We need the char-misc fixes in here as well.
Unified · Split
| @@ -41,10 +41,11 @@ Related CVEs · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | The following CVE entries describe Spectre variants: |
| 43 | 43 | |
| 44 | − ============= ======================= ================= | |
| 44 | + ============= ======================= ========================== | |
| 45 | 45 | CVE-2017-5753 Bounds check bypass Spectre variant 1 |
| 46 | 46 | CVE-2017-5715 Branch target injection Spectre variant 2 |
| 47 | − ============= ======================= ================= | |
| 47 | + CVE-2019-1125 Spectre v1 swapgs Spectre variant 1 (swapgs) | |
| 48 | + ============= ======================= ========================== | |
| 48 | 49 | |
| 49 | 50 | Problem |
| 50 | 51 | ------- |
| @@ -78,6 +79,13 @@ There are some extensions of Spectre variant 1 attacks for reading data · 27 unmodified lines | ||
| 78 | 79 | over the network, see :ref:`[12] <spec_ref12>`. However such attacks |
| 79 | 80 | are difficult, low bandwidth, fragile, and are considered low risk. |
| 80 | 81 | |
| 82 | +Note that, despite "Bounds Check Bypass" name, Spectre variant 1 is not | |
| 83 | +only about user-controlled array bounds checks. It can affect any | |
| 84 | +conditional checks. The kernel entry code interrupt, exception, and NMI | |
| 85 | +handlers all have conditional swapgs checks. Those may be problematic | |
| 86 | +in the context of Spectre v1, as kernel code can speculatively run with | |
| 87 | +a user GS. | |
| 88 | + | |
| 81 | 89 | Spectre variant 2 (Branch Target Injection) |
| 82 | 90 | ------------------------------------------- |
| 83 | 91 | |
| @@ -132,6 +140,9 @@ not cover all possible attack vectors. · 48 unmodified lines | ||
| 132 | 140 | 1. A user process attacking the kernel |
| 133 | 141 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 134 | 142 | |
| 143 | +Spectre variant 1 | |
| 144 | +~~~~~~~~~~~~~~~~~ | |
| 145 | + | |
| 135 | 146 | The attacker passes a parameter to the kernel via a register or |
| 136 | 147 | via a known address in memory during a syscall. Such parameter may |
| 137 | 148 | be used later by the kernel as an index to an array or to derive |
| @@ -144,7 +155,40 @@ not cover all possible attack vectors. · 6 unmodified lines | ||
| 144 | 155 | potentially be influenced for Spectre attacks, new "nospec" accessor |
| 145 | 156 | macros are used to prevent speculative loading of data. |
| 146 | 157 | |
| 147 | − Spectre variant 2 attacker can :ref:`poison <poison_btb>` the branch | |
| 158 | +Spectre variant 1 (swapgs) | |
| 159 | +~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 160 | + | |
| 161 | + An attacker can train the branch predictor to speculatively skip the | |
| 162 | + swapgs path for an interrupt or exception. If they initialize | |
| 163 | + the GS register to a user-space value, if the swapgs is speculatively | |
| 164 | + skipped, subsequent GS-related percpu accesses in the speculation | |
| 165 | + window will be done with the attacker-controlled GS value. This | |
| 166 | + could cause privileged memory to be accessed and leaked. | |
| 167 | + | |
| 168 | + For example: | |
| 169 | + | |
| 170 | + :: | |
| 171 | + | |
| 172 | + if (coming from user space) | |
| 173 | + swapgs | |
| 174 | + mov %gs:<percpu_offset>, %reg | |
| 175 | + mov (%reg), %reg1 | |
| 176 | + | |
| 177 | + When coming from user space, the CPU can speculatively skip the | |
| 178 | + swapgs, and then do a speculative percpu load using the user GS | |
| 179 | + value. So the user can speculatively force a read of any kernel | |
| 180 | + value. If a gadget exists which uses the percpu value as an address | |
| 181 | + in another load/store, then the contents of the kernel value may | |
| 182 | + become visible via an L1 side channel attack. | |
| 183 | + | |
| 184 | + A similar attack exists when coming from kernel space. The CPU can | |
| 185 | + speculatively do the swapgs, causing the user GS to get used for the | |
| 186 | + rest of the speculative window. | |
| 187 | + | |
| 188 | +Spectre variant 2 | |
| 189 | +~~~~~~~~~~~~~~~~~ | |
| 190 | + | |
| 191 | + A spectre variant 2 attacker can :ref:`poison <poison_btb>` the branch | |
| 148 | 192 | target buffer (BTB) before issuing syscall to launch an attack. |
| 149 | 193 | After entering the kernel, the kernel could use the poisoned branch |
| 150 | 194 | target buffer on indirect jump and jump to gadget code in speculative |
| @@ -280,11 +324,18 @@ The sysfs file showing Spectre variant 1 mitigation status is: · 129 unmodified lines | ||
| 280 | 324 | |
| 281 | 325 | The possible values in this file are: |
| 282 | 326 | |
| 283 | − ======================================= ================================= | |
| 284 | − 'Mitigation: __user pointer sanitation' Protection in kernel on a case by | |
| 285 | − case base with explicit pointer | |
| 286 | − sanitation. | |
| 287 | − ======================================= ================================= | |
| 327 | + .. list-table:: | |
| 328 | + | |
| 329 | + * - 'Not affected' | |
| 330 | + - The processor is not vulnerable. | |
| 331 | + * - 'Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers' | |
| 332 | + - The swapgs protections are disabled; otherwise it has | |
| 333 | + protection in the kernel on a case by case base with explicit | |
| 334 | + pointer sanitation and usercopy LFENCE barriers. | |
| 335 | + * - 'Mitigation: usercopy/swapgs barriers and __user pointer sanitization' | |
| 336 | + - Protection in the kernel on a case by case base with explicit | |
| 337 | + pointer sanitation, usercopy LFENCE barriers, and swapgs LFENCE | |
| 338 | + barriers. | |
| 288 | 339 | |
| 289 | 340 | However, the protections are put in place on a case by case basis, |
| 290 | 341 | and there is no guarantee that all possible attack vectors for Spectre |
| @@ -366,12 +417,27 @@ Turning on mitigation for Spectre variant 1 and Spectre variant 2 · 75 unmodified lines | ||
| 366 | 417 | 1. Kernel mitigation |
| 367 | 418 | ^^^^^^^^^^^^^^^^^^^^ |
| 368 | 419 | |
| 420 | +Spectre variant 1 | |
| 421 | +~~~~~~~~~~~~~~~~~ | |
| 422 | + | |
| 369 | 423 | For the Spectre variant 1, vulnerable kernel code (as determined |
| 370 | 424 | by code audit or scanning tools) is annotated on a case by case |
| 371 | 425 | basis to use nospec accessor macros for bounds clipping :ref:`[2] |
| 372 | 426 | <spec_ref2>` to avoid any usable disclosure gadgets. However, it may |
| 373 | 427 | not cover all attack vectors for Spectre variant 1. |
| 374 | 428 | |
| 429 | + Copy-from-user code has an LFENCE barrier to prevent the access_ok() | |
| 430 | + check from being mis-speculated. The barrier is done by the | |
| 431 | + barrier_nospec() macro. | |
| 432 | + | |
| 433 | + For the swapgs variant of Spectre variant 1, LFENCE barriers are | |
| 434 | + added to interrupt, exception and NMI entry where needed. These | |
| 435 | + barriers are done by the FENCE_SWAPGS_KERNEL_ENTRY and | |
| 436 | + FENCE_SWAPGS_USER_ENTRY macros. | |
| 437 | + | |
| 438 | +Spectre variant 2 | |
| 439 | +~~~~~~~~~~~~~~~~~ | |
| 440 | + | |
| 375 | 441 | For Spectre variant 2 mitigation, the compiler turns indirect calls or |
| 376 | 442 | jumps in the kernel into equivalent return trampolines (retpolines) |
| 377 | 443 | :ref:`[3] <spec_ref3>` :ref:`[9] <spec_ref9>` to go to the target |
| @@ -473,6 +539,12 @@ Mitigation control on the kernel command line · 95 unmodified lines | ||
| 473 | 539 | Spectre variant 2 mitigation can be disabled or force enabled at the |
| 474 | 540 | kernel command line. |
| 475 | 541 | |
| 542 | + nospectre_v1 | |
| 543 | + | |
| 544 | + [X86,PPC] Disable mitigations for Spectre Variant 1 | |
| 545 | + (bounds check bypass). With this option data leaks are | |
| 546 | + possible in the system. | |
| 547 | + | |
| 476 | 548 | nospectre_v2 |
| 477 | 549 | |
| 478 | 550 | [X86] Disable all mitigations for the Spectre variant 2 |
| @@ -2604,7 +2604,7 @@ · 2603 unmodified lines | ||
| 2604 | 2604 | expose users to several CPU vulnerabilities. |
| 2605 | 2605 | Equivalent to: nopti [X86,PPC] |
| 2606 | 2606 | kpti=0 [ARM64] |
| 2607 | − nospectre_v1 [PPC] | |
| 2607 | + nospectre_v1 [X86,PPC] | |
| 2608 | 2608 | nobp=0 [S390] |
| 2609 | 2609 | nospectre_v2 [X86,PPC,S390,ARM64] |
| 2610 | 2610 | spectre_v2_user=off [X86] |
| @@ -2965,9 +2965,9 @@ · 354 unmodified lines | ||
| 2965 | 2965 | nosmt=force: Force disable SMT, cannot be undone |
| 2966 | 2966 | via the sysfs control file. |
| 2967 | 2967 | |
| 2968 | − nospectre_v1 [PPC] Disable mitigations for Spectre Variant 1 (bounds | |
| 2969 | − check bypass). With this option data leaks are possible | |
| 2970 | − in the system. | |
| 2968 | + nospectre_v1 [X86,PPC] Disable mitigations for Spectre Variant 1 | |
| 2969 | + (bounds check bypass). With this option data leaks are | |
| 2970 | + possible in the system. | |
| 2971 | 2971 | |
| 2972 | 2972 | nospectre_v2 [X86,PPC_FSL_BOOK3E,ARM64] Disable all mitigations for |
| 2973 | 2973 | the Spectre variant 2 (indirect branch prediction) |
| @@ -1,162 +0,0 @@ | ||
| 1 | −=================== | |
| 2 | −RISC-V CPU Bindings | |
| 3 | −=================== | |
| 4 | − | |
| 5 | −The device tree allows to describe the layout of CPUs in a system through | |
| 6 | −the "cpus" node, which in turn contains a number of subnodes (ie "cpu") | |
| 7 | −defining properties for every cpu. | |
| 8 | − | |
| 9 | −Bindings for CPU nodes follow the Devicetree Specification, available from: | |
| 10 | − | |
| 11 | −https://www.devicetree.org/specifications/ | |
| 12 | − | |
| 13 | −with updates for 32-bit and 64-bit RISC-V systems provided in this document. | |
| 14 | − | |
| 15 | −=========== | |
| 16 | −Terminology | |
| 17 | −=========== | |
| 18 | − | |
| 19 | −This document uses some terminology common to the RISC-V community that is not | |
| 20 | −widely used, the definitions of which are listed here: | |
| 21 | − | |
| 22 | −* hart: A hardware execution context, which contains all the state mandated by | |
| 23 | − the RISC-V ISA: a PC and some registers. This terminology is designed to | |
| 24 | − disambiguate software's view of execution contexts from any particular | |
| 25 | − microarchitectural implementation strategy. For example, my Intel laptop is | |
| 26 | − described as having one socket with two cores, each of which has two hyper | |
| 27 | − threads. Therefore this system has four harts. | |
| 28 | − | |
| 29 | −===================================== | |
| 30 | −cpus and cpu node bindings definition | |
| 31 | −===================================== | |
| 32 | − | |
| 33 | −The RISC-V architecture, in accordance with the Devicetree Specification, | |
| 34 | −requires the cpus and cpu nodes to be present and contain the properties | |
| 35 | −described below. | |
| 36 | − | |
| 37 | −- cpus node | |
| 38 | − | |
| 39 | − Description: Container of cpu nodes | |
| 40 | − | |
| 41 | − The node name must be "cpus". | |
| 42 | − | |
| 43 | − A cpus node must define the following properties: | |
| 44 | − | |
| 45 | − - #address-cells | |
| 46 | − Usage: required | |
| 47 | − Value type: <u32> | |
| 48 | − Definition: must be set to 1 | |
| 49 | − - #size-cells | |
| 50 | − Usage: required | |
| 51 | − Value type: <u32> | |
| 52 | − Definition: must be set to 0 | |
| 53 | − | |
| 54 | −- cpu node | |
| 55 | − | |
| 56 | − Description: Describes a hart context | |
| 57 | − | |
| 58 | − PROPERTIES | |
| 59 | − | |
| 60 | − - device_type | |
| 61 | − Usage: required | |
| 62 | − Value type: <string> | |
| 63 | − Definition: must be "cpu" | |
| 64 | − - reg | |
| 65 | − Usage: required | |
| 66 | − Value type: <u32> | |
| 67 | − Definition: The hart ID of this CPU node | |
| 68 | − - compatible: | |
| 69 | − Usage: required | |
| 70 | − Value type: <stringlist> | |
| 71 | − Definition: must contain "riscv", may contain one of | |
| 72 | − "sifive,rocket0" | |
| 73 | − - mmu-type: | |
| 74 | − Usage: optional | |
| 75 | − Value type: <string> | |
| 76 | − Definition: Specifies the CPU's MMU type. Possible values are | |
| 77 | − "riscv,sv32" | |
| 78 | − "riscv,sv39" | |
| 79 | − "riscv,sv48" | |
| 80 | − - riscv,isa: | |
| 81 | − Usage: required | |
| 82 | − Value type: <string> | |
| 83 | − Definition: Contains the RISC-V ISA string of this hart. These | |
| 84 | − ISA strings are defined by the RISC-V ISA manual. | |
| 85 | − | |
| 86 | −Example: SiFive Freedom U540G Development Kit | |
| 87 | −--------------------------------------------- | |
| 88 | − | |
| 89 | −This system contains two harts: a hart marked as disabled that's used for | |
| 90 | −low-level system tasks and should be ignored by Linux, and a second hart that | |
| 91 | −Linux is allowed to run on. | |
| 92 | − | |
| 93 | − cpus { | |
| 94 | − #address-cells = <1>; | |
| 95 | − #size-cells = <0>; | |
| 96 | − timebase-frequency = <1000000>; | |
| 97 | − cpu@0 { | |
| 98 | − clock-frequency = <1600000000>; | |
| 99 | − compatible = "sifive,rocket0", "riscv"; | |
| 100 | − device_type = "cpu"; | |
| 101 | − i-cache-block-size = <64>; | |
| 102 | − i-cache-sets = <128>; | |
| 103 | − i-cache-size = <16384>; | |
| 104 | − next-level-cache = <&L15 &L0>; | |
| 105 | − reg = <0>; | |
| 106 | − riscv,isa = "rv64imac"; | |
| 107 | − status = "disabled"; | |
| 108 | − L10: interrupt-controller { | |
| 109 | − #interrupt-cells = <1>; | |
| 110 | − compatible = "riscv,cpu-intc"; | |
| 111 | − interrupt-controller; | |
| 112 | − }; | |
| 113 | − }; | |
| 114 | − cpu@1 { | |
| 115 | − clock-frequency = <1600000000>; | |
| 116 | − compatible = "sifive,rocket0", "riscv"; | |
| 117 | − d-cache-block-size = <64>; | |
| 118 | − d-cache-sets = <64>; | |
| 119 | − d-cache-size = <32768>; | |
| 120 | − d-tlb-sets = <1>; | |
| 121 | − d-tlb-size = <32>; | |
| 122 | − device_type = "cpu"; | |
| 123 | − i-cache-block-size = <64>; | |
| 124 | − i-cache-sets = <64>; | |
| 125 | − i-cache-size = <32768>; | |
| 126 | − i-tlb-sets = <1>; | |
| 127 | − i-tlb-size = <32>; | |
| 128 | − mmu-type = "riscv,sv39"; | |
| 129 | − next-level-cache = <&L15 &L0>; | |
| 130 | − reg = <1>; | |
| 131 | − riscv,isa = "rv64imafdc"; | |
| 132 | − status = "okay"; | |
| 133 | − tlb-split; | |
| 134 | − L13: interrupt-controller { | |
| 135 | − #interrupt-cells = <1>; | |
| 136 | − compatible = "riscv,cpu-intc"; | |
| 137 | − interrupt-controller; | |
| 138 | − }; | |
| 139 | − }; | |
| 140 | − }; | |
| 141 | − | |
| 142 | −Example: Spike ISA Simulator with 1 Hart | |
| 143 | −---------------------------------------- | |
| 144 | − | |
| 145 | −This device tree matches the Spike ISA golden model as run with `spike -p1`. | |
| 146 | − | |
| 147 | − cpus { | |
| 148 | − cpu@0 { | |
| 149 | − device_type = "cpu"; | |
| 150 | − reg = <0x00000000>; | |
| 151 | − status = "okay"; | |
| 152 | − compatible = "riscv"; | |
| 153 | − riscv,isa = "rv64imafdc"; | |
| 154 | − mmu-type = "riscv,sv48"; | |
| 155 | − clock-frequency = <0x3b9aca00>; | |
| 156 | − interrupt-controller { | |
| 157 | − #interrupt-cells = <0x00000001>; | |
| 158 | − interrupt-controller; | |
| 159 | − compatible = "riscv,cpu-intc"; | |
| 160 | − } | |
| 161 | − } | |
| 162 | − } | |
| @@ -10,6 +10,18 @@ maintainers: · 9 unmodified lines | ||
| 10 | 10 | - Paul Walmsley <paul.walmsley@sifive.com> |
| 11 | 11 | - Palmer Dabbelt <palmer@sifive.com> |
| 12 | 12 | |
| 13 | +description: | | |
| 14 | + This document uses some terminology common to the RISC-V community | |
| 15 | + that is not widely used, the definitions of which are listed here: | |
| 16 | + | |
| 17 | + hart: A hardware execution context, which contains all the state | |
| 18 | + mandated by the RISC-V ISA: a PC and some registers. This | |
| 19 | + terminology is designed to disambiguate software's view of execution | |
| 20 | + contexts from any particular microarchitectural implementation | |
| 21 | + strategy. For example, an Intel laptop containing one socket with | |
| 22 | + two cores, each of which has two hyperthreads, could be described as | |
| 23 | + having four harts. | |
| 24 | + | |
| 13 | 25 | properties: |
| 14 | 26 | compatible: |
| 15 | 27 | items: |
| @@ -50,6 +62,10 @@ properties: · 34 unmodified lines | ||
| 50 | 62 | User-Level ISA document, available from |
| 51 | 63 | https://riscv.org/specifications/ |
| 52 | 64 | |
| 65 | + While the isa strings in ISA specification are case | |
| 66 | + insensitive, letters in the riscv,isa string must be all | |
| 67 | + lowercase to simplify parsing. | |
| 68 | + | |
| 53 | 69 | timebase-frequency: |
| 54 | 70 | type: integer |
| 55 | 71 | minimum: 1 |
| @@ -19,7 +19,7 @@ properties: · 18 unmodified lines | ||
| 19 | 19 | compatible: |
| 20 | 20 | items: |
| 21 | 21 | - enum: |
| 22 | − - sifive,freedom-unleashed-a00 | |
| 22 | + - sifive,hifive-unleashed-a00 | |
| 23 | 23 | - const: sifive,fu540-c000 |
| 24 | 24 | - const: sifive,fu540 |
| 25 | 25 | ... |
| @@ -73,7 +73,6 @@ patternProperties: · 72 unmodified lines | ||
| 73 | 73 | Compatible of the SPI device. |
| 74 | 74 | |
| 75 | 75 | reg: |
| 76 | − maxItems: 1 | |
| 77 | 76 | minimum: 0 |
| 78 | 77 | maximum: 256 |
| 79 | 78 | description: |
| @@ -13,7 +13,8 @@ a) SMB3 (and SMB3.1.1) missing optional features: · 12 unmodified lines | ||
| 13 | 13 | - T10 copy offload ie "ODX" (copy chunk, and "Duplicate Extents" ioctl |
| 14 | 14 | currently the only two server side copy mechanisms supported) |
| 15 | 15 | |
| 16 | −b) improved sparse file support | |
| 16 | +b) improved sparse file support (fiemap and SEEK_HOLE are implemented | |
| 17 | +but additional features would be supportable by the protocol). | |
| 17 | 18 | |
| 18 | 19 | c) Directory entry caching relies on a 1 second timer, rather than |
| 19 | 20 | using Directory Leases, currently only the root file handle is cached longer |
| @@ -21,9 +22,13 @@ using Directory Leases, currently only the root file handle is cached longer · 1 unmodified line | ||
| 21 | 22 | d) quota support (needs minor kernel change since quota calls |
| 22 | 23 | to make it to network filesystems or deviceless filesystems) |
| 23 | 24 | |
| 24 | −e) Additional use cases where we use "compoounding" (e.g. open/query/close | |
| 25 | −and open/setinfo/close) to reduce the number of roundtrips, and also | |
| 26 | −open to reduce redundant opens (using deferred close and reference counts more). | |
| 25 | +e) Additional use cases can be optimized to use "compounding" | |
| 26 | +(e.g. open/query/close and open/setinfo/close) to reduce the number | |
| 27 | +of roundtrips to the server and improve performance. Various cases | |
| 28 | +(stat, statfs, create, unlink, mkdir) already have been improved by | |
| 29 | +using compounding but more can be done. In addition we could significantly | |
| 30 | +reduce redundant opens by using deferred close (with handle caching leases) | |
| 31 | +and better using reference counters on file handles. | |
| 27 | 32 | |
| 28 | 33 | f) Finish inotify support so kde and gnome file list windows |
| 29 | 34 | will autorefresh (partially complete by Asser). Needs minor kernel |
| @@ -43,18 +48,17 @@ mount or a per server basis to client UIDs or nobody if no mapping · 13 unmodified lines | ||
| 43 | 48 | exists. Also better integration with winbind for resolving SID owners |
| 44 | 49 | |
| 45 | 50 | k) Add tools to take advantage of more smb3 specific ioctls and features |
| 46 | −(passthrough ioctl/fsctl for sending various SMB3 fsctls to the server | |
| 47 | −is in progress, and a passthrough query_info call is already implemented | |
| 48 | −in cifs.ko to allow smb3 info levels queries to be sent from userspace) | |
| 51 | +(passthrough ioctl/fsctl is now implemented in cifs.ko to allow sending | |
| 52 | +various SMB3 fsctls and query info and set info calls directly from user space) | |
| 53 | +Add tools to make setting various non-POSIX metadata attributes easier | |
| 54 | +from tools (e.g. extending what was done in smb-info tool). | |
| 49 | 55 | |
| 50 | 56 | l) encrypted file support |
| 51 | 57 | |
| 52 | 58 | m) improved stats gathering tools (perhaps integration with nfsometer?) |
| 53 | 59 | to extend and make easier to use what is currently in /proc/fs/cifs/Stats |
| 54 | 60 | |
| 55 | −n) allow setting more NTFS/SMB3 file attributes remotely (currently limited to compressed | |
| 56 | −file attribute via chflags) and improve user space tools for managing and | |
| 57 | −viewing them. | |
| 61 | +n) Add support for claims based ACLs ("DAC") | |
| 58 | 62 | |
| 59 | 63 | o) mount helper GUI (to simplify the various configuration options on mount) |
| 60 | 64 | |
| @@ -82,6 +86,8 @@ so far). · 21 unmodified lines | ||
| 82 | 86 | w) Add support for additional strong encryption types, and additional spnego |
| 83 | 87 | authentication mechanisms (see MS-SMB2) |
| 84 | 88 | |
| 89 | +x) Finish support for SMB3.1.1 compression | |
| 90 | + | |
| 85 | 91 | KNOWN BUGS |
| 86 | 92 | ==================================== |
| 87 | 93 | See http://bugzilla.samba.org - search on product "CifsVFS" for |
| @@ -424,13 +424,24 @@ Statistics · 423 unmodified lines | ||
| 424 | 424 | Following minimum set of TLS-related statistics should be reported |
| 425 | 425 | by the driver: |
| 426 | 426 | |
| 427 | − * ``rx_tls_decrypted`` - number of successfully decrypted TLS segments | |
| 428 | − * ``tx_tls_encrypted`` - number of in-order TLS segments passed to device | |
| 429 | − for encryption | |
| 427 | + * ``rx_tls_decrypted_packets`` - number of successfully decrypted RX packets | |
| 428 | + which were part of a TLS stream. | |
| 429 | + * ``rx_tls_decrypted_bytes`` - number of TLS payload bytes in RX packets | |
| 430 | + which were successfully decrypted. | |
| 431 | + * ``tx_tls_encrypted_packets`` - number of TX packets passed to the device | |
| 432 | + for encryption of their TLS payload. | |
| 433 | + * ``tx_tls_encrypted_bytes`` - number of TLS payload bytes in TX packets | |
| 434 | + passed to the device for encryption. | |
| 435 | + * ``tx_tls_ctx`` - number of TLS TX HW offload contexts added to device for | |
| 436 | + encryption. | |
| 430 | 437 | * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream |
| 431 | − but did not arrive in the expected order | |
| 432 | − * ``tx_tls_drop_no_sync_data`` - number of TX packets dropped because | |
| 433 | − they arrived out of order and associated record could not be found | |
| 438 | + but did not arrive in the expected order. | |
| 439 | + * ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of | |
| 440 | + a TLS stream dropped, because they arrived out of order and associated | |
| 441 | + record could not be found. | |
| 442 | + * ``tx_tls_drop_bypass_req`` - number of TX packets which were part of a TLS | |
| 443 | + stream dropped, because they contain both data that has been encrypted by | |
| 444 | + software and data that expects hardware crypto offload. | |
| 434 | 445 | |
| 435 | 446 | Notable corner cases, exceptions and additional requirements |
| 436 | 447 | ============================================================ |
| @@ -237,7 +237,7 @@ The usage pattern is:: · 236 unmodified lines | ||
| 237 | 237 | ret = hmm_range_snapshot(&range); |
| 238 | 238 | if (ret) { |
| 239 | 239 | up_read(&mm->mmap_sem); |
| 240 | − if (ret == -EAGAIN) { | |
| 240 | + if (ret == -EBUSY) { | |
| 241 | 241 | /* |
| 242 | 242 | * No need to check hmm_range_wait_until_valid() return value |
| 243 | 243 | * on retry we will get proper error with hmm_range_snapshot() |
| @@ -2155,10 +2155,12 @@ F: Documentation/devicetree/bindings/arm/realtek.txt · 2154 unmodified lines | ||
| 2155 | 2155 | |
| 2156 | 2156 | ARM/RENESAS ARM64 ARCHITECTURE |
| 2157 | 2157 | M: Simon Horman <horms@verge.net.au> |
| 2158 | +M: Geert Uytterhoeven <geert+renesas@glider.be> | |
| 2158 | 2159 | M: Magnus Damm <magnus.damm@gmail.com> |
| 2159 | 2160 | L: linux-renesas-soc@vger.kernel.org |
| 2160 | 2161 | Q: http://patchwork.kernel.org/project/linux-renesas-soc/list/ |
| 2161 | 2162 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next |
| 2163 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next | |
| 2162 | 2164 | S: Supported |
| 2163 | 2165 | F: arch/arm64/boot/dts/renesas/ |
| 2164 | 2166 | F: Documentation/devicetree/bindings/arm/renesas.yaml |
| @@ -2269,10 +2271,12 @@ F: drivers/media/platform/s5p-mfc/ · 104 unmodified lines | ||
| 2269 | 2271 | |
| 2270 | 2272 | ARM/SHMOBILE ARM ARCHITECTURE |
| 2271 | 2273 | M: Simon Horman <horms@verge.net.au> |
| 2274 | +M: Geert Uytterhoeven <geert+renesas@glider.be> | |
| 2272 | 2275 | M: Magnus Damm <magnus.damm@gmail.com> |
| 2273 | 2276 | L: linux-renesas-soc@vger.kernel.org |
| 2274 | 2277 | Q: http://patchwork.kernel.org/project/linux-renesas-soc/list/ |
| 2275 | 2278 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next |
| 2279 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next | |
| 2276 | 2280 | S: Supported |
| 2277 | 2281 | F: arch/arm/boot/dts/emev2* |
| 2278 | 2282 | F: arch/arm/boot/dts/gr-peach* |
| @@ -6322,7 +6326,8 @@ F: Documentation/devicetree/bindings/counter/ftm-quaddec.txt · 4043 unmodified lines | ||
| 6322 | 6326 | F: drivers/counter/ftm-quaddec.c |
| 6323 | 6327 | |
| 6324 | 6328 | FLOPPY DRIVER |
| 6325 | −S: Orphan | |
| 6329 | +M: Denis Efremov <efremov@linux.com> | |
| 6330 | +S: Odd Fixes | |
| 6326 | 6331 | L: linux-block@vger.kernel.org |
| 6327 | 6332 | F: drivers/block/floppy.c |
| 6328 | 6333 | |
| @@ -6339,7 +6344,7 @@ FPGA MANAGER FRAMEWORK · 10 unmodified lines | ||
| 6339 | 6344 | M: Moritz Fischer <mdf@kernel.org> |
| 6340 | 6345 | L: linux-fpga@vger.kernel.org |
| 6341 | 6346 | S: Maintained |
| 6342 | −T: git git://git.kernel.org/pub/scm/linux/kernel/git/atull/linux-fpga.git | |
| 6347 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux-fpga.git | |
| 6343 | 6348 | Q: http://patchwork.kernel.org/project/linux-fpga/list/ |
| 6344 | 6349 | F: Documentation/fpga/ |
| 6345 | 6350 | F: Documentation/driver-api/fpga/ |
| @@ -6372,7 +6377,7 @@ FRAMEBUFFER LAYER · 26 unmodified lines | ||
| 6372 | 6377 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> |
| 6373 | 6378 | L: dri-devel@lists.freedesktop.org |
| 6374 | 6379 | L: linux-fbdev@vger.kernel.org |
| 6375 | −T: git git://github.com/bzolnier/linux.git | |
| 6380 | +T: git git://anongit.freedesktop.org/drm/drm-misc | |
| 6376 | 6381 | Q: http://patchwork.kernel.org/project/linux-fbdev/list/ |
| 6377 | 6382 | S: Maintained |
| 6378 | 6383 | F: Documentation/fb/ |
| @@ -6822,13 +6827,6 @@ F: Documentation/filesystems/gfs2*.txt · 443 unmodified lines | ||
| 6822 | 6827 | F: fs/gfs2/ |
| 6823 | 6828 | F: include/uapi/linux/gfs2_ondisk.h |
| 6824 | 6829 | |
| 6825 | −GIGASET ISDN DRIVERS | |
| 6826 | −M: Paul Bolle <pebolle@tiscali.nl> | |
| 6827 | −L: gigaset307x-common@lists.sourceforge.net | |
| 6828 | −W: http://gigaset307x.sourceforge.net/ | |
| 6829 | −S: Odd Fixes | |
| 6830 | −F: drivers/staging/isdn/gigaset/ | |
| 6831 | − | |
| 6832 | 6830 | GNSS SUBSYSTEM |
| 6833 | 6831 | M: Johan Hovold <johan@kernel.org> |
| 6834 | 6832 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/johan/gnss.git |
| @@ -8044,6 +8042,7 @@ S: Maintained · 1209 unmodified lines | ||
| 8044 | 8042 | F: drivers/video/fbdev/i810/ |
| 8045 | 8043 | |
| 8046 | 8044 | INTEL ASoC DRIVERS |
| 8045 | +M: Cezary Rojewski <cezary.rojewski@intel.com> | |
| 8047 | 8046 | M: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
| 8048 | 8047 | M: Liam Girdwood <liam.r.girdwood@linux.intel.com> |
| 8049 | 8048 | M: Jie Yang <yang.jie@linux.intel.com> |
| @@ -11145,6 +11144,7 @@ L: netdev@vger.kernel.org · 3095 unmodified lines | ||
| 11145 | 11144 | S: Maintained |
| 11146 | 11145 | W: https://fedorahosted.org/dropwatch/ |
| 11147 | 11146 | F: net/core/drop_monitor.c |
| 11147 | +F: include/uapi/linux/net_dropmon.h | |
| 11148 | 11148 | |
| 11149 | 11149 | NETWORKING DRIVERS |
| 11150 | 11150 | M: "David S. Miller" <davem@davemloft.net> |
| @@ -11283,6 +11283,7 @@ M: Aviad Yehezkel <aviadye@mellanox.com> · 132 unmodified lines | ||
| 11283 | 11283 | M: Dave Watson <davejwatson@fb.com> |
| 11284 | 11284 | M: John Fastabend <john.fastabend@gmail.com> |
| 11285 | 11285 | M: Daniel Borkmann <daniel@iogearbox.net> |
| 11286 | +M: Jakub Kicinski <jakub.kicinski@netronome.com> | |
| 11286 | 11287 | L: netdev@vger.kernel.org |
| 11287 | 11288 | S: Maintained |
| 11288 | 11289 | F: net/tls/* |
| @@ -14017,6 +14018,12 @@ F: drivers/media/common/saa7146/ · 2728 unmodified lines | ||
| 14017 | 14018 | F: drivers/media/pci/saa7146/ |
| 14018 | 14019 | F: include/media/drv-intf/saa7146* |
| 14019 | 14020 | |
| 14021 | +SAFESETID SECURITY MODULE | |
| 14022 | +M: Micah Morton <mortonm@chromium.org> | |
| 14023 | +S: Supported | |
| 14024 | +F: security/safesetid/ | |
| 14025 | +F: Documentation/admin-guide/LSM/SafeSetID.rst | |
| 14026 | + | |
| 14020 | 14027 | SAMSUNG AUDIO (ASoC) DRIVERS |
| 14021 | 14028 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 14022 | 14029 | M: Sangbeom Kim <sbkim73@samsung.com> |
| @@ -16079,7 +16086,7 @@ S: Maintained · 2056 unmodified lines | ||
| 16079 | 16086 | F: drivers/net/ethernet/ti/netcp* |
| 16080 | 16087 | |
| 16081 | 16088 | TI PCM3060 ASoC CODEC DRIVER |
| 16082 | −M: Kirill Marinushkin <kmarinushkin@birdec.tech> | |
| 16089 | +M: Kirill Marinushkin <kmarinushkin@birdec.com> | |
| 16083 | 16090 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| 16084 | 16091 | S: Maintained |
| 16085 | 16092 | F: Documentation/devicetree/bindings/sound/pcm3060.txt |
| @@ -17555,7 +17562,6 @@ M: Jakub Kicinski <jakub.kicinski@netronome.com> · 1469 unmodified lines | ||
| 17555 | 17562 | M: Jesper Dangaard Brouer <hawk@kernel.org> |
| 17556 | 17563 | M: John Fastabend <john.fastabend@gmail.com> |
| 17557 | 17564 | L: netdev@vger.kernel.org |
| 17558 | −L: xdp-newbies@vger.kernel.org | |
| 17559 | 17565 | L: bpf@vger.kernel.org |
| 17560 | 17566 | S: Supported |
| 17561 | 17567 | F: net/core/xdp.c |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 3 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc2 | |
| 5 | +EXTRAVERSION = -rc4 | |
| 6 | 6 | NAME = Bobtail Squid |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| @@ -419,6 +419,7 @@ NM = $(CROSS_COMPILE)nm · 410 unmodified lines | ||
| 419 | 419 | STRIP = $(CROSS_COMPILE)strip |
| 420 | 420 | OBJCOPY = $(CROSS_COMPILE)objcopy |
| 421 | 421 | OBJDUMP = $(CROSS_COMPILE)objdump |
| 422 | +OBJSIZE = $(CROSS_COMPILE)size | |
| 422 | 423 | PAHOLE = pahole |
| 423 | 424 | LEX = flex |
| 424 | 425 | YACC = bison |
| @@ -472,11 +473,12 @@ KBUILD_CFLAGS_MODULE := -DMODULE · 47 unmodified lines | ||
| 472 | 473 | KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds |
| 473 | 474 | KBUILD_LDFLAGS := |
| 474 | 475 | GCC_PLUGINS_CFLAGS := |
| 476 | +CLANG_FLAGS := | |
| 475 | 477 | |
| 476 | 478 | export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC |
| 477 | −export CPP AR NM STRIP OBJCOPY OBJDUMP PAHOLE KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS | |
| 478 | −export MAKE LEX YACC AWK INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE | |
| 479 | −export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | |
| 479 | +export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE PAHOLE LEX YACC AWK INSTALLKERNEL | |
| 480 | +export PERL PYTHON PYTHON2 PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX | |
| 481 | +export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE | |
| 480 | 482 | |
| 481 | 483 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS |
| 482 | 484 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE |
| @@ -519,7 +521,7 @@ endif · 36 unmodified lines | ||
| 519 | 521 | |
| 520 | 522 | ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) |
| 521 | 523 | ifneq ($(CROSS_COMPILE),) |
| 522 | −CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) | |
| 524 | +CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) | |
| 523 | 525 | GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) |
| 524 | 526 | CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) |
| 525 | 527 | GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) |
| @@ -844,7 +846,7 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) · 318 unmodified lines | ||
| 844 | 846 | KBUILD_CFLAGS += -Wdeclaration-after-statement |
| 845 | 847 | |
| 846 | 848 | # Warn about unmarked fall-throughs in switch statement. |
| 847 | −KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough=3,) | |
| 849 | +KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,) | |
| 848 | 850 | |
| 849 | 851 | # Variable Length Arrays (VLAs) should not be used anywhere in the kernel |
| 850 | 852 | KBUILD_CFLAGS += -Wvla |
| @@ -1001,6 +1003,8 @@ endif · 150 unmodified lines | ||
| 1001 | 1003 | |
| 1002 | 1004 | PHONY += prepare0 |
| 1003 | 1005 | |
| 1006 | +export MODORDER := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order | |
| 1007 | + | |
| 1004 | 1008 | ifeq ($(KBUILD_EXTMOD),) |
| 1005 | 1009 | core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ |
| 1006 | 1010 | |
| @@ -1770,13 +1774,22 @@ build-dir = $(patsubst %/,%,$(dir $(build-target))) · 763 unmodified lines | ||
| 1770 | 1774 | $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) |
| 1771 | 1775 | %.symtypes: prepare FORCE |
| 1772 | 1776 | $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) |
| 1777 | +ifeq ($(KBUILD_EXTMOD),) | |
| 1778 | +# For the single build of an in-tree module, use a temporary file to avoid | |
| 1779 | +# the situation of modules_install installing an invalid modules.order. | |
| 1780 | +%.ko: MODORDER := .modules.tmp | |
| 1781 | +endif | |
| 1782 | +%.ko: prepare FORCE | |
| 1783 | + $(Q)$(MAKE) $(build)=$(build-dir) $(build-target:.ko=.mod) | |
| 1784 | + $(Q)echo $(build-target) > $(MODORDER) | |
| 1785 | + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | |
| 1773 | 1786 | |
| 1774 | 1787 | # Modules |
| 1775 | 1788 | PHONY += / |
| 1776 | 1789 | /: ./ |
| 1777 | 1790 | |
| 1778 | 1791 | %/: prepare FORCE |
| 1779 | − $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) | |
| 1792 | + $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) need-modorder=1 | |
| 1780 | 1793 | |
| 1781 | 1794 | # FIXME Should go into a make.lib or something |
| 1782 | 1795 | # =========================================================================== |
| @@ -18,7 +18,9 @@ extern const struct dma_map_ops arm_coherent_dma_ops; · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
| 20 | 20 | { |
| 21 | − return IS_ENABLED(CONFIG_MMU) ? &arm_dma_ops : NULL; | |
| 21 | + if (IS_ENABLED(CONFIG_MMU) && !IS_ENABLED(CONFIG_ARM_LPAE)) | |
| 22 | + return &arm_dma_ops; | |
| 23 | + return NULL; | |
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | #ifdef __arch_page_to_dma |
| @@ -544,6 +544,7 @@ static int arch_build_bp_info(struct perf_event *bp, · 543 unmodified lines | ||
| 544 | 544 | if ((hw->ctrl.type != ARM_BREAKPOINT_EXECUTE) |
| 545 | 545 | && max_watchpoint_len >= 8) |
| 546 | 546 | break; |
| 547 | + /* Else, fall through */ | |
| 547 | 548 | default: |
| 548 | 549 | return -EINVAL; |
| 549 | 550 | } |
| @@ -608,10 +609,12 @@ int hw_breakpoint_arch_parse(struct perf_event *bp, · 58 unmodified lines | ||
| 608 | 609 | /* Allow halfword watchpoints and breakpoints. */ |
| 609 | 610 | if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2) |
| 610 | 611 | break; |
| 612 | + /* Else, fall through */ | |
| 611 | 613 | case 3: |
| 612 | 614 | /* Allow single byte watchpoint. */ |
| 613 | 615 | if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1) |
| 614 | 616 | break; |
| 617 | + /* Else, fall through */ | |
| 615 | 618 | default: |
| 616 | 619 | ret = -EINVAL; |
| 617 | 620 | goto out; |
| @@ -861,6 +864,7 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr, · 243 unmodified lines | ||
| 861 | 864 | break; |
| 862 | 865 | case ARM_ENTRY_ASYNC_WATCHPOINT: |
| 863 | 866 | WARN(1, "Asynchronous watchpoint exception taken. Debugging results may be unreliable\n"); |
| 867 | + /* Fall through */ | |
| 864 | 868 | case ARM_ENTRY_SYNC_WATCHPOINT: |
| 865 | 869 | watchpoint_handler(addr, fsr, regs); |
| 866 | 870 | break; |
| @@ -909,6 +913,7 @@ static bool core_has_os_save_restore(void) · 42 unmodified lines | ||
| 909 | 913 | ARM_DBG_READ(c1, c1, 4, oslsr); |
| 910 | 914 | if (oslsr & ARM_OSLSR_OSLM0) |
| 911 | 915 | return true; |
| 916 | + /* Else, fall through */ | |
| 912 | 917 | default: |
| 913 | 918 | return false; |
| 914 | 919 | } |
| @@ -596,6 +596,7 @@ static int do_signal(struct pt_regs *regs, int syscall) · 595 unmodified lines | ||
| 596 | 596 | switch (retval) { |
| 597 | 597 | case -ERESTART_RESTARTBLOCK: |
| 598 | 598 | restart -= 2; |
| 599 | + /* Fall through */ | |
| 599 | 600 | case -ERESTARTNOHAND: |
| 600 | 601 | case -ERESTARTSYS: |
| 601 | 602 | case -ERESTARTNOINTR: |
| @@ -651,13 +651,22 @@ int kvm_handle_cp14_64(struct kvm_vcpu *vcpu, struct kvm_run *run) · 650 unmodified lines | ||
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | static void reset_coproc_regs(struct kvm_vcpu *vcpu, |
| 654 | − const struct coproc_reg *table, size_t num) | |
| 654 | + const struct coproc_reg *table, size_t num, | |
| 655 | + unsigned long *bmap) | |
| 655 | 656 | { |
| 656 | 657 | unsigned long i; |
| 657 | 658 | |
| 658 | 659 | for (i = 0; i < num; i++) |
| 659 | − if (table[i].reset) | |
| 660 | + if (table[i].reset) { | |
| 661 | + int reg = table[i].reg; | |
| 662 | + | |
| 660 | 663 | table[i].reset(vcpu, &table[i]); |
| 664 | + if (reg > 0 && reg < NR_CP15_REGS) { | |
| 665 | + set_bit(reg, bmap); | |
| 666 | + if (table[i].is_64bit) | |
| 667 | + set_bit(reg + 1, bmap); | |
| 668 | + } | |
| 669 | + } | |
| 661 | 670 | } |
| 662 | 671 | |
| 663 | 672 | static struct coproc_params decode_32bit_hsr(struct kvm_vcpu *vcpu) |
| @@ -1432,17 +1441,15 @@ void kvm_reset_coprocs(struct kvm_vcpu *vcpu) · 768 unmodified lines | ||
| 1432 | 1441 | { |
| 1433 | 1442 | size_t num; |
| 1434 | 1443 | const struct coproc_reg *table; |
| 1435 | − | |
| 1436 | − /* Catch someone adding a register without putting in reset entry. */ | |
| 1437 | − memset(vcpu->arch.ctxt.cp15, 0x42, sizeof(vcpu->arch.ctxt.cp15)); | |
| 1444 | + DECLARE_BITMAP(bmap, NR_CP15_REGS) = { 0, }; | |
| 1438 | 1445 | |
| 1439 | 1446 | /* Generic chip reset first (so target could override). */ |
| 1440 | − reset_coproc_regs(vcpu, cp15_regs, ARRAY_SIZE(cp15_regs)); | |
| 1447 | + reset_coproc_regs(vcpu, cp15_regs, ARRAY_SIZE(cp15_regs), bmap); | |
| 1441 | 1448 | |
| 1442 | 1449 | table = get_target_table(vcpu->arch.target, &num); |
| 1443 | − reset_coproc_regs(vcpu, table, num); | |
| 1450 | + reset_coproc_regs(vcpu, table, num, bmap); | |
| 1444 | 1451 | |
| 1445 | 1452 | for (num = 1; num < NR_CP15_REGS; num++) |
| 1446 | − WARN(vcpu_cp15(vcpu, num) == 0x42424242, | |
| 1453 | + WARN(!test_bit(num, bmap), | |
| 1447 | 1454 | "Didn't reset vcpu_cp15(vcpu, %zi)", num); |
| 1448 | 1455 | } |
| @@ -49,6 +49,7 @@ static int crunch_do(struct notifier_block *self, unsigned long cmd, void *t) · 48 unmodified lines | ||
| 49 | 49 | * FALLTHROUGH: Ensure we don't try to overwrite our newly |
| 50 | 50 | * initialised state information on the first fault. |
| 51 | 51 | */ |
| 52 | + /* Fall through */ | |
| 52 | 53 | |
| 53 | 54 | case THREAD_NOTIFY_EXIT: |
| 54 | 55 | crunch_task_release(thread); |
| @@ -70,7 +70,7 @@ static void __init tegra_cpu_reset_handler_enable(void) · 69 unmodified lines | ||
| 70 | 70 | switch (err) { |
| 71 | 71 | case -ENOSYS: |
| 72 | 72 | tegra_cpu_reset_handler_set(reset_address); |
| 73 | − /* pass-through */ | |
| 73 | + /* fall through */ | |
| 74 | 74 | case 0: |
| 75 | 75 | is_enabled = true; |
| 76 | 76 | break; |
| @@ -663,6 +663,11 @@ config ARM_LPAE · 662 unmodified lines | ||
| 663 | 663 | depends on MMU && CPU_32v7 && !CPU_32v6 && !CPU_32v5 && \ |
| 664 | 664 | !CPU_32v4 && !CPU_32v3 |
| 665 | 665 | select PHYS_ADDR_T_64BIT |
| 666 | + select SWIOTLB | |
| 667 | + select ARCH_HAS_DMA_COHERENT_TO_PFN | |
| 668 | + select ARCH_HAS_DMA_MMAP_PGPROT | |
| 669 | + select ARCH_HAS_SYNC_DMA_FOR_DEVICE | |
| 670 | + select ARCH_HAS_SYNC_DMA_FOR_CPU | |
| 666 | 671 | help |
| 667 | 672 | Say Y if you have an ARMv7 processor supporting the LPAE page |
| 668 | 673 | table format and you would like to access memory beyond the |
| @@ -695,7 +695,7 @@ thumb2arm(u16 tinstr) · 694 unmodified lines | ||
| 695 | 695 | return subset[(L<<1) | ((tinstr & (1<<8)) >> 8)] | |
| 696 | 696 | (tinstr & 255); /* register_list */ |
| 697 | 697 | } |
| 698 | − /* Else fall through for illegal instruction case */ | |
| 698 | + /* Else, fall through - for illegal instruction case */ | |
| 699 | 699 | |
| 700 | 700 | default: |
| 701 | 701 | return BAD_INSTR; |
| @@ -751,6 +751,8 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs, · 49 unmodified lines | ||
| 751 | 751 | case 0xe8e0: |
| 752 | 752 | case 0xe9e0: |
| 753 | 753 | poffset->un = (tinst2 & 0xff) << 2; |
| 754 | + /* Fall through */ | |
| 755 | + | |
| 754 | 756 | case 0xe940: |
| 755 | 757 | case 0xe9c0: |
| 756 | 758 | return do_alignment_ldrdstrd; |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/init.h> |
| 16 | 16 | #include <linux/device.h> |
| 17 | 17 | #include <linux/dma-mapping.h> |
| 18 | +#include <linux/dma-noncoherent.h> | |
| 18 | 19 | #include <linux/dma-contiguous.h> |
| 19 | 20 | #include <linux/highmem.h> |
| 20 | 21 | #include <linux/memblock.h> |
| @@ -1125,6 +1126,19 @@ int arm_dma_supported(struct device *dev, u64 mask) · 1104 unmodified lines | ||
| 1125 | 1126 | |
| 1126 | 1127 | static const struct dma_map_ops *arm_get_dma_map_ops(bool coherent) |
| 1127 | 1128 | { |
| 1129 | + /* | |
| 1130 | + * When CONFIG_ARM_LPAE is set, physical address can extend above | |
| 1131 | + * 32-bits, which then can't be addressed by devices that only support | |
| 1132 | + * 32-bit DMA. | |
| 1133 | + * Use the generic dma-direct / swiotlb ops code in that case, as that | |
| 1134 | + * handles bounce buffering for us. | |
| 1135 | + * | |
| 1136 | + * Note: this checks CONFIG_ARM_LPAE instead of CONFIG_SWIOTLB as the | |
| 1137 | + * latter is also selected by the Xen code, but that code for now relies | |
| 1138 | + * on non-NULL dev_dma_ops. To be cleaned up later. | |
| 1139 | + */ | |
| 1140 | + if (IS_ENABLED(CONFIG_ARM_LPAE)) | |
| 1141 | + return NULL; | |
| 1128 | 1142 | return coherent ? &arm_coherent_dma_ops : &arm_dma_ops; |
| 1129 | 1143 | } |
| 1130 | 1144 | |
| @@ -2329,6 +2343,9 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 1198 unmodified lines | ||
| 2329 | 2343 | const struct dma_map_ops *dma_ops; |
| 2330 | 2344 | |
| 2331 | 2345 | dev->archdata.dma_coherent = coherent; |
| 2346 | +#ifdef CONFIG_SWIOTLB | |
| 2347 | + dev->dma_coherent = coherent; | |
| 2348 | +#endif | |
| 2332 | 2349 | |
| 2333 | 2350 | /* |
| 2334 | 2351 | * Don't override the dma_ops if they have already been set. Ideally |
| @@ -2363,3 +2380,47 @@ void arch_teardown_dma_ops(struct device *dev) · 28 unmodified lines | ||
| 2363 | 2380 | /* Let arch_setup_dma_ops() start again from scratch upon re-probe */ |
| 2364 | 2381 | set_dma_ops(dev, NULL); |
| 2365 | 2382 | } |
| 2383 | + | |
| 2384 | +#ifdef CONFIG_SWIOTLB | |
| 2385 | +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, | |
| 2386 | + size_t size, enum dma_data_direction dir) | |
| 2387 | +{ | |
| 2388 | + __dma_page_cpu_to_dev(phys_to_page(paddr), paddr & (PAGE_SIZE - 1), | |
| 2389 | + size, dir); | |
| 2390 | +} | |
| 2391 | + | |
| 2392 | +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, | |
| 2393 | + size_t size, enum dma_data_direction dir) | |
| 2394 | +{ | |
| 2395 | + __dma_page_dev_to_cpu(phys_to_page(paddr), paddr & (PAGE_SIZE - 1), | |
| 2396 | + size, dir); | |
| 2397 | +} | |
| 2398 | + | |
| 2399 | +long arch_dma_coherent_to_pfn(struct device *dev, void *cpu_addr, | |
| 2400 | + dma_addr_t dma_addr) | |
| 2401 | +{ | |
| 2402 | + return dma_to_pfn(dev, dma_addr); | |
| 2403 | +} | |
| 2404 | + | |
| 2405 | +pgprot_t arch_dma_mmap_pgprot(struct device *dev, pgprot_t prot, | |
| 2406 | + unsigned long attrs) | |
| 2407 | +{ | |
| 2408 | + if (!dev_is_dma_coherent(dev)) | |
| 2409 | + return __get_dma_pgprot(attrs, prot); | |
| 2410 | + return prot; | |
| 2411 | +} | |
| 2412 | + | |
| 2413 | +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, | |
| 2414 | + gfp_t gfp, unsigned long attrs) | |
| 2415 | +{ | |
| 2416 | + return __dma_alloc(dev, size, dma_handle, gfp, | |
| 2417 | + __get_dma_pgprot(attrs, PAGE_KERNEL), false, | |
| 2418 | + attrs, __builtin_return_address(0)); | |
| 2419 | +} | |
| 2420 | + | |
| 2421 | +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, | |
| 2422 | + dma_addr_t dma_handle, unsigned long attrs) | |
| 2423 | +{ | |
| 2424 | + __arm_dma_free(dev, size, cpu_addr, dma_handle, attrs, false); | |
| 2425 | +} | |
| 2426 | +#endif /* CONFIG_SWIOTLB */ | |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <linux/dma-contiguous.h> |
| 22 | 22 | #include <linux/sizes.h> |
| 23 | 23 | #include <linux/stop_machine.h> |
| 24 | +#include <linux/swiotlb.h> | |
| 24 | 25 | |
| 25 | 26 | #include <asm/cp15.h> |
| 26 | 27 | #include <asm/mach-types.h> |
| @@ -463,6 +464,10 @@ static void __init free_highpages(void) · 436 unmodified lines | ||
| 463 | 464 | */ |
| 464 | 465 | void __init mem_init(void) |
| 465 | 466 | { |
| 467 | +#ifdef CONFIG_ARM_LPAE | |
| 468 | + swiotlb_init(1); | |
| 469 | +#endif | |
| 470 | + | |
| 466 | 471 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); |
| 467 | 472 | |
| 468 | 473 | /* this will put all unused low memory onto the freelists */ |
| @@ -388,17 +388,15 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) · 387 unmodified lines | ||
| 388 | 388 | /* |
| 389 | 389 | * not supported by current hardware on OMAP1 |
| 390 | 390 | * w |= (0x03 << 7); |
| 391 | − * fall through | |
| 392 | 391 | */ |
| 392 | + /* fall through */ | |
| 393 | 393 | case OMAP_DMA_DATA_BURST_16: |
| 394 | 394 | if (dma_omap2plus()) { |
| 395 | 395 | burst = 0x3; |
| 396 | 396 | break; |
| 397 | 397 | } |
| 398 | − /* | |
| 399 | − * OMAP1 don't support burst 16 | |
| 400 | − * fall through | |
| 401 | − */ | |
| 398 | + /* OMAP1 don't support burst 16 */ | |
| 399 | + /* fall through */ | |
| 402 | 400 | default: |
| 403 | 401 | BUG(); |
| 404 | 402 | } |
| @@ -474,10 +472,8 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) · 69 unmodified lines | ||
| 474 | 472 | burst = 0x3; |
| 475 | 473 | break; |
| 476 | 474 | } |
| 477 | − /* | |
| 478 | − * OMAP1 don't support burst 16 | |
| 479 | − * fall through | |
| 480 | − */ | |
| 475 | + /* OMAP1 don't support burst 16 */ | |
| 476 | + /* fall through */ | |
| 481 | 477 | default: |
| 482 | 478 | printk(KERN_ERR "Invalid DMA burst mode\n"); |
| 483 | 479 | BUG(); |
| @@ -52,7 +52,7 @@ ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y) · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | ifeq ($(CONFIG_CC_IS_CLANG), y) |
| 54 | 54 | $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built) |
| 55 | − else ifeq ($(CROSS_COMPILE_COMPAT),) | |
| 55 | + else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),) | |
| 56 | 56 | $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built) |
| 57 | 57 | else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),) |
| 58 | 58 | $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT) |
| @@ -155,6 +155,12 @@ static inline void gic_pmr_mask_irqs(void) · 154 unmodified lines | ||
| 155 | 155 | BUILD_BUG_ON(GICD_INT_DEF_PRI < (GIC_PRIO_IRQOFF | |
| 156 | 156 | GIC_PRIO_PSR_I_SET)); |
| 157 | 157 | BUILD_BUG_ON(GICD_INT_DEF_PRI >= GIC_PRIO_IRQON); |
| 158 | + /* | |
| 159 | + * Need to make sure IRQON allows IRQs when SCR_EL3.FIQ is cleared | |
| 160 | + * and non-secure PMR accesses are not subject to the shifts that | |
| 161 | + * are applied to IRQ priorities | |
| 162 | + */ | |
| 163 | + BUILD_BUG_ON((0x80 | (GICD_INT_DEF_PRI >> 1)) >= GIC_PRIO_IRQON); | |
| 158 | 164 | gic_write_pmr(GIC_PRIO_IRQOFF); |
| 159 | 165 | } |
| 160 | 166 | |
| @@ -35,9 +35,10 @@ · 34 unmodified lines | ||
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | 37 | enum ftr_type { |
| 38 | − FTR_EXACT, /* Use a predefined safe value */ | |
| 39 | − FTR_LOWER_SAFE, /* Smaller value is safe */ | |
| 40 | − FTR_HIGHER_SAFE,/* Bigger value is safe */ | |
| 38 | + FTR_EXACT, /* Use a predefined safe value */ | |
| 39 | + FTR_LOWER_SAFE, /* Smaller value is safe */ | |
| 40 | + FTR_HIGHER_SAFE, /* Bigger value is safe */ | |
| 41 | + FTR_HIGHER_OR_ZERO_SAFE, /* Bigger value is safe, but 0 is biggest */ | |
| 41 | 42 | }; |
| 42 | 43 | |
| 43 | 44 | #define FTR_STRICT true /* SANITY check strict matching required */ |
| @@ -13,6 +13,8 @@ · 12 unmodified lines | ||
| 13 | 13 | #define DAIF_PROCCTX 0 |
| 14 | 14 | #define DAIF_PROCCTX_NOIRQ PSR_I_BIT |
| 15 | 15 | #define DAIF_ERRCTX (PSR_I_BIT | PSR_A_BIT) |
| 16 | +#define DAIF_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT) | |
| 17 | + | |
| 16 | 18 | |
| 17 | 19 | /* mask/save/unmask/restore all exceptions, including interrupts. */ |
| 18 | 20 | static inline void local_daif_mask(void) |
| @@ -105,7 +105,11 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base, · 104 unmodified lines | ||
| 105 | 105 | ((protocol##_t *)instance)->f(instance, ##__VA_ARGS__) |
| 106 | 106 | |
| 107 | 107 | #define alloc_screen_info(x...) &screen_info |
| 108 | −#define free_screen_info(x...) | |
| 108 | + | |
| 109 | +static inline void free_screen_info(efi_system_table_t *sys_table_arg, | |
| 110 | + struct screen_info *si) | |
| 111 | +{ | |
| 112 | +} | |
| 109 | 113 | |
| 110 | 114 | /* redeclare as 'hidden' so the compiler will generate relative references */ |
| 111 | 115 | extern struct screen_info screen_info __attribute__((__visibility__("hidden"))); |
| @@ -316,9 +316,10 @@ · 315 unmodified lines | ||
| 316 | 316 | |
| 317 | 317 | #define kvm_arm_exception_class \ |
| 318 | 318 | ECN(UNKNOWN), ECN(WFx), ECN(CP15_32), ECN(CP15_64), ECN(CP14_MR), \ |
| 319 | − ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(CP14_64), ECN(SVC64), \ | |
| 320 | − ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(IMP_DEF), ECN(IABT_LOW), \ | |
| 321 | − ECN(IABT_CUR), ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \ | |
| 319 | + ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(PAC), ECN(CP14_64), \ | |
| 320 | + ECN(SVC64), ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(SVE), \ | |
| 321 | + ECN(IMP_DEF), ECN(IABT_LOW), ECN(IABT_CUR), \ | |
| 322 | + ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \ | |
| 322 | 323 | ECN(SP_ALIGN), ECN(FP_EXC32), ECN(FP_EXC64), ECN(SERROR), \ |
| 323 | 324 | ECN(BREAKPT_LOW), ECN(BREAKPT_CUR), ECN(SOFTSTP_LOW), \ |
| 324 | 325 | ECN(SOFTSTP_CUR), ECN(WATCHPT_LOW), ECN(WATCHPT_CUR), \ |
| @@ -210,7 +210,11 @@ extern u64 vabits_user; · 209 unmodified lines | ||
| 210 | 210 | #define __tag_reset(addr) untagged_addr(addr) |
| 211 | 211 | #define __tag_get(addr) (__u8)((u64)(addr) >> 56) |
| 212 | 212 | #else |
| 213 | −#define __tag_set(addr, tag) (addr) | |
| 213 | +static inline const void *__tag_set(const void *addr, u8 tag) | |
| 214 | +{ | |
| 215 | + return addr; | |
| 216 | +} | |
| 217 | + | |
| 214 | 218 | #define __tag_reset(addr) (addr) |
| 215 | 219 | #define __tag_get(addr) 0 |
| 216 | 220 | #endif |
| @@ -301,8 +305,8 @@ static inline void *phys_to_virt(phys_addr_t x) · 84 unmodified lines | ||
| 301 | 305 | #define page_to_virt(page) ({ \ |
| 302 | 306 | unsigned long __addr = \ |
| 303 | 307 | ((__page_to_voff(page)) | PAGE_OFFSET); \ |
| 304 | − unsigned long __addr_tag = \ | |
| 305 | − __tag_set(__addr, page_kasan_tag(page)); \ | |
| 308 | + const void *__addr_tag = \ | |
| 309 | + __tag_set((void *)__addr, page_kasan_tag(page)); \ | |
| 306 | 310 | ((void *)__addr_tag); \ |
| 307 | 311 | }) |
| 308 | 312 | |
| @@ -209,7 +209,7 @@ static inline pmd_t pmd_mkcont(pmd_t pmd) · 208 unmodified lines | ||
| 209 | 209 | |
| 210 | 210 | static inline pte_t pte_mkdevmap(pte_t pte) |
| 211 | 211 | { |
| 212 | − return set_pte_bit(pte, __pgprot(PTE_DEVMAP)); | |
| 212 | + return set_pte_bit(pte, __pgprot(PTE_DEVMAP | PTE_SPECIAL)); | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | static inline void set_pte(pte_t *ptep, pte_t pte) |
| @@ -396,7 +396,10 @@ static inline int pmd_protnone(pmd_t pmd) · 180 unmodified lines | ||
| 396 | 396 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 397 | 397 | #define pmd_devmap(pmd) pte_devmap(pmd_pte(pmd)) |
| 398 | 398 | #endif |
| 399 | −#define pmd_mkdevmap(pmd) pte_pmd(pte_mkdevmap(pmd_pte(pmd))) | |
| 399 | +static inline pmd_t pmd_mkdevmap(pmd_t pmd) | |
| 400 | +{ | |
| 401 | + return pte_pmd(set_pte_bit(pmd_pte(pmd), __pgprot(PTE_DEVMAP))); | |
| 402 | +} | |
| 400 | 403 | |
| 401 | 404 | #define __pmd_to_phys(pmd) __pte_to_phys(pmd_pte(pmd)) |
| 402 | 405 | #define __phys_to_pmd_val(phys) __phys_to_pte_val(phys) |
| @@ -447,8 +450,8 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, · 44 unmodified lines | ||
| 447 | 450 | PMD_TYPE_SECT) |
| 448 | 451 | |
| 449 | 452 | #if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS < 3 |
| 450 | −#define pud_sect(pud) (0) | |
| 451 | −#define pud_table(pud) (1) | |
| 453 | +static inline bool pud_sect(pud_t pud) { return false; } | |
| 454 | +static inline bool pud_table(pud_t pud) { return true; } | |
| 452 | 455 | #else |
| 453 | 456 | #define pud_sect(pud) ((pud_val(pud) & PUD_TYPE_MASK) == \ |
| 454 | 457 | PUD_TYPE_SECT) |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | * in the the priority mask, it indicates that PSR.I should be set and |
| 31 | 31 | * interrupt disabling temporarily does not rely on IRQ priorities. |
| 32 | 32 | */ |
| 33 | −#define GIC_PRIO_IRQON 0xc0 | |
| 33 | +#define GIC_PRIO_IRQON 0xe0 | |
| 34 | 34 | #define GIC_PRIO_IRQOFF (GIC_PRIO_IRQON & ~0x80) |
| 35 | 35 | #define GIC_PRIO_PSR_I_SET (1 << 4) |
| 36 | 36 | |
| @@ -16,6 +16,8 @@ · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | #define VDSO_HAS_CLOCK_GETRES 1 |
| 18 | 18 | |
| 19 | +#define VDSO_HAS_32BIT_FALLBACK 1 | |
| 20 | + | |
| 19 | 21 | static __always_inline |
| 20 | 22 | int gettimeofday_fallback(struct __kernel_old_timeval *_tv, |
| 21 | 23 | struct timezone *_tz) |
| @@ -51,6 +53,23 @@ long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) · 29 unmodified lines | ||
| 51 | 53 | return ret; |
| 52 | 54 | } |
| 53 | 55 | |
| 56 | +static __always_inline | |
| 57 | +long clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts) | |
| 58 | +{ | |
| 59 | + register struct old_timespec32 *ts asm("r1") = _ts; | |
| 60 | + register clockid_t clkid asm("r0") = _clkid; | |
| 61 | + register long ret asm ("r0"); | |
| 62 | + register long nr asm("r7") = __NR_compat_clock_gettime; | |
| 63 | + | |
| 64 | + asm volatile( | |
| 65 | + " swi #0\n" | |
| 66 | + : "=r" (ret) | |
| 67 | + : "r" (clkid), "r" (ts), "r" (nr) | |
| 68 | + : "memory"); | |
| 69 | + | |
| 70 | + return ret; | |
| 71 | +} | |
| 72 | + | |
| 54 | 73 | static __always_inline |
| 55 | 74 | int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) |
| 56 | 75 | { |
| @@ -72,6 +91,27 @@ int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) · 15 unmodified lines | ||
| 72 | 91 | return ret; |
| 73 | 92 | } |
| 74 | 93 | |
| 94 | +static __always_inline | |
| 95 | +int clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts) | |
| 96 | +{ | |
| 97 | + register struct old_timespec32 *ts asm("r1") = _ts; | |
| 98 | + register clockid_t clkid asm("r0") = _clkid; | |
| 99 | + register long ret asm ("r0"); | |
| 100 | + register long nr asm("r7") = __NR_compat_clock_getres; | |
| 101 | + | |
| 102 | + /* The checks below are required for ABI consistency with arm */ | |
| 103 | + if ((_clkid >= MAX_CLOCKS) && (_ts == NULL)) | |
| 104 | + return -EINVAL; | |
| 105 | + | |
| 106 | + asm volatile( | |
| 107 | + " swi #0\n" | |
| 108 | + : "=r" (ret) | |
| 109 | + : "r" (clkid), "r" (ts), "r" (nr) | |
| 110 | + : "memory"); | |
| 111 | + | |
| 112 | + return ret; | |
| 113 | +} | |
| 114 | + | |
| 75 | 115 | static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) |
| 76 | 116 | { |
| 77 | 117 | u64 res; |
| @@ -225,8 +225,8 @@ static const struct arm64_ftr_bits ftr_ctr[] = { · 224 unmodified lines | ||
| 225 | 225 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RES1 */ |
| 226 | 226 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, CTR_DIC_SHIFT, 1, 1), |
| 227 | 227 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, CTR_IDC_SHIFT, 1, 1), |
| 228 | − ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, CTR_CWG_SHIFT, 4, 0), | |
| 229 | − ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, CTR_ERG_SHIFT, 4, 0), | |
| 228 | + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_OR_ZERO_SAFE, CTR_CWG_SHIFT, 4, 0), | |
| 229 | + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_OR_ZERO_SAFE, CTR_ERG_SHIFT, 4, 0), | |
| 230 | 230 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, CTR_DMINLINE_SHIFT, 4, 1), |
| 231 | 231 | /* |
| 232 | 232 | * Linux can handle differing I-cache policies. Userspace JITs will |
| @@ -468,6 +468,10 @@ static s64 arm64_ftr_safe_value(const struct arm64_ftr_bits *ftrp, s64 new, · 235 unmodified lines | ||
| 468 | 468 | case FTR_LOWER_SAFE: |
| 469 | 469 | ret = new < cur ? new : cur; |
| 470 | 470 | break; |
| 471 | + case FTR_HIGHER_OR_ZERO_SAFE: | |
| 472 | + if (!cur || !new) | |
| 473 | + break; | |
| 474 | + /* Fallthrough */ | |
| 471 | 475 | case FTR_HIGHER_SAFE: |
| 472 | 476 | ret = new > cur ? new : cur; |
| 473 | 477 | break; |
| @@ -207,16 +207,16 @@ static int call_step_hook(struct pt_regs *regs, unsigned int esr) · 206 unmodified lines | ||
| 207 | 207 | |
| 208 | 208 | list = user_mode(regs) ? &user_step_hook : &kernel_step_hook; |
| 209 | 209 | |
| 210 | − rcu_read_lock(); | |
| 211 | − | |
| 210 | + /* | |
| 211 | + * Since single-step exception disables interrupt, this function is | |
| 212 | + * entirely not preemptible, and we can use rcu list safely here. | |
| 213 | + */ | |
| 212 | 214 | list_for_each_entry_rcu(hook, list, node) { |
| 213 | 215 | retval = hook->fn(regs, esr); |
| 214 | 216 | if (retval == DBG_HOOK_HANDLED) |
| 215 | 217 | break; |
| 216 | 218 | } |
| 217 | 219 | |
| 218 | − rcu_read_unlock(); | |
| 219 | − | |
| 220 | 220 | return retval; |
| 221 | 221 | } |
| 222 | 222 | NOKPROBE_SYMBOL(call_step_hook); |
| @@ -305,14 +305,16 @@ static int call_break_hook(struct pt_regs *regs, unsigned int esr) · 82 unmodified lines | ||
| 305 | 305 | |
| 306 | 306 | list = user_mode(regs) ? &user_break_hook : &kernel_break_hook; |
| 307 | 307 | |
| 308 | − rcu_read_lock(); | |
| 308 | + /* | |
| 309 | + * Since brk exception disables interrupt, this function is | |
| 310 | + * entirely not preemptible, and we can use rcu list safely here. | |
| 311 | + */ | |
| 309 | 312 | list_for_each_entry_rcu(hook, list, node) { |
| 310 | 313 | unsigned int comment = esr & ESR_ELx_BRK64_ISS_COMMENT_MASK; |
| 311 | 314 | |
| 312 | 315 | if ((comment & ~hook->mask) == hook->imm) |
| 313 | 316 | fn = hook->fn; |
| 314 | 317 | } |
| 315 | − rcu_read_unlock(); | |
| 316 | 318 | |
| 317 | 319 | return fn ? fn(regs, esr) : DBG_HOOK_ERROR; |
| 318 | 320 | } |
| @@ -536,13 +536,18 @@ int hw_breakpoint_arch_parse(struct perf_event *bp, · 535 unmodified lines | ||
| 536 | 536 | /* Aligned */ |
| 537 | 537 | break; |
| 538 | 538 | case 1: |
| 539 | − /* Allow single byte watchpoint. */ | |
| 540 | − if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1) | |
| 541 | − break; | |
| 542 | 539 | case 2: |
| 543 | 540 | /* Allow halfword watchpoints and breakpoints. */ |
| 544 | 541 | if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2) |
| 545 | 542 | break; |
| 543 | + | |
| 544 | + /* Fallthrough */ | |
| 545 | + case 3: | |
| 546 | + /* Allow single byte watchpoint. */ | |
| 547 | + if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1) | |
| 548 | + break; | |
| 549 | + | |
| 550 | + /* Fallthrough */ | |
| 546 | 551 | default: |
| 547 | 552 | return -EINVAL; |
| 548 | 553 | } |
| @@ -314,18 +314,21 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, · 313 unmodified lines | ||
| 314 | 314 | /* MOVW instruction relocations. */ |
| 315 | 315 | case R_AARCH64_MOVW_UABS_G0_NC: |
| 316 | 316 | overflow_check = false; |
| 317 | + /* Fall through */ | |
| 317 | 318 | case R_AARCH64_MOVW_UABS_G0: |
| 318 | 319 | ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0, |
| 319 | 320 | AARCH64_INSN_IMM_MOVKZ); |
| 320 | 321 | break; |
| 321 | 322 | case R_AARCH64_MOVW_UABS_G1_NC: |
| 322 | 323 | overflow_check = false; |
| 324 | + /* Fall through */ | |
| 323 | 325 | case R_AARCH64_MOVW_UABS_G1: |
| 324 | 326 | ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16, |
| 325 | 327 | AARCH64_INSN_IMM_MOVKZ); |
| 326 | 328 | break; |
| 327 | 329 | case R_AARCH64_MOVW_UABS_G2_NC: |
| 328 | 330 | overflow_check = false; |
| 331 | + /* Fall through */ | |
| 329 | 332 | case R_AARCH64_MOVW_UABS_G2: |
| 330 | 333 | ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32, |
| 331 | 334 | AARCH64_INSN_IMM_MOVKZ); |
| @@ -393,6 +396,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, · 61 unmodified lines | ||
| 393 | 396 | break; |
| 394 | 397 | case R_AARCH64_ADR_PREL_PG_HI21_NC: |
| 395 | 398 | overflow_check = false; |
| 399 | + /* Fall through */ | |
| 396 | 400 | case R_AARCH64_ADR_PREL_PG_HI21: |
| 397 | 401 | ovf = reloc_insn_adrp(me, sechdrs, loc, val); |
| 398 | 402 | if (ovf && ovf != -ERANGE) |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <asm/ptrace.h> |
| 22 | 22 | #include <asm/cacheflush.h> |
| 23 | 23 | #include <asm/debug-monitors.h> |
| 24 | +#include <asm/daifflags.h> | |
| 24 | 25 | #include <asm/system_misc.h> |
| 25 | 26 | #include <asm/insn.h> |
| 26 | 27 | #include <linux/uaccess.h> |
| @@ -167,33 +168,6 @@ static void __kprobes set_current_kprobe(struct kprobe *p) · 140 unmodified lines | ||
| 167 | 168 | __this_cpu_write(current_kprobe, p); |
| 168 | 169 | } |
| 169 | 170 | |
| 170 | −/* | |
| 171 | − * When PSTATE.D is set (masked), then software step exceptions can not be | |
| 172 | − * generated. | |
| 173 | − * SPSR's D bit shows the value of PSTATE.D immediately before the | |
| 174 | − * exception was taken. PSTATE.D is set while entering into any exception | |
| 175 | − * mode, however software clears it for any normal (none-debug-exception) | |
| 176 | − * mode in the exception entry. Therefore, when we are entering into kprobe | |
| 177 | − * breakpoint handler from any normal mode then SPSR.D bit is already | |
| 178 | − * cleared, however it is set when we are entering from any debug exception | |
| 179 | − * mode. | |
| 180 | − * Since we always need to generate single step exception after a kprobe | |
| 181 | − * breakpoint exception therefore we need to clear it unconditionally, when | |
| 182 | − * we become sure that the current breakpoint exception is for kprobe. | |
| 183 | − */ | |
| 184 | −static void __kprobes | |
| 185 | −spsr_set_debug_flag(struct pt_regs *regs, int mask) | |
| 186 | −{ | |
| 187 | − unsigned long spsr = regs->pstate; | |
| 188 | − | |
| 189 | − if (mask) | |
| 190 | − spsr |= PSR_D_BIT; | |
| 191 | − else | |
| 192 | − spsr &= ~PSR_D_BIT; | |
| 193 | − | |
| 194 | − regs->pstate = spsr; | |
| 195 | −} | |
| 196 | − | |
| 197 | 171 | /* |
| 198 | 172 | * Interrupts need to be disabled before single-step mode is set, and not |
| 199 | 173 | * reenabled until after single-step mode ends. |
| @@ -205,17 +179,17 @@ spsr_set_debug_flag(struct pt_regs *regs, int mask) · 5 unmodified lines | ||
| 205 | 179 | static void __kprobes kprobes_save_local_irqflag(struct kprobe_ctlblk *kcb, |
| 206 | 180 | struct pt_regs *regs) |
| 207 | 181 | { |
| 208 | − kcb->saved_irqflag = regs->pstate; | |
| 182 | + kcb->saved_irqflag = regs->pstate & DAIF_MASK; | |
| 209 | 183 | regs->pstate |= PSR_I_BIT; |
| 184 | + /* Unmask PSTATE.D for enabling software step exceptions. */ | |
| 185 | + regs->pstate &= ~PSR_D_BIT; | |
| 210 | 186 | } |
| 211 | 187 | |
| 212 | 188 | static void __kprobes kprobes_restore_local_irqflag(struct kprobe_ctlblk *kcb, |
| 213 | 189 | struct pt_regs *regs) |
| 214 | 190 | { |
| 215 | − if (kcb->saved_irqflag & PSR_I_BIT) | |
| 216 | − regs->pstate |= PSR_I_BIT; | |
| 217 | − else | |
| 218 | − regs->pstate &= ~PSR_I_BIT; | |
| 191 | + regs->pstate &= ~DAIF_MASK; | |
| 192 | + regs->pstate |= kcb->saved_irqflag; | |
| 219 | 193 | } |
| 220 | 194 | |
| 221 | 195 | static void __kprobes |
| @@ -252,8 +226,6 @@ static void __kprobes setup_singlestep(struct kprobe *p, · 30 unmodified lines | ||
| 252 | 226 | |
| 253 | 227 | set_ss_context(kcb, slot); /* mark pending ss */ |
| 254 | 228 | |
| 255 | − spsr_set_debug_flag(regs, 0); | |
| 256 | − | |
| 257 | 229 | /* IRQs and single stepping do not mix well. */ |
| 258 | 230 | kprobes_save_local_irqflag(kcb, regs); |
| 259 | 231 | kernel_enable_single_step(regs); |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #include <linux/export.h> |
| 10 | 10 | #include <linux/ftrace.h> |
| 11 | +#include <linux/kprobes.h> | |
| 11 | 12 | |
| 12 | 13 | #include <asm/stack_pointer.h> |
| 13 | 14 | #include <asm/stacktrace.h> |
| @@ -29,6 +30,7 @@ static int save_return_addr(struct stackframe *frame, void *d) · 15 unmodified lines | ||
| 29 | 30 | return 0; |
| 30 | 31 | } |
| 31 | 32 | } |
| 33 | +NOKPROBE_SYMBOL(save_return_addr); | |
| 32 | 34 | |
| 33 | 35 | void *return_address(unsigned int level) |
| 34 | 36 | { |
| @@ -49,3 +51,4 @@ void *return_address(unsigned int level) · 14 unmodified lines | ||
| 49 | 51 | return NULL; |
| 50 | 52 | } |
| 51 | 53 | EXPORT_SYMBOL_GPL(return_address); |
| 54 | +NOKPROBE_SYMBOL(return_address); | |
| @@ -152,8 +152,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) · 151 unmodified lines | ||
| 152 | 152 | pr_crit("CPU%u: died during early boot\n", cpu); |
| 153 | 153 | break; |
| 154 | 154 | } |
| 155 | − /* Fall through */ | |
| 156 | 155 | pr_crit("CPU%u: may not have shut down cleanly\n", cpu); |
| 156 | + /* Fall through */ | |
| 157 | 157 | case CPU_STUCK_IN_KERNEL: |
| 158 | 158 | pr_crit("CPU%u: is stuck in kernel\n", cpu); |
| 159 | 159 | if (status & CPU_STUCK_REASON_52_BIT_VA) |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/kernel.h> |
| 8 | 8 | #include <linux/export.h> |
| 9 | 9 | #include <linux/ftrace.h> |
| 10 | +#include <linux/kprobes.h> | |
| 10 | 11 | #include <linux/sched.h> |
| 11 | 12 | #include <linux/sched/debug.h> |
| 12 | 13 | #include <linux/sched/task_stack.h> |
| @@ -111,6 +112,7 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) · 98 unmodified lines | ||
| 111 | 112 | |
| 112 | 113 | return 0; |
| 113 | 114 | } |
| 115 | +NOKPROBE_SYMBOL(unwind_frame); | |
| 114 | 116 | |
| 115 | 117 | void notrace walk_stackframe(struct task_struct *tsk, struct stackframe *frame, |
| 116 | 118 | int (*fn)(struct stackframe *, void *), void *data) |
| @@ -125,6 +127,7 @@ void notrace walk_stackframe(struct task_struct *tsk, struct stackframe *frame, · 8 unmodified lines | ||
| 125 | 127 | break; |
| 126 | 128 | } |
| 127 | 129 | } |
| 130 | +NOKPROBE_SYMBOL(walk_stackframe); | |
| 128 | 131 | |
| 129 | 132 | #ifdef CONFIG_STACKTRACE |
| 130 | 133 | struct stack_trace_data { |
| @@ -733,6 +733,7 @@ static const char *esr_class_str[] = { · 732 unmodified lines | ||
| 733 | 733 | [ESR_ELx_EC_CP14_LS] = "CP14 LDC/STC", |
| 734 | 734 | [ESR_ELx_EC_FP_ASIMD] = "ASIMD", |
| 735 | 735 | [ESR_ELx_EC_CP10_ID] = "CP10 MRC/VMRS", |
| 736 | + [ESR_ELx_EC_PAC] = "PAC", | |
| 736 | 737 | [ESR_ELx_EC_CP14_64] = "CP14 MCRR/MRRC", |
| 737 | 738 | [ESR_ELx_EC_ILL] = "PSTATE.IL", |
| 738 | 739 | [ESR_ELx_EC_SVC32] = "SVC (AArch32)", |
| @@ -18,40 +18,70 @@ · 17 unmodified lines | ||
| 18 | 18 | #define save_debug(ptr,reg,nr) \ |
| 19 | 19 | switch (nr) { \ |
| 20 | 20 | case 15: ptr[15] = read_debug(reg, 15); \ |
| 21 | + /* Fall through */ \ | |
| 21 | 22 | case 14: ptr[14] = read_debug(reg, 14); \ |
| 23 | + /* Fall through */ \ | |
| 22 | 24 | case 13: ptr[13] = read_debug(reg, 13); \ |
| 25 | + /* Fall through */ \ | |
| 23 | 26 | case 12: ptr[12] = read_debug(reg, 12); \ |
| 27 | + /* Fall through */ \ | |
| 24 | 28 | case 11: ptr[11] = read_debug(reg, 11); \ |
| 29 | + /* Fall through */ \ | |
| 25 | 30 | case 10: ptr[10] = read_debug(reg, 10); \ |
| 31 | + /* Fall through */ \ | |
| 26 | 32 | case 9: ptr[9] = read_debug(reg, 9); \ |
| 33 | + /* Fall through */ \ | |
| 27 | 34 | case 8: ptr[8] = read_debug(reg, 8); \ |
| 35 | + /* Fall through */ \ | |
| 28 | 36 | case 7: ptr[7] = read_debug(reg, 7); \ |
| 37 | + /* Fall through */ \ | |
| 29 | 38 | case 6: ptr[6] = read_debug(reg, 6); \ |
| 39 | + /* Fall through */ \ | |
| 30 | 40 | case 5: ptr[5] = read_debug(reg, 5); \ |
| 41 | + /* Fall through */ \ | |
| 31 | 42 | case 4: ptr[4] = read_debug(reg, 4); \ |
| 43 | + /* Fall through */ \ | |
| 32 | 44 | case 3: ptr[3] = read_debug(reg, 3); \ |
| 45 | + /* Fall through */ \ | |
| 33 | 46 | case 2: ptr[2] = read_debug(reg, 2); \ |
| 47 | + /* Fall through */ \ | |
| 34 | 48 | case 1: ptr[1] = read_debug(reg, 1); \ |
| 49 | + /* Fall through */ \ | |
| 35 | 50 | default: ptr[0] = read_debug(reg, 0); \ |
| 36 | 51 | } |
| 37 | 52 | |
| 38 | 53 | #define restore_debug(ptr,reg,nr) \ |
| 39 | 54 | switch (nr) { \ |
| 40 | 55 | case 15: write_debug(ptr[15], reg, 15); \ |
| 56 | + /* Fall through */ \ | |
| 41 | 57 | case 14: write_debug(ptr[14], reg, 14); \ |
| 58 | + /* Fall through */ \ | |
| 42 | 59 | case 13: write_debug(ptr[13], reg, 13); \ |
| 60 | + /* Fall through */ \ | |
| 43 | 61 | case 12: write_debug(ptr[12], reg, 12); \ |
| 62 | + /* Fall through */ \ | |
| 44 | 63 | case 11: write_debug(ptr[11], reg, 11); \ |
| 64 | + /* Fall through */ \ | |
| 45 | 65 | case 10: write_debug(ptr[10], reg, 10); \ |
| 66 | + /* Fall through */ \ | |
| 46 | 67 | case 9: write_debug(ptr[9], reg, 9); \ |
| 68 | + /* Fall through */ \ | |
| 47 | 69 | case 8: write_debug(ptr[8], reg, 8); \ |
| 70 | + /* Fall through */ \ | |
| 48 | 71 | case 7: write_debug(ptr[7], reg, 7); \ |
| 72 | + /* Fall through */ \ | |
| 49 | 73 | case 6: write_debug(ptr[6], reg, 6); \ |
| 74 | + /* Fall through */ \ | |
| 50 | 75 | case 5: write_debug(ptr[5], reg, 5); \ |
| 76 | + /* Fall through */ \ | |
| 51 | 77 | case 4: write_debug(ptr[4], reg, 4); \ |
| 78 | + /* Fall through */ \ | |
| 52 | 79 | case 3: write_debug(ptr[3], reg, 3); \ |
| 80 | + /* Fall through */ \ | |
| 53 | 81 | case 2: write_debug(ptr[2], reg, 2); \ |
| 82 | + /* Fall through */ \ | |
| 54 | 83 | case 1: write_debug(ptr[1], reg, 1); \ |
| 84 | + /* Fall through */ \ | |
| 55 | 85 | default: write_debug(ptr[0], reg, 0); \ |
| 56 | 86 | } |
| 57 | 87 | |
| @@ -178,13 +178,18 @@ void vcpu_write_spsr32(struct kvm_vcpu *vcpu, unsigned long v) · 177 unmodified lines | ||
| 178 | 178 | switch (spsr_idx) { |
| 179 | 179 | case KVM_SPSR_SVC: |
| 180 | 180 | write_sysreg_el1(v, SYS_SPSR); |
| 181 | + break; | |
| 181 | 182 | case KVM_SPSR_ABT: |
| 182 | 183 | write_sysreg(v, spsr_abt); |
| 184 | + break; | |
| 183 | 185 | case KVM_SPSR_UND: |
| 184 | 186 | write_sysreg(v, spsr_und); |
| 187 | + break; | |
| 185 | 188 | case KVM_SPSR_IRQ: |
| 186 | 189 | write_sysreg(v, spsr_irq); |
| 190 | + break; | |
| 187 | 191 | case KVM_SPSR_FIQ: |
| 188 | 192 | write_sysreg(v, spsr_fiq); |
| 193 | + break; | |
| 189 | 194 | } |
| 190 | 195 | } |
| @@ -632,7 +632,7 @@ static void reset_pmcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) · 631 unmodified lines | ||
| 632 | 632 | */ |
| 633 | 633 | val = ((pmcr & ~ARMV8_PMU_PMCR_MASK) |
| 634 | 634 | | (ARMV8_PMU_PMCR_MASK & 0xdecafbad)) & (~ARMV8_PMU_PMCR_E); |
| 635 | − __vcpu_sys_reg(vcpu, PMCR_EL0) = val; | |
| 635 | + __vcpu_sys_reg(vcpu, r->reg) = val; | |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | static bool check_pmu_access_disabled(struct kvm_vcpu *vcpu, u64 flags) |
| @@ -981,13 +981,13 @@ static bool access_pmuserenr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 342 unmodified lines | ||
| 981 | 981 | /* Silly macro to expand the DBG{BCR,BVR,WVR,WCR}n_EL1 registers in one go */ |
| 982 | 982 | #define DBG_BCR_BVR_WCR_WVR_EL1(n) \ |
| 983 | 983 | { SYS_DESC(SYS_DBGBVRn_EL1(n)), \ |
| 984 | − trap_bvr, reset_bvr, n, 0, get_bvr, set_bvr }, \ | |
| 984 | + trap_bvr, reset_bvr, 0, 0, get_bvr, set_bvr }, \ | |
| 985 | 985 | { SYS_DESC(SYS_DBGBCRn_EL1(n)), \ |
| 986 | − trap_bcr, reset_bcr, n, 0, get_bcr, set_bcr }, \ | |
| 986 | + trap_bcr, reset_bcr, 0, 0, get_bcr, set_bcr }, \ | |
| 987 | 987 | { SYS_DESC(SYS_DBGWVRn_EL1(n)), \ |
| 988 | − trap_wvr, reset_wvr, n, 0, get_wvr, set_wvr }, \ | |
| 988 | + trap_wvr, reset_wvr, 0, 0, get_wvr, set_wvr }, \ | |
| 989 | 989 | { SYS_DESC(SYS_DBGWCRn_EL1(n)), \ |
| 990 | − trap_wcr, reset_wcr, n, 0, get_wcr, set_wcr } | |
| 990 | + trap_wcr, reset_wcr, 0, 0, get_wcr, set_wcr } | |
| 991 | 991 | |
| 992 | 992 | /* Macro to expand the PMEVCNTRn_EL0 register */ |
| 993 | 993 | #define PMU_PMEVCNTR_EL0(n) \ |
| @@ -1540,7 +1540,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { · 546 unmodified lines | ||
| 1540 | 1540 | { SYS_DESC(SYS_CSSELR_EL1), access_csselr, reset_unknown, CSSELR_EL1 }, |
| 1541 | 1541 | { SYS_DESC(SYS_CTR_EL0), access_ctr }, |
| 1542 | 1542 | |
| 1543 | − { SYS_DESC(SYS_PMCR_EL0), access_pmcr, reset_pmcr, }, | |
| 1543 | + { SYS_DESC(SYS_PMCR_EL0), access_pmcr, reset_pmcr, PMCR_EL0 }, | |
| 1544 | 1544 | { SYS_DESC(SYS_PMCNTENSET_EL0), access_pmcnten, reset_unknown, PMCNTENSET_EL0 }, |
| 1545 | 1545 | { SYS_DESC(SYS_PMCNTENCLR_EL0), access_pmcnten, NULL, PMCNTENSET_EL0 }, |
| 1546 | 1546 | { SYS_DESC(SYS_PMOVSCLR_EL0), access_pmovs, NULL, PMOVSSET_EL0 }, |
| @@ -2254,13 +2254,19 @@ static int emulate_sys_reg(struct kvm_vcpu *vcpu, · 707 unmodified lines | ||
| 2254 | 2254 | } |
| 2255 | 2255 | |
| 2256 | 2256 | static void reset_sys_reg_descs(struct kvm_vcpu *vcpu, |
| 2257 | − const struct sys_reg_desc *table, size_t num) | |
| 2257 | + const struct sys_reg_desc *table, size_t num, | |
| 2258 | + unsigned long *bmap) | |
| 2258 | 2259 | { |
| 2259 | 2260 | unsigned long i; |
| 2260 | 2261 | |
| 2261 | 2262 | for (i = 0; i < num; i++) |
| 2262 | − if (table[i].reset) | |
| 2263 | + if (table[i].reset) { | |
| 2264 | + int reg = table[i].reg; | |
| 2265 | + | |
| 2263 | 2266 | table[i].reset(vcpu, &table[i]); |
| 2267 | + if (reg > 0 && reg < NR_SYS_REGS) | |
| 2268 | + set_bit(reg, bmap); | |
| 2269 | + } | |
| 2264 | 2270 | } |
| 2265 | 2271 | |
| 2266 | 2272 | /** |
| @@ -2774,18 +2780,16 @@ void kvm_reset_sys_regs(struct kvm_vcpu *vcpu) · 507 unmodified lines | ||
| 2774 | 2780 | { |
| 2775 | 2781 | size_t num; |
| 2776 | 2782 | const struct sys_reg_desc *table; |
| 2777 | − | |
| 2778 | − /* Catch someone adding a register without putting in reset entry. */ | |
| 2779 | − memset(&vcpu->arch.ctxt.sys_regs, 0x42, sizeof(vcpu->arch.ctxt.sys_regs)); | |
| 2783 | + DECLARE_BITMAP(bmap, NR_SYS_REGS) = { 0, }; | |
| 2780 | 2784 | |
| 2781 | 2785 | /* Generic chip reset first (so target could override). */ |
| 2782 | − reset_sys_reg_descs(vcpu, sys_reg_descs, ARRAY_SIZE(sys_reg_descs)); | |
| 2786 | + reset_sys_reg_descs(vcpu, sys_reg_descs, ARRAY_SIZE(sys_reg_descs), bmap); | |
| 2783 | 2787 | |
| 2784 | 2788 | table = get_target_table(vcpu->arch.target, true, &num); |
| 2785 | − reset_sys_reg_descs(vcpu, table, num); | |
| 2789 | + reset_sys_reg_descs(vcpu, table, num, bmap); | |
| 2786 | 2790 | |
| 2787 | 2791 | for (num = 1; num < NR_SYS_REGS; num++) { |
| 2788 | − if (WARN(__vcpu_sys_reg(vcpu, num) == 0x4242424242424242, | |
| 2792 | + if (WARN(!test_bit(num, bmap), | |
| 2789 | 2793 | "Didn't reset __vcpu_sys_reg(%zi)\n", num)) |
| 2790 | 2794 | break; |
| 2791 | 2795 | } |
| @@ -777,6 +777,53 @@ void __init hook_debug_fault_code(int nr, · 776 unmodified lines | ||
| 777 | 777 | debug_fault_info[nr].name = name; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | +/* | |
| 781 | + * In debug exception context, we explicitly disable preemption despite | |
| 782 | + * having interrupts disabled. | |
| 783 | + * This serves two purposes: it makes it much less likely that we would | |
| 784 | + * accidentally schedule in exception context and it will force a warning | |
| 785 | + * if we somehow manage to schedule by accident. | |
| 786 | + */ | |
| 787 | +static void debug_exception_enter(struct pt_regs *regs) | |
| 788 | +{ | |
| 789 | + /* | |
| 790 | + * Tell lockdep we disabled irqs in entry.S. Do nothing if they were | |
| 791 | + * already disabled to preserve the last enabled/disabled addresses. | |
| 792 | + */ | |
| 793 | + if (interrupts_enabled(regs)) | |
| 794 | + trace_hardirqs_off(); | |
| 795 | + | |
| 796 | + if (user_mode(regs)) { | |
| 797 | + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); | |
| 798 | + } else { | |
| 799 | + /* | |
| 800 | + * We might have interrupted pretty much anything. In | |
| 801 | + * fact, if we're a debug exception, we can even interrupt | |
| 802 | + * NMI processing. We don't want this code makes in_nmi() | |
| 803 | + * to return true, but we need to notify RCU. | |
| 804 | + */ | |
| 805 | + rcu_nmi_enter(); | |
| 806 | + } | |
| 807 | + | |
| 808 | + preempt_disable(); | |
| 809 | + | |
| 810 | + /* This code is a bit fragile. Test it. */ | |
| 811 | + RCU_LOCKDEP_WARN(!rcu_is_watching(), "exception_enter didn't work"); | |
| 812 | +} | |
| 813 | +NOKPROBE_SYMBOL(debug_exception_enter); | |
| 814 | + | |
| 815 | +static void debug_exception_exit(struct pt_regs *regs) | |
| 816 | +{ | |
| 817 | + preempt_enable_no_resched(); | |
| 818 | + | |
| 819 | + if (!user_mode(regs)) | |
| 820 | + rcu_nmi_exit(); | |
| 821 | + | |
| 822 | + if (interrupts_enabled(regs)) | |
| 823 | + trace_hardirqs_on(); | |
| 824 | +} | |
| 825 | +NOKPROBE_SYMBOL(debug_exception_exit); | |
| 826 | + | |
| 780 | 827 | #ifdef CONFIG_ARM64_ERRATUM_1463225 |
| 781 | 828 | DECLARE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa); |
| 782 | 829 | |
| @@ -817,12 +864,7 @@ asmlinkage void __exception do_debug_exception(unsigned long addr_if_watchpoint, · 34 unmodified lines | ||
| 817 | 864 | if (cortex_a76_erratum_1463225_debug_handler(regs)) |
| 818 | 865 | return; |
| 819 | 866 | |
| 820 | − /* | |
| 821 | − * Tell lockdep we disabled irqs in entry.S. Do nothing if they were | |
| 822 | − * already disabled to preserve the last enabled/disabled addresses. | |
| 823 | − */ | |
| 824 | − if (interrupts_enabled(regs)) | |
| 825 | − trace_hardirqs_off(); | |
| 867 | + debug_exception_enter(regs); | |
| 826 | 868 | |
| 827 | 869 | if (user_mode(regs) && !is_ttbr0_addr(pc)) |
| 828 | 870 | arm64_apply_bp_hardening(); |
| @@ -832,7 +874,6 @@ asmlinkage void __exception do_debug_exception(unsigned long addr_if_watchpoint, · 3 unmodified lines | ||
| 832 | 874 | inf->sig, inf->code, (void __user *)pc, esr); |
| 833 | 875 | } |
| 834 | 876 | |
| 835 | − if (interrupts_enabled(regs)) | |
| 836 | − trace_hardirqs_on(); | |
| 877 | + debug_exception_exit(regs); | |
| 837 | 878 | } |
| 838 | 879 | NOKPROBE_SYMBOL(do_debug_exception); |
| @@ -398,6 +398,7 @@ static int dwc3_octeon_clocks_start(struct device *dev, u64 base) · 397 unmodified lines | ||
| 398 | 398 | default: |
| 399 | 399 | dev_err(dev, "Invalid ref_clk %u, using 100000000 instead\n", |
| 400 | 400 | clock_rate); |
| 401 | + /* fall through */ | |
| 401 | 402 | case 100000000: |
| 402 | 403 | mpll_mul = 0x19; |
| 403 | 404 | if (ref_clk_sel < 2) |
| @@ -69,6 +69,8 @@ static int __populate_cache_leaves(unsigned int cpu) · 68 unmodified lines | ||
| 69 | 69 | if (c->tcache.waysize) |
| 70 | 70 | populate_cache(tcache, this_leaf, 3, CACHE_TYPE_UNIFIED); |
| 71 | 71 | |
| 72 | + this_cpu_ci->cpu_map_populated = true; | |
| 73 | + | |
| 72 | 74 | return 0; |
| 73 | 75 | } |
| 74 | 76 | |
| @@ -32,7 +32,8 @@ void __init setup_pit_timer(void) · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | static int __init init_pit_clocksource(void) |
| 34 | 34 | { |
| 35 | − if (num_possible_cpus() > 1) /* PIT does not scale! */ | |
| 35 | + if (num_possible_cpus() > 1 || /* PIT does not scale! */ | |
| 36 | + !clockevent_state_periodic(&i8253_clockevent)) | |
| 36 | 37 | return 0; |
| 37 | 38 | |
| 38 | 39 | return clocksource_i8253_init(); |
| @@ -140,6 +140,7 @@ static int kvm_compute_return_epc(struct kvm_vcpu *vcpu, unsigned long instpc, · 139 unmodified lines | ||
| 140 | 140 | /* These are unconditional and in j_format. */ |
| 141 | 141 | case jal_op: |
| 142 | 142 | arch->gprs[31] = instpc + 8; |
| 143 | + /* fall through */ | |
| 143 | 144 | case j_op: |
| 144 | 145 | epc += 4; |
| 145 | 146 | epc >>= 28; |
| @@ -150,16 +150,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 149 unmodified lines | ||
| 150 | 150 | return 0; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | −bool kvm_arch_has_vcpu_debugfs(void) | |
| 154 | −{ | |
| 155 | − return false; | |
| 156 | −} | |
| 157 | − | |
| 158 | −int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | |
| 159 | −{ | |
| 160 | − return 0; | |
| 161 | −} | |
| 162 | − | |
| 163 | 153 | void kvm_mips_free_vcpus(struct kvm *kvm) |
| 164 | 154 | { |
| 165 | 155 | unsigned int i; |
| @@ -172,12 +172,15 @@ static void mipsxx_cpu_setup(void *args) · 171 unmodified lines | ||
| 172 | 172 | case 4: |
| 173 | 173 | w_c0_perfctrl3(0); |
| 174 | 174 | w_c0_perfcntr3(reg.counter[3]); |
| 175 | + /* fall through */ | |
| 175 | 176 | case 3: |
| 176 | 177 | w_c0_perfctrl2(0); |
| 177 | 178 | w_c0_perfcntr2(reg.counter[2]); |
| 179 | + /* fall through */ | |
| 178 | 180 | case 2: |
| 179 | 181 | w_c0_perfctrl1(0); |
| 180 | 182 | w_c0_perfcntr1(reg.counter[1]); |
| 183 | + /* fall through */ | |
| 181 | 184 | case 1: |
| 182 | 185 | w_c0_perfctrl0(0); |
| 183 | 186 | w_c0_perfcntr0(reg.counter[0]); |
| @@ -195,10 +198,13 @@ static void mipsxx_cpu_start(void *args) · 11 unmodified lines | ||
| 195 | 198 | switch (counters) { |
| 196 | 199 | case 4: |
| 197 | 200 | w_c0_perfctrl3(WHAT | reg.control[3]); |
| 201 | + /* fall through */ | |
| 198 | 202 | case 3: |
| 199 | 203 | w_c0_perfctrl2(WHAT | reg.control[2]); |
| 204 | + /* fall through */ | |
| 200 | 205 | case 2: |
| 201 | 206 | w_c0_perfctrl1(WHAT | reg.control[1]); |
| 207 | + /* fall through */ | |
| 202 | 208 | case 1: |
| 203 | 209 | w_c0_perfctrl0(WHAT | reg.control[0]); |
| 204 | 210 | } |
| @@ -215,10 +221,13 @@ static void mipsxx_cpu_stop(void *args) · 10 unmodified lines | ||
| 215 | 221 | switch (counters) { |
| 216 | 222 | case 4: |
| 217 | 223 | w_c0_perfctrl3(0); |
| 224 | + /* fall through */ | |
| 218 | 225 | case 3: |
| 219 | 226 | w_c0_perfctrl2(0); |
| 227 | + /* fall through */ | |
| 220 | 228 | case 2: |
| 221 | 229 | w_c0_perfctrl1(0); |
| 230 | + /* fall through */ | |
| 222 | 231 | case 1: |
| 223 | 232 | w_c0_perfctrl0(0); |
| 224 | 233 | } |
| @@ -236,6 +245,7 @@ static int mipsxx_perfcount_handler(void) · 11 unmodified lines | ||
| 236 | 245 | |
| 237 | 246 | switch (counters) { |
| 238 | 247 | #define HANDLE_COUNTER(n) \ |
| 248 | + /* fall through */ \ | |
| 239 | 249 | case n + 1: \ |
| 240 | 250 | control = r_c0_perfctrl ## n(); \ |
| 241 | 251 | counter = r_c0_perfcntr ## n(); \ |
| @@ -297,12 +307,15 @@ static void reset_counters(void *arg) · 55 unmodified lines | ||
| 297 | 307 | case 4: |
| 298 | 308 | w_c0_perfctrl3(0); |
| 299 | 309 | w_c0_perfcntr3(0); |
| 310 | + /* fall through */ | |
| 300 | 311 | case 3: |
| 301 | 312 | w_c0_perfctrl2(0); |
| 302 | 313 | w_c0_perfcntr2(0); |
| 314 | + /* fall through */ | |
| 303 | 315 | case 2: |
| 304 | 316 | w_c0_perfctrl1(0); |
| 305 | 317 | w_c0_perfcntr1(0); |
| 318 | + /* fall through */ | |
| 306 | 319 | case 1: |
| 307 | 320 | w_c0_perfctrl0(0); |
| 308 | 321 | w_c0_perfcntr0(0); |
| @@ -474,6 +474,7 @@ static int bcm63xx_pcie_can_access(struct pci_bus *bus, int devfn) · 473 unmodified lines | ||
| 474 | 474 | if (PCI_SLOT(devfn) == 0) |
| 475 | 475 | return bcm_pcie_readl(PCIE_DLSTATUS_REG) |
| 476 | 476 | & DLSTATUS_PHYLINKUP; |
| 477 | + /* else, fall through */ | |
| 477 | 478 | default: |
| 478 | 479 | return false; |
| 479 | 480 | } |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #if _MIPS_SIM != _MIPS_SIM_ABI64 && defined(CONFIG_64BIT) |
| 10 | 10 | |
| 11 | 11 | /* Building 32-bit VDSO for the 64-bit kernel. Fake a 32-bit Kconfig. */ |
| 12 | +#define BUILD_VDSO32_64 | |
| 12 | 13 | #undef CONFIG_64BIT |
| 13 | 14 | #define CONFIG_32BIT 1 |
| 14 | 15 | #ifndef __ASSEMBLY__ |
| @@ -19,8 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | KBUILD_IMAGE := vmlinuz |
| 21 | 21 | |
| 22 | −KBUILD_DEFCONFIG := default_defconfig | |
| 23 | − | |
| 24 | 22 | NM = sh $(srctree)/arch/parisc/nm |
| 25 | 23 | CHECKFLAGS += -D__hppa__=1 |
| 26 | 24 | LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
| @@ -182,5 +180,8 @@ define archhelp · 155 unmodified lines | ||
| 182 | 180 | @echo ' zinstall - Install compressed vmlinuz kernel' |
| 183 | 181 | endef |
| 184 | 182 | |
| 183 | +archclean: | |
| 184 | + $(Q)$(MAKE) $(clean)=$(boot) | |
| 185 | + | |
| 185 | 186 | archheaders: |
| 186 | 187 | $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all |
| @@ -12,6 +12,7 @@ UBSAN_SANITIZE := n · 11 unmodified lines | ||
| 12 | 12 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 |
| 13 | 13 | targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 |
| 14 | 14 | targets += misc.o piggy.o sizes.h head.o real2.o firmware.o |
| 15 | +targets += real2.S firmware.c | |
| 15 | 16 | |
| 16 | 17 | KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER |
| 17 | 18 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING |
| @@ -55,7 +56,8 @@ $(obj)/misc.o: $(obj)/sizes.h · 37 unmodified lines | ||
| 55 | 56 | CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER |
| 56 | 57 | $(obj)/vmlinux.lds: $(obj)/sizes.h |
| 57 | 58 | |
| 58 | −$(obj)/vmlinux.bin: vmlinux | |
| 59 | +OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S | |
| 60 | +$(obj)/vmlinux.bin: vmlinux FORCE | |
| 59 | 61 | $(call if_changed,objcopy) |
| 60 | 62 | |
| 61 | 63 | vmlinux.bin.all-y := $(obj)/vmlinux.bin |
| @@ -48,8 +48,8 @@ SECTIONS · 47 unmodified lines | ||
| 48 | 48 | *(.rodata.compressed) |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | − /* bootloader code and data starts behind area of extracted kernel */ | |
| 52 | − . = (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START); | |
| 51 | + /* bootloader code and data starts at least behind area of extracted kernel */ | |
| 52 | + . = MAX(ABSOLUTE(.), (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START)); | |
| 53 | 53 | |
| 54 | 54 | /* align on next page boundary */ |
| 55 | 55 | . = ALIGN(4096); |
File renamed without changes.
| @@ -181,8 +181,9 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, · 180 unmodified lines | ||
| 181 | 181 | for (i = 0; i < ARRAY_SIZE(insn); i++) |
| 182 | 182 | insn[i] = INSN_NOP; |
| 183 | 183 | |
| 184 | + __patch_text((void *)rec->ip, INSN_NOP); | |
| 184 | 185 | __patch_text_multiple((void *)rec->ip + 4 - sizeof(insn), |
| 185 | − insn, sizeof(insn)); | |
| 186 | + insn, sizeof(insn)-4); | |
| 186 | 187 | return 0; |
| 187 | 188 | } |
| 188 | 189 | #endif |
| @@ -18,3 +18,4 @@ obj-y := frnd.o driver.o decode_exc.o fpudispatch.o denormal.o \ · 17 unmodified lines | ||
| 18 | 18 | # other very old or stripped-down PA-RISC CPUs -- not currently supported |
| 19 | 19 | |
| 20 | 20 | obj-$(CONFIG_MATH_EMULATION) += unimplemented-math-emulation.o |
| 21 | +CFLAGS_REMOVE_fpudispatch.o = -Wimplicit-fallthrough | |
| @@ -66,6 +66,7 @@ parisc_acctyp(unsigned long code, unsigned int inst) · 65 unmodified lines | ||
| 66 | 66 | case 0x30000000: /* coproc2 */ |
| 67 | 67 | if (bit22set(inst)) |
| 68 | 68 | return VM_WRITE; |
| 69 | + /* fall through */ | |
| 69 | 70 | |
| 70 | 71 | case 0x0: /* indexed/memory management */ |
| 71 | 72 | if (bit22set(inst)) { |
| @@ -107,22 +107,22 @@ extern void _set_L3CR(unsigned long); · 106 unmodified lines | ||
| 107 | 107 | |
| 108 | 108 | static inline void dcbz(void *addr) |
| 109 | 109 | { |
| 110 | − __asm__ __volatile__ ("dcbz %y0" : : "Z"(*(u8 *)addr) : "memory"); | |
| 110 | + __asm__ __volatile__ ("dcbz 0, %0" : : "r"(addr) : "memory"); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | static inline void dcbi(void *addr) |
| 114 | 114 | { |
| 115 | − __asm__ __volatile__ ("dcbi %y0" : : "Z"(*(u8 *)addr) : "memory"); | |
| 115 | + __asm__ __volatile__ ("dcbi 0, %0" : : "r"(addr) : "memory"); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | static inline void dcbf(void *addr) |
| 119 | 119 | { |
| 120 | − __asm__ __volatile__ ("dcbf %y0" : : "Z"(*(u8 *)addr) : "memory"); | |
| 120 | + __asm__ __volatile__ ("dcbf 0, %0" : : "r"(addr) : "memory"); | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | static inline void dcbst(void *addr) |
| 124 | 124 | { |
| 125 | − __asm__ __volatile__ ("dcbst %y0" : : "Z"(*(u8 *)addr) : "memory"); | |
| 125 | + __asm__ __volatile__ ("dcbst 0, %0" : : "r"(addr) : "memory"); | |
| 126 | 126 | } |
| 127 | 127 | #endif /* !__ASSEMBLY__ */ |
| 128 | 128 | #endif /* __KERNEL__ */ |
| @@ -49,6 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | #define __ARCH_WANT_SYS_FORK |
| 50 | 50 | #define __ARCH_WANT_SYS_VFORK |
| 51 | 51 | #define __ARCH_WANT_SYS_CLONE |
| 52 | +#define __ARCH_WANT_SYS_CLONE3 | |
| 52 | 53 | |
| 53 | 54 | #endif /* __ASSEMBLY__ */ |
| 54 | 55 | #endif /* _ASM_POWERPC_UNISTD_H_ */ |
| @@ -176,9 +176,11 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg, · 175 unmodified lines | ||
| 176 | 176 | ret |= __get_user_inatomic(temp.v[1], p++); |
| 177 | 177 | ret |= __get_user_inatomic(temp.v[2], p++); |
| 178 | 178 | ret |= __get_user_inatomic(temp.v[3], p++); |
| 179 | + /* fall through */ | |
| 179 | 180 | case 4: |
| 180 | 181 | ret |= __get_user_inatomic(temp.v[4], p++); |
| 181 | 182 | ret |= __get_user_inatomic(temp.v[5], p++); |
| 183 | + /* fall through */ | |
| 182 | 184 | case 2: |
| 183 | 185 | ret |= __get_user_inatomic(temp.v[6], p++); |
| 184 | 186 | ret |= __get_user_inatomic(temp.v[7], p++); |
| @@ -259,9 +261,11 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg, · 74 unmodified lines | ||
| 259 | 261 | ret |= __put_user_inatomic(data.v[1], p++); |
| 260 | 262 | ret |= __put_user_inatomic(data.v[2], p++); |
| 261 | 263 | ret |= __put_user_inatomic(data.v[3], p++); |
| 264 | + /* fall through */ | |
| 262 | 265 | case 4: |
| 263 | 266 | ret |= __put_user_inatomic(data.v[4], p++); |
| 264 | 267 | ret |= __put_user_inatomic(data.v[5], p++); |
| 268 | + /* fall through */ | |
| 265 | 269 | case 2: |
| 266 | 270 | ret |= __put_user_inatomic(data.v[6], p++); |
| 267 | 271 | ret |= __put_user_inatomic(data.v[7], p++); |
| @@ -597,6 +597,14 @@ ppc_clone: · 596 unmodified lines | ||
| 597 | 597 | stw r0,_TRAP(r1) /* register set saved */ |
| 598 | 598 | b sys_clone |
| 599 | 599 | |
| 600 | + .globl ppc_clone3 | |
| 601 | +ppc_clone3: | |
| 602 | + SAVE_NVGPRS(r1) | |
| 603 | + lwz r0,_TRAP(r1) | |
| 604 | + rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */ | |
| 605 | + stw r0,_TRAP(r1) /* register set saved */ | |
| 606 | + b sys_clone3 | |
| 607 | + | |
| 600 | 608 | .globl ppc_swapcontext |
| 601 | 609 | ppc_swapcontext: |
| 602 | 610 | SAVE_NVGPRS(r1) |
| @@ -487,6 +487,11 @@ _GLOBAL(ppc_clone) · 486 unmodified lines | ||
| 487 | 487 | bl sys_clone |
| 488 | 488 | b .Lsyscall_exit |
| 489 | 489 | |
| 490 | +_GLOBAL(ppc_clone3) | |
| 491 | + bl save_nvgprs | |
| 492 | + bl sys_clone3 | |
| 493 | + b .Lsyscall_exit | |
| 494 | + | |
| 490 | 495 | _GLOBAL(ppc32_swapcontext) |
| 491 | 496 | bl save_nvgprs |
| 492 | 497 | bl compat_sys_swapcontext |
| @@ -516,4 +516,4 @@ · 515 unmodified lines | ||
| 516 | 516 | 432 common fsmount sys_fsmount |
| 517 | 517 | 433 common fspick sys_fspick |
| 518 | 518 | 434 common pidfd_open sys_pidfd_open |
| 519 | −# 435 reserved for clone3 | |
| 519 | +435 nospu clone3 ppc_clone3 | |
| @@ -239,6 +239,7 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr, · 238 unmodified lines | ||
| 239 | 239 | case 2: |
| 240 | 240 | case 6: |
| 241 | 241 | pte->may_write = true; |
| 242 | + /* fall through */ | |
| 242 | 243 | case 3: |
| 243 | 244 | case 5: |
| 244 | 245 | case 7: |
| @@ -50,6 +50,11 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) · 49 unmodified lines | ||
| 50 | 50 | return !!(v->arch.pending_exceptions) || kvm_request_pending(v); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | +bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu) | |
| 54 | +{ | |
| 55 | + return kvm_arch_vcpu_runnable(vcpu); | |
| 56 | +} | |
| 57 | + | |
| 53 | 58 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) |
| 54 | 59 | { |
| 55 | 60 | return false; |
| @@ -452,16 +457,6 @@ err_out: · 396 unmodified lines | ||
| 452 | 457 | return -EINVAL; |
| 453 | 458 | } |
| 454 | 459 | |
| 455 | −bool kvm_arch_has_vcpu_debugfs(void) | |
| 456 | −{ | |
| 457 | − return false; | |
| 458 | −} | |
| 459 | − | |
| 460 | −int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | |
| 461 | −{ | |
| 462 | − return 0; | |
| 463 | −} | |
| 464 | − | |
| 465 | 460 | void kvm_arch_destroy_vm(struct kvm *kvm) |
| 466 | 461 | { |
| 467 | 462 | unsigned int i; |
| @@ -21,7 +21,7 @@ static void kasan_populate_pte(pte_t *ptep, pgprot_t prot) · 20 unmodified lines | ||
| 21 | 21 | __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot), 0); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | −static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end) | |
| 24 | +static int __ref kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end) | |
| 25 | 25 | { |
| 26 | 26 | pmd_t *pmd; |
| 27 | 27 | unsigned long k_cur, k_next; |
| @@ -35,7 +35,10 @@ static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_ · 7 unmodified lines | ||
| 35 | 35 | if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte) |
| 36 | 36 | continue; |
| 37 | 37 | |
| 38 | − new = pte_alloc_one_kernel(&init_mm); | |
| 38 | + if (slab_is_available()) | |
| 39 | + new = pte_alloc_one_kernel(&init_mm); | |
| 40 | + else | |
| 41 | + new = memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE); | |
| 39 | 42 | |
| 40 | 43 | if (!new) |
| 41 | 44 | return -ENOMEM; |
| @@ -275,12 +275,32 @@ static const struct attribute_group *papr_scm_dimm_groups[] = { · 274 unmodified lines | ||
| 275 | 275 | NULL, |
| 276 | 276 | }; |
| 277 | 277 | |
| 278 | +static inline int papr_scm_node(int node) | |
| 279 | +{ | |
| 280 | + int min_dist = INT_MAX, dist; | |
| 281 | + int nid, min_node; | |
| 282 | + | |
| 283 | + if ((node == NUMA_NO_NODE) || node_online(node)) | |
| 284 | + return node; | |
| 285 | + | |
| 286 | + min_node = first_online_node; | |
| 287 | + for_each_online_node(nid) { | |
| 288 | + dist = node_distance(node, nid); | |
| 289 | + if (dist < min_dist) { | |
| 290 | + min_dist = dist; | |
| 291 | + min_node = nid; | |
| 292 | + } | |
| 293 | + } | |
| 294 | + return min_node; | |
| 295 | +} | |
| 296 | + | |
| 278 | 297 | static int papr_scm_nvdimm_init(struct papr_scm_priv *p) |
| 279 | 298 | { |
| 280 | 299 | struct device *dev = &p->pdev->dev; |
| 281 | 300 | struct nd_mapping_desc mapping; |
| 282 | 301 | struct nd_region_desc ndr_desc; |
| 283 | 302 | unsigned long dimm_flags; |
| 303 | + int target_nid, online_nid; | |
| 284 | 304 | |
| 285 | 305 | p->bus_desc.ndctl = papr_scm_ndctl; |
| 286 | 306 | p->bus_desc.module = THIS_MODULE; |
| @@ -319,8 +339,10 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p) · 32 unmodified lines | ||
| 319 | 339 | |
| 320 | 340 | memset(&ndr_desc, 0, sizeof(ndr_desc)); |
| 321 | 341 | ndr_desc.attr_groups = region_attr_groups; |
| 322 | − ndr_desc.numa_node = dev_to_node(&p->pdev->dev); | |
| 323 | − ndr_desc.target_node = ndr_desc.numa_node; | |
| 342 | + target_nid = dev_to_node(&p->pdev->dev); | |
| 343 | + online_nid = papr_scm_node(target_nid); | |
| 344 | + ndr_desc.numa_node = online_nid; | |
| 345 | + ndr_desc.target_node = target_nid; | |
| 324 | 346 | ndr_desc.res = &p->res; |
| 325 | 347 | ndr_desc.of_node = p->dn; |
| 326 | 348 | ndr_desc.provider_data = p; |
| @@ -338,6 +360,9 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p) · 11 unmodified lines | ||
| 338 | 360 | ndr_desc.res, p->dn); |
| 339 | 361 | goto err; |
| 340 | 362 | } |
| 363 | + if (target_nid != online_nid) | |
| 364 | + dev_info(dev, "Region registered with target node %d and online node %d", | |
| 365 | + target_nid, online_nid); | |
| 341 | 366 | |
| 342 | 367 | return 0; |
| 343 | 368 | |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | ||
| 21 | 21 | cpus { |
| 22 | 22 | #address-cells = <1>; |
| 23 | 23 | #size-cells = <0>; |
| 24 | − timebase-frequency = <1000000>; | |
| 25 | 24 | cpu0: cpu@0 { |
| 26 | 25 | compatible = "sifive,e51", "sifive,rocket0", "riscv"; |
| 27 | 26 | device_type = "cpu"; |
| @@ -34,6 +34,7 @@ CONFIG_PCIEPORTBUS=y · 33 unmodified lines | ||
| 34 | 34 | CONFIG_PCI_HOST_GENERIC=y |
| 35 | 35 | CONFIG_PCIE_XILINX=y |
| 36 | 36 | CONFIG_DEVTMPFS=y |
| 37 | +CONFIG_DEVTMPFS_MOUNT=y | |
| 37 | 38 | CONFIG_BLK_DEV_LOOP=y |
| 38 | 39 | CONFIG_VIRTIO_BLK=y |
| 39 | 40 | CONFIG_BLK_DEV_SD=y |
| @@ -53,6 +54,8 @@ CONFIG_SERIAL_8250_CONSOLE=y · 13 unmodified lines | ||
| 53 | 54 | CONFIG_SERIAL_OF_PLATFORM=y |
| 54 | 55 | CONFIG_SERIAL_EARLYCON_RISCV_SBI=y |
| 55 | 56 | CONFIG_HVC_RISCV_SBI=y |
| 57 | +CONFIG_SPI=y | |
| 58 | +CONFIG_SPI_SIFIVE=y | |
| 56 | 59 | # CONFIG_PTP_1588_CLOCK is not set |
| 57 | 60 | CONFIG_DRM=y |
| 58 | 61 | CONFIG_DRM_RADEON=y |
| @@ -66,8 +69,9 @@ CONFIG_USB_OHCI_HCD=y · 7 unmodified lines | ||
| 66 | 69 | CONFIG_USB_OHCI_HCD_PLATFORM=y |
| 67 | 70 | CONFIG_USB_STORAGE=y |
| 68 | 71 | CONFIG_USB_UAS=y |
| 72 | +CONFIG_MMC=y | |
| 73 | +CONFIG_MMC_SPI=y | |
| 69 | 74 | CONFIG_VIRTIO_MMIO=y |
| 70 | −CONFIG_SPI_SIFIVE=y | |
| 71 | 75 | CONFIG_EXT4_FS=y |
| 72 | 76 | CONFIG_EXT4_FS_POSIX_ACL=y |
| 73 | 77 | CONFIG_AUTOFS4_FS=y |
| @@ -83,8 +87,4 @@ CONFIG_ROOT_NFS=y · 9 unmodified lines | ||
| 83 | 87 | CONFIG_CRYPTO_USER_API_HASH=y |
| 84 | 88 | CONFIG_CRYPTO_DEV_VIRTIO=y |
| 85 | 89 | CONFIG_PRINTK_TIME=y |
| 86 | −CONFIG_SPI=y | |
| 87 | −CONFIG_MMC_SPI=y | |
| 88 | −CONFIG_MMC=y | |
| 89 | −CONFIG_DEVTMPFS_MOUNT=y | |
| 90 | 90 | # CONFIG_RCU_TRACE is not set |
| @@ -37,7 +37,7 @@ $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE · 36 unmodified lines | ||
| 37 | 37 | # these symbols in the kernel code rather than hand-coded addresses. |
| 38 | 38 | |
| 39 | 39 | SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \ |
| 40 | − -Wl,--hash-style=both | |
| 40 | + -Wl,--build-id -Wl,--hash-style=both | |
| 41 | 41 | $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE |
| 42 | 42 | $(call if_changed,vdsold) |
| 43 | 43 | |
| @@ -5,5 +5,3 @@ lib-y += memset.o · 4 unmodified lines | ||
| 5 | 5 | lib-y += uaccess.o |
| 6 | 6 | |
| 7 | 7 | lib-$(CONFIG_64BIT) += tishift.o |
| 8 | − | |
| 9 | −lib-$(CONFIG_32BIT) += udivdi3.o | |
| @@ -81,9 +81,13 @@ EXPORT_SYMBOL(__delay); · 80 unmodified lines | ||
| 81 | 81 | void udelay(unsigned long usecs) |
| 82 | 82 | { |
| 83 | 83 | u64 ucycles = (u64)usecs * lpj_fine * UDELAY_MULT; |
| 84 | + u64 n; | |
| 84 | 85 | |
| 85 | 86 | if (unlikely(usecs > MAX_UDELAY_US)) { |
| 86 | − __delay((u64)usecs * riscv_timebase / 1000000ULL); | |
| 87 | + n = (u64)usecs * riscv_timebase; | |
| 88 | + do_div(n, 1000000); | |
| 89 | + | |
| 90 | + __delay(n); | |
| 87 | 91 | return; |
| 88 | 92 | } |
| 89 | 93 | |
| @@ -1,32 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | −/* | |
| 3 | − * Copyright (C) 2016-2017 Free Software Foundation, Inc. | |
| 4 | − */ | |
| 5 | − | |
| 6 | −#include <linux/linkage.h> | |
| 7 | − | |
| 8 | −ENTRY(__udivdi3) | |
| 9 | − mv a2, a1 | |
| 10 | − mv a1, a0 | |
| 11 | − li a0, -1 | |
| 12 | − beqz a2, .L5 | |
| 13 | − li a3, 1 | |
| 14 | − bgeu a2, a1, .L2 | |
| 15 | −.L1: | |
| 16 | − blez a2, .L2 | |
| 17 | − slli a2, a2, 1 | |
| 18 | − slli a3, a3, 1 | |
| 19 | − bgtu a1, a2, .L1 | |
| 20 | −.L2: | |
| 21 | − li a0, 0 | |
| 22 | −.L3: | |
| 23 | − bltu a1, a2, .L4 | |
| 24 | − sub a1, a1, a2 | |
| 25 | − or a0, a0, a3 | |
| 26 | −.L4: | |
| 27 | − srli a3, a3, 1 | |
| 28 | − srli a2, a2, 1 | |
| 29 | − bnez a3, .L3 | |
| 30 | −.L5: | |
| 31 | − ret | |
| 32 | −ENDPROC(__udivdi3) | |
| @@ -8,6 +8,7 @@ void store_ipl_parmblock(void); · 7 unmodified lines | ||
| 8 | 8 | void setup_boot_command_line(void); |
| 9 | 9 | void parse_boot_command_line(void); |
| 10 | 10 | void setup_memory_end(void); |
| 11 | +void verify_facilities(void); | |
| 11 | 12 | void print_missing_facilities(void); |
| 12 | 13 | unsigned long get_random_base(unsigned long safe_addr); |
| 13 | 14 | |
| @@ -48,9 +48,7 @@ void store_ipl_parmblock(void) · 47 unmodified lines | ||
| 48 | 48 | { |
| 49 | 49 | int rc; |
| 50 | 50 | |
| 51 | − uv_set_shared(__pa(&ipl_block)); | |
| 52 | 51 | rc = __diag308(DIAG308_STORE, &ipl_block); |
| 53 | − uv_remove_shared(__pa(&ipl_block)); | |
| 54 | 52 | if (rc == DIAG308_RC_OK && |
| 55 | 53 | ipl_block.hdr.version <= IPL_MAX_SUPPORTED_VERSION) |
| 56 | 54 | ipl_block_valid = 1; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <asm/timex.h> |
| 8 | 8 | #include <asm/sclp.h> |
| 9 | 9 | #include "compressed/decompressor.h" |
| 10 | +#include "boot.h" | |
| 10 | 11 | |
| 11 | 12 | #define PRNG_MODE_TDES 1 |
| 12 | 13 | #define PRNG_MODE_SHA512 2 |
| @@ -3,6 +3,7 @@ CONFIG_POSIX_MQUEUE=y · 2 unmodified lines | ||
| 3 | 3 | CONFIG_AUDIT=y |
| 4 | 4 | CONFIG_NO_HZ_IDLE=y |
| 5 | 5 | CONFIG_HIGH_RES_TIMERS=y |
| 6 | +CONFIG_PREEMPT=y | |
| 6 | 7 | CONFIG_BSD_PROCESS_ACCT=y |
| 7 | 8 | CONFIG_BSD_PROCESS_ACCT_V3=y |
| 8 | 9 | CONFIG_TASKSTATS=y |
| @@ -18,55 +19,71 @@ CONFIG_BLK_CGROUP=y · 9 unmodified lines | ||
| 18 | 19 | CONFIG_CFS_BANDWIDTH=y |
| 19 | 20 | CONFIG_RT_GROUP_SCHED=y |
| 20 | 21 | CONFIG_CGROUP_PIDS=y |
| 22 | +CONFIG_CGROUP_RDMA=y | |
| 21 | 23 | CONFIG_CGROUP_FREEZER=y |
| 22 | 24 | CONFIG_CGROUP_HUGETLB=y |
| 23 | 25 | CONFIG_CPUSETS=y |
| 24 | 26 | CONFIG_CGROUP_DEVICE=y |
| 25 | 27 | CONFIG_CGROUP_CPUACCT=y |
| 26 | 28 | CONFIG_CGROUP_PERF=y |
| 29 | +CONFIG_CGROUP_BPF=y | |
| 27 | 30 | CONFIG_NAMESPACES=y |
| 28 | 31 | CONFIG_USER_NS=y |
| 32 | +CONFIG_CHECKPOINT_RESTORE=y | |
| 29 | 33 | CONFIG_SCHED_AUTOGROUP=y |
| 30 | 34 | CONFIG_BLK_DEV_INITRD=y |
| 31 | 35 | CONFIG_EXPERT=y |
| 32 | 36 | # CONFIG_SYSFS_SYSCALL is not set |
| 33 | −CONFIG_CHECKPOINT_RESTORE=y | |
| 34 | 37 | CONFIG_BPF_SYSCALL=y |
| 35 | 38 | CONFIG_USERFAULTFD=y |
| 36 | 39 | # CONFIG_COMPAT_BRK is not set |
| 37 | 40 | CONFIG_PROFILING=y |
| 41 | +CONFIG_LIVEPATCH=y | |
| 42 | +CONFIG_TUNE_ZEC12=y | |
| 43 | +CONFIG_NR_CPUS=512 | |
| 44 | +CONFIG_NUMA=y | |
| 45 | +CONFIG_HZ_100=y | |
| 46 | +CONFIG_KEXEC_FILE=y | |
| 47 | +CONFIG_EXPOLINE=y | |
| 48 | +CONFIG_EXPOLINE_AUTO=y | |
| 49 | +CONFIG_CHSC_SCH=y | |
| 50 | +CONFIG_VFIO_CCW=m | |
| 51 | +CONFIG_VFIO_AP=m | |
| 52 | +CONFIG_CRASH_DUMP=y | |
| 53 | +CONFIG_HIBERNATION=y | |
| 54 | +CONFIG_PM_DEBUG=y | |
| 55 | +CONFIG_CMM=m | |
| 56 | +CONFIG_APPLDATA_BASE=y | |
| 57 | +CONFIG_KVM=m | |
| 58 | +CONFIG_VHOST_NET=m | |
| 59 | +CONFIG_VHOST_VSOCK=m | |
| 38 | 60 | CONFIG_OPROFILE=m |
| 39 | 61 | CONFIG_KPROBES=y |
| 40 | 62 | CONFIG_JUMP_LABEL=y |
| 41 | 63 | CONFIG_STATIC_KEYS_SELFTEST=y |
| 64 | +CONFIG_REFCOUNT_FULL=y | |
| 65 | +CONFIG_LOCK_EVENT_COUNTS=y | |
| 42 | 66 | CONFIG_MODULES=y |
| 43 | 67 | CONFIG_MODULE_FORCE_LOAD=y |
| 44 | 68 | CONFIG_MODULE_UNLOAD=y |
| 45 | 69 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 46 | 70 | CONFIG_MODVERSIONS=y |
| 47 | 71 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 72 | +CONFIG_MODULE_SIG=y | |
| 73 | +CONFIG_MODULE_SIG_SHA256=y | |
| 48 | 74 | CONFIG_BLK_DEV_INTEGRITY=y |
| 49 | 75 | CONFIG_BLK_DEV_THROTTLING=y |
| 50 | 76 | CONFIG_BLK_WBT=y |
| 51 | −CONFIG_BLK_WBT_SQ=y | |
| 77 | +CONFIG_BLK_CGROUP_IOLATENCY=y | |
| 52 | 78 | CONFIG_PARTITION_ADVANCED=y |
| 53 | 79 | CONFIG_IBM_PARTITION=y |
| 54 | 80 | CONFIG_BSD_DISKLABEL=y |
| 55 | 81 | CONFIG_MINIX_SUBPARTITION=y |
| 56 | 82 | CONFIG_SOLARIS_X86_PARTITION=y |
| 57 | 83 | CONFIG_UNIXWARE_DISKLABEL=y |
| 58 | −CONFIG_CFQ_GROUP_IOSCHED=y | |
| 59 | −CONFIG_DEFAULT_DEADLINE=y | |
| 60 | −CONFIG_LIVEPATCH=y | |
| 61 | −CONFIG_TUNE_ZEC12=y | |
| 62 | −CONFIG_NR_CPUS=512 | |
| 63 | −CONFIG_NUMA=y | |
| 64 | −CONFIG_PREEMPT=y | |
| 65 | −CONFIG_HZ_100=y | |
| 66 | −CONFIG_KEXEC_FILE=y | |
| 67 | −CONFIG_KEXEC_VERIFY_SIG=y | |
| 68 | −CONFIG_EXPOLINE=y | |
| 69 | −CONFIG_EXPOLINE_AUTO=y | |
| 84 | +CONFIG_IOSCHED_BFQ=y | |
| 85 | +CONFIG_BFQ_GROUP_IOSCHED=y | |
| 86 | +CONFIG_BINFMT_MISC=m | |
| 70 | 87 | CONFIG_MEMORY_HOTPLUG=y |
| 71 | 88 | CONFIG_MEMORY_HOTREMOVE=y |
| 72 | 89 | CONFIG_KSM=y |
| @@ -82,17 +99,8 @@ CONFIG_ZSMALLOC=m · 9 unmodified lines | ||
| 82 | 99 | CONFIG_ZSMALLOC_STAT=y |
| 83 | 100 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y |
| 84 | 101 | CONFIG_IDLE_PAGE_TRACKING=y |
| 85 | −CONFIG_PCI=y | |
| 86 | −CONFIG_PCI_DEBUG=y | |
| 87 | −CONFIG_HOTPLUG_PCI=y | |
| 88 | −CONFIG_HOTPLUG_PCI_S390=y | |
| 89 | −CONFIG_CHSC_SCH=y | |
| 90 | −CONFIG_VFIO_AP=m | |
| 91 | −CONFIG_VFIO_CCW=m | |
| 92 | −CONFIG_CRASH_DUMP=y | |
| 93 | −CONFIG_BINFMT_MISC=m | |
| 94 | −CONFIG_HIBERNATION=y | |
| 95 | −CONFIG_PM_DEBUG=y | |
| 102 | +CONFIG_PERCPU_STATS=y | |
| 103 | +CONFIG_GUP_BENCHMARK=y | |
| 96 | 104 | CONFIG_NET=y |
| 97 | 105 | CONFIG_PACKET=y |
| 98 | 106 | CONFIG_PACKET_DIAG=m |
| @@ -121,9 +129,6 @@ CONFIG_NET_IPVTI=m · 22 unmodified lines | ||
| 121 | 129 | CONFIG_INET_AH=m |
| 122 | 130 | CONFIG_INET_ESP=m |
| 123 | 131 | CONFIG_INET_IPCOMP=m |
| 124 | −CONFIG_INET_XFRM_MODE_TRANSPORT=m | |
| 125 | −CONFIG_INET_XFRM_MODE_TUNNEL=m | |
| 126 | −CONFIG_INET_XFRM_MODE_BEET=m | |
| 127 | 132 | CONFIG_INET_DIAG=m |
| 128 | 133 | CONFIG_INET_UDP_DIAG=m |
| 129 | 134 | CONFIG_TCP_CONG_ADVANCED=y |
| @@ -139,10 +144,6 @@ CONFIG_INET6_AH=m · 9 unmodified lines | ||
| 139 | 144 | CONFIG_INET6_ESP=m |
| 140 | 145 | CONFIG_INET6_IPCOMP=m |
| 141 | 146 | CONFIG_IPV6_MIP6=m |
| 142 | −CONFIG_INET6_XFRM_MODE_TRANSPORT=m | |
| 143 | −CONFIG_INET6_XFRM_MODE_TUNNEL=m | |
| 144 | −CONFIG_INET6_XFRM_MODE_BEET=m | |
| 145 | −CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m | |
| 146 | 147 | CONFIG_IPV6_VTI=m |
| 147 | 148 | CONFIG_IPV6_SIT=m |
| 148 | 149 | CONFIG_IPV6_GRE=m |
| @@ -264,11 +265,8 @@ CONFIG_IP_VS_SED=m · 115 unmodified lines | ||
| 264 | 265 | CONFIG_IP_VS_NQ=m |
| 265 | 266 | CONFIG_IP_VS_FTP=m |
| 266 | 267 | CONFIG_IP_VS_PE_SIP=m |
| 267 | −CONFIG_NF_CONNTRACK_IPV4=m | |
| 268 | 268 | CONFIG_NF_TABLES_IPV4=y |
| 269 | −CONFIG_NFT_CHAIN_ROUTE_IPV4=m | |
| 270 | 269 | CONFIG_NF_TABLES_ARP=y |
| 271 | −CONFIG_NFT_CHAIN_NAT_IPV4=m | |
| 272 | 270 | CONFIG_IP_NF_IPTABLES=m |
| 273 | 271 | CONFIG_IP_NF_MATCH_AH=m |
| 274 | 272 | CONFIG_IP_NF_MATCH_ECN=m |
| @@ -287,10 +285,7 @@ CONFIG_IP_NF_SECURITY=m · 12 unmodified lines | ||
| 287 | 285 | CONFIG_IP_NF_ARPTABLES=m |
| 288 | 286 | CONFIG_IP_NF_ARPFILTER=m |
| 289 | 287 | CONFIG_IP_NF_ARP_MANGLE=m |
| 290 | −CONFIG_NF_CONNTRACK_IPV6=m | |
| 291 | 288 | CONFIG_NF_TABLES_IPV6=y |
| 292 | −CONFIG_NFT_CHAIN_ROUTE_IPV6=m | |
| 293 | −CONFIG_NFT_CHAIN_NAT_IPV6=m | |
| 294 | 289 | CONFIG_IP6_NF_IPTABLES=m |
| 295 | 290 | CONFIG_IP6_NF_MATCH_AH=m |
| 296 | 291 | CONFIG_IP6_NF_MATCH_EUI64=m |
| @@ -309,7 +304,7 @@ CONFIG_IP6_NF_RAW=m · 12 unmodified lines | ||
| 309 | 304 | CONFIG_IP6_NF_SECURITY=m |
| 310 | 305 | CONFIG_IP6_NF_NAT=m |
| 311 | 306 | CONFIG_IP6_NF_TARGET_MASQUERADE=m |
| 312 | −CONFIG_NF_TABLES_BRIDGE=y | |
| 307 | +CONFIG_NF_TABLES_BRIDGE=m | |
| 313 | 308 | CONFIG_RDS=m |
| 314 | 309 | CONFIG_RDS_RDMA=m |
| 315 | 310 | CONFIG_RDS_TCP=m |
| @@ -375,9 +370,11 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 375 | 370 | CONFIG_CGROUP_NET_PRIO=y |
| 376 | 371 | CONFIG_BPF_JIT=y |
| 377 | 372 | CONFIG_NET_PKTGEN=m |
| 373 | +CONFIG_PCI=y | |
| 374 | +CONFIG_PCI_DEBUG=y | |
| 375 | +CONFIG_HOTPLUG_PCI=y | |
| 376 | +CONFIG_HOTPLUG_PCI_S390=y | |
| 378 | 377 | CONFIG_DEVTMPFS=y |
| 379 | −CONFIG_DMA_CMA=y | |
| 380 | −CONFIG_CMA_SIZE_MBYTES=0 | |
| 381 | 378 | CONFIG_CONNECTOR=y |
| 382 | 379 | CONFIG_ZRAM=m |
| 383 | 380 | CONFIG_BLK_DEV_LOOP=m |
| @@ -395,7 +392,6 @@ CONFIG_RAID_ATTRS=m · 11 unmodified lines | ||
| 395 | 392 | CONFIG_SCSI=y |
| 396 | 393 | CONFIG_BLK_DEV_SD=y |
| 397 | 394 | CONFIG_CHR_DEV_ST=m |
| 398 | −CONFIG_CHR_DEV_OSST=m | |
| 399 | 395 | CONFIG_BLK_DEV_SR=m |
| 400 | 396 | CONFIG_CHR_DEV_SG=y |
| 401 | 397 | CONFIG_CHR_DEV_SCH=m |
| @@ -415,17 +411,19 @@ CONFIG_SCSI_DH_RDAC=m · 13 unmodified lines | ||
| 415 | 411 | CONFIG_SCSI_DH_HP_SW=m |
| 416 | 412 | CONFIG_SCSI_DH_EMC=m |
| 417 | 413 | CONFIG_SCSI_DH_ALUA=m |
| 418 | −CONFIG_SCSI_OSD_INITIATOR=m | |
| 419 | −CONFIG_SCSI_OSD_ULD=m | |
| 420 | 414 | CONFIG_MD=y |
| 421 | 415 | CONFIG_BLK_DEV_MD=y |
| 422 | 416 | CONFIG_MD_LINEAR=m |
| 423 | 417 | CONFIG_MD_MULTIPATH=m |
| 424 | 418 | CONFIG_MD_FAULTY=m |
| 419 | +CONFIG_MD_CLUSTER=m | |
| 420 | +CONFIG_BCACHE=m | |
| 425 | 421 | CONFIG_BLK_DEV_DM=m |
| 422 | +CONFIG_DM_UNSTRIPED=m | |
| 426 | 423 | CONFIG_DM_CRYPT=m |
| 427 | 424 | CONFIG_DM_SNAPSHOT=m |
| 428 | 425 | CONFIG_DM_THIN_PROVISIONING=m |
| 426 | +CONFIG_DM_WRITECACHE=m | |
| 429 | 427 | CONFIG_DM_MIRROR=m |
| 430 | 428 | CONFIG_DM_LOG_USERSPACE=m |
| 431 | 429 | CONFIG_DM_RAID=m |
| @@ -445,23 +443,78 @@ CONFIG_EQUALIZER=m · 13 unmodified lines | ||
| 445 | 443 | CONFIG_IFB=m |
| 446 | 444 | CONFIG_MACVLAN=m |
| 447 | 445 | CONFIG_MACVTAP=m |
| 448 | −CONFIG_VXLAN=m | |
| 449 | 446 | CONFIG_TUN=m |
| 450 | 447 | CONFIG_VETH=m |
| 451 | 448 | CONFIG_VIRTIO_NET=m |
| 452 | 449 | CONFIG_NLMON=m |
| 450 | +# CONFIG_NET_VENDOR_3COM is not set | |
| 451 | +# CONFIG_NET_VENDOR_ADAPTEC is not set | |
| 452 | +# CONFIG_NET_VENDOR_AGERE is not set | |
| 453 | +# CONFIG_NET_VENDOR_ALACRITECH is not set | |
| 454 | +# CONFIG_NET_VENDOR_ALTEON is not set | |
| 455 | +# CONFIG_NET_VENDOR_AMAZON is not set | |
| 456 | +# CONFIG_NET_VENDOR_AMD is not set | |
| 457 | +# CONFIG_NET_VENDOR_AQUANTIA is not set | |
| 453 | 458 | # CONFIG_NET_VENDOR_ARC is not set |
| 459 | +# CONFIG_NET_VENDOR_ATHEROS is not set | |
| 460 | +# CONFIG_NET_VENDOR_AURORA is not set | |
| 461 | +# CONFIG_NET_VENDOR_BROADCOM is not set | |
| 462 | +# CONFIG_NET_VENDOR_BROCADE is not set | |
| 463 | +# CONFIG_NET_VENDOR_CADENCE is not set | |
| 464 | +# CONFIG_NET_VENDOR_CAVIUM is not set | |
| 454 | 465 | # CONFIG_NET_VENDOR_CHELSIO is not set |
| 466 | +# CONFIG_NET_VENDOR_CISCO is not set | |
| 467 | +# CONFIG_NET_VENDOR_CORTINA is not set | |
| 468 | +# CONFIG_NET_VENDOR_DEC is not set | |
| 469 | +# CONFIG_NET_VENDOR_DLINK is not set | |
| 470 | +# CONFIG_NET_VENDOR_EMULEX is not set | |
| 471 | +# CONFIG_NET_VENDOR_EZCHIP is not set | |
| 472 | +# CONFIG_NET_VENDOR_GOOGLE is not set | |
| 473 | +# CONFIG_NET_VENDOR_HP is not set | |
| 474 | +# CONFIG_NET_VENDOR_HUAWEI is not set | |
| 455 | 475 | # CONFIG_NET_VENDOR_INTEL is not set |
| 456 | 476 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 457 | 477 | CONFIG_MLX4_EN=m |
| 458 | 478 | CONFIG_MLX5_CORE=m |
| 459 | 479 | CONFIG_MLX5_CORE_EN=y |
| 480 | +# CONFIG_MLXFW is not set | |
| 481 | +# CONFIG_NET_VENDOR_MICREL is not set | |
| 482 | +# CONFIG_NET_VENDOR_MICROCHIP is not set | |
| 483 | +# CONFIG_NET_VENDOR_MICROSEMI is not set | |
| 484 | +# CONFIG_NET_VENDOR_MYRI is not set | |
| 460 | 485 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 486 | +# CONFIG_NET_VENDOR_NETERION is not set | |
| 487 | +# CONFIG_NET_VENDOR_NETRONOME is not set | |
| 488 | +# CONFIG_NET_VENDOR_NI is not set | |
| 489 | +# CONFIG_NET_VENDOR_NVIDIA is not set | |
| 490 | +# CONFIG_NET_VENDOR_OKI is not set | |
| 491 | +# CONFIG_NET_VENDOR_PACKET_ENGINES is not set | |
| 492 | +# CONFIG_NET_VENDOR_QLOGIC is not set | |
| 493 | +# CONFIG_NET_VENDOR_QUALCOMM is not set | |
| 494 | +# CONFIG_NET_VENDOR_RDC is not set | |
| 495 | +# CONFIG_NET_VENDOR_REALTEK is not set | |
| 496 | +# CONFIG_NET_VENDOR_RENESAS is not set | |
| 497 | +# CONFIG_NET_VENDOR_ROCKER is not set | |
| 498 | +# CONFIG_NET_VENDOR_SAMSUNG is not set | |
| 499 | +# CONFIG_NET_VENDOR_SEEQ is not set | |
| 500 | +# CONFIG_NET_VENDOR_SOLARFLARE is not set | |
| 501 | +# CONFIG_NET_VENDOR_SILAN is not set | |
| 502 | +# CONFIG_NET_VENDOR_SIS is not set | |
| 503 | +# CONFIG_NET_VENDOR_SMSC is not set | |
| 504 | +# CONFIG_NET_VENDOR_SOCIONEXT is not set | |
| 505 | +# CONFIG_NET_VENDOR_STMICRO is not set | |
| 506 | +# CONFIG_NET_VENDOR_SUN is not set | |
| 507 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 508 | +# CONFIG_NET_VENDOR_TEHUTI is not set | |
| 509 | +# CONFIG_NET_VENDOR_TI is not set | |
| 510 | +# CONFIG_NET_VENDOR_VIA is not set | |
| 511 | +# CONFIG_NET_VENDOR_WIZNET is not set | |
| 461 | 512 | CONFIG_PPP=m |
| 462 | 513 | CONFIG_PPP_BSDCOMP=m |
| 463 | 514 | CONFIG_PPP_DEFLATE=m |
| 515 | +CONFIG_PPP_FILTER=y | |
| 464 | 516 | CONFIG_PPP_MPPE=m |
| 517 | +CONFIG_PPP_MULTILINK=y | |
| 465 | 518 | CONFIG_PPPOE=m |
| 466 | 519 | CONFIG_PPTP=m |
| 467 | 520 | CONFIG_PPPOL2TP=m |
| @@ -473,10 +526,13 @@ CONFIG_INPUT_EVDEV=y · 5 unmodified lines | ||
| 473 | 526 | # CONFIG_INPUT_MOUSE is not set |
| 474 | 527 | # CONFIG_SERIO is not set |
| 475 | 528 | CONFIG_LEGACY_PTY_COUNT=0 |
| 529 | +CONFIG_NULL_TTY=m | |
| 476 | 530 | CONFIG_HW_RANDOM_VIRTIO=m |
| 477 | 531 | CONFIG_RAW_DRIVER=m |
| 478 | 532 | CONFIG_HANGCHECK_TIMER=m |
| 479 | 533 | CONFIG_TN3270_FS=y |
| 534 | +CONFIG_PPS=m | |
| 535 | +# CONFIG_PTP_1588_CLOCK is not set | |
| 480 | 536 | # CONFIG_HWMON is not set |
| 481 | 537 | CONFIG_WATCHDOG=y |
| 482 | 538 | CONFIG_WATCHDOG_NOWAYOUT=y |
| @@ -498,8 +554,8 @@ CONFIG_VFIO_MDEV_DEVICE=m · 15 unmodified lines | ||
| 498 | 554 | CONFIG_VIRTIO_PCI=m |
| 499 | 555 | CONFIG_VIRTIO_BALLOON=m |
| 500 | 556 | CONFIG_VIRTIO_INPUT=y |
| 501 | −CONFIG_S390_AP_IOMMU=y | |
| 502 | 557 | CONFIG_S390_CCW_IOMMU=y |
| 558 | +CONFIG_S390_AP_IOMMU=y | |
| 503 | 559 | CONFIG_EXT4_FS=y |
| 504 | 560 | CONFIG_EXT4_FS_POSIX_ACL=y |
| 505 | 561 | CONFIG_EXT4_FS_SECURITY=y |
| @@ -519,6 +575,7 @@ CONFIG_OCFS2_FS=m · 13 unmodified lines | ||
| 519 | 575 | CONFIG_BTRFS_FS=y |
| 520 | 576 | CONFIG_BTRFS_FS_POSIX_ACL=y |
| 521 | 577 | CONFIG_BTRFS_DEBUG=y |
| 578 | +CONFIG_BTRFS_ASSERT=y | |
| 522 | 579 | CONFIG_NILFS2_FS=m |
| 523 | 580 | CONFIG_FS_DAX=y |
| 524 | 581 | CONFIG_EXPORTFS_BLOCK_OPS=y |
| @@ -552,8 +609,10 @@ CONFIG_ECRYPT_FS=m · 27 unmodified lines | ||
| 552 | 609 | CONFIG_CRAMFS=m |
| 553 | 610 | CONFIG_SQUASHFS=m |
| 554 | 611 | CONFIG_SQUASHFS_XATTR=y |
| 612 | +CONFIG_SQUASHFS_LZ4=y | |
| 555 | 613 | CONFIG_SQUASHFS_LZO=y |
| 556 | 614 | CONFIG_SQUASHFS_XZ=y |
| 615 | +CONFIG_SQUASHFS_ZSTD=y | |
| 557 | 616 | CONFIG_ROMFS_FS=m |
| 558 | 617 | CONFIG_NFS_FS=m |
| 559 | 618 | CONFIG_NFS_V3_ACL=y |
| @@ -564,7 +623,6 @@ CONFIG_NFSD_V3_ACL=y · 4 unmodified lines | ||
| 564 | 623 | CONFIG_NFSD_V4=y |
| 565 | 624 | CONFIG_NFSD_V4_SECURITY_LABEL=y |
| 566 | 625 | CONFIG_CIFS=m |
| 567 | −CONFIG_CIFS_STATS=y | |
| 568 | 626 | CONFIG_CIFS_STATS2=y |
| 569 | 627 | CONFIG_CIFS_WEAK_PW_HASH=y |
| 570 | 628 | CONFIG_CIFS_UPCALL=y |
| @@ -580,19 +638,112 @@ CONFIG_NLS_ISO8859_1=m · 9 unmodified lines | ||
| 580 | 638 | CONFIG_NLS_ISO8859_15=m |
| 581 | 639 | CONFIG_NLS_UTF8=m |
| 582 | 640 | CONFIG_DLM=m |
| 641 | +CONFIG_UNICODE=y | |
| 642 | +CONFIG_PERSISTENT_KEYRINGS=y | |
| 643 | +CONFIG_BIG_KEYS=y | |
| 644 | +CONFIG_ENCRYPTED_KEYS=m | |
| 645 | +CONFIG_SECURITY=y | |
| 646 | +CONFIG_SECURITY_NETWORK=y | |
| 647 | +CONFIG_FORTIFY_SOURCE=y | |
| 648 | +CONFIG_SECURITY_SELINUX=y | |
| 649 | +CONFIG_SECURITY_SELINUX_BOOTPARAM=y | |
| 650 | +CONFIG_SECURITY_SELINUX_DISABLE=y | |
| 651 | +CONFIG_INTEGRITY_SIGNATURE=y | |
| 652 | +CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y | |
| 653 | +CONFIG_IMA=y | |
| 654 | +CONFIG_IMA_DEFAULT_HASH_SHA256=y | |
| 655 | +CONFIG_IMA_WRITE_POLICY=y | |
| 656 | +CONFIG_IMA_APPRAISE=y | |
| 657 | +CONFIG_CRYPTO_USER=m | |
| 658 | +# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set | |
| 659 | +CONFIG_CRYPTO_PCRYPT=m | |
| 660 | +CONFIG_CRYPTO_CRYPTD=m | |
| 661 | +CONFIG_CRYPTO_TEST=m | |
| 662 | +CONFIG_CRYPTO_DH=m | |
| 663 | +CONFIG_CRYPTO_ECDH=m | |
| 664 | +CONFIG_CRYPTO_ECRDSA=m | |
| 665 | +CONFIG_CRYPTO_CHACHA20POLY1305=m | |
| 666 | +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 | +CONFIG_CRYPTO_CFB=m | |
| 672 | +CONFIG_CRYPTO_LRW=m | |
| 673 | +CONFIG_CRYPTO_PCBC=m | |
| 674 | +CONFIG_CRYPTO_KEYWRAP=m | |
| 675 | +CONFIG_CRYPTO_ADIANTUM=m | |
| 676 | +CONFIG_CRYPTO_XCBC=m | |
| 677 | +CONFIG_CRYPTO_VMAC=m | |
| 678 | +CONFIG_CRYPTO_CRC32=m | |
| 679 | +CONFIG_CRYPTO_XXHASH=m | |
| 680 | +CONFIG_CRYPTO_MICHAEL_MIC=m | |
| 681 | +CONFIG_CRYPTO_RMD128=m | |
| 682 | +CONFIG_CRYPTO_RMD160=m | |
| 683 | +CONFIG_CRYPTO_RMD256=m | |
| 684 | +CONFIG_CRYPTO_RMD320=m | |
| 685 | +CONFIG_CRYPTO_SHA3=m | |
| 686 | +CONFIG_CRYPTO_SM3=m | |
| 687 | +CONFIG_CRYPTO_TGR192=m | |
| 688 | +CONFIG_CRYPTO_WP512=m | |
| 689 | +CONFIG_CRYPTO_AES_TI=m | |
| 690 | +CONFIG_CRYPTO_ANUBIS=m | |
| 691 | +CONFIG_CRYPTO_ARC4=m | |
| 692 | +CONFIG_CRYPTO_BLOWFISH=m | |
| 693 | +CONFIG_CRYPTO_CAMELLIA=m | |
| 694 | +CONFIG_CRYPTO_CAST5=m | |
| 695 | +CONFIG_CRYPTO_CAST6=m | |
| 696 | +CONFIG_CRYPTO_FCRYPT=m | |
| 697 | +CONFIG_CRYPTO_KHAZAD=m | |
| 698 | +CONFIG_CRYPTO_SALSA20=m | |
| 699 | +CONFIG_CRYPTO_SEED=m | |
| 700 | +CONFIG_CRYPTO_SERPENT=m | |
| 701 | +CONFIG_CRYPTO_SM4=m | |
| 702 | +CONFIG_CRYPTO_TEA=m | |
| 703 | +CONFIG_CRYPTO_TWOFISH=m | |
| 704 | +CONFIG_CRYPTO_842=m | |
| 705 | +CONFIG_CRYPTO_LZ4=m | |
| 706 | +CONFIG_CRYPTO_LZ4HC=m | |
| 707 | +CONFIG_CRYPTO_ZSTD=m | |
| 708 | +CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 709 | +CONFIG_CRYPTO_USER_API_HASH=m | |
| 710 | +CONFIG_CRYPTO_USER_API_SKCIPHER=m | |
| 711 | +CONFIG_CRYPTO_USER_API_RNG=m | |
| 712 | +CONFIG_CRYPTO_USER_API_AEAD=m | |
| 713 | +CONFIG_CRYPTO_STATS=y | |
| 714 | +CONFIG_ZCRYPT=m | |
| 715 | +CONFIG_PKEY=m | |
| 716 | +CONFIG_CRYPTO_PAES_S390=m | |
| 717 | +CONFIG_CRYPTO_SHA1_S390=m | |
| 718 | +CONFIG_CRYPTO_SHA256_S390=m | |
| 719 | +CONFIG_CRYPTO_SHA512_S390=m | |
| 720 | +CONFIG_CRYPTO_DES_S390=m | |
| 721 | +CONFIG_CRYPTO_AES_S390=m | |
| 722 | +CONFIG_CRYPTO_GHASH_S390=m | |
| 723 | +CONFIG_CRYPTO_CRC32_S390=y | |
| 724 | +CONFIG_CORDIC=m | |
| 725 | +CONFIG_CRC32_SELFTEST=y | |
| 726 | +CONFIG_CRC4=m | |
| 727 | +CONFIG_CRC7=m | |
| 728 | +CONFIG_CRC8=m | |
| 729 | +CONFIG_RANDOM32_SELFTEST=y | |
| 730 | +CONFIG_DMA_CMA=y | |
| 731 | +CONFIG_CMA_SIZE_MBYTES=0 | |
| 732 | +CONFIG_DMA_API_DEBUG=y | |
| 733 | +CONFIG_STRING_SELFTEST=y | |
| 583 | 734 | CONFIG_PRINTK_TIME=y |
| 584 | 735 | CONFIG_DYNAMIC_DEBUG=y |
| 585 | 736 | CONFIG_DEBUG_INFO=y |
| 586 | 737 | CONFIG_DEBUG_INFO_DWARF4=y |
| 587 | 738 | CONFIG_GDB_SCRIPTS=y |
| 588 | 739 | CONFIG_FRAME_WARN=1024 |
| 589 | −CONFIG_READABLE_ASM=y | |
| 590 | 740 | CONFIG_UNUSED_SYMBOLS=y |
| 591 | 741 | CONFIG_HEADERS_INSTALL=y |
| 592 | 742 | CONFIG_HEADERS_CHECK=y |
| 593 | 743 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| 594 | 744 | CONFIG_MAGIC_SYSRQ=y |
| 595 | 745 | CONFIG_DEBUG_PAGEALLOC=y |
| 746 | +CONFIG_PAGE_OWNER=y | |
| 596 | 747 | CONFIG_DEBUG_RODATA_TEST=y |
| 597 | 748 | CONFIG_DEBUG_OBJECTS=y |
| 598 | 749 | CONFIG_DEBUG_OBJECTS_SELFTEST=y |
| @@ -645,7 +796,6 @@ CONFIG_STACK_TRACER=y · 46 unmodified lines | ||
| 645 | 796 | CONFIG_BLK_DEV_IO_TRACE=y |
| 646 | 797 | CONFIG_FUNCTION_PROFILER=y |
| 647 | 798 | CONFIG_HIST_TRIGGERS=y |
| 648 | −CONFIG_DMA_API_DEBUG=y | |
| 649 | 799 | CONFIG_LKDTM=m |
| 650 | 800 | CONFIG_TEST_LIST_SORT=y |
| 651 | 801 | CONFIG_TEST_SORT=y |
| @@ -657,85 +807,3 @@ CONFIG_ATOMIC64_SELFTEST=y · 5 unmodified lines | ||
| 657 | 807 | CONFIG_TEST_BPF=m |
| 658 | 808 | CONFIG_BUG_ON_DATA_CORRUPTION=y |
| 659 | 809 | CONFIG_S390_PTDUMP=y |
| 660 | −CONFIG_PERSISTENT_KEYRINGS=y | |
| 661 | −CONFIG_BIG_KEYS=y | |
| 662 | −CONFIG_ENCRYPTED_KEYS=m | |
| 663 | −CONFIG_SECURITY=y | |
| 664 | −CONFIG_SECURITY_NETWORK=y | |
| 665 | −CONFIG_FORTIFY_SOURCE=y | |
| 666 | −CONFIG_SECURITY_SELINUX=y | |
| 667 | −CONFIG_SECURITY_SELINUX_BOOTPARAM=y | |
| 668 | −CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 | |
| 669 | −CONFIG_SECURITY_SELINUX_DISABLE=y | |
| 670 | −CONFIG_INTEGRITY_SIGNATURE=y | |
| 671 | −CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y | |
| 672 | −CONFIG_IMA=y | |
| 673 | −CONFIG_IMA_DEFAULT_HASH_SHA256=y | |
| 674 | −CONFIG_IMA_WRITE_POLICY=y | |
| 675 | −CONFIG_IMA_APPRAISE=y | |
| 676 | −CONFIG_CRYPTO_DH=m | |
| 677 | −CONFIG_CRYPTO_ECDH=m | |
| 678 | −CONFIG_CRYPTO_USER=m | |
| 679 | −# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set | |
| 680 | −CONFIG_CRYPTO_PCRYPT=m | |
| 681 | −CONFIG_CRYPTO_CRYPTD=m | |
| 682 | −CONFIG_CRYPTO_TEST=m | |
| 683 | −CONFIG_CRYPTO_CHACHA20POLY1305=m | |
| 684 | −CONFIG_CRYPTO_LRW=m | |
| 685 | −CONFIG_CRYPTO_PCBC=m | |
| 686 | −CONFIG_CRYPTO_KEYWRAP=m | |
| 687 | −CONFIG_CRYPTO_XCBC=m | |
| 688 | −CONFIG_CRYPTO_VMAC=m | |
| 689 | −CONFIG_CRYPTO_CRC32=m | |
| 690 | −CONFIG_CRYPTO_MICHAEL_MIC=m | |
| 691 | −CONFIG_CRYPTO_RMD128=m | |
| 692 | −CONFIG_CRYPTO_RMD160=m | |
| 693 | −CONFIG_CRYPTO_RMD256=m | |
| 694 | −CONFIG_CRYPTO_RMD320=m | |
| 695 | −CONFIG_CRYPTO_SHA512=m | |
| 696 | −CONFIG_CRYPTO_SHA3=m | |
| 697 | −CONFIG_CRYPTO_TGR192=m | |
| 698 | −CONFIG_CRYPTO_WP512=m | |
| 699 | −CONFIG_CRYPTO_AES_TI=m | |
| 700 | −CONFIG_CRYPTO_ANUBIS=m | |
| 701 | −CONFIG_CRYPTO_BLOWFISH=m | |
| 702 | −CONFIG_CRYPTO_CAMELLIA=m | |
| 703 | −CONFIG_CRYPTO_CAST5=m | |
| 704 | −CONFIG_CRYPTO_CAST6=m | |
| 705 | −CONFIG_CRYPTO_FCRYPT=m | |
| 706 | −CONFIG_CRYPTO_KHAZAD=m | |
| 707 | −CONFIG_CRYPTO_SALSA20=m | |
| 708 | −CONFIG_CRYPTO_SEED=m | |
| 709 | −CONFIG_CRYPTO_SERPENT=m | |
| 710 | −CONFIG_CRYPTO_TEA=m | |
| 711 | −CONFIG_CRYPTO_TWOFISH=m | |
| 712 | −CONFIG_CRYPTO_842=m | |
| 713 | −CONFIG_CRYPTO_LZ4=m | |
| 714 | −CONFIG_CRYPTO_LZ4HC=m | |
| 715 | −CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 716 | −CONFIG_CRYPTO_USER_API_HASH=m | |
| 717 | −CONFIG_CRYPTO_USER_API_SKCIPHER=m | |
| 718 | −CONFIG_CRYPTO_USER_API_RNG=m | |
| 719 | −CONFIG_CRYPTO_USER_API_AEAD=m | |
| 720 | −CONFIG_ZCRYPT=m | |
| 721 | −CONFIG_PKEY=m | |
| 722 | −CONFIG_CRYPTO_PAES_S390=m | |
| 723 | −CONFIG_CRYPTO_SHA1_S390=m | |
| 724 | −CONFIG_CRYPTO_SHA256_S390=m | |
| 725 | −CONFIG_CRYPTO_SHA512_S390=m | |
| 726 | −CONFIG_CRYPTO_DES_S390=m | |
| 727 | −CONFIG_CRYPTO_AES_S390=m | |
| 728 | −CONFIG_CRYPTO_GHASH_S390=m | |
| 729 | −CONFIG_CRYPTO_CRC32_S390=y | |
| 730 | −CONFIG_PKCS7_MESSAGE_PARSER=y | |
| 731 | −CONFIG_SYSTEM_TRUSTED_KEYRING=y | |
| 732 | −CONFIG_CRC7=m | |
| 733 | −CONFIG_CRC8=m | |
| 734 | −CONFIG_RANDOM32_SELFTEST=y | |
| 735 | −CONFIG_CORDIC=m | |
| 736 | −CONFIG_CMM=m | |
| 737 | −CONFIG_APPLDATA_BASE=y | |
| 738 | −CONFIG_KVM=m | |
| 739 | −CONFIG_KVM_S390_UCONTROL=y | |
| 740 | −CONFIG_VHOST_NET=m | |
| 741 | −CONFIG_VHOST_VSOCK=m | |
| @@ -12,30 +12,51 @@ CONFIG_TASK_IO_ACCOUNTING=y · 11 unmodified lines | ||
| 12 | 12 | CONFIG_IKCONFIG=y |
| 13 | 13 | CONFIG_IKCONFIG_PROC=y |
| 14 | 14 | CONFIG_NUMA_BALANCING=y |
| 15 | −# CONFIG_NUMA_BALANCING_DEFAULT_ENABLED is not set | |
| 16 | 15 | CONFIG_MEMCG=y |
| 17 | 16 | CONFIG_MEMCG_SWAP=y |
| 18 | 17 | CONFIG_BLK_CGROUP=y |
| 19 | 18 | CONFIG_CFS_BANDWIDTH=y |
| 20 | 19 | CONFIG_RT_GROUP_SCHED=y |
| 21 | 20 | CONFIG_CGROUP_PIDS=y |
| 21 | +CONFIG_CGROUP_RDMA=y | |
| 22 | 22 | CONFIG_CGROUP_FREEZER=y |
| 23 | 23 | CONFIG_CGROUP_HUGETLB=y |
| 24 | 24 | CONFIG_CPUSETS=y |
| 25 | 25 | CONFIG_CGROUP_DEVICE=y |
| 26 | 26 | CONFIG_CGROUP_CPUACCT=y |
| 27 | 27 | CONFIG_CGROUP_PERF=y |
| 28 | +CONFIG_CGROUP_BPF=y | |
| 28 | 29 | CONFIG_NAMESPACES=y |
| 29 | 30 | CONFIG_USER_NS=y |
| 31 | +CONFIG_CHECKPOINT_RESTORE=y | |
| 30 | 32 | CONFIG_SCHED_AUTOGROUP=y |
| 31 | 33 | CONFIG_BLK_DEV_INITRD=y |
| 32 | 34 | CONFIG_EXPERT=y |
| 33 | 35 | # CONFIG_SYSFS_SYSCALL is not set |
| 34 | −CONFIG_CHECKPOINT_RESTORE=y | |
| 35 | 36 | CONFIG_BPF_SYSCALL=y |
| 36 | 37 | CONFIG_USERFAULTFD=y |
| 37 | 38 | # CONFIG_COMPAT_BRK is not set |
| 38 | 39 | CONFIG_PROFILING=y |
| 40 | +CONFIG_LIVEPATCH=y | |
| 41 | +CONFIG_TUNE_ZEC12=y | |
| 42 | +CONFIG_NR_CPUS=512 | |
| 43 | +CONFIG_NUMA=y | |
| 44 | +# CONFIG_NUMA_EMU is not set | |
| 45 | +CONFIG_HZ_100=y | |
| 46 | +CONFIG_KEXEC_FILE=y | |
| 47 | +CONFIG_EXPOLINE=y | |
| 48 | +CONFIG_EXPOLINE_AUTO=y | |
| 49 | +CONFIG_CHSC_SCH=y | |
| 50 | +CONFIG_VFIO_CCW=m | |
| 51 | +CONFIG_VFIO_AP=m | |
| 52 | +CONFIG_CRASH_DUMP=y | |
| 53 | +CONFIG_HIBERNATION=y | |
| 54 | +CONFIG_PM_DEBUG=y | |
| 55 | +CONFIG_CMM=m | |
| 56 | +CONFIG_APPLDATA_BASE=y | |
| 57 | +CONFIG_KVM=m | |
| 58 | +CONFIG_VHOST_NET=m | |
| 59 | +CONFIG_VHOST_VSOCK=m | |
| 39 | 60 | CONFIG_OPROFILE=m |
| 40 | 61 | CONFIG_KPROBES=y |
| 41 | 62 | CONFIG_JUMP_LABEL=y |
| @@ -47,27 +68,18 @@ CONFIG_MODVERSIONS=y · 5 unmodified lines | ||
| 47 | 68 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 48 | 69 | CONFIG_MODULE_SIG=y |
| 49 | 70 | CONFIG_MODULE_SIG_SHA256=y |
| 50 | −CONFIG_BLK_DEV_INTEGRITY=y | |
| 51 | 71 | CONFIG_BLK_DEV_THROTTLING=y |
| 52 | 72 | CONFIG_BLK_WBT=y |
| 53 | −CONFIG_BLK_WBT_SQ=y | |
| 73 | +CONFIG_BLK_CGROUP_IOLATENCY=y | |
| 54 | 74 | CONFIG_PARTITION_ADVANCED=y |
| 55 | 75 | CONFIG_IBM_PARTITION=y |
| 56 | 76 | CONFIG_BSD_DISKLABEL=y |
| 57 | 77 | CONFIG_MINIX_SUBPARTITION=y |
| 58 | 78 | CONFIG_SOLARIS_X86_PARTITION=y |
| 59 | 79 | CONFIG_UNIXWARE_DISKLABEL=y |
| 60 | −CONFIG_CFQ_GROUP_IOSCHED=y | |
| 61 | −CONFIG_DEFAULT_DEADLINE=y | |
| 62 | −CONFIG_LIVEPATCH=y | |
| 63 | −CONFIG_TUNE_ZEC12=y | |
| 64 | −CONFIG_NR_CPUS=512 | |
| 65 | −CONFIG_NUMA=y | |
| 66 | −CONFIG_HZ_100=y | |
| 67 | −CONFIG_KEXEC_FILE=y | |
| 68 | −CONFIG_KEXEC_VERIFY_SIG=y | |
| 69 | −CONFIG_EXPOLINE=y | |
| 70 | −CONFIG_EXPOLINE_AUTO=y | |
| 80 | +CONFIG_IOSCHED_BFQ=y | |
| 81 | +CONFIG_BFQ_GROUP_IOSCHED=y | |
| 82 | +CONFIG_BINFMT_MISC=m | |
| 71 | 83 | CONFIG_MEMORY_HOTPLUG=y |
| 72 | 84 | CONFIG_MEMORY_HOTREMOVE=y |
| 73 | 85 | CONFIG_KSM=y |
| @@ -81,16 +93,8 @@ CONFIG_ZSMALLOC=m · 7 unmodified lines | ||
| 81 | 93 | CONFIG_ZSMALLOC_STAT=y |
| 82 | 94 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y |
| 83 | 95 | CONFIG_IDLE_PAGE_TRACKING=y |
| 84 | −CONFIG_PCI=y | |
| 85 | −CONFIG_HOTPLUG_PCI=y | |
| 86 | −CONFIG_HOTPLUG_PCI_S390=y | |
| 87 | −CONFIG_CHSC_SCH=y | |
| 88 | −CONFIG_VFIO_AP=m | |
| 89 | −CONFIG_VFIO_CCW=m | |
| 90 | −CONFIG_CRASH_DUMP=y | |
| 91 | −CONFIG_BINFMT_MISC=m | |
| 92 | −CONFIG_HIBERNATION=y | |
| 93 | −CONFIG_PM_DEBUG=y | |
| 96 | +CONFIG_PERCPU_STATS=y | |
| 97 | +CONFIG_GUP_BENCHMARK=y | |
| 94 | 98 | CONFIG_NET=y |
| 95 | 99 | CONFIG_PACKET=y |
| 96 | 100 | CONFIG_PACKET_DIAG=m |
| @@ -119,9 +123,6 @@ CONFIG_NET_IPVTI=m · 22 unmodified lines | ||
| 119 | 123 | CONFIG_INET_AH=m |
| 120 | 124 | CONFIG_INET_ESP=m |
| 121 | 125 | CONFIG_INET_IPCOMP=m |
| 122 | −CONFIG_INET_XFRM_MODE_TRANSPORT=m | |
| 123 | −CONFIG_INET_XFRM_MODE_TUNNEL=m | |
| 124 | −CONFIG_INET_XFRM_MODE_BEET=m | |
| 125 | 126 | CONFIG_INET_DIAG=m |
| 126 | 127 | CONFIG_INET_UDP_DIAG=m |
| 127 | 128 | CONFIG_TCP_CONG_ADVANCED=y |
| @@ -137,10 +138,6 @@ CONFIG_INET6_AH=m · 9 unmodified lines | ||
| 137 | 138 | CONFIG_INET6_ESP=m |
| 138 | 139 | CONFIG_INET6_IPCOMP=m |
| 139 | 140 | CONFIG_IPV6_MIP6=m |
| 140 | −CONFIG_INET6_XFRM_MODE_TRANSPORT=m | |
| 141 | −CONFIG_INET6_XFRM_MODE_TUNNEL=m | |
| 142 | −CONFIG_INET6_XFRM_MODE_BEET=m | |
| 143 | −CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m | |
| 144 | 141 | CONFIG_IPV6_VTI=m |
| 145 | 142 | CONFIG_IPV6_SIT=m |
| 146 | 143 | CONFIG_IPV6_GRE=m |
| @@ -262,11 +259,8 @@ CONFIG_IP_VS_SED=m · 115 unmodified lines | ||
| 262 | 259 | CONFIG_IP_VS_NQ=m |
| 263 | 260 | CONFIG_IP_VS_FTP=m |
| 264 | 261 | CONFIG_IP_VS_PE_SIP=m |
| 265 | −CONFIG_NF_CONNTRACK_IPV4=m | |
| 266 | 262 | CONFIG_NF_TABLES_IPV4=y |
| 267 | −CONFIG_NFT_CHAIN_ROUTE_IPV4=m | |
| 268 | 263 | CONFIG_NF_TABLES_ARP=y |
| 269 | −CONFIG_NFT_CHAIN_NAT_IPV4=m | |
| 270 | 264 | CONFIG_IP_NF_IPTABLES=m |
| 271 | 265 | CONFIG_IP_NF_MATCH_AH=m |
| 272 | 266 | CONFIG_IP_NF_MATCH_ECN=m |
| @@ -285,10 +279,7 @@ CONFIG_IP_NF_SECURITY=m · 12 unmodified lines | ||
| 285 | 279 | CONFIG_IP_NF_ARPTABLES=m |
| 286 | 280 | CONFIG_IP_NF_ARPFILTER=m |
| 287 | 281 | CONFIG_IP_NF_ARP_MANGLE=m |
| 288 | −CONFIG_NF_CONNTRACK_IPV6=m | |
| 289 | 282 | CONFIG_NF_TABLES_IPV6=y |
| 290 | −CONFIG_NFT_CHAIN_ROUTE_IPV6=m | |
| 291 | −CONFIG_NFT_CHAIN_NAT_IPV6=m | |
| 292 | 283 | CONFIG_IP6_NF_IPTABLES=m |
| 293 | 284 | CONFIG_IP6_NF_MATCH_AH=m |
| 294 | 285 | CONFIG_IP6_NF_MATCH_EUI64=m |
| @@ -307,7 +298,7 @@ CONFIG_IP6_NF_RAW=m · 12 unmodified lines | ||
| 307 | 298 | CONFIG_IP6_NF_SECURITY=m |
| 308 | 299 | CONFIG_IP6_NF_NAT=m |
| 309 | 300 | CONFIG_IP6_NF_TARGET_MASQUERADE=m |
| 310 | −CONFIG_NF_TABLES_BRIDGE=y | |
| 301 | +CONFIG_NF_TABLES_BRIDGE=m | |
| 311 | 302 | CONFIG_RDS=m |
| 312 | 303 | CONFIG_RDS_RDMA=m |
| 313 | 304 | CONFIG_RDS_TCP=m |
| @@ -372,9 +363,11 @@ CONFIG_NETLINK_DIAG=m · 58 unmodified lines | ||
| 372 | 363 | CONFIG_CGROUP_NET_PRIO=y |
| 373 | 364 | CONFIG_BPF_JIT=y |
| 374 | 365 | CONFIG_NET_PKTGEN=m |
| 366 | +CONFIG_PCI=y | |
| 367 | +CONFIG_HOTPLUG_PCI=y | |
| 368 | +CONFIG_HOTPLUG_PCI_S390=y | |
| 369 | +CONFIG_UEVENT_HELPER=y | |
| 375 | 370 | CONFIG_DEVTMPFS=y |
| 376 | −CONFIG_DMA_CMA=y | |
| 377 | −CONFIG_CMA_SIZE_MBYTES=0 | |
| 378 | 371 | CONFIG_CONNECTOR=y |
| 379 | 372 | CONFIG_ZRAM=m |
| 380 | 373 | CONFIG_BLK_DEV_LOOP=m |
| @@ -383,6 +376,7 @@ CONFIG_BLK_DEV_DRBD=m · 2 unmodified lines | ||
| 383 | 376 | CONFIG_BLK_DEV_NBD=m |
| 384 | 377 | CONFIG_BLK_DEV_RAM=y |
| 385 | 378 | CONFIG_BLK_DEV_RAM_SIZE=32768 |
| 379 | +# CONFIG_BLK_DEV_XPRAM is not set | |
| 386 | 380 | CONFIG_VIRTIO_BLK=y |
| 387 | 381 | CONFIG_BLK_DEV_RBD=m |
| 388 | 382 | CONFIG_BLK_DEV_NVME=m |
| @@ -392,7 +386,6 @@ CONFIG_RAID_ATTRS=m · 3 unmodified lines | ||
| 392 | 386 | CONFIG_SCSI=y |
| 393 | 387 | CONFIG_BLK_DEV_SD=y |
| 394 | 388 | CONFIG_CHR_DEV_ST=m |
| 395 | −CONFIG_CHR_DEV_OSST=m | |
| 396 | 389 | CONFIG_BLK_DEV_SR=m |
| 397 | 390 | CONFIG_CHR_DEV_SG=y |
| 398 | 391 | CONFIG_CHR_DEV_SCH=m |
| @@ -412,17 +405,19 @@ CONFIG_SCSI_DH_RDAC=m · 13 unmodified lines | ||
| 412 | 405 | CONFIG_SCSI_DH_HP_SW=m |
| 413 | 406 | CONFIG_SCSI_DH_EMC=m |
| 414 | 407 | CONFIG_SCSI_DH_ALUA=m |
| 415 | −CONFIG_SCSI_OSD_INITIATOR=m | |
| 416 | −CONFIG_SCSI_OSD_ULD=m | |
| 417 | 408 | CONFIG_MD=y |
| 418 | 409 | CONFIG_BLK_DEV_MD=y |
| 419 | 410 | CONFIG_MD_LINEAR=m |
| 420 | 411 | CONFIG_MD_MULTIPATH=m |
| 421 | 412 | CONFIG_MD_FAULTY=m |
| 413 | +CONFIG_MD_CLUSTER=m | |
| 414 | +CONFIG_BCACHE=m | |
| 422 | 415 | CONFIG_BLK_DEV_DM=m |
| 416 | +CONFIG_DM_UNSTRIPED=m | |
| 423 | 417 | CONFIG_DM_CRYPT=m |
| 424 | 418 | CONFIG_DM_SNAPSHOT=m |
| 425 | 419 | CONFIG_DM_THIN_PROVISIONING=m |
| 420 | +CONFIG_DM_WRITECACHE=m | |
| 426 | 421 | CONFIG_DM_MIRROR=m |
| 427 | 422 | CONFIG_DM_LOG_USERSPACE=m |
| 428 | 423 | CONFIG_DM_RAID=m |
| @@ -435,6 +430,7 @@ CONFIG_DM_UEVENT=y · 6 unmodified lines | ||
| 435 | 430 | CONFIG_DM_FLAKEY=m |
| 436 | 431 | CONFIG_DM_VERITY=m |
| 437 | 432 | CONFIG_DM_SWITCH=m |
| 433 | +CONFIG_DM_INTEGRITY=m | |
| 438 | 434 | CONFIG_NETDEVICES=y |
| 439 | 435 | CONFIG_BONDING=m |
| 440 | 436 | CONFIG_DUMMY=m |
| @@ -442,23 +438,78 @@ CONFIG_EQUALIZER=m · 1 unmodified line | ||
| 442 | 438 | CONFIG_IFB=m |
| 443 | 439 | CONFIG_MACVLAN=m |
| 444 | 440 | CONFIG_MACVTAP=m |
| 445 | −CONFIG_VXLAN=m | |
| 446 | 441 | CONFIG_TUN=m |
| 447 | 442 | CONFIG_VETH=m |
| 448 | 443 | CONFIG_VIRTIO_NET=m |
| 449 | 444 | CONFIG_NLMON=m |
| 445 | +# CONFIG_NET_VENDOR_3COM is not set | |
| 446 | +# CONFIG_NET_VENDOR_ADAPTEC is not set | |
| 447 | +# CONFIG_NET_VENDOR_AGERE is not set | |
| 448 | +# CONFIG_NET_VENDOR_ALACRITECH is not set | |
| 449 | +# CONFIG_NET_VENDOR_ALTEON is not set | |
| 450 | +# CONFIG_NET_VENDOR_AMAZON is not set | |
| 451 | +# CONFIG_NET_VENDOR_AMD is not set | |
| 452 | +# CONFIG_NET_VENDOR_AQUANTIA is not set | |
| 450 | 453 | # CONFIG_NET_VENDOR_ARC is not set |
| 454 | +# CONFIG_NET_VENDOR_ATHEROS is not set | |
| 455 | +# CONFIG_NET_VENDOR_AURORA is not set | |
| 456 | +# CONFIG_NET_VENDOR_BROADCOM is not set | |
| 457 | +# CONFIG_NET_VENDOR_BROCADE is not set | |
| 458 | +# CONFIG_NET_VENDOR_CADENCE is not set | |
| 459 | +# CONFIG_NET_VENDOR_CAVIUM is not set | |
| 451 | 460 | # CONFIG_NET_VENDOR_CHELSIO is not set |
| 461 | +# CONFIG_NET_VENDOR_CISCO is not set | |
| 462 | +# CONFIG_NET_VENDOR_CORTINA is not set | |
| 463 | +# CONFIG_NET_VENDOR_DEC is not set | |
| 464 | +# CONFIG_NET_VENDOR_DLINK is not set | |
| 465 | +# CONFIG_NET_VENDOR_EMULEX is not set | |
| 466 | +# CONFIG_NET_VENDOR_EZCHIP is not set | |
| 467 | +# CONFIG_NET_VENDOR_GOOGLE is not set | |
| 468 | +# CONFIG_NET_VENDOR_HP is not set | |
| 469 | +# CONFIG_NET_VENDOR_HUAWEI is not set | |
| 452 | 470 | # CONFIG_NET_VENDOR_INTEL is not set |
| 453 | 471 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 454 | 472 | CONFIG_MLX4_EN=m |
| 455 | 473 | CONFIG_MLX5_CORE=m |
| 456 | 474 | CONFIG_MLX5_CORE_EN=y |
| 475 | +# CONFIG_MLXFW is not set | |
| 476 | +# CONFIG_NET_VENDOR_MICREL is not set | |
| 477 | +# CONFIG_NET_VENDOR_MICROCHIP is not set | |
| 478 | +# CONFIG_NET_VENDOR_MICROSEMI is not set | |
| 479 | +# CONFIG_NET_VENDOR_MYRI is not set | |
| 457 | 480 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 481 | +# CONFIG_NET_VENDOR_NETERION is not set | |
| 482 | +# CONFIG_NET_VENDOR_NETRONOME is not set | |
| 483 | +# CONFIG_NET_VENDOR_NI is not set | |
| 484 | +# CONFIG_NET_VENDOR_NVIDIA is not set | |
| 485 | +# CONFIG_NET_VENDOR_OKI is not set | |
| 486 | +# CONFIG_NET_VENDOR_PACKET_ENGINES is not set | |
| 487 | +# CONFIG_NET_VENDOR_QLOGIC is not set | |
| 488 | +# CONFIG_NET_VENDOR_QUALCOMM is not set | |
| 489 | +# CONFIG_NET_VENDOR_RDC is not set | |
| 490 | +# CONFIG_NET_VENDOR_REALTEK is not set | |
| 491 | +# CONFIG_NET_VENDOR_RENESAS is not set | |
| 492 | +# CONFIG_NET_VENDOR_ROCKER is not set | |
| 493 | +# CONFIG_NET_VENDOR_SAMSUNG is not set | |
| 494 | +# CONFIG_NET_VENDOR_SEEQ is not set | |
| 495 | +# CONFIG_NET_VENDOR_SOLARFLARE is not set | |
| 496 | +# CONFIG_NET_VENDOR_SILAN is not set | |
| 497 | +# CONFIG_NET_VENDOR_SIS is not set | |
| 498 | +# CONFIG_NET_VENDOR_SMSC is not set | |
| 499 | +# CONFIG_NET_VENDOR_SOCIONEXT is not set | |
| 500 | +# CONFIG_NET_VENDOR_STMICRO is not set | |
| 501 | +# CONFIG_NET_VENDOR_SUN is not set | |
| 502 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 503 | +# CONFIG_NET_VENDOR_TEHUTI is not set | |
| 504 | +# CONFIG_NET_VENDOR_TI is not set | |
| 505 | +# CONFIG_NET_VENDOR_VIA is not set | |
| 506 | +# CONFIG_NET_VENDOR_WIZNET is not set | |
| 458 | 507 | CONFIG_PPP=m |
| 459 | 508 | CONFIG_PPP_BSDCOMP=m |
| 460 | 509 | CONFIG_PPP_DEFLATE=m |
| 510 | +CONFIG_PPP_FILTER=y | |
| 461 | 511 | CONFIG_PPP_MPPE=m |
| 512 | +CONFIG_PPP_MULTILINK=y | |
| 462 | 513 | CONFIG_PPPOE=m |
| 463 | 514 | CONFIG_PPTP=m |
| 464 | 515 | CONFIG_PPPOL2TP=m |
| @@ -470,17 +521,21 @@ CONFIG_INPUT_EVDEV=y · 5 unmodified lines | ||
| 470 | 521 | # CONFIG_INPUT_MOUSE is not set |
| 471 | 522 | # CONFIG_SERIO is not set |
| 472 | 523 | CONFIG_LEGACY_PTY_COUNT=0 |
| 524 | +CONFIG_NULL_TTY=m | |
| 473 | 525 | CONFIG_HW_RANDOM_VIRTIO=m |
| 474 | 526 | CONFIG_RAW_DRIVER=m |
| 475 | 527 | CONFIG_HANGCHECK_TIMER=m |
| 476 | 528 | CONFIG_TN3270_FS=y |
| 529 | +# CONFIG_PTP_1588_CLOCK is not set | |
| 477 | 530 | # CONFIG_HWMON is not set |
| 478 | 531 | CONFIG_WATCHDOG=y |
| 532 | +CONFIG_WATCHDOG_CORE=y | |
| 479 | 533 | CONFIG_WATCHDOG_NOWAYOUT=y |
| 480 | 534 | CONFIG_SOFT_WATCHDOG=m |
| 481 | 535 | CONFIG_DIAG288_WATCHDOG=m |
| 482 | 536 | CONFIG_DRM=y |
| 483 | 537 | CONFIG_DRM_VIRTIO_GPU=y |
| 538 | +# CONFIG_BACKLIGHT_CLASS_DEVICE is not set | |
| 484 | 539 | CONFIG_FRAMEBUFFER_CONSOLE=y |
| 485 | 540 | # CONFIG_HID is not set |
| 486 | 541 | # CONFIG_USB_SUPPORT is not set |
| @@ -495,8 +550,8 @@ CONFIG_VFIO_MDEV_DEVICE=m · 8 unmodified lines | ||
| 495 | 550 | CONFIG_VIRTIO_PCI=m |
| 496 | 551 | CONFIG_VIRTIO_BALLOON=m |
| 497 | 552 | CONFIG_VIRTIO_INPUT=y |
| 498 | −CONFIG_S390_AP_IOMMU=y | |
| 499 | 553 | CONFIG_S390_CCW_IOMMU=y |
| 554 | +CONFIG_S390_AP_IOMMU=y | |
| 500 | 555 | CONFIG_EXT4_FS=y |
| 501 | 556 | CONFIG_EXT4_FS_POSIX_ACL=y |
| 502 | 557 | CONFIG_EXT4_FS_SECURITY=y |
| @@ -546,8 +601,10 @@ CONFIG_ECRYPT_FS=m · 43 unmodified lines | ||
| 546 | 601 | CONFIG_CRAMFS=m |
| 547 | 602 | CONFIG_SQUASHFS=m |
| 548 | 603 | CONFIG_SQUASHFS_XATTR=y |
| 604 | +CONFIG_SQUASHFS_LZ4=y | |
| 549 | 605 | CONFIG_SQUASHFS_LZO=y |
| 550 | 606 | CONFIG_SQUASHFS_XZ=y |
| 607 | +CONFIG_SQUASHFS_ZSTD=y | |
| 551 | 608 | CONFIG_ROMFS_FS=m |
| 552 | 609 | CONFIG_NFS_FS=m |
| 553 | 610 | CONFIG_NFS_V3_ACL=y |
| @@ -558,7 +615,6 @@ CONFIG_NFSD_V3_ACL=y · 4 unmodified lines | ||
| 558 | 615 | CONFIG_NFSD_V4=y |
| 559 | 616 | CONFIG_NFSD_V4_SECURITY_LABEL=y |
| 560 | 617 | CONFIG_CIFS=m |
| 561 | −CONFIG_CIFS_STATS=y | |
| 562 | 618 | CONFIG_CIFS_STATS2=y |
| 563 | 619 | CONFIG_CIFS_WEAK_PW_HASH=y |
| 564 | 620 | CONFIG_CIFS_UPCALL=y |
| @@ -574,31 +630,7 @@ CONFIG_NLS_ISO8859_1=m · 9 unmodified lines | ||
| 574 | 630 | CONFIG_NLS_ISO8859_15=m |
| 575 | 631 | CONFIG_NLS_UTF8=m |
| 576 | 632 | CONFIG_DLM=m |
| 577 | −CONFIG_PRINTK_TIME=y | |
| 578 | −CONFIG_DEBUG_INFO=y | |
| 579 | −CONFIG_DEBUG_INFO_DWARF4=y | |
| 580 | −CONFIG_GDB_SCRIPTS=y | |
| 581 | −# CONFIG_ENABLE_MUST_CHECK is not set | |
| 582 | −CONFIG_FRAME_WARN=1024 | |
| 583 | −CONFIG_UNUSED_SYMBOLS=y | |
| 584 | −CONFIG_MAGIC_SYSRQ=y | |
| 585 | −CONFIG_DEBUG_MEMORY_INIT=y | |
| 586 | −CONFIG_PANIC_ON_OOPS=y | |
| 587 | −CONFIG_RCU_TORTURE_TEST=m | |
| 588 | −CONFIG_RCU_CPU_STALL_TIMEOUT=60 | |
| 589 | −CONFIG_LATENCYTOP=y | |
| 590 | −CONFIG_SCHED_TRACER=y | |
| 591 | −CONFIG_FTRACE_SYSCALLS=y | |
| 592 | −CONFIG_STACK_TRACER=y | |
| 593 | −CONFIG_BLK_DEV_IO_TRACE=y | |
| 594 | −CONFIG_FUNCTION_PROFILER=y | |
| 595 | −CONFIG_HIST_TRIGGERS=y | |
| 596 | −CONFIG_LKDTM=m | |
| 597 | −CONFIG_PERCPU_TEST=m | |
| 598 | −CONFIG_ATOMIC64_SELFTEST=y | |
| 599 | −CONFIG_TEST_BPF=m | |
| 600 | −CONFIG_BUG_ON_DATA_CORRUPTION=y | |
| 601 | −CONFIG_S390_PTDUMP=y | |
| 633 | +CONFIG_UNICODE=y | |
| 602 | 634 | CONFIG_PERSISTENT_KEYRINGS=y |
| 603 | 635 | CONFIG_BIG_KEYS=y |
| 604 | 636 | CONFIG_ENCRYPTED_KEYS=m |
| @@ -606,7 +638,6 @@ CONFIG_SECURITY=y · 1 unmodified line | ||
| 606 | 638 | CONFIG_SECURITY_NETWORK=y |
| 607 | 639 | CONFIG_SECURITY_SELINUX=y |
| 608 | 640 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 609 | −CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 | |
| 610 | 641 | CONFIG_SECURITY_SELINUX_DISABLE=y |
| 611 | 642 | CONFIG_INTEGRITY_SIGNATURE=y |
| 612 | 643 | CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y |
| @@ -615,31 +646,42 @@ CONFIG_IMA_DEFAULT_HASH_SHA256=y · 2 unmodified lines | ||
| 615 | 646 | CONFIG_IMA_WRITE_POLICY=y |
| 616 | 647 | CONFIG_IMA_APPRAISE=y |
| 617 | 648 | CONFIG_CRYPTO_FIPS=y |
| 618 | −CONFIG_CRYPTO_DH=m | |
| 619 | −CONFIG_CRYPTO_ECDH=m | |
| 620 | 649 | CONFIG_CRYPTO_USER=m |
| 621 | 650 | # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set |
| 622 | 651 | CONFIG_CRYPTO_PCRYPT=m |
| 623 | 652 | CONFIG_CRYPTO_CRYPTD=m |
| 624 | 653 | CONFIG_CRYPTO_TEST=m |
| 654 | +CONFIG_CRYPTO_DH=m | |
| 655 | +CONFIG_CRYPTO_ECDH=m | |
| 656 | +CONFIG_CRYPTO_ECRDSA=m | |
| 625 | 657 | CONFIG_CRYPTO_CHACHA20POLY1305=m |
| 658 | +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 | +CONFIG_CRYPTO_CFB=m | |
| 626 | 664 | CONFIG_CRYPTO_LRW=m |
| 665 | +CONFIG_CRYPTO_OFB=m | |
| 627 | 666 | CONFIG_CRYPTO_PCBC=m |
| 628 | 667 | CONFIG_CRYPTO_KEYWRAP=m |
| 668 | +CONFIG_CRYPTO_ADIANTUM=m | |
| 629 | 669 | CONFIG_CRYPTO_XCBC=m |
| 630 | 670 | CONFIG_CRYPTO_VMAC=m |
| 631 | 671 | CONFIG_CRYPTO_CRC32=m |
| 672 | +CONFIG_CRYPTO_XXHASH=m | |
| 632 | 673 | CONFIG_CRYPTO_MICHAEL_MIC=m |
| 633 | 674 | CONFIG_CRYPTO_RMD128=m |
| 634 | 675 | CONFIG_CRYPTO_RMD160=m |
| 635 | 676 | CONFIG_CRYPTO_RMD256=m |
| 636 | 677 | CONFIG_CRYPTO_RMD320=m |
| 637 | −CONFIG_CRYPTO_SHA512=m | |
| 638 | 678 | CONFIG_CRYPTO_SHA3=m |
| 679 | +CONFIG_CRYPTO_SM3=m | |
| 639 | 680 | CONFIG_CRYPTO_TGR192=m |
| 640 | 681 | CONFIG_CRYPTO_WP512=m |
| 641 | 682 | CONFIG_CRYPTO_AES_TI=m |
| 642 | 683 | CONFIG_CRYPTO_ANUBIS=m |
| 684 | +CONFIG_CRYPTO_ARC4=m | |
| 643 | 685 | CONFIG_CRYPTO_BLOWFISH=m |
| 644 | 686 | CONFIG_CRYPTO_CAMELLIA=m |
| 645 | 687 | CONFIG_CRYPTO_CAST5=m |
| @@ -649,16 +691,19 @@ CONFIG_CRYPTO_KHAZAD=m · 3 unmodified lines | ||
| 649 | 691 | CONFIG_CRYPTO_SALSA20=m |
| 650 | 692 | CONFIG_CRYPTO_SEED=m |
| 651 | 693 | CONFIG_CRYPTO_SERPENT=m |
| 694 | +CONFIG_CRYPTO_SM4=m | |
| 652 | 695 | CONFIG_CRYPTO_TEA=m |
| 653 | 696 | CONFIG_CRYPTO_TWOFISH=m |
| 654 | 697 | CONFIG_CRYPTO_842=m |
| 655 | 698 | CONFIG_CRYPTO_LZ4=m |
| 656 | 699 | CONFIG_CRYPTO_LZ4HC=m |
| 700 | +CONFIG_CRYPTO_ZSTD=m | |
| 657 | 701 | CONFIG_CRYPTO_ANSI_CPRNG=m |
| 658 | 702 | CONFIG_CRYPTO_USER_API_HASH=m |
| 659 | 703 | CONFIG_CRYPTO_USER_API_SKCIPHER=m |
| 660 | 704 | CONFIG_CRYPTO_USER_API_RNG=m |
| 661 | 705 | CONFIG_CRYPTO_USER_API_AEAD=m |
| 706 | +CONFIG_CRYPTO_STATS=y | |
| 662 | 707 | CONFIG_ZCRYPT=m |
| 663 | 708 | CONFIG_PKEY=m |
| 664 | 709 | CONFIG_CRYPTO_PAES_S390=m |
| @@ -669,12 +714,34 @@ CONFIG_CRYPTO_DES_S390=m · 4 unmodified lines | ||
| 669 | 714 | CONFIG_CRYPTO_AES_S390=m |
| 670 | 715 | CONFIG_CRYPTO_GHASH_S390=m |
| 671 | 716 | CONFIG_CRYPTO_CRC32_S390=y |
| 717 | +CONFIG_CORDIC=m | |
| 718 | +CONFIG_CRC4=m | |
| 672 | 719 | CONFIG_CRC7=m |
| 673 | 720 | CONFIG_CRC8=m |
| 674 | −CONFIG_CORDIC=m | |
| 675 | −CONFIG_CMM=m | |
| 676 | −CONFIG_APPLDATA_BASE=y | |
| 677 | −CONFIG_KVM=m | |
| 678 | −CONFIG_KVM_S390_UCONTROL=y | |
| 679 | −CONFIG_VHOST_NET=m | |
| 680 | −CONFIG_VHOST_VSOCK=m | |
| 721 | +CONFIG_DMA_CMA=y | |
| 722 | +CONFIG_CMA_SIZE_MBYTES=0 | |
| 723 | +CONFIG_PRINTK_TIME=y | |
| 724 | +CONFIG_DEBUG_INFO=y | |
| 725 | +CONFIG_DEBUG_INFO_DWARF4=y | |
| 726 | +CONFIG_GDB_SCRIPTS=y | |
| 727 | +CONFIG_FRAME_WARN=1024 | |
| 728 | +CONFIG_UNUSED_SYMBOLS=y | |
| 729 | +CONFIG_DEBUG_SECTION_MISMATCH=y | |
| 730 | +CONFIG_MAGIC_SYSRQ=y | |
| 731 | +CONFIG_DEBUG_MEMORY_INIT=y | |
| 732 | +CONFIG_PANIC_ON_OOPS=y | |
| 733 | +CONFIG_RCU_TORTURE_TEST=m | |
| 734 | +CONFIG_RCU_CPU_STALL_TIMEOUT=60 | |
| 735 | +CONFIG_LATENCYTOP=y | |
| 736 | +CONFIG_SCHED_TRACER=y | |
| 737 | +CONFIG_FTRACE_SYSCALLS=y | |
| 738 | +CONFIG_STACK_TRACER=y | |
| 739 | +CONFIG_BLK_DEV_IO_TRACE=y | |
| 740 | +CONFIG_FUNCTION_PROFILER=y | |
| 741 | +CONFIG_HIST_TRIGGERS=y | |
| 742 | +CONFIG_LKDTM=m | |
| 743 | +CONFIG_PERCPU_TEST=m | |
| 744 | +CONFIG_ATOMIC64_SELFTEST=y | |
| 745 | +CONFIG_TEST_BPF=m | |
| 746 | +CONFIG_BUG_ON_DATA_CORRUPTION=y | |
| 747 | +CONFIG_S390_PTDUMP=y | |
| @@ -1,27 +1,33 @@ | ||
| 1 | 1 | # CONFIG_SWAP is not set |
| 2 | 2 | CONFIG_NO_HZ_IDLE=y |
| 3 | 3 | CONFIG_HIGH_RES_TIMERS=y |
| 4 | +# CONFIG_CPU_ISOLATION is not set | |
| 5 | +# CONFIG_UTS_NS is not set | |
| 6 | +# CONFIG_PID_NS is not set | |
| 7 | +# CONFIG_NET_NS is not set | |
| 4 | 8 | CONFIG_BLK_DEV_INITRD=y |
| 5 | 9 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
| 6 | 10 | # CONFIG_COMPAT_BRK is not set |
| 7 | −CONFIG_PARTITION_ADVANCED=y | |
| 8 | −CONFIG_IBM_PARTITION=y | |
| 9 | −CONFIG_DEFAULT_DEADLINE=y | |
| 10 | 11 | CONFIG_TUNE_ZEC12=y |
| 11 | 12 | # CONFIG_COMPAT is not set |
| 12 | 13 | CONFIG_NR_CPUS=2 |
| 13 | −# CONFIG_HOTPLUG_CPU is not set | |
| 14 | 14 | CONFIG_HZ_100=y |
| 15 | 15 | # CONFIG_ARCH_RANDOM is not set |
| 16 | −# CONFIG_COMPACTION is not set | |
| 17 | −# CONFIG_MIGRATION is not set | |
| 18 | −# CONFIG_BOUNCE is not set | |
| 19 | −# CONFIG_CHECK_STACK is not set | |
| 16 | +# CONFIG_RELOCATABLE is not set | |
| 20 | 17 | # CONFIG_CHSC_SCH is not set |
| 21 | 18 | # CONFIG_SCM_BUS is not set |
| 22 | 19 | CONFIG_CRASH_DUMP=y |
| 23 | −# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | |
| 24 | 20 | # CONFIG_SECCOMP is not set |
| 21 | +# CONFIG_PFAULT is not set | |
| 22 | +# CONFIG_S390_HYPFS_FS is not set | |
| 23 | +# CONFIG_VIRTUALIZATION is not set | |
| 24 | +# CONFIG_S390_GUEST is not set | |
| 25 | +CONFIG_PARTITION_ADVANCED=y | |
| 26 | +CONFIG_IBM_PARTITION=y | |
| 27 | +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | |
| 28 | +# CONFIG_COMPACTION is not set | |
| 29 | +# CONFIG_MIGRATION is not set | |
| 30 | +# CONFIG_BOUNCE is not set | |
| 25 | 31 | CONFIG_NET=y |
| 26 | 32 | # CONFIG_IUCV is not set |
| 27 | 33 | CONFIG_DEVTMPFS=y |
| @@ -43,7 +49,6 @@ CONFIG_ZFCP=y · 15 unmodified lines | ||
| 43 | 49 | # CONFIG_HVC_IUCV is not set |
| 44 | 50 | # CONFIG_HW_RANDOM_S390 is not set |
| 45 | 51 | CONFIG_RAW_DRIVER=y |
| 46 | −# CONFIG_SCLP_ASYNC is not set | |
| 47 | 52 | # CONFIG_HMC_DRV is not set |
| 48 | 53 | # CONFIG_S390_TAPE is not set |
| 49 | 54 | # CONFIG_VMCP is not set |
| @@ -56,6 +61,7 @@ CONFIG_RAW_DRIVER=y · 6 unmodified lines | ||
| 56 | 61 | CONFIG_CONFIGFS_FS=y |
| 57 | 62 | # CONFIG_MISC_FILESYSTEMS is not set |
| 58 | 63 | # CONFIG_NETWORK_FILESYSTEMS is not set |
| 64 | +# CONFIG_DIMLIB is not set | |
| 59 | 65 | CONFIG_PRINTK_TIME=y |
| 60 | 66 | CONFIG_DEBUG_INFO=y |
| 61 | 67 | CONFIG_DEBUG_FS=y |
| @@ -64,7 +70,4 @@ CONFIG_PANIC_ON_OOPS=y · 2 unmodified lines | ||
| 64 | 70 | # CONFIG_SCHED_DEBUG is not set |
| 65 | 71 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 66 | 72 | # CONFIG_FTRACE is not set |
| 67 | −# CONFIG_PFAULT is not set | |
| 68 | −# CONFIG_S390_HYPFS_FS is not set | |
| 69 | −# CONFIG_VIRTUALIZATION is not set | |
| 70 | −# CONFIG_S390_GUEST is not set | |
| 73 | +# CONFIG_RUNTIME_TESTING_MENU is not set | |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | * @sliba: storage list information block address |
| 29 | 29 | * @sla: storage list address |
| 30 | 30 | * @slsba: storage list state block address |
| 31 | − * @akey: access key for DLIB | |
| 31 | + * @akey: access key for SLIB | |
| 32 | 32 | * @bkey: access key for SL |
| 33 | 33 | * @ckey: access key for SBALs |
| 34 | 34 | * @dkey: access key for SLSB |
| @@ -50,11 +50,10 @@ struct qdesfmt0 { · 15 unmodified lines | ||
| 50 | 50 | /** |
| 51 | 51 | * struct qdr - queue description record (QDR) |
| 52 | 52 | * @qfmt: queue format |
| 53 | − * @pfmt: implementation dependent parameter format | |
| 54 | 53 | * @ac: adapter characteristics |
| 55 | 54 | * @iqdcnt: input queue descriptor count |
| 56 | 55 | * @oqdcnt: output queue descriptor count |
| 57 | − * @iqdsz: inpout queue descriptor size | |
| 56 | + * @iqdsz: input queue descriptor size | |
| 58 | 57 | * @oqdsz: output queue descriptor size |
| 59 | 58 | * @qiba: queue information block address |
| 60 | 59 | * @qkey: queue information block key |
| @@ -62,8 +61,7 @@ struct qdesfmt0 { · 1 unmodified line | ||
| 62 | 61 | */ |
| 63 | 62 | struct qdr { |
| 64 | 63 | u32 qfmt : 8; |
| 65 | − u32 pfmt : 8; | |
| 66 | − u32 : 8; | |
| 64 | + u32 : 16; | |
| 67 | 65 | u32 ac : 8; |
| 68 | 66 | u32 : 8; |
| 69 | 67 | u32 iqdcnt : 8; |
| @@ -327,6 +325,7 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int, · 257 unmodified lines | ||
| 327 | 325 | * struct qdio_initialize - qdio initialization data |
| 328 | 326 | * @cdev: associated ccw device |
| 329 | 327 | * @q_format: queue format |
| 328 | + * @qdr_ac: feature flags to set | |
| 330 | 329 | * @adapter_name: name for the adapter |
| 331 | 330 | * @qib_param_field_format: format for qib_parm_field |
| 332 | 331 | * @qib_param_field: pointer to 128 bytes or NULL, if no param field |
| @@ -338,6 +337,7 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int, · 5 unmodified lines | ||
| 338 | 337 | * @input_handler: handler to be called for input queues |
| 339 | 338 | * @output_handler: handler to be called for output queues |
| 340 | 339 | * @queue_start_poll_array: polling handlers (one per input queue or NULL) |
| 340 | + * @scan_threshold: # of in-use buffers that triggers scan on output queue | |
| 341 | 341 | * @int_parm: interruption parameter |
| 342 | 342 | * @input_sbal_addr_array: address of no_input_qs * 128 pointers |
| 343 | 343 | * @output_sbal_addr_array: address of no_output_qs * 128 pointers |
| @@ -84,6 +84,7 @@ extern int noexec_disabled; · 83 unmodified lines | ||
| 84 | 84 | extern int memory_end_set; |
| 85 | 85 | extern unsigned long memory_end; |
| 86 | 86 | extern unsigned long max_physmem_end; |
| 87 | +extern unsigned long __swsusp_reset_dma; | |
| 87 | 88 | |
| 88 | 89 | #define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) |
| 89 | 90 | #define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) |
| @@ -114,12 +114,8 @@ recursion_check: · 113 unmodified lines | ||
| 114 | 114 | * If it comes up a second time then there's something wrong going on: |
| 115 | 115 | * just break out and report an unknown stack type. |
| 116 | 116 | */ |
| 117 | − if (*visit_mask & (1UL << info->type)) { | |
| 118 | − printk_deferred_once(KERN_WARNING | |
| 119 | − "WARNING: stack recursion on stack type %d\n", | |
| 120 | − info->type); | |
| 117 | + if (*visit_mask & (1UL << info->type)) | |
| 121 | 118 | goto unknown; |
| 122 | − } | |
| 123 | 119 | *visit_mask |= 1UL << info->type; |
| 124 | 120 | return 0; |
| 125 | 121 | unknown: |
| @@ -60,12 +60,5 @@ ENTRY(startup_continue) · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | .align 16 |
| 62 | 62 | .LPG1: |
| 63 | −.Lpcmsk:.quad 0x0000000180000000 | |
| 64 | −.L4malign:.quad 0xffffffffffc00000 | |
| 65 | −.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 | |
| 66 | −.Lnop: .long 0x07000700 | |
| 67 | −.Lparmaddr: | |
| 68 | − .quad PARMAREA | |
| 69 | − .align 64 | |
| 70 | 63 | .Ldw: .quad 0x0002000180000000,0x0000000000000000 |
| 71 | 64 | .Laregs:.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
| @@ -31,7 +31,6 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <asm/os_info.h> |
| 32 | 32 | #include <asm/sections.h> |
| 33 | 33 | #include <asm/boot_data.h> |
| 34 | −#include <asm/uv.h> | |
| 35 | 34 | #include "entry.h" |
| 36 | 35 | |
| 37 | 36 | #define IPL_PARM_BLOCK_VERSION 0 |
| @@ -892,21 +891,15 @@ static void __reipl_run(void *unused) · 854 unmodified lines | ||
| 892 | 891 | { |
| 893 | 892 | switch (reipl_type) { |
| 894 | 893 | case IPL_TYPE_CCW: |
| 895 | − uv_set_shared(__pa(reipl_block_ccw)); | |
| 896 | 894 | diag308(DIAG308_SET, reipl_block_ccw); |
| 897 | − uv_remove_shared(__pa(reipl_block_ccw)); | |
| 898 | 895 | diag308(DIAG308_LOAD_CLEAR, NULL); |
| 899 | 896 | break; |
| 900 | 897 | case IPL_TYPE_FCP: |
| 901 | − uv_set_shared(__pa(reipl_block_fcp)); | |
| 902 | 898 | diag308(DIAG308_SET, reipl_block_fcp); |
| 903 | − uv_remove_shared(__pa(reipl_block_fcp)); | |
| 904 | 899 | diag308(DIAG308_LOAD_CLEAR, NULL); |
| 905 | 900 | break; |
| 906 | 901 | case IPL_TYPE_NSS: |
| 907 | − uv_set_shared(__pa(reipl_block_nss)); | |
| 908 | 902 | diag308(DIAG308_SET, reipl_block_nss); |
| 909 | − uv_remove_shared(__pa(reipl_block_nss)); | |
| 910 | 903 | diag308(DIAG308_LOAD_CLEAR, NULL); |
| 911 | 904 | break; |
| 912 | 905 | case IPL_TYPE_UNKNOWN: |
| @@ -1176,9 +1169,7 @@ static struct kset *dump_kset; · 263 unmodified lines | ||
| 1176 | 1169 | |
| 1177 | 1170 | static void diag308_dump(void *dump_block) |
| 1178 | 1171 | { |
| 1179 | − uv_set_shared(__pa(dump_block)); | |
| 1180 | 1172 | diag308(DIAG308_SET, dump_block); |
| 1181 | − uv_remove_shared(__pa(dump_block)); | |
| 1182 | 1173 | while (1) { |
| 1183 | 1174 | if (diag308(DIAG308_LOAD_NORMAL_DUMP, NULL) != 0x302) |
| 1184 | 1175 | break; |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | #include <linux/elf.h> |
| 3 | +#include <asm/kexec.h> | |
| 3 | 4 | |
| 4 | 5 | int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val, |
| 5 | 6 | unsigned long addr) |
| @@ -34,7 +34,7 @@ struct cf_diag_csd { /* Counter set data per CPU */ · 33 unmodified lines | ||
| 34 | 34 | unsigned char start[PAGE_SIZE]; /* Counter set at event start */ |
| 35 | 35 | unsigned char data[PAGE_SIZE]; /* Counter set at event delete */ |
| 36 | 36 | }; |
| 37 | −DEFINE_PER_CPU(struct cf_diag_csd, cf_diag_csd); | |
| 37 | +static DEFINE_PER_CPU(struct cf_diag_csd, cf_diag_csd); | |
| 38 | 38 | |
| 39 | 39 | /* Counter sets are stored as data stream in a page sized memory buffer and |
| 40 | 40 | * exported to user space via raw data attached to the event sample data. |
| @@ -1114,8 +1114,7 @@ void __init setup_arch(char **cmdline_p) · 1113 unmodified lines | ||
| 1114 | 1114 | |
| 1115 | 1115 | ROOT_DEV = Root_RAM0; |
| 1116 | 1116 | |
| 1117 | − /* Is init_mm really needed? */ | |
| 1118 | − init_mm.start_code = PAGE_OFFSET; | |
| 1117 | + init_mm.start_code = (unsigned long) _text; | |
| 1119 | 1118 | init_mm.end_code = (unsigned long) _etext; |
| 1120 | 1119 | init_mm.end_data = (unsigned long) _edata; |
| 1121 | 1120 | init_mm.brk = (unsigned long) _end; |
| @@ -216,11 +216,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · 215 unmodified lines | ||
| 216 | 216 | |
| 217 | 217 | if (!vdso_enabled) |
| 218 | 218 | return 0; |
| 219 | − /* | |
| 220 | − * Only map the vdso for dynamically linked elf binaries. | |
| 221 | − */ | |
| 222 | − if (!uses_interp) | |
| 223 | − return 0; | |
| 224 | 219 | |
| 225 | 220 | vdso_pages = vdso64_pages; |
| 226 | 221 | #ifdef CONFIG_COMPAT_VDSO |
| @@ -32,10 +32,9 @@ PHDRS { · 31 unmodified lines | ||
| 32 | 32 | SECTIONS |
| 33 | 33 | { |
| 34 | 34 | . = 0x100000; |
| 35 | − _stext = .; /* Start of text section */ | |
| 36 | 35 | .text : { |
| 37 | − /* Text and read-only data */ | |
| 38 | − _text = .; | |
| 36 | + _stext = .; /* Start of text section */ | |
| 37 | + _text = .; /* Text and read-only data */ | |
| 39 | 38 | HEAD_TEXT |
| 40 | 39 | TEXT_TEXT |
| 41 | 40 | SCHED_TEXT |
| @@ -47,11 +46,10 @@ SECTIONS · 5 unmodified lines | ||
| 47 | 46 | *(.text.*_indirect_*) |
| 48 | 47 | *(.fixup) |
| 49 | 48 | *(.gnu.warning) |
| 49 | + . = ALIGN(PAGE_SIZE); | |
| 50 | + _etext = .; /* End of text section */ | |
| 50 | 51 | } :text = 0x0700 |
| 51 | 52 | |
| 52 | − . = ALIGN(PAGE_SIZE); | |
| 53 | − _etext = .; /* End of text section */ | |
| 54 | − | |
| 55 | 53 | NOTES :text :note |
| 56 | 54 | |
| 57 | 55 | .dummy : { *(.dummy) } :data |
| @@ -2516,16 +2516,6 @@ out_err: · 2515 unmodified lines | ||
| 2516 | 2516 | return rc; |
| 2517 | 2517 | } |
| 2518 | 2518 | |
| 2519 | −bool kvm_arch_has_vcpu_debugfs(void) | |
| 2520 | −{ | |
| 2521 | − return false; | |
| 2522 | −} | |
| 2523 | − | |
| 2524 | −int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | |
| 2525 | −{ | |
| 2526 | − return 0; | |
| 2527 | −} | |
| 2528 | − | |
| 2529 | 2519 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) |
| 2530 | 2520 | { |
| 2531 | 2521 | VCPU_EVENT(vcpu, 3, "%s", "free cpu"); |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/types.h> |
| 10 | 10 | #include <linux/export.h> |
| 11 | 11 | #include <linux/raid/xor.h> |
| 12 | +#include <asm/xor.h> | |
| 12 | 13 | |
| 13 | 14 | static void xor_xc_2(unsigned long bytes, unsigned long *p1, unsigned long *p2) |
| 14 | 15 | { |
| @@ -161,9 +161,9 @@ static void walk_pmd_level(struct seq_file *m, struct pg_state *st, · 160 unmodified lines | ||
| 161 | 161 | } |
| 162 | 162 | #endif |
| 163 | 163 | |
| 164 | − for (i = 0; i < PTRS_PER_PMD && addr < max_addr; i++) { | |
| 164 | + pmd = pmd_offset(pud, addr); | |
| 165 | + for (i = 0; i < PTRS_PER_PMD && addr < max_addr; i++, pmd++) { | |
| 165 | 166 | st->current_address = addr; |
| 166 | − pmd = pmd_offset(pud, addr); | |
| 167 | 167 | if (!pmd_none(*pmd)) { |
| 168 | 168 | if (pmd_large(*pmd)) { |
| 169 | 169 | prot = pmd_val(*pmd) & |
| @@ -192,9 +192,9 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, · 22 unmodified lines | ||
| 192 | 192 | } |
| 193 | 193 | #endif |
| 194 | 194 | |
| 195 | − for (i = 0; i < PTRS_PER_PUD && addr < max_addr; i++) { | |
| 195 | + pud = pud_offset(p4d, addr); | |
| 196 | + for (i = 0; i < PTRS_PER_PUD && addr < max_addr; i++, pud++) { | |
| 196 | 197 | st->current_address = addr; |
| 197 | − pud = pud_offset(p4d, addr); | |
| 198 | 198 | if (!pud_none(*pud)) |
| 199 | 199 | if (pud_large(*pud)) { |
| 200 | 200 | prot = pud_val(*pud) & |
| @@ -222,9 +222,9 @@ static void walk_p4d_level(struct seq_file *m, struct pg_state *st, · 21 unmodified lines | ||
| 222 | 222 | } |
| 223 | 223 | #endif |
| 224 | 224 | |
| 225 | − for (i = 0; i < PTRS_PER_P4D && addr < max_addr; i++) { | |
| 225 | + p4d = p4d_offset(pgd, addr); | |
| 226 | + for (i = 0; i < PTRS_PER_P4D && addr < max_addr; i++, p4d++) { | |
| 226 | 227 | st->current_address = addr; |
| 227 | − p4d = p4d_offset(pgd, addr); | |
| 228 | 228 | if (!p4d_none(*p4d)) |
| 229 | 229 | walk_pud_level(m, st, p4d, addr); |
| 230 | 230 | else |
| @@ -327,6 +327,7 @@ static noinline void do_fault_error(struct pt_regs *regs, int access, · 326 unmodified lines | ||
| 327 | 327 | case VM_FAULT_BADACCESS: |
| 328 | 328 | if (access == VM_EXEC && signal_return(regs) == 0) |
| 329 | 329 | break; |
| 330 | + /* fallthrough */ | |
| 330 | 331 | case VM_FAULT_BADMAP: |
| 331 | 332 | /* Bad memory access. Check if it is kernel or user space. */ |
| 332 | 333 | if (user_mode(regs)) { |
| @@ -336,7 +337,9 @@ static noinline void do_fault_error(struct pt_regs *regs, int access, · 3 unmodified lines | ||
| 336 | 337 | do_sigsegv(regs, si_code); |
| 337 | 338 | break; |
| 338 | 339 | } |
| 340 | + /* fallthrough */ | |
| 339 | 341 | case VM_FAULT_BADCONTEXT: |
| 342 | + /* fallthrough */ | |
| 340 | 343 | case VM_FAULT_PFAULT: |
| 341 | 344 | do_no_context(regs); |
| 342 | 345 | break; |
| @@ -2424,8 +2424,8 @@ EXPORT_SYMBOL_GPL(gmap_pmdp_idte_global); · 2423 unmodified lines | ||
| 2424 | 2424 | * This function is assumed to be called with the guest_table_lock |
| 2425 | 2425 | * held. |
| 2426 | 2426 | */ |
| 2427 | −bool gmap_test_and_clear_dirty_pmd(struct gmap *gmap, pmd_t *pmdp, | |
| 2428 | − unsigned long gaddr) | |
| 2427 | +static bool gmap_test_and_clear_dirty_pmd(struct gmap *gmap, pmd_t *pmdp, | |
| 2428 | + unsigned long gaddr) | |
| 2429 | 2429 | { |
| 2430 | 2430 | if (pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID) |
| 2431 | 2431 | return false; |
| @@ -11,8 +11,7 @@ chkbss: $(addprefix $(obj)/, $(chkbss-files)) · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | quiet_cmd_chkbss = CHKBSS $< |
| 13 | 13 | cmd_chkbss = \ |
| 14 | − if $(OBJDUMP) -h $< | grep -q "\.bss" && \ | |
| 15 | − ! $(OBJDUMP) -j .bss -w -h $< | awk 'END { if ($$3) exit 1 }'; then \ | |
| 14 | + if ! $(OBJSIZE) --common $< | $(AWK) 'END { if ($$3) exit 1 }'; then \ | |
| 16 | 15 | echo "error: $< .bss section is not empty" >&2; exit 1; \ |
| 17 | 16 | fi; \ |
| 18 | 17 | touch $@; |
| @@ -37,6 +37,14 @@ int memcmp(const void *s1, const void *s2, size_t len) · 36 unmodified lines | ||
| 37 | 37 | return diff; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | +/* | |
| 41 | + * Clang may lower `memcmp == 0` to `bcmp == 0`. | |
| 42 | + */ | |
| 43 | +int bcmp(const void *s1, const void *s2, size_t len) | |
| 44 | +{ | |
| 45 | + return memcmp(s1, s2, len); | |
| 46 | +} | |
| 47 | + | |
| 40 | 48 | int strcmp(const char *str1, const char *str2) |
| 41 | 49 | { |
| 42 | 50 | const unsigned char *s1 = (const unsigned char *)str1; |
| @@ -314,6 +314,23 @@ For 32-bit we have the following conventions - kernel is built with · 313 unmodified lines | ||
| 314 | 314 | |
| 315 | 315 | #endif |
| 316 | 316 | |
| 317 | +/* | |
| 318 | + * Mitigate Spectre v1 for conditional swapgs code paths. | |
| 319 | + * | |
| 320 | + * FENCE_SWAPGS_USER_ENTRY is used in the user entry swapgs code path, to | |
| 321 | + * prevent a speculative swapgs when coming from kernel space. | |
| 322 | + * | |
| 323 | + * FENCE_SWAPGS_KERNEL_ENTRY is used in the kernel entry non-swapgs code path, | |
| 324 | + * to prevent the swapgs from getting speculatively skipped when coming from | |
| 325 | + * user space. | |
| 326 | + */ | |
| 327 | +.macro FENCE_SWAPGS_USER_ENTRY | |
| 328 | + ALTERNATIVE "", "lfence", X86_FEATURE_FENCE_SWAPGS_USER | |
| 329 | +.endm | |
| 330 | +.macro FENCE_SWAPGS_KERNEL_ENTRY | |
| 331 | + ALTERNATIVE "", "lfence", X86_FEATURE_FENCE_SWAPGS_KERNEL | |
| 332 | +.endm | |
| 333 | + | |
| 317 | 334 | .macro STACKLEAK_ERASE_NOCLOBBER |
| 318 | 335 | #ifdef CONFIG_GCC_PLUGIN_STACKLEAK |
| 319 | 336 | PUSH_AND_CLEAR_REGS |
| @@ -519,7 +519,7 @@ ENTRY(interrupt_entry) · 518 unmodified lines | ||
| 519 | 519 | testb $3, CS-ORIG_RAX+8(%rsp) |
| 520 | 520 | jz 1f |
| 521 | 521 | SWAPGS |
| 522 | − | |
| 522 | + FENCE_SWAPGS_USER_ENTRY | |
| 523 | 523 | /* |
| 524 | 524 | * Switch to the thread stack. The IRET frame and orig_ax are |
| 525 | 525 | * on the stack, as well as the return address. RDI..R12 are |
| @@ -549,8 +549,10 @@ ENTRY(interrupt_entry) · 23 unmodified lines | ||
| 549 | 549 | UNWIND_HINT_FUNC |
| 550 | 550 | |
| 551 | 551 | movq (%rdi), %rdi |
| 552 | + jmp 2f | |
| 552 | 553 | 1: |
| 553 | − | |
| 554 | + FENCE_SWAPGS_KERNEL_ENTRY | |
| 555 | +2: | |
| 554 | 556 | PUSH_AND_CLEAR_REGS save_ret=1 |
| 555 | 557 | ENCODE_FRAME_POINTER 8 |
| 556 | 558 | |
| @@ -1238,6 +1240,13 @@ ENTRY(paranoid_entry) · 681 unmodified lines | ||
| 1238 | 1240 | */ |
| 1239 | 1241 | SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=%rax save_reg=%r14 |
| 1240 | 1242 | |
| 1243 | + /* | |
| 1244 | + * The above SAVE_AND_SWITCH_TO_KERNEL_CR3 macro doesn't do an | |
| 1245 | + * unconditional CR3 write, even in the PTI case. So do an lfence | |
| 1246 | + * to prevent GS speculation, regardless of whether PTI is enabled. | |
| 1247 | + */ | |
| 1248 | + FENCE_SWAPGS_KERNEL_ENTRY | |
| 1249 | + | |
| 1241 | 1250 | ret |
| 1242 | 1251 | END(paranoid_entry) |
| 1243 | 1252 | |
| @@ -1288,6 +1297,7 @@ ENTRY(error_entry) · 44 unmodified lines | ||
| 1288 | 1297 | * from user mode due to an IRET fault. |
| 1289 | 1298 | */ |
| 1290 | 1299 | SWAPGS |
| 1300 | + FENCE_SWAPGS_USER_ENTRY | |
| 1291 | 1301 | /* We have user CR3. Change to kernel CR3. */ |
| 1292 | 1302 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rax |
| 1293 | 1303 | |
| @@ -1301,6 +1311,8 @@ ENTRY(error_entry) · 7 unmodified lines | ||
| 1301 | 1311 | pushq %r12 |
| 1302 | 1312 | ret |
| 1303 | 1313 | |
| 1314 | +.Lerror_entry_done_lfence: | |
| 1315 | + FENCE_SWAPGS_KERNEL_ENTRY | |
| 1304 | 1316 | .Lerror_entry_done: |
| 1305 | 1317 | ret |
| 1306 | 1318 | |
| @@ -1318,7 +1330,7 @@ ENTRY(error_entry) · 11 unmodified lines | ||
| 1318 | 1330 | cmpq %rax, RIP+8(%rsp) |
| 1319 | 1331 | je .Lbstep_iret |
| 1320 | 1332 | cmpq $.Lgs_change, RIP+8(%rsp) |
| 1321 | − jne .Lerror_entry_done | |
| 1333 | + jne .Lerror_entry_done_lfence | |
| 1322 | 1334 | |
| 1323 | 1335 | /* |
| 1324 | 1336 | * hack: .Lgs_change can fail with user gsbase. If this happens, fix up |
| @@ -1326,6 +1338,7 @@ ENTRY(error_entry) · 1 unmodified line | ||
| 1326 | 1338 | * .Lgs_change's error handler with kernel gsbase. |
| 1327 | 1339 | */ |
| 1328 | 1340 | SWAPGS |
| 1341 | + FENCE_SWAPGS_USER_ENTRY | |
| 1329 | 1342 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rax |
| 1330 | 1343 | jmp .Lerror_entry_done |
| 1331 | 1344 | |
| @@ -1340,6 +1353,7 @@ ENTRY(error_entry) · 8 unmodified lines | ||
| 1340 | 1353 | * gsbase and CR3. Switch to kernel gsbase and CR3: |
| 1341 | 1354 | */ |
| 1342 | 1355 | SWAPGS |
| 1356 | + FENCE_SWAPGS_USER_ENTRY | |
| 1343 | 1357 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rax |
| 1344 | 1358 | |
| 1345 | 1359 | /* |
| @@ -1431,6 +1445,7 @@ ENTRY(nmi) · 85 unmodified lines | ||
| 1431 | 1445 | |
| 1432 | 1446 | swapgs |
| 1433 | 1447 | cld |
| 1448 | + FENCE_SWAPGS_USER_ENTRY | |
| 1434 | 1449 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rdx |
| 1435 | 1450 | movq %rsp, %rdx |
| 1436 | 1451 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp |
| @@ -281,6 +281,8 @@ · 280 unmodified lines | ||
| 281 | 281 | #define X86_FEATURE_CQM_OCCUP_LLC (11*32+ 1) /* LLC occupancy monitoring */ |
| 282 | 282 | #define X86_FEATURE_CQM_MBM_TOTAL (11*32+ 2) /* LLC Total MBM monitoring */ |
| 283 | 283 | #define X86_FEATURE_CQM_MBM_LOCAL (11*32+ 3) /* LLC Local MBM monitoring */ |
| 284 | +#define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */ | |
| 285 | +#define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */ | |
| 284 | 286 | |
| 285 | 287 | /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ |
| 286 | 288 | #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */ |
| @@ -394,5 +396,6 @@ · 107 unmodified lines | ||
| 394 | 396 | #define X86_BUG_L1TF X86_BUG(18) /* CPU is affected by L1 Terminal Fault */ |
| 395 | 397 | #define X86_BUG_MDS X86_BUG(19) /* CPU is affected by Microarchitectural data sampling */ |
| 396 | 398 | #define X86_BUG_MSBDS_ONLY X86_BUG(20) /* CPU is only affected by the MSDBS variant of BUG_MDS */ |
| 399 | +#define X86_BUG_SWAPGS X86_BUG(21) /* CPU is affected by speculation through SWAPGS */ | |
| 397 | 400 | |
| 398 | 401 | #endif /* _ASM_X86_CPUFEATURES_H */ |
| @@ -35,6 +35,8 @@ · 34 unmodified lines | ||
| 35 | 35 | #include <asm/kvm_vcpu_regs.h> |
| 36 | 36 | #include <asm/hyperv-tlfs.h> |
| 37 | 37 | |
| 38 | +#define __KVM_HAVE_ARCH_VCPU_DEBUGFS | |
| 39 | + | |
| 38 | 40 | #define KVM_MAX_VCPUS 288 |
| 39 | 41 | #define KVM_SOFT_MAX_VCPUS 240 |
| 40 | 42 | #define KVM_MAX_VCPU_ID 1023 |
| @@ -1175,6 +1177,7 @@ struct kvm_x86_ops { · 1134 unmodified lines | ||
| 1175 | 1177 | int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq, |
| 1176 | 1178 | uint32_t guest_irq, bool set); |
| 1177 | 1179 | void (*apicv_post_state_restore)(struct kvm_vcpu *vcpu); |
| 1180 | + bool (*dy_apicv_has_pending_interrupt)(struct kvm_vcpu *vcpu); | |
| 1178 | 1181 | |
| 1179 | 1182 | int (*set_hv_timer)(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc, |
| 1180 | 1183 | bool *expired); |
| @@ -96,6 +96,8 @@ long clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) · 95 unmodified lines | ||
| 96 | 96 | |
| 97 | 97 | #else |
| 98 | 98 | |
| 99 | +#define VDSO_HAS_32BIT_FALLBACK 1 | |
| 100 | + | |
| 99 | 101 | static __always_inline |
| 100 | 102 | long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) |
| 101 | 103 | { |
| @@ -113,6 +115,23 @@ long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) · 11 unmodified lines | ||
| 113 | 115 | return ret; |
| 114 | 116 | } |
| 115 | 117 | |
| 118 | +static __always_inline | |
| 119 | +long clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts) | |
| 120 | +{ | |
| 121 | + long ret; | |
| 122 | + | |
| 123 | + asm ( | |
| 124 | + "mov %%ebx, %%edx \n" | |
| 125 | + "mov %[clock], %%ebx \n" | |
| 126 | + "call __kernel_vsyscall \n" | |
| 127 | + "mov %%edx, %%ebx \n" | |
| 128 | + : "=a" (ret), "=m" (*_ts) | |
| 129 | + : "0" (__NR_clock_gettime), [clock] "g" (_clkid), "c" (_ts) | |
| 130 | + : "edx"); | |
| 131 | + | |
| 132 | + return ret; | |
| 133 | +} | |
| 134 | + | |
| 116 | 135 | static __always_inline |
| 117 | 136 | long gettimeofday_fallback(struct __kernel_old_timeval *_tv, |
| 118 | 137 | struct timezone *_tz) |
| @@ -148,6 +167,23 @@ clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) · 29 unmodified lines | ||
| 148 | 167 | return ret; |
| 149 | 168 | } |
| 150 | 169 | |
| 170 | +static __always_inline | |
| 171 | +long clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts) | |
| 172 | +{ | |
| 173 | + long ret; | |
| 174 | + | |
| 175 | + asm ( | |
| 176 | + "mov %%ebx, %%edx \n" | |
| 177 | + "mov %[clock], %%ebx \n" | |
| 178 | + "call __kernel_vsyscall \n" | |
| 179 | + "mov %%edx, %%ebx \n" | |
| 180 | + : "=a" (ret), "=m" (*_ts) | |
| 181 | + : "0" (__NR_clock_getres), [clock] "g" (_clkid), "c" (_ts) | |
| 182 | + : "edx"); | |
| 183 | + | |
| 184 | + return ret; | |
| 185 | +} | |
| 186 | + | |
| 151 | 187 | #endif |
| 152 | 188 | |
| 153 | 189 | #ifdef CONFIG_PARAVIRT_CLOCK |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | #include "cpu.h" |
| 36 | 36 | |
| 37 | +static void __init spectre_v1_select_mitigation(void); | |
| 37 | 38 | static void __init spectre_v2_select_mitigation(void); |
| 38 | 39 | static void __init ssb_select_mitigation(void); |
| 39 | 40 | static void __init l1tf_select_mitigation(void); |
| @@ -98,17 +99,11 @@ void __init check_bugs(void) · 58 unmodified lines | ||
| 98 | 99 | if (boot_cpu_has(X86_FEATURE_STIBP)) |
| 99 | 100 | x86_spec_ctrl_mask |= SPEC_CTRL_STIBP; |
| 100 | 101 | |
| 101 | − /* Select the proper spectre mitigation before patching alternatives */ | |
| 102 | + /* Select the proper CPU mitigations before patching alternatives: */ | |
| 103 | + spectre_v1_select_mitigation(); | |
| 102 | 104 | spectre_v2_select_mitigation(); |
| 103 | − | |
| 104 | − /* | |
| 105 | − * Select proper mitigation for any exposure to the Speculative Store | |
| 106 | − * Bypass vulnerability. | |
| 107 | − */ | |
| 108 | 105 | ssb_select_mitigation(); |
| 109 | − | |
| 110 | 106 | l1tf_select_mitigation(); |
| 111 | − | |
| 112 | 107 | mds_select_mitigation(); |
| 113 | 108 | |
| 114 | 109 | arch_smt_update(); |
| @@ -273,6 +268,98 @@ static int __init mds_cmdline(char *str) · 158 unmodified lines | ||
| 273 | 268 | } |
| 274 | 269 | early_param("mds", mds_cmdline); |
| 275 | 270 | |
| 271 | +#undef pr_fmt | |
| 272 | +#define pr_fmt(fmt) "Spectre V1 : " fmt | |
| 273 | + | |
| 274 | +enum spectre_v1_mitigation { | |
| 275 | + SPECTRE_V1_MITIGATION_NONE, | |
| 276 | + SPECTRE_V1_MITIGATION_AUTO, | |
| 277 | +}; | |
| 278 | + | |
| 279 | +static enum spectre_v1_mitigation spectre_v1_mitigation __ro_after_init = | |
| 280 | + SPECTRE_V1_MITIGATION_AUTO; | |
| 281 | + | |
| 282 | +static const char * const spectre_v1_strings[] = { | |
| 283 | + [SPECTRE_V1_MITIGATION_NONE] = "Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers", | |
| 284 | + [SPECTRE_V1_MITIGATION_AUTO] = "Mitigation: usercopy/swapgs barriers and __user pointer sanitization", | |
| 285 | +}; | |
| 286 | + | |
| 287 | +/* | |
| 288 | + * Does SMAP provide full mitigation against speculative kernel access to | |
| 289 | + * userspace? | |
| 290 | + */ | |
| 291 | +static bool smap_works_speculatively(void) | |
| 292 | +{ | |
| 293 | + if (!boot_cpu_has(X86_FEATURE_SMAP)) | |
| 294 | + return false; | |
| 295 | + | |
| 296 | + /* | |
| 297 | + * On CPUs which are vulnerable to Meltdown, SMAP does not | |
| 298 | + * prevent speculative access to user data in the L1 cache. | |
| 299 | + * Consider SMAP to be non-functional as a mitigation on these | |
| 300 | + * CPUs. | |
| 301 | + */ | |
| 302 | + if (boot_cpu_has(X86_BUG_CPU_MELTDOWN)) | |
| 303 | + return false; | |
| 304 | + | |
| 305 | + return true; | |
| 306 | +} | |
| 307 | + | |
| 308 | +static void __init spectre_v1_select_mitigation(void) | |
| 309 | +{ | |
| 310 | + if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1) || cpu_mitigations_off()) { | |
| 311 | + spectre_v1_mitigation = SPECTRE_V1_MITIGATION_NONE; | |
| 312 | + return; | |
| 313 | + } | |
| 314 | + | |
| 315 | + if (spectre_v1_mitigation == SPECTRE_V1_MITIGATION_AUTO) { | |
| 316 | + /* | |
| 317 | + * With Spectre v1, a user can speculatively control either | |
| 318 | + * path of a conditional swapgs with a user-controlled GS | |
| 319 | + * value. The mitigation is to add lfences to both code paths. | |
| 320 | + * | |
| 321 | + * If FSGSBASE is enabled, the user can put a kernel address in | |
| 322 | + * GS, in which case SMAP provides no protection. | |
| 323 | + * | |
| 324 | + * [ NOTE: Don't check for X86_FEATURE_FSGSBASE until the | |
| 325 | + * FSGSBASE enablement patches have been merged. ] | |
| 326 | + * | |
| 327 | + * If FSGSBASE is disabled, the user can only put a user space | |
| 328 | + * address in GS. That makes an attack harder, but still | |
| 329 | + * possible if there's no SMAP protection. | |
| 330 | + */ | |
| 331 | + if (!smap_works_speculatively()) { | |
| 332 | + /* | |
| 333 | + * Mitigation can be provided from SWAPGS itself or | |
| 334 | + * PTI as the CR3 write in the Meltdown mitigation | |
| 335 | + * is serializing. | |
| 336 | + * | |
| 337 | + * If neither is there, mitigate with an LFENCE to | |
| 338 | + * stop speculation through swapgs. | |
| 339 | + */ | |
| 340 | + if (boot_cpu_has_bug(X86_BUG_SWAPGS) && | |
| 341 | + !boot_cpu_has(X86_FEATURE_PTI)) | |
| 342 | + setup_force_cpu_cap(X86_FEATURE_FENCE_SWAPGS_USER); | |
| 343 | + | |
| 344 | + /* | |
| 345 | + * Enable lfences in the kernel entry (non-swapgs) | |
| 346 | + * paths, to prevent user entry from speculatively | |
| 347 | + * skipping swapgs. | |
| 348 | + */ | |
| 349 | + setup_force_cpu_cap(X86_FEATURE_FENCE_SWAPGS_KERNEL); | |
| 350 | + } | |
| 351 | + } | |
| 352 | + | |
| 353 | + pr_info("%s\n", spectre_v1_strings[spectre_v1_mitigation]); | |
| 354 | +} | |
| 355 | + | |
| 356 | +static int __init nospectre_v1_cmdline(char *str) | |
| 357 | +{ | |
| 358 | + spectre_v1_mitigation = SPECTRE_V1_MITIGATION_NONE; | |
| 359 | + return 0; | |
| 360 | +} | |
| 361 | +early_param("nospectre_v1", nospectre_v1_cmdline); | |
| 362 | + | |
| 276 | 363 | #undef pr_fmt |
| 277 | 364 | #define pr_fmt(fmt) "Spectre V2 : " fmt |
| 278 | 365 | |
| @@ -1290,7 +1377,7 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr · 1011 unmodified lines | ||
| 1290 | 1377 | break; |
| 1291 | 1378 | |
| 1292 | 1379 | case X86_BUG_SPECTRE_V1: |
| 1293 | − return sprintf(buf, "Mitigation: __user pointer sanitization\n"); | |
| 1380 | + return sprintf(buf, "%s\n", spectre_v1_strings[spectre_v1_mitigation]); | |
| 1294 | 1381 | |
| 1295 | 1382 | case X86_BUG_SPECTRE_V2: |
| 1296 | 1383 | return sprintf(buf, "%s%s%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled], |
| @@ -1022,6 +1022,7 @@ static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c) · 1021 unmodified lines | ||
| 1022 | 1022 | #define NO_L1TF BIT(3) |
| 1023 | 1023 | #define NO_MDS BIT(4) |
| 1024 | 1024 | #define MSBDS_ONLY BIT(5) |
| 1025 | +#define NO_SWAPGS BIT(6) | |
| 1025 | 1026 | |
| 1026 | 1027 | #define VULNWL(_vendor, _family, _model, _whitelist) \ |
| 1027 | 1028 | { X86_VENDOR_##_vendor, _family, _model, X86_FEATURE_ANY, _whitelist } |
| @@ -1048,30 +1049,38 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = { · 20 unmodified lines | ||
| 1048 | 1049 | VULNWL_INTEL(ATOM_BONNELL, NO_SPECULATION), |
| 1049 | 1050 | VULNWL_INTEL(ATOM_BONNELL_MID, NO_SPECULATION), |
| 1050 | 1051 | |
| 1051 | − VULNWL_INTEL(ATOM_SILVERMONT, NO_SSB | NO_L1TF | MSBDS_ONLY), | |
| 1052 | − VULNWL_INTEL(ATOM_SILVERMONT_X, NO_SSB | NO_L1TF | MSBDS_ONLY), | |
| 1053 | − VULNWL_INTEL(ATOM_SILVERMONT_MID, NO_SSB | NO_L1TF | MSBDS_ONLY), | |
| 1054 | − VULNWL_INTEL(ATOM_AIRMONT, NO_SSB | NO_L1TF | MSBDS_ONLY), | |
| 1055 | − VULNWL_INTEL(XEON_PHI_KNL, NO_SSB | NO_L1TF | MSBDS_ONLY), | |
| 1056 | − VULNWL_INTEL(XEON_PHI_KNM, NO_SSB | NO_L1TF | MSBDS_ONLY), | |
| 1052 | + VULNWL_INTEL(ATOM_SILVERMONT, NO_SSB | NO_L1TF | MSBDS_ONLY | NO_SWAPGS), | |
| 1053 | + VULNWL_INTEL(ATOM_SILVERMONT_X, NO_SSB | NO_L1TF | MSBDS_ONLY | NO_SWAPGS), | |
| 1054 | + VULNWL_INTEL(ATOM_SILVERMONT_MID, NO_SSB | NO_L1TF | MSBDS_ONLY | NO_SWAPGS), | |
| 1055 | + VULNWL_INTEL(ATOM_AIRMONT, NO_SSB | NO_L1TF | MSBDS_ONLY | NO_SWAPGS), | |
| 1056 | + VULNWL_INTEL(XEON_PHI_KNL, NO_SSB | NO_L1TF | MSBDS_ONLY | NO_SWAPGS), | |
| 1057 | + VULNWL_INTEL(XEON_PHI_KNM, NO_SSB | NO_L1TF | MSBDS_ONLY | NO_SWAPGS), | |
| 1057 | 1058 | |
| 1058 | 1059 | VULNWL_INTEL(CORE_YONAH, NO_SSB), |
| 1059 | 1060 | |
| 1060 | − VULNWL_INTEL(ATOM_AIRMONT_MID, NO_L1TF | MSBDS_ONLY), | |
| 1061 | + VULNWL_INTEL(ATOM_AIRMONT_MID, NO_L1TF | MSBDS_ONLY | NO_SWAPGS), | |
| 1061 | 1062 | |
| 1062 | − VULNWL_INTEL(ATOM_GOLDMONT, NO_MDS | NO_L1TF), | |
| 1063 | − VULNWL_INTEL(ATOM_GOLDMONT_X, NO_MDS | NO_L1TF), | |
| 1064 | − VULNWL_INTEL(ATOM_GOLDMONT_PLUS, NO_MDS | NO_L1TF), | |
| 1063 | + VULNWL_INTEL(ATOM_GOLDMONT, NO_MDS | NO_L1TF | NO_SWAPGS), | |
| 1064 | + VULNWL_INTEL(ATOM_GOLDMONT_X, NO_MDS | NO_L1TF | NO_SWAPGS), | |
| 1065 | + VULNWL_INTEL(ATOM_GOLDMONT_PLUS, NO_MDS | NO_L1TF | NO_SWAPGS), | |
| 1066 | + | |
| 1067 | + /* | |
| 1068 | + * Technically, swapgs isn't serializing on AMD (despite it previously | |
| 1069 | + * being documented as such in the APM). But according to AMD, %gs is | |
| 1070 | + * updated non-speculatively, and the issuing of %gs-relative memory | |
| 1071 | + * operands will be blocked until the %gs update completes, which is | |
| 1072 | + * good enough for our purposes. | |
| 1073 | + */ | |
| 1065 | 1074 | |
| 1066 | 1075 | /* AMD Family 0xf - 0x12 */ |
| 1067 | − VULNWL_AMD(0x0f, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS), | |
| 1068 | − VULNWL_AMD(0x10, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS), | |
| 1069 | − VULNWL_AMD(0x11, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS), | |
| 1070 | − VULNWL_AMD(0x12, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS), | |
| 1076 | + VULNWL_AMD(0x0f, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS | NO_SWAPGS), | |
| 1077 | + VULNWL_AMD(0x10, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS | NO_SWAPGS), | |
| 1078 | + VULNWL_AMD(0x11, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS | NO_SWAPGS), | |
| 1079 | + VULNWL_AMD(0x12, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS | NO_SWAPGS), | |
| 1071 | 1080 | |
| 1072 | 1081 | /* FAMILY_ANY must be last, otherwise 0x0f - 0x12 matches won't work */ |
| 1073 | − VULNWL_AMD(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS), | |
| 1074 | − VULNWL_HYGON(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS), | |
| 1082 | + VULNWL_AMD(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS), | |
| 1083 | + VULNWL_HYGON(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS), | |
| 1075 | 1084 | {} |
| 1076 | 1085 | }; |
| 1077 | 1086 | |
| @@ -1108,6 +1117,9 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) · 30 unmodified lines | ||
| 1108 | 1117 | setup_force_cpu_bug(X86_BUG_MSBDS_ONLY); |
| 1109 | 1118 | } |
| 1110 | 1119 | |
| 1120 | + if (!cpu_matches(NO_SWAPGS)) | |
| 1121 | + setup_force_cpu_bug(X86_BUG_SWAPGS); | |
| 1122 | + | |
| 1111 | 1123 | if (cpu_matches(NO_MELTDOWN)) |
| 1112 | 1124 | return; |
| 1113 | 1125 | |
| @@ -98,6 +98,7 @@ cyrix_get_free_region(unsigned long base, unsigned long size, int replace_reg) · 97 unmodified lines | ||
| 98 | 98 | case 7: |
| 99 | 99 | if (size < 0x40) |
| 100 | 100 | break; |
| 101 | + /* Else, fall through */ | |
| 101 | 102 | case 6: |
| 102 | 103 | case 5: |
| 103 | 104 | case 4: |
| @@ -308,9 +308,6 @@ static notrace void kvm_guest_apic_eoi_write(u32 reg, u32 val) · 307 unmodified lines | ||
| 308 | 308 | |
| 309 | 309 | static void kvm_guest_cpu_init(void) |
| 310 | 310 | { |
| 311 | − if (!kvm_para_available()) | |
| 312 | − return; | |
| 313 | − | |
| 314 | 311 | if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF) && kvmapf) { |
| 315 | 312 | u64 pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason)); |
| 316 | 313 | |
| @@ -625,9 +622,6 @@ static void __init kvm_guest_init(void) · 308 unmodified lines | ||
| 625 | 622 | { |
| 626 | 623 | int i; |
| 627 | 624 | |
| 628 | − if (!kvm_para_available()) | |
| 629 | − return; | |
| 630 | − | |
| 631 | 625 | paravirt_ops_setup(); |
| 632 | 626 | register_reboot_notifier(&kvm_pv_reboot_nb); |
| 633 | 627 | for (i = 0; i < KVM_TASK_SLEEP_HASHSIZE; i++) |
| @@ -848,8 +842,6 @@ asm( · 214 unmodified lines | ||
| 848 | 842 | */ |
| 849 | 843 | void __init kvm_spinlock_init(void) |
| 850 | 844 | { |
| 851 | − if (!kvm_para_available()) | |
| 852 | − return; | |
| 853 | 845 | /* Does host kernel support KVM_FEATURE_PV_UNHALT? */ |
| 854 | 846 | if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT)) |
| 855 | 847 | return; |
| @@ -201,6 +201,7 @@ static int set_segment_reg(struct task_struct *task, · 200 unmodified lines | ||
| 201 | 201 | case offsetof(struct user_regs_struct, ss): |
| 202 | 202 | if (unlikely(value == 0)) |
| 203 | 203 | return -EIO; |
| 204 | + /* Else, fall through */ | |
| 204 | 205 | |
| 205 | 206 | default: |
| 206 | 207 | *pt_regs_access(task_pt_regs(task), offset) = value; |
| @@ -8,11 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/debugfs.h> |
| 9 | 9 | #include "lapic.h" |
| 10 | 10 | |
| 11 | −bool kvm_arch_has_vcpu_debugfs(void) | |
| 12 | −{ | |
| 13 | − return true; | |
| 14 | −} | |
| 15 | − | |
| 16 | 11 | static int vcpu_get_timer_advance_ns(void *data, u64 *val) |
| 17 | 12 | { |
| 18 | 13 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *) data; |
| @@ -48,37 +43,22 @@ static int vcpu_get_tsc_scaling_frac_bits(void *data, u64 *val) · 29 unmodified lines | ||
| 48 | 43 | |
| 49 | 44 | DEFINE_SIMPLE_ATTRIBUTE(vcpu_tsc_scaling_frac_fops, vcpu_get_tsc_scaling_frac_bits, NULL, "%llu\n"); |
| 50 | 45 | |
| 51 | −int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | |
| 46 | +void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) | |
| 52 | 47 | { |
| 53 | − struct dentry *ret; | |
| 54 | − | |
| 55 | − ret = debugfs_create_file("tsc-offset", 0444, | |
| 56 | − vcpu->debugfs_dentry, | |
| 57 | − vcpu, &vcpu_tsc_offset_fops); | |
| 58 | − if (!ret) | |
| 59 | − return -ENOMEM; | |
| 48 | + debugfs_create_file("tsc-offset", 0444, vcpu->debugfs_dentry, vcpu, | |
| 49 | + &vcpu_tsc_offset_fops); | |
| 60 | 50 | |
| 61 | − if (lapic_in_kernel(vcpu)) { | |
| 62 | − ret = debugfs_create_file("lapic_timer_advance_ns", 0444, | |
| 63 | − vcpu->debugfs_dentry, | |
| 64 | − vcpu, &vcpu_timer_advance_ns_fops); | |
| 65 | − if (!ret) | |
| 66 | − return -ENOMEM; | |
| 67 | − } | |
| 51 | + if (lapic_in_kernel(vcpu)) | |
| 52 | + debugfs_create_file("lapic_timer_advance_ns", 0444, | |
| 53 | + vcpu->debugfs_dentry, vcpu, | |
| 54 | + &vcpu_timer_advance_ns_fops); | |
| 68 | 55 | |
| 69 | 56 | if (kvm_has_tsc_control) { |
| 70 | − ret = debugfs_create_file("tsc-scaling-ratio", 0444, | |
| 71 | − vcpu->debugfs_dentry, | |
| 72 | − vcpu, &vcpu_tsc_scaling_fops); | |
| 73 | − if (!ret) | |
| 74 | − return -ENOMEM; | |
| 75 | − ret = debugfs_create_file("tsc-scaling-ratio-frac-bits", 0444, | |
| 76 | − vcpu->debugfs_dentry, | |
| 77 | − vcpu, &vcpu_tsc_scaling_frac_fops); | |
| 78 | − if (!ret) | |
| 79 | − return -ENOMEM; | |
| 80 | − | |
| 57 | + debugfs_create_file("tsc-scaling-ratio", 0444, | |
| 58 | + vcpu->debugfs_dentry, vcpu, | |
| 59 | + &vcpu_tsc_scaling_fops); | |
| 60 | + debugfs_create_file("tsc-scaling-ratio-frac-bits", 0444, | |
| 61 | + vcpu->debugfs_dentry, vcpu, | |
| 62 | + &vcpu_tsc_scaling_frac_fops); | |
| 81 | 63 | } |
| 82 | − | |
| 83 | − return 0; | |
| 84 | 64 | } |
| @@ -1548,7 +1548,6 @@ static void kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic) · 1547 unmodified lines | ||
| 1548 | 1548 | static void apic_timer_expired(struct kvm_lapic *apic) |
| 1549 | 1549 | { |
| 1550 | 1550 | struct kvm_vcpu *vcpu = apic->vcpu; |
| 1551 | − struct swait_queue_head *q = &vcpu->wq; | |
| 1552 | 1551 | struct kvm_timer *ktimer = &apic->lapic_timer; |
| 1553 | 1552 | |
| 1554 | 1553 | if (atomic_read(&apic->lapic_timer.pending)) |
| @@ -1566,13 +1565,6 @@ static void apic_timer_expired(struct kvm_lapic *apic) · 11 unmodified lines | ||
| 1566 | 1565 | |
| 1567 | 1566 | atomic_inc(&apic->lapic_timer.pending); |
| 1568 | 1567 | kvm_set_pending_timer(vcpu); |
| 1569 | − | |
| 1570 | − /* | |
| 1571 | − * For x86, the atomic_inc() is serialized, thus | |
| 1572 | − * using swait_active() is safe. | |
| 1573 | − */ | |
| 1574 | − if (swait_active(q)) | |
| 1575 | − swake_up_one(q); | |
| 1576 | 1568 | } |
| 1577 | 1569 | |
| 1578 | 1570 | static void start_sw_tscdeadline(struct kvm_lapic *apic) |
| @@ -5190,6 +5190,11 @@ static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) · 5189 unmodified lines | ||
| 5190 | 5190 | kvm_vcpu_wake_up(vcpu); |
| 5191 | 5191 | } |
| 5192 | 5192 | |
| 5193 | +static bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) | |
| 5194 | +{ | |
| 5195 | + return false; | |
| 5196 | +} | |
| 5197 | + | |
| 5193 | 5198 | static void svm_ir_list_del(struct vcpu_svm *svm, struct amd_iommu_pi_data *pi) |
| 5194 | 5199 | { |
| 5195 | 5200 | unsigned long flags; |
| @@ -7314,6 +7319,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { · 2118 unmodified lines | ||
| 7314 | 7319 | |
| 7315 | 7320 | .pmu_ops = &amd_pmu_ops, |
| 7316 | 7321 | .deliver_posted_interrupt = svm_deliver_avic_intr, |
| 7322 | + .dy_apicv_has_pending_interrupt = svm_dy_apicv_has_pending_interrupt, | |
| 7317 | 7323 | .update_pi_irte = svm_update_pi_irte, |
| 7318 | 7324 | .setup_mce = svm_setup_mce, |
| 7319 | 7325 | |
| @@ -6117,6 +6117,11 @@ static int vmx_sync_pir_to_irr(struct kvm_vcpu *vcpu) · 6116 unmodified lines | ||
| 6117 | 6117 | return max_irr; |
| 6118 | 6118 | } |
| 6119 | 6119 | |
| 6120 | +static bool vmx_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) | |
| 6121 | +{ | |
| 6122 | + return pi_test_on(vcpu_to_pi_desc(vcpu)); | |
| 6123 | +} | |
| 6124 | + | |
| 6120 | 6125 | static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) |
| 6121 | 6126 | { |
| 6122 | 6127 | if (!kvm_vcpu_apicv_active(vcpu)) |
| @@ -7726,6 +7731,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { · 1603 unmodified lines | ||
| 7726 | 7731 | .guest_apic_has_interrupt = vmx_guest_apic_has_interrupt, |
| 7727 | 7732 | .sync_pir_to_irr = vmx_sync_pir_to_irr, |
| 7728 | 7733 | .deliver_posted_interrupt = vmx_deliver_posted_interrupt, |
| 7734 | + .dy_apicv_has_pending_interrupt = vmx_dy_apicv_has_pending_interrupt, | |
| 7729 | 7735 | |
| 7730 | 7736 | .set_tss_addr = vmx_set_tss_addr, |
| 7731 | 7737 | .set_identity_map_addr = vmx_set_identity_map_addr, |
| @@ -9698,6 +9698,22 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) · 9697 unmodified lines | ||
| 9698 | 9698 | return kvm_vcpu_running(vcpu) || kvm_vcpu_has_events(vcpu); |
| 9699 | 9699 | } |
| 9700 | 9700 | |
| 9701 | +bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu) | |
| 9702 | +{ | |
| 9703 | + if (READ_ONCE(vcpu->arch.pv.pv_unhalted)) | |
| 9704 | + return true; | |
| 9705 | + | |
| 9706 | + if (kvm_test_request(KVM_REQ_NMI, vcpu) || | |
| 9707 | + kvm_test_request(KVM_REQ_SMI, vcpu) || | |
| 9708 | + kvm_test_request(KVM_REQ_EVENT, vcpu)) | |
| 9709 | + return true; | |
| 9710 | + | |
| 9711 | + if (vcpu->arch.apicv_active && kvm_x86_ops->dy_apicv_has_pending_interrupt(vcpu)) | |
| 9712 | + return true; | |
| 9713 | + | |
| 9714 | + return false; | |
| 9715 | +} | |
| 9716 | + | |
| 9701 | 9717 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) |
| 9702 | 9718 | { |
| 9703 | 9719 | return vcpu->arch.preempted_in_kernel; |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | #include <linux/types.h> |
| 3 | 3 | #include <linux/export.h> |
| 4 | +#include <asm/cpu.h> | |
| 4 | 5 | |
| 5 | 6 | unsigned int x86_family(unsigned int sig) |
| 6 | 7 | { |
| @@ -6,6 +6,9 @@ purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string · 5 unmodified lines | ||
| 6 | 6 | targets += $(purgatory-y) |
| 7 | 7 | PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) |
| 8 | 8 | |
| 9 | +$(obj)/string.o: $(srctree)/arch/x86/boot/compressed/string.c FORCE | |
| 10 | + $(call if_changed_rule,cc_o_c) | |
| 11 | + | |
| 9 | 12 | $(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE |
| 10 | 13 | $(call if_changed_rule,cc_o_c) |
| 11 | 14 | |
| @@ -17,11 +20,34 @@ KCOV_INSTRUMENT := n · 5 unmodified lines | ||
| 17 | 20 | |
| 18 | 21 | # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That |
| 19 | 22 | # in turn leaves some undefined symbols like __fentry__ in purgatory and not |
| 20 | −# sure how to relocate those. Like kexec-tools, use custom flags. | |
| 21 | − | |
| 22 | −KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large | |
| 23 | −KBUILD_CFLAGS += -m$(BITS) | |
| 24 | −KBUILD_CFLAGS += $(call cc-option,-fno-PIE) | |
| 23 | +# sure how to relocate those. | |
| 24 | +ifdef CONFIG_FUNCTION_TRACER | |
| 25 | +CFLAGS_REMOVE_sha256.o += $(CC_FLAGS_FTRACE) | |
| 26 | +CFLAGS_REMOVE_purgatory.o += $(CC_FLAGS_FTRACE) | |
| 27 | +CFLAGS_REMOVE_string.o += $(CC_FLAGS_FTRACE) | |
| 28 | +CFLAGS_REMOVE_kexec-purgatory.o += $(CC_FLAGS_FTRACE) | |
| 29 | +endif | |
| 30 | + | |
| 31 | +ifdef CONFIG_STACKPROTECTOR | |
| 32 | +CFLAGS_REMOVE_sha256.o += -fstack-protector | |
| 33 | +CFLAGS_REMOVE_purgatory.o += -fstack-protector | |
| 34 | +CFLAGS_REMOVE_string.o += -fstack-protector | |
| 35 | +CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector | |
| 36 | +endif | |
| 37 | + | |
| 38 | +ifdef CONFIG_STACKPROTECTOR_STRONG | |
| 39 | +CFLAGS_REMOVE_sha256.o += -fstack-protector-strong | |
| 40 | +CFLAGS_REMOVE_purgatory.o += -fstack-protector-strong | |
| 41 | +CFLAGS_REMOVE_string.o += -fstack-protector-strong | |
| 42 | +CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector-strong | |
| 43 | +endif | |
| 44 | + | |
| 45 | +ifdef CONFIG_RETPOLINE | |
| 46 | +CFLAGS_REMOVE_sha256.o += $(RETPOLINE_CFLAGS) | |
| 47 | +CFLAGS_REMOVE_purgatory.o += $(RETPOLINE_CFLAGS) | |
| 48 | +CFLAGS_REMOVE_string.o += $(RETPOLINE_CFLAGS) | |
| 49 | +CFLAGS_REMOVE_kexec-purgatory.o += $(RETPOLINE_CFLAGS) | |
| 50 | +endif | |
| 25 | 51 | |
| 26 | 52 | $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE |
| 27 | 53 | $(call if_changed,ld) |
| @@ -68,3 +68,9 @@ void purgatory(void) · 67 unmodified lines | ||
| 68 | 68 | } |
| 69 | 69 | copy_backup_region(); |
| 70 | 70 | } |
| 71 | + | |
| 72 | +/* | |
| 73 | + * Defined in order to reuse memcpy() and memset() from | |
| 74 | + * arch/x86/boot/compressed/string.c | |
| 75 | + */ | |
| 76 | +void warn(const char *msg) {} | |
| @@ -1,23 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −/* | |
| 3 | − * Simple string functions. | |
| 4 | − * | |
| 5 | − * Copyright (C) 2014 Red Hat Inc. | |
| 6 | − * | |
| 7 | − * Author: | |
| 8 | − * Vivek Goyal <vgoyal@redhat.com> | |
| 9 | − */ | |
| 10 | − | |
| 11 | −#include <linux/types.h> | |
| 12 | − | |
| 13 | −#include "../boot/string.c" | |
| 14 | − | |
| 15 | −void *memcpy(void *dst, const void *src, size_t len) | |
| 16 | −{ | |
| 17 | − return __builtin_memcpy(dst, src, len); | |
| 18 | −} | |
| 19 | − | |
| 20 | −void *memset(void *dst, int c, size_t len) | |
| 21 | −{ | |
| 22 | − return __builtin_memset(dst, c, len); | |
| 23 | −} | |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | #include <linux/linkage.h> |
| 16 | 16 | #include <asm/asm-offsets.h> |
| 17 | +#include <asm/asmmacro.h> | |
| 17 | 18 | #include <asm/processor.h> |
| 18 | 19 | #include <asm/coprocessor.h> |
| 19 | 20 | #include <asm/thread_info.h> |
| @@ -1924,12 +1924,13 @@ static void bfq_add_request(struct request *rq) · 1923 unmodified lines | ||
| 1924 | 1924 | * confirmed no later than during the next |
| 1925 | 1925 | * I/O-plugging interval for bfqq. |
| 1926 | 1926 | */ |
| 1927 | − if (!bfq_bfqq_has_short_ttime(bfqq) && | |
| 1927 | + if (bfqd->last_completed_rq_bfqq && | |
| 1928 | + !bfq_bfqq_has_short_ttime(bfqq) && | |
| 1928 | 1929 | ktime_get_ns() - bfqd->last_completion < |
| 1929 | 1930 | 200 * NSEC_PER_USEC) { |
| 1930 | 1931 | if (bfqd->last_completed_rq_bfqq != bfqq && |
| 1931 | − bfqd->last_completed_rq_bfqq != | |
| 1932 | − bfqq->waker_bfqq) { | |
| 1932 | + bfqd->last_completed_rq_bfqq != | |
| 1933 | + bfqq->waker_bfqq) { | |
| 1933 | 1934 | /* |
| 1934 | 1935 | * First synchronization detected with |
| 1935 | 1936 | * a candidate waker queue, or with a |
| @@ -2250,9 +2251,14 @@ static void bfq_request_merged(struct request_queue *q, struct request *req, · 314 unmodified lines | ||
| 2250 | 2251 | blk_rq_pos(container_of(rb_prev(&req->rb_node), |
| 2251 | 2252 | struct request, rb_node))) { |
| 2252 | 2253 | struct bfq_queue *bfqq = bfq_init_rq(req); |
| 2253 | − struct bfq_data *bfqd = bfqq->bfqd; | |
| 2254 | + struct bfq_data *bfqd; | |
| 2254 | 2255 | struct request *prev, *next_rq; |
| 2255 | 2256 | |
| 2257 | + if (!bfqq) | |
| 2258 | + return; | |
| 2259 | + | |
| 2260 | + bfqd = bfqq->bfqd; | |
| 2261 | + | |
| 2256 | 2262 | /* Reposition request in its sort_list */ |
| 2257 | 2263 | elv_rb_del(&bfqq->sort_list, req); |
| 2258 | 2264 | elv_rb_add(&bfqq->sort_list, req); |
| @@ -2299,6 +2305,9 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, · 40 unmodified lines | ||
| 2299 | 2305 | struct bfq_queue *bfqq = bfq_init_rq(rq), |
| 2300 | 2306 | *next_bfqq = bfq_init_rq(next); |
| 2301 | 2307 | |
| 2308 | + if (!bfqq) | |
| 2309 | + return; | |
| 2310 | + | |
| 2302 | 2311 | /* |
| 2303 | 2312 | * If next and rq belong to the same bfq_queue and next is older |
| 2304 | 2313 | * than rq, then reposition rq in the fifo (by substituting next |
| @@ -4764,6 +4773,8 @@ static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx) · 2459 unmodified lines | ||
| 4764 | 4773 | */ |
| 4765 | 4774 | void bfq_put_queue(struct bfq_queue *bfqq) |
| 4766 | 4775 | { |
| 4776 | + struct bfq_queue *item; | |
| 4777 | + struct hlist_node *n; | |
| 4767 | 4778 | #ifdef CONFIG_BFQ_GROUP_IOSCHED |
| 4768 | 4779 | struct bfq_group *bfqg = bfqq_group(bfqq); |
| 4769 | 4780 | #endif |
| @@ -4808,6 +4819,36 @@ void bfq_put_queue(struct bfq_queue *bfqq) · 38 unmodified lines | ||
| 4808 | 4819 | bfqq->bfqd->burst_size--; |
| 4809 | 4820 | } |
| 4810 | 4821 | |
| 4822 | + /* | |
| 4823 | + * bfqq does not exist any longer, so it cannot be woken by | |
| 4824 | + * any other queue, and cannot wake any other queue. Then bfqq | |
| 4825 | + * must be removed from the woken list of its possible waker | |
| 4826 | + * queue, and all queues in the woken list of bfqq must stop | |
| 4827 | + * having a waker queue. Strictly speaking, these updates | |
| 4828 | + * should be performed when bfqq remains with no I/O source | |
| 4829 | + * attached to it, which happens before bfqq gets freed. In | |
| 4830 | + * particular, this happens when the last process associated | |
| 4831 | + * with bfqq exits or gets associated with a different | |
| 4832 | + * queue. However, both events lead to bfqq being freed soon, | |
| 4833 | + * and dangling references would come out only after bfqq gets | |
| 4834 | + * freed. So these updates are done here, as a simple and safe | |
| 4835 | + * way to handle all cases. | |
| 4836 | + */ | |
| 4837 | + /* remove bfqq from woken list */ | |
| 4838 | + if (!hlist_unhashed(&bfqq->woken_list_node)) | |
| 4839 | + hlist_del_init(&bfqq->woken_list_node); | |
| 4840 | + | |
| 4841 | + /* reset waker for all queues in woken list */ | |
| 4842 | + hlist_for_each_entry_safe(item, n, &bfqq->woken_list, | |
| 4843 | + woken_list_node) { | |
| 4844 | + item->waker_bfqq = NULL; | |
| 4845 | + bfq_clear_bfqq_has_waker(item); | |
| 4846 | + hlist_del_init(&item->woken_list_node); | |
| 4847 | + } | |
| 4848 | + | |
| 4849 | + if (bfqq->bfqd && bfqq->bfqd->last_completed_rq_bfqq == bfqq) | |
| 4850 | + bfqq->bfqd->last_completed_rq_bfqq = NULL; | |
| 4851 | + | |
| 4811 | 4852 | kmem_cache_free(bfq_pool, bfqq); |
| 4812 | 4853 | #ifdef CONFIG_BFQ_GROUP_IOSCHED |
| 4813 | 4854 | bfqg_and_blkg_put(bfqg); |
| @@ -4835,9 +4876,6 @@ static void bfq_put_cooperator(struct bfq_queue *bfqq) · 21 unmodified lines | ||
| 4835 | 4876 | |
| 4836 | 4877 | static void bfq_exit_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq) |
| 4837 | 4878 | { |
| 4838 | − struct bfq_queue *item; | |
| 4839 | − struct hlist_node *n; | |
| 4840 | − | |
| 4841 | 4879 | if (bfqq == bfqd->in_service_queue) { |
| 4842 | 4880 | __bfq_bfqq_expire(bfqd, bfqq, BFQQE_BUDGET_TIMEOUT); |
| 4843 | 4881 | bfq_schedule_dispatch(bfqd); |
| @@ -4847,18 +4885,6 @@ static void bfq_exit_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq) · 3 unmodified lines | ||
| 4847 | 4885 | |
| 4848 | 4886 | bfq_put_cooperator(bfqq); |
| 4849 | 4887 | |
| 4850 | − /* remove bfqq from woken list */ | |
| 4851 | − if (!hlist_unhashed(&bfqq->woken_list_node)) | |
| 4852 | − hlist_del_init(&bfqq->woken_list_node); | |
| 4853 | − | |
| 4854 | − /* reset waker for all queues in woken list */ | |
| 4855 | − hlist_for_each_entry_safe(item, n, &bfqq->woken_list, | |
| 4856 | − woken_list_node) { | |
| 4857 | − item->waker_bfqq = NULL; | |
| 4858 | − bfq_clear_bfqq_has_waker(item); | |
| 4859 | − hlist_del_init(&item->woken_list_node); | |
| 4860 | − } | |
| 4861 | − | |
| 4862 | 4888 | bfq_put_queue(bfqq); /* release process reference */ |
| 4863 | 4889 | } |
| 4864 | 4890 | |
| @@ -5436,12 +5462,12 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, · 571 unmodified lines | ||
| 5436 | 5462 | |
| 5437 | 5463 | spin_lock_irq(&bfqd->lock); |
| 5438 | 5464 | bfqq = bfq_init_rq(rq); |
| 5439 | − if (at_head || blk_rq_is_passthrough(rq)) { | |
| 5465 | + if (!bfqq || at_head || blk_rq_is_passthrough(rq)) { | |
| 5440 | 5466 | if (at_head) |
| 5441 | 5467 | list_add(&rq->queuelist, &bfqd->dispatch); |
| 5442 | 5468 | else |
| 5443 | 5469 | list_add_tail(&rq->queuelist, &bfqd->dispatch); |
| 5444 | − } else { /* bfqq is assumed to be non null here */ | |
| 5470 | + } else { | |
| 5445 | 5471 | idle_timer_disabled = __bfq_insert_request(bfqd, rq); |
| 5446 | 5472 | /* |
| 5447 | 5473 | * Update bfqq, because, if a queue merge has occurred |
| @@ -232,13 +232,15 @@ int acpi_device_set_power(struct acpi_device *device, int state) · 231 unmodified lines | ||
| 232 | 232 | if (device->power.flags.power_resources) |
| 233 | 233 | result = acpi_power_transition(device, target_state); |
| 234 | 234 | } else { |
| 235 | + int cur_state = device->power.state; | |
| 236 | + | |
| 235 | 237 | if (device->power.flags.power_resources) { |
| 236 | 238 | result = acpi_power_transition(device, ACPI_STATE_D0); |
| 237 | 239 | if (result) |
| 238 | 240 | goto end; |
| 239 | 241 | } |
| 240 | 242 | |
| 241 | − if (device->power.state == ACPI_STATE_D0) { | |
| 243 | + if (cur_state == ACPI_STATE_D0) { | |
| 242 | 244 | int psc; |
| 243 | 245 | |
| 244 | 246 | /* Nothing to do here if _PSC is not present. */ |
| @@ -2204,6 +2204,12 @@ int __init acpi_scan_init(void) · 2203 unmodified lines | ||
| 2204 | 2204 | acpi_gpe_apply_masked_gpes(); |
| 2205 | 2205 | acpi_update_all_gpes(); |
| 2206 | 2206 | |
| 2207 | + /* | |
| 2208 | + * Although we call __add_memory() that is documented to require the | |
| 2209 | + * device_hotplug_lock, it is not necessary here because this is an | |
| 2210 | + * early code when userspace or any other code path cannot trigger | |
| 2211 | + * hotplug/hotunplug operations. | |
| 2212 | + */ | |
| 2207 | 2213 | mutex_lock(&acpi_scan_lock); |
| 2208 | 2214 | /* |
| 2209 | 2215 | * Enumerate devices in the ACPI namespace. |
| @@ -338,6 +338,9 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port, · 337 unmodified lines | ||
| 338 | 338 | hpriv->phys[port] = NULL; |
| 339 | 339 | rc = 0; |
| 340 | 340 | break; |
| 341 | + case -EPROBE_DEFER: | |
| 342 | + /* Do not complain yet */ | |
| 343 | + break; | |
| 341 | 344 | |
| 342 | 345 | default: |
| 343 | 346 | dev_err(dev, |
| @@ -1786,6 +1786,21 @@ nothing_to_do: · 1785 unmodified lines | ||
| 1786 | 1786 | return 1; |
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | +static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks) | |
| 1790 | +{ | |
| 1791 | + struct request *rq = scmd->request; | |
| 1792 | + u32 req_blocks; | |
| 1793 | + | |
| 1794 | + if (!blk_rq_is_passthrough(rq)) | |
| 1795 | + return true; | |
| 1796 | + | |
| 1797 | + req_blocks = blk_rq_bytes(rq) / scmd->device->sector_size; | |
| 1798 | + if (n_blocks > req_blocks) | |
| 1799 | + return false; | |
| 1800 | + | |
| 1801 | + return true; | |
| 1802 | +} | |
| 1803 | + | |
| 1789 | 1804 | /** |
| 1790 | 1805 | * ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one |
| 1791 | 1806 | * @qc: Storage for translated ATA taskfile |
| @@ -1830,6 +1845,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) · 38 unmodified lines | ||
| 1830 | 1845 | scsi_10_lba_len(cdb, &block, &n_block); |
| 1831 | 1846 | if (cdb[1] & (1 << 3)) |
| 1832 | 1847 | tf_flags |= ATA_TFLAG_FUA; |
| 1848 | + if (!ata_check_nblocks(scmd, n_block)) | |
| 1849 | + goto invalid_fld; | |
| 1833 | 1850 | break; |
| 1834 | 1851 | case READ_6: |
| 1835 | 1852 | case WRITE_6: |
| @@ -1844,6 +1861,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) · 8 unmodified lines | ||
| 1844 | 1861 | */ |
| 1845 | 1862 | if (!n_block) |
| 1846 | 1863 | n_block = 256; |
| 1864 | + if (!ata_check_nblocks(scmd, n_block)) | |
| 1865 | + goto invalid_fld; | |
| 1847 | 1866 | break; |
| 1848 | 1867 | case READ_16: |
| 1849 | 1868 | case WRITE_16: |
| @@ -1854,6 +1873,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) · 4 unmodified lines | ||
| 1854 | 1873 | scsi_16_lba_len(cdb, &block, &n_block); |
| 1855 | 1874 | if (cdb[1] & (1 << 3)) |
| 1856 | 1875 | tf_flags |= ATA_TFLAG_FUA; |
| 1876 | + if (!ata_check_nblocks(scmd, n_block)) | |
| 1877 | + goto invalid_fld; | |
| 1857 | 1878 | break; |
| 1858 | 1879 | default: |
| 1859 | 1880 | DPRINTK("no-byte command\n"); |
| @@ -658,6 +658,10 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) · 657 unmodified lines | ||
| 658 | 658 | unsigned int offset; |
| 659 | 659 | unsigned char *buf; |
| 660 | 660 | |
| 661 | + if (!qc->cursg) { | |
| 662 | + qc->curbytes = qc->nbytes; | |
| 663 | + return; | |
| 664 | + } | |
| 661 | 665 | if (qc->curbytes == qc->nbytes - qc->sect_size) |
| 662 | 666 | ap->hsm_task_state = HSM_ST_LAST; |
| 663 | 667 | |
| @@ -683,6 +687,8 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) · 19 unmodified lines | ||
| 683 | 687 | |
| 684 | 688 | if (qc->cursg_ofs == qc->cursg->length) { |
| 685 | 689 | qc->cursg = sg_next(qc->cursg); |
| 690 | + if (!qc->cursg) | |
| 691 | + ap->hsm_task_state = HSM_ST_LAST; | |
| 686 | 692 | qc->cursg_ofs = 0; |
| 687 | 693 | } |
| 688 | 694 | } |
| @@ -56,7 +56,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev) · 55 unmodified lines | ||
| 56 | 56 | unsigned int ret; |
| 57 | 57 | struct rm_feature_desc *desc; |
| 58 | 58 | struct ata_taskfile tf; |
| 59 | − static const char cdb[] = { GPCMD_GET_CONFIGURATION, | |
| 59 | + static const char cdb[ATAPI_CDB_LEN] = { GPCMD_GET_CONFIGURATION, | |
| 60 | 60 | 2, /* only 1 feature descriptor requested */ |
| 61 | 61 | 0, 3, /* 3, removable medium feature */ |
| 62 | 62 | 0, 0, 0,/* reserved */ |
| @@ -158,7 +158,6 @@ static int rb532_pata_driver_probe(struct platform_device *pdev) · 157 unmodified lines | ||
| 158 | 158 | static int rb532_pata_driver_remove(struct platform_device *pdev) |
| 159 | 159 | { |
| 160 | 160 | struct ata_host *ah = platform_get_drvdata(pdev); |
| 161 | − struct rb532_cf_info *info = ah->private_data; | |
| 162 | 161 | |
| 163 | 162 | ata_host_detach(ah); |
| 164 | 163 | |
| @@ -63,6 +63,7 @@ · 62 unmodified lines | ||
| 63 | 63 | #include <asm/byteorder.h> |
| 64 | 64 | #include <linux/vmalloc.h> |
| 65 | 65 | #include <linux/jiffies.h> |
| 66 | +#include <linux/nospec.h> | |
| 66 | 67 | #include "iphase.h" |
| 67 | 68 | #include "suni.h" |
| 68 | 69 | #define swap_byte_order(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8)) |
| @@ -2760,8 +2761,11 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) · 2691 unmodified lines | ||
| 2760 | 2761 | } |
| 2761 | 2762 | if (copy_from_user(&ia_cmds, arg, sizeof ia_cmds)) return -EFAULT; |
| 2762 | 2763 | board = ia_cmds.status; |
| 2763 | − if ((board < 0) || (board > iadev_count)) | |
| 2764 | − board = 0; | |
| 2764 | + | |
| 2765 | + if ((board < 0) || (board > iadev_count)) | |
| 2766 | + board = 0; | |
| 2767 | + board = array_index_nospec(board, iadev_count + 1); | |
| 2768 | + | |
| 2765 | 2769 | iadev = ia_dev[board]; |
| 2766 | 2770 | switch (ia_cmds.cmd) { |
| 2767 | 2771 | case MEMDUMP: |
| @@ -1823,12 +1823,63 @@ static inline struct kobject *get_glue_dir(struct device *dev) · 1822 unmodified lines | ||
| 1823 | 1823 | */ |
| 1824 | 1824 | static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) |
| 1825 | 1825 | { |
| 1826 | + unsigned int ref; | |
| 1827 | + | |
| 1826 | 1828 | /* see if we live in a "glue" directory */ |
| 1827 | 1829 | if (!live_in_glue_dir(glue_dir, dev)) |
| 1828 | 1830 | return; |
| 1829 | 1831 | |
| 1830 | 1832 | mutex_lock(&gdp_mutex); |
| 1831 | − if (!kobject_has_children(glue_dir)) | |
| 1833 | + /** | |
| 1834 | + * There is a race condition between removing glue directory | |
| 1835 | + * and adding a new device under the glue directory. | |
| 1836 | + * | |
| 1837 | + * CPU1: CPU2: | |
| 1838 | + * | |
| 1839 | + * device_add() | |
| 1840 | + * get_device_parent() | |
| 1841 | + * class_dir_create_and_add() | |
| 1842 | + * kobject_add_internal() | |
| 1843 | + * create_dir() // create glue_dir | |
| 1844 | + * | |
| 1845 | + * device_add() | |
| 1846 | + * get_device_parent() | |
| 1847 | + * kobject_get() // get glue_dir | |
| 1848 | + * | |
| 1849 | + * device_del() | |
| 1850 | + * cleanup_glue_dir() | |
| 1851 | + * kobject_del(glue_dir) | |
| 1852 | + * | |
| 1853 | + * kobject_add() | |
| 1854 | + * kobject_add_internal() | |
| 1855 | + * create_dir() // in glue_dir | |
| 1856 | + * sysfs_create_dir_ns() | |
| 1857 | + * kernfs_create_dir_ns(sd) | |
| 1858 | + * | |
| 1859 | + * sysfs_remove_dir() // glue_dir->sd=NULL | |
| 1860 | + * sysfs_put() // free glue_dir->sd | |
| 1861 | + * | |
| 1862 | + * // sd is freed | |
| 1863 | + * kernfs_new_node(sd) | |
| 1864 | + * kernfs_get(glue_dir) | |
| 1865 | + * kernfs_add_one() | |
| 1866 | + * kernfs_put() | |
| 1867 | + * | |
| 1868 | + * Before CPU1 remove last child device under glue dir, if CPU2 add | |
| 1869 | + * a new device under glue dir, the glue_dir kobject reference count | |
| 1870 | + * will be increase to 2 in kobject_get(k). And CPU2 has been called | |
| 1871 | + * kernfs_create_dir_ns(). Meanwhile, CPU1 call sysfs_remove_dir() | |
| 1872 | + * and sysfs_put(). This result in glue_dir->sd is freed. | |
| 1873 | + * | |
| 1874 | + * Then the CPU2 will see a stale "empty" but still potentially used | |
| 1875 | + * glue dir around in kernfs_new_node(). | |
| 1876 | + * | |
| 1877 | + * In order to avoid this happening, we also should make sure that | |
| 1878 | + * kernfs_node for glue_dir is released in CPU1 only when refcount | |
| 1879 | + * for glue_dir kobj is 1. | |
| 1880 | + */ | |
| 1881 | + ref = kref_read(&glue_dir->kref); | |
| 1882 | + if (!kobject_has_children(glue_dir) && !--ref) | |
| 1832 | 1883 | kobject_del(glue_dir); |
| 1833 | 1884 | kobject_put(glue_dir); |
| 1834 | 1885 | mutex_unlock(&gdp_mutex); |
| @@ -157,8 +157,13 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) · 156 unmodified lines | ||
| 157 | 157 | * the device will only expose one IRQ, and this fallback |
| 158 | 158 | * allows a common code path across either kind of resource. |
| 159 | 159 | */ |
| 160 | − if (num == 0 && has_acpi_companion(&dev->dev)) | |
| 161 | − return acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num); | |
| 160 | + if (num == 0 && has_acpi_companion(&dev->dev)) { | |
| 161 | + int ret = acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num); | |
| 162 | + | |
| 163 | + /* Our callers expect -ENXIO for missing IRQs. */ | |
| 164 | + if (ret >= 0 || ret == -EPROBE_DEFER) | |
| 165 | + return ret; | |
| 166 | + } | |
| 162 | 167 | |
| 163 | 168 | return -ENXIO; |
| 164 | 169 | #endif |
| @@ -323,10 +323,14 @@ flush(const char __user *str, size_t cnt, int exiting) · 322 unmodified lines | ||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | flush_scheduled_work(); |
| 326 | − /* pass one: without sleeping, do aoedev_downdev */ | |
| 326 | + /* pass one: do aoedev_downdev, which might sleep */ | |
| 327 | +restart1: | |
| 327 | 328 | spin_lock_irqsave(&devlist_lock, flags); |
| 328 | 329 | for (d = devlist; d; d = d->next) { |
| 329 | 330 | spin_lock(&d->lock); |
| 331 | + if (d->flags & DEVFL_TKILL) | |
| 332 | + goto cont; | |
| 333 | + | |
| 330 | 334 | if (exiting) { |
| 331 | 335 | /* unconditionally take each device down */ |
| 332 | 336 | } else if (specified) { |
| @@ -338,8 +342,11 @@ flush(const char __user *str, size_t cnt, int exiting) · 5 unmodified lines | ||
| 338 | 342 | || d->ref) |
| 339 | 343 | goto cont; |
| 340 | 344 | |
| 345 | + spin_unlock(&d->lock); | |
| 346 | + spin_unlock_irqrestore(&devlist_lock, flags); | |
| 341 | 347 | aoedev_downdev(d); |
| 342 | 348 | d->flags |= DEVFL_TKILL; |
| 349 | + goto restart1; | |
| 343 | 350 | cont: |
| 344 | 351 | spin_unlock(&d->lock); |
| 345 | 352 | } |
| @@ -348,7 +355,7 @@ cont: · 2 unmodified lines | ||
| 348 | 355 | /* pass two: call freedev, which might sleep, |
| 349 | 356 | * for aoedevs marked with DEVFL_TKILL |
| 350 | 357 | */ |
| 351 | −restart: | |
| 358 | +restart2: | |
| 352 | 359 | spin_lock_irqsave(&devlist_lock, flags); |
| 353 | 360 | for (d = devlist; d; d = d->next) { |
| 354 | 361 | spin_lock(&d->lock); |
| @@ -357,7 +364,7 @@ restart: · 2 unmodified lines | ||
| 357 | 364 | spin_unlock(&d->lock); |
| 358 | 365 | spin_unlock_irqrestore(&devlist_lock, flags); |
| 359 | 366 | freedev(d); |
| 360 | − goto restart; | |
| 367 | + goto restart2; | |
| 361 | 368 | } |
| 362 | 369 | spin_unlock(&d->lock); |
| 363 | 370 | } |
| @@ -1726,6 +1726,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, · 1725 unmodified lines | ||
| 1726 | 1726 | /* MSch: invalidate default_params */ |
| 1727 | 1727 | default_params[drive].blocks = 0; |
| 1728 | 1728 | set_capacity(floppy->disk, MAX_DISK_SIZE * 2); |
| 1729 | + /* Fall through */ | |
| 1729 | 1730 | case FDFMTEND: |
| 1730 | 1731 | case FDFLUSH: |
| 1731 | 1732 | /* invalidate the buffer track to force a reread */ |
| @@ -885,7 +885,7 @@ static void loop_unprepare_queue(struct loop_device *lo) · 884 unmodified lines | ||
| 885 | 885 | |
| 886 | 886 | static int loop_kthread_worker_fn(void *worker_ptr) |
| 887 | 887 | { |
| 888 | − current->flags |= PF_LESS_THROTTLE; | |
| 888 | + current->flags |= PF_LESS_THROTTLE | PF_MEMALLOC_NOIO; | |
| 889 | 889 | return kthread_worker_fn(worker_ptr); |
| 890 | 890 | } |
| 891 | 891 | |
| @@ -924,6 +924,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, · 32 unmodified lines | ||
| 924 | 924 | struct file *file; |
| 925 | 925 | struct inode *inode; |
| 926 | 926 | struct address_space *mapping; |
| 927 | + struct block_device *claimed_bdev = NULL; | |
| 927 | 928 | int lo_flags = 0; |
| 928 | 929 | int error; |
| 929 | 930 | loff_t size; |
| @@ -942,10 +943,11 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, · 12 unmodified lines | ||
| 942 | 943 | * here to avoid changing device under exclusive owner. |
| 943 | 944 | */ |
| 944 | 945 | if (!(mode & FMODE_EXCL)) { |
| 945 | − bdgrab(bdev); | |
| 946 | − error = blkdev_get(bdev, mode | FMODE_EXCL, loop_set_fd); | |
| 947 | − if (error) | |
| 946 | + claimed_bdev = bd_start_claiming(bdev, loop_set_fd); | |
| 947 | + if (IS_ERR(claimed_bdev)) { | |
| 948 | + error = PTR_ERR(claimed_bdev); | |
| 948 | 949 | goto out_putf; |
| 950 | + } | |
| 949 | 951 | } |
| 950 | 952 | |
| 951 | 953 | error = mutex_lock_killable(&loop_ctl_mutex); |
| @@ -1015,15 +1017,15 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, · 63 unmodified lines | ||
| 1015 | 1017 | mutex_unlock(&loop_ctl_mutex); |
| 1016 | 1018 | if (partscan) |
| 1017 | 1019 | loop_reread_partitions(lo, bdev); |
| 1018 | − if (!(mode & FMODE_EXCL)) | |
| 1019 | − blkdev_put(bdev, mode | FMODE_EXCL); | |
| 1020 | + if (claimed_bdev) | |
| 1021 | + bd_abort_claiming(bdev, claimed_bdev, loop_set_fd); | |
| 1020 | 1022 | return 0; |
| 1021 | 1023 | |
| 1022 | 1024 | out_unlock: |
| 1023 | 1025 | mutex_unlock(&loop_ctl_mutex); |
| 1024 | 1026 | out_bdev: |
| 1025 | − if (!(mode & FMODE_EXCL)) | |
| 1026 | − blkdev_put(bdev, mode | FMODE_EXCL); | |
| 1027 | + if (claimed_bdev) | |
| 1028 | + bd_abort_claiming(bdev, claimed_bdev, loop_set_fd); | |
| 1027 | 1029 | out_putf: |
| 1028 | 1030 | fput(file); |
| 1029 | 1031 | out: |
| @@ -1231,7 +1231,7 @@ static void nbd_clear_sock_ioctl(struct nbd_device *nbd, · 1230 unmodified lines | ||
| 1231 | 1231 | struct block_device *bdev) |
| 1232 | 1232 | { |
| 1233 | 1233 | sock_shutdown(nbd); |
| 1234 | − kill_bdev(bdev); | |
| 1234 | + __invalidate_device(bdev, true); | |
| 1235 | 1235 | nbd_bdev_reset(bdev); |
| 1236 | 1236 | if (test_and_clear_bit(NBD_HAS_CONFIG_REF, |
| 1237 | 1237 | &nbd->config->runtime_flags)) |
| @@ -98,6 +98,9 @@ static int ath_open(struct hci_uart *hu) · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | BT_DBG("hu %p", hu); |
| 100 | 100 | |
| 101 | + if (!hci_uart_has_flow_control(hu)) | |
| 102 | + return -EOPNOTSUPP; | |
| 103 | + | |
| 101 | 104 | ath = kzalloc(sizeof(*ath), GFP_KERNEL); |
| 102 | 105 | if (!ath) |
| 103 | 106 | return -ENOMEM; |
| @@ -406,6 +406,9 @@ static int bcm_open(struct hci_uart *hu) · 405 unmodified lines | ||
| 406 | 406 | |
| 407 | 407 | bt_dev_dbg(hu->hdev, "hu %p", hu); |
| 408 | 408 | |
| 409 | + if (!hci_uart_has_flow_control(hu)) | |
| 410 | + return -EOPNOTSUPP; | |
| 411 | + | |
| 409 | 412 | bcm = kzalloc(sizeof(*bcm), GFP_KERNEL); |
| 410 | 413 | if (!bcm) |
| 411 | 414 | return -ENOMEM; |
| @@ -391,6 +391,9 @@ static int intel_open(struct hci_uart *hu) · 390 unmodified lines | ||
| 391 | 391 | |
| 392 | 392 | BT_DBG("hu %p", hu); |
| 393 | 393 | |
| 394 | + if (!hci_uart_has_flow_control(hu)) | |
| 395 | + return -EOPNOTSUPP; | |
| 396 | + | |
| 394 | 397 | intel = kzalloc(sizeof(*intel), GFP_KERNEL); |
| 395 | 398 | if (!intel) |
| 396 | 399 | return -ENOMEM; |
| @@ -292,6 +292,19 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb) · 291 unmodified lines | ||
| 292 | 292 | return 0; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | +/* Check the underlying device or tty has flow control support */ | |
| 296 | +bool hci_uart_has_flow_control(struct hci_uart *hu) | |
| 297 | +{ | |
| 298 | + /* serdev nodes check if the needed operations are present */ | |
| 299 | + if (hu->serdev) | |
| 300 | + return true; | |
| 301 | + | |
| 302 | + if (hu->tty->driver->ops->tiocmget && hu->tty->driver->ops->tiocmset) | |
| 303 | + return true; | |
| 304 | + | |
| 305 | + return false; | |
| 306 | +} | |
| 307 | + | |
| 295 | 308 | /* Flow control or un-flow control the device */ |
| 296 | 309 | void hci_uart_set_flow_control(struct hci_uart *hu, bool enable) |
| 297 | 310 | { |
| @@ -59,6 +59,9 @@ static int mrvl_open(struct hci_uart *hu) · 58 unmodified lines | ||
| 59 | 59 | |
| 60 | 60 | BT_DBG("hu %p", hu); |
| 61 | 61 | |
| 62 | + if (!hci_uart_has_flow_control(hu)) | |
| 63 | + return -EOPNOTSUPP; | |
| 64 | + | |
| 62 | 65 | mrvl = kzalloc(sizeof(*mrvl), GFP_KERNEL); |
| 63 | 66 | if (!mrvl) |
| 64 | 67 | return -ENOMEM; |
| @@ -473,6 +473,9 @@ static int qca_open(struct hci_uart *hu) · 472 unmodified lines | ||
| 473 | 473 | |
| 474 | 474 | BT_DBG("hu %p qca_open", hu); |
| 475 | 475 | |
| 476 | + if (!hci_uart_has_flow_control(hu)) | |
| 477 | + return -EOPNOTSUPP; | |
| 478 | + | |
| 476 | 479 | qca = kzalloc(sizeof(struct qca_data), GFP_KERNEL); |
| 477 | 480 | if (!qca) |
| 478 | 481 | return -ENOMEM; |
| @@ -104,6 +104,7 @@ int hci_uart_wait_until_sent(struct hci_uart *hu); · 103 unmodified lines | ||
| 104 | 104 | int hci_uart_init_ready(struct hci_uart *hu); |
| 105 | 105 | void hci_uart_init_work(struct work_struct *work); |
| 106 | 106 | void hci_uart_set_baudrate(struct hci_uart *hu, unsigned int speed); |
| 107 | +bool hci_uart_has_flow_control(struct hci_uart *hu); | |
| 107 | 108 | void hci_uart_set_flow_control(struct hci_uart *hu, bool enable); |
| 108 | 109 | void hci_uart_set_speeds(struct hci_uart *hu, unsigned int init_speed, |
| 109 | 110 | unsigned int oper_speed); |
| @@ -76,7 +76,7 @@ static ssize_t ipmb_read(struct file *file, char __user *buf, size_t count, · 75 unmodified lines | ||
| 76 | 76 | struct ipmb_dev *ipmb_dev = to_ipmb_dev(file); |
| 77 | 77 | struct ipmb_request_elem *queue_elem; |
| 78 | 78 | struct ipmb_msg msg; |
| 79 | − ssize_t ret; | |
| 79 | + ssize_t ret = 0; | |
| 80 | 80 | |
| 81 | 81 | memset(&msg, 0, sizeof(msg)); |
| 82 | 82 | |
| @@ -77,6 +77,18 @@ static int tpm_go_idle(struct tpm_chip *chip) · 76 unmodified lines | ||
| 77 | 77 | return chip->ops->go_idle(chip); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | +static void tpm_clk_enable(struct tpm_chip *chip) | |
| 81 | +{ | |
| 82 | + if (chip->ops->clk_enable) | |
| 83 | + chip->ops->clk_enable(chip, true); | |
| 84 | +} | |
| 85 | + | |
| 86 | +static void tpm_clk_disable(struct tpm_chip *chip) | |
| 87 | +{ | |
| 88 | + if (chip->ops->clk_enable) | |
| 89 | + chip->ops->clk_enable(chip, false); | |
| 90 | +} | |
| 91 | + | |
| 80 | 92 | /** |
| 81 | 93 | * tpm_chip_start() - power on the TPM |
| 82 | 94 | * @chip: a TPM chip to use |
| @@ -89,13 +101,12 @@ int tpm_chip_start(struct tpm_chip *chip) · 6 unmodified lines | ||
| 89 | 101 | { |
| 90 | 102 | int ret; |
| 91 | 103 | |
| 92 | − if (chip->ops->clk_enable) | |
| 93 | − chip->ops->clk_enable(chip, true); | |
| 104 | + tpm_clk_enable(chip); | |
| 94 | 105 | |
| 95 | 106 | if (chip->locality == -1) { |
| 96 | 107 | ret = tpm_request_locality(chip); |
| 97 | 108 | if (ret) { |
| 98 | − chip->ops->clk_enable(chip, false); | |
| 109 | + tpm_clk_disable(chip); | |
| 99 | 110 | return ret; |
| 100 | 111 | } |
| 101 | 112 | } |
| @@ -103,8 +114,7 @@ int tpm_chip_start(struct tpm_chip *chip) · 1 unmodified line | ||
| 103 | 114 | ret = tpm_cmd_ready(chip); |
| 104 | 115 | if (ret) { |
| 105 | 116 | tpm_relinquish_locality(chip); |
| 106 | − if (chip->ops->clk_enable) | |
| 107 | − chip->ops->clk_enable(chip, false); | |
| 117 | + tpm_clk_disable(chip); | |
| 108 | 118 | return ret; |
| 109 | 119 | } |
| 110 | 120 | |
| @@ -124,8 +134,7 @@ void tpm_chip_stop(struct tpm_chip *chip) · 13 unmodified lines | ||
| 124 | 134 | { |
| 125 | 135 | tpm_go_idle(chip); |
| 126 | 136 | tpm_relinquish_locality(chip); |
| 127 | − if (chip->ops->clk_enable) | |
| 128 | − chip->ops->clk_enable(chip, false); | |
| 137 | + tpm_clk_disable(chip); | |
| 129 | 138 | } |
| 130 | 139 | EXPORT_SYMBOL_GPL(tpm_chip_stop); |
| 131 | 140 | |
| @@ -545,6 +554,20 @@ static int tpm_add_hwrng(struct tpm_chip *chip) · 413 unmodified lines | ||
| 545 | 554 | return hwrng_register(&chip->hwrng); |
| 546 | 555 | } |
| 547 | 556 | |
| 557 | +static int tpm_get_pcr_allocation(struct tpm_chip *chip) | |
| 558 | +{ | |
| 559 | + int rc; | |
| 560 | + | |
| 561 | + rc = (chip->flags & TPM_CHIP_FLAG_TPM2) ? | |
| 562 | + tpm2_get_pcr_allocation(chip) : | |
| 563 | + tpm1_get_pcr_allocation(chip); | |
| 564 | + | |
| 565 | + if (rc > 0) | |
| 566 | + return -ENODEV; | |
| 567 | + | |
| 568 | + return rc; | |
| 569 | +} | |
| 570 | + | |
| 548 | 571 | /* |
| 549 | 572 | * tpm_chip_register() - create a character device for the TPM chip |
| 550 | 573 | * @chip: TPM chip to use. |
| @@ -564,6 +587,12 @@ int tpm_chip_register(struct tpm_chip *chip) · 13 unmodified lines | ||
| 564 | 587 | if (rc) |
| 565 | 588 | return rc; |
| 566 | 589 | rc = tpm_auto_startup(chip); |
| 590 | + if (rc) { | |
| 591 | + tpm_chip_stop(chip); | |
| 592 | + return rc; | |
| 593 | + } | |
| 594 | + | |
| 595 | + rc = tpm_get_pcr_allocation(chip); | |
| 567 | 596 | tpm_chip_stop(chip); |
| 568 | 597 | if (rc) |
| 569 | 598 | return rc; |
| @@ -394,6 +394,7 @@ int tpm1_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf); · 393 unmodified lines | ||
| 394 | 394 | ssize_t tpm1_getcap(struct tpm_chip *chip, u32 subcap_id, cap_t *cap, |
| 395 | 395 | const char *desc, size_t min_cap_length); |
| 396 | 396 | int tpm1_get_random(struct tpm_chip *chip, u8 *out, size_t max); |
| 397 | +int tpm1_get_pcr_allocation(struct tpm_chip *chip); | |
| 397 | 398 | unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); |
| 398 | 399 | int tpm_pm_suspend(struct device *dev); |
| 399 | 400 | int tpm_pm_resume(struct device *dev); |
| @@ -449,6 +450,7 @@ int tpm2_unseal_trusted(struct tpm_chip *chip, · 49 unmodified lines | ||
| 449 | 450 | ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, |
| 450 | 451 | u32 *value, const char *desc); |
| 451 | 452 | |
| 453 | +ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip); | |
| 452 | 454 | int tpm2_auto_startup(struct tpm_chip *chip); |
| 453 | 455 | void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type); |
| 454 | 456 | unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); |
| @@ -699,18 +699,6 @@ int tpm1_auto_startup(struct tpm_chip *chip) · 698 unmodified lines | ||
| 699 | 699 | goto out; |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | − chip->allocated_banks = kcalloc(1, sizeof(*chip->allocated_banks), | |
| 703 | − GFP_KERNEL); | |
| 704 | − if (!chip->allocated_banks) { | |
| 705 | − rc = -ENOMEM; | |
| 706 | − goto out; | |
| 707 | − } | |
| 708 | − | |
| 709 | − chip->allocated_banks[0].alg_id = TPM_ALG_SHA1; | |
| 710 | − chip->allocated_banks[0].digest_size = hash_digest_size[HASH_ALGO_SHA1]; | |
| 711 | − chip->allocated_banks[0].crypto_id = HASH_ALGO_SHA1; | |
| 712 | − chip->nr_allocated_banks = 1; | |
| 713 | − | |
| 714 | 702 | return rc; |
| 715 | 703 | out: |
| 716 | 704 | if (rc > 0) |
| @@ -779,3 +767,27 @@ int tpm1_pm_suspend(struct tpm_chip *chip, u32 tpm_suspend_pcr) · 62 unmodified lines | ||
| 779 | 767 | return rc; |
| 780 | 768 | } |
| 781 | 769 | |
| 770 | +/** | |
| 771 | + * tpm1_get_pcr_allocation() - initialize the allocated bank | |
| 772 | + * @chip: TPM chip to use. | |
| 773 | + * | |
| 774 | + * The function initializes the SHA1 allocated bank to extend PCR | |
| 775 | + * | |
| 776 | + * Return: | |
| 777 | + * * 0 on success, | |
| 778 | + * * < 0 on error. | |
| 779 | + */ | |
| 780 | +int tpm1_get_pcr_allocation(struct tpm_chip *chip) | |
| 781 | +{ | |
| 782 | + chip->allocated_banks = kcalloc(1, sizeof(*chip->allocated_banks), | |
| 783 | + GFP_KERNEL); | |
| 784 | + if (!chip->allocated_banks) | |
| 785 | + return -ENOMEM; | |
| 786 | + | |
| 787 | + chip->allocated_banks[0].alg_id = TPM_ALG_SHA1; | |
| 788 | + chip->allocated_banks[0].digest_size = hash_digest_size[HASH_ALGO_SHA1]; | |
| 789 | + chip->allocated_banks[0].crypto_id = HASH_ALGO_SHA1; | |
| 790 | + chip->nr_allocated_banks = 1; | |
| 791 | + | |
| 792 | + return 0; | |
| 793 | +} | |
| @@ -840,7 +840,7 @@ struct tpm2_pcr_selection { · 839 unmodified lines | ||
| 840 | 840 | u8 pcr_select[3]; |
| 841 | 841 | } __packed; |
| 842 | 842 | |
| 843 | −static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip) | |
| 843 | +ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip) | |
| 844 | 844 | { |
| 845 | 845 | struct tpm2_pcr_selection pcr_selection; |
| 846 | 846 | struct tpm_buf buf; |
| @@ -1040,10 +1040,6 @@ int tpm2_auto_startup(struct tpm_chip *chip) · 193 unmodified lines | ||
| 1040 | 1040 | goto out; |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | − rc = tpm2_get_pcr_allocation(chip); | |
| 1044 | − if (rc) | |
| 1045 | − goto out; | |
| 1046 | − | |
| 1047 | 1043 | rc = tpm2_get_cc_attrs_tbl(chip); |
| 1048 | 1044 | |
| 1049 | 1045 | out: |
| @@ -141,6 +141,8 @@ static int clk_generated_determine_rate(struct clk_hw *hw, · 140 unmodified lines | ||
| 141 | 141 | continue; |
| 142 | 142 | |
| 143 | 143 | div = DIV_ROUND_CLOSEST(parent_rate, req->rate); |
| 144 | + if (div > GENERATED_MAX_DIV + 1) | |
| 145 | + div = GENERATED_MAX_DIV + 1; | |
| 144 | 146 | |
| 145 | 147 | clk_generated_best_diff(req, parent, parent_rate, div, |
| 146 | 148 | &best_diff, &best_rate); |
| @@ -25,9 +25,11 @@ static const struct mtk_fixed_clk top_fixed_clks[] = { · 24 unmodified lines | ||
| 25 | 25 | FIXED_CLK(CLK_TOP_UNIVP_192M, "univpll_192m", "univpll", 192000000), |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | +static const struct mtk_fixed_factor top_early_divs[] = { | |
| 29 | + FACTOR(CLK_TOP_CLK13M, "clk13m", "clk26m", 1, 2), | |
| 30 | +}; | |
| 31 | + | |
| 28 | 32 | static const struct mtk_fixed_factor top_divs[] = { |
| 29 | − FACTOR(CLK_TOP_CLK13M, "clk13m", "clk26m", 1, | |
| 30 | − 2), | |
| 31 | 33 | FACTOR(CLK_TOP_F26M_CK_D2, "csw_f26m_ck_d2", "clk26m", 1, |
| 32 | 34 | 2), |
| 33 | 35 | FACTOR(CLK_TOP_SYSPLL_CK, "syspll_ck", "mainpll", 1, |
| @@ -1148,37 +1150,57 @@ static int clk_mt8183_apmixed_probe(struct platform_device *pdev) · 1114 unmodified lines | ||
| 1148 | 1150 | return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); |
| 1149 | 1151 | } |
| 1150 | 1152 | |
| 1153 | +static struct clk_onecell_data *top_clk_data; | |
| 1154 | + | |
| 1155 | +static void clk_mt8183_top_init_early(struct device_node *node) | |
| 1156 | +{ | |
| 1157 | + int i; | |
| 1158 | + | |
| 1159 | + top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); | |
| 1160 | + | |
| 1161 | + for (i = 0; i < CLK_TOP_NR_CLK; i++) | |
| 1162 | + top_clk_data->clks[i] = ERR_PTR(-EPROBE_DEFER); | |
| 1163 | + | |
| 1164 | + mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs), | |
| 1165 | + top_clk_data); | |
| 1166 | + | |
| 1167 | + of_clk_add_provider(node, of_clk_src_onecell_get, top_clk_data); | |
| 1168 | +} | |
| 1169 | + | |
| 1170 | +CLK_OF_DECLARE_DRIVER(mt8183_topckgen, "mediatek,mt8183-topckgen", | |
| 1171 | + clk_mt8183_top_init_early); | |
| 1172 | + | |
| 1151 | 1173 | static int clk_mt8183_top_probe(struct platform_device *pdev) |
| 1152 | 1174 | { |
| 1153 | 1175 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1154 | 1176 | void __iomem *base; |
| 1155 | − struct clk_onecell_data *clk_data; | |
| 1156 | 1177 | struct device_node *node = pdev->dev.of_node; |
| 1157 | 1178 | |
| 1158 | 1179 | base = devm_ioremap_resource(&pdev->dev, res); |
| 1159 | 1180 | if (IS_ERR(base)) |
| 1160 | 1181 | return PTR_ERR(base); |
| 1161 | 1182 | |
| 1162 | − clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); | |
| 1163 | − | |
| 1164 | 1183 | mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), |
| 1165 | − clk_data); | |
| 1184 | + top_clk_data); | |
| 1185 | + | |
| 1186 | + mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs), | |
| 1187 | + top_clk_data); | |
| 1166 | 1188 | |
| 1167 | − mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); | |
| 1189 | + mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data); | |
| 1168 | 1190 | |
| 1169 | 1191 | mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes), |
| 1170 | − node, &mt8183_clk_lock, clk_data); | |
| 1192 | + node, &mt8183_clk_lock, top_clk_data); | |
| 1171 | 1193 | |
| 1172 | 1194 | mtk_clk_register_composites(top_aud_muxes, ARRAY_SIZE(top_aud_muxes), |
| 1173 | − base, &mt8183_clk_lock, clk_data); | |
| 1195 | + base, &mt8183_clk_lock, top_clk_data); | |
| 1174 | 1196 | |
| 1175 | 1197 | mtk_clk_register_composites(top_aud_divs, ARRAY_SIZE(top_aud_divs), |
| 1176 | − base, &mt8183_clk_lock, clk_data); | |
| 1198 | + base, &mt8183_clk_lock, top_clk_data); | |
| 1177 | 1199 | |
| 1178 | 1200 | mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), |
| 1179 | − clk_data); | |
| 1201 | + top_clk_data); | |
| 1180 | 1202 | |
| 1181 | − return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); | |
| 1203 | + return of_clk_add_provider(node, of_clk_src_onecell_get, top_clk_data); | |
| 1182 | 1204 | } |
| 1183 | 1205 | |
| 1184 | 1206 | static int clk_mt8183_infra_probe(struct platform_device *pdev) |
| @@ -572,17 +572,11 @@ static int cpg_mssr_reset(struct reset_controller_dev *rcdev, · 571 unmodified lines | ||
| 572 | 572 | unsigned int reg = id / 32; |
| 573 | 573 | unsigned int bit = id % 32; |
| 574 | 574 | u32 bitmask = BIT(bit); |
| 575 | − unsigned long flags; | |
| 576 | − u32 value; | |
| 577 | 575 | |
| 578 | 576 | dev_dbg(priv->dev, "reset %u%02u\n", reg, bit); |
| 579 | 577 | |
| 580 | 578 | /* Reset module */ |
| 581 | − spin_lock_irqsave(&priv->rmw_lock, flags); | |
| 582 | − value = readl(priv->base + SRCR(reg)); | |
| 583 | − value |= bitmask; | |
| 584 | − writel(value, priv->base + SRCR(reg)); | |
| 585 | − spin_unlock_irqrestore(&priv->rmw_lock, flags); | |
| 579 | + writel(bitmask, priv->base + SRCR(reg)); | |
| 586 | 580 | |
| 587 | 581 | /* Wait for at least one cycle of the RCLK clock (@ ca. 32 kHz) */ |
| 588 | 582 | udelay(35); |
| @@ -599,16 +593,10 @@ static int cpg_mssr_assert(struct reset_controller_dev *rcdev, unsigned long id) · 10 unmodified lines | ||
| 599 | 593 | unsigned int reg = id / 32; |
| 600 | 594 | unsigned int bit = id % 32; |
| 601 | 595 | u32 bitmask = BIT(bit); |
| 602 | − unsigned long flags; | |
| 603 | − u32 value; | |
| 604 | 596 | |
| 605 | 597 | dev_dbg(priv->dev, "assert %u%02u\n", reg, bit); |
| 606 | 598 | |
| 607 | − spin_lock_irqsave(&priv->rmw_lock, flags); | |
| 608 | − value = readl(priv->base + SRCR(reg)); | |
| 609 | − value |= bitmask; | |
| 610 | − writel(value, priv->base + SRCR(reg)); | |
| 611 | − spin_unlock_irqrestore(&priv->rmw_lock, flags); | |
| 599 | + writel(bitmask, priv->base + SRCR(reg)); | |
| 612 | 600 | return 0; |
| 613 | 601 | } |
| 614 | 602 | |
| @@ -3,6 +3,7 @@ config SPRD_COMMON_CLK · 2 unmodified lines | ||
| 3 | 3 | tristate "Clock support for Spreadtrum SoCs" |
| 4 | 4 | depends on ARCH_SPRD || COMPILE_TEST |
| 5 | 5 | default ARCH_SPRD |
| 6 | + select REGMAP_MMIO | |
| 6 | 7 | |
| 7 | 8 | if SPRD_COMMON_CLK |
| 8 | 9 | |
| @@ -55,7 +55,7 @@ static u64 riscv_sched_clock(void) · 54 unmodified lines | ||
| 55 | 55 | return get_cycles64(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | −static DEFINE_PER_CPU(struct clocksource, riscv_clocksource) = { | |
| 58 | +static struct clocksource riscv_clocksource = { | |
| 59 | 59 | .name = "riscv_clocksource", |
| 60 | 60 | .rating = 300, |
| 61 | 61 | .mask = CLOCKSOURCE_MASK(64), |
| @@ -92,7 +92,6 @@ void riscv_timer_interrupt(void) · 30 unmodified lines | ||
| 92 | 92 | static int __init riscv_timer_init_dt(struct device_node *n) |
| 93 | 93 | { |
| 94 | 94 | int cpuid, hartid, error; |
| 95 | − struct clocksource *cs; | |
| 96 | 95 | |
| 97 | 96 | hartid = riscv_of_processor_hartid(n); |
| 98 | 97 | if (hartid < 0) { |
| @@ -112,8 +111,7 @@ static int __init riscv_timer_init_dt(struct device_node *n) · 13 unmodified lines | ||
| 112 | 111 | |
| 113 | 112 | pr_info("%s: Registering clocksource cpuid [%d] hartid [%d]\n", |
| 114 | 113 | __func__, cpuid, hartid); |
| 115 | − cs = per_cpu_ptr(&riscv_clocksource, cpuid); | |
| 116 | − error = clocksource_register_hz(cs, riscv_timebase); | |
| 114 | + error = clocksource_register_hz(&riscv_clocksource, riscv_timebase); | |
| 117 | 115 | if (error) { |
| 118 | 116 | pr_err("RISCV timer register failed [%d] for cpu = [%d]\n", |
| 119 | 117 | error, cpuid); |
| @@ -58,6 +58,19 @@ static int ccp_aes_gcm_setkey(struct crypto_aead *tfm, const u8 *key, · 57 unmodified lines | ||
| 58 | 58 | static int ccp_aes_gcm_setauthsize(struct crypto_aead *tfm, |
| 59 | 59 | unsigned int authsize) |
| 60 | 60 | { |
| 61 | + switch (authsize) { | |
| 62 | + case 16: | |
| 63 | + case 15: | |
| 64 | + case 14: | |
| 65 | + case 13: | |
| 66 | + case 12: | |
| 67 | + case 8: | |
| 68 | + case 4: | |
| 69 | + break; | |
| 70 | + default: | |
| 71 | + return -EINVAL; | |
| 72 | + } | |
| 73 | + | |
| 61 | 74 | return 0; |
| 62 | 75 | } |
| 63 | 76 | |
| @@ -104,6 +117,7 @@ static int ccp_aes_gcm_crypt(struct aead_request *req, bool encrypt) · 40 unmodified lines | ||
| 104 | 117 | memset(&rctx->cmd, 0, sizeof(rctx->cmd)); |
| 105 | 118 | INIT_LIST_HEAD(&rctx->cmd.entry); |
| 106 | 119 | rctx->cmd.engine = CCP_ENGINE_AES; |
| 120 | + rctx->cmd.u.aes.authsize = crypto_aead_authsize(tfm); | |
| 107 | 121 | rctx->cmd.u.aes.type = ctx->u.aes.type; |
| 108 | 122 | rctx->cmd.u.aes.mode = ctx->u.aes.mode; |
| 109 | 123 | rctx->cmd.u.aes.action = encrypt; |
| @@ -622,6 +622,7 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, · 621 unmodified lines | ||
| 622 | 622 | |
| 623 | 623 | unsigned long long *final; |
| 624 | 624 | unsigned int dm_offset; |
| 625 | + unsigned int authsize; | |
| 625 | 626 | unsigned int jobid; |
| 626 | 627 | unsigned int ilen; |
| 627 | 628 | bool in_place = true; /* Default value */ |
| @@ -643,6 +644,21 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, · 15 unmodified lines | ||
| 643 | 644 | if (!aes->key) /* Gotta have a key SGL */ |
| 644 | 645 | return -EINVAL; |
| 645 | 646 | |
| 647 | + /* Zero defaults to 16 bytes, the maximum size */ | |
| 648 | + authsize = aes->authsize ? aes->authsize : AES_BLOCK_SIZE; | |
| 649 | + switch (authsize) { | |
| 650 | + case 16: | |
| 651 | + case 15: | |
| 652 | + case 14: | |
| 653 | + case 13: | |
| 654 | + case 12: | |
| 655 | + case 8: | |
| 656 | + case 4: | |
| 657 | + break; | |
| 658 | + default: | |
| 659 | + return -EINVAL; | |
| 660 | + } | |
| 661 | + | |
| 646 | 662 | /* First, decompose the source buffer into AAD & PT, |
| 647 | 663 | * and the destination buffer into AAD, CT & tag, or |
| 648 | 664 | * the input into CT & tag. |
| @@ -657,7 +673,7 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, · 8 unmodified lines | ||
| 657 | 673 | p_tag = scatterwalk_ffwd(sg_tag, p_outp, ilen); |
| 658 | 674 | } else { |
| 659 | 675 | /* Input length for decryption includes tag */ |
| 660 | − ilen = aes->src_len - AES_BLOCK_SIZE; | |
| 676 | + ilen = aes->src_len - authsize; | |
| 661 | 677 | p_tag = scatterwalk_ffwd(sg_tag, p_inp, ilen); |
| 662 | 678 | } |
| 663 | 679 | |
| @@ -766,8 +782,7 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, · 102 unmodified lines | ||
| 766 | 782 | while (src.sg_wa.bytes_left) { |
| 767 | 783 | ccp_prepare_data(&src, &dst, &op, AES_BLOCK_SIZE, true); |
| 768 | 784 | if (!src.sg_wa.bytes_left) { |
| 769 | − unsigned int nbytes = aes->src_len | |
| 770 | − % AES_BLOCK_SIZE; | |
| 785 | + unsigned int nbytes = ilen % AES_BLOCK_SIZE; | |
| 771 | 786 | |
| 772 | 787 | if (nbytes) { |
| 773 | 788 | op.eom = 1; |
| @@ -839,19 +854,19 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, · 65 unmodified lines | ||
| 839 | 854 | |
| 840 | 855 | if (aes->action == CCP_AES_ACTION_ENCRYPT) { |
| 841 | 856 | /* Put the ciphered tag after the ciphertext. */ |
| 842 | − ccp_get_dm_area(&final_wa, 0, p_tag, 0, AES_BLOCK_SIZE); | |
| 857 | + ccp_get_dm_area(&final_wa, 0, p_tag, 0, authsize); | |
| 843 | 858 | } else { |
| 844 | 859 | /* Does this ciphered tag match the input? */ |
| 845 | − ret = ccp_init_dm_workarea(&tag, cmd_q, AES_BLOCK_SIZE, | |
| 860 | + ret = ccp_init_dm_workarea(&tag, cmd_q, authsize, | |
| 846 | 861 | DMA_BIDIRECTIONAL); |
| 847 | 862 | if (ret) |
| 848 | 863 | goto e_tag; |
| 849 | − ret = ccp_set_dm_area(&tag, 0, p_tag, 0, AES_BLOCK_SIZE); | |
| 864 | + ret = ccp_set_dm_area(&tag, 0, p_tag, 0, authsize); | |
| 850 | 865 | if (ret) |
| 851 | 866 | goto e_tag; |
| 852 | 867 | |
| 853 | 868 | ret = crypto_memneq(tag.address, final_wa.address, |
| 854 | − AES_BLOCK_SIZE) ? -EBADMSG : 0; | |
| 869 | + authsize) ? -EBADMSG : 0; | |
| 855 | 870 | ccp_dm_free(&tag); |
| 856 | 871 | } |
| 857 | 872 | |
| @@ -859,11 +874,11 @@ e_tag: · 1 unmodified line | ||
| 859 | 874 | ccp_dm_free(&final_wa); |
| 860 | 875 | |
| 861 | 876 | e_dst: |
| 862 | − if (aes->src_len && !in_place) | |
| 877 | + if (ilen > 0 && !in_place) | |
| 863 | 878 | ccp_free_data(&dst, cmd_q); |
| 864 | 879 | |
| 865 | 880 | e_src: |
| 866 | − if (aes->src_len) | |
| 881 | + if (ilen > 0) | |
| 867 | 882 | ccp_free_data(&src, cmd_q); |
| 868 | 883 | |
| 869 | 884 | e_aad: |
| @@ -314,14 +314,17 @@ void cryp_save_device_context(struct cryp_device_data *device_data, · 313 unmodified lines | ||
| 314 | 314 | case CRYP_KEY_SIZE_256: |
| 315 | 315 | ctx->key_4_l = readl_relaxed(&src_reg->key_4_l); |
| 316 | 316 | ctx->key_4_r = readl_relaxed(&src_reg->key_4_r); |
| 317 | + /* Fall through */ | |
| 317 | 318 | |
| 318 | 319 | case CRYP_KEY_SIZE_192: |
| 319 | 320 | ctx->key_3_l = readl_relaxed(&src_reg->key_3_l); |
| 320 | 321 | ctx->key_3_r = readl_relaxed(&src_reg->key_3_r); |
| 322 | + /* Fall through */ | |
| 321 | 323 | |
| 322 | 324 | case CRYP_KEY_SIZE_128: |
| 323 | 325 | ctx->key_2_l = readl_relaxed(&src_reg->key_2_l); |
| 324 | 326 | ctx->key_2_r = readl_relaxed(&src_reg->key_2_r); |
| 327 | + /* Fall through */ | |
| 325 | 328 | |
| 326 | 329 | default: |
| 327 | 330 | ctx->key_1_l = readl_relaxed(&src_reg->key_1_l); |
| @@ -361,14 +364,17 @@ void cryp_restore_device_context(struct cryp_device_data *device_data, · 33 unmodified lines | ||
| 361 | 364 | case CRYP_KEY_SIZE_256: |
| 362 | 365 | writel_relaxed(ctx->key_4_l, ®->key_4_l); |
| 363 | 366 | writel_relaxed(ctx->key_4_r, ®->key_4_r); |
| 367 | + /* Fall through */ | |
| 364 | 368 | |
| 365 | 369 | case CRYP_KEY_SIZE_192: |
| 366 | 370 | writel_relaxed(ctx->key_3_l, ®->key_3_l); |
| 367 | 371 | writel_relaxed(ctx->key_3_r, ®->key_3_r); |
| 372 | + /* Fall through */ | |
| 368 | 373 | |
| 369 | 374 | case CRYP_KEY_SIZE_128: |
| 370 | 375 | writel_relaxed(ctx->key_2_l, ®->key_2_l); |
| 371 | 376 | writel_relaxed(ctx->key_2_r, ®->key_2_r); |
| 377 | + /* Fall through */ | |
| 372 | 378 | |
| 373 | 379 | default: |
| 374 | 380 | writel_relaxed(ctx->key_1_l, ®->key_1_l); |
| @@ -956,9 +956,11 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) · 955 unmodified lines | ||
| 956 | 956 | } |
| 957 | 957 | |
| 958 | 958 | if (eflags & GPIOEVENT_REQUEST_RISING_EDGE) |
| 959 | − irqflags |= IRQF_TRIGGER_RISING; | |
| 959 | + irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? | |
| 960 | + IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING; | |
| 960 | 961 | if (eflags & GPIOEVENT_REQUEST_FALLING_EDGE) |
| 961 | − irqflags |= IRQF_TRIGGER_FALLING; | |
| 962 | + irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? | |
| 963 | + IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING; | |
| 962 | 964 | irqflags |= IRQF_ONESHOT; |
| 963 | 965 | |
| 964 | 966 | INIT_KFIFO(le->events); |
| @@ -1392,12 +1394,17 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 427 unmodified lines | ||
| 1392 | 1394 | for (i = 0; i < chip->ngpio; i++) { |
| 1393 | 1395 | struct gpio_desc *desc = &gdev->descs[i]; |
| 1394 | 1396 | |
| 1395 | − if (chip->get_direction && gpiochip_line_is_valid(chip, i)) | |
| 1396 | − desc->flags = !chip->get_direction(chip, i) ? | |
| 1397 | − (1 << FLAG_IS_OUT) : 0; | |
| 1398 | − else | |
| 1399 | − desc->flags = !chip->direction_input ? | |
| 1400 | − (1 << FLAG_IS_OUT) : 0; | |
| 1397 | + if (chip->get_direction && gpiochip_line_is_valid(chip, i)) { | |
| 1398 | + if (!chip->get_direction(chip, i)) | |
| 1399 | + set_bit(FLAG_IS_OUT, &desc->flags); | |
| 1400 | + else | |
| 1401 | + clear_bit(FLAG_IS_OUT, &desc->flags); | |
| 1402 | + } else { | |
| 1403 | + if (!chip->direction_input) | |
| 1404 | + set_bit(FLAG_IS_OUT, &desc->flags); | |
| 1405 | + else | |
| 1406 | + clear_bit(FLAG_IS_OUT, &desc->flags); | |
| 1407 | + } | |
| 1401 | 1408 | } |
| 1402 | 1409 | |
| 1403 | 1410 | acpi_gpiochip_add(chip); |
| @@ -394,7 +394,7 @@ config DRM_R128 · 393 unmodified lines | ||
| 394 | 394 | config DRM_I810 |
| 395 | 395 | tristate "Intel I810" |
| 396 | 396 | # !PREEMPT because of missing ioctl locking |
| 397 | − depends on DRM && AGP && AGP_INTEL && (!PREEMPT || BROKEN) | |
| 397 | + depends on DRM && AGP && AGP_INTEL && (!PREEMPTION || BROKEN) | |
| 398 | 398 | help |
| 399 | 399 | Choose this option if you have an Intel I810 graphics card. If M is |
| 400 | 400 | selected, the module will be called i810. AGP support is required |
| @@ -1140,7 +1140,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu( · 1139 unmodified lines | ||
| 1140 | 1140 | adev->asic_type != CHIP_FIJI && |
| 1141 | 1141 | adev->asic_type != CHIP_POLARIS10 && |
| 1142 | 1142 | adev->asic_type != CHIP_POLARIS11 && |
| 1143 | − adev->asic_type != CHIP_POLARIS12) ? | |
| 1143 | + adev->asic_type != CHIP_POLARIS12 && | |
| 1144 | + adev->asic_type != CHIP_VEGAM) ? | |
| 1144 | 1145 | VI_BO_SIZE_ALIGN : 1; |
| 1145 | 1146 | |
| 1146 | 1147 | mapping_flags = AMDGPU_VM_PAGE_READABLE; |
| @@ -1044,29 +1044,27 @@ static int amdgpu_cs_process_fence_dep(struct amdgpu_cs_parser *p, · 1043 unmodified lines | ||
| 1044 | 1044 | return r; |
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | − fence = amdgpu_ctx_get_fence(ctx, entity, | |
| 1048 | − deps[i].handle); | |
| 1047 | + fence = amdgpu_ctx_get_fence(ctx, entity, deps[i].handle); | |
| 1048 | + amdgpu_ctx_put(ctx); | |
| 1049 | + | |
| 1050 | + if (IS_ERR(fence)) | |
| 1051 | + return PTR_ERR(fence); | |
| 1052 | + else if (!fence) | |
| 1053 | + continue; | |
| 1049 | 1054 | |
| 1050 | 1055 | if (chunk->chunk_id == AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES) { |
| 1051 | − struct drm_sched_fence *s_fence = to_drm_sched_fence(fence); | |
| 1056 | + struct drm_sched_fence *s_fence; | |
| 1052 | 1057 | struct dma_fence *old = fence; |
| 1053 | 1058 | |
| 1059 | + s_fence = to_drm_sched_fence(fence); | |
| 1054 | 1060 | fence = dma_fence_get(&s_fence->scheduled); |
| 1055 | 1061 | dma_fence_put(old); |
| 1056 | 1062 | } |
| 1057 | 1063 | |
| 1058 | − if (IS_ERR(fence)) { | |
| 1059 | − r = PTR_ERR(fence); | |
| 1060 | − amdgpu_ctx_put(ctx); | |
| 1064 | + r = amdgpu_sync_fence(p->adev, &p->job->sync, fence, true); | |
| 1065 | + dma_fence_put(fence); | |
| 1066 | + if (r) | |
| 1061 | 1067 | return r; |
| 1062 | − } else if (fence) { | |
| 1063 | − r = amdgpu_sync_fence(p->adev, &p->job->sync, fence, | |
| 1064 | − true); | |
| 1065 | − dma_fence_put(fence); | |
| 1066 | − amdgpu_ctx_put(ctx); | |
| 1067 | − if (r) | |
| 1068 | − return r; | |
| 1069 | − } | |
| 1070 | 1068 | } |
| 1071 | 1069 | return 0; |
| 1072 | 1070 | } |
| @@ -707,7 +707,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, · 706 unmodified lines | ||
| 707 | 707 | thread = (*pos & GENMASK_ULL(59, 52)) >> 52; |
| 708 | 708 | bank = (*pos & GENMASK_ULL(61, 60)) >> 60; |
| 709 | 709 | |
| 710 | − data = kmalloc_array(1024, sizeof(*data), GFP_KERNEL); | |
| 710 | + data = kcalloc(1024, sizeof(*data), GFP_KERNEL); | |
| 711 | 711 | if (!data) |
| 712 | 712 | return -ENOMEM; |
| 713 | 713 | |
| @@ -32,7 +32,6 @@ struct amdgpu_gds { · 31 unmodified lines | ||
| 32 | 32 | uint32_t gws_size; |
| 33 | 33 | uint32_t oa_size; |
| 34 | 34 | uint32_t gds_compute_max_wave_id; |
| 35 | − uint32_t vgt_gs_max_wave_id; | |
| 36 | 35 | }; |
| 37 | 36 | |
| 38 | 37 | struct amdgpu_gds_reg_offset { |
| @@ -159,12 +159,16 @@ static ssize_t amdgpu_get_dpm_state(struct device *dev, · 158 unmodified lines | ||
| 159 | 159 | struct amdgpu_device *adev = ddev->dev_private; |
| 160 | 160 | enum amd_pm_state_type pm; |
| 161 | 161 | |
| 162 | − if (is_support_sw_smu(adev) && adev->smu.ppt_funcs->get_current_power_state) | |
| 163 | − pm = amdgpu_smu_get_current_power_state(adev); | |
| 164 | − else if (adev->powerplay.pp_funcs->get_current_power_state) | |
| 162 | + if (is_support_sw_smu(adev)) { | |
| 163 | + if (adev->smu.ppt_funcs->get_current_power_state) | |
| 164 | + pm = amdgpu_smu_get_current_power_state(adev); | |
| 165 | + else | |
| 166 | + pm = adev->pm.dpm.user_state; | |
| 167 | + } else if (adev->powerplay.pp_funcs->get_current_power_state) { | |
| 165 | 168 | pm = amdgpu_dpm_get_current_power_state(adev); |
| 166 | − else | |
| 169 | + } else { | |
| 167 | 170 | pm = adev->pm.dpm.user_state; |
| 171 | + } | |
| 168 | 172 | |
| 169 | 173 | return snprintf(buf, PAGE_SIZE, "%s\n", |
| 170 | 174 | (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : |
| @@ -191,7 +195,11 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev, · 20 unmodified lines | ||
| 191 | 195 | goto fail; |
| 192 | 196 | } |
| 193 | 197 | |
| 194 | − if (adev->powerplay.pp_funcs->dispatch_tasks) { | |
| 198 | + if (is_support_sw_smu(adev)) { | |
| 199 | + mutex_lock(&adev->pm.mutex); | |
| 200 | + adev->pm.dpm.user_state = state; | |
| 201 | + mutex_unlock(&adev->pm.mutex); | |
| 202 | + } else if (adev->powerplay.pp_funcs->dispatch_tasks) { | |
| 195 | 203 | amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_ENABLE_USER_STATE, &state); |
| 196 | 204 | } else { |
| 197 | 205 | mutex_lock(&adev->pm.mutex); |
| @@ -3067,28 +3075,44 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a · 2869 unmodified lines | ||
| 3067 | 3075 | if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK, (void *)&value64, &size)) |
| 3068 | 3076 | seq_printf(m, "SMC Feature Mask: 0x%016llx\n", value64); |
| 3069 | 3077 | |
| 3070 | − /* UVD clocks */ | |
| 3071 | − if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_POWER, (void *)&value, &size)) { | |
| 3072 | − if (!value) { | |
| 3073 | − seq_printf(m, "UVD: Disabled\n"); | |
| 3074 | − } else { | |
| 3075 | − seq_printf(m, "UVD: Enabled\n"); | |
| 3076 | − if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size)) | |
| 3077 | − seq_printf(m, "\t%u MHz (DCLK)\n", value/100); | |
| 3078 | − if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size)) | |
| 3079 | − seq_printf(m, "\t%u MHz (VCLK)\n", value/100); | |
| 3078 | + if (adev->asic_type > CHIP_VEGA20) { | |
| 3079 | + /* VCN clocks */ | |
| 3080 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCN_POWER_STATE, (void *)&value, &size)) { | |
| 3081 | + if (!value) { | |
| 3082 | + seq_printf(m, "VCN: Disabled\n"); | |
| 3083 | + } else { | |
| 3084 | + seq_printf(m, "VCN: Enabled\n"); | |
| 3085 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size)) | |
| 3086 | + seq_printf(m, "\t%u MHz (DCLK)\n", value/100); | |
| 3087 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size)) | |
| 3088 | + seq_printf(m, "\t%u MHz (VCLK)\n", value/100); | |
| 3089 | + } | |
| 3080 | 3090 | } |
| 3081 | − } | |
| 3082 | − seq_printf(m, "\n"); | |
| 3091 | + seq_printf(m, "\n"); | |
| 3092 | + } else { | |
| 3093 | + /* UVD clocks */ | |
| 3094 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_POWER, (void *)&value, &size)) { | |
| 3095 | + if (!value) { | |
| 3096 | + seq_printf(m, "UVD: Disabled\n"); | |
| 3097 | + } else { | |
| 3098 | + seq_printf(m, "UVD: Enabled\n"); | |
| 3099 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size)) | |
| 3100 | + seq_printf(m, "\t%u MHz (DCLK)\n", value/100); | |
| 3101 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size)) | |
| 3102 | + seq_printf(m, "\t%u MHz (VCLK)\n", value/100); | |
| 3103 | + } | |
| 3104 | + } | |
| 3105 | + seq_printf(m, "\n"); | |
| 3083 | 3106 | |
| 3084 | − /* VCE clocks */ | |
| 3085 | − if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_POWER, (void *)&value, &size)) { | |
| 3086 | − if (!value) { | |
| 3087 | − seq_printf(m, "VCE: Disabled\n"); | |
| 3088 | − } else { | |
| 3089 | − seq_printf(m, "VCE: Enabled\n"); | |
| 3090 | − if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_ECCLK, (void *)&value, &size)) | |
| 3091 | − seq_printf(m, "\t%u MHz (ECCLK)\n", value/100); | |
| 3107 | + /* VCE clocks */ | |
| 3108 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_POWER, (void *)&value, &size)) { | |
| 3109 | + if (!value) { | |
| 3110 | + seq_printf(m, "VCE: Disabled\n"); | |
| 3111 | + } else { | |
| 3112 | + seq_printf(m, "VCE: Enabled\n"); | |
| 3113 | + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_ECCLK, (void *)&value, &size)) | |
| 3114 | + seq_printf(m, "\t%u MHz (ECCLK)\n", value/100); | |
| 3115 | + } | |
| 3092 | 3116 | } |
| 3093 | 3117 | } |
| 3094 | 3118 | |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #define AMDGPU_VCN_FIRMWARE_OFFSET 256 |
| 31 | 31 | #define AMDGPU_VCN_MAX_ENC_RINGS 3 |
| 32 | 32 | |
| 33 | +#define VCN_DEC_KMD_CMD 0x80000000 | |
| 33 | 34 | #define VCN_DEC_CMD_FENCE 0x00000000 |
| 34 | 35 | #define VCN_DEC_CMD_TRAP 0x00000001 |
| 35 | 36 | #define VCN_DEC_CMD_WRITE_REG 0x00000004 |
| @@ -4206,15 +4206,6 @@ static void gfx_v10_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, · 4205 unmodified lines | ||
| 4206 | 4206 | unsigned vmid = AMDGPU_JOB_GET_VMID(job); |
| 4207 | 4207 | u32 header, control = 0; |
| 4208 | 4208 | |
| 4209 | − /* Prevent a hw deadlock due to a wave ID mismatch between ME and GDS. | |
| 4210 | − * This resets the wave ID counters. (needed by transform feedback) | |
| 4211 | − * TODO: This might only be needed on a VMID switch when we change | |
| 4212 | − * the GDS OA mapping, not sure. | |
| 4213 | − */ | |
| 4214 | − amdgpu_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | |
| 4215 | − amdgpu_ring_write(ring, mmVGT_GS_MAX_WAVE_ID); | |
| 4216 | − amdgpu_ring_write(ring, ring->adev->gds.vgt_gs_max_wave_id); | |
| 4217 | − | |
| 4218 | 4209 | if (ib->flags & AMDGPU_IB_FLAG_CE) |
| 4219 | 4210 | header = PACKET3(PACKET3_INDIRECT_BUFFER_CNST, 2); |
| 4220 | 4211 | else |
| @@ -4961,7 +4952,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = { · 740 unmodified lines | ||
| 4961 | 4952 | 5 + /* HDP_INVL */ |
| 4962 | 4953 | 8 + 8 + /* FENCE x2 */ |
| 4963 | 4954 | 2, /* SWITCH_BUFFER */ |
| 4964 | − .emit_ib_size = 7, /* gfx_v10_0_ring_emit_ib_gfx */ | |
| 4955 | + .emit_ib_size = 4, /* gfx_v10_0_ring_emit_ib_gfx */ | |
| 4965 | 4956 | .emit_ib = gfx_v10_0_ring_emit_ib_gfx, |
| 4966 | 4957 | .emit_fence = gfx_v10_0_ring_emit_fence, |
| 4967 | 4958 | .emit_pipeline_sync = gfx_v10_0_ring_emit_pipeline_sync, |
| @@ -5112,7 +5103,6 @@ static void gfx_v10_0_set_gds_init(struct amdgpu_device *adev) · 144 unmodified lines | ||
| 5112 | 5103 | default: |
| 5113 | 5104 | adev->gds.gds_size = 0x10000; |
| 5114 | 5105 | adev->gds.gds_compute_max_wave_id = 0x4ff; |
| 5115 | − adev->gds.vgt_gs_max_wave_id = 0x3ff; | |
| 5116 | 5106 | break; |
| 5117 | 5107 | } |
| 5118 | 5108 | |
| @@ -1321,6 +1321,39 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev) · 1320 unmodified lines | ||
| 1321 | 1321 | return 0; |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | +static int gfx_v8_0_csb_vram_pin(struct amdgpu_device *adev) | |
| 1325 | +{ | |
| 1326 | + int r; | |
| 1327 | + | |
| 1328 | + r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false); | |
| 1329 | + if (unlikely(r != 0)) | |
| 1330 | + return r; | |
| 1331 | + | |
| 1332 | + r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj, | |
| 1333 | + AMDGPU_GEM_DOMAIN_VRAM); | |
| 1334 | + if (!r) | |
| 1335 | + adev->gfx.rlc.clear_state_gpu_addr = | |
| 1336 | + amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj); | |
| 1337 | + | |
| 1338 | + amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj); | |
| 1339 | + | |
| 1340 | + return r; | |
| 1341 | +} | |
| 1342 | + | |
| 1343 | +static void gfx_v8_0_csb_vram_unpin(struct amdgpu_device *adev) | |
| 1344 | +{ | |
| 1345 | + int r; | |
| 1346 | + | |
| 1347 | + if (!adev->gfx.rlc.clear_state_obj) | |
| 1348 | + return; | |
| 1349 | + | |
| 1350 | + r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true); | |
| 1351 | + if (likely(r == 0)) { | |
| 1352 | + amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj); | |
| 1353 | + amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj); | |
| 1354 | + } | |
| 1355 | +} | |
| 1356 | + | |
| 1324 | 1357 | static void gfx_v8_0_mec_fini(struct amdgpu_device *adev) |
| 1325 | 1358 | { |
| 1326 | 1359 | amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); |
| @@ -4785,6 +4818,10 @@ static int gfx_v8_0_hw_init(void *handle) · 3458 unmodified lines | ||
| 4785 | 4818 | gfx_v8_0_init_golden_registers(adev); |
| 4786 | 4819 | gfx_v8_0_constants_init(adev); |
| 4787 | 4820 | |
| 4821 | + r = gfx_v8_0_csb_vram_pin(adev); | |
| 4822 | + if (r) | |
| 4823 | + return r; | |
| 4824 | + | |
| 4788 | 4825 | r = adev->gfx.rlc.funcs->resume(adev); |
| 4789 | 4826 | if (r) |
| 4790 | 4827 | return r; |
| @@ -4901,6 +4938,9 @@ static int gfx_v8_0_hw_fini(void *handle) · 110 unmodified lines | ||
| 4901 | 4938 | else |
| 4902 | 4939 | pr_err("rlc is busy, skip halt rlc\n"); |
| 4903 | 4940 | amdgpu_gfx_rlc_exit_safe_mode(adev); |
| 4941 | + | |
| 4942 | + gfx_v8_0_csb_vram_unpin(adev); | |
| 4943 | + | |
| 4904 | 4944 | return 0; |
| 4905 | 4945 | } |
| 4906 | 4946 | |
| @@ -1485,7 +1485,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring) · 1484 unmodified lines | ||
| 1485 | 1485 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0)); |
| 1486 | 1486 | amdgpu_ring_write(ring, 0); |
| 1487 | 1487 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0)); |
| 1488 | − amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_START << 1); | |
| 1488 | + amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_START << 1)); | |
| 1489 | 1489 | } |
| 1490 | 1490 | |
| 1491 | 1491 | /** |
| @@ -1498,7 +1498,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring) · 6 unmodified lines | ||
| 1498 | 1498 | static void vcn_v2_0_dec_ring_insert_end(struct amdgpu_ring *ring) |
| 1499 | 1499 | { |
| 1500 | 1500 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0)); |
| 1501 | − amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_END << 1); | |
| 1501 | + amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_END << 1)); | |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | /** |
| @@ -1543,7 +1543,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 · 38 unmodified lines | ||
| 1543 | 1543 | amdgpu_ring_write(ring, upper_32_bits(addr) & 0xff); |
| 1544 | 1544 | |
| 1545 | 1545 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0)); |
| 1546 | − amdgpu_ring_write(ring, VCN_DEC_CMD_FENCE << 1); | |
| 1546 | + amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_FENCE << 1)); | |
| 1547 | 1547 | |
| 1548 | 1548 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0)); |
| 1549 | 1549 | amdgpu_ring_write(ring, 0); |
| @@ -1553,7 +1553,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 · 3 unmodified lines | ||
| 1553 | 1553 | |
| 1554 | 1554 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0)); |
| 1555 | 1555 | |
| 1556 | − amdgpu_ring_write(ring, VCN_DEC_CMD_TRAP << 1); | |
| 1556 | + amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_TRAP << 1)); | |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | /** |
| @@ -1597,7 +1597,7 @@ static void vcn_v2_0_dec_ring_emit_reg_wait(struct amdgpu_ring *ring, · 37 unmodified lines | ||
| 1597 | 1597 | |
| 1598 | 1598 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0)); |
| 1599 | 1599 | |
| 1600 | − amdgpu_ring_write(ring, VCN_DEC_CMD_REG_READ_COND_WAIT << 1); | |
| 1600 | + amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_REG_READ_COND_WAIT << 1)); | |
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | 1603 | static void vcn_v2_0_dec_ring_emit_vm_flush(struct amdgpu_ring *ring, |
| @@ -1626,7 +1626,7 @@ static void vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring, · 22 unmodified lines | ||
| 1626 | 1626 | |
| 1627 | 1627 | amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0)); |
| 1628 | 1628 | |
| 1629 | − amdgpu_ring_write(ring, VCN_DEC_CMD_WRITE_REG << 1); | |
| 1629 | + amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_WRITE_REG << 1)); | |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | /** |
| @@ -2079,6 +2079,36 @@ static int vcn_v2_0_process_interrupt(struct amdgpu_device *adev, · 446 unmodified lines | ||
| 2079 | 2079 | return 0; |
| 2080 | 2080 | } |
| 2081 | 2081 | |
| 2082 | +static int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring) | |
| 2083 | +{ | |
| 2084 | + struct amdgpu_device *adev = ring->adev; | |
| 2085 | + uint32_t tmp = 0; | |
| 2086 | + unsigned i; | |
| 2087 | + int r; | |
| 2088 | + | |
| 2089 | + WREG32(adev->vcn.external.scratch9, 0xCAFEDEAD); | |
| 2090 | + r = amdgpu_ring_alloc(ring, 4); | |
| 2091 | + if (r) | |
| 2092 | + return r; | |
| 2093 | + amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0)); | |
| 2094 | + amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_START << 1)); | |
| 2095 | + amdgpu_ring_write(ring, PACKET0(adev->vcn.internal.scratch9, 0)); | |
| 2096 | + amdgpu_ring_write(ring, 0xDEADBEEF); | |
| 2097 | + amdgpu_ring_commit(ring); | |
| 2098 | + for (i = 0; i < adev->usec_timeout; i++) { | |
| 2099 | + tmp = RREG32(adev->vcn.external.scratch9); | |
| 2100 | + if (tmp == 0xDEADBEEF) | |
| 2101 | + break; | |
| 2102 | + DRM_UDELAY(1); | |
| 2103 | + } | |
| 2104 | + | |
| 2105 | + if (i >= adev->usec_timeout) | |
| 2106 | + r = -ETIMEDOUT; | |
| 2107 | + | |
| 2108 | + return r; | |
| 2109 | +} | |
| 2110 | + | |
| 2111 | + | |
| 2082 | 2112 | static int vcn_v2_0_set_powergating_state(void *handle, |
| 2083 | 2113 | enum amd_powergating_state state) |
| 2084 | 2114 | { |
| @@ -2142,7 +2172,7 @@ static const struct amdgpu_ring_funcs vcn_v2_0_dec_ring_vm_funcs = { · 57 unmodified lines | ||
| 2142 | 2172 | .emit_ib = vcn_v2_0_dec_ring_emit_ib, |
| 2143 | 2173 | .emit_fence = vcn_v2_0_dec_ring_emit_fence, |
| 2144 | 2174 | .emit_vm_flush = vcn_v2_0_dec_ring_emit_vm_flush, |
| 2145 | − .test_ring = amdgpu_vcn_dec_ring_test_ring, | |
| 2175 | + .test_ring = vcn_v2_0_dec_ring_test_ring, | |
| 2146 | 2176 | .test_ib = amdgpu_vcn_dec_ring_test_ib, |
| 2147 | 2177 | .insert_nop = vcn_v2_0_dec_ring_insert_nop, |
| 2148 | 2178 | .insert_start = vcn_v2_0_dec_ring_insert_start, |
| @@ -1567,32 +1567,6 @@ copy_from_user_failed: · 1566 unmodified lines | ||
| 1567 | 1567 | return err; |
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | −static int kfd_ioctl_alloc_queue_gws(struct file *filep, | |
| 1571 | − struct kfd_process *p, void *data) | |
| 1572 | −{ | |
| 1573 | − int retval; | |
| 1574 | − struct kfd_ioctl_alloc_queue_gws_args *args = data; | |
| 1575 | − struct kfd_dev *dev; | |
| 1576 | − | |
| 1577 | − if (!hws_gws_support) | |
| 1578 | − return -ENODEV; | |
| 1579 | − | |
| 1580 | − dev = kfd_device_by_id(args->gpu_id); | |
| 1581 | − if (!dev) { | |
| 1582 | − pr_debug("Could not find gpu id 0x%x\n", args->gpu_id); | |
| 1583 | − return -ENODEV; | |
| 1584 | − } | |
| 1585 | − if (dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) | |
| 1586 | − return -ENODEV; | |
| 1587 | − | |
| 1588 | − mutex_lock(&p->mutex); | |
| 1589 | − retval = pqm_set_gws(&p->pqm, args->queue_id, args->num_gws ? dev->gws : NULL); | |
| 1590 | − mutex_unlock(&p->mutex); | |
| 1591 | − | |
| 1592 | − args->first_gws = 0; | |
| 1593 | − return retval; | |
| 1594 | −} | |
| 1595 | − | |
| 1596 | 1570 | static int kfd_ioctl_get_dmabuf_info(struct file *filep, |
| 1597 | 1571 | struct kfd_process *p, void *data) |
| 1598 | 1572 | { |
| @@ -1795,8 +1769,6 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = { · 196 unmodified lines | ||
| 1795 | 1769 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_IMPORT_DMABUF, |
| 1796 | 1770 | kfd_ioctl_import_dmabuf, 0), |
| 1797 | 1771 | |
| 1798 | − AMDKFD_IOCTL_DEF(AMDKFD_IOC_ALLOC_QUEUE_GWS, | |
| 1799 | − kfd_ioctl_alloc_queue_gws, 0), | |
| 1800 | 1772 | }; |
| 1801 | 1773 | |
| 1802 | 1774 | #define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls) |
| @@ -123,6 +123,7 @@ enum amd_pp_sensors { · 122 unmodified lines | ||
| 123 | 123 | AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK, |
| 124 | 124 | AMDGPU_PP_SENSOR_MIN_FAN_RPM, |
| 125 | 125 | AMDGPU_PP_SENSOR_MAX_FAN_RPM, |
| 126 | + AMDGPU_PP_SENSOR_VCN_POWER_STATE, | |
| 126 | 127 | }; |
| 127 | 128 | |
| 128 | 129 | enum amd_pp_task { |
| @@ -306,7 +306,8 @@ int smu_get_power_num_states(struct smu_context *smu, · 305 unmodified lines | ||
| 306 | 306 | |
| 307 | 307 | /* not support power state */ |
| 308 | 308 | memset(state_info, 0, sizeof(struct pp_states_info)); |
| 309 | − state_info->nums = 0; | |
| 309 | + state_info->nums = 1; | |
| 310 | + state_info->states[0] = POWER_STATE_TYPE_DEFAULT; | |
| 310 | 311 | |
| 311 | 312 | return 0; |
| 312 | 313 | } |
| @@ -314,6 +315,8 @@ int smu_get_power_num_states(struct smu_context *smu, · 1 unmodified line | ||
| 314 | 315 | int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor, |
| 315 | 316 | void *data, uint32_t *size) |
| 316 | 317 | { |
| 318 | + struct smu_power_context *smu_power = &smu->smu_power; | |
| 319 | + struct smu_power_gate *power_gate = &smu_power->power_gate; | |
| 317 | 320 | int ret = 0; |
| 318 | 321 | |
| 319 | 322 | switch (sensor) { |
| @@ -337,6 +340,10 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor, · 17 unmodified lines | ||
| 337 | 340 | *(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_DPM_VCE_BIT) ? 1 : 0; |
| 338 | 341 | *size = 4; |
| 339 | 342 | break; |
| 343 | + case AMDGPU_PP_SENSOR_VCN_POWER_STATE: | |
| 344 | + *(uint32_t *)data = power_gate->vcn_gated ? 0 : 1; | |
| 345 | + *size = 4; | |
| 346 | + break; | |
| 340 | 347 | default: |
| 341 | 348 | ret = -EINVAL; |
| 342 | 349 | break; |
| @@ -723,6 +730,12 @@ static int smu_sw_init(void *handle) · 380 unmodified lines | ||
| 723 | 730 | return ret; |
| 724 | 731 | } |
| 725 | 732 | |
| 733 | + ret = smu_register_irq_handler(smu); | |
| 734 | + if (ret) { | |
| 735 | + pr_err("Failed to register smc irq handler!\n"); | |
| 736 | + return ret; | |
| 737 | + } | |
| 738 | + | |
| 726 | 739 | return 0; |
| 727 | 740 | } |
| 728 | 741 | |
| @@ -732,6 +745,9 @@ static int smu_sw_fini(void *handle) · 3 unmodified lines | ||
| 732 | 745 | struct smu_context *smu = &adev->smu; |
| 733 | 746 | int ret; |
| 734 | 747 | |
| 748 | + kfree(smu->irq_source); | |
| 749 | + smu->irq_source = NULL; | |
| 750 | + | |
| 735 | 751 | ret = smu_smc_table_sw_fini(smu); |
| 736 | 752 | if (ret) { |
| 737 | 753 | pr_err("Failed to sw fini smc table!\n"); |
| @@ -1088,10 +1104,6 @@ static int smu_hw_init(void *handle) · 350 unmodified lines | ||
| 1088 | 1104 | if (ret) |
| 1089 | 1105 | goto failed; |
| 1090 | 1106 | |
| 1091 | − ret = smu_register_irq_handler(smu); | |
| 1092 | − if (ret) | |
| 1093 | − goto failed; | |
| 1094 | − | |
| 1095 | 1107 | if (!smu->pm_enabled) |
| 1096 | 1108 | adev->pm.dpm_enabled = false; |
| 1097 | 1109 | else |
| @@ -1121,9 +1133,6 @@ static int smu_hw_fini(void *handle) · 23 unmodified lines | ||
| 1121 | 1133 | kfree(table_context->overdrive_table); |
| 1122 | 1134 | table_context->overdrive_table = NULL; |
| 1123 | 1135 | |
| 1124 | − kfree(smu->irq_source); | |
| 1125 | − smu->irq_source = NULL; | |
| 1126 | − | |
| 1127 | 1136 | ret = smu_fini_fb_allocations(smu); |
| 1128 | 1137 | if (ret) |
| 1129 | 1138 | return ret; |
| @@ -1111,6 +1111,7 @@ static int smu10_thermal_get_temperature(struct pp_hwmgr *hwmgr) · 1110 unmodified lines | ||
| 1111 | 1111 | static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, |
| 1112 | 1112 | void *value, int *size) |
| 1113 | 1113 | { |
| 1114 | + struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); | |
| 1114 | 1115 | uint32_t sclk, mclk; |
| 1115 | 1116 | int ret = 0; |
| 1116 | 1117 | |
| @@ -1132,6 +1133,10 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, · 15 unmodified lines | ||
| 1132 | 1133 | case AMDGPU_PP_SENSOR_GPU_TEMP: |
| 1133 | 1134 | *((uint32_t *)value) = smu10_thermal_get_temperature(hwmgr); |
| 1134 | 1135 | break; |
| 1136 | + case AMDGPU_PP_SENSOR_VCN_POWER_STATE: | |
| 1137 | + *(uint32_t *)value = smu10_data->vcn_power_gated ? 0 : 1; | |
| 1138 | + *size = 4; | |
| 1139 | + break; | |
| 1135 | 1140 | default: |
| 1136 | 1141 | ret = -EINVAL; |
| 1137 | 1142 | break; |
| @@ -1175,18 +1180,22 @@ static int smu10_powergate_sdma(struct pp_hwmgr *hwmgr, bool gate) · 37 unmodified lines | ||
| 1175 | 1180 | |
| 1176 | 1181 | static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate) |
| 1177 | 1182 | { |
| 1183 | + struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); | |
| 1184 | + | |
| 1178 | 1185 | if (bgate) { |
| 1179 | 1186 | amdgpu_device_ip_set_powergating_state(hwmgr->adev, |
| 1180 | 1187 | AMD_IP_BLOCK_TYPE_VCN, |
| 1181 | 1188 | AMD_PG_STATE_GATE); |
| 1182 | 1189 | smum_send_msg_to_smc_with_parameter(hwmgr, |
| 1183 | 1190 | PPSMC_MSG_PowerDownVcn, 0); |
| 1191 | + smu10_data->vcn_power_gated = true; | |
| 1184 | 1192 | } else { |
| 1185 | 1193 | smum_send_msg_to_smc_with_parameter(hwmgr, |
| 1186 | 1194 | PPSMC_MSG_PowerUpVcn, 0); |
| 1187 | 1195 | amdgpu_device_ip_set_powergating_state(hwmgr->adev, |
| 1188 | 1196 | AMD_IP_BLOCK_TYPE_VCN, |
| 1189 | 1197 | AMD_PG_STATE_UNGATE); |
| 1198 | + smu10_data->vcn_power_gated = false; | |
| 1190 | 1199 | } |
| 1191 | 1200 | } |
| 1192 | 1201 | |
| @@ -429,7 +429,6 @@ struct smu_table_context · 428 unmodified lines | ||
| 429 | 429 | struct smu_table *tables; |
| 430 | 430 | uint32_t table_count; |
| 431 | 431 | struct smu_table memory_pool; |
| 432 | − uint16_t software_shutdown_temp; | |
| 433 | 432 | uint8_t thermal_controller_type; |
| 434 | 433 | uint16_t TDPODLimit; |
| 435 | 434 | |
| @@ -452,6 +451,7 @@ struct smu_dpm_context { · 16 unmodified lines | ||
| 452 | 451 | struct smu_power_gate { |
| 453 | 452 | bool uvd_gated; |
| 454 | 453 | bool vce_gated; |
| 454 | + bool vcn_gated; | |
| 455 | 455 | }; |
| 456 | 456 | |
| 457 | 457 | struct smu_power_context { |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | #include "pp_debug.h" |
| 25 | 25 | #include <linux/firmware.h> |
| 26 | +#include <linux/pci.h> | |
| 26 | 27 | #include "amdgpu.h" |
| 27 | 28 | #include "amdgpu_smu.h" |
| 28 | 29 | #include "atomfirmware.h" |
| @@ -501,6 +502,8 @@ static int navi10_store_powerplay_table(struct smu_context *smu) · 472 unmodified lines | ||
| 501 | 502 | |
| 502 | 503 | static int navi10_tables_init(struct smu_context *smu, struct smu_table *tables) |
| 503 | 504 | { |
| 505 | + struct smu_table_context *smu_table = &smu->smu_table; | |
| 506 | + | |
| 504 | 507 | SMU_TABLE_INIT(tables, SMU_TABLE_PPTABLE, sizeof(PPTable_t), |
| 505 | 508 | PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); |
| 506 | 509 | SMU_TABLE_INIT(tables, SMU_TABLE_WATERMARKS, sizeof(Watermarks_t), |
| @@ -515,9 +518,35 @@ static int navi10_tables_init(struct smu_context *smu, struct smu_table *tables) · 8 unmodified lines | ||
| 515 | 518 | sizeof(DpmActivityMonitorCoeffInt_t), PAGE_SIZE, |
| 516 | 519 | AMDGPU_GEM_DOMAIN_VRAM); |
| 517 | 520 | |
| 521 | + smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t), GFP_KERNEL); | |
| 522 | + if (!smu_table->metrics_table) | |
| 523 | + return -ENOMEM; | |
| 524 | + smu_table->metrics_time = 0; | |
| 525 | + | |
| 518 | 526 | return 0; |
| 519 | 527 | } |
| 520 | 528 | |
| 529 | +static int navi10_get_metrics_table(struct smu_context *smu, | |
| 530 | + SmuMetrics_t *metrics_table) | |
| 531 | +{ | |
| 532 | + struct smu_table_context *smu_table= &smu->smu_table; | |
| 533 | + int ret = 0; | |
| 534 | + | |
| 535 | + if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + HZ / 1000)) { | |
| 536 | + ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, | |
| 537 | + (void *)smu_table->metrics_table, false); | |
| 538 | + if (ret) { | |
| 539 | + pr_info("Failed to export SMU metrics table!\n"); | |
| 540 | + return ret; | |
| 541 | + } | |
| 542 | + smu_table->metrics_time = jiffies; | |
| 543 | + } | |
| 544 | + | |
| 545 | + memcpy(metrics_table, smu_table->metrics_table, sizeof(SmuMetrics_t)); | |
| 546 | + | |
| 547 | + return ret; | |
| 548 | +} | |
| 549 | + | |
| 521 | 550 | static int navi10_allocate_dpm_context(struct smu_context *smu) |
| 522 | 551 | { |
| 523 | 552 | struct smu_dpm_context *smu_dpm = &smu->smu_dpm; |
| @@ -576,44 +605,38 @@ static int navi10_set_default_dpm_table(struct smu_context *smu) · 52 unmodified lines | ||
| 576 | 605 | |
| 577 | 606 | static int navi10_dpm_set_uvd_enable(struct smu_context *smu, bool enable) |
| 578 | 607 | { |
| 579 | − int ret = 0; | |
| 580 | 608 | struct smu_power_context *smu_power = &smu->smu_power; |
| 581 | 609 | struct smu_power_gate *power_gate = &smu_power->power_gate; |
| 610 | + int ret = 0; | |
| 582 | 611 | |
| 583 | − if (enable && power_gate->uvd_gated) { | |
| 584 | − if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) { | |
| 612 | + if (enable) { | |
| 613 | + /* vcn dpm on is a prerequisite for vcn power gate messages */ | |
| 614 | + if (smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) { | |
| 585 | 615 | ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1); |
| 586 | 616 | if (ret) |
| 587 | 617 | return ret; |
| 588 | 618 | } |
| 589 | − power_gate->uvd_gated = false; | |
| 619 | + power_gate->vcn_gated = false; | |
| 590 | 620 | } else { |
| 591 | − if (!enable && !power_gate->uvd_gated) { | |
| 592 | − if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) { | |
| 593 | − ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn); | |
| 594 | − if (ret) | |
| 595 | − return ret; | |
| 596 | − } | |
| 597 | − power_gate->uvd_gated = true; | |
| 621 | + if (smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) { | |
| 622 | + ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn); | |
| 623 | + if (ret) | |
| 624 | + return ret; | |
| 598 | 625 | } |
| 626 | + power_gate->vcn_gated = true; | |
| 599 | 627 | } |
| 600 | 628 | |
| 601 | − return 0; | |
| 629 | + return ret; | |
| 602 | 630 | } |
| 603 | 631 | |
| 604 | 632 | static int navi10_get_current_clk_freq_by_table(struct smu_context *smu, |
| 605 | 633 | enum smu_clk_type clk_type, |
| 606 | 634 | uint32_t *value) |
| 607 | 635 | { |
| 608 | − static SmuMetrics_t metrics; | |
| 609 | 636 | int ret = 0, clk_id = 0; |
| 637 | + SmuMetrics_t metrics; | |
| 610 | 638 | |
| 611 | − if (!value) | |
| 612 | − return -EINVAL; | |
| 613 | − | |
| 614 | − memset(&metrics, 0, sizeof(metrics)); | |
| 615 | − | |
| 616 | − ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, (void *)&metrics, false); | |
| 639 | + ret = navi10_get_metrics_table(smu, &metrics); | |
| 617 | 640 | if (ret) |
| 618 | 641 | return ret; |
| 619 | 642 | |
| @@ -901,8 +924,9 @@ static int navi10_get_gpu_power(struct smu_context *smu, uint32_t *value) · 281 unmodified lines | ||
| 901 | 924 | if (!value) |
| 902 | 925 | return -EINVAL; |
| 903 | 926 | |
| 904 | − ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, (void *)&metrics, | |
| 905 | − false); | |
| 927 | + ret = navi10_get_metrics_table(smu, &metrics); | |
| 928 | + if (ret) | |
| 929 | + return ret; | |
| 906 | 930 | if (ret) |
| 907 | 931 | return ret; |
| 908 | 932 | |
| @@ -921,10 +945,7 @@ static int navi10_get_current_activity_percent(struct smu_context *smu, · 12 unmodified lines | ||
| 921 | 945 | if (!value) |
| 922 | 946 | return -EINVAL; |
| 923 | 947 | |
| 924 | − msleep(1); | |
| 925 | − | |
| 926 | − ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, | |
| 927 | − (void *)&metrics, false); | |
| 948 | + ret = navi10_get_metrics_table(smu, &metrics); | |
| 928 | 949 | if (ret) |
| 929 | 950 | return ret; |
| 930 | 951 | |
| @@ -963,10 +984,9 @@ static int navi10_get_fan_speed_rpm(struct smu_context *smu, · 32 unmodified lines | ||
| 963 | 984 | if (!speed) |
| 964 | 985 | return -EINVAL; |
| 965 | 986 | |
| 966 | − memset(&metrics, 0, sizeof(metrics)); | |
| 967 | − | |
| 968 | − ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, | |
| 969 | − (void *)&metrics, false); | |
| 987 | + ret = navi10_get_metrics_table(smu, &metrics); | |
| 988 | + if (ret) | |
| 989 | + return ret; | |
| 970 | 990 | if (ret) |
| 971 | 991 | return ret; |
| 972 | 992 | |
| @@ -1314,7 +1334,7 @@ static int navi10_thermal_get_temperature(struct smu_context *smu, · 341 unmodified lines | ||
| 1314 | 1334 | if (!value) |
| 1315 | 1335 | return -EINVAL; |
| 1316 | 1336 | |
| 1317 | − ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, (void *)&metrics, false); | |
| 1337 | + ret = navi10_get_metrics_table(smu, &metrics); | |
| 1318 | 1338 | if (ret) |
| 1319 | 1339 | return ret; |
| 1320 | 1340 | |
| @@ -1573,7 +1593,7 @@ static int navi10_set_peak_clock_by_device(struct smu_context *smu) · 252 unmodified lines | ||
| 1573 | 1593 | uint32_t sclk_freq = 0, uclk_freq = 0; |
| 1574 | 1594 | uint32_t uclk_level = 0; |
| 1575 | 1595 | |
| 1576 | − switch (adev->rev_id) { | |
| 1596 | + switch (adev->pdev->revision) { | |
| 1577 | 1597 | case 0xf0: /* XTX */ |
| 1578 | 1598 | case 0xc0: |
| 1579 | 1599 | sclk_freq = NAVI10_PEAK_SCLK_XTX; |
| @@ -1620,6 +1640,22 @@ static int navi10_set_performance_level(struct smu_context *smu, enum amd_dpm_fo · 40 unmodified lines | ||
| 1620 | 1640 | return ret; |
| 1621 | 1641 | } |
| 1622 | 1642 | |
| 1643 | +static int navi10_get_thermal_temperature_range(struct smu_context *smu, | |
| 1644 | + struct smu_temperature_range *range) | |
| 1645 | +{ | |
| 1646 | + struct smu_table_context *table_context = &smu->smu_table; | |
| 1647 | + struct smu_11_0_powerplay_table *powerplay_table = table_context->power_play_table; | |
| 1648 | + | |
| 1649 | + if (!range || !powerplay_table) | |
| 1650 | + return -EINVAL; | |
| 1651 | + | |
| 1652 | + /* The unit is temperature */ | |
| 1653 | + range->min = 0; | |
| 1654 | + range->max = powerplay_table->software_shutdown_temp; | |
| 1655 | + | |
| 1656 | + return 0; | |
| 1657 | +} | |
| 1658 | + | |
| 1623 | 1659 | static const struct pptable_funcs navi10_ppt_funcs = { |
| 1624 | 1660 | .tables_init = navi10_tables_init, |
| 1625 | 1661 | .alloc_dpm_context = navi10_allocate_dpm_context, |
| @@ -1657,6 +1693,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { · 31 unmodified lines | ||
| 1657 | 1693 | .get_ppfeature_status = navi10_get_ppfeature_status, |
| 1658 | 1694 | .set_ppfeature_status = navi10_set_ppfeature_status, |
| 1659 | 1695 | .set_performance_level = navi10_set_performance_level, |
| 1696 | + .get_thermal_temperature_range = navi10_get_thermal_temperature_range, | |
| 1660 | 1697 | }; |
| 1661 | 1698 | |
| 1662 | 1699 | void navi10_set_ppt_funcs(struct smu_context *smu) |
| @@ -1124,10 +1124,8 @@ static int smu_v11_0_set_thermal_range(struct smu_context *smu, · 1123 unmodified lines | ||
| 1124 | 1124 | struct smu_temperature_range *range) |
| 1125 | 1125 | { |
| 1126 | 1126 | struct amdgpu_device *adev = smu->adev; |
| 1127 | − int low = SMU_THERMAL_MINIMUM_ALERT_TEMP * | |
| 1128 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1129 | − int high = SMU_THERMAL_MAXIMUM_ALERT_TEMP * | |
| 1130 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1127 | + int low = SMU_THERMAL_MINIMUM_ALERT_TEMP; | |
| 1128 | + int high = SMU_THERMAL_MAXIMUM_ALERT_TEMP; | |
| 1131 | 1129 | uint32_t val; |
| 1132 | 1130 | |
| 1133 | 1131 | if (!range) |
| @@ -1138,6 +1136,9 @@ static int smu_v11_0_set_thermal_range(struct smu_context *smu, · 4 unmodified lines | ||
| 1138 | 1136 | if (high > range->max) |
| 1139 | 1137 | high = range->max; |
| 1140 | 1138 | |
| 1139 | + low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP, range->min); | |
| 1140 | + high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP, range->max); | |
| 1141 | + | |
| 1141 | 1142 | if (low > high) |
| 1142 | 1143 | return -EINVAL; |
| 1143 | 1144 | |
| @@ -1146,8 +1147,8 @@ static int smu_v11_0_set_thermal_range(struct smu_context *smu, · 2 unmodified lines | ||
| 1146 | 1147 | val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1); |
| 1147 | 1148 | val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_INTH_MASK, 0); |
| 1148 | 1149 | val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_INTL_MASK, 0); |
| 1149 | − val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES)); | |
| 1150 | − val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES)); | |
| 1150 | + val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high & 0xff)); | |
| 1151 | + val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low & 0xff)); | |
| 1151 | 1152 | val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK); |
| 1152 | 1153 | |
| 1153 | 1154 | WREG32_SOC15(THM, 0, mmTHM_THERMAL_INT_CTRL, val); |
| @@ -1186,7 +1187,10 @@ static int smu_v11_0_start_thermal_control(struct smu_context *smu) · 32 unmodified lines | ||
| 1186 | 1187 | |
| 1187 | 1188 | if (!smu->pm_enabled) |
| 1188 | 1189 | return ret; |
| 1190 | + | |
| 1189 | 1191 | ret = smu_get_thermal_temperature_range(smu, &range); |
| 1192 | + if (ret) | |
| 1193 | + return ret; | |
| 1190 | 1194 | |
| 1191 | 1195 | if (smu->smu_table.thermal_controller_type) { |
| 1192 | 1196 | ret = smu_v11_0_set_thermal_range(smu, &range); |
| @@ -1202,15 +1206,17 @@ static int smu_v11_0_start_thermal_control(struct smu_context *smu) · 9 unmodified lines | ||
| 1202 | 1206 | return ret; |
| 1203 | 1207 | } |
| 1204 | 1208 | |
| 1205 | − adev->pm.dpm.thermal.min_temp = range.min; | |
| 1206 | − adev->pm.dpm.thermal.max_temp = range.max; | |
| 1207 | − adev->pm.dpm.thermal.max_edge_emergency_temp = range.edge_emergency_max; | |
| 1208 | − adev->pm.dpm.thermal.min_hotspot_temp = range.hotspot_min; | |
| 1209 | − adev->pm.dpm.thermal.max_hotspot_crit_temp = range.hotspot_crit_max; | |
| 1210 | − adev->pm.dpm.thermal.max_hotspot_emergency_temp = range.hotspot_emergency_max; | |
| 1211 | − adev->pm.dpm.thermal.min_mem_temp = range.mem_min; | |
| 1212 | − adev->pm.dpm.thermal.max_mem_crit_temp = range.mem_crit_max; | |
| 1213 | − adev->pm.dpm.thermal.max_mem_emergency_temp = range.mem_emergency_max; | |
| 1209 | + adev->pm.dpm.thermal.min_temp = range.min * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1210 | + adev->pm.dpm.thermal.max_temp = range.max * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1211 | + adev->pm.dpm.thermal.max_edge_emergency_temp = range.edge_emergency_max * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1212 | + adev->pm.dpm.thermal.min_hotspot_temp = range.hotspot_min * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1213 | + adev->pm.dpm.thermal.max_hotspot_crit_temp = range.hotspot_crit_max * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1214 | + adev->pm.dpm.thermal.max_hotspot_emergency_temp = range.hotspot_emergency_max * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1215 | + adev->pm.dpm.thermal.min_mem_temp = range.mem_min * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1216 | + adev->pm.dpm.thermal.max_mem_crit_temp = range.mem_crit_max * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1217 | + adev->pm.dpm.thermal.max_mem_emergency_temp = range.mem_emergency_max * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1218 | + adev->pm.dpm.thermal.min_temp = range.min * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1219 | + adev->pm.dpm.thermal.max_temp = range.max * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 1214 | 1220 | |
| 1215 | 1221 | return ret; |
| 1216 | 1222 | } |
| @@ -1385,7 +1391,7 @@ smu_v11_0_smc_fan_control(struct smu_context *smu, bool start) · 168 unmodified lines | ||
| 1385 | 1391 | { |
| 1386 | 1392 | int ret = 0; |
| 1387 | 1393 | |
| 1388 | − if (smu_feature_is_supported(smu, SMU_FEATURE_FAN_CONTROL_BIT)) | |
| 1394 | + if (!smu_feature_is_supported(smu, SMU_FEATURE_FAN_CONTROL_BIT)) | |
| 1389 | 1395 | return 0; |
| 1390 | 1396 | |
| 1391 | 1397 | ret = smu_feature_set_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT, start); |
| @@ -450,7 +450,6 @@ static int vega20_store_powerplay_table(struct smu_context *smu) · 449 unmodified lines | ||
| 450 | 450 | memcpy(table_context->driver_pptable, &powerplay_table->smcPPTable, |
| 451 | 451 | sizeof(PPTable_t)); |
| 452 | 452 | |
| 453 | − table_context->software_shutdown_temp = powerplay_table->usSoftwareShutdownTemp; | |
| 454 | 453 | table_context->thermal_controller_type = powerplay_table->ucThermalControllerType; |
| 455 | 454 | table_context->TDPODLimit = le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE]); |
| 456 | 455 | |
| @@ -3234,35 +3233,24 @@ static int vega20_set_watermarks_table(struct smu_context *smu, · 2777 unmodified lines | ||
| 3234 | 3233 | return 0; |
| 3235 | 3234 | } |
| 3236 | 3235 | |
| 3237 | −static const struct smu_temperature_range vega20_thermal_policy[] = | |
| 3238 | −{ | |
| 3239 | − {-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000}, | |
| 3240 | − { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000}, | |
| 3241 | −}; | |
| 3242 | − | |
| 3243 | 3236 | static int vega20_get_thermal_temperature_range(struct smu_context *smu, |
| 3244 | 3237 | struct smu_temperature_range *range) |
| 3245 | 3238 | { |
| 3246 | − | |
| 3239 | + struct smu_table_context *table_context = &smu->smu_table; | |
| 3240 | + ATOM_Vega20_POWERPLAYTABLE *powerplay_table = table_context->power_play_table; | |
| 3247 | 3241 | PPTable_t *pptable = smu->smu_table.driver_pptable; |
| 3248 | 3242 | |
| 3249 | − if (!range) | |
| 3243 | + if (!range || !powerplay_table) | |
| 3250 | 3244 | return -EINVAL; |
| 3251 | 3245 | |
| 3252 | − memcpy(range, &vega20_thermal_policy[0], sizeof(struct smu_temperature_range)); | |
| 3253 | − | |
| 3254 | − range->max = pptable->TedgeLimit * | |
| 3255 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 3256 | − range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) * | |
| 3257 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 3258 | − range->hotspot_crit_max = pptable->ThotspotLimit * | |
| 3259 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 3260 | − range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) * | |
| 3261 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 3262 | − range->mem_crit_max = pptable->ThbmLimit * | |
| 3263 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 3264 | − range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM)* | |
| 3265 | − SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; | |
| 3246 | + /* The unit is temperature */ | |
| 3247 | + range->min = 0; | |
| 3248 | + range->max = powerplay_table->usSoftwareShutdownTemp; | |
| 3249 | + range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE); | |
| 3250 | + range->hotspot_crit_max = pptable->ThotspotLimit; | |
| 3251 | + range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT); | |
| 3252 | + range->mem_crit_max = pptable->ThbmLimit; | |
| 3253 | + range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM); | |
| 3266 | 3254 | |
| 3267 | 3255 | |
| 3268 | 3256 | return 0; |
| @@ -191,6 +191,7 @@ int bochs_kms_init(struct bochs_device *bochs) · 190 unmodified lines | ||
| 191 | 191 | bochs->dev->mode_config.fb_base = bochs->fb_base; |
| 192 | 192 | bochs->dev->mode_config.preferred_depth = 24; |
| 193 | 193 | bochs->dev->mode_config.prefer_shadow = 0; |
| 194 | + bochs->dev->mode_config.prefer_shadow_fbdev = 1; | |
| 194 | 195 | bochs->dev->mode_config.quirk_addfb_prefer_host_byte_order = true; |
| 195 | 196 | |
| 196 | 197 | bochs->dev->mode_config.funcs = &bochs_mode_funcs; |
| @@ -48,6 +48,7 @@ config DRM_DUMB_VGA_DAC · 47 unmodified lines | ||
| 48 | 48 | config DRM_LVDS_ENCODER |
| 49 | 49 | tristate "Transparent parallel to LVDS encoder support" |
| 50 | 50 | depends on OF |
| 51 | + select DRM_KMS_HELPER | |
| 51 | 52 | select DRM_PANEL_BRIDGE |
| 52 | 53 | help |
| 53 | 54 | Support for transparent parallel to LVDS encoders that don't require |
| @@ -116,9 +117,10 @@ config DRM_THINE_THC63LVD1024 · 62 unmodified lines | ||
| 116 | 117 | |
| 117 | 118 | config DRM_TOSHIBA_TC358764 |
| 118 | 119 | tristate "TC358764 DSI/LVDS bridge" |
| 119 | − depends on DRM && DRM_PANEL | |
| 120 | 120 | depends on OF |
| 121 | 121 | select DRM_MIPI_DSI |
| 122 | + select DRM_KMS_HELPER | |
| 123 | + select DRM_PANEL | |
| 122 | 124 | help |
| 123 | 125 | Toshiba TC358764 DSI/LVDS bridge driver. |
| 124 | 126 | |
| @@ -254,7 +254,6 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u · 253 unmodified lines | ||
| 254 | 254 | struct drm_device *dev = client->dev; |
| 255 | 255 | struct drm_client_buffer *buffer; |
| 256 | 256 | struct drm_gem_object *obj; |
| 257 | − void *vaddr; | |
| 258 | 257 | int ret; |
| 259 | 258 | |
| 260 | 259 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
| @@ -281,6 +280,36 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u · 20 unmodified lines | ||
| 281 | 280 | |
| 282 | 281 | buffer->gem = obj; |
| 283 | 282 | |
| 283 | + return buffer; | |
| 284 | + | |
| 285 | +err_delete: | |
| 286 | + drm_client_buffer_delete(buffer); | |
| 287 | + | |
| 288 | + return ERR_PTR(ret); | |
| 289 | +} | |
| 290 | + | |
| 291 | +/** | |
| 292 | + * drm_client_buffer_vmap - Map DRM client buffer into address space | |
| 293 | + * @buffer: DRM client buffer | |
| 294 | + * | |
| 295 | + * This function maps a client buffer into kernel address space. If the | |
| 296 | + * buffer is already mapped, it returns the mapping's address. | |
| 297 | + * | |
| 298 | + * Client buffer mappings are not ref'counted. Each call to | |
| 299 | + * drm_client_buffer_vmap() should be followed by a call to | |
| 300 | + * drm_client_buffer_vunmap(); or the client buffer should be mapped | |
| 301 | + * throughout its lifetime. | |
| 302 | + * | |
| 303 | + * Returns: | |
| 304 | + * The mapped memory's address | |
| 305 | + */ | |
| 306 | +void *drm_client_buffer_vmap(struct drm_client_buffer *buffer) | |
| 307 | +{ | |
| 308 | + void *vaddr; | |
| 309 | + | |
| 310 | + if (buffer->vaddr) | |
| 311 | + return buffer->vaddr; | |
| 312 | + | |
| 284 | 313 | /* |
| 285 | 314 | * FIXME: The dependency on GEM here isn't required, we could |
| 286 | 315 | * convert the driver handle to a dma-buf instead and use the |
| @@ -289,21 +318,30 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u · 2 unmodified lines | ||
| 289 | 318 | * fd_install step out of the driver backend hooks, to make that |
| 290 | 319 | * final step optional for internal users. |
| 291 | 320 | */ |
| 292 | − vaddr = drm_gem_vmap(obj); | |
| 293 | − if (IS_ERR(vaddr)) { | |
| 294 | − ret = PTR_ERR(vaddr); | |
| 295 | − goto err_delete; | |
| 296 | − } | |
| 321 | + vaddr = drm_gem_vmap(buffer->gem); | |
| 322 | + if (IS_ERR(vaddr)) | |
| 323 | + return vaddr; | |
| 297 | 324 | |
| 298 | 325 | buffer->vaddr = vaddr; |
| 299 | 326 | |
| 300 | − return buffer; | |
| 301 | − | |
| 302 | −err_delete: | |
| 303 | − drm_client_buffer_delete(buffer); | |
| 327 | + return vaddr; | |
| 328 | +} | |
| 329 | +EXPORT_SYMBOL(drm_client_buffer_vmap); | |
| 304 | 330 | |
| 305 | − return ERR_PTR(ret); | |
| 331 | +/** | |
| 332 | + * drm_client_buffer_vunmap - Unmap DRM client buffer | |
| 333 | + * @buffer: DRM client buffer | |
| 334 | + * | |
| 335 | + * This function removes a client buffer's memory mapping. Calling this | |
| 336 | + * function is only required by clients that manage their buffer mappings | |
| 337 | + * by themselves. | |
| 338 | + */ | |
| 339 | +void drm_client_buffer_vunmap(struct drm_client_buffer *buffer) | |
| 340 | +{ | |
| 341 | + drm_gem_vunmap(buffer->gem, buffer->vaddr); | |
| 342 | + buffer->vaddr = NULL; | |
| 306 | 343 | } |
| 344 | +EXPORT_SYMBOL(drm_client_buffer_vunmap); | |
| 307 | 345 | |
| 308 | 346 | static void drm_client_buffer_rmfb(struct drm_client_buffer *buffer) |
| 309 | 347 | { |
| @@ -403,6 +403,7 @@ static void drm_fb_helper_dirty_work(struct work_struct *work) · 402 unmodified lines | ||
| 403 | 403 | struct drm_clip_rect *clip = &helper->dirty_clip; |
| 404 | 404 | struct drm_clip_rect clip_copy; |
| 405 | 405 | unsigned long flags; |
| 406 | + void *vaddr; | |
| 406 | 407 | |
| 407 | 408 | spin_lock_irqsave(&helper->dirty_lock, flags); |
| 408 | 409 | clip_copy = *clip; |
| @@ -412,10 +413,20 @@ static void drm_fb_helper_dirty_work(struct work_struct *work) · 3 unmodified lines | ||
| 412 | 413 | |
| 413 | 414 | /* call dirty callback only when it has been really touched */ |
| 414 | 415 | if (clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2) { |
| 416 | + | |
| 415 | 417 | /* Generic fbdev uses a shadow buffer */ |
| 416 | − if (helper->buffer) | |
| 418 | + if (helper->buffer) { | |
| 419 | + vaddr = drm_client_buffer_vmap(helper->buffer); | |
| 420 | + if (IS_ERR(vaddr)) | |
| 421 | + return; | |
| 417 | 422 | drm_fb_helper_dirty_blit_real(helper, &clip_copy); |
| 418 | − helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1); | |
| 423 | + } | |
| 424 | + if (helper->fb->funcs->dirty) | |
| 425 | + helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, | |
| 426 | + &clip_copy, 1); | |
| 427 | + | |
| 428 | + if (helper->buffer) | |
| 429 | + drm_client_buffer_vunmap(helper->buffer); | |
| 419 | 430 | } |
| 420 | 431 | } |
| 421 | 432 | |
| @@ -604,6 +615,16 @@ void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper) · 182 unmodified lines | ||
| 604 | 615 | } |
| 605 | 616 | EXPORT_SYMBOL(drm_fb_helper_unlink_fbi); |
| 606 | 617 | |
| 618 | +static bool drm_fbdev_use_shadow_fb(struct drm_fb_helper *fb_helper) | |
| 619 | +{ | |
| 620 | + struct drm_device *dev = fb_helper->dev; | |
| 621 | + struct drm_framebuffer *fb = fb_helper->fb; | |
| 622 | + | |
| 623 | + return dev->mode_config.prefer_shadow_fbdev || | |
| 624 | + dev->mode_config.prefer_shadow || | |
| 625 | + fb->funcs->dirty; | |
| 626 | +} | |
| 627 | + | |
| 607 | 628 | static void drm_fb_helper_dirty(struct fb_info *info, u32 x, u32 y, |
| 608 | 629 | u32 width, u32 height) |
| 609 | 630 | { |
| @@ -611,7 +632,7 @@ static void drm_fb_helper_dirty(struct fb_info *info, u32 x, u32 y, · 1 unmodified line | ||
| 611 | 632 | struct drm_clip_rect *clip = &helper->dirty_clip; |
| 612 | 633 | unsigned long flags; |
| 613 | 634 | |
| 614 | − if (!helper->fb->funcs->dirty) | |
| 635 | + if (!drm_fbdev_use_shadow_fb(helper)) | |
| 615 | 636 | return; |
| 616 | 637 | |
| 617 | 638 | spin_lock_irqsave(&helper->dirty_lock, flags); |
| @@ -2178,6 +2199,7 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, · 1560 unmodified lines | ||
| 2178 | 2199 | struct drm_framebuffer *fb; |
| 2179 | 2200 | struct fb_info *fbi; |
| 2180 | 2201 | u32 format; |
| 2202 | + void *vaddr; | |
| 2181 | 2203 | |
| 2182 | 2204 | DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d)\n", |
| 2183 | 2205 | sizes->surface_width, sizes->surface_height, |
| @@ -2200,16 +2222,10 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, · 16 unmodified lines | ||
| 2200 | 2222 | fbi->fbops = &drm_fbdev_fb_ops; |
| 2201 | 2223 | fbi->screen_size = fb->height * fb->pitches[0]; |
| 2202 | 2224 | fbi->fix.smem_len = fbi->screen_size; |
| 2203 | − fbi->screen_buffer = buffer->vaddr; | |
| 2204 | − /* Shamelessly leak the physical address to user-space */ | |
| 2205 | −#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) | |
| 2206 | − if (drm_leak_fbdev_smem && fbi->fix.smem_start == 0) | |
| 2207 | − fbi->fix.smem_start = | |
| 2208 | − page_to_phys(virt_to_page(fbi->screen_buffer)); | |
| 2209 | −#endif | |
| 2225 | + | |
| 2210 | 2226 | drm_fb_helper_fill_info(fbi, fb_helper, sizes); |
| 2211 | 2227 | |
| 2212 | − if (fb->funcs->dirty) { | |
| 2228 | + if (drm_fbdev_use_shadow_fb(fb_helper)) { | |
| 2213 | 2229 | struct fb_ops *fbops; |
| 2214 | 2230 | void *shadow; |
| 2215 | 2231 | |
| @@ -2231,6 +2247,19 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, · 15 unmodified lines | ||
| 2231 | 2247 | fbi->fbdefio = &drm_fbdev_defio; |
| 2232 | 2248 | |
| 2233 | 2249 | fb_deferred_io_init(fbi); |
| 2250 | + } else { | |
| 2251 | + /* buffer is mapped for HW framebuffer */ | |
| 2252 | + vaddr = drm_client_buffer_vmap(fb_helper->buffer); | |
| 2253 | + if (IS_ERR(vaddr)) | |
| 2254 | + return PTR_ERR(vaddr); | |
| 2255 | + | |
| 2256 | + fbi->screen_buffer = vaddr; | |
| 2257 | + /* Shamelessly leak the physical address to user-space */ | |
| 2258 | +#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) | |
| 2259 | + if (drm_leak_fbdev_smem && fbi->fix.smem_start == 0) | |
| 2260 | + fbi->fix.smem_start = | |
| 2261 | + page_to_phys(virt_to_page(fbi->screen_buffer)); | |
| 2262 | +#endif | |
| 2234 | 2263 | } |
| 2235 | 2264 | |
| 2236 | 2265 | return 0; |
| @@ -1770,7 +1770,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, · 1769 unmodified lines | ||
| 1770 | 1770 | } |
| 1771 | 1771 | |
| 1772 | 1772 | if (named_mode) { |
| 1773 | − strncpy(mode->name, name, mode_end); | |
| 1773 | + if (mode_end + 1 > DRM_DISPLAY_MODE_LEN) | |
| 1774 | + return false; | |
| 1775 | + strscpy(mode->name, name, mode_end + 1); | |
| 1774 | 1776 | } else { |
| 1775 | 1777 | ret = drm_mode_parse_cmdline_res_mode(name, mode_end, |
| 1776 | 1778 | parse_extras, |
| @@ -2,6 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | config DRM_EXYNOS |
| 3 | 3 | tristate "DRM Support for Samsung SoC EXYNOS Series" |
| 4 | 4 | depends on OF && DRM && (ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || ARCH_MULTIPLATFORM || COMPILE_TEST) |
| 5 | + depends on MMU | |
| 5 | 6 | select DRM_KMS_HELPER |
| 6 | 7 | select VIDEOMODE_HELPERS |
| 7 | 8 | select SND_SOC_HDMI_CODEC if SND_SOC |
| @@ -44,7 +44,7 @@ static unsigned int fimc_mask = 0xc; · 43 unmodified lines | ||
| 44 | 44 | module_param_named(fimc_devs, fimc_mask, uint, 0644); |
| 45 | 45 | MODULE_PARM_DESC(fimc_devs, "Alias mask for assigning FIMC devices to Exynos DRM"); |
| 46 | 46 | |
| 47 | −#define get_fimc_context(dev) platform_get_drvdata(to_platform_device(dev)) | |
| 47 | +#define get_fimc_context(dev) dev_get_drvdata(dev) | |
| 48 | 48 | |
| 49 | 49 | enum { |
| 50 | 50 | FIMC_CLK_LCLK, |
| @@ -267,7 +267,7 @@ static inline void g2d_hw_reset(struct g2d_data *g2d) · 266 unmodified lines | ||
| 267 | 267 | static int g2d_init_cmdlist(struct g2d_data *g2d) |
| 268 | 268 | { |
| 269 | 269 | struct device *dev = g2d->dev; |
| 270 | − struct g2d_cmdlist_node *node = g2d->cmdlist_node; | |
| 270 | + struct g2d_cmdlist_node *node; | |
| 271 | 271 | int nr; |
| 272 | 272 | int ret; |
| 273 | 273 | struct g2d_buf_info *buf_info; |
| @@ -58,7 +58,7 @@ · 57 unmodified lines | ||
| 58 | 58 | #define GSC_COEF_DEPTH 3 |
| 59 | 59 | #define GSC_AUTOSUSPEND_DELAY 2000 |
| 60 | 60 | |
| 61 | −#define get_gsc_context(dev) platform_get_drvdata(to_platform_device(dev)) | |
| 61 | +#define get_gsc_context(dev) dev_get_drvdata(dev) | |
| 62 | 62 | #define gsc_read(offset) readl(ctx->regs + (offset)) |
| 63 | 63 | #define gsc_write(cfg, offset) writel(cfg, ctx->regs + (offset)) |
| 64 | 64 | |
| @@ -94,12 +94,12 @@ static inline int scaler_reset(struct scaler_context *scaler) · 93 unmodified lines | ||
| 94 | 94 | scaler_write(SCALER_CFG_SOFT_RESET, SCALER_CFG); |
| 95 | 95 | do { |
| 96 | 96 | cpu_relax(); |
| 97 | − } while (retry > 1 && | |
| 97 | + } while (--retry > 1 && | |
| 98 | 98 | scaler_read(SCALER_CFG) & SCALER_CFG_SOFT_RESET); |
| 99 | 99 | do { |
| 100 | 100 | cpu_relax(); |
| 101 | 101 | scaler_write(1, SCALER_INT_EN); |
| 102 | − } while (retry > 0 && scaler_read(SCALER_INT_EN) != 1); | |
| 102 | + } while (--retry > 0 && scaler_read(SCALER_INT_EN) != 1); | |
| 103 | 103 | |
| 104 | 104 | return retry ? 0 : -EIO; |
| 105 | 105 | } |
| @@ -765,7 +765,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb) · 764 unmodified lines | ||
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | if (bdb->version >= 226) { |
| 768 | − u32 wakeup_time = psr_table->psr2_tp2_tp3_wakeup_time; | |
| 768 | + u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time; | |
| 769 | 769 | |
| 770 | 770 | wakeup_time = (wakeup_time >> (2 * panel_type)) & 0x3; |
| 771 | 771 | switch (wakeup_time) { |
| @@ -178,6 +178,8 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv) · 177 unmodified lines | ||
| 178 | 178 | clpchgroup = (sa->deburst * deinterleave / num_channels) << i; |
| 179 | 179 | bi->num_planes = (ipqdepth - clpchgroup) / clpchgroup + 1; |
| 180 | 180 | |
| 181 | + bi->num_qgv_points = qi.num_points; | |
| 182 | + | |
| 181 | 183 | for (j = 0; j < qi.num_points; j++) { |
| 182 | 184 | const struct intel_qgv_point *sp = &qi.points[j]; |
| 183 | 185 | int ct, bw; |
| @@ -195,7 +197,7 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv) · 11 unmodified lines | ||
| 195 | 197 | bi->deratedbw[j] = min(maxdebw, |
| 196 | 198 | bw * 9 / 10); /* 90% */ |
| 197 | 199 | |
| 198 | − DRM_DEBUG_KMS("BW%d / QGV %d: num_planes=%d deratedbw=%d\n", | |
| 200 | + DRM_DEBUG_KMS("BW%d / QGV %d: num_planes=%d deratedbw=%u\n", | |
| 199 | 201 | i, j, bi->num_planes, bi->deratedbw[j]); |
| 200 | 202 | } |
| 201 | 203 | |
| @@ -211,14 +213,17 @@ static unsigned int icl_max_bw(struct drm_i915_private *dev_priv, · 9 unmodified lines | ||
| 211 | 213 | { |
| 212 | 214 | int i; |
| 213 | 215 | |
| 214 | − /* Did we initialize the bw limits successfully? */ | |
| 215 | − if (dev_priv->max_bw[0].num_planes == 0) | |
| 216 | − return UINT_MAX; | |
| 217 | − | |
| 218 | 216 | for (i = 0; i < ARRAY_SIZE(dev_priv->max_bw); i++) { |
| 219 | 217 | const struct intel_bw_info *bi = |
| 220 | 218 | &dev_priv->max_bw[i]; |
| 221 | 219 | |
| 220 | + /* | |
| 221 | + * Pcode will not expose all QGV points when | |
| 222 | + * SAGV is forced to off/min/med/max. | |
| 223 | + */ | |
| 224 | + if (qgv_point >= bi->num_qgv_points) | |
| 225 | + return UINT_MAX; | |
| 226 | + | |
| 222 | 227 | if (num_planes >= bi->num_planes) |
| 223 | 228 | return bi->deratedbw[qgv_point]; |
| 224 | 229 | } |
| @@ -2239,6 +2239,17 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state) · 2238 unmodified lines | ||
| 2239 | 2239 | if (crtc_state->has_audio && INTEL_GEN(dev_priv) >= 9) |
| 2240 | 2240 | min_cdclk = max(2 * 96000, min_cdclk); |
| 2241 | 2241 | |
| 2242 | + /* | |
| 2243 | + * "For DP audio configuration, cdclk frequency shall be set to | |
| 2244 | + * meet the following requirements: | |
| 2245 | + * DP Link Frequency(MHz) | Cdclk frequency(MHz) | |
| 2246 | + * 270 | 320 or higher | |
| 2247 | + * 162 | 200 or higher" | |
| 2248 | + */ | |
| 2249 | + if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && | |
| 2250 | + intel_crtc_has_dp_encoder(crtc_state) && crtc_state->has_audio) | |
| 2251 | + min_cdclk = max(crtc_state->port_clock, min_cdclk); | |
| 2252 | + | |
| 2242 | 2253 | /* |
| 2243 | 2254 | * On Valleyview some DSI panels lose (v|h)sync when the clock is lower |
| 2244 | 2255 | * than 320000KHz. |
| @@ -1839,7 +1839,7 @@ static void intel_enable_pipe(const struct intel_crtc_state *new_crtc_state) · 1838 unmodified lines | ||
| 1839 | 1839 | /* FIXME: assert CPU port conditions for SNB+ */ |
| 1840 | 1840 | } |
| 1841 | 1841 | |
| 1842 | − trace_intel_pipe_enable(dev_priv, pipe); | |
| 1842 | + trace_intel_pipe_enable(crtc); | |
| 1843 | 1843 | |
| 1844 | 1844 | reg = PIPECONF(cpu_transcoder); |
| 1845 | 1845 | val = I915_READ(reg); |
| @@ -1880,7 +1880,7 @@ static void intel_disable_pipe(const struct intel_crtc_state *old_crtc_state) · 34 unmodified lines | ||
| 1880 | 1880 | */ |
| 1881 | 1881 | assert_planes_disabled(crtc); |
| 1882 | 1882 | |
| 1883 | − trace_intel_pipe_disable(dev_priv, pipe); | |
| 1883 | + trace_intel_pipe_disable(crtc); | |
| 1884 | 1884 | |
| 1885 | 1885 | reg = PIPECONF(cpu_transcoder); |
| 1886 | 1886 | val = I915_READ(reg); |
| @@ -438,16 +438,23 @@ icl_combo_phy_aux_power_well_disable(struct drm_i915_private *dev_priv, · 437 unmodified lines | ||
| 438 | 438 | #define ICL_AUX_PW_TO_CH(pw_idx) \ |
| 439 | 439 | ((pw_idx) - ICL_PW_CTL_IDX_AUX_A + AUX_CH_A) |
| 440 | 440 | |
| 441 | +#define ICL_TBT_AUX_PW_TO_CH(pw_idx) \ | |
| 442 | + ((pw_idx) - ICL_PW_CTL_IDX_AUX_TBT1 + AUX_CH_C) | |
| 443 | + | |
| 441 | 444 | static void |
| 442 | 445 | icl_tc_phy_aux_power_well_enable(struct drm_i915_private *dev_priv, |
| 443 | 446 | struct i915_power_well *power_well) |
| 444 | 447 | { |
| 445 | − enum aux_ch aux_ch = ICL_AUX_PW_TO_CH(power_well->desc->hsw.idx); | |
| 448 | + int pw_idx = power_well->desc->hsw.idx; | |
| 449 | + bool is_tbt = power_well->desc->hsw.is_tc_tbt; | |
| 450 | + enum aux_ch aux_ch; | |
| 446 | 451 | u32 val; |
| 447 | 452 | |
| 453 | + aux_ch = is_tbt ? ICL_TBT_AUX_PW_TO_CH(pw_idx) : | |
| 454 | + ICL_AUX_PW_TO_CH(pw_idx); | |
| 448 | 455 | val = I915_READ(DP_AUX_CH_CTL(aux_ch)); |
| 449 | 456 | val &= ~DP_AUX_CH_CTL_TBT_IO; |
| 450 | − if (power_well->desc->hsw.is_tc_tbt) | |
| 457 | + if (is_tbt) | |
| 451 | 458 | val |= DP_AUX_CH_CTL_TBT_IO; |
| 452 | 459 | I915_WRITE(DP_AUX_CH_CTL(aux_ch), val); |
| 453 | 460 | |
| @@ -536,7 +536,8 @@ int intel_hdcp_auth_downstream(struct intel_connector *connector) · 535 unmodified lines | ||
| 536 | 536 | |
| 537 | 537 | if (drm_hdcp_check_ksvs_revoked(dev, ksv_fifo, num_downstream)) { |
| 538 | 538 | DRM_ERROR("Revoked Ksv(s) in ksv_fifo\n"); |
| 539 | − return -EPERM; | |
| 539 | + ret = -EPERM; | |
| 540 | + goto err; | |
| 540 | 541 | } |
| 541 | 542 | |
| 542 | 543 | /* |
| @@ -478,13 +478,13 @@ struct psr_table { · 477 unmodified lines | ||
| 478 | 478 | /* TP wake up time in multiple of 100 */ |
| 479 | 479 | u16 tp1_wakeup_time; |
| 480 | 480 | u16 tp2_tp3_wakeup_time; |
| 481 | − | |
| 482 | − /* PSR2 TP2/TP3 wakeup time for 16 panels */ | |
| 483 | − u32 psr2_tp2_tp3_wakeup_time; | |
| 484 | 481 | } __packed; |
| 485 | 482 | |
| 486 | 483 | struct bdb_psr { |
| 487 | 484 | struct psr_table psr_table[16]; |
| 485 | + | |
| 486 | + /* PSR2 TP2/TP3 wakeup time for 16 panels */ | |
| 487 | + u32 psr2_tp2_tp3_wakeup_time; | |
| 488 | 488 | } __packed; |
| 489 | 489 | |
| 490 | 490 | /* |
| @@ -396,8 +396,8 @@ static void glk_dsi_program_esc_clock(struct drm_device *dev, · 395 unmodified lines | ||
| 396 | 396 | else |
| 397 | 397 | txesc2_div = 10; |
| 398 | 398 | |
| 399 | − I915_WRITE(MIPIO_TXESC_CLK_DIV1, txesc1_div & GLK_TX_ESC_CLK_DIV1_MASK); | |
| 400 | − I915_WRITE(MIPIO_TXESC_CLK_DIV2, txesc2_div & GLK_TX_ESC_CLK_DIV2_MASK); | |
| 399 | + I915_WRITE(MIPIO_TXESC_CLK_DIV1, (1 << (txesc1_div - 1)) & GLK_TX_ESC_CLK_DIV1_MASK); | |
| 400 | + I915_WRITE(MIPIO_TXESC_CLK_DIV2, (1 << (txesc2_div - 1)) & GLK_TX_ESC_CLK_DIV2_MASK); | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /* Program BXT Mipi clocks and dividers */ |
| @@ -1628,6 +1628,7 @@ static int check_relocations(const struct drm_i915_gem_exec_object2 *entry) · 1627 unmodified lines | ||
| 1628 | 1628 | |
| 1629 | 1629 | static int eb_copy_relocations(const struct i915_execbuffer *eb) |
| 1630 | 1630 | { |
| 1631 | + struct drm_i915_gem_relocation_entry *relocs; | |
| 1631 | 1632 | const unsigned int count = eb->buffer_count; |
| 1632 | 1633 | unsigned int i; |
| 1633 | 1634 | int err; |
| @@ -1635,7 +1636,6 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb) · 1 unmodified line | ||
| 1635 | 1636 | for (i = 0; i < count; i++) { |
| 1636 | 1637 | const unsigned int nreloc = eb->exec[i].relocation_count; |
| 1637 | 1638 | struct drm_i915_gem_relocation_entry __user *urelocs; |
| 1638 | − struct drm_i915_gem_relocation_entry *relocs; | |
| 1639 | 1639 | unsigned long size; |
| 1640 | 1640 | unsigned long copied; |
| 1641 | 1641 | |
| @@ -1663,14 +1663,8 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb) · 21 unmodified lines | ||
| 1663 | 1663 | |
| 1664 | 1664 | if (__copy_from_user((char *)relocs + copied, |
| 1665 | 1665 | (char __user *)urelocs + copied, |
| 1666 | − len)) { | |
| 1667 | −end_user: | |
| 1668 | − user_access_end(); | |
| 1669 | −end: | |
| 1670 | − kvfree(relocs); | |
| 1671 | − err = -EFAULT; | |
| 1672 | − goto err; | |
| 1673 | − } | |
| 1666 | + len)) | |
| 1667 | + goto end; | |
| 1674 | 1668 | |
| 1675 | 1669 | copied += len; |
| 1676 | 1670 | } while (copied < size); |
| @@ -1699,10 +1693,14 @@ end: · 22 unmodified lines | ||
| 1699 | 1693 | |
| 1700 | 1694 | return 0; |
| 1701 | 1695 | |
| 1696 | +end_user: | |
| 1697 | + user_access_end(); | |
| 1698 | +end: | |
| 1699 | + kvfree(relocs); | |
| 1700 | + err = -EFAULT; | |
| 1702 | 1701 | err: |
| 1703 | 1702 | while (i--) { |
| 1704 | − struct drm_i915_gem_relocation_entry *relocs = | |
| 1705 | − u64_to_ptr(typeof(*relocs), eb->exec[i].relocs_ptr); | |
| 1703 | + relocs = u64_to_ptr(typeof(*relocs), eb->exec[i].relocs_ptr); | |
| 1706 | 1704 | if (eb->exec[i].relocation_count) |
| 1707 | 1705 | kvfree(relocs); |
| 1708 | 1706 | } |
| @@ -253,14 +253,15 @@ void i915_gem_resume(struct drm_i915_private *i915) · 252 unmodified lines | ||
| 253 | 253 | i915_gem_restore_gtt_mappings(i915); |
| 254 | 254 | i915_gem_restore_fences(i915); |
| 255 | 255 | |
| 256 | + if (i915_gem_init_hw(i915)) | |
| 257 | + goto err_wedged; | |
| 258 | + | |
| 256 | 259 | /* |
| 257 | 260 | * As we didn't flush the kernel context before suspend, we cannot |
| 258 | 261 | * guarantee that the context image is complete. So let's just reset |
| 259 | 262 | * it and start again. |
| 260 | 263 | */ |
| 261 | − intel_gt_resume(i915); | |
| 262 | − | |
| 263 | − if (i915_gem_init_hw(i915)) | |
| 264 | + if (intel_gt_resume(i915)) | |
| 264 | 265 | goto err_wedged; |
| 265 | 266 | |
| 266 | 267 | intel_uc_resume(i915); |
| @@ -664,7 +664,15 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj, · 663 unmodified lines | ||
| 664 | 664 | |
| 665 | 665 | for_each_sgt_page(page, sgt_iter, pages) { |
| 666 | 666 | if (obj->mm.dirty) |
| 667 | − set_page_dirty(page); | |
| 667 | + /* | |
| 668 | + * As this may not be anonymous memory (e.g. shmem) | |
| 669 | + * but exist on a real mapping, we have to lock | |
| 670 | + * the page in order to dirty it -- holding | |
| 671 | + * the page reference is not sufficient to | |
| 672 | + * prevent the inode from being truncated. | |
| 673 | + * Play safe and take the lock. | |
| 674 | + */ | |
| 675 | + set_page_dirty_lock(page); | |
| 668 | 676 | |
| 669 | 677 | mark_page_accessed(page); |
| 670 | 678 | put_page(page); |
| @@ -126,6 +126,7 @@ static void intel_context_retire(struct i915_active *active) · 125 unmodified lines | ||
| 126 | 126 | if (ce->state) |
| 127 | 127 | __context_unpin_state(ce->state); |
| 128 | 128 | |
| 129 | + intel_ring_unpin(ce->ring); | |
| 129 | 130 | intel_context_put(ce); |
| 130 | 131 | } |
| 131 | 132 | |
| @@ -160,27 +161,35 @@ int intel_context_active_acquire(struct intel_context *ce, unsigned long flags) · 28 unmodified lines | ||
| 160 | 161 | |
| 161 | 162 | intel_context_get(ce); |
| 162 | 163 | |
| 164 | + err = intel_ring_pin(ce->ring); | |
| 165 | + if (err) | |
| 166 | + goto err_put; | |
| 167 | + | |
| 163 | 168 | if (!ce->state) |
| 164 | 169 | return 0; |
| 165 | 170 | |
| 166 | 171 | err = __context_pin_state(ce->state, flags); |
| 167 | − if (err) { | |
| 168 | − i915_active_cancel(&ce->active); | |
| 169 | − intel_context_put(ce); | |
| 170 | − return err; | |
| 171 | − } | |
| 172 | + if (err) | |
| 173 | + goto err_ring; | |
| 172 | 174 | |
| 173 | 175 | /* Preallocate tracking nodes */ |
| 174 | 176 | if (!i915_gem_context_is_kernel(ce->gem_context)) { |
| 175 | 177 | err = i915_active_acquire_preallocate_barrier(&ce->active, |
| 176 | 178 | ce->engine); |
| 177 | − if (err) { | |
| 178 | − i915_active_release(&ce->active); | |
| 179 | − return err; | |
| 180 | − } | |
| 179 | + if (err) | |
| 180 | + goto err_state; | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | return 0; |
| 184 | + | |
| 185 | +err_state: | |
| 186 | + __context_unpin_state(ce->state); | |
| 187 | +err_ring: | |
| 188 | + intel_ring_unpin(ce->ring); | |
| 189 | +err_put: | |
| 190 | + intel_context_put(ce); | |
| 191 | + i915_active_cancel(&ce->active); | |
| 192 | + return err; | |
| 184 | 193 | } |
| 185 | 194 | |
| 186 | 195 | void intel_context_active_release(struct intel_context *ce) |
| @@ -969,9 +969,14 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) · 968 unmodified lines | ||
| 969 | 969 | u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv) |
| 970 | 970 | { |
| 971 | 971 | const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu; |
| 972 | + unsigned int slice = fls(sseu->slice_mask) - 1; | |
| 973 | + unsigned int subslice; | |
| 972 | 974 | u32 mcr_s_ss_select; |
| 973 | − u32 slice = fls(sseu->slice_mask); | |
| 974 | − u32 subslice = fls(sseu->subslice_mask[slice]); | |
| 975 | + | |
| 976 | + GEM_BUG_ON(slice >= ARRAY_SIZE(sseu->subslice_mask)); | |
| 977 | + subslice = fls(sseu->subslice_mask[slice]); | |
| 978 | + GEM_BUG_ON(!subslice); | |
| 979 | + subslice--; | |
| 975 | 980 | |
| 976 | 981 | if (IS_GEN(dev_priv, 10)) |
| 977 | 982 | mcr_s_ss_select = GEN8_MCR_SLICE(slice) | |
| @@ -1471,6 +1476,7 @@ void intel_engine_dump(struct intel_engine_cs *engine, · 493 unmodified lines | ||
| 1471 | 1476 | struct i915_gpu_error * const error = &engine->i915->gpu_error; |
| 1472 | 1477 | struct i915_request *rq; |
| 1473 | 1478 | intel_wakeref_t wakeref; |
| 1479 | + unsigned long flags; | |
| 1474 | 1480 | |
| 1475 | 1481 | if (header) { |
| 1476 | 1482 | va_list ap; |
| @@ -1490,10 +1496,9 @@ void intel_engine_dump(struct intel_engine_cs *engine, · 13 unmodified lines | ||
| 1490 | 1496 | i915_reset_engine_count(error, engine), |
| 1491 | 1497 | i915_reset_count(error)); |
| 1492 | 1498 | |
| 1493 | − rcu_read_lock(); | |
| 1494 | − | |
| 1495 | 1499 | drm_printf(m, "\tRequests:\n"); |
| 1496 | 1500 | |
| 1501 | + spin_lock_irqsave(&engine->active.lock, flags); | |
| 1497 | 1502 | rq = intel_engine_find_active_request(engine); |
| 1498 | 1503 | if (rq) { |
| 1499 | 1504 | print_request(m, rq, "\t\tactive "); |
| @@ -1513,8 +1518,7 @@ void intel_engine_dump(struct intel_engine_cs *engine, · 13 unmodified lines | ||
| 1513 | 1518 | |
| 1514 | 1519 | print_request_ring(m, rq); |
| 1515 | 1520 | } |
| 1516 | − | |
| 1517 | − rcu_read_unlock(); | |
| 1521 | + spin_unlock_irqrestore(&engine->active.lock, flags); | |
| 1518 | 1522 | |
| 1519 | 1523 | wakeref = intel_runtime_pm_get_if_in_use(&engine->i915->runtime_pm); |
| 1520 | 1524 | if (wakeref) { |
| @@ -1672,7 +1676,6 @@ struct i915_request * · 151 unmodified lines | ||
| 1672 | 1676 | intel_engine_find_active_request(struct intel_engine_cs *engine) |
| 1673 | 1677 | { |
| 1674 | 1678 | struct i915_request *request, *active = NULL; |
| 1675 | − unsigned long flags; | |
| 1676 | 1679 | |
| 1677 | 1680 | /* |
| 1678 | 1681 | * We are called by the error capture, reset and to dump engine |
| @@ -1685,7 +1688,7 @@ intel_engine_find_active_request(struct intel_engine_cs *engine) · 6 unmodified lines | ||
| 1685 | 1688 | * At all other times, we must assume the GPU is still running, but |
| 1686 | 1689 | * we only care about the snapshot of this moment. |
| 1687 | 1690 | */ |
| 1688 | − spin_lock_irqsave(&engine->active.lock, flags); | |
| 1691 | + lockdep_assert_held(&engine->active.lock); | |
| 1689 | 1692 | list_for_each_entry(request, &engine->active.requests, sched.link) { |
| 1690 | 1693 | if (i915_request_completed(request)) |
| 1691 | 1694 | continue; |
| @@ -1700,7 +1703,6 @@ intel_engine_find_active_request(struct intel_engine_cs *engine) · 8 unmodified lines | ||
| 1700 | 1703 | active = request; |
| 1701 | 1704 | break; |
| 1702 | 1705 | } |
| 1703 | − spin_unlock_irqrestore(&engine->active.lock, flags); | |
| 1704 | 1706 | |
| 1705 | 1707 | return active; |
| 1706 | 1708 | } |
| @@ -142,27 +142,3 @@ void intel_engine_init__pm(struct intel_engine_cs *engine) · 141 unmodified lines | ||
| 142 | 142 | { |
| 143 | 143 | intel_wakeref_init(&engine->wakeref); |
| 144 | 144 | } |
| 145 | − | |
| 146 | −int intel_engines_resume(struct drm_i915_private *i915) | |
| 147 | −{ | |
| 148 | − struct intel_engine_cs *engine; | |
| 149 | − enum intel_engine_id id; | |
| 150 | − int err = 0; | |
| 151 | − | |
| 152 | − intel_gt_pm_get(i915); | |
| 153 | − for_each_engine(engine, i915, id) { | |
| 154 | − intel_engine_pm_get(engine); | |
| 155 | − engine->serial++; /* kernel context lost */ | |
| 156 | − err = engine->resume(engine); | |
| 157 | − intel_engine_pm_put(engine); | |
| 158 | − if (err) { | |
| 159 | − dev_err(i915->drm.dev, | |
| 160 | − "Failed to restart %s (%d)\n", | |
| 161 | − engine->name, err); | |
| 162 | − break; | |
| 163 | − } | |
| 164 | − } | |
| 165 | − intel_gt_pm_put(i915); | |
| 166 | − | |
| 167 | − return err; | |
| 168 | −} | |
| @@ -7,16 +7,22 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifndef INTEL_ENGINE_PM_H |
| 8 | 8 | #define INTEL_ENGINE_PM_H |
| 9 | 9 | |
| 10 | +#include "intel_engine_types.h" | |
| 11 | +#include "intel_wakeref.h" | |
| 12 | + | |
| 10 | 13 | struct drm_i915_private; |
| 11 | −struct intel_engine_cs; | |
| 12 | 14 | |
| 13 | 15 | void intel_engine_pm_get(struct intel_engine_cs *engine); |
| 14 | 16 | void intel_engine_pm_put(struct intel_engine_cs *engine); |
| 15 | 17 | |
| 18 | +static inline bool | |
| 19 | +intel_engine_pm_get_if_awake(struct intel_engine_cs *engine) | |
| 20 | +{ | |
| 21 | + return intel_wakeref_get_if_active(&engine->wakeref); | |
| 22 | +} | |
| 23 | + | |
| 16 | 24 | void intel_engine_park(struct intel_engine_cs *engine); |
| 17 | 25 | |
| 18 | 26 | void intel_engine_init__pm(struct intel_engine_cs *engine); |
| 19 | 27 | |
| 20 | −int intel_engines_resume(struct drm_i915_private *i915); | |
| 21 | − | |
| 22 | 28 | #endif /* INTEL_ENGINE_PM_H */ |
| @@ -70,6 +70,18 @@ struct intel_ring { · 69 unmodified lines | ||
| 70 | 70 | struct list_head request_list; |
| 71 | 71 | struct list_head active_link; |
| 72 | 72 | |
| 73 | + /* | |
| 74 | + * As we have two types of rings, one global to the engine used | |
| 75 | + * by ringbuffer submission and those that are exclusive to a | |
| 76 | + * context used by execlists, we have to play safe and allow | |
| 77 | + * atomic updates to the pin_count. However, the actual pinning | |
| 78 | + * of the context is either done during initialisation for | |
| 79 | + * ringbuffer submission or serialised as part of the context | |
| 80 | + * pinning for execlists, and so we do not need a mutex ourselves | |
| 81 | + * to serialise intel_ring_pin/intel_ring_unpin. | |
| 82 | + */ | |
| 83 | + atomic_t pin_count; | |
| 84 | + | |
| 73 | 85 | u32 head; |
| 74 | 86 | u32 tail; |
| 75 | 87 | u32 emit; |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "i915_drv.h" |
| 8 | +#include "intel_engine_pm.h" | |
| 8 | 9 | #include "intel_gt_pm.h" |
| 9 | 10 | #include "intel_pm.h" |
| 10 | 11 | #include "intel_wakeref.h" |
| @@ -118,10 +119,11 @@ void intel_gt_sanitize(struct drm_i915_private *i915, bool force) · 107 unmodified lines | ||
| 118 | 119 | intel_engine_reset(engine, false); |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | −void intel_gt_resume(struct drm_i915_private *i915) | |
| 122 | +int intel_gt_resume(struct drm_i915_private *i915) | |
| 122 | 123 | { |
| 123 | 124 | struct intel_engine_cs *engine; |
| 124 | 125 | enum intel_engine_id id; |
| 126 | + int err = 0; | |
| 125 | 127 | |
| 126 | 128 | /* |
| 127 | 129 | * After resume, we may need to poke into the pinned kernel |
| @@ -129,9 +131,12 @@ void intel_gt_resume(struct drm_i915_private *i915) · 1 unmodified line | ||
| 129 | 131 | * Only the kernel contexts should remain pinned over suspend, |
| 130 | 132 | * allowing us to fixup the user contexts on their first pin. |
| 131 | 133 | */ |
| 134 | + intel_gt_pm_get(i915); | |
| 132 | 135 | for_each_engine(engine, i915, id) { |
| 133 | 136 | struct intel_context *ce; |
| 134 | 137 | |
| 138 | + intel_engine_pm_get(engine); | |
| 139 | + | |
| 135 | 140 | ce = engine->kernel_context; |
| 136 | 141 | if (ce) |
| 137 | 142 | ce->ops->reset(ce); |
| @@ -139,5 +144,19 @@ void intel_gt_resume(struct drm_i915_private *i915) · 1 unmodified line | ||
| 139 | 144 | ce = engine->preempt_context; |
| 140 | 145 | if (ce) |
| 141 | 146 | ce->ops->reset(ce); |
| 147 | + | |
| 148 | + engine->serial++; /* kernel context lost */ | |
| 149 | + err = engine->resume(engine); | |
| 150 | + | |
| 151 | + intel_engine_pm_put(engine); | |
| 152 | + if (err) { | |
| 153 | + dev_err(i915->drm.dev, | |
| 154 | + "Failed to restart %s (%d)\n", | |
| 155 | + engine->name, err); | |
| 156 | + break; | |
| 157 | + } | |
| 142 | 158 | } |
| 159 | + intel_gt_pm_put(i915); | |
| 160 | + | |
| 161 | + return err; | |
| 143 | 162 | } |
| @@ -22,6 +22,6 @@ void intel_gt_pm_put(struct drm_i915_private *i915); · 21 unmodified lines | ||
| 22 | 22 | void intel_gt_pm_init(struct drm_i915_private *i915); |
| 23 | 23 | |
| 24 | 24 | void intel_gt_sanitize(struct drm_i915_private *i915, bool force); |
| 25 | −void intel_gt_resume(struct drm_i915_private *i915); | |
| 25 | +int intel_gt_resume(struct drm_i915_private *i915); | |
| 26 | 26 | |
| 27 | 27 | #endif /* INTEL_GT_PM_H */ |
| @@ -1414,6 +1414,7 @@ static void execlists_context_destroy(struct kref *kref) · 1413 unmodified lines | ||
| 1414 | 1414 | { |
| 1415 | 1415 | struct intel_context *ce = container_of(kref, typeof(*ce), ref); |
| 1416 | 1416 | |
| 1417 | + GEM_BUG_ON(!i915_active_is_idle(&ce->active)); | |
| 1417 | 1418 | GEM_BUG_ON(intel_context_is_pinned(ce)); |
| 1418 | 1419 | |
| 1419 | 1420 | if (ce->state) |
| @@ -1426,7 +1427,6 @@ static void execlists_context_unpin(struct intel_context *ce) · 6 unmodified lines | ||
| 1426 | 1427 | { |
| 1427 | 1428 | i915_gem_context_unpin_hw_id(ce->gem_context); |
| 1428 | 1429 | i915_gem_object_unpin_map(ce->state->obj); |
| 1429 | − intel_ring_unpin(ce->ring); | |
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | 1432 | static void |
| @@ -1478,13 +1478,9 @@ __execlists_context_pin(struct intel_context *ce, · 45 unmodified lines | ||
| 1478 | 1478 | goto unpin_active; |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | − ret = intel_ring_pin(ce->ring); | |
| 1482 | − if (ret) | |
| 1483 | − goto unpin_map; | |
| 1484 | − | |
| 1485 | 1481 | ret = i915_gem_context_pin_hw_id(ce->gem_context); |
| 1486 | 1482 | if (ret) |
| 1487 | − goto unpin_ring; | |
| 1483 | + goto unpin_map; | |
| 1488 | 1484 | |
| 1489 | 1485 | ce->lrc_desc = lrc_descriptor(ce, engine); |
| 1490 | 1486 | ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE; |
| @@ -1492,8 +1488,6 @@ __execlists_context_pin(struct intel_context *ce, · 1 unmodified line | ||
| 1492 | 1488 | |
| 1493 | 1489 | return 0; |
| 1494 | 1490 | |
| 1495 | −unpin_ring: | |
| 1496 | − intel_ring_unpin(ce->ring); | |
| 1497 | 1491 | unpin_map: |
| 1498 | 1492 | i915_gem_object_unpin_map(ce->state->obj); |
| 1499 | 1493 | unpin_active: |
| @@ -687,7 +687,6 @@ static void reset_prepare_engine(struct intel_engine_cs *engine) · 686 unmodified lines | ||
| 687 | 687 | * written to the powercontext is undefined and so we may lose |
| 688 | 688 | * GPU state upon resume, i.e. fail to restart after a reset. |
| 689 | 689 | */ |
| 690 | − intel_engine_pm_get(engine); | |
| 691 | 690 | intel_uncore_forcewake_get(engine->uncore, FORCEWAKE_ALL); |
| 692 | 691 | engine->reset.prepare(engine); |
| 693 | 692 | } |
| @@ -718,16 +717,21 @@ static void revoke_mmaps(struct drm_i915_private *i915) · 24 unmodified lines | ||
| 718 | 717 | } |
| 719 | 718 | } |
| 720 | 719 | |
| 721 | −static void reset_prepare(struct drm_i915_private *i915) | |
| 720 | +static intel_engine_mask_t reset_prepare(struct drm_i915_private *i915) | |
| 722 | 721 | { |
| 723 | 722 | struct intel_engine_cs *engine; |
| 723 | + intel_engine_mask_t awake = 0; | |
| 724 | 724 | enum intel_engine_id id; |
| 725 | 725 | |
| 726 | − intel_gt_pm_get(i915); | |
| 727 | − for_each_engine(engine, i915, id) | |
| 726 | + for_each_engine(engine, i915, id) { | |
| 727 | + if (intel_engine_pm_get_if_awake(engine)) | |
| 728 | + awake |= engine->mask; | |
| 728 | 729 | reset_prepare_engine(engine); |
| 730 | + } | |
| 729 | 731 | |
| 730 | 732 | intel_uc_reset_prepare(i915); |
| 733 | + | |
| 734 | + return awake; | |
| 731 | 735 | } |
| 732 | 736 | |
| 733 | 737 | static void gt_revoke(struct drm_i915_private *i915) |
| @@ -761,20 +765,22 @@ static int gt_reset(struct drm_i915_private *i915, · 27 unmodified lines | ||
| 761 | 765 | static void reset_finish_engine(struct intel_engine_cs *engine) |
| 762 | 766 | { |
| 763 | 767 | engine->reset.finish(engine); |
| 764 | − intel_engine_pm_put(engine); | |
| 765 | 768 | intel_uncore_forcewake_put(engine->uncore, FORCEWAKE_ALL); |
| 769 | + | |
| 770 | + intel_engine_signal_breadcrumbs(engine); | |
| 766 | 771 | } |
| 767 | 772 | |
| 768 | −static void reset_finish(struct drm_i915_private *i915) | |
| 773 | +static void reset_finish(struct drm_i915_private *i915, | |
| 774 | + intel_engine_mask_t awake) | |
| 769 | 775 | { |
| 770 | 776 | struct intel_engine_cs *engine; |
| 771 | 777 | enum intel_engine_id id; |
| 772 | 778 | |
| 773 | 779 | for_each_engine(engine, i915, id) { |
| 774 | 780 | reset_finish_engine(engine); |
| 775 | − intel_engine_signal_breadcrumbs(engine); | |
| 781 | + if (awake & engine->mask) | |
| 782 | + intel_engine_pm_put(engine); | |
| 776 | 783 | } |
| 777 | − intel_gt_pm_put(i915); | |
| 778 | 784 | } |
| 779 | 785 | |
| 780 | 786 | static void nop_submit_request(struct i915_request *request) |
| @@ -798,6 +804,7 @@ static void __i915_gem_set_wedged(struct drm_i915_private *i915) · 17 unmodified lines | ||
| 798 | 804 | { |
| 799 | 805 | struct i915_gpu_error *error = &i915->gpu_error; |
| 800 | 806 | struct intel_engine_cs *engine; |
| 807 | + intel_engine_mask_t awake; | |
| 801 | 808 | enum intel_engine_id id; |
| 802 | 809 | |
| 803 | 810 | if (test_bit(I915_WEDGED, &error->flags)) |
| @@ -817,7 +824,7 @@ static void __i915_gem_set_wedged(struct drm_i915_private *i915) · 13 unmodified lines | ||
| 817 | 824 | * rolling the global seqno forward (since this would complete requests |
| 818 | 825 | * for which we haven't set the fence error to EIO yet). |
| 819 | 826 | */ |
| 820 | − reset_prepare(i915); | |
| 827 | + awake = reset_prepare(i915); | |
| 821 | 828 | |
| 822 | 829 | /* Even if the GPU reset fails, it should still stop the engines */ |
| 823 | 830 | if (!INTEL_INFO(i915)->gpu_reset_clobbers_display) |
| @@ -841,7 +848,7 @@ static void __i915_gem_set_wedged(struct drm_i915_private *i915) · 17 unmodified lines | ||
| 841 | 848 | for_each_engine(engine, i915, id) |
| 842 | 849 | engine->cancel_requests(engine); |
| 843 | 850 | |
| 844 | − reset_finish(i915); | |
| 851 | + reset_finish(i915, awake); | |
| 845 | 852 | |
| 846 | 853 | GEM_TRACE("end\n"); |
| 847 | 854 | } |
| @@ -951,6 +958,21 @@ static int do_reset(struct drm_i915_private *i915, · 103 unmodified lines | ||
| 951 | 958 | return gt_reset(i915, stalled_mask); |
| 952 | 959 | } |
| 953 | 960 | |
| 961 | +static int resume(struct drm_i915_private *i915) | |
| 962 | +{ | |
| 963 | + struct intel_engine_cs *engine; | |
| 964 | + enum intel_engine_id id; | |
| 965 | + int ret; | |
| 966 | + | |
| 967 | + for_each_engine(engine, i915, id) { | |
| 968 | + ret = engine->resume(engine); | |
| 969 | + if (ret) | |
| 970 | + return ret; | |
| 971 | + } | |
| 972 | + | |
| 973 | + return 0; | |
| 974 | +} | |
| 975 | + | |
| 954 | 976 | /** |
| 955 | 977 | * i915_reset - reset chip after a hang |
| 956 | 978 | * @i915: #drm_i915_private to reset |
| @@ -973,6 +995,7 @@ void i915_reset(struct drm_i915_private *i915, · 16 unmodified lines | ||
| 973 | 995 | const char *reason) |
| 974 | 996 | { |
| 975 | 997 | struct i915_gpu_error *error = &i915->gpu_error; |
| 998 | + intel_engine_mask_t awake; | |
| 976 | 999 | int ret; |
| 977 | 1000 | |
| 978 | 1001 | GEM_TRACE("flags=%lx\n", error->flags); |
| @@ -989,7 +1012,7 @@ void i915_reset(struct drm_i915_private *i915, · 10 unmodified lines | ||
| 989 | 1012 | dev_notice(i915->drm.dev, "Resetting chip for %s\n", reason); |
| 990 | 1013 | error->reset_count++; |
| 991 | 1014 | |
| 992 | − reset_prepare(i915); | |
| 1015 | + awake = reset_prepare(i915); | |
| 993 | 1016 | |
| 994 | 1017 | if (!intel_has_gpu_reset(i915)) { |
| 995 | 1018 | if (i915_modparams.reset) |
| @@ -1024,13 +1047,17 @@ void i915_reset(struct drm_i915_private *i915, · 28 unmodified lines | ||
| 1024 | 1047 | if (ret) { |
| 1025 | 1048 | DRM_ERROR("Failed to initialise HW following reset (%d)\n", |
| 1026 | 1049 | ret); |
| 1027 | − goto error; | |
| 1050 | + goto taint; | |
| 1028 | 1051 | } |
| 1029 | 1052 | |
| 1053 | + ret = resume(i915); | |
| 1054 | + if (ret) | |
| 1055 | + goto taint; | |
| 1056 | + | |
| 1030 | 1057 | i915_queue_hangcheck(i915); |
| 1031 | 1058 | |
| 1032 | 1059 | finish: |
| 1033 | − reset_finish(i915); | |
| 1060 | + reset_finish(i915, awake); | |
| 1034 | 1061 | unlock: |
| 1035 | 1062 | mutex_unlock(&error->wedge_mutex); |
| 1036 | 1063 | return; |
| @@ -1081,7 +1108,7 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg) · 44 unmodified lines | ||
| 1081 | 1108 | GEM_TRACE("%s flags=%lx\n", engine->name, error->flags); |
| 1082 | 1109 | GEM_BUG_ON(!test_bit(I915_RESET_ENGINE + engine->id, &error->flags)); |
| 1083 | 1110 | |
| 1084 | − if (!intel_wakeref_active(&engine->wakeref)) | |
| 1111 | + if (!intel_engine_pm_get_if_awake(engine)) | |
| 1085 | 1112 | return 0; |
| 1086 | 1113 | |
| 1087 | 1114 | reset_prepare_engine(engine); |
| @@ -1116,12 +1143,11 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg) · 28 unmodified lines | ||
| 1116 | 1143 | * process to program RING_MODE, HWSP and re-enable submission. |
| 1117 | 1144 | */ |
| 1118 | 1145 | ret = engine->resume(engine); |
| 1119 | − if (ret) | |
| 1120 | − goto out; | |
| 1121 | 1146 | |
| 1122 | 1147 | out: |
| 1123 | 1148 | intel_engine_cancel_stop_cs(engine); |
| 1124 | 1149 | reset_finish_engine(engine); |
| 1150 | + intel_engine_pm_put(engine); | |
| 1125 | 1151 | return ret; |
| 1126 | 1152 | } |
| 1127 | 1153 | |
| @@ -1149,16 +1149,16 @@ i915_emit_bb_start(struct i915_request *rq, · 1148 unmodified lines | ||
| 1149 | 1149 | int intel_ring_pin(struct intel_ring *ring) |
| 1150 | 1150 | { |
| 1151 | 1151 | struct i915_vma *vma = ring->vma; |
| 1152 | − enum i915_map_type map = i915_coherent_map_type(vma->vm->i915); | |
| 1153 | 1152 | unsigned int flags; |
| 1154 | 1153 | void *addr; |
| 1155 | 1154 | int ret; |
| 1156 | 1155 | |
| 1157 | − GEM_BUG_ON(ring->vaddr); | |
| 1156 | + if (atomic_fetch_inc(&ring->pin_count)) | |
| 1157 | + return 0; | |
| 1158 | 1158 | |
| 1159 | 1159 | ret = i915_timeline_pin(ring->timeline); |
| 1160 | 1160 | if (ret) |
| 1161 | − return ret; | |
| 1161 | + goto err_unpin; | |
| 1162 | 1162 | |
| 1163 | 1163 | flags = PIN_GLOBAL; |
| 1164 | 1164 | |
| @@ -1172,26 +1172,31 @@ int intel_ring_pin(struct intel_ring *ring) · 7 unmodified lines | ||
| 1172 | 1172 | |
| 1173 | 1173 | ret = i915_vma_pin(vma, 0, 0, flags); |
| 1174 | 1174 | if (unlikely(ret)) |
| 1175 | − goto unpin_timeline; | |
| 1175 | + goto err_timeline; | |
| 1176 | 1176 | |
| 1177 | 1177 | if (i915_vma_is_map_and_fenceable(vma)) |
| 1178 | 1178 | addr = (void __force *)i915_vma_pin_iomap(vma); |
| 1179 | 1179 | else |
| 1180 | − addr = i915_gem_object_pin_map(vma->obj, map); | |
| 1180 | + addr = i915_gem_object_pin_map(vma->obj, | |
| 1181 | + i915_coherent_map_type(vma->vm->i915)); | |
| 1181 | 1182 | if (IS_ERR(addr)) { |
| 1182 | 1183 | ret = PTR_ERR(addr); |
| 1183 | − goto unpin_ring; | |
| 1184 | + goto err_ring; | |
| 1184 | 1185 | } |
| 1185 | 1186 | |
| 1186 | 1187 | vma->obj->pin_global++; |
| 1187 | 1188 | |
| 1189 | + GEM_BUG_ON(ring->vaddr); | |
| 1188 | 1190 | ring->vaddr = addr; |
| 1191 | + | |
| 1189 | 1192 | return 0; |
| 1190 | 1193 | |
| 1191 | −unpin_ring: | |
| 1194 | +err_ring: | |
| 1192 | 1195 | i915_vma_unpin(vma); |
| 1193 | −unpin_timeline: | |
| 1196 | +err_timeline: | |
| 1194 | 1197 | i915_timeline_unpin(ring->timeline); |
| 1198 | +err_unpin: | |
| 1199 | + atomic_dec(&ring->pin_count); | |
| 1195 | 1200 | return ret; |
| 1196 | 1201 | } |
| 1197 | 1202 | |
| @@ -1207,16 +1212,19 @@ void intel_ring_reset(struct intel_ring *ring, u32 tail) · 9 unmodified lines | ||
| 1207 | 1212 | |
| 1208 | 1213 | void intel_ring_unpin(struct intel_ring *ring) |
| 1209 | 1214 | { |
| 1210 | − GEM_BUG_ON(!ring->vma); | |
| 1211 | − GEM_BUG_ON(!ring->vaddr); | |
| 1215 | + if (!atomic_dec_and_test(&ring->pin_count)) | |
| 1216 | + return; | |
| 1212 | 1217 | |
| 1213 | 1218 | /* Discard any unused bytes beyond that submitted to hw. */ |
| 1214 | 1219 | intel_ring_reset(ring, ring->tail); |
| 1215 | 1220 | |
| 1221 | + GEM_BUG_ON(!ring->vma); | |
| 1216 | 1222 | if (i915_vma_is_map_and_fenceable(ring->vma)) |
| 1217 | 1223 | i915_vma_unpin_iomap(ring->vma); |
| 1218 | 1224 | else |
| 1219 | 1225 | i915_gem_object_unpin_map(ring->vma->obj); |
| 1226 | + | |
| 1227 | + GEM_BUG_ON(!ring->vaddr); | |
| 1220 | 1228 | ring->vaddr = NULL; |
| 1221 | 1229 | |
| 1222 | 1230 | ring->vma->obj->pin_global--; |
| @@ -2081,10 +2089,11 @@ static void ring_destroy(struct intel_engine_cs *engine) · 858 unmodified lines | ||
| 2081 | 2089 | WARN_ON(INTEL_GEN(dev_priv) > 2 && |
| 2082 | 2090 | (ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0); |
| 2083 | 2091 | |
| 2092 | + intel_engine_cleanup_common(engine); | |
| 2093 | + | |
| 2084 | 2094 | intel_ring_unpin(engine->buffer); |
| 2085 | 2095 | intel_ring_put(engine->buffer); |
| 2086 | 2096 | |
| 2087 | − intel_engine_cleanup_common(engine); | |
| 2088 | 2097 | kfree(engine); |
| 2089 | 2098 | } |
| 2090 | 2099 | |
| @@ -1098,10 +1098,25 @@ static void glk_whitelist_build(struct intel_engine_cs *engine) · 1097 unmodified lines | ||
| 1098 | 1098 | |
| 1099 | 1099 | static void cfl_whitelist_build(struct intel_engine_cs *engine) |
| 1100 | 1100 | { |
| 1101 | + struct i915_wa_list *w = &engine->whitelist; | |
| 1102 | + | |
| 1101 | 1103 | if (engine->class != RENDER_CLASS) |
| 1102 | 1104 | return; |
| 1103 | 1105 | |
| 1104 | − gen9_whitelist_build(&engine->whitelist); | |
| 1106 | + gen9_whitelist_build(w); | |
| 1107 | + | |
| 1108 | + /* | |
| 1109 | + * WaAllowPMDepthAndInvocationCountAccessFromUMD:cfl,whl,cml,aml | |
| 1110 | + * | |
| 1111 | + * This covers 4 register which are next to one another : | |
| 1112 | + * - PS_INVOCATION_COUNT | |
| 1113 | + * - PS_INVOCATION_COUNT_UDW | |
| 1114 | + * - PS_DEPTH_COUNT | |
| 1115 | + * - PS_DEPTH_COUNT_UDW | |
| 1116 | + */ | |
| 1117 | + whitelist_reg_ext(w, PS_INVOCATION_COUNT, | |
| 1118 | + RING_FORCE_TO_NONPRIV_RD | | |
| 1119 | + RING_FORCE_TO_NONPRIV_RANGE_4); | |
| 1105 | 1120 | } |
| 1106 | 1121 | |
| 1107 | 1122 | static void cnl_whitelist_build(struct intel_engine_cs *engine) |
| @@ -1129,6 +1144,19 @@ static void icl_whitelist_build(struct intel_engine_cs *engine) · 21 unmodified lines | ||
| 1129 | 1144 | |
| 1130 | 1145 | /* WaEnableStateCacheRedirectToCS:icl */ |
| 1131 | 1146 | whitelist_reg(w, GEN9_SLICE_COMMON_ECO_CHICKEN1); |
| 1147 | + | |
| 1148 | + /* | |
| 1149 | + * WaAllowPMDepthAndInvocationCountAccessFromUMD:icl | |
| 1150 | + * | |
| 1151 | + * This covers 4 register which are next to one another : | |
| 1152 | + * - PS_INVOCATION_COUNT | |
| 1153 | + * - PS_INVOCATION_COUNT_UDW | |
| 1154 | + * - PS_DEPTH_COUNT | |
| 1155 | + * - PS_DEPTH_COUNT_UDW | |
| 1156 | + */ | |
| 1157 | + whitelist_reg_ext(w, PS_INVOCATION_COUNT, | |
| 1158 | + RING_FORCE_TO_NONPRIV_RD | | |
| 1159 | + RING_FORCE_TO_NONPRIV_RANGE_4); | |
| 1132 | 1160 | break; |
| 1133 | 1161 | |
| 1134 | 1162 | case VIDEO_DECODE_CLASS: |
| @@ -1258,8 +1286,12 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) · 123 unmodified lines | ||
| 1258 | 1286 | if (IS_ICL_REVID(i915, ICL_REVID_A0, ICL_REVID_B0)) |
| 1259 | 1287 | wa_write_or(wal, |
| 1260 | 1288 | GEN7_SARCHKMD, |
| 1261 | − GEN7_DISABLE_DEMAND_PREFETCH | | |
| 1262 | − GEN7_DISABLE_SAMPLER_PREFETCH); | |
| 1289 | + GEN7_DISABLE_DEMAND_PREFETCH); | |
| 1290 | + | |
| 1291 | + /* Wa_1606682166:icl */ | |
| 1292 | + wa_write_or(wal, | |
| 1293 | + GEN7_SARCHKMD, | |
| 1294 | + GEN7_DISABLE_SAMPLER_PREFETCH); | |
| 1263 | 1295 | } |
| 1264 | 1296 | |
| 1265 | 1297 | if (IS_GEN_RANGE(i915, 9, 11)) { |
| @@ -66,6 +66,7 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine) · 65 unmodified lines | ||
| 66 | 66 | ring->base.effective_size = sz; |
| 67 | 67 | ring->base.vaddr = (void *)(ring + 1); |
| 68 | 68 | ring->base.timeline = &ring->timeline; |
| 69 | + atomic_set(&ring->base.pin_count, 1); | |
| 69 | 70 | |
| 70 | 71 | INIT_LIST_HEAD(&ring->base.request_list); |
| 71 | 72 | intel_ring_update_space(&ring->base); |
| @@ -71,13 +71,16 @@ static int igt_atomic_reset(void *arg) · 70 unmodified lines | ||
| 71 | 71 | goto unlock; |
| 72 | 72 | |
| 73 | 73 | for (p = igt_atomic_phases; p->name; p++) { |
| 74 | + intel_engine_mask_t awake; | |
| 75 | + | |
| 74 | 76 | GEM_TRACE("intel_gpu_reset under %s\n", p->name); |
| 75 | 77 | |
| 78 | + awake = reset_prepare(i915); | |
| 76 | 79 | p->critical_section_begin(); |
| 77 | 80 | reset_prepare(i915); |
| 78 | 81 | err = intel_gpu_reset(i915, ALL_ENGINES); |
| 79 | − reset_finish(i915); | |
| 80 | 82 | p->critical_section_end(); |
| 83 | + reset_finish(i915, awake); | |
| 81 | 84 | |
| 82 | 85 | if (err) { |
| 83 | 86 | pr_err("intel_gpu_reset failed under %s\n", p->name); |
| @@ -925,7 +925,12 @@ check_whitelisted_registers(struct intel_engine_cs *engine, · 924 unmodified lines | ||
| 925 | 925 | |
| 926 | 926 | err = 0; |
| 927 | 927 | for (i = 0; i < engine->whitelist.count; i++) { |
| 928 | − if (!fn(engine, a[i], b[i], engine->whitelist.list[i].reg)) | |
| 928 | + const struct i915_wa *wa = &engine->whitelist.list[i]; | |
| 929 | + | |
| 930 | + if (i915_mmio_reg_offset(wa->reg) & RING_FORCE_TO_NONPRIV_RD) | |
| 931 | + continue; | |
| 932 | + | |
| 933 | + if (!fn(engine, a[i], b[i], wa->reg)) | |
| 929 | 934 | err = -EINVAL; |
| 930 | 935 | } |
| 931 | 936 | |
| @@ -2674,11 +2674,6 @@ static int scan_workload(struct intel_vgpu_workload *workload) · 2673 unmodified lines | ||
| 2674 | 2674 | gma_head == gma_tail) |
| 2675 | 2675 | return 0; |
| 2676 | 2676 | |
| 2677 | − if (!intel_gvt_ggtt_validate_range(s.vgpu, s.ring_start, s.ring_size)) { | |
| 2678 | − ret = -EINVAL; | |
| 2679 | − goto out; | |
| 2680 | − } | |
| 2681 | − | |
| 2682 | 2677 | ret = ip_gma_set(&s, gma_head); |
| 2683 | 2678 | if (ret) |
| 2684 | 2679 | goto out; |
| @@ -2724,11 +2719,6 @@ static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 39 unmodified lines | ||
| 2724 | 2719 | s.workload = workload; |
| 2725 | 2720 | s.is_ctx_wa = true; |
| 2726 | 2721 | |
| 2727 | − if (!intel_gvt_ggtt_validate_range(s.vgpu, s.ring_start, s.ring_size)) { | |
| 2728 | − ret = -EINVAL; | |
| 2729 | − goto out; | |
| 2730 | − } | |
| 2731 | − | |
| 2732 | 2722 | ret = ip_gma_set(&s, gma_head); |
| 2733 | 2723 | if (ret) |
| 2734 | 2724 | goto out; |
| @@ -245,7 +245,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, · 244 unmodified lines | ||
| 245 | 245 | plane->hw_format = fmt; |
| 246 | 246 | |
| 247 | 247 | plane->base = vgpu_vreg_t(vgpu, DSPSURF(pipe)) & I915_GTT_PAGE_MASK; |
| 248 | − if (!intel_gvt_ggtt_validate_range(vgpu, plane->base, 0)) | |
| 248 | + if (!vgpu_gmadr_is_valid(vgpu, plane->base)) | |
| 249 | 249 | return -EINVAL; |
| 250 | 250 | |
| 251 | 251 | plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base); |
| @@ -368,7 +368,7 @@ int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu, · 116 unmodified lines | ||
| 368 | 368 | alpha_plane, alpha_force); |
| 369 | 369 | |
| 370 | 370 | plane->base = vgpu_vreg_t(vgpu, CURBASE(pipe)) & I915_GTT_PAGE_MASK; |
| 371 | − if (!intel_gvt_ggtt_validate_range(vgpu, plane->base, 0)) | |
| 371 | + if (!vgpu_gmadr_is_valid(vgpu, plane->base)) | |
| 372 | 372 | return -EINVAL; |
| 373 | 373 | |
| 374 | 374 | plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base); |
| @@ -472,7 +472,7 @@ int intel_vgpu_decode_sprite_plane(struct intel_vgpu *vgpu, · 97 unmodified lines | ||
| 472 | 472 | plane->drm_format = drm_format; |
| 473 | 473 | |
| 474 | 474 | plane->base = vgpu_vreg_t(vgpu, SPRSURF(pipe)) & I915_GTT_PAGE_MASK; |
| 475 | − if (!intel_gvt_ggtt_validate_range(vgpu, plane->base, 0)) | |
| 475 | + if (!vgpu_gmadr_is_valid(vgpu, plane->base)) | |
| 476 | 476 | return -EINVAL; |
| 477 | 477 | |
| 478 | 478 | plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base); |
| @@ -2141,11 +2141,20 @@ static int emulate_ggtt_mmio_read(struct intel_vgpu *vgpu, · 2140 unmodified lines | ||
| 2141 | 2141 | struct intel_vgpu_mm *ggtt_mm = vgpu->gtt.ggtt_mm; |
| 2142 | 2142 | const struct intel_gvt_device_info *info = &vgpu->gvt->device_info; |
| 2143 | 2143 | unsigned long index = off >> info->gtt_entry_size_shift; |
| 2144 | + unsigned long gma; | |
| 2144 | 2145 | struct intel_gvt_gtt_entry e; |
| 2145 | 2146 | |
| 2146 | 2147 | if (bytes != 4 && bytes != 8) |
| 2147 | 2148 | return -EINVAL; |
| 2148 | 2149 | |
| 2150 | + gma = index << I915_GTT_PAGE_SHIFT; | |
| 2151 | + if (!intel_gvt_ggtt_validate_range(vgpu, | |
| 2152 | + gma, 1 << I915_GTT_PAGE_SHIFT)) { | |
| 2153 | + gvt_dbg_mm("read invalid ggtt at 0x%lx\n", gma); | |
| 2154 | + memset(p_data, 0, bytes); | |
| 2155 | + return 0; | |
| 2156 | + } | |
| 2157 | + | |
| 2149 | 2158 | ggtt_get_guest_entry(ggtt_mm, &e, index); |
| 2150 | 2159 | memcpy(p_data, (void *)&e.val64 + (off & (info->gtt_entry_size - 1)), |
| 2151 | 2160 | bytes); |
| @@ -1904,6 +1904,18 @@ static int kvmgt_dma_map_guest_page(unsigned long handle, unsigned long gfn, · 1903 unmodified lines | ||
| 1904 | 1904 | |
| 1905 | 1905 | entry = __gvt_cache_find_gfn(info->vgpu, gfn); |
| 1906 | 1906 | if (!entry) { |
| 1907 | + ret = gvt_dma_map_page(vgpu, gfn, dma_addr, size); | |
| 1908 | + if (ret) | |
| 1909 | + goto err_unlock; | |
| 1910 | + | |
| 1911 | + ret = __gvt_cache_add(info->vgpu, gfn, *dma_addr, size); | |
| 1912 | + if (ret) | |
| 1913 | + goto err_unmap; | |
| 1914 | + } else if (entry->size != size) { | |
| 1915 | + /* the same gfn with different size: unmap and re-map */ | |
| 1916 | + gvt_dma_unmap_page(vgpu, gfn, entry->dma_addr, entry->size); | |
| 1917 | + __gvt_cache_remove_entry(vgpu, entry); | |
| 1918 | + | |
| 1907 | 1919 | ret = gvt_dma_map_page(vgpu, gfn, dma_addr, size); |
| 1908 | 1920 | if (ret) |
| 1909 | 1921 | goto err_unlock; |
| @@ -364,16 +364,13 @@ static void release_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 363 unmodified lines | ||
| 364 | 364 | wa_ctx->indirect_ctx.shadow_va = NULL; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | −static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, | |
| 368 | − struct i915_gem_context *ctx) | |
| 367 | +static void set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, | |
| 368 | + struct i915_gem_context *ctx) | |
| 369 | 369 | { |
| 370 | 370 | struct intel_vgpu_mm *mm = workload->shadow_mm; |
| 371 | 371 | struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(ctx->vm); |
| 372 | 372 | int i = 0; |
| 373 | 373 | |
| 374 | − if (mm->type != INTEL_GVT_MM_PPGTT || !mm->ppgtt_mm.shadowed) | |
| 375 | − return -EINVAL; | |
| 376 | − | |
| 377 | 374 | if (mm->ppgtt_mm.root_entry_type == GTT_TYPE_PPGTT_ROOT_L4_ENTRY) { |
| 378 | 375 | px_dma(ppgtt->pd) = mm->ppgtt_mm.shadow_pdps[0]; |
| 379 | 376 | } else { |
| @@ -384,8 +381,6 @@ static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, · 4 unmodified lines | ||
| 384 | 381 | px_dma(pd) = mm->ppgtt_mm.shadow_pdps[i]; |
| 385 | 382 | } |
| 386 | 383 | } |
| 387 | − | |
| 388 | − return 0; | |
| 389 | 384 | } |
| 390 | 385 | |
| 391 | 386 | static int |
| @@ -614,6 +609,8 @@ static void release_shadow_batch_buffer(struct intel_vgpu_workload *workload) · 222 unmodified lines | ||
| 614 | 609 | static int prepare_workload(struct intel_vgpu_workload *workload) |
| 615 | 610 | { |
| 616 | 611 | struct intel_vgpu *vgpu = workload->vgpu; |
| 612 | + struct intel_vgpu_submission *s = &vgpu->submission; | |
| 613 | + int ring = workload->ring_id; | |
| 617 | 614 | int ret = 0; |
| 618 | 615 | |
| 619 | 616 | ret = intel_vgpu_pin_mm(workload->shadow_mm); |
| @@ -622,8 +619,16 @@ static int prepare_workload(struct intel_vgpu_workload *workload) · 2 unmodified lines | ||
| 622 | 619 | return ret; |
| 623 | 620 | } |
| 624 | 621 | |
| 622 | + if (workload->shadow_mm->type != INTEL_GVT_MM_PPGTT || | |
| 623 | + !workload->shadow_mm->ppgtt_mm.shadowed) { | |
| 624 | + gvt_vgpu_err("workload shadow ppgtt isn't ready\n"); | |
| 625 | + return -EINVAL; | |
| 626 | + } | |
| 627 | + | |
| 625 | 628 | update_shadow_pdps(workload); |
| 626 | 629 | |
| 630 | + set_context_ppgtt_from_shadow(workload, s->shadow[ring]->gem_context); | |
| 631 | + | |
| 627 | 632 | ret = intel_vgpu_sync_oos_pages(workload->vgpu); |
| 628 | 633 | if (ret) { |
| 629 | 634 | gvt_vgpu_err("fail to vgpu sync oos pages\n"); |
| @@ -674,7 +679,6 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 44 unmodified lines | ||
| 674 | 679 | { |
| 675 | 680 | struct intel_vgpu *vgpu = workload->vgpu; |
| 676 | 681 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; |
| 677 | − struct intel_vgpu_submission *s = &vgpu->submission; | |
| 678 | 682 | struct i915_request *rq; |
| 679 | 683 | int ring_id = workload->ring_id; |
| 680 | 684 | int ret; |
| @@ -685,13 +689,6 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 4 unmodified lines | ||
| 685 | 689 | mutex_lock(&vgpu->vgpu_lock); |
| 686 | 690 | mutex_lock(&dev_priv->drm.struct_mutex); |
| 687 | 691 | |
| 688 | − ret = set_context_ppgtt_from_shadow(workload, | |
| 689 | − s->shadow[ring_id]->gem_context); | |
| 690 | − if (ret < 0) { | |
| 691 | − gvt_vgpu_err("workload shadow ppgtt isn't ready\n"); | |
| 692 | − goto err_req; | |
| 693 | − } | |
| 694 | − | |
| 695 | 692 | ret = intel_gvt_workload_req_alloc(workload); |
| 696 | 693 | if (ret) |
| 697 | 694 | goto err_req; |
| @@ -990,6 +987,7 @@ static int workload_thread(void *priv) · 292 unmodified lines | ||
| 990 | 987 | int ret; |
| 991 | 988 | bool need_force_wake = (INTEL_GEN(gvt->dev_priv) >= 9); |
| 992 | 989 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
| 990 | + struct intel_runtime_pm *rpm = &gvt->dev_priv->runtime_pm; | |
| 993 | 991 | |
| 994 | 992 | kfree(p); |
| 995 | 993 | |
| @@ -1013,6 +1011,8 @@ static int workload_thread(void *priv) · 17 unmodified lines | ||
| 1013 | 1011 | workload->ring_id, workload, |
| 1014 | 1012 | workload->vgpu->id); |
| 1015 | 1013 | |
| 1014 | + intel_runtime_pm_get(rpm); | |
| 1015 | + | |
| 1016 | 1016 | gvt_dbg_sched("ring id %d will dispatch workload %p\n", |
| 1017 | 1017 | workload->ring_id, workload); |
| 1018 | 1018 | |
| @@ -1042,6 +1042,7 @@ complete: · 23 unmodified lines | ||
| 1042 | 1042 | intel_uncore_forcewake_put(&gvt->dev_priv->uncore, |
| 1043 | 1043 | FORCEWAKE_ALL); |
| 1044 | 1044 | |
| 1045 | + intel_runtime_pm_put_unchecked(rpm); | |
| 1045 | 1046 | if (ret && (vgpu_is_vm_unhealthy(ret))) |
| 1046 | 1047 | enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR); |
| 1047 | 1048 | } |
| @@ -1492,6 +1493,12 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu, int ring_id, · 444 unmodified lines | ||
| 1492 | 1493 | intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + |
| 1493 | 1494 | RING_CTX_OFF(ctx_ctrl.val), &ctx_ctl, 4); |
| 1494 | 1495 | |
| 1496 | + if (!intel_gvt_ggtt_validate_range(vgpu, start, | |
| 1497 | + _RING_CTL_BUF_SIZE(ctl))) { | |
| 1498 | + gvt_vgpu_err("context contain invalid rb at: 0x%x\n", start); | |
| 1499 | + return ERR_PTR(-EINVAL); | |
| 1500 | + } | |
| 1501 | + | |
| 1495 | 1502 | workload = alloc_workload(vgpu); |
| 1496 | 1503 | if (IS_ERR(workload)) |
| 1497 | 1504 | return workload; |
| @@ -1516,9 +1523,31 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu, int ring_id, · 18 unmodified lines | ||
| 1516 | 1523 | workload->wa_ctx.indirect_ctx.size = |
| 1517 | 1524 | (indirect_ctx & INDIRECT_CTX_SIZE_MASK) * |
| 1518 | 1525 | CACHELINE_BYTES; |
| 1526 | + | |
| 1527 | + if (workload->wa_ctx.indirect_ctx.size != 0) { | |
| 1528 | + if (!intel_gvt_ggtt_validate_range(vgpu, | |
| 1529 | + workload->wa_ctx.indirect_ctx.guest_gma, | |
| 1530 | + workload->wa_ctx.indirect_ctx.size)) { | |
| 1531 | + kmem_cache_free(s->workloads, workload); | |
| 1532 | + gvt_vgpu_err("invalid wa_ctx at: 0x%lx\n", | |
| 1533 | + workload->wa_ctx.indirect_ctx.guest_gma); | |
| 1534 | + return ERR_PTR(-EINVAL); | |
| 1535 | + } | |
| 1536 | + } | |
| 1537 | + | |
| 1519 | 1538 | workload->wa_ctx.per_ctx.guest_gma = |
| 1520 | 1539 | per_ctx & PER_CTX_ADDR_MASK; |
| 1521 | 1540 | workload->wa_ctx.per_ctx.valid = per_ctx & 1; |
| 1541 | + if (workload->wa_ctx.per_ctx.valid) { | |
| 1542 | + if (!intel_gvt_ggtt_validate_range(vgpu, | |
| 1543 | + workload->wa_ctx.per_ctx.guest_gma, | |
| 1544 | + CACHELINE_BYTES)) { | |
| 1545 | + kmem_cache_free(s->workloads, workload); | |
| 1546 | + gvt_vgpu_err("invalid per_ctx at: 0x%lx\n", | |
| 1547 | + workload->wa_ctx.per_ctx.guest_gma); | |
| 1548 | + return ERR_PTR(-EINVAL); | |
| 1549 | + } | |
| 1550 | + } | |
| 1522 | 1551 | } |
| 1523 | 1552 | |
| 1524 | 1553 | gvt_dbg_el("workload %p ring id %d head %x tail %x start %x ctl %x\n", |
| @@ -28,8 +28,6 @@ · 27 unmodified lines | ||
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | −#include "trace.h" | |
| 32 | − | |
| 33 | 31 | #ifndef __CHECKER__ |
| 34 | 32 | #define CREATE_TRACE_POINTS |
| 35 | 33 | #include "trace.h" |
| @@ -1674,8 +1674,9 @@ struct drm_i915_private { · 1673 unmodified lines | ||
| 1674 | 1674 | } dram_info; |
| 1675 | 1675 | |
| 1676 | 1676 | struct intel_bw_info { |
| 1677 | − int num_planes; | |
| 1678 | − int deratedbw[3]; | |
| 1677 | + unsigned int deratedbw[3]; /* for each QGV point */ | |
| 1678 | + u8 num_qgv_points; | |
| 1679 | + u8 num_planes; | |
| 1679 | 1680 | } max_bw[6]; |
| 1680 | 1681 | |
| 1681 | 1682 | struct drm_private_obj bw_obj; |
| @@ -46,7 +46,6 @@ · 45 unmodified lines | ||
| 46 | 46 | #include "gem/i915_gem_ioctls.h" |
| 47 | 47 | #include "gem/i915_gem_pm.h" |
| 48 | 48 | #include "gem/i915_gemfs.h" |
| 49 | −#include "gt/intel_engine_pm.h" | |
| 50 | 49 | #include "gt/intel_gt_pm.h" |
| 51 | 50 | #include "gt/intel_mocs.h" |
| 52 | 51 | #include "gt/intel_reset.h" |
| @@ -1307,21 +1306,13 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv) · 1254 unmodified lines | ||
| 1307 | 1306 | |
| 1308 | 1307 | intel_mocs_init_l3cc_table(dev_priv); |
| 1309 | 1308 | |
| 1310 | − /* Only when the HW is re-initialised, can we replay the requests */ | |
| 1311 | − ret = intel_engines_resume(dev_priv); | |
| 1312 | − if (ret) | |
| 1313 | − goto cleanup_uc; | |
| 1314 | − | |
| 1315 | 1309 | intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL); |
| 1316 | 1310 | |
| 1317 | 1311 | intel_engines_set_scheduler_caps(dev_priv); |
| 1318 | 1312 | return 0; |
| 1319 | 1313 | |
| 1320 | −cleanup_uc: | |
| 1321 | − intel_uc_fini_hw(dev_priv); | |
| 1322 | 1314 | out: |
| 1323 | 1315 | intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL); |
| 1324 | − | |
| 1325 | 1316 | return ret; |
| 1326 | 1317 | } |
| 1327 | 1318 | |
| @@ -1580,6 +1571,11 @@ int i915_gem_init(struct drm_i915_private *dev_priv) · 252 unmodified lines | ||
| 1580 | 1571 | if (ret) |
| 1581 | 1572 | goto err_uc_init; |
| 1582 | 1573 | |
| 1574 | + /* Only when the HW is re-initialised, can we replay the requests */ | |
| 1575 | + ret = intel_gt_resume(dev_priv); | |
| 1576 | + if (ret) | |
| 1577 | + goto err_init_hw; | |
| 1578 | + | |
| 1583 | 1579 | /* |
| 1584 | 1580 | * Despite its name intel_init_clock_gating applies both display |
| 1585 | 1581 | * clock gating workarounds; GT mmio workarounds and the occasional |
| @@ -1593,20 +1589,20 @@ int i915_gem_init(struct drm_i915_private *dev_priv) · 7 unmodified lines | ||
| 1593 | 1589 | |
| 1594 | 1590 | ret = intel_engines_verify_workarounds(dev_priv); |
| 1595 | 1591 | if (ret) |
| 1596 | − goto err_init_hw; | |
| 1592 | + goto err_gt; | |
| 1597 | 1593 | |
| 1598 | 1594 | ret = __intel_engines_record_defaults(dev_priv); |
| 1599 | 1595 | if (ret) |
| 1600 | − goto err_init_hw; | |
| 1596 | + goto err_gt; | |
| 1601 | 1597 | |
| 1602 | 1598 | if (i915_inject_load_failure()) { |
| 1603 | 1599 | ret = -ENODEV; |
| 1604 | − goto err_init_hw; | |
| 1600 | + goto err_gt; | |
| 1605 | 1601 | } |
| 1606 | 1602 | |
| 1607 | 1603 | if (i915_inject_load_failure()) { |
| 1608 | 1604 | ret = -EIO; |
| 1609 | − goto err_init_hw; | |
| 1605 | + goto err_gt; | |
| 1610 | 1606 | } |
| 1611 | 1607 | |
| 1612 | 1608 | intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL); |
| @@ -1620,7 +1616,7 @@ int i915_gem_init(struct drm_i915_private *dev_priv) · 7 unmodified lines | ||
| 1620 | 1616 | * HW as irrevisibly wedged, but keep enough state around that the |
| 1621 | 1617 | * driver doesn't explode during runtime. |
| 1622 | 1618 | */ |
| 1623 | −err_init_hw: | |
| 1619 | +err_gt: | |
| 1624 | 1620 | mutex_unlock(&dev_priv->drm.struct_mutex); |
| 1625 | 1621 | |
| 1626 | 1622 | i915_gem_set_wedged(dev_priv); |
| @@ -1630,6 +1626,7 @@ err_init_hw: · 3 unmodified lines | ||
| 1630 | 1626 | i915_gem_drain_workqueue(dev_priv); |
| 1631 | 1627 | |
| 1632 | 1628 | mutex_lock(&dev_priv->drm.struct_mutex); |
| 1629 | +err_init_hw: | |
| 1633 | 1630 | intel_uc_fini_hw(dev_priv); |
| 1634 | 1631 | err_uc_init: |
| 1635 | 1632 | intel_uc_fini(dev_priv); |
| @@ -1444,9 +1444,11 @@ unwind_pd: · 1443 unmodified lines | ||
| 1444 | 1444 | spin_lock(&pdp->lock); |
| 1445 | 1445 | if (atomic_dec_and_test(&pd->used)) { |
| 1446 | 1446 | gen8_ppgtt_set_pdpe(pdp, vm->scratch_pd, pdpe); |
| 1447 | + pdp->entry[pdpe] = vm->scratch_pd; | |
| 1447 | 1448 | GEM_BUG_ON(!atomic_read(&pdp->used)); |
| 1448 | 1449 | atomic_dec(&pdp->used); |
| 1449 | − free_pd(vm, pd); | |
| 1450 | + GEM_BUG_ON(alloc); | |
| 1451 | + alloc = pd; /* defer the free to after the lock */ | |
| 1450 | 1452 | } |
| 1451 | 1453 | spin_unlock(&pdp->lock); |
| 1452 | 1454 | unwind: |
| @@ -1515,7 +1517,9 @@ unwind_pdp: · 62 unmodified lines | ||
| 1515 | 1517 | spin_lock(&pml4->lock); |
| 1516 | 1518 | if (atomic_dec_and_test(&pdp->used)) { |
| 1517 | 1519 | gen8_ppgtt_set_pml4e(pml4, vm->scratch_pdp, pml4e); |
| 1518 | − free_pd(vm, pdp); | |
| 1520 | + pml4->entry[pml4e] = vm->scratch_pdp; | |
| 1521 | + GEM_BUG_ON(alloc); | |
| 1522 | + alloc = pdp; /* defer the free until after the lock */ | |
| 1519 | 1523 | } |
| 1520 | 1524 | spin_unlock(&pml4->lock); |
| 1521 | 1525 | unwind: |
| @@ -1418,6 +1418,7 @@ static void gem_record_rings(struct i915_gpu_state *error) · 1417 unmodified lines | ||
| 1418 | 1418 | struct intel_engine_cs *engine = i915->engine[i]; |
| 1419 | 1419 | struct drm_i915_error_engine *ee = &error->engine[i]; |
| 1420 | 1420 | struct i915_request *request; |
| 1421 | + unsigned long flags; | |
| 1421 | 1422 | |
| 1422 | 1423 | ee->engine_id = -1; |
| 1423 | 1424 | |
| @@ -1429,10 +1430,11 @@ static void gem_record_rings(struct i915_gpu_state *error) · 5 unmodified lines | ||
| 1429 | 1430 | error_record_engine_registers(error, engine, ee); |
| 1430 | 1431 | error_record_engine_execlists(engine, ee); |
| 1431 | 1432 | |
| 1433 | + spin_lock_irqsave(&engine->active.lock, flags); | |
| 1432 | 1434 | request = intel_engine_find_active_request(engine); |
| 1433 | 1435 | if (request) { |
| 1434 | 1436 | struct i915_gem_context *ctx = request->gem_context; |
| 1435 | − struct intel_ring *ring; | |
| 1437 | + struct intel_ring *ring = request->ring; | |
| 1436 | 1438 | |
| 1437 | 1439 | ee->vm = ctx->vm ?: &ggtt->vm; |
| 1438 | 1440 | |
| @@ -1462,7 +1464,6 @@ static void gem_record_rings(struct i915_gpu_state *error) · 23 unmodified lines | ||
| 1462 | 1464 | ee->rq_post = request->postfix; |
| 1463 | 1465 | ee->rq_tail = request->tail; |
| 1464 | 1466 | |
| 1465 | − ring = request->ring; | |
| 1466 | 1467 | ee->cpu_ring_head = ring->head; |
| 1467 | 1468 | ee->cpu_ring_tail = ring->tail; |
| 1468 | 1469 | ee->ringbuffer = |
| @@ -1470,6 +1471,7 @@ static void gem_record_rings(struct i915_gpu_state *error) · 1 unmodified line | ||
| 1470 | 1471 | |
| 1471 | 1472 | engine_record_requests(engine, request, ee); |
| 1472 | 1473 | } |
| 1474 | + spin_unlock_irqrestore(&engine->active.lock, flags); | |
| 1473 | 1475 | |
| 1474 | 1476 | ee->hws_page = |
| 1475 | 1477 | i915_error_object_create(i915, |
| @@ -1567,28 +1567,10 @@ static void config_oa_regs(struct drm_i915_private *dev_priv, · 1566 unmodified lines | ||
| 1567 | 1567 | } |
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | −static int hsw_enable_metric_set(struct i915_perf_stream *stream) | |
| 1570 | +static void delay_after_mux(void) | |
| 1571 | 1571 | { |
| 1572 | − struct drm_i915_private *dev_priv = stream->dev_priv; | |
| 1573 | − const struct i915_oa_config *oa_config = stream->oa_config; | |
| 1574 | − | |
| 1575 | − /* PRM: | |
| 1576 | − * | |
| 1577 | − * OA unit is using “crclk” for its functionality. When trunk | |
| 1578 | − * level clock gating takes place, OA clock would be gated, | |
| 1579 | − * unable to count the events from non-render clock domain. | |
| 1580 | − * Render clock gating must be disabled when OA is enabled to | |
| 1581 | − * count the events from non-render domain. Unit level clock | |
| 1582 | − * gating for RCS should also be disabled. | |
| 1583 | − */ | |
| 1584 | − I915_WRITE(GEN7_MISCCPCTL, (I915_READ(GEN7_MISCCPCTL) & | |
| 1585 | − ~GEN7_DOP_CLOCK_GATE_ENABLE)); | |
| 1586 | − I915_WRITE(GEN6_UCGCTL1, (I915_READ(GEN6_UCGCTL1) | | |
| 1587 | − GEN6_CSUNIT_CLOCK_GATE_DISABLE)); | |
| 1588 | − | |
| 1589 | − config_oa_regs(dev_priv, oa_config->mux_regs, oa_config->mux_regs_len); | |
| 1590 | − | |
| 1591 | − /* It apparently takes a fairly long time for a new MUX | |
| 1572 | + /* | |
| 1573 | + * It apparently takes a fairly long time for a new MUX | |
| 1592 | 1574 | * configuration to be be applied after these register writes. |
| 1593 | 1575 | * This delay duration was derived empirically based on the |
| 1594 | 1576 | * render_basic config but hopefully it covers the maximum |
| @@ -1610,6 +1592,30 @@ static int hsw_enable_metric_set(struct i915_perf_stream *stream) · 15 unmodified lines | ||
| 1610 | 1592 | * a delay at this location would mitigate any invalid reports. |
| 1611 | 1593 | */ |
| 1612 | 1594 | usleep_range(15000, 20000); |
| 1595 | +} | |
| 1596 | + | |
| 1597 | +static int hsw_enable_metric_set(struct i915_perf_stream *stream) | |
| 1598 | +{ | |
| 1599 | + struct drm_i915_private *dev_priv = stream->dev_priv; | |
| 1600 | + const struct i915_oa_config *oa_config = stream->oa_config; | |
| 1601 | + | |
| 1602 | + /* | |
| 1603 | + * PRM: | |
| 1604 | + * | |
| 1605 | + * OA unit is using “crclk” for its functionality. When trunk | |
| 1606 | + * level clock gating takes place, OA clock would be gated, | |
| 1607 | + * unable to count the events from non-render clock domain. | |
| 1608 | + * Render clock gating must be disabled when OA is enabled to | |
| 1609 | + * count the events from non-render domain. Unit level clock | |
| 1610 | + * gating for RCS should also be disabled. | |
| 1611 | + */ | |
| 1612 | + I915_WRITE(GEN7_MISCCPCTL, (I915_READ(GEN7_MISCCPCTL) & | |
| 1613 | + ~GEN7_DOP_CLOCK_GATE_ENABLE)); | |
| 1614 | + I915_WRITE(GEN6_UCGCTL1, (I915_READ(GEN6_UCGCTL1) | | |
| 1615 | + GEN6_CSUNIT_CLOCK_GATE_DISABLE)); | |
| 1616 | + | |
| 1617 | + config_oa_regs(dev_priv, oa_config->mux_regs, oa_config->mux_regs_len); | |
| 1618 | + delay_after_mux(); | |
| 1613 | 1619 | |
| 1614 | 1620 | config_oa_regs(dev_priv, oa_config->b_counter_regs, |
| 1615 | 1621 | oa_config->b_counter_regs_len); |
| @@ -1835,6 +1841,7 @@ static int gen8_enable_metric_set(struct i915_perf_stream *stream) · 219 unmodified lines | ||
| 1835 | 1841 | return ret; |
| 1836 | 1842 | |
| 1837 | 1843 | config_oa_regs(dev_priv, oa_config->mux_regs, oa_config->mux_regs_len); |
| 1844 | + delay_after_mux(); | |
| 1838 | 1845 | |
| 1839 | 1846 | config_oa_regs(dev_priv, oa_config->b_counter_regs, |
| 1840 | 1847 | oa_config->b_counter_regs_len); |
| @@ -2515,6 +2522,9 @@ static int i915_perf_release(struct inode *inode, struct file *file) · 674 unmodified lines | ||
| 2515 | 2522 | i915_perf_destroy_locked(stream); |
| 2516 | 2523 | mutex_unlock(&dev_priv->perf.lock); |
| 2517 | 2524 | |
| 2525 | + /* Release the reference the perf stream kept on the driver. */ | |
| 2526 | + drm_dev_put(&dev_priv->drm); | |
| 2527 | + | |
| 2518 | 2528 | return 0; |
| 2519 | 2529 | } |
| 2520 | 2530 | |
| @@ -2650,6 +2660,11 @@ i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv, · 129 unmodified lines | ||
| 2650 | 2660 | if (!(param->flags & I915_PERF_FLAG_DISABLED)) |
| 2651 | 2661 | i915_perf_enable_locked(stream); |
| 2652 | 2662 | |
| 2663 | + /* Take a reference on the driver that will be kept with stream_fd | |
| 2664 | + * until its release. | |
| 2665 | + */ | |
| 2666 | + drm_dev_get(&dev_priv->drm); | |
| 2667 | + | |
| 2653 | 2668 | return stream_fd; |
| 2654 | 2669 | |
| 2655 | 2670 | err_open: |
| @@ -3477,9 +3492,13 @@ void i915_perf_init(struct drm_i915_private *dev_priv) · 821 unmodified lines | ||
| 3477 | 3492 | dev_priv->perf.oa.ops.enable_metric_set = gen8_enable_metric_set; |
| 3478 | 3493 | dev_priv->perf.oa.ops.disable_metric_set = gen10_disable_metric_set; |
| 3479 | 3494 | |
| 3480 | − dev_priv->perf.oa.ctx_oactxctrl_offset = 0x128; | |
| 3481 | − dev_priv->perf.oa.ctx_flexeu0_offset = 0x3de; | |
| 3482 | − | |
| 3495 | + if (IS_GEN(dev_priv, 10)) { | |
| 3496 | + dev_priv->perf.oa.ctx_oactxctrl_offset = 0x128; | |
| 3497 | + dev_priv->perf.oa.ctx_flexeu0_offset = 0x3de; | |
| 3498 | + } else { | |
| 3499 | + dev_priv->perf.oa.ctx_oactxctrl_offset = 0x124; | |
| 3500 | + dev_priv->perf.oa.ctx_flexeu0_offset = 0x78e; | |
| 3501 | + } | |
| 3483 | 3502 | dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16); |
| 3484 | 3503 | } |
| 3485 | 3504 | } |
| @@ -21,24 +21,22 @@ · 20 unmodified lines | ||
| 21 | 21 | /* watermark/fifo updates */ |
| 22 | 22 | |
| 23 | 23 | TRACE_EVENT(intel_pipe_enable, |
| 24 | − TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe), | |
| 25 | − TP_ARGS(dev_priv, pipe), | |
| 24 | + TP_PROTO(struct intel_crtc *crtc), | |
| 25 | + TP_ARGS(crtc), | |
| 26 | 26 | |
| 27 | 27 | TP_STRUCT__entry( |
| 28 | 28 | __array(u32, frame, 3) |
| 29 | 29 | __array(u32, scanline, 3) |
| 30 | 30 | __field(enum pipe, pipe) |
| 31 | 31 | ), |
| 32 | − | |
| 33 | 32 | TP_fast_assign( |
| 34 | − enum pipe _pipe; | |
| 35 | − for_each_pipe(dev_priv, _pipe) { | |
| 36 | − __entry->frame[_pipe] = | |
| 37 | − dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, _pipe); | |
| 38 | − __entry->scanline[_pipe] = | |
| 39 | − intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, _pipe)); | |
| 33 | + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | |
| 34 | + struct intel_crtc *it__; | |
| 35 | + for_each_intel_crtc(&dev_priv->drm, it__) { | |
| 36 | + __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__); | |
| 37 | + __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__); | |
| 40 | 38 | } |
| 41 | − __entry->pipe = pipe; | |
| 39 | + __entry->pipe = crtc->pipe; | |
| 42 | 40 | ), |
| 43 | 41 | |
| 44 | 42 | TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", |
| @@ -49,8 +47,8 @@ TRACE_EVENT(intel_pipe_enable, · 4 unmodified lines | ||
| 49 | 47 | ); |
| 50 | 48 | |
| 51 | 49 | TRACE_EVENT(intel_pipe_disable, |
| 52 | − TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe), | |
| 53 | − TP_ARGS(dev_priv, pipe), | |
| 50 | + TP_PROTO(struct intel_crtc *crtc), | |
| 51 | + TP_ARGS(crtc), | |
| 54 | 52 | |
| 55 | 53 | TP_STRUCT__entry( |
| 56 | 54 | __array(u32, frame, 3) |
| @@ -59,14 +57,13 @@ TRACE_EVENT(intel_pipe_disable, · 2 unmodified lines | ||
| 59 | 57 | ), |
| 60 | 58 | |
| 61 | 59 | TP_fast_assign( |
| 62 | − enum pipe _pipe; | |
| 63 | − for_each_pipe(dev_priv, _pipe) { | |
| 64 | − __entry->frame[_pipe] = | |
| 65 | − dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, _pipe); | |
| 66 | − __entry->scanline[_pipe] = | |
| 67 | − intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, _pipe)); | |
| 60 | + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | |
| 61 | + struct intel_crtc *it__; | |
| 62 | + for_each_intel_crtc(&dev_priv->drm, it__) { | |
| 63 | + __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__); | |
| 64 | + __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__); | |
| 68 | 65 | } |
| 69 | − __entry->pipe = pipe; | |
| 66 | + __entry->pipe = crtc->pipe; | |
| 70 | 67 | ), |
| 71 | 68 | |
| 72 | 69 | TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", |
| @@ -89,8 +86,7 @@ TRACE_EVENT(intel_pipe_crc, · 16 unmodified lines | ||
| 89 | 86 | |
| 90 | 87 | TP_fast_assign( |
| 91 | 88 | __entry->pipe = crtc->pipe; |
| 92 | − __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, | |
| 93 | − crtc->pipe); | |
| 89 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 94 | 90 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 95 | 91 | memcpy(__entry->crcs, crcs, sizeof(__entry->crcs)); |
| 96 | 92 | ), |
| @@ -112,9 +108,10 @@ TRACE_EVENT(intel_cpu_fifo_underrun, · 15 unmodified lines | ||
| 112 | 108 | ), |
| 113 | 109 | |
| 114 | 110 | TP_fast_assign( |
| 111 | + struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe); | |
| 115 | 112 | __entry->pipe = pipe; |
| 116 | − __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe); | |
| 117 | − __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe)); | |
| 113 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 114 | + __entry->scanline = intel_get_crtc_scanline(crtc); | |
| 118 | 115 | ), |
| 119 | 116 | |
| 120 | 117 | TP_printk("pipe %c, frame=%u, scanline=%u", |
| @@ -134,9 +131,10 @@ TRACE_EVENT(intel_pch_fifo_underrun, · 13 unmodified lines | ||
| 134 | 131 | |
| 135 | 132 | TP_fast_assign( |
| 136 | 133 | enum pipe pipe = pch_transcoder; |
| 134 | + struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe); | |
| 137 | 135 | __entry->pipe = pipe; |
| 138 | − __entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe); | |
| 139 | − __entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe)); | |
| 136 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 137 | + __entry->scanline = intel_get_crtc_scanline(crtc); | |
| 140 | 138 | ), |
| 141 | 139 | |
| 142 | 140 | TP_printk("pch transcoder %c, frame=%u, scanline=%u", |
| @@ -156,12 +154,10 @@ TRACE_EVENT(intel_memory_cxsr, · 13 unmodified lines | ||
| 156 | 154 | ), |
| 157 | 155 | |
| 158 | 156 | TP_fast_assign( |
| 159 | − enum pipe pipe; | |
| 160 | − for_each_pipe(dev_priv, pipe) { | |
| 161 | − __entry->frame[pipe] = | |
| 162 | − dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe); | |
| 163 | − __entry->scanline[pipe] = | |
| 164 | − intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe)); | |
| 157 | + struct intel_crtc *crtc; | |
| 158 | + for_each_intel_crtc(&dev_priv->drm, crtc) { | |
| 159 | + __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc); | |
| 160 | + __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc); | |
| 165 | 161 | } |
| 166 | 162 | __entry->old = old; |
| 167 | 163 | __entry->new = new; |
| @@ -198,8 +194,7 @@ TRACE_EVENT(g4x_wm, · 30 unmodified lines | ||
| 198 | 194 | |
| 199 | 195 | TP_fast_assign( |
| 200 | 196 | __entry->pipe = crtc->pipe; |
| 201 | − __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, | |
| 202 | − crtc->pipe); | |
| 197 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 203 | 198 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 204 | 199 | __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY]; |
| 205 | 200 | __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0]; |
| @@ -243,8 +238,7 @@ TRACE_EVENT(vlv_wm, · 37 unmodified lines | ||
| 243 | 238 | |
| 244 | 239 | TP_fast_assign( |
| 245 | 240 | __entry->pipe = crtc->pipe; |
| 246 | − __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, | |
| 247 | − crtc->pipe); | |
| 241 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 248 | 242 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 249 | 243 | __entry->level = wm->level; |
| 250 | 244 | __entry->cxsr = wm->cxsr; |
| @@ -278,8 +272,7 @@ TRACE_EVENT(vlv_fifo_size, · 27 unmodified lines | ||
| 278 | 272 | |
| 279 | 273 | TP_fast_assign( |
| 280 | 274 | __entry->pipe = crtc->pipe; |
| 281 | − __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, | |
| 282 | − crtc->pipe); | |
| 275 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 283 | 276 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 284 | 277 | __entry->sprite0_start = sprite0_start; |
| 285 | 278 | __entry->sprite1_start = sprite1_start; |
| @@ -310,8 +303,7 @@ TRACE_EVENT(intel_update_plane, · 24 unmodified lines | ||
| 310 | 303 | TP_fast_assign( |
| 311 | 304 | __entry->pipe = crtc->pipe; |
| 312 | 305 | __entry->name = plane->name; |
| 313 | − __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, | |
| 314 | − crtc->pipe); | |
| 306 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 315 | 307 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 316 | 308 | memcpy(__entry->src, &plane->state->src, sizeof(__entry->src)); |
| 317 | 309 | memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst)); |
| @@ -338,8 +330,7 @@ TRACE_EVENT(intel_disable_plane, · 20 unmodified lines | ||
| 338 | 330 | TP_fast_assign( |
| 339 | 331 | __entry->pipe = crtc->pipe; |
| 340 | 332 | __entry->name = plane->name; |
| 341 | − __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, | |
| 342 | − crtc->pipe); | |
| 333 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 343 | 334 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 344 | 335 | ), |
| 345 | 336 | |
| @@ -364,8 +355,7 @@ TRACE_EVENT(i915_pipe_update_start, · 18 unmodified lines | ||
| 364 | 355 | |
| 365 | 356 | TP_fast_assign( |
| 366 | 357 | __entry->pipe = crtc->pipe; |
| 367 | − __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, | |
| 368 | − crtc->pipe); | |
| 358 | + __entry->frame = intel_crtc_get_vblank_counter(crtc); | |
| 369 | 359 | __entry->scanline = intel_get_crtc_scanline(crtc); |
| 370 | 360 | __entry->min = crtc->debug.min_vbl; |
| 371 | 361 | __entry->max = crtc->debug.max_vbl; |
| @@ -221,13 +221,11 @@ __untrack_all_wakerefs(struct intel_runtime_pm_debug *debug, · 220 unmodified lines | ||
| 221 | 221 | static void |
| 222 | 222 | dump_and_free_wakeref_tracking(struct intel_runtime_pm_debug *debug) |
| 223 | 223 | { |
| 224 | − struct drm_printer p; | |
| 224 | + if (debug->count) { | |
| 225 | + struct drm_printer p = drm_debug_printer("i915"); | |
| 225 | 226 | |
| 226 | − if (!debug->count) | |
| 227 | − return; | |
| 228 | − | |
| 229 | − p = drm_debug_printer("i915"); | |
| 230 | − __print_intel_runtime_pm_wakeref(&p, debug); | |
| 227 | + __print_intel_runtime_pm_wakeref(&p, debug); | |
| 228 | + } | |
| 231 | 229 | |
| 232 | 230 | kfree(debug->owners); |
| 233 | 231 | } |
| @@ -65,6 +65,21 @@ intel_wakeref_get(struct intel_runtime_pm *rpm, · 64 unmodified lines | ||
| 65 | 65 | return 0; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | +/** | |
| 69 | + * intel_wakeref_get_if_in_use: Acquire the wakeref | |
| 70 | + * @wf: the wakeref | |
| 71 | + * | |
| 72 | + * Acquire a hold on the wakeref, but only if the wakeref is already | |
| 73 | + * active. | |
| 74 | + * | |
| 75 | + * Returns: true if the wakeref was acquired, false otherwise. | |
| 76 | + */ | |
| 77 | +static inline bool | |
| 78 | +intel_wakeref_get_if_active(struct intel_wakeref *wf) | |
| 79 | +{ | |
| 80 | + return atomic_inc_not_zero(&wf->count); | |
| 81 | +} | |
| 82 | + | |
| 68 | 83 | /** |
| 69 | 84 | * intel_wakeref_put: Release the wakeref |
| 70 | 85 | * @i915: the drm_i915_private device |
| @@ -59,6 +59,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit · 58 unmodified lines | ||
| 59 | 59 | case MSM_SUBMIT_CMD_CTX_RESTORE_BUF: |
| 60 | 60 | if (priv->lastctx == ctx) |
| 61 | 61 | break; |
| 62 | + /* fall-thru */ | |
| 62 | 63 | case MSM_SUBMIT_CMD_BUF: |
| 63 | 64 | /* copy commands into RB: */ |
| 64 | 65 | obj = submit->bos[submit->cmd[i].idx].obj; |
| @@ -149,6 +150,7 @@ static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, · 84 unmodified lines | ||
| 149 | 150 | case MSM_SUBMIT_CMD_CTX_RESTORE_BUF: |
| 150 | 151 | if (priv->lastctx == ctx) |
| 151 | 152 | break; |
| 153 | + /* fall-thru */ | |
| 152 | 154 | case MSM_SUBMIT_CMD_BUF: |
| 153 | 155 | OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3); |
| 154 | 156 | OUT_RING(ring, lower_32_bits(submit->cmd[i].iova)); |
| @@ -115,6 +115,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, · 114 unmodified lines | ||
| 115 | 115 | case MSM_SUBMIT_CMD_CTX_RESTORE_BUF: |
| 116 | 116 | if (priv->lastctx == ctx) |
| 117 | 117 | break; |
| 118 | + /* fall-thru */ | |
| 118 | 119 | case MSM_SUBMIT_CMD_BUF: |
| 119 | 120 | OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3); |
| 120 | 121 | OUT_RING(ring, lower_32_bits(submit->cmd[i].iova)); |
| @@ -428,6 +428,7 @@ void adreno_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, · 427 unmodified lines | ||
| 428 | 428 | /* ignore if there has not been a ctx switch: */ |
| 429 | 429 | if (priv->lastctx == ctx) |
| 430 | 430 | break; |
| 431 | + /* fall-thru */ | |
| 431 | 432 | case MSM_SUBMIT_CMD_BUF: |
| 432 | 433 | OUT_PKT3(ring, adreno_is_a430(adreno_gpu) ? |
| 433 | 434 | CP_INDIRECT_BUFFER_PFE : CP_INDIRECT_BUFFER_PFD, 2); |
| @@ -439,6 +439,18 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc, · 438 unmodified lines | ||
| 439 | 439 | mdp5_crtc->enabled = false; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | +static void mdp5_crtc_vblank_on(struct drm_crtc *crtc) | |
| 443 | +{ | |
| 444 | + struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); | |
| 445 | + struct mdp5_interface *intf = mdp5_cstate->pipeline.intf; | |
| 446 | + u32 count; | |
| 447 | + | |
| 448 | + count = intf->mode == MDP5_INTF_DSI_MODE_COMMAND ? 0 : 0xffffffff; | |
| 449 | + drm_crtc_set_max_vblank_count(crtc, count); | |
| 450 | + | |
| 451 | + drm_crtc_vblank_on(crtc); | |
| 452 | +} | |
| 453 | + | |
| 442 | 454 | static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc, |
| 443 | 455 | struct drm_crtc_state *old_state) |
| 444 | 456 | { |
| @@ -475,7 +487,7 @@ static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc, · 30 unmodified lines | ||
| 475 | 487 | } |
| 476 | 488 | |
| 477 | 489 | /* Restore vblank irq handling after power is enabled */ |
| 478 | − drm_crtc_vblank_on(crtc); | |
| 490 | + mdp5_crtc_vblank_on(crtc); | |
| 479 | 491 | |
| 480 | 492 | mdp5_crtc_mode_set_nofb(crtc); |
| 481 | 493 | |
| @@ -1028,6 +1040,8 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) · 546 unmodified lines | ||
| 1028 | 1040 | mdp5_crtc_destroy_state(crtc, crtc->state); |
| 1029 | 1041 | |
| 1030 | 1042 | __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base); |
| 1043 | + | |
| 1044 | + drm_crtc_vblank_reset(crtc); | |
| 1031 | 1045 | } |
| 1032 | 1046 | |
| 1033 | 1047 | static const struct drm_crtc_funcs mdp5_crtc_funcs = { |
| @@ -740,7 +740,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) · 739 unmodified lines | ||
| 740 | 740 | dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos; |
| 741 | 741 | dev->driver->get_scanout_position = mdp5_get_scanoutpos; |
| 742 | 742 | dev->driver->get_vblank_counter = mdp5_get_vblank_counter; |
| 743 | − dev->max_vblank_count = 0xffffffff; | |
| 743 | + dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */ | |
| 744 | 744 | dev->vblank_disable_immediate = true; |
| 745 | 745 | |
| 746 | 746 | return kms; |
| @@ -1279,7 +1279,8 @@ static int add_gpu_components(struct device *dev, · 1278 unmodified lines | ||
| 1279 | 1279 | if (!np) |
| 1280 | 1280 | return 0; |
| 1281 | 1281 | |
| 1282 | − drm_of_component_match_add(dev, matchptr, compare_of, np); | |
| 1282 | + if (of_device_is_available(np)) | |
| 1283 | + drm_of_component_match_add(dev, matchptr, compare_of, np); | |
| 1283 | 1284 | |
| 1284 | 1285 | of_node_put(np); |
| 1285 | 1286 | |
| @@ -32,6 +32,46 @@ static bool use_pages(struct drm_gem_object *obj) · 31 unmodified lines | ||
| 32 | 32 | return !msm_obj->vram_node; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | +/* | |
| 36 | + * Cache sync.. this is a bit over-complicated, to fit dma-mapping | |
| 37 | + * API. Really GPU cache is out of scope here (handled on cmdstream) | |
| 38 | + * and all we need to do is invalidate newly allocated pages before | |
| 39 | + * mapping to CPU as uncached/writecombine. | |
| 40 | + * | |
| 41 | + * On top of this, we have the added headache, that depending on | |
| 42 | + * display generation, the display's iommu may be wired up to either | |
| 43 | + * the toplevel drm device (mdss), or to the mdp sub-node, meaning | |
| 44 | + * that here we either have dma-direct or iommu ops. | |
| 45 | + * | |
| 46 | + * Let this be a cautionary tail of abstraction gone wrong. | |
| 47 | + */ | |
| 48 | + | |
| 49 | +static void sync_for_device(struct msm_gem_object *msm_obj) | |
| 50 | +{ | |
| 51 | + struct device *dev = msm_obj->base.dev->dev; | |
| 52 | + | |
| 53 | + if (get_dma_ops(dev)) { | |
| 54 | + dma_sync_sg_for_device(dev, msm_obj->sgt->sgl, | |
| 55 | + msm_obj->sgt->nents, DMA_BIDIRECTIONAL); | |
| 56 | + } else { | |
| 57 | + dma_map_sg(dev, msm_obj->sgt->sgl, | |
| 58 | + msm_obj->sgt->nents, DMA_BIDIRECTIONAL); | |
| 59 | + } | |
| 60 | +} | |
| 61 | + | |
| 62 | +static void sync_for_cpu(struct msm_gem_object *msm_obj) | |
| 63 | +{ | |
| 64 | + struct device *dev = msm_obj->base.dev->dev; | |
| 65 | + | |
| 66 | + if (get_dma_ops(dev)) { | |
| 67 | + dma_sync_sg_for_cpu(dev, msm_obj->sgt->sgl, | |
| 68 | + msm_obj->sgt->nents, DMA_BIDIRECTIONAL); | |
| 69 | + } else { | |
| 70 | + dma_unmap_sg(dev, msm_obj->sgt->sgl, | |
| 71 | + msm_obj->sgt->nents, DMA_BIDIRECTIONAL); | |
| 72 | + } | |
| 73 | +} | |
| 74 | + | |
| 35 | 75 | /* allocate pages from VRAM carveout, used when no IOMMU: */ |
| 36 | 76 | static struct page **get_pages_vram(struct drm_gem_object *obj, int npages) |
| 37 | 77 | { |
| @@ -97,8 +137,7 @@ static struct page **get_pages(struct drm_gem_object *obj) · 59 unmodified lines | ||
| 97 | 137 | * because display controller, GPU, etc. are not coherent: |
| 98 | 138 | */ |
| 99 | 139 | if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) |
| 100 | − dma_sync_sg_for_device(dev->dev, msm_obj->sgt->sgl, | |
| 101 | − msm_obj->sgt->nents, DMA_BIDIRECTIONAL); | |
| 140 | + sync_for_device(msm_obj); | |
| 102 | 141 | } |
| 103 | 142 | |
| 104 | 143 | return msm_obj->pages; |
| @@ -127,9 +166,7 @@ static void put_pages(struct drm_gem_object *obj) · 22 unmodified lines | ||
| 127 | 166 | * GPU, etc. are not coherent: |
| 128 | 167 | */ |
| 129 | 168 | if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) |
| 130 | − dma_sync_sg_for_cpu(obj->dev->dev, msm_obj->sgt->sgl, | |
| 131 | − msm_obj->sgt->nents, | |
| 132 | − DMA_BIDIRECTIONAL); | |
| 169 | + sync_for_cpu(msm_obj); | |
| 133 | 170 | |
| 134 | 171 | sg_free_table(msm_obj->sgt); |
| 135 | 172 | kfree(msm_obj->sgt); |
| @@ -780,7 +780,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder, · 779 unmodified lines | ||
| 780 | 780 | drm_dp_calc_pbn_mode(crtc_state->adjusted_mode.clock, |
| 781 | 781 | connector->display_info.bpc * 3); |
| 782 | 782 | |
| 783 | − if (drm_atomic_crtc_needs_modeset(crtc_state)) { | |
| 783 | + if (crtc_state->mode_changed) { | |
| 784 | 784 | slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, |
| 785 | 785 | mstc->port, |
| 786 | 786 | asyh->dp.pbn); |
| @@ -475,6 +475,47 @@ nouveau_svm_fault_cache(struct nouveau_svm *svm, · 474 unmodified lines | ||
| 475 | 475 | fault->inst, fault->addr, fault->access); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | +static inline bool | |
| 479 | +nouveau_range_done(struct hmm_range *range) | |
| 480 | +{ | |
| 481 | + bool ret = hmm_range_valid(range); | |
| 482 | + | |
| 483 | + hmm_range_unregister(range); | |
| 484 | + return ret; | |
| 485 | +} | |
| 486 | + | |
| 487 | +static int | |
| 488 | +nouveau_range_fault(struct hmm_mirror *mirror, struct hmm_range *range) | |
| 489 | +{ | |
| 490 | + long ret; | |
| 491 | + | |
| 492 | + range->default_flags = 0; | |
| 493 | + range->pfn_flags_mask = -1UL; | |
| 494 | + | |
| 495 | + ret = hmm_range_register(range, mirror, | |
| 496 | + range->start, range->end, | |
| 497 | + PAGE_SHIFT); | |
| 498 | + if (ret) { | |
| 499 | + up_read(&range->vma->vm_mm->mmap_sem); | |
| 500 | + return (int)ret; | |
| 501 | + } | |
| 502 | + | |
| 503 | + if (!hmm_range_wait_until_valid(range, HMM_RANGE_DEFAULT_TIMEOUT)) { | |
| 504 | + up_read(&range->vma->vm_mm->mmap_sem); | |
| 505 | + return -EAGAIN; | |
| 506 | + } | |
| 507 | + | |
| 508 | + ret = hmm_range_fault(range, true); | |
| 509 | + if (ret <= 0) { | |
| 510 | + if (ret == 0) | |
| 511 | + ret = -EBUSY; | |
| 512 | + up_read(&range->vma->vm_mm->mmap_sem); | |
| 513 | + hmm_range_unregister(range); | |
| 514 | + return ret; | |
| 515 | + } | |
| 516 | + return 0; | |
| 517 | +} | |
| 518 | + | |
| 478 | 519 | static int |
| 479 | 520 | nouveau_svm_fault(struct nvif_notify *notify) |
| 480 | 521 | { |
| @@ -649,10 +690,10 @@ nouveau_svm_fault(struct nvif_notify *notify) · 168 unmodified lines | ||
| 649 | 690 | range.values = nouveau_svm_pfn_values; |
| 650 | 691 | range.pfn_shift = NVIF_VMM_PFNMAP_V0_ADDR_SHIFT; |
| 651 | 692 | again: |
| 652 | − ret = hmm_vma_fault(&svmm->mirror, &range, true); | |
| 693 | + ret = nouveau_range_fault(&svmm->mirror, &range); | |
| 653 | 694 | if (ret == 0) { |
| 654 | 695 | mutex_lock(&svmm->mutex); |
| 655 | − if (!hmm_vma_range_done(&range)) { | |
| 696 | + if (!nouveau_range_done(&range)) { | |
| 656 | 697 | mutex_unlock(&svmm->mutex); |
| 657 | 698 | goto again; |
| 658 | 699 | } |
| @@ -666,8 +707,8 @@ again: · 7 unmodified lines | ||
| 666 | 707 | NULL); |
| 667 | 708 | svmm->vmm->vmm.object.client->super = false; |
| 668 | 709 | mutex_unlock(&svmm->mutex); |
| 710 | + up_read(&svmm->mm->mmap_sem); | |
| 669 | 711 | } |
| 670 | − up_read(&svmm->mm->mmap_sem); | |
| 671 | 712 | |
| 672 | 713 | /* Cancel any faults in the window whose pages didn't manage |
| 673 | 714 | * to keep their valid bit, or stay writeable when required. |
| @@ -432,7 +432,7 @@ static int rockchip_dp_resume(struct device *dev) · 431 unmodified lines | ||
| 432 | 432 | |
| 433 | 433 | static const struct dev_pm_ops rockchip_dp_pm_ops = { |
| 434 | 434 | #ifdef CONFIG_PM_SLEEP |
| 435 | − .suspend = rockchip_dp_suspend, | |
| 435 | + .suspend_late = rockchip_dp_suspend, | |
| 436 | 436 | .resume_early = rockchip_dp_resume, |
| 437 | 437 | #endif |
| 438 | 438 | }; |
| @@ -126,8 +126,12 @@ int tegra_output_probe(struct tegra_output *output) · 125 unmodified lines | ||
| 126 | 126 | "nvidia,hpd-gpio", 0, |
| 127 | 127 | GPIOD_IN, |
| 128 | 128 | "HDMI hotplug detect"); |
| 129 | − if (IS_ERR(output->hpd_gpio)) | |
| 130 | − return PTR_ERR(output->hpd_gpio); | |
| 129 | + if (IS_ERR(output->hpd_gpio)) { | |
| 130 | + if (PTR_ERR(output->hpd_gpio) != -ENOENT) | |
| 131 | + return PTR_ERR(output->hpd_gpio); | |
| 132 | + | |
| 133 | + output->hpd_gpio = NULL; | |
| 134 | + } | |
| 131 | 135 | |
| 132 | 136 | if (output->hpd_gpio) { |
| 133 | 137 | err = gpiod_to_irq(output->hpd_gpio); |
| @@ -389,8 +389,10 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg, · 388 unmodified lines | ||
| 389 | 389 | break; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | − if (retries == RETRIES) | |
| 392 | + if (retries == RETRIES) { | |
| 393 | + kfree(reply); | |
| 393 | 394 | return -EINVAL; |
| 395 | + } | |
| 394 | 396 | |
| 395 | 397 | *msg_len = reply_len; |
| 396 | 398 | *msg = reply; |
| @@ -23,12 +23,36 @@ · 22 unmodified lines | ||
| 23 | 23 | #define A4_2WHEEL_MOUSE_HACK_7 0x01 |
| 24 | 24 | #define A4_2WHEEL_MOUSE_HACK_B8 0x02 |
| 25 | 25 | |
| 26 | +#define A4_WHEEL_ORIENTATION (HID_UP_GENDESK | 0x000000b8) | |
| 27 | + | |
| 26 | 28 | struct a4tech_sc { |
| 27 | 29 | unsigned long quirks; |
| 28 | 30 | unsigned int hw_wheel; |
| 29 | 31 | __s32 delayed_value; |
| 30 | 32 | }; |
| 31 | 33 | |
| 34 | +static int a4_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |
| 35 | + struct hid_field *field, struct hid_usage *usage, | |
| 36 | + unsigned long **bit, int *max) | |
| 37 | +{ | |
| 38 | + struct a4tech_sc *a4 = hid_get_drvdata(hdev); | |
| 39 | + | |
| 40 | + if (a4->quirks & A4_2WHEEL_MOUSE_HACK_B8 && | |
| 41 | + usage->hid == A4_WHEEL_ORIENTATION) { | |
| 42 | + /* | |
| 43 | + * We do not want to have this usage mapped to anything as it's | |
| 44 | + * nonstandard and doesn't really behave like an HID report. | |
| 45 | + * It's only selecting the orientation (vertical/horizontal) of | |
| 46 | + * the previous mouse wheel report. The input_events will be | |
| 47 | + * generated once both reports are recorded in a4_event(). | |
| 48 | + */ | |
| 49 | + return -1; | |
| 50 | + } | |
| 51 | + | |
| 52 | + return 0; | |
| 53 | + | |
| 54 | +} | |
| 55 | + | |
| 32 | 56 | static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
| 33 | 57 | struct hid_field *field, struct hid_usage *usage, |
| 34 | 58 | unsigned long **bit, int *max) |
| @@ -52,8 +76,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, · 17 unmodified lines | ||
| 52 | 76 | struct a4tech_sc *a4 = hid_get_drvdata(hdev); |
| 53 | 77 | struct input_dev *input; |
| 54 | 78 | |
| 55 | − if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || | |
| 56 | − !usage->type) | |
| 79 | + if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput) | |
| 57 | 80 | return 0; |
| 58 | 81 | |
| 59 | 82 | input = field->hidinput->input; |
| @@ -64,7 +87,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, · 4 unmodified lines | ||
| 64 | 87 | return 1; |
| 65 | 88 | } |
| 66 | 89 | |
| 67 | − if (usage->hid == 0x000100b8) { | |
| 90 | + if (usage->hid == A4_WHEEL_ORIENTATION) { | |
| 68 | 91 | input_event(input, EV_REL, value ? REL_HWHEEL : |
| 69 | 92 | REL_WHEEL, a4->delayed_value); |
| 70 | 93 | input_event(input, EV_REL, value ? REL_HWHEEL_HI_RES : |
| @@ -131,6 +154,7 @@ MODULE_DEVICE_TABLE(hid, a4_devices); · 60 unmodified lines | ||
| 131 | 154 | static struct hid_driver a4_driver = { |
| 132 | 155 | .name = "a4tech", |
| 133 | 156 | .id_table = a4_devices, |
| 157 | + .input_mapping = a4_input_mapping, | |
| 134 | 158 | .input_mapped = a4_input_mapped, |
| 135 | 159 | .event = a4_event, |
| 136 | 160 | .probe = a4_probe, |
| @@ -123,9 +123,14 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type, · 122 unmodified lines | ||
| 123 | 123 | |
| 124 | 124 | /* Locate the boot interface, to receive the LED change events */ |
| 125 | 125 | struct usb_interface *boot_interface = usb_ifnum_to_if(usb_dev, 0); |
| 126 | + struct hid_device *boot_hid; | |
| 127 | + struct hid_input *boot_hid_input; | |
| 126 | 128 | |
| 127 | − struct hid_device *boot_hid = usb_get_intfdata(boot_interface); | |
| 128 | − struct hid_input *boot_hid_input = list_first_entry(&boot_hid->inputs, | |
| 129 | + if (unlikely(boot_interface == NULL)) | |
| 130 | + return -ENODEV; | |
| 131 | + | |
| 132 | + boot_hid = usb_get_intfdata(boot_interface); | |
| 133 | + boot_hid_input = list_first_entry(&boot_hid->inputs, | |
| 129 | 134 | struct hid_input, list); |
| 130 | 135 | |
| 131 | 136 | return boot_hid_input->input->event(boot_hid_input->input, type, code, |
| @@ -568,6 +568,7 @@ · 567 unmodified lines | ||
| 568 | 568 | #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A 0x0b4a |
| 569 | 569 | #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a |
| 570 | 570 | #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A 0x094a |
| 571 | +#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641 0x0641 | |
| 571 | 572 | |
| 572 | 573 | #define USB_VENDOR_ID_HUION 0x256c |
| 573 | 574 | #define USB_DEVICE_ID_HUION_TABLET 0x006e |
| @@ -768,7 +769,8 @@ · 194 unmodified lines | ||
| 768 | 769 | #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER 0xc52f |
| 769 | 770 | #define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2 0xc532 |
| 770 | 771 | #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_2 0xc534 |
| 771 | −#define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_GAMING 0xc539 | |
| 772 | +#define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED 0xc539 | |
| 773 | +#define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_POWERPLAY 0xc53a | |
| 772 | 774 | #define USB_DEVICE_ID_SPACETRAVELLER 0xc623 |
| 773 | 775 | #define USB_DEVICE_ID_SPACENAVIGATOR 0xc626 |
| 774 | 776 | #define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704 |
| @@ -989,6 +991,7 @@ · 214 unmodified lines | ||
| 989 | 991 | #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 |
| 990 | 992 | #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa |
| 991 | 993 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 |
| 994 | +#define USB_DEVICE_ID_SAITEK_X52 0x075c | |
| 992 | 995 | |
| 993 | 996 | #define USB_VENDOR_ID_SAMSUNG 0x0419 |
| 994 | 997 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
| @@ -1125,7 +1125,7 @@ static int logi_dj_recv_query_hidpp_devices(struct dj_receiver_dev *djrcv_dev) · 1124 unmodified lines | ||
| 1125 | 1125 | HID_REQ_SET_REPORT); |
| 1126 | 1126 | |
| 1127 | 1127 | kfree(hidpp_report); |
| 1128 | − return retval; | |
| 1128 | + return (retval < 0) ? retval : 0; | |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) |
| @@ -1832,13 +1832,17 @@ static const struct hid_device_id logi_dj_receivers[] = { · 700 unmodified lines | ||
| 1832 | 1832 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, |
| 1833 | 1833 | USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_2), |
| 1834 | 1834 | .driver_data = recvr_type_hidpp}, |
| 1835 | − { /* Logitech gaming receiver (0xc539) */ | |
| 1835 | + { /* Logitech lightspeed receiver (0xc539) */ | |
| 1836 | 1836 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, |
| 1837 | − USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_GAMING), | |
| 1837 | + USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED), | |
| 1838 | 1838 | .driver_data = recvr_type_gaming_hidpp}, |
| 1839 | 1839 | { /* Logitech 27 MHz HID++ 1.0 receiver (0xc513) */ |
| 1840 | 1840 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER), |
| 1841 | 1841 | .driver_data = recvr_type_27mhz}, |
| 1842 | + { /* Logitech powerplay receiver (0xc53a) */ | |
| 1843 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, | |
| 1844 | + USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_POWERPLAY), | |
| 1845 | + .driver_data = recvr_type_gaming_hidpp}, | |
| 1842 | 1846 | { /* Logitech 27 MHz HID++ 1.0 receiver (0xc517) */ |
| 1843 | 1847 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, |
| 1844 | 1848 | USB_DEVICE_ID_S510_RECEIVER_2), |
| @@ -3749,15 +3749,45 @@ static const struct hid_device_id hidpp_devices[] = { · 3748 unmodified lines | ||
| 3749 | 3749 | |
| 3750 | 3750 | { L27MHZ_DEVICE(HID_ANY_ID) }, |
| 3751 | 3751 | |
| 3752 | − { /* Logitech G403 Gaming Mouse over USB */ | |
| 3752 | + { /* Logitech G203/Prodigy Gaming Mouse */ | |
| 3753 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC084) }, | |
| 3754 | + { /* Logitech G302 Gaming Mouse */ | |
| 3755 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC07F) }, | |
| 3756 | + { /* Logitech G303 Gaming Mouse */ | |
| 3757 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC080) }, | |
| 3758 | + { /* Logitech G400 Gaming Mouse */ | |
| 3759 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC07E) }, | |
| 3760 | + { /* Logitech G403 Wireless Gaming Mouse over USB */ | |
| 3753 | 3761 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC082) }, |
| 3762 | + { /* Logitech G403 Gaming Mouse */ | |
| 3763 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC083) }, | |
| 3764 | + { /* Logitech G403 Hero Gaming Mouse over USB */ | |
| 3765 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08F) }, | |
| 3766 | + { /* Logitech G502 Proteus Core Gaming Mouse */ | |
| 3767 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC07D) }, | |
| 3768 | + { /* Logitech G502 Proteus Spectrum Gaming Mouse over USB */ | |
| 3769 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC332) }, | |
| 3770 | + { /* Logitech G502 Hero Gaming Mouse over USB */ | |
| 3771 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08B) }, | |
| 3754 | 3772 | { /* Logitech G700 Gaming Mouse over USB */ |
| 3755 | 3773 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC06B) }, |
| 3774 | + { /* Logitech G700s Gaming Mouse over USB */ | |
| 3775 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC07C) }, | |
| 3776 | + { /* Logitech G703 Gaming Mouse over USB */ | |
| 3777 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC087) }, | |
| 3778 | + { /* Logitech G703 Hero Gaming Mouse over USB */ | |
| 3779 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090) }, | |
| 3756 | 3780 | { /* Logitech G900 Gaming Mouse over USB */ |
| 3757 | 3781 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081) }, |
| 3782 | + { /* Logitech G903 Gaming Mouse over USB */ | |
| 3783 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC086) }, | |
| 3784 | + { /* Logitech G903 Hero Gaming Mouse over USB */ | |
| 3785 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC091) }, | |
| 3758 | 3786 | { /* Logitech G920 Wheel over USB */ |
| 3759 | 3787 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL), |
| 3760 | 3788 | .driver_data = HIDPP_QUIRK_CLASS_G920 | HIDPP_QUIRK_FORCE_OUTPUT_REPORTS}, |
| 3789 | + { /* Logitech G Pro Gaming Mouse over USB */ | |
| 3790 | + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC088) }, | |
| 3761 | 3791 | |
| 3762 | 3792 | { /* MX5000 keyboard over Bluetooth */ |
| 3763 | 3793 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb305), |
| @@ -92,6 +92,7 @@ static const struct hid_device_id hid_quirks[] = { · 91 unmodified lines | ||
| 92 | 92 | { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A), HID_QUIRK_ALWAYS_POLL }, |
| 93 | 93 | { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, |
| 94 | 94 | { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A), HID_QUIRK_ALWAYS_POLL }, |
| 95 | + { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641), HID_QUIRK_ALWAYS_POLL }, | |
| 95 | 96 | { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT }, |
| 96 | 97 | { HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT }, |
| 97 | 98 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X), HID_QUIRK_MULTI_INPUT }, |
| @@ -141,6 +142,7 @@ static const struct hid_device_id hid_quirks[] = { · 43 unmodified lines | ||
| 141 | 142 | { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPAD), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
| 142 | 143 | { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
| 143 | 144 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD }, |
| 145 | + { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | |
| 144 | 146 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS }, |
| 145 | 147 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, |
| 146 | 148 | { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET }, |
| @@ -585,10 +585,14 @@ static void sony_set_leds(struct sony_sc *sc); · 584 unmodified lines | ||
| 585 | 585 | static inline void sony_schedule_work(struct sony_sc *sc, |
| 586 | 586 | enum sony_worker which) |
| 587 | 587 | { |
| 588 | + unsigned long flags; | |
| 589 | + | |
| 588 | 590 | switch (which) { |
| 589 | 591 | case SONY_WORKER_STATE: |
| 590 | − if (!sc->defer_initialization) | |
| 592 | + spin_lock_irqsave(&sc->lock, flags); | |
| 593 | + if (!sc->defer_initialization && sc->state_worker_initialized) | |
| 591 | 594 | schedule_work(&sc->state_worker); |
| 595 | + spin_unlock_irqrestore(&sc->lock, flags); | |
| 592 | 596 | break; |
| 593 | 597 | case SONY_WORKER_HOTPLUG: |
| 594 | 598 | if (sc->hotplug_worker_initialized) |
| @@ -2558,13 +2562,18 @@ static inline void sony_init_output_report(struct sony_sc *sc, · 1963 unmodified lines | ||
| 2558 | 2562 | |
| 2559 | 2563 | static inline void sony_cancel_work_sync(struct sony_sc *sc) |
| 2560 | 2564 | { |
| 2565 | + unsigned long flags; | |
| 2566 | + | |
| 2561 | 2567 | if (sc->hotplug_worker_initialized) |
| 2562 | 2568 | cancel_work_sync(&sc->hotplug_worker); |
| 2563 | − if (sc->state_worker_initialized) | |
| 2569 | + if (sc->state_worker_initialized) { | |
| 2570 | + spin_lock_irqsave(&sc->lock, flags); | |
| 2571 | + sc->state_worker_initialized = 0; | |
| 2572 | + spin_unlock_irqrestore(&sc->lock, flags); | |
| 2564 | 2573 | cancel_work_sync(&sc->state_worker); |
| 2574 | + } | |
| 2565 | 2575 | } |
| 2566 | 2576 | |
| 2567 | − | |
| 2568 | 2577 | static int sony_input_configured(struct hid_device *hdev, |
| 2569 | 2578 | struct hid_input *hidinput) |
| 2570 | 2579 | { |
| @@ -22,6 +22,8 @@ · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | #include "hid-ids.h" |
| 24 | 24 | |
| 25 | +#define THRUSTMASTER_DEVICE_ID_2_IN_1_DT 0xb320 | |
| 26 | + | |
| 25 | 27 | static const signed short ff_rumble[] = { |
| 26 | 28 | FF_RUMBLE, |
| 27 | 29 | -1 |
| @@ -76,6 +78,7 @@ static int tmff_play(struct input_dev *dev, void *data, · 48 unmodified lines | ||
| 76 | 78 | struct hid_field *ff_field = tmff->ff_field; |
| 77 | 79 | int x, y; |
| 78 | 80 | int left, right; /* Rumbling */ |
| 81 | + int motor_swap; | |
| 79 | 82 | |
| 80 | 83 | switch (effect->type) { |
| 81 | 84 | case FF_CONSTANT: |
| @@ -100,6 +103,13 @@ static int tmff_play(struct input_dev *dev, void *data, · 18 unmodified lines | ||
| 100 | 103 | ff_field->logical_minimum, |
| 101 | 104 | ff_field->logical_maximum); |
| 102 | 105 | |
| 106 | + /* 2-in-1 strong motor is left */ | |
| 107 | + if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT) { | |
| 108 | + motor_swap = left; | |
| 109 | + left = right; | |
| 110 | + right = motor_swap; | |
| 111 | + } | |
| 112 | + | |
| 103 | 113 | dbg_hid("(left,right)=(%08x, %08x)\n", left, right); |
| 104 | 114 | ff_field->value[0] = left; |
| 105 | 115 | ff_field->value[1] = right; |
| @@ -226,6 +236,8 @@ static const struct hid_device_id tm_devices[] = { · 120 unmodified lines | ||
| 226 | 236 | .driver_data = (unsigned long)ff_rumble }, |
| 227 | 237 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304), /* FireStorm Dual Power 2 (and 3) */ |
| 228 | 238 | .driver_data = (unsigned long)ff_rumble }, |
| 239 | + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, THRUSTMASTER_DEVICE_ID_2_IN_1_DT), /* Dual Trigger 2-in-1 */ | |
| 240 | + .driver_data = (unsigned long)ff_rumble }, | |
| 229 | 241 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323), /* Dual Trigger 3-in-1 (PC Mode) */ |
| 230 | 242 | .driver_data = (unsigned long)ff_rumble }, |
| 231 | 243 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324), /* Dual Trigger 3-in-1 (PS3 Mode) */ |
| @@ -284,6 +284,14 @@ static int hiddev_open(struct inode *inode, struct file *file) · 283 unmodified lines | ||
| 284 | 284 | spin_unlock_irq(&list->hiddev->list_lock); |
| 285 | 285 | |
| 286 | 286 | mutex_lock(&hiddev->existancelock); |
| 287 | + /* | |
| 288 | + * recheck exist with existance lock held to | |
| 289 | + * avoid opening a disconnected device | |
| 290 | + */ | |
| 291 | + if (!list->hiddev->exist) { | |
| 292 | + res = -ENODEV; | |
| 293 | + goto bail_unlock; | |
| 294 | + } | |
| 287 | 295 | if (!list->hiddev->open++) |
| 288 | 296 | if (list->hiddev->exist) { |
| 289 | 297 | struct hid_device *hid = hiddev->hid; |
| @@ -300,6 +308,10 @@ bail_normal_power: · 10 unmodified lines | ||
| 300 | 308 | hid_hw_power(hid, PM_HINT_NORMAL); |
| 301 | 309 | bail_unlock: |
| 302 | 310 | mutex_unlock(&hiddev->existancelock); |
| 311 | + | |
| 312 | + spin_lock_irq(&list->hiddev->list_lock); | |
| 313 | + list_del(&list->node); | |
| 314 | + spin_unlock_irq(&list->hiddev->list_lock); | |
| 303 | 315 | bail: |
| 304 | 316 | file->private_data = NULL; |
| 305 | 317 | vfree(list); |
| @@ -533,14 +533,14 @@ static int wacom_intuos_pad(struct wacom_wac *wacom) · 532 unmodified lines | ||
| 533 | 533 | */ |
| 534 | 534 | buttons = (data[4] << 1) | (data[3] & 0x01); |
| 535 | 535 | } else if (features->type == CINTIQ_COMPANION_2) { |
| 536 | − /* d-pad right -> data[4] & 0x10 | |
| 537 | − * d-pad up -> data[4] & 0x20 | |
| 538 | − * d-pad left -> data[4] & 0x40 | |
| 539 | − * d-pad down -> data[4] & 0x80 | |
| 540 | − * d-pad center -> data[3] & 0x01 | |
| 536 | + /* d-pad right -> data[2] & 0x10 | |
| 537 | + * d-pad up -> data[2] & 0x20 | |
| 538 | + * d-pad left -> data[2] & 0x40 | |
| 539 | + * d-pad down -> data[2] & 0x80 | |
| 540 | + * d-pad center -> data[1] & 0x01 | |
| 541 | 541 | */ |
| 542 | 542 | buttons = ((data[2] >> 4) << 7) | |
| 543 | − ((data[1] & 0x04) << 6) | | |
| 543 | + ((data[1] & 0x04) << 4) | | |
| 544 | 544 | ((data[2] & 0x0F) << 2) | |
| 545 | 545 | (data[1] & 0x03); |
| 546 | 546 | } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { |
| @@ -343,7 +343,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) · 342 unmodified lines | ||
| 343 | 343 | data->sample_time = MSEC_PER_SEC / 2; |
| 344 | 344 | break; |
| 345 | 345 | case tmp75b: /* not one-shot mode, Conversion rate 37Hz */ |
| 346 | − clr_mask |= 1 << 15 | 0x3 << 13; | |
| 346 | + clr_mask |= 1 << 7 | 0x3 << 5; | |
| 347 | 347 | data->resolution = 12; |
| 348 | 348 | data->sample_time = MSEC_PER_SEC / 37; |
| 349 | 349 | break; |
| @@ -704,7 +704,7 @@ static struct attribute *nct7802_in_attrs[] = { · 703 unmodified lines | ||
| 704 | 704 | &sensor_dev_attr_in3_alarm.dev_attr.attr, |
| 705 | 705 | &sensor_dev_attr_in3_beep.dev_attr.attr, |
| 706 | 706 | |
| 707 | − &sensor_dev_attr_in4_input.dev_attr.attr, /* 17 */ | |
| 707 | + &sensor_dev_attr_in4_input.dev_attr.attr, /* 16 */ | |
| 708 | 708 | &sensor_dev_attr_in4_min.dev_attr.attr, |
| 709 | 709 | &sensor_dev_attr_in4_max.dev_attr.attr, |
| 710 | 710 | &sensor_dev_attr_in4_alarm.dev_attr.attr, |
| @@ -730,9 +730,9 @@ static umode_t nct7802_in_is_visible(struct kobject *kobj, · 19 unmodified lines | ||
| 730 | 730 | |
| 731 | 731 | if (index >= 6 && index < 11 && (reg & 0x03) != 0x03) /* VSEN1 */ |
| 732 | 732 | return 0; |
| 733 | − if (index >= 11 && index < 17 && (reg & 0x0c) != 0x0c) /* VSEN2 */ | |
| 733 | + if (index >= 11 && index < 16 && (reg & 0x0c) != 0x0c) /* VSEN2 */ | |
| 734 | 734 | return 0; |
| 735 | − if (index >= 17 && (reg & 0x30) != 0x30) /* VSEN3 */ | |
| 735 | + if (index >= 16 && (reg & 0x30) != 0x30) /* VSEN3 */ | |
| 736 | 736 | return 0; |
| 737 | 737 | |
| 738 | 738 | return attr->mode; |
| @@ -544,6 +544,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev) · 543 unmodified lines | ||
| 544 | 544 | /* See function coresight_get_sink_by_id() to know where this is used */ |
| 545 | 545 | hash = hashlen_hash(hashlen_string(NULL, name)); |
| 546 | 546 | |
| 547 | + sysfs_attr_init(&ea->attr.attr); | |
| 547 | 548 | ea->attr.attr.name = devm_kstrdup(dev, name, GFP_KERNEL); |
| 548 | 549 | if (!ea->attr.attr.name) |
| 549 | 550 | return -ENOMEM; |
| @@ -142,7 +142,7 @@ static struct at91_twi_pdata sama5d4_config = { · 141 unmodified lines | ||
| 142 | 142 | |
| 143 | 143 | static struct at91_twi_pdata sama5d2_config = { |
| 144 | 144 | .clk_max_div = 7, |
| 145 | − .clk_offset = 4, | |
| 145 | + .clk_offset = 3, | |
| 146 | 146 | .has_unre_flag = true, |
| 147 | 147 | .has_alt_cmd = true, |
| 148 | 148 | .has_hold_field = true, |
| @@ -122,9 +122,11 @@ static void at91_twi_write_next_byte(struct at91_twi_dev *dev) · 121 unmodified lines | ||
| 122 | 122 | writeb_relaxed(*dev->buf, dev->base + AT91_TWI_THR); |
| 123 | 123 | |
| 124 | 124 | /* send stop when last byte has been written */ |
| 125 | − if (--dev->buf_len == 0) | |
| 125 | + if (--dev->buf_len == 0) { | |
| 126 | 126 | if (!dev->use_alt_cmd) |
| 127 | 127 | at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP); |
| 128 | + at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_TXRDY); | |
| 129 | + } | |
| 128 | 130 | |
| 129 | 131 | dev_dbg(dev->dev, "wrote 0x%x, to go %zu\n", *dev->buf, dev->buf_len); |
| 130 | 132 | |
| @@ -542,9 +544,8 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) · 411 unmodified lines | ||
| 542 | 544 | } else { |
| 543 | 545 | at91_twi_write_next_byte(dev); |
| 544 | 546 | at91_twi_write(dev, AT91_TWI_IER, |
| 545 | − AT91_TWI_TXCOMP | | |
| 546 | − AT91_TWI_NACK | | |
| 547 | − AT91_TWI_TXRDY); | |
| 547 | + AT91_TWI_TXCOMP | AT91_TWI_NACK | | |
| 548 | + (dev->buf_len ? AT91_TWI_TXRDY : 0)); | |
| 548 | 549 | } |
| 549 | 550 | } |
| 550 | 551 | |
| @@ -392,16 +392,18 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, · 391 unmodified lines | ||
| 392 | 392 | static void bcm_iproc_i2c_read_valid_bytes(struct bcm_iproc_i2c_dev *iproc_i2c) |
| 393 | 393 | { |
| 394 | 394 | struct i2c_msg *msg = iproc_i2c->msg; |
| 395 | + uint32_t val; | |
| 395 | 396 | |
| 396 | 397 | /* Read valid data from RX FIFO */ |
| 397 | 398 | while (iproc_i2c->rx_bytes < msg->len) { |
| 398 | − if (!((iproc_i2c_rd_reg(iproc_i2c, M_FIFO_CTRL_OFFSET) >> M_FIFO_RX_CNT_SHIFT) | |
| 399 | − & M_FIFO_RX_CNT_MASK)) | |
| 399 | + val = iproc_i2c_rd_reg(iproc_i2c, M_RX_OFFSET); | |
| 400 | + | |
| 401 | + /* rx fifo empty */ | |
| 402 | + if (!((val >> M_RX_STATUS_SHIFT) & M_RX_STATUS_MASK)) | |
| 400 | 403 | break; |
| 401 | 404 | |
| 402 | 405 | msg->buf[iproc_i2c->rx_bytes] = |
| 403 | − (iproc_i2c_rd_reg(iproc_i2c, M_RX_OFFSET) >> | |
| 404 | − M_RX_DATA_SHIFT) & M_RX_DATA_MASK; | |
| 406 | + (val >> M_RX_DATA_SHIFT) & M_RX_DATA_MASK; | |
| 405 | 407 | iproc_i2c->rx_bytes++; |
| 406 | 408 | } |
| 407 | 409 | } |
| @@ -435,6 +435,7 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat) · 434 unmodified lines | ||
| 435 | 435 | * fall through to the write state, as we will need to |
| 436 | 436 | * send a byte as well |
| 437 | 437 | */ |
| 438 | + /* Fall through */ | |
| 438 | 439 | |
| 439 | 440 | case STATE_WRITE: |
| 440 | 441 | /* |
| @@ -319,7 +319,6 @@ static const struct iio_chan_spec_ext_info cros_ec_accel_legacy_ext_info[] = { · 318 unmodified lines | ||
| 319 | 319 | .modified = 1, \ |
| 320 | 320 | .info_mask_separate = \ |
| 321 | 321 | BIT(IIO_CHAN_INFO_RAW) | \ |
| 322 | − BIT(IIO_CHAN_INFO_SCALE) | \ | |
| 323 | 322 | BIT(IIO_CHAN_INFO_CALIBBIAS), \ |
| 324 | 323 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SCALE), \ |
| 325 | 324 | .ext_info = cros_ec_accel_legacy_ext_info, \ |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/iio/iio.h> |
| 12 | 12 | #include <linux/io.h> |
| 13 | 13 | #include <linux/iopoll.h> |
| 14 | +#include <linux/kernel.h> | |
| 14 | 15 | #include <linux/module.h> |
| 15 | 16 | #include <linux/mutex.h> |
| 16 | 17 | #include <linux/platform_device.h> |
| @@ -22,8 +23,11 @@ · 5 unmodified lines | ||
| 22 | 23 | #define JZ_ADC_REG_ADTCH 0x18 |
| 23 | 24 | #define JZ_ADC_REG_ADBDAT 0x1c |
| 24 | 25 | #define JZ_ADC_REG_ADSDAT 0x20 |
| 26 | +#define JZ_ADC_REG_ADCLK 0x28 | |
| 25 | 27 | |
| 26 | 28 | #define JZ_ADC_REG_CFG_BAT_MD BIT(4) |
| 29 | +#define JZ_ADC_REG_ADCLK_CLKDIV_LSB 0 | |
| 30 | +#define JZ_ADC_REG_ADCLK_CLKDIV10US_LSB 16 | |
| 27 | 31 | |
| 28 | 32 | #define JZ_ADC_AUX_VREF 3300 |
| 29 | 33 | #define JZ_ADC_AUX_VREF_BITS 12 |
| @@ -34,6 +38,8 @@ · 4 unmodified lines | ||
| 34 | 38 | #define JZ4740_ADC_BATTERY_HIGH_VREF (7500 * 0.986) |
| 35 | 39 | #define JZ4740_ADC_BATTERY_HIGH_VREF_BITS 12 |
| 36 | 40 | |
| 41 | +struct ingenic_adc; | |
| 42 | + | |
| 37 | 43 | struct ingenic_adc_soc_data { |
| 38 | 44 | unsigned int battery_high_vref; |
| 39 | 45 | unsigned int battery_high_vref_bits; |
| @@ -41,6 +47,7 @@ struct ingenic_adc_soc_data { · 1 unmodified line | ||
| 41 | 47 | size_t battery_raw_avail_size; |
| 42 | 48 | const int *battery_scale_avail; |
| 43 | 49 | size_t battery_scale_avail_size; |
| 50 | + int (*init_clk_div)(struct device *dev, struct ingenic_adc *adc); | |
| 44 | 51 | }; |
| 45 | 52 | |
| 46 | 53 | struct ingenic_adc { |
| @@ -151,6 +158,42 @@ static const int jz4740_adc_battery_scale_avail[] = { · 104 unmodified lines | ||
| 151 | 158 | JZ_ADC_BATTERY_LOW_VREF, JZ_ADC_BATTERY_LOW_VREF_BITS, |
| 152 | 159 | }; |
| 153 | 160 | |
| 161 | +static int jz4725b_adc_init_clk_div(struct device *dev, struct ingenic_adc *adc) | |
| 162 | +{ | |
| 163 | + struct clk *parent_clk; | |
| 164 | + unsigned long parent_rate, rate; | |
| 165 | + unsigned int div_main, div_10us; | |
| 166 | + | |
| 167 | + parent_clk = clk_get_parent(adc->clk); | |
| 168 | + if (!parent_clk) { | |
| 169 | + dev_err(dev, "ADC clock has no parent\n"); | |
| 170 | + return -ENODEV; | |
| 171 | + } | |
| 172 | + parent_rate = clk_get_rate(parent_clk); | |
| 173 | + | |
| 174 | + /* | |
| 175 | + * The JZ4725B ADC works at 500 kHz to 8 MHz. | |
| 176 | + * We pick the highest rate possible. | |
| 177 | + * In practice we typically get 6 MHz, half of the 12 MHz EXT clock. | |
| 178 | + */ | |
| 179 | + div_main = DIV_ROUND_UP(parent_rate, 8000000); | |
| 180 | + div_main = clamp(div_main, 1u, 64u); | |
| 181 | + rate = parent_rate / div_main; | |
| 182 | + if (rate < 500000 || rate > 8000000) { | |
| 183 | + dev_err(dev, "No valid divider for ADC main clock\n"); | |
| 184 | + return -EINVAL; | |
| 185 | + } | |
| 186 | + | |
| 187 | + /* We also need a divider that produces a 10us clock. */ | |
| 188 | + div_10us = DIV_ROUND_UP(rate, 100000); | |
| 189 | + | |
| 190 | + writel(((div_10us - 1) << JZ_ADC_REG_ADCLK_CLKDIV10US_LSB) | | |
| 191 | + (div_main - 1) << JZ_ADC_REG_ADCLK_CLKDIV_LSB, | |
| 192 | + adc->base + JZ_ADC_REG_ADCLK); | |
| 193 | + | |
| 194 | + return 0; | |
| 195 | +} | |
| 196 | + | |
| 154 | 197 | static const struct ingenic_adc_soc_data jz4725b_adc_soc_data = { |
| 155 | 198 | .battery_high_vref = JZ4725B_ADC_BATTERY_HIGH_VREF, |
| 156 | 199 | .battery_high_vref_bits = JZ4725B_ADC_BATTERY_HIGH_VREF_BITS, |
| @@ -158,6 +201,7 @@ static const struct ingenic_adc_soc_data jz4725b_adc_soc_data = { · 1 unmodified line | ||
| 158 | 201 | .battery_raw_avail_size = ARRAY_SIZE(jz4725b_adc_battery_raw_avail), |
| 159 | 202 | .battery_scale_avail = jz4725b_adc_battery_scale_avail, |
| 160 | 203 | .battery_scale_avail_size = ARRAY_SIZE(jz4725b_adc_battery_scale_avail), |
| 204 | + .init_clk_div = jz4725b_adc_init_clk_div, | |
| 161 | 205 | }; |
| 162 | 206 | |
| 163 | 207 | static const struct ingenic_adc_soc_data jz4740_adc_soc_data = { |
| @@ -167,6 +211,7 @@ static const struct ingenic_adc_soc_data jz4740_adc_soc_data = { · 3 unmodified lines | ||
| 167 | 211 | .battery_raw_avail_size = ARRAY_SIZE(jz4740_adc_battery_raw_avail), |
| 168 | 212 | .battery_scale_avail = jz4740_adc_battery_scale_avail, |
| 169 | 213 | .battery_scale_avail_size = ARRAY_SIZE(jz4740_adc_battery_scale_avail), |
| 214 | + .init_clk_div = NULL, /* no ADCLK register on JZ4740 */ | |
| 170 | 215 | }; |
| 171 | 216 | |
| 172 | 217 | static int ingenic_adc_read_avail(struct iio_dev *iio_dev, |
| @@ -317,6 +362,15 @@ static int ingenic_adc_probe(struct platform_device *pdev) · 144 unmodified lines | ||
| 317 | 362 | return ret; |
| 318 | 363 | } |
| 319 | 364 | |
| 365 | + /* Set clock dividers. */ | |
| 366 | + if (soc_data->init_clk_div) { | |
| 367 | + ret = soc_data->init_clk_div(dev, adc); | |
| 368 | + if (ret) { | |
| 369 | + clk_disable_unprepare(adc->clk); | |
| 370 | + return ret; | |
| 371 | + } | |
| 372 | + } | |
| 373 | + | |
| 320 | 374 | /* Put hardware in a known passive state. */ |
| 321 | 375 | writeb(0x00, adc->base + JZ_ADC_REG_ENABLE); |
| 322 | 376 | writeb(0xff, adc->base + JZ_ADC_REG_CTRL); |
| @@ -83,7 +83,7 @@ · 82 unmodified lines | ||
| 83 | 83 | #define MAX9611_TEMP_MAX_POS 0x7f80 |
| 84 | 84 | #define MAX9611_TEMP_MAX_NEG 0xff80 |
| 85 | 85 | #define MAX9611_TEMP_MIN_NEG 0xd980 |
| 86 | −#define MAX9611_TEMP_MASK GENMASK(7, 15) | |
| 86 | +#define MAX9611_TEMP_MASK GENMASK(15, 7) | |
| 87 | 87 | #define MAX9611_TEMP_SHIFT 0x07 |
| 88 | 88 | #define MAX9611_TEMP_RAW(_r) ((_r) >> MAX9611_TEMP_SHIFT) |
| 89 | 89 | #define MAX9611_TEMP_SCALE_NUM 1000000 |
| @@ -382,7 +382,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) · 381 unmodified lines | ||
| 382 | 382 | dev_err(dev, |
| 383 | 383 | "Only %i channels supported with %pOFn, but reg = <%i>.\n", |
| 384 | 384 | num_channels, child, reg); |
| 385 | − return ret; | |
| 385 | + return -EINVAL; | |
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | |
| @@ -391,7 +391,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) · 2 unmodified lines | ||
| 391 | 391 | dev_err(dev, |
| 392 | 392 | "Channel %i uses different ADC mode than the rest.\n", |
| 393 | 393 | reg); |
| 394 | − return ret; | |
| 394 | + return -EINVAL; | |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /* Channel is valid, grab the regulator. */ |
| @@ -845,6 +845,25 @@ static const struct iio_chan_spec inv_mpu_channels[] = { · 844 unmodified lines | ||
| 845 | 845 | INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_MPU6050_SCAN_ACCL_Z), |
| 846 | 846 | }; |
| 847 | 847 | |
| 848 | +static const unsigned long inv_mpu_scan_masks[] = { | |
| 849 | + /* 3-axis accel */ | |
| 850 | + BIT(INV_MPU6050_SCAN_ACCL_X) | |
| 851 | + | BIT(INV_MPU6050_SCAN_ACCL_Y) | |
| 852 | + | BIT(INV_MPU6050_SCAN_ACCL_Z), | |
| 853 | + /* 3-axis gyro */ | |
| 854 | + BIT(INV_MPU6050_SCAN_GYRO_X) | |
| 855 | + | BIT(INV_MPU6050_SCAN_GYRO_Y) | |
| 856 | + | BIT(INV_MPU6050_SCAN_GYRO_Z), | |
| 857 | + /* 6-axis accel + gyro */ | |
| 858 | + BIT(INV_MPU6050_SCAN_ACCL_X) | |
| 859 | + | BIT(INV_MPU6050_SCAN_ACCL_Y) | |
| 860 | + | BIT(INV_MPU6050_SCAN_ACCL_Z) | |
| 861 | + | BIT(INV_MPU6050_SCAN_GYRO_X) | |
| 862 | + | BIT(INV_MPU6050_SCAN_GYRO_Y) | |
| 863 | + | BIT(INV_MPU6050_SCAN_GYRO_Z), | |
| 864 | + 0, | |
| 865 | +}; | |
| 866 | + | |
| 848 | 867 | static const struct iio_chan_spec inv_icm20602_channels[] = { |
| 849 | 868 | IIO_CHAN_SOFT_TIMESTAMP(INV_ICM20602_SCAN_TIMESTAMP), |
| 850 | 869 | { |
| @@ -871,6 +890,28 @@ static const struct iio_chan_spec inv_icm20602_channels[] = { · 20 unmodified lines | ||
| 871 | 890 | INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_ICM20602_SCAN_ACCL_Z), |
| 872 | 891 | }; |
| 873 | 892 | |
| 893 | +static const unsigned long inv_icm20602_scan_masks[] = { | |
| 894 | + /* 3-axis accel + temp (mandatory) */ | |
| 895 | + BIT(INV_ICM20602_SCAN_ACCL_X) | |
| 896 | + | BIT(INV_ICM20602_SCAN_ACCL_Y) | |
| 897 | + | BIT(INV_ICM20602_SCAN_ACCL_Z) | |
| 898 | + | BIT(INV_ICM20602_SCAN_TEMP), | |
| 899 | + /* 3-axis gyro + temp (mandatory) */ | |
| 900 | + BIT(INV_ICM20602_SCAN_GYRO_X) | |
| 901 | + | BIT(INV_ICM20602_SCAN_GYRO_Y) | |
| 902 | + | BIT(INV_ICM20602_SCAN_GYRO_Z) | |
| 903 | + | BIT(INV_ICM20602_SCAN_TEMP), | |
| 904 | + /* 6-axis accel + gyro + temp (mandatory) */ | |
| 905 | + BIT(INV_ICM20602_SCAN_ACCL_X) | |
| 906 | + | BIT(INV_ICM20602_SCAN_ACCL_Y) | |
| 907 | + | BIT(INV_ICM20602_SCAN_ACCL_Z) | |
| 908 | + | BIT(INV_ICM20602_SCAN_GYRO_X) | |
| 909 | + | BIT(INV_ICM20602_SCAN_GYRO_Y) | |
| 910 | + | BIT(INV_ICM20602_SCAN_GYRO_Z) | |
| 911 | + | BIT(INV_ICM20602_SCAN_TEMP), | |
| 912 | + 0, | |
| 913 | +}; | |
| 914 | + | |
| 874 | 915 | /* |
| 875 | 916 | * The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE and |
| 876 | 917 | * INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by the |
| @@ -1130,9 +1171,11 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, · 253 unmodified lines | ||
| 1130 | 1171 | if (chip_type == INV_ICM20602) { |
| 1131 | 1172 | indio_dev->channels = inv_icm20602_channels; |
| 1132 | 1173 | indio_dev->num_channels = ARRAY_SIZE(inv_icm20602_channels); |
| 1174 | + indio_dev->available_scan_masks = inv_icm20602_scan_masks; | |
| 1133 | 1175 | } else { |
| 1134 | 1176 | indio_dev->channels = inv_mpu_channels; |
| 1135 | 1177 | indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); |
| 1178 | + indio_dev->available_scan_masks = inv_mpu_scan_masks; | |
| 1136 | 1179 | } |
| 1137 | 1180 | |
| 1138 | 1181 | indio_dev->info = &mpu_info; |
| @@ -302,7 +302,9 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev, · 301 unmodified lines | ||
| 302 | 302 | struct ib_udata *udata, |
| 303 | 303 | struct ib_uobject *uobj) |
| 304 | 304 | { |
| 305 | + enum ib_qp_type qp_type = attr->qp_type; | |
| 305 | 306 | struct ib_qp *qp; |
| 307 | + bool is_xrc; | |
| 306 | 308 | |
| 307 | 309 | if (!dev->ops.create_qp) |
| 308 | 310 | return ERR_PTR(-EOPNOTSUPP); |
| @@ -320,7 +322,8 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev, · 11 unmodified lines | ||
| 320 | 322 | * and more importantly they are created internaly by driver, |
| 321 | 323 | * see mlx5 create_dev_resources() as an example. |
| 322 | 324 | */ |
| 323 | − if (attr->qp_type < IB_QPT_XRC_INI) { | |
| 325 | + is_xrc = qp_type == IB_QPT_XRC_INI || qp_type == IB_QPT_XRC_TGT; | |
| 326 | + if ((qp_type < IB_QPT_MAX && !is_xrc) || qp_type == IB_QPT_DRIVER) { | |
| 324 | 327 | qp->res.type = RDMA_RESTRACK_QP; |
| 325 | 328 | if (uobj) |
| 326 | 329 | rdma_restrack_uadd(&qp->res); |
| @@ -393,6 +393,9 @@ u64 rdma_counter_get_hwstat_value(struct ib_device *dev, u8 port, u32 index) · 392 unmodified lines | ||
| 393 | 393 | u64 sum; |
| 394 | 394 | |
| 395 | 395 | port_counter = &dev->port_data[port].port_counter; |
| 396 | + if (!port_counter->hstats) | |
| 397 | + return 0; | |
| 398 | + | |
| 396 | 399 | sum = get_running_counters_hwstat_sum(dev, port, index); |
| 397 | 400 | sum += port_counter->hstats->value[index]; |
| 398 | 401 | |
| @@ -594,7 +597,7 @@ void rdma_counter_init(struct ib_device *dev) · 195 unmodified lines | ||
| 594 | 597 | struct rdma_port_counter *port_counter; |
| 595 | 598 | u32 port; |
| 596 | 599 | |
| 597 | − if (!dev->ops.alloc_hw_stats || !dev->port_data) | |
| 600 | + if (!dev->port_data) | |
| 598 | 601 | return; |
| 599 | 602 | |
| 600 | 603 | rdma_for_each_port(dev, port) { |
| @@ -602,6 +605,9 @@ void rdma_counter_init(struct ib_device *dev) · 1 unmodified line | ||
| 602 | 605 | port_counter->mode.mode = RDMA_COUNTER_MODE_NONE; |
| 603 | 606 | mutex_init(&port_counter->lock); |
| 604 | 607 | |
| 608 | + if (!dev->ops.alloc_hw_stats) | |
| 609 | + continue; | |
| 610 | + | |
| 605 | 611 | port_counter->hstats = dev->ops.alloc_hw_stats(dev, port); |
| 606 | 612 | if (!port_counter->hstats) |
| 607 | 613 | goto fail; |
| @@ -624,9 +630,6 @@ void rdma_counter_release(struct ib_device *dev) · 16 unmodified lines | ||
| 624 | 630 | struct rdma_port_counter *port_counter; |
| 625 | 631 | u32 port; |
| 626 | 632 | |
| 627 | − if (!dev->ops.alloc_hw_stats) | |
| 628 | − return; | |
| 629 | − | |
| 630 | 633 | rdma_for_each_port(dev, port) { |
| 631 | 634 | port_counter = &dev->port_data[port].port_counter; |
| 632 | 635 | kfree(port_counter->hstats); |
| @@ -94,11 +94,17 @@ static DEFINE_XARRAY_FLAGS(devices, XA_FLAGS_ALLOC); · 93 unmodified lines | ||
| 94 | 94 | static DECLARE_RWSEM(devices_rwsem); |
| 95 | 95 | #define DEVICE_REGISTERED XA_MARK_1 |
| 96 | 96 | |
| 97 | −static LIST_HEAD(client_list); | |
| 97 | +static u32 highest_client_id; | |
| 98 | 98 | #define CLIENT_REGISTERED XA_MARK_1 |
| 99 | 99 | static DEFINE_XARRAY_FLAGS(clients, XA_FLAGS_ALLOC); |
| 100 | 100 | static DECLARE_RWSEM(clients_rwsem); |
| 101 | 101 | |
| 102 | +static void ib_client_put(struct ib_client *client) | |
| 103 | +{ | |
| 104 | + if (refcount_dec_and_test(&client->uses)) | |
| 105 | + complete(&client->uses_zero); | |
| 106 | +} | |
| 107 | + | |
| 102 | 108 | /* |
| 103 | 109 | * If client_data is registered then the corresponding client must also still |
| 104 | 110 | * be registered. |
| @@ -660,6 +666,14 @@ static int add_client_context(struct ib_device *device, · 555 unmodified lines | ||
| 660 | 666 | return 0; |
| 661 | 667 | |
| 662 | 668 | down_write(&device->client_data_rwsem); |
| 669 | + /* | |
| 670 | + * So long as the client is registered hold both the client and device | |
| 671 | + * unregistration locks. | |
| 672 | + */ | |
| 673 | + if (!refcount_inc_not_zero(&client->uses)) | |
| 674 | + goto out_unlock; | |
| 675 | + refcount_inc(&device->refcount); | |
| 676 | + | |
| 663 | 677 | /* |
| 664 | 678 | * Another caller to add_client_context got here first and has already |
| 665 | 679 | * completely initialized context. |
| @@ -683,6 +697,9 @@ static int add_client_context(struct ib_device *device, · 17 unmodified lines | ||
| 683 | 697 | return 0; |
| 684 | 698 | |
| 685 | 699 | out: |
| 700 | + ib_device_put(device); | |
| 701 | + ib_client_put(client); | |
| 702 | +out_unlock: | |
| 686 | 703 | up_write(&device->client_data_rwsem); |
| 687 | 704 | return ret; |
| 688 | 705 | } |
| @@ -702,7 +719,7 @@ static void remove_client_context(struct ib_device *device, · 13 unmodified lines | ||
| 702 | 719 | client_data = xa_load(&device->client_data, client_id); |
| 703 | 720 | xa_clear_mark(&device->client_data, client_id, CLIENT_DATA_REGISTERED); |
| 704 | 721 | client = xa_load(&clients, client_id); |
| 705 | − downgrade_write(&device->client_data_rwsem); | |
| 722 | + up_write(&device->client_data_rwsem); | |
| 706 | 723 | |
| 707 | 724 | /* |
| 708 | 725 | * Notice we cannot be holding any exclusive locks when calling the |
| @@ -712,17 +729,13 @@ static void remove_client_context(struct ib_device *device, · 3 unmodified lines | ||
| 712 | 729 | * |
| 713 | 730 | * For this reason clients and drivers should not call the |
| 714 | 731 | * unregistration functions will holdling any locks. |
| 715 | − * | |
| 716 | − * It tempting to drop the client_data_rwsem too, but this is required | |
| 717 | − * to ensure that unregister_client does not return until all clients | |
| 718 | − * are completely unregistered, which is required to avoid module | |
| 719 | − * unloading races. | |
| 720 | 732 | */ |
| 721 | 733 | if (client->remove) |
| 722 | 734 | client->remove(device, client_data); |
| 723 | 735 | |
| 724 | 736 | xa_erase(&device->client_data, client_id); |
| 725 | − up_read(&device->client_data_rwsem); | |
| 737 | + ib_device_put(device); | |
| 738 | + ib_client_put(client); | |
| 726 | 739 | } |
| 727 | 740 | |
| 728 | 741 | static int alloc_port_data(struct ib_device *device) |
| @@ -1224,7 +1237,7 @@ static int setup_device(struct ib_device *device) · 495 unmodified lines | ||
| 1224 | 1237 | |
| 1225 | 1238 | static void disable_device(struct ib_device *device) |
| 1226 | 1239 | { |
| 1227 | − struct ib_client *client; | |
| 1240 | + u32 cid; | |
| 1228 | 1241 | |
| 1229 | 1242 | WARN_ON(!refcount_read(&device->refcount)); |
| 1230 | 1243 | |
| @@ -1232,10 +1245,19 @@ static void disable_device(struct ib_device *device) · 1 unmodified line | ||
| 1232 | 1245 | xa_clear_mark(&devices, device->index, DEVICE_REGISTERED); |
| 1233 | 1246 | up_write(&devices_rwsem); |
| 1234 | 1247 | |
| 1248 | + /* | |
| 1249 | + * Remove clients in LIFO order, see assign_client_id. This could be | |
| 1250 | + * more efficient if xarray learns to reverse iterate. Since no new | |
| 1251 | + * clients can be added to this ib_device past this point we only need | |
| 1252 | + * the maximum possible client_id value here. | |
| 1253 | + */ | |
| 1235 | 1254 | down_read(&clients_rwsem); |
| 1236 | − list_for_each_entry_reverse(client, &client_list, list) | |
| 1237 | − remove_client_context(device, client->client_id); | |
| 1255 | + cid = highest_client_id; | |
| 1238 | 1256 | up_read(&clients_rwsem); |
| 1257 | + while (cid) { | |
| 1258 | + cid--; | |
| 1259 | + remove_client_context(device, cid); | |
| 1260 | + } | |
| 1239 | 1261 | |
| 1240 | 1262 | /* Pairs with refcount_set in enable_device */ |
| 1241 | 1263 | ib_device_put(device); |
| @@ -1662,30 +1684,31 @@ static int assign_client_id(struct ib_client *client) · 420 unmodified lines | ||
| 1662 | 1684 | /* |
| 1663 | 1685 | * The add/remove callbacks must be called in FIFO/LIFO order. To |
| 1664 | 1686 | * achieve this we assign client_ids so they are sorted in |
| 1665 | − * registration order, and retain a linked list we can reverse iterate | |
| 1666 | − * to get the LIFO order. The extra linked list can go away if xarray | |
| 1667 | − * learns to reverse iterate. | |
| 1687 | + * registration order. | |
| 1668 | 1688 | */ |
| 1669 | − if (list_empty(&client_list)) { | |
| 1670 | − client->client_id = 0; | |
| 1671 | − } else { | |
| 1672 | − struct ib_client *last; | |
| 1673 | − | |
| 1674 | − last = list_last_entry(&client_list, struct ib_client, list); | |
| 1675 | − client->client_id = last->client_id + 1; | |
| 1676 | − } | |
| 1689 | + client->client_id = highest_client_id; | |
| 1677 | 1690 | ret = xa_insert(&clients, client->client_id, client, GFP_KERNEL); |
| 1678 | 1691 | if (ret) |
| 1679 | 1692 | goto out; |
| 1680 | 1693 | |
| 1694 | + highest_client_id++; | |
| 1681 | 1695 | xa_set_mark(&clients, client->client_id, CLIENT_REGISTERED); |
| 1682 | − list_add_tail(&client->list, &client_list); | |
| 1683 | 1696 | |
| 1684 | 1697 | out: |
| 1685 | 1698 | up_write(&clients_rwsem); |
| 1686 | 1699 | return ret; |
| 1687 | 1700 | } |
| 1688 | 1701 | |
| 1702 | +static void remove_client_id(struct ib_client *client) | |
| 1703 | +{ | |
| 1704 | + down_write(&clients_rwsem); | |
| 1705 | + xa_erase(&clients, client->client_id); | |
| 1706 | + for (; highest_client_id; highest_client_id--) | |
| 1707 | + if (xa_load(&clients, highest_client_id - 1)) | |
| 1708 | + break; | |
| 1709 | + up_write(&clients_rwsem); | |
| 1710 | +} | |
| 1711 | + | |
| 1689 | 1712 | /** |
| 1690 | 1713 | * ib_register_client - Register an IB client |
| 1691 | 1714 | * @client:Client to register |
| @@ -1705,6 +1728,8 @@ int ib_register_client(struct ib_client *client) · 13 unmodified lines | ||
| 1705 | 1728 | unsigned long index; |
| 1706 | 1729 | int ret; |
| 1707 | 1730 | |
| 1731 | + refcount_set(&client->uses, 1); | |
| 1732 | + init_completion(&client->uses_zero); | |
| 1708 | 1733 | ret = assign_client_id(client); |
| 1709 | 1734 | if (ret) |
| 1710 | 1735 | return ret; |
| @@ -1740,21 +1765,30 @@ void ib_unregister_client(struct ib_client *client) · 29 unmodified lines | ||
| 1740 | 1765 | unsigned long index; |
| 1741 | 1766 | |
| 1742 | 1767 | down_write(&clients_rwsem); |
| 1768 | + ib_client_put(client); | |
| 1743 | 1769 | xa_clear_mark(&clients, client->client_id, CLIENT_REGISTERED); |
| 1744 | 1770 | up_write(&clients_rwsem); |
| 1745 | − /* | |
| 1746 | − * Every device still known must be serialized to make sure we are | |
| 1747 | − * done with the client callbacks before we return. | |
| 1748 | − */ | |
| 1749 | − down_read(&devices_rwsem); | |
| 1750 | − xa_for_each (&devices, index, device) | |
| 1771 | + | |
| 1772 | + /* We do not want to have locks while calling client->remove() */ | |
| 1773 | + rcu_read_lock(); | |
| 1774 | + xa_for_each (&devices, index, device) { | |
| 1775 | + if (!ib_device_try_get(device)) | |
| 1776 | + continue; | |
| 1777 | + rcu_read_unlock(); | |
| 1778 | + | |
| 1751 | 1779 | remove_client_context(device, client->client_id); |
| 1752 | − up_read(&devices_rwsem); | |
| 1753 | 1780 | |
| 1754 | − down_write(&clients_rwsem); | |
| 1755 | − list_del(&client->list); | |
| 1756 | − xa_erase(&clients, client->client_id); | |
| 1757 | − up_write(&clients_rwsem); | |
| 1781 | + ib_device_put(device); | |
| 1782 | + rcu_read_lock(); | |
| 1783 | + } | |
| 1784 | + rcu_read_unlock(); | |
| 1785 | + | |
| 1786 | + /* | |
| 1787 | + * remove_client_context() is not a fence, it can return even though a | |
| 1788 | + * removal is ongoing. Wait until all removals are completed. | |
| 1789 | + */ | |
| 1790 | + wait_for_completion(&client->uses_zero); | |
| 1791 | + remove_client_id(client); | |
| 1758 | 1792 | } |
| 1759 | 1793 | EXPORT_SYMBOL(ib_unregister_client); |
| 1760 | 1794 | |
| @@ -3224,18 +3224,18 @@ static int ib_mad_port_open(struct ib_device *device, · 3223 unmodified lines | ||
| 3224 | 3224 | if (has_smi) |
| 3225 | 3225 | cq_size *= 2; |
| 3226 | 3226 | |
| 3227 | + port_priv->pd = ib_alloc_pd(device, 0); | |
| 3228 | + if (IS_ERR(port_priv->pd)) { | |
| 3229 | + dev_err(&device->dev, "Couldn't create ib_mad PD\n"); | |
| 3230 | + ret = PTR_ERR(port_priv->pd); | |
| 3231 | + goto error3; | |
| 3232 | + } | |
| 3233 | + | |
| 3227 | 3234 | port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0, |
| 3228 | 3235 | IB_POLL_UNBOUND_WORKQUEUE); |
| 3229 | 3236 | if (IS_ERR(port_priv->cq)) { |
| 3230 | 3237 | dev_err(&device->dev, "Couldn't create ib_mad CQ\n"); |
| 3231 | 3238 | ret = PTR_ERR(port_priv->cq); |
| 3232 | − goto error3; | |
| 3233 | − } | |
| 3234 | − | |
| 3235 | − port_priv->pd = ib_alloc_pd(device, 0); | |
| 3236 | − if (IS_ERR(port_priv->pd)) { | |
| 3237 | − dev_err(&device->dev, "Couldn't create ib_mad PD\n"); | |
| 3238 | − ret = PTR_ERR(port_priv->pd); | |
| 3239 | 3239 | goto error4; |
| 3240 | 3240 | } |
| 3241 | 3241 | |
| @@ -3278,11 +3278,11 @@ error8: · 36 unmodified lines | ||
| 3278 | 3278 | error7: |
| 3279 | 3279 | destroy_mad_qp(&port_priv->qp_info[0]); |
| 3280 | 3280 | error6: |
| 3281 | − ib_dealloc_pd(port_priv->pd); | |
| 3282 | −error4: | |
| 3283 | 3281 | ib_free_cq(port_priv->cq); |
| 3284 | 3282 | cleanup_recv_queue(&port_priv->qp_info[1]); |
| 3285 | 3283 | cleanup_recv_queue(&port_priv->qp_info[0]); |
| 3284 | +error4: | |
| 3285 | + ib_dealloc_pd(port_priv->pd); | |
| 3286 | 3286 | error3: |
| 3287 | 3287 | kfree(port_priv); |
| 3288 | 3288 | |
| @@ -3312,8 +3312,8 @@ static int ib_mad_port_close(struct ib_device *device, int port_num) · 23 unmodified lines | ||
| 3312 | 3312 | destroy_workqueue(port_priv->wq); |
| 3313 | 3313 | destroy_mad_qp(&port_priv->qp_info[1]); |
| 3314 | 3314 | destroy_mad_qp(&port_priv->qp_info[0]); |
| 3315 | − ib_dealloc_pd(port_priv->pd); | |
| 3316 | 3315 | ib_free_cq(port_priv->cq); |
| 3316 | + ib_dealloc_pd(port_priv->pd); | |
| 3317 | 3317 | cleanup_recv_queue(&port_priv->qp_info[1]); |
| 3318 | 3318 | cleanup_recv_queue(&port_priv->qp_info[0]); |
| 3319 | 3319 | /* XXX: Handle deallocation of MAD registration tables */ |
| @@ -49,6 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | #include <linux/sched.h> |
| 50 | 50 | #include <linux/semaphore.h> |
| 51 | 51 | #include <linux/slab.h> |
| 52 | +#include <linux/nospec.h> | |
| 52 | 53 | |
| 53 | 54 | #include <linux/uaccess.h> |
| 54 | 55 | |
| @@ -884,11 +885,14 @@ static int ib_umad_unreg_agent(struct ib_umad_file *file, u32 __user *arg) · 829 unmodified lines | ||
| 884 | 885 | |
| 885 | 886 | if (get_user(id, arg)) |
| 886 | 887 | return -EFAULT; |
| 888 | + if (id >= IB_UMAD_MAX_AGENTS) | |
| 889 | + return -EINVAL; | |
| 887 | 890 | |
| 888 | 891 | mutex_lock(&file->port->file_mutex); |
| 889 | 892 | mutex_lock(&file->mutex); |
| 890 | 893 | |
| 891 | − if (id >= IB_UMAD_MAX_AGENTS || !__get_agent(file, id)) { | |
| 894 | + id = array_index_nospec(id, IB_UMAD_MAX_AGENTS); | |
| 895 | + if (!__get_agent(file, id)) { | |
| 892 | 896 | ret = -EINVAL; |
| 893 | 897 | goto out; |
| 894 | 898 | } |
| @@ -308,6 +308,7 @@ int bnxt_re_del_gid(const struct ib_gid_attr *attr, void **context) · 307 unmodified lines | ||
| 308 | 308 | struct bnxt_re_dev *rdev = to_bnxt_re_dev(attr->device, ibdev); |
| 309 | 309 | struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl; |
| 310 | 310 | struct bnxt_qplib_gid *gid_to_del; |
| 311 | + u16 vlan_id = 0xFFFF; | |
| 311 | 312 | |
| 312 | 313 | /* Delete the entry from the hardware */ |
| 313 | 314 | ctx = *context; |
| @@ -317,7 +318,8 @@ int bnxt_re_del_gid(const struct ib_gid_attr *attr, void **context) · 3 unmodified lines | ||
| 317 | 318 | if (sgid_tbl && sgid_tbl->active) { |
| 318 | 319 | if (ctx->idx >= sgid_tbl->max) |
| 319 | 320 | return -EINVAL; |
| 320 | − gid_to_del = &sgid_tbl->tbl[ctx->idx]; | |
| 321 | + gid_to_del = &sgid_tbl->tbl[ctx->idx].gid; | |
| 322 | + vlan_id = sgid_tbl->tbl[ctx->idx].vlan_id; | |
| 321 | 323 | /* DEL_GID is called in WQ context(netdevice_event_work_handler) |
| 322 | 324 | * or via the ib_unregister_device path. In the former case QP1 |
| 323 | 325 | * may not be destroyed yet, in which case just return as FW |
| @@ -335,7 +337,8 @@ int bnxt_re_del_gid(const struct ib_gid_attr *attr, void **context) · 11 unmodified lines | ||
| 335 | 337 | } |
| 336 | 338 | ctx->refcnt--; |
| 337 | 339 | if (!ctx->refcnt) { |
| 338 | − rc = bnxt_qplib_del_sgid(sgid_tbl, gid_to_del, true); | |
| 340 | + rc = bnxt_qplib_del_sgid(sgid_tbl, gid_to_del, | |
| 341 | + vlan_id, true); | |
| 339 | 342 | if (rc) { |
| 340 | 343 | dev_err(rdev_to_dev(rdev), |
| 341 | 344 | "Failed to remove GID: %#x", rc); |
| @@ -488,7 +488,7 @@ static int bnxt_qplib_alloc_sgid_tbl(struct bnxt_qplib_res *res, · 487 unmodified lines | ||
| 488 | 488 | struct bnxt_qplib_sgid_tbl *sgid_tbl, |
| 489 | 489 | u16 max) |
| 490 | 490 | { |
| 491 | − sgid_tbl->tbl = kcalloc(max, sizeof(struct bnxt_qplib_gid), GFP_KERNEL); | |
| 491 | + sgid_tbl->tbl = kcalloc(max, sizeof(*sgid_tbl->tbl), GFP_KERNEL); | |
| 492 | 492 | if (!sgid_tbl->tbl) |
| 493 | 493 | return -ENOMEM; |
| 494 | 494 | |
| @@ -526,9 +526,10 @@ static void bnxt_qplib_cleanup_sgid_tbl(struct bnxt_qplib_res *res, · 31 unmodified lines | ||
| 526 | 526 | for (i = 0; i < sgid_tbl->max; i++) { |
| 527 | 527 | if (memcmp(&sgid_tbl->tbl[i], &bnxt_qplib_gid_zero, |
| 528 | 528 | sizeof(bnxt_qplib_gid_zero))) |
| 529 | − bnxt_qplib_del_sgid(sgid_tbl, &sgid_tbl->tbl[i], true); | |
| 529 | + bnxt_qplib_del_sgid(sgid_tbl, &sgid_tbl->tbl[i].gid, | |
| 530 | + sgid_tbl->tbl[i].vlan_id, true); | |
| 530 | 531 | } |
| 531 | − memset(sgid_tbl->tbl, 0, sizeof(struct bnxt_qplib_gid) * sgid_tbl->max); | |
| 532 | + memset(sgid_tbl->tbl, 0, sizeof(*sgid_tbl->tbl) * sgid_tbl->max); | |
| 532 | 533 | memset(sgid_tbl->hw_id, -1, sizeof(u16) * sgid_tbl->max); |
| 533 | 534 | memset(sgid_tbl->vlan, 0, sizeof(u8) * sgid_tbl->max); |
| 534 | 535 | sgid_tbl->active = 0; |
| @@ -537,7 +538,11 @@ static void bnxt_qplib_cleanup_sgid_tbl(struct bnxt_qplib_res *res, · 2 unmodified lines | ||
| 537 | 538 | static void bnxt_qplib_init_sgid_tbl(struct bnxt_qplib_sgid_tbl *sgid_tbl, |
| 538 | 539 | struct net_device *netdev) |
| 539 | 540 | { |
| 540 | − memset(sgid_tbl->tbl, 0, sizeof(struct bnxt_qplib_gid) * sgid_tbl->max); | |
| 541 | + u32 i; | |
| 542 | + | |
| 543 | + for (i = 0; i < sgid_tbl->max; i++) | |
| 544 | + sgid_tbl->tbl[i].vlan_id = 0xffff; | |
| 545 | + | |
| 541 | 546 | memset(sgid_tbl->hw_id, -1, sizeof(u16) * sgid_tbl->max); |
| 542 | 547 | } |
| 543 | 548 | |
| @@ -111,7 +111,7 @@ struct bnxt_qplib_pd_tbl { · 110 unmodified lines | ||
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | 113 | struct bnxt_qplib_sgid_tbl { |
| 114 | − struct bnxt_qplib_gid *tbl; | |
| 114 | + struct bnxt_qplib_gid_info *tbl; | |
| 115 | 115 | u16 *hw_id; |
| 116 | 116 | u16 max; |
| 117 | 117 | u16 active; |
| @@ -213,12 +213,12 @@ int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res, · 212 unmodified lines | ||
| 213 | 213 | index, sgid_tbl->max); |
| 214 | 214 | return -EINVAL; |
| 215 | 215 | } |
| 216 | − memcpy(gid, &sgid_tbl->tbl[index], sizeof(*gid)); | |
| 216 | + memcpy(gid, &sgid_tbl->tbl[index].gid, sizeof(*gid)); | |
| 217 | 217 | return 0; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, |
| 221 | − struct bnxt_qplib_gid *gid, bool update) | |
| 221 | + struct bnxt_qplib_gid *gid, u16 vlan_id, bool update) | |
| 222 | 222 | { |
| 223 | 223 | struct bnxt_qplib_res *res = to_bnxt_qplib(sgid_tbl, |
| 224 | 224 | struct bnxt_qplib_res, |
| @@ -236,7 +236,8 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 11 unmodified lines | ||
| 236 | 236 | return -ENOMEM; |
| 237 | 237 | } |
| 238 | 238 | for (index = 0; index < sgid_tbl->max; index++) { |
| 239 | − if (!memcmp(&sgid_tbl->tbl[index], gid, sizeof(*gid))) | |
| 239 | + if (!memcmp(&sgid_tbl->tbl[index].gid, gid, sizeof(*gid)) && | |
| 240 | + vlan_id == sgid_tbl->tbl[index].vlan_id) | |
| 240 | 241 | break; |
| 241 | 242 | } |
| 242 | 243 | if (index == sgid_tbl->max) { |
| @@ -262,8 +263,9 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 19 unmodified lines | ||
| 262 | 263 | if (rc) |
| 263 | 264 | return rc; |
| 264 | 265 | } |
| 265 | − memcpy(&sgid_tbl->tbl[index], &bnxt_qplib_gid_zero, | |
| 266 | + memcpy(&sgid_tbl->tbl[index].gid, &bnxt_qplib_gid_zero, | |
| 266 | 267 | sizeof(bnxt_qplib_gid_zero)); |
| 268 | + sgid_tbl->tbl[index].vlan_id = 0xFFFF; | |
| 267 | 269 | sgid_tbl->vlan[index] = 0; |
| 268 | 270 | sgid_tbl->active--; |
| 269 | 271 | dev_dbg(&res->pdev->dev, |
| @@ -296,7 +298,8 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 26 unmodified lines | ||
| 296 | 298 | } |
| 297 | 299 | free_idx = sgid_tbl->max; |
| 298 | 300 | for (i = 0; i < sgid_tbl->max; i++) { |
| 299 | − if (!memcmp(&sgid_tbl->tbl[i], gid, sizeof(*gid))) { | |
| 301 | + if (!memcmp(&sgid_tbl->tbl[i], gid, sizeof(*gid)) && | |
| 302 | + sgid_tbl->tbl[i].vlan_id == vlan_id) { | |
| 300 | 303 | dev_dbg(&res->pdev->dev, |
| 301 | 304 | "SGID entry already exist in entry %d!\n", i); |
| 302 | 305 | *index = i; |
| @@ -351,6 +354,7 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 48 unmodified lines | ||
| 351 | 354 | } |
| 352 | 355 | /* Add GID to the sgid_tbl */ |
| 353 | 356 | memcpy(&sgid_tbl->tbl[free_idx], gid, sizeof(*gid)); |
| 357 | + sgid_tbl->tbl[free_idx].vlan_id = vlan_id; | |
| 354 | 358 | sgid_tbl->active++; |
| 355 | 359 | if (vlan_id != 0xFFFF) |
| 356 | 360 | sgid_tbl->vlan[free_idx] = 1; |
| @@ -84,6 +84,11 @@ struct bnxt_qplib_gid { · 83 unmodified lines | ||
| 84 | 84 | u8 data[16]; |
| 85 | 85 | }; |
| 86 | 86 | |
| 87 | +struct bnxt_qplib_gid_info { | |
| 88 | + struct bnxt_qplib_gid gid; | |
| 89 | + u16 vlan_id; | |
| 90 | +}; | |
| 91 | + | |
| 87 | 92 | struct bnxt_qplib_ah { |
| 88 | 93 | struct bnxt_qplib_gid dgid; |
| 89 | 94 | struct bnxt_qplib_pd *pd; |
| @@ -221,7 +226,7 @@ int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res, · 131 unmodified lines | ||
| 221 | 226 | struct bnxt_qplib_sgid_tbl *sgid_tbl, int index, |
| 222 | 227 | struct bnxt_qplib_gid *gid); |
| 223 | 228 | int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, |
| 224 | − struct bnxt_qplib_gid *gid, bool update); | |
| 229 | + struct bnxt_qplib_gid *gid, u16 vlan_id, bool update); | |
| 225 | 230 | int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, |
| 226 | 231 | struct bnxt_qplib_gid *gid, u8 *mac, u16 vlan_id, |
| 227 | 232 | bool update, u32 *index); |
| @@ -14452,7 +14452,7 @@ void hfi1_deinit_vnic_rsm(struct hfi1_devdata *dd) · 14451 unmodified lines | ||
| 14452 | 14452 | clear_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK); |
| 14453 | 14453 | } |
| 14454 | 14454 | |
| 14455 | −static void init_rxe(struct hfi1_devdata *dd) | |
| 14455 | +static int init_rxe(struct hfi1_devdata *dd) | |
| 14456 | 14456 | { |
| 14457 | 14457 | struct rsm_map_table *rmt; |
| 14458 | 14458 | u64 val; |
| @@ -14461,6 +14461,9 @@ static void init_rxe(struct hfi1_devdata *dd) · 2 unmodified lines | ||
| 14461 | 14461 | write_csr(dd, RCV_ERR_MASK, ~0ull); |
| 14462 | 14462 | |
| 14463 | 14463 | rmt = alloc_rsm_map_table(dd); |
| 14464 | + if (!rmt) | |
| 14465 | + return -ENOMEM; | |
| 14466 | + | |
| 14464 | 14467 | /* set up QOS, including the QPN map table */ |
| 14465 | 14468 | init_qos(dd, rmt); |
| 14466 | 14469 | init_fecn_handling(dd, rmt); |
| @@ -14487,6 +14490,7 @@ static void init_rxe(struct hfi1_devdata *dd) · 20 unmodified lines | ||
| 14487 | 14490 | val |= ((4ull & RCV_BYPASS_HDR_SIZE_MASK) << |
| 14488 | 14491 | RCV_BYPASS_HDR_SIZE_SHIFT); |
| 14489 | 14492 | write_csr(dd, RCV_BYPASS, val); |
| 14493 | + return 0; | |
| 14490 | 14494 | } |
| 14491 | 14495 | |
| 14492 | 14496 | static void init_other(struct hfi1_devdata *dd) |
| @@ -15024,7 +15028,10 @@ int hfi1_init_dd(struct hfi1_devdata *dd) · 531 unmodified lines | ||
| 15024 | 15028 | goto bail_cleanup; |
| 15025 | 15029 | |
| 15026 | 15030 | /* set initial RXE CSRs */ |
| 15027 | − init_rxe(dd); | |
| 15031 | + ret = init_rxe(dd); | |
| 15032 | + if (ret) | |
| 15033 | + goto bail_cleanup; | |
| 15034 | + | |
| 15028 | 15035 | /* set initial TXE CSRs */ |
| 15029 | 15036 | init_txe(dd); |
| 15030 | 15037 | /* set initial non-RXE, non-TXE CSRs */ |
| @@ -1835,7 +1835,6 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah) · 1834 unmodified lines | ||
| 1835 | 1835 | cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) <= 0) |
| 1836 | 1836 | break; |
| 1837 | 1837 | trdma_clean_swqe(qp, wqe); |
| 1838 | − rvt_qp_wqe_unreserve(qp, wqe); | |
| 1839 | 1838 | trace_hfi1_qp_send_completion(qp, wqe, qp->s_last); |
| 1840 | 1839 | rvt_qp_complete_swqe(qp, |
| 1841 | 1840 | wqe, |
| @@ -1882,7 +1881,6 @@ struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, · 40 unmodified lines | ||
| 1882 | 1881 | if (cmp_psn(wqe->lpsn, qp->s_sending_psn) < 0 || |
| 1883 | 1882 | cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) > 0) { |
| 1884 | 1883 | trdma_clean_swqe(qp, wqe); |
| 1885 | − rvt_qp_wqe_unreserve(qp, wqe); | |
| 1886 | 1884 | trace_hfi1_qp_send_completion(qp, wqe, qp->s_last); |
| 1887 | 1885 | rvt_qp_complete_swqe(qp, |
| 1888 | 1886 | wqe, |
| @@ -1620,6 +1620,7 @@ static int hfi1_kern_exp_rcv_alloc_flows(struct tid_rdma_request *req, · 1619 unmodified lines | ||
| 1620 | 1620 | flows[i].req = req; |
| 1621 | 1621 | flows[i].npagesets = 0; |
| 1622 | 1622 | flows[i].pagesets[0].mapped = 0; |
| 1623 | + flows[i].resync_npkts = 0; | |
| 1623 | 1624 | } |
| 1624 | 1625 | req->flows = flows; |
| 1625 | 1626 | return 0; |
| @@ -1673,34 +1674,6 @@ static struct tid_rdma_flow *find_flow_ib(struct tid_rdma_request *req, · 47 unmodified lines | ||
| 1673 | 1674 | return NULL; |
| 1674 | 1675 | } |
| 1675 | 1676 | |
| 1676 | −static struct tid_rdma_flow * | |
| 1677 | −__find_flow_ranged(struct tid_rdma_request *req, u16 head, u16 tail, | |
| 1678 | − u32 psn, u16 *fidx) | |
| 1679 | −{ | |
| 1680 | − for ( ; CIRC_CNT(head, tail, MAX_FLOWS); | |
| 1681 | − tail = CIRC_NEXT(tail, MAX_FLOWS)) { | |
| 1682 | − struct tid_rdma_flow *flow = &req->flows[tail]; | |
| 1683 | − u32 spsn, lpsn; | |
| 1684 | − | |
| 1685 | − spsn = full_flow_psn(flow, flow->flow_state.spsn); | |
| 1686 | − lpsn = full_flow_psn(flow, flow->flow_state.lpsn); | |
| 1687 | − | |
| 1688 | − if (cmp_psn(psn, spsn) >= 0 && cmp_psn(psn, lpsn) <= 0) { | |
| 1689 | − if (fidx) | |
| 1690 | − *fidx = tail; | |
| 1691 | − return flow; | |
| 1692 | − } | |
| 1693 | − } | |
| 1694 | − return NULL; | |
| 1695 | −} | |
| 1696 | − | |
| 1697 | −static struct tid_rdma_flow *find_flow(struct tid_rdma_request *req, | |
| 1698 | − u32 psn, u16 *fidx) | |
| 1699 | −{ | |
| 1700 | − return __find_flow_ranged(req, req->setup_head, req->clear_tail, psn, | |
| 1701 | − fidx); | |
| 1702 | −} | |
| 1703 | − | |
| 1704 | 1677 | /* TID RDMA READ functions */ |
| 1705 | 1678 | u32 hfi1_build_tid_rdma_read_packet(struct rvt_swqe *wqe, |
| 1706 | 1679 | struct ib_other_headers *ohdr, u32 *bth1, |
| @@ -2788,19 +2761,7 @@ static bool handle_read_kdeth_eflags(struct hfi1_ctxtdata *rcd, · 1081 unmodified lines | ||
| 2788 | 2761 | * to prevent continuous Flow Sequence errors for any |
| 2789 | 2762 | * packets that could be still in the fabric. |
| 2790 | 2763 | */ |
| 2791 | − flow = find_flow(req, psn, NULL); | |
| 2792 | − if (!flow) { | |
| 2793 | − /* | |
| 2794 | − * We can't find the IB PSN matching the | |
| 2795 | − * received KDETH PSN. The only thing we can | |
| 2796 | − * do at this point is report the error to | |
| 2797 | − * the QP. | |
| 2798 | − */ | |
| 2799 | − hfi1_kern_read_tid_flow_free(qp); | |
| 2800 | − spin_unlock(&qp->s_lock); | |
| 2801 | − rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR); | |
| 2802 | − return ret; | |
| 2803 | − } | |
| 2764 | + flow = &req->flows[req->clear_tail]; | |
| 2804 | 2765 | if (priv->s_flags & HFI1_R_TID_SW_PSN) { |
| 2805 | 2766 | diff = cmp_psn(psn, |
| 2806 | 2767 | flow->flow_state.r_next_psn); |
| @@ -54,6 +54,7 @@ · 53 unmodified lines | ||
| 54 | 54 | #include <linux/mm.h> |
| 55 | 55 | #include <linux/vmalloc.h> |
| 56 | 56 | #include <rdma/opa_addr.h> |
| 57 | +#include <linux/nospec.h> | |
| 57 | 58 | |
| 58 | 59 | #include "hfi.h" |
| 59 | 60 | #include "common.h" |
| @@ -1536,6 +1537,7 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr) · 1476 unmodified lines | ||
| 1536 | 1537 | sl = rdma_ah_get_sl(ah_attr); |
| 1537 | 1538 | if (sl >= ARRAY_SIZE(ibp->sl_to_sc)) |
| 1538 | 1539 | return -EINVAL; |
| 1540 | + sl = array_index_nospec(sl, ARRAY_SIZE(ibp->sl_to_sc)); | |
| 1539 | 1541 | |
| 1540 | 1542 | sc5 = ibp->sl_to_sc[sl]; |
| 1541 | 1543 | if (sc_to_vlt(dd, sc5) > num_vls && sc_to_vlt(dd, sc5) != 0xf) |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | config INFINIBAND_HNS |
| 3 | − tristate "HNS RoCE Driver" | |
| 3 | + bool "HNS RoCE Driver" | |
| 4 | 4 | depends on NET_VENDOR_HISILICON |
| 5 | 5 | depends on ARM64 || (COMPILE_TEST && 64BIT) |
| 6 | 6 | ---help--- |
| @@ -11,7 +11,7 @@ config INFINIBAND_HNS · 4 unmodified lines | ||
| 11 | 11 | To compile HIP06 or HIP08 driver as module, choose M here. |
| 12 | 12 | |
| 13 | 13 | config INFINIBAND_HNS_HIP06 |
| 14 | − bool "Hisilicon Hip06 Family RoCE support" | |
| 14 | + tristate "Hisilicon Hip06 Family RoCE support" | |
| 15 | 15 | depends on INFINIBAND_HNS && HNS && HNS_DSAF && HNS_ENET |
| 16 | 16 | ---help--- |
| 17 | 17 | RoCE driver support for Hisilicon RoCE engine in Hisilicon Hip06 and |
| @@ -21,7 +21,7 @@ config INFINIBAND_HNS_HIP06 · 3 unmodified lines | ||
| 21 | 21 | module will be called hns-roce-hw-v1 |
| 22 | 22 | |
| 23 | 23 | config INFINIBAND_HNS_HIP08 |
| 24 | − bool "Hisilicon Hip08 Family RoCE support" | |
| 24 | + tristate "Hisilicon Hip08 Family RoCE support" | |
| 25 | 25 | depends on INFINIBAND_HNS && PCI && HNS3 |
| 26 | 26 | ---help--- |
| 27 | 27 | RoCE driver support for Hisilicon RoCE engine in Hisilicon Hip08 SoC. |
| @@ -9,12 +9,8 @@ hns-roce-objs := hns_roce_main.o hns_roce_cmd.o hns_roce_pd.o \ · 8 unmodified lines | ||
| 9 | 9 | hns_roce_ah.o hns_roce_hem.o hns_roce_mr.o hns_roce_qp.o \ |
| 10 | 10 | hns_roce_cq.o hns_roce_alloc.o hns_roce_db.o hns_roce_srq.o hns_roce_restrack.o |
| 11 | 11 | |
| 12 | −ifdef CONFIG_INFINIBAND_HNS_HIP06 | |
| 13 | 12 | hns-roce-hw-v1-objs := hns_roce_hw_v1.o $(hns-roce-objs) |
| 14 | −obj-$(CONFIG_INFINIBAND_HNS) += hns-roce-hw-v1.o | |
| 15 | −endif | |
| 13 | +obj-$(CONFIG_INFINIBAND_HNS_HIP06) += hns-roce-hw-v1.o | |
| 16 | 14 | |
| 17 | −ifdef CONFIG_INFINIBAND_HNS_HIP08 | |
| 18 | 15 | hns-roce-hw-v2-objs := hns_roce_hw_v2.o hns_roce_hw_v2_dfx.o $(hns-roce-objs) |
| 19 | −obj-$(CONFIG_INFINIBAND_HNS) += hns-roce-hw-v2.o | |
| 20 | −endif | |
| 16 | +obj-$(CONFIG_INFINIBAND_HNS_HIP08) += hns-roce-hw-v2.o | |
| @@ -12,13 +12,15 @@ int hns_roce_db_map_user(struct hns_roce_ucontext *context, · 11 unmodified lines | ||
| 12 | 12 | struct ib_udata *udata, unsigned long virt, |
| 13 | 13 | struct hns_roce_db *db) |
| 14 | 14 | { |
| 15 | + unsigned long page_addr = virt & PAGE_MASK; | |
| 15 | 16 | struct hns_roce_user_db_page *page; |
| 17 | + unsigned int offset; | |
| 16 | 18 | int ret = 0; |
| 17 | 19 | |
| 18 | 20 | mutex_lock(&context->page_mutex); |
| 19 | 21 | |
| 20 | 22 | list_for_each_entry(page, &context->page_list, list) |
| 21 | − if (page->user_virt == (virt & PAGE_MASK)) | |
| 23 | + if (page->user_virt == page_addr) | |
| 22 | 24 | goto found; |
| 23 | 25 | |
| 24 | 26 | page = kmalloc(sizeof(*page), GFP_KERNEL); |
| @@ -28,8 +30,8 @@ int hns_roce_db_map_user(struct hns_roce_ucontext *context, · 3 unmodified lines | ||
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | refcount_set(&page->refcount, 1); |
| 31 | − page->user_virt = (virt & PAGE_MASK); | |
| 32 | − page->umem = ib_umem_get(udata, virt & PAGE_MASK, PAGE_SIZE, 0, 0); | |
| 33 | + page->user_virt = page_addr; | |
| 34 | + page->umem = ib_umem_get(udata, page_addr, PAGE_SIZE, 0, 0); | |
| 33 | 35 | if (IS_ERR(page->umem)) { |
| 34 | 36 | ret = PTR_ERR(page->umem); |
| 35 | 37 | kfree(page); |
| @@ -39,10 +41,9 @@ int hns_roce_db_map_user(struct hns_roce_ucontext *context, · 3 unmodified lines | ||
| 39 | 41 | list_add(&page->list, &context->page_list); |
| 40 | 42 | |
| 41 | 43 | found: |
| 42 | − db->dma = sg_dma_address(page->umem->sg_head.sgl) + | |
| 43 | − (virt & ~PAGE_MASK); | |
| 44 | − page->umem->sg_head.sgl->offset = virt & ~PAGE_MASK; | |
| 45 | − db->virt_addr = sg_virt(page->umem->sg_head.sgl); | |
| 44 | + offset = virt - page_addr; | |
| 45 | + db->dma = sg_dma_address(page->umem->sg_head.sgl) + offset; | |
| 46 | + db->virt_addr = sg_virt(page->umem->sg_head.sgl) + offset; | |
| 46 | 47 | db->u.user_page = page; |
| 47 | 48 | refcount_inc(&page->refcount); |
| 48 | 49 | |
| @@ -750,8 +750,10 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev) · 749 unmodified lines | ||
| 750 | 750 | atomic_set(&free_mr->mr_free_cq->ib_cq.usecnt, 0); |
| 751 | 751 | |
| 752 | 752 | pd = rdma_zalloc_drv_obj(ibdev, ib_pd); |
| 753 | − if (!pd) | |
| 753 | + if (!pd) { | |
| 754 | + ret = -ENOMEM; | |
| 754 | 755 | goto alloc_mem_failed; |
| 756 | + } | |
| 755 | 757 | |
| 756 | 758 | pd->device = ibdev; |
| 757 | 759 | ret = hns_roce_alloc_pd(pd, NULL); |
| @@ -5802,13 +5802,12 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev, · 5801 unmodified lines | ||
| 5802 | 5802 | return; |
| 5803 | 5803 | } |
| 5804 | 5804 | |
| 5805 | − if (mpi->mdev_events.notifier_call) | |
| 5806 | − mlx5_notifier_unregister(mpi->mdev, &mpi->mdev_events); | |
| 5807 | − mpi->mdev_events.notifier_call = NULL; | |
| 5808 | − | |
| 5809 | 5805 | mpi->ibdev = NULL; |
| 5810 | 5806 | |
| 5811 | 5807 | spin_unlock(&port->mp.mpi_lock); |
| 5808 | + if (mpi->mdev_events.notifier_call) | |
| 5809 | + mlx5_notifier_unregister(mpi->mdev, &mpi->mdev_events); | |
| 5810 | + mpi->mdev_events.notifier_call = NULL; | |
| 5812 | 5811 | mlx5_remove_netdev_notifier(ibdev, port_num); |
| 5813 | 5812 | spin_lock(&port->mp.mpi_lock); |
| 5814 | 5813 | |
| @@ -481,6 +481,7 @@ struct mlx5_umr_wr { · 480 unmodified lines | ||
| 481 | 481 | u64 length; |
| 482 | 482 | int access_flags; |
| 483 | 483 | u32 mkey; |
| 484 | + u8 ignore_free_state:1; | |
| 484 | 485 | }; |
| 485 | 486 | |
| 486 | 487 | static inline const struct mlx5_umr_wr *umr_wr(const struct ib_send_wr *wr) |
| @@ -51,22 +51,12 @@ static void clean_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr); · 50 unmodified lines | ||
| 51 | 51 | static void dereg_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr); |
| 52 | 52 | static int mr_cache_max_order(struct mlx5_ib_dev *dev); |
| 53 | 53 | static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr); |
| 54 | −static bool umr_can_modify_entity_size(struct mlx5_ib_dev *dev) | |
| 55 | −{ | |
| 56 | − return !MLX5_CAP_GEN(dev->mdev, umr_modify_entity_size_disabled); | |
| 57 | −} | |
| 58 | 54 | |
| 59 | 55 | static bool umr_can_use_indirect_mkey(struct mlx5_ib_dev *dev) |
| 60 | 56 | { |
| 61 | 57 | return !MLX5_CAP_GEN(dev->mdev, umr_indirect_mkey_disabled); |
| 62 | 58 | } |
| 63 | 59 | |
| 64 | −static bool use_umr(struct mlx5_ib_dev *dev, int order) | |
| 65 | −{ | |
| 66 | − return order <= mr_cache_max_order(dev) && | |
| 67 | − umr_can_modify_entity_size(dev); | |
| 68 | −} | |
| 69 | − | |
| 70 | 60 | static int destroy_mkey(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) |
| 71 | 61 | { |
| 72 | 62 | int err = mlx5_core_destroy_mkey(dev->mdev, &mr->mmkey); |
| @@ -545,13 +535,16 @@ void mlx5_mr_cache_free(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) · 472 unmodified lines | ||
| 545 | 535 | return; |
| 546 | 536 | |
| 547 | 537 | c = order2idx(dev, mr->order); |
| 548 | − if (c < 0 || c >= MAX_MR_CACHE_ENTRIES) { | |
| 549 | − mlx5_ib_warn(dev, "order %d, cache index %d\n", mr->order, c); | |
| 550 | − return; | |
| 551 | − } | |
| 538 | + WARN_ON(c < 0 || c >= MAX_MR_CACHE_ENTRIES); | |
| 552 | 539 | |
| 553 | − if (unreg_umr(dev, mr)) | |
| 540 | + if (unreg_umr(dev, mr)) { | |
| 541 | + mr->allocated_from_cache = false; | |
| 542 | + destroy_mkey(dev, mr); | |
| 543 | + ent = &cache->ent[c]; | |
| 544 | + if (ent->cur < ent->limit) | |
| 545 | + queue_work(cache->wq, &ent->work); | |
| 554 | 546 | return; |
| 547 | + } | |
| 555 | 548 | |
| 556 | 549 | ent = &cache->ent[c]; |
| 557 | 550 | spin_lock_irq(&ent->lock); |
| @@ -1268,7 +1261,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, · 710 unmodified lines | ||
| 1268 | 1261 | { |
| 1269 | 1262 | struct mlx5_ib_dev *dev = to_mdev(pd->device); |
| 1270 | 1263 | struct mlx5_ib_mr *mr = NULL; |
| 1271 | − bool populate_mtts = false; | |
| 1264 | + bool use_umr; | |
| 1272 | 1265 | struct ib_umem *umem; |
| 1273 | 1266 | int page_shift; |
| 1274 | 1267 | int npages; |
| @@ -1300,29 +1293,30 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, · 25 unmodified lines | ||
| 1300 | 1293 | if (err < 0) |
| 1301 | 1294 | return ERR_PTR(err); |
| 1302 | 1295 | |
| 1303 | − if (use_umr(dev, order)) { | |
| 1296 | + use_umr = !MLX5_CAP_GEN(dev->mdev, umr_modify_entity_size_disabled) && | |
| 1297 | + (!MLX5_CAP_GEN(dev->mdev, umr_modify_atomic_disabled) || | |
| 1298 | + !MLX5_CAP_GEN(dev->mdev, atomic)); | |
| 1299 | + | |
| 1300 | + if (order <= mr_cache_max_order(dev) && use_umr) { | |
| 1304 | 1301 | mr = alloc_mr_from_cache(pd, umem, virt_addr, length, ncont, |
| 1305 | 1302 | page_shift, order, access_flags); |
| 1306 | 1303 | if (PTR_ERR(mr) == -EAGAIN) { |
| 1307 | 1304 | mlx5_ib_dbg(dev, "cache empty for order %d\n", order); |
| 1308 | 1305 | mr = NULL; |
| 1309 | 1306 | } |
| 1310 | − populate_mtts = false; | |
| 1311 | 1307 | } else if (!MLX5_CAP_GEN(dev->mdev, umr_extended_translation_offset)) { |
| 1312 | 1308 | if (access_flags & IB_ACCESS_ON_DEMAND) { |
| 1313 | 1309 | err = -EINVAL; |
| 1314 | 1310 | pr_err("Got MR registration for ODP MR > 512MB, not supported for Connect-IB\n"); |
| 1315 | 1311 | goto error; |
| 1316 | 1312 | } |
| 1317 | − populate_mtts = true; | |
| 1313 | + use_umr = false; | |
| 1318 | 1314 | } |
| 1319 | 1315 | |
| 1320 | 1316 | if (!mr) { |
| 1321 | − if (!umr_can_modify_entity_size(dev)) | |
| 1322 | − populate_mtts = true; | |
| 1323 | 1317 | mutex_lock(&dev->slow_path_mutex); |
| 1324 | 1318 | mr = reg_create(NULL, pd, virt_addr, length, umem, ncont, |
| 1325 | − page_shift, access_flags, populate_mtts); | |
| 1319 | + page_shift, access_flags, !use_umr); | |
| 1326 | 1320 | mutex_unlock(&dev->slow_path_mutex); |
| 1327 | 1321 | } |
| 1328 | 1322 | |
| @@ -1338,7 +1332,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, · 9 unmodified lines | ||
| 1338 | 1332 | |
| 1339 | 1333 | update_odp_mr(mr); |
| 1340 | 1334 | |
| 1341 | − if (!populate_mtts) { | |
| 1335 | + if (use_umr) { | |
| 1342 | 1336 | int update_xlt_flags = MLX5_IB_UPD_XLT_ENABLE; |
| 1343 | 1337 | |
| 1344 | 1338 | if (access_flags & IB_ACCESS_ON_DEMAND) |
| @@ -1373,9 +1367,11 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) · 28 unmodified lines | ||
| 1373 | 1367 | return 0; |
| 1374 | 1368 | |
| 1375 | 1369 | umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR | |
| 1376 | − MLX5_IB_SEND_UMR_FAIL_IF_FREE; | |
| 1370 | + MLX5_IB_SEND_UMR_UPDATE_PD_ACCESS; | |
| 1377 | 1371 | umrwr.wr.opcode = MLX5_IB_WR_UMR; |
| 1372 | + umrwr.pd = dev->umrc.pd; | |
| 1378 | 1373 | umrwr.mkey = mr->mmkey.key; |
| 1374 | + umrwr.ignore_free_state = 1; | |
| 1379 | 1375 | |
| 1380 | 1376 | return mlx5_ib_post_send_wait(dev, &umrwr); |
| 1381 | 1377 | } |
| @@ -1577,10 +1573,10 @@ static void clean_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) · 195 unmodified lines | ||
| 1577 | 1573 | mr->sig = NULL; |
| 1578 | 1574 | } |
| 1579 | 1575 | |
| 1580 | − mlx5_free_priv_descs(mr); | |
| 1581 | − | |
| 1582 | − if (!allocated_from_cache) | |
| 1576 | + if (!allocated_from_cache) { | |
| 1583 | 1577 | destroy_mkey(dev, mr); |
| 1578 | + mlx5_free_priv_descs(mr); | |
| 1579 | + } | |
| 1584 | 1580 | } |
| 1585 | 1581 | |
| 1586 | 1582 | static void dereg_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) |
| @@ -246,7 +246,7 @@ void mlx5_ib_invalidate_range(struct ib_umem_odp *umem_odp, unsigned long start, · 245 unmodified lines | ||
| 246 | 246 | * overwrite the same MTTs. Concurent invalidations might race us, |
| 247 | 247 | * but they will write 0s as well, so no difference in the end result. |
| 248 | 248 | */ |
| 249 | − | |
| 249 | + mutex_lock(&umem_odp->umem_mutex); | |
| 250 | 250 | for (addr = start; addr < end; addr += BIT(umem_odp->page_shift)) { |
| 251 | 251 | idx = (addr - ib_umem_start(umem_odp)) >> umem_odp->page_shift; |
| 252 | 252 | /* |
| @@ -278,6 +278,7 @@ void mlx5_ib_invalidate_range(struct ib_umem_odp *umem_odp, unsigned long start, · 25 unmodified lines | ||
| 278 | 278 | idx - blk_start_idx + 1, 0, |
| 279 | 279 | MLX5_IB_UPD_XLT_ZAP | |
| 280 | 280 | MLX5_IB_UPD_XLT_ATOMIC); |
| 281 | + mutex_unlock(&umem_odp->umem_mutex); | |
| 281 | 282 | /* |
| 282 | 283 | * We are now sure that the device will not access the |
| 283 | 284 | * memory. We can safely unmap it, and mark it as dirty if |
| @@ -1771,7 +1772,7 @@ static void mlx5_ib_prefetch_mr_work(struct work_struct *work) · 1487 unmodified lines | ||
| 1771 | 1772 | |
| 1772 | 1773 | num_pending_prefetch_dec(to_mdev(w->pd->device), w->sg_list, |
| 1773 | 1774 | w->num_sge, 0); |
| 1774 | − kfree(w); | |
| 1775 | + kvfree(w); | |
| 1775 | 1776 | } |
| 1776 | 1777 | |
| 1777 | 1778 | int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd, |
| @@ -1813,7 +1814,7 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd, · 35 unmodified lines | ||
| 1813 | 1814 | if (valid_req) |
| 1814 | 1815 | queue_work(system_unbound_wq, &work->work); |
| 1815 | 1816 | else |
| 1816 | − kfree(work); | |
| 1817 | + kvfree(work); | |
| 1817 | 1818 | |
| 1818 | 1819 | srcu_read_unlock(&dev->mr_srcu, srcu_key); |
| 1819 | 1820 | |
| @@ -1713,7 +1713,6 @@ static int create_rss_raw_qp_tir(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, · 1712 unmodified lines | ||
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | 1715 | MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_RX_HASH_FN_TOEPLITZ); |
| 1716 | − MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); | |
| 1717 | 1716 | memcpy(rss_key, ucmd.rx_hash_key, len); |
| 1718 | 1717 | break; |
| 1719 | 1718 | } |
| @@ -4295,10 +4294,14 @@ static int set_reg_umr_segment(struct mlx5_ib_dev *dev, · 2575 unmodified lines | ||
| 4295 | 4294 | |
| 4296 | 4295 | memset(umr, 0, sizeof(*umr)); |
| 4297 | 4296 | |
| 4298 | − if (wr->send_flags & MLX5_IB_SEND_UMR_FAIL_IF_FREE) | |
| 4299 | − umr->flags = MLX5_UMR_CHECK_FREE; /* fail if free */ | |
| 4300 | − else | |
| 4301 | − umr->flags = MLX5_UMR_CHECK_NOT_FREE; /* fail if not free */ | |
| 4297 | + if (!umrwr->ignore_free_state) { | |
| 4298 | + if (wr->send_flags & MLX5_IB_SEND_UMR_FAIL_IF_FREE) | |
| 4299 | + /* fail if free */ | |
| 4300 | + umr->flags = MLX5_UMR_CHECK_FREE; | |
| 4301 | + else | |
| 4302 | + /* fail if not free */ | |
| 4303 | + umr->flags = MLX5_UMR_CHECK_NOT_FREE; | |
| 4304 | + } | |
| 4302 | 4305 | |
| 4303 | 4306 | umr->xlt_octowords = cpu_to_be16(get_xlt_octo(umrwr->xlt_size)); |
| 4304 | 4307 | if (wr->send_flags & MLX5_IB_SEND_UMR_UPDATE_XLT) { |
| @@ -125,14 +125,20 @@ static ssize_t hw_rev_show(struct device *device, struct device_attribute *attr, · 124 unmodified lines | ||
| 125 | 125 | struct qedr_dev *dev = |
| 126 | 126 | rdma_device_to_drv_device(device, struct qedr_dev, ibdev); |
| 127 | 127 | |
| 128 | − return scnprintf(buf, PAGE_SIZE, "0x%x\n", dev->pdev->vendor); | |
| 128 | + return scnprintf(buf, PAGE_SIZE, "0x%x\n", dev->attr.hw_ver); | |
| 129 | 129 | } |
| 130 | 130 | static DEVICE_ATTR_RO(hw_rev); |
| 131 | 131 | |
| 132 | 132 | static ssize_t hca_type_show(struct device *device, |
| 133 | 133 | struct device_attribute *attr, char *buf) |
| 134 | 134 | { |
| 135 | − return scnprintf(buf, PAGE_SIZE, "%s\n", "HCA_TYPE_TO_SET"); | |
| 135 | + struct qedr_dev *dev = | |
| 136 | + rdma_device_to_drv_device(device, struct qedr_dev, ibdev); | |
| 137 | + | |
| 138 | + return scnprintf(buf, PAGE_SIZE, "FastLinQ QL%x %s\n", | |
| 139 | + dev->pdev->device, | |
| 140 | + rdma_protocol_iwarp(&dev->ibdev, 1) ? | |
| 141 | + "iWARP" : "RoCE"); | |
| 136 | 142 | } |
| 137 | 143 | static DEVICE_ATTR_RO(hca_type); |
| 138 | 144 | |
| @@ -220,13 +220,12 @@ static void siw_put_work(struct siw_cm_work *work) · 219 unmodified lines | ||
| 220 | 220 | static void siw_cep_set_inuse(struct siw_cep *cep) |
| 221 | 221 | { |
| 222 | 222 | unsigned long flags; |
| 223 | − int rv; | |
| 224 | 223 | retry: |
| 225 | 224 | spin_lock_irqsave(&cep->lock, flags); |
| 226 | 225 | |
| 227 | 226 | if (cep->in_use) { |
| 228 | 227 | spin_unlock_irqrestore(&cep->lock, flags); |
| 229 | − rv = wait_event_interruptible(cep->waitq, !cep->in_use); | |
| 228 | + wait_event_interruptible(cep->waitq, !cep->in_use); | |
| 230 | 229 | if (signal_pending(current)) |
| 231 | 230 | flush_signals(current); |
| 232 | 231 | goto retry; |
| @@ -612,6 +612,7 @@ static __init int siw_init_module(void) · 611 unmodified lines | ||
| 612 | 612 | |
| 613 | 613 | if (!siw_create_tx_threads()) { |
| 614 | 614 | pr_info("siw: Could not start any TX thread\n"); |
| 615 | + rv = -ENOMEM; | |
| 615 | 616 | goto out_error; |
| 616 | 617 | } |
| 617 | 618 | /* |
| @@ -220,12 +220,14 @@ static int siw_qp_enable_crc(struct siw_qp *qp) · 219 unmodified lines | ||
| 220 | 220 | { |
| 221 | 221 | struct siw_rx_stream *c_rx = &qp->rx_stream; |
| 222 | 222 | struct siw_iwarp_tx *c_tx = &qp->tx_ctx; |
| 223 | − int size = crypto_shash_descsize(siw_crypto_shash) + | |
| 224 | − sizeof(struct shash_desc); | |
| 223 | + int size; | |
| 225 | 224 | |
| 226 | 225 | if (siw_crypto_shash == NULL) |
| 227 | 226 | return -ENOENT; |
| 228 | 227 | |
| 228 | + size = crypto_shash_descsize(siw_crypto_shash) + | |
| 229 | + sizeof(struct shash_desc); | |
| 230 | + | |
| 229 | 231 | c_tx->mpa_crc_hd = kzalloc(size, GFP_KERNEL); |
| 230 | 232 | c_rx->mpa_crc_hd = kzalloc(size, GFP_KERNEL); |
| 231 | 233 | if (!c_tx->mpa_crc_hd || !c_rx->mpa_crc_hd) { |
| @@ -201,7 +201,12 @@ static int iforce_usb_probe(struct usb_interface *intf, · 200 unmodified lines | ||
| 201 | 201 | return -ENODEV; |
| 202 | 202 | |
| 203 | 203 | epirq = &interface->endpoint[0].desc; |
| 204 | + if (!usb_endpoint_is_int_in(epirq)) | |
| 205 | + return -ENODEV; | |
| 206 | + | |
| 204 | 207 | epout = &interface->endpoint[1].desc; |
| 208 | + if (!usb_endpoint_is_int_out(epout)) | |
| 209 | + return -ENODEV; | |
| 205 | 210 | |
| 206 | 211 | iforce_usb = kzalloc(sizeof(*iforce_usb), GFP_KERNEL); |
| 207 | 212 | if (!iforce_usb) |
| @@ -76,6 +76,8 @@ config KEYBOARD_APPLESPI · 75 unmodified lines | ||
| 76 | 76 | depends on ACPI && EFI |
| 77 | 77 | depends on SPI |
| 78 | 78 | depends on X86 || COMPILE_TEST |
| 79 | + depends on LEDS_CLASS | |
| 80 | + select CRC16 | |
| 79 | 81 | help |
| 80 | 82 | Say Y here if you are running Linux on any Apple MacBook8,1 or later, |
| 81 | 83 | or any MacBookPro13,* or MacBookPro14,*. |
| @@ -134,10 +134,10 @@ struct keyboard_protocol { · 133 unmodified lines | ||
| 134 | 134 | * struct tp_finger - single trackpad finger structure, le16-aligned |
| 135 | 135 | * |
| 136 | 136 | * @origin: zero when switching track finger |
| 137 | − * @abs_x: absolute x coodinate | |
| 138 | − * @abs_y: absolute y coodinate | |
| 139 | − * @rel_x: relative x coodinate | |
| 140 | − * @rel_y: relative y coodinate | |
| 137 | + * @abs_x: absolute x coordinate | |
| 138 | + * @abs_y: absolute y coordinate | |
| 139 | + * @rel_x: relative x coordinate | |
| 140 | + * @rel_y: relative y coordinate | |
| 141 | 141 | * @tool_major: tool area, major axis |
| 142 | 142 | * @tool_minor: tool area, minor axis |
| 143 | 143 | * @orientation: 16384 when point, else 15 bit angle |
| @@ -944,10 +944,14 @@ static inline int le16_to_int(__le16 x) · 800 unmodified lines | ||
| 944 | 944 | static void applespi_debug_update_dimensions(struct applespi_data *applespi, |
| 945 | 945 | const struct tp_finger *f) |
| 946 | 946 | { |
| 947 | − applespi->tp_dim_min_x = min_t(int, applespi->tp_dim_min_x, f->abs_x); | |
| 948 | − applespi->tp_dim_max_x = max_t(int, applespi->tp_dim_max_x, f->abs_x); | |
| 949 | − applespi->tp_dim_min_y = min_t(int, applespi->tp_dim_min_y, f->abs_y); | |
| 950 | − applespi->tp_dim_max_y = max_t(int, applespi->tp_dim_max_y, f->abs_y); | |
| 947 | + applespi->tp_dim_min_x = min(applespi->tp_dim_min_x, | |
| 948 | + le16_to_int(f->abs_x)); | |
| 949 | + applespi->tp_dim_max_x = max(applespi->tp_dim_max_x, | |
| 950 | + le16_to_int(f->abs_x)); | |
| 951 | + applespi->tp_dim_min_y = min(applespi->tp_dim_min_y, | |
| 952 | + le16_to_int(f->abs_y)); | |
| 953 | + applespi->tp_dim_max_y = max(applespi->tp_dim_max_y, | |
| 954 | + le16_to_int(f->abs_y)); | |
| 951 | 955 | } |
| 952 | 956 | |
| 953 | 957 | static int applespi_tp_dim_open(struct inode *inode, struct file *file) |
| @@ -1490,8 +1494,7 @@ static void applespi_got_data(struct applespi_data *applespi) · 536 unmodified lines | ||
| 1490 | 1494 | size_t tp_len; |
| 1491 | 1495 | |
| 1492 | 1496 | tp = &message->touchpad; |
| 1493 | − tp_len = sizeof(*tp) + | |
| 1494 | − tp->number_of_fingers * sizeof(tp->fingers[0]); | |
| 1497 | + tp_len = struct_size(tp, fingers, tp->number_of_fingers); | |
| 1495 | 1498 | |
| 1496 | 1499 | if (le16_to_cpu(message->length) + 2 != tp_len) { |
| 1497 | 1500 | dev_warn_ratelimited(&applespi->spi->dev, |
| @@ -1611,8 +1614,8 @@ static void applespi_save_bl_level(struct applespi_data *applespi, · 113 unmodified lines | ||
| 1611 | 1614 | efi_attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | |
| 1612 | 1615 | EFI_VARIABLE_RUNTIME_ACCESS; |
| 1613 | 1616 | |
| 1614 | − sts = efivar_entry_set_safe(EFI_BL_LEVEL_NAME, efi_guid, efi_attr, true, | |
| 1615 | − efi_data_len, &efi_data); | |
| 1617 | + sts = efivar_entry_set_safe((efi_char16_t *)EFI_BL_LEVEL_NAME, efi_guid, | |
| 1618 | + efi_attr, true, efi_data_len, &efi_data); | |
| 1616 | 1619 | if (sts) |
| 1617 | 1620 | dev_warn(&applespi->spi->dev, |
| 1618 | 1621 | "Error saving backlight level to EFI vars: %d\n", sts); |
| @@ -1953,7 +1956,7 @@ static const struct acpi_device_id applespi_acpi_match[] = { · 334 unmodified lines | ||
| 1953 | 1956 | }; |
| 1954 | 1957 | MODULE_DEVICE_TABLE(acpi, applespi_acpi_match); |
| 1955 | 1958 | |
| 1956 | −const struct dev_pm_ops applespi_pm_ops = { | |
| 1959 | +static const struct dev_pm_ops applespi_pm_ops = { | |
| 1957 | 1960 | SET_SYSTEM_SLEEP_PM_OPS(applespi_suspend, applespi_resume) |
| 1958 | 1961 | .poweroff_late = applespi_poweroff_late, |
| 1959 | 1962 | }; |
| @@ -1827,6 +1827,31 @@ static int elantech_create_smbus(struct psmouse *psmouse, · 1826 unmodified lines | ||
| 1827 | 1827 | leave_breadcrumbs); |
| 1828 | 1828 | } |
| 1829 | 1829 | |
| 1830 | +static bool elantech_use_host_notify(struct psmouse *psmouse, | |
| 1831 | + struct elantech_device_info *info) | |
| 1832 | +{ | |
| 1833 | + if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) | |
| 1834 | + return true; | |
| 1835 | + | |
| 1836 | + switch (info->bus) { | |
| 1837 | + case ETP_BUS_PS2_ONLY: | |
| 1838 | + /* expected case */ | |
| 1839 | + break; | |
| 1840 | + case ETP_BUS_SMB_HST_NTFY_ONLY: | |
| 1841 | + case ETP_BUS_PS2_SMB_HST_NTFY: | |
| 1842 | + /* SMbus implementation is stable since 2018 */ | |
| 1843 | + if (dmi_get_bios_year() >= 2018) | |
| 1844 | + return true; | |
| 1845 | + /* fall through */ | |
| 1846 | + default: | |
| 1847 | + psmouse_dbg(psmouse, | |
| 1848 | + "Ignoring SMBus bus provider %d\n", info->bus); | |
| 1849 | + break; | |
| 1850 | + } | |
| 1851 | + | |
| 1852 | + return false; | |
| 1853 | +} | |
| 1854 | + | |
| 1830 | 1855 | /** |
| 1831 | 1856 | * elantech_setup_smbus - called once the PS/2 devices are enumerated |
| 1832 | 1857 | * and decides to instantiate a SMBus InterTouch device. |
| @@ -1846,7 +1871,7 @@ static int elantech_setup_smbus(struct psmouse *psmouse, · 13 unmodified lines | ||
| 1846 | 1871 | * i2c_blacklist_pnp_ids. |
| 1847 | 1872 | * Old ICs are up to the user to decide. |
| 1848 | 1873 | */ |
| 1849 | − if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || | |
| 1874 | + if (!elantech_use_host_notify(psmouse, info) || | |
| 1850 | 1875 | psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids)) |
| 1851 | 1876 | return -ENXIO; |
| 1852 | 1877 | } |
| @@ -1866,34 +1891,6 @@ static int elantech_setup_smbus(struct psmouse *psmouse, · 13 unmodified lines | ||
| 1866 | 1891 | return 0; |
| 1867 | 1892 | } |
| 1868 | 1893 | |
| 1869 | −static bool elantech_use_host_notify(struct psmouse *psmouse, | |
| 1870 | − struct elantech_device_info *info) | |
| 1871 | −{ | |
| 1872 | − if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) | |
| 1873 | − return true; | |
| 1874 | − | |
| 1875 | − switch (info->bus) { | |
| 1876 | − case ETP_BUS_PS2_ONLY: | |
| 1877 | − /* expected case */ | |
| 1878 | − break; | |
| 1879 | − case ETP_BUS_SMB_ALERT_ONLY: | |
| 1880 | − /* fall-through */ | |
| 1881 | − case ETP_BUS_PS2_SMB_ALERT: | |
| 1882 | − psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); | |
| 1883 | − break; | |
| 1884 | − case ETP_BUS_SMB_HST_NTFY_ONLY: | |
| 1885 | − /* fall-through */ | |
| 1886 | − case ETP_BUS_PS2_SMB_HST_NTFY: | |
| 1887 | − return true; | |
| 1888 | − default: | |
| 1889 | − psmouse_dbg(psmouse, | |
| 1890 | − "Ignoring SMBus bus provider %d.\n", | |
| 1891 | − info->bus); | |
| 1892 | − } | |
| 1893 | − | |
| 1894 | − return false; | |
| 1895 | −} | |
| 1896 | − | |
| 1897 | 1894 | int elantech_init_smbus(struct psmouse *psmouse) |
| 1898 | 1895 | { |
| 1899 | 1896 | struct elantech_device_info info; |
| @@ -182,6 +182,7 @@ static const char * const smbus_pnp_ids[] = { · 181 unmodified lines | ||
| 182 | 182 | "LEN2055", /* E580 */ |
| 183 | 183 | "SYN3052", /* HP EliteBook 840 G4 */ |
| 184 | 184 | "SYN3221", /* HP 15-ay000 */ |
| 185 | + "SYN323d", /* HP Spectre X360 13-w013dx */ | |
| 185 | 186 | NULL |
| 186 | 187 | }; |
| 187 | 188 | |
| @@ -117,6 +117,10 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i · 116 unmodified lines | ||
| 117 | 117 | if (intf->cur_altsetting->desc.bNumEndpoints < 1) |
| 118 | 118 | return -ENODEV; |
| 119 | 119 | |
| 120 | + endpoint = &intf->cur_altsetting->endpoint[0].desc; | |
| 121 | + if (!usb_endpoint_is_int_in(endpoint)) | |
| 122 | + return -ENODEV; | |
| 123 | + | |
| 120 | 124 | kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL); |
| 121 | 125 | input_dev = input_allocate_device(); |
| 122 | 126 | if (!kbtab || !input_dev) |
| @@ -155,8 +159,6 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i · 32 unmodified lines | ||
| 155 | 159 | input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0); |
| 156 | 160 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); |
| 157 | 161 | |
| 158 | − endpoint = &intf->cur_altsetting->endpoint[0].desc; | |
| 159 | − | |
| 160 | 162 | usb_fill_int_urb(kbtab->irq, dev, |
| 161 | 163 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), |
| 162 | 164 | kbtab->data, 8, |
| @@ -1659,6 +1659,8 @@ static int usbtouch_probe(struct usb_interface *intf, · 1658 unmodified lines | ||
| 1659 | 1659 | if (!usbtouch || !input_dev) |
| 1660 | 1660 | goto out_free; |
| 1661 | 1661 | |
| 1662 | + mutex_init(&usbtouch->pm_mutex); | |
| 1663 | + | |
| 1662 | 1664 | type = &usbtouch_dev_info[id->driver_info]; |
| 1663 | 1665 | usbtouch->type = type; |
| 1664 | 1666 | if (!type->process_pkt) |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | /* |
| 3 | 3 | * Virtio driver for the paravirtualized IOMMU |
| 4 | 4 | * |
| 5 | − * Copyright (C) 2018 Arm Limited | |
| 5 | + * Copyright (C) 2019 Arm Limited | |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| @@ -47,7 +47,10 @@ struct viommu_dev { · 38 unmodified lines | ||
| 47 | 47 | /* Device configuration */ |
| 48 | 48 | struct iommu_domain_geometry geometry; |
| 49 | 49 | u64 pgsize_bitmap; |
| 50 | − u8 domain_bits; | |
| 50 | + u32 first_domain; | |
| 51 | + u32 last_domain; | |
| 52 | + /* Supported MAP flags */ | |
| 53 | + u32 map_flags; | |
| 51 | 54 | u32 probe_size; |
| 52 | 55 | }; |
| 53 | 56 | |
| @@ -62,6 +65,7 @@ struct viommu_domain { · 8 unmodified lines | ||
| 62 | 65 | struct viommu_dev *viommu; |
| 63 | 66 | struct mutex mutex; /* protects viommu pointer */ |
| 64 | 67 | unsigned int id; |
| 68 | + u32 map_flags; | |
| 65 | 69 | |
| 66 | 70 | spinlock_t mappings_lock; |
| 67 | 71 | struct rb_root_cached mappings; |
| @@ -113,6 +117,8 @@ static int viommu_get_req_errno(void *buf, size_t len) · 45 unmodified lines | ||
| 113 | 117 | return -ENOENT; |
| 114 | 118 | case VIRTIO_IOMMU_S_FAULT: |
| 115 | 119 | return -EFAULT; |
| 120 | + case VIRTIO_IOMMU_S_NOMEM: | |
| 121 | + return -ENOMEM; | |
| 116 | 122 | case VIRTIO_IOMMU_S_IOERR: |
| 117 | 123 | case VIRTIO_IOMMU_S_DEVERR: |
| 118 | 124 | default: |
| @@ -607,15 +613,15 @@ static int viommu_domain_finalise(struct viommu_dev *viommu, · 488 unmodified lines | ||
| 607 | 613 | { |
| 608 | 614 | int ret; |
| 609 | 615 | struct viommu_domain *vdomain = to_viommu_domain(domain); |
| 610 | − unsigned int max_domain = viommu->domain_bits > 31 ? ~0 : | |
| 611 | − (1U << viommu->domain_bits) - 1; | |
| 612 | 616 | |
| 613 | 617 | vdomain->viommu = viommu; |
| 618 | + vdomain->map_flags = viommu->map_flags; | |
| 614 | 619 | |
| 615 | 620 | domain->pgsize_bitmap = viommu->pgsize_bitmap; |
| 616 | 621 | domain->geometry = viommu->geometry; |
| 617 | 622 | |
| 618 | − ret = ida_alloc_max(&viommu->domain_ids, max_domain, GFP_KERNEL); | |
| 623 | + ret = ida_alloc_range(&viommu->domain_ids, viommu->first_domain, | |
| 624 | + viommu->last_domain, GFP_KERNEL); | |
| 619 | 625 | if (ret >= 0) |
| 620 | 626 | vdomain->id = (unsigned int)ret; |
| 621 | 627 | |
| @@ -710,7 +716,7 @@ static int viommu_map(struct iommu_domain *domain, unsigned long iova, · 88 unmodified lines | ||
| 710 | 716 | phys_addr_t paddr, size_t size, int prot) |
| 711 | 717 | { |
| 712 | 718 | int ret; |
| 713 | − int flags; | |
| 719 | + u32 flags; | |
| 714 | 720 | struct virtio_iommu_req_map map; |
| 715 | 721 | struct viommu_domain *vdomain = to_viommu_domain(domain); |
| 716 | 722 | |
| @@ -718,6 +724,9 @@ static int viommu_map(struct iommu_domain *domain, unsigned long iova, · 1 unmodified line | ||
| 718 | 724 | (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) | |
| 719 | 725 | (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0); |
| 720 | 726 | |
| 727 | + if (flags & ~vdomain->map_flags) | |
| 728 | + return -EINVAL; | |
| 729 | + | |
| 721 | 730 | ret = viommu_add_mapping(vdomain, iova, paddr, size, flags); |
| 722 | 731 | if (ret) |
| 723 | 732 | return ret; |
| @@ -1027,7 +1036,8 @@ static int viommu_probe(struct virtio_device *vdev) · 303 unmodified lines | ||
| 1027 | 1036 | goto err_free_vqs; |
| 1028 | 1037 | } |
| 1029 | 1038 | |
| 1030 | − viommu->domain_bits = 32; | |
| 1039 | + viommu->map_flags = VIRTIO_IOMMU_MAP_F_READ | VIRTIO_IOMMU_MAP_F_WRITE; | |
| 1040 | + viommu->last_domain = ~0U; | |
| 1031 | 1041 | |
| 1032 | 1042 | /* Optional features */ |
| 1033 | 1043 | virtio_cread_feature(vdev, VIRTIO_IOMMU_F_INPUT_RANGE, |
| @@ -1038,9 +1048,13 @@ static int viommu_probe(struct virtio_device *vdev) · 4 unmodified lines | ||
| 1038 | 1048 | struct virtio_iommu_config, input_range.end, |
| 1039 | 1049 | &input_end); |
| 1040 | 1050 | |
| 1041 | − virtio_cread_feature(vdev, VIRTIO_IOMMU_F_DOMAIN_BITS, | |
| 1042 | − struct virtio_iommu_config, domain_bits, | |
| 1043 | − &viommu->domain_bits); | |
| 1051 | + virtio_cread_feature(vdev, VIRTIO_IOMMU_F_DOMAIN_RANGE, | |
| 1052 | + struct virtio_iommu_config, domain_range.start, | |
| 1053 | + &viommu->first_domain); | |
| 1054 | + | |
| 1055 | + virtio_cread_feature(vdev, VIRTIO_IOMMU_F_DOMAIN_RANGE, | |
| 1056 | + struct virtio_iommu_config, domain_range.end, | |
| 1057 | + &viommu->last_domain); | |
| 1044 | 1058 | |
| 1045 | 1059 | virtio_cread_feature(vdev, VIRTIO_IOMMU_F_PROBE, |
| 1046 | 1060 | struct virtio_iommu_config, probe_size, |
| @@ -1052,6 +1066,9 @@ static int viommu_probe(struct virtio_device *vdev) · 5 unmodified lines | ||
| 1052 | 1066 | .force_aperture = true, |
| 1053 | 1067 | }; |
| 1054 | 1068 | |
| 1069 | + if (virtio_has_feature(vdev, VIRTIO_IOMMU_F_MMIO)) | |
| 1070 | + viommu->map_flags |= VIRTIO_IOMMU_MAP_F_MMIO; | |
| 1071 | + | |
| 1055 | 1072 | viommu_ops.pgsize_bitmap = viommu->pgsize_bitmap; |
| 1056 | 1073 | |
| 1057 | 1074 | virtio_device_ready(vdev); |
| @@ -1130,9 +1147,10 @@ static void viommu_config_changed(struct virtio_device *vdev) · 72 unmodified lines | ||
| 1130 | 1147 | |
| 1131 | 1148 | static unsigned int features[] = { |
| 1132 | 1149 | VIRTIO_IOMMU_F_MAP_UNMAP, |
| 1133 | − VIRTIO_IOMMU_F_DOMAIN_BITS, | |
| 1134 | 1150 | VIRTIO_IOMMU_F_INPUT_RANGE, |
| 1151 | + VIRTIO_IOMMU_F_DOMAIN_RANGE, | |
| 1135 | 1152 | VIRTIO_IOMMU_F_PROBE, |
| 1153 | + VIRTIO_IOMMU_F_MMIO, | |
| 1136 | 1154 | }; |
| 1137 | 1155 | |
| 1138 | 1156 | static struct virtio_device_id id_table[] = { |
| @@ -3010,7 +3010,7 @@ static int its_vpe_init(struct its_vpe *vpe) · 3009 unmodified lines | ||
| 3010 | 3010 | |
| 3011 | 3011 | if (!its_alloc_vpe_table(vpe_id)) { |
| 3012 | 3012 | its_vpe_id_free(vpe_id); |
| 3013 | − its_free_pending_table(vpe->vpt_page); | |
| 3013 | + its_free_pending_table(vpt_page); | |
| 3014 | 3014 | return -ENOMEM; |
| 3015 | 3015 | } |
| 3016 | 3016 | |
| @@ -771,8 +771,10 @@ static void gic_cpu_sys_reg_init(void) · 770 unmodified lines | ||
| 771 | 771 | case 7: |
| 772 | 772 | write_gicreg(0, ICC_AP0R3_EL1); |
| 773 | 773 | write_gicreg(0, ICC_AP0R2_EL1); |
| 774 | + /* Fall through */ | |
| 774 | 775 | case 6: |
| 775 | 776 | write_gicreg(0, ICC_AP0R1_EL1); |
| 777 | + /* Fall through */ | |
| 776 | 778 | case 5: |
| 777 | 779 | case 4: |
| 778 | 780 | write_gicreg(0, ICC_AP0R0_EL1); |
| @@ -786,8 +788,10 @@ static void gic_cpu_sys_reg_init(void) · 7 unmodified lines | ||
| 786 | 788 | case 7: |
| 787 | 789 | write_gicreg(0, ICC_AP1R3_EL1); |
| 788 | 790 | write_gicreg(0, ICC_AP1R2_EL1); |
| 791 | + /* Fall through */ | |
| 789 | 792 | case 6: |
| 790 | 793 | write_gicreg(0, ICC_AP1R1_EL1); |
| 794 | + /* Fall through */ | |
| 791 | 795 | case 5: |
| 792 | 796 | case 4: |
| 793 | 797 | write_gicreg(0, ICC_AP1R0_EL1); |
| @@ -131,6 +131,7 @@ static struct irq_chip gpcv2_irqchip_data_chip = { · 130 unmodified lines | ||
| 131 | 131 | .irq_unmask = imx_gpcv2_irq_unmask, |
| 132 | 132 | .irq_set_wake = imx_gpcv2_irq_set_wake, |
| 133 | 133 | .irq_retrigger = irq_chip_retrigger_hierarchy, |
| 134 | + .irq_set_type = irq_chip_set_type_parent, | |
| 134 | 135 | #ifdef CONFIG_SMP |
| 135 | 136 | .irq_set_affinity = irq_chip_set_affinity_parent, |
| 136 | 137 | #endif |
| @@ -241,12 +241,15 @@ static int mbigen_of_create_domain(struct platform_device *pdev, · 240 unmodified lines | ||
| 241 | 241 | |
| 242 | 242 | parent = platform_bus_type.dev_root; |
| 243 | 243 | child = of_platform_device_create(np, NULL, parent); |
| 244 | − if (!child) | |
| 244 | + if (!child) { | |
| 245 | + of_node_put(np); | |
| 245 | 246 | return -ENOMEM; |
| 247 | + } | |
| 246 | 248 | |
| 247 | 249 | if (of_property_read_u32(child->dev.of_node, "num-pins", |
| 248 | 250 | &num_pins) < 0) { |
| 249 | 251 | dev_err(&pdev->dev, "No num-pins property\n"); |
| 252 | + of_node_put(np); | |
| 250 | 253 | return -EINVAL; |
| 251 | 254 | } |
| 252 | 255 | |
| @@ -254,8 +257,10 @@ static int mbigen_of_create_domain(struct platform_device *pdev, · 1 unmodified line | ||
| 254 | 257 | mbigen_write_msg, |
| 255 | 258 | &mbigen_domain_ops, |
| 256 | 259 | mgn_chip); |
| 257 | − if (!domain) | |
| 260 | + if (!domain) { | |
| 261 | + of_node_put(np); | |
| 258 | 262 | return -ENOMEM; |
| 263 | + } | |
| 259 | 264 | } |
| 260 | 265 | |
| 261 | 266 | return 0; |
| @@ -1394,6 +1394,7 @@ start_isoc_chain(struct usb_fifo *fifo, int num_packets_per_urb, · 1393 unmodified lines | ||
| 1394 | 1394 | printk(KERN_DEBUG |
| 1395 | 1395 | "%s: %s: alloc urb for fifo %i failed", |
| 1396 | 1396 | hw->name, __func__, fifo->fifonum); |
| 1397 | + continue; | |
| 1397 | 1398 | } |
| 1398 | 1399 | fifo->iso[i].owner_fifo = (struct usb_fifo *) fifo; |
| 1399 | 1400 | fifo->iso[i].indx = i; |
| @@ -1692,13 +1693,23 @@ hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel) · 292 unmodified lines | ||
| 1692 | 1693 | static int |
| 1693 | 1694 | setup_hfcsusb(struct hfcsusb *hw) |
| 1694 | 1695 | { |
| 1696 | + void *dmabuf = kmalloc(sizeof(u_char), GFP_KERNEL); | |
| 1695 | 1697 | u_char b; |
| 1698 | + int ret; | |
| 1696 | 1699 | |
| 1697 | 1700 | if (debug & DBG_HFC_CALL_TRACE) |
| 1698 | 1701 | printk(KERN_DEBUG "%s: %s\n", hw->name, __func__); |
| 1699 | 1702 | |
| 1703 | + if (!dmabuf) | |
| 1704 | + return -ENOMEM; | |
| 1705 | + | |
| 1706 | + ret = read_reg_atomic(hw, HFCUSB_CHIP_ID, dmabuf); | |
| 1707 | + | |
| 1708 | + memcpy(&b, dmabuf, sizeof(u_char)); | |
| 1709 | + kfree(dmabuf); | |
| 1710 | + | |
| 1700 | 1711 | /* check the chip id */ |
| 1701 | − if (read_reg_atomic(hw, HFCUSB_CHIP_ID, &b) != 1) { | |
| 1712 | + if (ret != 1) { | |
| 1702 | 1713 | printk(KERN_DEBUG "%s: %s: cannot read chip id\n", |
| 1703 | 1714 | hw->name, __func__); |
| 1704 | 1715 | return 1; |
| @@ -852,6 +852,7 @@ int smu_queue_i2c(struct smu_i2c_cmd *cmd) · 851 unmodified lines | ||
| 852 | 852 | break; |
| 853 | 853 | case SMU_I2C_TRANSFER_COMBINED: |
| 854 | 854 | cmd->info.devaddr &= 0xfe; |
| 855 | + /* fall through */ | |
| 855 | 856 | case SMU_I2C_TRANSFER_STDSUB: |
| 856 | 857 | if (cmd->info.sublen > 3) |
| 857 | 858 | return -EINVAL; |
| @@ -23,24 +23,28 @@ static const char * const bch_cache_modes[] = { · 22 unmodified lines | ||
| 23 | 23 | "writethrough", |
| 24 | 24 | "writeback", |
| 25 | 25 | "writearound", |
| 26 | − "none" | |
| 26 | + "none", | |
| 27 | + NULL | |
| 27 | 28 | }; |
| 28 | 29 | |
| 29 | 30 | /* Default is 0 ("auto") */ |
| 30 | 31 | static const char * const bch_stop_on_failure_modes[] = { |
| 31 | 32 | "auto", |
| 32 | − "always" | |
| 33 | + "always", | |
| 34 | + NULL | |
| 33 | 35 | }; |
| 34 | 36 | |
| 35 | 37 | static const char * const cache_replacement_policies[] = { |
| 36 | 38 | "lru", |
| 37 | 39 | "fifo", |
| 38 | − "random" | |
| 40 | + "random", | |
| 41 | + NULL | |
| 39 | 42 | }; |
| 40 | 43 | |
| 41 | 44 | static const char * const error_actions[] = { |
| 42 | 45 | "unregister", |
| 43 | − "panic" | |
| 46 | + "panic", | |
| 47 | + NULL | |
| 44 | 48 | }; |
| 45 | 49 | |
| 46 | 50 | write_attribute(attach); |
| @@ -338,7 +342,7 @@ STORE(__cached_dev) · 291 unmodified lines | ||
| 338 | 342 | } |
| 339 | 343 | |
| 340 | 344 | if (attr == &sysfs_cache_mode) { |
| 341 | − v = sysfs_match_string(bch_cache_modes, buf); | |
| 345 | + v = __sysfs_match_string(bch_cache_modes, -1, buf); | |
| 342 | 346 | if (v < 0) |
| 343 | 347 | return v; |
| 344 | 348 | |
| @@ -349,7 +353,7 @@ STORE(__cached_dev) · 4 unmodified lines | ||
| 349 | 353 | } |
| 350 | 354 | |
| 351 | 355 | if (attr == &sysfs_stop_when_cache_set_failed) { |
| 352 | − v = sysfs_match_string(bch_stop_on_failure_modes, buf); | |
| 356 | + v = __sysfs_match_string(bch_stop_on_failure_modes, -1, buf); | |
| 353 | 357 | if (v < 0) |
| 354 | 358 | return v; |
| 355 | 359 | |
| @@ -816,7 +820,7 @@ STORE(__bch_cache_set) · 460 unmodified lines | ||
| 816 | 820 | 0, UINT_MAX); |
| 817 | 821 | |
| 818 | 822 | if (attr == &sysfs_errors) { |
| 819 | − v = sysfs_match_string(error_actions, buf); | |
| 823 | + v = __sysfs_match_string(error_actions, -1, buf); | |
| 820 | 824 | if (v < 0) |
| 821 | 825 | return v; |
| 822 | 826 | |
| @@ -1088,7 +1092,7 @@ STORE(__bch_cache) · 265 unmodified lines | ||
| 1088 | 1092 | } |
| 1089 | 1093 | |
| 1090 | 1094 | if (attr == &sysfs_cache_replacement_policy) { |
| 1091 | − v = sysfs_match_string(cache_replacement_policies, buf); | |
| 1095 | + v = __sysfs_match_string(cache_replacement_policies, -1, buf); | |
| 1092 | 1096 | if (v < 0) |
| 1093 | 1097 | return v; |
| 1094 | 1098 | |
| @@ -882,23 +882,23 @@ EXPORT_SYMBOL_GPL(dm_table_set_type); · 881 unmodified lines | ||
| 882 | 882 | |
| 883 | 883 | /* validate the dax capability of the target device span */ |
| 884 | 884 | int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, |
| 885 | − sector_t start, sector_t len, void *data) | |
| 885 | + sector_t start, sector_t len, void *data) | |
| 886 | 886 | { |
| 887 | 887 | int blocksize = *(int *) data; |
| 888 | 888 | |
| 889 | 889 | return generic_fsdax_supported(dev->dax_dev, dev->bdev, blocksize, |
| 890 | − start, len); | |
| 890 | + start, len); | |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | /* Check devices support synchronous DAX */ |
| 894 | −static int device_synchronous(struct dm_target *ti, struct dm_dev *dev, | |
| 895 | − sector_t start, sector_t len, void *data) | |
| 894 | +static int device_dax_synchronous(struct dm_target *ti, struct dm_dev *dev, | |
| 895 | + sector_t start, sector_t len, void *data) | |
| 896 | 896 | { |
| 897 | − return dax_synchronous(dev->dax_dev); | |
| 897 | + return dev->dax_dev && dax_synchronous(dev->dax_dev); | |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | bool dm_table_supports_dax(struct dm_table *t, |
| 901 | − iterate_devices_callout_fn iterate_fn, int *blocksize) | |
| 901 | + iterate_devices_callout_fn iterate_fn, int *blocksize) | |
| 902 | 902 | { |
| 903 | 903 | struct dm_target *ti; |
| 904 | 904 | unsigned i; |
| @@ -911,7 +911,7 @@ bool dm_table_supports_dax(struct dm_table *t, · 6 unmodified lines | ||
| 911 | 911 | return false; |
| 912 | 912 | |
| 913 | 913 | if (!ti->type->iterate_devices || |
| 914 | − !ti->type->iterate_devices(ti, iterate_fn, blocksize)) | |
| 914 | + !ti->type->iterate_devices(ti, iterate_fn, blocksize)) | |
| 915 | 915 | return false; |
| 916 | 916 | } |
| 917 | 917 | |
| @@ -1921,7 +1921,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, · 1003 unmodified lines | ||
| 1921 | 1921 | |
| 1922 | 1922 | if (dm_table_supports_dax(t, device_supports_dax, &page_size)) { |
| 1923 | 1923 | blk_queue_flag_set(QUEUE_FLAG_DAX, q); |
| 1924 | − if (dm_table_supports_dax(t, device_synchronous, NULL)) | |
| 1924 | + if (dm_table_supports_dax(t, device_dax_synchronous, NULL)) | |
| 1925 | 1925 | set_dax_synchronous(t->md->dax_dev); |
| 1926 | 1926 | } |
| 1927 | 1927 | else |
| @@ -1099,6 +1099,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) · 1098 unmodified lines | ||
| 1099 | 1099 | |
| 1100 | 1100 | /* start creating the vb2 queues */ |
| 1101 | 1101 | if (dev->has_vid_cap) { |
| 1102 | + snprintf(dev->vid_cap_dev.name, sizeof(dev->vid_cap_dev.name), | |
| 1103 | + "vivid-%03d-vid-cap", inst); | |
| 1102 | 1104 | /* initialize vid_cap queue */ |
| 1103 | 1105 | q = &dev->vb_vid_cap_q; |
| 1104 | 1106 | q->type = dev->multiplanar ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : |
| @@ -1122,6 +1124,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) · 17 unmodified lines | ||
| 1122 | 1124 | } |
| 1123 | 1125 | |
| 1124 | 1126 | if (dev->has_vid_out) { |
| 1127 | + snprintf(dev->vid_out_dev.name, sizeof(dev->vid_out_dev.name), | |
| 1128 | + "vivid-%03d-vid-out", inst); | |
| 1125 | 1129 | /* initialize vid_out queue */ |
| 1126 | 1130 | q = &dev->vb_vid_out_q; |
| 1127 | 1131 | q->type = dev->multiplanar ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : |
| @@ -1265,8 +1269,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) · 137 unmodified lines | ||
| 1265 | 1269 | /* finally start creating the device nodes */ |
| 1266 | 1270 | if (dev->has_vid_cap) { |
| 1267 | 1271 | vfd = &dev->vid_cap_dev; |
| 1268 | − snprintf(vfd->name, sizeof(vfd->name), | |
| 1269 | − "vivid-%03d-vid-cap", inst); | |
| 1270 | 1272 | vfd->fops = &vivid_fops; |
| 1271 | 1273 | vfd->ioctl_ops = &vivid_ioctl_ops; |
| 1272 | 1274 | vfd->device_caps = dev->vid_cap_caps; |
| @@ -1312,8 +1314,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) · 39 unmodified lines | ||
| 1312 | 1314 | |
| 1313 | 1315 | if (dev->has_vid_out) { |
| 1314 | 1316 | vfd = &dev->vid_out_dev; |
| 1315 | − snprintf(vfd->name, sizeof(vfd->name), | |
| 1316 | − "vivid-%03d-vid-out", inst); | |
| 1317 | 1317 | vfd->vfl_dir = VFL_DIR_TX; |
| 1318 | 1318 | vfd->fops = &vivid_fops; |
| 1319 | 1319 | vfd->ioctl_ops = &vivid_ioctl_ops; |
| @@ -1590,8 +1590,10 @@ static unsigned long dsiclk_rate(u8 n) · 1589 unmodified lines | ||
| 1590 | 1590 | switch (divsel) { |
| 1591 | 1591 | case PRCM_DSI_PLLOUT_SEL_PHI_4: |
| 1592 | 1592 | div *= 2; |
| 1593 | + /* Fall through */ | |
| 1593 | 1594 | case PRCM_DSI_PLLOUT_SEL_PHI_2: |
| 1594 | 1595 | div *= 2; |
| 1596 | + /* Fall through */ | |
| 1595 | 1597 | case PRCM_DSI_PLLOUT_SEL_PHI: |
| 1596 | 1598 | return pll_rate(PRCM_PLLDSI_FREQ, clock_rate(PRCMU_HDMICLK), |
| 1597 | 1599 | PLL_RAW) / div; |
| @@ -308,7 +308,7 @@ static int usbhs_runtime_resume(struct device *dev) · 307 unmodified lines | ||
| 308 | 308 | i, r); |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | − /* Fall through as HSIC mode needs utmi_clk */ | |
| 311 | + /* Fall through - as HSIC mode needs utmi_clk */ | |
| 312 | 312 | |
| 313 | 313 | case OMAP_EHCI_PORT_MODE_TLL: |
| 314 | 314 | if (!IS_ERR(omap->utmi_clk[i])) { |
| @@ -344,7 +344,7 @@ static int usbhs_runtime_suspend(struct device *dev) · 29 unmodified lines | ||
| 344 | 344 | |
| 345 | 345 | if (!IS_ERR(omap->hsic480m_clk[i])) |
| 346 | 346 | clk_disable_unprepare(omap->hsic480m_clk[i]); |
| 347 | − /* Fall through as utmi_clks were used in HSIC mode */ | |
| 347 | + /* Fall through - as utmi_clks were used in HSIC mode */ | |
| 348 | 348 | |
| 349 | 349 | case OMAP_EHCI_PORT_MODE_TLL: |
| 350 | 350 | if (!IS_ERR(omap->utmi_clk[i])) |
| @@ -685,7 +685,7 @@ static int at24_probe(struct i2c_client *client) · 684 unmodified lines | ||
| 685 | 685 | nvmem_config.name = dev_name(dev); |
| 686 | 686 | nvmem_config.dev = dev; |
| 687 | 687 | nvmem_config.read_only = !writable; |
| 688 | − nvmem_config.root_only = true; | |
| 688 | + nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO); | |
| 689 | 689 | nvmem_config.owner = THIS_MODULE; |
| 690 | 690 | nvmem_config.compat = true; |
| 691 | 691 | nvmem_config.base_dev = dev; |
| @@ -683,7 +683,7 @@ int hl_cs_ioctl(struct hl_fpriv *hpriv, void *data) · 682 unmodified lines | ||
| 683 | 683 | |
| 684 | 684 | rc = hl_poll_timeout_memory(hdev, |
| 685 | 685 | &ctx->thread_ctx_switch_wait_token, tmp, (tmp == 1), |
| 686 | − 100, jiffies_to_usecs(hdev->timeout_jiffies)); | |
| 686 | + 100, jiffies_to_usecs(hdev->timeout_jiffies), false); | |
| 687 | 687 | |
| 688 | 688 | if (rc == -ETIMEDOUT) { |
| 689 | 689 | dev_err(hdev->dev, |
| @@ -24,7 +24,7 @@ int hl_fw_push_fw_to_device(struct hl_device *hdev, const char *fw_name, · 23 unmodified lines | ||
| 24 | 24 | { |
| 25 | 25 | const struct firmware *fw; |
| 26 | 26 | const u64 *fw_data; |
| 27 | − size_t fw_size, i; | |
| 27 | + size_t fw_size; | |
| 28 | 28 | int rc; |
| 29 | 29 | |
| 30 | 30 | rc = request_firmware(&fw, fw_name, hdev->dev); |
| @@ -45,22 +45,7 @@ int hl_fw_push_fw_to_device(struct hl_device *hdev, const char *fw_name, · 14 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | fw_data = (const u64 *) fw->data; |
| 47 | 47 | |
| 48 | − if ((fw->size % 8) != 0) | |
| 49 | − fw_size -= 8; | |
| 50 | − | |
| 51 | − for (i = 0 ; i < fw_size ; i += 8, fw_data++, dst += 8) { | |
| 52 | − if (!(i & (0x80000 - 1))) { | |
| 53 | − dev_dbg(hdev->dev, | |
| 54 | − "copied so far %zu out of %zu for %s firmware", | |
| 55 | − i, fw_size, fw_name); | |
| 56 | − usleep_range(20, 100); | |
| 57 | − } | |
| 58 | − | |
| 59 | − writeq(*fw_data, dst); | |
| 60 | − } | |
| 61 | − | |
| 62 | − if ((fw->size % 8) != 0) | |
| 63 | − writel(*(const u32 *) fw_data, dst); | |
| 48 | + memcpy_toio(dst, fw_data, fw_size); | |
| 64 | 49 | |
| 65 | 50 | out: |
| 66 | 51 | release_firmware(fw); |
| @@ -112,7 +97,8 @@ int hl_fw_send_cpu_message(struct hl_device *hdev, u32 hw_queue_id, u32 *msg, · 45 unmodified lines | ||
| 112 | 97 | } |
| 113 | 98 | |
| 114 | 99 | rc = hl_poll_timeout_memory(hdev, &pkt->fence, tmp, |
| 115 | − (tmp == ARMCP_PACKET_FENCE_VAL), 1000, timeout); | |
| 100 | + (tmp == ARMCP_PACKET_FENCE_VAL), 1000, | |
| 101 | + timeout, true); | |
| 116 | 102 | |
| 117 | 103 | hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id); |
| 118 | 104 | |
| @@ -2864,7 +2864,8 @@ static int goya_send_job_on_qman0(struct hl_device *hdev, struct hl_cs_job *job) · 2863 unmodified lines | ||
| 2864 | 2864 | } |
| 2865 | 2865 | |
| 2866 | 2866 | rc = hl_poll_timeout_memory(hdev, fence_ptr, tmp, |
| 2867 | − (tmp == GOYA_QMAN0_FENCE_VAL), 1000, timeout); | |
| 2867 | + (tmp == GOYA_QMAN0_FENCE_VAL), 1000, | |
| 2868 | + timeout, true); | |
| 2868 | 2869 | |
| 2869 | 2870 | hl_hw_queue_inc_ci_kernel(hdev, GOYA_QUEUE_ID_DMA_0); |
| 2870 | 2871 | |
| @@ -2945,7 +2946,7 @@ int goya_test_queue(struct hl_device *hdev, u32 hw_queue_id) · 74 unmodified lines | ||
| 2945 | 2946 | } |
| 2946 | 2947 | |
| 2947 | 2948 | rc = hl_poll_timeout_memory(hdev, fence_ptr, tmp, (tmp == fence_val), |
| 2948 | − 1000, GOYA_TEST_QUEUE_WAIT_USEC); | |
| 2949 | + 1000, GOYA_TEST_QUEUE_WAIT_USEC, true); | |
| 2949 | 2950 | |
| 2950 | 2951 | hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id); |
| 2951 | 2952 | |
| @@ -1062,9 +1062,17 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val); · 1061 unmodified lines | ||
| 1062 | 1062 | /* |
| 1063 | 1063 | * address in this macro points always to a memory location in the |
| 1064 | 1064 | * host's (server's) memory. That location is updated asynchronously |
| 1065 | − * either by the direct access of the device or by another core | |
| 1065 | + * either by the direct access of the device or by another core. | |
| 1066 | + * | |
| 1067 | + * To work both in LE and BE architectures, we need to distinguish between the | |
| 1068 | + * two states (device or another core updates the memory location). Therefore, | |
| 1069 | + * if mem_written_by_device is true, the host memory being polled will be | |
| 1070 | + * updated directly by the device. If false, the host memory being polled will | |
| 1071 | + * be updated by host CPU. Required so host knows whether or not the memory | |
| 1072 | + * might need to be byte-swapped before returning value to caller. | |
| 1066 | 1073 | */ |
| 1067 | −#define hl_poll_timeout_memory(hdev, addr, val, cond, sleep_us, timeout_us) \ | |
| 1074 | +#define hl_poll_timeout_memory(hdev, addr, val, cond, sleep_us, timeout_us, \ | |
| 1075 | + mem_written_by_device) \ | |
| 1068 | 1076 | ({ \ |
| 1069 | 1077 | ktime_t __timeout; \ |
| 1070 | 1078 | /* timeout should be longer when working with simulator */ \ |
| @@ -1077,10 +1085,14 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val); · 6 unmodified lines | ||
| 1077 | 1085 | /* Verify we read updates done by other cores or by device */ \ |
| 1078 | 1086 | mb(); \ |
| 1079 | 1087 | (val) = *((u32 *) (uintptr_t) (addr)); \ |
| 1088 | + if (mem_written_by_device) \ | |
| 1089 | + (val) = le32_to_cpu(val); \ | |
| 1080 | 1090 | if (cond) \ |
| 1081 | 1091 | break; \ |
| 1082 | 1092 | if (timeout_us && ktime_compare(ktime_get(), __timeout) > 0) { \ |
| 1083 | 1093 | (val) = *((u32 *) (uintptr_t) (addr)); \ |
| 1094 | + if (mem_written_by_device) \ | |
| 1095 | + (val) = le32_to_cpu(val); \ | |
| 1084 | 1096 | break; \ |
| 1085 | 1097 | } \ |
| 1086 | 1098 | if (sleep_us) \ |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <linux/kthread.h> |
| 11 | 11 | #include <linux/scatterlist.h> |
| 12 | 12 | #include <linux/dma-mapping.h> |
| 13 | +#include <linux/backing-dev.h> | |
| 13 | 14 | |
| 14 | 15 | #include <linux/mmc/card.h> |
| 15 | 16 | #include <linux/mmc/host.h> |
| @@ -427,6 +428,10 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card) · 411 unmodified lines | ||
| 427 | 428 | goto free_tag_set; |
| 428 | 429 | } |
| 429 | 430 | |
| 431 | + if (mmc_host_is_spi(host) && host->use_spi_crc) | |
| 432 | + mq->queue->backing_dev_info->capabilities |= | |
| 433 | + BDI_CAP_STABLE_WRITES; | |
| 434 | + | |
| 430 | 435 | mq->queue->queuedata = mq; |
| 431 | 436 | blk_queue_rq_timeout(mq->queue, 60 * HZ); |
| 432 | 437 | |
| @@ -374,6 +374,7 @@ static int finish_dma_single(struct cvm_mmc_host *host, struct mmc_data *data) · 373 unmodified lines | ||
| 374 | 374 | { |
| 375 | 375 | data->bytes_xfered = data->blocks * data->blksz; |
| 376 | 376 | data->error = 0; |
| 377 | + dma_unmap_sg(host->dev, data->sg, data->sg_len, get_dma_dir(data)); | |
| 377 | 378 | return 1; |
| 378 | 379 | } |
| 379 | 380 | |
| @@ -1046,7 +1047,8 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host) · 666 unmodified lines | ||
| 1046 | 1047 | mmc->max_segs = 1; |
| 1047 | 1048 | |
| 1048 | 1049 | /* DMA size field can address up to 8 MB */ |
| 1049 | − mmc->max_seg_size = 8 * 1024 * 1024; | |
| 1050 | + mmc->max_seg_size = min_t(unsigned int, 8 * 1024 * 1024, | |
| 1051 | + dma_get_max_seg_size(host->dev)); | |
| 1050 | 1052 | mmc->max_req_size = mmc->max_seg_size; |
| 1051 | 1053 | /* External DMA is in 512 byte blocks */ |
| 1052 | 1054 | mmc->max_blk_size = 512; |
| @@ -2012,8 +2012,7 @@ static void dw_mci_tasklet_func(unsigned long priv) · 2011 unmodified lines | ||
| 2012 | 2012 | * delayed. Allowing the transfer to take place |
| 2013 | 2013 | * avoids races and keeps things simple. |
| 2014 | 2014 | */ |
| 2015 | − if ((err != -ETIMEDOUT) && | |
| 2016 | − (cmd->opcode == MMC_SEND_TUNING_BLOCK)) { | |
| 2015 | + if (err != -ETIMEDOUT) { | |
| 2017 | 2016 | state = STATE_SENDING_DATA; |
| 2018 | 2017 | continue; |
| 2019 | 2018 | } |
| @@ -73,7 +73,7 @@ · 72 unmodified lines | ||
| 73 | 73 | #define MESON_MX_SDIO_IRQC_IF_CONFIG_MASK GENMASK(7, 6) |
| 74 | 74 | #define MESON_MX_SDIO_IRQC_FORCE_DATA_CLK BIT(8) |
| 75 | 75 | #define MESON_MX_SDIO_IRQC_FORCE_DATA_CMD BIT(9) |
| 76 | − #define MESON_MX_SDIO_IRQC_FORCE_DATA_DAT_MASK GENMASK(10, 13) | |
| 76 | + #define MESON_MX_SDIO_IRQC_FORCE_DATA_DAT_MASK GENMASK(13, 10) | |
| 77 | 77 | #define MESON_MX_SDIO_IRQC_SOFT_RESET BIT(15) |
| 78 | 78 | #define MESON_MX_SDIO_IRQC_FORCE_HALT BIT(30) |
| 79 | 79 | #define MESON_MX_SDIO_IRQC_HALT_HOLE BIT(31) |
| @@ -883,7 +883,7 @@ static int sdhci_acpi_runtime_resume(struct device *dev) · 882 unmodified lines | ||
| 883 | 883 | |
| 884 | 884 | sdhci_acpi_byt_setting(&c->pdev->dev); |
| 885 | 885 | |
| 886 | − return sdhci_runtime_resume_host(c->host); | |
| 886 | + return sdhci_runtime_resume_host(c->host, 0); | |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | #endif |
| @@ -1705,7 +1705,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) · 1704 unmodified lines | ||
| 1705 | 1705 | esdhc_pltfm_set_clock(host, imx_data->actual_clock); |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | − err = sdhci_runtime_resume_host(host); | |
| 1708 | + err = sdhci_runtime_resume_host(host, 0); | |
| 1709 | 1709 | if (err) |
| 1710 | 1710 | goto disable_ipg_clk; |
| 1711 | 1711 | |
| @@ -289,7 +289,7 @@ static int sdhci_at91_runtime_resume(struct device *dev) · 288 unmodified lines | ||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | out: |
| 292 | − return sdhci_runtime_resume_host(host); | |
| 292 | + return sdhci_runtime_resume_host(host, 0); | |
| 293 | 293 | } |
| 294 | 294 | #endif /* CONFIG_PM */ |
| 295 | 295 | |
| @@ -167,7 +167,7 @@ static int sdhci_pci_runtime_suspend_host(struct sdhci_pci_chip *chip) · 166 unmodified lines | ||
| 167 | 167 | |
| 168 | 168 | err_pci_runtime_suspend: |
| 169 | 169 | while (--i >= 0) |
| 170 | − sdhci_runtime_resume_host(chip->slots[i]->host); | |
| 170 | + sdhci_runtime_resume_host(chip->slots[i]->host, 0); | |
| 171 | 171 | return ret; |
| 172 | 172 | } |
| 173 | 173 | |
| @@ -181,7 +181,7 @@ static int sdhci_pci_runtime_resume_host(struct sdhci_pci_chip *chip) · 7 unmodified lines | ||
| 181 | 181 | if (!slot) |
| 182 | 182 | continue; |
| 183 | 183 | |
| 184 | − ret = sdhci_runtime_resume_host(slot->host); | |
| 184 | + ret = sdhci_runtime_resume_host(slot->host, 0); | |
| 185 | 185 | if (ret) |
| 186 | 186 | return ret; |
| 187 | 187 | } |
| @@ -554,7 +554,7 @@ static int sdhci_pxav3_runtime_resume(struct device *dev) · 553 unmodified lines | ||
| 554 | 554 | if (!IS_ERR(pxa->clk_core)) |
| 555 | 555 | clk_prepare_enable(pxa->clk_core); |
| 556 | 556 | |
| 557 | − return sdhci_runtime_resume_host(host); | |
| 557 | + return sdhci_runtime_resume_host(host, 0); | |
| 558 | 558 | } |
| 559 | 559 | #endif |
| 560 | 560 | |
| @@ -745,7 +745,7 @@ static int sdhci_s3c_runtime_resume(struct device *dev) · 744 unmodified lines | ||
| 745 | 745 | clk_prepare_enable(busclk); |
| 746 | 746 | if (ourhost->cur_clk >= 0) |
| 747 | 747 | clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]); |
| 748 | − ret = sdhci_runtime_resume_host(host); | |
| 748 | + ret = sdhci_runtime_resume_host(host, 0); | |
| 749 | 749 | return ret; |
| 750 | 750 | } |
| 751 | 751 | #endif |
| @@ -624,6 +624,7 @@ err_cleanup_host: · 623 unmodified lines | ||
| 624 | 624 | sdhci_cleanup_host(host); |
| 625 | 625 | |
| 626 | 626 | pm_runtime_disable: |
| 627 | + pm_runtime_put_noidle(&pdev->dev); | |
| 627 | 628 | pm_runtime_disable(&pdev->dev); |
| 628 | 629 | pm_runtime_set_suspended(&pdev->dev); |
| 629 | 630 | |
| @@ -695,7 +696,7 @@ static int sdhci_sprd_runtime_resume(struct device *dev) · 65 unmodified lines | ||
| 695 | 696 | if (ret) |
| 696 | 697 | goto clk_disable; |
| 697 | 698 | |
| 698 | − sdhci_runtime_resume_host(host); | |
| 699 | + sdhci_runtime_resume_host(host, 1); | |
| 699 | 700 | return 0; |
| 700 | 701 | |
| 701 | 702 | clk_disable: |
| @@ -638,7 +638,7 @@ static int xenon_runtime_resume(struct device *dev) · 637 unmodified lines | ||
| 638 | 638 | priv->restore_needed = false; |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | − ret = sdhci_runtime_resume_host(host); | |
| 641 | + ret = sdhci_runtime_resume_host(host, 0); | |
| 642 | 642 | if (ret) |
| 643 | 643 | goto out; |
| 644 | 644 | return 0; |
| @@ -3320,7 +3320,7 @@ int sdhci_runtime_suspend_host(struct sdhci_host *host) · 3319 unmodified lines | ||
| 3320 | 3320 | } |
| 3321 | 3321 | EXPORT_SYMBOL_GPL(sdhci_runtime_suspend_host); |
| 3322 | 3322 | |
| 3323 | −int sdhci_runtime_resume_host(struct sdhci_host *host) | |
| 3323 | +int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset) | |
| 3324 | 3324 | { |
| 3325 | 3325 | struct mmc_host *mmc = host->mmc; |
| 3326 | 3326 | unsigned long flags; |
| @@ -3331,7 +3331,7 @@ int sdhci_runtime_resume_host(struct sdhci_host *host) · 4 unmodified lines | ||
| 3331 | 3331 | host->ops->enable_dma(host); |
| 3332 | 3332 | } |
| 3333 | 3333 | |
| 3334 | − sdhci_init(host, 0); | |
| 3334 | + sdhci_init(host, soft_reset); | |
| 3335 | 3335 | |
| 3336 | 3336 | if (mmc->ios.power_mode != MMC_POWER_UNDEFINED && |
| 3337 | 3337 | mmc->ios.power_mode != MMC_POWER_OFF) { |
| @@ -781,7 +781,7 @@ void sdhci_adma_write_desc(struct sdhci_host *host, void **desc, · 780 unmodified lines | ||
| 781 | 781 | int sdhci_suspend_host(struct sdhci_host *host); |
| 782 | 782 | int sdhci_resume_host(struct sdhci_host *host); |
| 783 | 783 | int sdhci_runtime_suspend_host(struct sdhci_host *host); |
| 784 | −int sdhci_runtime_resume_host(struct sdhci_host *host); | |
| 784 | +int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset); | |
| 785 | 785 | #endif |
| 786 | 786 | |
| 787 | 787 | void sdhci_cqe_enable(struct mmc_host *mmc); |
| @@ -14,8 +14,9 @@ if MTD_HYPERBUS · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | config HBMC_AM654 |
| 16 | 16 | tristate "HyperBus controller driver for AM65x SoC" |
| 17 | + depends on ARM64 || COMPILE_TEST | |
| 17 | 18 | select MULTIPLEXER |
| 18 | − select MUX_MMIO | |
| 19 | + imply MUX_MMIO | |
| 19 | 20 | help |
| 20 | 21 | This is the driver for HyperBus controller on TI's AM65x and |
| 21 | 22 | other SoCs |
| @@ -390,6 +390,14 @@ static int micron_supports_on_die_ecc(struct nand_chip *chip) · 389 unmodified lines | ||
| 390 | 390 | (chip->id.data[4] & MICRON_ID_INTERNAL_ECC_MASK) != 0x2) |
| 391 | 391 | return MICRON_ON_DIE_UNSUPPORTED; |
| 392 | 392 | |
| 393 | + /* | |
| 394 | + * It seems that there are devices which do not support ECC officially. | |
| 395 | + * At least the MT29F2G08ABAGA / MT29F2G08ABBGA devices supports | |
| 396 | + * enabling the ECC feature but don't reflect that to the READ_ID table. | |
| 397 | + * So we have to guarantee that we disable the ECC feature directly | |
| 398 | + * after we did the READ_ID table command. Later we can evaluate the | |
| 399 | + * ECC_ENABLE support. | |
| 400 | + */ | |
| 393 | 401 | ret = micron_nand_on_die_ecc_setup(chip, true); |
| 394 | 402 | if (ret) |
| 395 | 403 | return MICRON_ON_DIE_UNSUPPORTED; |
| @@ -398,13 +406,13 @@ static int micron_supports_on_die_ecc(struct nand_chip *chip) · 2 unmodified lines | ||
| 398 | 406 | if (ret) |
| 399 | 407 | return MICRON_ON_DIE_UNSUPPORTED; |
| 400 | 408 | |
| 401 | − if (!(id[4] & MICRON_ID_ECC_ENABLED)) | |
| 402 | − return MICRON_ON_DIE_UNSUPPORTED; | |
| 403 | − | |
| 404 | 409 | ret = micron_nand_on_die_ecc_setup(chip, false); |
| 405 | 410 | if (ret) |
| 406 | 411 | return MICRON_ON_DIE_UNSUPPORTED; |
| 407 | 412 | |
| 413 | + if (!(id[4] & MICRON_ID_ECC_ENABLED)) | |
| 414 | + return MICRON_ON_DIE_UNSUPPORTED; | |
| 415 | + | |
| 408 | 416 | ret = nand_readid_op(chip, 0, id, sizeof(id)); |
| 409 | 417 | if (ret) |
| 410 | 418 | return MICRON_ON_DIE_UNSUPPORTED; |
| @@ -363,10 +363,13 @@ static int __init arcrimi_setup(char *s) · 362 unmodified lines | ||
| 363 | 363 | switch (ints[0]) { |
| 364 | 364 | default: /* ERROR */ |
| 365 | 365 | pr_err("Too many arguments\n"); |
| 366 | + /* Fall through */ | |
| 366 | 367 | case 3: /* Node ID */ |
| 367 | 368 | node = ints[3]; |
| 369 | + /* Fall through */ | |
| 368 | 370 | case 2: /* IRQ */ |
| 369 | 371 | irq = ints[2]; |
| 372 | + /* Fall through */ | |
| 370 | 373 | case 1: /* IO address */ |
| 371 | 374 | io = ints[1]; |
| 372 | 375 | } |
| @@ -197,16 +197,22 @@ static int __init com20020isa_setup(char *s) · 196 unmodified lines | ||
| 197 | 197 | switch (ints[0]) { |
| 198 | 198 | default: /* ERROR */ |
| 199 | 199 | pr_info("Too many arguments\n"); |
| 200 | + /* Fall through */ | |
| 200 | 201 | case 6: /* Timeout */ |
| 201 | 202 | timeout = ints[6]; |
| 203 | + /* Fall through */ | |
| 202 | 204 | case 5: /* CKP value */ |
| 203 | 205 | clockp = ints[5]; |
| 206 | + /* Fall through */ | |
| 204 | 207 | case 4: /* Backplane flag */ |
| 205 | 208 | backplane = ints[4]; |
| 209 | + /* Fall through */ | |
| 206 | 210 | case 3: /* Node ID */ |
| 207 | 211 | node = ints[3]; |
| 212 | + /* Fall through */ | |
| 208 | 213 | case 2: /* IRQ */ |
| 209 | 214 | irq = ints[2]; |
| 215 | + /* Fall through */ | |
| 210 | 216 | case 1: /* IO address */ |
| 211 | 217 | io = ints[1]; |
| 212 | 218 | } |
| @@ -363,8 +363,10 @@ static int __init com90io_setup(char *s) · 362 unmodified lines | ||
| 363 | 363 | switch (ints[0]) { |
| 364 | 364 | default: /* ERROR */ |
| 365 | 365 | pr_err("Too many arguments\n"); |
| 366 | + /* Fall through */ | |
| 366 | 367 | case 2: /* IRQ */ |
| 367 | 368 | irq = ints[2]; |
| 369 | + /* Fall through */ | |
| 368 | 370 | case 1: /* IO address */ |
| 369 | 371 | io = ints[1]; |
| 370 | 372 | } |
| @@ -693,10 +693,13 @@ static int __init com90xx_setup(char *s) · 692 unmodified lines | ||
| 693 | 693 | switch (ints[0]) { |
| 694 | 694 | default: /* ERROR */ |
| 695 | 695 | pr_err("Too many arguments\n"); |
| 696 | + /* Fall through */ | |
| 696 | 697 | case 3: /* Mem address */ |
| 697 | 698 | shmem = ints[3]; |
| 699 | + /* Fall through */ | |
| 698 | 700 | case 2: /* IRQ */ |
| 699 | 701 | irq = ints[2]; |
| 702 | + /* Fall through */ | |
| 700 | 703 | case 1: /* IO address */ |
| 701 | 704 | io = ints[1]; |
| 702 | 705 | } |
| @@ -2196,6 +2196,15 @@ static void bond_miimon_commit(struct bonding *bond) · 2195 unmodified lines | ||
| 2196 | 2196 | bond_for_each_slave(bond, slave, iter) { |
| 2197 | 2197 | switch (slave->new_link) { |
| 2198 | 2198 | case BOND_LINK_NOCHANGE: |
| 2199 | + /* For 802.3ad mode, check current slave speed and | |
| 2200 | + * duplex again in case its port was disabled after | |
| 2201 | + * invalid speed/duplex reporting but recovered before | |
| 2202 | + * link monitoring could make a decision on the actual | |
| 2203 | + * link status | |
| 2204 | + */ | |
| 2205 | + if (BOND_MODE(bond) == BOND_MODE_8023AD && | |
| 2206 | + slave->link == BOND_LINK_UP) | |
| 2207 | + bond_3ad_adapter_speed_duplex_changed(slave); | |
| 2199 | 2208 | continue; |
| 2200 | 2209 | |
| 2201 | 2210 | case BOND_LINK_UP: |
| @@ -1249,6 +1249,8 @@ int register_candev(struct net_device *dev) · 1248 unmodified lines | ||
| 1249 | 1249 | return -EINVAL; |
| 1250 | 1250 | |
| 1251 | 1251 | dev->rtnl_link_ops = &can_link_ops; |
| 1252 | + netif_carrier_off(dev); | |
| 1253 | + | |
| 1252 | 1254 | return register_netdev(dev); |
| 1253 | 1255 | } |
| 1254 | 1256 | EXPORT_SYMBOL_GPL(register_candev); |
| @@ -400,9 +400,10 @@ static void flexcan_enable_wakeup_irq(struct flexcan_priv *priv, bool enable) · 399 unmodified lines | ||
| 400 | 400 | priv->write(reg_mcr, ®s->mcr); |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | −static inline void flexcan_enter_stop_mode(struct flexcan_priv *priv) | |
| 403 | +static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) | |
| 404 | 404 | { |
| 405 | 405 | struct flexcan_regs __iomem *regs = priv->regs; |
| 406 | + unsigned int ackval; | |
| 406 | 407 | u32 reg_mcr; |
| 407 | 408 | |
| 408 | 409 | reg_mcr = priv->read(®s->mcr); |
| @@ -412,20 +413,37 @@ static inline void flexcan_enter_stop_mode(struct flexcan_priv *priv) · 3 unmodified lines | ||
| 412 | 413 | /* enable stop request */ |
| 413 | 414 | regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, |
| 414 | 415 | 1 << priv->stm.req_bit, 1 << priv->stm.req_bit); |
| 416 | + | |
| 417 | + /* get stop acknowledgment */ | |
| 418 | + if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, | |
| 419 | + ackval, ackval & (1 << priv->stm.ack_bit), | |
| 420 | + 0, FLEXCAN_TIMEOUT_US)) | |
| 421 | + return -ETIMEDOUT; | |
| 422 | + | |
| 423 | + return 0; | |
| 415 | 424 | } |
| 416 | 425 | |
| 417 | −static inline void flexcan_exit_stop_mode(struct flexcan_priv *priv) | |
| 426 | +static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv) | |
| 418 | 427 | { |
| 419 | 428 | struct flexcan_regs __iomem *regs = priv->regs; |
| 429 | + unsigned int ackval; | |
| 420 | 430 | u32 reg_mcr; |
| 421 | 431 | |
| 422 | 432 | /* remove stop request */ |
| 423 | 433 | regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, |
| 424 | 434 | 1 << priv->stm.req_bit, 0); |
| 425 | 435 | |
| 436 | + /* get stop acknowledgment */ | |
| 437 | + if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, | |
| 438 | + ackval, !(ackval & (1 << priv->stm.ack_bit)), | |
| 439 | + 0, FLEXCAN_TIMEOUT_US)) | |
| 440 | + return -ETIMEDOUT; | |
| 441 | + | |
| 426 | 442 | reg_mcr = priv->read(®s->mcr); |
| 427 | 443 | reg_mcr &= ~FLEXCAN_MCR_SLF_WAK; |
| 428 | 444 | priv->write(reg_mcr, ®s->mcr); |
| 445 | + | |
| 446 | + return 0; | |
| 429 | 447 | } |
| 430 | 448 | |
| 431 | 449 | static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv) |
| @@ -1437,10 +1455,10 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) · 1005 unmodified lines | ||
| 1437 | 1455 | |
| 1438 | 1456 | priv = netdev_priv(dev); |
| 1439 | 1457 | priv->stm.gpr = syscon_node_to_regmap(gpr_np); |
| 1440 | − of_node_put(gpr_np); | |
| 1441 | 1458 | if (IS_ERR(priv->stm.gpr)) { |
| 1442 | 1459 | dev_dbg(&pdev->dev, "could not find gpr regmap\n"); |
| 1443 | − return PTR_ERR(priv->stm.gpr); | |
| 1460 | + ret = PTR_ERR(priv->stm.gpr); | |
| 1461 | + goto out_put_node; | |
| 1444 | 1462 | } |
| 1445 | 1463 | |
| 1446 | 1464 | priv->stm.req_gpr = out_val[1]; |
| @@ -1455,7 +1473,9 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) · 8 unmodified lines | ||
| 1455 | 1473 | |
| 1456 | 1474 | device_set_wakeup_capable(&pdev->dev, true); |
| 1457 | 1475 | |
| 1458 | − return 0; | |
| 1476 | +out_put_node: | |
| 1477 | + of_node_put(gpr_np); | |
| 1478 | + return ret; | |
| 1459 | 1479 | } |
| 1460 | 1480 | |
| 1461 | 1481 | static const struct of_device_id flexcan_of_match[] = { |
| @@ -1612,7 +1632,9 @@ static int __maybe_unused flexcan_suspend(struct device *device) · 150 unmodified lines | ||
| 1612 | 1632 | */ |
| 1613 | 1633 | if (device_may_wakeup(device)) { |
| 1614 | 1634 | enable_irq_wake(dev->irq); |
| 1615 | − flexcan_enter_stop_mode(priv); | |
| 1635 | + err = flexcan_enter_stop_mode(priv); | |
| 1636 | + if (err) | |
| 1637 | + return err; | |
| 1616 | 1638 | } else { |
| 1617 | 1639 | err = flexcan_chip_disable(priv); |
| 1618 | 1640 | if (err) |
| @@ -1662,10 +1684,13 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) · 43 unmodified lines | ||
| 1662 | 1684 | { |
| 1663 | 1685 | struct net_device *dev = dev_get_drvdata(device); |
| 1664 | 1686 | struct flexcan_priv *priv = netdev_priv(dev); |
| 1687 | + int err; | |
| 1665 | 1688 | |
| 1666 | 1689 | if (netif_running(dev) && device_may_wakeup(device)) { |
| 1667 | 1690 | flexcan_enable_wakeup_irq(priv, false); |
| 1668 | − flexcan_exit_stop_mode(priv); | |
| 1691 | + err = flexcan_exit_stop_mode(priv); | |
| 1692 | + if (err) | |
| 1693 | + return err; | |
| 1669 | 1694 | } |
| 1670 | 1695 | |
| 1671 | 1696 | return 0; |
| @@ -1508,10 +1508,11 @@ static int rcar_canfd_rx_poll(struct napi_struct *napi, int quota) · 1507 unmodified lines | ||
| 1508 | 1508 | |
| 1509 | 1509 | /* All packets processed */ |
| 1510 | 1510 | if (num_pkts < quota) { |
| 1511 | − napi_complete_done(napi, num_pkts); | |
| 1512 | − /* Enable Rx FIFO interrupts */ | |
| 1513 | − rcar_canfd_set_bit(priv->base, RCANFD_RFCC(ridx), | |
| 1514 | − RCANFD_RFCC_RFIE); | |
| 1511 | + if (napi_complete_done(napi, num_pkts)) { | |
| 1512 | + /* Enable Rx FIFO interrupts */ | |
| 1513 | + rcar_canfd_set_bit(priv->base, RCANFD_RFCC(ridx), | |
| 1514 | + RCANFD_RFCC_RFIE); | |
| 1515 | + } | |
| 1515 | 1516 | } |
| 1516 | 1517 | return num_pkts; |
| 1517 | 1518 | } |
| @@ -479,7 +479,7 @@ static void pcan_free_channels(struct pcan_pccard *card) · 478 unmodified lines | ||
| 479 | 479 | if (!netdev) |
| 480 | 480 | continue; |
| 481 | 481 | |
| 482 | − strncpy(name, netdev->name, IFNAMSIZ); | |
| 482 | + strlcpy(name, netdev->name, IFNAMSIZ); | |
| 483 | 483 | |
| 484 | 484 | unregister_sja1000dev(netdev); |
| 485 | 485 | |
| @@ -664,17 +664,6 @@ static int mcp251x_power_enable(struct regulator *reg, int enable) · 663 unmodified lines | ||
| 664 | 664 | return regulator_disable(reg); |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | −static void mcp251x_open_clean(struct net_device *net) | |
| 668 | −{ | |
| 669 | − struct mcp251x_priv *priv = netdev_priv(net); | |
| 670 | − struct spi_device *spi = priv->spi; | |
| 671 | − | |
| 672 | − free_irq(spi->irq, priv); | |
| 673 | − mcp251x_hw_sleep(spi); | |
| 674 | − mcp251x_power_enable(priv->transceiver, 0); | |
| 675 | − close_candev(net); | |
| 676 | −} | |
| 677 | − | |
| 678 | 667 | static int mcp251x_stop(struct net_device *net) |
| 679 | 668 | { |
| 680 | 669 | struct mcp251x_priv *priv = netdev_priv(net); |
| @@ -941,37 +930,43 @@ static int mcp251x_open(struct net_device *net) · 260 unmodified lines | ||
| 941 | 930 | flags | IRQF_ONESHOT, DEVICE_NAME, priv); |
| 942 | 931 | if (ret) { |
| 943 | 932 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); |
| 944 | − mcp251x_power_enable(priv->transceiver, 0); | |
| 945 | − close_candev(net); | |
| 946 | − goto open_unlock; | |
| 933 | + goto out_close; | |
| 947 | 934 | } |
| 948 | 935 | |
| 949 | 936 | priv->wq = alloc_workqueue("mcp251x_wq", WQ_FREEZABLE | WQ_MEM_RECLAIM, |
| 950 | 937 | 0); |
| 938 | + if (!priv->wq) { | |
| 939 | + ret = -ENOMEM; | |
| 940 | + goto out_clean; | |
| 941 | + } | |
| 951 | 942 | INIT_WORK(&priv->tx_work, mcp251x_tx_work_handler); |
| 952 | 943 | INIT_WORK(&priv->restart_work, mcp251x_restart_work_handler); |
| 953 | 944 | |
| 954 | 945 | ret = mcp251x_hw_reset(spi); |
| 955 | − if (ret) { | |
| 956 | − mcp251x_open_clean(net); | |
| 957 | − goto open_unlock; | |
| 958 | − } | |
| 946 | + if (ret) | |
| 947 | + goto out_free_wq; | |
| 959 | 948 | ret = mcp251x_setup(net, spi); |
| 960 | − if (ret) { | |
| 961 | − mcp251x_open_clean(net); | |
| 962 | − goto open_unlock; | |
| 963 | − } | |
| 949 | + if (ret) | |
| 950 | + goto out_free_wq; | |
| 964 | 951 | ret = mcp251x_set_normal_mode(spi); |
| 965 | − if (ret) { | |
| 966 | − mcp251x_open_clean(net); | |
| 967 | − goto open_unlock; | |
| 968 | − } | |
| 952 | + if (ret) | |
| 953 | + goto out_free_wq; | |
| 969 | 954 | |
| 970 | 955 | can_led_event(net, CAN_LED_EVENT_OPEN); |
| 971 | 956 | |
| 972 | 957 | netif_wake_queue(net); |
| 958 | + mutex_unlock(&priv->mcp_lock); | |
| 973 | 959 | |
| 974 | −open_unlock: | |
| 960 | + return 0; | |
| 961 | + | |
| 962 | +out_free_wq: | |
| 963 | + destroy_workqueue(priv->wq); | |
| 964 | +out_clean: | |
| 965 | + free_irq(spi->irq, priv); | |
| 966 | + mcp251x_hw_sleep(spi); | |
| 967 | +out_close: | |
| 968 | + mcp251x_power_enable(priv->transceiver, 0); | |
| 969 | + close_candev(net); | |
| 975 | 970 | mutex_unlock(&priv->mcp_lock); |
| 976 | 971 | return ret; |
| 977 | 972 | } |
| @@ -568,16 +568,16 @@ static int peak_usb_ndo_stop(struct net_device *netdev) · 567 unmodified lines | ||
| 568 | 568 | dev->state &= ~PCAN_USB_STATE_STARTED; |
| 569 | 569 | netif_stop_queue(netdev); |
| 570 | 570 | |
| 571 | + close_candev(netdev); | |
| 572 | + | |
| 573 | + dev->can.state = CAN_STATE_STOPPED; | |
| 574 | + | |
| 571 | 575 | /* unlink all pending urbs and free used memory */ |
| 572 | 576 | peak_usb_unlink_all_urbs(dev); |
| 573 | 577 | |
| 574 | 578 | if (dev->adapter->dev_stop) |
| 575 | 579 | dev->adapter->dev_stop(dev); |
| 576 | 580 | |
| 577 | − close_candev(netdev); | |
| 578 | − | |
| 579 | − dev->can.state = CAN_STATE_STOPPED; | |
| 580 | − | |
| 581 | 581 | /* can set bus off now */ |
| 582 | 582 | if (dev->adapter->dev_set_bus) { |
| 583 | 583 | int err = dev->adapter->dev_set_bus(dev, 0); |
| @@ -855,7 +855,7 @@ static void peak_usb_disconnect(struct usb_interface *intf) · 271 unmodified lines | ||
| 855 | 855 | |
| 856 | 856 | dev_prev_siblings = dev->prev_siblings; |
| 857 | 857 | dev->state &= ~PCAN_USB_STATE_CONNECTED; |
| 858 | − strncpy(name, netdev->name, IFNAMSIZ); | |
| 858 | + strlcpy(name, netdev->name, IFNAMSIZ); | |
| 859 | 859 | |
| 860 | 860 | unregister_netdev(netdev); |
| 861 | 861 | |
| @@ -841,7 +841,7 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev) · 840 unmodified lines | ||
| 841 | 841 | goto err_out; |
| 842 | 842 | |
| 843 | 843 | /* allocate command buffer once for all for the interface */ |
| 844 | − pdev->cmd_buffer_addr = kmalloc(PCAN_UFD_CMD_BUFFER_SIZE, | |
| 844 | + pdev->cmd_buffer_addr = kzalloc(PCAN_UFD_CMD_BUFFER_SIZE, | |
| 845 | 845 | GFP_KERNEL); |
| 846 | 846 | if (!pdev->cmd_buffer_addr) |
| 847 | 847 | goto err_out_1; |
| @@ -494,7 +494,7 @@ static int pcan_usb_pro_drv_loaded(struct peak_usb_device *dev, int loaded) · 493 unmodified lines | ||
| 494 | 494 | u8 *buffer; |
| 495 | 495 | int err; |
| 496 | 496 | |
| 497 | − buffer = kmalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); | |
| 497 | + buffer = kzalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); | |
| 498 | 498 | if (!buffer) |
| 499 | 499 | return -ENOMEM; |
| 500 | 500 | |
| @@ -27,7 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/platform_data/mv88e6xxx.h> |
| 28 | 28 | #include <linux/netdevice.h> |
| 29 | 29 | #include <linux/gpio/consumer.h> |
| 30 | −#include <linux/phy.h> | |
| 31 | 30 | #include <linux/phylink.h> |
| 32 | 31 | #include <net/dsa.h> |
| 33 | 32 | |
| @@ -430,7 +429,7 @@ int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, int link, · 396 unmodified lines | ||
| 430 | 429 | return 0; |
| 431 | 430 | |
| 432 | 431 | /* Port's MAC control must not be changed unless the link is down */ |
| 433 | − err = chip->info->ops->port_set_link(chip, port, 0); | |
| 432 | + err = chip->info->ops->port_set_link(chip, port, LINK_FORCED_DOWN); | |
| 434 | 433 | if (err) |
| 435 | 434 | return err; |
| 436 | 435 | |
| @@ -482,30 +481,6 @@ static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port) · 45 unmodified lines | ||
| 482 | 481 | return port < chip->info->num_internal_phys; |
| 483 | 482 | } |
| 484 | 483 | |
| 485 | −/* We expect the switch to perform auto negotiation if there is a real | |
| 486 | − * phy. However, in the case of a fixed link phy, we force the port | |
| 487 | − * settings from the fixed link settings. | |
| 488 | − */ | |
| 489 | −static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, | |
| 490 | − struct phy_device *phydev) | |
| 491 | −{ | |
| 492 | − struct mv88e6xxx_chip *chip = ds->priv; | |
| 493 | − int err; | |
| 494 | − | |
| 495 | − if (!phy_is_pseudo_fixed_link(phydev) && | |
| 496 | − mv88e6xxx_phy_is_internal(ds, port)) | |
| 497 | − return; | |
| 498 | − | |
| 499 | − mv88e6xxx_reg_lock(chip); | |
| 500 | − err = mv88e6xxx_port_setup_mac(chip, port, phydev->link, phydev->speed, | |
| 501 | − phydev->duplex, phydev->pause, | |
| 502 | − phydev->interface); | |
| 503 | − mv88e6xxx_reg_unlock(chip); | |
| 504 | − | |
| 505 | − if (err && err != -EOPNOTSUPP) | |
| 506 | − dev_err(ds->dev, "p%d: failed to configure MAC\n", port); | |
| 507 | −} | |
| 508 | − | |
| 509 | 484 | static void mv88e6065_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 510 | 485 | unsigned long *mask, |
| 511 | 486 | struct phylink_link_state *state) |
| @@ -2721,6 +2696,7 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, · 2209 unmodified lines | ||
| 2721 | 2696 | err = mv88e6xxx_mdio_register(chip, child, true); |
| 2722 | 2697 | if (err) { |
| 2723 | 2698 | mv88e6xxx_mdios_unregister(chip); |
| 2699 | + of_node_put(child); | |
| 2724 | 2700 | return err; |
| 2725 | 2701 | } |
| 2726 | 2702 | } |
| @@ -4638,7 +4614,6 @@ static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port, · 1911 unmodified lines | ||
| 4638 | 4614 | static const struct dsa_switch_ops mv88e6xxx_switch_ops = { |
| 4639 | 4615 | .get_tag_protocol = mv88e6xxx_get_tag_protocol, |
| 4640 | 4616 | .setup = mv88e6xxx_setup, |
| 4641 | − .adjust_link = mv88e6xxx_adjust_link, | |
| 4642 | 4617 | .phylink_validate = mv88e6xxx_validate, |
| 4643 | 4618 | .phylink_mac_link_state = mv88e6xxx_link_state, |
| 4644 | 4619 | .phylink_mac_config = mv88e6xxx_mac_config, |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2009 Felix Fietkau <nbd@nbd.name> |
| 4 | 4 | * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org> |
| 5 | − * Copyright (c) 2015, The Linux Foundation. All rights reserved. | |
| 5 | + * Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved. | |
| 6 | 6 | * Copyright (c) 2016 John Crispin <john@phrozen.org> |
| 7 | 7 | */ |
| 8 | 8 | |
| @@ -583,8 +583,11 @@ qca8k_setup_mdio_bus(struct qca8k_priv *priv) · 574 unmodified lines | ||
| 583 | 583 | |
| 584 | 584 | for_each_available_child_of_node(ports, port) { |
| 585 | 585 | err = of_property_read_u32(port, "reg", ®); |
| 586 | − if (err) | |
| 586 | + if (err) { | |
| 587 | + of_node_put(port); | |
| 588 | + of_node_put(ports); | |
| 587 | 589 | return err; |
| 590 | + } | |
| 588 | 591 | |
| 589 | 592 | if (!dsa_is_user_port(priv->ds, reg)) |
| 590 | 593 | continue; |
| @@ -595,6 +598,7 @@ qca8k_setup_mdio_bus(struct qca8k_priv *priv) · 4 unmodified lines | ||
| 595 | 598 | internal_mdio_mask |= BIT(reg); |
| 596 | 599 | } |
| 597 | 600 | |
| 601 | + of_node_put(ports); | |
| 598 | 602 | if (!external_mdio_mask && !internal_mdio_mask) { |
| 599 | 603 | dev_err(priv->dev, "no PHYs are defined.\n"); |
| 600 | 604 | return -EINVAL; |
| @@ -935,6 +939,8 @@ qca8k_port_enable(struct dsa_switch *ds, int port, · 334 unmodified lines | ||
| 935 | 939 | qca8k_port_set_status(priv, port, 1); |
| 936 | 940 | priv->port_sts[port].enabled = 1; |
| 937 | 941 | |
| 942 | + phy_support_asym_pause(phy); | |
| 943 | + | |
| 938 | 944 | return 0; |
| 939 | 945 | } |
| 940 | 946 | |
| @@ -277,6 +277,18 @@ sja1105et_l2_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, · 276 unmodified lines | ||
| 277 | 277 | SJA1105ET_SIZE_L2_LOOKUP_ENTRY, op); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | +static size_t sja1105et_dyn_l2_lookup_entry_packing(void *buf, void *entry_ptr, | |
| 281 | + enum packing_op op) | |
| 282 | +{ | |
| 283 | + struct sja1105_l2_lookup_entry *entry = entry_ptr; | |
| 284 | + u8 *cmd = buf + SJA1105ET_SIZE_L2_LOOKUP_ENTRY; | |
| 285 | + const int size = SJA1105_SIZE_DYN_CMD; | |
| 286 | + | |
| 287 | + sja1105_packing(cmd, &entry->lockeds, 28, 28, size, op); | |
| 288 | + | |
| 289 | + return sja1105et_l2_lookup_entry_packing(buf, entry_ptr, op); | |
| 290 | +} | |
| 291 | + | |
| 280 | 292 | static void |
| 281 | 293 | sja1105et_mgmt_route_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, |
| 282 | 294 | enum packing_op op) |
| @@ -477,7 +489,7 @@ sja1105et_general_params_entry_packing(void *buf, void *entry_ptr, · 194 unmodified lines | ||
| 477 | 489 | /* SJA1105E/T: First generation */ |
| 478 | 490 | struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN] = { |
| 479 | 491 | [BLK_IDX_L2_LOOKUP] = { |
| 480 | − .entry_packing = sja1105et_l2_lookup_entry_packing, | |
| 492 | + .entry_packing = sja1105et_dyn_l2_lookup_entry_packing, | |
| 481 | 493 | .cmd_packing = sja1105et_l2_lookup_cmd_packing, |
| 482 | 494 | .access = (OP_READ | OP_WRITE | OP_DEL), |
| 483 | 495 | .max_entry_count = SJA1105_MAX_L2_LOOKUP_COUNT, |
| @@ -218,7 +218,7 @@ static int sja1105_init_l2_lookup_params(struct sja1105_private *priv) · 217 unmodified lines | ||
| 218 | 218 | /* This selects between Independent VLAN Learning (IVL) and |
| 219 | 219 | * Shared VLAN Learning (SVL) |
| 220 | 220 | */ |
| 221 | − .shared_learn = false, | |
| 221 | + .shared_learn = true, | |
| 222 | 222 | /* Don't discard management traffic based on ENFPORT - |
| 223 | 223 | * we don't perform SMAC port enforcement anyway, so |
| 224 | 224 | * what we are setting here doesn't matter. |
| @@ -625,6 +625,7 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv, · 400 unmodified lines | ||
| 625 | 625 | if (of_property_read_u32(child, "reg", &index) < 0) { |
| 626 | 626 | dev_err(dev, "Port number not defined in device tree " |
| 627 | 627 | "(property \"reg\")\n"); |
| 628 | + of_node_put(child); | |
| 628 | 629 | return -ENODEV; |
| 629 | 630 | } |
| 630 | 631 | |
| @@ -634,6 +635,7 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv, · 3 unmodified lines | ||
| 634 | 635 | dev_err(dev, "Failed to read phy-mode or " |
| 635 | 636 | "phy-interface-type property for port %d\n", |
| 636 | 637 | index); |
| 638 | + of_node_put(child); | |
| 637 | 639 | return -ENODEV; |
| 638 | 640 | } |
| 639 | 641 | ports[index].phy_mode = phy_mode; |
| @@ -643,6 +645,7 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv, · 3 unmodified lines | ||
| 643 | 645 | if (!of_phy_is_fixed_link(child)) { |
| 644 | 646 | dev_err(dev, "phy-handle or fixed-link " |
| 645 | 647 | "properties missing!\n"); |
| 648 | + of_node_put(child); | |
| 646 | 649 | return -ENODEV; |
| 647 | 650 | } |
| 648 | 651 | /* phy-handle is missing, but fixed-link isn't. |
| @@ -1089,8 +1092,13 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, · 440 unmodified lines | ||
| 1089 | 1092 | l2_lookup.vlanid = vid; |
| 1090 | 1093 | l2_lookup.iotag = SJA1105_S_TAG; |
| 1091 | 1094 | l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); |
| 1092 | − l2_lookup.mask_vlanid = VLAN_VID_MASK; | |
| 1093 | − l2_lookup.mask_iotag = BIT(0); | |
| 1095 | + if (dsa_port_is_vlan_filtering(&ds->ports[port])) { | |
| 1096 | + l2_lookup.mask_vlanid = VLAN_VID_MASK; | |
| 1097 | + l2_lookup.mask_iotag = BIT(0); | |
| 1098 | + } else { | |
| 1099 | + l2_lookup.mask_vlanid = 0; | |
| 1100 | + l2_lookup.mask_iotag = 0; | |
| 1101 | + } | |
| 1094 | 1102 | l2_lookup.destports = BIT(port); |
| 1095 | 1103 | |
| 1096 | 1104 | rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, |
| @@ -1147,8 +1155,13 @@ int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port, · 50 unmodified lines | ||
| 1147 | 1155 | l2_lookup.vlanid = vid; |
| 1148 | 1156 | l2_lookup.iotag = SJA1105_S_TAG; |
| 1149 | 1157 | l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); |
| 1150 | − l2_lookup.mask_vlanid = VLAN_VID_MASK; | |
| 1151 | − l2_lookup.mask_iotag = BIT(0); | |
| 1158 | + if (dsa_port_is_vlan_filtering(&ds->ports[port])) { | |
| 1159 | + l2_lookup.mask_vlanid = VLAN_VID_MASK; | |
| 1160 | + l2_lookup.mask_iotag = BIT(0); | |
| 1161 | + } else { | |
| 1162 | + l2_lookup.mask_vlanid = 0; | |
| 1163 | + l2_lookup.mask_iotag = 0; | |
| 1164 | + } | |
| 1152 | 1165 | l2_lookup.destports = BIT(port); |
| 1153 | 1166 | |
| 1154 | 1167 | rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, |
| @@ -1178,60 +1191,31 @@ static int sja1105_fdb_add(struct dsa_switch *ds, int port, · 23 unmodified lines | ||
| 1178 | 1191 | const unsigned char *addr, u16 vid) |
| 1179 | 1192 | { |
| 1180 | 1193 | struct sja1105_private *priv = ds->priv; |
| 1181 | − u16 rx_vid, tx_vid; | |
| 1182 | − int rc, i; | |
| 1183 | 1194 | |
| 1184 | − if (dsa_port_is_vlan_filtering(&ds->ports[port])) | |
| 1185 | − return priv->info->fdb_add_cmd(ds, port, addr, vid); | |
| 1186 | − | |
| 1187 | − /* Since we make use of VLANs even when the bridge core doesn't tell us | |
| 1188 | − * to, translate these FDB entries into the correct dsa_8021q ones. | |
| 1189 | − * The basic idea (also repeats for removal below) is: | |
| 1190 | − * - Each of the other front-panel ports needs to be able to forward a | |
| 1191 | − * pvid-tagged (aka tagged with their rx_vid) frame that matches this | |
| 1192 | − * DMAC. | |
| 1193 | − * - The CPU port (aka the tx_vid of this port) needs to be able to | |
| 1194 | − * send a frame matching this DMAC to the specified port. | |
| 1195 | − * For a better picture see net/dsa/tag_8021q.c. | |
| 1195 | + /* dsa_8021q is in effect when the bridge's vlan_filtering isn't, | |
| 1196 | + * so the switch still does some VLAN processing internally. | |
| 1197 | + * But Shared VLAN Learning (SVL) is also active, and it will take | |
| 1198 | + * care of autonomous forwarding between the unique pvid's of each | |
| 1199 | + * port. Here we just make sure that users can't add duplicate FDB | |
| 1200 | + * entries when in this mode - the actual VID doesn't matter except | |
| 1201 | + * for what gets printed in 'bridge fdb show'. In the case of zero, | |
| 1202 | + * no VID gets printed at all. | |
| 1196 | 1203 | */ |
| 1197 | − for (i = 0; i < SJA1105_NUM_PORTS; i++) { | |
| 1198 | − if (i == port) | |
| 1199 | − continue; | |
| 1200 | − if (i == dsa_upstream_port(priv->ds, port)) | |
| 1201 | − continue; | |
| 1204 | + if (!dsa_port_is_vlan_filtering(&ds->ports[port])) | |
| 1205 | + vid = 0; | |
| 1202 | 1206 | |
| 1203 | − rx_vid = dsa_8021q_rx_vid(ds, i); | |
| 1204 | − rc = priv->info->fdb_add_cmd(ds, port, addr, rx_vid); | |
| 1205 | − if (rc < 0) | |
| 1206 | − return rc; | |
| 1207 | − } | |
| 1208 | − tx_vid = dsa_8021q_tx_vid(ds, port); | |
| 1209 | − return priv->info->fdb_add_cmd(ds, port, addr, tx_vid); | |
| 1207 | + return priv->info->fdb_add_cmd(ds, port, addr, vid); | |
| 1210 | 1208 | } |
| 1211 | 1209 | |
| 1212 | 1210 | static int sja1105_fdb_del(struct dsa_switch *ds, int port, |
| 1213 | 1211 | const unsigned char *addr, u16 vid) |
| 1214 | 1212 | { |
| 1215 | 1213 | struct sja1105_private *priv = ds->priv; |
| 1216 | − u16 rx_vid, tx_vid; | |
| 1217 | − int rc, i; | |
| 1218 | − | |
| 1219 | − if (dsa_port_is_vlan_filtering(&ds->ports[port])) | |
| 1220 | − return priv->info->fdb_del_cmd(ds, port, addr, vid); | |
| 1221 | 1214 | |
| 1222 | − for (i = 0; i < SJA1105_NUM_PORTS; i++) { | |
| 1223 | − if (i == port) | |
| 1224 | − continue; | |
| 1225 | − if (i == dsa_upstream_port(priv->ds, port)) | |
| 1226 | − continue; | |
| 1215 | + if (!dsa_port_is_vlan_filtering(&ds->ports[port])) | |
| 1216 | + vid = 0; | |
| 1227 | 1217 | |
| 1228 | − rx_vid = dsa_8021q_rx_vid(ds, i); | |
| 1229 | − rc = priv->info->fdb_del_cmd(ds, port, addr, rx_vid); | |
| 1230 | − if (rc < 0) | |
| 1231 | − return rc; | |
| 1232 | − } | |
| 1233 | − tx_vid = dsa_8021q_tx_vid(ds, port); | |
| 1234 | − return priv->info->fdb_del_cmd(ds, port, addr, tx_vid); | |
| 1218 | + return priv->info->fdb_del_cmd(ds, port, addr, vid); | |
| 1235 | 1219 | } |
| 1236 | 1220 | |
| 1237 | 1221 | static int sja1105_fdb_dump(struct dsa_switch *ds, int port, |
| @@ -1270,39 +1254,9 @@ static int sja1105_fdb_dump(struct dsa_switch *ds, int port, · 32 unmodified lines | ||
| 1270 | 1254 | continue; |
| 1271 | 1255 | u64_to_ether_addr(l2_lookup.macaddr, macaddr); |
| 1272 | 1256 | |
| 1273 | − /* On SJA1105 E/T, the switch doesn't implement the LOCKEDS | |
| 1274 | − * bit, so it doesn't tell us whether a FDB entry is static | |
| 1275 | − * or not. | |
| 1276 | − * But, of course, we can find out - we're the ones who added | |
| 1277 | − * it in the first place. | |
| 1278 | − */ | |
| 1279 | − if (priv->info->device_id == SJA1105E_DEVICE_ID || | |
| 1280 | − priv->info->device_id == SJA1105T_DEVICE_ID) { | |
| 1281 | − int match; | |
| 1282 | − | |
| 1283 | − match = sja1105_find_static_fdb_entry(priv, port, | |
| 1284 | − &l2_lookup); | |
| 1285 | − l2_lookup.lockeds = (match >= 0); | |
| 1286 | − } | |
| 1287 | − | |
| 1288 | − /* We need to hide the dsa_8021q VLANs from the user. This | |
| 1289 | − * basically means hiding the duplicates and only showing | |
| 1290 | − * the pvid that is supposed to be active in standalone and | |
| 1291 | − * non-vlan_filtering modes (aka 1). | |
| 1292 | − * - For statically added FDB entries (bridge fdb add), we | |
| 1293 | − * can convert the TX VID (coming from the CPU port) into the | |
| 1294 | − * pvid and ignore the RX VIDs of the other ports. | |
| 1295 | − * - For dynamically learned FDB entries, a single entry with | |
| 1296 | − * no duplicates is learned - that which has the real port's | |
| 1297 | − * pvid, aka RX VID. | |
| 1298 | − */ | |
| 1299 | − if (!dsa_port_is_vlan_filtering(&ds->ports[port])) { | |
| 1300 | − if (l2_lookup.vlanid == tx_vid || | |
| 1301 | − l2_lookup.vlanid == rx_vid) | |
| 1302 | − l2_lookup.vlanid = 1; | |
| 1303 | − else | |
| 1304 | − continue; | |
| 1305 | − } | |
| 1257 | + /* We need to hide the dsa_8021q VLANs from the user. */ | |
| 1258 | + if (!dsa_port_is_vlan_filtering(&ds->ports[port])) | |
| 1259 | + l2_lookup.vlanid = 0; | |
| 1306 | 1260 | cb(macaddr, l2_lookup.vlanid, l2_lookup.lockeds, data); |
| 1307 | 1261 | } |
| 1308 | 1262 | return 0; |
| @@ -1594,6 +1548,7 @@ static int sja1105_vlan_prepare(struct dsa_switch *ds, int port, · 285 unmodified lines | ||
| 1594 | 1548 | */ |
| 1595 | 1549 | static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled) |
| 1596 | 1550 | { |
| 1551 | + struct sja1105_l2_lookup_params_entry *l2_lookup_params; | |
| 1597 | 1552 | struct sja1105_general_params_entry *general_params; |
| 1598 | 1553 | struct sja1105_private *priv = ds->priv; |
| 1599 | 1554 | struct sja1105_table *table; |
| @@ -1622,6 +1577,28 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled) · 22 unmodified lines | ||
| 1622 | 1577 | general_params->incl_srcpt1 = enabled; |
| 1623 | 1578 | general_params->incl_srcpt0 = enabled; |
| 1624 | 1579 | |
| 1580 | + /* VLAN filtering => independent VLAN learning. | |
| 1581 | + * No VLAN filtering => shared VLAN learning. | |
| 1582 | + * | |
| 1583 | + * In shared VLAN learning mode, untagged traffic still gets | |
| 1584 | + * pvid-tagged, and the FDB table gets populated with entries | |
| 1585 | + * containing the "real" (pvid or from VLAN tag) VLAN ID. | |
| 1586 | + * However the switch performs a masked L2 lookup in the FDB, | |
| 1587 | + * effectively only looking up a frame's DMAC (and not VID) for the | |
| 1588 | + * forwarding decision. | |
| 1589 | + * | |
| 1590 | + * This is extremely convenient for us, because in modes with | |
| 1591 | + * vlan_filtering=0, dsa_8021q actually installs unique pvid's into | |
| 1592 | + * each front panel port. This is good for identification but breaks | |
| 1593 | + * learning badly - the VID of the learnt FDB entry is unique, aka | |
| 1594 | + * no frames coming from any other port are going to have it. So | |
| 1595 | + * for forwarding purposes, this is as though learning was broken | |
| 1596 | + * (all frames get flooded). | |
| 1597 | + */ | |
| 1598 | + table = &priv->static_config.tables[BLK_IDX_L2_LOOKUP_PARAMS]; | |
| 1599 | + l2_lookup_params = table->entries; | |
| 1600 | + l2_lookup_params->shared_learn = !enabled; | |
| 1601 | + | |
| 1625 | 1602 | rc = sja1105_static_config_reload(priv); |
| 1626 | 1603 | if (rc) |
| 1627 | 1604 | dev_err(ds->dev, "Failed to change VLAN Ethertype\n"); |
| @@ -1751,6 +1728,8 @@ static void sja1105_teardown(struct dsa_switch *ds) · 123 unmodified lines | ||
| 1751 | 1728 | |
| 1752 | 1729 | cancel_work_sync(&priv->tagger_data.rxtstamp_work); |
| 1753 | 1730 | skb_queue_purge(&priv->tagger_data.skb_rxtstamp_queue); |
| 1731 | + sja1105_ptp_clock_unregister(priv); | |
| 1732 | + sja1105_static_config_free(&priv->static_config); | |
| 1754 | 1733 | } |
| 1755 | 1734 | |
| 1756 | 1735 | static int sja1105_mgmt_xmit(struct dsa_switch *ds, int port, int slot, |
| @@ -2208,9 +2187,7 @@ static int sja1105_remove(struct spi_device *spi) · 451 unmodified lines | ||
| 2208 | 2187 | { |
| 2209 | 2188 | struct sja1105_private *priv = spi_get_drvdata(spi); |
| 2210 | 2189 | |
| 2211 | − sja1105_ptp_clock_unregister(priv); | |
| 2212 | 2190 | dsa_unregister_switch(priv->ds); |
| 2213 | − sja1105_static_config_free(&priv->static_config); | |
| 2214 | 2191 | return 0; |
| 2215 | 2192 | } |
| 2216 | 2193 | |
| @@ -369,16 +369,15 @@ int sja1105_ptp_clock_register(struct sja1105_private *priv) · 368 unmodified lines | ||
| 369 | 369 | .mult = SJA1105_CC_MULT, |
| 370 | 370 | }; |
| 371 | 371 | mutex_init(&priv->ptp_lock); |
| 372 | − INIT_DELAYED_WORK(&priv->refresh_work, sja1105_ptp_overflow_check); | |
| 373 | − | |
| 374 | − schedule_delayed_work(&priv->refresh_work, SJA1105_REFRESH_INTERVAL); | |
| 375 | − | |
| 376 | 372 | priv->ptp_caps = sja1105_ptp_caps; |
| 377 | 373 | |
| 378 | 374 | priv->clock = ptp_clock_register(&priv->ptp_caps, ds->dev); |
| 379 | 375 | if (IS_ERR_OR_NULL(priv->clock)) |
| 380 | 376 | return PTR_ERR(priv->clock); |
| 381 | 377 | |
| 378 | + INIT_DELAYED_WORK(&priv->refresh_work, sja1105_ptp_overflow_check); | |
| 379 | + schedule_delayed_work(&priv->refresh_work, SJA1105_REFRESH_INTERVAL); | |
| 380 | + | |
| 382 | 381 | return sja1105_ptp_reset(priv); |
| 383 | 382 | } |
| 384 | 383 | |
| @@ -12,8 +12,8 @@ config NET_VENDOR_8390 · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | Note that the answer to this question doesn't directly affect the |
| 14 | 14 | kernel: saying N will just cause the configurator to skip all |
| 15 | − the questions about Western Digital cards. If you say Y, you will be | |
| 16 | − asked for your specific card in the following questions. | |
| 15 | + the questions about National Semiconductor 8390 cards. If you say Y, | |
| 16 | + you will be asked for your specific card in the following questions. | |
| 17 | 17 | |
| 18 | 18 | if NET_VENDOR_8390 |
| 19 | 19 | |
| @@ -2362,7 +2362,7 @@ static int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) · 2361 unmodified lines | ||
| 2362 | 2362 | |
| 2363 | 2363 | /* Allocate memory for the TCB's (Transmit Control Block) */ |
| 2364 | 2364 | tx_ring->tcb_ring = kcalloc(NUM_TCB, sizeof(struct tcb), |
| 2365 | − GFP_ATOMIC | GFP_DMA); | |
| 2365 | + GFP_KERNEL | GFP_DMA); | |
| 2366 | 2366 | if (!tx_ring->tcb_ring) |
| 2367 | 2367 | return -ENOMEM; |
| 2368 | 2368 | |
| @@ -860,7 +860,9 @@ static int emac_probe(struct platform_device *pdev) · 859 unmodified lines | ||
| 860 | 860 | goto out_clk_disable_unprepare; |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | − db->phy_node = of_parse_phandle(np, "phy", 0); | |
| 863 | + db->phy_node = of_parse_phandle(np, "phy-handle", 0); | |
| 864 | + if (!db->phy_node) | |
| 865 | + db->phy_node = of_parse_phandle(np, "phy", 0); | |
| 864 | 866 | if (!db->phy_node) { |
| 865 | 867 | dev_err(&pdev->dev, "no associated PHY\n"); |
| 866 | 868 | ret = -ENODEV; |
| @@ -14,7 +14,7 @@ config NET_VENDOR_AMD · 13 unmodified lines | ||
| 14 | 14 | say Y. |
| 15 | 15 | |
| 16 | 16 | Note that the answer to this question does not directly affect |
| 17 | − the kernel: saying N will just case the configurator to skip all | |
| 17 | + the kernel: saying N will just cause the configurator to skip all | |
| 18 | 18 | the questions regarding AMD chipsets. If you say Y, you will be asked |
| 19 | 19 | for your specific chipset/driver in the following questions. |
| 20 | 20 | |
| @@ -11,8 +11,8 @@ config NET_VENDOR_APPLE · 10 unmodified lines | ||
| 11 | 11 | If you have a network (Ethernet) card belonging to this class, say Y. |
| 12 | 12 | |
| 13 | 13 | Note that the answer to this question doesn't directly affect the |
| 14 | − kernel: saying N will just cause the configurator to skip all | |
| 15 | − the questions about IBM devices. If you say Y, you will be asked for | |
| 14 | + kernel: saying N will just cause the configurator to skip all the | |
| 15 | + questions about Apple devices. If you say Y, you will be asked for | |
| 16 | 16 | your specific card in the following questions. |
| 17 | 17 | |
| 18 | 18 | if NET_VENDOR_APPLE |
| @@ -1141,7 +1141,7 @@ static int ag71xx_rings_init(struct ag71xx *ag) · 1140 unmodified lines | ||
| 1141 | 1141 | |
| 1142 | 1142 | tx->descs_cpu = dma_alloc_coherent(&ag->pdev->dev, |
| 1143 | 1143 | ring_size * AG71XX_DESC_SIZE, |
| 1144 | − &tx->descs_dma, GFP_ATOMIC); | |
| 1144 | + &tx->descs_dma, GFP_KERNEL); | |
| 1145 | 1145 | if (!tx->descs_cpu) { |
| 1146 | 1146 | kfree(tx->buf); |
| 1147 | 1147 | tx->buf = NULL; |
| @@ -14,9 +14,9 @@ config NET_VENDOR_BROADCOM · 13 unmodified lines | ||
| 14 | 14 | say Y. |
| 15 | 15 | |
| 16 | 16 | Note that the answer to this question does not directly affect |
| 17 | − the kernel: saying N will just case the configurator to skip all | |
| 18 | − the questions regarding AMD chipsets. If you say Y, you will be asked | |
| 19 | − for your specific chipset/driver in the following questions. | |
| 17 | + the kernel: saying N will just cause the configurator to skip all | |
| 18 | + the questions regarding Broadcom chipsets. If you say Y, you will | |
| 19 | + be asked for your specific chipset/driver in the following questions. | |
| 20 | 20 | |
| 21 | 21 | if NET_VENDOR_BROADCOM |
| 22 | 22 | |
| @@ -992,7 +992,7 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget) · 991 unmodified lines | ||
| 992 | 992 | { |
| 993 | 993 | struct bcm_sysport_priv *priv = |
| 994 | 994 | container_of(napi, struct bcm_sysport_priv, napi); |
| 995 | − struct dim_sample dim_sample; | |
| 995 | + struct dim_sample dim_sample = {}; | |
| 996 | 996 | unsigned int work_done = 0; |
| 997 | 997 | |
| 998 | 998 | work_done = bcm_sysport_desc_rx(priv, budget); |
| @@ -1934,8 +1934,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, · 1933 unmodified lines | ||
| 1934 | 1934 | } |
| 1935 | 1935 | |
| 1936 | 1936 | /* select a non-FCoE queue */ |
| 1937 | − return netdev_pick_tx(dev, skb, NULL) % | |
| 1938 | − (BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos); | |
| 1937 | + return netdev_pick_tx(dev, skb, NULL) % (BNX2X_NUM_ETH_QUEUES(bp)); | |
| 1939 | 1938 | } |
| 1940 | 1939 | |
| 1941 | 1940 | void bnx2x_set_num_queues(struct bnx2x *bp) |
| @@ -2136,7 +2136,7 @@ static int bnxt_poll(struct napi_struct *napi, int budget) · 2135 unmodified lines | ||
| 2136 | 2136 | } |
| 2137 | 2137 | } |
| 2138 | 2138 | if (bp->flags & BNXT_FLAG_DIM) { |
| 2139 | − struct dim_sample dim_sample; | |
| 2139 | + struct dim_sample dim_sample = {}; | |
| 2140 | 2140 | |
| 2141 | 2141 | dim_update_sample(cpr->event_ctr, |
| 2142 | 2142 | cpr->rx_packets, |
| @@ -1895,7 +1895,7 @@ static int bcmgenet_rx_poll(struct napi_struct *napi, int budget) · 1894 unmodified lines | ||
| 1895 | 1895 | { |
| 1896 | 1896 | struct bcmgenet_rx_ring *ring = container_of(napi, |
| 1897 | 1897 | struct bcmgenet_rx_ring, napi); |
| 1898 | − struct dim_sample dim_sample; | |
| 1898 | + struct dim_sample dim_sample = {}; | |
| 1899 | 1899 | unsigned int work_done; |
| 1900 | 1900 | |
| 1901 | 1901 | work_done = bcmgenet_desc_rx(ring, budget); |
| @@ -1381,24 +1381,18 @@ static int acpi_get_mac_address(struct device *dev, struct acpi_device *adev, · 1380 unmodified lines | ||
| 1381 | 1381 | u8 *dst) |
| 1382 | 1382 | { |
| 1383 | 1383 | u8 mac[ETH_ALEN]; |
| 1384 | − int ret; | |
| 1384 | + u8 *addr; | |
| 1385 | 1385 | |
| 1386 | − ret = fwnode_property_read_u8_array(acpi_fwnode_handle(adev), | |
| 1387 | − "mac-address", mac, ETH_ALEN); | |
| 1388 | − if (ret) | |
| 1389 | − goto out; | |
| 1390 | − | |
| 1391 | − if (!is_valid_ether_addr(mac)) { | |
| 1386 | + addr = fwnode_get_mac_address(acpi_fwnode_handle(adev), mac, ETH_ALEN); | |
| 1387 | + if (!addr) { | |
| 1392 | 1388 | dev_err(dev, "MAC address invalid: %pM\n", mac); |
| 1393 | − ret = -EINVAL; | |
| 1394 | − goto out; | |
| 1389 | + return -EINVAL; | |
| 1395 | 1390 | } |
| 1396 | 1391 | |
| 1397 | 1392 | dev_info(dev, "MAC address set to: %pM\n", mac); |
| 1398 | 1393 | |
| 1399 | − memcpy(dst, mac, ETH_ALEN); | |
| 1400 | −out: | |
| 1401 | − return ret; | |
| 1394 | + ether_addr_copy(dst, mac); | |
| 1395 | + return 0; | |
| 1402 | 1396 | } |
| 1403 | 1397 | |
| 1404 | 1398 | /* Currently only sets the MAC address. */ |
| @@ -3269,7 +3269,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 3268 unmodified lines | ||
| 3269 | 3269 | if (!adapter->regs) { |
| 3270 | 3270 | dev_err(&pdev->dev, "cannot map device registers\n"); |
| 3271 | 3271 | err = -ENOMEM; |
| 3272 | − goto out_free_adapter; | |
| 3272 | + goto out_free_adapter_nofail; | |
| 3273 | 3273 | } |
| 3274 | 3274 | |
| 3275 | 3275 | adapter->pdev = pdev; |
| @@ -3397,6 +3397,9 @@ out_free_dev: · 121 unmodified lines | ||
| 3397 | 3397 | if (adapter->port[i]) |
| 3398 | 3398 | free_netdev(adapter->port[i]); |
| 3399 | 3399 | |
| 3400 | +out_free_adapter_nofail: | |
| 3401 | + kfree_skb(adapter->nofail_skb); | |
| 3402 | + | |
| 3400 | 3403 | out_free_adapter: |
| 3401 | 3404 | kfree(adapter); |
| 3402 | 3405 | |
| @@ -550,7 +550,7 @@ int be_process_mcc(struct be_adapter *adapter) · 549 unmodified lines | ||
| 550 | 550 | int num = 0, status = 0; |
| 551 | 551 | struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; |
| 552 | 552 | |
| 553 | − spin_lock(&adapter->mcc_cq_lock); | |
| 553 | + spin_lock_bh(&adapter->mcc_cq_lock); | |
| 554 | 554 | |
| 555 | 555 | while ((compl = be_mcc_compl_get(adapter))) { |
| 556 | 556 | if (compl->flags & CQE_FLAGS_ASYNC_MASK) { |
| @@ -566,7 +566,7 @@ int be_process_mcc(struct be_adapter *adapter) · 9 unmodified lines | ||
| 566 | 566 | if (num) |
| 567 | 567 | be_cq_notify(adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num); |
| 568 | 568 | |
| 569 | − spin_unlock(&adapter->mcc_cq_lock); | |
| 569 | + spin_unlock_bh(&adapter->mcc_cq_lock); | |
| 570 | 570 | return status; |
| 571 | 571 | } |
| 572 | 572 | |
| @@ -581,9 +581,7 @@ static int be_mcc_wait_compl(struct be_adapter *adapter) · 8 unmodified lines | ||
| 581 | 581 | if (be_check_error(adapter, BE_ERROR_ANY)) |
| 582 | 582 | return -EIO; |
| 583 | 583 | |
| 584 | − local_bh_disable(); | |
| 585 | 584 | status = be_process_mcc(adapter); |
| 586 | − local_bh_enable(); | |
| 587 | 585 | |
| 588 | 586 | if (atomic_read(&mcc_obj->q.used) == 0) |
| 589 | 587 | break; |
| @@ -5630,9 +5630,7 @@ static void be_worker(struct work_struct *work) · 5629 unmodified lines | ||
| 5630 | 5630 | * mcc completions |
| 5631 | 5631 | */ |
| 5632 | 5632 | if (!netif_running(adapter->netdev)) { |
| 5633 | − local_bh_disable(); | |
| 5634 | 5633 | be_process_mcc(adapter); |
| 5635 | − local_bh_enable(); | |
| 5636 | 5634 | goto reschedule; |
| 5637 | 5635 | } |
| 5638 | 5636 | |
| @@ -2,6 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | config FSL_ENETC |
| 3 | 3 | tristate "ENETC PF driver" |
| 4 | 4 | depends on PCI && PCI_MSI && (ARCH_LAYERSCAPE || COMPILE_TEST) |
| 5 | + select PHYLIB | |
| 5 | 6 | help |
| 6 | 7 | This driver supports NXP ENETC gigabit ethernet controller PCIe |
| 7 | 8 | physical function (PF) devices, managing ENETC Ports at a privileged |
| @@ -12,6 +13,7 @@ config FSL_ENETC · 4 unmodified lines | ||
| 12 | 13 | config FSL_ENETC_VF |
| 13 | 14 | tristate "ENETC VF driver" |
| 14 | 15 | depends on PCI && PCI_MSI && (ARCH_LAYERSCAPE || COMPILE_TEST) |
| 16 | + select PHYLIB | |
| 15 | 17 | help |
| 16 | 18 | This driver supports NXP ENETC gigabit ethernet controller PCIe |
| 17 | 19 | virtual function (VF) devices enabled by the ENETC PF driver. |
| @@ -2439,9 +2439,6 @@ MODULE_PARM_DESC(fsl_fm_rx_extra_headroom, "Extra headroom for Rx buffers"); · 2438 unmodified lines | ||
| 2439 | 2439 | * buffers when not using jumbo frames. |
| 2440 | 2440 | * Must be large enough to accommodate the network MTU, but small enough |
| 2441 | 2441 | * to avoid wasting skb memory. |
| 2442 | − * | |
| 2443 | − * Could be overridden once, at boot-time, via the | |
| 2444 | − * fm_set_max_frm() callback. | |
| 2445 | 2442 | */ |
| 2446 | 2443 | static int fsl_fm_max_frm = FSL_FM_MAX_FRAME_SIZE; |
| 2447 | 2444 | module_param(fsl_fm_max_frm, int, 0); |
| @@ -31,9 +31,6 @@ · 30 unmodified lines | ||
| 31 | 31 | struct gve_rx_desc_queue { |
| 32 | 32 | struct gve_rx_desc *desc_ring; /* the descriptor ring */ |
| 33 | 33 | dma_addr_t bus; /* the bus for the desc_ring */ |
| 34 | − u32 cnt; /* free-running total number of completed packets */ | |
| 35 | − u32 fill_cnt; /* free-running total number of descriptors posted */ | |
| 36 | − u32 mask; /* masks the cnt to the size of the ring */ | |
| 37 | 34 | u8 seqno; /* the next expected seqno for this desc*/ |
| 38 | 35 | }; |
| 39 | 36 | |
| @@ -60,8 +57,6 @@ struct gve_rx_data_queue { · 20 unmodified lines | ||
| 60 | 57 | dma_addr_t data_bus; /* dma mapping of the slots */ |
| 61 | 58 | struct gve_rx_slot_page_info *page_info; /* page info of the buffers */ |
| 62 | 59 | struct gve_queue_page_list *qpl; /* qpl assigned to this queue */ |
| 63 | − u32 mask; /* masks the cnt to the size of the ring */ | |
| 64 | − u32 cnt; /* free-running total number of completed packets */ | |
| 65 | 60 | }; |
| 66 | 61 | |
| 67 | 62 | struct gve_priv; |
| @@ -73,6 +68,9 @@ struct gve_rx_ring { · 5 unmodified lines | ||
| 73 | 68 | struct gve_rx_data_queue data; |
| 74 | 69 | u64 rbytes; /* free-running bytes received */ |
| 75 | 70 | u64 rpackets; /* free-running packets received */ |
| 71 | + u32 cnt; /* free-running total number of completed packets */ | |
| 72 | + u32 fill_cnt; /* free-running total number of descs and buffs posted */ | |
| 73 | + u32 mask; /* masks the cnt and fill_cnt to the size of the ring */ | |
| 76 | 74 | u32 q_num; /* queue index */ |
| 77 | 75 | u32 ntfy_id; /* notification block index */ |
| 78 | 76 | struct gve_queue_resources *q_resources; /* head and tail pointer idx */ |
| @@ -138,8 +138,8 @@ gve_get_ethtool_stats(struct net_device *netdev, · 137 unmodified lines | ||
| 138 | 138 | for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) { |
| 139 | 139 | struct gve_rx_ring *rx = &priv->rx[ring]; |
| 140 | 140 | |
| 141 | − data[i++] = rx->desc.cnt; | |
| 142 | − data[i++] = rx->desc.fill_cnt; | |
| 141 | + data[i++] = rx->cnt; | |
| 142 | + data[i++] = rx->fill_cnt; | |
| 143 | 143 | } |
| 144 | 144 | } else { |
| 145 | 145 | i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS; |
| @@ -37,7 +37,7 @@ static void gve_rx_free_ring(struct gve_priv *priv, int idx) · 36 unmodified lines | ||
| 37 | 37 | rx->data.qpl = NULL; |
| 38 | 38 | kvfree(rx->data.page_info); |
| 39 | 39 | |
| 40 | − slots = rx->data.mask + 1; | |
| 40 | + slots = rx->mask + 1; | |
| 41 | 41 | bytes = sizeof(*rx->data.data_ring) * slots; |
| 42 | 42 | dma_free_coherent(dev, bytes, rx->data.data_ring, |
| 43 | 43 | rx->data.data_bus); |
| @@ -64,7 +64,7 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx) · 20 unmodified lines | ||
| 64 | 64 | /* Allocate one page per Rx queue slot. Each page is split into two |
| 65 | 65 | * packet buffers, when possible we "page flip" between the two. |
| 66 | 66 | */ |
| 67 | − slots = rx->data.mask + 1; | |
| 67 | + slots = rx->mask + 1; | |
| 68 | 68 | |
| 69 | 69 | rx->data.page_info = kvzalloc(slots * |
| 70 | 70 | sizeof(*rx->data.page_info), GFP_KERNEL); |
| @@ -111,7 +111,7 @@ static int gve_rx_alloc_ring(struct gve_priv *priv, int idx) · 40 unmodified lines | ||
| 111 | 111 | rx->q_num = idx; |
| 112 | 112 | |
| 113 | 113 | slots = priv->rx_pages_per_qpl; |
| 114 | − rx->data.mask = slots - 1; | |
| 114 | + rx->mask = slots - 1; | |
| 115 | 115 | |
| 116 | 116 | /* alloc rx data ring */ |
| 117 | 117 | bytes = sizeof(*rx->data.data_ring) * slots; |
| @@ -125,7 +125,7 @@ static int gve_rx_alloc_ring(struct gve_priv *priv, int idx) · 7 unmodified lines | ||
| 125 | 125 | err = -ENOMEM; |
| 126 | 126 | goto abort_with_slots; |
| 127 | 127 | } |
| 128 | − rx->desc.fill_cnt = filled_pages; | |
| 128 | + rx->fill_cnt = filled_pages; | |
| 129 | 129 | /* Ensure data ring slots (packet buffers) are visible. */ |
| 130 | 130 | dma_wmb(); |
| 131 | 131 | |
| @@ -156,8 +156,8 @@ static int gve_rx_alloc_ring(struct gve_priv *priv, int idx) · 24 unmodified lines | ||
| 156 | 156 | err = -ENOMEM; |
| 157 | 157 | goto abort_with_q_resources; |
| 158 | 158 | } |
| 159 | − rx->desc.mask = slots - 1; | |
| 160 | − rx->desc.cnt = 0; | |
| 159 | + rx->mask = slots - 1; | |
| 160 | + rx->cnt = 0; | |
| 161 | 161 | rx->desc.seqno = 1; |
| 162 | 162 | gve_rx_add_to_block(priv, idx); |
| 163 | 163 | |
| @@ -213,7 +213,7 @@ void gve_rx_write_doorbell(struct gve_priv *priv, struct gve_rx_ring *rx) · 49 unmodified lines | ||
| 213 | 213 | { |
| 214 | 214 | u32 db_idx = be32_to_cpu(rx->q_resources->db_index); |
| 215 | 215 | |
| 216 | − iowrite32be(rx->desc.fill_cnt, &priv->db_bar2[db_idx]); | |
| 216 | + iowrite32be(rx->fill_cnt, &priv->db_bar2[db_idx]); | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | static enum pkt_hash_types gve_rss_type(__be16 pkt_flags) |
| @@ -273,7 +273,7 @@ static void gve_rx_flip_buff(struct gve_rx_slot_page_info *page_info, · 53 unmodified lines | ||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc, |
| 276 | − netdev_features_t feat) | |
| 276 | + netdev_features_t feat, u32 idx) | |
| 277 | 277 | { |
| 278 | 278 | struct gve_rx_slot_page_info *page_info; |
| 279 | 279 | struct gve_priv *priv = rx->gve; |
| @@ -282,14 +282,12 @@ static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc, · 2 unmodified lines | ||
| 282 | 282 | struct sk_buff *skb; |
| 283 | 283 | int pagecount; |
| 284 | 284 | u16 len; |
| 285 | − u32 idx; | |
| 286 | 285 | |
| 287 | 286 | /* drop this packet */ |
| 288 | 287 | if (unlikely(rx_desc->flags_seq & GVE_RXF_ERR)) |
| 289 | 288 | return true; |
| 290 | 289 | |
| 291 | 290 | len = be16_to_cpu(rx_desc->len) - GVE_RX_PAD; |
| 292 | − idx = rx->data.cnt & rx->data.mask; | |
| 293 | 291 | page_info = &rx->data.page_info[idx]; |
| 294 | 292 | |
| 295 | 293 | /* gvnic can only receive into registered segments. If the buffer |
| @@ -340,8 +338,6 @@ have_skb: · 44 unmodified lines | ||
| 340 | 338 | if (!skb) |
| 341 | 339 | return true; |
| 342 | 340 | |
| 343 | − rx->data.cnt++; | |
| 344 | − | |
| 345 | 341 | if (likely(feat & NETIF_F_RXCSUM)) { |
| 346 | 342 | /* NIC passes up the partial sum */ |
| 347 | 343 | if (rx_desc->csum) |
| @@ -370,7 +366,7 @@ static bool gve_rx_work_pending(struct gve_rx_ring *rx) · 22 unmodified lines | ||
| 370 | 366 | __be16 flags_seq; |
| 371 | 367 | u32 next_idx; |
| 372 | 368 | |
| 373 | − next_idx = rx->desc.cnt & rx->desc.mask; | |
| 369 | + next_idx = rx->cnt & rx->mask; | |
| 374 | 370 | desc = rx->desc.desc_ring + next_idx; |
| 375 | 371 | |
| 376 | 372 | flags_seq = desc->flags_seq; |
| @@ -385,8 +381,8 @@ bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget, · 8 unmodified lines | ||
| 385 | 381 | { |
| 386 | 382 | struct gve_priv *priv = rx->gve; |
| 387 | 383 | struct gve_rx_desc *desc; |
| 388 | − u32 cnt = rx->desc.cnt; | |
| 389 | − u32 idx = cnt & rx->desc.mask; | |
| 384 | + u32 cnt = rx->cnt; | |
| 385 | + u32 idx = cnt & rx->mask; | |
| 390 | 386 | u32 work_done = 0; |
| 391 | 387 | u64 bytes = 0; |
| 392 | 388 | |
| @@ -401,10 +397,10 @@ bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget, · 8 unmodified lines | ||
| 401 | 397 | rx->q_num, GVE_SEQNO(desc->flags_seq), |
| 402 | 398 | rx->desc.seqno); |
| 403 | 399 | bytes += be16_to_cpu(desc->len) - GVE_RX_PAD; |
| 404 | − if (!gve_rx(rx, desc, feat)) | |
| 400 | + if (!gve_rx(rx, desc, feat, idx)) | |
| 405 | 401 | gve_schedule_reset(priv); |
| 406 | 402 | cnt++; |
| 407 | − idx = cnt & rx->desc.mask; | |
| 403 | + idx = cnt & rx->mask; | |
| 408 | 404 | desc = rx->desc.desc_ring + idx; |
| 409 | 405 | rx->desc.seqno = gve_next_seqno(rx->desc.seqno); |
| 410 | 406 | work_done++; |
| @@ -417,8 +413,8 @@ bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget, · 6 unmodified lines | ||
| 417 | 413 | rx->rpackets += work_done; |
| 418 | 414 | rx->rbytes += bytes; |
| 419 | 415 | u64_stats_update_end(&rx->statss); |
| 420 | − rx->desc.cnt = cnt; | |
| 421 | − rx->desc.fill_cnt += work_done; | |
| 416 | + rx->cnt = cnt; | |
| 417 | + rx->fill_cnt += work_done; | |
| 422 | 418 | |
| 423 | 419 | /* restock desc ring slots */ |
| 424 | 420 | dma_wmb(); /* Ensure descs are visible before ringing doorbell */ |
| @@ -220,6 +220,7 @@ struct hip04_priv { · 219 unmodified lines | ||
| 220 | 220 | unsigned int reg_inten; |
| 221 | 221 | |
| 222 | 222 | struct napi_struct napi; |
| 223 | + struct device *dev; | |
| 223 | 224 | struct net_device *ndev; |
| 224 | 225 | |
| 225 | 226 | struct tx_desc *tx_desc; |
| @@ -248,7 +249,7 @@ struct hip04_priv { · 22 unmodified lines | ||
| 248 | 249 | |
| 249 | 250 | static inline unsigned int tx_count(unsigned int head, unsigned int tail) |
| 250 | 251 | { |
| 251 | − return (head - tail) % (TX_DESC_NUM - 1); | |
| 252 | + return (head - tail) % TX_DESC_NUM; | |
| 252 | 253 | } |
| 253 | 254 | |
| 254 | 255 | static void hip04_config_port(struct net_device *ndev, u32 speed, u32 duplex) |
| @@ -465,7 +466,7 @@ static int hip04_tx_reclaim(struct net_device *ndev, bool force) · 210 unmodified lines | ||
| 465 | 466 | } |
| 466 | 467 | |
| 467 | 468 | if (priv->tx_phys[tx_tail]) { |
| 468 | − dma_unmap_single(&ndev->dev, priv->tx_phys[tx_tail], | |
| 469 | + dma_unmap_single(priv->dev, priv->tx_phys[tx_tail], | |
| 469 | 470 | priv->tx_skb[tx_tail]->len, |
| 470 | 471 | DMA_TO_DEVICE); |
| 471 | 472 | priv->tx_phys[tx_tail] = 0; |
| @@ -516,8 +517,8 @@ hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 44 unmodified lines | ||
| 516 | 517 | return NETDEV_TX_BUSY; |
| 517 | 518 | } |
| 518 | 519 | |
| 519 | − phys = dma_map_single(&ndev->dev, skb->data, skb->len, DMA_TO_DEVICE); | |
| 520 | − if (dma_mapping_error(&ndev->dev, phys)) { | |
| 520 | + phys = dma_map_single(priv->dev, skb->data, skb->len, DMA_TO_DEVICE); | |
| 521 | + if (dma_mapping_error(priv->dev, phys)) { | |
| 521 | 522 | dev_kfree_skb(skb); |
| 522 | 523 | return NETDEV_TX_OK; |
| 523 | 524 | } |
| @@ -585,6 +586,9 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 61 unmodified lines | ||
| 585 | 586 | u16 len; |
| 586 | 587 | u32 err; |
| 587 | 588 | |
| 589 | + /* clean up tx descriptors */ | |
| 590 | + tx_remaining = hip04_tx_reclaim(ndev, false); | |
| 591 | + | |
| 588 | 592 | while (cnt && !last) { |
| 589 | 593 | buf = priv->rx_buf[priv->rx_head]; |
| 590 | 594 | skb = build_skb(buf, priv->rx_buf_size); |
| @@ -593,7 +597,7 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 2 unmodified lines | ||
| 593 | 597 | goto refill; |
| 594 | 598 | } |
| 595 | 599 | |
| 596 | − dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head], | |
| 600 | + dma_unmap_single(priv->dev, priv->rx_phys[priv->rx_head], | |
| 597 | 601 | RX_BUF_SIZE, DMA_FROM_DEVICE); |
| 598 | 602 | priv->rx_phys[priv->rx_head] = 0; |
| 599 | 603 | |
| @@ -622,9 +626,9 @@ refill: · 22 unmodified lines | ||
| 622 | 626 | buf = netdev_alloc_frag(priv->rx_buf_size); |
| 623 | 627 | if (!buf) |
| 624 | 628 | goto done; |
| 625 | − phys = dma_map_single(&ndev->dev, buf, | |
| 629 | + phys = dma_map_single(priv->dev, buf, | |
| 626 | 630 | RX_BUF_SIZE, DMA_FROM_DEVICE); |
| 627 | − if (dma_mapping_error(&ndev->dev, phys)) | |
| 631 | + if (dma_mapping_error(priv->dev, phys)) | |
| 628 | 632 | goto done; |
| 629 | 633 | priv->rx_buf[priv->rx_head] = buf; |
| 630 | 634 | priv->rx_phys[priv->rx_head] = phys; |
| @@ -645,8 +649,7 @@ refill: · 14 unmodified lines | ||
| 645 | 649 | } |
| 646 | 650 | napi_complete_done(napi, rx); |
| 647 | 651 | done: |
| 648 | − /* clean up tx descriptors and start a new timer if necessary */ | |
| 649 | − tx_remaining = hip04_tx_reclaim(ndev, false); | |
| 652 | + /* start a new timer if necessary */ | |
| 650 | 653 | if (rx < budget && tx_remaining) |
| 651 | 654 | hip04_start_tx_timer(priv); |
| 652 | 655 | |
| @@ -728,9 +731,9 @@ static int hip04_mac_open(struct net_device *ndev) · 75 unmodified lines | ||
| 728 | 731 | for (i = 0; i < RX_DESC_NUM; i++) { |
| 729 | 732 | dma_addr_t phys; |
| 730 | 733 | |
| 731 | − phys = dma_map_single(&ndev->dev, priv->rx_buf[i], | |
| 734 | + phys = dma_map_single(priv->dev, priv->rx_buf[i], | |
| 732 | 735 | RX_BUF_SIZE, DMA_FROM_DEVICE); |
| 733 | − if (dma_mapping_error(&ndev->dev, phys)) | |
| 736 | + if (dma_mapping_error(priv->dev, phys)) | |
| 734 | 737 | return -EIO; |
| 735 | 738 | |
| 736 | 739 | priv->rx_phys[i] = phys; |
| @@ -764,7 +767,7 @@ static int hip04_mac_stop(struct net_device *ndev) · 27 unmodified lines | ||
| 764 | 767 | |
| 765 | 768 | for (i = 0; i < RX_DESC_NUM; i++) { |
| 766 | 769 | if (priv->rx_phys[i]) { |
| 767 | − dma_unmap_single(&ndev->dev, priv->rx_phys[i], | |
| 770 | + dma_unmap_single(priv->dev, priv->rx_phys[i], | |
| 768 | 771 | RX_BUF_SIZE, DMA_FROM_DEVICE); |
| 769 | 772 | priv->rx_phys[i] = 0; |
| 770 | 773 | } |
| @@ -907,6 +910,7 @@ static int hip04_mac_probe(struct platform_device *pdev) · 136 unmodified lines | ||
| 907 | 910 | return -ENOMEM; |
| 908 | 911 | |
| 909 | 912 | priv = netdev_priv(ndev); |
| 913 | + priv->dev = d; | |
| 910 | 914 | priv->ndev = ndev; |
| 911 | 915 | platform_set_drvdata(pdev, ndev); |
| 912 | 916 | SET_NETDEV_DEV(ndev, &pdev->dev); |
| @@ -3251,7 +3251,7 @@ static int ehea_mem_notifier(struct notifier_block *nb, · 3250 unmodified lines | ||
| 3251 | 3251 | switch (action) { |
| 3252 | 3252 | case MEM_CANCEL_OFFLINE: |
| 3253 | 3253 | pr_info("memory offlining canceled"); |
| 3254 | − /* Fall through: re-add canceled memory block */ | |
| 3254 | + /* Fall through - re-add canceled memory block */ | |
| 3255 | 3255 | |
| 3256 | 3256 | case MEM_ONLINE: |
| 3257 | 3257 | pr_info("memory is going online"); |
| @@ -319,20 +319,33 @@ static int orion_mdio_probe(struct platform_device *pdev) · 318 unmodified lines | ||
| 319 | 319 | |
| 320 | 320 | init_waitqueue_head(&dev->smi_busy_wait); |
| 321 | 321 | |
| 322 | − for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { | |
| 323 | − dev->clk[i] = of_clk_get(pdev->dev.of_node, i); | |
| 324 | − if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) { | |
| 322 | + if (pdev->dev.of_node) { | |
| 323 | + for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { | |
| 324 | + dev->clk[i] = of_clk_get(pdev->dev.of_node, i); | |
| 325 | + if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) { | |
| 326 | + ret = -EPROBE_DEFER; | |
| 327 | + goto out_clk; | |
| 328 | + } | |
| 329 | + if (IS_ERR(dev->clk[i])) | |
| 330 | + break; | |
| 331 | + clk_prepare_enable(dev->clk[i]); | |
| 332 | + } | |
| 333 | + | |
| 334 | + if (!IS_ERR(of_clk_get(pdev->dev.of_node, | |
| 335 | + ARRAY_SIZE(dev->clk)))) | |
| 336 | + dev_warn(&pdev->dev, | |
| 337 | + "unsupported number of clocks, limiting to the first " | |
| 338 | + __stringify(ARRAY_SIZE(dev->clk)) "\n"); | |
| 339 | + } else { | |
| 340 | + dev->clk[0] = clk_get(&pdev->dev, NULL); | |
| 341 | + if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) { | |
| 325 | 342 | ret = -EPROBE_DEFER; |
| 326 | 343 | goto out_clk; |
| 327 | 344 | } |
| 328 | − if (IS_ERR(dev->clk[i])) | |
| 329 | − break; | |
| 330 | − clk_prepare_enable(dev->clk[i]); | |
| 345 | + if (!IS_ERR(dev->clk[0])) | |
| 346 | + clk_prepare_enable(dev->clk[0]); | |
| 331 | 347 | } |
| 332 | 348 | |
| 333 | − if (!IS_ERR(of_clk_get(pdev->dev.of_node, ARRAY_SIZE(dev->clk)))) | |
| 334 | − dev_warn(&pdev->dev, "unsupported number of clocks, limiting to the first " | |
| 335 | − __stringify(ARRAY_SIZE(dev->clk)) "\n"); | |
| 336 | 349 | |
| 337 | 350 | dev->err_interrupt = platform_get_irq(pdev, 0); |
| 338 | 351 | if (dev->err_interrupt > 0 && |
| @@ -811,6 +811,26 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) · 810 unmodified lines | ||
| 811 | 811 | return 0; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | +static void mvpp2_set_hw_csum(struct mvpp2_port *port, | |
| 815 | + enum mvpp2_bm_pool_log_num new_long_pool) | |
| 816 | +{ | |
| 817 | + const netdev_features_t csums = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | |
| 818 | + | |
| 819 | + /* Update L4 checksum when jumbo enable/disable on port. | |
| 820 | + * Only port 0 supports hardware checksum offload due to | |
| 821 | + * the Tx FIFO size limitation. | |
| 822 | + * Also, don't set NETIF_F_HW_CSUM because L3_offset in TX descriptor | |
| 823 | + * has 7 bits, so the maximum L3 offset is 128. | |
| 824 | + */ | |
| 825 | + if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { | |
| 826 | + port->dev->features &= ~csums; | |
| 827 | + port->dev->hw_features &= ~csums; | |
| 828 | + } else { | |
| 829 | + port->dev->features |= csums; | |
| 830 | + port->dev->hw_features |= csums; | |
| 831 | + } | |
| 832 | +} | |
| 833 | + | |
| 814 | 834 | static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu) |
| 815 | 835 | { |
| 816 | 836 | struct mvpp2_port *port = netdev_priv(dev); |
| @@ -843,15 +863,7 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu) · 26 unmodified lines | ||
| 843 | 863 | /* Add port to new short & long pool */ |
| 844 | 864 | mvpp2_swf_bm_pool_init(port); |
| 845 | 865 | |
| 846 | − /* Update L4 checksum when jumbo enable/disable on port */ | |
| 847 | − if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { | |
| 848 | − dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | |
| 849 | − dev->hw_features &= ~(NETIF_F_IP_CSUM | | |
| 850 | − NETIF_F_IPV6_CSUM); | |
| 851 | − } else { | |
| 852 | − dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | |
| 853 | − dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | |
| 854 | − } | |
| 866 | + mvpp2_set_hw_csum(port, new_long_pool); | |
| 855 | 867 | } |
| 856 | 868 | |
| 857 | 869 | dev->mtu = mtu; |
| @@ -3700,6 +3712,7 @@ static int mvpp2_set_mac_address(struct net_device *dev, void *p) · 2842 unmodified lines | ||
| 3700 | 3712 | static int mvpp2_change_mtu(struct net_device *dev, int mtu) |
| 3701 | 3713 | { |
| 3702 | 3714 | struct mvpp2_port *port = netdev_priv(dev); |
| 3715 | + bool running = netif_running(dev); | |
| 3703 | 3716 | int err; |
| 3704 | 3717 | |
| 3705 | 3718 | if (!IS_ALIGNED(MVPP2_RX_PKT_SIZE(mtu), 8)) { |
| @@ -3708,40 +3721,24 @@ static int mvpp2_change_mtu(struct net_device *dev, int mtu) · 2 unmodified lines | ||
| 3708 | 3721 | mtu = ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8); |
| 3709 | 3722 | } |
| 3710 | 3723 | |
| 3711 | − if (!netif_running(dev)) { | |
| 3712 | − err = mvpp2_bm_update_mtu(dev, mtu); | |
| 3713 | − if (!err) { | |
| 3714 | − port->pkt_size = MVPP2_RX_PKT_SIZE(mtu); | |
| 3715 | − return 0; | |
| 3716 | − } | |
| 3717 | − | |
| 3718 | − /* Reconfigure BM to the original MTU */ | |
| 3719 | − err = mvpp2_bm_update_mtu(dev, dev->mtu); | |
| 3720 | − if (err) | |
| 3721 | − goto log_error; | |
| 3722 | − } | |
| 3723 | − | |
| 3724 | − mvpp2_stop_dev(port); | |
| 3724 | + if (running) | |
| 3725 | + mvpp2_stop_dev(port); | |
| 3725 | 3726 | |
| 3726 | 3727 | err = mvpp2_bm_update_mtu(dev, mtu); |
| 3727 | − if (!err) { | |
| 3728 | + if (err) { | |
| 3729 | + netdev_err(dev, "failed to change MTU\n"); | |
| 3730 | + /* Reconfigure BM to the original MTU */ | |
| 3731 | + mvpp2_bm_update_mtu(dev, dev->mtu); | |
| 3732 | + } else { | |
| 3728 | 3733 | port->pkt_size = MVPP2_RX_PKT_SIZE(mtu); |
| 3729 | − goto out_start; | |
| 3730 | 3734 | } |
| 3731 | 3735 | |
| 3732 | − /* Reconfigure BM to the original MTU */ | |
| 3733 | − err = mvpp2_bm_update_mtu(dev, dev->mtu); | |
| 3734 | − if (err) | |
| 3735 | − goto log_error; | |
| 3736 | − | |
| 3737 | −out_start: | |
| 3738 | − mvpp2_start_dev(port); | |
| 3739 | − mvpp2_egress_enable(port); | |
| 3740 | − mvpp2_ingress_enable(port); | |
| 3736 | + if (running) { | |
| 3737 | + mvpp2_start_dev(port); | |
| 3738 | + mvpp2_egress_enable(port); | |
| 3739 | + mvpp2_ingress_enable(port); | |
| 3740 | + } | |
| 3741 | 3741 | |
| 3742 | − return 0; | |
| 3743 | −log_error: | |
| 3744 | − netdev_err(dev, "failed to change MTU\n"); | |
| 3745 | 3742 | return err; |
| 3746 | 3743 | } |
| 3747 | 3744 | |
| @@ -4739,9 +4736,9 @@ static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode, · 991 unmodified lines | ||
| 4739 | 4736 | else |
| 4740 | 4737 | ctrl0 &= ~MVPP22_XLG_CTRL0_RX_FLOW_CTRL_EN; |
| 4741 | 4738 | |
| 4742 | − ctrl4 &= ~MVPP22_XLG_CTRL4_MACMODSELECT_GMAC; | |
| 4743 | − ctrl4 |= MVPP22_XLG_CTRL4_FWD_FC | MVPP22_XLG_CTRL4_FWD_PFC | | |
| 4744 | − MVPP22_XLG_CTRL4_EN_IDLE_CHECK; | |
| 4739 | + ctrl4 &= ~(MVPP22_XLG_CTRL4_MACMODSELECT_GMAC | | |
| 4740 | + MVPP22_XLG_CTRL4_EN_IDLE_CHECK); | |
| 4741 | + ctrl4 |= MVPP22_XLG_CTRL4_FWD_FC | MVPP22_XLG_CTRL4_FWD_PFC; | |
| 4745 | 4742 | |
| 4746 | 4743 | if (old_ctrl0 != ctrl0) |
| 4747 | 4744 | writel(ctrl0, port->base + MVPP22_XLG_CTRL0_REG); |
| @@ -5208,10 +5205,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 460 unmodified lines | ||
| 5208 | 5205 | dev->features |= NETIF_F_NTUPLE; |
| 5209 | 5206 | } |
| 5210 | 5207 | |
| 5211 | − if (port->pool_long->id == MVPP2_BM_JUMBO && port->id != 0) { | |
| 5212 | − dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | |
| 5213 | − dev->hw_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | |
| 5214 | − } | |
| 5208 | + mvpp2_set_hw_csum(port, port->pool_long->id); | |
| 5215 | 5209 | |
| 5216 | 5210 | dev->vlan_features |= features; |
| 5217 | 5211 | dev->gso_max_segs = MVPP2_MAX_TSO_SEGS; |
| @@ -5759,9 +5753,6 @@ static int mvpp2_remove(struct platform_device *pdev) · 541 unmodified lines | ||
| 5759 | 5753 | |
| 5760 | 5754 | mvpp2_dbgfs_cleanup(priv); |
| 5761 | 5755 | |
| 5762 | − flush_workqueue(priv->stats_queue); | |
| 5763 | − destroy_workqueue(priv->stats_queue); | |
| 5764 | − | |
| 5765 | 5756 | fwnode_for_each_available_child_node(fwnode, port_fwnode) { |
| 5766 | 5757 | if (priv->port_list[i]) { |
| 5767 | 5758 | mutex_destroy(&priv->port_list[i]->gather_stats_lock); |
| @@ -5770,6 +5761,8 @@ static int mvpp2_remove(struct platform_device *pdev) · 2 unmodified lines | ||
| 5770 | 5761 | i++; |
| 5771 | 5762 | } |
| 5772 | 5763 | |
| 5764 | + destroy_workqueue(priv->stats_queue); | |
| 5765 | + | |
| 5773 | 5766 | for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) { |
| 5774 | 5767 | struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i]; |
| 5775 | 5768 | |
| @@ -4924,6 +4924,13 @@ static const struct dmi_system_id msi_blacklist[] = { · 4923 unmodified lines | ||
| 4924 | 4924 | DMI_MATCH(DMI_PRODUCT_NAME, "P5W DH Deluxe"), |
| 4925 | 4925 | }, |
| 4926 | 4926 | }, |
| 4927 | + { | |
| 4928 | + .ident = "ASUS P6T", | |
| 4929 | + .matches = { | |
| 4930 | + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | |
| 4931 | + DMI_MATCH(DMI_BOARD_NAME, "P6T"), | |
| 4932 | + }, | |
| 4933 | + }, | |
| 4927 | 4934 | {} |
| 4928 | 4935 | }; |
| 4929 | 4936 | |
| @@ -9,7 +9,6 @@ if NET_VENDOR_MEDIATEK · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | config NET_MEDIATEK_SOC |
| 11 | 11 | tristate "MediaTek SoC Gigabit Ethernet support" |
| 12 | − depends on NET_VENDOR_MEDIATEK | |
| 13 | 12 | select PHYLIB |
| 14 | 13 | ---help--- |
| 15 | 14 | This driver supports the gigabit ethernet MACs in the |
| @@ -213,7 +213,7 @@ void mlx5_unregister_device(struct mlx5_core_dev *dev) · 212 unmodified lines | ||
| 213 | 213 | struct mlx5_interface *intf; |
| 214 | 214 | |
| 215 | 215 | mutex_lock(&mlx5_intf_mutex); |
| 216 | − list_for_each_entry(intf, &intf_list, list) | |
| 216 | + list_for_each_entry_reverse(intf, &intf_list, list) | |
| 217 | 217 | mlx5_remove_device(intf, priv); |
| 218 | 218 | list_del(&priv->dev_list); |
| 219 | 219 | mutex_unlock(&mlx5_intf_mutex); |
| @@ -159,7 +159,7 @@ do { \ · 158 unmodified lines | ||
| 159 | 159 | enum mlx5e_rq_group { |
| 160 | 160 | MLX5E_RQ_GROUP_REGULAR, |
| 161 | 161 | MLX5E_RQ_GROUP_XSK, |
| 162 | − MLX5E_NUM_RQ_GROUPS /* Keep last. */ | |
| 162 | +#define MLX5E_NUM_RQ_GROUPS(g) (1 + MLX5E_RQ_GROUP_##g) | |
| 163 | 163 | }; |
| 164 | 164 | |
| 165 | 165 | static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size) |
| @@ -182,14 +182,6 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev) · 16 unmodified lines | ||
| 182 | 182 | min_t(int, mlx5_comp_vectors_count(mdev), MLX5E_MAX_NUM_CHANNELS); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | −/* Use this function to get max num channels after netdev was created */ | |
| 186 | −static inline int mlx5e_get_netdev_max_channels(struct net_device *netdev) | |
| 187 | −{ | |
| 188 | − return min_t(unsigned int, | |
| 189 | − netdev->num_rx_queues / MLX5E_NUM_RQ_GROUPS, | |
| 190 | − netdev->num_tx_queues); | |
| 191 | −} | |
| 192 | − | |
| 193 | 185 | struct mlx5e_tx_wqe { |
| 194 | 186 | struct mlx5_wqe_ctrl_seg ctrl; |
| 195 | 187 | struct mlx5_wqe_eth_seg eth; |
| @@ -830,6 +822,7 @@ struct mlx5e_priv { · 634 unmodified lines | ||
| 830 | 822 | struct net_device *netdev; |
| 831 | 823 | struct mlx5e_stats stats; |
| 832 | 824 | struct mlx5e_channel_stats channel_stats[MLX5E_MAX_NUM_CHANNELS]; |
| 825 | + u16 max_nch; | |
| 833 | 826 | u8 max_opened_tc; |
| 834 | 827 | struct hwtstamp_config tstamp; |
| 835 | 828 | u16 q_counter; |
| @@ -871,6 +864,7 @@ struct mlx5e_profile { · 35 unmodified lines | ||
| 871 | 864 | mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe; |
| 872 | 865 | } rx_handlers; |
| 873 | 866 | int max_tc; |
| 867 | + u8 rq_groups; | |
| 874 | 868 | }; |
| 875 | 869 | |
| 876 | 870 | void mlx5e_build_ptys2ethtool_map(void); |
| @@ -66,9 +66,10 @@ static inline void mlx5e_qid_get_ch_and_group(struct mlx5e_params *params, · 65 unmodified lines | ||
| 66 | 66 | *group = qid / nch; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | −static inline bool mlx5e_qid_validate(struct mlx5e_params *params, u64 qid) | |
| 69 | +static inline bool mlx5e_qid_validate(const struct mlx5e_profile *profile, | |
| 70 | + struct mlx5e_params *params, u64 qid) | |
| 70 | 71 | { |
| 71 | − return qid < params->num_channels * MLX5E_NUM_RQ_GROUPS; | |
| 72 | + return qid < params->num_channels * profile->rq_groups; | |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | /* Parameter calculations */ |
| @@ -78,9 +78,10 @@ static const u32 mlx5e_ext_link_speed[MLX5E_EXT_LINK_MODES_NUMBER] = { · 77 unmodified lines | ||
| 78 | 78 | }; |
| 79 | 79 | |
| 80 | 80 | static void mlx5e_port_get_speed_arr(struct mlx5_core_dev *mdev, |
| 81 | − const u32 **arr, u32 *size) | |
| 81 | + const u32 **arr, u32 *size, | |
| 82 | + bool force_legacy) | |
| 82 | 83 | { |
| 83 | − bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); | |
| 84 | + bool ext = force_legacy ? false : MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); | |
| 84 | 85 | |
| 85 | 86 | *size = ext ? ARRAY_SIZE(mlx5e_ext_link_speed) : |
| 86 | 87 | ARRAY_SIZE(mlx5e_link_speed); |
| @@ -152,7 +153,8 @@ int mlx5_port_set_eth_ptys(struct mlx5_core_dev *dev, bool an_disable, · 65 unmodified lines | ||
| 152 | 153 | sizeof(out), MLX5_REG_PTYS, 0, 1); |
| 153 | 154 | } |
| 154 | 155 | |
| 155 | −u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper) | |
| 156 | +u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper, | |
| 157 | + bool force_legacy) | |
| 156 | 158 | { |
| 157 | 159 | unsigned long temp = eth_proto_oper; |
| 158 | 160 | const u32 *table; |
| @@ -160,7 +162,7 @@ u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper) · 1 unmodified line | ||
| 160 | 162 | u32 max_size; |
| 161 | 163 | int i; |
| 162 | 164 | |
| 163 | − mlx5e_port_get_speed_arr(mdev, &table, &max_size); | |
| 165 | + mlx5e_port_get_speed_arr(mdev, &table, &max_size, force_legacy); | |
| 164 | 166 | i = find_first_bit(&temp, max_size); |
| 165 | 167 | if (i < max_size) |
| 166 | 168 | speed = table[i]; |
| @@ -170,6 +172,7 @@ u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper) · 3 unmodified lines | ||
| 170 | 172 | int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) |
| 171 | 173 | { |
| 172 | 174 | struct mlx5e_port_eth_proto eproto; |
| 175 | + bool force_legacy = false; | |
| 173 | 176 | bool ext; |
| 174 | 177 | int err; |
| 175 | 178 | |
| @@ -177,8 +180,13 @@ int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) · 1 unmodified line | ||
| 177 | 180 | err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto); |
| 178 | 181 | if (err) |
| 179 | 182 | goto out; |
| 180 | − | |
| 181 | − *speed = mlx5e_port_ptys2speed(mdev, eproto.oper); | |
| 183 | + if (ext && !eproto.admin) { | |
| 184 | + force_legacy = true; | |
| 185 | + err = mlx5_port_query_eth_proto(mdev, 1, false, &eproto); | |
| 186 | + if (err) | |
| 187 | + goto out; | |
| 188 | + } | |
| 189 | + *speed = mlx5e_port_ptys2speed(mdev, eproto.oper, force_legacy); | |
| 182 | 190 | if (!(*speed)) |
| 183 | 191 | err = -EINVAL; |
| 184 | 192 | |
| @@ -201,7 +209,7 @@ int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) · 16 unmodified lines | ||
| 201 | 209 | if (err) |
| 202 | 210 | return err; |
| 203 | 211 | |
| 204 | − mlx5e_port_get_speed_arr(mdev, &table, &max_size); | |
| 212 | + mlx5e_port_get_speed_arr(mdev, &table, &max_size, false); | |
| 205 | 213 | for (i = 0; i < max_size; ++i) |
| 206 | 214 | if (eproto.cap & MLX5E_PROT_MASK(i)) |
| 207 | 215 | max_speed = max(max_speed, table[i]); |
| @@ -210,14 +218,15 @@ int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) · 2 unmodified lines | ||
| 210 | 218 | return 0; |
| 211 | 219 | } |
| 212 | 220 | |
| 213 | −u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed) | |
| 221 | +u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed, | |
| 222 | + bool force_legacy) | |
| 214 | 223 | { |
| 215 | 224 | u32 link_modes = 0; |
| 216 | 225 | const u32 *table; |
| 217 | 226 | u32 max_size; |
| 218 | 227 | int i; |
| 219 | 228 | |
| 220 | − mlx5e_port_get_speed_arr(mdev, &table, &max_size); | |
| 229 | + mlx5e_port_get_speed_arr(mdev, &table, &max_size, force_legacy); | |
| 221 | 230 | for (i = 0; i < max_size; ++i) { |
| 222 | 231 | if (table[i] == speed) |
| 223 | 232 | link_modes |= MLX5E_PROT_MASK(i); |
| @@ -48,10 +48,12 @@ void mlx5_port_query_eth_autoneg(struct mlx5_core_dev *dev, u8 *an_status, · 47 unmodified lines | ||
| 48 | 48 | u8 *an_disable_cap, u8 *an_disable_admin); |
| 49 | 49 | int mlx5_port_set_eth_ptys(struct mlx5_core_dev *dev, bool an_disable, |
| 50 | 50 | u32 proto_admin, bool ext); |
| 51 | −u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper); | |
| 51 | +u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper, | |
| 52 | + bool force_legacy); | |
| 52 | 53 | int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); |
| 53 | 54 | int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); |
| 54 | −u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed); | |
| 55 | +u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed, | |
| 56 | + bool force_legacy); | |
| 55 | 57 | |
| 56 | 58 | int mlx5e_port_query_pbmc(struct mlx5_core_dev *mdev, void *out); |
| 57 | 59 | int mlx5e_port_set_pbmc(struct mlx5_core_dev *mdev, void *in); |
| @@ -412,7 +412,7 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev, · 411 unmodified lines | ||
| 412 | 412 | goto out; |
| 413 | 413 | |
| 414 | 414 | tls_ctx = tls_get_ctx(skb->sk); |
| 415 | − if (unlikely(tls_ctx->netdev != netdev)) | |
| 415 | + if (unlikely(WARN_ON_ONCE(tls_ctx->netdev != netdev))) | |
| 416 | 416 | goto err_out; |
| 417 | 417 | |
| 418 | 418 | priv_tx = mlx5e_get_ktls_tx_priv_ctx(tls_ctx); |
| @@ -391,7 +391,7 @@ void mlx5e_ethtool_get_channels(struct mlx5e_priv *priv, · 390 unmodified lines | ||
| 391 | 391 | { |
| 392 | 392 | mutex_lock(&priv->state_lock); |
| 393 | 393 | |
| 394 | − ch->max_combined = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 394 | + ch->max_combined = priv->max_nch; | |
| 395 | 395 | ch->combined_count = priv->channels.params.num_channels; |
| 396 | 396 | if (priv->xsk.refcnt) { |
| 397 | 397 | /* The upper half are XSK queues. */ |
| @@ -785,7 +785,7 @@ static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings · 387 unmodified lines | ||
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | static void get_speed_duplex(struct net_device *netdev, |
| 788 | − u32 eth_proto_oper, | |
| 788 | + u32 eth_proto_oper, bool force_legacy, | |
| 789 | 789 | struct ethtool_link_ksettings *link_ksettings) |
| 790 | 790 | { |
| 791 | 791 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| @@ -795,7 +795,7 @@ static void get_speed_duplex(struct net_device *netdev, · 3 unmodified lines | ||
| 795 | 795 | if (!netif_carrier_ok(netdev)) |
| 796 | 796 | goto out; |
| 797 | 797 | |
| 798 | − speed = mlx5e_port_ptys2speed(priv->mdev, eth_proto_oper); | |
| 798 | + speed = mlx5e_port_ptys2speed(priv->mdev, eth_proto_oper, force_legacy); | |
| 799 | 799 | if (!speed) { |
| 800 | 800 | speed = SPEED_UNKNOWN; |
| 801 | 801 | goto out; |
| @@ -914,8 +914,8 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 112 unmodified lines | ||
| 914 | 914 | /* Fields: eth_proto_admin and ext_eth_proto_admin are |
| 915 | 915 | * mutually exclusive. Hence try reading legacy advertising |
| 916 | 916 | * when extended advertising is zero. |
| 917 | − * admin_ext indicates how eth_proto_admin should be | |
| 918 | − * interpreted | |
| 917 | + * admin_ext indicates which proto_admin (ext vs. legacy) | |
| 918 | + * should be read and interpreted | |
| 919 | 919 | */ |
| 920 | 920 | admin_ext = ext; |
| 921 | 921 | if (ext && !eth_proto_admin) { |
| @@ -924,7 +924,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 2 unmodified lines | ||
| 924 | 924 | admin_ext = false; |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | − eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, | |
| 927 | + eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, admin_ext, | |
| 928 | 928 | eth_proto_oper); |
| 929 | 929 | eth_proto_lp = MLX5_GET(ptys_reg, out, eth_proto_lp_advertise); |
| 930 | 930 | an_disable_admin = MLX5_GET(ptys_reg, out, an_disable_admin); |
| @@ -939,7 +939,8 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 8 unmodified lines | ||
| 939 | 939 | get_supported(mdev, eth_proto_cap, link_ksettings); |
| 940 | 940 | get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings, |
| 941 | 941 | admin_ext); |
| 942 | − get_speed_duplex(priv->netdev, eth_proto_oper, link_ksettings); | |
| 942 | + get_speed_duplex(priv->netdev, eth_proto_oper, !admin_ext, | |
| 943 | + link_ksettings); | |
| 943 | 944 | |
| 944 | 945 | eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; |
| 945 | 946 | |
| @@ -1016,45 +1017,69 @@ static u32 mlx5e_ethtool2ptys_ext_adver_link(const unsigned long *link_modes) · 70 unmodified lines | ||
| 1016 | 1017 | return ptys_modes; |
| 1017 | 1018 | } |
| 1018 | 1019 | |
| 1020 | +static bool ext_link_mode_requested(const unsigned long *adver) | |
| 1021 | +{ | |
| 1022 | +#define MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT ETHTOOL_LINK_MODE_50000baseKR_Full_BIT | |
| 1023 | + int size = __ETHTOOL_LINK_MODE_MASK_NBITS - MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT; | |
| 1024 | + __ETHTOOL_DECLARE_LINK_MODE_MASK(modes); | |
| 1025 | + | |
| 1026 | + bitmap_set(modes, MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT, size); | |
| 1027 | + return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
| 1028 | +} | |
| 1029 | + | |
| 1030 | +static bool ext_speed_requested(u32 speed) | |
| 1031 | +{ | |
| 1032 | +#define MLX5E_MAX_PTYS_LEGACY_SPEED 100000 | |
| 1033 | + return !!(speed > MLX5E_MAX_PTYS_LEGACY_SPEED); | |
| 1034 | +} | |
| 1035 | + | |
| 1036 | +static bool ext_requested(u8 autoneg, const unsigned long *adver, u32 speed) | |
| 1037 | +{ | |
| 1038 | + bool ext_link_mode = ext_link_mode_requested(adver); | |
| 1039 | + bool ext_speed = ext_speed_requested(speed); | |
| 1040 | + | |
| 1041 | + return autoneg == AUTONEG_ENABLE ? ext_link_mode : ext_speed; | |
| 1042 | +} | |
| 1043 | + | |
| 1019 | 1044 | int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, |
| 1020 | 1045 | const struct ethtool_link_ksettings *link_ksettings) |
| 1021 | 1046 | { |
| 1022 | 1047 | struct mlx5_core_dev *mdev = priv->mdev; |
| 1023 | 1048 | struct mlx5e_port_eth_proto eproto; |
| 1049 | + const unsigned long *adver; | |
| 1024 | 1050 | bool an_changes = false; |
| 1025 | 1051 | u8 an_disable_admin; |
| 1026 | 1052 | bool ext_supported; |
| 1027 | − bool ext_requested; | |
| 1028 | 1053 | u8 an_disable_cap; |
| 1029 | 1054 | bool an_disable; |
| 1030 | 1055 | u32 link_modes; |
| 1031 | 1056 | u8 an_status; |
| 1057 | + u8 autoneg; | |
| 1032 | 1058 | u32 speed; |
| 1059 | + bool ext; | |
| 1033 | 1060 | int err; |
| 1034 | 1061 | |
| 1035 | 1062 | u32 (*ethtool2ptys_adver_func)(const unsigned long *adver); |
| 1036 | 1063 | |
| 1037 | −#define MLX5E_PTYS_EXT ((1ULL << ETHTOOL_LINK_MODE_50000baseKR_Full_BIT) - 1) | |
| 1064 | + adver = link_ksettings->link_modes.advertising; | |
| 1065 | + autoneg = link_ksettings->base.autoneg; | |
| 1066 | + speed = link_ksettings->base.speed; | |
| 1038 | 1067 | |
| 1039 | − ext_requested = !!(link_ksettings->link_modes.advertising[0] > | |
| 1040 | − MLX5E_PTYS_EXT || | |
| 1041 | − link_ksettings->link_modes.advertising[1]); | |
| 1068 | + ext = ext_requested(autoneg, adver, speed), | |
| 1042 | 1069 | ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); |
| 1043 | − ext_requested &= ext_supported; | |
| 1070 | + if (!ext_supported && ext) | |
| 1071 | + return -EOPNOTSUPP; | |
| 1044 | 1072 | |
| 1045 | − speed = link_ksettings->base.speed; | |
| 1046 | − ethtool2ptys_adver_func = ext_requested ? | |
| 1047 | − mlx5e_ethtool2ptys_ext_adver_link : | |
| 1073 | + ethtool2ptys_adver_func = ext ? mlx5e_ethtool2ptys_ext_adver_link : | |
| 1048 | 1074 | mlx5e_ethtool2ptys_adver_link; |
| 1049 | − err = mlx5_port_query_eth_proto(mdev, 1, ext_requested, &eproto); | |
| 1075 | + err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto); | |
| 1050 | 1076 | if (err) { |
| 1051 | 1077 | netdev_err(priv->netdev, "%s: query port eth proto failed: %d\n", |
| 1052 | 1078 | __func__, err); |
| 1053 | 1079 | goto out; |
| 1054 | 1080 | } |
| 1055 | − link_modes = link_ksettings->base.autoneg == AUTONEG_ENABLE ? | |
| 1056 | − ethtool2ptys_adver_func(link_ksettings->link_modes.advertising) : | |
| 1057 | − mlx5e_port_speed2linkmodes(mdev, speed); | |
| 1081 | + link_modes = autoneg == AUTONEG_ENABLE ? ethtool2ptys_adver_func(adver) : | |
| 1082 | + mlx5e_port_speed2linkmodes(mdev, speed, !ext); | |
| 1058 | 1083 | |
| 1059 | 1084 | link_modes = link_modes & eproto.cap; |
| 1060 | 1085 | if (!link_modes) { |
| @@ -1067,14 +1092,14 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, · 6 unmodified lines | ||
| 1067 | 1092 | mlx5_port_query_eth_autoneg(mdev, &an_status, &an_disable_cap, |
| 1068 | 1093 | &an_disable_admin); |
| 1069 | 1094 | |
| 1070 | − an_disable = link_ksettings->base.autoneg == AUTONEG_DISABLE; | |
| 1095 | + an_disable = autoneg == AUTONEG_DISABLE; | |
| 1071 | 1096 | an_changes = ((!an_disable && an_disable_admin) || |
| 1072 | 1097 | (an_disable && !an_disable_admin)); |
| 1073 | 1098 | |
| 1074 | 1099 | if (!an_changes && link_modes == eproto.admin) |
| 1075 | 1100 | goto out; |
| 1076 | 1101 | |
| 1077 | − mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_requested); | |
| 1102 | + mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext); | |
| 1078 | 1103 | mlx5_toggle_port_link(mdev); |
| 1079 | 1104 | |
| 1080 | 1105 | out: |
| @@ -611,7 +611,8 @@ static int validate_flow(struct mlx5e_priv *priv, · 610 unmodified lines | ||
| 611 | 611 | return -ENOSPC; |
| 612 | 612 | |
| 613 | 613 | if (fs->ring_cookie != RX_CLS_FLOW_DISC) |
| 614 | − if (!mlx5e_qid_validate(&priv->channels.params, fs->ring_cookie)) | |
| 614 | + if (!mlx5e_qid_validate(priv->profile, &priv->channels.params, | |
| 615 | + fs->ring_cookie)) | |
| 615 | 616 | return -EINVAL; |
| 616 | 617 | |
| 617 | 618 | switch (fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { |
| @@ -331,12 +331,11 @@ static inline u64 mlx5e_get_mpwqe_offset(struct mlx5e_rq *rq, u16 wqe_ix) · 330 unmodified lines | ||
| 331 | 331 | |
| 332 | 332 | static void mlx5e_init_frags_partition(struct mlx5e_rq *rq) |
| 333 | 333 | { |
| 334 | − struct mlx5e_wqe_frag_info next_frag, *prev; | |
| 334 | + struct mlx5e_wqe_frag_info next_frag = {}; | |
| 335 | + struct mlx5e_wqe_frag_info *prev = NULL; | |
| 335 | 336 | int i; |
| 336 | 337 | |
| 337 | 338 | next_frag.di = &rq->wqe.di[0]; |
| 338 | − next_frag.offset = 0; | |
| 339 | − prev = NULL; | |
| 340 | 339 | |
| 341 | 340 | for (i = 0; i < mlx5_wq_cyc_get_size(&rq->wqe.wq); i++) { |
| 342 | 341 | struct mlx5e_rq_frag_info *frag_info = &rq->wqe.info.arr[0]; |
| @@ -1677,10 +1676,10 @@ static int mlx5e_open_sqs(struct mlx5e_channel *c, · 1334 unmodified lines | ||
| 1677 | 1676 | struct mlx5e_channel_param *cparam) |
| 1678 | 1677 | { |
| 1679 | 1678 | struct mlx5e_priv *priv = c->priv; |
| 1680 | − int err, tc, max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 1679 | + int err, tc; | |
| 1681 | 1680 | |
| 1682 | 1681 | for (tc = 0; tc < params->num_tc; tc++) { |
| 1683 | − int txq_ix = c->ix + tc * max_nch; | |
| 1682 | + int txq_ix = c->ix + tc * priv->max_nch; | |
| 1684 | 1683 | |
| 1685 | 1684 | err = mlx5e_open_txqsq(c, c->priv->tisn[tc], txq_ix, |
| 1686 | 1685 | params, &cparam->sq, &c->sq[tc], tc); |
| @@ -2438,11 +2437,10 @@ int mlx5e_create_indirect_rqt(struct mlx5e_priv *priv) · 751 unmodified lines | ||
| 2438 | 2437 | |
| 2439 | 2438 | int mlx5e_create_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) |
| 2440 | 2439 | { |
| 2441 | − const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 2442 | 2440 | int err; |
| 2443 | 2441 | int ix; |
| 2444 | 2442 | |
| 2445 | − for (ix = 0; ix < max_nch; ix++) { | |
| 2443 | + for (ix = 0; ix < priv->max_nch; ix++) { | |
| 2446 | 2444 | err = mlx5e_create_rqt(priv, 1 /*size */, &tirs[ix].rqt); |
| 2447 | 2445 | if (unlikely(err)) |
| 2448 | 2446 | goto err_destroy_rqts; |
| @@ -2460,10 +2458,9 @@ err_destroy_rqts: · 11 unmodified lines | ||
| 2460 | 2458 | |
| 2461 | 2459 | void mlx5e_destroy_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) |
| 2462 | 2460 | { |
| 2463 | − const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 2464 | 2461 | int i; |
| 2465 | 2462 | |
| 2466 | − for (i = 0; i < max_nch; i++) | |
| 2463 | + for (i = 0; i < priv->max_nch; i++) | |
| 2467 | 2464 | mlx5e_destroy_rqt(priv, &tirs[i].rqt); |
| 2468 | 2465 | } |
| 2469 | 2466 | |
| @@ -2557,7 +2554,7 @@ static void mlx5e_redirect_rqts(struct mlx5e_priv *priv, · 87 unmodified lines | ||
| 2557 | 2554 | mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, rrp); |
| 2558 | 2555 | } |
| 2559 | 2556 | |
| 2560 | − for (ix = 0; ix < mlx5e_get_netdev_max_channels(priv->netdev); ix++) { | |
| 2557 | + for (ix = 0; ix < priv->max_nch; ix++) { | |
| 2561 | 2558 | struct mlx5e_redirect_rqt_param direct_rrp = { |
| 2562 | 2559 | .is_rss = false, |
| 2563 | 2560 | { |
| @@ -2758,7 +2755,7 @@ static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv) · 194 unmodified lines | ||
| 2758 | 2755 | goto free_in; |
| 2759 | 2756 | } |
| 2760 | 2757 | |
| 2761 | − for (ix = 0; ix < mlx5e_get_netdev_max_channels(priv->netdev); ix++) { | |
| 2758 | + for (ix = 0; ix < priv->max_nch; ix++) { | |
| 2762 | 2759 | err = mlx5_core_modify_tir(mdev, priv->direct_tir[ix].tirn, |
| 2763 | 2760 | in, inlen); |
| 2764 | 2761 | if (err) |
| @@ -2858,12 +2855,11 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev) · 93 unmodified lines | ||
| 2858 | 2855 | |
| 2859 | 2856 | static void mlx5e_build_tc2txq_maps(struct mlx5e_priv *priv) |
| 2860 | 2857 | { |
| 2861 | − int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 2862 | 2858 | int i, tc; |
| 2863 | 2859 | |
| 2864 | − for (i = 0; i < max_nch; i++) | |
| 2860 | + for (i = 0; i < priv->max_nch; i++) | |
| 2865 | 2861 | for (tc = 0; tc < priv->profile->max_tc; tc++) |
| 2866 | − priv->channel_tc2txq[i][tc] = i + tc * max_nch; | |
| 2862 | + priv->channel_tc2txq[i][tc] = i + tc * priv->max_nch; | |
| 2867 | 2863 | } |
| 2868 | 2864 | |
| 2869 | 2865 | static void mlx5e_build_tx2sq_maps(struct mlx5e_priv *priv) |
| @@ -2884,7 +2880,7 @@ static void mlx5e_build_tx2sq_maps(struct mlx5e_priv *priv) · 14 unmodified lines | ||
| 2884 | 2880 | void mlx5e_activate_priv_channels(struct mlx5e_priv *priv) |
| 2885 | 2881 | { |
| 2886 | 2882 | int num_txqs = priv->channels.num * priv->channels.params.num_tc; |
| 2887 | − int num_rxqs = priv->channels.num * MLX5E_NUM_RQ_GROUPS; | |
| 2883 | + int num_rxqs = priv->channels.num * priv->profile->rq_groups; | |
| 2888 | 2884 | struct net_device *netdev = priv->netdev; |
| 2889 | 2885 | |
| 2890 | 2886 | mlx5e_netdev_set_tcs(netdev); |
| @@ -3306,7 +3302,6 @@ err_destroy_inner_tirs: · 415 unmodified lines | ||
| 3306 | 3302 | |
| 3307 | 3303 | int mlx5e_create_direct_tirs(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) |
| 3308 | 3304 | { |
| 3309 | − const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 3310 | 3305 | struct mlx5e_tir *tir; |
| 3311 | 3306 | void *tirc; |
| 3312 | 3307 | int inlen; |
| @@ -3319,7 +3314,7 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) · 6 unmodified lines | ||
| 3319 | 3314 | if (!in) |
| 3320 | 3315 | return -ENOMEM; |
| 3321 | 3316 | |
| 3322 | − for (ix = 0; ix < max_nch; ix++) { | |
| 3317 | + for (ix = 0; ix < priv->max_nch; ix++) { | |
| 3323 | 3318 | memset(in, 0, inlen); |
| 3324 | 3319 | tir = &tirs[ix]; |
| 3325 | 3320 | tirc = MLX5_ADDR_OF(create_tir_in, in, ctx); |
| @@ -3358,10 +3353,9 @@ void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc) · 32 unmodified lines | ||
| 3358 | 3353 | |
| 3359 | 3354 | void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) |
| 3360 | 3355 | { |
| 3361 | − const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 3362 | 3356 | int i; |
| 3363 | 3357 | |
| 3364 | − for (i = 0; i < max_nch; i++) | |
| 3358 | + for (i = 0; i < priv->max_nch; i++) | |
| 3365 | 3359 | mlx5e_destroy_tir(priv->mdev, &tirs[i]); |
| 3366 | 3360 | } |
| 3367 | 3361 | |
| @@ -3487,7 +3481,7 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s) · 119 unmodified lines | ||
| 3487 | 3481 | { |
| 3488 | 3482 | int i; |
| 3489 | 3483 | |
| 3490 | − for (i = 0; i < mlx5e_get_netdev_max_channels(priv->netdev); i++) { | |
| 3484 | + for (i = 0; i < priv->max_nch; i++) { | |
| 3491 | 3485 | struct mlx5e_channel_stats *channel_stats = &priv->channel_stats[i]; |
| 3492 | 3486 | struct mlx5e_rq_stats *xskrq_stats = &channel_stats->xskrq; |
| 3493 | 3487 | struct mlx5e_rq_stats *rq_stats = &channel_stats->rq; |
| @@ -4960,8 +4954,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev, · 1466 unmodified lines | ||
| 4960 | 4954 | return err; |
| 4961 | 4955 | |
| 4962 | 4956 | mlx5e_build_nic_params(mdev, &priv->xsk, rss, &priv->channels.params, |
| 4963 | − mlx5e_get_netdev_max_channels(netdev), | |
| 4964 | − netdev->mtu); | |
| 4957 | + priv->max_nch, netdev->mtu); | |
| 4965 | 4958 | |
| 4966 | 4959 | mlx5e_timestamp_init(priv); |
| 4967 | 4960 | |
| @@ -5164,6 +5157,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = { · 196 unmodified lines | ||
| 5164 | 5157 | .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe, |
| 5165 | 5158 | .rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq, |
| 5166 | 5159 | .max_tc = MLX5E_MAX_NUM_TC, |
| 5160 | + .rq_groups = MLX5E_NUM_RQ_GROUPS(XSK), | |
| 5167 | 5161 | }; |
| 5168 | 5162 | |
| 5169 | 5163 | /* mlx5e generic netdev management API (move to en_common.c) */ |
| @@ -5181,6 +5175,7 @@ int mlx5e_netdev_init(struct net_device *netdev, · 11 unmodified lines | ||
| 5181 | 5175 | priv->profile = profile; |
| 5182 | 5176 | priv->ppriv = ppriv; |
| 5183 | 5177 | priv->msglevel = MLX5E_MSG_LEVEL; |
| 5178 | + priv->max_nch = netdev->num_rx_queues / max_t(u8, profile->rq_groups, 1); | |
| 5184 | 5179 | priv->max_opened_tc = 1; |
| 5185 | 5180 | |
| 5186 | 5181 | mutex_init(&priv->state_lock); |
| @@ -5218,7 +5213,7 @@ struct net_device *mlx5e_create_netdev(struct mlx5_core_dev *mdev, · 31 unmodified lines | ||
| 5218 | 5213 | |
| 5219 | 5214 | netdev = alloc_etherdev_mqs(sizeof(struct mlx5e_priv), |
| 5220 | 5215 | nch * profile->max_tc, |
| 5221 | − nch * MLX5E_NUM_RQ_GROUPS); | |
| 5216 | + nch * profile->rq_groups); | |
| 5222 | 5217 | if (!netdev) { |
| 5223 | 5218 | mlx5_core_err(mdev, "alloc_etherdev_mqs() failed\n"); |
| 5224 | 5219 | return NULL; |
| @@ -1701,6 +1701,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = { · 1700 unmodified lines | ||
| 1701 | 1701 | .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe_rep, |
| 1702 | 1702 | .rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq, |
| 1703 | 1703 | .max_tc = 1, |
| 1704 | + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), | |
| 1704 | 1705 | }; |
| 1705 | 1706 | |
| 1706 | 1707 | static const struct mlx5e_profile mlx5e_uplink_rep_profile = { |
| @@ -1718,6 +1719,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = { · 11 unmodified lines | ||
| 1718 | 1719 | .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe_rep, |
| 1719 | 1720 | .rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq, |
| 1720 | 1721 | .max_tc = MLX5E_MAX_NUM_TC, |
| 1722 | + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), | |
| 1721 | 1723 | }; |
| 1722 | 1724 | |
| 1723 | 1725 | static bool |
| @@ -172,7 +172,7 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) · 171 unmodified lines | ||
| 172 | 172 | |
| 173 | 173 | memset(s, 0, sizeof(*s)); |
| 174 | 174 | |
| 175 | − for (i = 0; i < mlx5e_get_netdev_max_channels(priv->netdev); i++) { | |
| 175 | + for (i = 0; i < priv->max_nch; i++) { | |
| 176 | 176 | struct mlx5e_channel_stats *channel_stats = |
| 177 | 177 | &priv->channel_stats[i]; |
| 178 | 178 | struct mlx5e_xdpsq_stats *xdpsq_red_stats = &channel_stats->xdpsq; |
| @@ -1395,7 +1395,7 @@ static const struct counter_desc ch_stats_desc[] = { · 1216 unmodified lines | ||
| 1395 | 1395 | |
| 1396 | 1396 | static int mlx5e_grp_channels_get_num_stats(struct mlx5e_priv *priv) |
| 1397 | 1397 | { |
| 1398 | − int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 1398 | + int max_nch = priv->max_nch; | |
| 1399 | 1399 | |
| 1400 | 1400 | return (NUM_RQ_STATS * max_nch) + |
| 1401 | 1401 | (NUM_CH_STATS * max_nch) + |
| @@ -1409,8 +1409,8 @@ static int mlx5e_grp_channels_get_num_stats(struct mlx5e_priv *priv) · 7 unmodified lines | ||
| 1409 | 1409 | static int mlx5e_grp_channels_fill_strings(struct mlx5e_priv *priv, u8 *data, |
| 1410 | 1410 | int idx) |
| 1411 | 1411 | { |
| 1412 | − int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 1413 | 1412 | bool is_xsk = priv->xsk.ever_used; |
| 1413 | + int max_nch = priv->max_nch; | |
| 1414 | 1414 | int i, j, tc; |
| 1415 | 1415 | |
| 1416 | 1416 | for (i = 0; i < max_nch; i++) |
| @@ -1452,8 +1452,8 @@ static int mlx5e_grp_channels_fill_strings(struct mlx5e_priv *priv, u8 *data, · 35 unmodified lines | ||
| 1452 | 1452 | static int mlx5e_grp_channels_fill_stats(struct mlx5e_priv *priv, u64 *data, |
| 1453 | 1453 | int idx) |
| 1454 | 1454 | { |
| 1455 | − int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 1456 | 1455 | bool is_xsk = priv->xsk.ever_used; |
| 1456 | + int max_nch = priv->max_nch; | |
| 1457 | 1457 | int i, j, tc; |
| 1458 | 1458 | |
| 1459 | 1459 | for (i = 0; i < max_nch; i++) |
| @@ -1230,13 +1230,13 @@ static struct mlx5_fc *mlx5e_tc_get_counter(struct mlx5e_tc_flow *flow) · 1229 unmodified lines | ||
| 1230 | 1230 | void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe) |
| 1231 | 1231 | { |
| 1232 | 1232 | struct mlx5e_neigh *m_neigh = &nhe->m_neigh; |
| 1233 | − u64 bytes, packets, lastuse = 0; | |
| 1234 | 1233 | struct mlx5e_tc_flow *flow; |
| 1235 | 1234 | struct mlx5e_encap_entry *e; |
| 1236 | 1235 | struct mlx5_fc *counter; |
| 1237 | 1236 | struct neigh_table *tbl; |
| 1238 | 1237 | bool neigh_used = false; |
| 1239 | 1238 | struct neighbour *n; |
| 1239 | + u64 lastuse; | |
| 1240 | 1240 | |
| 1241 | 1241 | if (m_neigh->family == AF_INET) |
| 1242 | 1242 | tbl = &arp_tbl; |
| @@ -1256,7 +1256,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe) · 13 unmodified lines | ||
| 1256 | 1256 | encaps[efi->index]); |
| 1257 | 1257 | if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) { |
| 1258 | 1258 | counter = mlx5e_tc_get_counter(flow); |
| 1259 | − mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse); | |
| 1259 | + lastuse = mlx5_fc_query_lastuse(counter); | |
| 1260 | 1260 | if (time_after((unsigned long)lastuse, nhe->reported_lastuse)) { |
| 1261 | 1261 | neigh_used = true; |
| 1262 | 1262 | break; |
| @@ -49,7 +49,7 @@ static inline bool mlx5e_channel_no_affinity_change(struct mlx5e_channel *c) · 48 unmodified lines | ||
| 49 | 49 | static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq) |
| 50 | 50 | { |
| 51 | 51 | struct mlx5e_sq_stats *stats = sq->stats; |
| 52 | − struct dim_sample dim_sample; | |
| 52 | + struct dim_sample dim_sample = {}; | |
| 53 | 53 | |
| 54 | 54 | if (unlikely(!test_bit(MLX5E_SQ_STATE_AM, &sq->state))) |
| 55 | 55 | return; |
| @@ -61,7 +61,7 @@ static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq) · 5 unmodified lines | ||
| 61 | 61 | static void mlx5e_handle_rx_dim(struct mlx5e_rq *rq) |
| 62 | 62 | { |
| 63 | 63 | struct mlx5e_rq_stats *stats = rq->stats; |
| 64 | − struct dim_sample dim_sample; | |
| 64 | + struct dim_sample dim_sample = {}; | |
| 65 | 65 | |
| 66 | 66 | if (unlikely(!test_bit(MLX5E_RQ_STATE_AM, &rq->state))) |
| 67 | 67 | return; |
| @@ -68,7 +68,7 @@ enum fs_flow_table_type { · 67 unmodified lines | ||
| 68 | 68 | FS_FT_SNIFFER_RX = 0X5, |
| 69 | 69 | FS_FT_SNIFFER_TX = 0X6, |
| 70 | 70 | FS_FT_RDMA_RX = 0X7, |
| 71 | − FS_FT_MAX_TYPE = FS_FT_SNIFFER_TX, | |
| 71 | + FS_FT_MAX_TYPE = FS_FT_RDMA_RX, | |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | 74 | enum fs_flow_table_op_mod { |
| @@ -275,7 +275,8 @@ void mlx5_cleanup_fs(struct mlx5_core_dev *dev); · 200 unmodified lines | ||
| 275 | 275 | (type == FS_FT_FDB) ? MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) : \ |
| 276 | 276 | (type == FS_FT_SNIFFER_RX) ? MLX5_CAP_FLOWTABLE_SNIFFER_RX(mdev, cap) : \ |
| 277 | 277 | (type == FS_FT_SNIFFER_TX) ? MLX5_CAP_FLOWTABLE_SNIFFER_TX(mdev, cap) : \ |
| 278 | − (BUILD_BUG_ON_ZERO(FS_FT_SNIFFER_TX != FS_FT_MAX_TYPE))\ | |
| 278 | + (type == FS_FT_RDMA_RX) ? MLX5_CAP_FLOWTABLE_RDMA_RX(mdev, cap) : \ | |
| 279 | + (BUILD_BUG_ON_ZERO(FS_FT_RDMA_RX != FS_FT_MAX_TYPE))\ | |
| 279 | 280 | ) |
| 280 | 281 | |
| 281 | 282 | #endif |
| @@ -369,6 +369,11 @@ int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter, · 368 unmodified lines | ||
| 369 | 369 | } |
| 370 | 370 | EXPORT_SYMBOL(mlx5_fc_query); |
| 371 | 371 | |
| 372 | +u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter) | |
| 373 | +{ | |
| 374 | + return counter->cache.lastuse; | |
| 375 | +} | |
| 376 | + | |
| 372 | 377 | void mlx5_fc_query_cached(struct mlx5_fc *counter, |
| 373 | 378 | u64 *bytes, u64 *packets, u64 *lastuse) |
| 374 | 379 | { |
| @@ -88,8 +88,7 @@ int mlx5i_init(struct mlx5_core_dev *mdev, · 87 unmodified lines | ||
| 88 | 88 | netdev->mtu = netdev->max_mtu; |
| 89 | 89 | |
| 90 | 90 | mlx5e_build_nic_params(mdev, NULL, &priv->rss_params, &priv->channels.params, |
| 91 | − mlx5e_get_netdev_max_channels(netdev), | |
| 92 | − netdev->mtu); | |
| 91 | + priv->max_nch, netdev->mtu); | |
| 93 | 92 | mlx5i_build_nic_params(mdev, &priv->channels.params); |
| 94 | 93 | |
| 95 | 94 | mlx5e_timestamp_init(priv); |
| @@ -118,11 +117,10 @@ void mlx5i_cleanup(struct mlx5e_priv *priv) · 22 unmodified lines | ||
| 118 | 117 | |
| 119 | 118 | static void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv) |
| 120 | 119 | { |
| 121 | − int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); | |
| 122 | 120 | struct mlx5e_sw_stats s = { 0 }; |
| 123 | 121 | int i, j; |
| 124 | 122 | |
| 125 | − for (i = 0; i < max_nch; i++) { | |
| 123 | + for (i = 0; i < priv->max_nch; i++) { | |
| 126 | 124 | struct mlx5e_channel_stats *channel_stats; |
| 127 | 125 | struct mlx5e_rq_stats *rq_stats; |
| 128 | 126 | |
| @@ -436,6 +434,7 @@ static const struct mlx5e_profile mlx5i_nic_profile = { · 307 unmodified lines | ||
| 436 | 434 | .rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe, |
| 437 | 435 | .rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */ |
| 438 | 436 | .max_tc = MLX5I_MAX_NUM_TC, |
| 437 | + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), | |
| 439 | 438 | }; |
| 440 | 439 | |
| 441 | 440 | /* mlx5i netdev NDos */ |
| @@ -355,6 +355,7 @@ static const struct mlx5e_profile mlx5i_pkey_nic_profile = { · 354 unmodified lines | ||
| 355 | 355 | .rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe, |
| 356 | 356 | .rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */ |
| 357 | 357 | .max_tc = MLX5I_MAX_NUM_TC, |
| 358 | + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), | |
| 358 | 359 | }; |
| 359 | 360 | |
| 360 | 361 | const struct mlx5e_profile *mlx5i_pkey_get_profile(void) |
| @@ -6330,7 +6330,7 @@ static int __init mlxsw_sp_module_init(void) · 6329 unmodified lines | ||
| 6330 | 6330 | return 0; |
| 6331 | 6331 | |
| 6332 | 6332 | err_sp2_pci_driver_register: |
| 6333 | − mlxsw_pci_driver_unregister(&mlxsw_sp2_pci_driver); | |
| 6333 | + mlxsw_pci_driver_unregister(&mlxsw_sp1_pci_driver); | |
| 6334 | 6334 | err_sp1_pci_driver_register: |
| 6335 | 6335 | mlxsw_core_driver_unregister(&mlxsw_sp2_driver); |
| 6336 | 6336 | err_sp2_core_driver_register: |
| @@ -951,4 +951,8 @@ void mlxsw_sp_port_nve_fini(struct mlxsw_sp_port *mlxsw_sp_port); · 950 unmodified lines | ||
| 951 | 951 | int mlxsw_sp_nve_init(struct mlxsw_sp *mlxsw_sp); |
| 952 | 952 | void mlxsw_sp_nve_fini(struct mlxsw_sp *mlxsw_sp); |
| 953 | 953 | |
| 954 | +/* spectrum_nve_vxlan.c */ | |
| 955 | +int mlxsw_sp_nve_inc_parsing_depth_get(struct mlxsw_sp *mlxsw_sp); | |
| 956 | +void mlxsw_sp_nve_inc_parsing_depth_put(struct mlxsw_sp *mlxsw_sp); | |
| 957 | + | |
| 954 | 958 | #endif |
| @@ -437,8 +437,8 @@ static const struct mlxsw_sp_sb_pr mlxsw_sp1_sb_prs[] = { · 436 unmodified lines | ||
| 437 | 437 | MLXSW_SP1_SB_PR_CPU_SIZE, true, false), |
| 438 | 438 | }; |
| 439 | 439 | |
| 440 | −#define MLXSW_SP2_SB_PR_INGRESS_SIZE 38128752 | |
| 441 | −#define MLXSW_SP2_SB_PR_EGRESS_SIZE 38128752 | |
| 440 | +#define MLXSW_SP2_SB_PR_INGRESS_SIZE 35297568 | |
| 441 | +#define MLXSW_SP2_SB_PR_EGRESS_SIZE 35297568 | |
| 442 | 442 | #define MLXSW_SP2_SB_PR_CPU_SIZE (256 * 1000) |
| 443 | 443 | |
| 444 | 444 | /* Order according to mlxsw_sp2_sb_pool_dess */ |
| @@ -775,6 +775,7 @@ static void mlxsw_sp_nve_tunnel_fini(struct mlxsw_sp *mlxsw_sp) · 774 unmodified lines | ||
| 775 | 775 | ops->fini(nve); |
| 776 | 776 | mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, 1, |
| 777 | 777 | nve->tunnel_index); |
| 778 | + memset(&nve->config, 0, sizeof(nve->config)); | |
| 778 | 779 | } |
| 779 | 780 | nve->num_nve_tunnels--; |
| 780 | 781 | } |
| @@ -29,6 +29,7 @@ struct mlxsw_sp_nve { · 28 unmodified lines | ||
| 29 | 29 | unsigned int num_max_mc_entries[MLXSW_SP_L3_PROTO_MAX]; |
| 30 | 30 | u32 tunnel_index; |
| 31 | 31 | u16 ul_rif_index; /* Reserved for Spectrum */ |
| 32 | + unsigned int inc_parsing_depth_refs; | |
| 32 | 33 | }; |
| 33 | 34 | |
| 34 | 35 | struct mlxsw_sp_nve_ops { |
| @@ -103,9 +103,9 @@ static void mlxsw_sp_nve_vxlan_config(const struct mlxsw_sp_nve *nve, · 102 unmodified lines | ||
| 103 | 103 | config->udp_dport = cfg->dst_port; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | −static int mlxsw_sp_nve_parsing_set(struct mlxsw_sp *mlxsw_sp, | |
| 107 | − unsigned int parsing_depth, | |
| 108 | − __be16 udp_dport) | |
| 106 | +static int __mlxsw_sp_nve_parsing_set(struct mlxsw_sp *mlxsw_sp, | |
| 107 | + unsigned int parsing_depth, | |
| 108 | + __be16 udp_dport) | |
| 109 | 109 | { |
| 110 | 110 | char mprs_pl[MLXSW_REG_MPRS_LEN]; |
| 111 | 111 | |
| @@ -113,6 +113,56 @@ static int mlxsw_sp_nve_parsing_set(struct mlxsw_sp *mlxsw_sp, · 1 unmodified line | ||
| 113 | 113 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mprs), mprs_pl); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | +static int mlxsw_sp_nve_parsing_set(struct mlxsw_sp *mlxsw_sp, | |
| 117 | + __be16 udp_dport) | |
| 118 | +{ | |
| 119 | + int parsing_depth = mlxsw_sp->nve->inc_parsing_depth_refs ? | |
| 120 | + MLXSW_SP_NVE_VXLAN_PARSING_DEPTH : | |
| 121 | + MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH; | |
| 122 | + | |
| 123 | + return __mlxsw_sp_nve_parsing_set(mlxsw_sp, parsing_depth, udp_dport); | |
| 124 | +} | |
| 125 | + | |
| 126 | +static int | |
| 127 | +__mlxsw_sp_nve_inc_parsing_depth_get(struct mlxsw_sp *mlxsw_sp, | |
| 128 | + __be16 udp_dport) | |
| 129 | +{ | |
| 130 | + int err; | |
| 131 | + | |
| 132 | + mlxsw_sp->nve->inc_parsing_depth_refs++; | |
| 133 | + | |
| 134 | + err = mlxsw_sp_nve_parsing_set(mlxsw_sp, udp_dport); | |
| 135 | + if (err) | |
| 136 | + goto err_nve_parsing_set; | |
| 137 | + return 0; | |
| 138 | + | |
| 139 | +err_nve_parsing_set: | |
| 140 | + mlxsw_sp->nve->inc_parsing_depth_refs--; | |
| 141 | + return err; | |
| 142 | +} | |
| 143 | + | |
| 144 | +static void | |
| 145 | +__mlxsw_sp_nve_inc_parsing_depth_put(struct mlxsw_sp *mlxsw_sp, | |
| 146 | + __be16 udp_dport) | |
| 147 | +{ | |
| 148 | + mlxsw_sp->nve->inc_parsing_depth_refs--; | |
| 149 | + mlxsw_sp_nve_parsing_set(mlxsw_sp, udp_dport); | |
| 150 | +} | |
| 151 | + | |
| 152 | +int mlxsw_sp_nve_inc_parsing_depth_get(struct mlxsw_sp *mlxsw_sp) | |
| 153 | +{ | |
| 154 | + __be16 udp_dport = mlxsw_sp->nve->config.udp_dport; | |
| 155 | + | |
| 156 | + return __mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp, udp_dport); | |
| 157 | +} | |
| 158 | + | |
| 159 | +void mlxsw_sp_nve_inc_parsing_depth_put(struct mlxsw_sp *mlxsw_sp) | |
| 160 | +{ | |
| 161 | + __be16 udp_dport = mlxsw_sp->nve->config.udp_dport; | |
| 162 | + | |
| 163 | + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, udp_dport); | |
| 164 | +} | |
| 165 | + | |
| 116 | 166 | static void |
| 117 | 167 | mlxsw_sp_nve_vxlan_config_prepare(char *tngcr_pl, |
| 118 | 168 | const struct mlxsw_sp_nve_config *config) |
| @@ -176,9 +226,7 @@ static int mlxsw_sp1_nve_vxlan_init(struct mlxsw_sp_nve *nve, · 57 unmodified lines | ||
| 176 | 226 | struct mlxsw_sp *mlxsw_sp = nve->mlxsw_sp; |
| 177 | 227 | int err; |
| 178 | 228 | |
| 179 | − err = mlxsw_sp_nve_parsing_set(mlxsw_sp, | |
| 180 | − MLXSW_SP_NVE_VXLAN_PARSING_DEPTH, | |
| 181 | − config->udp_dport); | |
| 229 | + err = __mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp, config->udp_dport); | |
| 182 | 230 | if (err) |
| 183 | 231 | return err; |
| 184 | 232 | |
| @@ -203,8 +251,7 @@ err_promote_decap: · 18 unmodified lines | ||
| 203 | 251 | err_rtdp_set: |
| 204 | 252 | mlxsw_sp1_nve_vxlan_config_clear(mlxsw_sp); |
| 205 | 253 | err_config_set: |
| 206 | − mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, | |
| 207 | − config->udp_dport); | |
| 254 | + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); | |
| 208 | 255 | return err; |
| 209 | 256 | } |
| 210 | 257 | |
| @@ -216,8 +263,7 @@ static void mlxsw_sp1_nve_vxlan_fini(struct mlxsw_sp_nve *nve) · 5 unmodified lines | ||
| 216 | 263 | mlxsw_sp_router_nve_demote_decap(mlxsw_sp, config->ul_tb_id, |
| 217 | 264 | config->ul_proto, &config->ul_sip); |
| 218 | 265 | mlxsw_sp1_nve_vxlan_config_clear(mlxsw_sp); |
| 219 | − mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, | |
| 220 | − config->udp_dport); | |
| 266 | + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); | |
| 221 | 267 | } |
| 222 | 268 | |
| 223 | 269 | static int |
| @@ -320,9 +366,7 @@ static int mlxsw_sp2_nve_vxlan_init(struct mlxsw_sp_nve *nve, · 96 unmodified lines | ||
| 320 | 366 | struct mlxsw_sp *mlxsw_sp = nve->mlxsw_sp; |
| 321 | 367 | int err; |
| 322 | 368 | |
| 323 | − err = mlxsw_sp_nve_parsing_set(mlxsw_sp, | |
| 324 | − MLXSW_SP_NVE_VXLAN_PARSING_DEPTH, | |
| 325 | − config->udp_dport); | |
| 369 | + err = __mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp, config->udp_dport); | |
| 326 | 370 | if (err) |
| 327 | 371 | return err; |
| 328 | 372 | |
| @@ -348,8 +392,7 @@ err_promote_decap: · 19 unmodified lines | ||
| 348 | 392 | err_rtdp_set: |
| 349 | 393 | mlxsw_sp2_nve_vxlan_config_clear(mlxsw_sp); |
| 350 | 394 | err_config_set: |
| 351 | − mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, | |
| 352 | − config->udp_dport); | |
| 395 | + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); | |
| 353 | 396 | return err; |
| 354 | 397 | } |
| 355 | 398 | |
| @@ -361,8 +404,7 @@ static void mlxsw_sp2_nve_vxlan_fini(struct mlxsw_sp_nve *nve) · 5 unmodified lines | ||
| 361 | 404 | mlxsw_sp_router_nve_demote_decap(mlxsw_sp, config->ul_tb_id, |
| 362 | 405 | config->ul_proto, &config->ul_sip); |
| 363 | 406 | mlxsw_sp2_nve_vxlan_config_clear(mlxsw_sp); |
| 364 | − mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, | |
| 365 | − config->udp_dport); | |
| 407 | + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); | |
| 366 | 408 | } |
| 367 | 409 | |
| 368 | 410 | const struct mlxsw_sp_nve_ops mlxsw_sp2_nve_vxlan_ops = { |
| @@ -979,6 +979,9 @@ static int mlxsw_sp1_ptp_mtpppc_update(struct mlxsw_sp_port *mlxsw_sp_port, · 978 unmodified lines | ||
| 979 | 979 | { |
| 980 | 980 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
| 981 | 981 | struct mlxsw_sp_port *tmp; |
| 982 | + u16 orig_ing_types = 0; | |
| 983 | + u16 orig_egr_types = 0; | |
| 984 | + int err; | |
| 982 | 985 | int i; |
| 983 | 986 | |
| 984 | 987 | /* MTPPPC configures timestamping globally, not per port. Find the |
| @@ -986,12 +989,26 @@ static int mlxsw_sp1_ptp_mtpppc_update(struct mlxsw_sp_port *mlxsw_sp_port, · 1 unmodified line | ||
| 986 | 989 | */ |
| 987 | 990 | for (i = 1; i < mlxsw_core_max_ports(mlxsw_sp->core); i++) { |
| 988 | 991 | tmp = mlxsw_sp->ports[i]; |
| 992 | + if (tmp) { | |
| 993 | + orig_ing_types |= tmp->ptp.ing_types; | |
| 994 | + orig_egr_types |= tmp->ptp.egr_types; | |
| 995 | + } | |
| 989 | 996 | if (tmp && tmp != mlxsw_sp_port) { |
| 990 | 997 | ing_types |= tmp->ptp.ing_types; |
| 991 | 998 | egr_types |= tmp->ptp.egr_types; |
| 992 | 999 | } |
| 993 | 1000 | } |
| 994 | 1001 | |
| 1002 | + if ((ing_types || egr_types) && !(orig_ing_types || orig_egr_types)) { | |
| 1003 | + err = mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp); | |
| 1004 | + if (err) { | |
| 1005 | + netdev_err(mlxsw_sp_port->dev, "Failed to increase parsing depth"); | |
| 1006 | + return err; | |
| 1007 | + } | |
| 1008 | + } | |
| 1009 | + if (!(ing_types || egr_types) && (orig_ing_types || orig_egr_types)) | |
| 1010 | + mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp); | |
| 1011 | + | |
| 995 | 1012 | return mlxsw_sp1_ptp_mtpppc_set(mlxsw_sp_port->mlxsw_sp, |
| 996 | 1013 | ing_types, egr_types); |
| 997 | 1014 | } |
| @@ -1818,6 +1818,7 @@ EXPORT_SYMBOL(ocelot_init); · 1817 unmodified lines | ||
| 1818 | 1818 | |
| 1819 | 1819 | void ocelot_deinit(struct ocelot *ocelot) |
| 1820 | 1820 | { |
| 1821 | + cancel_delayed_work(&ocelot->stats_work); | |
| 1821 | 1822 | destroy_workqueue(ocelot->stats_queue); |
| 1822 | 1823 | mutex_destroy(&ocelot->stats_lock); |
| 1823 | 1824 | ocelot_ace_deinit(); |
| @@ -444,12 +444,12 @@ static u8 *nfp_vnic_get_sw_stats_strings(struct net_device *netdev, u8 *data) · 443 unmodified lines | ||
| 444 | 444 | data = nfp_pr_et(data, "hw_rx_csum_complete"); |
| 445 | 445 | data = nfp_pr_et(data, "hw_rx_csum_err"); |
| 446 | 446 | data = nfp_pr_et(data, "rx_replace_buf_alloc_fail"); |
| 447 | − data = nfp_pr_et(data, "rx_tls_decrypted"); | |
| 447 | + data = nfp_pr_et(data, "rx_tls_decrypted_packets"); | |
| 448 | 448 | data = nfp_pr_et(data, "hw_tx_csum"); |
| 449 | 449 | data = nfp_pr_et(data, "hw_tx_inner_csum"); |
| 450 | 450 | data = nfp_pr_et(data, "tx_gather"); |
| 451 | 451 | data = nfp_pr_et(data, "tx_lso"); |
| 452 | − data = nfp_pr_et(data, "tx_tls_encrypted"); | |
| 452 | + data = nfp_pr_et(data, "tx_tls_encrypted_packets"); | |
| 453 | 453 | data = nfp_pr_et(data, "tx_tls_ooo"); |
| 454 | 454 | data = nfp_pr_et(data, "tx_tls_drop_no_sync_data"); |
| 455 | 455 | |
| @@ -11,7 +11,7 @@ config NET_VENDOR_NI · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | Note that the answer to this question doesn't directly affect the |
| 13 | 13 | kernel: saying N will just cause the configurator to skip all |
| 14 | − the questions about National Instrument devices. | |
| 14 | + the questions about National Instruments devices. | |
| 15 | 15 | If you say Y, you will be asked for your specific device in the |
| 16 | 16 | following questions. |
| 17 | 17 | |
| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | # |
| 3 | −# Packet engine device configuration | |
| 3 | +# Packet Engines device configuration | |
| 4 | 4 | # |
| 5 | 5 | |
| 6 | 6 | config NET_VENDOR_PACKET_ENGINES |
| 7 | − bool "Packet Engine devices" | |
| 7 | + bool "Packet Engines devices" | |
| 8 | 8 | default y |
| 9 | 9 | depends on PCI |
| 10 | 10 | ---help--- |
| @@ -12,7 +12,7 @@ config NET_VENDOR_PACKET_ENGINES · 1 unmodified line | ||
| 12 | 12 | |
| 13 | 13 | Note that the answer to this question doesn't directly affect the |
| 14 | 14 | kernel: saying N will just cause the configurator to skip all |
| 15 | − the questions about packet engine devices. If you say Y, you will | |
| 15 | + the questions about Packet Engines devices. If you say Y, you will | |
| 16 | 16 | be asked for your specific card in the following questions. |
| 17 | 17 | |
| 18 | 18 | if NET_VENDOR_PACKET_ENGINES |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | # |
| 3 | −# Makefile for the Packet Engine network device drivers. | |
| 3 | +# Makefile for the Packet Engines network device drivers. | |
| 4 | 4 | # |
| 5 | 5 | |
| 6 | 6 | obj-$(CONFIG_HAMACHI) += hamachi.o |
| @@ -1093,7 +1093,7 @@ static int qed_int_deassertion(struct qed_hwfn *p_hwfn, · 1092 unmodified lines | ||
| 1093 | 1093 | snprintf(bit_name, 30, |
| 1094 | 1094 | p_aeu->bit_name, num); |
| 1095 | 1095 | else |
| 1096 | − strncpy(bit_name, | |
| 1096 | + strlcpy(bit_name, | |
| 1097 | 1097 | p_aeu->bit_name, 30); |
| 1098 | 1098 | |
| 1099 | 1099 | /* We now need to pass bitmask in its |
| @@ -442,7 +442,7 @@ static void qed_rdma_init_devinfo(struct qed_hwfn *p_hwfn, · 441 unmodified lines | ||
| 442 | 442 | /* Vendor specific information */ |
| 443 | 443 | dev->vendor_id = cdev->vendor_id; |
| 444 | 444 | dev->vendor_part_id = cdev->device_id; |
| 445 | − dev->hw_ver = 0; | |
| 445 | + dev->hw_ver = cdev->chip_rev; | |
| 446 | 446 | dev->fw_ver = (FW_MAJOR_VERSION << 24) | (FW_MINOR_VERSION << 16) | |
| 447 | 447 | (FW_REVISION_VERSION << 8) | (FW_ENGINEERING_VERSION); |
| 448 | 448 | |
| @@ -206,9 +206,9 @@ rmnet_map_ipv4_ul_csum_header(void *iphdr, · 205 unmodified lines | ||
| 206 | 206 | ul_header->csum_insert_offset = skb->csum_offset; |
| 207 | 207 | ul_header->csum_enabled = 1; |
| 208 | 208 | if (ip4h->protocol == IPPROTO_UDP) |
| 209 | − ul_header->udp_ip4_ind = 1; | |
| 209 | + ul_header->udp_ind = 1; | |
| 210 | 210 | else |
| 211 | − ul_header->udp_ip4_ind = 0; | |
| 211 | + ul_header->udp_ind = 0; | |
| 212 | 212 | |
| 213 | 213 | /* Changing remaining fields to network order */ |
| 214 | 214 | hdr++; |
| @@ -239,6 +239,7 @@ rmnet_map_ipv6_ul_csum_header(void *ip6hdr, · 24 unmodified lines | ||
| 239 | 239 | struct rmnet_map_ul_csum_header *ul_header, |
| 240 | 240 | struct sk_buff *skb) |
| 241 | 241 | { |
| 242 | + struct ipv6hdr *ip6h = (struct ipv6hdr *)ip6hdr; | |
| 242 | 243 | __be16 *hdr = (__be16 *)ul_header, offset; |
| 243 | 244 | |
| 244 | 245 | offset = htons((__force u16)(skb_transport_header(skb) - |
| @@ -246,7 +247,11 @@ rmnet_map_ipv6_ul_csum_header(void *ip6hdr, · 1 unmodified line | ||
| 246 | 247 | ul_header->csum_start_offset = offset; |
| 247 | 248 | ul_header->csum_insert_offset = skb->csum_offset; |
| 248 | 249 | ul_header->csum_enabled = 1; |
| 249 | − ul_header->udp_ip4_ind = 0; | |
| 250 | + | |
| 251 | + if (ip6h->nexthdr == IPPROTO_UDP) | |
| 252 | + ul_header->udp_ind = 1; | |
| 253 | + else | |
| 254 | + ul_header->udp_ind = 0; | |
| 250 | 255 | |
| 251 | 256 | /* Changing remaining fields to network order */ |
| 252 | 257 | hdr++; |
| @@ -419,7 +424,7 @@ sw_csum: · 166 unmodified lines | ||
| 419 | 424 | ul_header->csum_start_offset = 0; |
| 420 | 425 | ul_header->csum_insert_offset = 0; |
| 421 | 426 | ul_header->csum_enabled = 0; |
| 422 | − ul_header->udp_ip4_ind = 0; | |
| 427 | + ul_header->udp_ind = 0; | |
| 423 | 428 | |
| 424 | 429 | priv->stats.csum_sw++; |
| 425 | 430 | } |
| @@ -6136,10 +6136,7 @@ static int r8169_phy_connect(struct rtl8169_private *tp) · 6135 unmodified lines | ||
| 6136 | 6136 | if (ret) |
| 6137 | 6137 | return ret; |
| 6138 | 6138 | |
| 6139 | − if (tp->supports_gmii) | |
| 6140 | − phy_remove_link_mode(phydev, | |
| 6141 | − ETHTOOL_LINK_MODE_1000baseT_Half_BIT); | |
| 6142 | − else | |
| 6139 | + if (!tp->supports_gmii) | |
| 6143 | 6140 | phy_set_max_speed(phydev, SPEED_100); |
| 6144 | 6141 | |
| 6145 | 6142 | phy_support_asym_pause(phydev); |
| @@ -6589,13 +6586,18 @@ static int rtl_alloc_irq(struct rtl8169_private *tp) · 443 unmodified lines | ||
| 6589 | 6586 | { |
| 6590 | 6587 | unsigned int flags; |
| 6591 | 6588 | |
| 6592 | − if (tp->mac_version <= RTL_GIGA_MAC_VER_06) { | |
| 6589 | + switch (tp->mac_version) { | |
| 6590 | + case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: | |
| 6593 | 6591 | rtl_unlock_config_regs(tp); |
| 6594 | 6592 | RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable); |
| 6595 | 6593 | rtl_lock_config_regs(tp); |
| 6594 | + /* fall through */ | |
| 6595 | + case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_24: | |
| 6596 | 6596 | flags = PCI_IRQ_LEGACY; |
| 6597 | − } else { | |
| 6597 | + break; | |
| 6598 | + default: | |
| 6598 | 6599 | flags = PCI_IRQ_ALL_TYPES; |
| 6600 | + break; | |
| 6599 | 6601 | } |
| 6600 | 6602 | |
| 6601 | 6603 | return pci_alloc_irq_vectors(tp->pci_dev, 1, 1, flags); |
| @@ -2208,10 +2208,12 @@ static int rocker_router_fib_event(struct notifier_block *nb, · 2207 unmodified lines | ||
| 2208 | 2208 | |
| 2209 | 2209 | if (fen_info->fi->fib_nh_is_v6) { |
| 2210 | 2210 | NL_SET_ERR_MSG_MOD(info->extack, "IPv6 gateway with IPv4 route is not supported"); |
| 2211 | + kfree(fib_work); | |
| 2211 | 2212 | return notifier_from_errno(-EINVAL); |
| 2212 | 2213 | } |
| 2213 | 2214 | if (fen_info->fi->nh) { |
| 2214 | 2215 | NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported"); |
| 2216 | + kfree(fib_work); | |
| 2215 | 2217 | return notifier_from_errno(-EINVAL); |
| 2216 | 2218 | } |
| 2217 | 2219 | } |
| @@ -11,7 +11,7 @@ config NET_VENDOR_SAMSUNG · 10 unmodified lines | ||
| 11 | 11 | say Y. |
| 12 | 12 | |
| 13 | 13 | Note that the answer to this question does not directly affect |
| 14 | − the kernel: saying N will just case the configurator to skip all | |
| 14 | + the kernel: saying N will just cause the configurator to skip all | |
| 15 | 15 | the questions about Samsung chipsets. If you say Y, you will be asked |
| 16 | 16 | for your specific chipset/driver in the following questions. |
| 17 | 17 | |
| @@ -712,6 +712,7 @@ static void smc911x_phy_detect(struct net_device *dev) · 711 unmodified lines | ||
| 712 | 712 | /* Found an external PHY */ |
| 713 | 713 | break; |
| 714 | 714 | } |
| 715 | + /* Else, fall through */ | |
| 715 | 716 | default: |
| 716 | 717 | /* Internal media only */ |
| 717 | 718 | SMC_GET_PHY_ID1(lp, 1, id1); |
| @@ -85,6 +85,8 @@ static void dwmac4_rx_queue_priority(struct mac_device_info *hw, · 84 unmodified lines | ||
| 85 | 85 | u32 value; |
| 86 | 86 | |
| 87 | 87 | base_register = (queue < 4) ? GMAC_RXQ_CTRL2 : GMAC_RXQ_CTRL3; |
| 88 | + if (queue >= 4) | |
| 89 | + queue -= 4; | |
| 88 | 90 | |
| 89 | 91 | value = readl(ioaddr + base_register); |
| 90 | 92 | |
| @@ -102,6 +104,8 @@ static void dwmac4_tx_queue_priority(struct mac_device_info *hw, · 11 unmodified lines | ||
| 102 | 104 | u32 value; |
| 103 | 105 | |
| 104 | 106 | base_register = (queue < 4) ? GMAC_TXQ_PRTY_MAP0 : GMAC_TXQ_PRTY_MAP1; |
| 107 | + if (queue >= 4) | |
| 108 | + queue -= 4; | |
| 105 | 109 | |
| 106 | 110 | value = readl(ioaddr + base_register); |
| 107 | 111 | |
| @@ -44,11 +44,13 @@ · 43 unmodified lines | ||
| 44 | 44 | #define XGMAC_CORE_INIT_RX 0 |
| 45 | 45 | #define XGMAC_PACKET_FILTER 0x00000008 |
| 46 | 46 | #define XGMAC_FILTER_RA BIT(31) |
| 47 | +#define XGMAC_FILTER_HPF BIT(10) | |
| 47 | 48 | #define XGMAC_FILTER_PCF BIT(7) |
| 48 | 49 | #define XGMAC_FILTER_PM BIT(4) |
| 49 | 50 | #define XGMAC_FILTER_HMC BIT(2) |
| 50 | 51 | #define XGMAC_FILTER_PR BIT(0) |
| 51 | 52 | #define XGMAC_HASH_TABLE(x) (0x00000010 + (x) * 4) |
| 53 | +#define XGMAC_MAX_HASH_TABLE 8 | |
| 52 | 54 | #define XGMAC_RXQ_CTRL0 0x000000a0 |
| 53 | 55 | #define XGMAC_RXQEN(x) GENMASK((x) * 2 + 1, (x) * 2) |
| 54 | 56 | #define XGMAC_RXQEN_SHIFT(x) ((x) * 2) |
| @@ -99,11 +101,12 @@ · 44 unmodified lines | ||
| 99 | 101 | #define XGMAC_MDIO_ADDR 0x00000200 |
| 100 | 102 | #define XGMAC_MDIO_DATA 0x00000204 |
| 101 | 103 | #define XGMAC_MDIO_C22P 0x00000220 |
| 102 | −#define XGMAC_ADDR0_HIGH 0x00000300 | |
| 104 | +#define XGMAC_ADDRx_HIGH(x) (0x00000300 + (x) * 0x8) | |
| 105 | +#define XGMAC_ADDR_MAX 32 | |
| 103 | 106 | #define XGMAC_AE BIT(31) |
| 104 | 107 | #define XGMAC_DCS GENMASK(19, 16) |
| 105 | 108 | #define XGMAC_DCS_SHIFT 16 |
| 106 | −#define XGMAC_ADDR0_LOW 0x00000304 | |
| 109 | +#define XGMAC_ADDRx_LOW(x) (0x00000304 + (x) * 0x8) | |
| 107 | 110 | #define XGMAC_ARP_ADDR 0x00000c10 |
| 108 | 111 | #define XGMAC_TIMESTAMP_STATUS 0x00000d20 |
| 109 | 112 | #define XGMAC_TXTSC BIT(15) |
| @@ -4,6 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | * stmmac XGMAC support. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | +#include <linux/bitrev.h> | |
| 8 | +#include <linux/crc32.h> | |
| 7 | 9 | #include "stmmac.h" |
| 8 | 10 | #include "dwxgmac2.h" |
| 9 | 11 | |
| @@ -106,6 +108,8 @@ static void dwxgmac2_rx_queue_prio(struct mac_device_info *hw, u32 prio, · 96 unmodified lines | ||
| 106 | 108 | u32 value, reg; |
| 107 | 109 | |
| 108 | 110 | reg = (queue < 4) ? XGMAC_RXQ_CTRL2 : XGMAC_RXQ_CTRL3; |
| 111 | + if (queue >= 4) | |
| 112 | + queue -= 4; | |
| 109 | 113 | |
| 110 | 114 | value = readl(ioaddr + reg); |
| 111 | 115 | value &= ~XGMAC_PSRQ(queue); |
| @@ -169,6 +173,8 @@ static void dwxgmac2_map_mtl_to_dma(struct mac_device_info *hw, u32 queue, · 57 unmodified lines | ||
| 169 | 173 | u32 value, reg; |
| 170 | 174 | |
| 171 | 175 | reg = (queue < 4) ? XGMAC_MTL_RXQ_DMA_MAP0 : XGMAC_MTL_RXQ_DMA_MAP1; |
| 176 | + if (queue >= 4) | |
| 177 | + queue -= 4; | |
| 172 | 178 | |
| 173 | 179 | value = readl(ioaddr + reg); |
| 174 | 180 | value &= ~XGMAC_QxMDMACH(queue); |
| @@ -278,10 +284,10 @@ static void dwxgmac2_set_umac_addr(struct mac_device_info *hw, · 103 unmodified lines | ||
| 278 | 284 | u32 value; |
| 279 | 285 | |
| 280 | 286 | value = (addr[5] << 8) | addr[4]; |
| 281 | − writel(value | XGMAC_AE, ioaddr + XGMAC_ADDR0_HIGH); | |
| 287 | + writel(value | XGMAC_AE, ioaddr + XGMAC_ADDRx_HIGH(reg_n)); | |
| 282 | 288 | |
| 283 | 289 | value = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0]; |
| 284 | − writel(value, ioaddr + XGMAC_ADDR0_LOW); | |
| 290 | + writel(value, ioaddr + XGMAC_ADDRx_LOW(reg_n)); | |
| 285 | 291 | } |
| 286 | 292 | |
| 287 | 293 | static void dwxgmac2_get_umac_addr(struct mac_device_info *hw, |
| @@ -291,8 +297,8 @@ static void dwxgmac2_get_umac_addr(struct mac_device_info *hw, · 3 unmodified lines | ||
| 291 | 297 | u32 hi_addr, lo_addr; |
| 292 | 298 | |
| 293 | 299 | /* Read the MAC address from the hardware */ |
| 294 | − hi_addr = readl(ioaddr + XGMAC_ADDR0_HIGH); | |
| 295 | − lo_addr = readl(ioaddr + XGMAC_ADDR0_LOW); | |
| 300 | + hi_addr = readl(ioaddr + XGMAC_ADDRx_HIGH(reg_n)); | |
| 301 | + lo_addr = readl(ioaddr + XGMAC_ADDRx_LOW(reg_n)); | |
| 296 | 302 | |
| 297 | 303 | /* Extract the MAC address from the high and low words */ |
| 298 | 304 | addr[0] = lo_addr & 0xff; |
| @@ -303,19 +309,82 @@ static void dwxgmac2_get_umac_addr(struct mac_device_info *hw, · 4 unmodified lines | ||
| 303 | 309 | addr[5] = (hi_addr >> 8) & 0xff; |
| 304 | 310 | } |
| 305 | 311 | |
| 312 | +static void dwxgmac2_set_mchash(void __iomem *ioaddr, u32 *mcfilterbits, | |
| 313 | + int mcbitslog2) | |
| 314 | +{ | |
| 315 | + int numhashregs, regs; | |
| 316 | + | |
| 317 | + switch (mcbitslog2) { | |
| 318 | + case 6: | |
| 319 | + numhashregs = 2; | |
| 320 | + break; | |
| 321 | + case 7: | |
| 322 | + numhashregs = 4; | |
| 323 | + break; | |
| 324 | + case 8: | |
| 325 | + numhashregs = 8; | |
| 326 | + break; | |
| 327 | + default: | |
| 328 | + return; | |
| 329 | + } | |
| 330 | + | |
| 331 | + for (regs = 0; regs < numhashregs; regs++) | |
| 332 | + writel(mcfilterbits[regs], ioaddr + XGMAC_HASH_TABLE(regs)); | |
| 333 | +} | |
| 334 | + | |
| 306 | 335 | static void dwxgmac2_set_filter(struct mac_device_info *hw, |
| 307 | 336 | struct net_device *dev) |
| 308 | 337 | { |
| 309 | 338 | void __iomem *ioaddr = (void __iomem *)dev->base_addr; |
| 310 | − u32 value = XGMAC_FILTER_RA; | |
| 339 | + u32 value = readl(ioaddr + XGMAC_PACKET_FILTER); | |
| 340 | + int mcbitslog2 = hw->mcast_bits_log2; | |
| 341 | + u32 mc_filter[8]; | |
| 342 | + int i; | |
| 343 | + | |
| 344 | + value &= ~(XGMAC_FILTER_PR | XGMAC_FILTER_HMC | XGMAC_FILTER_PM); | |
| 345 | + value |= XGMAC_FILTER_HPF; | |
| 346 | + | |
| 347 | + memset(mc_filter, 0, sizeof(mc_filter)); | |
| 311 | 348 | |
| 312 | 349 | if (dev->flags & IFF_PROMISC) { |
| 313 | − value |= XGMAC_FILTER_PR | XGMAC_FILTER_PCF; | |
| 350 | + value |= XGMAC_FILTER_PR; | |
| 351 | + value |= XGMAC_FILTER_PCF; | |
| 314 | 352 | } else if ((dev->flags & IFF_ALLMULTI) || |
| 315 | − (netdev_mc_count(dev) > HASH_TABLE_SIZE)) { | |
| 353 | + (netdev_mc_count(dev) > hw->multicast_filter_bins)) { | |
| 316 | 354 | value |= XGMAC_FILTER_PM; |
| 317 | − writel(~0x0, ioaddr + XGMAC_HASH_TABLE(0)); | |
| 318 | − writel(~0x0, ioaddr + XGMAC_HASH_TABLE(1)); | |
| 355 | + | |
| 356 | + for (i = 0; i < XGMAC_MAX_HASH_TABLE; i++) | |
| 357 | + writel(~0x0, ioaddr + XGMAC_HASH_TABLE(i)); | |
| 358 | + } else if (!netdev_mc_empty(dev)) { | |
| 359 | + struct netdev_hw_addr *ha; | |
| 360 | + | |
| 361 | + value |= XGMAC_FILTER_HMC; | |
| 362 | + | |
| 363 | + netdev_for_each_mc_addr(ha, dev) { | |
| 364 | + int nr = (bitrev32(~crc32_le(~0, ha->addr, 6)) >> | |
| 365 | + (32 - mcbitslog2)); | |
| 366 | + mc_filter[nr >> 5] |= (1 << (nr & 0x1F)); | |
| 367 | + } | |
| 368 | + } | |
| 369 | + | |
| 370 | + dwxgmac2_set_mchash(ioaddr, mc_filter, mcbitslog2); | |
| 371 | + | |
| 372 | + /* Handle multiple unicast addresses */ | |
| 373 | + if (netdev_uc_count(dev) > XGMAC_ADDR_MAX) { | |
| 374 | + value |= XGMAC_FILTER_PR; | |
| 375 | + } else { | |
| 376 | + struct netdev_hw_addr *ha; | |
| 377 | + int reg = 1; | |
| 378 | + | |
| 379 | + netdev_for_each_uc_addr(ha, dev) { | |
| 380 | + dwxgmac2_set_umac_addr(hw, ha->addr, reg); | |
| 381 | + reg++; | |
| 382 | + } | |
| 383 | + | |
| 384 | + for ( ; reg < XGMAC_ADDR_MAX; reg++) { | |
| 385 | + writel(0, ioaddr + XGMAC_ADDRx_HIGH(reg)); | |
| 386 | + writel(0, ioaddr + XGMAC_ADDRx_LOW(reg)); | |
| 387 | + } | |
| 319 | 388 | } |
| 320 | 389 | |
| 321 | 390 | writel(value, ioaddr + XGMAC_PACKET_FILTER); |
| @@ -814,20 +814,15 @@ static void stmmac_validate(struct phylink_config *config, · 813 unmodified lines | ||
| 814 | 814 | phylink_set(mac_supported, 10baseT_Full); |
| 815 | 815 | phylink_set(mac_supported, 100baseT_Half); |
| 816 | 816 | phylink_set(mac_supported, 100baseT_Full); |
| 817 | + phylink_set(mac_supported, 1000baseT_Half); | |
| 818 | + phylink_set(mac_supported, 1000baseT_Full); | |
| 819 | + phylink_set(mac_supported, 1000baseKX_Full); | |
| 817 | 820 | |
| 818 | 821 | phylink_set(mac_supported, Autoneg); |
| 819 | 822 | phylink_set(mac_supported, Pause); |
| 820 | 823 | phylink_set(mac_supported, Asym_Pause); |
| 821 | 824 | phylink_set_port_modes(mac_supported); |
| 822 | 825 | |
| 823 | − if (priv->plat->has_gmac || | |
| 824 | − priv->plat->has_gmac4 || | |
| 825 | − priv->plat->has_xgmac) { | |
| 826 | − phylink_set(mac_supported, 1000baseT_Half); | |
| 827 | − phylink_set(mac_supported, 1000baseT_Full); | |
| 828 | − phylink_set(mac_supported, 1000baseKX_Full); | |
| 829 | − } | |
| 830 | − | |
| 831 | 826 | /* Cut down 1G if asked to */ |
| 832 | 827 | if ((max_speed > 0) && (max_speed < 1000)) { |
| 833 | 828 | phylink_set(mask, 1000baseT_Full); |
| @@ -1295,6 +1290,8 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags) · 461 unmodified lines | ||
| 1295 | 1290 | "(%s) dma_rx_phy=0x%08x\n", __func__, |
| 1296 | 1291 | (u32)rx_q->dma_rx_phy); |
| 1297 | 1292 | |
| 1293 | + stmmac_clear_rx_descriptors(priv, queue); | |
| 1294 | + | |
| 1298 | 1295 | for (i = 0; i < DMA_RX_SIZE; i++) { |
| 1299 | 1296 | struct dma_desc *p; |
| 1300 | 1297 | |
| @@ -1312,8 +1309,6 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags) · 11 unmodified lines | ||
| 1312 | 1309 | rx_q->cur_rx = 0; |
| 1313 | 1310 | rx_q->dirty_rx = (unsigned int)(i - DMA_RX_SIZE); |
| 1314 | 1311 | |
| 1315 | − stmmac_clear_rx_descriptors(priv, queue); | |
| 1316 | − | |
| 1317 | 1312 | /* Setup the chained descriptor addresses */ |
| 1318 | 1313 | if (priv->mode == STMMAC_CHAIN_MODE) { |
| 1319 | 1314 | if (priv->extend_desc) |
| @@ -1555,9 +1550,8 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv) · 235 unmodified lines | ||
| 1555 | 1550 | goto err_dma; |
| 1556 | 1551 | } |
| 1557 | 1552 | |
| 1558 | − rx_q->buf_pool = kmalloc_array(DMA_RX_SIZE, | |
| 1559 | − sizeof(*rx_q->buf_pool), | |
| 1560 | − GFP_KERNEL); | |
| 1553 | + rx_q->buf_pool = kcalloc(DMA_RX_SIZE, sizeof(*rx_q->buf_pool), | |
| 1554 | + GFP_KERNEL); | |
| 1561 | 1555 | if (!rx_q->buf_pool) |
| 1562 | 1556 | goto err_dma; |
| 1563 | 1557 | |
| @@ -1608,15 +1602,15 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv) · 44 unmodified lines | ||
| 1608 | 1602 | tx_q->queue_index = queue; |
| 1609 | 1603 | tx_q->priv_data = priv; |
| 1610 | 1604 | |
| 1611 | − tx_q->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE, | |
| 1612 | − sizeof(*tx_q->tx_skbuff_dma), | |
| 1613 | − GFP_KERNEL); | |
| 1605 | + tx_q->tx_skbuff_dma = kcalloc(DMA_TX_SIZE, | |
| 1606 | + sizeof(*tx_q->tx_skbuff_dma), | |
| 1607 | + GFP_KERNEL); | |
| 1614 | 1608 | if (!tx_q->tx_skbuff_dma) |
| 1615 | 1609 | goto err_dma; |
| 1616 | 1610 | |
| 1617 | − tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE, | |
| 1618 | − sizeof(struct sk_buff *), | |
| 1619 | − GFP_KERNEL); | |
| 1611 | + tx_q->tx_skbuff = kcalloc(DMA_TX_SIZE, | |
| 1612 | + sizeof(struct sk_buff *), | |
| 1613 | + GFP_KERNEL); | |
| 1620 | 1614 | if (!tx_q->tx_skbuff) |
| 1621 | 1615 | goto err_dma; |
| 1622 | 1616 | |
| @@ -3277,9 +3271,11 @@ static inline int stmmac_rx_threshold_count(struct stmmac_rx_queue *rx_q) · 1654 unmodified lines | ||
| 3277 | 3271 | static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) |
| 3278 | 3272 | { |
| 3279 | 3273 | struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
| 3280 | − int dirty = stmmac_rx_dirty(priv, queue); | |
| 3274 | + int len, dirty = stmmac_rx_dirty(priv, queue); | |
| 3281 | 3275 | unsigned int entry = rx_q->dirty_rx; |
| 3282 | 3276 | |
| 3277 | + len = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE) * PAGE_SIZE; | |
| 3278 | + | |
| 3283 | 3279 | while (dirty-- > 0) { |
| 3284 | 3280 | struct stmmac_rx_buffer *buf = &rx_q->buf_pool[entry]; |
| 3285 | 3281 | struct dma_desc *p; |
| @@ -3297,6 +3293,13 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) · 11 unmodified lines | ||
| 3297 | 3293 | } |
| 3298 | 3294 | |
| 3299 | 3295 | buf->addr = page_pool_get_dma_addr(buf->page); |
| 3296 | + | |
| 3297 | + /* Sync whole allocation to device. This will invalidate old | |
| 3298 | + * data. | |
| 3299 | + */ | |
| 3300 | + dma_sync_single_for_device(priv->device, buf->addr, len, | |
| 3301 | + DMA_FROM_DEVICE); | |
| 3302 | + | |
| 3300 | 3303 | stmmac_set_desc_addr(priv, p, buf->addr); |
| 3301 | 3304 | stmmac_refill_desc3(priv, rx_q, p); |
| 3302 | 3305 | |
| @@ -3431,8 +3434,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 128 unmodified lines | ||
| 3431 | 3434 | skb_copy_to_linear_data(skb, page_address(buf->page), |
| 3432 | 3435 | frame_len); |
| 3433 | 3436 | skb_put(skb, frame_len); |
| 3434 | − dma_sync_single_for_device(priv->device, buf->addr, | |
| 3435 | − frame_len, DMA_FROM_DEVICE); | |
| 3436 | 3437 | |
| 3437 | 3438 | if (netif_msg_pktdata(priv)) { |
| 3438 | 3439 | netdev_dbg(priv->dev, "frame received (%dbytes)", |
| @@ -4319,8 +4320,9 @@ int stmmac_dvr_probe(struct device *device, · 880 unmodified lines | ||
| 4319 | 4320 | NAPI_POLL_WEIGHT); |
| 4320 | 4321 | } |
| 4321 | 4322 | if (queue < priv->plat->tx_queues_to_use) { |
| 4322 | − netif_napi_add(ndev, &ch->tx_napi, stmmac_napi_poll_tx, | |
| 4323 | − NAPI_POLL_WEIGHT); | |
| 4323 | + netif_tx_napi_add(ndev, &ch->tx_napi, | |
| 4324 | + stmmac_napi_poll_tx, | |
| 4325 | + NAPI_POLL_WEIGHT); | |
| 4324 | 4326 | } |
| 4325 | 4327 | } |
| 4326 | 4328 | |
| @@ -370,6 +370,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) · 369 unmodified lines | ||
| 370 | 370 | return ERR_PTR(-ENOMEM); |
| 371 | 371 | |
| 372 | 372 | *mac = of_get_mac_address(np); |
| 373 | + if (IS_ERR(*mac)) { | |
| 374 | + if (PTR_ERR(*mac) == -EPROBE_DEFER) | |
| 375 | + return ERR_CAST(*mac); | |
| 376 | + | |
| 377 | + *mac = NULL; | |
| 378 | + } | |
| 379 | + | |
| 373 | 380 | plat->interface = of_get_phy_mode(np); |
| 374 | 381 | |
| 375 | 382 | /* Some wrapper drivers still rely on phy_node. Let's save it while |
| @@ -37,7 +37,7 @@ static struct stmmac_tc_entry *tc_find_entry(struct stmmac_priv *priv, · 36 unmodified lines | ||
| 37 | 37 | entry = &priv->tc_entries[i]; |
| 38 | 38 | if (!entry->in_use && !first && free) |
| 39 | 39 | first = entry; |
| 40 | − if (entry->handle == loc && !free) | |
| 40 | + if ((entry->handle == loc) && !free && !entry->is_frag) | |
| 41 | 41 | dup = entry; |
| 42 | 42 | } |
| 43 | 43 | |
| @@ -788,6 +788,7 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal) · 787 unmodified lines | ||
| 788 | 788 | /* fallthrough, if we release the descriptors |
| 789 | 789 | * brutally (then we don't care about |
| 790 | 790 | * SPIDER_NET_DESCR_CARDOWNED) */ |
| 791 | + /* Fall through */ | |
| 791 | 792 | |
| 792 | 793 | case SPIDER_NET_DESCR_RESPONSE_ERROR: |
| 793 | 794 | case SPIDER_NET_DESCR_PROTECTION_ERROR: |
| @@ -13,7 +13,7 @@ config NET_VENDOR_XSCALE · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | Note that the answer to this question does not directly affect the |
| 15 | 15 | kernel: saying N will just cause the configurator to skip all |
| 16 | − the questions about XSacle IXP devices. If you say Y, you will be | |
| 16 | + the questions about XScale IXP devices. If you say Y, you will be | |
| 17 | 17 | asked for your specific card in the following questions. |
| 18 | 18 | |
| 19 | 19 | if NET_VENDOR_XSCALE |
| @@ -500,8 +500,9 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) · 499 unmodified lines | ||
| 500 | 500 | } |
| 501 | 501 | break; |
| 502 | 502 | } |
| 503 | + /* fall through */ | |
| 503 | 504 | |
| 504 | − default: /* fall through */ | |
| 505 | + default: | |
| 505 | 506 | if (bc->hdlctx.calibrate <= 0) |
| 506 | 507 | return 0; |
| 507 | 508 | i = min_t(int, cnt, bc->hdlctx.calibrate); |
| @@ -216,8 +216,10 @@ static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np) · 215 unmodified lines | ||
| 216 | 216 | if (IS_ERR(gpiod)) { |
| 217 | 217 | if (PTR_ERR(gpiod) == -EPROBE_DEFER) |
| 218 | 218 | return gpiod; |
| 219 | − pr_err("error getting GPIO for fixed link %pOF, proceed without\n", | |
| 220 | − fixed_link_node); | |
| 219 | + | |
| 220 | + if (PTR_ERR(gpiod) != -ENOENT) | |
| 221 | + pr_err("error getting GPIO for fixed link %pOF, proceed without\n", | |
| 222 | + fixed_link_node); | |
| 221 | 223 | gpiod = NULL; |
| 222 | 224 | } |
| 223 | 225 | |
| @@ -2226,8 +2226,8 @@ static int vsc8514_probe(struct phy_device *phydev) · 2225 unmodified lines | ||
| 2226 | 2226 | vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; |
| 2227 | 2227 | vsc8531->hw_stats = vsc85xx_hw_stats; |
| 2228 | 2228 | vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); |
| 2229 | − vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, | |
| 2230 | − sizeof(u64), GFP_KERNEL); | |
| 2229 | + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, | |
| 2230 | + sizeof(u64), GFP_KERNEL); | |
| 2231 | 2231 | if (!vsc8531->stats) |
| 2232 | 2232 | return -ENOMEM; |
| 2233 | 2233 | |
| @@ -2251,8 +2251,8 @@ static int vsc8574_probe(struct phy_device *phydev) · 17 unmodified lines | ||
| 2251 | 2251 | vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; |
| 2252 | 2252 | vsc8531->hw_stats = vsc8584_hw_stats; |
| 2253 | 2253 | vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); |
| 2254 | − vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, | |
| 2255 | − sizeof(u64), GFP_KERNEL); | |
| 2254 | + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, | |
| 2255 | + sizeof(u64), GFP_KERNEL); | |
| 2256 | 2256 | if (!vsc8531->stats) |
| 2257 | 2257 | return -ENOMEM; |
| 2258 | 2258 | |
| @@ -2281,8 +2281,8 @@ static int vsc8584_probe(struct phy_device *phydev) · 22 unmodified lines | ||
| 2281 | 2281 | vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; |
| 2282 | 2282 | vsc8531->hw_stats = vsc8584_hw_stats; |
| 2283 | 2283 | vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); |
| 2284 | − vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, | |
| 2285 | − sizeof(u64), GFP_KERNEL); | |
| 2284 | + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, | |
| 2285 | + sizeof(u64), GFP_KERNEL); | |
| 2286 | 2286 | if (!vsc8531->stats) |
| 2287 | 2287 | return -ENOMEM; |
| 2288 | 2288 | |
| @@ -2311,8 +2311,8 @@ static int vsc85xx_probe(struct phy_device *phydev) · 22 unmodified lines | ||
| 2311 | 2311 | vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; |
| 2312 | 2312 | vsc8531->hw_stats = vsc85xx_hw_stats; |
| 2313 | 2313 | vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); |
| 2314 | − vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, | |
| 2315 | − sizeof(u64), GFP_KERNEL); | |
| 2314 | + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, | |
| 2315 | + sizeof(u64), GFP_KERNEL); | |
| 2316 | 2316 | if (!vsc8531->stats) |
| 2317 | 2317 | return -ENOMEM; |
| 2318 | 2318 | |
| @@ -1774,6 +1774,12 @@ done: · 1773 unmodified lines | ||
| 1774 | 1774 | phydev->link = status & BMSR_LSTATUS ? 1 : 0; |
| 1775 | 1775 | phydev->autoneg_complete = status & BMSR_ANEGCOMPLETE ? 1 : 0; |
| 1776 | 1776 | |
| 1777 | + /* Consider the case that autoneg was started and "aneg complete" | |
| 1778 | + * bit has been reset, but "link up" bit not yet. | |
| 1779 | + */ | |
| 1780 | + if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) | |
| 1781 | + phydev->link = 0; | |
| 1782 | + | |
| 1777 | 1783 | return 0; |
| 1778 | 1784 | } |
| 1779 | 1785 | EXPORT_SYMBOL(genphy_update_link); |
| @@ -48,8 +48,9 @@ void phy_led_trigger_change_speed(struct phy_device *phy) · 47 unmodified lines | ||
| 48 | 48 | if (!phy->last_triggered) |
| 49 | 49 | led_trigger_event(&phy->led_link_trigger->trigger, |
| 50 | 50 | LED_FULL); |
| 51 | + else | |
| 52 | + led_trigger_event(&phy->last_triggered->trigger, LED_OFF); | |
| 51 | 53 | |
| 52 | − led_trigger_event(&phy->last_triggered->trigger, LED_OFF); | |
| 53 | 54 | led_trigger_event(&plt->trigger, LED_FULL); |
| 54 | 55 | phy->last_triggered = plt; |
| 55 | 56 | } |
| @@ -216,6 +216,8 @@ static int phylink_parse_fixedlink(struct phylink *pl, · 215 unmodified lines | ||
| 216 | 216 | pl->supported, true); |
| 217 | 217 | linkmode_zero(pl->supported); |
| 218 | 218 | phylink_set(pl->supported, MII); |
| 219 | + phylink_set(pl->supported, Pause); | |
| 220 | + phylink_set(pl->supported, Asym_Pause); | |
| 219 | 221 | if (s) { |
| 220 | 222 | __set_bit(s->bit, pl->supported); |
| 221 | 223 | } else { |
| @@ -990,10 +992,10 @@ void phylink_start(struct phylink *pl) · 768 unmodified lines | ||
| 990 | 992 | } |
| 991 | 993 | if (pl->link_an_mode == MLO_AN_FIXED && pl->get_fixed_state) |
| 992 | 994 | mod_timer(&pl->link_poll, jiffies + HZ); |
| 993 | − if (pl->sfp_bus) | |
| 994 | − sfp_upstream_start(pl->sfp_bus); | |
| 995 | 995 | if (pl->phydev) |
| 996 | 996 | phy_start(pl->phydev); |
| 997 | + if (pl->sfp_bus) | |
| 998 | + sfp_upstream_start(pl->sfp_bus); | |
| 997 | 999 | } |
| 998 | 1000 | EXPORT_SYMBOL_GPL(phylink_start); |
| 999 | 1001 | |
| @@ -1010,10 +1012,10 @@ void phylink_stop(struct phylink *pl) · 10 unmodified lines | ||
| 1010 | 1012 | { |
| 1011 | 1013 | ASSERT_RTNL(); |
| 1012 | 1014 | |
| 1013 | − if (pl->phydev) | |
| 1014 | − phy_stop(pl->phydev); | |
| 1015 | 1015 | if (pl->sfp_bus) |
| 1016 | 1016 | sfp_upstream_stop(pl->sfp_bus); |
| 1017 | + if (pl->phydev) | |
| 1018 | + phy_stop(pl->phydev); | |
| 1017 | 1019 | del_timer_sync(&pl->link_poll); |
| 1018 | 1020 | if (pl->link_irq) { |
| 1019 | 1021 | free_irq(pl->link_irq, pl); |
| @@ -1115,6 +1115,9 @@ static const struct proto_ops pppoe_ops = { · 1114 unmodified lines | ||
| 1115 | 1115 | .recvmsg = pppoe_recvmsg, |
| 1116 | 1116 | .mmap = sock_no_mmap, |
| 1117 | 1117 | .ioctl = pppox_ioctl, |
| 1118 | +#ifdef CONFIG_COMPAT | |
| 1119 | + .compat_ioctl = pppox_compat_ioctl, | |
| 1120 | +#endif | |
| 1118 | 1121 | }; |
| 1119 | 1122 | |
| 1120 | 1123 | static const struct pppox_proto pppoe_proto = { |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/string.h> |
| 18 | 18 | #include <linux/module.h> |
| 19 | 19 | #include <linux/kernel.h> |
| 20 | +#include <linux/compat.h> | |
| 20 | 21 | #include <linux/errno.h> |
| 21 | 22 | #include <linux/netdevice.h> |
| 22 | 23 | #include <linux/net.h> |
| @@ -98,6 +99,18 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) · 75 unmodified lines | ||
| 98 | 99 | |
| 99 | 100 | EXPORT_SYMBOL(pppox_ioctl); |
| 100 | 101 | |
| 102 | +#ifdef CONFIG_COMPAT | |
| 103 | +int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |
| 104 | +{ | |
| 105 | + if (cmd == PPPOEIOCSFWD32) | |
| 106 | + cmd = PPPOEIOCSFWD; | |
| 107 | + | |
| 108 | + return pppox_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); | |
| 109 | +} | |
| 110 | + | |
| 111 | +EXPORT_SYMBOL(pppox_compat_ioctl); | |
| 112 | +#endif | |
| 113 | + | |
| 101 | 114 | static int pppox_create(struct net *net, struct socket *sock, int protocol, |
| 102 | 115 | int kern) |
| 103 | 116 | { |
| @@ -623,6 +623,9 @@ static const struct proto_ops pptp_ops = { · 622 unmodified lines | ||
| 623 | 623 | .recvmsg = sock_no_recvmsg, |
| 624 | 624 | .mmap = sock_no_mmap, |
| 625 | 625 | .ioctl = pppox_ioctl, |
| 626 | +#ifdef CONFIG_COMPAT | |
| 627 | + .compat_ioctl = pppox_compat_ioctl, | |
| 628 | +#endif | |
| 626 | 629 | }; |
| 627 | 630 | |
| 628 | 631 | static const struct pppox_proto pppox_pptp_proto = { |
| @@ -1599,7 +1599,8 @@ static bool tun_can_build_skb(struct tun_struct *tun, struct tun_file *tfile, · 1598 unmodified lines | ||
| 1599 | 1599 | return true; |
| 1600 | 1600 | } |
| 1601 | 1601 | |
| 1602 | −static struct sk_buff *__tun_build_skb(struct page_frag *alloc_frag, char *buf, | |
| 1602 | +static struct sk_buff *__tun_build_skb(struct tun_file *tfile, | |
| 1603 | + struct page_frag *alloc_frag, char *buf, | |
| 1603 | 1604 | int buflen, int len, int pad) |
| 1604 | 1605 | { |
| 1605 | 1606 | struct sk_buff *skb = build_skb(buf, buflen); |
| @@ -1609,6 +1610,7 @@ static struct sk_buff *__tun_build_skb(struct page_frag *alloc_frag, char *buf, · 3 unmodified lines | ||
| 1609 | 1610 | |
| 1610 | 1611 | skb_reserve(skb, pad); |
| 1611 | 1612 | skb_put(skb, len); |
| 1613 | + skb_set_owner_w(skb, tfile->socket.sk); | |
| 1612 | 1614 | |
| 1613 | 1615 | get_page(alloc_frag->page); |
| 1614 | 1616 | alloc_frag->offset += buflen; |
| @@ -1686,7 +1688,8 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, · 71 unmodified lines | ||
| 1686 | 1688 | */ |
| 1687 | 1689 | if (hdr->gso_type || !xdp_prog) { |
| 1688 | 1690 | *skb_xdp = 1; |
| 1689 | − return __tun_build_skb(alloc_frag, buf, buflen, len, pad); | |
| 1691 | + return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, | |
| 1692 | + pad); | |
| 1690 | 1693 | } |
| 1691 | 1694 | |
| 1692 | 1695 | *skb_xdp = 0; |
| @@ -1723,7 +1726,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, · 30 unmodified lines | ||
| 1723 | 1726 | rcu_read_unlock(); |
| 1724 | 1727 | local_bh_enable(); |
| 1725 | 1728 | |
| 1726 | − return __tun_build_skb(alloc_frag, buf, buflen, len, pad); | |
| 1729 | + return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, pad); | |
| 1727 | 1730 | |
| 1728 | 1731 | err_xdp: |
| 1729 | 1732 | put_page(alloc_frag->page); |
| @@ -282,7 +282,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int val) · 281 unmodified lines | ||
| 282 | 282 | static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata) |
| 283 | 283 | { |
| 284 | 284 | int i; |
| 285 | − __u8 tmp; | |
| 285 | + __u8 tmp = 0; | |
| 286 | 286 | __le16 retdatai; |
| 287 | 287 | int ret; |
| 288 | 288 | |
| @@ -1295,6 +1295,7 @@ static const struct usb_device_id products[] = { · 1294 unmodified lines | ||
| 1295 | 1295 | {QMI_FIXED_INTF(0x2001, 0x7e3d, 4)}, /* D-Link DWM-222 A2 */ |
| 1296 | 1296 | {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */ |
| 1297 | 1297 | {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ |
| 1298 | + {QMI_FIXED_INTF(0x2020, 0x2060, 4)}, /* BroadMobi BM818 */ | |
| 1298 | 1299 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
| 1299 | 1300 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
| 1300 | 1301 | {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ |
| @@ -50,7 +50,7 @@ · 49 unmodified lines | ||
| 50 | 50 | #define PLA_TEREDO_WAKE_BASE 0xc0c4 |
| 51 | 51 | #define PLA_MAR 0xcd00 |
| 52 | 52 | #define PLA_BACKUP 0xd000 |
| 53 | −#define PAL_BDC_CR 0xd1a0 | |
| 53 | +#define PLA_BDC_CR 0xd1a0 | |
| 54 | 54 | #define PLA_TEREDO_TIMER 0xd2cc |
| 55 | 55 | #define PLA_REALWOW_TIMER 0xd2e8 |
| 56 | 56 | #define PLA_SUSPEND_FLAG 0xd38a |
| @@ -274,7 +274,7 @@ · 217 unmodified lines | ||
| 274 | 274 | #define TEREDO_RS_EVENT_MASK 0x00fe |
| 275 | 275 | #define OOB_TEREDO_EN 0x0001 |
| 276 | 276 | |
| 277 | −/* PAL_BDC_CR */ | |
| 277 | +/* PLA_BDC_CR */ | |
| 278 | 278 | #define ALDPS_PROXY_MODE 0x0001 |
| 279 | 279 | |
| 280 | 280 | /* PLA_EFUSE_CMD */ |
| @@ -3191,9 +3191,9 @@ static void r8152b_enter_oob(struct r8152 *tp) · 2910 unmodified lines | ||
| 3191 | 3191 | |
| 3192 | 3192 | rtl_rx_vlan_en(tp, true); |
| 3193 | 3193 | |
| 3194 | − ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PAL_BDC_CR); | |
| 3194 | + ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_BDC_CR); | |
| 3195 | 3195 | ocp_data |= ALDPS_PROXY_MODE; |
| 3196 | − ocp_write_word(tp, MCU_TYPE_PLA, PAL_BDC_CR, ocp_data); | |
| 3196 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_BDC_CR, ocp_data); | |
| 3197 | 3197 | |
| 3198 | 3198 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
| 3199 | 3199 | ocp_data |= NOW_IS_OOB | DIS_MCU_CLROOB; |
| @@ -3577,9 +3577,9 @@ static void r8153_enter_oob(struct r8152 *tp) · 377 unmodified lines | ||
| 3577 | 3577 | |
| 3578 | 3578 | rtl_rx_vlan_en(tp, true); |
| 3579 | 3579 | |
| 3580 | − ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PAL_BDC_CR); | |
| 3580 | + ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_BDC_CR); | |
| 3581 | 3581 | ocp_data |= ALDPS_PROXY_MODE; |
| 3582 | − ocp_write_word(tp, MCU_TYPE_PLA, PAL_BDC_CR, ocp_data); | |
| 3582 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_BDC_CR, ocp_data); | |
| 3583 | 3583 | |
| 3584 | 3584 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
| 3585 | 3585 | ocp_data |= NOW_IS_OOB | DIS_MCU_CLROOB; |
| @@ -413,6 +413,7 @@ static void sdla_errors(struct net_device *dev, int cmd, int dlci, int ret, int · 412 unmodified lines | ||
| 413 | 413 | case SDLA_RET_NO_BUFS: |
| 414 | 414 | if (cmd == SDLA_INFORMATION_WRITE) |
| 415 | 415 | break; |
| 416 | + /* Else, fall through */ | |
| 416 | 417 | |
| 417 | 418 | default: |
| 418 | 419 | netdev_dbg(dev, "Cmd 0x%02X generated return code 0x%02X\n", |
| @@ -776,7 +776,6 @@ struct iwl_rss_config_cmd { · 775 unmodified lines | ||
| 776 | 776 | u8 indirection_table[IWL_RSS_INDIRECTION_TABLE_SIZE]; |
| 777 | 777 | } __packed; /* RSS_CONFIG_CMD_API_S_VER_1 */ |
| 778 | 778 | |
| 779 | −#define IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE 128 | |
| 780 | 779 | #define IWL_MULTI_QUEUE_SYNC_SENDER_POS 0 |
| 781 | 780 | #define IWL_MULTI_QUEUE_SYNC_SENDER_MSK 0xf |
| 782 | 781 | |
| @@ -812,10 +811,12 @@ struct iwl_rxq_sync_notification { · 29 unmodified lines | ||
| 812 | 811 | * |
| 813 | 812 | * @IWL_MVM_RXQ_EMPTY: empty sync notification |
| 814 | 813 | * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA |
| 814 | + * @IWL_MVM_RXQ_NSSN_SYNC: notify all the RSS queues with the new NSSN | |
| 815 | 815 | */ |
| 816 | 816 | enum iwl_mvm_rxq_notif_type { |
| 817 | 817 | IWL_MVM_RXQ_EMPTY, |
| 818 | 818 | IWL_MVM_RXQ_NOTIF_DEL_BA, |
| 819 | + IWL_MVM_RXQ_NSSN_SYNC, | |
| 819 | 820 | }; |
| 820 | 821 | |
| 821 | 822 | /** |
| @@ -2438,17 +2438,19 @@ static void iwl_fw_dbg_info_apply(struct iwl_fw_runtime *fwrt, · 2437 unmodified lines | ||
| 2438 | 2438 | { |
| 2439 | 2439 | u32 img_name_len = le32_to_cpu(dbg_info->img_name_len); |
| 2440 | 2440 | u32 dbg_cfg_name_len = le32_to_cpu(dbg_info->dbg_cfg_name_len); |
| 2441 | − const char err_str[] = | |
| 2442 | − "WRT: ext=%d. Invalid %s name length %d, expected %d\n"; | |
| 2443 | 2441 | |
| 2444 | 2442 | if (img_name_len != IWL_FW_INI_MAX_IMG_NAME_LEN) { |
| 2445 | − IWL_WARN(fwrt, err_str, ext, "image", img_name_len, | |
| 2443 | + IWL_WARN(fwrt, | |
| 2444 | + "WRT: ext=%d. Invalid image name length %d, expected %d\n", | |
| 2445 | + ext, img_name_len, | |
| 2446 | 2446 | IWL_FW_INI_MAX_IMG_NAME_LEN); |
| 2447 | 2447 | return; |
| 2448 | 2448 | } |
| 2449 | 2449 | |
| 2450 | 2450 | if (dbg_cfg_name_len != IWL_FW_INI_MAX_DBG_CFG_NAME_LEN) { |
| 2451 | − IWL_WARN(fwrt, err_str, ext, "debug cfg", dbg_cfg_name_len, | |
| 2451 | + IWL_WARN(fwrt, | |
| 2452 | + "WRT: ext=%d. Invalid debug cfg name length %d, expected %d\n", | |
| 2453 | + ext, dbg_cfg_name_len, | |
| 2452 | 2454 | IWL_FW_INI_MAX_DBG_CFG_NAME_LEN); |
| 2453 | 2455 | return; |
| 2454 | 2456 | } |
| @@ -2775,8 +2777,6 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, · 320 unmodified lines | ||
| 2775 | 2777 | struct iwl_ucode_tlv *tlv = iter; |
| 2776 | 2778 | void *ini_tlv = (void *)tlv->data; |
| 2777 | 2779 | u32 type = le32_to_cpu(tlv->type); |
| 2778 | − const char invalid_ap_str[] = | |
| 2779 | − "WRT: ext=%d. Invalid apply point %d for %s\n"; | |
| 2780 | 2780 | |
| 2781 | 2781 | switch (type) { |
| 2782 | 2782 | case IWL_UCODE_TLV_TYPE_DEBUG_INFO: |
| @@ -2786,8 +2786,9 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, · 3 unmodified lines | ||
| 2786 | 2786 | struct iwl_fw_ini_allocation_data *buf_alloc = ini_tlv; |
| 2787 | 2787 | |
| 2788 | 2788 | if (pnt != IWL_FW_INI_APPLY_EARLY) { |
| 2789 | − IWL_ERR(fwrt, invalid_ap_str, ext, pnt, | |
| 2790 | − "buffer allocation"); | |
| 2789 | + IWL_ERR(fwrt, | |
| 2790 | + "WRT: ext=%d. Invalid apply point %d for buffer allocation\n", | |
| 2791 | + ext, pnt); | |
| 2791 | 2792 | goto next; |
| 2792 | 2793 | } |
| 2793 | 2794 | |
| @@ -2797,8 +2798,9 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, · 3 unmodified lines | ||
| 2797 | 2798 | } |
| 2798 | 2799 | case IWL_UCODE_TLV_TYPE_HCMD: |
| 2799 | 2800 | if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) { |
| 2800 | − IWL_ERR(fwrt, invalid_ap_str, ext, pnt, | |
| 2801 | − "host command"); | |
| 2801 | + IWL_ERR(fwrt, | |
| 2802 | + "WRT: ext=%d. Invalid apply point %d for host command\n", | |
| 2803 | + ext, pnt); | |
| 2802 | 2804 | goto next; |
| 2803 | 2805 | } |
| 2804 | 2806 | iwl_fw_dbg_send_hcmd(fwrt, tlv, ext); |
| @@ -1640,6 +1640,8 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans) · 1639 unmodified lines | ||
| 1640 | 1640 | init_completion(&drv->request_firmware_complete); |
| 1641 | 1641 | INIT_LIST_HEAD(&drv->list); |
| 1642 | 1642 | |
| 1643 | + iwl_load_fw_dbg_tlv(drv->trans->dev, drv->trans); | |
| 1644 | + | |
| 1643 | 1645 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 1644 | 1646 | /* Create the device debugfs entries. */ |
| 1645 | 1647 | drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev), |
| @@ -1660,8 +1662,8 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans) · 14 unmodified lines | ||
| 1660 | 1662 | err_fw: |
| 1661 | 1663 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 1662 | 1664 | debugfs_remove_recursive(drv->dbgfs_drv); |
| 1663 | − iwl_fw_dbg_free(drv->trans); | |
| 1664 | 1665 | #endif |
| 1666 | + iwl_fw_dbg_free(drv->trans); | |
| 1665 | 1667 | kfree(drv); |
| 1666 | 1668 | err: |
| 1667 | 1669 | return ERR_PTR(ret); |
| @@ -755,7 +755,7 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) · 754 unmodified lines | ||
| 755 | 755 | |
| 756 | 756 | for (i = 0; i < n_profiles; i++) { |
| 757 | 757 | /* the tables start at element 3 */ |
| 758 | − static int pos = 3; | |
| 758 | + int pos = 3; | |
| 759 | 759 | |
| 760 | 760 | /* The EWRD profiles officially go from 2 to 4, but we |
| 761 | 761 | * save them in sar_profiles[1-3] (because we don't |
| @@ -880,6 +880,22 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) · 118 unmodified lines | ||
| 880 | 880 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | +static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm) | |
| 884 | +{ | |
| 885 | + /* | |
| 886 | + * The GEO_TX_POWER_LIMIT command is not supported on earlier | |
| 887 | + * firmware versions. Unfortunately, we don't have a TLV API | |
| 888 | + * flag to rely on, so rely on the major version which is in | |
| 889 | + * the first byte of ucode_ver. This was implemented | |
| 890 | + * initially on version 38 and then backported to 36, 29 and | |
| 891 | + * 17. | |
| 892 | + */ | |
| 893 | + return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || | |
| 894 | + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 36 || | |
| 895 | + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 || | |
| 896 | + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17; | |
| 897 | +} | |
| 898 | + | |
| 883 | 899 | int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) |
| 884 | 900 | { |
| 885 | 901 | struct iwl_geo_tx_power_profiles_resp *resp; |
| @@ -909,6 +925,9 @@ int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) · 23 unmodified lines | ||
| 909 | 925 | .data = { data }, |
| 910 | 926 | }; |
| 911 | 927 | |
| 928 | + if (!iwl_mvm_sar_geo_support(mvm)) | |
| 929 | + return -EOPNOTSUPP; | |
| 930 | + | |
| 912 | 931 | ret = iwl_mvm_send_cmd(mvm, &cmd); |
| 913 | 932 | if (ret) { |
| 914 | 933 | IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret); |
| @@ -934,13 +953,7 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) · 19 unmodified lines | ||
| 934 | 953 | int ret, i, j; |
| 935 | 954 | u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT); |
| 936 | 955 | |
| 937 | − /* | |
| 938 | − * This command is not supported on earlier firmware versions. | |
| 939 | − * Unfortunately, we don't have a TLV API flag to rely on, so | |
| 940 | − * rely on the major version which is in the first byte of | |
| 941 | − * ucode_ver. | |
| 942 | − */ | |
| 943 | − if (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) < 41) | |
| 956 | + if (!iwl_mvm_sar_geo_support(mvm)) | |
| 944 | 957 | return 0; |
| 945 | 958 | |
| 946 | 959 | ret = iwl_mvm_sar_get_wgds_table(mvm); |
| @@ -207,11 +207,11 @@ static const struct cfg80211_pmsr_capabilities iwl_mvm_pmsr_capa = { · 206 unmodified lines | ||
| 207 | 207 | }, |
| 208 | 208 | }; |
| 209 | 209 | |
| 210 | −static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |
| 211 | − enum set_key_cmd cmd, | |
| 212 | − struct ieee80211_vif *vif, | |
| 213 | − struct ieee80211_sta *sta, | |
| 214 | − struct ieee80211_key_conf *key); | |
| 210 | +static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |
| 211 | + enum set_key_cmd cmd, | |
| 212 | + struct ieee80211_vif *vif, | |
| 213 | + struct ieee80211_sta *sta, | |
| 214 | + struct ieee80211_key_conf *key); | |
| 215 | 215 | |
| 216 | 216 | void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type) |
| 217 | 217 | { |
| @@ -474,7 +474,19 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) · 256 unmodified lines | ||
| 474 | 474 | ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); |
| 475 | 475 | ieee80211_hw_set(hw, BUFF_MMPDU_TXQ); |
| 476 | 476 | ieee80211_hw_set(hw, STA_MMPDU_TXQ); |
| 477 | − ieee80211_hw_set(hw, TX_AMSDU); | |
| 477 | + /* | |
| 478 | + * On older devices, enabling TX A-MSDU occasionally leads to | |
| 479 | + * something getting messed up, the command read from the FIFO | |
| 480 | + * gets out of sync and isn't a TX command, so that we have an | |
| 481 | + * assert EDC. | |
| 482 | + * | |
| 483 | + * It's not clear where the bug is, but since we didn't used to | |
| 484 | + * support A-MSDU until moving the mac80211 iTXQs, just leave it | |
| 485 | + * for older devices. We also don't see this issue on any newer | |
| 486 | + * devices. | |
| 487 | + */ | |
| 488 | + if (mvm->cfg->device_family >= IWL_DEVICE_FAMILY_9000) | |
| 489 | + ieee80211_hw_set(hw, TX_AMSDU); | |
| 478 | 490 | ieee80211_hw_set(hw, TX_FRAG_LIST); |
| 479 | 491 | |
| 480 | 492 | if (iwl_mvm_has_tlc_offload(mvm)) { |
| @@ -2726,7 +2738,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw, · 2245 unmodified lines | ||
| 2726 | 2738 | |
| 2727 | 2739 | mvmvif->ap_early_keys[i] = NULL; |
| 2728 | 2740 | |
| 2729 | − ret = iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key); | |
| 2741 | + ret = __iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key); | |
| 2730 | 2742 | if (ret) |
| 2731 | 2743 | goto out_quota_failed; |
| 2732 | 2744 | } |
| @@ -3494,11 +3506,11 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, · 761 unmodified lines | ||
| 3494 | 3506 | return ret; |
| 3495 | 3507 | } |
| 3496 | 3508 | |
| 3497 | −static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |
| 3498 | − enum set_key_cmd cmd, | |
| 3499 | − struct ieee80211_vif *vif, | |
| 3500 | − struct ieee80211_sta *sta, | |
| 3501 | − struct ieee80211_key_conf *key) | |
| 3509 | +static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |
| 3510 | + enum set_key_cmd cmd, | |
| 3511 | + struct ieee80211_vif *vif, | |
| 3512 | + struct ieee80211_sta *sta, | |
| 3513 | + struct ieee80211_key_conf *key) | |
| 3502 | 3514 | { |
| 3503 | 3515 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 3504 | 3516 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| @@ -3553,8 +3565,6 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, · 48 unmodified lines | ||
| 3553 | 3565 | return -EOPNOTSUPP; |
| 3554 | 3566 | } |
| 3555 | 3567 | |
| 3556 | − mutex_lock(&mvm->mutex); | |
| 3557 | − | |
| 3558 | 3568 | switch (cmd) { |
| 3559 | 3569 | case SET_KEY: |
| 3560 | 3570 | if ((vif->type == NL80211_IFTYPE_ADHOC || |
| @@ -3700,7 +3710,22 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, · 139 unmodified lines | ||
| 3700 | 3710 | ret = -EINVAL; |
| 3701 | 3711 | } |
| 3702 | 3712 | |
| 3713 | + return ret; | |
| 3714 | +} | |
| 3715 | + | |
| 3716 | +static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |
| 3717 | + enum set_key_cmd cmd, | |
| 3718 | + struct ieee80211_vif *vif, | |
| 3719 | + struct ieee80211_sta *sta, | |
| 3720 | + struct ieee80211_key_conf *key) | |
| 3721 | +{ | |
| 3722 | + struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
| 3723 | + int ret; | |
| 3724 | + | |
| 3725 | + mutex_lock(&mvm->mutex); | |
| 3726 | + ret = __iwl_mvm_mac_set_key(hw, cmd, vif, sta, key); | |
| 3703 | 3727 | mutex_unlock(&mvm->mutex); |
| 3728 | + | |
| 3704 | 3729 | return ret; |
| 3705 | 3730 | } |
| 3706 | 3731 | |
| @@ -5041,7 +5066,6 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, · 1334 unmodified lines | ||
| 5041 | 5066 | u32 qmask = BIT(mvm->trans->num_rx_queues) - 1; |
| 5042 | 5067 | int ret; |
| 5043 | 5068 | |
| 5044 | − lockdep_assert_held(&mvm->mutex); | |
| 5045 | 5069 | |
| 5046 | 5070 | if (!iwl_mvm_has_new_rx_api(mvm)) |
| 5047 | 5071 | return; |
| @@ -5052,13 +5076,15 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, · 4 unmodified lines | ||
| 5052 | 5076 | atomic_set(&mvm->queue_sync_counter, |
| 5053 | 5077 | mvm->trans->num_rx_queues); |
| 5054 | 5078 | |
| 5055 | − ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, size); | |
| 5079 | + ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, | |
| 5080 | + size, !notif->sync); | |
| 5056 | 5081 | if (ret) { |
| 5057 | 5082 | IWL_ERR(mvm, "Failed to trigger RX queues sync (%d)\n", ret); |
| 5058 | 5083 | goto out; |
| 5059 | 5084 | } |
| 5060 | 5085 | |
| 5061 | 5086 | if (notif->sync) { |
| 5087 | + lockdep_assert_held(&mvm->mutex); | |
| 5062 | 5088 | ret = wait_event_timeout(mvm->rx_sync_waitq, |
| 5063 | 5089 | atomic_read(&mvm->queue_sync_counter) == 0 || |
| 5064 | 5090 | iwl_mvm_is_radio_killed(mvm), |
| @@ -1664,9 +1664,9 @@ void iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi, · 1663 unmodified lines | ||
| 1664 | 1664 | void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, |
| 1665 | 1665 | struct iwl_rx_cmd_buffer *rxb, int queue); |
| 1666 | 1666 | int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, |
| 1667 | − const u8 *data, u32 count); | |
| 1668 | −void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |
| 1669 | − int queue); | |
| 1667 | + const u8 *data, u32 count, bool async); | |
| 1668 | +void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, | |
| 1669 | + struct iwl_rx_cmd_buffer *rxb, int queue); | |
| 1670 | 1670 | void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
| 1671 | 1671 | void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, |
| 1672 | 1672 | struct iwl_rx_cmd_buffer *rxb); |
| @@ -1813,7 +1813,7 @@ iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 140 unmodified lines | ||
| 1813 | 1813 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
| 1814 | 1814 | |
| 1815 | 1815 | /* rate scaling */ |
| 1816 | −int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool sync); | |
| 1816 | +int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq); | |
| 1817 | 1817 | void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg); |
| 1818 | 1818 | int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate); |
| 1819 | 1819 | void rs_update_last_rssi(struct iwl_mvm *mvm, |
| @@ -620,7 +620,7 @@ void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm, · 619 unmodified lines | ||
| 620 | 620 | enum iwl_mcc_source src; |
| 621 | 621 | char mcc[3]; |
| 622 | 622 | struct ieee80211_regdomain *regd; |
| 623 | − u32 wgds_tbl_idx; | |
| 623 | + int wgds_tbl_idx; | |
| 624 | 624 | |
| 625 | 625 | lockdep_assert_held(&mvm->mutex); |
| 626 | 626 | |
| @@ -1088,7 +1088,7 @@ static void iwl_mvm_rx_mq(struct iwl_op_mode *op_mode, · 1087 unmodified lines | ||
| 1088 | 1088 | iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0); |
| 1089 | 1089 | else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP, |
| 1090 | 1090 | RX_QUEUES_NOTIFICATION))) |
| 1091 | − iwl_mvm_rx_queue_notif(mvm, rxb, 0); | |
| 1091 | + iwl_mvm_rx_queue_notif(mvm, napi, rxb, 0); | |
| 1092 | 1092 | else if (cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE)) |
| 1093 | 1093 | iwl_mvm_rx_frame_release(mvm, napi, rxb, 0); |
| 1094 | 1094 | else if (cmd == WIDE_ID(DATA_PATH_GROUP, RX_NO_DATA_NOTIF)) |
| @@ -1812,7 +1812,7 @@ static void iwl_mvm_rx_mq_rss(struct iwl_op_mode *op_mode, · 717 unmodified lines | ||
| 1812 | 1812 | iwl_mvm_rx_frame_release(mvm, napi, rxb, queue); |
| 1813 | 1813 | else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP, |
| 1814 | 1814 | RX_QUEUES_NOTIFICATION))) |
| 1815 | − iwl_mvm_rx_queue_notif(mvm, rxb, queue); | |
| 1815 | + iwl_mvm_rx_queue_notif(mvm, napi, rxb, queue); | |
| 1816 | 1816 | else if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))) |
| 1817 | 1817 | iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, queue); |
| 1818 | 1818 | } |
| @@ -1197,239 +1197,6 @@ static u8 rs_get_tid(struct ieee80211_hdr *hdr) · 1196 unmodified lines | ||
| 1197 | 1197 | return tid; |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | −void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |
| 1201 | − int tid, struct ieee80211_tx_info *info, bool ndp) | |
| 1202 | −{ | |
| 1203 | − int legacy_success; | |
| 1204 | − int retries; | |
| 1205 | − int i; | |
| 1206 | − struct iwl_lq_cmd *table; | |
| 1207 | − u32 lq_hwrate; | |
| 1208 | − struct rs_rate lq_rate, tx_resp_rate; | |
| 1209 | − struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; | |
| 1210 | − u32 tlc_info = (uintptr_t)info->status.status_driver_data[0]; | |
| 1211 | − u8 reduced_txp = tlc_info & RS_DRV_DATA_TXP_MSK; | |
| 1212 | − u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info); | |
| 1213 | − u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; | |
| 1214 | − struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
| 1215 | − struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; | |
| 1216 | − | |
| 1217 | − /* Treat uninitialized rate scaling data same as non-existing. */ | |
| 1218 | − if (!lq_sta) { | |
| 1219 | − IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n"); | |
| 1220 | − return; | |
| 1221 | − } else if (!lq_sta->pers.drv) { | |
| 1222 | − IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); | |
| 1223 | − return; | |
| 1224 | − } | |
| 1225 | − | |
| 1226 | − /* This packet was aggregated but doesn't carry status info */ | |
| 1227 | − if ((info->flags & IEEE80211_TX_CTL_AMPDU) && | |
| 1228 | − !(info->flags & IEEE80211_TX_STAT_AMPDU)) | |
| 1229 | − return; | |
| 1230 | − | |
| 1231 | − if (rs_rate_from_ucode_rate(tx_resp_hwrate, info->band, | |
| 1232 | − &tx_resp_rate)) { | |
| 1233 | − WARN_ON_ONCE(1); | |
| 1234 | − return; | |
| 1235 | − } | |
| 1236 | − | |
| 1237 | −#ifdef CONFIG_MAC80211_DEBUGFS | |
| 1238 | − /* Disable last tx check if we are debugging with fixed rate but | |
| 1239 | − * update tx stats */ | |
| 1240 | − if (lq_sta->pers.dbg_fixed_rate) { | |
| 1241 | − int index = tx_resp_rate.index; | |
| 1242 | − enum rs_column column; | |
| 1243 | − int attempts, success; | |
| 1244 | − | |
| 1245 | − column = rs_get_column_from_rate(&tx_resp_rate); | |
| 1246 | − if (WARN_ONCE(column == RS_COLUMN_INVALID, | |
| 1247 | − "Can't map rate 0x%x to column", | |
| 1248 | − tx_resp_hwrate)) | |
| 1249 | − return; | |
| 1250 | − | |
| 1251 | − if (info->flags & IEEE80211_TX_STAT_AMPDU) { | |
| 1252 | − attempts = info->status.ampdu_len; | |
| 1253 | − success = info->status.ampdu_ack_len; | |
| 1254 | − } else { | |
| 1255 | − attempts = info->status.rates[0].count; | |
| 1256 | − success = !!(info->flags & IEEE80211_TX_STAT_ACK); | |
| 1257 | − } | |
| 1258 | − | |
| 1259 | − lq_sta->pers.tx_stats[column][index].total += attempts; | |
| 1260 | − lq_sta->pers.tx_stats[column][index].success += success; | |
| 1261 | − | |
| 1262 | − IWL_DEBUG_RATE(mvm, "Fixed rate 0x%x success %d attempts %d\n", | |
| 1263 | − tx_resp_hwrate, success, attempts); | |
| 1264 | − return; | |
| 1265 | − } | |
| 1266 | −#endif | |
| 1267 | − | |
| 1268 | − if (time_after(jiffies, | |
| 1269 | − (unsigned long)(lq_sta->last_tx + | |
| 1270 | − (IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) { | |
| 1271 | − IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); | |
| 1272 | − iwl_mvm_rs_rate_init(mvm, sta, info->band, true); | |
| 1273 | − return; | |
| 1274 | − } | |
| 1275 | − lq_sta->last_tx = jiffies; | |
| 1276 | − | |
| 1277 | − /* Ignore this Tx frame response if its initial rate doesn't match | |
| 1278 | − * that of latest Link Quality command. There may be stragglers | |
| 1279 | − * from a previous Link Quality command, but we're no longer interested | |
| 1280 | − * in those; they're either from the "active" mode while we're trying | |
| 1281 | − * to check "search" mode, or a prior "search" mode after we've moved | |
| 1282 | − * to a new "search" mode (which might become the new "active" mode). | |
| 1283 | − */ | |
| 1284 | − table = &lq_sta->lq; | |
| 1285 | − lq_hwrate = le32_to_cpu(table->rs_table[0]); | |
| 1286 | − if (rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate)) { | |
| 1287 | − WARN_ON_ONCE(1); | |
| 1288 | − return; | |
| 1289 | − } | |
| 1290 | − | |
| 1291 | − /* Here we actually compare this rate to the latest LQ command */ | |
| 1292 | − if (lq_color != LQ_FLAG_COLOR_GET(table->flags)) { | |
| 1293 | − IWL_DEBUG_RATE(mvm, | |
| 1294 | − "tx resp color 0x%x does not match 0x%x\n", | |
| 1295 | − lq_color, LQ_FLAG_COLOR_GET(table->flags)); | |
| 1296 | − | |
| 1297 | − /* | |
| 1298 | − * Since rates mis-match, the last LQ command may have failed. | |
| 1299 | − * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with | |
| 1300 | − * ... driver. | |
| 1301 | − */ | |
| 1302 | − lq_sta->missed_rate_counter++; | |
| 1303 | − if (lq_sta->missed_rate_counter > IWL_MVM_RS_MISSED_RATE_MAX) { | |
| 1304 | − lq_sta->missed_rate_counter = 0; | |
| 1305 | − IWL_DEBUG_RATE(mvm, | |
| 1306 | − "Too many rates mismatch. Send sync LQ. rs_state %d\n", | |
| 1307 | − lq_sta->rs_state); | |
| 1308 | − iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, false); | |
| 1309 | − } | |
| 1310 | − /* Regardless, ignore this status info for outdated rate */ | |
| 1311 | − return; | |
| 1312 | − } else | |
| 1313 | − /* Rate did match, so reset the missed_rate_counter */ | |
| 1314 | − lq_sta->missed_rate_counter = 0; | |
| 1315 | − | |
| 1316 | − if (!lq_sta->search_better_tbl) { | |
| 1317 | − curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | |
| 1318 | − other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); | |
| 1319 | − } else { | |
| 1320 | − curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); | |
| 1321 | − other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | |
| 1322 | − } | |
| 1323 | − | |
| 1324 | − if (WARN_ON_ONCE(!rs_rate_column_match(&lq_rate, &curr_tbl->rate))) { | |
| 1325 | − IWL_DEBUG_RATE(mvm, | |
| 1326 | − "Neither active nor search matches tx rate\n"); | |
| 1327 | − tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | |
| 1328 | − rs_dump_rate(mvm, &tmp_tbl->rate, "ACTIVE"); | |
| 1329 | − tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); | |
| 1330 | − rs_dump_rate(mvm, &tmp_tbl->rate, "SEARCH"); | |
| 1331 | − rs_dump_rate(mvm, &lq_rate, "ACTUAL"); | |
| 1332 | − | |
| 1333 | − /* | |
| 1334 | − * no matching table found, let's by-pass the data collection | |
| 1335 | − * and continue to perform rate scale to find the rate table | |
| 1336 | − */ | |
| 1337 | − rs_stay_in_table(lq_sta, true); | |
| 1338 | − goto done; | |
| 1339 | − } | |
| 1340 | − | |
| 1341 | − /* | |
| 1342 | − * Updating the frame history depends on whether packets were | |
| 1343 | − * aggregated. | |
| 1344 | − * | |
| 1345 | − * For aggregation, all packets were transmitted at the same rate, the | |
| 1346 | − * first index into rate scale table. | |
| 1347 | − */ | |
| 1348 | − if (info->flags & IEEE80211_TX_STAT_AMPDU) { | |
| 1349 | − rs_collect_tpc_data(mvm, lq_sta, curr_tbl, tx_resp_rate.index, | |
| 1350 | − info->status.ampdu_len, | |
| 1351 | − info->status.ampdu_ack_len, | |
| 1352 | − reduced_txp); | |
| 1353 | − | |
| 1354 | − /* ampdu_ack_len = 0 marks no BA was received. For TLC, treat | |
| 1355 | − * it as a single frame loss as we don't want the success ratio | |
| 1356 | − * to dip too quickly because a BA wasn't received. | |
| 1357 | − * For TPC, there's no need for this optimisation since we want | |
| 1358 | − * to recover very quickly from a bad power reduction and, | |
| 1359 | − * therefore we'd like the success ratio to get an immediate hit | |
| 1360 | − * when failing to get a BA, so we'd switch back to a lower or | |
| 1361 | − * zero power reduction. When FW transmits agg with a rate | |
| 1362 | − * different from the initial rate, it will not use reduced txp | |
| 1363 | − * and will send BA notification twice (one empty with reduced | |
| 1364 | − * txp equal to the value from LQ and one with reduced txp 0). | |
| 1365 | − * We need to update counters for each txp level accordingly. | |
| 1366 | − */ | |
| 1367 | − if (info->status.ampdu_ack_len == 0) | |
| 1368 | − info->status.ampdu_len = 1; | |
| 1369 | − | |
| 1370 | − rs_collect_tlc_data(mvm, mvmsta, tid, curr_tbl, tx_resp_rate.index, | |
| 1371 | − info->status.ampdu_len, | |
| 1372 | − info->status.ampdu_ack_len); | |
| 1373 | − | |
| 1374 | − /* Update success/fail counts if not searching for new mode */ | |
| 1375 | − if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { | |
| 1376 | − lq_sta->total_success += info->status.ampdu_ack_len; | |
| 1377 | − lq_sta->total_failed += (info->status.ampdu_len - | |
| 1378 | − info->status.ampdu_ack_len); | |
| 1379 | − } | |
| 1380 | − } else { | |
| 1381 | − /* For legacy, update frame history with for each Tx retry. */ | |
| 1382 | − retries = info->status.rates[0].count - 1; | |
| 1383 | − /* HW doesn't send more than 15 retries */ | |
| 1384 | − retries = min(retries, 15); | |
| 1385 | − | |
| 1386 | − /* The last transmission may have been successful */ | |
| 1387 | − legacy_success = !!(info->flags & IEEE80211_TX_STAT_ACK); | |
| 1388 | − /* Collect data for each rate used during failed TX attempts */ | |
| 1389 | − for (i = 0; i <= retries; ++i) { | |
| 1390 | − lq_hwrate = le32_to_cpu(table->rs_table[i]); | |
| 1391 | − if (rs_rate_from_ucode_rate(lq_hwrate, info->band, | |
| 1392 | − &lq_rate)) { | |
| 1393 | − WARN_ON_ONCE(1); | |
| 1394 | − return; | |
| 1395 | − } | |
| 1396 | − | |
| 1397 | − /* | |
| 1398 | − * Only collect stats if retried rate is in the same RS | |
| 1399 | − * table as active/search. | |
| 1400 | − */ | |
| 1401 | − if (rs_rate_column_match(&lq_rate, &curr_tbl->rate)) | |
| 1402 | − tmp_tbl = curr_tbl; | |
| 1403 | − else if (rs_rate_column_match(&lq_rate, | |
| 1404 | − &other_tbl->rate)) | |
| 1405 | − tmp_tbl = other_tbl; | |
| 1406 | − else | |
| 1407 | − continue; | |
| 1408 | − | |
| 1409 | − rs_collect_tpc_data(mvm, lq_sta, tmp_tbl, | |
| 1410 | − tx_resp_rate.index, 1, | |
| 1411 | − i < retries ? 0 : legacy_success, | |
| 1412 | − reduced_txp); | |
| 1413 | − rs_collect_tlc_data(mvm, mvmsta, tid, tmp_tbl, | |
| 1414 | − tx_resp_rate.index, 1, | |
| 1415 | − i < retries ? 0 : legacy_success); | |
| 1416 | − } | |
| 1417 | − | |
| 1418 | − /* Update success/fail counts if not searching for new mode */ | |
| 1419 | − if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { | |
| 1420 | − lq_sta->total_success += legacy_success; | |
| 1421 | − lq_sta->total_failed += retries + (1 - legacy_success); | |
| 1422 | − } | |
| 1423 | − } | |
| 1424 | − /* The last TX rate is cached in lq_sta; it's set in if/else above */ | |
| 1425 | − lq_sta->last_rate_n_flags = lq_hwrate; | |
| 1426 | − IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp); | |
| 1427 | −done: | |
| 1428 | − /* See if there's a better rate or modulation mode to try. */ | |
| 1429 | − if (sta->supp_rates[info->band]) | |
| 1430 | − rs_rate_scale_perform(mvm, sta, lq_sta, tid, ndp); | |
| 1431 | −} | |
| 1432 | − | |
| 1433 | 1200 | /* |
| 1434 | 1201 | * mac80211 sends us Tx status |
| 1435 | 1202 | */ |
| @@ -1442,8 +1209,9 @@ static void rs_drv_mac80211_tx_status(void *mvm_r, · 6 unmodified lines | ||
| 1442 | 1209 | struct iwl_op_mode *op_mode = mvm_r; |
| 1443 | 1210 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); |
| 1444 | 1211 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 1212 | + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
| 1445 | 1213 | |
| 1446 | − if (!iwl_mvm_sta_from_mac80211(sta)->vif) | |
| 1214 | + if (!mvmsta->vif) | |
| 1447 | 1215 | return; |
| 1448 | 1216 | |
| 1449 | 1217 | if (!ieee80211_is_data(hdr->frame_control) || |
| @@ -1584,6 +1352,18 @@ static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, · 134 unmodified lines | ||
| 1584 | 1352 | tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); |
| 1585 | 1353 | } |
| 1586 | 1354 | |
| 1355 | +/* rs uses two tables, one is active and the second is for searching better | |
| 1356 | + * configuration. This function, according to the index of the currently | |
| 1357 | + * active table returns the search table, which is located at the | |
| 1358 | + * index complementary to 1 according to the active table (active = 1, | |
| 1359 | + * search = 0 or active = 0, search = 1). | |
| 1360 | + * Since lq_info is an arary of size 2, make sure index cannot be out of bounds. | |
| 1361 | + */ | |
| 1362 | +static inline u8 rs_search_tbl(u8 active_tbl) | |
| 1363 | +{ | |
| 1364 | + return (active_tbl ^ 1) & 1; | |
| 1365 | +} | |
| 1366 | + | |
| 1587 | 1367 | static s32 rs_get_best_rate(struct iwl_mvm *mvm, |
| 1588 | 1368 | struct iwl_lq_sta *lq_sta, |
| 1589 | 1369 | struct iwl_scale_tbl_info *tbl, /* "search" */ |
| @@ -1794,7 +1574,7 @@ static void rs_update_rate_tbl(struct iwl_mvm *mvm, · 204 unmodified lines | ||
| 1794 | 1574 | struct iwl_scale_tbl_info *tbl) |
| 1795 | 1575 | { |
| 1796 | 1576 | rs_fill_lq_cmd(mvm, sta, lq_sta, &tbl->rate); |
| 1797 | − iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, false); | |
| 1577 | + iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq); | |
| 1798 | 1578 | } |
| 1799 | 1579 | |
| 1800 | 1580 | static bool rs_tweak_rate_tbl(struct iwl_mvm *mvm, |
| @@ -1931,9 +1711,9 @@ static int rs_switch_to_column(struct iwl_mvm *mvm, · 130 unmodified lines | ||
| 1931 | 1711 | struct ieee80211_sta *sta, |
| 1932 | 1712 | enum rs_column col_id) |
| 1933 | 1713 | { |
| 1934 | − struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | |
| 1714 | + struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; | |
| 1935 | 1715 | struct iwl_scale_tbl_info *search_tbl = |
| 1936 | − &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); | |
| 1716 | + &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; | |
| 1937 | 1717 | struct rs_rate *rate = &search_tbl->rate; |
| 1938 | 1718 | const struct rs_tx_column *column = &rs_tx_columns[col_id]; |
| 1939 | 1719 | const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; |
| @@ -2341,7 +2121,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, · 401 unmodified lines | ||
| 2341 | 2121 | if (!lq_sta->search_better_tbl) |
| 2342 | 2122 | active_tbl = lq_sta->active_tbl; |
| 2343 | 2123 | else |
| 2344 | − active_tbl = 1 - lq_sta->active_tbl; | |
| 2124 | + active_tbl = rs_search_tbl(lq_sta->active_tbl); | |
| 2345 | 2125 | |
| 2346 | 2126 | tbl = &(lq_sta->lq_info[active_tbl]); |
| 2347 | 2127 | rate = &tbl->rate; |
| @@ -2565,7 +2345,7 @@ lq_update: · 217 unmodified lines | ||
| 2565 | 2345 | /* If new "search" mode was selected, set up in uCode table */ |
| 2566 | 2346 | if (lq_sta->search_better_tbl) { |
| 2567 | 2347 | /* Access the "search" table, clear its history. */ |
| 2568 | − tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); | |
| 2348 | + tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; | |
| 2569 | 2349 | rs_rate_scale_clear_tbl_windows(mvm, tbl); |
| 2570 | 2350 | |
| 2571 | 2351 | /* Use new "search" start rate */ |
| @@ -2896,7 +2676,7 @@ void rs_update_last_rssi(struct iwl_mvm *mvm, · 324 unmodified lines | ||
| 2896 | 2676 | static void rs_initialize_lq(struct iwl_mvm *mvm, |
| 2897 | 2677 | struct ieee80211_sta *sta, |
| 2898 | 2678 | struct iwl_lq_sta *lq_sta, |
| 2899 | − enum nl80211_band band, bool update) | |
| 2679 | + enum nl80211_band band) | |
| 2900 | 2680 | { |
| 2901 | 2681 | struct iwl_scale_tbl_info *tbl; |
| 2902 | 2682 | struct rs_rate *rate; |
| @@ -2908,7 +2688,7 @@ static void rs_initialize_lq(struct iwl_mvm *mvm, · 5 unmodified lines | ||
| 2908 | 2688 | if (!lq_sta->search_better_tbl) |
| 2909 | 2689 | active_tbl = lq_sta->active_tbl; |
| 2910 | 2690 | else |
| 2911 | − active_tbl = 1 - lq_sta->active_tbl; | |
| 2691 | + active_tbl = rs_search_tbl(lq_sta->active_tbl); | |
| 2912 | 2692 | |
| 2913 | 2693 | tbl = &(lq_sta->lq_info[active_tbl]); |
| 2914 | 2694 | rate = &tbl->rate; |
| @@ -2926,7 +2706,7 @@ static void rs_initialize_lq(struct iwl_mvm *mvm, · 11 unmodified lines | ||
| 2926 | 2706 | rs_set_expected_tpt_table(lq_sta, tbl); |
| 2927 | 2707 | rs_fill_lq_cmd(mvm, sta, lq_sta, rate); |
| 2928 | 2708 | /* TODO restore station should remember the lq cmd */ |
| 2929 | − iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, !update); | |
| 2709 | + iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq); | |
| 2930 | 2710 | } |
| 2931 | 2711 | |
| 2932 | 2712 | static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta, |
| @@ -3175,7 +2955,7 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg) · 242 unmodified lines | ||
| 3175 | 2955 | * Called after adding a new station to initialize rate scaling |
| 3176 | 2956 | */ |
| 3177 | 2957 | static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 3178 | − enum nl80211_band band, bool update) | |
| 2958 | + enum nl80211_band band) | |
| 3179 | 2959 | { |
| 3180 | 2960 | int i, j; |
| 3181 | 2961 | struct ieee80211_hw *hw = mvm->hw; |
| @@ -3186,6 +2966,8 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, · 4 unmodified lines | ||
| 3186 | 2966 | struct ieee80211_supported_band *sband; |
| 3187 | 2967 | unsigned long supp; /* must be unsigned long for for_each_set_bit */ |
| 3188 | 2968 | |
| 2969 | + lockdep_assert_held(&mvmsta->lq_sta.rs_drv.pers.lock); | |
| 2970 | + | |
| 3189 | 2971 | /* clear all non-persistent lq data */ |
| 3190 | 2972 | memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers)); |
| 3191 | 2973 | |
| @@ -3255,7 +3037,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, · 63 unmodified lines | ||
| 3255 | 3037 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 3256 | 3038 | iwl_mvm_reset_frame_stats(mvm); |
| 3257 | 3039 | #endif |
| 3258 | − rs_initialize_lq(mvm, sta, lq_sta, band, update); | |
| 3040 | + rs_initialize_lq(mvm, sta, lq_sta, band); | |
| 3259 | 3041 | } |
| 3260 | 3042 | |
| 3261 | 3043 | static void rs_drv_rate_update(void *mvm_r, |
| @@ -3278,6 +3060,258 @@ static void rs_drv_rate_update(void *mvm_r, · 16 unmodified lines | ||
| 3278 | 3060 | iwl_mvm_rs_rate_init(mvm, sta, sband->band, true); |
| 3279 | 3061 | } |
| 3280 | 3062 | |
| 3063 | +static void __iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, | |
| 3064 | + struct ieee80211_sta *sta, | |
| 3065 | + int tid, struct ieee80211_tx_info *info, | |
| 3066 | + bool ndp) | |
| 3067 | +{ | |
| 3068 | + int legacy_success; | |
| 3069 | + int retries; | |
| 3070 | + int i; | |
| 3071 | + struct iwl_lq_cmd *table; | |
| 3072 | + u32 lq_hwrate; | |
| 3073 | + struct rs_rate lq_rate, tx_resp_rate; | |
| 3074 | + struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; | |
| 3075 | + u32 tlc_info = (uintptr_t)info->status.status_driver_data[0]; | |
| 3076 | + u8 reduced_txp = tlc_info & RS_DRV_DATA_TXP_MSK; | |
| 3077 | + u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info); | |
| 3078 | + u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; | |
| 3079 | + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
| 3080 | + struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; | |
| 3081 | + | |
| 3082 | + /* Treat uninitialized rate scaling data same as non-existing. */ | |
| 3083 | + if (!lq_sta) { | |
| 3084 | + IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n"); | |
| 3085 | + return; | |
| 3086 | + } else if (!lq_sta->pers.drv) { | |
| 3087 | + IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); | |
| 3088 | + return; | |
| 3089 | + } | |
| 3090 | + | |
| 3091 | + /* This packet was aggregated but doesn't carry status info */ | |
| 3092 | + if ((info->flags & IEEE80211_TX_CTL_AMPDU) && | |
| 3093 | + !(info->flags & IEEE80211_TX_STAT_AMPDU)) | |
| 3094 | + return; | |
| 3095 | + | |
| 3096 | + if (rs_rate_from_ucode_rate(tx_resp_hwrate, info->band, | |
| 3097 | + &tx_resp_rate)) { | |
| 3098 | + WARN_ON_ONCE(1); | |
| 3099 | + return; | |
| 3100 | + } | |
| 3101 | + | |
| 3102 | +#ifdef CONFIG_MAC80211_DEBUGFS | |
| 3103 | + /* Disable last tx check if we are debugging with fixed rate but | |
| 3104 | + * update tx stats | |
| 3105 | + */ | |
| 3106 | + if (lq_sta->pers.dbg_fixed_rate) { | |
| 3107 | + int index = tx_resp_rate.index; | |
| 3108 | + enum rs_column column; | |
| 3109 | + int attempts, success; | |
| 3110 | + | |
| 3111 | + column = rs_get_column_from_rate(&tx_resp_rate); | |
| 3112 | + if (WARN_ONCE(column == RS_COLUMN_INVALID, | |
| 3113 | + "Can't map rate 0x%x to column", | |
| 3114 | + tx_resp_hwrate)) | |
| 3115 | + return; | |
| 3116 | + | |
| 3117 | + if (info->flags & IEEE80211_TX_STAT_AMPDU) { | |
| 3118 | + attempts = info->status.ampdu_len; | |
| 3119 | + success = info->status.ampdu_ack_len; | |
| 3120 | + } else { | |
| 3121 | + attempts = info->status.rates[0].count; | |
| 3122 | + success = !!(info->flags & IEEE80211_TX_STAT_ACK); | |
| 3123 | + } | |
| 3124 | + | |
| 3125 | + lq_sta->pers.tx_stats[column][index].total += attempts; | |
| 3126 | + lq_sta->pers.tx_stats[column][index].success += success; | |
| 3127 | + | |
| 3128 | + IWL_DEBUG_RATE(mvm, "Fixed rate 0x%x success %d attempts %d\n", | |
| 3129 | + tx_resp_hwrate, success, attempts); | |
| 3130 | + return; | |
| 3131 | + } | |
| 3132 | +#endif | |
| 3133 | + | |
| 3134 | + if (time_after(jiffies, | |
| 3135 | + (unsigned long)(lq_sta->last_tx + | |
| 3136 | + (IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) { | |
| 3137 | + IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); | |
| 3138 | + /* reach here only in case of driver RS, call directly | |
| 3139 | + * the unlocked version | |
| 3140 | + */ | |
| 3141 | + rs_drv_rate_init(mvm, sta, info->band); | |
| 3142 | + return; | |
| 3143 | + } | |
| 3144 | + lq_sta->last_tx = jiffies; | |
| 3145 | + | |
| 3146 | + /* Ignore this Tx frame response if its initial rate doesn't match | |
| 3147 | + * that of latest Link Quality command. There may be stragglers | |
| 3148 | + * from a previous Link Quality command, but we're no longer interested | |
| 3149 | + * in those; they're either from the "active" mode while we're trying | |
| 3150 | + * to check "search" mode, or a prior "search" mode after we've moved | |
| 3151 | + * to a new "search" mode (which might become the new "active" mode). | |
| 3152 | + */ | |
| 3153 | + table = &lq_sta->lq; | |
| 3154 | + lq_hwrate = le32_to_cpu(table->rs_table[0]); | |
| 3155 | + if (rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate)) { | |
| 3156 | + WARN_ON_ONCE(1); | |
| 3157 | + return; | |
| 3158 | + } | |
| 3159 | + | |
| 3160 | + /* Here we actually compare this rate to the latest LQ command */ | |
| 3161 | + if (lq_color != LQ_FLAG_COLOR_GET(table->flags)) { | |
| 3162 | + IWL_DEBUG_RATE(mvm, | |
| 3163 | + "tx resp color 0x%x does not match 0x%x\n", | |
| 3164 | + lq_color, LQ_FLAG_COLOR_GET(table->flags)); | |
| 3165 | + | |
| 3166 | + /* Since rates mis-match, the last LQ command may have failed. | |
| 3167 | + * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with | |
| 3168 | + * ... driver. | |
| 3169 | + */ | |
| 3170 | + lq_sta->missed_rate_counter++; | |
| 3171 | + if (lq_sta->missed_rate_counter > IWL_MVM_RS_MISSED_RATE_MAX) { | |
| 3172 | + lq_sta->missed_rate_counter = 0; | |
| 3173 | + IWL_DEBUG_RATE(mvm, | |
| 3174 | + "Too many rates mismatch. Send sync LQ. rs_state %d\n", | |
| 3175 | + lq_sta->rs_state); | |
| 3176 | + iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq); | |
| 3177 | + } | |
| 3178 | + /* Regardless, ignore this status info for outdated rate */ | |
| 3179 | + return; | |
| 3180 | + } | |
| 3181 | + | |
| 3182 | + /* Rate did match, so reset the missed_rate_counter */ | |
| 3183 | + lq_sta->missed_rate_counter = 0; | |
| 3184 | + | |
| 3185 | + if (!lq_sta->search_better_tbl) { | |
| 3186 | + curr_tbl = &lq_sta->lq_info[lq_sta->active_tbl]; | |
| 3187 | + other_tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; | |
| 3188 | + } else { | |
| 3189 | + curr_tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; | |
| 3190 | + other_tbl = &lq_sta->lq_info[lq_sta->active_tbl]; | |
| 3191 | + } | |
| 3192 | + | |
| 3193 | + if (WARN_ON_ONCE(!rs_rate_column_match(&lq_rate, &curr_tbl->rate))) { | |
| 3194 | + IWL_DEBUG_RATE(mvm, | |
| 3195 | + "Neither active nor search matches tx rate\n"); | |
| 3196 | + tmp_tbl = &lq_sta->lq_info[lq_sta->active_tbl]; | |
| 3197 | + rs_dump_rate(mvm, &tmp_tbl->rate, "ACTIVE"); | |
| 3198 | + tmp_tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; | |
| 3199 | + rs_dump_rate(mvm, &tmp_tbl->rate, "SEARCH"); | |
| 3200 | + rs_dump_rate(mvm, &lq_rate, "ACTUAL"); | |
| 3201 | + | |
| 3202 | + /* no matching table found, let's by-pass the data collection | |
| 3203 | + * and continue to perform rate scale to find the rate table | |
| 3204 | + */ | |
| 3205 | + rs_stay_in_table(lq_sta, true); | |
| 3206 | + goto done; | |
| 3207 | + } | |
| 3208 | + | |
| 3209 | + /* Updating the frame history depends on whether packets were | |
| 3210 | + * aggregated. | |
| 3211 | + * | |
| 3212 | + * For aggregation, all packets were transmitted at the same rate, the | |
| 3213 | + * first index into rate scale table. | |
| 3214 | + */ | |
| 3215 | + if (info->flags & IEEE80211_TX_STAT_AMPDU) { | |
| 3216 | + rs_collect_tpc_data(mvm, lq_sta, curr_tbl, tx_resp_rate.index, | |
| 3217 | + info->status.ampdu_len, | |
| 3218 | + info->status.ampdu_ack_len, | |
| 3219 | + reduced_txp); | |
| 3220 | + | |
| 3221 | + /* ampdu_ack_len = 0 marks no BA was received. For TLC, treat | |
| 3222 | + * it as a single frame loss as we don't want the success ratio | |
| 3223 | + * to dip too quickly because a BA wasn't received. | |
| 3224 | + * For TPC, there's no need for this optimisation since we want | |
| 3225 | + * to recover very quickly from a bad power reduction and, | |
| 3226 | + * therefore we'd like the success ratio to get an immediate hit | |
| 3227 | + * when failing to get a BA, so we'd switch back to a lower or | |
| 3228 | + * zero power reduction. When FW transmits agg with a rate | |
| 3229 | + * different from the initial rate, it will not use reduced txp | |
| 3230 | + * and will send BA notification twice (one empty with reduced | |
| 3231 | + * txp equal to the value from LQ and one with reduced txp 0). | |
| 3232 | + * We need to update counters for each txp level accordingly. | |
| 3233 | + */ | |
| 3234 | + if (info->status.ampdu_ack_len == 0) | |
| 3235 | + info->status.ampdu_len = 1; | |
| 3236 | + | |
| 3237 | + rs_collect_tlc_data(mvm, mvmsta, tid, curr_tbl, | |
| 3238 | + tx_resp_rate.index, | |
| 3239 | + info->status.ampdu_len, | |
| 3240 | + info->status.ampdu_ack_len); | |
| 3241 | + | |
| 3242 | + /* Update success/fail counts if not searching for new mode */ | |
| 3243 | + if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { | |
| 3244 | + lq_sta->total_success += info->status.ampdu_ack_len; | |
| 3245 | + lq_sta->total_failed += (info->status.ampdu_len - | |
| 3246 | + info->status.ampdu_ack_len); | |
| 3247 | + } | |
| 3248 | + } else { | |
| 3249 | + /* For legacy, update frame history with for each Tx retry. */ | |
| 3250 | + retries = info->status.rates[0].count - 1; | |
| 3251 | + /* HW doesn't send more than 15 retries */ | |
| 3252 | + retries = min(retries, 15); | |
| 3253 | + | |
| 3254 | + /* The last transmission may have been successful */ | |
| 3255 | + legacy_success = !!(info->flags & IEEE80211_TX_STAT_ACK); | |
| 3256 | + /* Collect data for each rate used during failed TX attempts */ | |
| 3257 | + for (i = 0; i <= retries; ++i) { | |
| 3258 | + lq_hwrate = le32_to_cpu(table->rs_table[i]); | |
| 3259 | + if (rs_rate_from_ucode_rate(lq_hwrate, info->band, | |
| 3260 | + &lq_rate)) { | |
| 3261 | + WARN_ON_ONCE(1); | |
| 3262 | + return; | |
| 3263 | + } | |
| 3264 | + | |
| 3265 | + /* Only collect stats if retried rate is in the same RS | |
| 3266 | + * table as active/search. | |
| 3267 | + */ | |
| 3268 | + if (rs_rate_column_match(&lq_rate, &curr_tbl->rate)) | |
| 3269 | + tmp_tbl = curr_tbl; | |
| 3270 | + else if (rs_rate_column_match(&lq_rate, | |
| 3271 | + &other_tbl->rate)) | |
| 3272 | + tmp_tbl = other_tbl; | |
| 3273 | + else | |
| 3274 | + continue; | |
| 3275 | + | |
| 3276 | + rs_collect_tpc_data(mvm, lq_sta, tmp_tbl, | |
| 3277 | + tx_resp_rate.index, 1, | |
| 3278 | + i < retries ? 0 : legacy_success, | |
| 3279 | + reduced_txp); | |
| 3280 | + rs_collect_tlc_data(mvm, mvmsta, tid, tmp_tbl, | |
| 3281 | + tx_resp_rate.index, 1, | |
| 3282 | + i < retries ? 0 : legacy_success); | |
| 3283 | + } | |
| 3284 | + | |
| 3285 | + /* Update success/fail counts if not searching for new mode */ | |
| 3286 | + if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { | |
| 3287 | + lq_sta->total_success += legacy_success; | |
| 3288 | + lq_sta->total_failed += retries + (1 - legacy_success); | |
| 3289 | + } | |
| 3290 | + } | |
| 3291 | + /* The last TX rate is cached in lq_sta; it's set in if/else above */ | |
| 3292 | + lq_sta->last_rate_n_flags = lq_hwrate; | |
| 3293 | + IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp); | |
| 3294 | +done: | |
| 3295 | + /* See if there's a better rate or modulation mode to try. */ | |
| 3296 | + if (sta->supp_rates[info->band]) | |
| 3297 | + rs_rate_scale_perform(mvm, sta, lq_sta, tid, ndp); | |
| 3298 | +} | |
| 3299 | + | |
| 3300 | +void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |
| 3301 | + int tid, struct ieee80211_tx_info *info, bool ndp) | |
| 3302 | +{ | |
| 3303 | + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
| 3304 | + | |
| 3305 | + /* If it's locked we are in middle of init flow | |
| 3306 | + * just wait for next tx status to update the lq_sta data | |
| 3307 | + */ | |
| 3308 | + if (!spin_trylock(&mvmsta->lq_sta.rs_drv.pers.lock)) | |
| 3309 | + return; | |
| 3310 | + | |
| 3311 | + __iwl_mvm_rs_tx_status(mvm, sta, tid, info, ndp); | |
| 3312 | + spin_unlock(&mvmsta->lq_sta.rs_drv.pers.lock); | |
| 3313 | +} | |
| 3314 | + | |
| 3281 | 3315 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 3282 | 3316 | static void rs_build_rates_table_from_fixed(struct iwl_mvm *mvm, |
| 3283 | 3317 | struct iwl_lq_cmd *lq_cmd, |
| @@ -3569,7 +3603,7 @@ static void rs_set_lq_ss_params(struct iwl_mvm *mvm, · 285 unmodified lines | ||
| 3569 | 3603 | |
| 3570 | 3604 | bfersta_ss_params &= ~LQ_SS_BFER_ALLOWED; |
| 3571 | 3605 | bfersta_lq_cmd->ss_params = cpu_to_le32(bfersta_ss_params); |
| 3572 | − iwl_mvm_send_lq_cmd(mvm, bfersta_lq_cmd, false); | |
| 3606 | + iwl_mvm_send_lq_cmd(mvm, bfersta_lq_cmd); | |
| 3573 | 3607 | |
| 3574 | 3608 | ss_params |= LQ_SS_BFER_ALLOWED; |
| 3575 | 3609 | IWL_DEBUG_RATE(mvm, |
| @@ -3735,7 +3769,7 @@ static void rs_program_fix_rate(struct iwl_mvm *mvm, · 159 unmodified lines | ||
| 3735 | 3769 | |
| 3736 | 3770 | if (lq_sta->pers.dbg_fixed_rate) { |
| 3737 | 3771 | rs_fill_lq_cmd(mvm, NULL, lq_sta, NULL); |
| 3738 | − iwl_mvm_send_lq_cmd(lq_sta->pers.drv, &lq_sta->lq, false); | |
| 3772 | + iwl_mvm_send_lq_cmd(lq_sta->pers.drv, &lq_sta->lq); | |
| 3739 | 3773 | } |
| 3740 | 3774 | } |
| 3741 | 3775 | |
| @@ -4132,10 +4166,15 @@ static const struct rate_control_ops rs_mvm_ops_drv = { · 390 unmodified lines | ||
| 4132 | 4166 | void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 4133 | 4167 | enum nl80211_band band, bool update) |
| 4134 | 4168 | { |
| 4135 | − if (iwl_mvm_has_tlc_offload(mvm)) | |
| 4169 | + if (iwl_mvm_has_tlc_offload(mvm)) { | |
| 4136 | 4170 | rs_fw_rate_init(mvm, sta, band, update); |
| 4137 | − else | |
| 4138 | − rs_drv_rate_init(mvm, sta, band, update); | |
| 4171 | + } else { | |
| 4172 | + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
| 4173 | + | |
| 4174 | + spin_lock(&mvmsta->lq_sta.rs_drv.pers.lock); | |
| 4175 | + rs_drv_rate_init(mvm, sta, band); | |
| 4176 | + spin_unlock(&mvmsta->lq_sta.rs_drv.pers.lock); | |
| 4177 | + } | |
| 4139 | 4178 | } |
| 4140 | 4179 | |
| 4141 | 4180 | int iwl_mvm_rate_control_register(void) |
| @@ -4165,7 +4204,7 @@ static int rs_drv_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, · 23 unmodified lines | ||
| 4165 | 4204 | lq->flags &= ~LQ_FLAG_USE_RTS_MSK; |
| 4166 | 4205 | } |
| 4167 | 4206 | |
| 4168 | − return iwl_mvm_send_lq_cmd(mvm, lq, false); | |
| 4207 | + return iwl_mvm_send_lq_cmd(mvm, lq); | |
| 4169 | 4208 | } |
| 4170 | 4209 | |
| 4171 | 4210 | /** |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. |
| 5 | 5 | * Copyright(c) 2015 Intel Mobile Communications GmbH |
| 6 | 6 | * Copyright(c) 2017 Intel Deutschland GmbH |
| 7 | − * Copyright(c) 2018 Intel Corporation | |
| 7 | + * Copyright(c) 2018 - 2019 Intel Corporation | |
| 8 | 8 | * |
| 9 | 9 | * Contact Information: |
| 10 | 10 | * Intel Linux Wireless <linuxwifi@intel.com> |
| @@ -390,6 +390,7 @@ struct iwl_lq_sta { · 379 unmodified lines | ||
| 390 | 390 | s8 last_rssi; |
| 391 | 391 | struct rs_rate_stats tx_stats[RS_COLUMN_COUNT][IWL_RATE_COUNT]; |
| 392 | 392 | struct iwl_mvm *drv; |
| 393 | + spinlock_t lock; /* for races in reinit/update table */ | |
| 393 | 394 | } pers; |
| 394 | 395 | }; |
| 395 | 396 | |
| @@ -463,20 +463,22 @@ static bool iwl_mvm_is_dup(struct ieee80211_sta *sta, int queue, · 462 unmodified lines | ||
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, |
| 466 | − const u8 *data, u32 count) | |
| 466 | + const u8 *data, u32 count, bool async) | |
| 467 | 467 | { |
| 468 | − struct iwl_rxq_sync_cmd *cmd; | |
| 468 | + u8 buf[sizeof(struct iwl_rxq_sync_cmd) + | |
| 469 | + sizeof(struct iwl_mvm_rss_sync_notif)]; | |
| 470 | + struct iwl_rxq_sync_cmd *cmd = (void *)buf; | |
| 469 | 471 | u32 data_size = sizeof(*cmd) + count; |
| 470 | 472 | int ret; |
| 471 | 473 | |
| 472 | − /* should be DWORD aligned */ | |
| 473 | − if (WARN_ON(count & 3 || count > IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE)) | |
| 474 | + /* | |
| 475 | + * size must be a multiple of DWORD | |
| 476 | + * Ensure we don't overflow buf | |
| 477 | + */ | |
| 478 | + if (WARN_ON(count & 3 || | |
| 479 | + count > sizeof(struct iwl_mvm_rss_sync_notif))) | |
| 474 | 480 | return -EINVAL; |
| 475 | 481 | |
| 476 | − cmd = kzalloc(data_size, GFP_KERNEL); | |
| 477 | − if (!cmd) | |
| 478 | − return -ENOMEM; | |
| 479 | − | |
| 480 | 482 | cmd->rxq_mask = cpu_to_le32(rxq_mask); |
| 481 | 483 | cmd->count = cpu_to_le32(count); |
| 482 | 484 | cmd->flags = 0; |
| @@ -485,9 +487,8 @@ int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, · 2 unmodified lines | ||
| 485 | 487 | ret = iwl_mvm_send_cmd_pdu(mvm, |
| 486 | 488 | WIDE_ID(DATA_PATH_GROUP, |
| 487 | 489 | TRIGGER_RX_QUEUES_NOTIF_CMD), |
| 488 | − 0, data_size, cmd); | |
| 490 | + async ? CMD_ASYNC : 0, data_size, cmd); | |
| 489 | 491 | |
| 490 | − kfree(cmd); | |
| 491 | 492 | return ret; |
| 492 | 493 | } |
| 493 | 494 | |
| @@ -503,14 +504,31 @@ static bool iwl_mvm_is_sn_less(u16 sn1, u16 sn2, u16 buffer_size) · 9 unmodified lines | ||
| 503 | 504 | !ieee80211_sn_less(sn1, sn2 - buffer_size); |
| 504 | 505 | } |
| 505 | 506 | |
| 507 | +static void iwl_mvm_sync_nssn(struct iwl_mvm *mvm, u8 baid, u16 nssn) | |
| 508 | +{ | |
| 509 | + struct iwl_mvm_rss_sync_notif notif = { | |
| 510 | + .metadata.type = IWL_MVM_RXQ_NSSN_SYNC, | |
| 511 | + .metadata.sync = 0, | |
| 512 | + .nssn_sync.baid = baid, | |
| 513 | + .nssn_sync.nssn = nssn, | |
| 514 | + }; | |
| 515 | + | |
| 516 | + iwl_mvm_sync_rx_queues_internal(mvm, (void *)¬if, sizeof(notif)); | |
| 517 | +} | |
| 518 | + | |
| 506 | 519 | #define RX_REORDER_BUF_TIMEOUT_MQ (HZ / 10) |
| 507 | 520 | |
| 521 | +enum iwl_mvm_release_flags { | |
| 522 | + IWL_MVM_RELEASE_SEND_RSS_SYNC = BIT(0), | |
| 523 | + IWL_MVM_RELEASE_FROM_RSS_SYNC = BIT(1), | |
| 524 | +}; | |
| 525 | + | |
| 508 | 526 | static void iwl_mvm_release_frames(struct iwl_mvm *mvm, |
| 509 | 527 | struct ieee80211_sta *sta, |
| 510 | 528 | struct napi_struct *napi, |
| 511 | 529 | struct iwl_mvm_baid_data *baid_data, |
| 512 | 530 | struct iwl_mvm_reorder_buffer *reorder_buf, |
| 513 | − u16 nssn) | |
| 531 | + u16 nssn, u32 flags) | |
| 514 | 532 | { |
| 515 | 533 | struct iwl_mvm_reorder_buf_entry *entries = |
| 516 | 534 | &baid_data->entries[reorder_buf->queue * |
| @@ -519,6 +537,18 @@ static void iwl_mvm_release_frames(struct iwl_mvm *mvm, · 2 unmodified lines | ||
| 519 | 537 | |
| 520 | 538 | lockdep_assert_held(&reorder_buf->lock); |
| 521 | 539 | |
| 540 | + /* | |
| 541 | + * We keep the NSSN not too far behind, if we are sync'ing it and it | |
| 542 | + * is more than 2048 ahead of us, it must be behind us. Discard it. | |
| 543 | + * This can happen if the queue that hit the 0 / 2048 seqno was lagging | |
| 544 | + * behind and this queue already processed packets. The next if | |
| 545 | + * would have caught cases where this queue would have processed less | |
| 546 | + * than 64 packets, but it may have processed more than 64 packets. | |
| 547 | + */ | |
| 548 | + if ((flags & IWL_MVM_RELEASE_FROM_RSS_SYNC) && | |
| 549 | + ieee80211_sn_less(nssn, ssn)) | |
| 550 | + goto set_timer; | |
| 551 | + | |
| 522 | 552 | /* ignore nssn smaller than head sn - this can happen due to timeout */ |
| 523 | 553 | if (iwl_mvm_is_sn_less(nssn, ssn, reorder_buf->buf_size)) |
| 524 | 554 | goto set_timer; |
| @@ -529,6 +559,9 @@ static void iwl_mvm_release_frames(struct iwl_mvm *mvm, · 4 unmodified lines | ||
| 529 | 559 | struct sk_buff *skb; |
| 530 | 560 | |
| 531 | 561 | ssn = ieee80211_sn_inc(ssn); |
| 562 | + if ((flags & IWL_MVM_RELEASE_SEND_RSS_SYNC) && | |
| 563 | + (ssn == 2048 || ssn == 0)) | |
| 564 | + iwl_mvm_sync_nssn(mvm, baid_data->baid, ssn); | |
| 532 | 565 | |
| 533 | 566 | /* |
| 534 | 567 | * Empty the list. Will have more than one frame for A-MSDU. |
| @@ -615,7 +648,8 @@ void iwl_mvm_reorder_timer_expired(struct timer_list *t) · 80 unmodified lines | ||
| 615 | 648 | sta_id, sn); |
| 616 | 649 | iwl_mvm_event_frame_timeout_callback(buf->mvm, mvmsta->vif, |
| 617 | 650 | sta, baid_data->tid); |
| 618 | − iwl_mvm_release_frames(buf->mvm, sta, NULL, baid_data, buf, sn); | |
| 651 | + iwl_mvm_release_frames(buf->mvm, sta, NULL, baid_data, | |
| 652 | + buf, sn, IWL_MVM_RELEASE_SEND_RSS_SYNC); | |
| 619 | 653 | rcu_read_unlock(); |
| 620 | 654 | } else { |
| 621 | 655 | /* |
| @@ -657,7 +691,8 @@ static void iwl_mvm_del_ba(struct iwl_mvm *mvm, int queue, · 35 unmodified lines | ||
| 657 | 691 | spin_lock_bh(&reorder_buf->lock); |
| 658 | 692 | iwl_mvm_release_frames(mvm, sta, NULL, ba_data, reorder_buf, |
| 659 | 693 | ieee80211_sn_add(reorder_buf->head_sn, |
| 660 | − reorder_buf->buf_size)); | |
| 694 | + reorder_buf->buf_size), | |
| 695 | + 0); | |
| 661 | 696 | spin_unlock_bh(&reorder_buf->lock); |
| 662 | 697 | del_timer_sync(&reorder_buf->reorder_timer); |
| 663 | 698 | |
| @@ -665,8 +700,54 @@ out: · 1 unmodified line | ||
| 665 | 700 | rcu_read_unlock(); |
| 666 | 701 | } |
| 667 | 702 | |
| 668 | −void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |
| 669 | − int queue) | |
| 703 | +static void iwl_mvm_release_frames_from_notif(struct iwl_mvm *mvm, | |
| 704 | + struct napi_struct *napi, | |
| 705 | + u8 baid, u16 nssn, int queue, | |
| 706 | + u32 flags) | |
| 707 | +{ | |
| 708 | + struct ieee80211_sta *sta; | |
| 709 | + struct iwl_mvm_reorder_buffer *reorder_buf; | |
| 710 | + struct iwl_mvm_baid_data *ba_data; | |
| 711 | + | |
| 712 | + IWL_DEBUG_HT(mvm, "Frame release notification for BAID %u, NSSN %d\n", | |
| 713 | + baid, nssn); | |
| 714 | + | |
| 715 | + if (WARN_ON_ONCE(baid == IWL_RX_REORDER_DATA_INVALID_BAID || | |
| 716 | + baid >= ARRAY_SIZE(mvm->baid_map))) | |
| 717 | + return; | |
| 718 | + | |
| 719 | + rcu_read_lock(); | |
| 720 | + | |
| 721 | + ba_data = rcu_dereference(mvm->baid_map[baid]); | |
| 722 | + if (WARN_ON_ONCE(!ba_data)) | |
| 723 | + goto out; | |
| 724 | + | |
| 725 | + sta = rcu_dereference(mvm->fw_id_to_mac_id[ba_data->sta_id]); | |
| 726 | + if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) | |
| 727 | + goto out; | |
| 728 | + | |
| 729 | + reorder_buf = &ba_data->reorder_buf[queue]; | |
| 730 | + | |
| 731 | + spin_lock_bh(&reorder_buf->lock); | |
| 732 | + iwl_mvm_release_frames(mvm, sta, napi, ba_data, | |
| 733 | + reorder_buf, nssn, flags); | |
| 734 | + spin_unlock_bh(&reorder_buf->lock); | |
| 735 | + | |
| 736 | +out: | |
| 737 | + rcu_read_unlock(); | |
| 738 | +} | |
| 739 | + | |
| 740 | +static void iwl_mvm_nssn_sync(struct iwl_mvm *mvm, | |
| 741 | + struct napi_struct *napi, int queue, | |
| 742 | + const struct iwl_mvm_nssn_sync_data *data) | |
| 743 | +{ | |
| 744 | + iwl_mvm_release_frames_from_notif(mvm, napi, data->baid, | |
| 745 | + data->nssn, queue, | |
| 746 | + IWL_MVM_RELEASE_FROM_RSS_SYNC); | |
| 747 | +} | |
| 748 | + | |
| 749 | +void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, | |
| 750 | + struct iwl_rx_cmd_buffer *rxb, int queue) | |
| 670 | 751 | { |
| 671 | 752 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
| 672 | 753 | struct iwl_rxq_sync_notification *notif; |
| @@ -687,6 +768,10 @@ void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, · 14 unmodified lines | ||
| 687 | 768 | case IWL_MVM_RXQ_NOTIF_DEL_BA: |
| 688 | 769 | iwl_mvm_del_ba(mvm, queue, (void *)internal_notif->data); |
| 689 | 770 | break; |
| 771 | + case IWL_MVM_RXQ_NSSN_SYNC: | |
| 772 | + iwl_mvm_nssn_sync(mvm, napi, queue, | |
| 773 | + (void *)internal_notif->data); | |
| 774 | + break; | |
| 690 | 775 | default: |
| 691 | 776 | WARN_ONCE(1, "Invalid identifier %d", internal_notif->type); |
| 692 | 777 | } |
| @@ -785,7 +870,8 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, · 92 unmodified lines | ||
| 785 | 870 | } |
| 786 | 871 | |
| 787 | 872 | if (ieee80211_is_back_req(hdr->frame_control)) { |
| 788 | − iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer, nssn); | |
| 873 | + iwl_mvm_release_frames(mvm, sta, napi, baid_data, | |
| 874 | + buffer, nssn, 0); | |
| 789 | 875 | goto drop; |
| 790 | 876 | } |
| 791 | 877 | |
| @@ -794,7 +880,10 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, · 2 unmodified lines | ||
| 794 | 880 | * If the SN is smaller than the NSSN it might need to first go into |
| 795 | 881 | * the reorder buffer, in which case we just release up to it and the |
| 796 | 882 | * rest of the function will take care of storing it and releasing up to |
| 797 | − * the nssn | |
| 883 | + * the nssn. | |
| 884 | + * This should not happen. This queue has been lagging and it should | |
| 885 | + * have been updated by a IWL_MVM_RXQ_NSSN_SYNC notification. Be nice | |
| 886 | + * and update the other queues. | |
| 798 | 887 | */ |
| 799 | 888 | if (!iwl_mvm_is_sn_less(nssn, buffer->head_sn + buffer->buf_size, |
| 800 | 889 | buffer->buf_size) || |
| @@ -802,7 +891,7 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, · 1 unmodified line | ||
| 802 | 891 | u16 min_sn = ieee80211_sn_less(sn, nssn) ? sn : nssn; |
| 803 | 892 | |
| 804 | 893 | iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer, |
| 805 | − min_sn); | |
| 894 | + min_sn, IWL_MVM_RELEASE_SEND_RSS_SYNC); | |
| 806 | 895 | } |
| 807 | 896 | |
| 808 | 897 | /* drop any oudated packets */ |
| @@ -813,8 +902,23 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, · 4 unmodified lines | ||
| 813 | 902 | if (!buffer->num_stored && ieee80211_sn_less(sn, nssn)) { |
| 814 | 903 | if (iwl_mvm_is_sn_less(buffer->head_sn, nssn, |
| 815 | 904 | buffer->buf_size) && |
| 816 | − (!amsdu || last_subframe)) | |
| 905 | + (!amsdu || last_subframe)) { | |
| 906 | + /* | |
| 907 | + * If we crossed the 2048 or 0 SN, notify all the | |
| 908 | + * queues. This is done in order to avoid having a | |
| 909 | + * head_sn that lags behind for too long. When that | |
| 910 | + * happens, we can get to a situation where the head_sn | |
| 911 | + * is within the interval [nssn - buf_size : nssn] | |
| 912 | + * which will make us think that the nssn is a packet | |
| 913 | + * that we already freed because of the reordering | |
| 914 | + * buffer and we will ignore it. So maintain the | |
| 915 | + * head_sn somewhat updated across all the queues: | |
| 916 | + * when it crosses 0 and 2048. | |
| 917 | + */ | |
| 918 | + if (sn == 2048 || sn == 0) | |
| 919 | + iwl_mvm_sync_nssn(mvm, baid, sn); | |
| 817 | 920 | buffer->head_sn = nssn; |
| 921 | + } | |
| 818 | 922 | /* No need to update AMSDU last SN - we are moving the head */ |
| 819 | 923 | spin_unlock_bh(&buffer->lock); |
| 820 | 924 | return false; |
| @@ -829,8 +933,11 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, · 8 unmodified lines | ||
| 829 | 933 | * while technically there is no hole and we can move forward. |
| 830 | 934 | */ |
| 831 | 935 | if (!buffer->num_stored && sn == buffer->head_sn) { |
| 832 | − if (!amsdu || last_subframe) | |
| 936 | + if (!amsdu || last_subframe) { | |
| 937 | + if (sn == 2048 || sn == 0) | |
| 938 | + iwl_mvm_sync_nssn(mvm, baid, sn); | |
| 833 | 939 | buffer->head_sn = ieee80211_sn_inc(buffer->head_sn); |
| 940 | + } | |
| 834 | 941 | /* No need to update AMSDU last SN - we are moving the head */ |
| 835 | 942 | spin_unlock_bh(&buffer->lock); |
| 836 | 943 | return false; |
| @@ -875,7 +982,9 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, · 38 unmodified lines | ||
| 875 | 982 | * release notification with up to date NSSN. |
| 876 | 983 | */ |
| 877 | 984 | if (!amsdu || last_subframe) |
| 878 | − iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer, nssn); | |
| 985 | + iwl_mvm_release_frames(mvm, sta, napi, baid_data, | |
| 986 | + buffer, nssn, | |
| 987 | + IWL_MVM_RELEASE_SEND_RSS_SYNC); | |
| 879 | 988 | |
| 880 | 989 | spin_unlock_bh(&buffer->lock); |
| 881 | 990 | return true; |
| @@ -1840,40 +1949,14 @@ void iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi, · 958 unmodified lines | ||
| 1840 | 1949 | out: |
| 1841 | 1950 | rcu_read_unlock(); |
| 1842 | 1951 | } |
| 1952 | + | |
| 1843 | 1953 | void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, |
| 1844 | 1954 | struct iwl_rx_cmd_buffer *rxb, int queue) |
| 1845 | 1955 | { |
| 1846 | 1956 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
| 1847 | 1957 | struct iwl_frame_release *release = (void *)pkt->data; |
| 1848 | − struct ieee80211_sta *sta; | |
| 1849 | − struct iwl_mvm_reorder_buffer *reorder_buf; | |
| 1850 | − struct iwl_mvm_baid_data *ba_data; | |
| 1851 | − | |
| 1852 | − int baid = release->baid; | |
| 1853 | − | |
| 1854 | − IWL_DEBUG_HT(mvm, "Frame release notification for BAID %u, NSSN %d\n", | |
| 1855 | − release->baid, le16_to_cpu(release->nssn)); | |
| 1856 | 1958 | |
| 1857 | − if (WARN_ON_ONCE(baid == IWL_RX_REORDER_DATA_INVALID_BAID)) | |
| 1858 | − return; | |
| 1859 | − | |
| 1860 | − rcu_read_lock(); | |
| 1861 | − | |
| 1862 | − ba_data = rcu_dereference(mvm->baid_map[baid]); | |
| 1863 | − if (WARN_ON_ONCE(!ba_data)) | |
| 1864 | − goto out; | |
| 1865 | − | |
| 1866 | − sta = rcu_dereference(mvm->fw_id_to_mac_id[ba_data->sta_id]); | |
| 1867 | − if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) | |
| 1868 | − goto out; | |
| 1869 | − | |
| 1870 | − reorder_buf = &ba_data->reorder_buf[queue]; | |
| 1871 | − | |
| 1872 | − spin_lock_bh(&reorder_buf->lock); | |
| 1873 | − iwl_mvm_release_frames(mvm, sta, napi, ba_data, reorder_buf, | |
| 1874 | − le16_to_cpu(release->nssn)); | |
| 1875 | − spin_unlock_bh(&reorder_buf->lock); | |
| 1876 | − | |
| 1877 | −out: | |
| 1878 | − rcu_read_unlock(); | |
| 1959 | + iwl_mvm_release_frames_from_notif(mvm, napi, release->baid, | |
| 1960 | + le16_to_cpu(release->nssn), | |
| 1961 | + queue, 0); | |
| 1879 | 1962 | } |
| @@ -1684,6 +1684,8 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm, · 1683 unmodified lines | ||
| 1684 | 1684 | */ |
| 1685 | 1685 | if (iwl_mvm_has_tlc_offload(mvm)) |
| 1686 | 1686 | iwl_mvm_rs_add_sta(mvm, mvm_sta); |
| 1687 | + else | |
| 1688 | + spin_lock_init(&mvm_sta->lq_sta.rs_drv.pers.lock); | |
| 1687 | 1689 | |
| 1688 | 1690 | iwl_mvm_toggle_tx_ant(mvm, &mvm_sta->tx_ant); |
| 1689 | 1691 | |
| @@ -2421,7 +2423,7 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 731 unmodified lines | ||
| 2421 | 2423 | |
| 2422 | 2424 | static void iwl_mvm_sync_rxq_del_ba(struct iwl_mvm *mvm, u8 baid) |
| 2423 | 2425 | { |
| 2424 | − struct iwl_mvm_delba_notif notif = { | |
| 2426 | + struct iwl_mvm_rss_sync_notif notif = { | |
| 2425 | 2427 | .metadata.type = IWL_MVM_RXQ_NOTIF_DEL_BA, |
| 2426 | 2428 | .metadata.sync = 1, |
| 2427 | 2429 | .delba.baid = baid, |
| @@ -2972,7 +2974,7 @@ out: · 544 unmodified lines | ||
| 2972 | 2974 | IWL_DEBUG_HT(mvm, "Tx aggregation enabled on ra = %pM tid = %d\n", |
| 2973 | 2975 | sta->addr, tid); |
| 2974 | 2976 | |
| 2975 | − return iwl_mvm_send_lq_cmd(mvm, &mvmsta->lq_sta.rs_drv.lq, false); | |
| 2977 | + return iwl_mvm_send_lq_cmd(mvm, &mvmsta->lq_sta.rs_drv.lq); | |
| 2976 | 2978 | } |
| 2977 | 2979 | |
| 2978 | 2980 | static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm, |
| @@ -343,9 +343,17 @@ struct iwl_mvm_delba_data { · 342 unmodified lines | ||
| 343 | 343 | u32 baid; |
| 344 | 344 | } __packed; |
| 345 | 345 | |
| 346 | −struct iwl_mvm_delba_notif { | |
| 346 | +struct iwl_mvm_nssn_sync_data { | |
| 347 | + u32 baid; | |
| 348 | + u32 nssn; | |
| 349 | +} __packed; | |
| 350 | + | |
| 351 | +struct iwl_mvm_rss_sync_notif { | |
| 347 | 352 | struct iwl_mvm_internal_rxq_notif metadata; |
| 348 | − struct iwl_mvm_delba_data delba; | |
| 353 | + union { | |
| 354 | + struct iwl_mvm_delba_data delba; | |
| 355 | + struct iwl_mvm_nssn_sync_data nssn_sync; | |
| 356 | + }; | |
| 349 | 357 | } __packed; |
| 350 | 358 | |
| 351 | 359 | /** |
| @@ -831,6 +831,7 @@ iwl_mvm_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes, · 830 unmodified lines | ||
| 831 | 831 | unsigned int tcp_payload_len; |
| 832 | 832 | unsigned int mss = skb_shinfo(skb)->gso_size; |
| 833 | 833 | bool ipv4 = (skb->protocol == htons(ETH_P_IP)); |
| 834 | + bool qos = ieee80211_is_data_qos(hdr->frame_control); | |
| 834 | 835 | u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0; |
| 835 | 836 | |
| 836 | 837 | skb_shinfo(skb)->gso_size = num_subframes * mss; |
| @@ -864,7 +865,7 @@ iwl_mvm_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes, · 27 unmodified lines | ||
| 864 | 865 | if (tcp_payload_len > mss) { |
| 865 | 866 | skb_shinfo(tmp)->gso_size = mss; |
| 866 | 867 | } else { |
| 867 | − if (ieee80211_is_data_qos(hdr->frame_control)) { | |
| 868 | + if (qos) { | |
| 868 | 869 | u8 *qc; |
| 869 | 870 | |
| 870 | 871 | if (ipv4) |
| @@ -653,12 +653,12 @@ int iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, int sta_id, · 652 unmodified lines | ||
| 653 | 653 | * this case to clear the state indicating that station creation is in |
| 654 | 654 | * progress. |
| 655 | 655 | */ |
| 656 | −int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool sync) | |
| 656 | +int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq) | |
| 657 | 657 | { |
| 658 | 658 | struct iwl_host_cmd cmd = { |
| 659 | 659 | .id = LQ_CMD, |
| 660 | 660 | .len = { sizeof(struct iwl_lq_cmd), }, |
| 661 | − .flags = sync ? 0 : CMD_ASYNC, | |
| 661 | + .flags = CMD_ASYNC, | |
| 662 | 662 | .data = { lq, }, |
| 663 | 663 | }; |
| 664 | 664 | |
| @@ -604,10 +604,13 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 603 unmodified lines | ||
| 604 | 604 | {IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9460_2ac_cfg)}, |
| 605 | 605 | {IWL_PCI_DEVICE(0x2526, 0x4234, iwl9560_2ac_cfg_soc)}, |
| 606 | 606 | {IWL_PCI_DEVICE(0x2526, 0x42A4, iwl9462_2ac_cfg_soc)}, |
| 607 | + {IWL_PCI_DEVICE(0x2526, 0x6010, iwl9260_2ac_160_cfg)}, | |
| 607 | 608 | {IWL_PCI_DEVICE(0x2526, 0x6014, iwl9260_2ac_160_cfg)}, |
| 608 | 609 | {IWL_PCI_DEVICE(0x2526, 0x8014, iwl9260_2ac_160_cfg)}, |
| 609 | 610 | {IWL_PCI_DEVICE(0x2526, 0x8010, iwl9260_2ac_160_cfg)}, |
| 610 | 611 | {IWL_PCI_DEVICE(0x2526, 0xA014, iwl9260_2ac_160_cfg)}, |
| 612 | + {IWL_PCI_DEVICE(0x2526, 0xE010, iwl9260_2ac_160_cfg)}, | |
| 613 | + {IWL_PCI_DEVICE(0x2526, 0xE014, iwl9260_2ac_160_cfg)}, | |
| 611 | 614 | {IWL_PCI_DEVICE(0x271B, 0x0010, iwl9160_2ac_cfg)}, |
| 612 | 615 | {IWL_PCI_DEVICE(0x271B, 0x0014, iwl9160_2ac_cfg)}, |
| 613 | 616 | {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)}, |
| @@ -435,6 +435,8 @@ static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, · 434 unmodified lines | ||
| 435 | 435 | DMA_TO_DEVICE); |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | + meta->tbs = 0; | |
| 439 | + | |
| 438 | 440 | if (trans->cfg->use_tfh) { |
| 439 | 441 | struct iwl_tfh_tfd *tfd_fh = (void *)tfd; |
| 440 | 442 | |
| @@ -3617,10 +3617,12 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb, · 3616 unmodified lines | ||
| 3617 | 3617 | hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, |
| 3618 | 3618 | cb->nlh->nlmsg_seq, &hwsim_genl_family, |
| 3619 | 3619 | NLM_F_MULTI, HWSIM_CMD_GET_RADIO); |
| 3620 | − if (!hdr) | |
| 3620 | + if (hdr) { | |
| 3621 | + genl_dump_check_consistent(cb, hdr); | |
| 3622 | + genlmsg_end(skb, hdr); | |
| 3623 | + } else { | |
| 3621 | 3624 | res = -EMSGSIZE; |
| 3622 | − genl_dump_check_consistent(cb, hdr); | |
| 3623 | − genlmsg_end(skb, hdr); | |
| 3625 | + } | |
| 3624 | 3626 | } |
| 3625 | 3627 | |
| 3626 | 3628 | done: |
| @@ -124,6 +124,7 @@ enum { · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | #define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S) |
| 126 | 126 | |
| 127 | +#define WPA_GTK_OUI_OFFSET 2 | |
| 127 | 128 | #define RSN_GTK_OUI_OFFSET 2 |
| 128 | 129 | |
| 129 | 130 | #define MWIFIEX_OUI_NOT_PRESENT 0 |
| @@ -181,7 +181,8 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) · 180 unmodified lines | ||
| 181 | 181 | u8 ret = MWIFIEX_OUI_NOT_PRESENT; |
| 182 | 182 | |
| 183 | 183 | if (has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC)) { |
| 184 | − iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data; | |
| 184 | + iebody = (struct ie_body *)((u8 *)bss_desc->bcn_wpa_ie->data + | |
| 185 | + WPA_GTK_OUI_OFFSET); | |
| 185 | 186 | oui = &mwifiex_wpa_oui[cipher][0]; |
| 186 | 187 | ret = mwifiex_search_oui_in_ie(iebody, oui); |
| 187 | 188 | if (ret) |
| @@ -244,7 +244,7 @@ void nfcmrvl_chip_reset(struct nfcmrvl_private *priv) · 243 unmodified lines | ||
| 244 | 244 | /* Reset possible fault of previous session */ |
| 245 | 245 | clear_bit(NFCMRVL_PHY_ERROR, &priv->flags); |
| 246 | 246 | |
| 247 | − if (priv->config.reset_n_io) { | |
| 247 | + if (gpio_is_valid(priv->config.reset_n_io)) { | |
| 248 | 248 | nfc_info(priv->dev, "reset the chip\n"); |
| 249 | 249 | gpio_set_value(priv->config.reset_n_io, 0); |
| 250 | 250 | usleep_range(5000, 10000); |
| @@ -255,7 +255,7 @@ void nfcmrvl_chip_reset(struct nfcmrvl_private *priv) · 4 unmodified lines | ||
| 255 | 255 | |
| 256 | 256 | void nfcmrvl_chip_halt(struct nfcmrvl_private *priv) |
| 257 | 257 | { |
| 258 | − if (priv->config.reset_n_io) | |
| 258 | + if (gpio_is_valid(priv->config.reset_n_io)) | |
| 259 | 259 | gpio_set_value(priv->config.reset_n_io, 0); |
| 260 | 260 | } |
| 261 | 261 | |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | static unsigned int hci_muxed; |
| 27 | 27 | static unsigned int flow_control; |
| 28 | 28 | static unsigned int break_control; |
| 29 | −static unsigned int reset_n_io; | |
| 29 | +static int reset_n_io = -EINVAL; | |
| 30 | 30 | |
| 31 | 31 | /* |
| 32 | 32 | ** NFCMRVL NCI OPS |
| @@ -231,5 +231,5 @@ MODULE_PARM_DESC(break_control, "Tell if UART driver must drive break signal."); · 198 unmodified lines | ||
| 231 | 231 | module_param(hci_muxed, uint, 0); |
| 232 | 232 | MODULE_PARM_DESC(hci_muxed, "Tell if transport is muxed in HCI one."); |
| 233 | 233 | |
| 234 | −module_param(reset_n_io, uint, 0); | |
| 234 | +module_param(reset_n_io, int, 0); | |
| 235 | 235 | MODULE_PARM_DESC(reset_n_io, "GPIO that is wired to RESET_N signal."); |
| @@ -305,6 +305,7 @@ static int nfcmrvl_probe(struct usb_interface *intf, · 304 unmodified lines | ||
| 305 | 305 | |
| 306 | 306 | /* No configuration for USB */ |
| 307 | 307 | memset(&config, 0, sizeof(config)); |
| 308 | + config.reset_n_io = -EINVAL; | |
| 308 | 309 | |
| 309 | 310 | nfc_info(&udev->dev, "intf %p id %p\n", intf, id); |
| 310 | 311 | |
| @@ -333,6 +333,8 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev, · 332 unmodified lines | ||
| 333 | 333 | |
| 334 | 334 | transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev, |
| 335 | 335 | skb->len - 2, GFP_KERNEL); |
| 336 | + if (!transaction) | |
| 337 | + return -ENOMEM; | |
| 336 | 338 | |
| 337 | 339 | transaction->aid_len = skb->data[1]; |
| 338 | 340 | memcpy(transaction->aid, &skb->data[2], transaction->aid_len); |
| @@ -317,6 +317,8 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host, · 316 unmodified lines | ||
| 317 | 317 | |
| 318 | 318 | transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev, |
| 319 | 319 | skb->len - 2, GFP_KERNEL); |
| 320 | + if (!transaction) | |
| 321 | + return -ENOMEM; | |
| 320 | 322 | |
| 321 | 323 | transaction->aid_len = skb->data[1]; |
| 322 | 324 | memcpy(transaction->aid, &skb->data[2], |
| @@ -6,11 +6,6 @@ · 5 unmodified lines | ||
| 6 | 6 | #include <linux/msi.h> |
| 7 | 7 | #include <linux/pci.h> |
| 8 | 8 | |
| 9 | −MODULE_LICENSE("Dual BSD/GPL"); | |
| 10 | −MODULE_VERSION("0.1"); | |
| 11 | −MODULE_AUTHOR("Logan Gunthorpe <logang@deltatee.com>"); | |
| 12 | −MODULE_DESCRIPTION("NTB MSI Interrupt Library"); | |
| 13 | − | |
| 14 | 9 | struct ntb_msi { |
| 15 | 10 | u64 base_addr; |
| 16 | 11 | u64 end_addr; |
| @@ -224,10 +224,17 @@ int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem, · 223 unmodified lines | ||
| 224 | 224 | if (!config->base_dev) |
| 225 | 225 | return -EINVAL; |
| 226 | 226 | |
| 227 | − if (nvmem->read_only) | |
| 228 | − nvmem->eeprom = bin_attr_ro_root_nvmem; | |
| 229 | − else | |
| 230 | − nvmem->eeprom = bin_attr_rw_root_nvmem; | |
| 227 | + if (nvmem->read_only) { | |
| 228 | + if (config->root_only) | |
| 229 | + nvmem->eeprom = bin_attr_ro_root_nvmem; | |
| 230 | + else | |
| 231 | + nvmem->eeprom = bin_attr_ro_nvmem; | |
| 232 | + } else { | |
| 233 | + if (config->root_only) | |
| 234 | + nvmem->eeprom = bin_attr_rw_root_nvmem; | |
| 235 | + else | |
| 236 | + nvmem->eeprom = bin_attr_rw_nvmem; | |
| 237 | + } | |
| 231 | 238 | nvmem->eeprom.attr.name = "eeprom"; |
| 232 | 239 | nvmem->eeprom.size = nvmem->size; |
| 233 | 240 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| @@ -1025,10 +1025,15 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state) · 1024 unmodified lines | ||
| 1025 | 1025 | if (state == PCI_D0) { |
| 1026 | 1026 | pci_platform_power_transition(dev, PCI_D0); |
| 1027 | 1027 | /* |
| 1028 | − * Mandatory power management transition delays are | |
| 1029 | − * handled in the PCIe portdrv resume hooks. | |
| 1028 | + * Mandatory power management transition delays, see | |
| 1029 | + * PCI Express Base Specification Revision 2.0 Section | |
| 1030 | + * 6.6.1: Conventional Reset. Do not delay for | |
| 1031 | + * devices powered on/off by corresponding bridge, | |
| 1032 | + * because have already delayed for the bridge. | |
| 1030 | 1033 | */ |
| 1031 | 1034 | if (dev->runtime_d3cold) { |
| 1035 | + if (dev->d3cold_delay && !dev->imm_ready) | |
| 1036 | + msleep(dev->d3cold_delay); | |
| 1032 | 1037 | /* |
| 1033 | 1038 | * When powering on a bridge from D3cold, the |
| 1034 | 1039 | * whole hierarchy may be powered on into |
| @@ -4602,16 +4607,14 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) · 3567 unmodified lines | ||
| 4602 | 4607 | |
| 4603 | 4608 | return pci_dev_wait(dev, "PM D3->D0", PCIE_RESET_READY_POLL_MS); |
| 4604 | 4609 | } |
| 4605 | − | |
| 4606 | 4610 | /** |
| 4607 | − * pcie_wait_for_link_delay - Wait until link is active or inactive | |
| 4611 | + * pcie_wait_for_link - Wait until link is active or inactive | |
| 4608 | 4612 | * @pdev: Bridge device |
| 4609 | 4613 | * @active: waiting for active or inactive? |
| 4610 | − * @delay: Delay to wait after link has become active (in ms) | |
| 4611 | 4614 | * |
| 4612 | 4615 | * Use this to wait till link becomes active or inactive. |
| 4613 | 4616 | */ |
| 4614 | −bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, int delay) | |
| 4617 | +bool pcie_wait_for_link(struct pci_dev *pdev, bool active) | |
| 4615 | 4618 | { |
| 4616 | 4619 | int timeout = 1000; |
| 4617 | 4620 | bool ret; |
| @@ -4648,25 +4651,13 @@ bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, int delay) · 30 unmodified lines | ||
| 4648 | 4651 | timeout -= 10; |
| 4649 | 4652 | } |
| 4650 | 4653 | if (active && ret) |
| 4651 | − msleep(delay); | |
| 4654 | + msleep(100); | |
| 4652 | 4655 | else if (ret != active) |
| 4653 | 4656 | pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n", |
| 4654 | 4657 | active ? "set" : "cleared"); |
| 4655 | 4658 | return ret == active; |
| 4656 | 4659 | } |
| 4657 | 4660 | |
| 4658 | −/** | |
| 4659 | − * pcie_wait_for_link - Wait until link is active or inactive | |
| 4660 | − * @pdev: Bridge device | |
| 4661 | − * @active: waiting for active or inactive? | |
| 4662 | − * | |
| 4663 | − * Use this to wait till link becomes active or inactive. | |
| 4664 | − */ | |
| 4665 | −bool pcie_wait_for_link(struct pci_dev *pdev, bool active) | |
| 4666 | −{ | |
| 4667 | − return pcie_wait_for_link_delay(pdev, active, 100); | |
| 4668 | −} | |
| 4669 | − | |
| 4670 | 4661 | void pci_reset_secondary_bus(struct pci_dev *dev) |
| 4671 | 4662 | { |
| 4672 | 4663 | u16 ctrl; |
| @@ -497,7 +497,6 @@ static inline int pci_dev_specific_disable_acs_redir(struct pci_dev *dev) · 496 unmodified lines | ||
| 497 | 497 | void pcie_do_recovery(struct pci_dev *dev, enum pci_channel_state state, |
| 498 | 498 | u32 service); |
| 499 | 499 | |
| 500 | −bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, int delay); | |
| 501 | 500 | bool pcie_wait_for_link(struct pci_dev *pdev, bool active); |
| 502 | 501 | #ifdef CONFIG_PCIEASPM |
| 503 | 502 | void pcie_aspm_init_link_state(struct pci_dev *pdev); |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/module.h> |
| 10 | 10 | #include <linux/pci.h> |
| 11 | 11 | #include <linux/kernel.h> |
| 12 | −#include <linux/delay.h> | |
| 13 | 12 | #include <linux/errno.h> |
| 14 | 13 | #include <linux/pm.h> |
| 15 | 14 | #include <linux/pm_runtime.h> |
| @@ -379,67 +378,6 @@ static int pm_iter(struct device *dev, void *data) · 363 unmodified lines | ||
| 379 | 378 | return 0; |
| 380 | 379 | } |
| 381 | 380 | |
| 382 | −static int get_downstream_delay(struct pci_bus *bus) | |
| 383 | −{ | |
| 384 | − struct pci_dev *pdev; | |
| 385 | − int min_delay = 100; | |
| 386 | − int max_delay = 0; | |
| 387 | − | |
| 388 | − list_for_each_entry(pdev, &bus->devices, bus_list) { | |
| 389 | − if (!pdev->imm_ready) | |
| 390 | − min_delay = 0; | |
| 391 | − else if (pdev->d3cold_delay < min_delay) | |
| 392 | − min_delay = pdev->d3cold_delay; | |
| 393 | − if (pdev->d3cold_delay > max_delay) | |
| 394 | − max_delay = pdev->d3cold_delay; | |
| 395 | − } | |
| 396 | − | |
| 397 | − return max(min_delay, max_delay); | |
| 398 | −} | |
| 399 | − | |
| 400 | −/* | |
| 401 | − * wait_for_downstream_link - Wait for downstream link to establish | |
| 402 | − * @pdev: PCIe port whose downstream link is waited | |
| 403 | − * | |
| 404 | − * Handle delays according to PCIe 4.0 section 6.6.1 before configuration | |
| 405 | − * access to the downstream component is permitted. | |
| 406 | − * | |
| 407 | − * This blocks PCI core resume of the hierarchy below this port until the | |
| 408 | − * link is trained. Should be called before resuming port services to | |
| 409 | − * prevent pciehp from starting to tear-down the hierarchy too soon. | |
| 410 | − */ | |
| 411 | −static void wait_for_downstream_link(struct pci_dev *pdev) | |
| 412 | −{ | |
| 413 | − int delay; | |
| 414 | − | |
| 415 | − if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT && | |
| 416 | − pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM) | |
| 417 | − return; | |
| 418 | − | |
| 419 | − if (pci_dev_is_disconnected(pdev)) | |
| 420 | − return; | |
| 421 | − | |
| 422 | − if (!pdev->subordinate || list_empty(&pdev->subordinate->devices) || | |
| 423 | − !pdev->bridge_d3) | |
| 424 | − return; | |
| 425 | − | |
| 426 | − delay = get_downstream_delay(pdev->subordinate); | |
| 427 | − if (!delay) | |
| 428 | − return; | |
| 429 | − | |
| 430 | − dev_dbg(&pdev->dev, "waiting downstream link for %d ms\n", delay); | |
| 431 | − | |
| 432 | − /* | |
| 433 | − * If downstream port does not support speeds greater than 5 GT/s | |
| 434 | − * need to wait 100ms. For higher speeds (gen3) we need to wait | |
| 435 | − * first for the data link layer to become active. | |
| 436 | − */ | |
| 437 | − if (pcie_get_speed_cap(pdev) <= PCIE_SPEED_5_0GT) | |
| 438 | − msleep(delay); | |
| 439 | − else | |
| 440 | − pcie_wait_for_link_delay(pdev, true, delay); | |
| 441 | −} | |
| 442 | − | |
| 443 | 381 | /** |
| 444 | 382 | * pcie_port_device_suspend - suspend port services associated with a PCIe port |
| 445 | 383 | * @dev: PCI Express port to handle |
| @@ -453,8 +391,6 @@ int pcie_port_device_suspend(struct device *dev) · 7 unmodified lines | ||
| 453 | 391 | int pcie_port_device_resume_noirq(struct device *dev) |
| 454 | 392 | { |
| 455 | 393 | size_t off = offsetof(struct pcie_port_service_driver, resume_noirq); |
| 456 | − | |
| 457 | − wait_for_downstream_link(to_pci_dev(dev)); | |
| 458 | 394 | return device_for_each_child(dev, &off, pm_iter); |
| 459 | 395 | } |
| 460 | 396 | |
| @@ -485,8 +421,6 @@ int pcie_port_device_runtime_suspend(struct device *dev) · 24 unmodified lines | ||
| 485 | 421 | int pcie_port_device_runtime_resume(struct device *dev) |
| 486 | 422 | { |
| 487 | 423 | size_t off = offsetof(struct pcie_port_service_driver, runtime_resume); |
| 488 | − | |
| 489 | − wait_for_downstream_link(to_pci_dev(dev)); | |
| 490 | 424 | return device_for_each_child(dev, &off, pm_iter); |
| 491 | 425 | } |
| 492 | 426 | #endif /* PM */ |
| @@ -255,8 +255,10 @@ static int db1x_pcmcia_configure(struct pcmcia_socket *skt, · 254 unmodified lines | ||
| 255 | 255 | switch (state->Vcc) { |
| 256 | 256 | case 50: |
| 257 | 257 | ++v; |
| 258 | + /* fall through */ | |
| 258 | 259 | case 33: |
| 259 | 260 | ++v; |
| 261 | + /* fall through */ | |
| 260 | 262 | case 0: |
| 261 | 263 | break; |
| 262 | 264 | default: |
| @@ -267,9 +269,11 @@ static int db1x_pcmcia_configure(struct pcmcia_socket *skt, · 4 unmodified lines | ||
| 267 | 269 | switch (state->Vpp) { |
| 268 | 270 | case 12: |
| 269 | 271 | ++p; |
| 272 | + /* fall through */ | |
| 270 | 273 | case 33: |
| 271 | 274 | case 50: |
| 272 | 275 | ++p; |
| 276 | + /* fall through */ | |
| 273 | 277 | case 0: |
| 274 | 278 | break; |
| 275 | 279 | default: |
| @@ -723,8 +723,8 @@ static int cpu_pm_pmu_notify(struct notifier_block *b, unsigned long cmd, · 722 unmodified lines | ||
| 723 | 723 | cpu_pm_pmu_setup(armpmu, cmd); |
| 724 | 724 | break; |
| 725 | 725 | case CPU_PM_EXIT: |
| 726 | − cpu_pm_pmu_setup(armpmu, cmd); | |
| 727 | 726 | case CPU_PM_ENTER_FAILED: |
| 727 | + cpu_pm_pmu_setup(armpmu, cmd); | |
| 728 | 728 | armpmu->start(armpmu); |
| 729 | 729 | break; |
| 730 | 730 | default: |
| @@ -2412,7 +2412,7 @@ static const struct aspeed_pin_config aspeed_g4_configs[] = { · 2411 unmodified lines | ||
| 2412 | 2412 | { PIN_CONFIG_INPUT_DEBOUNCE, { C14, B14 }, SCUA8, 27 }, |
| 2413 | 2413 | }; |
| 2414 | 2414 | |
| 2415 | −static int aspeed_g4_sig_expr_set(const struct aspeed_pinmux_data *ctx, | |
| 2415 | +static int aspeed_g4_sig_expr_set(struct aspeed_pinmux_data *ctx, | |
| 2416 | 2416 | const struct aspeed_sig_expr *expr, |
| 2417 | 2417 | bool enable) |
| 2418 | 2418 | { |
| @@ -2507,6 +2507,61 @@ static struct aspeed_pin_config aspeed_g5_configs[] = { · 2506 unmodified lines | ||
| 2507 | 2507 | { PIN_CONFIG_INPUT_DEBOUNCE, { A20, B19 }, SCUA8, 27 }, |
| 2508 | 2508 | }; |
| 2509 | 2509 | |
| 2510 | +static struct regmap *aspeed_g5_acquire_regmap(struct aspeed_pinmux_data *ctx, | |
| 2511 | + int ip) | |
| 2512 | +{ | |
| 2513 | + if (ip == ASPEED_IP_SCU) { | |
| 2514 | + WARN(!ctx->maps[ip], "Missing SCU syscon!"); | |
| 2515 | + return ctx->maps[ip]; | |
| 2516 | + } | |
| 2517 | + | |
| 2518 | + if (ip >= ASPEED_NR_PINMUX_IPS) | |
| 2519 | + return ERR_PTR(-EINVAL); | |
| 2520 | + | |
| 2521 | + if (likely(ctx->maps[ip])) | |
| 2522 | + return ctx->maps[ip]; | |
| 2523 | + | |
| 2524 | + if (ip == ASPEED_IP_GFX) { | |
| 2525 | + struct device_node *node; | |
| 2526 | + struct regmap *map; | |
| 2527 | + | |
| 2528 | + node = of_parse_phandle(ctx->dev->of_node, | |
| 2529 | + "aspeed,external-nodes", 0); | |
| 2530 | + if (node) { | |
| 2531 | + map = syscon_node_to_regmap(node); | |
| 2532 | + of_node_put(node); | |
| 2533 | + if (IS_ERR(map)) | |
| 2534 | + return map; | |
| 2535 | + } else | |
| 2536 | + return ERR_PTR(-ENODEV); | |
| 2537 | + | |
| 2538 | + ctx->maps[ASPEED_IP_GFX] = map; | |
| 2539 | + dev_dbg(ctx->dev, "Acquired GFX regmap"); | |
| 2540 | + return map; | |
| 2541 | + } | |
| 2542 | + | |
| 2543 | + if (ip == ASPEED_IP_LPC) { | |
| 2544 | + struct device_node *node; | |
| 2545 | + struct regmap *map; | |
| 2546 | + | |
| 2547 | + node = of_parse_phandle(ctx->dev->of_node, | |
| 2548 | + "aspeed,external-nodes", 1); | |
| 2549 | + if (node) { | |
| 2550 | + map = syscon_node_to_regmap(node->parent); | |
| 2551 | + of_node_put(node); | |
| 2552 | + if (IS_ERR(map)) | |
| 2553 | + return map; | |
| 2554 | + } else | |
| 2555 | + map = ERR_PTR(-ENODEV); | |
| 2556 | + | |
| 2557 | + ctx->maps[ASPEED_IP_LPC] = map; | |
| 2558 | + dev_dbg(ctx->dev, "Acquired LPC regmap"); | |
| 2559 | + return map; | |
| 2560 | + } | |
| 2561 | + | |
| 2562 | + return ERR_PTR(-EINVAL); | |
| 2563 | +} | |
| 2564 | + | |
| 2510 | 2565 | /** |
| 2511 | 2566 | * Configure a pin's signal by applying an expression's descriptor state for |
| 2512 | 2567 | * all descriptors in the expression. |
| @@ -2520,7 +2575,7 @@ static struct aspeed_pin_config aspeed_g5_configs[] = { · 7 unmodified lines | ||
| 2520 | 2575 | * Return: 0 if the expression is configured as requested and a negative error |
| 2521 | 2576 | * code otherwise |
| 2522 | 2577 | */ |
| 2523 | −static int aspeed_g5_sig_expr_set(const struct aspeed_pinmux_data *ctx, | |
| 2578 | +static int aspeed_g5_sig_expr_set(struct aspeed_pinmux_data *ctx, | |
| 2524 | 2579 | const struct aspeed_sig_expr *expr, |
| 2525 | 2580 | bool enable) |
| 2526 | 2581 | { |
| @@ -2531,9 +2586,15 @@ static int aspeed_g5_sig_expr_set(const struct aspeed_pinmux_data *ctx, · 4 unmodified lines | ||
| 2531 | 2586 | const struct aspeed_sig_desc *desc = &expr->descs[i]; |
| 2532 | 2587 | u32 pattern = enable ? desc->enable : desc->disable; |
| 2533 | 2588 | u32 val = (pattern << __ffs(desc->mask)); |
| 2589 | + struct regmap *map; | |
| 2534 | 2590 | |
| 2535 | − if (!ctx->maps[desc->ip]) | |
| 2536 | − return -ENODEV; | |
| 2591 | + map = aspeed_g5_acquire_regmap(ctx, desc->ip); | |
| 2592 | + if (IS_ERR(map)) { | |
| 2593 | + dev_err(ctx->dev, | |
| 2594 | + "Failed to acquire regmap for IP block %d\n", | |
| 2595 | + desc->ip); | |
| 2596 | + return PTR_ERR(map); | |
| 2597 | + } | |
| 2537 | 2598 | |
| 2538 | 2599 | /* |
| 2539 | 2600 | * Strap registers are configured in hardware or by early-boot |
| @@ -2641,34 +2702,11 @@ static struct pinctrl_desc aspeed_g5_pinctrl_desc = { · 101 unmodified lines | ||
| 2641 | 2702 | static int aspeed_g5_pinctrl_probe(struct platform_device *pdev) |
| 2642 | 2703 | { |
| 2643 | 2704 | int i; |
| 2644 | − struct regmap *map; | |
| 2645 | − struct device_node *node; | |
| 2646 | 2705 | |
| 2647 | 2706 | for (i = 0; i < ARRAY_SIZE(aspeed_g5_pins); i++) |
| 2648 | 2707 | aspeed_g5_pins[i].number = i; |
| 2649 | 2708 | |
| 2650 | − node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 0); | |
| 2651 | − map = syscon_node_to_regmap(node); | |
| 2652 | − of_node_put(node); | |
| 2653 | − if (IS_ERR(map)) { | |
| 2654 | − dev_warn(&pdev->dev, "No GFX phandle found, some mux configurations may fail\n"); | |
| 2655 | − map = NULL; | |
| 2656 | − } | |
| 2657 | − aspeed_g5_pinctrl_data.pinmux.maps[ASPEED_IP_GFX] = map; | |
| 2658 | − | |
| 2659 | − node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 1); | |
| 2660 | − if (node) { | |
| 2661 | − map = syscon_node_to_regmap(node->parent); | |
| 2662 | − if (IS_ERR(map)) { | |
| 2663 | − dev_warn(&pdev->dev, "LHC parent is not a syscon, some mux configurations may fail\n"); | |
| 2664 | − map = NULL; | |
| 2665 | − } | |
| 2666 | − } else { | |
| 2667 | − dev_warn(&pdev->dev, "No LHC phandle found, some mux configurations may fail\n"); | |
| 2668 | − map = NULL; | |
| 2669 | − } | |
| 2670 | − of_node_put(node); | |
| 2671 | − aspeed_g5_pinctrl_data.pinmux.maps[ASPEED_IP_LPC] = map; | |
| 2709 | + aspeed_g5_pinctrl_data.pinmux.dev = &pdev->dev; | |
| 2672 | 2710 | |
| 2673 | 2711 | return aspeed_pinctrl_probe(pdev, &aspeed_g5_pinctrl_desc, |
| 2674 | 2712 | &aspeed_g5_pinctrl_data); |
| @@ -71,7 +71,7 @@ int aspeed_pinmux_get_fn_groups(struct pinctrl_dev *pctldev, · 70 unmodified lines | ||
| 71 | 71 | return 0; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | −static int aspeed_sig_expr_enable(const struct aspeed_pinmux_data *ctx, | |
| 74 | +static int aspeed_sig_expr_enable(struct aspeed_pinmux_data *ctx, | |
| 75 | 75 | const struct aspeed_sig_expr *expr) |
| 76 | 76 | { |
| 77 | 77 | int ret; |
| @@ -86,7 +86,7 @@ static int aspeed_sig_expr_enable(const struct aspeed_pinmux_data *ctx, · 8 unmodified lines | ||
| 86 | 86 | return 0; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | −static int aspeed_sig_expr_disable(const struct aspeed_pinmux_data *ctx, | |
| 89 | +static int aspeed_sig_expr_disable(struct aspeed_pinmux_data *ctx, | |
| 90 | 90 | const struct aspeed_sig_expr *expr) |
| 91 | 91 | { |
| 92 | 92 | int ret; |
| @@ -109,7 +109,7 @@ static int aspeed_sig_expr_disable(const struct aspeed_pinmux_data *ctx, · 16 unmodified lines | ||
| 109 | 109 | * |
| 110 | 110 | * Return: 0 if all expressions are disabled, otherwise a negative error code |
| 111 | 111 | */ |
| 112 | −static int aspeed_disable_sig(const struct aspeed_pinmux_data *ctx, | |
| 112 | +static int aspeed_disable_sig(struct aspeed_pinmux_data *ctx, | |
| 113 | 113 | const struct aspeed_sig_expr **exprs) |
| 114 | 114 | { |
| 115 | 115 | int ret = 0; |
| @@ -217,8 +217,7 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, · 101 unmodified lines | ||
| 217 | 217 | { |
| 218 | 218 | int i; |
| 219 | 219 | int ret; |
| 220 | − const struct aspeed_pinctrl_data *pdata = | |
| 221 | − pinctrl_dev_get_drvdata(pctldev); | |
| 220 | + struct aspeed_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | |
| 222 | 221 | const struct aspeed_pin_group *pgroup = &pdata->pinmux.groups[group]; |
| 223 | 222 | const struct aspeed_pin_function *pfunc = |
| 224 | 223 | &pdata->pinmux.functions[function]; |
| @@ -306,8 +305,7 @@ int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev, · 81 unmodified lines | ||
| 306 | 305 | unsigned int offset) |
| 307 | 306 | { |
| 308 | 307 | int ret; |
| 309 | − const struct aspeed_pinctrl_data *pdata = | |
| 310 | − pinctrl_dev_get_drvdata(pctldev); | |
| 308 | + struct aspeed_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | |
| 311 | 309 | const struct aspeed_pin_desc *pdesc = pdata->pins[offset].drv_data; |
| 312 | 310 | const struct aspeed_sig_expr ***prios, **funcs, *expr; |
| 313 | 311 | |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | #include "pinmux-aspeed.h" |
| 7 | 7 | |
| 8 | −const char *const aspeed_pinmux_ips[] = { | |
| 8 | +static const char *const aspeed_pinmux_ips[] = { | |
| 9 | 9 | [ASPEED_IP_SCU] = "SCU", |
| 10 | 10 | [ASPEED_IP_GFX] = "GFX", |
| 11 | 11 | [ASPEED_IP_LPC] = "LPC", |
| @@ -702,11 +702,12 @@ struct aspeed_pin_function { · 701 unmodified lines | ||
| 702 | 702 | struct aspeed_pinmux_data; |
| 703 | 703 | |
| 704 | 704 | struct aspeed_pinmux_ops { |
| 705 | − int (*set)(const struct aspeed_pinmux_data *ctx, | |
| 705 | + int (*set)(struct aspeed_pinmux_data *ctx, | |
| 706 | 706 | const struct aspeed_sig_expr *expr, bool enabled); |
| 707 | 707 | }; |
| 708 | 708 | |
| 709 | 709 | struct aspeed_pinmux_data { |
| 710 | + struct device *dev; | |
| 710 | 711 | struct regmap *maps[ASPEED_NR_PINMUX_IPS]; |
| 711 | 712 | |
| 712 | 713 | const struct aspeed_pinmux_ops *ops; |
| @@ -725,7 +726,7 @@ int aspeed_sig_expr_eval(const struct aspeed_pinmux_data *ctx, · 12 unmodified lines | ||
| 725 | 726 | const struct aspeed_sig_expr *expr, |
| 726 | 727 | bool enabled); |
| 727 | 728 | |
| 728 | −static inline int aspeed_sig_expr_set(const struct aspeed_pinmux_data *ctx, | |
| 729 | +static inline int aspeed_sig_expr_set(struct aspeed_pinmux_data *ctx, | |
| 729 | 730 | const struct aspeed_sig_expr *expr, |
| 730 | 731 | bool enabled) |
| 731 | 732 | { |
| @@ -736,6 +736,12 @@ static const struct of_device_id olpc_xo175_ec_of_match[] = { · 735 unmodified lines | ||
| 736 | 736 | }; |
| 737 | 737 | MODULE_DEVICE_TABLE(of, olpc_xo175_ec_of_match); |
| 738 | 738 | |
| 739 | +static const struct spi_device_id olpc_xo175_ec_id_table[] = { | |
| 740 | + { "xo1.75-ec", 0 }, | |
| 741 | + {} | |
| 742 | +}; | |
| 743 | +MODULE_DEVICE_TABLE(spi, olpc_xo175_ec_id_table); | |
| 744 | + | |
| 739 | 745 | static struct spi_driver olpc_xo175_ec_spi_driver = { |
| 740 | 746 | .driver = { |
| 741 | 747 | .name = "olpc-xo175-ec", |
| @@ -812,6 +812,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = { · 811 unmodified lines | ||
| 812 | 812 | INTEL_CPU_FAM6(KABYLAKE_DESKTOP, spt_reg_map), |
| 813 | 813 | INTEL_CPU_FAM6(CANNONLAKE_MOBILE, cnp_reg_map), |
| 814 | 814 | INTEL_CPU_FAM6(ICELAKE_MOBILE, icl_reg_map), |
| 815 | + INTEL_CPU_FAM6(ICELAKE_NNPI, icl_reg_map), | |
| 815 | 816 | {} |
| 816 | 817 | }; |
| 817 | 818 | |
| @@ -93,7 +93,7 @@ static struct gpiod_lookup_table gpios_led_table = { · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | static struct gpio_keys_button apu2_keys_buttons[] = { |
| 95 | 95 | { |
| 96 | − .code = KEY_SETUP, | |
| 96 | + .code = KEY_RESTART, | |
| 97 | 97 | .active_low = 1, |
| 98 | 98 | .desc = "front button", |
| 99 | 99 | .type = EV_KEY, |
| @@ -255,6 +255,4 @@ MODULE_DESCRIPTION("PC Engines APUv2/APUv3 board GPIO/LED/keys driver"); · 155 unmodified lines | ||
| 255 | 255 | MODULE_LICENSE("GPL"); |
| 256 | 256 | MODULE_DEVICE_TABLE(dmi, apu_gpio_dmi_table); |
| 257 | 257 | MODULE_ALIAS("platform:pcengines-apuv2"); |
| 258 | −MODULE_SOFTDEP("pre: platform:" AMD_FCH_GPIO_DRIVER_NAME); | |
| 259 | −MODULE_SOFTDEP("pre: platform:leds-gpio"); | |
| 260 | −MODULE_SOFTDEP("pre: platform:gpio_keys_polled"); | |
| 258 | +MODULE_SOFTDEP("pre: platform:" AMD_FCH_GPIO_DRIVER_NAME " platform:leds-gpio platform:gpio_keys_polled"); | |
| @@ -882,8 +882,11 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) · 881 unmodified lines | ||
| 882 | 882 | return of_pwm_get(dev, dev->of_node, con_id); |
| 883 | 883 | |
| 884 | 884 | /* then lookup via ACPI */ |
| 885 | − if (dev && is_acpi_node(dev->fwnode)) | |
| 886 | − return acpi_pwm_get(dev->fwnode); | |
| 885 | + if (dev && is_acpi_node(dev->fwnode)) { | |
| 886 | + pwm = acpi_pwm_get(dev->fwnode); | |
| 887 | + if (!IS_ERR(pwm) || PTR_ERR(pwm) != -ENOENT) | |
| 888 | + return pwm; | |
| 889 | + } | |
| 887 | 890 | |
| 888 | 891 | /* |
| 889 | 892 | * We look up the provider in the static table typically provided by |
| @@ -174,14 +174,14 @@ · 173 unmodified lines | ||
| 174 | 174 | #define AXP803_DCDC5_1140mV_STEPS 35 |
| 175 | 175 | #define AXP803_DCDC5_1140mV_END \ |
| 176 | 176 | (AXP803_DCDC5_1140mV_START + AXP803_DCDC5_1140mV_STEPS) |
| 177 | −#define AXP803_DCDC5_NUM_VOLTAGES 68 | |
| 177 | +#define AXP803_DCDC5_NUM_VOLTAGES 69 | |
| 178 | 178 | |
| 179 | 179 | #define AXP803_DCDC6_600mV_START 0x00 |
| 180 | 180 | #define AXP803_DCDC6_600mV_STEPS 50 |
| 181 | 181 | #define AXP803_DCDC6_600mV_END \ |
| 182 | 182 | (AXP803_DCDC6_600mV_START + AXP803_DCDC6_600mV_STEPS) |
| 183 | 183 | #define AXP803_DCDC6_1120mV_START 0x33 |
| 184 | −#define AXP803_DCDC6_1120mV_STEPS 14 | |
| 184 | +#define AXP803_DCDC6_1120mV_STEPS 20 | |
| 185 | 185 | #define AXP803_DCDC6_1120mV_END \ |
| 186 | 186 | (AXP803_DCDC6_1120mV_START + AXP803_DCDC6_1120mV_STEPS) |
| 187 | 187 | #define AXP803_DCDC6_NUM_VOLTAGES 72 |
| @@ -240,7 +240,7 @@ · 52 unmodified lines | ||
| 240 | 240 | #define AXP806_DCDCA_600mV_END \ |
| 241 | 241 | (AXP806_DCDCA_600mV_START + AXP806_DCDCA_600mV_STEPS) |
| 242 | 242 | #define AXP806_DCDCA_1120mV_START 0x33 |
| 243 | −#define AXP806_DCDCA_1120mV_STEPS 14 | |
| 243 | +#define AXP806_DCDCA_1120mV_STEPS 20 | |
| 244 | 244 | #define AXP806_DCDCA_1120mV_END \ |
| 245 | 245 | (AXP806_DCDCA_1120mV_START + AXP806_DCDCA_1120mV_STEPS) |
| 246 | 246 | #define AXP806_DCDCA_NUM_VOLTAGES 72 |
| @@ -774,8 +774,8 @@ static const struct regulator_linear_range axp806_dcdcd_ranges[] = { · 527 unmodified lines | ||
| 774 | 774 | AXP806_DCDCD_600mV_END, |
| 775 | 775 | 20000), |
| 776 | 776 | REGULATOR_LINEAR_RANGE(1600000, |
| 777 | − AXP806_DCDCD_600mV_START, | |
| 778 | − AXP806_DCDCD_600mV_END, | |
| 777 | + AXP806_DCDCD_1600mV_START, | |
| 778 | + AXP806_DCDCD_1600mV_END, | |
| 779 | 779 | 100000), |
| 780 | 780 | }; |
| 781 | 781 | |
| @@ -163,7 +163,7 @@ static int lp87565_regulator_probe(struct platform_device *pdev) · 162 unmodified lines | ||
| 163 | 163 | struct lp87565 *lp87565 = dev_get_drvdata(pdev->dev.parent); |
| 164 | 164 | struct regulator_config config = { }; |
| 165 | 165 | struct regulator_dev *rdev; |
| 166 | − int i, min_idx = LP87565_BUCK_0, max_idx = LP87565_BUCK_3; | |
| 166 | + int i, min_idx, max_idx; | |
| 167 | 167 | |
| 168 | 168 | platform_set_drvdata(pdev, lp87565); |
| 169 | 169 | |
| @@ -182,9 +182,9 @@ static int lp87565_regulator_probe(struct platform_device *pdev) · 12 unmodified lines | ||
| 182 | 182 | max_idx = LP87565_BUCK_3210; |
| 183 | 183 | break; |
| 184 | 184 | default: |
| 185 | − dev_err(lp87565->dev, "Invalid lp config %d\n", | |
| 186 | − lp87565->dev_type); | |
| 187 | − return -EINVAL; | |
| 185 | + min_idx = LP87565_BUCK_0; | |
| 186 | + max_idx = LP87565_BUCK_3; | |
| 187 | + break; | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | for (i = min_idx; i <= max_idx; i++) { |
| @@ -416,8 +416,10 @@ device_node *regulator_of_get_init_node(struct device *dev, · 415 unmodified lines | ||
| 416 | 416 | if (!name) |
| 417 | 417 | name = child->name; |
| 418 | 418 | |
| 419 | − if (!strcmp(desc->of_match, name)) | |
| 419 | + if (!strcmp(desc->of_match, name)) { | |
| 420 | + of_node_put(search); | |
| 420 | 421 | return of_node_get(child); |
| 422 | + } | |
| 421 | 423 | } |
| 422 | 424 | |
| 423 | 425 | of_node_put(search); |
| @@ -383,6 +383,20 @@ suborder_not_supported(struct dasd_ccw_req *cqr) · 382 unmodified lines | ||
| 383 | 383 | char msg_format; |
| 384 | 384 | char msg_no; |
| 385 | 385 | |
| 386 | + /* | |
| 387 | + * intrc values ENODEV, ENOLINK and EPERM | |
| 388 | + * will be optained from sleep_on to indicate that no | |
| 389 | + * IO operation can be started | |
| 390 | + */ | |
| 391 | + if (cqr->intrc == -ENODEV) | |
| 392 | + return 1; | |
| 393 | + | |
| 394 | + if (cqr->intrc == -ENOLINK) | |
| 395 | + return 1; | |
| 396 | + | |
| 397 | + if (cqr->intrc == -EPERM) | |
| 398 | + return 1; | |
| 399 | + | |
| 386 | 400 | sense = dasd_get_sense(&cqr->irb); |
| 387 | 401 | if (!sense) |
| 388 | 402 | return 0; |
| @@ -447,12 +461,8 @@ static int read_unit_address_configuration(struct dasd_device *device, · 58 unmodified lines | ||
| 447 | 461 | lcu->flags &= ~NEED_UAC_UPDATE; |
| 448 | 462 | spin_unlock_irqrestore(&lcu->lock, flags); |
| 449 | 463 | |
| 450 | − do { | |
| 451 | − rc = dasd_sleep_on(cqr); | |
| 452 | − if (rc && suborder_not_supported(cqr)) | |
| 453 | − return -EOPNOTSUPP; | |
| 454 | − } while (rc && (cqr->retries > 0)); | |
| 455 | − if (rc) { | |
| 464 | + rc = dasd_sleep_on(cqr); | |
| 465 | + if (rc && !suborder_not_supported(cqr)) { | |
| 456 | 466 | spin_lock_irqsave(&lcu->lock, flags); |
| 457 | 467 | lcu->flags |= NEED_UAC_UPDATE; |
| 458 | 468 | spin_unlock_irqrestore(&lcu->lock, flags); |
| @@ -398,6 +398,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm, · 397 unmodified lines | ||
| 398 | 398 | } |
| 399 | 399 | if (dstat == 0x08) |
| 400 | 400 | break; |
| 401 | + /* else, fall through */ | |
| 401 | 402 | case 0x04: |
| 402 | 403 | /* Device end interrupt. */ |
| 403 | 404 | if ((raw = req->info) == NULL) |
| @@ -677,6 +677,7 @@ tape_generic_remove(struct ccw_device *cdev) · 676 unmodified lines | ||
| 677 | 677 | switch (device->tape_state) { |
| 678 | 678 | case TS_INIT: |
| 679 | 679 | tape_state_set(device, TS_NOT_OPER); |
| 680 | + /* fallthrough */ | |
| 680 | 681 | case TS_NOT_OPER: |
| 681 | 682 | /* |
| 682 | 683 | * Nothing to do. |
| @@ -949,6 +950,7 @@ __tape_start_request(struct tape_device *device, struct tape_request *request) · 266 unmodified lines | ||
| 949 | 950 | break; |
| 950 | 951 | if (device->tape_state == TS_UNUSED) |
| 951 | 952 | break; |
| 953 | + /* fallthrough */ | |
| 952 | 954 | default: |
| 953 | 955 | if (device->tape_state == TS_BLKUSE) |
| 954 | 956 | break; |
| @@ -1116,6 +1118,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb) · 161 unmodified lines | ||
| 1116 | 1118 | case -ETIMEDOUT: |
| 1117 | 1119 | DBF_LH(1, "(%08x): Request timed out\n", |
| 1118 | 1120 | device->cdev_id); |
| 1121 | + /* fallthrough */ | |
| 1119 | 1122 | case -EIO: |
| 1120 | 1123 | __tape_end_request(device, request, -EIO); |
| 1121 | 1124 | break; |
| @@ -70,7 +70,7 @@ static void vfio_ccw_async_region_release(struct vfio_ccw_private *private, · 69 unmodified lines | ||
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | −const struct vfio_ccw_regops vfio_ccw_async_region_ops = { | |
| 73 | +static const struct vfio_ccw_regops vfio_ccw_async_region_ops = { | |
| 74 | 74 | .read = vfio_ccw_async_region_read, |
| 75 | 75 | .write = vfio_ccw_async_region_write, |
| 76 | 76 | .release = vfio_ccw_async_region_release, |
| @@ -152,6 +152,7 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq) · 151 unmodified lines | ||
| 152 | 152 | ap_msg->receive(aq, ap_msg, aq->reply); |
| 153 | 153 | break; |
| 154 | 154 | } |
| 155 | + /* fall through */ | |
| 155 | 156 | case AP_RESPONSE_NO_PENDING_REPLY: |
| 156 | 157 | if (!status.queue_empty || aq->queue_count <= 0) |
| 157 | 158 | break; |
| @@ -801,10 +801,7 @@ static int convert_response_ica(struct zcrypt_queue *zq, · 800 unmodified lines | ||
| 801 | 801 | if (msg->cprbx.cprb_ver_id == 0x02) |
| 802 | 802 | return convert_type86_ica(zq, reply, |
| 803 | 803 | outputdata, outputdatalength); |
| 804 | − /* | |
| 805 | − * Fall through, no break, incorrect cprb version is an unknown | |
| 806 | − * response | |
| 807 | − */ | |
| 804 | + /* fall through - wrong cprb version is an unknown response */ | |
| 808 | 805 | default: /* Unknown response type, this should NEVER EVER happen */ |
| 809 | 806 | zq->online = 0; |
| 810 | 807 | pr_err("Cryptographic device %02x.%04x failed and was set offline\n", |
| @@ -837,10 +834,7 @@ static int convert_response_xcrb(struct zcrypt_queue *zq, · 26 unmodified lines | ||
| 837 | 834 | } |
| 838 | 835 | if (msg->cprbx.cprb_ver_id == 0x02) |
| 839 | 836 | return convert_type86_xcrb(zq, reply, xcRB); |
| 840 | − /* | |
| 841 | − * Fall through, no break, incorrect cprb version is an unknown | |
| 842 | − * response | |
| 843 | − */ | |
| 837 | + /* fall through - wrong cprb version is an unknown response */ | |
| 844 | 838 | default: /* Unknown response type, this should NEVER EVER happen */ |
| 845 | 839 | xcRB->status = 0x0008044DL; /* HDD_InvalidParm */ |
| 846 | 840 | zq->online = 0; |
| @@ -870,7 +864,7 @@ static int convert_response_ep11_xcrb(struct zcrypt_queue *zq, · 23 unmodified lines | ||
| 870 | 864 | return convert_error(zq, reply); |
| 871 | 865 | if (msg->cprbx.cprb_ver_id == 0x04) |
| 872 | 866 | return convert_type86_ep11_xcrb(zq, reply, xcRB); |
| 873 | − /* Fall through, no break, incorrect cprb version is an unknown resp.*/ | |
| 867 | + /* fall through - wrong cprb version is an unknown resp */ | |
| 874 | 868 | default: /* Unknown response type, this should NEVER EVER happen */ |
| 875 | 869 | zq->online = 0; |
| 876 | 870 | pr_err("Cryptographic device %02x.%04x failed and was set offline\n", |
| @@ -900,10 +894,7 @@ static int convert_response_rng(struct zcrypt_queue *zq, · 23 unmodified lines | ||
| 900 | 894 | return -EINVAL; |
| 901 | 895 | if (msg->cprbx.cprb_ver_id == 0x02) |
| 902 | 896 | return convert_type86_rng(zq, reply, data); |
| 903 | − /* | |
| 904 | − * Fall through, no break, incorrect cprb version is an unknown | |
| 905 | − * response | |
| 906 | − */ | |
| 897 | + /* fall through - wrong cprb version is an unknown response */ | |
| 907 | 898 | default: /* Unknown response type, this should NEVER EVER happen */ |
| 908 | 899 | zq->online = 0; |
| 909 | 900 | pr_err("Cryptographic device %02x.%04x failed and was set offline\n", |
| @@ -1704,6 +1704,7 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) · 1703 unmodified lines | ||
| 1704 | 1704 | grp->changed_side = 2; |
| 1705 | 1705 | break; |
| 1706 | 1706 | } |
| 1707 | + /* Else, fall through */ | |
| 1707 | 1708 | case MPCG_STATE_XID0IOWAIX: |
| 1708 | 1709 | case MPCG_STATE_XID7INITW: |
| 1709 | 1710 | case MPCG_STATE_XID7INITX: |
| @@ -357,6 +357,7 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) · 356 unmodified lines | ||
| 357 | 357 | /*fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW);*/ |
| 358 | 358 | if (callback) |
| 359 | 359 | grp->send_qllc_disc = 1; |
| 360 | + /* Else, fall through */ | |
| 360 | 361 | case MPCG_STATE_XID0IOWAIT: |
| 361 | 362 | fsm_deltimer(&grp->timer); |
| 362 | 363 | grp->outstanding_xid2 = 0; |
| @@ -1469,6 +1470,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) · 1106 unmodified lines | ||
| 1469 | 1470 | if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) && |
| 1470 | 1471 | (fsm_getstate(wch->fsm) == CH_XID0_PENDING)) |
| 1471 | 1472 | break; |
| 1473 | + /* Else, fall through */ | |
| 1472 | 1474 | default: |
| 1473 | 1475 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
| 1474 | 1476 | } |
| @@ -2089,6 +2091,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) · 614 unmodified lines | ||
| 2089 | 2091 | grp->estconnfunc = NULL; |
| 2090 | 2092 | break; |
| 2091 | 2093 | } |
| 2094 | + /* Else, fall through */ | |
| 2092 | 2095 | case MPCG_STATE_FLOWC: |
| 2093 | 2096 | case MPCG_STATE_READY: |
| 2094 | 2097 | grp->send_qllc_disc = 2; |
| @@ -333,7 +333,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card, · 332 unmodified lines | ||
| 333 | 333 | card->osn_info.data_cb(skb); |
| 334 | 334 | break; |
| 335 | 335 | } |
| 336 | − /* else unknown */ | |
| 336 | + /* Else, fall through */ | |
| 337 | 337 | default: |
| 338 | 338 | dev_kfree_skb_any(skb); |
| 339 | 339 | QETH_CARD_TEXT(card, 3, "inbunkno"); |
| @@ -603,6 +603,7 @@ static void fas216_handlesync(FAS216_Info *info, char *msg) · 602 unmodified lines | ||
| 603 | 603 | msgqueue_flush(&info->scsi.msgs); |
| 604 | 604 | msgqueue_addmsg(&info->scsi.msgs, 1, MESSAGE_REJECT); |
| 605 | 605 | info->scsi.phase = PHASE_MSGOUT_EXPECT; |
| 606 | + /* fall through */ | |
| 606 | 607 | |
| 607 | 608 | case async: |
| 608 | 609 | dev->period = info->ifcfg.asyncperiod / 4; |
| @@ -915,6 +916,7 @@ static void fas216_disconnect_intr(FAS216_Info *info) · 306 unmodified lines | ||
| 915 | 916 | fas216_done(info, DID_ABORT); |
| 916 | 917 | break; |
| 917 | 918 | } |
| 919 | + /* else, fall through */ | |
| 918 | 920 | |
| 919 | 921 | default: /* huh? */ |
| 920 | 922 | printk(KERN_ERR "scsi%d.%c: unexpected disconnect in phase %s\n", |
| @@ -1411,6 +1413,8 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne · 490 unmodified lines | ||
| 1411 | 1413 | case STATE(STAT_STATUS, PHASE_DATAOUT): /* Data Out -> Status */ |
| 1412 | 1414 | case STATE(STAT_STATUS, PHASE_DATAIN): /* Data In -> Status */ |
| 1413 | 1415 | fas216_stoptransfer(info); |
| 1416 | + /* fall through */ | |
| 1417 | + | |
| 1414 | 1418 | case STATE(STAT_STATUS, PHASE_SELSTEPS):/* Sel w/ steps -> Status */ |
| 1415 | 1419 | case STATE(STAT_STATUS, PHASE_MSGOUT): /* Message Out -> Status */ |
| 1416 | 1420 | case STATE(STAT_STATUS, PHASE_COMMAND): /* Command -> Status */ |
| @@ -1422,6 +1426,8 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne · 5 unmodified lines | ||
| 1422 | 1426 | case STATE(STAT_MESGIN, PHASE_DATAOUT): /* Data Out -> Message In */ |
| 1423 | 1427 | case STATE(STAT_MESGIN, PHASE_DATAIN): /* Data In -> Message In */ |
| 1424 | 1428 | fas216_stoptransfer(info); |
| 1429 | + /* fall through */ | |
| 1430 | + | |
| 1425 | 1431 | case STATE(STAT_MESGIN, PHASE_COMMAND): /* Command -> Message In */ |
| 1426 | 1432 | case STATE(STAT_MESGIN, PHASE_SELSTEPS):/* Sel w/ steps -> Message In */ |
| 1427 | 1433 | case STATE(STAT_MESGIN, PHASE_MSGOUT): /* Message Out -> Message In */ |
| @@ -1575,6 +1581,7 @@ static void fas216_funcdone_intr(FAS216_Info *info, unsigned int stat, unsigned · 147 unmodified lines | ||
| 1575 | 1581 | fas216_message(info); |
| 1576 | 1582 | break; |
| 1577 | 1583 | } |
| 1584 | + /* else, fall through */ | |
| 1578 | 1585 | |
| 1579 | 1586 | default: |
| 1580 | 1587 | fas216_log(info, 0, "internal phase %s for function done?" |
| @@ -1957,6 +1964,7 @@ static void fas216_kick(FAS216_Info *info) · 376 unmodified lines | ||
| 1957 | 1964 | switch (where_from) { |
| 1958 | 1965 | case TYPE_QUEUE: |
| 1959 | 1966 | fas216_allocate_tag(info, SCpnt); |
| 1967 | + /* fall through */ | |
| 1960 | 1968 | case TYPE_OTHER: |
| 1961 | 1969 | fas216_start_command(info, SCpnt); |
| 1962 | 1970 | break; |
| @@ -2005,7 +2005,7 @@ EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); · 2004 unmodified lines | ||
| 2005 | 2005 | */ |
| 2006 | 2006 | static inline struct fcoe_rport *fcoe_ctlr_rport(struct fc_rport_priv *rdata) |
| 2007 | 2007 | { |
| 2008 | − return (struct fcoe_rport *)(rdata + 1); | |
| 2008 | + return container_of(rdata, struct fcoe_rport, rdata); | |
| 2009 | 2009 | } |
| 2010 | 2010 | |
| 2011 | 2011 | /** |
| @@ -2269,7 +2269,7 @@ static void fcoe_ctlr_vn_start(struct fcoe_ctlr *fip) · 257 unmodified lines | ||
| 2269 | 2269 | */ |
| 2270 | 2270 | static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip, |
| 2271 | 2271 | struct sk_buff *skb, |
| 2272 | − struct fc_rport_priv *rdata) | |
| 2272 | + struct fcoe_rport *frport) | |
| 2273 | 2273 | { |
| 2274 | 2274 | struct fip_header *fiph; |
| 2275 | 2275 | struct fip_desc *desc = NULL; |
| @@ -2277,16 +2277,12 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip, · 1 unmodified line | ||
| 2277 | 2277 | struct fip_wwn_desc *wwn = NULL; |
| 2278 | 2278 | struct fip_vn_desc *vn = NULL; |
| 2279 | 2279 | struct fip_size_desc *size = NULL; |
| 2280 | − struct fcoe_rport *frport; | |
| 2281 | 2280 | size_t rlen; |
| 2282 | 2281 | size_t dlen; |
| 2283 | 2282 | u32 desc_mask = 0; |
| 2284 | 2283 | u32 dtype; |
| 2285 | 2284 | u8 sub; |
| 2286 | 2285 | |
| 2287 | − memset(rdata, 0, sizeof(*rdata) + sizeof(*frport)); | |
| 2288 | − frport = fcoe_ctlr_rport(rdata); | |
| 2289 | − | |
| 2290 | 2286 | fiph = (struct fip_header *)skb->data; |
| 2291 | 2287 | frport->flags = ntohs(fiph->fip_flags); |
| 2292 | 2288 | |
| @@ -2349,15 +2345,17 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip, · 56 unmodified lines | ||
| 2349 | 2345 | if (dlen != sizeof(struct fip_wwn_desc)) |
| 2350 | 2346 | goto len_err; |
| 2351 | 2347 | wwn = (struct fip_wwn_desc *)desc; |
| 2352 | − rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn); | |
| 2348 | + frport->rdata.ids.node_name = | |
| 2349 | + get_unaligned_be64(&wwn->fd_wwn); | |
| 2353 | 2350 | break; |
| 2354 | 2351 | case FIP_DT_VN_ID: |
| 2355 | 2352 | if (dlen != sizeof(struct fip_vn_desc)) |
| 2356 | 2353 | goto len_err; |
| 2357 | 2354 | vn = (struct fip_vn_desc *)desc; |
| 2358 | 2355 | memcpy(frport->vn_mac, vn->fd_mac, ETH_ALEN); |
| 2359 | − rdata->ids.port_id = ntoh24(vn->fd_fc_id); | |
| 2360 | − rdata->ids.port_name = get_unaligned_be64(&vn->fd_wwpn); | |
| 2356 | + frport->rdata.ids.port_id = ntoh24(vn->fd_fc_id); | |
| 2357 | + frport->rdata.ids.port_name = | |
| 2358 | + get_unaligned_be64(&vn->fd_wwpn); | |
| 2361 | 2359 | break; |
| 2362 | 2360 | case FIP_DT_FC4F: |
| 2363 | 2361 | if (dlen != sizeof(struct fip_fc4_feat)) |
| @@ -2403,16 +2401,14 @@ static void fcoe_ctlr_vn_send_claim(struct fcoe_ctlr *fip) · 39 unmodified lines | ||
| 2403 | 2401 | /** |
| 2404 | 2402 | * fcoe_ctlr_vn_probe_req() - handle incoming VN2VN probe request. |
| 2405 | 2403 | * @fip: The FCoE controller |
| 2406 | − * @rdata: parsed remote port with frport from the probe request | |
| 2404 | + * @frport: parsed FCoE rport from the probe request | |
| 2407 | 2405 | * |
| 2408 | 2406 | * Called with ctlr_mutex held. |
| 2409 | 2407 | */ |
| 2410 | 2408 | static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, |
| 2411 | − struct fc_rport_priv *rdata) | |
| 2409 | + struct fcoe_rport *frport) | |
| 2412 | 2410 | { |
| 2413 | − struct fcoe_rport *frport = fcoe_ctlr_rport(rdata); | |
| 2414 | − | |
| 2415 | − if (rdata->ids.port_id != fip->port_id) | |
| 2411 | + if (frport->rdata.ids.port_id != fip->port_id) | |
| 2416 | 2412 | return; |
| 2417 | 2413 | |
| 2418 | 2414 | switch (fip->state) { |
| @@ -2432,7 +2428,7 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, · 13 unmodified lines | ||
| 2432 | 2428 | * Probe's REC bit is not set. |
| 2433 | 2429 | * If we don't reply, we will change our address. |
| 2434 | 2430 | */ |
| 2435 | − if (fip->lp->wwpn > rdata->ids.port_name && | |
| 2431 | + if (fip->lp->wwpn > frport->rdata.ids.port_name && | |
| 2436 | 2432 | !(frport->flags & FIP_FL_REC_OR_P2P)) { |
| 2437 | 2433 | LIBFCOE_FIP_DBG(fip, "vn_probe_req: " |
| 2438 | 2434 | "port_id collision\n"); |
| @@ -2456,14 +2452,14 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, · 17 unmodified lines | ||
| 2456 | 2452 | /** |
| 2457 | 2453 | * fcoe_ctlr_vn_probe_reply() - handle incoming VN2VN probe reply. |
| 2458 | 2454 | * @fip: The FCoE controller |
| 2459 | − * @rdata: parsed remote port with frport from the probe request | |
| 2455 | + * @frport: parsed FCoE rport from the probe request | |
| 2460 | 2456 | * |
| 2461 | 2457 | * Called with ctlr_mutex held. |
| 2462 | 2458 | */ |
| 2463 | 2459 | static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip, |
| 2464 | − struct fc_rport_priv *rdata) | |
| 2460 | + struct fcoe_rport *frport) | |
| 2465 | 2461 | { |
| 2466 | − if (rdata->ids.port_id != fip->port_id) | |
| 2462 | + if (frport->rdata.ids.port_id != fip->port_id) | |
| 2467 | 2463 | return; |
| 2468 | 2464 | switch (fip->state) { |
| 2469 | 2465 | case FIP_ST_VNMP_START: |
| @@ -2486,11 +2482,11 @@ static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip, · 16 unmodified lines | ||
| 2486 | 2482 | /** |
| 2487 | 2483 | * fcoe_ctlr_vn_add() - Add a VN2VN entry to the list, based on a claim reply. |
| 2488 | 2484 | * @fip: The FCoE controller |
| 2489 | − * @new: newly-parsed remote port with frport as a template for new rdata | |
| 2485 | + * @new: newly-parsed FCoE rport as a template for new rdata | |
| 2490 | 2486 | * |
| 2491 | 2487 | * Called with ctlr_mutex held. |
| 2492 | 2488 | */ |
| 2493 | −static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) | |
| 2489 | +static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fcoe_rport *new) | |
| 2494 | 2490 | { |
| 2495 | 2491 | struct fc_lport *lport = fip->lp; |
| 2496 | 2492 | struct fc_rport_priv *rdata; |
| @@ -2498,7 +2494,7 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) · 1 unmodified line | ||
| 2498 | 2494 | struct fcoe_rport *frport; |
| 2499 | 2495 | u32 port_id; |
| 2500 | 2496 | |
| 2501 | − port_id = new->ids.port_id; | |
| 2497 | + port_id = new->rdata.ids.port_id; | |
| 2502 | 2498 | if (port_id == fip->port_id) |
| 2503 | 2499 | return; |
| 2504 | 2500 | |
| @@ -2515,22 +2511,28 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) · 10 unmodified lines | ||
| 2515 | 2511 | rdata->disc_id = lport->disc.disc_id; |
| 2516 | 2512 | |
| 2517 | 2513 | ids = &rdata->ids; |
| 2518 | − if ((ids->port_name != -1 && ids->port_name != new->ids.port_name) || | |
| 2519 | − (ids->node_name != -1 && ids->node_name != new->ids.node_name)) { | |
| 2514 | + if ((ids->port_name != -1 && | |
| 2515 | + ids->port_name != new->rdata.ids.port_name) || | |
| 2516 | + (ids->node_name != -1 && | |
| 2517 | + ids->node_name != new->rdata.ids.node_name)) { | |
| 2520 | 2518 | mutex_unlock(&rdata->rp_mutex); |
| 2521 | 2519 | LIBFCOE_FIP_DBG(fip, "vn_add rport logoff %6.6x\n", port_id); |
| 2522 | 2520 | fc_rport_logoff(rdata); |
| 2523 | 2521 | mutex_lock(&rdata->rp_mutex); |
| 2524 | 2522 | } |
| 2525 | − ids->port_name = new->ids.port_name; | |
| 2526 | − ids->node_name = new->ids.node_name; | |
| 2523 | + ids->port_name = new->rdata.ids.port_name; | |
| 2524 | + ids->node_name = new->rdata.ids.node_name; | |
| 2527 | 2525 | mutex_unlock(&rdata->rp_mutex); |
| 2528 | 2526 | |
| 2529 | 2527 | frport = fcoe_ctlr_rport(rdata); |
| 2530 | 2528 | LIBFCOE_FIP_DBG(fip, "vn_add rport %6.6x %s state %d\n", |
| 2531 | 2529 | port_id, frport->fcoe_len ? "old" : "new", |
| 2532 | 2530 | rdata->rp_state); |
| 2533 | − *frport = *fcoe_ctlr_rport(new); | |
| 2531 | + frport->fcoe_len = new->fcoe_len; | |
| 2532 | + frport->flags = new->flags; | |
| 2533 | + frport->login_count = new->login_count; | |
| 2534 | + memcpy(frport->enode_mac, new->enode_mac, ETH_ALEN); | |
| 2535 | + memcpy(frport->vn_mac, new->vn_mac, ETH_ALEN); | |
| 2534 | 2536 | frport->time = 0; |
| 2535 | 2537 | } |
| 2536 | 2538 | |
| @@ -2562,16 +2564,14 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac) · 25 unmodified lines | ||
| 2562 | 2564 | /** |
| 2563 | 2565 | * fcoe_ctlr_vn_claim_notify() - handle received FIP VN2VN Claim Notification |
| 2564 | 2566 | * @fip: The FCoE controller |
| 2565 | − * @new: newly-parsed remote port with frport as a template for new rdata | |
| 2567 | + * @new: newly-parsed FCoE rport as a template for new rdata | |
| 2566 | 2568 | * |
| 2567 | 2569 | * Called with ctlr_mutex held. |
| 2568 | 2570 | */ |
| 2569 | 2571 | static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, |
| 2570 | − struct fc_rport_priv *new) | |
| 2572 | + struct fcoe_rport *new) | |
| 2571 | 2573 | { |
| 2572 | − struct fcoe_rport *frport = fcoe_ctlr_rport(new); | |
| 2573 | − | |
| 2574 | − if (frport->flags & FIP_FL_REC_OR_P2P) { | |
| 2574 | + if (new->flags & FIP_FL_REC_OR_P2P) { | |
| 2575 | 2575 | LIBFCOE_FIP_DBG(fip, "send probe req for P2P/REC\n"); |
| 2576 | 2576 | fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); |
| 2577 | 2577 | return; |
| @@ -2580,7 +2580,7 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, · 2 unmodified lines | ||
| 2580 | 2580 | case FIP_ST_VNMP_START: |
| 2581 | 2581 | case FIP_ST_VNMP_PROBE1: |
| 2582 | 2582 | case FIP_ST_VNMP_PROBE2: |
| 2583 | − if (new->ids.port_id == fip->port_id) { | |
| 2583 | + if (new->rdata.ids.port_id == fip->port_id) { | |
| 2584 | 2584 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
| 2585 | 2585 | "restart, state %d\n", |
| 2586 | 2586 | fip->state); |
| @@ -2589,8 +2589,8 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, · 2 unmodified lines | ||
| 2589 | 2589 | break; |
| 2590 | 2590 | case FIP_ST_VNMP_CLAIM: |
| 2591 | 2591 | case FIP_ST_VNMP_UP: |
| 2592 | − if (new->ids.port_id == fip->port_id) { | |
| 2593 | − if (new->ids.port_name > fip->lp->wwpn) { | |
| 2592 | + if (new->rdata.ids.port_id == fip->port_id) { | |
| 2593 | + if (new->rdata.ids.port_name > fip->lp->wwpn) { | |
| 2594 | 2594 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
| 2595 | 2595 | "restart, port_id collision\n"); |
| 2596 | 2596 | fcoe_ctlr_vn_restart(fip); |
| @@ -2602,15 +2602,16 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, · 5 unmodified lines | ||
| 2602 | 2602 | break; |
| 2603 | 2603 | } |
| 2604 | 2604 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: send reply to %x\n", |
| 2605 | − new->ids.port_id); | |
| 2606 | − fcoe_ctlr_vn_send(fip, FIP_SC_VN_CLAIM_REP, frport->enode_mac, | |
| 2607 | − min((u32)frport->fcoe_len, | |
| 2605 | + new->rdata.ids.port_id); | |
| 2606 | + fcoe_ctlr_vn_send(fip, FIP_SC_VN_CLAIM_REP, new->enode_mac, | |
| 2607 | + min((u32)new->fcoe_len, | |
| 2608 | 2608 | fcoe_ctlr_fcoe_size(fip))); |
| 2609 | 2609 | fcoe_ctlr_vn_add(fip, new); |
| 2610 | 2610 | break; |
| 2611 | 2611 | default: |
| 2612 | 2612 | LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " |
| 2613 | − "ignoring claim from %x\n", new->ids.port_id); | |
| 2613 | + "ignoring claim from %x\n", | |
| 2614 | + new->rdata.ids.port_id); | |
| 2614 | 2615 | break; |
| 2615 | 2616 | } |
| 2616 | 2617 | } |
| @@ -2618,15 +2619,15 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, · 1 unmodified line | ||
| 2618 | 2619 | /** |
| 2619 | 2620 | * fcoe_ctlr_vn_claim_resp() - handle received Claim Response |
| 2620 | 2621 | * @fip: The FCoE controller that received the frame |
| 2621 | − * @new: newly-parsed remote port with frport from the Claim Response | |
| 2622 | + * @new: newly-parsed FCoE rport from the Claim Response | |
| 2622 | 2623 | * |
| 2623 | 2624 | * Called with ctlr_mutex held. |
| 2624 | 2625 | */ |
| 2625 | 2626 | static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip, |
| 2626 | − struct fc_rport_priv *new) | |
| 2627 | + struct fcoe_rport *new) | |
| 2627 | 2628 | { |
| 2628 | 2629 | LIBFCOE_FIP_DBG(fip, "claim resp from from rport %x - state %s\n", |
| 2629 | − new->ids.port_id, fcoe_ctlr_state(fip->state)); | |
| 2630 | + new->rdata.ids.port_id, fcoe_ctlr_state(fip->state)); | |
| 2630 | 2631 | if (fip->state == FIP_ST_VNMP_UP || fip->state == FIP_ST_VNMP_CLAIM) |
| 2631 | 2632 | fcoe_ctlr_vn_add(fip, new); |
| 2632 | 2633 | } |
| @@ -2634,28 +2635,28 @@ static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip, · 1 unmodified line | ||
| 2634 | 2635 | /** |
| 2635 | 2636 | * fcoe_ctlr_vn_beacon() - handle received beacon. |
| 2636 | 2637 | * @fip: The FCoE controller that received the frame |
| 2637 | − * @new: newly-parsed remote port with frport from the Beacon | |
| 2638 | + * @new: newly-parsed FCoE rport from the Beacon | |
| 2638 | 2639 | * |
| 2639 | 2640 | * Called with ctlr_mutex held. |
| 2640 | 2641 | */ |
| 2641 | 2642 | static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, |
| 2642 | − struct fc_rport_priv *new) | |
| 2643 | + struct fcoe_rport *new) | |
| 2643 | 2644 | { |
| 2644 | 2645 | struct fc_lport *lport = fip->lp; |
| 2645 | 2646 | struct fc_rport_priv *rdata; |
| 2646 | 2647 | struct fcoe_rport *frport; |
| 2647 | 2648 | |
| 2648 | − frport = fcoe_ctlr_rport(new); | |
| 2649 | − if (frport->flags & FIP_FL_REC_OR_P2P) { | |
| 2649 | + if (new->flags & FIP_FL_REC_OR_P2P) { | |
| 2650 | 2650 | LIBFCOE_FIP_DBG(fip, "p2p beacon while in vn2vn mode\n"); |
| 2651 | 2651 | fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); |
| 2652 | 2652 | return; |
| 2653 | 2653 | } |
| 2654 | − rdata = fc_rport_lookup(lport, new->ids.port_id); | |
| 2654 | + rdata = fc_rport_lookup(lport, new->rdata.ids.port_id); | |
| 2655 | 2655 | if (rdata) { |
| 2656 | − if (rdata->ids.node_name == new->ids.node_name && | |
| 2657 | − rdata->ids.port_name == new->ids.port_name) { | |
| 2656 | + if (rdata->ids.node_name == new->rdata.ids.node_name && | |
| 2657 | + rdata->ids.port_name == new->rdata.ids.port_name) { | |
| 2658 | 2658 | frport = fcoe_ctlr_rport(rdata); |
| 2659 | + | |
| 2659 | 2660 | LIBFCOE_FIP_DBG(fip, "beacon from rport %x\n", |
| 2660 | 2661 | rdata->ids.port_id); |
| 2661 | 2662 | if (!frport->time && fip->state == FIP_ST_VNMP_UP) { |
| @@ -2678,7 +2679,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, · 16 unmodified lines | ||
| 2678 | 2679 | * Don't add the neighbor yet. |
| 2679 | 2680 | */ |
| 2680 | 2681 | LIBFCOE_FIP_DBG(fip, "beacon from new rport %x. sending claim notify\n", |
| 2681 | − new->ids.port_id); | |
| 2682 | + new->rdata.ids.port_id); | |
| 2682 | 2683 | if (time_after(jiffies, |
| 2683 | 2684 | fip->sol_time + msecs_to_jiffies(FIP_VN_ANN_WAIT))) |
| 2684 | 2685 | fcoe_ctlr_vn_send_claim(fip); |
| @@ -2738,10 +2739,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) · 53 unmodified lines | ||
| 2738 | 2739 | { |
| 2739 | 2740 | struct fip_header *fiph; |
| 2740 | 2741 | enum fip_vn2vn_subcode sub; |
| 2741 | − struct { | |
| 2742 | − struct fc_rport_priv rdata; | |
| 2743 | − struct fcoe_rport frport; | |
| 2744 | − } buf; | |
| 2742 | + struct fcoe_rport frport = { }; | |
| 2745 | 2743 | int rc, vlan_id = 0; |
| 2746 | 2744 | |
| 2747 | 2745 | fiph = (struct fip_header *)skb->data; |
| @@ -2757,7 +2755,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) · 9 unmodified lines | ||
| 2757 | 2755 | goto drop; |
| 2758 | 2756 | } |
| 2759 | 2757 | |
| 2760 | − rc = fcoe_ctlr_vn_parse(fip, skb, &buf.rdata); | |
| 2758 | + rc = fcoe_ctlr_vn_parse(fip, skb, &frport); | |
| 2761 | 2759 | if (rc) { |
| 2762 | 2760 | LIBFCOE_FIP_DBG(fip, "vn_recv vn_parse error %d\n", rc); |
| 2763 | 2761 | goto drop; |
| @@ -2766,19 +2764,19 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) · 2 unmodified lines | ||
| 2766 | 2764 | mutex_lock(&fip->ctlr_mutex); |
| 2767 | 2765 | switch (sub) { |
| 2768 | 2766 | case FIP_SC_VN_PROBE_REQ: |
| 2769 | − fcoe_ctlr_vn_probe_req(fip, &buf.rdata); | |
| 2767 | + fcoe_ctlr_vn_probe_req(fip, &frport); | |
| 2770 | 2768 | break; |
| 2771 | 2769 | case FIP_SC_VN_PROBE_REP: |
| 2772 | − fcoe_ctlr_vn_probe_reply(fip, &buf.rdata); | |
| 2770 | + fcoe_ctlr_vn_probe_reply(fip, &frport); | |
| 2773 | 2771 | break; |
| 2774 | 2772 | case FIP_SC_VN_CLAIM_NOTIFY: |
| 2775 | − fcoe_ctlr_vn_claim_notify(fip, &buf.rdata); | |
| 2773 | + fcoe_ctlr_vn_claim_notify(fip, &frport); | |
| 2776 | 2774 | break; |
| 2777 | 2775 | case FIP_SC_VN_CLAIM_REP: |
| 2778 | − fcoe_ctlr_vn_claim_resp(fip, &buf.rdata); | |
| 2776 | + fcoe_ctlr_vn_claim_resp(fip, &frport); | |
| 2779 | 2777 | break; |
| 2780 | 2778 | case FIP_SC_VN_BEACON: |
| 2781 | − fcoe_ctlr_vn_beacon(fip, &buf.rdata); | |
| 2779 | + fcoe_ctlr_vn_beacon(fip, &frport); | |
| 2782 | 2780 | break; |
| 2783 | 2781 | default: |
| 2784 | 2782 | LIBFCOE_FIP_DBG(fip, "vn_recv unknown subcode %d\n", sub); |
| @@ -2802,22 +2800,18 @@ drop: · 17 unmodified lines | ||
| 2802 | 2800 | */ |
| 2803 | 2801 | static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip, |
| 2804 | 2802 | struct sk_buff *skb, |
| 2805 | − struct fc_rport_priv *rdata) | |
| 2803 | + struct fcoe_rport *frport) | |
| 2806 | 2804 | { |
| 2807 | 2805 | struct fip_header *fiph; |
| 2808 | 2806 | struct fip_desc *desc = NULL; |
| 2809 | 2807 | struct fip_mac_desc *macd = NULL; |
| 2810 | 2808 | struct fip_wwn_desc *wwn = NULL; |
| 2811 | − struct fcoe_rport *frport; | |
| 2812 | 2809 | size_t rlen; |
| 2813 | 2810 | size_t dlen; |
| 2814 | 2811 | u32 desc_mask = 0; |
| 2815 | 2812 | u32 dtype; |
| 2816 | 2813 | u8 sub; |
| 2817 | 2814 | |
| 2818 | − memset(rdata, 0, sizeof(*rdata) + sizeof(*frport)); | |
| 2819 | − frport = fcoe_ctlr_rport(rdata); | |
| 2820 | − | |
| 2821 | 2815 | fiph = (struct fip_header *)skb->data; |
| 2822 | 2816 | frport->flags = ntohs(fiph->fip_flags); |
| 2823 | 2817 | |
| @@ -2871,7 +2865,8 @@ static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip, · 47 unmodified lines | ||
| 2871 | 2865 | if (dlen != sizeof(struct fip_wwn_desc)) |
| 2872 | 2866 | goto len_err; |
| 2873 | 2867 | wwn = (struct fip_wwn_desc *)desc; |
| 2874 | − rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn); | |
| 2868 | + frport->rdata.ids.node_name = | |
| 2869 | + get_unaligned_be64(&wwn->fd_wwn); | |
| 2875 | 2870 | break; |
| 2876 | 2871 | default: |
| 2877 | 2872 | LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x " |
| @@ -2957,13 +2952,13 @@ static void fcoe_ctlr_vlan_send(struct fcoe_ctlr *fip, · 79 unmodified lines | ||
| 2957 | 2952 | /** |
| 2958 | 2953 | * fcoe_ctlr_vlan_disk_reply() - send FIP VLAN Discovery Notification. |
| 2959 | 2954 | * @fip: The FCoE controller |
| 2955 | + * @frport: The newly-parsed FCoE rport from the Discovery Request | |
| 2960 | 2956 | * |
| 2961 | 2957 | * Called with ctlr_mutex held. |
| 2962 | 2958 | */ |
| 2963 | 2959 | static void fcoe_ctlr_vlan_disc_reply(struct fcoe_ctlr *fip, |
| 2964 | − struct fc_rport_priv *rdata) | |
| 2960 | + struct fcoe_rport *frport) | |
| 2965 | 2961 | { |
| 2966 | − struct fcoe_rport *frport = fcoe_ctlr_rport(rdata); | |
| 2967 | 2962 | enum fip_vlan_subcode sub = FIP_SC_VL_NOTE; |
| 2968 | 2963 | |
| 2969 | 2964 | if (fip->mode == FIP_MODE_VN2VN) |
| @@ -2982,22 +2977,19 @@ static int fcoe_ctlr_vlan_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) · 12 unmodified lines | ||
| 2982 | 2977 | { |
| 2983 | 2978 | struct fip_header *fiph; |
| 2984 | 2979 | enum fip_vlan_subcode sub; |
| 2985 | − struct { | |
| 2986 | − struct fc_rport_priv rdata; | |
| 2987 | − struct fcoe_rport frport; | |
| 2988 | − } buf; | |
| 2980 | + struct fcoe_rport frport = { }; | |
| 2989 | 2981 | int rc; |
| 2990 | 2982 | |
| 2991 | 2983 | fiph = (struct fip_header *)skb->data; |
| 2992 | 2984 | sub = fiph->fip_subcode; |
| 2993 | − rc = fcoe_ctlr_vlan_parse(fip, skb, &buf.rdata); | |
| 2985 | + rc = fcoe_ctlr_vlan_parse(fip, skb, &frport); | |
| 2994 | 2986 | if (rc) { |
| 2995 | 2987 | LIBFCOE_FIP_DBG(fip, "vlan_recv vlan_parse error %d\n", rc); |
| 2996 | 2988 | goto drop; |
| 2997 | 2989 | } |
| 2998 | 2990 | mutex_lock(&fip->ctlr_mutex); |
| 2999 | 2991 | if (sub == FIP_SC_VL_REQ) |
| 3000 | − fcoe_ctlr_vlan_disc_reply(fip, &buf.rdata); | |
| 2992 | + fcoe_ctlr_vlan_disc_reply(fip, &frport); | |
| 3001 | 2993 | mutex_unlock(&fip->ctlr_mutex); |
| 3002 | 2994 | |
| 3003 | 2995 | drop: |
| @@ -2334,6 +2334,8 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h, · 2333 unmodified lines | ||
| 2334 | 2334 | case IOACCEL2_SERV_RESPONSE_COMPLETE: |
| 2335 | 2335 | switch (c2->error_data.status) { |
| 2336 | 2336 | case IOACCEL2_STATUS_SR_TASK_COMP_GOOD: |
| 2337 | + if (cmd) | |
| 2338 | + cmd->result = 0; | |
| 2337 | 2339 | break; |
| 2338 | 2340 | case IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND: |
| 2339 | 2341 | cmd->result |= SAM_STAT_CHECK_CONDITION; |
| @@ -2483,8 +2485,10 @@ static void process_ioaccel2_completion(struct ctlr_info *h, · 143 unmodified lines | ||
| 2483 | 2485 | |
| 2484 | 2486 | /* check for good status */ |
| 2485 | 2487 | if (likely(c2->error_data.serv_response == 0 && |
| 2486 | − c2->error_data.status == 0)) | |
| 2488 | + c2->error_data.status == 0)) { | |
| 2489 | + cmd->result = 0; | |
| 2487 | 2490 | return hpsa_cmd_free_and_done(h, c, cmd); |
| 2491 | + } | |
| 2488 | 2492 | |
| 2489 | 2493 | /* |
| 2490 | 2494 | * Any RAID offload error results in retry which will use |
| @@ -5653,6 +5657,12 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd) · 3162 unmodified lines | ||
| 5653 | 5657 | if (c == NULL) |
| 5654 | 5658 | return SCSI_MLQUEUE_DEVICE_BUSY; |
| 5655 | 5659 | |
| 5660 | + /* | |
| 5661 | + * This is necessary because the SML doesn't zero out this field during | |
| 5662 | + * error recovery. | |
| 5663 | + */ | |
| 5664 | + cmd->result = 0; | |
| 5665 | + | |
| 5656 | 5666 | /* |
| 5657 | 5667 | * Call alternate submit routine for I/O accelerated commands. |
| 5658 | 5668 | * Retries always go down the normal I/O path. |
| @@ -6081,8 +6091,6 @@ static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h, · 422 unmodified lines | ||
| 6081 | 6091 | if (idx != h->last_collision_tag) { /* Print once per tag */ |
| 6082 | 6092 | dev_warn(&h->pdev->dev, |
| 6083 | 6093 | "%s: tag collision (tag=%d)\n", __func__, idx); |
| 6084 | − if (c->scsi_cmd != NULL) | |
| 6085 | − scsi_print_command(c->scsi_cmd); | |
| 6086 | 6094 | if (scmd) |
| 6087 | 6095 | scsi_print_command(scmd); |
| 6088 | 6096 | h->last_collision_tag = idx; |
| @@ -128,6 +128,7 @@ EXPORT_SYMBOL(fc_rport_lookup); · 127 unmodified lines | ||
| 128 | 128 | struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) |
| 129 | 129 | { |
| 130 | 130 | struct fc_rport_priv *rdata; |
| 131 | + size_t rport_priv_size = sizeof(*rdata); | |
| 131 | 132 | |
| 132 | 133 | lockdep_assert_held(&lport->disc.disc_mutex); |
| 133 | 134 | |
| @@ -135,7 +136,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) · 1 unmodified line | ||
| 135 | 136 | if (rdata) |
| 136 | 137 | return rdata; |
| 137 | 138 | |
| 138 | − rdata = kzalloc(sizeof(*rdata) + lport->rport_priv_size, GFP_KERNEL); | |
| 139 | + if (lport->rport_priv_size > 0) | |
| 140 | + rport_priv_size = lport->rport_priv_size; | |
| 141 | + rdata = kzalloc(rport_priv_size, GFP_KERNEL); | |
| 139 | 142 | if (!rdata) |
| 140 | 143 | return NULL; |
| 141 | 144 | |
| @@ -2703,6 +2703,8 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) · 2702 unmodified lines | ||
| 2703 | 2703 | { |
| 2704 | 2704 | u64 required_mask, coherent_mask; |
| 2705 | 2705 | struct sysinfo s; |
| 2706 | + /* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */ | |
| 2707 | + int dma_mask = (ioc->hba_mpi_version_belonged > MPI2_VERSION) ? 63 : 64; | |
| 2706 | 2708 | |
| 2707 | 2709 | if (ioc->is_mcpu_endpoint) |
| 2708 | 2710 | goto try_32bit; |
| @@ -2712,17 +2714,17 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) · 3 unmodified lines | ||
| 2712 | 2714 | goto try_32bit; |
| 2713 | 2715 | |
| 2714 | 2716 | if (ioc->dma_mask) |
| 2715 | − coherent_mask = DMA_BIT_MASK(64); | |
| 2717 | + coherent_mask = DMA_BIT_MASK(dma_mask); | |
| 2716 | 2718 | else |
| 2717 | 2719 | coherent_mask = DMA_BIT_MASK(32); |
| 2718 | 2720 | |
| 2719 | − if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) || | |
| 2721 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(dma_mask)) || | |
| 2720 | 2722 | dma_set_coherent_mask(&pdev->dev, coherent_mask)) |
| 2721 | 2723 | goto try_32bit; |
| 2722 | 2724 | |
| 2723 | 2725 | ioc->base_add_sg_single = &_base_add_sg_single_64; |
| 2724 | 2726 | ioc->sge_size = sizeof(Mpi2SGESimple64_t); |
| 2725 | − ioc->dma_mask = 64; | |
| 2727 | + ioc->dma_mask = dma_mask; | |
| 2726 | 2728 | goto out; |
| 2727 | 2729 | |
| 2728 | 2730 | try_32bit: |
| @@ -2744,7 +2746,7 @@ static int · 15 unmodified lines | ||
| 2744 | 2746 | _base_change_consistent_dma_mask(struct MPT3SAS_ADAPTER *ioc, |
| 2745 | 2747 | struct pci_dev *pdev) |
| 2746 | 2748 | { |
| 2747 | − if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { | |
| 2749 | + if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(ioc->dma_mask))) { | |
| 2748 | 2750 | if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) |
| 2749 | 2751 | return -ENODEV; |
| 2750 | 2752 | } |
| @@ -4989,7 +4991,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 2238 unmodified lines | ||
| 4989 | 4991 | total_sz += sz; |
| 4990 | 4992 | } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count)); |
| 4991 | 4993 | |
| 4992 | − if (ioc->dma_mask == 64) { | |
| 4994 | + if (ioc->dma_mask > 32) { | |
| 4993 | 4995 | if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) { |
| 4994 | 4996 | ioc_warn(ioc, "no suitable consistent DMA mask for %s\n", |
| 4995 | 4997 | pci_name(ioc->pdev)); |
| @@ -4877,7 +4877,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) · 4876 unmodified lines | ||
| 4877 | 4877 | ql_log(ql_log_warn, vha, 0xd049, |
| 4878 | 4878 | "Failed to allocate ct_sns request.\n"); |
| 4879 | 4879 | kfree(fcport); |
| 4880 | − fcport = NULL; | |
| 4880 | + return NULL; | |
| 4881 | 4881 | } |
| 4882 | 4882 | |
| 4883 | 4883 | INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn); |
| @@ -834,7 +834,8 @@ static int bcm2835_spi_transfer_one(struct spi_controller *ctlr, · 833 unmodified lines | ||
| 834 | 834 | bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv); |
| 835 | 835 | |
| 836 | 836 | /* handle all the 3-wire mode */ |
| 837 | − if ((spi->mode & SPI_3WIRE) && (tfr->rx_buf)) | |
| 837 | + if (spi->mode & SPI_3WIRE && tfr->rx_buf && | |
| 838 | + tfr->rx_buf != ctlr->dummy_rx) | |
| 838 | 839 | cs |= BCM2835_SPI_CS_REN; |
| 839 | 840 | else |
| 840 | 841 | cs &= ~BCM2835_SPI_CS_REN; |
| @@ -206,7 +206,7 @@ static const struct fsl_qspi_devtype_data imx6sx_data = { · 205 unmodified lines | ||
| 206 | 206 | }; |
| 207 | 207 | |
| 208 | 208 | static const struct fsl_qspi_devtype_data imx7d_data = { |
| 209 | − .rxfifo = SZ_512, | |
| 209 | + .rxfifo = SZ_128, | |
| 210 | 210 | .txfifo = SZ_512, |
| 211 | 211 | .ahb_buf_size = SZ_1K, |
| 212 | 212 | .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_4X_INT_CLK, |
| @@ -410,6 +410,12 @@ static int spi_gpio_probe(struct platform_device *pdev) · 409 unmodified lines | ||
| 410 | 410 | |
| 411 | 411 | bb = &spi_gpio->bitbang; |
| 412 | 412 | bb->master = master; |
| 413 | + /* | |
| 414 | + * There is some additional business, apart from driving the CS GPIO | |
| 415 | + * line, that we need to do on selection. This makes the local | |
| 416 | + * callback for chipselect always get called. | |
| 417 | + */ | |
| 418 | + master->flags |= SPI_MASTER_GPIO_SS; | |
| 413 | 419 | bb->chipselect = spi_gpio_chipselect; |
| 414 | 420 | bb->set_line_direction = spi_gpio_set_direction; |
| 415 | 421 | |
| @@ -1457,6 +1457,14 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = { · 1456 unmodified lines | ||
| 1457 | 1457 | { PCI_VDEVICE(INTEL, 0x02aa), LPSS_CNL_SSP }, |
| 1458 | 1458 | { PCI_VDEVICE(INTEL, 0x02ab), LPSS_CNL_SSP }, |
| 1459 | 1459 | { PCI_VDEVICE(INTEL, 0x02fb), LPSS_CNL_SSP }, |
| 1460 | + /* TGL-LP */ | |
| 1461 | + { PCI_VDEVICE(INTEL, 0xa0aa), LPSS_CNL_SSP }, | |
| 1462 | + { PCI_VDEVICE(INTEL, 0xa0ab), LPSS_CNL_SSP }, | |
| 1463 | + { PCI_VDEVICE(INTEL, 0xa0de), LPSS_CNL_SSP }, | |
| 1464 | + { PCI_VDEVICE(INTEL, 0xa0df), LPSS_CNL_SSP }, | |
| 1465 | + { PCI_VDEVICE(INTEL, 0xa0fb), LPSS_CNL_SSP }, | |
| 1466 | + { PCI_VDEVICE(INTEL, 0xa0fd), LPSS_CNL_SSP }, | |
| 1467 | + { PCI_VDEVICE(INTEL, 0xa0fe), LPSS_CNL_SSP }, | |
| 1460 | 1468 | { }, |
| 1461 | 1469 | }; |
| 1462 | 1470 | |
| @@ -1831,14 +1839,16 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) · 368 unmodified lines | ||
| 1831 | 1839 | status = devm_spi_register_controller(&pdev->dev, controller); |
| 1832 | 1840 | if (status != 0) { |
| 1833 | 1841 | dev_err(&pdev->dev, "problem registering spi controller\n"); |
| 1834 | − goto out_error_clock_enabled; | |
| 1842 | + goto out_error_pm_runtime_enabled; | |
| 1835 | 1843 | } |
| 1836 | 1844 | |
| 1837 | 1845 | return status; |
| 1838 | 1846 | |
| 1839 | −out_error_clock_enabled: | |
| 1847 | +out_error_pm_runtime_enabled: | |
| 1840 | 1848 | pm_runtime_put_noidle(&pdev->dev); |
| 1841 | 1849 | pm_runtime_disable(&pdev->dev); |
| 1850 | + | |
| 1851 | +out_error_clock_enabled: | |
| 1842 | 1852 | clk_disable_unprepare(ssp->clk); |
| 1843 | 1853 | |
| 1844 | 1854 | out_error_dma_irq_alloc: |
| @@ -8,11 +8,14 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/list.h> |
| 9 | 9 | #include <linux/slab.h> |
| 10 | 10 | #include <linux/swap.h> |
| 11 | +#include <linux/sched/signal.h> | |
| 11 | 12 | |
| 12 | 13 | #include "ion.h" |
| 13 | 14 | |
| 14 | 15 | static inline struct page *ion_page_pool_alloc_pages(struct ion_page_pool *pool) |
| 15 | 16 | { |
| 17 | + if (fatal_signal_pending(current)) | |
| 18 | + return NULL; | |
| 16 | 19 | return alloc_pages(pool->gfp_mask, pool->order); |
| 17 | 20 | } |
| 18 | 21 | |
| @@ -24,7 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | static int init_display(struct fbtft_par *par) |
| 26 | 26 | { |
| 27 | − if (!par->gpio.cs) | |
| 27 | + if (par->gpio.cs) | |
| 28 | 28 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 29 | 29 | |
| 30 | 30 | par->fbtftops.reset(par); |
| @@ -77,7 +77,7 @@ static int init_display(struct fbtft_par *par) · 76 unmodified lines | ||
| 77 | 77 | { |
| 78 | 78 | par->fbtftops.reset(par); |
| 79 | 79 | |
| 80 | − if (!par->gpio.cs) | |
| 80 | + if (par->gpio.cs) | |
| 81 | 81 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 82 | 82 | |
| 83 | 83 | write_reg(par, MIPI_DCS_SOFT_RESET); /* software reset */ |
| @@ -85,7 +85,7 @@ static int init_display(struct fbtft_par *par) · 84 unmodified lines | ||
| 85 | 85 | { |
| 86 | 86 | par->fbtftops.reset(par); |
| 87 | 87 | |
| 88 | − if (!par->gpio.cs) | |
| 88 | + if (par->gpio.cs) | |
| 89 | 89 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 90 | 90 | |
| 91 | 91 | bt &= 0x07; |
| @@ -29,7 +29,7 @@ static int init_display(struct fbtft_par *par) · 28 unmodified lines | ||
| 29 | 29 | { |
| 30 | 30 | par->fbtftops.reset(par); |
| 31 | 31 | |
| 32 | − if (!par->gpio.cs) | |
| 32 | + if (par->gpio.cs) | |
| 33 | 33 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 34 | 34 | |
| 35 | 35 | /* Initialization sequence from Lib_UTFT */ |
| @@ -28,7 +28,7 @@ static int init_display(struct fbtft_par *par) · 27 unmodified lines | ||
| 28 | 28 | { |
| 29 | 29 | par->fbtftops.reset(par); |
| 30 | 30 | |
| 31 | − if (!par->gpio.cs) | |
| 31 | + if (par->gpio.cs) | |
| 32 | 32 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 33 | 33 | |
| 34 | 34 | write_reg(par, 0x00, 0x0001); |
| @@ -81,7 +81,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) · 80 unmodified lines | ||
| 81 | 81 | va_start(args, len); |
| 82 | 82 | |
| 83 | 83 | *buf = (u8)va_arg(args, unsigned int); |
| 84 | − if (!par->gpio.dc) | |
| 84 | + if (par->gpio.dc) | |
| 85 | 85 | gpiod_set_value(par->gpio.dc, 0); |
| 86 | 86 | ret = par->fbtftops.write(par, par->buf, sizeof(u8)); |
| 87 | 87 | if (ret < 0) { |
| @@ -104,7 +104,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) · 16 unmodified lines | ||
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | − if (!par->gpio.dc) | |
| 107 | + if (par->gpio.dc) | |
| 108 | 108 | gpiod_set_value(par->gpio.dc, 1); |
| 109 | 109 | va_end(args); |
| 110 | 110 | } |
| @@ -26,7 +26,7 @@ static int init_display(struct fbtft_par *par) · 25 unmodified lines | ||
| 26 | 26 | { |
| 27 | 27 | par->fbtftops.reset(par); |
| 28 | 28 | |
| 29 | − if (!par->gpio.cs) | |
| 29 | + if (par->gpio.cs) | |
| 30 | 30 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 31 | 31 | |
| 32 | 32 | /* Initialization sequence from Lib_UTFT */ |
| @@ -135,7 +135,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) · 134 unmodified lines | ||
| 135 | 135 | remain = len / 2; |
| 136 | 136 | vmem16 = (u16 *)(par->info->screen_buffer + offset); |
| 137 | 137 | |
| 138 | − if (!par->gpio.dc) | |
| 138 | + if (par->gpio.dc) | |
| 139 | 139 | gpiod_set_value(par->gpio.dc, 1); |
| 140 | 140 | |
| 141 | 141 | /* non buffered write */ |
| @@ -76,21 +76,18 @@ static int fbtft_request_one_gpio(struct fbtft_par *par, · 75 unmodified lines | ||
| 76 | 76 | struct gpio_desc **gpiop) |
| 77 | 77 | { |
| 78 | 78 | struct device *dev = par->info->device; |
| 79 | − struct device_node *node = dev->of_node; | |
| 80 | 79 | int ret = 0; |
| 81 | 80 | |
| 82 | − if (of_find_property(node, name, NULL)) { | |
| 83 | − *gpiop = devm_gpiod_get_index(dev, dev->driver->name, index, | |
| 84 | − GPIOD_OUT_HIGH); | |
| 85 | − if (IS_ERR(*gpiop)) { | |
| 86 | − ret = PTR_ERR(*gpiop); | |
| 87 | − dev_err(dev, | |
| 88 | − "Failed to request %s GPIO:%d\n", name, ret); | |
| 89 | − return ret; | |
| 90 | − } | |
| 91 | − fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' GPIO\n", | |
| 92 | − __func__, name); | |
| 81 | + *gpiop = devm_gpiod_get_index_optional(dev, name, index, | |
| 82 | + GPIOD_OUT_HIGH); | |
| 83 | + if (IS_ERR(*gpiop)) { | |
| 84 | + ret = PTR_ERR(*gpiop); | |
| 85 | + dev_err(dev, | |
| 86 | + "Failed to request %s GPIO: %d\n", name, ret); | |
| 87 | + return ret; | |
| 93 | 88 | } |
| 89 | + fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' GPIO\n", | |
| 90 | + __func__, name); | |
| 94 | 91 | |
| 95 | 92 | return ret; |
| 96 | 93 | } |
| @@ -103,34 +100,34 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par) · 6 unmodified lines | ||
| 103 | 100 | if (!par->info->device->of_node) |
| 104 | 101 | return -EINVAL; |
| 105 | 102 | |
| 106 | − ret = fbtft_request_one_gpio(par, "reset-gpios", 0, &par->gpio.reset); | |
| 103 | + ret = fbtft_request_one_gpio(par, "reset", 0, &par->gpio.reset); | |
| 107 | 104 | if (ret) |
| 108 | 105 | return ret; |
| 109 | − ret = fbtft_request_one_gpio(par, "dc-gpios", 0, &par->gpio.dc); | |
| 106 | + ret = fbtft_request_one_gpio(par, "dc", 0, &par->gpio.dc); | |
| 110 | 107 | if (ret) |
| 111 | 108 | return ret; |
| 112 | − ret = fbtft_request_one_gpio(par, "rd-gpios", 0, &par->gpio.rd); | |
| 109 | + ret = fbtft_request_one_gpio(par, "rd", 0, &par->gpio.rd); | |
| 113 | 110 | if (ret) |
| 114 | 111 | return ret; |
| 115 | − ret = fbtft_request_one_gpio(par, "wr-gpios", 0, &par->gpio.wr); | |
| 112 | + ret = fbtft_request_one_gpio(par, "wr", 0, &par->gpio.wr); | |
| 116 | 113 | if (ret) |
| 117 | 114 | return ret; |
| 118 | − ret = fbtft_request_one_gpio(par, "cs-gpios", 0, &par->gpio.cs); | |
| 115 | + ret = fbtft_request_one_gpio(par, "cs", 0, &par->gpio.cs); | |
| 119 | 116 | if (ret) |
| 120 | 117 | return ret; |
| 121 | − ret = fbtft_request_one_gpio(par, "latch-gpios", 0, &par->gpio.latch); | |
| 118 | + ret = fbtft_request_one_gpio(par, "latch", 0, &par->gpio.latch); | |
| 122 | 119 | if (ret) |
| 123 | 120 | return ret; |
| 124 | 121 | for (i = 0; i < 16; i++) { |
| 125 | − ret = fbtft_request_one_gpio(par, "db-gpios", i, | |
| 122 | + ret = fbtft_request_one_gpio(par, "db", i, | |
| 126 | 123 | &par->gpio.db[i]); |
| 127 | 124 | if (ret) |
| 128 | 125 | return ret; |
| 129 | − ret = fbtft_request_one_gpio(par, "led-gpios", i, | |
| 126 | + ret = fbtft_request_one_gpio(par, "led", i, | |
| 130 | 127 | &par->gpio.led[i]); |
| 131 | 128 | if (ret) |
| 132 | 129 | return ret; |
| 133 | − ret = fbtft_request_one_gpio(par, "aux-gpios", i, | |
| 130 | + ret = fbtft_request_one_gpio(par, "aux", i, | |
| 134 | 131 | &par->gpio.aux[i]); |
| 135 | 132 | if (ret) |
| 136 | 133 | return ret; |
| @@ -234,9 +231,9 @@ static void fbtft_reset(struct fbtft_par *par) · 97 unmodified lines | ||
| 234 | 231 | if (!par->gpio.reset) |
| 235 | 232 | return; |
| 236 | 233 | fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__); |
| 237 | − gpiod_set_value_cansleep(par->gpio.reset, 0); | |
| 238 | − usleep_range(20, 40); | |
| 239 | 234 | gpiod_set_value_cansleep(par->gpio.reset, 1); |
| 235 | + usleep_range(20, 40); | |
| 236 | + gpiod_set_value_cansleep(par->gpio.reset, 0); | |
| 240 | 237 | msleep(120); |
| 241 | 238 | } |
| 242 | 239 | |
| @@ -921,7 +918,7 @@ static int fbtft_init_display_dt(struct fbtft_par *par) · 678 unmodified lines | ||
| 921 | 918 | return -EINVAL; |
| 922 | 919 | |
| 923 | 920 | par->fbtftops.reset(par); |
| 924 | − if (!par->gpio.cs) | |
| 921 | + if (par->gpio.cs) | |
| 925 | 922 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 926 | 923 | |
| 927 | 924 | while (p) { |
| @@ -1012,7 +1009,7 @@ int fbtft_init_display(struct fbtft_par *par) · 84 unmodified lines | ||
| 1012 | 1009 | } |
| 1013 | 1010 | |
| 1014 | 1011 | par->fbtftops.reset(par); |
| 1015 | − if (!par->gpio.cs) | |
| 1012 | + if (par->gpio.cs) | |
| 1016 | 1013 | gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
| 1017 | 1014 | |
| 1018 | 1015 | i = 0; |
| @@ -532,7 +532,7 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, · 531 unmodified lines | ||
| 532 | 532 | break; |
| 533 | 533 | case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE: |
| 534 | 534 | ret = scnprintf(buf, PAGE_SIZE, "%u\n", |
| 535 | − gasket_page_table_num_entries( | |
| 535 | + gasket_page_table_num_simple_entries( | |
| 536 | 536 | gasket_dev->page_table[0])); |
| 537 | 537 | break; |
| 538 | 538 | case ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES: |
| @@ -1750,7 +1750,8 @@ static int visornic_poll(struct napi_struct *napi, int budget) · 1749 unmodified lines | ||
| 1750 | 1750 | } |
| 1751 | 1751 | |
| 1752 | 1752 | /* poll_for_irq - checks the status of the response queue |
| 1753 | − * @v: Void pointer to the visronic devdata struct. | |
| 1753 | + * @t: pointer to the 'struct timer_list' from which we can retrieve the | |
| 1754 | + * the visornic devdata struct. | |
| 1754 | 1755 | * |
| 1755 | 1756 | * Main function of the vnic_incoming thread. Periodically check the response |
| 1756 | 1757 | * queue and drain it if needed. |
| @@ -1969,6 +1969,7 @@ void wilc_deinit_host_int(struct net_device *net) · 1968 unmodified lines | ||
| 1969 | 1969 | |
| 1970 | 1970 | priv->p2p_listen_state = false; |
| 1971 | 1971 | |
| 1972 | + flush_workqueue(vif->wilc->hif_workqueue); | |
| 1972 | 1973 | mutex_destroy(&priv->scan_req_lock); |
| 1973 | 1974 | ret = wilc_deinit(vif); |
| 1974 | 1975 | |
| @@ -277,10 +277,14 @@ static void kgdboc_pre_exp_handler(void) · 276 unmodified lines | ||
| 277 | 277 | /* Increment the module count when the debugger is active */ |
| 278 | 278 | if (!kgdb_connected) |
| 279 | 279 | try_module_get(THIS_MODULE); |
| 280 | + | |
| 281 | + atomic_inc(&ignore_console_lock_warning); | |
| 280 | 282 | } |
| 281 | 283 | |
| 282 | 284 | static void kgdboc_post_exp_handler(void) |
| 283 | 285 | { |
| 286 | + atomic_dec(&ignore_console_lock_warning); | |
| 287 | + | |
| 284 | 288 | /* decrement the module count when the debugger detaches */ |
| 285 | 289 | if (!kgdb_connected) |
| 286 | 290 | module_put(THIS_MODULE); |
| @@ -1812,8 +1812,6 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 1811 unmodified lines | ||
| 1812 | 1812 | return 0; |
| 1813 | 1813 | |
| 1814 | 1814 | error: |
| 1815 | − if (as && as->usbm) | |
| 1816 | − dec_usb_memory_use_count(as->usbm, &as->usbm->urb_use_count); | |
| 1817 | 1815 | kfree(isopkt); |
| 1818 | 1816 | kfree(dr); |
| 1819 | 1817 | if (as) |
| @@ -103,11 +103,6 @@ static DEFINE_SPINLOCK(hcd_urb_unlink_lock); · 102 unmodified lines | ||
| 103 | 103 | /* wait queue for synchronous unlinks */ |
| 104 | 104 | DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue); |
| 105 | 105 | |
| 106 | −static inline int is_root_hub(struct usb_device *udev) | |
| 107 | −{ | |
| 108 | − return (udev->parent == NULL); | |
| 109 | −} | |
| 110 | − | |
| 111 | 106 | /*-------------------------------------------------------------------------*/ |
| 112 | 107 | |
| 113 | 108 | /* |
| @@ -880,101 +875,6 @@ static int usb_rh_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) · 766 unmodified lines | ||
| 880 | 875 | } |
| 881 | 876 | |
| 882 | 877 | |
| 883 | − | |
| 884 | −/* | |
| 885 | − * Show & store the current value of authorized_default | |
| 886 | − */ | |
| 887 | −static ssize_t authorized_default_show(struct device *dev, | |
| 888 | − struct device_attribute *attr, char *buf) | |
| 889 | −{ | |
| 890 | − struct usb_device *rh_usb_dev = to_usb_device(dev); | |
| 891 | − struct usb_bus *usb_bus = rh_usb_dev->bus; | |
| 892 | − struct usb_hcd *hcd; | |
| 893 | − | |
| 894 | − hcd = bus_to_hcd(usb_bus); | |
| 895 | − return snprintf(buf, PAGE_SIZE, "%u\n", hcd->dev_policy); | |
| 896 | −} | |
| 897 | − | |
| 898 | −static ssize_t authorized_default_store(struct device *dev, | |
| 899 | − struct device_attribute *attr, | |
| 900 | − const char *buf, size_t size) | |
| 901 | −{ | |
| 902 | − ssize_t result; | |
| 903 | − unsigned val; | |
| 904 | − struct usb_device *rh_usb_dev = to_usb_device(dev); | |
| 905 | − struct usb_bus *usb_bus = rh_usb_dev->bus; | |
| 906 | − struct usb_hcd *hcd; | |
| 907 | − | |
| 908 | − hcd = bus_to_hcd(usb_bus); | |
| 909 | − result = sscanf(buf, "%u\n", &val); | |
| 910 | − if (result == 1) { | |
| 911 | − hcd->dev_policy = val <= USB_DEVICE_AUTHORIZE_INTERNAL ? | |
| 912 | − val : USB_DEVICE_AUTHORIZE_ALL; | |
| 913 | − result = size; | |
| 914 | − } else { | |
| 915 | − result = -EINVAL; | |
| 916 | − } | |
| 917 | − return result; | |
| 918 | −} | |
| 919 | −static DEVICE_ATTR_RW(authorized_default); | |
| 920 | − | |
| 921 | −/* | |
| 922 | − * interface_authorized_default_show - show default authorization status | |
| 923 | − * for USB interfaces | |
| 924 | − * | |
| 925 | − * note: interface_authorized_default is the default value | |
| 926 | − * for initializing the authorized attribute of interfaces | |
| 927 | − */ | |
| 928 | −static ssize_t interface_authorized_default_show(struct device *dev, | |
| 929 | − struct device_attribute *attr, char *buf) | |
| 930 | −{ | |
| 931 | − struct usb_device *usb_dev = to_usb_device(dev); | |
| 932 | − struct usb_hcd *hcd = bus_to_hcd(usb_dev->bus); | |
| 933 | − | |
| 934 | − return sprintf(buf, "%u\n", !!HCD_INTF_AUTHORIZED(hcd)); | |
| 935 | −} | |
| 936 | − | |
| 937 | −/* | |
| 938 | − * interface_authorized_default_store - store default authorization status | |
| 939 | − * for USB interfaces | |
| 940 | − * | |
| 941 | − * note: interface_authorized_default is the default value | |
| 942 | − * for initializing the authorized attribute of interfaces | |
| 943 | − */ | |
| 944 | −static ssize_t interface_authorized_default_store(struct device *dev, | |
| 945 | − struct device_attribute *attr, const char *buf, size_t count) | |
| 946 | −{ | |
| 947 | − struct usb_device *usb_dev = to_usb_device(dev); | |
| 948 | − struct usb_hcd *hcd = bus_to_hcd(usb_dev->bus); | |
| 949 | − int rc = count; | |
| 950 | − bool val; | |
| 951 | − | |
| 952 | − if (strtobool(buf, &val) != 0) | |
| 953 | − return -EINVAL; | |
| 954 | − | |
| 955 | − if (val) | |
| 956 | − set_bit(HCD_FLAG_INTF_AUTHORIZED, &hcd->flags); | |
| 957 | − else | |
| 958 | − clear_bit(HCD_FLAG_INTF_AUTHORIZED, &hcd->flags); | |
| 959 | − | |
| 960 | − return rc; | |
| 961 | −} | |
| 962 | −static DEVICE_ATTR_RW(interface_authorized_default); | |
| 963 | − | |
| 964 | −/* Group all the USB bus attributes */ | |
| 965 | −static struct attribute *usb_bus_attrs[] = { | |
| 966 | − &dev_attr_authorized_default.attr, | |
| 967 | − &dev_attr_interface_authorized_default.attr, | |
| 968 | − NULL, | |
| 969 | −}; | |
| 970 | − | |
| 971 | −static const struct attribute_group usb_bus_attr_group = { | |
| 972 | − .name = NULL, /* we want them in the same directory */ | |
| 973 | − .attrs = usb_bus_attrs, | |
| 974 | −}; | |
| 975 | − | |
| 976 | − | |
| 977 | − | |
| 978 | 878 | /*-------------------------------------------------------------------------*/ |
| 979 | 879 | |
| 980 | 880 | /** |
| @@ -2894,32 +2794,11 @@ int usb_add_hcd(struct usb_hcd *hcd, · 1913 unmodified lines | ||
| 2894 | 2794 | if (retval != 0) |
| 2895 | 2795 | goto err_register_root_hub; |
| 2896 | 2796 | |
| 2897 | − retval = sysfs_create_group(&rhdev->dev.kobj, &usb_bus_attr_group); | |
| 2898 | − if (retval < 0) { | |
| 2899 | − printk(KERN_ERR "Cannot register USB bus sysfs attributes: %d\n", | |
| 2900 | − retval); | |
| 2901 | − goto error_create_attr_group; | |
| 2902 | − } | |
| 2903 | 2797 | if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) |
| 2904 | 2798 | usb_hcd_poll_rh_status(hcd); |
| 2905 | 2799 | |
| 2906 | 2800 | return retval; |
| 2907 | 2801 | |
| 2908 | −error_create_attr_group: | |
| 2909 | − clear_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); | |
| 2910 | − if (HC_IS_RUNNING(hcd->state)) | |
| 2911 | − hcd->state = HC_STATE_QUIESCING; | |
| 2912 | − spin_lock_irq(&hcd_root_hub_lock); | |
| 2913 | − hcd->rh_registered = 0; | |
| 2914 | − spin_unlock_irq(&hcd_root_hub_lock); | |
| 2915 | − | |
| 2916 | −#ifdef CONFIG_PM | |
| 2917 | − cancel_work_sync(&hcd->wakeup_work); | |
| 2918 | −#endif | |
| 2919 | − cancel_work_sync(&hcd->died_work); | |
| 2920 | − mutex_lock(&usb_bus_idr_lock); | |
| 2921 | − usb_disconnect(&rhdev); /* Sets rhdev to NULL */ | |
| 2922 | − mutex_unlock(&usb_bus_idr_lock); | |
| 2923 | 2802 | err_register_root_hub: |
| 2924 | 2803 | hcd->rh_pollable = 0; |
| 2925 | 2804 | clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
| @@ -2963,8 +2842,6 @@ void usb_remove_hcd(struct usb_hcd *hcd) · 37 unmodified lines | ||
| 2963 | 2842 | dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); |
| 2964 | 2843 | |
| 2965 | 2844 | usb_get_dev(rhdev); |
| 2966 | − sysfs_remove_group(&rhdev->dev.kobj, &usb_bus_attr_group); | |
| 2967 | − | |
| 2968 | 2845 | clear_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); |
| 2969 | 2846 | if (HC_IS_RUNNING (hcd->state)) |
| 2970 | 2847 | hcd->state = HC_STATE_QUIESCING; |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/kernel.h> |
| 16 | 16 | #include <linux/string.h> |
| 17 | 17 | #include <linux/usb.h> |
| 18 | +#include <linux/usb/hcd.h> | |
| 18 | 19 | #include <linux/usb/quirks.h> |
| 19 | 20 | #include <linux/of.h> |
| 20 | 21 | #include "usb.h" |
| @@ -922,6 +923,116 @@ static struct bin_attribute dev_bin_attr_descriptors = { · 901 unmodified lines | ||
| 922 | 923 | .size = 18 + 65535, /* dev descr + max-size raw descriptor */ |
| 923 | 924 | }; |
| 924 | 925 | |
| 926 | +/* | |
| 927 | + * Show & store the current value of authorized_default | |
| 928 | + */ | |
| 929 | +static ssize_t authorized_default_show(struct device *dev, | |
| 930 | + struct device_attribute *attr, char *buf) | |
| 931 | +{ | |
| 932 | + struct usb_device *rh_usb_dev = to_usb_device(dev); | |
| 933 | + struct usb_bus *usb_bus = rh_usb_dev->bus; | |
| 934 | + struct usb_hcd *hcd; | |
| 935 | + | |
| 936 | + hcd = bus_to_hcd(usb_bus); | |
| 937 | + return snprintf(buf, PAGE_SIZE, "%u\n", hcd->dev_policy); | |
| 938 | +} | |
| 939 | + | |
| 940 | +static ssize_t authorized_default_store(struct device *dev, | |
| 941 | + struct device_attribute *attr, | |
| 942 | + const char *buf, size_t size) | |
| 943 | +{ | |
| 944 | + ssize_t result; | |
| 945 | + unsigned int val; | |
| 946 | + struct usb_device *rh_usb_dev = to_usb_device(dev); | |
| 947 | + struct usb_bus *usb_bus = rh_usb_dev->bus; | |
| 948 | + struct usb_hcd *hcd; | |
| 949 | + | |
| 950 | + hcd = bus_to_hcd(usb_bus); | |
| 951 | + result = sscanf(buf, "%u\n", &val); | |
| 952 | + if (result == 1) { | |
| 953 | + hcd->dev_policy = val <= USB_DEVICE_AUTHORIZE_INTERNAL ? | |
| 954 | + val : USB_DEVICE_AUTHORIZE_ALL; | |
| 955 | + result = size; | |
| 956 | + } else { | |
| 957 | + result = -EINVAL; | |
| 958 | + } | |
| 959 | + return result; | |
| 960 | +} | |
| 961 | +static DEVICE_ATTR_RW(authorized_default); | |
| 962 | + | |
| 963 | +/* | |
| 964 | + * interface_authorized_default_show - show default authorization status | |
| 965 | + * for USB interfaces | |
| 966 | + * | |
| 967 | + * note: interface_authorized_default is the default value | |
| 968 | + * for initializing the authorized attribute of interfaces | |
| 969 | + */ | |
| 970 | +static ssize_t interface_authorized_default_show(struct device *dev, | |
| 971 | + struct device_attribute *attr, char *buf) | |
| 972 | +{ | |
| 973 | + struct usb_device *usb_dev = to_usb_device(dev); | |
| 974 | + struct usb_hcd *hcd = bus_to_hcd(usb_dev->bus); | |
| 975 | + | |
| 976 | + return sprintf(buf, "%u\n", !!HCD_INTF_AUTHORIZED(hcd)); | |
| 977 | +} | |
| 978 | + | |
| 979 | +/* | |
| 980 | + * interface_authorized_default_store - store default authorization status | |
| 981 | + * for USB interfaces | |
| 982 | + * | |
| 983 | + * note: interface_authorized_default is the default value | |
| 984 | + * for initializing the authorized attribute of interfaces | |
| 985 | + */ | |
| 986 | +static ssize_t interface_authorized_default_store(struct device *dev, | |
| 987 | + struct device_attribute *attr, const char *buf, size_t count) | |
| 988 | +{ | |
| 989 | + struct usb_device *usb_dev = to_usb_device(dev); | |
| 990 | + struct usb_hcd *hcd = bus_to_hcd(usb_dev->bus); | |
| 991 | + int rc = count; | |
| 992 | + bool val; | |
| 993 | + | |
| 994 | + if (strtobool(buf, &val) != 0) | |
| 995 | + return -EINVAL; | |
| 996 | + | |
| 997 | + if (val) | |
| 998 | + set_bit(HCD_FLAG_INTF_AUTHORIZED, &hcd->flags); | |
| 999 | + else | |
| 1000 | + clear_bit(HCD_FLAG_INTF_AUTHORIZED, &hcd->flags); | |
| 1001 | + | |
| 1002 | + return rc; | |
| 1003 | +} | |
| 1004 | +static DEVICE_ATTR_RW(interface_authorized_default); | |
| 1005 | + | |
| 1006 | +/* Group all the USB bus attributes */ | |
| 1007 | +static struct attribute *usb_bus_attrs[] = { | |
| 1008 | + &dev_attr_authorized_default.attr, | |
| 1009 | + &dev_attr_interface_authorized_default.attr, | |
| 1010 | + NULL, | |
| 1011 | +}; | |
| 1012 | + | |
| 1013 | +static const struct attribute_group usb_bus_attr_group = { | |
| 1014 | + .name = NULL, /* we want them in the same directory */ | |
| 1015 | + .attrs = usb_bus_attrs, | |
| 1016 | +}; | |
| 1017 | + | |
| 1018 | + | |
| 1019 | +static int add_default_authorized_attributes(struct device *dev) | |
| 1020 | +{ | |
| 1021 | + int rc = 0; | |
| 1022 | + | |
| 1023 | + if (is_usb_device(dev)) | |
| 1024 | + rc = sysfs_create_group(&dev->kobj, &usb_bus_attr_group); | |
| 1025 | + | |
| 1026 | + return rc; | |
| 1027 | +} | |
| 1028 | + | |
| 1029 | +static void remove_default_authorized_attributes(struct device *dev) | |
| 1030 | +{ | |
| 1031 | + if (is_usb_device(dev)) { | |
| 1032 | + sysfs_remove_group(&dev->kobj, &usb_bus_attr_group); | |
| 1033 | + } | |
| 1034 | +} | |
| 1035 | + | |
| 925 | 1036 | int usb_create_sysfs_dev_files(struct usb_device *udev) |
| 926 | 1037 | { |
| 927 | 1038 | struct device *dev = &udev->dev; |
| @@ -938,7 +1049,14 @@ int usb_create_sysfs_dev_files(struct usb_device *udev) · 10 unmodified lines | ||
| 938 | 1049 | retval = add_power_attributes(dev); |
| 939 | 1050 | if (retval) |
| 940 | 1051 | goto error; |
| 1052 | + | |
| 1053 | + if (is_root_hub(udev)) { | |
| 1054 | + retval = add_default_authorized_attributes(dev); | |
| 1055 | + if (retval) | |
| 1056 | + goto error; | |
| 1057 | + } | |
| 941 | 1058 | return retval; |
| 1059 | + | |
| 942 | 1060 | error: |
| 943 | 1061 | usb_remove_sysfs_dev_files(udev); |
| 944 | 1062 | return retval; |
| @@ -948,6 +1066,9 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev) · 3 unmodified lines | ||
| 948 | 1066 | { |
| 949 | 1067 | struct device *dev = &udev->dev; |
| 950 | 1068 | |
| 1069 | + if (is_root_hub(udev)) | |
| 1070 | + remove_default_authorized_attributes(dev); | |
| 1071 | + | |
| 951 | 1072 | remove_power_attributes(dev); |
| 952 | 1073 | remove_persist_attributes(dev); |
| 953 | 1074 | device_remove_bin_file(dev, &dev_bin_attr_descriptors); |
| @@ -153,6 +153,11 @@ static inline int is_usb_port(const struct device *dev) · 152 unmodified lines | ||
| 153 | 153 | return dev->type == &usb_port_device_type; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | +static inline int is_root_hub(struct usb_device *udev) | |
| 157 | +{ | |
| 158 | + return (udev->parent == NULL); | |
| 159 | +} | |
| 160 | + | |
| 156 | 161 | /* Do the same for device drivers and interface drivers. */ |
| 157 | 162 | |
| 158 | 163 | static inline int is_usb_device_driver(struct device_driver *drv) |
| @@ -238,10 +238,15 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd) · 237 unmodified lines | ||
| 238 | 238 | * pointers. So, this driver clears the AC64 bit of xhci->hcc_params |
| 239 | 239 | * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in |
| 240 | 240 | * xhci_gen_setup(). |
| 241 | + * | |
| 242 | + * And, since the firmware/internal CPU control the USBSTS.STS_HALT | |
| 243 | + * and the process speed is down when the roothub port enters U3, | |
| 244 | + * long delay for the handshake of STS_HALT is neeed in xhci_suspend(). | |
| 241 | 245 | */ |
| 242 | 246 | if (xhci_rcar_is_gen2(hcd->self.controller) || |
| 243 | − xhci_rcar_is_gen3(hcd->self.controller)) | |
| 244 | − xhci->quirks |= XHCI_NO_64BIT_SUPPORT; | |
| 247 | + xhci_rcar_is_gen3(hcd->self.controller)) { | |
| 248 | + xhci->quirks |= XHCI_NO_64BIT_SUPPORT | XHCI_SLOW_SUSPEND; | |
| 249 | + } | |
| 245 | 250 | |
| 246 | 251 | if (!xhci_rcar_wait_for_pll_active(hcd)) |
| 247 | 252 | return -ETIMEDOUT; |
| @@ -3089,8 +3089,18 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, · 3088 unmodified lines | ||
| 3089 | 3089 | return; |
| 3090 | 3090 | udev = (struct usb_device *) host_ep->hcpriv; |
| 3091 | 3091 | vdev = xhci->devs[udev->slot_id]; |
| 3092 | + | |
| 3093 | + /* | |
| 3094 | + * vdev may be lost due to xHC restore error and re-initialization | |
| 3095 | + * during S3/S4 resume. A new vdev will be allocated later by | |
| 3096 | + * xhci_discover_or_reset_device() | |
| 3097 | + */ | |
| 3098 | + if (!udev->slot_id || !vdev) | |
| 3099 | + return; | |
| 3092 | 3100 | ep_index = xhci_get_endpoint_index(&host_ep->desc); |
| 3093 | 3101 | ep = &vdev->eps[ep_index]; |
| 3102 | + if (!ep) | |
| 3103 | + return; | |
| 3094 | 3104 | |
| 3095 | 3105 | /* Bail out if toggle is already being cleared by a endpoint reset */ |
| 3096 | 3106 | if (ep->ep_state & EP_HARD_CLEAR_TOGGLE) { |
| @@ -866,19 +866,20 @@ static void iowarrior_disconnect(struct usb_interface *interface) · 865 unmodified lines | ||
| 866 | 866 | dev = usb_get_intfdata(interface); |
| 867 | 867 | mutex_lock(&iowarrior_open_disc_lock); |
| 868 | 868 | usb_set_intfdata(interface, NULL); |
| 869 | + /* prevent device read, write and ioctl */ | |
| 870 | + dev->present = 0; | |
| 869 | 871 | |
| 870 | 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*/ | |
| 871 | 875 | |
| 872 | − /* give back our minor */ | |
| 873 | 876 | usb_deregister_dev(interface, &iowarrior_class); |
| 874 | 877 | |
| 875 | 878 | mutex_lock(&dev->mutex); |
| 876 | 879 | |
| 877 | 880 | /* prevent device read, write and ioctl */ |
| 878 | − dev->present = 0; | |
| 879 | 881 | |
| 880 | 882 | mutex_unlock(&dev->mutex); |
| 881 | − mutex_unlock(&iowarrior_open_disc_lock); | |
| 882 | 883 | |
| 883 | 884 | if (dev->opened) { |
| 884 | 885 | /* There is a process that holds a filedescriptor to the device , |
| @@ -51,6 +51,7 @@ struct rio_usb_data { · 50 unmodified lines | ||
| 51 | 51 | char *obuf, *ibuf; /* transfer buffers */ |
| 52 | 52 | char bulk_in_ep, bulk_out_ep; /* Endpoint assignments */ |
| 53 | 53 | wait_queue_head_t wait_q; /* for timeouts */ |
| 54 | + struct mutex lock; /* general race avoidance */ | |
| 54 | 55 | }; |
| 55 | 56 | |
| 56 | 57 | static DEFINE_MUTEX(rio500_mutex); |
| @@ -62,8 +63,10 @@ static int open_rio(struct inode *inode, struct file *file) · 5 unmodified lines | ||
| 62 | 63 | |
| 63 | 64 | /* against disconnect() */ |
| 64 | 65 | mutex_lock(&rio500_mutex); |
| 66 | + mutex_lock(&(rio->lock)); | |
| 65 | 67 | |
| 66 | 68 | if (rio->isopen || !rio->present) { |
| 69 | + mutex_unlock(&(rio->lock)); | |
| 67 | 70 | mutex_unlock(&rio500_mutex); |
| 68 | 71 | return -EBUSY; |
| 69 | 72 | } |
| @@ -71,6 +74,7 @@ static int open_rio(struct inode *inode, struct file *file) · 1 unmodified line | ||
| 71 | 74 | |
| 72 | 75 | init_waitqueue_head(&rio->wait_q); |
| 73 | 76 | |
| 77 | + mutex_unlock(&(rio->lock)); | |
| 74 | 78 | |
| 75 | 79 | dev_info(&rio->rio_dev->dev, "Rio opened.\n"); |
| 76 | 80 | mutex_unlock(&rio500_mutex); |
| @@ -84,6 +88,7 @@ static int close_rio(struct inode *inode, struct file *file) · 7 unmodified lines | ||
| 84 | 88 | |
| 85 | 89 | /* against disconnect() */ |
| 86 | 90 | mutex_lock(&rio500_mutex); |
| 91 | + mutex_lock(&(rio->lock)); | |
| 87 | 92 | |
| 88 | 93 | rio->isopen = 0; |
| 89 | 94 | if (!rio->present) { |
| @@ -95,6 +100,7 @@ static int close_rio(struct inode *inode, struct file *file) · 5 unmodified lines | ||
| 95 | 100 | } else { |
| 96 | 101 | dev_info(&rio->rio_dev->dev, "Rio closed.\n"); |
| 97 | 102 | } |
| 103 | + mutex_unlock(&(rio->lock)); | |
| 98 | 104 | mutex_unlock(&rio500_mutex); |
| 99 | 105 | return 0; |
| 100 | 106 | } |
| @@ -109,7 +115,7 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) · 8 unmodified lines | ||
| 109 | 115 | int retries; |
| 110 | 116 | int retval=0; |
| 111 | 117 | |
| 112 | − mutex_lock(&rio500_mutex); | |
| 118 | + mutex_lock(&(rio->lock)); | |
| 113 | 119 | /* Sanity check to make sure rio is connected, powered, etc */ |
| 114 | 120 | if (rio->present == 0 || rio->rio_dev == NULL) { |
| 115 | 121 | retval = -ENODEV; |
| @@ -253,7 +259,7 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) · 137 unmodified lines | ||
| 253 | 259 | |
| 254 | 260 | |
| 255 | 261 | err_out: |
| 256 | − mutex_unlock(&rio500_mutex); | |
| 262 | + mutex_unlock(&(rio->lock)); | |
| 257 | 263 | return retval; |
| 258 | 264 | } |
| 259 | 265 | |
| @@ -273,12 +279,12 @@ write_rio(struct file *file, const char __user *buffer, · 13 unmodified lines | ||
| 273 | 279 | int errn = 0; |
| 274 | 280 | int intr; |
| 275 | 281 | |
| 276 | − intr = mutex_lock_interruptible(&rio500_mutex); | |
| 282 | + intr = mutex_lock_interruptible(&(rio->lock)); | |
| 277 | 283 | if (intr) |
| 278 | 284 | return -EINTR; |
| 279 | 285 | /* Sanity check to make sure rio is connected, powered, etc */ |
| 280 | 286 | if (rio->present == 0 || rio->rio_dev == NULL) { |
| 281 | − mutex_unlock(&rio500_mutex); | |
| 287 | + mutex_unlock(&(rio->lock)); | |
| 282 | 288 | return -ENODEV; |
| 283 | 289 | } |
| 284 | 290 | |
| @@ -301,7 +307,7 @@ write_rio(struct file *file, const char __user *buffer, · 16 unmodified lines | ||
| 301 | 307 | goto error; |
| 302 | 308 | } |
| 303 | 309 | if (signal_pending(current)) { |
| 304 | − mutex_unlock(&rio500_mutex); | |
| 310 | + mutex_unlock(&(rio->lock)); | |
| 305 | 311 | return bytes_written ? bytes_written : -EINTR; |
| 306 | 312 | } |
| 307 | 313 | |
| @@ -339,12 +345,12 @@ write_rio(struct file *file, const char __user *buffer, · 31 unmodified lines | ||
| 339 | 345 | buffer += copy_size; |
| 340 | 346 | } while (count > 0); |
| 341 | 347 | |
| 342 | − mutex_unlock(&rio500_mutex); | |
| 348 | + mutex_unlock(&(rio->lock)); | |
| 343 | 349 | |
| 344 | 350 | return bytes_written ? bytes_written : -EIO; |
| 345 | 351 | |
| 346 | 352 | error: |
| 347 | − mutex_unlock(&rio500_mutex); | |
| 353 | + mutex_unlock(&(rio->lock)); | |
| 348 | 354 | return errn; |
| 349 | 355 | } |
| 350 | 356 | |
| @@ -361,12 +367,12 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) · 10 unmodified lines | ||
| 361 | 367 | char *ibuf; |
| 362 | 368 | int intr; |
| 363 | 369 | |
| 364 | − intr = mutex_lock_interruptible(&rio500_mutex); | |
| 370 | + intr = mutex_lock_interruptible(&(rio->lock)); | |
| 365 | 371 | if (intr) |
| 366 | 372 | return -EINTR; |
| 367 | 373 | /* Sanity check to make sure rio is connected, powered, etc */ |
| 368 | 374 | if (rio->present == 0 || rio->rio_dev == NULL) { |
| 369 | − mutex_unlock(&rio500_mutex); | |
| 375 | + mutex_unlock(&(rio->lock)); | |
| 370 | 376 | return -ENODEV; |
| 371 | 377 | } |
| 372 | 378 | |
| @@ -377,11 +383,11 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) · 4 unmodified lines | ||
| 377 | 383 | |
| 378 | 384 | while (count > 0) { |
| 379 | 385 | if (signal_pending(current)) { |
| 380 | − mutex_unlock(&rio500_mutex); | |
| 386 | + mutex_unlock(&(rio->lock)); | |
| 381 | 387 | return read_count ? read_count : -EINTR; |
| 382 | 388 | } |
| 383 | 389 | if (!rio->rio_dev) { |
| 384 | − mutex_unlock(&rio500_mutex); | |
| 390 | + mutex_unlock(&(rio->lock)); | |
| 385 | 391 | return -ENODEV; |
| 386 | 392 | } |
| 387 | 393 | this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count; |
| @@ -399,7 +405,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) · 11 unmodified lines | ||
| 399 | 405 | count = this_read = partial; |
| 400 | 406 | } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */ |
| 401 | 407 | if (!maxretry--) { |
| 402 | − mutex_unlock(&rio500_mutex); | |
| 408 | + mutex_unlock(&(rio->lock)); | |
| 403 | 409 | dev_err(&rio->rio_dev->dev, |
| 404 | 410 | "read_rio: maxretry timeout\n"); |
| 405 | 411 | return -ETIME; |
| @@ -409,19 +415,19 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) · 3 unmodified lines | ||
| 409 | 415 | finish_wait(&rio->wait_q, &wait); |
| 410 | 416 | continue; |
| 411 | 417 | } else if (result != -EREMOTEIO) { |
| 412 | − mutex_unlock(&rio500_mutex); | |
| 418 | + mutex_unlock(&(rio->lock)); | |
| 413 | 419 | dev_err(&rio->rio_dev->dev, |
| 414 | 420 | "Read Whoops - result:%d partial:%u this_read:%u\n", |
| 415 | 421 | result, partial, this_read); |
| 416 | 422 | return -EIO; |
| 417 | 423 | } else { |
| 418 | − mutex_unlock(&rio500_mutex); | |
| 424 | + mutex_unlock(&(rio->lock)); | |
| 419 | 425 | return (0); |
| 420 | 426 | } |
| 421 | 427 | |
| 422 | 428 | if (this_read) { |
| 423 | 429 | if (copy_to_user(buffer, ibuf, this_read)) { |
| 424 | − mutex_unlock(&rio500_mutex); | |
| 430 | + mutex_unlock(&(rio->lock)); | |
| 425 | 431 | return -EFAULT; |
| 426 | 432 | } |
| 427 | 433 | count -= this_read; |
| @@ -429,7 +435,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) · 1 unmodified line | ||
| 429 | 435 | buffer += this_read; |
| 430 | 436 | } |
| 431 | 437 | } |
| 432 | − mutex_unlock(&rio500_mutex); | |
| 438 | + mutex_unlock(&(rio->lock)); | |
| 433 | 439 | return read_count; |
| 434 | 440 | } |
| 435 | 441 | |
| @@ -494,6 +500,8 @@ static int probe_rio(struct usb_interface *intf, · 58 unmodified lines | ||
| 494 | 500 | } |
| 495 | 501 | dev_dbg(&intf->dev, "ibuf address:%p\n", rio->ibuf); |
| 496 | 502 | |
| 503 | + mutex_init(&(rio->lock)); | |
| 504 | + | |
| 497 | 505 | usb_set_intfdata (intf, rio); |
| 498 | 506 | rio->present = 1; |
| 499 | 507 | bail_out: |
| @@ -511,10 +519,12 @@ static void disconnect_rio(struct usb_interface *intf) · 11 unmodified lines | ||
| 511 | 519 | if (rio) { |
| 512 | 520 | usb_deregister_dev(intf, &usb_rio_class); |
| 513 | 521 | |
| 522 | + mutex_lock(&(rio->lock)); | |
| 514 | 523 | if (rio->isopen) { |
| 515 | 524 | rio->isopen = 0; |
| 516 | 525 | /* better let it finish - the release will do whats needed */ |
| 517 | 526 | rio->rio_dev = NULL; |
| 527 | + mutex_unlock(&(rio->lock)); | |
| 518 | 528 | mutex_unlock(&rio500_mutex); |
| 519 | 529 | return; |
| 520 | 530 | } |
| @@ -524,6 +534,7 @@ static void disconnect_rio(struct usb_interface *intf) · 3 unmodified lines | ||
| 524 | 534 | dev_info(&intf->dev, "USB Rio disconnected.\n"); |
| 525 | 535 | |
| 526 | 536 | rio->present = 0; |
| 537 | + mutex_unlock(&(rio->lock)); | |
| 527 | 538 | } |
| 528 | 539 | mutex_unlock(&rio500_mutex); |
| 529 | 540 | } |
| @@ -92,7 +92,6 @@ static void yurex_delete(struct kref *kref) · 91 unmodified lines | ||
| 92 | 92 | |
| 93 | 93 | dev_dbg(&dev->interface->dev, "%s\n", __func__); |
| 94 | 94 | |
| 95 | − usb_put_dev(dev->udev); | |
| 96 | 95 | if (dev->cntl_urb) { |
| 97 | 96 | usb_kill_urb(dev->cntl_urb); |
| 98 | 97 | kfree(dev->cntl_req); |
| @@ -108,6 +107,7 @@ static void yurex_delete(struct kref *kref) · 9 unmodified lines | ||
| 108 | 107 | dev->int_buffer, dev->urb->transfer_dma); |
| 109 | 108 | usb_free_urb(dev->urb); |
| 110 | 109 | } |
| 110 | + usb_put_dev(dev->udev); | |
| 111 | 111 | kfree(dev); |
| 112 | 112 | } |
| 113 | 113 | |
| @@ -379,7 +379,8 @@ static enum tcpm_state tcpm_default_state(struct tcpm_port *port) · 378 unmodified lines | ||
| 379 | 379 | return SNK_UNATTACHED; |
| 380 | 380 | else if (port->try_role == TYPEC_SOURCE) |
| 381 | 381 | return SRC_UNATTACHED; |
| 382 | − else if (port->tcpc->config->default_role == TYPEC_SINK) | |
| 382 | + else if (port->tcpc->config && | |
| 383 | + port->tcpc->config->default_role == TYPEC_SINK) | |
| 383 | 384 | return SNK_UNATTACHED; |
| 384 | 385 | /* Fall through to return SRC_UNATTACHED */ |
| 385 | 386 | } else if (port->port_type == TYPEC_PORT_SNK) { |
| @@ -586,7 +587,20 @@ static void tcpm_debugfs_init(struct tcpm_port *port) · 200 unmodified lines | ||
| 586 | 587 | |
| 587 | 588 | static void tcpm_debugfs_exit(struct tcpm_port *port) |
| 588 | 589 | { |
| 590 | + int i; | |
| 591 | + | |
| 592 | + mutex_lock(&port->logbuffer_lock); | |
| 593 | + for (i = 0; i < LOG_BUFFER_ENTRIES; i++) { | |
| 594 | + kfree(port->logbuffer[i]); | |
| 595 | + port->logbuffer[i] = NULL; | |
| 596 | + } | |
| 597 | + mutex_unlock(&port->logbuffer_lock); | |
| 598 | + | |
| 589 | 599 | debugfs_remove(port->dentry); |
| 600 | + if (list_empty(&rootdir->d_subdirs)) { | |
| 601 | + debugfs_remove(rootdir); | |
| 602 | + rootdir = NULL; | |
| 603 | + } | |
| 590 | 604 | } |
| 591 | 605 | |
| 592 | 606 | #else |
| @@ -1095,7 +1109,8 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, · 502 unmodified lines | ||
| 1095 | 1109 | break; |
| 1096 | 1110 | case CMD_ATTENTION: |
| 1097 | 1111 | /* Attention command does not have response */ |
| 1098 | − typec_altmode_attention(adev, p[1]); | |
| 1112 | + if (adev) | |
| 1113 | + typec_altmode_attention(adev, p[1]); | |
| 1099 | 1114 | return 0; |
| 1100 | 1115 | default: |
| 1101 | 1116 | break; |
| @@ -1147,20 +1162,26 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, · 45 unmodified lines | ||
| 1147 | 1162 | } |
| 1148 | 1163 | break; |
| 1149 | 1164 | case CMD_ENTER_MODE: |
| 1150 | − typec_altmode_update_active(pdev, true); | |
| 1151 | − | |
| 1152 | − if (typec_altmode_vdm(adev, p[0], &p[1], cnt)) { | |
| 1153 | − response[0] = VDO(adev->svid, 1, CMD_EXIT_MODE); | |
| 1154 | − response[0] |= VDO_OPOS(adev->mode); | |
| 1155 | − return 1; | |
| 1165 | + if (adev && pdev) { | |
| 1166 | + typec_altmode_update_active(pdev, true); | |
| 1167 | + | |
| 1168 | + if (typec_altmode_vdm(adev, p[0], &p[1], cnt)) { | |
| 1169 | + response[0] = VDO(adev->svid, 1, | |
| 1170 | + CMD_EXIT_MODE); | |
| 1171 | + response[0] |= VDO_OPOS(adev->mode); | |
| 1172 | + return 1; | |
| 1173 | + } | |
| 1156 | 1174 | } |
| 1157 | 1175 | return 0; |
| 1158 | 1176 | case CMD_EXIT_MODE: |
| 1159 | − typec_altmode_update_active(pdev, false); | |
| 1177 | + if (adev && pdev) { | |
| 1178 | + typec_altmode_update_active(pdev, false); | |
| 1160 | 1179 | |
| 1161 | − /* Back to USB Operation */ | |
| 1162 | − WARN_ON(typec_altmode_notify(adev, TYPEC_STATE_USB, | |
| 1163 | − NULL)); | |
| 1180 | + /* Back to USB Operation */ | |
| 1181 | + WARN_ON(typec_altmode_notify(adev, | |
| 1182 | + TYPEC_STATE_USB, | |
| 1183 | + NULL)); | |
| 1184 | + } | |
| 1164 | 1185 | break; |
| 1165 | 1186 | default: |
| 1166 | 1187 | break; |
| @@ -1170,8 +1191,10 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, · 3 unmodified lines | ||
| 1170 | 1191 | switch (cmd) { |
| 1171 | 1192 | case CMD_ENTER_MODE: |
| 1172 | 1193 | /* Back to USB Operation */ |
| 1173 | − WARN_ON(typec_altmode_notify(adev, TYPEC_STATE_USB, | |
| 1174 | − NULL)); | |
| 1194 | + if (adev) | |
| 1195 | + WARN_ON(typec_altmode_notify(adev, | |
| 1196 | + TYPEC_STATE_USB, | |
| 1197 | + NULL)); | |
| 1175 | 1198 | break; |
| 1176 | 1199 | default: |
| 1177 | 1200 | break; |
| @@ -1182,7 +1205,8 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, · 4 unmodified lines | ||
| 1182 | 1205 | } |
| 1183 | 1206 | |
| 1184 | 1207 | /* Informing the alternate mode drivers about everything */ |
| 1185 | − typec_altmode_vdm(adev, p[0], &p[1], cnt); | |
| 1208 | + if (adev) | |
| 1209 | + typec_altmode_vdm(adev, p[0], &p[1], cnt); | |
| 1186 | 1210 | |
| 1187 | 1211 | return rlen; |
| 1188 | 1212 | } |
| @@ -4114,7 +4138,7 @@ static int tcpm_try_role(const struct typec_capability *cap, int role) · 2925 unmodified lines | ||
| 4114 | 4138 | mutex_lock(&port->lock); |
| 4115 | 4139 | if (tcpc->try_role) |
| 4116 | 4140 | ret = tcpc->try_role(tcpc, role); |
| 4117 | − if (!ret && !tcpc->config->try_role_hw) | |
| 4141 | + if (!ret && (!tcpc->config || !tcpc->config->try_role_hw)) | |
| 4118 | 4142 | port->try_role = role; |
| 4119 | 4143 | port->try_src_count = 0; |
| 4120 | 4144 | port->try_snk_count = 0; |
| @@ -4701,7 +4725,7 @@ static int tcpm_copy_caps(struct tcpm_port *port, · 580 unmodified lines | ||
| 4701 | 4725 | port->typec_caps.prefer_role = tcfg->default_role; |
| 4702 | 4726 | port->typec_caps.type = tcfg->type; |
| 4703 | 4727 | port->typec_caps.data = tcfg->data; |
| 4704 | − port->self_powered = port->tcpc->config->self_powered; | |
| 4728 | + port->self_powered = tcfg->self_powered; | |
| 4705 | 4729 | |
| 4706 | 4730 | return 0; |
| 4707 | 4731 | } |
| @@ -1018,7 +1018,7 @@ release_fw: · 1017 unmodified lines | ||
| 1018 | 1018 | ******************************************************************************/ |
| 1019 | 1019 | static int ccg_fw_update(struct ucsi_ccg *uc, enum enum_flash_mode flash_mode) |
| 1020 | 1020 | { |
| 1021 | − int err; | |
| 1021 | + int err = 0; | |
| 1022 | 1022 | |
| 1023 | 1023 | while (flash_mode != FLASH_NOT_NEEDED) { |
| 1024 | 1024 | err = do_flash(uc, flash_mode); |
| @@ -96,7 +96,7 @@ struct vhost_uaddr { · 95 unmodified lines | ||
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | 98 | #if defined(CONFIG_MMU_NOTIFIER) && ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 0 |
| 99 | −#define VHOST_ARCH_CAN_ACCEL_UACCESS 1 | |
| 99 | +#define VHOST_ARCH_CAN_ACCEL_UACCESS 0 | |
| 100 | 100 | #else |
| 101 | 101 | #define VHOST_ARCH_CAN_ACCEL_UACCESS 0 |
| 102 | 102 | #endif |
| @@ -447,6 +447,7 @@ static int set_color_mode(struct omapfb_plane_struct *plane, · 446 unmodified lines | ||
| 447 | 447 | return 0; |
| 448 | 448 | case 12: |
| 449 | 449 | var->bits_per_pixel = 16; |
| 450 | + /* fall through */ | |
| 450 | 451 | case 16: |
| 451 | 452 | if (plane->fbdev->panel->bpp == 12) |
| 452 | 453 | plane->color_mode = OMAPFB_COLOR_RGB444; |
| @@ -1534,20 +1535,27 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state) · 1081 unmodified lines | ||
| 1534 | 1535 | case OMAPFB_ACTIVE: |
| 1535 | 1536 | for (i = 0; i < fbdev->mem_desc.region_cnt; i++) |
| 1536 | 1537 | unregister_framebuffer(fbdev->fb_info[i]); |
| 1538 | + /* fall through */ | |
| 1537 | 1539 | case 7: |
| 1538 | 1540 | omapfb_unregister_sysfs(fbdev); |
| 1541 | + /* fall through */ | |
| 1539 | 1542 | case 6: |
| 1540 | 1543 | if (fbdev->panel->disable) |
| 1541 | 1544 | fbdev->panel->disable(fbdev->panel); |
| 1545 | + /* fall through */ | |
| 1542 | 1546 | case 5: |
| 1543 | 1547 | omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED); |
| 1548 | + /* fall through */ | |
| 1544 | 1549 | case 4: |
| 1545 | 1550 | planes_cleanup(fbdev); |
| 1551 | + /* fall through */ | |
| 1546 | 1552 | case 3: |
| 1547 | 1553 | ctrl_cleanup(fbdev); |
| 1554 | + /* fall through */ | |
| 1548 | 1555 | case 2: |
| 1549 | 1556 | if (fbdev->panel->cleanup) |
| 1550 | 1557 | fbdev->panel->cleanup(fbdev->panel); |
| 1558 | + /* fall through */ | |
| 1551 | 1559 | case 1: |
| 1552 | 1560 | dev_set_drvdata(fbdev->dev, NULL); |
| 1553 | 1561 | kfree(fbdev); |
| @@ -235,6 +235,7 @@ static long ar7_wdt_ioctl(struct file *file, · 234 unmodified lines | ||
| 235 | 235 | ar7_wdt_update_margin(new_margin); |
| 236 | 236 | ar7_wdt_kick(1); |
| 237 | 237 | spin_unlock(&wdt_lock); |
| 238 | + /* Fall through */ | |
| 238 | 239 | |
| 239 | 240 | case WDIOC_GETTIMEOUT: |
| 240 | 241 | if (put_user(margin, (int *)arg)) |
| @@ -651,7 +651,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 650 unmodified lines | ||
| 651 | 651 | return -EINVAL; |
| 652 | 652 | |
| 653 | 653 | pcwd_keepalive(); |
| 654 | − /* Fall */ | |
| 654 | + /* Fall through */ | |
| 655 | 655 | |
| 656 | 656 | case WDIOC_GETTIMEOUT: |
| 657 | 657 | return put_user(heartbeat, argp); |
| @@ -134,7 +134,7 @@ static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · 133 unmodified lines | ||
| 134 | 134 | return -EINVAL; |
| 135 | 135 | riowd_timeout = (new_margin + 59) / 60; |
| 136 | 136 | riowd_writereg(p, riowd_timeout, WDTO_INDEX); |
| 137 | − /* Fall */ | |
| 137 | + /* Fall through */ | |
| 138 | 138 | |
| 139 | 139 | case WDIOC_GETTIMEOUT: |
| 140 | 140 | return put_user(riowd_timeout * 60, (int __user *)argp); |
| @@ -202,6 +202,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd, · 201 unmodified lines | ||
| 202 | 202 | timeout = time; |
| 203 | 203 | sbwdog_set(user_dog, timeout); |
| 204 | 204 | sbwdog_pet(user_dog); |
| 205 | + /* Fall through */ | |
| 205 | 206 | |
| 206 | 207 | case WDIOC_GETTIMEOUT: |
| 207 | 208 | /* |
| @@ -186,6 +186,7 @@ static long scx200_wdt_ioctl(struct file *file, unsigned int cmd, · 185 unmodified lines | ||
| 186 | 186 | margin = new_margin; |
| 187 | 187 | scx200_wdt_update_margin(); |
| 188 | 188 | scx200_wdt_ping(); |
| 189 | + /* Fall through */ | |
| 189 | 190 | case WDIOC_GETTIMEOUT: |
| 190 | 191 | if (put_user(margin, p)) |
| 191 | 192 | return -EFAULT; |
| @@ -389,7 +389,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 388 unmodified lines | ||
| 389 | 389 | if (wdt_set_heartbeat(new_heartbeat)) |
| 390 | 390 | return -EINVAL; |
| 391 | 391 | wdt_ping(); |
| 392 | − /* Fall */ | |
| 392 | + /* Fall through */ | |
| 393 | 393 | case WDIOC_GETTIMEOUT: |
| 394 | 394 | return put_user(heartbeat, p); |
| 395 | 395 | default: |
| @@ -398,7 +398,7 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd, · 397 unmodified lines | ||
| 398 | 398 | return -EINVAL; |
| 399 | 399 | |
| 400 | 400 | wdt977_keepalive(); |
| 401 | − /* Fall */ | |
| 401 | + /* Fall through */ | |
| 402 | 402 | |
| 403 | 403 | case WDIOC_GETTIMEOUT: |
| 404 | 404 | return put_user(timeout, uarg.i); |
| @@ -1143,7 +1143,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) · 1142 unmodified lines | ||
| 1143 | 1143 | goto out_put_map; |
| 1144 | 1144 | |
| 1145 | 1145 | if (!use_ptemod) { |
| 1146 | − err = vm_map_pages(vma, map->pages, map->count); | |
| 1146 | + err = vm_map_pages_zero(vma, map->pages, map->count); | |
| 1147 | 1147 | if (err) |
| 1148 | 1148 | goto out_put_map; |
| 1149 | 1149 | } else { |
| @@ -724,25 +724,6 @@ static long privcmd_ioctl_restrict(struct file *file, void __user *udata) · 723 unmodified lines | ||
| 724 | 724 | return 0; |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | −struct remap_pfn { | |
| 728 | − struct mm_struct *mm; | |
| 729 | − struct page **pages; | |
| 730 | − pgprot_t prot; | |
| 731 | − unsigned long i; | |
| 732 | −}; | |
| 733 | − | |
| 734 | −static int remap_pfn_fn(pte_t *ptep, unsigned long addr, void *data) | |
| 735 | −{ | |
| 736 | − struct remap_pfn *r = data; | |
| 737 | − struct page *page = r->pages[r->i]; | |
| 738 | − pte_t pte = pte_mkspecial(pfn_pte(page_to_pfn(page), r->prot)); | |
| 739 | − | |
| 740 | − set_pte_at(r->mm, addr, ptep, pte); | |
| 741 | − r->i++; | |
| 742 | − | |
| 743 | − return 0; | |
| 744 | −} | |
| 745 | − | |
| 746 | 727 | static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata) |
| 747 | 728 | { |
| 748 | 729 | struct privcmd_data *data = file->private_data; |
| @@ -774,7 +755,8 @@ static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata) · 25 unmodified lines | ||
| 774 | 755 | goto out; |
| 775 | 756 | } |
| 776 | 757 | |
| 777 | − if (xen_feature(XENFEAT_auto_translated_physmap)) { | |
| 758 | + if (IS_ENABLED(CONFIG_XEN_AUTO_XLATE) && | |
| 759 | + xen_feature(XENFEAT_auto_translated_physmap)) { | |
| 778 | 760 | unsigned int nr = DIV_ROUND_UP(kdata.num, XEN_PFN_PER_PAGE); |
| 779 | 761 | struct page **pages; |
| 780 | 762 | unsigned int i; |
| @@ -808,16 +790,9 @@ static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata) · 27 unmodified lines | ||
| 808 | 790 | if (rc) |
| 809 | 791 | goto out; |
| 810 | 792 | |
| 811 | − if (xen_feature(XENFEAT_auto_translated_physmap)) { | |
| 812 | − struct remap_pfn r = { | |
| 813 | − .mm = vma->vm_mm, | |
| 814 | − .pages = vma->vm_private_data, | |
| 815 | − .prot = vma->vm_page_prot, | |
| 816 | − }; | |
| 817 | − | |
| 818 | − rc = apply_to_page_range(r.mm, kdata.addr, | |
| 819 | − kdata.num << PAGE_SHIFT, | |
| 820 | − remap_pfn_fn, &r); | |
| 793 | + if (IS_ENABLED(CONFIG_XEN_AUTO_XLATE) && | |
| 794 | + xen_feature(XENFEAT_auto_translated_physmap)) { | |
| 795 | + rc = xen_remap_vma_range(vma, kdata.addr, kdata.num << PAGE_SHIFT); | |
| 821 | 796 | } else { |
| 822 | 797 | unsigned int domid = |
| 823 | 798 | (xdata.flags & XENMEM_rsrc_acq_caller_owned) ? |
| @@ -83,34 +83,18 @@ static inline dma_addr_t xen_virt_to_bus(void *address) · 82 unmodified lines | ||
| 83 | 83 | return xen_phys_to_bus(virt_to_phys(address)); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | −static int check_pages_physically_contiguous(unsigned long xen_pfn, | |
| 87 | − unsigned int offset, | |
| 88 | − size_t length) | |
| 86 | +static inline int range_straddles_page_boundary(phys_addr_t p, size_t size) | |
| 89 | 87 | { |
| 90 | − unsigned long next_bfn; | |
| 91 | − int i; | |
| 92 | − int nr_pages; | |
| 88 | + unsigned long next_bfn, xen_pfn = XEN_PFN_DOWN(p); | |
| 89 | + unsigned int i, nr_pages = XEN_PFN_UP(xen_offset_in_page(p) + size); | |
| 93 | 90 | |
| 94 | 91 | next_bfn = pfn_to_bfn(xen_pfn); |
| 95 | − nr_pages = (offset + length + XEN_PAGE_SIZE-1) >> XEN_PAGE_SHIFT; | |
| 96 | 92 | |
| 97 | − for (i = 1; i < nr_pages; i++) { | |
| 93 | + for (i = 1; i < nr_pages; i++) | |
| 98 | 94 | if (pfn_to_bfn(++xen_pfn) != ++next_bfn) |
| 99 | − return 0; | |
| 100 | − } | |
| 101 | − return 1; | |
| 102 | −} | |
| 95 | + return 1; | |
| 103 | 96 | |
| 104 | −static inline int range_straddles_page_boundary(phys_addr_t p, size_t size) | |
| 105 | −{ | |
| 106 | − unsigned long xen_pfn = XEN_PFN_DOWN(p); | |
| 107 | − unsigned int offset = p & ~XEN_PAGE_MASK; | |
| 108 | − | |
| 109 | − if (offset + size <= XEN_PAGE_SIZE) | |
| 110 | − return 0; | |
| 111 | − if (check_pages_physically_contiguous(xen_pfn, offset, size)) | |
| 112 | − return 0; | |
| 113 | − return 1; | |
| 97 | + return 0; | |
| 114 | 98 | } |
| 115 | 99 | |
| 116 | 100 | static int is_xen_swiotlb_buffer(dma_addr_t dma_addr) |
| @@ -338,6 +322,7 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, · 221 unmodified lines | ||
| 338 | 322 | xen_free_coherent_pages(hwdev, size, ret, (dma_addr_t)phys, attrs); |
| 339 | 323 | return NULL; |
| 340 | 324 | } |
| 325 | + SetPageXenRemapped(virt_to_page(ret)); | |
| 341 | 326 | } |
| 342 | 327 | memset(ret, 0, size); |
| 343 | 328 | return ret; |
| @@ -361,8 +346,9 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, · 17 unmodified lines | ||
| 361 | 346 | /* Convert the size to actually allocated. */ |
| 362 | 347 | size = 1UL << (order + XEN_PAGE_SHIFT); |
| 363 | 348 | |
| 364 | − if (((dev_addr + size - 1 <= dma_mask)) || | |
| 365 | − range_straddles_page_boundary(phys, size)) | |
| 349 | + if (!WARN_ON((dev_addr + size - 1 > dma_mask) || | |
| 350 | + range_straddles_page_boundary(phys, size)) && | |
| 351 | + TestClearPageXenRemapped(virt_to_page(vaddr))) | |
| 366 | 352 | xen_destroy_contiguous_region(phys, order); |
| 367 | 353 | |
| 368 | 354 | xen_free_coherent_pages(hwdev, size, vaddr, (dma_addr_t)phys, attrs); |
| @@ -116,13 +116,12 @@ static int pm_ctrl_write(struct pci_dev *dev, int offset, u16 new_value, · 115 unmodified lines | ||
| 116 | 116 | { |
| 117 | 117 | int err; |
| 118 | 118 | u16 old_value; |
| 119 | − pci_power_t new_state, old_state; | |
| 119 | + pci_power_t new_state; | |
| 120 | 120 | |
| 121 | 121 | err = pci_read_config_word(dev, offset, &old_value); |
| 122 | 122 | if (err) |
| 123 | 123 | goto out; |
| 124 | 124 | |
| 125 | − old_state = (pci_power_t)(old_value & PCI_PM_CTRL_STATE_MASK); | |
| 126 | 125 | new_state = (pci_power_t)(new_value & PCI_PM_CTRL_STATE_MASK); |
| 127 | 126 | |
| 128 | 127 | new_value &= PM_OK_BITS; |
| @@ -262,3 +262,35 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt, · 261 unmodified lines | ||
| 262 | 262 | return 0; |
| 263 | 263 | } |
| 264 | 264 | EXPORT_SYMBOL_GPL(xen_xlate_map_ballooned_pages); |
| 265 | + | |
| 266 | +struct remap_pfn { | |
| 267 | + struct mm_struct *mm; | |
| 268 | + struct page **pages; | |
| 269 | + pgprot_t prot; | |
| 270 | + unsigned long i; | |
| 271 | +}; | |
| 272 | + | |
| 273 | +static int remap_pfn_fn(pte_t *ptep, unsigned long addr, void *data) | |
| 274 | +{ | |
| 275 | + struct remap_pfn *r = data; | |
| 276 | + struct page *page = r->pages[r->i]; | |
| 277 | + pte_t pte = pte_mkspecial(pfn_pte(page_to_pfn(page), r->prot)); | |
| 278 | + | |
| 279 | + set_pte_at(r->mm, addr, ptep, pte); | |
| 280 | + r->i++; | |
| 281 | + | |
| 282 | + return 0; | |
| 283 | +} | |
| 284 | + | |
| 285 | +/* Used by the privcmd module, but has to be built-in on ARM */ | |
| 286 | +int xen_remap_vma_range(struct vm_area_struct *vma, unsigned long addr, unsigned long len) | |
| 287 | +{ | |
| 288 | + struct remap_pfn r = { | |
| 289 | + .mm = vma->vm_mm, | |
| 290 | + .pages = vma->vm_private_data, | |
| 291 | + .prot = vma->vm_page_prot, | |
| 292 | + }; | |
| 293 | + | |
| 294 | + return apply_to_page_range(vma->vm_mm, addr, len, remap_pfn_fn, &r); | |
| 295 | +} | |
| 296 | +EXPORT_SYMBOL_GPL(xen_remap_vma_range); | |
| @@ -349,7 +349,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 348 unmodified lines | ||
| 349 | 349 | loff_t pos = iocb->ki_pos; |
| 350 | 350 | blk_qc_t qc = BLK_QC_T_NONE; |
| 351 | 351 | gfp_t gfp; |
| 352 | − ssize_t ret; | |
| 352 | + int ret; | |
| 353 | 353 | |
| 354 | 354 | if ((pos | iov_iter_alignment(iter)) & |
| 355 | 355 | (bdev_logical_block_size(bdev) - 1)) |
| @@ -386,8 +386,6 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 30 unmodified lines | ||
| 386 | 386 | |
| 387 | 387 | ret = 0; |
| 388 | 388 | for (;;) { |
| 389 | − int err; | |
| 390 | − | |
| 391 | 389 | bio_set_dev(bio, bdev); |
| 392 | 390 | bio->bi_iter.bi_sector = pos >> 9; |
| 393 | 391 | bio->bi_write_hint = iocb->ki_hint; |
| @@ -395,10 +393,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 1 unmodified line | ||
| 395 | 393 | bio->bi_end_io = blkdev_bio_end_io; |
| 396 | 394 | bio->bi_ioprio = iocb->ki_ioprio; |
| 397 | 395 | |
| 398 | − err = bio_iov_iter_get_pages(bio, iter); | |
| 399 | − if (unlikely(err)) { | |
| 400 | − if (!ret) | |
| 401 | − ret = err; | |
| 396 | + ret = bio_iov_iter_get_pages(bio, iter); | |
| 397 | + if (unlikely(ret)) { | |
| 402 | 398 | bio->bi_status = BLK_STS_IOERR; |
| 403 | 399 | bio_endio(bio); |
| 404 | 400 | break; |
| @@ -421,7 +417,6 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 16 unmodified lines | ||
| 421 | 417 | if (nowait) |
| 422 | 418 | bio->bi_opf |= (REQ_NOWAIT | REQ_NOWAIT_INLINE); |
| 423 | 419 | |
| 424 | − dio->size += bio->bi_iter.bi_size; | |
| 425 | 420 | pos += bio->bi_iter.bi_size; |
| 426 | 421 | |
| 427 | 422 | nr_pages = iov_iter_npages(iter, BIO_MAX_PAGES); |
| @@ -433,10 +428,11 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 5 unmodified lines | ||
| 433 | 428 | polled = true; |
| 434 | 429 | } |
| 435 | 430 | |
| 431 | + dio->size += bio->bi_iter.bi_size; | |
| 436 | 432 | qc = submit_bio(bio); |
| 437 | 433 | if (qc == BLK_QC_T_EAGAIN) { |
| 438 | − if (!ret) | |
| 439 | − ret = -EAGAIN; | |
| 434 | + dio->size -= bio->bi_iter.bi_size; | |
| 435 | + ret = -EAGAIN; | |
| 440 | 436 | goto error; |
| 441 | 437 | } |
| 442 | 438 | |
| @@ -459,18 +455,17 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 16 unmodified lines | ||
| 459 | 455 | atomic_inc(&dio->ref); |
| 460 | 456 | } |
| 461 | 457 | |
| 458 | + dio->size += bio->bi_iter.bi_size; | |
| 462 | 459 | qc = submit_bio(bio); |
| 463 | 460 | if (qc == BLK_QC_T_EAGAIN) { |
| 464 | − if (!ret) | |
| 465 | − ret = -EAGAIN; | |
| 461 | + dio->size -= bio->bi_iter.bi_size; | |
| 462 | + ret = -EAGAIN; | |
| 466 | 463 | goto error; |
| 467 | 464 | } |
| 468 | − ret += bio->bi_iter.bi_size; | |
| 469 | 465 | |
| 470 | 466 | bio = bio_alloc(gfp, nr_pages); |
| 471 | 467 | if (!bio) { |
| 472 | − if (!ret) | |
| 473 | − ret = -EAGAIN; | |
| 468 | + ret = -EAGAIN; | |
| 474 | 469 | goto error; |
| 475 | 470 | } |
| 476 | 471 | } |
| @@ -495,6 +490,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 18 unmodified lines | ||
| 495 | 490 | out: |
| 496 | 491 | if (!ret) |
| 497 | 492 | ret = blk_status_to_errno(dio->bio.bi_status); |
| 493 | + if (likely(!ret)) | |
| 494 | + ret = dio->size; | |
| 498 | 495 | |
| 499 | 496 | bio_put(&dio->bio); |
| 500 | 497 | return ret; |
| @@ -1181,8 +1178,7 @@ static struct gendisk *bdev_get_gendisk(struct block_device *bdev, int *partno) · 680 unmodified lines | ||
| 1181 | 1178 | * Pointer to the block device containing @bdev on success, ERR_PTR() |
| 1182 | 1179 | * value on failure. |
| 1183 | 1180 | */ |
| 1184 | −static struct block_device *bd_start_claiming(struct block_device *bdev, | |
| 1185 | − void *holder) | |
| 1181 | +struct block_device *bd_start_claiming(struct block_device *bdev, void *holder) | |
| 1186 | 1182 | { |
| 1187 | 1183 | struct gendisk *disk; |
| 1188 | 1184 | struct block_device *whole; |
| @@ -1229,6 +1225,62 @@ static struct block_device *bd_start_claiming(struct block_device *bdev, · 40 unmodified lines | ||
| 1229 | 1225 | return ERR_PTR(err); |
| 1230 | 1226 | } |
| 1231 | 1227 | } |
| 1228 | +EXPORT_SYMBOL(bd_start_claiming); | |
| 1229 | + | |
| 1230 | +static void bd_clear_claiming(struct block_device *whole, void *holder) | |
| 1231 | +{ | |
| 1232 | + lockdep_assert_held(&bdev_lock); | |
| 1233 | + /* tell others that we're done */ | |
| 1234 | + BUG_ON(whole->bd_claiming != holder); | |
| 1235 | + whole->bd_claiming = NULL; | |
| 1236 | + wake_up_bit(&whole->bd_claiming, 0); | |
| 1237 | +} | |
| 1238 | + | |
| 1239 | +/** | |
| 1240 | + * bd_finish_claiming - finish claiming of a block device | |
| 1241 | + * @bdev: block device of interest | |
| 1242 | + * @whole: whole block device (returned from bd_start_claiming()) | |
| 1243 | + * @holder: holder that has claimed @bdev | |
| 1244 | + * | |
| 1245 | + * Finish exclusive open of a block device. Mark the device as exlusively | |
| 1246 | + * open by the holder and wake up all waiters for exclusive open to finish. | |
| 1247 | + */ | |
| 1248 | +void bd_finish_claiming(struct block_device *bdev, struct block_device *whole, | |
| 1249 | + void *holder) | |
| 1250 | +{ | |
| 1251 | + spin_lock(&bdev_lock); | |
| 1252 | + BUG_ON(!bd_may_claim(bdev, whole, holder)); | |
| 1253 | + /* | |
| 1254 | + * Note that for a whole device bd_holders will be incremented twice, | |
| 1255 | + * and bd_holder will be set to bd_may_claim before being set to holder | |
| 1256 | + */ | |
| 1257 | + whole->bd_holders++; | |
| 1258 | + whole->bd_holder = bd_may_claim; | |
| 1259 | + bdev->bd_holders++; | |
| 1260 | + bdev->bd_holder = holder; | |
| 1261 | + bd_clear_claiming(whole, holder); | |
| 1262 | + spin_unlock(&bdev_lock); | |
| 1263 | +} | |
| 1264 | +EXPORT_SYMBOL(bd_finish_claiming); | |
| 1265 | + | |
| 1266 | +/** | |
| 1267 | + * bd_abort_claiming - abort claiming of a block device | |
| 1268 | + * @bdev: block device of interest | |
| 1269 | + * @whole: whole block device (returned from bd_start_claiming()) | |
| 1270 | + * @holder: holder that has claimed @bdev | |
| 1271 | + * | |
| 1272 | + * Abort claiming of a block device when the exclusive open failed. This can be | |
| 1273 | + * also used when exclusive open is not actually desired and we just needed | |
| 1274 | + * to block other exclusive openers for a while. | |
| 1275 | + */ | |
| 1276 | +void bd_abort_claiming(struct block_device *bdev, struct block_device *whole, | |
| 1277 | + void *holder) | |
| 1278 | +{ | |
| 1279 | + spin_lock(&bdev_lock); | |
| 1280 | + bd_clear_claiming(whole, holder); | |
| 1281 | + spin_unlock(&bdev_lock); | |
| 1282 | +} | |
| 1283 | +EXPORT_SYMBOL(bd_abort_claiming); | |
| 1232 | 1284 | |
| 1233 | 1285 | #ifdef CONFIG_SYSFS |
| 1234 | 1286 | struct bd_holder_disk { |
| @@ -1698,29 +1750,10 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) · 463 unmodified lines | ||
| 1698 | 1750 | |
| 1699 | 1751 | /* finish claiming */ |
| 1700 | 1752 | mutex_lock(&bdev->bd_mutex); |
| 1701 | − spin_lock(&bdev_lock); | |
| 1702 | − | |
| 1703 | − if (!res) { | |
| 1704 | − BUG_ON(!bd_may_claim(bdev, whole, holder)); | |
| 1705 | − /* | |
| 1706 | − * Note that for a whole device bd_holders | |
| 1707 | − * will be incremented twice, and bd_holder | |
| 1708 | − * will be set to bd_may_claim before being | |
| 1709 | − * set to holder | |
| 1710 | − */ | |
| 1711 | − whole->bd_holders++; | |
| 1712 | − whole->bd_holder = bd_may_claim; | |
| 1713 | − bdev->bd_holders++; | |
| 1714 | − bdev->bd_holder = holder; | |
| 1715 | − } | |
| 1716 | − | |
| 1717 | − /* tell others that we're done */ | |
| 1718 | − BUG_ON(whole->bd_claiming != holder); | |
| 1719 | − whole->bd_claiming = NULL; | |
| 1720 | − wake_up_bit(&whole->bd_claiming, 0); | |
| 1721 | − | |
| 1722 | − spin_unlock(&bdev_lock); | |
| 1723 | − | |
| 1753 | + if (!res) | |
| 1754 | + bd_finish_claiming(bdev, whole, holder); | |
| 1755 | + else | |
| 1756 | + bd_abort_claiming(bdev, whole, holder); | |
| 1724 | 1757 | /* |
| 1725 | 1758 | * Block event polling for write claims if requested. Any |
| 1726 | 1759 | * write holder makes the write_holder state stick until |
| @@ -1483,7 +1483,7 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr, · 1482 unmodified lines | ||
| 1483 | 1483 | ulist_init(roots); |
| 1484 | 1484 | ulist_init(tmp); |
| 1485 | 1485 | |
| 1486 | − trans = btrfs_attach_transaction(root); | |
| 1486 | + trans = btrfs_join_transaction_nostart(root); | |
| 1487 | 1487 | if (IS_ERR(trans)) { |
| 1488 | 1488 | if (PTR_ERR(trans) != -ENOENT && PTR_ERR(trans) != -EROFS) { |
| 1489 | 1489 | ret = PTR_ERR(trans); |
| @@ -6322,68 +6322,21 @@ static int changed_extent(struct send_ctx *sctx, · 6321 unmodified lines | ||
| 6322 | 6322 | { |
| 6323 | 6323 | int ret = 0; |
| 6324 | 6324 | |
| 6325 | − if (sctx->cur_ino != sctx->cmp_key->objectid) { | |
| 6326 | − | |
| 6327 | − if (result == BTRFS_COMPARE_TREE_CHANGED) { | |
| 6328 | − struct extent_buffer *leaf_l; | |
| 6329 | − struct extent_buffer *leaf_r; | |
| 6330 | − struct btrfs_file_extent_item *ei_l; | |
| 6331 | − struct btrfs_file_extent_item *ei_r; | |
| 6332 | − | |
| 6333 | − leaf_l = sctx->left_path->nodes[0]; | |
| 6334 | − leaf_r = sctx->right_path->nodes[0]; | |
| 6335 | − ei_l = btrfs_item_ptr(leaf_l, | |
| 6336 | − sctx->left_path->slots[0], | |
| 6337 | − struct btrfs_file_extent_item); | |
| 6338 | − ei_r = btrfs_item_ptr(leaf_r, | |
| 6339 | − sctx->right_path->slots[0], | |
| 6340 | − struct btrfs_file_extent_item); | |
| 6341 | − | |
| 6342 | − /* | |
| 6343 | − * We may have found an extent item that has changed | |
| 6344 | − * only its disk_bytenr field and the corresponding | |
| 6345 | − * inode item was not updated. This case happens due to | |
| 6346 | − * very specific timings during relocation when a leaf | |
| 6347 | − * that contains file extent items is COWed while | |
| 6348 | − * relocation is ongoing and its in the stage where it | |
| 6349 | − * updates data pointers. So when this happens we can | |
| 6350 | − * safely ignore it since we know it's the same extent, | |
| 6351 | − * but just at different logical and physical locations | |
| 6352 | − * (when an extent is fully replaced with a new one, we | |
| 6353 | − * know the generation number must have changed too, | |
| 6354 | − * since snapshot creation implies committing the current | |
| 6355 | − * transaction, and the inode item must have been updated | |
| 6356 | − * as well). | |
| 6357 | − * This replacement of the disk_bytenr happens at | |
| 6358 | − * relocation.c:replace_file_extents() through | |
| 6359 | − * relocation.c:btrfs_reloc_cow_block(). | |
| 6360 | − */ | |
| 6361 | − if (btrfs_file_extent_generation(leaf_l, ei_l) == | |
| 6362 | − btrfs_file_extent_generation(leaf_r, ei_r) && | |
| 6363 | − btrfs_file_extent_ram_bytes(leaf_l, ei_l) == | |
| 6364 | − btrfs_file_extent_ram_bytes(leaf_r, ei_r) && | |
| 6365 | − btrfs_file_extent_compression(leaf_l, ei_l) == | |
| 6366 | − btrfs_file_extent_compression(leaf_r, ei_r) && | |
| 6367 | − btrfs_file_extent_encryption(leaf_l, ei_l) == | |
| 6368 | − btrfs_file_extent_encryption(leaf_r, ei_r) && | |
| 6369 | − btrfs_file_extent_other_encoding(leaf_l, ei_l) == | |
| 6370 | − btrfs_file_extent_other_encoding(leaf_r, ei_r) && | |
| 6371 | − btrfs_file_extent_type(leaf_l, ei_l) == | |
| 6372 | − btrfs_file_extent_type(leaf_r, ei_r) && | |
| 6373 | − btrfs_file_extent_disk_bytenr(leaf_l, ei_l) != | |
| 6374 | − btrfs_file_extent_disk_bytenr(leaf_r, ei_r) && | |
| 6375 | − btrfs_file_extent_disk_num_bytes(leaf_l, ei_l) == | |
| 6376 | − btrfs_file_extent_disk_num_bytes(leaf_r, ei_r) && | |
| 6377 | − btrfs_file_extent_offset(leaf_l, ei_l) == | |
| 6378 | − btrfs_file_extent_offset(leaf_r, ei_r) && | |
| 6379 | − btrfs_file_extent_num_bytes(leaf_l, ei_l) == | |
| 6380 | − btrfs_file_extent_num_bytes(leaf_r, ei_r)) | |
| 6381 | − return 0; | |
| 6382 | − } | |
| 6383 | − | |
| 6384 | − inconsistent_snapshot_error(sctx, result, "extent"); | |
| 6385 | − return -EIO; | |
| 6386 | − } | |
| 6325 | + /* | |
| 6326 | + * We have found an extent item that changed without the inode item | |
| 6327 | + * having changed. This can happen either after relocation (where the | |
| 6328 | + * disk_bytenr of an extent item is replaced at | |
| 6329 | + * relocation.c:replace_file_extents()) or after deduplication into a | |
| 6330 | + * file in both the parent and send snapshots (where an extent item can | |
| 6331 | + * get modified or replaced with a new one). Note that deduplication | |
| 6332 | + * updates the inode item, but it only changes the iversion (sequence | |
| 6333 | + * field in the inode item) of the inode, so if a file is deduplicated | |
| 6334 | + * the same amount of times in both the parent and send snapshots, its | |
| 6335 | + * iversion becames the same in both snapshots, whence the inode item is | |
| 6336 | + * the same on both snapshots. | |
| 6337 | + */ | |
| 6338 | + if (sctx->cur_ino != sctx->cmp_key->objectid) | |
| 6339 | + return 0; | |
| 6387 | 6340 | |
| 6388 | 6341 | if (!sctx->cur_inode_new_gen && !sctx->cur_inode_deleted) { |
| 6389 | 6342 | if (result != BTRFS_COMPARE_TREE_DELETED) |
| @@ -28,15 +28,18 @@ static const unsigned int btrfs_blocked_trans_types[TRANS_STATE_MAX] = { · 27 unmodified lines | ||
| 28 | 28 | [TRANS_STATE_COMMIT_START] = (__TRANS_START | __TRANS_ATTACH), |
| 29 | 29 | [TRANS_STATE_COMMIT_DOING] = (__TRANS_START | |
| 30 | 30 | __TRANS_ATTACH | |
| 31 | − __TRANS_JOIN), | |
| 31 | + __TRANS_JOIN | | |
| 32 | + __TRANS_JOIN_NOSTART), | |
| 32 | 33 | [TRANS_STATE_UNBLOCKED] = (__TRANS_START | |
| 33 | 34 | __TRANS_ATTACH | |
| 34 | 35 | __TRANS_JOIN | |
| 35 | − __TRANS_JOIN_NOLOCK), | |
| 36 | + __TRANS_JOIN_NOLOCK | | |
| 37 | + __TRANS_JOIN_NOSTART), | |
| 36 | 38 | [TRANS_STATE_COMPLETED] = (__TRANS_START | |
| 37 | 39 | __TRANS_ATTACH | |
| 38 | 40 | __TRANS_JOIN | |
| 39 | − __TRANS_JOIN_NOLOCK), | |
| 41 | + __TRANS_JOIN_NOLOCK | | |
| 42 | + __TRANS_JOIN_NOSTART), | |
| 40 | 43 | }; |
| 41 | 44 | |
| 42 | 45 | void btrfs_put_transaction(struct btrfs_transaction *transaction) |
| @@ -543,7 +546,8 @@ again: · 500 unmodified lines | ||
| 543 | 546 | ret = join_transaction(fs_info, type); |
| 544 | 547 | if (ret == -EBUSY) { |
| 545 | 548 | wait_current_trans(fs_info); |
| 546 | − if (unlikely(type == TRANS_ATTACH)) | |
| 549 | + if (unlikely(type == TRANS_ATTACH || | |
| 550 | + type == TRANS_JOIN_NOSTART)) | |
| 547 | 551 | ret = -ENOENT; |
| 548 | 552 | } |
| 549 | 553 | } while (ret == -EBUSY); |
| @@ -659,6 +663,16 @@ struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root · 109 unmodified lines | ||
| 659 | 663 | BTRFS_RESERVE_NO_FLUSH, true); |
| 660 | 664 | } |
| 661 | 665 | |
| 666 | +/* | |
| 667 | + * Similar to regular join but it never starts a transaction when none is | |
| 668 | + * running or after waiting for the current one to finish. | |
| 669 | + */ | |
| 670 | +struct btrfs_trans_handle *btrfs_join_transaction_nostart(struct btrfs_root *root) | |
| 671 | +{ | |
| 672 | + return start_transaction(root, 0, TRANS_JOIN_NOSTART, | |
| 673 | + BTRFS_RESERVE_NO_FLUSH, true); | |
| 674 | +} | |
| 675 | + | |
| 662 | 676 | /* |
| 663 | 677 | * btrfs_attach_transaction() - catch the running transaction |
| 664 | 678 | * |
| @@ -2037,6 +2051,16 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 1372 unmodified lines | ||
| 2037 | 2051 | } |
| 2038 | 2052 | } else { |
| 2039 | 2053 | spin_unlock(&fs_info->trans_lock); |
| 2054 | + /* | |
| 2055 | + * The previous transaction was aborted and was already removed | |
| 2056 | + * from the list of transactions at fs_info->trans_list. So we | |
| 2057 | + * abort to prevent writing a new superblock that reflects a | |
| 2058 | + * corrupt state (pointing to trees with unwritten nodes/leafs). | |
| 2059 | + */ | |
| 2060 | + if (test_bit(BTRFS_FS_STATE_TRANS_ABORTED, &fs_info->fs_state)) { | |
| 2061 | + ret = -EROFS; | |
| 2062 | + goto cleanup_transaction; | |
| 2063 | + } | |
| 2040 | 2064 | } |
| 2041 | 2065 | |
| 2042 | 2066 | extwriter_counter_dec(cur_trans, trans->type); |
| @@ -94,11 +94,13 @@ struct btrfs_transaction { · 93 unmodified lines | ||
| 94 | 94 | #define __TRANS_JOIN (1U << 11) |
| 95 | 95 | #define __TRANS_JOIN_NOLOCK (1U << 12) |
| 96 | 96 | #define __TRANS_DUMMY (1U << 13) |
| 97 | +#define __TRANS_JOIN_NOSTART (1U << 14) | |
| 97 | 98 | |
| 98 | 99 | #define TRANS_START (__TRANS_START | __TRANS_FREEZABLE) |
| 99 | 100 | #define TRANS_ATTACH (__TRANS_ATTACH) |
| 100 | 101 | #define TRANS_JOIN (__TRANS_JOIN | __TRANS_FREEZABLE) |
| 101 | 102 | #define TRANS_JOIN_NOLOCK (__TRANS_JOIN_NOLOCK) |
| 103 | +#define TRANS_JOIN_NOSTART (__TRANS_JOIN_NOSTART) | |
| 102 | 104 | |
| 103 | 105 | #define TRANS_EXTWRITERS (__TRANS_START | __TRANS_ATTACH) |
| 104 | 106 | |
| @@ -183,6 +185,7 @@ struct btrfs_trans_handle *btrfs_start_transaction_fallback_global_rsv( · 78 unmodified lines | ||
| 183 | 185 | int min_factor); |
| 184 | 186 | struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root); |
| 185 | 187 | struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root); |
| 188 | +struct btrfs_trans_handle *btrfs_join_transaction_nostart(struct btrfs_root *root); | |
| 186 | 189 | struct btrfs_trans_handle *btrfs_attach_transaction(struct btrfs_root *root); |
| 187 | 190 | struct btrfs_trans_handle *btrfs_attach_transaction_barrier( |
| 188 | 191 | struct btrfs_root *root); |
| @@ -1113,6 +1113,7 @@ cifs_demultiplex_thread(void *p) · 1112 unmodified lines | ||
| 1113 | 1113 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv); |
| 1114 | 1114 | |
| 1115 | 1115 | set_freezable(); |
| 1116 | + allow_signal(SIGKILL); | |
| 1116 | 1117 | while (server->tcpStatus != CifsExiting) { |
| 1117 | 1118 | if (try_to_freeze()) |
| 1118 | 1119 | continue; |
| @@ -3489,7 +3489,15 @@ fill_transform_hdr(struct smb2_transform_hdr *tr_hdr, unsigned int orig_len, · 3488 unmodified lines | ||
| 3489 | 3489 | static inline void smb2_sg_set_buf(struct scatterlist *sg, const void *buf, |
| 3490 | 3490 | unsigned int buflen) |
| 3491 | 3491 | { |
| 3492 | − sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); | |
| 3492 | + void *addr; | |
| 3493 | + /* | |
| 3494 | + * VMAP_STACK (at least) puts stack into the vmalloc address space | |
| 3495 | + */ | |
| 3496 | + if (is_vmalloc_addr(buf)) | |
| 3497 | + addr = vmalloc_to_page(buf); | |
| 3498 | + else | |
| 3499 | + addr = virt_to_page(buf); | |
| 3500 | + sg_set_page(sg, addr, buflen, offset_in_page(buf)); | |
| 3493 | 3501 | } |
| 3494 | 3502 | |
| 3495 | 3503 | /* Assumes the first rqst has a transform header as the first iov. |
| @@ -4070,7 +4078,6 @@ receive_encrypted_standard(struct TCP_Server_Info *server, · 574 unmodified lines | ||
| 4070 | 4078 | { |
| 4071 | 4079 | int ret, length; |
| 4072 | 4080 | char *buf = server->smallbuf; |
| 4073 | − char *tmpbuf; | |
| 4074 | 4081 | struct smb2_sync_hdr *shdr; |
| 4075 | 4082 | unsigned int pdu_length = server->pdu_size; |
| 4076 | 4083 | unsigned int buf_size; |
| @@ -4100,18 +4107,15 @@ receive_encrypted_standard(struct TCP_Server_Info *server, · 23 unmodified lines | ||
| 4100 | 4107 | return length; |
| 4101 | 4108 | |
| 4102 | 4109 | next_is_large = server->large_buf; |
| 4103 | − one_more: | |
| 4110 | +one_more: | |
| 4104 | 4111 | shdr = (struct smb2_sync_hdr *)buf; |
| 4105 | 4112 | if (shdr->NextCommand) { |
| 4106 | − if (next_is_large) { | |
| 4107 | − tmpbuf = server->bigbuf; | |
| 4113 | + if (next_is_large) | |
| 4108 | 4114 | next_buffer = (char *)cifs_buf_get(); |
| 4109 | − } else { | |
| 4110 | − tmpbuf = server->smallbuf; | |
| 4115 | + else | |
| 4111 | 4116 | next_buffer = (char *)cifs_small_buf_get(); |
| 4112 | − } | |
| 4113 | 4117 | memcpy(next_buffer, |
| 4114 | − tmpbuf + le32_to_cpu(shdr->NextCommand), | |
| 4118 | + buf + le32_to_cpu(shdr->NextCommand), | |
| 4115 | 4119 | pdu_length - le32_to_cpu(shdr->NextCommand)); |
| 4116 | 4120 | } |
| 4117 | 4121 | |
| @@ -4140,12 +4144,21 @@ receive_encrypted_standard(struct TCP_Server_Info *server, · 22 unmodified lines | ||
| 4140 | 4144 | pdu_length -= le32_to_cpu(shdr->NextCommand); |
| 4141 | 4145 | server->large_buf = next_is_large; |
| 4142 | 4146 | if (next_is_large) |
| 4143 | − server->bigbuf = next_buffer; | |
| 4147 | + server->bigbuf = buf = next_buffer; | |
| 4144 | 4148 | else |
| 4145 | − server->smallbuf = next_buffer; | |
| 4146 | − | |
| 4147 | − buf += le32_to_cpu(shdr->NextCommand); | |
| 4149 | + server->smallbuf = buf = next_buffer; | |
| 4148 | 4150 | goto one_more; |
| 4151 | + } else if (ret != 0) { | |
| 4152 | + /* | |
| 4153 | + * ret != 0 here means that we didn't get to handle_mid() thus | |
| 4154 | + * server->smallbuf and server->bigbuf are still valid. We need | |
| 4155 | + * to free next_buffer because it is not going to be used | |
| 4156 | + * anywhere. | |
| 4157 | + */ | |
| 4158 | + if (next_is_large) | |
| 4159 | + free_rsp_buf(CIFS_LARGE_BUFFER, next_buffer); | |
| 4160 | + else | |
| 4161 | + free_rsp_buf(CIFS_SMALL_BUFFER, next_buffer); | |
| 4149 | 4162 | } |
| 4150 | 4163 | |
| 4151 | 4164 | return ret; |
| @@ -252,7 +252,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon) · 251 unmodified lines | ||
| 252 | 252 | if (tcon == NULL) |
| 253 | 253 | return 0; |
| 254 | 254 | |
| 255 | − if (smb2_command == SMB2_TREE_CONNECT) | |
| 255 | + if (smb2_command == SMB2_TREE_CONNECT || smb2_command == SMB2_IOCTL) | |
| 256 | 256 | return 0; |
| 257 | 257 | |
| 258 | 258 | if (tcon->tidStatus == CifsExiting) { |
| @@ -1196,7 +1196,12 @@ SMB2_sess_alloc_buffer(struct SMB2_sess_data *sess_data) · 937 unmodified lines | ||
| 1196 | 1196 | else |
| 1197 | 1197 | req->SecurityMode = 0; |
| 1198 | 1198 | |
| 1199 | +#ifdef CONFIG_CIFS_DFS_UPCALL | |
| 1200 | + req->Capabilities = cpu_to_le32(SMB2_GLOBAL_CAP_DFS); | |
| 1201 | +#else | |
| 1199 | 1202 | req->Capabilities = 0; |
| 1203 | +#endif /* DFS_UPCALL */ | |
| 1204 | + | |
| 1200 | 1205 | req->Channel = 0; /* MBZ */ |
| 1201 | 1206 | |
| 1202 | 1207 | sess_data->iov[0].iov_base = (char *)req; |
| @@ -638,9 +638,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) · 637 unmodified lines | ||
| 638 | 638 | COMPATIBLE_IOCTL(PPPIOCATTCHAN) |
| 639 | 639 | COMPATIBLE_IOCTL(PPPIOCGCHAN) |
| 640 | 640 | COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) |
| 641 | −/* PPPOX */ | |
| 642 | −COMPATIBLE_IOCTL(PPPOEIOCSFWD) | |
| 643 | −COMPATIBLE_IOCTL(PPPOEIOCDFWD) | |
| 644 | 641 | /* Big A */ |
| 645 | 642 | /* sparc only */ |
| 646 | 643 | /* Big Q for sound/OSS */ |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/stat.h> |
| 8 | 8 | #include <linux/fcntl.h> |
| 9 | 9 | #include <linux/swap.h> |
| 10 | +#include <linux/ctype.h> | |
| 10 | 11 | #include <linux/string.h> |
| 11 | 12 | #include <linux/init.h> |
| 12 | 13 | #include <linux/pagemap.h> |
| @@ -187,11 +188,13 @@ put_exe_file: · 174 unmodified lines | ||
| 187 | 188 | * name into corename, which must have space for at least |
| 188 | 189 | * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. |
| 189 | 190 | */ |
| 190 | −static int format_corename(struct core_name *cn, struct coredump_params *cprm) | |
| 191 | +static int format_corename(struct core_name *cn, struct coredump_params *cprm, | |
| 192 | + size_t **argv, int *argc) | |
| 191 | 193 | { |
| 192 | 194 | const struct cred *cred = current_cred(); |
| 193 | 195 | const char *pat_ptr = core_pattern; |
| 194 | 196 | int ispipe = (*pat_ptr == '|'); |
| 197 | + bool was_space = false; | |
| 195 | 198 | int pid_in_pattern = 0; |
| 196 | 199 | int err = 0; |
| 197 | 200 | |
| @@ -201,12 +204,35 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm) · 3 unmodified lines | ||
| 201 | 204 | return -ENOMEM; |
| 202 | 205 | cn->corename[0] = '\0'; |
| 203 | 206 | |
| 204 | − if (ispipe) | |
| 207 | + if (ispipe) { | |
| 208 | + int argvs = sizeof(core_pattern) / 2; | |
| 209 | + (*argv) = kmalloc_array(argvs, sizeof(**argv), GFP_KERNEL); | |
| 210 | + if (!(*argv)) | |
| 211 | + return -ENOMEM; | |
| 212 | + (*argv)[(*argc)++] = 0; | |
| 205 | 213 | ++pat_ptr; |
| 214 | + } | |
| 206 | 215 | |
| 207 | 216 | /* Repeat as long as we have more pattern to process and more output |
| 208 | 217 | space */ |
| 209 | 218 | while (*pat_ptr) { |
| 219 | + /* | |
| 220 | + * Split on spaces before doing template expansion so that | |
| 221 | + * %e and %E don't get split if they have spaces in them | |
| 222 | + */ | |
| 223 | + if (ispipe) { | |
| 224 | + if (isspace(*pat_ptr)) { | |
| 225 | + was_space = true; | |
| 226 | + pat_ptr++; | |
| 227 | + continue; | |
| 228 | + } else if (was_space) { | |
| 229 | + was_space = false; | |
| 230 | + err = cn_printf(cn, "%c", '\0'); | |
| 231 | + if (err) | |
| 232 | + return err; | |
| 233 | + (*argv)[(*argc)++] = cn->used; | |
| 234 | + } | |
| 235 | + } | |
| 210 | 236 | if (*pat_ptr != '%') { |
| 211 | 237 | err = cn_printf(cn, "%c", *pat_ptr++); |
| 212 | 238 | } else { |
| @@ -546,6 +572,8 @@ void do_coredump(const kernel_siginfo_t *siginfo) · 333 unmodified lines | ||
| 546 | 572 | struct cred *cred; |
| 547 | 573 | int retval = 0; |
| 548 | 574 | int ispipe; |
| 575 | + size_t *argv = NULL; | |
| 576 | + int argc = 0; | |
| 549 | 577 | struct files_struct *displaced; |
| 550 | 578 | /* require nonrelative corefile path and be extra careful */ |
| 551 | 579 | bool need_suid_safe = false; |
| @@ -592,9 +620,10 @@ void do_coredump(const kernel_siginfo_t *siginfo) · 40 unmodified lines | ||
| 592 | 620 | |
| 593 | 621 | old_cred = override_creds(cred); |
| 594 | 622 | |
| 595 | − ispipe = format_corename(&cn, &cprm); | |
| 623 | + ispipe = format_corename(&cn, &cprm, &argv, &argc); | |
| 596 | 624 | |
| 597 | 625 | if (ispipe) { |
| 626 | + int argi; | |
| 598 | 627 | int dump_count; |
| 599 | 628 | char **helper_argv; |
| 600 | 629 | struct subprocess_info *sub_info; |
| @@ -637,12 +666,16 @@ void do_coredump(const kernel_siginfo_t *siginfo) · 36 unmodified lines | ||
| 637 | 666 | goto fail_dropcount; |
| 638 | 667 | } |
| 639 | 668 | |
| 640 | − helper_argv = argv_split(GFP_KERNEL, cn.corename, NULL); | |
| 669 | + helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv), | |
| 670 | + GFP_KERNEL); | |
| 641 | 671 | if (!helper_argv) { |
| 642 | 672 | printk(KERN_WARNING "%s failed to allocate memory\n", |
| 643 | 673 | __func__); |
| 644 | 674 | goto fail_dropcount; |
| 645 | 675 | } |
| 676 | + for (argi = 0; argi < argc; argi++) | |
| 677 | + helper_argv[argi] = cn.corename + argv[argi]; | |
| 678 | + helper_argv[argi] = NULL; | |
| 646 | 679 | |
| 647 | 680 | retval = -ENOMEM; |
| 648 | 681 | sub_info = call_usermodehelper_setup(helper_argv[0], |
| @@ -652,7 +685,7 @@ void do_coredump(const kernel_siginfo_t *siginfo) · 3 unmodified lines | ||
| 652 | 685 | retval = call_usermodehelper_exec(sub_info, |
| 653 | 686 | UMH_WAIT_EXEC); |
| 654 | 687 | |
| 655 | − argv_free(helper_argv); | |
| 688 | + kfree(helper_argv); | |
| 656 | 689 | if (retval) { |
| 657 | 690 | printk(KERN_INFO "Core dump to |%s pipe failed\n", |
| 658 | 691 | cn.corename); |
| @@ -766,6 +799,7 @@ fail_dropcount: · 107 unmodified lines | ||
| 766 | 799 | if (ispipe) |
| 767 | 800 | atomic_dec(&core_dump_count); |
| 768 | 801 | fail_unlock: |
| 802 | + kfree(argv); | |
| 769 | 803 | kfree(cn.corename); |
| 770 | 804 | coredump_finish(mm, core_dumped); |
| 771 | 805 | revert_creds(old_cred); |
| @@ -266,7 +266,7 @@ static void wait_entry_unlocked(struct xa_state *xas, void *entry) · 265 unmodified lines | ||
| 266 | 266 | static void put_unlocked_entry(struct xa_state *xas, void *entry) |
| 267 | 267 | { |
| 268 | 268 | /* If we were the only waiter woken, wake the next one */ |
| 269 | − if (entry && dax_is_conflict(entry)) | |
| 269 | + if (entry && !dax_is_conflict(entry)) | |
| 270 | 270 | dax_wake_entry(xas, entry, false); |
| 271 | 271 | } |
| 272 | 272 | |
| @@ -600,7 +600,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping) · 327 unmodified lines | ||
| 600 | 600 | * guaranteed to either see new references or prevent new |
| 601 | 601 | * references from being established. |
| 602 | 602 | */ |
| 603 | − unmap_mapping_range(mapping, 0, 0, 1); | |
| 603 | + unmap_mapping_range(mapping, 0, 0, 0); | |
| 604 | 604 | |
| 605 | 605 | xas_lock_irq(&xas); |
| 606 | 606 | xas_for_each(&xas, entry, ULONG_MAX) { |
| @@ -1653,19 +1653,12 @@ static int f2fs_file_flush(struct file *file, fl_owner_t id) · 1652 unmodified lines | ||
| 1653 | 1653 | static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) |
| 1654 | 1654 | { |
| 1655 | 1655 | struct f2fs_inode_info *fi = F2FS_I(inode); |
| 1656 | − u32 oldflags; | |
| 1657 | 1656 | |
| 1658 | 1657 | /* Is it quota file? Do not allow user to mess with it */ |
| 1659 | 1658 | if (IS_NOQUOTA(inode)) |
| 1660 | 1659 | return -EPERM; |
| 1661 | 1660 | |
| 1662 | − oldflags = fi->i_flags; | |
| 1663 | − | |
| 1664 | − if ((iflags ^ oldflags) & (F2FS_APPEND_FL | F2FS_IMMUTABLE_FL)) | |
| 1665 | − if (!capable(CAP_LINUX_IMMUTABLE)) | |
| 1666 | − return -EPERM; | |
| 1667 | − | |
| 1668 | − fi->i_flags = iflags | (oldflags & ~mask); | |
| 1661 | + fi->i_flags = iflags | (fi->i_flags & ~mask); | |
| 1669 | 1662 | |
| 1670 | 1663 | if (fi->i_flags & F2FS_PROJINHERIT_FL) |
| 1671 | 1664 | set_inode_flag(inode, FI_PROJ_INHERIT); |
| @@ -1770,7 +1763,8 @@ static int f2fs_ioc_getflags(struct file *filp, unsigned long arg) · 98 unmodified lines | ||
| 1770 | 1763 | static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) |
| 1771 | 1764 | { |
| 1772 | 1765 | struct inode *inode = file_inode(filp); |
| 1773 | − u32 fsflags; | |
| 1766 | + struct f2fs_inode_info *fi = F2FS_I(inode); | |
| 1767 | + u32 fsflags, old_fsflags; | |
| 1774 | 1768 | u32 iflags; |
| 1775 | 1769 | int ret; |
| 1776 | 1770 | |
| @@ -1794,8 +1788,14 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) · 17 unmodified lines | ||
| 1794 | 1788 | |
| 1795 | 1789 | inode_lock(inode); |
| 1796 | 1790 | |
| 1791 | + old_fsflags = f2fs_iflags_to_fsflags(fi->i_flags); | |
| 1792 | + ret = vfs_ioc_setflags_prepare(inode, old_fsflags, fsflags); | |
| 1793 | + if (ret) | |
| 1794 | + goto out; | |
| 1795 | + | |
| 1797 | 1796 | ret = f2fs_setflags_common(inode, iflags, |
| 1798 | 1797 | f2fs_fsflags_to_iflags(F2FS_SETTABLE_FS_FL)); |
| 1798 | +out: | |
| 1799 | 1799 | inode_unlock(inode); |
| 1800 | 1800 | mnt_drop_write_file(filp); |
| 1801 | 1801 | return ret; |
| @@ -2855,52 +2855,32 @@ static inline u32 f2fs_xflags_to_iflags(u32 xflags) · 1053 unmodified lines | ||
| 2855 | 2855 | return iflags; |
| 2856 | 2856 | } |
| 2857 | 2857 | |
| 2858 | −static int f2fs_ioc_fsgetxattr(struct file *filp, unsigned long arg) | |
| 2858 | +static void f2fs_fill_fsxattr(struct inode *inode, struct fsxattr *fa) | |
| 2859 | 2859 | { |
| 2860 | − struct inode *inode = file_inode(filp); | |
| 2861 | 2860 | struct f2fs_inode_info *fi = F2FS_I(inode); |
| 2862 | − struct fsxattr fa; | |
| 2863 | 2861 | |
| 2864 | − memset(&fa, 0, sizeof(struct fsxattr)); | |
| 2865 | − fa.fsx_xflags = f2fs_iflags_to_xflags(fi->i_flags); | |
| 2862 | + simple_fill_fsxattr(fa, f2fs_iflags_to_xflags(fi->i_flags)); | |
| 2866 | 2863 | |
| 2867 | 2864 | if (f2fs_sb_has_project_quota(F2FS_I_SB(inode))) |
| 2868 | − fa.fsx_projid = (__u32)from_kprojid(&init_user_ns, | |
| 2869 | − fi->i_projid); | |
| 2870 | − | |
| 2871 | − if (copy_to_user((struct fsxattr __user *)arg, &fa, sizeof(fa))) | |
| 2872 | − return -EFAULT; | |
| 2873 | − return 0; | |
| 2865 | + fa->fsx_projid = from_kprojid(&init_user_ns, fi->i_projid); | |
| 2874 | 2866 | } |
| 2875 | 2867 | |
| 2876 | −static int f2fs_ioctl_check_project(struct inode *inode, struct fsxattr *fa) | |
| 2868 | +static int f2fs_ioc_fsgetxattr(struct file *filp, unsigned long arg) | |
| 2877 | 2869 | { |
| 2878 | − /* | |
| 2879 | − * Project Quota ID state is only allowed to change from within the init | |
| 2880 | − * namespace. Enforce that restriction only if we are trying to change | |
| 2881 | − * the quota ID state. Everything else is allowed in user namespaces. | |
| 2882 | − */ | |
| 2883 | − if (current_user_ns() == &init_user_ns) | |
| 2884 | − return 0; | |
| 2870 | + struct inode *inode = file_inode(filp); | |
| 2871 | + struct fsxattr fa; | |
| 2885 | 2872 | |
| 2886 | − if (__kprojid_val(F2FS_I(inode)->i_projid) != fa->fsx_projid) | |
| 2887 | − return -EINVAL; | |
| 2888 | − | |
| 2889 | − if (F2FS_I(inode)->i_flags & F2FS_PROJINHERIT_FL) { | |
| 2890 | − if (!(fa->fsx_xflags & FS_XFLAG_PROJINHERIT)) | |
| 2891 | − return -EINVAL; | |
| 2892 | − } else { | |
| 2893 | − if (fa->fsx_xflags & FS_XFLAG_PROJINHERIT) | |
| 2894 | − return -EINVAL; | |
| 2895 | − } | |
| 2873 | + f2fs_fill_fsxattr(inode, &fa); | |
| 2896 | 2874 | |
| 2875 | + if (copy_to_user((struct fsxattr __user *)arg, &fa, sizeof(fa))) | |
| 2876 | + return -EFAULT; | |
| 2897 | 2877 | return 0; |
| 2898 | 2878 | } |
| 2899 | 2879 | |
| 2900 | 2880 | static int f2fs_ioc_fssetxattr(struct file *filp, unsigned long arg) |
| 2901 | 2881 | { |
| 2902 | 2882 | struct inode *inode = file_inode(filp); |
| 2903 | − struct fsxattr fa; | |
| 2883 | + struct fsxattr fa, old_fa; | |
| 2904 | 2884 | u32 iflags; |
| 2905 | 2885 | int err; |
| 2906 | 2886 | |
| @@ -2923,9 +2903,12 @@ static int f2fs_ioc_fssetxattr(struct file *filp, unsigned long arg) · 16 unmodified lines | ||
| 2923 | 2903 | return err; |
| 2924 | 2904 | |
| 2925 | 2905 | inode_lock(inode); |
| 2926 | − err = f2fs_ioctl_check_project(inode, &fa); | |
| 2906 | + | |
| 2907 | + f2fs_fill_fsxattr(inode, &old_fa); | |
| 2908 | + err = vfs_ioc_fssetxattr_check(inode, &old_fa, &fa); | |
| 2927 | 2909 | if (err) |
| 2928 | 2910 | goto out; |
| 2911 | + | |
| 2929 | 2912 | err = f2fs_setflags_common(inode, iflags, |
| 2930 | 2913 | f2fs_xflags_to_iflags(F2FS_SUPPORTED_XFLAGS)); |
| 2931 | 2914 | if (err) |
| @@ -796,6 +796,29 @@ static int move_data_block(struct inode *inode, block_t bidx, · 795 unmodified lines | ||
| 796 | 796 | if (lfs_mode) |
| 797 | 797 | down_write(&fio.sbi->io_order_lock); |
| 798 | 798 | |
| 799 | + mpage = f2fs_grab_cache_page(META_MAPPING(fio.sbi), | |
| 800 | + fio.old_blkaddr, false); | |
| 801 | + if (!mpage) | |
| 802 | + goto up_out; | |
| 803 | + | |
| 804 | + fio.encrypted_page = mpage; | |
| 805 | + | |
| 806 | + /* read source block in mpage */ | |
| 807 | + if (!PageUptodate(mpage)) { | |
| 808 | + err = f2fs_submit_page_bio(&fio); | |
| 809 | + if (err) { | |
| 810 | + f2fs_put_page(mpage, 1); | |
| 811 | + goto up_out; | |
| 812 | + } | |
| 813 | + lock_page(mpage); | |
| 814 | + if (unlikely(mpage->mapping != META_MAPPING(fio.sbi) || | |
| 815 | + !PageUptodate(mpage))) { | |
| 816 | + err = -EIO; | |
| 817 | + f2fs_put_page(mpage, 1); | |
| 818 | + goto up_out; | |
| 819 | + } | |
| 820 | + } | |
| 821 | + | |
| 799 | 822 | f2fs_allocate_data_block(fio.sbi, NULL, fio.old_blkaddr, &newaddr, |
| 800 | 823 | &sum, CURSEG_COLD_DATA, NULL, false); |
| 801 | 824 | |
| @@ -803,44 +826,18 @@ static int move_data_block(struct inode *inode, block_t bidx, · 1 unmodified line | ||
| 803 | 826 | newaddr, FGP_LOCK | FGP_CREAT, GFP_NOFS); |
| 804 | 827 | if (!fio.encrypted_page) { |
| 805 | 828 | err = -ENOMEM; |
| 806 | − goto recover_block; | |
| 807 | − } | |
| 808 | − | |
| 809 | − mpage = f2fs_pagecache_get_page(META_MAPPING(fio.sbi), | |
| 810 | − fio.old_blkaddr, FGP_LOCK, GFP_NOFS); | |
| 811 | − if (mpage) { | |
| 812 | − bool updated = false; | |
| 813 | − | |
| 814 | − if (PageUptodate(mpage)) { | |
| 815 | − memcpy(page_address(fio.encrypted_page), | |
| 816 | − page_address(mpage), PAGE_SIZE); | |
| 817 | − updated = true; | |
| 818 | − } | |
| 819 | 829 | f2fs_put_page(mpage, 1); |
| 820 | − invalidate_mapping_pages(META_MAPPING(fio.sbi), | |
| 821 | − fio.old_blkaddr, fio.old_blkaddr); | |
| 822 | − if (updated) | |
| 823 | − goto write_page; | |
| 824 | − } | |
| 825 | − | |
| 826 | − err = f2fs_submit_page_bio(&fio); | |
| 827 | − if (err) | |
| 828 | − goto put_page_out; | |
| 829 | − | |
| 830 | − /* write page */ | |
| 831 | − lock_page(fio.encrypted_page); | |
| 832 | − | |
| 833 | − if (unlikely(fio.encrypted_page->mapping != META_MAPPING(fio.sbi))) { | |
| 834 | − err = -EIO; | |
| 835 | − goto put_page_out; | |
| 836 | − } | |
| 837 | − if (unlikely(!PageUptodate(fio.encrypted_page))) { | |
| 838 | − err = -EIO; | |
| 839 | − goto put_page_out; | |
| 830 | + goto recover_block; | |
| 840 | 831 | } |
| 841 | 832 | |
| 842 | −write_page: | |
| 833 | + /* write target block */ | |
| 843 | 834 | f2fs_wait_on_page_writeback(fio.encrypted_page, DATA, true, true); |
| 835 | + memcpy(page_address(fio.encrypted_page), | |
| 836 | + page_address(mpage), PAGE_SIZE); | |
| 837 | + f2fs_put_page(mpage, 1); | |
| 838 | + invalidate_mapping_pages(META_MAPPING(fio.sbi), | |
| 839 | + fio.old_blkaddr, fio.old_blkaddr); | |
| 840 | + | |
| 844 | 841 | set_page_dirty(fio.encrypted_page); |
| 845 | 842 | if (clear_page_dirty_for_io(fio.encrypted_page)) |
| 846 | 843 | dec_page_count(fio.sbi, F2FS_DIRTY_META); |
| @@ -871,11 +868,12 @@ write_page: · 24 unmodified lines | ||
| 871 | 868 | put_page_out: |
| 872 | 869 | f2fs_put_page(fio.encrypted_page, 1); |
| 873 | 870 | recover_block: |
| 874 | − if (lfs_mode) | |
| 875 | − up_write(&fio.sbi->io_order_lock); | |
| 876 | 871 | if (err) |
| 877 | 872 | f2fs_do_replace_block(fio.sbi, &sum, newaddr, fio.old_blkaddr, |
| 878 | 873 | true, true); |
| 874 | +up_out: | |
| 875 | + if (lfs_mode) | |
| 876 | + up_write(&fio.sbi->io_order_lock); | |
| 879 | 877 | put_out: |
| 880 | 878 | f2fs_put_dnode(&dn); |
| 881 | 879 | out: |
| @@ -2422,6 +2422,12 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 2421 unmodified lines | ||
| 2422 | 2422 | size_t crc_offset = 0; |
| 2423 | 2423 | __u32 crc = 0; |
| 2424 | 2424 | |
| 2425 | + if (le32_to_cpu(raw_super->magic) != F2FS_SUPER_MAGIC) { | |
| 2426 | + f2fs_info(sbi, "Magic Mismatch, valid(0x%x) - read(0x%x)", | |
| 2427 | + F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic)); | |
| 2428 | + return -EINVAL; | |
| 2429 | + } | |
| 2430 | + | |
| 2425 | 2431 | /* Check checksum_offset and crc in superblock */ |
| 2426 | 2432 | if (__F2FS_HAS_FEATURE(raw_super, F2FS_FEATURE_SB_CHKSUM)) { |
| 2427 | 2433 | crc_offset = le32_to_cpu(raw_super->checksum_offset); |
| @@ -2429,26 +2435,20 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 1 unmodified line | ||
| 2429 | 2435 | offsetof(struct f2fs_super_block, crc)) { |
| 2430 | 2436 | f2fs_info(sbi, "Invalid SB checksum offset: %zu", |
| 2431 | 2437 | crc_offset); |
| 2432 | − return 1; | |
| 2438 | + return -EFSCORRUPTED; | |
| 2433 | 2439 | } |
| 2434 | 2440 | crc = le32_to_cpu(raw_super->crc); |
| 2435 | 2441 | if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) { |
| 2436 | 2442 | f2fs_info(sbi, "Invalid SB checksum value: %u", crc); |
| 2437 | − return 1; | |
| 2443 | + return -EFSCORRUPTED; | |
| 2438 | 2444 | } |
| 2439 | 2445 | } |
| 2440 | 2446 | |
| 2441 | − if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) { | |
| 2442 | − f2fs_info(sbi, "Magic Mismatch, valid(0x%x) - read(0x%x)", | |
| 2443 | − F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic)); | |
| 2444 | − return 1; | |
| 2445 | − } | |
| 2446 | − | |
| 2447 | 2447 | /* Currently, support only 4KB page cache size */ |
| 2448 | 2448 | if (F2FS_BLKSIZE != PAGE_SIZE) { |
| 2449 | 2449 | f2fs_info(sbi, "Invalid page_cache_size (%lu), supports only 4KB", |
| 2450 | 2450 | PAGE_SIZE); |
| 2451 | − return 1; | |
| 2451 | + return -EFSCORRUPTED; | |
| 2452 | 2452 | } |
| 2453 | 2453 | |
| 2454 | 2454 | /* Currently, support only 4KB block size */ |
| @@ -2456,14 +2456,14 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 1 unmodified line | ||
| 2456 | 2456 | if (blocksize != F2FS_BLKSIZE) { |
| 2457 | 2457 | f2fs_info(sbi, "Invalid blocksize (%u), supports only 4KB", |
| 2458 | 2458 | blocksize); |
| 2459 | − return 1; | |
| 2459 | + return -EFSCORRUPTED; | |
| 2460 | 2460 | } |
| 2461 | 2461 | |
| 2462 | 2462 | /* check log blocks per segment */ |
| 2463 | 2463 | if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) { |
| 2464 | 2464 | f2fs_info(sbi, "Invalid log blocks per segment (%u)", |
| 2465 | 2465 | le32_to_cpu(raw_super->log_blocks_per_seg)); |
| 2466 | − return 1; | |
| 2466 | + return -EFSCORRUPTED; | |
| 2467 | 2467 | } |
| 2468 | 2468 | |
| 2469 | 2469 | /* Currently, support 512/1024/2048/4096 bytes sector size */ |
| @@ -2473,7 +2473,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 3 unmodified lines | ||
| 2473 | 2473 | F2FS_MIN_LOG_SECTOR_SIZE) { |
| 2474 | 2474 | f2fs_info(sbi, "Invalid log sectorsize (%u)", |
| 2475 | 2475 | le32_to_cpu(raw_super->log_sectorsize)); |
| 2476 | − return 1; | |
| 2476 | + return -EFSCORRUPTED; | |
| 2477 | 2477 | } |
| 2478 | 2478 | if (le32_to_cpu(raw_super->log_sectors_per_block) + |
| 2479 | 2479 | le32_to_cpu(raw_super->log_sectorsize) != |
| @@ -2481,7 +2481,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 1 unmodified line | ||
| 2481 | 2481 | f2fs_info(sbi, "Invalid log sectors per block(%u) log sectorsize(%u)", |
| 2482 | 2482 | le32_to_cpu(raw_super->log_sectors_per_block), |
| 2483 | 2483 | le32_to_cpu(raw_super->log_sectorsize)); |
| 2484 | − return 1; | |
| 2484 | + return -EFSCORRUPTED; | |
| 2485 | 2485 | } |
| 2486 | 2486 | |
| 2487 | 2487 | segment_count = le32_to_cpu(raw_super->segment_count); |
| @@ -2495,7 +2495,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 7 unmodified lines | ||
| 2495 | 2495 | if (segment_count > F2FS_MAX_SEGMENT || |
| 2496 | 2496 | segment_count < F2FS_MIN_SEGMENTS) { |
| 2497 | 2497 | f2fs_info(sbi, "Invalid segment count (%u)", segment_count); |
| 2498 | − return 1; | |
| 2498 | + return -EFSCORRUPTED; | |
| 2499 | 2499 | } |
| 2500 | 2500 | |
| 2501 | 2501 | if (total_sections > segment_count || |
| @@ -2503,25 +2503,25 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 1 unmodified line | ||
| 2503 | 2503 | segs_per_sec > segment_count || !segs_per_sec) { |
| 2504 | 2504 | f2fs_info(sbi, "Invalid segment/section count (%u, %u x %u)", |
| 2505 | 2505 | segment_count, total_sections, segs_per_sec); |
| 2506 | − return 1; | |
| 2506 | + return -EFSCORRUPTED; | |
| 2507 | 2507 | } |
| 2508 | 2508 | |
| 2509 | 2509 | if ((segment_count / segs_per_sec) < total_sections) { |
| 2510 | 2510 | f2fs_info(sbi, "Small segment_count (%u < %u * %u)", |
| 2511 | 2511 | segment_count, segs_per_sec, total_sections); |
| 2512 | − return 1; | |
| 2512 | + return -EFSCORRUPTED; | |
| 2513 | 2513 | } |
| 2514 | 2514 | |
| 2515 | 2515 | if (segment_count > (le64_to_cpu(raw_super->block_count) >> 9)) { |
| 2516 | 2516 | f2fs_info(sbi, "Wrong segment_count / block_count (%u > %llu)", |
| 2517 | 2517 | segment_count, le64_to_cpu(raw_super->block_count)); |
| 2518 | − return 1; | |
| 2518 | + return -EFSCORRUPTED; | |
| 2519 | 2519 | } |
| 2520 | 2520 | |
| 2521 | 2521 | if (secs_per_zone > total_sections || !secs_per_zone) { |
| 2522 | 2522 | f2fs_info(sbi, "Wrong secs_per_zone / total_sections (%u, %u)", |
| 2523 | 2523 | secs_per_zone, total_sections); |
| 2524 | − return 1; | |
| 2524 | + return -EFSCORRUPTED; | |
| 2525 | 2525 | } |
| 2526 | 2526 | if (le32_to_cpu(raw_super->extension_count) > F2FS_MAX_EXTENSION || |
| 2527 | 2527 | raw_super->hot_ext_count > F2FS_MAX_EXTENSION || |
| @@ -2531,7 +2531,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 3 unmodified lines | ||
| 2531 | 2531 | le32_to_cpu(raw_super->extension_count), |
| 2532 | 2532 | raw_super->hot_ext_count, |
| 2533 | 2533 | F2FS_MAX_EXTENSION); |
| 2534 | − return 1; | |
| 2534 | + return -EFSCORRUPTED; | |
| 2535 | 2535 | } |
| 2536 | 2536 | |
| 2537 | 2537 | if (le32_to_cpu(raw_super->cp_payload) > |
| @@ -2539,7 +2539,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 1 unmodified line | ||
| 2539 | 2539 | f2fs_info(sbi, "Insane cp_payload (%u > %u)", |
| 2540 | 2540 | le32_to_cpu(raw_super->cp_payload), |
| 2541 | 2541 | blocks_per_seg - F2FS_CP_PACKS); |
| 2542 | − return 1; | |
| 2542 | + return -EFSCORRUPTED; | |
| 2543 | 2543 | } |
| 2544 | 2544 | |
| 2545 | 2545 | /* check reserved ino info */ |
| @@ -2550,12 +2550,12 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, · 4 unmodified lines | ||
| 2550 | 2550 | le32_to_cpu(raw_super->node_ino), |
| 2551 | 2551 | le32_to_cpu(raw_super->meta_ino), |
| 2552 | 2552 | le32_to_cpu(raw_super->root_ino)); |
| 2553 | − return 1; | |
| 2553 | + return -EFSCORRUPTED; | |
| 2554 | 2554 | } |
| 2555 | 2555 | |
| 2556 | 2556 | /* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */ |
| 2557 | 2557 | if (sanity_check_area_boundary(sbi, bh)) |
| 2558 | − return 1; | |
| 2558 | + return -EFSCORRUPTED; | |
| 2559 | 2559 | |
| 2560 | 2560 | return 0; |
| 2561 | 2561 | } |
| @@ -2870,10 +2870,10 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, · 308 unmodified lines | ||
| 2870 | 2870 | } |
| 2871 | 2871 | |
| 2872 | 2872 | /* sanity checking of raw super */ |
| 2873 | − if (sanity_check_raw_super(sbi, bh)) { | |
| 2873 | + err = sanity_check_raw_super(sbi, bh); | |
| 2874 | + if (err) { | |
| 2874 | 2875 | f2fs_err(sbi, "Can't find valid F2FS filesystem in %dth superblock", |
| 2875 | 2876 | block + 1); |
| 2876 | − err = -EFSCORRUPTED; | |
| 2877 | 2877 | brelse(bh); |
| 2878 | 2878 | continue; |
| 2879 | 2879 | } |
| @@ -390,6 +390,19 @@ static int fillup_metapath(struct gfs2_inode *ip, struct metapath *mp, int h) · 389 unmodified lines | ||
| 390 | 390 | return mp->mp_aheight - x - 1; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | +static sector_t metapath_to_block(struct gfs2_sbd *sdp, struct metapath *mp) | |
| 394 | +{ | |
| 395 | + sector_t factor = 1, block = 0; | |
| 396 | + int hgt; | |
| 397 | + | |
| 398 | + for (hgt = mp->mp_fheight - 1; hgt >= 0; hgt--) { | |
| 399 | + if (hgt < mp->mp_aheight) | |
| 400 | + block += mp->mp_list[hgt] * factor; | |
| 401 | + factor *= sdp->sd_inptrs; | |
| 402 | + } | |
| 403 | + return block; | |
| 404 | +} | |
| 405 | + | |
| 393 | 406 | static void release_metapath(struct metapath *mp) |
| 394 | 407 | { |
| 395 | 408 | int i; |
| @@ -430,60 +443,84 @@ static inline unsigned int gfs2_extent_length(struct buffer_head *bh, __be64 *pt · 34 unmodified lines | ||
| 430 | 443 | return ptr - first; |
| 431 | 444 | } |
| 432 | 445 | |
| 433 | −typedef const __be64 *(*gfs2_metadata_walker)( | |
| 434 | − struct metapath *mp, | |
| 435 | − const __be64 *start, const __be64 *end, | |
| 436 | − u64 factor, void *data); | |
| 446 | +enum walker_status { WALK_STOP, WALK_FOLLOW, WALK_CONTINUE }; | |
| 447 | + | |
| 448 | +/* | |
| 449 | + * gfs2_metadata_walker - walk an indirect block | |
| 450 | + * @mp: Metapath to indirect block | |
| 451 | + * @ptrs: Number of pointers to look at | |
| 452 | + * | |
| 453 | + * When returning WALK_FOLLOW, the walker must update @mp to point at the right | |
| 454 | + * indirect block to follow. | |
| 455 | + */ | |
| 456 | +typedef enum walker_status (*gfs2_metadata_walker)(struct metapath *mp, | |
| 457 | + unsigned int ptrs); | |
| 437 | 458 | |
| 438 | −#define WALK_STOP ((__be64 *)0) | |
| 439 | −#define WALK_NEXT ((__be64 *)1) | |
| 459 | +/* | |
| 460 | + * gfs2_walk_metadata - walk a tree of indirect blocks | |
| 461 | + * @inode: The inode | |
| 462 | + * @mp: Starting point of walk | |
| 463 | + * @max_len: Maximum number of blocks to walk | |
| 464 | + * @walker: Called during the walk | |
| 465 | + * | |
| 466 | + * Returns 1 if the walk was stopped by @walker, 0 if we went past @max_len or | |
| 467 | + * past the end of metadata, and a negative error code otherwise. | |
| 468 | + */ | |
| 440 | 469 | |
| 441 | −static int gfs2_walk_metadata(struct inode *inode, sector_t lblock, | |
| 442 | − u64 len, struct metapath *mp, gfs2_metadata_walker walker, | |
| 443 | − void *data) | |
| 470 | +static int gfs2_walk_metadata(struct inode *inode, struct metapath *mp, | |
| 471 | + u64 max_len, gfs2_metadata_walker walker) | |
| 444 | 472 | { |
| 445 | − struct metapath clone; | |
| 446 | 473 | struct gfs2_inode *ip = GFS2_I(inode); |
| 447 | 474 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
| 448 | − const __be64 *start, *end, *ptr; | |
| 449 | 475 | u64 factor = 1; |
| 450 | 476 | unsigned int hgt; |
| 451 | − int ret = 0; | |
| 477 | + int ret; | |
| 452 | 478 | |
| 453 | − for (hgt = ip->i_height - 1; hgt >= mp->mp_aheight; hgt--) | |
| 479 | + /* | |
| 480 | + * The walk starts in the lowest allocated indirect block, which may be | |
| 481 | + * before the position indicated by @mp. Adjust @max_len accordingly | |
| 482 | + * to avoid a short walk. | |
| 483 | + */ | |
| 484 | + for (hgt = mp->mp_fheight - 1; hgt >= mp->mp_aheight; hgt--) { | |
| 485 | + max_len += mp->mp_list[hgt] * factor; | |
| 486 | + mp->mp_list[hgt] = 0; | |
| 454 | 487 | factor *= sdp->sd_inptrs; |
| 488 | + } | |
| 455 | 489 | |
| 456 | 490 | for (;;) { |
| 457 | − u64 step; | |
| 491 | + u16 start = mp->mp_list[hgt]; | |
| 492 | + enum walker_status status; | |
| 493 | + unsigned int ptrs; | |
| 494 | + u64 len; | |
| 458 | 495 | |
| 459 | 496 | /* Walk indirect block. */ |
| 460 | − start = metapointer(hgt, mp); | |
| 461 | − end = metaend(hgt, mp); | |
| 462 | − | |
| 463 | − step = (end - start) * factor; | |
| 464 | − if (step > len) | |
| 465 | − end = start + DIV_ROUND_UP_ULL(len, factor); | |
| 466 | − | |
| 467 | − ptr = walker(mp, start, end, factor, data); | |
| 468 | − if (ptr == WALK_STOP) | |
| 497 | + ptrs = (hgt >= 1 ? sdp->sd_inptrs : sdp->sd_diptrs) - start; | |
| 498 | + len = ptrs * factor; | |
| 499 | + if (len > max_len) | |
| 500 | + ptrs = DIV_ROUND_UP_ULL(max_len, factor); | |
| 501 | + status = walker(mp, ptrs); | |
| 502 | + switch (status) { | |
| 503 | + case WALK_STOP: | |
| 504 | + return 1; | |
| 505 | + case WALK_FOLLOW: | |
| 506 | + BUG_ON(mp->mp_aheight == mp->mp_fheight); | |
| 507 | + ptrs = mp->mp_list[hgt] - start; | |
| 508 | + len = ptrs * factor; | |
| 469 | 509 | break; |
| 470 | − if (step >= len) | |
| 510 | + case WALK_CONTINUE: | |
| 471 | 511 | break; |
| 472 | − len -= step; | |
| 473 | − if (ptr != WALK_NEXT) { | |
| 474 | − BUG_ON(!*ptr); | |
| 475 | − mp->mp_list[hgt] += ptr - start; | |
| 476 | − goto fill_up_metapath; | |
| 477 | 512 | } |
| 513 | + if (len >= max_len) | |
| 514 | + break; | |
| 515 | + max_len -= len; | |
| 516 | + if (status == WALK_FOLLOW) | |
| 517 | + goto fill_up_metapath; | |
| 478 | 518 | |
| 479 | 519 | lower_metapath: |
| 480 | 520 | /* Decrease height of metapath. */ |
| 481 | − if (mp != &clone) { | |
| 482 | − clone_metapath(&clone, mp); | |
| 483 | − mp = &clone; | |
| 484 | − } | |
| 485 | 521 | brelse(mp->mp_bh[hgt]); |
| 486 | 522 | mp->mp_bh[hgt] = NULL; |
| 523 | + mp->mp_list[hgt] = 0; | |
| 487 | 524 | if (!hgt) |
| 488 | 525 | break; |
| 489 | 526 | hgt--; |
| @@ -491,10 +528,7 @@ lower_metapath: · 1 unmodified line | ||
| 491 | 528 | |
| 492 | 529 | /* Advance in metadata tree. */ |
| 493 | 530 | (mp->mp_list[hgt])++; |
| 494 | − start = metapointer(hgt, mp); | |
| 495 | − end = metaend(hgt, mp); | |
| 496 | − if (start >= end) { | |
| 497 | − mp->mp_list[hgt] = 0; | |
| 531 | + if (mp->mp_list[hgt] >= sdp->sd_inptrs) { | |
| 498 | 532 | if (!hgt) |
| 499 | 533 | break; |
| 500 | 534 | goto lower_metapath; |
| @@ -502,44 +536,36 @@ lower_metapath: · 1 unmodified line | ||
| 502 | 536 | |
| 503 | 537 | fill_up_metapath: |
| 504 | 538 | /* Increase height of metapath. */ |
| 505 | − if (mp != &clone) { | |
| 506 | − clone_metapath(&clone, mp); | |
| 507 | − mp = &clone; | |
| 508 | − } | |
| 509 | 539 | ret = fillup_metapath(ip, mp, ip->i_height - 1); |
| 510 | 540 | if (ret < 0) |
| 511 | − break; | |
| 541 | + return ret; | |
| 512 | 542 | hgt += ret; |
| 513 | 543 | for (; ret; ret--) |
| 514 | 544 | do_div(factor, sdp->sd_inptrs); |
| 515 | 545 | mp->mp_aheight = hgt + 1; |
| 516 | 546 | } |
| 517 | − if (mp == &clone) | |
| 518 | − release_metapath(mp); | |
| 519 | − return ret; | |
| 547 | + return 0; | |
| 520 | 548 | } |
| 521 | 549 | |
| 522 | −struct gfs2_hole_walker_args { | |
| 523 | − u64 blocks; | |
| 524 | −}; | |
| 525 | − | |
| 526 | −static const __be64 *gfs2_hole_walker(struct metapath *mp, | |
| 527 | − const __be64 *start, const __be64 *end, | |
| 528 | − u64 factor, void *data) | |
| 550 | +static enum walker_status gfs2_hole_walker(struct metapath *mp, | |
| 551 | + unsigned int ptrs) | |
| 529 | 552 | { |
| 530 | − struct gfs2_hole_walker_args *args = data; | |
| 531 | − const __be64 *ptr; | |
| 553 | + const __be64 *start, *ptr, *end; | |
| 554 | + unsigned int hgt; | |
| 555 | + | |
| 556 | + hgt = mp->mp_aheight - 1; | |
| 557 | + start = metapointer(hgt, mp); | |
| 558 | + end = start + ptrs; | |
| 532 | 559 | |
| 533 | 560 | for (ptr = start; ptr < end; ptr++) { |
| 534 | 561 | if (*ptr) { |
| 535 | − args->blocks += (ptr - start) * factor; | |
| 562 | + mp->mp_list[hgt] += ptr - start; | |
| 536 | 563 | if (mp->mp_aheight == mp->mp_fheight) |
| 537 | 564 | return WALK_STOP; |
| 538 | − return ptr; /* increase height */ | |
| 565 | + return WALK_FOLLOW; | |
| 539 | 566 | } |
| 540 | 567 | } |
| 541 | − args->blocks += (end - start) * factor; | |
| 542 | − return WALK_NEXT; | |
| 568 | + return WALK_CONTINUE; | |
| 543 | 569 | } |
| 544 | 570 | |
| 545 | 571 | /** |
| @@ -557,12 +583,24 @@ static const __be64 *gfs2_hole_walker(struct metapath *mp, · 11 unmodified lines | ||
| 557 | 583 | static int gfs2_hole_size(struct inode *inode, sector_t lblock, u64 len, |
| 558 | 584 | struct metapath *mp, struct iomap *iomap) |
| 559 | 585 | { |
| 560 | − struct gfs2_hole_walker_args args = { }; | |
| 561 | − int ret = 0; | |
| 586 | + struct metapath clone; | |
| 587 | + u64 hole_size; | |
| 588 | + int ret; | |
| 562 | 589 | |
| 563 | − ret = gfs2_walk_metadata(inode, lblock, len, mp, gfs2_hole_walker, &args); | |
| 564 | − if (!ret) | |
| 565 | − iomap->length = args.blocks << inode->i_blkbits; | |
| 590 | + clone_metapath(&clone, mp); | |
| 591 | + ret = gfs2_walk_metadata(inode, &clone, len, gfs2_hole_walker); | |
| 592 | + if (ret < 0) | |
| 593 | + goto out; | |
| 594 | + | |
| 595 | + if (ret == 1) | |
| 596 | + hole_size = metapath_to_block(GFS2_SB(inode), &clone) - lblock; | |
| 597 | + else | |
| 598 | + hole_size = len; | |
| 599 | + iomap->length = hole_size << inode->i_blkbits; | |
| 600 | + ret = 0; | |
| 601 | + | |
| 602 | +out: | |
| 603 | + release_metapath(&clone); | |
| 566 | 604 | return ret; |
| 567 | 605 | } |
| 568 | 606 | |
| @@ -1002,11 +1040,16 @@ static void gfs2_iomap_page_done(struct inode *inode, loff_t pos, · 433 unmodified lines | ||
| 1002 | 1040 | unsigned copied, struct page *page, |
| 1003 | 1041 | struct iomap *iomap) |
| 1004 | 1042 | { |
| 1043 | + struct gfs2_trans *tr = current->journal_info; | |
| 1005 | 1044 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1006 | 1045 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
| 1007 | 1046 | |
| 1008 | 1047 | if (page && !gfs2_is_stuffed(ip)) |
| 1009 | 1048 | gfs2_page_add_databufs(ip, page, offset_in_page(pos), copied); |
| 1049 | + | |
| 1050 | + if (tr->tr_num_buf_new) | |
| 1051 | + __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | |
| 1052 | + | |
| 1010 | 1053 | gfs2_trans_end(sdp); |
| 1011 | 1054 | } |
| 1012 | 1055 | |
| @@ -1099,8 +1142,6 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, · 86 unmodified lines | ||
| 1099 | 1142 | tr = current->journal_info; |
| 1100 | 1143 | if (tr->tr_num_buf_new) |
| 1101 | 1144 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
| 1102 | − else | |
| 1103 | − gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[0]); | |
| 1104 | 1145 | |
| 1105 | 1146 | gfs2_trans_end(sdp); |
| 1106 | 1147 | } |
| @@ -1181,10 +1222,16 @@ static int gfs2_iomap_end(struct inode *inode, loff_t pos, loff_t length, · 74 unmodified lines | ||
| 1181 | 1222 | |
| 1182 | 1223 | if (ip->i_qadata && ip->i_qadata->qa_qd_num) |
| 1183 | 1224 | gfs2_quota_unlock(ip); |
| 1225 | + | |
| 1226 | + if (unlikely(!written)) | |
| 1227 | + goto out_unlock; | |
| 1228 | + | |
| 1184 | 1229 | if (iomap->flags & IOMAP_F_SIZE_CHANGED) |
| 1185 | 1230 | mark_inode_dirty(inode); |
| 1186 | − gfs2_write_unlock(inode); | |
| 1231 | + set_bit(GLF_DIRTY, &ip->i_gl->gl_flags); | |
| 1187 | 1232 | |
| 1233 | +out_unlock: | |
| 1234 | + gfs2_write_unlock(inode); | |
| 1188 | 1235 | out: |
| 1189 | 1236 | return 0; |
| 1190 | 1237 | } |
| @@ -1838,6 +1838,7 @@ restart: · 1837 unmodified lines | ||
| 1838 | 1838 | do { |
| 1839 | 1839 | struct sqe_submit *s = &req->submit; |
| 1840 | 1840 | const struct io_uring_sqe *sqe = s->sqe; |
| 1841 | + unsigned int flags = req->flags; | |
| 1841 | 1842 | |
| 1842 | 1843 | /* Ensure we clear previously set non-block flag */ |
| 1843 | 1844 | req->rw.ki_flags &= ~IOCB_NOWAIT; |
| @@ -1883,7 +1884,7 @@ restart: · 39 unmodified lines | ||
| 1883 | 1884 | kfree(sqe); |
| 1884 | 1885 | |
| 1885 | 1886 | /* req from defer and link list needn't decrease async cnt */ |
| 1886 | − if (req->flags & (REQ_F_IO_DRAINED | REQ_F_LINK_DONE)) | |
| 1887 | + if (flags & (REQ_F_IO_DRAINED | REQ_F_LINK_DONE)) | |
| 1887 | 1888 | goto out; |
| 1888 | 1889 | |
| 1889 | 1890 | if (!async_list) |
| @@ -153,7 +153,7 @@ again: · 152 unmodified lines | ||
| 153 | 153 | /* Block nfs4_proc_unlck */ |
| 154 | 154 | mutex_lock(&sp->so_delegreturn_mutex); |
| 155 | 155 | seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); |
| 156 | − err = nfs4_open_delegation_recall(ctx, state, stateid, type); | |
| 156 | + err = nfs4_open_delegation_recall(ctx, state, stateid); | |
| 157 | 157 | if (!err) |
| 158 | 158 | err = nfs_delegation_claim_locks(state, stateid); |
| 159 | 159 | if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) |
| @@ -1046,6 +1046,22 @@ void nfs_test_expired_all_delegations(struct nfs_client *clp) · 886 unmodified lines | ||
| 1046 | 1046 | nfs4_schedule_state_manager(clp); |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | +static void | |
| 1050 | +nfs_delegation_test_free_expired(struct inode *inode, | |
| 1051 | + nfs4_stateid *stateid, | |
| 1052 | + const struct cred *cred) | |
| 1053 | +{ | |
| 1054 | + struct nfs_server *server = NFS_SERVER(inode); | |
| 1055 | + const struct nfs4_minor_version_ops *ops = server->nfs_client->cl_mvops; | |
| 1056 | + int status; | |
| 1057 | + | |
| 1058 | + if (!cred) | |
| 1059 | + return; | |
| 1060 | + status = ops->test_and_free_expired(server, stateid, cred); | |
| 1061 | + if (status == -NFS4ERR_EXPIRED || status == -NFS4ERR_BAD_STATEID) | |
| 1062 | + nfs_remove_bad_delegation(inode, stateid); | |
| 1063 | +} | |
| 1064 | + | |
| 1049 | 1065 | /** |
| 1050 | 1066 | * nfs_reap_expired_delegations - reap expired delegations |
| 1051 | 1067 | * @clp: nfs_client to process |
| @@ -1057,7 +1073,6 @@ void nfs_test_expired_all_delegations(struct nfs_client *clp) · 5 unmodified lines | ||
| 1057 | 1073 | */ |
| 1058 | 1074 | void nfs_reap_expired_delegations(struct nfs_client *clp) |
| 1059 | 1075 | { |
| 1060 | − const struct nfs4_minor_version_ops *ops = clp->cl_mvops; | |
| 1061 | 1076 | struct nfs_delegation *delegation; |
| 1062 | 1077 | struct nfs_server *server; |
| 1063 | 1078 | struct inode *inode; |
| @@ -1088,11 +1103,7 @@ restart: · 24 unmodified lines | ||
| 1088 | 1103 | nfs4_stateid_copy(&stateid, &delegation->stateid); |
| 1089 | 1104 | clear_bit(NFS_DELEGATION_TEST_EXPIRED, &delegation->flags); |
| 1090 | 1105 | rcu_read_unlock(); |
| 1091 | − if (cred != NULL && | |
| 1092 | − ops->test_and_free_expired(server, &stateid, cred) < 0) { | |
| 1093 | − nfs_revoke_delegation(inode, &stateid); | |
| 1094 | − nfs_inode_find_state_and_recover(inode, &stateid); | |
| 1095 | − } | |
| 1106 | + nfs_delegation_test_free_expired(inode, &stateid, cred); | |
| 1096 | 1107 | put_cred(cred); |
| 1097 | 1108 | if (nfs4_server_rebooted(clp)) { |
| 1098 | 1109 | nfs_inode_mark_test_expired_delegation(server,inode); |
| @@ -63,7 +63,7 @@ void nfs_reap_expired_delegations(struct nfs_client *clp); · 62 unmodified lines | ||
| 63 | 63 | |
| 64 | 64 | /* NFSv4 delegation-related procedures */ |
| 65 | 65 | int nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, const nfs4_stateid *stateid, int issync); |
| 66 | −int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid, fmode_t type); | |
| 66 | +int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid); | |
| 67 | 67 | int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, const nfs4_stateid *stateid); |
| 68 | 68 | bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags, nfs4_stateid *dst, const struct cred **cred); |
| 69 | 69 | bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode); |
| @@ -114,6 +114,10 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int · 113 unmodified lines | ||
| 114 | 114 | struct rb_node **p, *parent; |
| 115 | 115 | int diff; |
| 116 | 116 | |
| 117 | + nfss->fscache_key = NULL; | |
| 118 | + nfss->fscache = NULL; | |
| 119 | + if (!(nfss->options & NFS_OPTION_FSCACHE)) | |
| 120 | + return; | |
| 117 | 121 | if (!uniq) { |
| 118 | 122 | uniq = ""; |
| 119 | 123 | ulen = 1; |
| @@ -226,10 +230,11 @@ void nfs_fscache_release_super_cookie(struct super_block *sb) · 106 unmodified lines | ||
| 226 | 230 | void nfs_fscache_init_inode(struct inode *inode) |
| 227 | 231 | { |
| 228 | 232 | struct nfs_fscache_inode_auxdata auxdata; |
| 233 | + struct nfs_server *nfss = NFS_SERVER(inode); | |
| 229 | 234 | struct nfs_inode *nfsi = NFS_I(inode); |
| 230 | 235 | |
| 231 | 236 | nfsi->fscache = NULL; |
| 232 | − if (!S_ISREG(inode->i_mode)) | |
| 237 | + if (!(nfss->fscache && S_ISREG(inode->i_mode))) | |
| 233 | 238 | return; |
| 234 | 239 | |
| 235 | 240 | memset(&auxdata, 0, sizeof(auxdata)); |
| @@ -182,7 +182,7 @@ static inline void nfs_fscache_wait_on_invalidate(struct inode *inode) · 181 unmodified lines | ||
| 182 | 182 | */ |
| 183 | 183 | static inline const char *nfs_server_fscache_state(struct nfs_server *server) |
| 184 | 184 | { |
| 185 | − if (server->fscache && (server->options & NFS_OPTION_FSCACHE)) | |
| 185 | + if (server->fscache) | |
| 186 | 186 | return "yes"; |
| 187 | 187 | return "no "; |
| 188 | 188 | } |
| @@ -465,7 +465,8 @@ static inline void nfs4_schedule_session_recovery(struct nfs4_session *session, · 464 unmodified lines | ||
| 465 | 465 | |
| 466 | 466 | extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, const struct cred *, gfp_t); |
| 467 | 467 | extern void nfs4_put_state_owner(struct nfs4_state_owner *); |
| 468 | −extern void nfs4_purge_state_owners(struct nfs_server *); | |
| 468 | +extern void nfs4_purge_state_owners(struct nfs_server *, struct list_head *); | |
| 469 | +extern void nfs4_free_state_owners(struct list_head *head); | |
| 469 | 470 | extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); |
| 470 | 471 | extern void nfs4_put_open_state(struct nfs4_state *); |
| 471 | 472 | extern void nfs4_close_state(struct nfs4_state *, fmode_t); |
| @@ -758,9 +758,12 @@ out: · 757 unmodified lines | ||
| 758 | 758 | |
| 759 | 759 | static void nfs4_destroy_server(struct nfs_server *server) |
| 760 | 760 | { |
| 761 | + LIST_HEAD(freeme); | |
| 762 | + | |
| 761 | 763 | nfs_server_return_all_delegations(server); |
| 762 | 764 | unset_pnfs_layoutdriver(server); |
| 763 | − nfs4_purge_state_owners(server); | |
| 765 | + nfs4_purge_state_owners(server, &freeme); | |
| 766 | + nfs4_free_state_owners(&freeme); | |
| 764 | 767 | } |
| 765 | 768 | |
| 766 | 769 | /* |
| @@ -1683,6 +1683,14 @@ static void nfs_state_set_open_stateid(struct nfs4_state *state, · 1682 unmodified lines | ||
| 1683 | 1683 | write_sequnlock(&state->seqlock); |
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | +static void nfs_state_clear_open_state_flags(struct nfs4_state *state) | |
| 1687 | +{ | |
| 1688 | + clear_bit(NFS_O_RDWR_STATE, &state->flags); | |
| 1689 | + clear_bit(NFS_O_WRONLY_STATE, &state->flags); | |
| 1690 | + clear_bit(NFS_O_RDONLY_STATE, &state->flags); | |
| 1691 | + clear_bit(NFS_OPEN_STATE, &state->flags); | |
| 1692 | +} | |
| 1693 | + | |
| 1686 | 1694 | static void nfs_state_set_delegation(struct nfs4_state *state, |
| 1687 | 1695 | const nfs4_stateid *deleg_stateid, |
| 1688 | 1696 | fmode_t fmode) |
| @@ -1907,8 +1915,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) · 218 unmodified lines | ||
| 1907 | 1915 | if (data->o_res.delegation_type != 0) |
| 1908 | 1916 | nfs4_opendata_check_deleg(data, state); |
| 1909 | 1917 | update: |
| 1910 | − update_open_stateid(state, &data->o_res.stateid, NULL, | |
| 1911 | − data->o_arg.fmode); | |
| 1918 | + if (!update_open_stateid(state, &data->o_res.stateid, | |
| 1919 | + NULL, data->o_arg.fmode)) | |
| 1920 | + return ERR_PTR(-EAGAIN); | |
| 1912 | 1921 | refcount_inc(&state->count); |
| 1913 | 1922 | |
| 1914 | 1923 | return state; |
| @@ -1973,8 +1982,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data) · 58 unmodified lines | ||
| 1973 | 1982 | |
| 1974 | 1983 | if (data->o_res.delegation_type != 0) |
| 1975 | 1984 | nfs4_opendata_check_deleg(data, state); |
| 1976 | − update_open_stateid(state, &data->o_res.stateid, NULL, | |
| 1977 | − data->o_arg.fmode); | |
| 1985 | + if (!update_open_stateid(state, &data->o_res.stateid, | |
| 1986 | + NULL, data->o_arg.fmode)) { | |
| 1987 | + nfs4_put_open_state(state); | |
| 1988 | + state = ERR_PTR(-EAGAIN); | |
| 1989 | + } | |
| 1978 | 1990 | out: |
| 1979 | 1991 | nfs_release_seqid(data->o_arg.seqid); |
| 1980 | 1992 | return state; |
| @@ -2074,13 +2086,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * · 93 unmodified lines | ||
| 2074 | 2086 | { |
| 2075 | 2087 | int ret; |
| 2076 | 2088 | |
| 2077 | − /* Don't trigger recovery in nfs_test_and_clear_all_open_stateid */ | |
| 2078 | − clear_bit(NFS_O_RDWR_STATE, &state->flags); | |
| 2079 | − clear_bit(NFS_O_WRONLY_STATE, &state->flags); | |
| 2080 | − clear_bit(NFS_O_RDONLY_STATE, &state->flags); | |
| 2081 | 2089 | /* memory barrier prior to reading state->n_* */ |
| 2082 | − clear_bit(NFS_DELEGATED_STATE, &state->flags); | |
| 2083 | − clear_bit(NFS_OPEN_STATE, &state->flags); | |
| 2084 | 2090 | smp_rmb(); |
| 2085 | 2091 | ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE); |
| 2086 | 2092 | if (ret != 0) |
| @@ -2156,6 +2162,8 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta · 69 unmodified lines | ||
| 2156 | 2162 | ctx = nfs4_state_find_open_context(state); |
| 2157 | 2163 | if (IS_ERR(ctx)) |
| 2158 | 2164 | return -EAGAIN; |
| 2165 | + clear_bit(NFS_DELEGATED_STATE, &state->flags); | |
| 2166 | + nfs_state_clear_open_state_flags(state); | |
| 2159 | 2167 | ret = nfs4_do_open_reclaim(ctx, state); |
| 2160 | 2168 | put_nfs_open_context(ctx); |
| 2161 | 2169 | return ret; |
| @@ -2171,18 +2179,17 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct · 9 unmodified lines | ||
| 2171 | 2179 | case -ENOENT: |
| 2172 | 2180 | case -EAGAIN: |
| 2173 | 2181 | case -ESTALE: |
| 2182 | + case -ETIMEDOUT: | |
| 2174 | 2183 | break; |
| 2175 | 2184 | case -NFS4ERR_BADSESSION: |
| 2176 | 2185 | case -NFS4ERR_BADSLOT: |
| 2177 | 2186 | case -NFS4ERR_BAD_HIGH_SLOT: |
| 2178 | 2187 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
| 2179 | 2188 | case -NFS4ERR_DEADSESSION: |
| 2180 | − set_bit(NFS_DELEGATED_STATE, &state->flags); | |
| 2181 | 2189 | nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); |
| 2182 | 2190 | return -EAGAIN; |
| 2183 | 2191 | case -NFS4ERR_STALE_CLIENTID: |
| 2184 | 2192 | case -NFS4ERR_STALE_STATEID: |
| 2185 | − set_bit(NFS_DELEGATED_STATE, &state->flags); | |
| 2186 | 2193 | /* Don't recall a delegation if it was lost */ |
| 2187 | 2194 | nfs4_schedule_lease_recovery(server->nfs_client); |
| 2188 | 2195 | return -EAGAIN; |
| @@ -2203,7 +2210,6 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct · 14 unmodified lines | ||
| 2203 | 2210 | return -EAGAIN; |
| 2204 | 2211 | case -NFS4ERR_DELAY: |
| 2205 | 2212 | case -NFS4ERR_GRACE: |
| 2206 | − set_bit(NFS_DELEGATED_STATE, &state->flags); | |
| 2207 | 2213 | ssleep(1); |
| 2208 | 2214 | return -EAGAIN; |
| 2209 | 2215 | case -ENOMEM: |
| @@ -2219,8 +2225,7 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct · 9 unmodified lines | ||
| 2219 | 2225 | } |
| 2220 | 2226 | |
| 2221 | 2227 | int nfs4_open_delegation_recall(struct nfs_open_context *ctx, |
| 2222 | − struct nfs4_state *state, const nfs4_stateid *stateid, | |
| 2223 | − fmode_t type) | |
| 2228 | + struct nfs4_state *state, const nfs4_stateid *stateid) | |
| 2224 | 2229 | { |
| 2225 | 2230 | struct nfs_server *server = NFS_SERVER(state->inode); |
| 2226 | 2231 | struct nfs4_opendata *opendata; |
| @@ -2231,20 +2236,23 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, · 4 unmodified lines | ||
| 2231 | 2236 | if (IS_ERR(opendata)) |
| 2232 | 2237 | return PTR_ERR(opendata); |
| 2233 | 2238 | nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid); |
| 2234 | − nfs_state_clear_delegation(state); | |
| 2235 | − switch (type & (FMODE_READ|FMODE_WRITE)) { | |
| 2236 | − case FMODE_READ|FMODE_WRITE: | |
| 2237 | − case FMODE_WRITE: | |
| 2239 | + if (!test_bit(NFS_O_RDWR_STATE, &state->flags)) { | |
| 2238 | 2240 | err = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE); |
| 2239 | 2241 | if (err) |
| 2240 | − break; | |
| 2242 | + goto out; | |
| 2243 | + } | |
| 2244 | + if (!test_bit(NFS_O_WRONLY_STATE, &state->flags)) { | |
| 2241 | 2245 | err = nfs4_open_recover_helper(opendata, FMODE_WRITE); |
| 2242 | 2246 | if (err) |
| 2243 | − break; | |
| 2244 | − /* Fall through */ | |
| 2245 | − case FMODE_READ: | |
| 2247 | + goto out; | |
| 2248 | + } | |
| 2249 | + if (!test_bit(NFS_O_RDONLY_STATE, &state->flags)) { | |
| 2246 | 2250 | err = nfs4_open_recover_helper(opendata, FMODE_READ); |
| 2251 | + if (err) | |
| 2252 | + goto out; | |
| 2247 | 2253 | } |
| 2254 | + nfs_state_clear_delegation(state); | |
| 2255 | +out: | |
| 2248 | 2256 | nfs4_opendata_put(opendata); |
| 2249 | 2257 | return nfs4_handle_delegation_recall_error(server, state, stateid, NULL, err); |
| 2250 | 2258 | } |
| @@ -2492,6 +2500,7 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, · 241 unmodified lines | ||
| 2492 | 2500 | if (!ctx) { |
| 2493 | 2501 | nfs4_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1, 1); |
| 2494 | 2502 | data->is_recover = true; |
| 2503 | + task_setup_data.flags |= RPC_TASK_TIMEOUT; | |
| 2495 | 2504 | } else { |
| 2496 | 2505 | nfs4_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1, 0); |
| 2497 | 2506 | pnfs_lgopen_prepare(data, ctx); |
| @@ -2698,6 +2707,7 @@ static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st · 200 unmodified lines | ||
| 2698 | 2707 | { |
| 2699 | 2708 | /* NFSv4.0 doesn't allow for delegation recovery on open expire */ |
| 2700 | 2709 | nfs40_clear_delegation_stateid(state); |
| 2710 | + nfs_state_clear_open_state_flags(state); | |
| 2701 | 2711 | return nfs4_open_expired(sp, state); |
| 2702 | 2712 | } |
| 2703 | 2713 | |
| @@ -2740,13 +2750,13 @@ out_free: · 36 unmodified lines | ||
| 2740 | 2750 | return -NFS4ERR_EXPIRED; |
| 2741 | 2751 | } |
| 2742 | 2752 | |
| 2743 | −static void nfs41_check_delegation_stateid(struct nfs4_state *state) | |
| 2753 | +static int nfs41_check_delegation_stateid(struct nfs4_state *state) | |
| 2744 | 2754 | { |
| 2745 | 2755 | struct nfs_server *server = NFS_SERVER(state->inode); |
| 2746 | 2756 | nfs4_stateid stateid; |
| 2747 | 2757 | struct nfs_delegation *delegation; |
| 2748 | 2758 | const struct cred *cred = NULL; |
| 2749 | − int status; | |
| 2759 | + int status, ret = NFS_OK; | |
| 2750 | 2760 | |
| 2751 | 2761 | /* Get the delegation credential for use by test/free_stateid */ |
| 2752 | 2762 | rcu_read_lock(); |
| @@ -2754,20 +2764,15 @@ static void nfs41_check_delegation_stateid(struct nfs4_state *state) · 1 unmodified line | ||
| 2754 | 2764 | if (delegation == NULL) { |
| 2755 | 2765 | rcu_read_unlock(); |
| 2756 | 2766 | nfs_state_clear_delegation(state); |
| 2757 | − return; | |
| 2767 | + return NFS_OK; | |
| 2758 | 2768 | } |
| 2759 | 2769 | |
| 2760 | 2770 | nfs4_stateid_copy(&stateid, &delegation->stateid); |
| 2761 | − if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) { | |
| 2762 | − rcu_read_unlock(); | |
| 2763 | − nfs_state_clear_delegation(state); | |
| 2764 | − return; | |
| 2765 | − } | |
| 2766 | 2771 | |
| 2767 | 2772 | if (!test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED, |
| 2768 | 2773 | &delegation->flags)) { |
| 2769 | 2774 | rcu_read_unlock(); |
| 2770 | − return; | |
| 2775 | + return NFS_OK; | |
| 2771 | 2776 | } |
| 2772 | 2777 | |
| 2773 | 2778 | if (delegation->cred) |
| @@ -2777,9 +2782,24 @@ static void nfs41_check_delegation_stateid(struct nfs4_state *state) · 3 unmodified lines | ||
| 2777 | 2782 | trace_nfs4_test_delegation_stateid(state, NULL, status); |
| 2778 | 2783 | if (status == -NFS4ERR_EXPIRED || status == -NFS4ERR_BAD_STATEID) |
| 2779 | 2784 | nfs_finish_clear_delegation_stateid(state, &stateid); |
| 2785 | + else | |
68 more lines aren’t shown here.
This diff is large: its 172 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 8 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 13 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 65 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 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 263 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 22 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 17 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 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 34 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 28 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 11 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 25 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 63 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 158 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 31 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 13 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 16 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 24 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 52 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 10 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 46 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 17 lines aren’t shown here.
This diff is large: its 21 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 17 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 19 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 25 lines aren’t shown here.
This diff is large: its 8 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 26 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 193 lines aren’t shown here.
This diff is large: its 145 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 13 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 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 71 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 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 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
File mode changed from 100755 to 100644.
File mode changed from 100755 to 100644.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 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 46 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 13 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.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 295 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 71 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 9 lines aren’t shown here.
This diff is large: its 47 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 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 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 12 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 251 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.