No conflicts.
Unified · Split
| @@ -80,6 +80,9 @@ Chris Chiu <chris.chiu@canonical.com> <chiu@endlessos.org> · 79 unmodified lines | |||
| 80 | Christian Borntraeger <borntraeger@linux.ibm.com> <borntraeger@de.ibm.com> | 80 | Christian Borntraeger <borntraeger@linux.ibm.com> <borntraeger@de.ibm.com> |
| 81 | Christian Borntraeger <borntraeger@linux.ibm.com> <cborntra@de.ibm.com> | 81 | Christian Borntraeger <borntraeger@linux.ibm.com> <cborntra@de.ibm.com> |
| 82 | Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com> | 82 | Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com> |
| 83 | Christian Brauner <brauner@kernel.org> <christian@brauner.io> | ||
| 84 | Christian Brauner <brauner@kernel.org> <christian.brauner@canonical.com> | ||
| 85 | Christian Brauner <brauner@kernel.org> <christian.brauner@ubuntu.com> | ||
| 83 | Christophe Ricard <christophe.ricard@gmail.com> | 86 | Christophe Ricard <christophe.ricard@gmail.com> |
| 84 | Christoph Hellwig <hch@lst.de> | 87 | Christoph Hellwig <hch@lst.de> |
| 85 | Colin Ian King <colin.king@intel.com> <colin.king@canonical.com> | 88 | Colin Ian King <colin.king@intel.com> <colin.king@canonical.com> |
| @@ -10,6 +10,7 @@ gpio · 9 unmodified lines | |||
| 10 | gpio-aggregator | 10 | gpio-aggregator |
| 11 | sysfs | 11 | sysfs |
| 12 | gpio-mockup | 12 | gpio-mockup |
| 13 | gpio-sim | ||
| 13 | 14 | ||
| 14 | .. only:: subproject and html | 15 | .. only:: subproject and html |
| 15 | 16 | ||
| @@ -266,10 +266,12 @@ Avanta family · 265 unmodified lines | |||
| 266 | ------------- | 266 | ------------- |
| 267 | 267 | ||
| 268 | Flavors: | 268 | Flavors: |
| 269 | - 88F6500 | ||
| 269 | - 88F6510 | 270 | - 88F6510 |
| 270 | - 88F6530P | 271 | - 88F6530P |
| 271 | - 88F6550 | 272 | - 88F6550 |
| 272 | - 88F6560 | 273 | - 88F6560 |
| 274 | - 88F6601 | ||
| 273 | 275 | ||
| 274 | Homepage: | 276 | Homepage: |
| 275 | https://web.archive.org/web/20181005145041/http://www.marvell.com/broadband/ | 277 | https://web.archive.org/web/20181005145041/http://www.marvell.com/broadband/ |
| @@ -52,6 +52,12 @@ stable kernels. · 51 unmodified lines | |||
| 52 | | Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 | | 52 | | Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 | |
| 53 | +----------------+-----------------+-----------------+-----------------------------+ | 53 | +----------------+-----------------+-----------------+-----------------------------+ |
| 54 | +----------------+-----------------+-----------------+-----------------------------+ | 54 | +----------------+-----------------+-----------------+-----------------------------+ |
| 55 | | ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_2064142 | | ||
| 56 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 57 | | ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_2038923 | | ||
| 58 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 59 | | ARM | Cortex-A510 | #1902691 | ARM64_ERRATUM_1902691 | | ||
| 60 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 55 | | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | | 61 | | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | |
| 56 | +----------------+-----------------+-----------------+-----------------------------+ | 62 | +----------------+-----------------+-----------------+-----------------------------+ |
| 57 | | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 | | 63 | | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 | |
| @@ -92,12 +98,18 @@ stable kernels. · 34 unmodified lines | |||
| 92 | +----------------+-----------------+-----------------+-----------------------------+ | 98 | +----------------+-----------------+-----------------+-----------------------------+ |
| 93 | | ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 | | 99 | | ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 | |
| 94 | +----------------+-----------------+-----------------+-----------------------------+ | 100 | +----------------+-----------------+-----------------+-----------------------------+ |
| 101 | | ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_2051678 | | ||
| 102 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 95 | | ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 | | 103 | | ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 | |
| 96 | +----------------+-----------------+-----------------+-----------------------------+ | 104 | +----------------+-----------------+-----------------+-----------------------------+ |
| 97 | | ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 | | 105 | | ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 | |
| 98 | +----------------+-----------------+-----------------+-----------------------------+ | 106 | +----------------+-----------------+-----------------+-----------------------------+ |
| 99 | | ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_2224489 | | 107 | | ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_2224489 | |
| 100 | +----------------+-----------------+-----------------+-----------------------------+ | 108 | +----------------+-----------------+-----------------+-----------------------------+ |
| 109 | | ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_2119858 | | ||
| 110 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 111 | | ARM | Cortex-X2 | #2224489 | ARM64_ERRATUM_2224489 | | ||
| 112 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 101 | | ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 | | 113 | | ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 | |
| 102 | +----------------+-----------------+-----------------+-----------------------------+ | 114 | +----------------+-----------------+-----------------+-----------------------------+ |
| 103 | | ARM | Neoverse-N1 | #1349291 | N/A | | 115 | | ARM | Neoverse-N1 | #1349291 | N/A | |
| @@ -7,6 +7,14 @@ directory. These are intended to be small tests to exercise individual code · 6 unmodified lines | |||
| 7 | paths in the kernel. Tests are intended to be run after building, installing | 7 | paths in the kernel. Tests are intended to be run after building, installing |
| 8 | and booting a kernel. | 8 | and booting a kernel. |
| 9 | 9 | ||
| 10 | Kselftest from mainline can be run on older stable kernels. Running tests | ||
| 11 | from mainline offers the best coverage. Several test rings run mainline | ||
| 12 | kselftest suite on stable releases. The reason is that when a new test | ||
| 13 | gets added to test existing code to regression test a bug, we should be | ||
| 14 | able to run that test on an older kernel. Hence, it is important to keep | ||
| 15 | code that can still test an older kernel and make sure it skips the test | ||
| 16 | gracefully on newer releases. | ||
| 17 | |||
| 10 | You can find additional information on Kselftest framework, how to | 18 | You can find additional information on Kselftest framework, how to |
| 11 | write new tests using the framework on Kselftest wiki: | 19 | write new tests using the framework on Kselftest wiki: |
| 12 | 20 | ||
| @@ -36,6 +36,7 @@ properties: · 35 unmodified lines | |||
| 36 | - renesas,intc-ex-r8a77980 # R-Car V3H | 36 | - renesas,intc-ex-r8a77980 # R-Car V3H |
| 37 | - renesas,intc-ex-r8a77990 # R-Car E3 | 37 | - renesas,intc-ex-r8a77990 # R-Car E3 |
| 38 | - renesas,intc-ex-r8a77995 # R-Car D3 | 38 | - renesas,intc-ex-r8a77995 # R-Car D3 |
| 39 | - renesas,intc-ex-r8a779a0 # R-Car V3U | ||
| 39 | - const: renesas,irqc | 40 | - const: renesas,irqc |
| 40 | 41 | ||
| 41 | '#interrupt-cells': | 42 | '#interrupt-cells': |
| @@ -62,6 +62,7 @@ properties: · 61 unmodified lines | |||
| 62 | 62 | ||
| 63 | interrupts-extended: | 63 | interrupts-extended: |
| 64 | minItems: 1 | 64 | minItems: 1 |
| 65 | maxItems: 15872 | ||
| 65 | description: | 66 | description: |
| 66 | Specifies which contexts are connected to the PLIC, with "-1" specifying | 67 | Specifies which contexts are connected to the PLIC, with "-1" specifying |
| 67 | that a context is not present. Each node pointed to should be a | 68 | that a context is not present. Each node pointed to should be a |
| @@ -90,12 +91,11 @@ examples: · 22 unmodified lines | |||
| 90 | #interrupt-cells = <1>; | 91 | #interrupt-cells = <1>; |
| 91 | compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0"; | 92 | compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0"; |
| 92 | interrupt-controller; | 93 | interrupt-controller; |
| 93 | interrupts-extended = < | 94 | interrupts-extended = <&cpu0_intc 11>, |
| 94 | &cpu0_intc 11 | 95 | <&cpu1_intc 11>, <&cpu1_intc 9>, |
| 95 | &cpu1_intc 11 &cpu1_intc 9 | 96 | <&cpu2_intc 11>, <&cpu2_intc 9>, |
| 96 | &cpu2_intc 11 &cpu2_intc 9 | 97 | <&cpu3_intc 11>, <&cpu3_intc 9>, |
| 97 | &cpu3_intc 11 &cpu3_intc 9 | 98 | <&cpu4_intc 11>, <&cpu4_intc 9>; |
| 98 | &cpu4_intc 11 &cpu4_intc 9>; | ||
| 99 | reg = <0xc000000 0x4000000>; | 99 | reg = <0xc000000 0x4000000>; |
| 100 | riscv,ndev = <10>; | 100 | riscv,ndev = <10>; |
| 101 | }; | 101 | }; |
| @@ -107,6 +107,10 @@ properties: · 106 unmodified lines | |||
| 107 | - const: imem | 107 | - const: imem |
| 108 | - const: config | 108 | - const: config |
| 109 | 109 | ||
| 110 | qcom,qmp: | ||
| 111 | $ref: /schemas/types.yaml#/definitions/phandle | ||
| 112 | description: phandle to the AOSS side-channel message RAM | ||
| 113 | |||
| 110 | qcom,smem-states: | 114 | qcom,smem-states: |
| 111 | $ref: /schemas/types.yaml#/definitions/phandle-array | 115 | $ref: /schemas/types.yaml#/definitions/phandle-array |
| 112 | description: State bits used in by the AP to signal the modem. | 116 | description: State bits used in by the AP to signal the modem. |
| @@ -222,6 +226,8 @@ examples: · 109 unmodified lines | |||
| 222 | "imem", | 226 | "imem", |
| 223 | "config"; | 227 | "config"; |
| 224 | 228 | ||
| 229 | qcom,qmp = <&aoss_qmp>; | ||
| 230 | |||
| 225 | qcom,smem-states = <&ipa_smp2p_out 0>, | 231 | qcom,smem-states = <&ipa_smp2p_out 0>, |
| 226 | <&ipa_smp2p_out 1>; | 232 | <&ipa_smp2p_out 1>; |
| 227 | qcom,smem-state-names = "ipa-clock-enabled-valid", | 233 | qcom,smem-state-names = "ipa-clock-enabled-valid", |
| @@ -23,8 +23,9 @@ properties: · 22 unmodified lines | |||
| 23 | minItems: 1 | 23 | minItems: 1 |
| 24 | maxItems: 256 | 24 | maxItems: 256 |
| 25 | items: | 25 | items: |
| 26 | minimum: 0 | 26 | items: |
| 27 | maximum: 256 | 27 | - minimum: 0 |
| 28 | maximum: 256 | ||
| 28 | description: | 29 | description: |
| 29 | Chip select used by the device. | 30 | Chip select used by the device. |
| 30 | 31 | ||
| @@ -166,6 +166,7 @@ to ReStructured Text format, or are simply too old. · 165 unmodified lines | |||
| 166 | .. toctree:: | 166 | .. toctree:: |
| 167 | :maxdepth: 2 | 167 | :maxdepth: 2 |
| 168 | 168 | ||
| 169 | tools/index | ||
| 169 | staging/index | 170 | staging/index |
| 170 | watch_queue | 171 | watch_queue |
| 171 | 172 | ||
| @@ -295,7 +295,7 @@ Pete Zaitcev gives the following summary: · 294 unmodified lines | |||
| 295 | 295 | ||
| 296 | - If you are in a process context (any syscall) and want to lock other | 296 | - If you are in a process context (any syscall) and want to lock other |
| 297 | process out, use a mutex. You can take a mutex and sleep | 297 | process out, use a mutex. You can take a mutex and sleep |
| 298 | (``copy_from_user*(`` or ``kmalloc(x,GFP_KERNEL)``). | 298 | (``copy_from_user()`` or ``kmalloc(x,GFP_KERNEL)``). |
| 299 | 299 | ||
| 300 | - Otherwise (== data can be touched in an interrupt), use | 300 | - Otherwise (== data can be touched in an interrupt), use |
| 301 | spin_lock_irqsave() and | 301 | spin_lock_irqsave() and |
| @@ -0,0 +1,20 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ============ | ||
| 4 | Kernel tools | ||
| 5 | ============ | ||
| 6 | |||
| 7 | This book covers user-space tools that are shipped with the kernel source; | ||
| 8 | more additions are needed here: | ||
| 9 | |||
| 10 | .. toctree:: | ||
| 11 | :maxdepth: 1 | ||
| 12 | |||
| 13 | rtla/index | ||
| 14 | |||
| 15 | .. only:: subproject and html | ||
| 16 | |||
| 17 | Indices | ||
| 18 | ======= | ||
| 19 | |||
| 20 | * :ref:`genindex` | ||
| @@ -0,0 +1,26 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ================================ | ||
| 4 | The realtime Linux analysis tool | ||
| 5 | ================================ | ||
| 6 | |||
| 7 | RTLA provides a set of tools for the analysis of the kernel's realtime | ||
| 8 | behavior on specific hardware. | ||
| 9 | |||
| 10 | .. toctree:: | ||
| 11 | :maxdepth: 1 | ||
| 12 | |||
| 13 | rtla | ||
| 14 | rtla-osnoise | ||
| 15 | rtla-osnoise-hist | ||
| 16 | rtla-osnoise-top | ||
| 17 | rtla-timerlat | ||
| 18 | rtla-timerlat-hist | ||
| 19 | rtla-timerlat-top | ||
| 20 | |||
| 21 | .. only:: subproject and html | ||
| 22 | |||
| 23 | Indices | ||
| 24 | ======= | ||
| 25 | |||
| 26 | * :ref:`genindex` | ||
| @@ -3268,6 +3268,7 @@ number. · 3267 unmodified lines | |||
| 3268 | 3268 | ||
| 3269 | :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, | 3269 | :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, |
| 3270 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device | 3270 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device |
| 3271 | KVM_CAP_SYS_ATTRIBUTES for system (/dev/kvm) device (no set) | ||
| 3271 | :Type: device ioctl, vm ioctl, vcpu ioctl | 3272 | :Type: device ioctl, vm ioctl, vcpu ioctl |
| 3272 | :Parameters: struct kvm_device_attr | 3273 | :Parameters: struct kvm_device_attr |
| 3273 | :Returns: 0 on success, -1 on error | 3274 | :Returns: 0 on success, -1 on error |
| @@ -3302,7 +3303,8 @@ transferred is defined by the particular attribute. · 28 unmodified lines | |||
| 3302 | ------------------------ | 3303 | ------------------------ |
| 3303 | 3304 | ||
| 3304 | :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, | 3305 | :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, |
| 3305 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device | 3306 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device |
| 3307 | KVM_CAP_SYS_ATTRIBUTES for system (/dev/kvm) device | ||
| 3306 | :Type: device ioctl, vm ioctl, vcpu ioctl | 3308 | :Type: device ioctl, vm ioctl, vcpu ioctl |
| 3307 | :Parameters: struct kvm_device_attr | 3309 | :Parameters: struct kvm_device_attr |
| 3308 | :Returns: 0 on success, -1 on error | 3310 | :Returns: 0 on success, -1 on error |
| @@ -9,7 +9,7 @@ Page Table Check · 8 unmodified lines | |||
| 9 | Introduction | 9 | Introduction |
| 10 | ============ | 10 | ============ |
| 11 | 11 | ||
| 12 | Page table check allows to hardern the kernel by ensuring that some types of | 12 | Page table check allows to harden the kernel by ensuring that some types of |
| 13 | the memory corruptions are prevented. | 13 | the memory corruptions are prevented. |
| 14 | 14 | ||
| 15 | Page table check performs extra verifications at the time when new pages become | 15 | Page table check performs extra verifications at the time when new pages become |
| @@ -4157,9 +4157,8 @@ N: csky · 4156 unmodified lines | |||
| 4157 | K: csky | 4157 | K: csky |
| 4158 | 4158 | ||
| 4159 | CA8210 IEEE-802.15.4 RADIO DRIVER | 4159 | CA8210 IEEE-802.15.4 RADIO DRIVER |
| 4160 | M: Harry Morris <h.morris@cascoda.com> | ||
| 4161 | L: linux-wpan@vger.kernel.org | 4160 | L: linux-wpan@vger.kernel.org |
| 4162 | S: Maintained | 4161 | S: Orphan |
| 4163 | W: https://github.com/Cascoda/ca8210-linux.git | 4162 | W: https://github.com/Cascoda/ca8210-linux.git |
| 4164 | F: Documentation/devicetree/bindings/net/ieee802154/ca8210.txt | 4163 | F: Documentation/devicetree/bindings/net/ieee802154/ca8210.txt |
| 4165 | F: drivers/net/ieee802154/ca8210.c | 4164 | F: drivers/net/ieee802154/ca8210.c |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 17 | 3 | PATCHLEVEL = 17 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc1 | 5 | EXTRAVERSION = -rc2 |
| 6 | NAME = Gobble Gobble | 6 | NAME = Gobble Gobble |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -83,6 +83,7 @@ config ARM · 82 unmodified lines | |||
| 83 | select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 | 83 | select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 |
| 84 | select HAVE_CONTEXT_TRACKING | 84 | select HAVE_CONTEXT_TRACKING |
| 85 | select HAVE_C_RECORDMCOUNT | 85 | select HAVE_C_RECORDMCOUNT |
| 86 | select HAVE_BUILDTIME_MCOUNT_SORT | ||
| 86 | select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL | 87 | select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL |
| 87 | select HAVE_DMA_CONTIGUOUS if MMU | 88 | select HAVE_DMA_CONTIGUOUS if MMU |
| 88 | select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU | 89 | select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU |
| @@ -670,15 +670,25 @@ config ARM64_ERRATUM_1508412 · 669 unmodified lines | |||
| 670 | config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE | 670 | config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE |
| 671 | bool | 671 | bool |
| 672 | 672 | ||
| 673 | config ARM64_ERRATUM_2051678 | ||
| 674 | bool "Cortex-A510: 2051678: disable Hardware Update of the page table dirty bit" | ||
| 675 | help | ||
| 676 | This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678. | ||
| 677 | Affected Coretex-A510 might not respect the ordering rules for | ||
| 678 | hardware update of the page table's dirty bit. The workaround | ||
| 679 | is to not enable the feature on affected CPUs. | ||
| 680 | |||
| 681 | If unsure, say Y. | ||
| 682 | |||
| 673 | config ARM64_ERRATUM_2119858 | 683 | config ARM64_ERRATUM_2119858 |
| 674 | bool "Cortex-A710: 2119858: workaround TRBE overwriting trace data in FILL mode" | 684 | bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode" |
| 675 | default y | 685 | default y |
| 676 | depends on CORESIGHT_TRBE | 686 | depends on CORESIGHT_TRBE |
| 677 | select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE | 687 | select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE |
| 678 | help | 688 | help |
| 679 | This option adds the workaround for ARM Cortex-A710 erratum 2119858. | 689 | This option adds the workaround for ARM Cortex-A710/X2 erratum 2119858. |
| 680 | 690 | ||
| 681 | Affected Cortex-A710 cores could overwrite up to 3 cache lines of trace | 691 | Affected Cortex-A710/X2 cores could overwrite up to 3 cache lines of trace |
| 682 | data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in | 692 | data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in |
| 683 | the event of a WRAP event. | 693 | the event of a WRAP event. |
| 684 | 694 | ||
| @@ -761,14 +771,14 @@ config ARM64_ERRATUM_2253138 · 76 unmodified lines | |||
| 761 | If unsure, say Y. | 771 | If unsure, say Y. |
| 762 | 772 | ||
| 763 | config ARM64_ERRATUM_2224489 | 773 | config ARM64_ERRATUM_2224489 |
| 764 | bool "Cortex-A710: 2224489: workaround TRBE writing to address out-of-range" | 774 | bool "Cortex-A710/X2: 2224489: workaround TRBE writing to address out-of-range" |
| 765 | depends on CORESIGHT_TRBE | 775 | depends on CORESIGHT_TRBE |
| 766 | default y | 776 | default y |
| 767 | select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE | 777 | select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE |
| 768 | help | 778 | help |
| 769 | This option adds the workaround for ARM Cortex-A710 erratum 2224489. | 779 | This option adds the workaround for ARM Cortex-A710/X2 erratum 2224489. |
| 770 | 780 | ||
| 771 | Affected Cortex-A710 cores might write to an out-of-range address, not reserved | 781 | Affected Cortex-A710/X2 cores might write to an out-of-range address, not reserved |
| 772 | for TRBE. Under some conditions, the TRBE might generate a write to the next | 782 | for TRBE. Under some conditions, the TRBE might generate a write to the next |
| 773 | virtually addressed page following the last page of the TRBE address space | 783 | virtually addressed page following the last page of the TRBE address space |
| 774 | (i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base. | 784 | (i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base. |
| @@ -778,6 +788,65 @@ config ARM64_ERRATUM_2224489 · 3 unmodified lines | |||
| 778 | 788 | ||
| 779 | If unsure, say Y. | 789 | If unsure, say Y. |
| 780 | 790 | ||
| 791 | config ARM64_ERRATUM_2064142 | ||
| 792 | bool "Cortex-A510: 2064142: workaround TRBE register writes while disabled" | ||
| 793 | depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in | ||
| 794 | default y | ||
| 795 | help | ||
| 796 | This option adds the workaround for ARM Cortex-A510 erratum 2064142. | ||
| 797 | |||
| 798 | Affected Cortex-A510 core might fail to write into system registers after the | ||
| 799 | TRBE has been disabled. Under some conditions after the TRBE has been disabled | ||
| 800 | writes into TRBE registers TRBLIMITR_EL1, TRBPTR_EL1, TRBBASER_EL1, TRBSR_EL1, | ||
| 801 | and TRBTRG_EL1 will be ignored and will not be effected. | ||
| 802 | |||
| 803 | Work around this in the driver by executing TSB CSYNC and DSB after collection | ||
| 804 | is stopped and before performing a system register write to one of the affected | ||
| 805 | registers. | ||
| 806 | |||
| 807 | If unsure, say Y. | ||
| 808 | |||
| 809 | config ARM64_ERRATUM_2038923 | ||
| 810 | bool "Cortex-A510: 2038923: workaround TRBE corruption with enable" | ||
| 811 | depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in | ||
| 812 | default y | ||
| 813 | help | ||
| 814 | This option adds the workaround for ARM Cortex-A510 erratum 2038923. | ||
| 815 | |||
| 816 | Affected Cortex-A510 core might cause an inconsistent view on whether trace is | ||
| 817 | prohibited within the CPU. As a result, the trace buffer or trace buffer state | ||
| 818 | might be corrupted. This happens after TRBE buffer has been enabled by setting | ||
| 819 | TRBLIMITR_EL1.E, followed by just a single context synchronization event before | ||
| 820 | execution changes from a context, in which trace is prohibited to one where it | ||
| 821 | isn't, or vice versa. In these mentioned conditions, the view of whether trace | ||
| 822 | is prohibited is inconsistent between parts of the CPU, and the trace buffer or | ||
| 823 | the trace buffer state might be corrupted. | ||
| 824 | |||
| 825 | Work around this in the driver by preventing an inconsistent view of whether the | ||
| 826 | trace is prohibited or not based on TRBLIMITR_EL1.E by immediately following a | ||
| 827 | change to TRBLIMITR_EL1.E with at least one ISB instruction before an ERET, or | ||
| 828 | two ISB instructions if no ERET is to take place. | ||
| 829 | |||
| 830 | If unsure, say Y. | ||
| 831 | |||
| 832 | config ARM64_ERRATUM_1902691 | ||
| 833 | bool "Cortex-A510: 1902691: workaround TRBE trace corruption" | ||
| 834 | depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in | ||
| 835 | default y | ||
| 836 | help | ||
| 837 | This option adds the workaround for ARM Cortex-A510 erratum 1902691. | ||
| 838 | |||
| 839 | Affected Cortex-A510 core might cause trace data corruption, when being written | ||
| 840 | into the memory. Effectively TRBE is broken and hence cannot be used to capture | ||
| 841 | trace data. | ||
| 842 | |||
| 843 | Work around this problem in the driver by just preventing TRBE initialization on | ||
| 844 | affected cpus. The firmware must have disabled the access to TRBE for the kernel | ||
| 845 | on such implementations. This will cover the kernel for any firmware that doesn't | ||
| 846 | do this already. | ||
| 847 | |||
| 848 | If unsure, say Y. | ||
| 849 | |||
| 781 | config CAVIUM_ERRATUM_22375 | 850 | config CAVIUM_ERRATUM_22375 |
| 782 | bool "Cavium erratum 22375, 24313" | 851 | bool "Cavium erratum 22375, 24313" |
| 783 | default y | 852 | default y |
| @@ -73,7 +73,9 @@ · 72 unmodified lines | |||
| 73 | #define ARM_CPU_PART_CORTEX_A76 0xD0B | 73 | #define ARM_CPU_PART_CORTEX_A76 0xD0B |
| 74 | #define ARM_CPU_PART_NEOVERSE_N1 0xD0C | 74 | #define ARM_CPU_PART_NEOVERSE_N1 0xD0C |
| 75 | #define ARM_CPU_PART_CORTEX_A77 0xD0D | 75 | #define ARM_CPU_PART_CORTEX_A77 0xD0D |
| 76 | #define ARM_CPU_PART_CORTEX_A510 0xD46 | ||
| 76 | #define ARM_CPU_PART_CORTEX_A710 0xD47 | 77 | #define ARM_CPU_PART_CORTEX_A710 0xD47 |
| 78 | #define ARM_CPU_PART_CORTEX_X2 0xD48 | ||
| 77 | #define ARM_CPU_PART_NEOVERSE_N2 0xD49 | 79 | #define ARM_CPU_PART_NEOVERSE_N2 0xD49 |
| 78 | 80 | ||
| 79 | #define APM_CPU_PART_POTENZA 0x000 | 81 | #define APM_CPU_PART_POTENZA 0x000 |
| @@ -115,7 +117,9 @@ · 35 unmodified lines | |||
| 115 | #define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76) | 117 | #define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76) |
| 116 | #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1) | 118 | #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1) |
| 117 | #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77) | 119 | #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77) |
| 120 | #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) | ||
| 118 | #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) | 121 | #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) |
| 122 | #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2) | ||
| 119 | #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2) | 123 | #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2) |
| 120 | #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX) | 124 | #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX) |
| 121 | #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX) | 125 | #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX) |
| @@ -347,6 +347,7 @@ static const struct midr_range trbe_overwrite_fill_mode_cpus[] = { · 346 unmodified lines | |||
| 347 | #endif | 347 | #endif |
| 348 | #ifdef CONFIG_ARM64_ERRATUM_2119858 | 348 | #ifdef CONFIG_ARM64_ERRATUM_2119858 |
| 349 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), | 349 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), |
| 350 | MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0), | ||
| 350 | #endif | 351 | #endif |
| 351 | {}, | 352 | {}, |
| 352 | }; | 353 | }; |
| @@ -371,6 +372,7 @@ static struct midr_range trbe_write_out_of_range_cpus[] = { · 18 unmodified lines | |||
| 371 | #endif | 372 | #endif |
| 372 | #ifdef CONFIG_ARM64_ERRATUM_2224489 | 373 | #ifdef CONFIG_ARM64_ERRATUM_2224489 |
| 373 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), | 374 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), |
| 375 | MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0), | ||
| 374 | #endif | 376 | #endif |
| 375 | {}, | 377 | {}, |
| 376 | }; | 378 | }; |
| @@ -597,6 +599,33 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 220 unmodified lines | |||
| 597 | .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, | 599 | .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, |
| 598 | CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus), | 600 | CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus), |
| 599 | }, | 601 | }, |
| 602 | #endif | ||
| 603 | #ifdef CONFIG_ARM64_ERRATUM_2064142 | ||
| 604 | { | ||
| 605 | .desc = "ARM erratum 2064142", | ||
| 606 | .capability = ARM64_WORKAROUND_2064142, | ||
| 607 | |||
| 608 | /* Cortex-A510 r0p0 - r0p2 */ | ||
| 609 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) | ||
| 610 | }, | ||
| 611 | #endif | ||
| 612 | #ifdef CONFIG_ARM64_ERRATUM_2038923 | ||
| 613 | { | ||
| 614 | .desc = "ARM erratum 2038923", | ||
| 615 | .capability = ARM64_WORKAROUND_2038923, | ||
| 616 | |||
| 617 | /* Cortex-A510 r0p0 - r0p2 */ | ||
| 618 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) | ||
| 619 | }, | ||
| 620 | #endif | ||
| 621 | #ifdef CONFIG_ARM64_ERRATUM_1902691 | ||
| 622 | { | ||
| 623 | .desc = "ARM erratum 1902691", | ||
| 624 | .capability = ARM64_WORKAROUND_1902691, | ||
| 625 | |||
| 626 | /* Cortex-A510 r0p0 - r0p1 */ | ||
| 627 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 1) | ||
| 628 | }, | ||
| 600 | #endif | 629 | #endif |
| 601 | { | 630 | { |
| 602 | } | 631 | } |
| @@ -1645,6 +1645,9 @@ static bool cpu_has_broken_dbm(void) · 1644 unmodified lines | |||
| 1645 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), | 1645 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), |
| 1646 | /* Kryo4xx Silver (rdpe => r1p0) */ | 1646 | /* Kryo4xx Silver (rdpe => r1p0) */ |
| 1647 | MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe), | 1647 | MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe), |
| 1648 | #endif | ||
| 1649 | #ifdef CONFIG_ARM64_ERRATUM_2051678 | ||
| 1650 | MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2), | ||
| 1648 | #endif | 1651 | #endif |
| 1649 | {}, | 1652 | {}, |
| 1650 | }; | 1653 | }; |
| @@ -33,8 +33,8 @@ · 32 unmodified lines | |||
| 33 | */ | 33 | */ |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | static void start_backtrace(struct stackframe *frame, unsigned long fp, | 36 | static notrace void start_backtrace(struct stackframe *frame, unsigned long fp, |
| 37 | unsigned long pc) | 37 | unsigned long pc) |
| 38 | { | 38 | { |
| 39 | frame->fp = fp; | 39 | frame->fp = fp; |
| 40 | frame->pc = pc; | 40 | frame->pc = pc; |
| @@ -55,6 +55,7 @@ static void start_backtrace(struct stackframe *frame, unsigned long fp, · 14 unmodified lines | |||
| 55 | frame->prev_fp = 0; | 55 | frame->prev_fp = 0; |
| 56 | frame->prev_type = STACK_TYPE_UNKNOWN; | 56 | frame->prev_type = STACK_TYPE_UNKNOWN; |
| 57 | } | 57 | } |
| 58 | NOKPROBE_SYMBOL(start_backtrace); | ||
| 58 | 59 | ||
| 59 | /* | 60 | /* |
| 60 | * Unwind from one frame record (A) to the next frame record (B). | 61 | * Unwind from one frame record (A) to the next frame record (B). |
| @@ -29,8 +29,11 @@ ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv \ · 28 unmodified lines | |||
| 29 | ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18 | 29 | ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18 |
| 30 | ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO | 30 | ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO |
| 31 | 31 | ||
| 32 | # -Wmissing-prototypes and -Wmissing-declarations are removed from | ||
| 33 | # the CFLAGS of vgettimeofday.c to make possible to build the | ||
| 34 | # kernel with CONFIG_WERROR enabled. | ||
| 32 | CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) $(GCC_PLUGINS_CFLAGS) \ | 35 | CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) $(GCC_PLUGINS_CFLAGS) \ |
| 33 | $(CC_FLAGS_LTO) | 36 | $(CC_FLAGS_LTO) -Wmissing-prototypes -Wmissing-declarations |
| 34 | KASAN_SANITIZE := n | 37 | KASAN_SANITIZE := n |
| 35 | KCSAN_SANITIZE := n | 38 | KCSAN_SANITIZE := n |
| 36 | UBSAN_SANITIZE := n | 39 | UBSAN_SANITIZE := n |
| @@ -38,7 +38,10 @@ static inline void __vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg) · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | static void __vcpu_write_spsr(struct kvm_vcpu *vcpu, u64 val) | 39 | static void __vcpu_write_spsr(struct kvm_vcpu *vcpu, u64 val) |
| 40 | { | 40 | { |
| 41 | write_sysreg_el1(val, SYS_SPSR); | 41 | if (has_vhe()) |
| 42 | write_sysreg_el1(val, SYS_SPSR); | ||
| 43 | else | ||
| 44 | __vcpu_sys_reg(vcpu, SPSR_EL1) = val; | ||
| 42 | } | 45 | } |
| 43 | 46 | ||
| 44 | static void __vcpu_write_spsr_abt(struct kvm_vcpu *vcpu, u64 val) | 47 | static void __vcpu_write_spsr_abt(struct kvm_vcpu *vcpu, u64 val) |
| @@ -983,13 +983,9 @@ static int stage2_unmap_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, · 982 unmodified lines | |||
| 983 | */ | 983 | */ |
| 984 | stage2_put_pte(ptep, mmu, addr, level, mm_ops); | 984 | stage2_put_pte(ptep, mmu, addr, level, mm_ops); |
| 985 | 985 | ||
| 986 | if (need_flush) { | 986 | if (need_flush && mm_ops->dcache_clean_inval_poc) |
| 987 | kvm_pte_t *pte_follow = kvm_pte_follow(pte, mm_ops); | 987 | mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops), |
| 988 | 988 | kvm_granule_size(level)); | |
| 989 | dcache_clean_inval_poc((unsigned long)pte_follow, | ||
| 990 | (unsigned long)pte_follow + | ||
| 991 | kvm_granule_size(level)); | ||
| 992 | } | ||
| 993 | 989 | ||
| 994 | if (childp) | 990 | if (childp) |
| 995 | mm_ops->put_page(childp); | 991 | mm_ops->put_page(childp); |
| @@ -1151,15 +1147,13 @@ static int stage2_flush_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, · 155 unmodified lines | |||
| 1151 | struct kvm_pgtable *pgt = arg; | 1147 | struct kvm_pgtable *pgt = arg; |
| 1152 | struct kvm_pgtable_mm_ops *mm_ops = pgt->mm_ops; | 1148 | struct kvm_pgtable_mm_ops *mm_ops = pgt->mm_ops; |
| 1153 | kvm_pte_t pte = *ptep; | 1149 | kvm_pte_t pte = *ptep; |
| 1154 | kvm_pte_t *pte_follow; | ||
| 1155 | 1150 | ||
| 1156 | if (!kvm_pte_valid(pte) || !stage2_pte_cacheable(pgt, pte)) | 1151 | if (!kvm_pte_valid(pte) || !stage2_pte_cacheable(pgt, pte)) |
| 1157 | return 0; | 1152 | return 0; |
| 1158 | 1153 | ||
| 1159 | pte_follow = kvm_pte_follow(pte, mm_ops); | 1154 | if (mm_ops->dcache_clean_inval_poc) |
| 1160 | dcache_clean_inval_poc((unsigned long)pte_follow, | 1155 | mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops), |
| 1161 | (unsigned long)pte_follow + | 1156 | kvm_granule_size(level)); |
| 1162 | kvm_granule_size(level)); | ||
| 1163 | return 0; | 1157 | return 0; |
| 1164 | } | 1158 | } |
| 1165 | 1159 | ||
| @@ -983,6 +983,9 @@ static void __vgic_v3_read_ctlr(struct kvm_vcpu *vcpu, u32 vmcr, int rt) · 982 unmodified lines | |||
| 983 | val = ((vtr >> 29) & 7) << ICC_CTLR_EL1_PRI_BITS_SHIFT; | 983 | val = ((vtr >> 29) & 7) << ICC_CTLR_EL1_PRI_BITS_SHIFT; |
| 984 | /* IDbits */ | 984 | /* IDbits */ |
| 985 | val |= ((vtr >> 23) & 7) << ICC_CTLR_EL1_ID_BITS_SHIFT; | 985 | val |= ((vtr >> 23) & 7) << ICC_CTLR_EL1_ID_BITS_SHIFT; |
| 986 | /* SEIS */ | ||
| 987 | if (kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK) | ||
| 988 | val |= BIT(ICC_CTLR_EL1_SEIS_SHIFT); | ||
| 986 | /* A3V */ | 989 | /* A3V */ |
| 987 | val |= ((vtr >> 21) & 1) << ICC_CTLR_EL1_A3V_SHIFT; | 990 | val |= ((vtr >> 21) & 1) << ICC_CTLR_EL1_A3V_SHIFT; |
| 988 | /* EOImode */ | 991 | /* EOImode */ |
| @@ -609,6 +609,18 @@ static int __init early_gicv4_enable(char *buf) · 608 unmodified lines | |||
| 609 | } | 609 | } |
| 610 | early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable); | 610 | early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable); |
| 611 | 611 | ||
| 612 | static const struct midr_range broken_seis[] = { | ||
| 613 | MIDR_ALL_VERSIONS(MIDR_APPLE_M1_ICESTORM), | ||
| 614 | MIDR_ALL_VERSIONS(MIDR_APPLE_M1_FIRESTORM), | ||
| 615 | {}, | ||
| 616 | }; | ||
| 617 | |||
| 618 | static bool vgic_v3_broken_seis(void) | ||
| 619 | { | ||
| 620 | return ((kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK) && | ||
| 621 | is_midr_in_range_list(read_cpuid_id(), broken_seis)); | ||
| 622 | } | ||
| 623 | |||
| 612 | /** | 624 | /** |
| 613 | * vgic_v3_probe - probe for a VGICv3 compatible interrupt controller | 625 | * vgic_v3_probe - probe for a VGICv3 compatible interrupt controller |
| 614 | * @info: pointer to the GIC description | 626 | * @info: pointer to the GIC description |
| @@ -676,9 +688,10 @@ int vgic_v3_probe(const struct gic_kvm_info *info) · 61 unmodified lines | |||
| 676 | group1_trap = true; | 688 | group1_trap = true; |
| 677 | } | 689 | } |
| 678 | 690 | ||
| 679 | if (kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK) { | 691 | if (vgic_v3_broken_seis()) { |
| 680 | kvm_info("GICv3 with locally generated SEI\n"); | 692 | kvm_info("GICv3 with broken locally generated SEI\n"); |
| 681 | 693 | ||
| 694 | kvm_vgic_global_state.ich_vtr_el2 &= ~ICH_VTR_SEIS_MASK; | ||
| 682 | group0_trap = true; | 695 | group0_trap = true; |
| 683 | group1_trap = true; | 696 | group1_trap = true; |
| 684 | if (ich_vtr_el2 & ICH_VTR_TDS_MASK) | 697 | if (ich_vtr_el2 & ICH_VTR_TDS_MASK) |
| @@ -40,8 +40,8 @@ static bool · 39 unmodified lines | |||
| 40 | ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex, | 40 | ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex, |
| 41 | struct pt_regs *regs) | 41 | struct pt_regs *regs) |
| 42 | { | 42 | { |
| 43 | int reg_data = FIELD_GET(EX_DATA_REG_DATA, ex->type); | 43 | int reg_data = FIELD_GET(EX_DATA_REG_DATA, ex->data); |
| 44 | int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->type); | 44 | int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->data); |
| 45 | unsigned long data, addr, offset; | 45 | unsigned long data, addr, offset; |
| 46 | 46 | ||
| 47 | addr = pt_regs_read_reg(regs, reg_addr); | 47 | addr = pt_regs_read_reg(regs, reg_addr); |
| @@ -55,6 +55,9 @@ WORKAROUND_1418040 · 54 unmodified lines | |||
| 55 | WORKAROUND_1463225 | 55 | WORKAROUND_1463225 |
| 56 | WORKAROUND_1508412 | 56 | WORKAROUND_1508412 |
| 57 | WORKAROUND_1542419 | 57 | WORKAROUND_1542419 |
| 58 | WORKAROUND_2064142 | ||
| 59 | WORKAROUND_2038923 | ||
| 60 | WORKAROUND_1902691 | ||
| 58 | WORKAROUND_TRBE_OVERWRITE_FILL_MODE | 61 | WORKAROUND_TRBE_OVERWRITE_FILL_MODE |
| 59 | WORKAROUND_TSB_FLUSH_FAILURE | 62 | WORKAROUND_TSB_FLUSH_FAILURE |
| 60 | WORKAROUND_TRBE_WRITE_OUT_OF_RANGE | 63 | WORKAROUND_TRBE_WRITE_OUT_OF_RANGE |
| @@ -318,7 +318,7 @@ config ARCH_PROC_KCORE_TEXT · 317 unmodified lines | |||
| 318 | depends on PROC_KCORE | 318 | depends on PROC_KCORE |
| 319 | 319 | ||
| 320 | config IA64_MCA_RECOVERY | 320 | config IA64_MCA_RECOVERY |
| 321 | tristate "MCA recovery from errors other than TLB." | 321 | bool "MCA recovery from errors other than TLB." |
| 322 | 322 | ||
| 323 | config IA64_PALINFO | 323 | config IA64_PALINFO |
| 324 | tristate "/proc/pal support" | 324 | tristate "/proc/pal support" |
| @@ -76,5 +76,5 @@ static void pci_fixup_video(struct pci_dev *pdev) · 75 unmodified lines | |||
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, | 79 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, |
| 80 | PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); | 80 | PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
| @@ -74,7 +74,7 @@ · 73 unmodified lines | |||
| 74 | #define EXC(inst_reg,addr,handler) \ | 74 | #define EXC(inst_reg,addr,handler) \ |
| 75 | 9: inst_reg, addr; \ | 75 | 9: inst_reg, addr; \ |
| 76 | .section __ex_table,"a"; \ | 76 | .section __ex_table,"a"; \ |
| 77 | PTR 9b, handler; \ | 77 | PTR_WD 9b, handler; \ |
| 78 | .previous | 78 | .previous |
| 79 | 79 | ||
| 80 | /* | 80 | /* |
| @@ -285,7 +285,7 @@ symbol = value · 284 unmodified lines | |||
| 285 | 285 | ||
| 286 | #define PTR_SCALESHIFT 2 | 286 | #define PTR_SCALESHIFT 2 |
| 287 | 287 | ||
| 288 | #define PTR .word | 288 | #define PTR_WD .word |
| 289 | #define PTRSIZE 4 | 289 | #define PTRSIZE 4 |
| 290 | #define PTRLOG 2 | 290 | #define PTRLOG 2 |
| 291 | #endif | 291 | #endif |
| @@ -310,7 +310,7 @@ symbol = value · 18 unmodified lines | |||
| 310 | 310 | ||
| 311 | #define PTR_SCALESHIFT 3 | 311 | #define PTR_SCALESHIFT 3 |
| 312 | 312 | ||
| 313 | #define PTR .dword | 313 | #define PTR_WD .dword |
| 314 | #define PTRSIZE 8 | 314 | #define PTRSIZE 8 |
| 315 | #define PTRLOG 3 | 315 | #define PTRLOG 3 |
| 316 | #endif | 316 | #endif |
| @@ -32,7 +32,7 @@ do { \ · 31 unmodified lines | |||
| 32 | ".previous\n" \ | 32 | ".previous\n" \ |
| 33 | \ | 33 | \ |
| 34 | ".section\t__ex_table,\"a\"\n\t" \ | 34 | ".section\t__ex_table,\"a\"\n\t" \ |
| 35 | STR(PTR) "\t1b, 3b\n\t" \ | 35 | STR(PTR_WD) "\t1b, 3b\n\t" \ |
| 36 | ".previous\n" \ | 36 | ".previous\n" \ |
| 37 | \ | 37 | \ |
| 38 | : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\ | 38 | : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\ |
| @@ -54,7 +54,7 @@ do { \ · 15 unmodified lines | |||
| 54 | ".previous\n" \ | 54 | ".previous\n" \ |
| 55 | \ | 55 | \ |
| 56 | ".section\t__ex_table,\"a\"\n\t"\ | 56 | ".section\t__ex_table,\"a\"\n\t"\ |
| 57 | STR(PTR) "\t1b, 3b\n\t" \ | 57 | STR(PTR_WD) "\t1b, 3b\n\t" \ |
| 58 | ".previous\n" \ | 58 | ".previous\n" \ |
| 59 | \ | 59 | \ |
| 60 | : [tmp_err] "=r" (error) \ | 60 | : [tmp_err] "=r" (error) \ |
| @@ -119,7 +119,7 @@ static inline void flush_scache_line(unsigned long addr) · 118 unmodified lines | |||
| 119 | " j 2b \n" \ | 119 | " j 2b \n" \ |
| 120 | " .previous \n" \ | 120 | " .previous \n" \ |
| 121 | " .section __ex_table,\"a\" \n" \ | 121 | " .section __ex_table,\"a\" \n" \ |
| 122 | " "STR(PTR)" 1b, 3b \n" \ | 122 | " "STR(PTR_WD)" 1b, 3b \n" \ |
| 123 | " .previous" \ | 123 | " .previous" \ |
| 124 | : "+r" (__err) \ | 124 | : "+r" (__err) \ |
| 125 | : "i" (op), "r" (addr), "i" (-EFAULT)); \ | 125 | : "i" (op), "r" (addr), "i" (-EFAULT)); \ |
| @@ -142,7 +142,7 @@ static inline void flush_scache_line(unsigned long addr) · 16 unmodified lines | |||
| 142 | " j 2b \n" \ | 142 | " j 2b \n" \ |
| 143 | " .previous \n" \ | 143 | " .previous \n" \ |
| 144 | " .section __ex_table,\"a\" \n" \ | 144 | " .section __ex_table,\"a\" \n" \ |
| 145 | " "STR(PTR)" 1b, 3b \n" \ | 145 | " "STR(PTR_WD)" 1b, 3b \n" \ |
| 146 | " .previous" \ | 146 | " .previous" \ |
| 147 | : "+r" (__err) \ | 147 | : "+r" (__err) \ |
| 148 | : "i" (op), "r" (addr), "i" (-EFAULT)); \ | 148 | : "i" (op), "r" (addr), "i" (-EFAULT)); \ |
| @@ -20,8 +20,8 @@ do { \ · 19 unmodified lines | |||
| 20 | "j\t3b\n\t" \ | 20 | "j\t3b\n\t" \ |
| 21 | ".previous\n\t" \ | 21 | ".previous\n\t" \ |
| 22 | ".section\t__ex_table,\"a\"\n\t" \ | 22 | ".section\t__ex_table,\"a\"\n\t" \ |
| 23 | STR(PTR)"\t1b, 4b\n\t" \ | 23 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 24 | STR(PTR)"\t2b, 4b\n\t" \ | 24 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 25 | ".previous" \ | 25 | ".previous" \ |
| 26 | : "=&r" (value), "=r" (res) \ | 26 | : "=&r" (value), "=r" (res) \ |
| 27 | : "r" (addr), "i" (-EFAULT)); \ | 27 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -41,8 +41,8 @@ do { \ · 13 unmodified lines | |||
| 41 | "j\t3b\n\t" \ | 41 | "j\t3b\n\t" \ |
| 42 | ".previous\n\t" \ | 42 | ".previous\n\t" \ |
| 43 | ".section\t__ex_table,\"a\"\n\t" \ | 43 | ".section\t__ex_table,\"a\"\n\t" \ |
| 44 | STR(PTR)"\t1b, 4b\n\t" \ | 44 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 45 | STR(PTR)"\t2b, 4b\n\t" \ | 45 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 46 | ".previous" \ | 46 | ".previous" \ |
| 47 | : "=&r" (value), "=r" (res) \ | 47 | : "=&r" (value), "=r" (res) \ |
| 48 | : "r" (addr), "i" (-EFAULT)); \ | 48 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -74,10 +74,10 @@ do { \ · 25 unmodified lines | |||
| 74 | "j\t10b\n\t" \ | 74 | "j\t10b\n\t" \ |
| 75 | ".previous\n\t" \ | 75 | ".previous\n\t" \ |
| 76 | ".section\t__ex_table,\"a\"\n\t" \ | 76 | ".section\t__ex_table,\"a\"\n\t" \ |
| 77 | STR(PTR)"\t1b, 11b\n\t" \ | 77 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 78 | STR(PTR)"\t2b, 11b\n\t" \ | 78 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 79 | STR(PTR)"\t3b, 11b\n\t" \ | 79 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 80 | STR(PTR)"\t4b, 11b\n\t" \ | 80 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 81 | ".previous" \ | 81 | ".previous" \ |
| 82 | : "=&r" (value), "=r" (res) \ | 82 | : "=&r" (value), "=r" (res) \ |
| 83 | : "r" (addr), "i" (-EFAULT)); \ | 83 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -102,8 +102,8 @@ do { \ · 18 unmodified lines | |||
| 102 | "j\t3b\n\t" \ | 102 | "j\t3b\n\t" \ |
| 103 | ".previous\n\t" \ | 103 | ".previous\n\t" \ |
| 104 | ".section\t__ex_table,\"a\"\n\t" \ | 104 | ".section\t__ex_table,\"a\"\n\t" \ |
| 105 | STR(PTR)"\t1b, 4b\n\t" \ | 105 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 106 | STR(PTR)"\t2b, 4b\n\t" \ | 106 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 107 | ".previous" \ | 107 | ".previous" \ |
| 108 | : "=&r" (value), "=r" (res) \ | 108 | : "=&r" (value), "=r" (res) \ |
| 109 | : "r" (addr), "i" (-EFAULT)); \ | 109 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -125,8 +125,8 @@ do { \ · 15 unmodified lines | |||
| 125 | "j\t3b\n\t" \ | 125 | "j\t3b\n\t" \ |
| 126 | ".previous\n\t" \ | 126 | ".previous\n\t" \ |
| 127 | ".section\t__ex_table,\"a\"\n\t" \ | 127 | ".section\t__ex_table,\"a\"\n\t" \ |
| 128 | STR(PTR)"\t1b, 4b\n\t" \ | 128 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 129 | STR(PTR)"\t2b, 4b\n\t" \ | 129 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 130 | ".previous" \ | 130 | ".previous" \ |
| 131 | : "=&r" (value), "=r" (res) \ | 131 | : "=&r" (value), "=r" (res) \ |
| 132 | : "r" (addr), "i" (-EFAULT)); \ | 132 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -145,8 +145,8 @@ do { \ · 12 unmodified lines | |||
| 145 | "j\t3b\n\t" \ | 145 | "j\t3b\n\t" \ |
| 146 | ".previous\n\t" \ | 146 | ".previous\n\t" \ |
| 147 | ".section\t__ex_table,\"a\"\n\t" \ | 147 | ".section\t__ex_table,\"a\"\n\t" \ |
| 148 | STR(PTR)"\t1b, 4b\n\t" \ | 148 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 149 | STR(PTR)"\t2b, 4b\n\t" \ | 149 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 150 | ".previous" \ | 150 | ".previous" \ |
| 151 | : "=&r" (value), "=r" (res) \ | 151 | : "=&r" (value), "=r" (res) \ |
| 152 | : "r" (addr), "i" (-EFAULT)); \ | 152 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -178,10 +178,10 @@ do { \ · 25 unmodified lines | |||
| 178 | "j\t10b\n\t" \ | 178 | "j\t10b\n\t" \ |
| 179 | ".previous\n\t" \ | 179 | ".previous\n\t" \ |
| 180 | ".section\t__ex_table,\"a\"\n\t" \ | 180 | ".section\t__ex_table,\"a\"\n\t" \ |
| 181 | STR(PTR)"\t1b, 11b\n\t" \ | 181 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 182 | STR(PTR)"\t2b, 11b\n\t" \ | 182 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 183 | STR(PTR)"\t3b, 11b\n\t" \ | 183 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 184 | STR(PTR)"\t4b, 11b\n\t" \ | 184 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 185 | ".previous" \ | 185 | ".previous" \ |
| 186 | : "=&r" (value), "=r" (res) \ | 186 | : "=&r" (value), "=r" (res) \ |
| 187 | : "r" (addr), "i" (-EFAULT)); \ | 187 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -223,14 +223,14 @@ do { \ · 35 unmodified lines | |||
| 223 | "j\t10b\n\t" \ | 223 | "j\t10b\n\t" \ |
| 224 | ".previous\n\t" \ | 224 | ".previous\n\t" \ |
| 225 | ".section\t__ex_table,\"a\"\n\t" \ | 225 | ".section\t__ex_table,\"a\"\n\t" \ |
| 226 | STR(PTR)"\t1b, 11b\n\t" \ | 226 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 227 | STR(PTR)"\t2b, 11b\n\t" \ | 227 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 228 | STR(PTR)"\t3b, 11b\n\t" \ | 228 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 229 | STR(PTR)"\t4b, 11b\n\t" \ | 229 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 230 | STR(PTR)"\t5b, 11b\n\t" \ | 230 | STR(PTR_WD)"\t5b, 11b\n\t" \ |
| 231 | STR(PTR)"\t6b, 11b\n\t" \ | 231 | STR(PTR_WD)"\t6b, 11b\n\t" \ |
| 232 | STR(PTR)"\t7b, 11b\n\t" \ | 232 | STR(PTR_WD)"\t7b, 11b\n\t" \ |
| 233 | STR(PTR)"\t8b, 11b\n\t" \ | 233 | STR(PTR_WD)"\t8b, 11b\n\t" \ |
| 234 | ".previous" \ | 234 | ".previous" \ |
| 235 | : "=&r" (value), "=r" (res) \ | 235 | : "=&r" (value), "=r" (res) \ |
| 236 | : "r" (addr), "i" (-EFAULT)); \ | 236 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -255,8 +255,8 @@ do { \ · 18 unmodified lines | |||
| 255 | "j\t3b\n\t" \ | 255 | "j\t3b\n\t" \ |
| 256 | ".previous\n\t" \ | 256 | ".previous\n\t" \ |
| 257 | ".section\t__ex_table,\"a\"\n\t" \ | 257 | ".section\t__ex_table,\"a\"\n\t" \ |
| 258 | STR(PTR)"\t1b, 4b\n\t" \ | 258 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 259 | STR(PTR)"\t2b, 4b\n\t" \ | 259 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 260 | ".previous" \ | 260 | ".previous" \ |
| 261 | : "=r" (res) \ | 261 | : "=r" (res) \ |
| 262 | : "r" (value), "r" (addr), "i" (-EFAULT));\ | 262 | : "r" (value), "r" (addr), "i" (-EFAULT));\ |
| @@ -276,8 +276,8 @@ do { \ · 13 unmodified lines | |||
| 276 | "j\t3b\n\t" \ | 276 | "j\t3b\n\t" \ |
| 277 | ".previous\n\t" \ | 277 | ".previous\n\t" \ |
| 278 | ".section\t__ex_table,\"a\"\n\t" \ | 278 | ".section\t__ex_table,\"a\"\n\t" \ |
| 279 | STR(PTR)"\t1b, 4b\n\t" \ | 279 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 280 | STR(PTR)"\t2b, 4b\n\t" \ | 280 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 281 | ".previous" \ | 281 | ".previous" \ |
| 282 | : "=r" (res) \ | 282 | : "=r" (res) \ |
| 283 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ | 283 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ |
| @@ -296,8 +296,8 @@ do { \ · 12 unmodified lines | |||
| 296 | "j\t3b\n\t" \ | 296 | "j\t3b\n\t" \ |
| 297 | ".previous\n\t" \ | 297 | ".previous\n\t" \ |
| 298 | ".section\t__ex_table,\"a\"\n\t" \ | 298 | ".section\t__ex_table,\"a\"\n\t" \ |
| 299 | STR(PTR)"\t1b, 4b\n\t" \ | 299 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 300 | STR(PTR)"\t2b, 4b\n\t" \ | 300 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 301 | ".previous" \ | 301 | ".previous" \ |
| 302 | : "=r" (res) \ | 302 | : "=r" (res) \ |
| 303 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ | 303 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ |
| @@ -325,10 +325,10 @@ do { \ · 21 unmodified lines | |||
| 325 | "j\t10b\n\t" \ | 325 | "j\t10b\n\t" \ |
| 326 | ".previous\n\t" \ | 326 | ".previous\n\t" \ |
| 327 | ".section\t__ex_table,\"a\"\n\t" \ | 327 | ".section\t__ex_table,\"a\"\n\t" \ |
| 328 | STR(PTR)"\t1b, 11b\n\t" \ | 328 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 329 | STR(PTR)"\t2b, 11b\n\t" \ | 329 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 330 | STR(PTR)"\t3b, 11b\n\t" \ | 330 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 331 | STR(PTR)"\t4b, 11b\n\t" \ | 331 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 332 | ".previous" \ | 332 | ".previous" \ |
| 333 | : "=&r" (res) \ | 333 | : "=&r" (res) \ |
| 334 | : "r" (value), "r" (addr), "i" (-EFAULT) \ | 334 | : "r" (value), "r" (addr), "i" (-EFAULT) \ |
| @@ -365,14 +365,14 @@ do { \ · 30 unmodified lines | |||
| 365 | "j\t10b\n\t" \ | 365 | "j\t10b\n\t" \ |
| 366 | ".previous\n\t" \ | 366 | ".previous\n\t" \ |
| 367 | ".section\t__ex_table,\"a\"\n\t" \ | 367 | ".section\t__ex_table,\"a\"\n\t" \ |
| 368 | STR(PTR)"\t1b, 11b\n\t" \ | 368 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 369 | STR(PTR)"\t2b, 11b\n\t" \ | 369 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 370 | STR(PTR)"\t3b, 11b\n\t" \ | 370 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 371 | STR(PTR)"\t4b, 11b\n\t" \ | 371 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 372 | STR(PTR)"\t5b, 11b\n\t" \ | 372 | STR(PTR_WD)"\t5b, 11b\n\t" \ |
| 373 | STR(PTR)"\t6b, 11b\n\t" \ | 373 | STR(PTR_WD)"\t6b, 11b\n\t" \ |
| 374 | STR(PTR)"\t7b, 11b\n\t" \ | 374 | STR(PTR_WD)"\t7b, 11b\n\t" \ |
| 375 | STR(PTR)"\t8b, 11b\n\t" \ | 375 | STR(PTR_WD)"\t8b, 11b\n\t" \ |
| 376 | ".previous" \ | 376 | ".previous" \ |
| 377 | : "=&r" (res) \ | 377 | : "=&r" (res) \ |
| 378 | : "r" (value), "r" (addr), "i" (-EFAULT) \ | 378 | : "r" (value), "r" (addr), "i" (-EFAULT) \ |
| @@ -398,8 +398,8 @@ do { \ · 19 unmodified lines | |||
| 398 | "j\t3b\n\t" \ | 398 | "j\t3b\n\t" \ |
| 399 | ".previous\n\t" \ | 399 | ".previous\n\t" \ |
| 400 | ".section\t__ex_table,\"a\"\n\t" \ | 400 | ".section\t__ex_table,\"a\"\n\t" \ |
| 401 | STR(PTR)"\t1b, 4b\n\t" \ | 401 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 402 | STR(PTR)"\t2b, 4b\n\t" \ | 402 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 403 | ".previous" \ | 403 | ".previous" \ |
| 404 | : "=&r" (value), "=r" (res) \ | 404 | : "=&r" (value), "=r" (res) \ |
| 405 | : "r" (addr), "i" (-EFAULT)); \ | 405 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -419,8 +419,8 @@ do { \ · 13 unmodified lines | |||
| 419 | "j\t3b\n\t" \ | 419 | "j\t3b\n\t" \ |
| 420 | ".previous\n\t" \ | 420 | ".previous\n\t" \ |
| 421 | ".section\t__ex_table,\"a\"\n\t" \ | 421 | ".section\t__ex_table,\"a\"\n\t" \ |
| 422 | STR(PTR)"\t1b, 4b\n\t" \ | 422 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 423 | STR(PTR)"\t2b, 4b\n\t" \ | 423 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 424 | ".previous" \ | 424 | ".previous" \ |
| 425 | : "=&r" (value), "=r" (res) \ | 425 | : "=&r" (value), "=r" (res) \ |
| 426 | : "r" (addr), "i" (-EFAULT)); \ | 426 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -452,10 +452,10 @@ do { \ · 25 unmodified lines | |||
| 452 | "j\t10b\n\t" \ | 452 | "j\t10b\n\t" \ |
| 453 | ".previous\n\t" \ | 453 | ".previous\n\t" \ |
| 454 | ".section\t__ex_table,\"a\"\n\t" \ | 454 | ".section\t__ex_table,\"a\"\n\t" \ |
| 455 | STR(PTR)"\t1b, 11b\n\t" \ | 455 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 456 | STR(PTR)"\t2b, 11b\n\t" \ | 456 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 457 | STR(PTR)"\t3b, 11b\n\t" \ | 457 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 458 | STR(PTR)"\t4b, 11b\n\t" \ | 458 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 459 | ".previous" \ | 459 | ".previous" \ |
| 460 | : "=&r" (value), "=r" (res) \ | 460 | : "=&r" (value), "=r" (res) \ |
| 461 | : "r" (addr), "i" (-EFAULT)); \ | 461 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -481,8 +481,8 @@ do { \ · 19 unmodified lines | |||
| 481 | "j\t3b\n\t" \ | 481 | "j\t3b\n\t" \ |
| 482 | ".previous\n\t" \ | 482 | ".previous\n\t" \ |
| 483 | ".section\t__ex_table,\"a\"\n\t" \ | 483 | ".section\t__ex_table,\"a\"\n\t" \ |
| 484 | STR(PTR)"\t1b, 4b\n\t" \ | 484 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 485 | STR(PTR)"\t2b, 4b\n\t" \ | 485 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 486 | ".previous" \ | 486 | ".previous" \ |
| 487 | : "=&r" (value), "=r" (res) \ | 487 | : "=&r" (value), "=r" (res) \ |
| 488 | : "r" (addr), "i" (-EFAULT)); \ | 488 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -504,8 +504,8 @@ do { \ · 15 unmodified lines | |||
| 504 | "j\t3b\n\t" \ | 504 | "j\t3b\n\t" \ |
| 505 | ".previous\n\t" \ | 505 | ".previous\n\t" \ |
| 506 | ".section\t__ex_table,\"a\"\n\t" \ | 506 | ".section\t__ex_table,\"a\"\n\t" \ |
| 507 | STR(PTR)"\t1b, 4b\n\t" \ | 507 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 508 | STR(PTR)"\t2b, 4b\n\t" \ | 508 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 509 | ".previous" \ | 509 | ".previous" \ |
| 510 | : "=&r" (value), "=r" (res) \ | 510 | : "=&r" (value), "=r" (res) \ |
| 511 | : "r" (addr), "i" (-EFAULT)); \ | 511 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -524,8 +524,8 @@ do { \ · 12 unmodified lines | |||
| 524 | "j\t3b\n\t" \ | 524 | "j\t3b\n\t" \ |
| 525 | ".previous\n\t" \ | 525 | ".previous\n\t" \ |
| 526 | ".section\t__ex_table,\"a\"\n\t" \ | 526 | ".section\t__ex_table,\"a\"\n\t" \ |
| 527 | STR(PTR)"\t1b, 4b\n\t" \ | 527 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 528 | STR(PTR)"\t2b, 4b\n\t" \ | 528 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 529 | ".previous" \ | 529 | ".previous" \ |
| 530 | : "=&r" (value), "=r" (res) \ | 530 | : "=&r" (value), "=r" (res) \ |
| 531 | : "r" (addr), "i" (-EFAULT)); \ | 531 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -557,10 +557,10 @@ do { \ · 25 unmodified lines | |||
| 557 | "j\t10b\n\t" \ | 557 | "j\t10b\n\t" \ |
| 558 | ".previous\n\t" \ | 558 | ".previous\n\t" \ |
| 559 | ".section\t__ex_table,\"a\"\n\t" \ | 559 | ".section\t__ex_table,\"a\"\n\t" \ |
| 560 | STR(PTR)"\t1b, 11b\n\t" \ | 560 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 561 | STR(PTR)"\t2b, 11b\n\t" \ | 561 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 562 | STR(PTR)"\t3b, 11b\n\t" \ | 562 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 563 | STR(PTR)"\t4b, 11b\n\t" \ | 563 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 564 | ".previous" \ | 564 | ".previous" \ |
| 565 | : "=&r" (value), "=r" (res) \ | 565 | : "=&r" (value), "=r" (res) \ |
| 566 | : "r" (addr), "i" (-EFAULT)); \ | 566 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -602,14 +602,14 @@ do { \ · 35 unmodified lines | |||
| 602 | "j\t10b\n\t" \ | 602 | "j\t10b\n\t" \ |
| 603 | ".previous\n\t" \ | 603 | ".previous\n\t" \ |
| 604 | ".section\t__ex_table,\"a\"\n\t" \ | 604 | ".section\t__ex_table,\"a\"\n\t" \ |
| 605 | STR(PTR)"\t1b, 11b\n\t" \ | 605 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 606 | STR(PTR)"\t2b, 11b\n\t" \ | 606 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 607 | STR(PTR)"\t3b, 11b\n\t" \ | 607 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 608 | STR(PTR)"\t4b, 11b\n\t" \ | 608 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 609 | STR(PTR)"\t5b, 11b\n\t" \ | 609 | STR(PTR_WD)"\t5b, 11b\n\t" \ |
| 610 | STR(PTR)"\t6b, 11b\n\t" \ | 610 | STR(PTR_WD)"\t6b, 11b\n\t" \ |
| 611 | STR(PTR)"\t7b, 11b\n\t" \ | 611 | STR(PTR_WD)"\t7b, 11b\n\t" \ |
| 612 | STR(PTR)"\t8b, 11b\n\t" \ | 612 | STR(PTR_WD)"\t8b, 11b\n\t" \ |
| 613 | ".previous" \ | 613 | ".previous" \ |
| 614 | : "=&r" (value), "=r" (res) \ | 614 | : "=&r" (value), "=r" (res) \ |
| 615 | : "r" (addr), "i" (-EFAULT)); \ | 615 | : "r" (addr), "i" (-EFAULT)); \ |
| @@ -632,8 +632,8 @@ do { \ · 16 unmodified lines | |||
| 632 | "j\t3b\n\t" \ | 632 | "j\t3b\n\t" \ |
| 633 | ".previous\n\t" \ | 633 | ".previous\n\t" \ |
| 634 | ".section\t__ex_table,\"a\"\n\t" \ | 634 | ".section\t__ex_table,\"a\"\n\t" \ |
| 635 | STR(PTR)"\t1b, 4b\n\t" \ | 635 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 636 | STR(PTR)"\t2b, 4b\n\t" \ | 636 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 637 | ".previous" \ | 637 | ".previous" \ |
| 638 | : "=r" (res) \ | 638 | : "=r" (res) \ |
| 639 | : "r" (value), "r" (addr), "i" (-EFAULT));\ | 639 | : "r" (value), "r" (addr), "i" (-EFAULT));\ |
| @@ -653,8 +653,8 @@ do { \ · 13 unmodified lines | |||
| 653 | "j\t3b\n\t" \ | 653 | "j\t3b\n\t" \ |
| 654 | ".previous\n\t" \ | 654 | ".previous\n\t" \ |
| 655 | ".section\t__ex_table,\"a\"\n\t" \ | 655 | ".section\t__ex_table,\"a\"\n\t" \ |
| 656 | STR(PTR)"\t1b, 4b\n\t" \ | 656 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 657 | STR(PTR)"\t2b, 4b\n\t" \ | 657 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 658 | ".previous" \ | 658 | ".previous" \ |
| 659 | : "=r" (res) \ | 659 | : "=r" (res) \ |
| 660 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ | 660 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ |
| @@ -673,8 +673,8 @@ do { \ · 12 unmodified lines | |||
| 673 | "j\t3b\n\t" \ | 673 | "j\t3b\n\t" \ |
| 674 | ".previous\n\t" \ | 674 | ".previous\n\t" \ |
| 675 | ".section\t__ex_table,\"a\"\n\t" \ | 675 | ".section\t__ex_table,\"a\"\n\t" \ |
| 676 | STR(PTR)"\t1b, 4b\n\t" \ | 676 | STR(PTR_WD)"\t1b, 4b\n\t" \ |
| 677 | STR(PTR)"\t2b, 4b\n\t" \ | 677 | STR(PTR_WD)"\t2b, 4b\n\t" \ |
| 678 | ".previous" \ | 678 | ".previous" \ |
| 679 | : "=r" (res) \ | 679 | : "=r" (res) \ |
| 680 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ | 680 | : "r" (value), "r" (addr), "i" (-EFAULT)); \ |
| @@ -703,10 +703,10 @@ do { \ · 22 unmodified lines | |||
| 703 | "j\t10b\n\t" \ | 703 | "j\t10b\n\t" \ |
| 704 | ".previous\n\t" \ | 704 | ".previous\n\t" \ |
| 705 | ".section\t__ex_table,\"a\"\n\t" \ | 705 | ".section\t__ex_table,\"a\"\n\t" \ |
| 706 | STR(PTR)"\t1b, 11b\n\t" \ | 706 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 707 | STR(PTR)"\t2b, 11b\n\t" \ | 707 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 708 | STR(PTR)"\t3b, 11b\n\t" \ | 708 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 709 | STR(PTR)"\t4b, 11b\n\t" \ | 709 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 710 | ".previous" \ | 710 | ".previous" \ |
| 711 | : "=&r" (res) \ | 711 | : "=&r" (res) \ |
| 712 | : "r" (value), "r" (addr), "i" (-EFAULT) \ | 712 | : "r" (value), "r" (addr), "i" (-EFAULT) \ |
| @@ -743,14 +743,14 @@ do { \ · 30 unmodified lines | |||
| 743 | "j\t10b\n\t" \ | 743 | "j\t10b\n\t" \ |
| 744 | ".previous\n\t" \ | 744 | ".previous\n\t" \ |
| 745 | ".section\t__ex_table,\"a\"\n\t" \ | 745 | ".section\t__ex_table,\"a\"\n\t" \ |
| 746 | STR(PTR)"\t1b, 11b\n\t" \ | 746 | STR(PTR_WD)"\t1b, 11b\n\t" \ |
| 747 | STR(PTR)"\t2b, 11b\n\t" \ | 747 | STR(PTR_WD)"\t2b, 11b\n\t" \ |
| 748 | STR(PTR)"\t3b, 11b\n\t" \ | 748 | STR(PTR_WD)"\t3b, 11b\n\t" \ |
| 749 | STR(PTR)"\t4b, 11b\n\t" \ | 749 | STR(PTR_WD)"\t4b, 11b\n\t" \ |
| 750 | STR(PTR)"\t5b, 11b\n\t" \ | 750 | STR(PTR_WD)"\t5b, 11b\n\t" \ |
| 751 | STR(PTR)"\t6b, 11b\n\t" \ | 751 | STR(PTR_WD)"\t6b, 11b\n\t" \ |
| 752 | STR(PTR)"\t7b, 11b\n\t" \ | 752 | STR(PTR_WD)"\t7b, 11b\n\t" \ |
| 753 | STR(PTR)"\t8b, 11b\n\t" \ | 753 | STR(PTR_WD)"\t8b, 11b\n\t" \ |
| 754 | ".previous" \ | 754 | ".previous" \ |
| 755 | : "=&r" (res) \ | 755 | : "=&r" (res) \ |
| 756 | : "r" (value), "r" (addr), "i" (-EFAULT) \ | 756 | : "r" (value), "r" (addr), "i" (-EFAULT) \ |
| @@ -1258,10 +1258,10 @@ fpu_emul: · 1257 unmodified lines | |||
| 1258 | " j 10b\n" | 1258 | " j 10b\n" |
| 1259 | " .previous\n" | 1259 | " .previous\n" |
| 1260 | " .section __ex_table,\"a\"\n" | 1260 | " .section __ex_table,\"a\"\n" |
| 1261 | STR(PTR) " 1b,8b\n" | 1261 | STR(PTR_WD) " 1b,8b\n" |
| 1262 | STR(PTR) " 2b,8b\n" | 1262 | STR(PTR_WD) " 2b,8b\n" |
| 1263 | STR(PTR) " 3b,8b\n" | 1263 | STR(PTR_WD) " 3b,8b\n" |
| 1264 | STR(PTR) " 4b,8b\n" | 1264 | STR(PTR_WD) " 4b,8b\n" |
| 1265 | " .previous\n" | 1265 | " .previous\n" |
| 1266 | " .set pop\n" | 1266 | " .set pop\n" |
| 1267 | : "+&r"(rt), "=&r"(rs), | 1267 | : "+&r"(rt), "=&r"(rs), |
| @@ -1333,10 +1333,10 @@ fpu_emul: · 65 unmodified lines | |||
| 1333 | " j 10b\n" | 1333 | " j 10b\n" |
| 1334 | " .previous\n" | 1334 | " .previous\n" |
| 1335 | " .section __ex_table,\"a\"\n" | 1335 | " .section __ex_table,\"a\"\n" |
| 1336 | STR(PTR) " 1b,8b\n" | 1336 | STR(PTR_WD) " 1b,8b\n" |
| 1337 | STR(PTR) " 2b,8b\n" | 1337 | STR(PTR_WD) " 2b,8b\n" |
| 1338 | STR(PTR) " 3b,8b\n" | 1338 | STR(PTR_WD) " 3b,8b\n" |
| 1339 | STR(PTR) " 4b,8b\n" | 1339 | STR(PTR_WD) " 4b,8b\n" |
| 1340 | " .previous\n" | 1340 | " .previous\n" |
| 1341 | " .set pop\n" | 1341 | " .set pop\n" |
| 1342 | : "+&r"(rt), "=&r"(rs), | 1342 | : "+&r"(rt), "=&r"(rs), |
| @@ -1404,10 +1404,10 @@ fpu_emul: · 61 unmodified lines | |||
| 1404 | " j 9b\n" | 1404 | " j 9b\n" |
| 1405 | " .previous\n" | 1405 | " .previous\n" |
| 1406 | " .section __ex_table,\"a\"\n" | 1406 | " .section __ex_table,\"a\"\n" |
| 1407 | STR(PTR) " 1b,8b\n" | 1407 | STR(PTR_WD) " 1b,8b\n" |
| 1408 | STR(PTR) " 2b,8b\n" | 1408 | STR(PTR_WD) " 2b,8b\n" |
| 1409 | STR(PTR) " 3b,8b\n" | 1409 | STR(PTR_WD) " 3b,8b\n" |
| 1410 | STR(PTR) " 4b,8b\n" | 1410 | STR(PTR_WD) " 4b,8b\n" |
| 1411 | " .previous\n" | 1411 | " .previous\n" |
| 1412 | " .set pop\n" | 1412 | " .set pop\n" |
| 1413 | : "+&r"(rt), "=&r"(rs), | 1413 | : "+&r"(rt), "=&r"(rs), |
| @@ -1474,10 +1474,10 @@ fpu_emul: · 60 unmodified lines | |||
| 1474 | " j 9b\n" | 1474 | " j 9b\n" |
| 1475 | " .previous\n" | 1475 | " .previous\n" |
| 1476 | " .section __ex_table,\"a\"\n" | 1476 | " .section __ex_table,\"a\"\n" |
| 1477 | STR(PTR) " 1b,8b\n" | 1477 | STR(PTR_WD) " 1b,8b\n" |
| 1478 | STR(PTR) " 2b,8b\n" | 1478 | STR(PTR_WD) " 2b,8b\n" |
| 1479 | STR(PTR) " 3b,8b\n" | 1479 | STR(PTR_WD) " 3b,8b\n" |
| 1480 | STR(PTR) " 4b,8b\n" | 1480 | STR(PTR_WD) " 4b,8b\n" |
| 1481 | " .previous\n" | 1481 | " .previous\n" |
| 1482 | " .set pop\n" | 1482 | " .set pop\n" |
| 1483 | : "+&r"(rt), "=&r"(rs), | 1483 | : "+&r"(rt), "=&r"(rs), |
| @@ -1589,14 +1589,14 @@ fpu_emul: · 105 unmodified lines | |||
| 1589 | " j 9b\n" | 1589 | " j 9b\n" |
| 1590 | " .previous\n" | 1590 | " .previous\n" |
| 1591 | " .section __ex_table,\"a\"\n" | 1591 | " .section __ex_table,\"a\"\n" |
| 1592 | STR(PTR) " 1b,8b\n" | 1592 | STR(PTR_WD) " 1b,8b\n" |
| 1593 | STR(PTR) " 2b,8b\n" | 1593 | STR(PTR_WD) " 2b,8b\n" |
| 1594 | STR(PTR) " 3b,8b\n" | 1594 | STR(PTR_WD) " 3b,8b\n" |
| 1595 | STR(PTR) " 4b,8b\n" | 1595 | STR(PTR_WD) " 4b,8b\n" |
| 1596 | STR(PTR) " 5b,8b\n" | 1596 | STR(PTR_WD) " 5b,8b\n" |
| 1597 | STR(PTR) " 6b,8b\n" | 1597 | STR(PTR_WD) " 6b,8b\n" |
| 1598 | STR(PTR) " 7b,8b\n" | 1598 | STR(PTR_WD) " 7b,8b\n" |
| 1599 | STR(PTR) " 0b,8b\n" | 1599 | STR(PTR_WD) " 0b,8b\n" |
| 1600 | " .previous\n" | 1600 | " .previous\n" |
| 1601 | " .set pop\n" | 1601 | " .set pop\n" |
| 1602 | : "+&r"(rt), "=&r"(rs), | 1602 | : "+&r"(rt), "=&r"(rs), |
| @@ -1708,14 +1708,14 @@ fpu_emul: · 105 unmodified lines | |||
| 1708 | " j 9b\n" | 1708 | " j 9b\n" |
| 1709 | " .previous\n" | 1709 | " .previous\n" |
| 1710 | " .section __ex_table,\"a\"\n" | 1710 | " .section __ex_table,\"a\"\n" |
| 1711 | STR(PTR) " 1b,8b\n" | 1711 | STR(PTR_WD) " 1b,8b\n" |
| 1712 | STR(PTR) " 2b,8b\n" | 1712 | STR(PTR_WD) " 2b,8b\n" |
| 1713 | STR(PTR) " 3b,8b\n" | 1713 | STR(PTR_WD) " 3b,8b\n" |
| 1714 | STR(PTR) " 4b,8b\n" | 1714 | STR(PTR_WD) " 4b,8b\n" |
| 1715 | STR(PTR) " 5b,8b\n" | 1715 | STR(PTR_WD) " 5b,8b\n" |
| 1716 | STR(PTR) " 6b,8b\n" | 1716 | STR(PTR_WD) " 6b,8b\n" |
| 1717 | STR(PTR) " 7b,8b\n" | 1717 | STR(PTR_WD) " 7b,8b\n" |
| 1718 | STR(PTR) " 0b,8b\n" | 1718 | STR(PTR_WD) " 0b,8b\n" |
| 1719 | " .previous\n" | 1719 | " .previous\n" |
| 1720 | " .set pop\n" | 1720 | " .set pop\n" |
| 1721 | : "+&r"(rt), "=&r"(rs), | 1721 | : "+&r"(rt), "=&r"(rs), |
| @@ -1827,14 +1827,14 @@ fpu_emul: · 105 unmodified lines | |||
| 1827 | " j 9b\n" | 1827 | " j 9b\n" |
| 1828 | " .previous\n" | 1828 | " .previous\n" |
| 1829 | " .section __ex_table,\"a\"\n" | 1829 | " .section __ex_table,\"a\"\n" |
| 1830 | STR(PTR) " 1b,8b\n" | 1830 | STR(PTR_WD) " 1b,8b\n" |
| 1831 | STR(PTR) " 2b,8b\n" | 1831 | STR(PTR_WD) " 2b,8b\n" |
| 1832 | STR(PTR) " 3b,8b\n" | 1832 | STR(PTR_WD) " 3b,8b\n" |
| 1833 | STR(PTR) " 4b,8b\n" | 1833 | STR(PTR_WD) " 4b,8b\n" |
| 1834 | STR(PTR) " 5b,8b\n" | 1834 | STR(PTR_WD) " 5b,8b\n" |
| 1835 | STR(PTR) " 6b,8b\n" | 1835 | STR(PTR_WD) " 6b,8b\n" |
| 1836 | STR(PTR) " 7b,8b\n" | 1836 | STR(PTR_WD) " 7b,8b\n" |
| 1837 | STR(PTR) " 0b,8b\n" | 1837 | STR(PTR_WD) " 0b,8b\n" |
| 1838 | " .previous\n" | 1838 | " .previous\n" |
| 1839 | " .set pop\n" | 1839 | " .set pop\n" |
| 1840 | : "+&r"(rt), "=&r"(rs), | 1840 | : "+&r"(rt), "=&r"(rs), |
| @@ -1945,14 +1945,14 @@ fpu_emul: · 104 unmodified lines | |||
| 1945 | " j 9b\n" | 1945 | " j 9b\n" |
| 1946 | " .previous\n" | 1946 | " .previous\n" |
| 1947 | " .section __ex_table,\"a\"\n" | 1947 | " .section __ex_table,\"a\"\n" |
| 1948 | STR(PTR) " 1b,8b\n" | 1948 | STR(PTR_WD) " 1b,8b\n" |
| 1949 | STR(PTR) " 2b,8b\n" | 1949 | STR(PTR_WD) " 2b,8b\n" |
| 1950 | STR(PTR) " 3b,8b\n" | 1950 | STR(PTR_WD) " 3b,8b\n" |
| 1951 | STR(PTR) " 4b,8b\n" | 1951 | STR(PTR_WD) " 4b,8b\n" |
| 1952 | STR(PTR) " 5b,8b\n" | 1952 | STR(PTR_WD) " 5b,8b\n" |
| 1953 | STR(PTR) " 6b,8b\n" | 1953 | STR(PTR_WD) " 6b,8b\n" |
| 1954 | STR(PTR) " 7b,8b\n" | 1954 | STR(PTR_WD) " 7b,8b\n" |
| 1955 | STR(PTR) " 0b,8b\n" | 1955 | STR(PTR_WD) " 0b,8b\n" |
| 1956 | " .previous\n" | 1956 | " .previous\n" |
| 1957 | " .set pop\n" | 1957 | " .set pop\n" |
| 1958 | : "+&r"(rt), "=&r"(rs), | 1958 | : "+&r"(rt), "=&r"(rs), |
| @@ -2007,7 +2007,7 @@ fpu_emul: · 48 unmodified lines | |||
| 2007 | "j 2b\n" | 2007 | "j 2b\n" |
| 2008 | ".previous\n" | 2008 | ".previous\n" |
| 2009 | ".section __ex_table,\"a\"\n" | 2009 | ".section __ex_table,\"a\"\n" |
| 2010 | STR(PTR) " 1b,3b\n" | 2010 | STR(PTR_WD) " 1b,3b\n" |
| 2011 | ".previous\n" | 2011 | ".previous\n" |
| 2012 | : "=&r"(res), "+&r"(err) | 2012 | : "=&r"(res), "+&r"(err) |
| 2013 | : "r"(vaddr), "i"(SIGSEGV) | 2013 | : "r"(vaddr), "i"(SIGSEGV) |
| @@ -2065,7 +2065,7 @@ fpu_emul: · 51 unmodified lines | |||
| 2065 | "j 2b\n" | 2065 | "j 2b\n" |
| 2066 | ".previous\n" | 2066 | ".previous\n" |
| 2067 | ".section __ex_table,\"a\"\n" | 2067 | ".section __ex_table,\"a\"\n" |
| 2068 | STR(PTR) " 1b,3b\n" | 2068 | STR(PTR_WD) " 1b,3b\n" |
| 2069 | ".previous\n" | 2069 | ".previous\n" |
| 2070 | : "+&r"(res), "+&r"(err) | 2070 | : "+&r"(res), "+&r"(err) |
| 2071 | : "r"(vaddr), "i"(SIGSEGV)); | 2071 | : "r"(vaddr), "i"(SIGSEGV)); |
| @@ -2126,7 +2126,7 @@ fpu_emul: · 54 unmodified lines | |||
| 2126 | "j 2b\n" | 2126 | "j 2b\n" |
| 2127 | ".previous\n" | 2127 | ".previous\n" |
| 2128 | ".section __ex_table,\"a\"\n" | 2128 | ".section __ex_table,\"a\"\n" |
| 2129 | STR(PTR) " 1b,3b\n" | 2129 | STR(PTR_WD) " 1b,3b\n" |
| 2130 | ".previous\n" | 2130 | ".previous\n" |
| 2131 | : "=&r"(res), "+&r"(err) | 2131 | : "=&r"(res), "+&r"(err) |
| 2132 | : "r"(vaddr), "i"(SIGSEGV) | 2132 | : "r"(vaddr), "i"(SIGSEGV) |
| @@ -2189,7 +2189,7 @@ fpu_emul: · 56 unmodified lines | |||
| 2189 | "j 2b\n" | 2189 | "j 2b\n" |
| 2190 | ".previous\n" | 2190 | ".previous\n" |
| 2191 | ".section __ex_table,\"a\"\n" | 2191 | ".section __ex_table,\"a\"\n" |
| 2192 | STR(PTR) " 1b,3b\n" | 2192 | STR(PTR_WD) " 1b,3b\n" |
| 2193 | ".previous\n" | 2193 | ".previous\n" |
| 2194 | : "+&r"(res), "+&r"(err) | 2194 | : "+&r"(res), "+&r"(err) |
| 2195 | : "r"(vaddr), "i"(SIGSEGV)); | 2195 | : "r"(vaddr), "i"(SIGSEGV)); |
| @@ -23,14 +23,14 @@ · 22 unmodified lines | |||
| 23 | #define EX(a,b) \ | 23 | #define EX(a,b) \ |
| 24 | 9: a,##b; \ | 24 | 9: a,##b; \ |
| 25 | .section __ex_table,"a"; \ | 25 | .section __ex_table,"a"; \ |
| 26 | PTR 9b,fault; \ | 26 | PTR_WD 9b,fault; \ |
| 27 | .previous | 27 | .previous |
| 28 | 28 | ||
| 29 | #define EX2(a,b) \ | 29 | #define EX2(a,b) \ |
| 30 | 9: a,##b; \ | 30 | 9: a,##b; \ |
| 31 | .section __ex_table,"a"; \ | 31 | .section __ex_table,"a"; \ |
| 32 | PTR 9b,fault; \ | 32 | PTR_WD 9b,fault; \ |
| 33 | PTR 9b+4,fault; \ | 33 | PTR_WD 9b+4,fault; \ |
| 34 | .previous | 34 | .previous |
| 35 | 35 | ||
| 36 | .set mips1 | 36 | .set mips1 |
| @@ -31,7 +31,7 @@ · 30 unmodified lines | |||
| 31 | .ex\@: \insn \reg, \src | 31 | .ex\@: \insn \reg, \src |
| 32 | .set pop | 32 | .set pop |
| 33 | .section __ex_table,"a" | 33 | .section __ex_table,"a" |
| 34 | PTR .ex\@, fault | 34 | PTR_WD .ex\@, fault |
| 35 | .previous | 35 | .previous |
| 36 | .endm | 36 | .endm |
| 37 | 37 | ||
| @@ -147,10 +147,10 @@ LEAF(kexec_smp_wait) · 146 unmodified lines | |||
| 147 | 147 | ||
| 148 | kexec_args: | 148 | kexec_args: |
| 149 | EXPORT(kexec_args) | 149 | EXPORT(kexec_args) |
| 150 | arg0: PTR 0x0 | 150 | arg0: PTR_WD 0x0 |
| 151 | arg1: PTR 0x0 | 151 | arg1: PTR_WD 0x0 |
| 152 | arg2: PTR 0x0 | 152 | arg2: PTR_WD 0x0 |
| 153 | arg3: PTR 0x0 | 153 | arg3: PTR_WD 0x0 |
| 154 | .size kexec_args,PTRSIZE*4 | 154 | .size kexec_args,PTRSIZE*4 |
| 155 | 155 | ||
| 156 | #ifdef CONFIG_SMP | 156 | #ifdef CONFIG_SMP |
| @@ -161,10 +161,10 @@ arg3: PTR 0x0 · 4 unmodified lines | |||
| 161 | */ | 161 | */ |
| 162 | secondary_kexec_args: | 162 | secondary_kexec_args: |
| 163 | EXPORT(secondary_kexec_args) | 163 | EXPORT(secondary_kexec_args) |
| 164 | s_arg0: PTR 0x0 | 164 | s_arg0: PTR_WD 0x0 |
| 165 | s_arg1: PTR 0x0 | 165 | s_arg1: PTR_WD 0x0 |
| 166 | s_arg2: PTR 0x0 | 166 | s_arg2: PTR_WD 0x0 |
| 167 | s_arg3: PTR 0x0 | 167 | s_arg3: PTR_WD 0x0 |
| 168 | .size secondary_kexec_args,PTRSIZE*4 | 168 | .size secondary_kexec_args,PTRSIZE*4 |
| 169 | kexec_flag: | 169 | kexec_flag: |
| 170 | LONG 0x1 | 170 | LONG 0x1 |
| @@ -173,17 +173,17 @@ kexec_flag: · 2 unmodified lines | |||
| 173 | 173 | ||
| 174 | kexec_start_address: | 174 | kexec_start_address: |
| 175 | EXPORT(kexec_start_address) | 175 | EXPORT(kexec_start_address) |
| 176 | PTR 0x0 | 176 | PTR_WD 0x0 |
| 177 | .size kexec_start_address, PTRSIZE | 177 | .size kexec_start_address, PTRSIZE |
| 178 | 178 | ||
| 179 | kexec_indirection_page: | 179 | kexec_indirection_page: |
| 180 | EXPORT(kexec_indirection_page) | 180 | EXPORT(kexec_indirection_page) |
| 181 | PTR 0 | 181 | PTR_WD 0 |
| 182 | .size kexec_indirection_page, PTRSIZE | 182 | .size kexec_indirection_page, PTRSIZE |
| 183 | 183 | ||
| 184 | relocate_new_kernel_end: | 184 | relocate_new_kernel_end: |
| 185 | 185 | ||
| 186 | relocate_new_kernel_size: | 186 | relocate_new_kernel_size: |
| 187 | EXPORT(relocate_new_kernel_size) | 187 | EXPORT(relocate_new_kernel_size) |
| 188 | PTR relocate_new_kernel_end - relocate_new_kernel | 188 | PTR_WD relocate_new_kernel_end - relocate_new_kernel |
| 189 | .size relocate_new_kernel_size, PTRSIZE | 189 | .size relocate_new_kernel_size, PTRSIZE |
| @@ -72,10 +72,10 @@ loads_done: · 71 unmodified lines | |||
| 72 | .set pop | 72 | .set pop |
| 73 | 73 | ||
| 74 | .section __ex_table,"a" | 74 | .section __ex_table,"a" |
| 75 | PTR load_a4, bad_stack_a4 | 75 | PTR_WD load_a4, bad_stack_a4 |
| 76 | PTR load_a5, bad_stack_a5 | 76 | PTR_WD load_a5, bad_stack_a5 |
| 77 | PTR load_a6, bad_stack_a6 | 77 | PTR_WD load_a6, bad_stack_a6 |
| 78 | PTR load_a7, bad_stack_a7 | 78 | PTR_WD load_a7, bad_stack_a7 |
| 79 | .previous | 79 | .previous |
| 80 | 80 | ||
| 81 | lw t0, TI_FLAGS($28) # syscall tracing enabled? | 81 | lw t0, TI_FLAGS($28) # syscall tracing enabled? |
| @@ -216,7 +216,7 @@ einval: li v0, -ENOSYS · 134 unmodified lines | |||
| 216 | #endif /* CONFIG_MIPS_MT_FPAFF */ | 216 | #endif /* CONFIG_MIPS_MT_FPAFF */ |
| 217 | 217 | ||
| 218 | #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) | 218 | #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) |
| 219 | #define __SYSCALL(nr, entry) PTR entry | 219 | #define __SYSCALL(nr, entry) PTR_WD entry |
| 220 | .align 2 | 220 | .align 2 |
| 221 | .type sys_call_table, @object | 221 | .type sys_call_table, @object |
| 222 | EXPORT(sys_call_table) | 222 | EXPORT(sys_call_table) |
| @@ -101,7 +101,7 @@ not_n32_scall: · 100 unmodified lines | |||
| 101 | 101 | ||
| 102 | END(handle_sysn32) | 102 | END(handle_sysn32) |
| 103 | 103 | ||
| 104 | #define __SYSCALL(nr, entry) PTR entry | 104 | #define __SYSCALL(nr, entry) PTR_WD entry |
| 105 | .type sysn32_call_table, @object | 105 | .type sysn32_call_table, @object |
| 106 | EXPORT(sysn32_call_table) | 106 | EXPORT(sysn32_call_table) |
| 107 | #include <asm/syscall_table_n32.h> | 107 | #include <asm/syscall_table_n32.h> |
| @@ -109,7 +109,7 @@ illegal_syscall: · 108 unmodified lines | |||
| 109 | j n64_syscall_exit | 109 | j n64_syscall_exit |
| 110 | END(handle_sys64) | 110 | END(handle_sys64) |
| 111 | 111 | ||
| 112 | #define __SYSCALL(nr, entry) PTR entry | 112 | #define __SYSCALL(nr, entry) PTR_WD entry |
| 113 | .align 3 | 113 | .align 3 |
| 114 | .type sys_call_table, @object | 114 | .type sys_call_table, @object |
| 115 | EXPORT(sys_call_table) | 115 | EXPORT(sys_call_table) |
| @@ -73,10 +73,10 @@ load_a7: lw a7, 28(t0) # argument #8 from usp · 72 unmodified lines | |||
| 73 | loads_done: | 73 | loads_done: |
| 74 | 74 | ||
| 75 | .section __ex_table,"a" | 75 | .section __ex_table,"a" |
| 76 | PTR load_a4, bad_stack_a4 | 76 | PTR_WD load_a4, bad_stack_a4 |
| 77 | PTR load_a5, bad_stack_a5 | 77 | PTR_WD load_a5, bad_stack_a5 |
| 78 | PTR load_a6, bad_stack_a6 | 78 | PTR_WD load_a6, bad_stack_a6 |
| 79 | PTR load_a7, bad_stack_a7 | 79 | PTR_WD load_a7, bad_stack_a7 |
| 80 | .previous | 80 | .previous |
| 81 | 81 | ||
| 82 | li t1, _TIF_WORK_SYSCALL_ENTRY | 82 | li t1, _TIF_WORK_SYSCALL_ENTRY |
| @@ -214,7 +214,7 @@ einval: li v0, -ENOSYS · 131 unmodified lines | |||
| 214 | END(sys32_syscall) | 214 | END(sys32_syscall) |
| 215 | 215 | ||
| 216 | #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) | 216 | #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) |
| 217 | #define __SYSCALL(nr, entry) PTR entry | 217 | #define __SYSCALL(nr, entry) PTR_WD entry |
| 218 | .align 3 | 218 | .align 3 |
| 219 | .type sys32_call_table,@object | 219 | .type sys32_call_table,@object |
| 220 | EXPORT(sys32_call_table) | 220 | EXPORT(sys32_call_table) |
| @@ -122,8 +122,8 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new) · 121 unmodified lines | |||
| 122 | " j 3b \n" | 122 | " j 3b \n" |
| 123 | " .previous \n" | 123 | " .previous \n" |
| 124 | " .section __ex_table,\"a\" \n" | 124 | " .section __ex_table,\"a\" \n" |
| 125 | " "STR(PTR)" 1b, 4b \n" | 125 | " "STR(PTR_WD)" 1b, 4b \n" |
| 126 | " "STR(PTR)" 2b, 4b \n" | 126 | " "STR(PTR_WD)" 2b, 4b \n" |
| 127 | " .previous \n" | 127 | " .previous \n" |
| 128 | " .set pop \n" | 128 | " .set pop \n" |
| 129 | : [old] "=&r" (old), | 129 | : [old] "=&r" (old), |
| @@ -152,8 +152,8 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new) · 22 unmodified lines | |||
| 152 | " j 3b \n" | 152 | " j 3b \n" |
| 153 | " .previous \n" | 153 | " .previous \n" |
| 154 | " .section __ex_table,\"a\" \n" | 154 | " .section __ex_table,\"a\" \n" |
| 155 | " "STR(PTR)" 1b, 5b \n" | 155 | " "STR(PTR_WD)" 1b, 5b \n" |
| 156 | " "STR(PTR)" 2b, 5b \n" | 156 | " "STR(PTR_WD)" 2b, 5b \n" |
| 157 | " .previous \n" | 157 | " .previous \n" |
| 158 | " .set pop \n" | 158 | " .set pop \n" |
| 159 | : [old] "=&r" (old), | 159 | : [old] "=&r" (old), |
| @@ -458,8 +458,8 @@ void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu) · 457 unmodified lines | |||
| 458 | /** | 458 | /** |
| 459 | * _kvm_vz_save_htimer() - Switch to software emulation of guest timer. | 459 | * _kvm_vz_save_htimer() - Switch to software emulation of guest timer. |
| 460 | * @vcpu: Virtual CPU. | 460 | * @vcpu: Virtual CPU. |
| 461 | * @compare: Pointer to write compare value to. | 461 | * @out_compare: Pointer to write compare value to. |
| 462 | * @cause: Pointer to write cause value to. | 462 | * @out_cause: Pointer to write cause value to. |
| 463 | * | 463 | * |
| 464 | * Save VZ guest timer state and switch to software emulation of guest CP0 | 464 | * Save VZ guest timer state and switch to software emulation of guest CP0 |
| 465 | * timer. The hard timer must already be in use, so preemption should be | 465 | * timer. The hard timer must already be in use, so preemption should be |
| @@ -1541,11 +1541,14 @@ static int kvm_trap_vz_handle_guest_exit(struct kvm_vcpu *vcpu) · 1075 unmodified lines | |||
| 1541 | } | 1541 | } |
| 1542 | 1542 | ||
| 1543 | /** | 1543 | /** |
| 1544 | * kvm_trap_vz_handle_cop_unusuable() - Guest used unusable coprocessor. | 1544 | * kvm_trap_vz_handle_cop_unusable() - Guest used unusable coprocessor. |
| 1545 | * @vcpu: Virtual CPU context. | 1545 | * @vcpu: Virtual CPU context. |
| 1546 | * | 1546 | * |
| 1547 | * Handle when the guest attempts to use a coprocessor which hasn't been allowed | 1547 | * Handle when the guest attempts to use a coprocessor which hasn't been allowed |
| 1548 | * by the root context. | 1548 | * by the root context. |
| 1549 | * | ||
| 1550 | * Return: value indicating whether to resume the host or the guest | ||
| 1551 | * (RESUME_HOST or RESUME_GUEST) | ||
| 1549 | */ | 1552 | */ |
| 1550 | static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu) | 1553 | static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu) |
| 1551 | { | 1554 | { |
| @@ -1592,6 +1595,9 @@ static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu) · 40 unmodified lines | |||
| 1592 | * | 1595 | * |
| 1593 | * Handle when the guest attempts to use MSA when it is disabled in the root | 1596 | * Handle when the guest attempts to use MSA when it is disabled in the root |
| 1594 | * context. | 1597 | * context. |
| 1598 | * | ||
| 1599 | * Return: value indicating whether to resume the host or the guest | ||
| 1600 | * (RESUME_HOST or RESUME_GUEST) | ||
| 1595 | */ | 1601 | */ |
| 1596 | static int kvm_trap_vz_handle_msa_disabled(struct kvm_vcpu *vcpu) | 1602 | static int kvm_trap_vz_handle_msa_disabled(struct kvm_vcpu *vcpu) |
| 1597 | { | 1603 | { |
| @@ -347,7 +347,7 @@ EXPORT_SYMBOL(csum_partial) · 346 unmodified lines | |||
| 347 | .if \mode == LEGACY_MODE; \ | 347 | .if \mode == LEGACY_MODE; \ |
| 348 | 9: insn reg, addr; \ | 348 | 9: insn reg, addr; \ |
| 349 | .section __ex_table,"a"; \ | 349 | .section __ex_table,"a"; \ |
| 350 | PTR 9b, .L_exc; \ | 350 | PTR_WD 9b, .L_exc; \ |
| 351 | .previous; \ | 351 | .previous; \ |
| 352 | /* This is enabled in EVA mode */ \ | 352 | /* This is enabled in EVA mode */ \ |
| 353 | .else; \ | 353 | .else; \ |
| @@ -356,7 +356,7 @@ EXPORT_SYMBOL(csum_partial) · 2 unmodified lines | |||
| 356 | ((\to == USEROP) && (type == ST_INSN)); \ | 356 | ((\to == USEROP) && (type == ST_INSN)); \ |
| 357 | 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ | 357 | 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ |
| 358 | .section __ex_table,"a"; \ | 358 | .section __ex_table,"a"; \ |
| 359 | PTR 9b, .L_exc; \ | 359 | PTR_WD 9b, .L_exc; \ |
| 360 | .previous; \ | 360 | .previous; \ |
| 361 | .else; \ | 361 | .else; \ |
| 362 | /* EVA without exception */ \ | 362 | /* EVA without exception */ \ |
| @@ -116,7 +116,7 @@ · 115 unmodified lines | |||
| 116 | .if \mode == LEGACY_MODE; \ | 116 | .if \mode == LEGACY_MODE; \ |
| 117 | 9: insn reg, addr; \ | 117 | 9: insn reg, addr; \ |
| 118 | .section __ex_table,"a"; \ | 118 | .section __ex_table,"a"; \ |
| 119 | PTR 9b, handler; \ | 119 | PTR_WD 9b, handler; \ |
| 120 | .previous; \ | 120 | .previous; \ |
| 121 | /* This is assembled in EVA mode */ \ | 121 | /* This is assembled in EVA mode */ \ |
| 122 | .else; \ | 122 | .else; \ |
| @@ -125,7 +125,7 @@ · 2 unmodified lines | |||
| 125 | ((\to == USEROP) && (type == ST_INSN)); \ | 125 | ((\to == USEROP) && (type == ST_INSN)); \ |
| 126 | 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ | 126 | 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ |
| 127 | .section __ex_table,"a"; \ | 127 | .section __ex_table,"a"; \ |
| 128 | PTR 9b, handler; \ | 128 | PTR_WD 9b, handler; \ |
| 129 | .previous; \ | 129 | .previous; \ |
| 130 | .else; \ | 130 | .else; \ |
| 131 | /* \ | 131 | /* \ |
| @@ -52,7 +52,7 @@ · 51 unmodified lines | |||
| 52 | 9: ___BUILD_EVA_INSN(insn, reg, addr); \ | 52 | 9: ___BUILD_EVA_INSN(insn, reg, addr); \ |
| 53 | .endif; \ | 53 | .endif; \ |
| 54 | .section __ex_table,"a"; \ | 54 | .section __ex_table,"a"; \ |
| 55 | PTR 9b, handler; \ | 55 | PTR_WD 9b, handler; \ |
| 56 | .previous | 56 | .previous |
| 57 | 57 | ||
| 58 | .macro f_fill64 dst, offset, val, fixup, mode | 58 | .macro f_fill64 dst, offset, val, fixup, mode |
| @@ -15,7 +15,7 @@ · 14 unmodified lines | |||
| 15 | #define EX(insn,reg,addr,handler) \ | 15 | #define EX(insn,reg,addr,handler) \ |
| 16 | 9: insn reg, addr; \ | 16 | 9: insn reg, addr; \ |
| 17 | .section __ex_table,"a"; \ | 17 | .section __ex_table,"a"; \ |
| 18 | PTR 9b, handler; \ | 18 | PTR_WD 9b, handler; \ |
| 19 | .previous | 19 | .previous |
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| @@ -59,7 +59,7 @@ LEAF(__strncpy_from_user_asm) · 37 unmodified lines | |||
| 59 | jr ra | 59 | jr ra |
| 60 | 60 | ||
| 61 | .section __ex_table,"a" | 61 | .section __ex_table,"a" |
| 62 | PTR 1b, .Lfault | 62 | PTR_WD 1b, .Lfault |
| 63 | .previous | 63 | .previous |
| 64 | 64 | ||
| 65 | EXPORT_SYMBOL(__strncpy_from_user_asm) | 65 | EXPORT_SYMBOL(__strncpy_from_user_asm) |
| @@ -14,7 +14,7 @@ · 13 unmodified lines | |||
| 14 | #define EX(insn,reg,addr,handler) \ | 14 | #define EX(insn,reg,addr,handler) \ |
| 15 | 9: insn reg, addr; \ | 15 | 9: insn reg, addr; \ |
| 16 | .section __ex_table,"a"; \ | 16 | .section __ex_table,"a"; \ |
| 17 | PTR 9b, handler; \ | 17 | PTR_WD 9b, handler; \ |
| 18 | .previous | 18 | .previous |
| 19 | 19 | ||
| 20 | /* | 20 | /* |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | #include <linux/pci.h> | 3 | #include <linux/pci.h> |
| 4 | #include <loongson.h> | 4 | #include <loongson.h> |
| 5 | 5 | ||
| 6 | static void pci_fixup_radeon(struct pci_dev *pdev) | 6 | static void pci_fixup_video(struct pci_dev *pdev) |
| 7 | { | 7 | { |
| 8 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | 8 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; |
| 9 | 9 | ||
| @@ -22,8 +22,7 @@ static void pci_fixup_radeon(struct pci_dev *pdev) · 12 unmodified lines | |||
| 22 | res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW | | 22 | res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW | |
| 23 | IORESOURCE_PCI_FIXED; | 23 | IORESOURCE_PCI_FIXED; |
| 24 | 24 | ||
| 25 | dev_info(&pdev->dev, "BAR %d: assigned %pR for Radeon ROM\n", | 25 | dev_info(&pdev->dev, "Video device with shadowed ROM at %pR\n", res); |
| 26 | PCI_ROM_RESOURCE, res); | ||
| 27 | } | 26 | } |
| 28 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, 0x9615, | 27 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_ATI, 0x9615, |
| 29 | PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_radeon); | 28 | PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
| @@ -178,6 +178,7 @@ static inline bool pte_user(pte_t pte) · 177 unmodified lines | |||
| 178 | #ifndef __ASSEMBLY__ | 178 | #ifndef __ASSEMBLY__ |
| 179 | 179 | ||
| 180 | int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); | 180 | int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); |
| 181 | void unmap_kernel_page(unsigned long va); | ||
| 181 | 182 | ||
| 182 | #endif /* !__ASSEMBLY__ */ | 183 | #endif /* !__ASSEMBLY__ */ |
| 183 | 184 | ||
| @@ -1082,6 +1082,8 @@ static inline int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t p · 1081 unmodified lines | |||
| 1082 | return hash__map_kernel_page(ea, pa, prot); | 1082 | return hash__map_kernel_page(ea, pa, prot); |
| 1083 | } | 1083 | } |
| 1084 | 1084 | ||
| 1085 | void unmap_kernel_page(unsigned long va); | ||
| 1086 | |||
| 1085 | static inline int __meminit vmemmap_create_mapping(unsigned long start, | 1087 | static inline int __meminit vmemmap_create_mapping(unsigned long start, |
| 1086 | unsigned long page_size, | 1088 | unsigned long page_size, |
| 1087 | unsigned long phys) | 1089 | unsigned long phys) |
| @@ -111,8 +111,10 @@ static inline void __set_fixmap(enum fixed_addresses idx, · 110 unmodified lines | |||
| 111 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses); | 111 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses); |
| 112 | else if (WARN_ON(idx >= __end_of_fixed_addresses)) | 112 | else if (WARN_ON(idx >= __end_of_fixed_addresses)) |
| 113 | return; | 113 | return; |
| 114 | 114 | if (pgprot_val(flags)) | |
| 115 | map_kernel_page(__fix_to_virt(idx), phys, flags); | 115 | map_kernel_page(__fix_to_virt(idx), phys, flags); |
| 116 | else | ||
| 117 | unmap_kernel_page(__fix_to_virt(idx)); | ||
| 116 | } | 118 | } |
| 117 | 119 | ||
| 118 | #define __early_set_fixmap __set_fixmap | 120 | #define __early_set_fixmap __set_fixmap |
| @@ -39,7 +39,6 @@ struct kvm_nested_guest { · 38 unmodified lines | |||
| 39 | pgd_t *shadow_pgtable; /* our page table for this guest */ | 39 | pgd_t *shadow_pgtable; /* our page table for this guest */ |
| 40 | u64 l1_gr_to_hr; /* L1's addr of part'n-scoped table */ | 40 | u64 l1_gr_to_hr; /* L1's addr of part'n-scoped table */ |
| 41 | u64 process_table; /* process table entry for this guest */ | 41 | u64 process_table; /* process table entry for this guest */ |
| 42 | u64 hfscr; /* HFSCR that the L1 requested for this nested guest */ | ||
| 43 | long refcnt; /* number of pointers to this struct */ | 42 | long refcnt; /* number of pointers to this struct */ |
| 44 | struct mutex tlb_lock; /* serialize page faults and tlbies */ | 43 | struct mutex tlb_lock; /* serialize page faults and tlbies */ |
| 45 | struct kvm_nested_guest *next; | 44 | struct kvm_nested_guest *next; |
| @@ -818,6 +818,7 @@ struct kvm_vcpu_arch { · 817 unmodified lines | |||
| 818 | 818 | ||
| 819 | /* For support of nested guests */ | 819 | /* For support of nested guests */ |
| 820 | struct kvm_nested_guest *nested; | 820 | struct kvm_nested_guest *nested; |
| 821 | u64 nested_hfscr; /* HFSCR that the L1 requested for the nested guest */ | ||
| 821 | u32 nested_vcpu_id; | 822 | u32 nested_vcpu_id; |
| 822 | gpa_t nested_io_gpr; | 823 | gpa_t nested_io_gpr; |
| 823 | #endif | 824 | #endif |
| @@ -64,6 +64,7 @@ extern int icache_44x_need_flush; · 63 unmodified lines | |||
| 64 | #ifndef __ASSEMBLY__ | 64 | #ifndef __ASSEMBLY__ |
| 65 | 65 | ||
| 66 | int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); | 66 | int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); |
| 67 | void unmap_kernel_page(unsigned long va); | ||
| 67 | 68 | ||
| 68 | #endif /* !__ASSEMBLY__ */ | 69 | #endif /* !__ASSEMBLY__ */ |
| 69 | 70 | ||
| @@ -308,6 +308,7 @@ static inline void __ptep_set_access_flags(struct vm_area_struct *vma, · 307 unmodified lines | |||
| 308 | #define __swp_entry_to_pte(x) __pte((x).val) | 308 | #define __swp_entry_to_pte(x) __pte((x).val) |
| 309 | 309 | ||
| 310 | int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot); | 310 | int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot); |
| 311 | void unmap_kernel_page(unsigned long va); | ||
| 311 | extern int __meminit vmemmap_create_mapping(unsigned long start, | 312 | extern int __meminit vmemmap_create_mapping(unsigned long start, |
| 312 | unsigned long page_size, | 313 | unsigned long page_size, |
| 313 | unsigned long phys); | 314 | unsigned long phys); |
| @@ -649,8 +649,9 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt) · 648 unmodified lines | |||
| 649 | __this_cpu_inc(irq_stat.timer_irqs_event); | 649 | __this_cpu_inc(irq_stat.timer_irqs_event); |
| 650 | } else { | 650 | } else { |
| 651 | now = *next_tb - now; | 651 | now = *next_tb - now; |
| 652 | if (now <= decrementer_max) | 652 | if (now > decrementer_max) |
| 653 | set_dec_or_work(now); | 653 | now = decrementer_max; |
| 654 | set_dec_or_work(now); | ||
| 654 | __this_cpu_inc(irq_stat.timer_irqs_others); | 655 | __this_cpu_inc(irq_stat.timer_irqs_others); |
| 655 | } | 656 | } |
| 656 | 657 | ||
| @@ -1816,7 +1816,6 @@ static int kvmppc_handle_exit_hv(struct kvm_vcpu *vcpu, · 1815 unmodified lines | |||
| 1816 | 1816 | ||
| 1817 | static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu) | 1817 | static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu) |
| 1818 | { | 1818 | { |
| 1819 | struct kvm_nested_guest *nested = vcpu->arch.nested; | ||
| 1820 | int r; | 1819 | int r; |
| 1821 | int srcu_idx; | 1820 | int srcu_idx; |
| 1822 | 1821 | ||
| @@ -1922,7 +1921,7 @@ static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu) · 99 unmodified lines | |||
| 1922 | * it into a HEAI. | 1921 | * it into a HEAI. |
| 1923 | */ | 1922 | */ |
| 1924 | if (!(vcpu->arch.hfscr_permitted & (1UL << cause)) || | 1923 | if (!(vcpu->arch.hfscr_permitted & (1UL << cause)) || |
| 1925 | (nested->hfscr & (1UL << cause))) { | 1924 | (vcpu->arch.nested_hfscr & (1UL << cause))) { |
| 1926 | vcpu->arch.trap = BOOK3S_INTERRUPT_H_EMUL_ASSIST; | 1925 | vcpu->arch.trap = BOOK3S_INTERRUPT_H_EMUL_ASSIST; |
| 1927 | 1926 | ||
| 1928 | /* | 1927 | /* |
| @@ -363,7 +363,7 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu) · 362 unmodified lines | |||
| 363 | /* set L1 state to L2 state */ | 363 | /* set L1 state to L2 state */ |
| 364 | vcpu->arch.nested = l2; | 364 | vcpu->arch.nested = l2; |
| 365 | vcpu->arch.nested_vcpu_id = l2_hv.vcpu_token; | 365 | vcpu->arch.nested_vcpu_id = l2_hv.vcpu_token; |
| 366 | l2->hfscr = l2_hv.hfscr; | 366 | vcpu->arch.nested_hfscr = l2_hv.hfscr; |
| 367 | vcpu->arch.regs = l2_regs; | 367 | vcpu->arch.regs = l2_regs; |
| 368 | 368 | ||
| 369 | /* Guest must always run with ME enabled, HV disabled. */ | 369 | /* Guest must always run with ME enabled, HV disabled. */ |
| @@ -206,6 +206,15 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, · 205 unmodified lines | |||
| 206 | __set_pte_at(mm, addr, ptep, pte, 0); | 206 | __set_pte_at(mm, addr, ptep, pte, 0); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | void unmap_kernel_page(unsigned long va) | ||
| 210 | { | ||
| 211 | pmd_t *pmdp = pmd_off_k(va); | ||
| 212 | pte_t *ptep = pte_offset_kernel(pmdp, va); | ||
| 213 | |||
| 214 | pte_clear(&init_mm, va, ptep); | ||
| 215 | flush_tlb_kernel_range(va, va + PAGE_SIZE); | ||
| 216 | } | ||
| 217 | |||
| 209 | /* | 218 | /* |
| 210 | * This is called when relaxing access to a PTE. It's also called in the page | 219 | * This is called when relaxing access to a PTE. It's also called in the page |
| 211 | * fault path when we don't hit any of the major fault cases, ie, a minor | 220 | * fault path when we don't hit any of the major fault cases, ie, a minor |
| @@ -1355,9 +1355,20 @@ static void power_pmu_disable(struct pmu *pmu) · 1354 unmodified lines | |||
| 1355 | * Otherwise provide a warning if there is PMI pending, but | 1355 | * Otherwise provide a warning if there is PMI pending, but |
| 1356 | * no counter is found overflown. | 1356 | * no counter is found overflown. |
| 1357 | */ | 1357 | */ |
| 1358 | if (any_pmc_overflown(cpuhw)) | 1358 | if (any_pmc_overflown(cpuhw)) { |
| 1359 | clear_pmi_irq_pending(); | 1359 | /* |
| 1360 | else | 1360 | * Since power_pmu_disable runs under local_irq_save, it |
| 1361 | * could happen that code hits a PMC overflow without PMI | ||
| 1362 | * pending in paca. Hence only clear PMI pending if it was | ||
| 1363 | * set. | ||
| 1364 | * | ||
| 1365 | * If a PMI is pending, then MSR[EE] must be disabled (because | ||
| 1366 | * the masked PMI handler disabling EE). So it is safe to | ||
| 1367 | * call clear_pmi_irq_pending(). | ||
| 1368 | */ | ||
| 1369 | if (pmi_irq_pending()) | ||
| 1370 | clear_pmi_irq_pending(); | ||
| 1371 | } else | ||
| 1361 | WARN_ON(pmi_irq_pending()); | 1372 | WARN_ON(pmi_irq_pending()); |
| 1362 | 1373 | ||
| 1363 | val = mmcra = cpuhw->mmcr.mmcra; | 1374 | val = mmcra = cpuhw->mmcr.mmcra; |
| @@ -945,6 +945,9 @@ config S390_GUEST · 944 unmodified lines | |||
| 945 | 945 | ||
| 946 | endmenu | 946 | endmenu |
| 947 | 947 | ||
| 948 | config S390_MODULES_SANITY_TEST_HELPERS | ||
| 949 | def_bool n | ||
| 950 | |||
| 948 | menu "Selftests" | 951 | menu "Selftests" |
| 949 | 952 | ||
| 950 | config S390_UNWIND_SELFTEST | 953 | config S390_UNWIND_SELFTEST |
| @@ -971,4 +974,16 @@ config S390_KPROBES_SANITY_TEST · 20 unmodified lines | |||
| 971 | 974 | ||
| 972 | Say N if you are unsure. | 975 | Say N if you are unsure. |
| 973 | 976 | ||
| 977 | config S390_MODULES_SANITY_TEST | ||
| 978 | def_tristate n | ||
| 979 | depends on KUNIT | ||
| 980 | default KUNIT_ALL_TESTS | ||
| 981 | prompt "Enable s390 specific modules tests" | ||
| 982 | select S390_MODULES_SANITY_TEST_HELPERS | ||
| 983 | help | ||
| 984 | This option enables an s390 specific modules test. This option is | ||
| 985 | not useful for distributions or general kernels, but only for | ||
| 986 | kernel developers working on architecture code. | ||
| 987 | |||
| 988 | Say N if you are unsure. | ||
| 974 | endmenu | 989 | endmenu |
| @@ -63,6 +63,7 @@ CONFIG_APPLDATA_BASE=y · 62 unmodified lines | |||
| 63 | CONFIG_KVM=m | 63 | CONFIG_KVM=m |
| 64 | CONFIG_S390_UNWIND_SELFTEST=m | 64 | CONFIG_S390_UNWIND_SELFTEST=m |
| 65 | CONFIG_S390_KPROBES_SANITY_TEST=m | 65 | CONFIG_S390_KPROBES_SANITY_TEST=m |
| 66 | CONFIG_S390_MODULES_SANITY_TEST=m | ||
| 66 | CONFIG_KPROBES=y | 67 | CONFIG_KPROBES=y |
| 67 | CONFIG_JUMP_LABEL=y | 68 | CONFIG_JUMP_LABEL=y |
| 68 | CONFIG_STATIC_KEYS_SELFTEST=y | 69 | CONFIG_STATIC_KEYS_SELFTEST=y |
| @@ -96,7 +97,6 @@ CONFIG_MEMORY_HOTPLUG=y · 27 unmodified lines | |||
| 96 | CONFIG_MEMORY_HOTREMOVE=y | 97 | CONFIG_MEMORY_HOTREMOVE=y |
| 97 | CONFIG_KSM=y | 98 | CONFIG_KSM=y |
| 98 | CONFIG_TRANSPARENT_HUGEPAGE=y | 99 | CONFIG_TRANSPARENT_HUGEPAGE=y |
| 99 | CONFIG_FRONTSWAP=y | ||
| 100 | CONFIG_CMA_DEBUG=y | 100 | CONFIG_CMA_DEBUG=y |
| 101 | CONFIG_CMA_DEBUGFS=y | 101 | CONFIG_CMA_DEBUGFS=y |
| 102 | CONFIG_CMA_SYSFS=y | 102 | CONFIG_CMA_SYSFS=y |
| @@ -109,6 +109,7 @@ CONFIG_DEFERRED_STRUCT_PAGE_INIT=y · 6 unmodified lines | |||
| 109 | CONFIG_IDLE_PAGE_TRACKING=y | 109 | CONFIG_IDLE_PAGE_TRACKING=y |
| 110 | CONFIG_PERCPU_STATS=y | 110 | CONFIG_PERCPU_STATS=y |
| 111 | CONFIG_GUP_TEST=y | 111 | CONFIG_GUP_TEST=y |
| 112 | CONFIG_ANON_VMA_NAME=y | ||
| 112 | CONFIG_NET=y | 113 | CONFIG_NET=y |
| 113 | CONFIG_PACKET=y | 114 | CONFIG_PACKET=y |
| 114 | CONFIG_PACKET_DIAG=m | 115 | CONFIG_PACKET_DIAG=m |
| @@ -116,7 +117,6 @@ CONFIG_UNIX=y · 1 unmodified line | |||
| 116 | CONFIG_UNIX_DIAG=m | 117 | CONFIG_UNIX_DIAG=m |
| 117 | CONFIG_XFRM_USER=m | 118 | CONFIG_XFRM_USER=m |
| 118 | CONFIG_NET_KEY=m | 119 | CONFIG_NET_KEY=m |
| 119 | CONFIG_NET_SWITCHDEV=y | ||
| 120 | CONFIG_SMC=m | 120 | CONFIG_SMC=m |
| 121 | CONFIG_SMC_DIAG=m | 121 | CONFIG_SMC_DIAG=m |
| 122 | CONFIG_INET=y | 122 | CONFIG_INET=y |
| @@ -185,7 +185,6 @@ CONFIG_NF_CT_NETLINK_TIMEOUT=m · 62 unmodified lines | |||
| 185 | CONFIG_NF_TABLES=m | 185 | CONFIG_NF_TABLES=m |
| 186 | CONFIG_NF_TABLES_INET=y | 186 | CONFIG_NF_TABLES_INET=y |
| 187 | CONFIG_NFT_CT=m | 187 | CONFIG_NFT_CT=m |
| 188 | CONFIG_NFT_COUNTER=m | ||
| 189 | CONFIG_NFT_LOG=m | 188 | CONFIG_NFT_LOG=m |
| 190 | CONFIG_NFT_LIMIT=m | 189 | CONFIG_NFT_LIMIT=m |
| 191 | CONFIG_NFT_NAT=m | 190 | CONFIG_NFT_NAT=m |
| @@ -391,6 +390,7 @@ CONFIG_OPENVSWITCH=m · 199 unmodified lines | |||
| 391 | CONFIG_VSOCKETS=m | 390 | CONFIG_VSOCKETS=m |
| 392 | CONFIG_VIRTIO_VSOCKETS=m | 391 | CONFIG_VIRTIO_VSOCKETS=m |
| 393 | CONFIG_NETLINK_DIAG=m | 392 | CONFIG_NETLINK_DIAG=m |
| 393 | CONFIG_NET_SWITCHDEV=y | ||
| 394 | CONFIG_CGROUP_NET_PRIO=y | 394 | CONFIG_CGROUP_NET_PRIO=y |
| 395 | CONFIG_NET_PKTGEN=m | 395 | CONFIG_NET_PKTGEN=m |
| 396 | CONFIG_PCI=y | 396 | CONFIG_PCI=y |
| @@ -400,6 +400,7 @@ CONFIG_PCI_IOV=y · 3 unmodified lines | |||
| 400 | CONFIG_HOTPLUG_PCI=y | 400 | CONFIG_HOTPLUG_PCI=y |
| 401 | CONFIG_HOTPLUG_PCI_S390=y | 401 | CONFIG_HOTPLUG_PCI_S390=y |
| 402 | CONFIG_DEVTMPFS=y | 402 | CONFIG_DEVTMPFS=y |
| 403 | CONFIG_DEVTMPFS_SAFE=y | ||
| 403 | CONFIG_CONNECTOR=y | 404 | CONFIG_CONNECTOR=y |
| 404 | CONFIG_ZRAM=y | 405 | CONFIG_ZRAM=y |
| 405 | CONFIG_BLK_DEV_LOOP=m | 406 | CONFIG_BLK_DEV_LOOP=m |
| @@ -501,6 +502,7 @@ CONFIG_NLMON=m · 95 unmodified lines | |||
| 501 | # CONFIG_NET_VENDOR_DEC is not set | 502 | # CONFIG_NET_VENDOR_DEC is not set |
| 502 | # CONFIG_NET_VENDOR_DLINK is not set | 503 | # CONFIG_NET_VENDOR_DLINK is not set |
| 503 | # CONFIG_NET_VENDOR_EMULEX is not set | 504 | # CONFIG_NET_VENDOR_EMULEX is not set |
| 505 | # CONFIG_NET_VENDOR_ENGLEDER is not set | ||
| 504 | # CONFIG_NET_VENDOR_EZCHIP is not set | 506 | # CONFIG_NET_VENDOR_EZCHIP is not set |
| 505 | # CONFIG_NET_VENDOR_GOOGLE is not set | 507 | # CONFIG_NET_VENDOR_GOOGLE is not set |
| 506 | # CONFIG_NET_VENDOR_HUAWEI is not set | 508 | # CONFIG_NET_VENDOR_HUAWEI is not set |
| @@ -511,7 +513,6 @@ CONFIG_NLMON=m · 4 unmodified lines | |||
| 511 | CONFIG_MLX4_EN=m | 513 | CONFIG_MLX4_EN=m |
| 512 | CONFIG_MLX5_CORE=m | 514 | CONFIG_MLX5_CORE=m |
| 513 | CONFIG_MLX5_CORE_EN=y | 515 | CONFIG_MLX5_CORE_EN=y |
| 514 | CONFIG_MLX5_ESWITCH=y | ||
| 515 | # CONFIG_NET_VENDOR_MICREL is not set | 516 | # CONFIG_NET_VENDOR_MICREL is not set |
| 516 | # CONFIG_NET_VENDOR_MICROCHIP is not set | 517 | # CONFIG_NET_VENDOR_MICROCHIP is not set |
| 517 | # CONFIG_NET_VENDOR_MICROSEMI is not set | 518 | # CONFIG_NET_VENDOR_MICROSEMI is not set |
| @@ -542,6 +543,7 @@ CONFIG_MLX5_ESWITCH=y · 24 unmodified lines | |||
| 542 | # CONFIG_NET_VENDOR_SYNOPSYS is not set | 543 | # CONFIG_NET_VENDOR_SYNOPSYS is not set |
| 543 | # CONFIG_NET_VENDOR_TEHUTI is not set | 544 | # CONFIG_NET_VENDOR_TEHUTI is not set |
| 544 | # CONFIG_NET_VENDOR_TI is not set | 545 | # CONFIG_NET_VENDOR_TI is not set |
| 546 | # CONFIG_NET_VENDOR_VERTEXCOM is not set | ||
| 545 | # CONFIG_NET_VENDOR_VIA is not set | 547 | # CONFIG_NET_VENDOR_VIA is not set |
| 546 | # CONFIG_NET_VENDOR_WIZNET is not set | 548 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 547 | # CONFIG_NET_VENDOR_XILINX is not set | 549 | # CONFIG_NET_VENDOR_XILINX is not set |
| @@ -592,6 +594,7 @@ CONFIG_VIRTIO_BALLOON=m · 44 unmodified lines | |||
| 592 | CONFIG_VIRTIO_INPUT=y | 594 | CONFIG_VIRTIO_INPUT=y |
| 593 | CONFIG_VHOST_NET=m | 595 | CONFIG_VHOST_NET=m |
| 594 | CONFIG_VHOST_VSOCK=m | 596 | CONFIG_VHOST_VSOCK=m |
| 597 | # CONFIG_SURFACE_PLATFORMS is not set | ||
| 595 | CONFIG_S390_CCW_IOMMU=y | 598 | CONFIG_S390_CCW_IOMMU=y |
| 596 | CONFIG_S390_AP_IOMMU=y | 599 | CONFIG_S390_AP_IOMMU=y |
| 597 | CONFIG_EXT4_FS=y | 600 | CONFIG_EXT4_FS=y |
| @@ -756,9 +759,6 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 158 unmodified lines | |||
| 756 | CONFIG_CRYPTO_USER_API_RNG=m | 759 | CONFIG_CRYPTO_USER_API_RNG=m |
| 757 | CONFIG_CRYPTO_USER_API_AEAD=m | 760 | CONFIG_CRYPTO_USER_API_AEAD=m |
| 758 | CONFIG_CRYPTO_STATS=y | 761 | CONFIG_CRYPTO_STATS=y |
| 759 | CONFIG_CRYPTO_LIB_BLAKE2S=m | ||
| 760 | CONFIG_CRYPTO_LIB_CURVE25519=m | ||
| 761 | CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m | ||
| 762 | CONFIG_ZCRYPT=m | 762 | CONFIG_ZCRYPT=m |
| 763 | CONFIG_PKEY=m | 763 | CONFIG_PKEY=m |
| 764 | CONFIG_CRYPTO_PAES_S390=m | 764 | CONFIG_CRYPTO_PAES_S390=m |
| @@ -774,6 +774,8 @@ CONFIG_CRYPTO_GHASH_S390=m · 9 unmodified lines | |||
| 774 | CONFIG_CRYPTO_CRC32_S390=y | 774 | CONFIG_CRYPTO_CRC32_S390=y |
| 775 | CONFIG_CRYPTO_DEV_VIRTIO=m | 775 | CONFIG_CRYPTO_DEV_VIRTIO=m |
| 776 | CONFIG_CORDIC=m | 776 | CONFIG_CORDIC=m |
| 777 | CONFIG_CRYPTO_LIB_CURVE25519=m | ||
| 778 | CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m | ||
| 777 | CONFIG_CRC32_SELFTEST=y | 779 | CONFIG_CRC32_SELFTEST=y |
| 778 | CONFIG_CRC4=m | 780 | CONFIG_CRC4=m |
| 779 | CONFIG_CRC7=m | 781 | CONFIG_CRC7=m |
| @@ -807,7 +809,6 @@ CONFIG_SLUB_DEBUG_ON=y · 27 unmodified lines | |||
| 807 | CONFIG_SLUB_STATS=y | 809 | CONFIG_SLUB_STATS=y |
| 808 | CONFIG_DEBUG_STACK_USAGE=y | 810 | CONFIG_DEBUG_STACK_USAGE=y |
| 809 | CONFIG_DEBUG_VM=y | 811 | CONFIG_DEBUG_VM=y |
| 810 | CONFIG_DEBUG_VM_VMACACHE=y | ||
| 811 | CONFIG_DEBUG_VM_PGFLAGS=y | 812 | CONFIG_DEBUG_VM_PGFLAGS=y |
| 812 | CONFIG_DEBUG_MEMORY_INIT=y | 813 | CONFIG_DEBUG_MEMORY_INIT=y |
| 813 | CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m | 814 | CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m |
| @@ -819,12 +820,11 @@ CONFIG_PANIC_ON_OOPS=y · 5 unmodified lines | |||
| 819 | CONFIG_DETECT_HUNG_TASK=y | 820 | CONFIG_DETECT_HUNG_TASK=y |
| 820 | CONFIG_WQ_WATCHDOG=y | 821 | CONFIG_WQ_WATCHDOG=y |
| 821 | CONFIG_TEST_LOCKUP=m | 822 | CONFIG_TEST_LOCKUP=m |
| 822 | CONFIG_DEBUG_TIMEKEEPING=y | ||
| 823 | CONFIG_PROVE_LOCKING=y | 823 | CONFIG_PROVE_LOCKING=y |
| 824 | CONFIG_LOCK_STAT=y | 824 | CONFIG_LOCK_STAT=y |
| 825 | CONFIG_DEBUG_LOCKDEP=y | ||
| 826 | CONFIG_DEBUG_ATOMIC_SLEEP=y | 825 | CONFIG_DEBUG_ATOMIC_SLEEP=y |
| 827 | CONFIG_DEBUG_LOCKING_API_SELFTESTS=y | 826 | CONFIG_DEBUG_LOCKING_API_SELFTESTS=y |
| 827 | CONFIG_DEBUG_IRQFLAGS=y | ||
| 828 | CONFIG_DEBUG_SG=y | 828 | CONFIG_DEBUG_SG=y |
| 829 | CONFIG_DEBUG_NOTIFIERS=y | 829 | CONFIG_DEBUG_NOTIFIERS=y |
| 830 | CONFIG_BUG_ON_DATA_CORRUPTION=y | 830 | CONFIG_BUG_ON_DATA_CORRUPTION=y |
| @@ -61,6 +61,7 @@ CONFIG_APPLDATA_BASE=y · 60 unmodified lines | |||
| 61 | CONFIG_KVM=m | 61 | CONFIG_KVM=m |
| 62 | CONFIG_S390_UNWIND_SELFTEST=m | 62 | CONFIG_S390_UNWIND_SELFTEST=m |
| 63 | CONFIG_S390_KPROBES_SANITY_TEST=m | 63 | CONFIG_S390_KPROBES_SANITY_TEST=m |
| 64 | CONFIG_S390_MODULES_SANITY_TEST=m | ||
| 64 | CONFIG_KPROBES=y | 65 | CONFIG_KPROBES=y |
| 65 | CONFIG_JUMP_LABEL=y | 66 | CONFIG_JUMP_LABEL=y |
| 66 | # CONFIG_GCC_PLUGINS is not set | 67 | # CONFIG_GCC_PLUGINS is not set |
| @@ -91,7 +92,6 @@ CONFIG_MEMORY_HOTPLUG=y · 24 unmodified lines | |||
| 91 | CONFIG_MEMORY_HOTREMOVE=y | 92 | CONFIG_MEMORY_HOTREMOVE=y |
| 92 | CONFIG_KSM=y | 93 | CONFIG_KSM=y |
| 93 | CONFIG_TRANSPARENT_HUGEPAGE=y | 94 | CONFIG_TRANSPARENT_HUGEPAGE=y |
| 94 | CONFIG_FRONTSWAP=y | ||
| 95 | CONFIG_CMA_SYSFS=y | 95 | CONFIG_CMA_SYSFS=y |
| 96 | CONFIG_CMA_AREAS=7 | 96 | CONFIG_CMA_AREAS=7 |
| 97 | CONFIG_MEM_SOFT_DIRTY=y | 97 | CONFIG_MEM_SOFT_DIRTY=y |
| @@ -101,6 +101,7 @@ CONFIG_ZSMALLOC_STAT=y · 3 unmodified lines | |||
| 101 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y | 101 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y |
| 102 | CONFIG_IDLE_PAGE_TRACKING=y | 102 | CONFIG_IDLE_PAGE_TRACKING=y |
| 103 | CONFIG_PERCPU_STATS=y | 103 | CONFIG_PERCPU_STATS=y |
| 104 | CONFIG_ANON_VMA_NAME=y | ||
| 104 | CONFIG_NET=y | 105 | CONFIG_NET=y |
| 105 | CONFIG_PACKET=y | 106 | CONFIG_PACKET=y |
| 106 | CONFIG_PACKET_DIAG=m | 107 | CONFIG_PACKET_DIAG=m |
| @@ -108,7 +109,6 @@ CONFIG_UNIX=y · 1 unmodified line | |||
| 108 | CONFIG_UNIX_DIAG=m | 109 | CONFIG_UNIX_DIAG=m |
| 109 | CONFIG_XFRM_USER=m | 110 | CONFIG_XFRM_USER=m |
| 110 | CONFIG_NET_KEY=m | 111 | CONFIG_NET_KEY=m |
| 111 | CONFIG_NET_SWITCHDEV=y | ||
| 112 | CONFIG_SMC=m | 112 | CONFIG_SMC=m |
| 113 | CONFIG_SMC_DIAG=m | 113 | CONFIG_SMC_DIAG=m |
| 114 | CONFIG_INET=y | 114 | CONFIG_INET=y |
| @@ -177,7 +177,6 @@ CONFIG_NF_CT_NETLINK_TIMEOUT=m · 62 unmodified lines | |||
| 177 | CONFIG_NF_TABLES=m | 177 | CONFIG_NF_TABLES=m |
| 178 | CONFIG_NF_TABLES_INET=y | 178 | CONFIG_NF_TABLES_INET=y |
| 179 | CONFIG_NFT_CT=m | 179 | CONFIG_NFT_CT=m |
| 180 | CONFIG_NFT_COUNTER=m | ||
| 181 | CONFIG_NFT_LOG=m | 180 | CONFIG_NFT_LOG=m |
| 182 | CONFIG_NFT_LIMIT=m | 181 | CONFIG_NFT_LIMIT=m |
| 183 | CONFIG_NFT_NAT=m | 182 | CONFIG_NFT_NAT=m |
| @@ -382,6 +381,7 @@ CONFIG_OPENVSWITCH=m · 198 unmodified lines | |||
| 382 | CONFIG_VSOCKETS=m | 381 | CONFIG_VSOCKETS=m |
| 383 | CONFIG_VIRTIO_VSOCKETS=m | 382 | CONFIG_VIRTIO_VSOCKETS=m |
| 384 | CONFIG_NETLINK_DIAG=m | 383 | CONFIG_NETLINK_DIAG=m |
| 384 | CONFIG_NET_SWITCHDEV=y | ||
| 385 | CONFIG_CGROUP_NET_PRIO=y | 385 | CONFIG_CGROUP_NET_PRIO=y |
| 386 | CONFIG_NET_PKTGEN=m | 386 | CONFIG_NET_PKTGEN=m |
| 387 | CONFIG_PCI=y | 387 | CONFIG_PCI=y |
| @@ -391,6 +391,7 @@ CONFIG_HOTPLUG_PCI=y · 3 unmodified lines | |||
| 391 | CONFIG_HOTPLUG_PCI_S390=y | 391 | CONFIG_HOTPLUG_PCI_S390=y |
| 392 | CONFIG_UEVENT_HELPER=y | 392 | CONFIG_UEVENT_HELPER=y |
| 393 | CONFIG_DEVTMPFS=y | 393 | CONFIG_DEVTMPFS=y |
| 394 | CONFIG_DEVTMPFS_SAFE=y | ||
| 394 | CONFIG_CONNECTOR=y | 395 | CONFIG_CONNECTOR=y |
| 395 | CONFIG_ZRAM=y | 396 | CONFIG_ZRAM=y |
| 396 | CONFIG_BLK_DEV_LOOP=m | 397 | CONFIG_BLK_DEV_LOOP=m |
| @@ -492,6 +493,7 @@ CONFIG_NLMON=m · 95 unmodified lines | |||
| 492 | # CONFIG_NET_VENDOR_DEC is not set | 493 | # CONFIG_NET_VENDOR_DEC is not set |
| 493 | # CONFIG_NET_VENDOR_DLINK is not set | 494 | # CONFIG_NET_VENDOR_DLINK is not set |
| 494 | # CONFIG_NET_VENDOR_EMULEX is not set | 495 | # CONFIG_NET_VENDOR_EMULEX is not set |
| 496 | # CONFIG_NET_VENDOR_ENGLEDER is not set | ||
| 495 | # CONFIG_NET_VENDOR_EZCHIP is not set | 497 | # CONFIG_NET_VENDOR_EZCHIP is not set |
| 496 | # CONFIG_NET_VENDOR_GOOGLE is not set | 498 | # CONFIG_NET_VENDOR_GOOGLE is not set |
| 497 | # CONFIG_NET_VENDOR_HUAWEI is not set | 499 | # CONFIG_NET_VENDOR_HUAWEI is not set |
| @@ -502,7 +504,6 @@ CONFIG_NLMON=m · 4 unmodified lines | |||
| 502 | CONFIG_MLX4_EN=m | 504 | CONFIG_MLX4_EN=m |
| 503 | CONFIG_MLX5_CORE=m | 505 | CONFIG_MLX5_CORE=m |
| 504 | CONFIG_MLX5_CORE_EN=y | 506 | CONFIG_MLX5_CORE_EN=y |
| 505 | CONFIG_MLX5_ESWITCH=y | ||
| 506 | # CONFIG_NET_VENDOR_MICREL is not set | 507 | # CONFIG_NET_VENDOR_MICREL is not set |
| 507 | # CONFIG_NET_VENDOR_MICROCHIP is not set | 508 | # CONFIG_NET_VENDOR_MICROCHIP is not set |
| 508 | # CONFIG_NET_VENDOR_MICROSEMI is not set | 509 | # CONFIG_NET_VENDOR_MICROSEMI is not set |
| @@ -533,6 +534,7 @@ CONFIG_MLX5_ESWITCH=y · 24 unmodified lines | |||
| 533 | # CONFIG_NET_VENDOR_SYNOPSYS is not set | 534 | # CONFIG_NET_VENDOR_SYNOPSYS is not set |
| 534 | # CONFIG_NET_VENDOR_TEHUTI is not set | 535 | # CONFIG_NET_VENDOR_TEHUTI is not set |
| 535 | # CONFIG_NET_VENDOR_TI is not set | 536 | # CONFIG_NET_VENDOR_TI is not set |
| 537 | # CONFIG_NET_VENDOR_VERTEXCOM is not set | ||
| 536 | # CONFIG_NET_VENDOR_VIA is not set | 538 | # CONFIG_NET_VENDOR_VIA is not set |
| 537 | # CONFIG_NET_VENDOR_WIZNET is not set | 539 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 538 | # CONFIG_NET_VENDOR_XILINX is not set | 540 | # CONFIG_NET_VENDOR_XILINX is not set |
| @@ -582,6 +584,7 @@ CONFIG_VIRTIO_BALLOON=m · 43 unmodified lines | |||
| 582 | CONFIG_VIRTIO_INPUT=y | 584 | CONFIG_VIRTIO_INPUT=y |
| 583 | CONFIG_VHOST_NET=m | 585 | CONFIG_VHOST_NET=m |
| 584 | CONFIG_VHOST_VSOCK=m | 586 | CONFIG_VHOST_VSOCK=m |
| 587 | # CONFIG_SURFACE_PLATFORMS is not set | ||
| 585 | CONFIG_S390_CCW_IOMMU=y | 588 | CONFIG_S390_CCW_IOMMU=y |
| 586 | CONFIG_S390_AP_IOMMU=y | 589 | CONFIG_S390_AP_IOMMU=y |
| 587 | CONFIG_EXT4_FS=y | 590 | CONFIG_EXT4_FS=y |
| @@ -743,9 +746,6 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 155 unmodified lines | |||
| 743 | CONFIG_CRYPTO_USER_API_RNG=m | 746 | CONFIG_CRYPTO_USER_API_RNG=m |
| 744 | CONFIG_CRYPTO_USER_API_AEAD=m | 747 | CONFIG_CRYPTO_USER_API_AEAD=m |
| 745 | CONFIG_CRYPTO_STATS=y | 748 | CONFIG_CRYPTO_STATS=y |
| 746 | CONFIG_CRYPTO_LIB_BLAKE2S=m | ||
| 747 | CONFIG_CRYPTO_LIB_CURVE25519=m | ||
| 748 | CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m | ||
| 749 | CONFIG_ZCRYPT=m | 749 | CONFIG_ZCRYPT=m |
| 750 | CONFIG_PKEY=m | 750 | CONFIG_PKEY=m |
| 751 | CONFIG_CRYPTO_PAES_S390=m | 751 | CONFIG_CRYPTO_PAES_S390=m |
| @@ -762,6 +762,8 @@ CONFIG_CRYPTO_CRC32_S390=y · 10 unmodified lines | |||
| 762 | CONFIG_CRYPTO_DEV_VIRTIO=m | 762 | CONFIG_CRYPTO_DEV_VIRTIO=m |
| 763 | CONFIG_CORDIC=m | 763 | CONFIG_CORDIC=m |
| 764 | CONFIG_PRIME_NUMBERS=m | 764 | CONFIG_PRIME_NUMBERS=m |
| 765 | CONFIG_CRYPTO_LIB_CURVE25519=m | ||
| 766 | CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m | ||
| 765 | CONFIG_CRC4=m | 767 | CONFIG_CRC4=m |
| 766 | CONFIG_CRC7=m | 768 | CONFIG_CRC7=m |
| 767 | CONFIG_CRC8=m | 769 | CONFIG_CRC8=m |
| @@ -1,6 +1,7 @@ | |||
| 1 | # CONFIG_SWAP is not set | 1 | # CONFIG_SWAP is not set |
| 2 | CONFIG_NO_HZ_IDLE=y | 2 | CONFIG_NO_HZ_IDLE=y |
| 3 | CONFIG_HIGH_RES_TIMERS=y | 3 | CONFIG_HIGH_RES_TIMERS=y |
| 4 | CONFIG_BPF_SYSCALL=y | ||
| 4 | # CONFIG_CPU_ISOLATION is not set | 5 | # CONFIG_CPU_ISOLATION is not set |
| 5 | # CONFIG_UTS_NS is not set | 6 | # CONFIG_UTS_NS is not set |
| 6 | # CONFIG_TIME_NS is not set | 7 | # CONFIG_TIME_NS is not set |
| @@ -34,6 +35,7 @@ CONFIG_NET=y · 27 unmodified lines | |||
| 34 | # CONFIG_PCPU_DEV_REFCNT is not set | 35 | # CONFIG_PCPU_DEV_REFCNT is not set |
| 35 | # CONFIG_ETHTOOL_NETLINK is not set | 36 | # CONFIG_ETHTOOL_NETLINK is not set |
| 36 | CONFIG_DEVTMPFS=y | 37 | CONFIG_DEVTMPFS=y |
| 38 | CONFIG_DEVTMPFS_SAFE=y | ||
| 37 | CONFIG_BLK_DEV_RAM=y | 39 | CONFIG_BLK_DEV_RAM=y |
| 38 | # CONFIG_DCSSBLK is not set | 40 | # CONFIG_DCSSBLK is not set |
| 39 | # CONFIG_DASD is not set | 41 | # CONFIG_DASD is not set |
| @@ -58,6 +60,7 @@ CONFIG_ZFCP=y · 18 unmodified lines | |||
| 58 | # CONFIG_HID is not set | 60 | # CONFIG_HID is not set |
| 59 | # CONFIG_VIRTIO_MENU is not set | 61 | # CONFIG_VIRTIO_MENU is not set |
| 60 | # CONFIG_VHOST_MENU is not set | 62 | # CONFIG_VHOST_MENU is not set |
| 63 | # CONFIG_SURFACE_PLATFORMS is not set | ||
| 61 | # CONFIG_IOMMU_SUPPORT is not set | 64 | # CONFIG_IOMMU_SUPPORT is not set |
| 62 | # CONFIG_DNOTIFY is not set | 65 | # CONFIG_DNOTIFY is not set |
| 63 | # CONFIG_INOTIFY_USER is not set | 66 | # CONFIG_INOTIFY_USER is not set |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | static char local_guest[] = " "; | 21 | static char local_guest[] = " "; |
| 22 | static char all_guests[] = "* "; | 22 | static char all_guests[] = "* "; |
| 23 | static char *all_groups = all_guests; | ||
| 23 | static char *guest_query; | 24 | static char *guest_query; |
| 24 | 25 | ||
| 25 | struct diag2fc_data { | 26 | struct diag2fc_data { |
| @@ -62,10 +63,11 @@ static int diag2fc(int size, char* query, void *addr) · 36 unmodified lines | |||
| 62 | 63 | ||
| 63 | memcpy(parm_list.userid, query, NAME_LEN); | 64 | memcpy(parm_list.userid, query, NAME_LEN); |
| 64 | ASCEBC(parm_list.userid, NAME_LEN); | 65 | ASCEBC(parm_list.userid, NAME_LEN); |
| 65 | parm_list.addr = (unsigned long) addr ; | 66 | memcpy(parm_list.aci_grp, all_groups, NAME_LEN); |
| 67 | ASCEBC(parm_list.aci_grp, NAME_LEN); | ||
| 68 | parm_list.addr = (unsigned long)addr; | ||
| 66 | parm_list.size = size; | 69 | parm_list.size = size; |
| 67 | parm_list.fmt = 0x02; | 70 | parm_list.fmt = 0x02; |
| 68 | memset(parm_list.aci_grp, 0x40, NAME_LEN); | ||
| 69 | rc = -1; | 71 | rc = -1; |
| 70 | 72 | ||
| 71 | diag_stat_inc(DIAG_STAT_X2FC); | 73 | diag_stat_inc(DIAG_STAT_X2FC); |
| @@ -47,8 +47,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n); · 46 unmodified lines | |||
| 47 | int __put_user_bad(void) __attribute__((noreturn)); | 47 | int __put_user_bad(void) __attribute__((noreturn)); |
| 48 | int __get_user_bad(void) __attribute__((noreturn)); | 48 | int __get_user_bad(void) __attribute__((noreturn)); |
| 49 | 49 | ||
| 50 | #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES | ||
| 51 | |||
| 52 | union oac { | 50 | union oac { |
| 53 | unsigned int val; | 51 | unsigned int val; |
| 54 | struct { | 52 | struct { |
| @@ -71,6 +69,8 @@ union oac { · 16 unmodified lines | |||
| 71 | }; | 69 | }; |
| 72 | }; | 70 | }; |
| 73 | 71 | ||
| 72 | #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES | ||
| 73 | |||
| 74 | #define __put_get_user_asm(to, from, size, oac_spec) \ | 74 | #define __put_get_user_asm(to, from, size, oac_spec) \ |
| 75 | ({ \ | 75 | ({ \ |
| 76 | int __rc; \ | 76 | int __rc; \ |
| @@ -33,7 +33,7 @@ · 32 unmodified lines | |||
| 33 | #define DEBUGP(fmt , ...) | 33 | #define DEBUGP(fmt , ...) |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #define PLT_ENTRY_SIZE 20 | 36 | #define PLT_ENTRY_SIZE 22 |
| 37 | 37 | ||
| 38 | void *module_alloc(unsigned long size) | 38 | void *module_alloc(unsigned long size) |
| 39 | { | 39 | { |
| @@ -341,27 +341,26 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, · 301 unmodified lines | |||
| 341 | case R_390_PLTOFF32: /* 32 bit offset from GOT to PLT. */ | 341 | case R_390_PLTOFF32: /* 32 bit offset from GOT to PLT. */ |
| 342 | case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ | 342 | case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ |
| 343 | if (info->plt_initialized == 0) { | 343 | if (info->plt_initialized == 0) { |
| 344 | unsigned int insn[5]; | 344 | unsigned char insn[PLT_ENTRY_SIZE]; |
| 345 | unsigned int *ip = me->core_layout.base + | 345 | char *plt_base; |
| 346 | me->arch.plt_offset + | 346 | char *ip; |
| 347 | info->plt_offset; | 347 | |
| 348 | 348 | plt_base = me->core_layout.base + me->arch.plt_offset; | |
| 349 | insn[0] = 0x0d10e310; /* basr 1,0 */ | 349 | ip = plt_base + info->plt_offset; |
| 350 | insn[1] = 0x100a0004; /* lg 1,10(1) */ | 350 | *(int *)insn = 0x0d10e310; /* basr 1,0 */ |
| 351 | *(int *)&insn[4] = 0x100c0004; /* lg 1,12(1) */ | ||
| 351 | if (IS_ENABLED(CONFIG_EXPOLINE) && !nospec_disable) { | 352 | if (IS_ENABLED(CONFIG_EXPOLINE) && !nospec_disable) { |
| 352 | unsigned int *ij; | 353 | char *jump_r1; |
| 353 | ij = me->core_layout.base + | 354 | |
| 354 | me->arch.plt_offset + | 355 | jump_r1 = plt_base + me->arch.plt_size - |
| 355 | me->arch.plt_size - PLT_ENTRY_SIZE; | 356 | PLT_ENTRY_SIZE; |
| 356 | insn[2] = 0xa7f40000 + /* j __jump_r1 */ | 357 | /* brcl 0xf,__jump_r1 */ |
| 357 | (unsigned int)(u16) | 358 | *(short *)&insn[8] = 0xc0f4; |
| 358 | (((unsigned long) ij - 8 - | 359 | *(int *)&insn[10] = (jump_r1 - (ip + 8)) / 2; |
| 359 | (unsigned long) ip) / 2); | ||
| 360 | } else { | 360 | } else { |
| 361 | insn[2] = 0x07f10000; /* br %r1 */ | 361 | *(int *)&insn[8] = 0x07f10000; /* br %r1 */ |
| 362 | } | 362 | } |
| 363 | insn[3] = (unsigned int) (val >> 32); | 363 | *(long *)&insn[14] = val; |
| 364 | insn[4] = (unsigned int) val; | ||
| 365 | 364 | ||
| 366 | write(ip, insn, sizeof(insn)); | 365 | write(ip, insn, sizeof(insn)); |
| 367 | info->plt_initialized = 1; | 366 | info->plt_initialized = 1; |
| @@ -264,7 +264,14 @@ static int notrace s390_validate_registers(union mci mci, int umode) · 263 unmodified lines | |||
| 264 | /* Validate vector registers */ | 264 | /* Validate vector registers */ |
| 265 | union ctlreg0 cr0; | 265 | union ctlreg0 cr0; |
| 266 | 266 | ||
| 267 | if (!mci.vr) { | 267 | /* |
| 268 | * The vector validity must only be checked if not running a | ||
| 269 | * KVM guest. For KVM guests the machine check is forwarded by | ||
| 270 | * KVM and it is the responsibility of the guest to take | ||
| 271 | * appropriate actions. The host vector or FPU values have been | ||
| 272 | * saved by KVM and will be restored by KVM. | ||
| 273 | */ | ||
| 274 | if (!mci.vr && !test_cpu_flag(CIF_MCCK_GUEST)) { | ||
| 268 | /* | 275 | /* |
| 269 | * Vector registers can't be restored. If the kernel | 276 | * Vector registers can't be restored. If the kernel |
| 270 | * currently uses vector registers the system is | 277 | * currently uses vector registers the system is |
| @@ -307,11 +314,21 @@ static int notrace s390_validate_registers(union mci mci, int umode) · 36 unmodified lines | |||
| 307 | if (cr2.gse) { | 314 | if (cr2.gse) { |
| 308 | if (!mci.gs) { | 315 | if (!mci.gs) { |
| 309 | /* | 316 | /* |
| 310 | * Guarded storage register can't be restored and | 317 | * 2 cases: |
| 311 | * the current processes uses guarded storage. | 318 | * - machine check in kernel or userspace |
| 312 | * It has to be terminated. | 319 | * - machine check while running SIE (KVM guest) |
| 320 | * For kernel or userspace the userspace values of | ||
| 321 | * guarded storage control can not be recreated, the | ||
| 322 | * process must be terminated. | ||
| 323 | * For SIE the guest values of guarded storage can not | ||
| 324 | * be recreated. This is either due to a bug or due to | ||
| 325 | * GS being disabled in the guest. The guest will be | ||
| 326 | * notified by KVM code and the guests machine check | ||
| 327 | * handling must take care of this. The host values | ||
| 328 | * are saved by KVM and are not affected. | ||
| 313 | */ | 329 | */ |
| 314 | kill_task = 1; | 330 | if (!test_cpu_flag(CIF_MCCK_GUEST)) |
| 331 | kill_task = 1; | ||
| 315 | } else { | 332 | } else { |
| 316 | load_gs_cb((struct gs_cb *)mcesa->guarded_storage_save_area); | 333 | load_gs_cb((struct gs_cb *)mcesa->guarded_storage_save_area); |
| 317 | } | 334 | } |
| @@ -17,4 +17,7 @@ KASAN_SANITIZE_uaccess.o := n · 16 unmodified lines | |||
| 17 | obj-$(CONFIG_S390_UNWIND_SELFTEST) += test_unwind.o | 17 | obj-$(CONFIG_S390_UNWIND_SELFTEST) += test_unwind.o |
| 18 | CFLAGS_test_unwind.o += -fno-optimize-sibling-calls | 18 | CFLAGS_test_unwind.o += -fno-optimize-sibling-calls |
| 19 | 19 | ||
| 20 | obj-$(CONFIG_S390_MODULES_SANITY_TEST) += test_modules.o | ||
| 21 | obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) += test_modules_helpers.o | ||
| 22 | |||
| 20 | lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o | 23 | lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o |
| @@ -0,0 +1,35 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0+ | ||
| 2 | |||
| 3 | #include <kunit/test.h> | ||
| 4 | #include <linux/module.h> | ||
| 5 | |||
| 6 | #include "test_modules.h" | ||
| 7 | |||
| 8 | #define DECLARE_RETURN(i) int test_modules_return_ ## i(void) | ||
| 9 | REPEAT_10000(DECLARE_RETURN); | ||
| 10 | |||
| 11 | /* | ||
| 12 | * Test that modules with many relocations are loaded properly. | ||
| 13 | */ | ||
| 14 | static void test_modules_many_vmlinux_relocs(struct kunit *test) | ||
| 15 | { | ||
| 16 | int result = 0; | ||
| 17 | |||
| 18 | #define CALL_RETURN(i) result += test_modules_return_ ## i() | ||
| 19 | REPEAT_10000(CALL_RETURN); | ||
| 20 | KUNIT_ASSERT_EQ(test, result, 49995000); | ||
| 21 | } | ||
| 22 | |||
| 23 | static struct kunit_case modules_testcases[] = { | ||
| 24 | KUNIT_CASE(test_modules_many_vmlinux_relocs), | ||
| 25 | {} | ||
| 26 | }; | ||
| 27 | |||
| 28 | static struct kunit_suite modules_test_suite = { | ||
| 29 | .name = "modules_test_s390", | ||
| 30 | .test_cases = modules_testcases, | ||
| 31 | }; | ||
| 32 | |||
| 33 | kunit_test_suites(&modules_test_suite); | ||
| 34 | |||
| 35 | MODULE_LICENSE("GPL"); | ||
| @@ -0,0 +1,50 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
| 2 | #ifndef TEST_MODULES_H | ||
| 3 | #define TEST_MODULES_H | ||
| 4 | |||
| 5 | #define __REPEAT_10000_3(f, x) \ | ||
| 6 | f(x ## 0); \ | ||
| 7 | f(x ## 1); \ | ||
| 8 | f(x ## 2); \ | ||
| 9 | f(x ## 3); \ | ||
| 10 | f(x ## 4); \ | ||
| 11 | f(x ## 5); \ | ||
| 12 | f(x ## 6); \ | ||
| 13 | f(x ## 7); \ | ||
| 14 | f(x ## 8); \ | ||
| 15 | f(x ## 9) | ||
| 16 | #define __REPEAT_10000_2(f, x) \ | ||
| 17 | __REPEAT_10000_3(f, x ## 0); \ | ||
| 18 | __REPEAT_10000_3(f, x ## 1); \ | ||
| 19 | __REPEAT_10000_3(f, x ## 2); \ | ||
| 20 | __REPEAT_10000_3(f, x ## 3); \ | ||
| 21 | __REPEAT_10000_3(f, x ## 4); \ | ||
| 22 | __REPEAT_10000_3(f, x ## 5); \ | ||
| 23 | __REPEAT_10000_3(f, x ## 6); \ | ||
| 24 | __REPEAT_10000_3(f, x ## 7); \ | ||
| 25 | __REPEAT_10000_3(f, x ## 8); \ | ||
| 26 | __REPEAT_10000_3(f, x ## 9) | ||
| 27 | #define __REPEAT_10000_1(f, x) \ | ||
| 28 | __REPEAT_10000_2(f, x ## 0); \ | ||
| 29 | __REPEAT_10000_2(f, x ## 1); \ | ||
| 30 | __REPEAT_10000_2(f, x ## 2); \ | ||
| 31 | __REPEAT_10000_2(f, x ## 3); \ | ||
| 32 | __REPEAT_10000_2(f, x ## 4); \ | ||
| 33 | __REPEAT_10000_2(f, x ## 5); \ | ||
| 34 | __REPEAT_10000_2(f, x ## 6); \ | ||
| 35 | __REPEAT_10000_2(f, x ## 7); \ | ||
| 36 | __REPEAT_10000_2(f, x ## 8); \ | ||
| 37 | __REPEAT_10000_2(f, x ## 9) | ||
| 38 | #define REPEAT_10000(f) \ | ||
| 39 | __REPEAT_10000_1(f, 0); \ | ||
| 40 | __REPEAT_10000_1(f, 1); \ | ||
| 41 | __REPEAT_10000_1(f, 2); \ | ||
| 42 | __REPEAT_10000_1(f, 3); \ | ||
| 43 | __REPEAT_10000_1(f, 4); \ | ||
| 44 | __REPEAT_10000_1(f, 5); \ | ||
| 45 | __REPEAT_10000_1(f, 6); \ | ||
| 46 | __REPEAT_10000_1(f, 7); \ | ||
| 47 | __REPEAT_10000_1(f, 8); \ | ||
| 48 | __REPEAT_10000_1(f, 9) | ||
| 49 | |||
| 50 | #endif | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0+ | ||
| 2 | |||
| 3 | #include <linux/export.h> | ||
| 4 | |||
| 5 | #include "test_modules.h" | ||
| 6 | |||
| 7 | #define DEFINE_RETURN(i) \ | ||
| 8 | int test_modules_return_ ## i(void) \ | ||
| 9 | { \ | ||
| 10 | return 1 ## i - 10000; \ | ||
| 11 | } \ | ||
| 12 | EXPORT_SYMBOL_GPL(test_modules_return_ ## i) | ||
| 13 | REPEAT_10000(DEFINE_RETURN); | ||
| @@ -186,6 +186,7 @@ config X86 · 185 unmodified lines | |||
| 186 | select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING | 186 | select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING |
| 187 | select HAVE_C_RECORDMCOUNT | 187 | select HAVE_C_RECORDMCOUNT |
| 188 | select HAVE_OBJTOOL_MCOUNT if STACK_VALIDATION | 188 | select HAVE_OBJTOOL_MCOUNT if STACK_VALIDATION |
| 189 | select HAVE_BUILDTIME_MCOUNT_SORT | ||
| 189 | select HAVE_DEBUG_KMEMLEAK | 190 | select HAVE_DEBUG_KMEMLEAK |
| 190 | select HAVE_DMA_CONTIGUOUS | 191 | select HAVE_DMA_CONTIGUOUS |
| 191 | select HAVE_DYNAMIC_FTRACE | 192 | select HAVE_DYNAMIC_FTRACE |
| @@ -1483,7 +1483,8 @@ struct kvm_x86_ops { · 1482 unmodified lines | |||
| 1483 | 1483 | ||
| 1484 | int (*get_msr_feature)(struct kvm_msr_entry *entry); | 1484 | int (*get_msr_feature)(struct kvm_msr_entry *entry); |
| 1485 | 1485 | ||
| 1486 | bool (*can_emulate_instruction)(struct kvm_vcpu *vcpu, void *insn, int insn_len); | 1486 | bool (*can_emulate_instruction)(struct kvm_vcpu *vcpu, int emul_type, |
| 1487 | void *insn, int insn_len); | ||
| 1487 | 1488 | ||
| 1488 | bool (*apic_init_signal_blocked)(struct kvm_vcpu *vcpu); | 1489 | bool (*apic_init_signal_blocked)(struct kvm_vcpu *vcpu); |
| 1489 | int (*enable_direct_tlbflush)(struct kvm_vcpu *vcpu); | 1490 | int (*enable_direct_tlbflush)(struct kvm_vcpu *vcpu); |
| @@ -1496,6 +1497,7 @@ struct kvm_x86_ops { · 6 unmodified lines | |||
| 1496 | }; | 1497 | }; |
| 1497 | 1498 | ||
| 1498 | struct kvm_x86_nested_ops { | 1499 | struct kvm_x86_nested_ops { |
| 1500 | void (*leave_nested)(struct kvm_vcpu *vcpu); | ||
| 1499 | int (*check_events)(struct kvm_vcpu *vcpu); | 1501 | int (*check_events)(struct kvm_vcpu *vcpu); |
| 1500 | bool (*hv_timer_pending)(struct kvm_vcpu *vcpu); | 1502 | bool (*hv_timer_pending)(struct kvm_vcpu *vcpu); |
| 1501 | void (*triple_fault)(struct kvm_vcpu *vcpu); | 1503 | void (*triple_fault)(struct kvm_vcpu *vcpu); |
| @@ -1861,7 +1863,6 @@ int kvm_cpu_has_extint(struct kvm_vcpu *v); · 359 unmodified lines | |||
| 1861 | int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); | 1863 | int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); |
| 1862 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 1864 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
| 1863 | void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event); | 1865 | void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event); |
| 1864 | void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu); | ||
| 1865 | 1866 | ||
| 1866 | int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, | 1867 | int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, |
| 1867 | unsigned long ipi_bitmap_high, u32 min, | 1868 | unsigned long ipi_bitmap_high, u32 min, |
| @@ -452,6 +452,9 @@ struct kvm_sync_regs { · 451 unmodified lines | |||
| 452 | 452 | ||
| 453 | #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001 | 453 | #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001 |
| 454 | 454 | ||
| 455 | /* attributes for system fd (group 0) */ | ||
| 456 | #define KVM_X86_XCOMP_GUEST_SUPP 0 | ||
| 457 | |||
| 455 | struct kvm_vmx_nested_state_data { | 458 | struct kvm_vmx_nested_state_data { |
| 456 | __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; | 459 | __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; |
| 457 | __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; | 460 | __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; |
| @@ -423,7 +423,7 @@ static void threshold_restart_bank(void *_tr) · 422 unmodified lines | |||
| 423 | u32 hi, lo; | 423 | u32 hi, lo; |
| 424 | 424 | ||
| 425 | /* sysfs write might race against an offline operation */ | 425 | /* sysfs write might race against an offline operation */ |
| 426 | if (this_cpu_read(threshold_banks)) | 426 | if (!this_cpu_read(threshold_banks) && !tr->set_lvt_off) |
| 427 | return; | 427 | return; |
| 428 | 428 | ||
| 429 | rdmsr(tr->b->address, lo, hi); | 429 | rdmsr(tr->b->address, lo, hi); |
| @@ -486,6 +486,7 @@ static void intel_ppin_init(struct cpuinfo_x86 *c) · 485 unmodified lines | |||
| 486 | case INTEL_FAM6_BROADWELL_X: | 486 | case INTEL_FAM6_BROADWELL_X: |
| 487 | case INTEL_FAM6_SKYLAKE_X: | 487 | case INTEL_FAM6_SKYLAKE_X: |
| 488 | case INTEL_FAM6_ICELAKE_X: | 488 | case INTEL_FAM6_ICELAKE_X: |
| 489 | case INTEL_FAM6_ICELAKE_D: | ||
| 489 | case INTEL_FAM6_SAPPHIRERAPIDS_X: | 490 | case INTEL_FAM6_SAPPHIRERAPIDS_X: |
| 490 | case INTEL_FAM6_XEON_PHI_KNL: | 491 | case INTEL_FAM6_XEON_PHI_KNL: |
| 491 | case INTEL_FAM6_XEON_PHI_KNM: | 492 | case INTEL_FAM6_XEON_PHI_KNM: |
| @@ -133,6 +133,7 @@ static int kvm_cpuid_check_equal(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 · 132 unmodified lines | |||
| 133 | orig = &vcpu->arch.cpuid_entries[i]; | 133 | orig = &vcpu->arch.cpuid_entries[i]; |
| 134 | if (e2[i].function != orig->function || | 134 | if (e2[i].function != orig->function || |
| 135 | e2[i].index != orig->index || | 135 | e2[i].index != orig->index || |
| 136 | e2[i].flags != orig->flags || | ||
| 136 | e2[i].eax != orig->eax || e2[i].ebx != orig->ebx || | 137 | e2[i].eax != orig->eax || e2[i].ebx != orig->ebx || |
| 137 | e2[i].ecx != orig->ecx || e2[i].edx != orig->edx) | 138 | e2[i].ecx != orig->ecx || e2[i].edx != orig->edx) |
| 138 | return -EINVAL; | 139 | return -EINVAL; |
| @@ -196,10 +197,26 @@ void kvm_update_pv_runtime(struct kvm_vcpu *vcpu) · 57 unmodified lines | |||
| 196 | vcpu->arch.pv_cpuid.features = best->eax; | 197 | vcpu->arch.pv_cpuid.features = best->eax; |
| 197 | } | 198 | } |
| 198 | 199 | ||
| 200 | /* | ||
| 201 | * Calculate guest's supported XCR0 taking into account guest CPUID data and | ||
| 202 | * supported_xcr0 (comprised of host configuration and KVM_SUPPORTED_XCR0). | ||
| 203 | */ | ||
| 204 | static u64 cpuid_get_supported_xcr0(struct kvm_cpuid_entry2 *entries, int nent) | ||
| 205 | { | ||
| 206 | struct kvm_cpuid_entry2 *best; | ||
| 207 | |||
| 208 | best = cpuid_entry2_find(entries, nent, 0xd, 0); | ||
| 209 | if (!best) | ||
| 210 | return 0; | ||
| 211 | |||
| 212 | return (best->eax | ((u64)best->edx << 32)) & supported_xcr0; | ||
| 213 | } | ||
| 214 | |||
| 199 | static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *entries, | 215 | static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *entries, |
| 200 | int nent) | 216 | int nent) |
| 201 | { | 217 | { |
| 202 | struct kvm_cpuid_entry2 *best; | 218 | struct kvm_cpuid_entry2 *best; |
| 219 | u64 guest_supported_xcr0 = cpuid_get_supported_xcr0(entries, nent); | ||
| 203 | 220 | ||
| 204 | best = cpuid_entry2_find(entries, nent, 1, 0); | 221 | best = cpuid_entry2_find(entries, nent, 1, 0); |
| 205 | if (best) { | 222 | if (best) { |
| @@ -238,6 +255,21 @@ static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_cpuid_e · 32 unmodified lines | |||
| 238 | vcpu->arch.ia32_misc_enable_msr & | 255 | vcpu->arch.ia32_misc_enable_msr & |
| 239 | MSR_IA32_MISC_ENABLE_MWAIT); | 256 | MSR_IA32_MISC_ENABLE_MWAIT); |
| 240 | } | 257 | } |
| 258 | |||
| 259 | /* | ||
| 260 | * Bits 127:0 of the allowed SECS.ATTRIBUTES (CPUID.0x12.0x1) enumerate | ||
| 261 | * the supported XSAVE Feature Request Mask (XFRM), i.e. the enclave's | ||
| 262 | * requested XCR0 value. The enclave's XFRM must be a subset of XCRO | ||
| 263 | * at the time of EENTER, thus adjust the allowed XFRM by the guest's | ||
| 264 | * supported XCR0. Similar to XCR0 handling, FP and SSE are forced to | ||
| 265 | * '1' even on CPUs that don't support XSAVE. | ||
| 266 | */ | ||
| 267 | best = cpuid_entry2_find(entries, nent, 0x12, 0x1); | ||
| 268 | if (best) { | ||
| 269 | best->ecx &= guest_supported_xcr0 & 0xffffffff; | ||
| 270 | best->edx &= guest_supported_xcr0 >> 32; | ||
| 271 | best->ecx |= XFEATURE_MASK_FPSSE; | ||
| 272 | } | ||
| 241 | } | 273 | } |
| 242 | 274 | ||
| 243 | void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu) | 275 | void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu) |
| @@ -261,27 +293,8 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 17 unmodified lines | |||
| 261 | kvm_apic_set_version(vcpu); | 293 | kvm_apic_set_version(vcpu); |
| 262 | } | 294 | } |
| 263 | 295 | ||
| 264 | best = kvm_find_cpuid_entry(vcpu, 0xD, 0); | 296 | vcpu->arch.guest_supported_xcr0 = |
| 265 | if (!best) | 297 | cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent); |
| 266 | vcpu->arch.guest_supported_xcr0 = 0; | ||
| 267 | else | ||
| 268 | vcpu->arch.guest_supported_xcr0 = | ||
| 269 | (best->eax | ((u64)best->edx << 32)) & supported_xcr0; | ||
| 270 | |||
| 271 | /* | ||
| 272 | * Bits 127:0 of the allowed SECS.ATTRIBUTES (CPUID.0x12.0x1) enumerate | ||
| 273 | * the supported XSAVE Feature Request Mask (XFRM), i.e. the enclave's | ||
| 274 | * requested XCR0 value. The enclave's XFRM must be a subset of XCRO | ||
| 275 | * at the time of EENTER, thus adjust the allowed XFRM by the guest's | ||
| 276 | * supported XCR0. Similar to XCR0 handling, FP and SSE are forced to | ||
| 277 | * '1' even on CPUs that don't support XSAVE. | ||
| 278 | */ | ||
| 279 | best = kvm_find_cpuid_entry(vcpu, 0x12, 0x1); | ||
| 280 | if (best) { | ||
| 281 | best->ecx &= vcpu->arch.guest_supported_xcr0 & 0xffffffff; | ||
| 282 | best->edx &= vcpu->arch.guest_supported_xcr0 >> 32; | ||
| 283 | best->ecx |= XFEATURE_MASK_FPSSE; | ||
| 284 | } | ||
| 285 | 298 | ||
| 286 | kvm_update_pv_runtime(vcpu); | 299 | kvm_update_pv_runtime(vcpu); |
| 287 | 300 | ||
| @@ -346,8 +359,14 @@ static int kvm_set_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *e2, · 58 unmodified lines | |||
| 346 | * KVM_SET_CPUID{,2} again. To support this legacy behavior, check | 359 | * KVM_SET_CPUID{,2} again. To support this legacy behavior, check |
| 347 | * whether the supplied CPUID data is equal to what's already set. | 360 | * whether the supplied CPUID data is equal to what's already set. |
| 348 | */ | 361 | */ |
| 349 | if (vcpu->arch.last_vmentry_cpu != -1) | 362 | if (vcpu->arch.last_vmentry_cpu != -1) { |
| 350 | return kvm_cpuid_check_equal(vcpu, e2, nent); | 363 | r = kvm_cpuid_check_equal(vcpu, e2, nent); |
| 364 | if (r) | ||
| 365 | return r; | ||
| 366 | |||
| 367 | kvfree(e2); | ||
| 368 | return 0; | ||
| 369 | } | ||
| 351 | 370 | ||
| 352 | r = kvm_check_cpuid(vcpu, e2, nent); | 371 | r = kvm_check_cpuid(vcpu, e2, nent); |
| 353 | if (r) | 372 | if (r) |
| @@ -887,13 +906,14 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 533 unmodified lines | |||
| 887 | } | 906 | } |
| 888 | break; | 907 | break; |
| 889 | case 0xd: { | 908 | case 0xd: { |
| 890 | u64 guest_perm = xstate_get_guest_group_perm(); | 909 | u64 permitted_xcr0 = supported_xcr0 & xstate_get_guest_group_perm(); |
| 910 | u64 permitted_xss = supported_xss; | ||
| 891 | 911 | ||
| 892 | entry->eax &= supported_xcr0 & guest_perm; | 912 | entry->eax &= permitted_xcr0; |
| 893 | entry->ebx = xstate_required_size(supported_xcr0, false); | 913 | entry->ebx = xstate_required_size(permitted_xcr0, false); |
| 894 | entry->ecx = entry->ebx; | 914 | entry->ecx = entry->ebx; |
| 895 | entry->edx &= (supported_xcr0 & guest_perm) >> 32; | 915 | entry->edx &= permitted_xcr0 >> 32; |
| 896 | if (!supported_xcr0) | 916 | if (!permitted_xcr0) |
| 897 | break; | 917 | break; |
| 898 | 918 | ||
| 899 | entry = do_host_cpuid(array, function, 1); | 919 | entry = do_host_cpuid(array, function, 1); |
| @@ -902,20 +922,20 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 2 unmodified lines | |||
| 902 | 922 | ||
| 903 | cpuid_entry_override(entry, CPUID_D_1_EAX); | 923 | cpuid_entry_override(entry, CPUID_D_1_EAX); |
| 904 | if (entry->eax & (F(XSAVES)|F(XSAVEC))) | 924 | if (entry->eax & (F(XSAVES)|F(XSAVEC))) |
| 905 | entry->ebx = xstate_required_size(supported_xcr0 | supported_xss, | 925 | entry->ebx = xstate_required_size(permitted_xcr0 | permitted_xss, |
| 906 | true); | 926 | true); |
| 907 | else { | 927 | else { |
| 908 | WARN_ON_ONCE(supported_xss != 0); | 928 | WARN_ON_ONCE(permitted_xss != 0); |
| 909 | entry->ebx = 0; | 929 | entry->ebx = 0; |
| 910 | } | 930 | } |
| 911 | entry->ecx &= supported_xss; | 931 | entry->ecx &= permitted_xss; |
| 912 | entry->edx &= supported_xss >> 32; | 932 | entry->edx &= permitted_xss >> 32; |
| 913 | 933 | ||
| 914 | for (i = 2; i < 64; ++i) { | 934 | for (i = 2; i < 64; ++i) { |
| 915 | bool s_state; | 935 | bool s_state; |
| 916 | if (supported_xcr0 & BIT_ULL(i)) | 936 | if (permitted_xcr0 & BIT_ULL(i)) |
| 917 | s_state = false; | 937 | s_state = false; |
| 918 | else if (supported_xss & BIT_ULL(i)) | 938 | else if (permitted_xss & BIT_ULL(i)) |
| 919 | s_state = true; | 939 | s_state = true; |
| 920 | else | 940 | else |
| 921 | continue; | 941 | continue; |
| @@ -929,7 +949,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 7 unmodified lines | |||
| 929 | * invalid sub-leafs. Only valid sub-leafs should | 949 | * invalid sub-leafs. Only valid sub-leafs should |
| 930 | * reach this point, and they should have a non-zero | 950 | * reach this point, and they should have a non-zero |
| 931 | * save state size. Furthermore, check whether the | 951 | * save state size. Furthermore, check whether the |
| 932 | * processor agrees with supported_xcr0/supported_xss | 952 | * processor agrees with permitted_xcr0/permitted_xss |
| 933 | * on whether this is an XCR0- or IA32_XSS-managed area. | 953 | * on whether this is an XCR0- or IA32_XSS-managed area. |
| 934 | */ | 954 | */ |
| 935 | if (WARN_ON_ONCE(!entry->eax || (entry->ecx & 0x1) != s_state)) { | 955 | if (WARN_ON_ONCE(!entry->eax || (entry->ecx & 0x1) != s_state)) { |
| @@ -2629,7 +2629,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) · 2628 unmodified lines | |||
| 2629 | kvm_apic_set_version(vcpu); | 2629 | kvm_apic_set_version(vcpu); |
| 2630 | 2630 | ||
| 2631 | apic_update_ppr(apic); | 2631 | apic_update_ppr(apic); |
| 2632 | hrtimer_cancel(&apic->lapic_timer.timer); | 2632 | cancel_apic_timer(apic); |
| 2633 | apic->lapic_timer.expired_tscdeadline = 0; | 2633 | apic->lapic_timer.expired_tscdeadline = 0; |
| 2634 | apic_update_lvtt(apic); | 2634 | apic_update_lvtt(apic); |
| 2635 | apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0)); | 2635 | apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0)); |
| @@ -983,9 +983,9 @@ void svm_free_nested(struct vcpu_svm *svm) · 982 unmodified lines | |||
| 983 | /* | 983 | /* |
| 984 | * Forcibly leave nested mode in order to be able to reset the VCPU later on. | 984 | * Forcibly leave nested mode in order to be able to reset the VCPU later on. |
| 985 | */ | 985 | */ |
| 986 | void svm_leave_nested(struct vcpu_svm *svm) | 986 | void svm_leave_nested(struct kvm_vcpu *vcpu) |
| 987 | { | 987 | { |
| 988 | struct kvm_vcpu *vcpu = &svm->vcpu; | 988 | struct vcpu_svm *svm = to_svm(vcpu); |
| 989 | 989 | ||
| 990 | if (is_guest_mode(vcpu)) { | 990 | if (is_guest_mode(vcpu)) { |
| 991 | svm->nested.nested_run_pending = 0; | 991 | svm->nested.nested_run_pending = 0; |
| @@ -1411,7 +1411,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 419 unmodified lines | |||
| 1411 | return -EINVAL; | 1411 | return -EINVAL; |
| 1412 | 1412 | ||
| 1413 | if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) { | 1413 | if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) { |
| 1414 | svm_leave_nested(svm); | 1414 | svm_leave_nested(vcpu); |
| 1415 | svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET)); | 1415 | svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET)); |
| 1416 | return 0; | 1416 | return 0; |
| 1417 | } | 1417 | } |
| @@ -1478,7 +1478,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 60 unmodified lines | |||
| 1478 | */ | 1478 | */ |
| 1479 | 1479 | ||
| 1480 | if (is_guest_mode(vcpu)) | 1480 | if (is_guest_mode(vcpu)) |
| 1481 | svm_leave_nested(svm); | 1481 | svm_leave_nested(vcpu); |
| 1482 | else | 1482 | else |
| 1483 | svm->nested.vmcb02.ptr->save = svm->vmcb01.ptr->save; | 1483 | svm->nested.vmcb02.ptr->save = svm->vmcb01.ptr->save; |
| 1484 | 1484 | ||
| @@ -1532,6 +1532,7 @@ static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu) · 47 unmodified lines | |||
| 1532 | } | 1532 | } |
| 1533 | 1533 | ||
| 1534 | struct kvm_x86_nested_ops svm_nested_ops = { | 1534 | struct kvm_x86_nested_ops svm_nested_ops = { |
| 1535 | .leave_nested = svm_leave_nested, | ||
| 1535 | .check_events = svm_check_nested_events, | 1536 | .check_events = svm_check_nested_events, |
| 1536 | .triple_fault = nested_svm_triple_fault, | 1537 | .triple_fault = nested_svm_triple_fault, |
| 1537 | .get_nested_state_pages = svm_get_nested_state_pages, | 1538 | .get_nested_state_pages = svm_get_nested_state_pages, |
| @@ -2100,8 +2100,13 @@ void __init sev_hardware_setup(void) · 2099 unmodified lines | |||
| 2100 | if (!sev_enabled || !npt_enabled) | 2100 | if (!sev_enabled || !npt_enabled) |
| 2101 | goto out; | 2101 | goto out; |
| 2102 | 2102 | ||
| 2103 | /* Does the CPU support SEV? */ | 2103 | /* |
| 2104 | if (!boot_cpu_has(X86_FEATURE_SEV)) | 2104 | * SEV must obviously be supported in hardware. Sanity check that the |
| 2105 | * CPU supports decode assists, which is mandatory for SEV guests to | ||
| 2106 | * support instruction emulation. | ||
| 2107 | */ | ||
| 2108 | if (!boot_cpu_has(X86_FEATURE_SEV) || | ||
| 2109 | WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS))) | ||
| 2105 | goto out; | 2110 | goto out; |
| 2106 | 2111 | ||
| 2107 | /* Retrieve SEV CPUID information */ | 2112 | /* Retrieve SEV CPUID information */ |
| @@ -290,7 +290,7 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) · 289 unmodified lines | |||
| 290 | 290 | ||
| 291 | if ((old_efer & EFER_SVME) != (efer & EFER_SVME)) { | 291 | if ((old_efer & EFER_SVME) != (efer & EFER_SVME)) { |
| 292 | if (!(efer & EFER_SVME)) { | 292 | if (!(efer & EFER_SVME)) { |
| 293 | svm_leave_nested(svm); | 293 | svm_leave_nested(vcpu); |
| 294 | svm_set_gif(svm, true); | 294 | svm_set_gif(svm, true); |
| 295 | /* #GP intercept is still needed for vmware backdoor */ | 295 | /* #GP intercept is still needed for vmware backdoor */ |
| 296 | if (!enable_vmware_backdoor) | 296 | if (!enable_vmware_backdoor) |
| @@ -312,7 +312,11 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) · 15 unmodified lines | |||
| 312 | return ret; | 312 | return ret; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | if (svm_gp_erratum_intercept) | 315 | /* |
| 316 | * Never intercept #GP for SEV guests, KVM can't | ||
| 317 | * decrypt guest memory to workaround the erratum. | ||
| 318 | */ | ||
| 319 | if (svm_gp_erratum_intercept && !sev_guest(vcpu->kvm)) | ||
| 316 | set_exception_intercept(svm, GP_VECTOR); | 320 | set_exception_intercept(svm, GP_VECTOR); |
| 317 | } | 321 | } |
| 318 | } | 322 | } |
| @@ -1010,9 +1014,10 @@ static void init_vmcb(struct kvm_vcpu *vcpu) · 691 unmodified lines | |||
| 1010 | * Guest access to VMware backdoor ports could legitimately | 1014 | * Guest access to VMware backdoor ports could legitimately |
| 1011 | * trigger #GP because of TSS I/O permission bitmap. | 1015 | * trigger #GP because of TSS I/O permission bitmap. |
| 1012 | * We intercept those #GP and allow access to them anyway | 1016 | * We intercept those #GP and allow access to them anyway |
| 1013 | * as VMware does. | 1017 | * as VMware does. Don't intercept #GP for SEV guests as KVM can't |
| 1018 | * decrypt guest memory to decode the faulting instruction. | ||
| 1014 | */ | 1019 | */ |
| 1015 | if (enable_vmware_backdoor) | 1020 | if (enable_vmware_backdoor && !sev_guest(vcpu->kvm)) |
| 1016 | set_exception_intercept(svm, GP_VECTOR); | 1021 | set_exception_intercept(svm, GP_VECTOR); |
| 1017 | 1022 | ||
| 1018 | svm_set_intercept(svm, INTERCEPT_INTR); | 1023 | svm_set_intercept(svm, INTERCEPT_INTR); |
| @@ -2091,10 +2096,6 @@ static int gp_interception(struct kvm_vcpu *vcpu) · 1072 unmodified lines | |||
| 2091 | if (error_code) | 2096 | if (error_code) |
| 2092 | goto reinject; | 2097 | goto reinject; |
| 2093 | 2098 | ||
| 2094 | /* All SVM instructions expect page aligned RAX */ | ||
| 2095 | if (svm->vmcb->save.rax & ~PAGE_MASK) | ||
| 2096 | goto reinject; | ||
| 2097 | |||
| 2098 | /* Decode the instruction for usage later */ | 2099 | /* Decode the instruction for usage later */ |
| 2099 | if (x86_decode_emulated_instruction(vcpu, 0, NULL, 0) != EMULATION_OK) | 2100 | if (x86_decode_emulated_instruction(vcpu, 0, NULL, 0) != EMULATION_OK) |
| 2100 | goto reinject; | 2101 | goto reinject; |
| @@ -2112,8 +2113,13 @@ static int gp_interception(struct kvm_vcpu *vcpu) · 11 unmodified lines | |||
| 2112 | if (!is_guest_mode(vcpu)) | 2113 | if (!is_guest_mode(vcpu)) |
| 2113 | return kvm_emulate_instruction(vcpu, | 2114 | return kvm_emulate_instruction(vcpu, |
| 2114 | EMULTYPE_VMWARE_GP | EMULTYPE_NO_DECODE); | 2115 | EMULTYPE_VMWARE_GP | EMULTYPE_NO_DECODE); |
| 2115 | } else | 2116 | } else { |
| 2117 | /* All SVM instructions expect page aligned RAX */ | ||
| 2118 | if (svm->vmcb->save.rax & ~PAGE_MASK) | ||
| 2119 | goto reinject; | ||
| 2120 | |||
| 2116 | return emulate_svm_instr(vcpu, opcode); | 2121 | return emulate_svm_instr(vcpu, opcode); |
| 2122 | } | ||
| 2117 | 2123 | ||
| 2118 | reinject: | 2124 | reinject: |
| 2119 | kvm_queue_exception_e(vcpu, GP_VECTOR, error_code); | 2125 | kvm_queue_exception_e(vcpu, GP_VECTOR, error_code); |
| @@ -4252,79 +4258,140 @@ static void svm_enable_smi_window(struct kvm_vcpu *vcpu) · 2132 unmodified lines | |||
| 4252 | } | 4258 | } |
| 4253 | } | 4259 | } |
| 4254 | 4260 | ||
| 4255 | static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int insn_len) | 4261 | static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type, |
| 4262 | void *insn, int insn_len) | ||
| 4256 | { | 4263 | { |
| 4257 | bool smep, smap, is_user; | 4264 | bool smep, smap, is_user; |
| 4258 | unsigned long cr4; | 4265 | unsigned long cr4; |
| 4266 | u64 error_code; | ||
| 4267 | |||
| 4268 | /* Emulation is always possible when KVM has access to all guest state. */ | ||
| 4269 | if (!sev_guest(vcpu->kvm)) | ||
| 4270 | return true; | ||
| 4271 | |||
| 4272 | /* #UD and #GP should never be intercepted for SEV guests. */ | ||
| 4273 | WARN_ON_ONCE(emul_type & (EMULTYPE_TRAP_UD | | ||
| 4274 | EMULTYPE_TRAP_UD_FORCED | | ||
| 4275 | EMULTYPE_VMWARE_GP)); | ||
| 4259 | 4276 | ||
| 4260 | /* | 4277 | /* |
| 4261 | * When the guest is an SEV-ES guest, emulation is not possible. | 4278 | * Emulation is impossible for SEV-ES guests as KVM doesn't have access |
| 4279 | * to guest register state. | ||
| 4262 | */ | 4280 | */ |
| 4263 | if (sev_es_guest(vcpu->kvm)) | 4281 | if (sev_es_guest(vcpu->kvm)) |
| 4264 | return false; | 4282 | return false; |
| 4265 | 4283 | ||
| 4284 | /* | ||
| 4285 | * Emulation is possible if the instruction is already decoded, e.g. | ||
| 4286 | * when completing I/O after returning from userspace. | ||
| 4287 | */ | ||
| 4288 | if (emul_type & EMULTYPE_NO_DECODE) | ||
| 4289 | return true; | ||
| 4290 | |||
| 4291 | /* | ||
| 4292 | * Emulation is possible for SEV guests if and only if a prefilled | ||
| 4293 | * buffer containing the bytes of the intercepted instruction is | ||
| 4294 | * available. SEV guest memory is encrypted with a guest specific key | ||
| 4295 | * and cannot be decrypted by KVM, i.e. KVM would read cyphertext and | ||
| 4296 | * decode garbage. | ||
| 4297 | * | ||
| 4298 | * Inject #UD if KVM reached this point without an instruction buffer. | ||
| 4299 | * In practice, this path should never be hit by a well-behaved guest, | ||
| 4300 | * e.g. KVM doesn't intercept #UD or #GP for SEV guests, but this path | ||
| 4301 | * is still theoretically reachable, e.g. via unaccelerated fault-like | ||
| 4302 | * AVIC access, and needs to be handled by KVM to avoid putting the | ||
| 4303 | * guest into an infinite loop. Injecting #UD is somewhat arbitrary, | ||
| 4304 | * but its the least awful option given lack of insight into the guest. | ||
| 4305 | */ | ||
| 4306 | if (unlikely(!insn)) { | ||
| 4307 | kvm_queue_exception(vcpu, UD_VECTOR); | ||
| 4308 | return false; | ||
| 4309 | } | ||
| 4310 | |||
| 4311 | /* | ||
| 4312 | * Emulate for SEV guests if the insn buffer is not empty. The buffer | ||
| 4313 | * will be empty if the DecodeAssist microcode cannot fetch bytes for | ||
| 4314 | * the faulting instruction because the code fetch itself faulted, e.g. | ||
| 4315 | * the guest attempted to fetch from emulated MMIO or a guest page | ||
| 4316 | * table used to translate CS:RIP resides in emulated MMIO. | ||
| 4317 | */ | ||
| 4318 | if (likely(insn_len)) | ||
| 4319 | return true; | ||
| 4320 | |||
| 4266 | /* | 4321 | /* |
| 4267 | * Detect and workaround Errata 1096 Fam_17h_00_0Fh. | 4322 | * Detect and workaround Errata 1096 Fam_17h_00_0Fh. |
| 4268 | * | 4323 | * |
| 4269 | * Errata: | 4324 | * Errata: |
| 4270 | * When CPU raise #NPF on guest data access and vCPU CR4.SMAP=1, it is | 4325 | * When CPU raises #NPF on guest data access and vCPU CR4.SMAP=1, it is |
| 4271 | * possible that CPU microcode implementing DecodeAssist will fail | 4326 | * possible that CPU microcode implementing DecodeAssist will fail to |
| 4272 | * to read bytes of instruction which caused #NPF. In this case, | 4327 | * read guest memory at CS:RIP and vmcb.GuestIntrBytes will incorrectly |
| 4273 | * GuestIntrBytes field of the VMCB on a VMEXIT will incorrectly | 4328 | * be '0'. This happens because microcode reads CS:RIP using a _data_ |
| 4274 | * return 0 instead of the correct guest instruction bytes. | 4329 | * loap uop with CPL=0 privileges. If the load hits a SMAP #PF, ucode |
| 4275 | * | 4330 | * gives up and does not fill the instruction bytes buffer. |
| 4276 | * This happens because CPU microcode reading instruction bytes | ||
| 4277 | * uses a special opcode which attempts to read data using CPL=0 | ||
| 4278 | * privileges. The microcode reads CS:RIP and if it hits a SMAP | ||
| 4279 | * fault, it gives up and returns no instruction bytes. | ||
| 4280 | * | 4331 | * |
| 4281 | * Detection: | 4332 | * As above, KVM reaches this point iff the VM is an SEV guest, the CPU |
| 4282 | * We reach here in case CPU supports DecodeAssist, raised #NPF and | 4333 | * supports DecodeAssist, a #NPF was raised, KVM's page fault handler |
| 4283 | * returned 0 in GuestIntrBytes field of the VMCB. | 4334 | * triggered emulation (e.g. for MMIO), and the CPU returned 0 in the |
| 4284 | * First, errata can only be triggered in case vCPU CR4.SMAP=1. | 4335 | * GuestIntrBytes field of the VMCB. |
| 4285 | * Second, if vCPU CR4.SMEP=1, errata could only be triggered | ||
| 4286 | * in case vCPU CPL==3 (Because otherwise guest would have triggered | ||
| 4287 | * a SMEP fault instead of #NPF). | ||
| 4288 | * Otherwise, vCPU CR4.SMEP=0, errata could be triggered by any vCPU CPL. | ||
| 4289 | * As most guests enable SMAP if they have also enabled SMEP, use above | ||
| 4290 | * logic in order to attempt minimize false-positive of detecting errata | ||
| 4291 | * while still preserving all cases semantic correctness. | ||
| 4292 | * | 4336 | * |
| 4293 | * Workaround: | 4337 | * This does _not_ mean that the erratum has been encountered, as the |
| 4294 | * To determine what instruction the guest was executing, the hypervisor | 4338 | * DecodeAssist will also fail if the load for CS:RIP hits a legitimate |
| 4295 | * will have to decode the instruction at the instruction pointer. | 4339 | * #PF, e.g. if the guest attempt to execute from emulated MMIO and |
| 4340 | * encountered a reserved/not-present #PF. | ||
| 4296 | * | 4341 | * |
| 4297 | * In non SEV guest, hypervisor will be able to read the guest | 4342 | * To hit the erratum, the following conditions must be true: |
| 4298 | * memory to decode the instruction pointer when insn_len is zero | 4343 | * 1. CR4.SMAP=1 (obviously). |
| 4299 | * so we return true to indicate that decoding is possible. | 4344 | * 2. CR4.SMEP=0 || CPL=3. If SMEP=1 and CPL<3, the erratum cannot |
| 4345 | * have been hit as the guest would have encountered a SMEP | ||
| 4346 | * violation #PF, not a #NPF. | ||
| 4347 | * 3. The #NPF is not due to a code fetch, in which case failure to | ||
| 4348 | * retrieve the instruction bytes is legitimate (see abvoe). | ||
| 4300 | * | 4349 | * |
| 4301 | * But in the SEV guest, the guest memory is encrypted with the | 4350 | * In addition, don't apply the erratum workaround if the #NPF occurred |
| 4302 | * guest specific key and hypervisor will not be able to decode the | 4351 | * while translating guest page tables (see below). |
| 4303 | * instruction pointer so we will not able to workaround it. Lets | ||
| 4304 | * print the error and request to kill the guest. | ||
| 4305 | */ | 4352 | */ |
| 4306 | if (likely(!insn || insn_len)) | 4353 | error_code = to_svm(vcpu)->vmcb->control.exit_info_1; |
| 4307 | return true; | 4354 | if (error_code & (PFERR_GUEST_PAGE_MASK | PFERR_FETCH_MASK)) |
| 4308 | 4355 | goto resume_guest; | |
| 4309 | /* | ||
| 4310 | * If RIP is invalid, go ahead with emulation which will cause an | ||
| 4311 | * internal error exit. | ||
| 4312 | */ | ||
| 4313 | if (!kvm_vcpu_gfn_to_memslot(vcpu, kvm_rip_read(vcpu) >> PAGE_SHIFT)) | ||
| 4314 | return true; | ||
| 4315 | 4356 | ||
| 4316 | cr4 = kvm_read_cr4(vcpu); | 4357 | cr4 = kvm_read_cr4(vcpu); |
| 4317 | smep = cr4 & X86_CR4_SMEP; | 4358 | smep = cr4 & X86_CR4_SMEP; |
| 4318 | smap = cr4 & X86_CR4_SMAP; | 4359 | smap = cr4 & X86_CR4_SMAP; |
| 4319 | is_user = svm_get_cpl(vcpu) == 3; | 4360 | is_user = svm_get_cpl(vcpu) == 3; |
| 4320 | if (smap && (!smep || is_user)) { | 4361 | if (smap && (!smep || is_user)) { |
| 4321 | if (!sev_guest(vcpu->kvm)) | ||
| 4322 | return true; | ||
| 4323 | |||
| 4324 | pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n"); | 4362 | pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n"); |
| 4325 | kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); | 4363 | |
| 4364 | /* | ||
| 4365 | * If the fault occurred in userspace, arbitrarily inject #GP | ||
| 4366 | * to avoid killing the guest and to hopefully avoid confusing | ||
| 4367 | * the guest kernel too much, e.g. injecting #PF would not be | ||
| 4368 | * coherent with respect to the guest's page tables. Request | ||
| 4369 | * triple fault if the fault occurred in the kernel as there's | ||
| 4370 | * no fault that KVM can inject without confusing the guest. | ||
| 4371 | * In practice, the triple fault is moot as no sane SEV kernel | ||
| 4372 | * will execute from user memory while also running with SMAP=1. | ||
| 4373 | */ | ||
| 4374 | if (is_user) | ||
| 4375 | kvm_inject_gp(vcpu, 0); | ||
| 4376 | else | ||
| 4377 | kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); | ||
| 4326 | } | 4378 | } |
| 4327 | 4379 | ||
| 4380 | resume_guest: | ||
| 4381 | /* | ||
| 4382 | * If the erratum was not hit, simply resume the guest and let it fault | ||
| 4383 | * again. While awful, e.g. the vCPU may get stuck in an infinite loop | ||
| 4384 | * if the fault is at CPL=0, it's the lesser of all evils. Exiting to | ||
| 4385 | * userspace will kill the guest, and letting the emulator read garbage | ||
| 4386 | * will yield random behavior and potentially corrupt the guest. | ||
| 4387 | * | ||
| 4388 | * Simply resuming the guest is technically not a violation of the SEV | ||
| 4389 | * architecture. AMD's APM states that all code fetches and page table | ||
| 4390 | * accesses for SEV guest are encrypted, regardless of the C-Bit. The | ||
| 4391 | * APM also states that encrypted accesses to MMIO are "ignored", but | ||
| 4392 | * doesn't explicitly define "ignored", i.e. doing nothing and letting | ||
| 4393 | * the guest spin is technically "ignoring" the access. | ||
| 4394 | */ | ||
| 4328 | return false; | 4395 | return false; |
| 4329 | } | 4396 | } |
| 4330 | 4397 | ||
| @@ -304,11 +304,6 @@ static inline void vmcb_mark_all_clean(struct vmcb *vmcb) · 303 unmodified lines | |||
| 304 | & ~VMCB_ALWAYS_DIRTY_MASK; | 304 | & ~VMCB_ALWAYS_DIRTY_MASK; |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | static inline bool vmcb_is_clean(struct vmcb *vmcb, int bit) | ||
| 308 | { | ||
| 309 | return (vmcb->control.clean & (1 << bit)); | ||
| 310 | } | ||
| 311 | |||
| 312 | static inline void vmcb_mark_dirty(struct vmcb *vmcb, int bit) | 307 | static inline void vmcb_mark_dirty(struct vmcb *vmcb, int bit) |
| 313 | { | 308 | { |
| 314 | vmcb->control.clean &= ~(1 << bit); | 309 | vmcb->control.clean &= ~(1 << bit); |
| @@ -525,7 +520,7 @@ static inline bool nested_exit_on_nmi(struct vcpu_svm *svm) · 210 unmodified lines | |||
| 525 | 520 | ||
| 526 | int enter_svm_guest_mode(struct kvm_vcpu *vcpu, | 521 | int enter_svm_guest_mode(struct kvm_vcpu *vcpu, |
| 527 | u64 vmcb_gpa, struct vmcb *vmcb12, bool from_vmrun); | 522 | u64 vmcb_gpa, struct vmcb *vmcb12, bool from_vmrun); |
| 528 | void svm_leave_nested(struct vcpu_svm *svm); | 523 | void svm_leave_nested(struct kvm_vcpu *vcpu); |
| 529 | void svm_free_nested(struct vcpu_svm *svm); | 524 | void svm_free_nested(struct vcpu_svm *svm); |
| 530 | int svm_allocate_nested(struct vcpu_svm *svm); | 525 | int svm_allocate_nested(struct vcpu_svm *svm); |
| 531 | int nested_svm_vmrun(struct kvm_vcpu *vcpu); | 526 | int nested_svm_vmrun(struct kvm_vcpu *vcpu); |
| @@ -46,6 +46,9 @@ static inline void svm_hv_init_vmcb(struct vmcb *vmcb) · 45 unmodified lines | |||
| 46 | if (npt_enabled && | 46 | if (npt_enabled && |
| 47 | ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) | 47 | ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) |
| 48 | hve->hv_enlightenments_control.enlightened_npt_tlb = 1; | 48 | hve->hv_enlightenments_control.enlightened_npt_tlb = 1; |
| 49 | |||
| 50 | if (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP) | ||
| 51 | hve->hv_enlightenments_control.msr_bitmap = 1; | ||
| 49 | } | 52 | } |
| 50 | 53 | ||
| 51 | static inline void svm_hv_hardware_setup(void) | 54 | static inline void svm_hv_hardware_setup(void) |
| @@ -83,14 +86,7 @@ static inline void svm_hv_vmcb_dirty_nested_enlightenments( · 31 unmodified lines | |||
| 83 | struct hv_enlightenments *hve = | 86 | struct hv_enlightenments *hve = |
| 84 | (struct hv_enlightenments *)vmcb->control.reserved_sw; | 87 | (struct hv_enlightenments *)vmcb->control.reserved_sw; |
| 85 | 88 | ||
| 86 | /* | 89 | if (hve->hv_enlightenments_control.msr_bitmap) |
| 87 | * vmcb can be NULL if called during early vcpu init. | ||
| 88 | * And its okay not to mark vmcb dirty during vcpu init | ||
| 89 | * as we mark it dirty unconditionally towards end of vcpu | ||
| 90 | * init phase. | ||
| 91 | */ | ||
| 92 | if (vmcb_is_clean(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS) && | ||
| 93 | hve->hv_enlightenments_control.msr_bitmap) | ||
| 94 | vmcb_mark_dirty(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS); | 90 | vmcb_mark_dirty(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS); |
| 95 | } | 91 | } |
| 96 | 92 | ||
| @@ -54,7 +54,6 @@ struct nested_vmx_msrs { · 53 unmodified lines | |||
| 54 | 54 | ||
| 55 | struct vmcs_config { | 55 | struct vmcs_config { |
| 56 | int size; | 56 | int size; |
| 57 | int order; | ||
| 58 | u32 basic_cap; | 57 | u32 basic_cap; |
| 59 | u32 revision_id; | 58 | u32 revision_id; |
| 60 | u32 pin_based_exec_ctrl; | 59 | u32 pin_based_exec_ctrl; |
| @@ -12,8 +12,6 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | DEFINE_STATIC_KEY_FALSE(enable_evmcs); | 13 | DEFINE_STATIC_KEY_FALSE(enable_evmcs); |
| 14 | 14 | ||
| 15 | #if IS_ENABLED(CONFIG_HYPERV) | ||
| 16 | |||
| 17 | #define EVMCS1_OFFSET(x) offsetof(struct hv_enlightened_vmcs, x) | 15 | #define EVMCS1_OFFSET(x) offsetof(struct hv_enlightened_vmcs, x) |
| 18 | #define EVMCS1_FIELD(number, name, clean_field)[ROL16(number, 6)] = \ | 16 | #define EVMCS1_FIELD(number, name, clean_field)[ROL16(number, 6)] = \ |
| 19 | {EVMCS1_OFFSET(name), clean_field} | 17 | {EVMCS1_OFFSET(name), clean_field} |
| @@ -296,6 +294,7 @@ const struct evmcs_field vmcs_field_to_evmcs_1[] = { · 276 unmodified lines | |||
| 296 | }; | 294 | }; |
| 297 | const unsigned int nr_evmcs_1_fields = ARRAY_SIZE(vmcs_field_to_evmcs_1); | 295 | const unsigned int nr_evmcs_1_fields = ARRAY_SIZE(vmcs_field_to_evmcs_1); |
| 298 | 296 | ||
| 297 | #if IS_ENABLED(CONFIG_HYPERV) | ||
| 299 | __init void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf) | 298 | __init void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf) |
| 300 | { | 299 | { |
| 301 | vmcs_conf->pin_based_exec_ctrl &= ~EVMCS1_UNSUPPORTED_PINCTRL; | 300 | vmcs_conf->pin_based_exec_ctrl &= ~EVMCS1_UNSUPPORTED_PINCTRL; |
| @@ -362,6 +361,7 @@ void nested_evmcs_filter_control_msr(u32 msr_index, u64 *pdata) · 60 unmodified lines | |||
| 362 | case MSR_IA32_VMX_PROCBASED_CTLS2: | 361 | case MSR_IA32_VMX_PROCBASED_CTLS2: |
| 363 | ctl_high &= ~EVMCS1_UNSUPPORTED_2NDEXEC; | 362 | ctl_high &= ~EVMCS1_UNSUPPORTED_2NDEXEC; |
| 364 | break; | 363 | break; |
| 364 | case MSR_IA32_VMX_TRUE_PINBASED_CTLS: | ||
| 365 | case MSR_IA32_VMX_PINBASED_CTLS: | 365 | case MSR_IA32_VMX_PINBASED_CTLS: |
| 366 | ctl_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; | 366 | ctl_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; |
| 367 | break; | 367 | break; |
| @@ -59,12 +59,12 @@ DECLARE_STATIC_KEY_FALSE(enable_evmcs); · 58 unmodified lines | |||
| 59 | SECONDARY_EXEC_SHADOW_VMCS | \ | 59 | SECONDARY_EXEC_SHADOW_VMCS | \ |
| 60 | SECONDARY_EXEC_TSC_SCALING | \ | 60 | SECONDARY_EXEC_TSC_SCALING | \ |
| 61 | SECONDARY_EXEC_PAUSE_LOOP_EXITING) | 61 | SECONDARY_EXEC_PAUSE_LOOP_EXITING) |
| 62 | #define EVMCS1_UNSUPPORTED_VMEXIT_CTRL (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) | 62 | #define EVMCS1_UNSUPPORTED_VMEXIT_CTRL \ |
| 63 | (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \ | ||
| 64 | VM_EXIT_SAVE_VMX_PREEMPTION_TIMER) | ||
| 63 | #define EVMCS1_UNSUPPORTED_VMENTRY_CTRL (VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) | 65 | #define EVMCS1_UNSUPPORTED_VMENTRY_CTRL (VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) |
| 64 | #define EVMCS1_UNSUPPORTED_VMFUNC (VMX_VMFUNC_EPTP_SWITCHING) | 66 | #define EVMCS1_UNSUPPORTED_VMFUNC (VMX_VMFUNC_EPTP_SWITCHING) |
| 65 | 67 | ||
| 66 | #if IS_ENABLED(CONFIG_HYPERV) | ||
| 67 | |||
| 68 | struct evmcs_field { | 68 | struct evmcs_field { |
| 69 | u16 offset; | 69 | u16 offset; |
| 70 | u16 clean_field; | 70 | u16 clean_field; |
| @@ -73,26 +73,56 @@ struct evmcs_field { · 2 unmodified lines | |||
| 73 | extern const struct evmcs_field vmcs_field_to_evmcs_1[]; | 73 | extern const struct evmcs_field vmcs_field_to_evmcs_1[]; |
| 74 | extern const unsigned int nr_evmcs_1_fields; | 74 | extern const unsigned int nr_evmcs_1_fields; |
| 75 | 75 | ||
| 76 | static __always_inline int get_evmcs_offset(unsigned long field, | 76 | static __always_inline int evmcs_field_offset(unsigned long field, |
| 77 | u16 *clean_field) | 77 | u16 *clean_field) |
| 78 | { | 78 | { |
| 79 | unsigned int index = ROL16(field, 6); | 79 | unsigned int index = ROL16(field, 6); |
| 80 | const struct evmcs_field *evmcs_field; | 80 | const struct evmcs_field *evmcs_field; |
| 81 | 81 | ||
| 82 | if (unlikely(index >= nr_evmcs_1_fields)) { | 82 | if (unlikely(index >= nr_evmcs_1_fields)) |
| 83 | WARN_ONCE(1, "KVM: accessing unsupported EVMCS field %lx\n", | ||
| 84 | field); | ||
| 85 | return -ENOENT; | 83 | return -ENOENT; |
| 86 | } | ||
| 87 | 84 | ||
| 88 | evmcs_field = &vmcs_field_to_evmcs_1[index]; | 85 | evmcs_field = &vmcs_field_to_evmcs_1[index]; |
| 89 | 86 | ||
| 87 | /* | ||
| 88 | * Use offset=0 to detect holes in eVMCS. This offset belongs to | ||
| 89 | * 'revision_id' but this field has no encoding and is supposed to | ||
| 90 | * be accessed directly. | ||
| 91 | */ | ||
| 92 | if (unlikely(!evmcs_field->offset)) | ||
| 93 | return -ENOENT; | ||
| 94 | |||
| 90 | if (clean_field) | 95 | if (clean_field) |
| 91 | *clean_field = evmcs_field->clean_field; | 96 | *clean_field = evmcs_field->clean_field; |
| 92 | 97 | ||
| 93 | return evmcs_field->offset; | 98 | return evmcs_field->offset; |
| 94 | } | 99 | } |
| 95 | 100 | ||
| 101 | static inline u64 evmcs_read_any(struct hv_enlightened_vmcs *evmcs, | ||
| 102 | unsigned long field, u16 offset) | ||
| 103 | { | ||
| 104 | /* | ||
| 105 | * vmcs12_read_any() doesn't care whether the supplied structure | ||
| 106 | * is 'struct vmcs12' or 'struct hv_enlightened_vmcs' as it takes | ||
| 107 | * the exact offset of the required field, use it for convenience | ||
| 108 | * here. | ||
| 109 | */ | ||
| 110 | return vmcs12_read_any((void *)evmcs, field, offset); | ||
| 111 | } | ||
| 112 | |||
| 113 | #if IS_ENABLED(CONFIG_HYPERV) | ||
| 114 | |||
| 115 | static __always_inline int get_evmcs_offset(unsigned long field, | ||
| 116 | u16 *clean_field) | ||
| 117 | { | ||
| 118 | int offset = evmcs_field_offset(field, clean_field); | ||
| 119 | |||
| 120 | WARN_ONCE(offset < 0, "KVM: accessing unsupported EVMCS field %lx\n", | ||
| 121 | field); | ||
| 122 | |||
| 123 | return offset; | ||
| 124 | } | ||
| 125 | |||
| 96 | static __always_inline void evmcs_write64(unsigned long field, u64 value) | 126 | static __always_inline void evmcs_write64(unsigned long field, u64 value) |
| 97 | { | 127 | { |
| 98 | u16 clean_field; | 128 | u16 clean_field; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include <asm/mmu_context.h> | 7 | #include <asm/mmu_context.h> |
| 8 | 8 | ||
| 9 | #include "cpuid.h" | 9 | #include "cpuid.h" |
| 10 | #include "evmcs.h" | ||
| 10 | #include "hyperv.h" | 11 | #include "hyperv.h" |
| 11 | #include "mmu.h" | 12 | #include "mmu.h" |
| 12 | #include "nested.h" | 13 | #include "nested.h" |
| @@ -4851,18 +4852,20 @@ static struct vmcs *alloc_shadow_vmcs(struct kvm_vcpu *vcpu) · 4838 unmodified lines | |||
| 4851 | struct loaded_vmcs *loaded_vmcs = vmx->loaded_vmcs; | 4852 | struct loaded_vmcs *loaded_vmcs = vmx->loaded_vmcs; |
| 4852 | 4853 | ||
| 4853 | /* | 4854 | /* |
| 4854 | * We should allocate a shadow vmcs for vmcs01 only when L1 | 4855 | * KVM allocates a shadow VMCS only when L1 executes VMXON and frees it |
| 4855 | * executes VMXON and free it when L1 executes VMXOFF. | 4856 | * when L1 executes VMXOFF or the vCPU is forced out of nested |
| 4856 | * As it is invalid to execute VMXON twice, we shouldn't reach | 4857 | * operation. VMXON faults if the CPU is already post-VMXON, so it |
| 4857 | * here when vmcs01 already have an allocated shadow vmcs. | 4858 | * should be impossible to already have an allocated shadow VMCS. KVM |
| 4859 | * doesn't support virtualization of VMCS shadowing, so vmcs01 should | ||
| 4860 | * always be the loaded VMCS. | ||
| 4858 | */ | 4861 | */ |
| 4859 | WARN_ON(loaded_vmcs == &vmx->vmcs01 && loaded_vmcs->shadow_vmcs); | 4862 | if (WARN_ON(loaded_vmcs != &vmx->vmcs01 || loaded_vmcs->shadow_vmcs)) |
| 4863 | return loaded_vmcs->shadow_vmcs; | ||
| 4864 | |||
| 4865 | loaded_vmcs->shadow_vmcs = alloc_vmcs(true); | ||
| 4866 | if (loaded_vmcs->shadow_vmcs) | ||
| 4867 | vmcs_clear(loaded_vmcs->shadow_vmcs); | ||
| 4860 | 4868 | ||
| 4861 | if (!loaded_vmcs->shadow_vmcs) { | ||
| 4862 | loaded_vmcs->shadow_vmcs = alloc_vmcs(true); | ||
| 4863 | if (loaded_vmcs->shadow_vmcs) | ||
| 4864 | vmcs_clear(loaded_vmcs->shadow_vmcs); | ||
| 4865 | } | ||
| 4866 | return loaded_vmcs->shadow_vmcs; | 4869 | return loaded_vmcs->shadow_vmcs; |
| 4867 | } | 4870 | } |
| 4868 | 4871 | ||
| @@ -5099,27 +5102,49 @@ static int handle_vmread(struct kvm_vcpu *vcpu) · 230 unmodified lines | |||
| 5099 | if (!nested_vmx_check_permission(vcpu)) | 5102 | if (!nested_vmx_check_permission(vcpu)) |
| 5100 | return 1; | 5103 | return 1; |
| 5101 | 5104 | ||
| 5102 | /* | ||
| 5103 | * In VMX non-root operation, when the VMCS-link pointer is INVALID_GPA, | ||
| 5104 | * any VMREAD sets the ALU flags for VMfailInvalid. | ||
| 5105 | */ | ||
| 5106 | if (vmx->nested.current_vmptr == INVALID_GPA || | ||
| 5107 | (is_guest_mode(vcpu) && | ||
| 5108 | get_vmcs12(vcpu)->vmcs_link_pointer == INVALID_GPA)) | ||
| 5109 | return nested_vmx_failInvalid(vcpu); | ||
| 5110 | |||
| 5111 | /* Decode instruction info and find the field to read */ | 5105 | /* Decode instruction info and find the field to read */ |
| 5112 | field = kvm_register_read(vcpu, (((instr_info) >> 28) & 0xf)); | 5106 | field = kvm_register_read(vcpu, (((instr_info) >> 28) & 0xf)); |
| 5113 | 5107 | ||
| 5114 | offset = vmcs_field_to_offset(field); | 5108 | if (!evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) { |
| 5115 | if (offset < 0) | 5109 | /* |
| 5116 | return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); | 5110 | * In VMX non-root operation, when the VMCS-link pointer is INVALID_GPA, |
| 5111 | * any VMREAD sets the ALU flags for VMfailInvalid. | ||
| 5112 | */ | ||
| 5113 | if (vmx->nested.current_vmptr == INVALID_GPA || | ||
| 5114 | (is_guest_mode(vcpu) && | ||
| 5115 | get_vmcs12(vcpu)->vmcs_link_pointer == INVALID_GPA)) | ||
| 5116 | return nested_vmx_failInvalid(vcpu); | ||
| 5117 | 5117 | ||
| 5118 | if (!is_guest_mode(vcpu) && is_vmcs12_ext_field(field)) | 5118 | offset = get_vmcs12_field_offset(field); |
| 5119 | copy_vmcs02_to_vmcs12_rare(vcpu, vmcs12); | 5119 | if (offset < 0) |
| 5120 | return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); | ||
| 5121 | |||
| 5122 | if (!is_guest_mode(vcpu) && is_vmcs12_ext_field(field)) | ||
| 5123 | copy_vmcs02_to_vmcs12_rare(vcpu, vmcs12); | ||
| 5120 | 5124 | ||
| 5121 | /* Read the field, zero-extended to a u64 value */ | 5125 | /* Read the field, zero-extended to a u64 value */ |
| 5122 | value = vmcs12_read_any(vmcs12, field, offset); | 5126 | value = vmcs12_read_any(vmcs12, field, offset); |
| 5127 | } else { | ||
| 5128 | /* | ||
| 5129 | * Hyper-V TLFS (as of 6.0b) explicitly states, that while an | ||
| 5130 | * enlightened VMCS is active VMREAD/VMWRITE instructions are | ||
| 5131 | * unsupported. Unfortunately, certain versions of Windows 11 | ||
| 5132 | * don't comply with this requirement which is not enforced in | ||
| 5133 | * genuine Hyper-V. Allow VMREAD from an enlightened VMCS as a | ||
| 5134 | * workaround, as misbehaving guests will panic on VM-Fail. | ||
| 5135 | * Note, enlightened VMCS is incompatible with shadow VMCS so | ||
| 5136 | * all VMREADs from L2 should go to L1. | ||
| 5137 | */ | ||
| 5138 | if (WARN_ON_ONCE(is_guest_mode(vcpu))) | ||
| 5139 | return nested_vmx_failInvalid(vcpu); | ||
| 5140 | |||
| 5141 | offset = evmcs_field_offset(field, NULL); | ||
| 5142 | if (offset < 0) | ||
| 5143 | return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); | ||
| 5144 | |||
| 5145 | /* Read the field, zero-extended to a u64 value */ | ||
| 5146 | value = evmcs_read_any(vmx->nested.hv_evmcs, field, offset); | ||
| 5147 | } | ||
| 5123 | 5148 | ||
| 5124 | /* | 5149 | /* |
| 5125 | * Now copy part of this value to register or memory, as requested. | 5150 | * Now copy part of this value to register or memory, as requested. |
| @@ -5214,7 +5239,7 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu) · 88 unmodified lines | |||
| 5214 | 5239 | ||
| 5215 | field = kvm_register_read(vcpu, (((instr_info) >> 28) & 0xf)); | 5240 | field = kvm_register_read(vcpu, (((instr_info) >> 28) & 0xf)); |
| 5216 | 5241 | ||
| 5217 | offset = vmcs_field_to_offset(field); | 5242 | offset = get_vmcs12_field_offset(field); |
| 5218 | if (offset < 0) | 5243 | if (offset < 0) |
| 5219 | return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); | 5244 | return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); |
| 5220 | 5245 | ||
| @@ -6462,7 +6487,7 @@ static u64 nested_vmx_calc_vmcs_enum_msr(void) · 1241 unmodified lines | |||
| 6462 | max_idx = 0; | 6487 | max_idx = 0; |
| 6463 | for (i = 0; i < nr_vmcs12_fields; i++) { | 6488 | for (i = 0; i < nr_vmcs12_fields; i++) { |
| 6464 | /* The vmcs12 table is very, very sparsely populated. */ | 6489 | /* The vmcs12 table is very, very sparsely populated. */ |
| 6465 | if (!vmcs_field_to_offset_table[i]) | 6490 | if (!vmcs12_field_offsets[i]) |
| 6466 | continue; | 6491 | continue; |
| 6467 | 6492 | ||
| 6468 | idx = vmcs_field_index(VMCS12_IDX_TO_ENC(i)); | 6493 | idx = vmcs_field_index(VMCS12_IDX_TO_ENC(i)); |
| @@ -6771,6 +6796,7 @@ __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)) · 302 unmodified lines | |||
| 6771 | } | 6796 | } |
| 6772 | 6797 | ||
| 6773 | struct kvm_x86_nested_ops vmx_nested_ops = { | 6798 | struct kvm_x86_nested_ops vmx_nested_ops = { |
| 6799 | .leave_nested = vmx_leave_nested, | ||
| 6774 | .check_events = vmx_check_nested_events, | 6800 | .check_events = vmx_check_nested_events, |
| 6775 | .hv_timer_pending = nested_vmx_preemption_timer_pending, | 6801 | .hv_timer_pending = nested_vmx_preemption_timer_pending, |
| 6776 | .triple_fault = nested_vmx_triple_fault, | 6802 | .triple_fault = nested_vmx_triple_fault, |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | FIELD(number, name), \ | 8 | FIELD(number, name), \ |
| 9 | [ROL16(number##_HIGH, 6)] = VMCS12_OFFSET(name) + sizeof(u32) | 9 | [ROL16(number##_HIGH, 6)] = VMCS12_OFFSET(name) + sizeof(u32) |
| 10 | 10 | ||
| 11 | const unsigned short vmcs_field_to_offset_table[] = { | 11 | const unsigned short vmcs12_field_offsets[] = { |
| 12 | FIELD(VIRTUAL_PROCESSOR_ID, virtual_processor_id), | 12 | FIELD(VIRTUAL_PROCESSOR_ID, virtual_processor_id), |
| 13 | FIELD(POSTED_INTR_NV, posted_intr_nv), | 13 | FIELD(POSTED_INTR_NV, posted_intr_nv), |
| 14 | FIELD(GUEST_ES_SELECTOR, guest_es_selector), | 14 | FIELD(GUEST_ES_SELECTOR, guest_es_selector), |
| @@ -151,4 +151,4 @@ const unsigned short vmcs_field_to_offset_table[] = { · 136 unmodified lines | |||
| 151 | FIELD(HOST_RSP, host_rsp), | 151 | FIELD(HOST_RSP, host_rsp), |
| 152 | FIELD(HOST_RIP, host_rip), | 152 | FIELD(HOST_RIP, host_rip), |
| 153 | }; | 153 | }; |
| 154 | const unsigned int nr_vmcs12_fields = ARRAY_SIZE(vmcs_field_to_offset_table); | 154 | const unsigned int nr_vmcs12_fields = ARRAY_SIZE(vmcs12_field_offsets); |
| @@ -361,10 +361,10 @@ static inline void vmx_check_vmcs12_offsets(void) · 360 unmodified lines | |||
| 361 | CHECK_OFFSET(guest_pml_index, 996); | 361 | CHECK_OFFSET(guest_pml_index, 996); |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | extern const unsigned short vmcs_field_to_offset_table[]; | 364 | extern const unsigned short vmcs12_field_offsets[]; |
| 365 | extern const unsigned int nr_vmcs12_fields; | 365 | extern const unsigned int nr_vmcs12_fields; |
| 366 | 366 | ||
| 367 | static inline short vmcs_field_to_offset(unsigned long field) | 367 | static inline short get_vmcs12_field_offset(unsigned long field) |
| 368 | { | 368 | { |
| 369 | unsigned short offset; | 369 | unsigned short offset; |
| 370 | unsigned int index; | 370 | unsigned int index; |
| @@ -377,7 +377,7 @@ static inline short vmcs_field_to_offset(unsigned long field) · 6 unmodified lines | |||
| 377 | return -ENOENT; | 377 | return -ENOENT; |
| 378 | 378 | ||
| 379 | index = array_index_nospec(index, nr_vmcs12_fields); | 379 | index = array_index_nospec(index, nr_vmcs12_fields); |
| 380 | offset = vmcs_field_to_offset_table[index]; | 380 | offset = vmcs12_field_offsets[index]; |
| 381 | if (offset == 0) | 381 | if (offset == 0) |
| 382 | return -ENOENT; | 382 | return -ENOENT; |
| 383 | return offset; | 383 | return offset; |
| @@ -1487,11 +1487,12 @@ static int vmx_rtit_ctl_check(struct kvm_vcpu *vcpu, u64 data) · 1486 unmodified lines | |||
| 1487 | return 0; | 1487 | return 0; |
| 1488 | } | 1488 | } |
| 1489 | 1489 | ||
| 1490 | static bool vmx_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int insn_len) | 1490 | static bool vmx_can_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type, |
| 1491 | void *insn, int insn_len) | ||
| 1491 | { | 1492 | { |
| 1492 | /* | 1493 | /* |
| 1493 | * Emulation of instructions in SGX enclaves is impossible as RIP does | 1494 | * Emulation of instructions in SGX enclaves is impossible as RIP does |
| 1494 | * not point tthe failing instruction, and even if it did, the code | 1495 | * not point at the failing instruction, and even if it did, the code |
| 1495 | * stream is inaccessible. Inject #UD instead of exiting to userspace | 1496 | * stream is inaccessible. Inject #UD instead of exiting to userspace |
| 1496 | * so that guest userspace can't DoS the guest simply by triggering | 1497 | * so that guest userspace can't DoS the guest simply by triggering |
| 1497 | * emulation (enclaves are CPL3 only). | 1498 | * emulation (enclaves are CPL3 only). |
| @@ -2603,7 +2604,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, · 1105 unmodified lines | |||
| 2603 | return -EIO; | 2604 | return -EIO; |
| 2604 | 2605 | ||
| 2605 | vmcs_conf->size = vmx_msr_high & 0x1fff; | 2606 | vmcs_conf->size = vmx_msr_high & 0x1fff; |
| 2606 | vmcs_conf->order = get_order(vmcs_conf->size); | ||
| 2607 | vmcs_conf->basic_cap = vmx_msr_high & ~0x1fff; | 2607 | vmcs_conf->basic_cap = vmx_msr_high & ~0x1fff; |
| 2608 | 2608 | ||
| 2609 | vmcs_conf->revision_id = vmx_msr_low; | 2609 | vmcs_conf->revision_id = vmx_msr_low; |
| @@ -2628,7 +2628,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags) · 18 unmodified lines | |||
| 2628 | struct page *pages; | 2628 | struct page *pages; |
| 2629 | struct vmcs *vmcs; | 2629 | struct vmcs *vmcs; |
| 2630 | 2630 | ||
| 2631 | pages = __alloc_pages_node(node, flags, vmcs_config.order); | 2631 | pages = __alloc_pages_node(node, flags, 0); |
| 2632 | if (!pages) | 2632 | if (!pages) |
| 2633 | return NULL; | 2633 | return NULL; |
| 2634 | vmcs = page_address(pages); | 2634 | vmcs = page_address(pages); |
| @@ -2647,7 +2647,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags) · 12 unmodified lines | |||
| 2647 | 2647 | ||
| 2648 | void free_vmcs(struct vmcs *vmcs) | 2648 | void free_vmcs(struct vmcs *vmcs) |
| 2649 | { | 2649 | { |
| 2650 | free_pages((unsigned long)vmcs, vmcs_config.order); | 2650 | free_page((unsigned long)vmcs); |
| 2651 | } | 2651 | } |
| 2652 | 2652 | ||
| 2653 | /* | 2653 | /* |
| @@ -4094,10 +4094,14 @@ void vmx_set_constant_host_state(struct vcpu_vmx *vmx) · 1440 unmodified lines | |||
| 4094 | vmcs_write32(HOST_IA32_SYSENTER_CS, low32); | 4094 | vmcs_write32(HOST_IA32_SYSENTER_CS, low32); |
| 4095 | 4095 | ||
| 4096 | /* | 4096 | /* |
| 4097 | * If 32-bit syscall is enabled, vmx_vcpu_load_vcms rewrites | 4097 | * SYSENTER is used for 32-bit system calls on either 32-bit or |
| 4098 | * HOST_IA32_SYSENTER_ESP. | 4098 | * 64-bit kernels. It is always zero If neither is allowed, otherwise |
| 4099 | * vmx_vcpu_load_vmcs loads it with the per-CPU entry stack (and may | ||
| 4100 | * have already done so!). | ||
| 4099 | */ | 4101 | */ |
| 4100 | vmcs_writel(HOST_IA32_SYSENTER_ESP, 0); | 4102 | if (!IS_ENABLED(CONFIG_IA32_EMULATION) && !IS_ENABLED(CONFIG_X86_32)) |
| 4103 | vmcs_writel(HOST_IA32_SYSENTER_ESP, 0); | ||
| 4104 | |||
| 4101 | rdmsrl(MSR_IA32_SYSENTER_EIP, tmpl); | 4105 | rdmsrl(MSR_IA32_SYSENTER_EIP, tmpl); |
| 4102 | vmcs_writel(HOST_IA32_SYSENTER_EIP, tmpl); /* 22.2.3 */ | 4106 | vmcs_writel(HOST_IA32_SYSENTER_EIP, tmpl); /* 22.2.3 */ |
| 4103 | 4107 | ||
| @@ -4901,8 +4905,33 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) · 797 unmodified lines | |||
| 4901 | dr6 = vmx_get_exit_qual(vcpu); | 4905 | dr6 = vmx_get_exit_qual(vcpu); |
| 4902 | if (!(vcpu->guest_debug & | 4906 | if (!(vcpu->guest_debug & |
| 4903 | (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) { | 4907 | (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) { |
| 4908 | /* | ||
| 4909 | * If the #DB was due to ICEBP, a.k.a. INT1, skip the | ||
| 4910 | * instruction. ICEBP generates a trap-like #DB, but | ||
| 4911 | * despite its interception control being tied to #DB, | ||
| 4912 | * is an instruction intercept, i.e. the VM-Exit occurs | ||
| 4913 | * on the ICEBP itself. Note, skipping ICEBP also | ||
| 4914 | * clears STI and MOVSS blocking. | ||
| 4915 | * | ||
| 4916 | * For all other #DBs, set vmcs.PENDING_DBG_EXCEPTIONS.BS | ||
| 4917 | * if single-step is enabled in RFLAGS and STI or MOVSS | ||
| 4918 | * blocking is active, as the CPU doesn't set the bit | ||
| 4919 | * on VM-Exit due to #DB interception. VM-Entry has a | ||
| 4920 | * consistency check that a single-step #DB is pending | ||
| 4921 | * in this scenario as the previous instruction cannot | ||
| 4922 | * have toggled RFLAGS.TF 0=>1 (because STI and POP/MOV | ||
| 4923 | * don't modify RFLAGS), therefore the one instruction | ||
| 4924 | * delay when activating single-step breakpoints must | ||
| 4925 | * have already expired. Note, the CPU sets/clears BS | ||
| 4926 | * as appropriate for all other VM-Exits types. | ||
| 4927 | */ | ||
| 4904 | if (is_icebp(intr_info)) | 4928 | if (is_icebp(intr_info)) |
| 4905 | WARN_ON(!skip_emulated_instruction(vcpu)); | 4929 | WARN_ON(!skip_emulated_instruction(vcpu)); |
| 4930 | else if ((vmx_get_rflags(vcpu) & X86_EFLAGS_TF) && | ||
| 4931 | (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & | ||
| 4932 | (GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS))) | ||
| 4933 | vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, | ||
| 4934 | vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS) | DR6_BS); | ||
| 4906 | 4935 | ||
| 4907 | kvm_queue_exception_p(vcpu, DB_VECTOR, dr6); | 4936 | kvm_queue_exception_p(vcpu, DB_VECTOR, dr6); |
| 4908 | return 1; | 4937 | return 1; |
| @@ -5397,7 +5426,7 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu) · 488 unmodified lines | |||
| 5397 | { | 5426 | { |
| 5398 | gpa_t gpa; | 5427 | gpa_t gpa; |
| 5399 | 5428 | ||
| 5400 | if (!vmx_can_emulate_instruction(vcpu, NULL, 0)) | 5429 | if (!vmx_can_emulate_instruction(vcpu, EMULTYPE_PF, NULL, 0)) |
| 5401 | return 1; | 5430 | return 1; |
| 5402 | 5431 | ||
| 5403 | /* | 5432 | /* |
| @@ -3535,6 +3535,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 3534 unmodified lines | |||
| 3535 | if (data & ~supported_xss) | 3535 | if (data & ~supported_xss) |
| 3536 | return 1; | 3536 | return 1; |
| 3537 | vcpu->arch.ia32_xss = data; | 3537 | vcpu->arch.ia32_xss = data; |
| 3538 | kvm_update_cpuid_runtime(vcpu); | ||
| 3538 | break; | 3539 | break; |
| 3539 | case MSR_SMI_COUNT: | 3540 | case MSR_SMI_COUNT: |
| 3540 | if (!msr_info->host_initiated) | 3541 | if (!msr_info->host_initiated) |
| @@ -4229,6 +4230,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 688 unmodified lines | |||
| 4229 | case KVM_CAP_SREGS2: | 4230 | case KVM_CAP_SREGS2: |
| 4230 | case KVM_CAP_EXIT_ON_EMULATION_FAILURE: | 4231 | case KVM_CAP_EXIT_ON_EMULATION_FAILURE: |
| 4231 | case KVM_CAP_VCPU_ATTRIBUTES: | 4232 | case KVM_CAP_VCPU_ATTRIBUTES: |
| 4233 | case KVM_CAP_SYS_ATTRIBUTES: | ||
| 4232 | r = 1; | 4234 | r = 1; |
| 4233 | break; | 4235 | break; |
| 4234 | case KVM_CAP_EXIT_HYPERCALL: | 4236 | case KVM_CAP_EXIT_HYPERCALL: |
| @@ -4331,7 +4333,49 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 96 unmodified lines | |||
| 4331 | break; | 4333 | break; |
| 4332 | } | 4334 | } |
| 4333 | return r; | 4335 | return r; |
| 4336 | } | ||
| 4337 | |||
| 4338 | static inline void __user *kvm_get_attr_addr(struct kvm_device_attr *attr) | ||
| 4339 | { | ||
| 4340 | void __user *uaddr = (void __user*)(unsigned long)attr->addr; | ||
| 4334 | 4341 | ||
| 4342 | if ((u64)(unsigned long)uaddr != attr->addr) | ||
| 4343 | return ERR_PTR(-EFAULT); | ||
| 4344 | return uaddr; | ||
| 4345 | } | ||
| 4346 | |||
| 4347 | static int kvm_x86_dev_get_attr(struct kvm_device_attr *attr) | ||
| 4348 | { | ||
| 4349 | u64 __user *uaddr = kvm_get_attr_addr(attr); | ||
| 4350 | |||
| 4351 | if (attr->group) | ||
| 4352 | return -ENXIO; | ||
| 4353 | |||
| 4354 | if (IS_ERR(uaddr)) | ||
| 4355 | return PTR_ERR(uaddr); | ||
| 4356 | |||
| 4357 | switch (attr->attr) { | ||
| 4358 | case KVM_X86_XCOMP_GUEST_SUPP: | ||
| 4359 | if (put_user(supported_xcr0, uaddr)) | ||
| 4360 | return -EFAULT; | ||
| 4361 | return 0; | ||
| 4362 | default: | ||
| 4363 | return -ENXIO; | ||
| 4364 | break; | ||
| 4365 | } | ||
| 4366 | } | ||
| 4367 | |||
| 4368 | static int kvm_x86_dev_has_attr(struct kvm_device_attr *attr) | ||
| 4369 | { | ||
| 4370 | if (attr->group) | ||
| 4371 | return -ENXIO; | ||
| 4372 | |||
| 4373 | switch (attr->attr) { | ||
| 4374 | case KVM_X86_XCOMP_GUEST_SUPP: | ||
| 4375 | return 0; | ||
| 4376 | default: | ||
| 4377 | return -ENXIO; | ||
| 4378 | } | ||
| 4335 | } | 4379 | } |
| 4336 | 4380 | ||
| 4337 | long kvm_arch_dev_ioctl(struct file *filp, | 4381 | long kvm_arch_dev_ioctl(struct file *filp, |
| @@ -4422,6 +4466,22 @@ long kvm_arch_dev_ioctl(struct file *filp, · 84 unmodified lines | |||
| 4422 | case KVM_GET_SUPPORTED_HV_CPUID: | 4466 | case KVM_GET_SUPPORTED_HV_CPUID: |
| 4423 | r = kvm_ioctl_get_supported_hv_cpuid(NULL, argp); | 4467 | r = kvm_ioctl_get_supported_hv_cpuid(NULL, argp); |
| 4424 | break; | 4468 | break; |
| 4469 | case KVM_GET_DEVICE_ATTR: { | ||
| 4470 | struct kvm_device_attr attr; | ||
| 4471 | r = -EFAULT; | ||
| 4472 | if (copy_from_user(&attr, (void __user *)arg, sizeof(attr))) | ||
| 4473 | break; | ||
| 4474 | r = kvm_x86_dev_get_attr(&attr); | ||
| 4475 | break; | ||
| 4476 | } | ||
| 4477 | case KVM_HAS_DEVICE_ATTR: { | ||
| 4478 | struct kvm_device_attr attr; | ||
| 4479 | r = -EFAULT; | ||
| 4480 | if (copy_from_user(&attr, (void __user *)arg, sizeof(attr))) | ||
| 4481 | break; | ||
| 4482 | r = kvm_x86_dev_has_attr(&attr); | ||
| 4483 | break; | ||
| 4484 | } | ||
| 4425 | default: | 4485 | default: |
| 4426 | r = -EINVAL; | 4486 | r = -EINVAL; |
| 4427 | break; | 4487 | break; |
| @@ -4860,8 +4920,10 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, · 432 unmodified lines | |||
| 4860 | vcpu->arch.apic->sipi_vector = events->sipi_vector; | 4920 | vcpu->arch.apic->sipi_vector = events->sipi_vector; |
| 4861 | 4921 | ||
| 4862 | if (events->flags & KVM_VCPUEVENT_VALID_SMM) { | 4922 | if (events->flags & KVM_VCPUEVENT_VALID_SMM) { |
| 4863 | if (!!(vcpu->arch.hflags & HF_SMM_MASK) != events->smi.smm) | 4923 | if (!!(vcpu->arch.hflags & HF_SMM_MASK) != events->smi.smm) { |
| 4924 | kvm_x86_ops.nested_ops->leave_nested(vcpu); | ||
| 4864 | kvm_smm_changed(vcpu, events->smi.smm); | 4925 | kvm_smm_changed(vcpu, events->smi.smm); |
| 4926 | } | ||
| 4865 | 4927 | ||
| 4866 | vcpu->arch.smi_pending = events->smi.pending; | 4928 | vcpu->arch.smi_pending = events->smi.pending; |
| 4867 | 4929 | ||
| @@ -5022,11 +5084,11 @@ static int kvm_arch_tsc_has_attr(struct kvm_vcpu *vcpu, · 154 unmodified lines | |||
| 5022 | static int kvm_arch_tsc_get_attr(struct kvm_vcpu *vcpu, | 5084 | static int kvm_arch_tsc_get_attr(struct kvm_vcpu *vcpu, |
| 5023 | struct kvm_device_attr *attr) | 5085 | struct kvm_device_attr *attr) |
| 5024 | { | 5086 | { |
| 5025 | u64 __user *uaddr = (u64 __user *)(unsigned long)attr->addr; | 5087 | u64 __user *uaddr = kvm_get_attr_addr(attr); |
| 5026 | int r; | 5088 | int r; |
| 5027 | 5089 | ||
| 5028 | if ((u64)(unsigned long)uaddr != attr->addr) | 5090 | if (IS_ERR(uaddr)) |
| 5029 | return -EFAULT; | 5091 | return PTR_ERR(uaddr); |
| 5030 | 5092 | ||
| 5031 | switch (attr->attr) { | 5093 | switch (attr->attr) { |
| 5032 | case KVM_VCPU_TSC_OFFSET: | 5094 | case KVM_VCPU_TSC_OFFSET: |
| @@ -5045,12 +5107,12 @@ static int kvm_arch_tsc_get_attr(struct kvm_vcpu *vcpu, · 12 unmodified lines | |||
| 5045 | static int kvm_arch_tsc_set_attr(struct kvm_vcpu *vcpu, | 5107 | static int kvm_arch_tsc_set_attr(struct kvm_vcpu *vcpu, |
| 5046 | struct kvm_device_attr *attr) | 5108 | struct kvm_device_attr *attr) |
| 5047 | { | 5109 | { |
| 5048 | u64 __user *uaddr = (u64 __user *)(unsigned long)attr->addr; | 5110 | u64 __user *uaddr = kvm_get_attr_addr(attr); |
| 5049 | struct kvm *kvm = vcpu->kvm; | 5111 | struct kvm *kvm = vcpu->kvm; |
| 5050 | int r; | 5112 | int r; |
| 5051 | 5113 | ||
| 5052 | if ((u64)(unsigned long)uaddr != attr->addr) | 5114 | if (IS_ERR(uaddr)) |
| 5053 | return -EFAULT; | 5115 | return PTR_ERR(uaddr); |
| 5054 | 5116 | ||
| 5055 | switch (attr->attr) { | 5117 | switch (attr->attr) { |
| 5056 | case KVM_VCPU_TSC_OFFSET: { | 5118 | case KVM_VCPU_TSC_OFFSET: { |
| @@ -6810,6 +6872,13 @@ int kvm_write_guest_virt_system(struct kvm_vcpu *vcpu, gva_t addr, void *val, · 1753 unmodified lines | |||
| 6810 | } | 6872 | } |
| 6811 | EXPORT_SYMBOL_GPL(kvm_write_guest_virt_system); | 6873 | EXPORT_SYMBOL_GPL(kvm_write_guest_virt_system); |
| 6812 | 6874 | ||
| 6875 | static int kvm_can_emulate_insn(struct kvm_vcpu *vcpu, int emul_type, | ||
| 6876 | void *insn, int insn_len) | ||
| 6877 | { | ||
| 6878 | return static_call(kvm_x86_can_emulate_instruction)(vcpu, emul_type, | ||
| 6879 | insn, insn_len); | ||
| 6880 | } | ||
| 6881 | |||
| 6813 | int handle_ud(struct kvm_vcpu *vcpu) | 6882 | int handle_ud(struct kvm_vcpu *vcpu) |
| 6814 | { | 6883 | { |
| 6815 | static const char kvm_emulate_prefix[] = { __KVM_EMULATE_PREFIX }; | 6884 | static const char kvm_emulate_prefix[] = { __KVM_EMULATE_PREFIX }; |
| @@ -6817,7 +6886,7 @@ int handle_ud(struct kvm_vcpu *vcpu) · 1 unmodified line | |||
| 6817 | char sig[5]; /* ud2; .ascii "kvm" */ | 6886 | char sig[5]; /* ud2; .ascii "kvm" */ |
| 6818 | struct x86_exception e; | 6887 | struct x86_exception e; |
| 6819 | 6888 | ||
| 6820 | if (unlikely(!static_call(kvm_x86_can_emulate_instruction)(vcpu, NULL, 0))) | 6889 | if (unlikely(!kvm_can_emulate_insn(vcpu, emul_type, NULL, 0))) |
| 6821 | return 1; | 6890 | return 1; |
| 6822 | 6891 | ||
| 6823 | if (force_emulation_prefix && | 6892 | if (force_emulation_prefix && |
| @@ -8193,7 +8262,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, · 1369 unmodified lines | |||
| 8193 | bool writeback = true; | 8262 | bool writeback = true; |
| 8194 | bool write_fault_to_spt; | 8263 | bool write_fault_to_spt; |
| 8195 | 8264 | ||
| 8196 | if (unlikely(!static_call(kvm_x86_can_emulate_instruction)(vcpu, insn, insn_len))) | 8265 | if (unlikely(!kvm_can_emulate_insn(vcpu, emulation_type, insn, insn_len))) |
| 8197 | return 1; | 8266 | return 1; |
| 8198 | 8267 | ||
| 8199 | vcpu->arch.l1tf_flush_l1d = true; | 8268 | vcpu->arch.l1tf_flush_l1d = true; |
| @@ -9706,7 +9775,7 @@ void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, · 1506 unmodified lines | |||
| 9706 | kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD); | 9775 | kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD); |
| 9707 | } | 9776 | } |
| 9708 | 9777 | ||
| 9709 | void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) | 9778 | static void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) |
| 9710 | { | 9779 | { |
| 9711 | if (!lapic_in_kernel(vcpu)) | 9780 | if (!lapic_in_kernel(vcpu)) |
| 9712 | return; | 9781 | return; |
| @@ -11209,7 +11278,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 1496 unmodified lines | |||
| 11209 | 11278 | ||
| 11210 | vcpu->arch.msr_misc_features_enables = 0; | 11279 | vcpu->arch.msr_misc_features_enables = 0; |
| 11211 | 11280 | ||
| 11212 | vcpu->arch.xcr0 = XFEATURE_MASK_FP; | 11281 | __kvm_set_xcr(vcpu, 0, XFEATURE_MASK_FP); |
| 11282 | __kvm_set_msr(vcpu, MSR_IA32_XSS, 0, true); | ||
| 11213 | } | 11283 | } |
| 11214 | 11284 | ||
| 11215 | /* All GPRs except RDX (handled below) are zeroed on RESET/INIT. */ | 11285 | /* All GPRs except RDX (handled below) are zeroed on RESET/INIT. */ |
| @@ -11226,8 +11296,6 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 10 unmodified lines | |||
| 11226 | cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1, 0); | 11296 | cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1, 0); |
| 11227 | kvm_rdx_write(vcpu, cpuid_0x1 ? cpuid_0x1->eax : 0x600); | 11297 | kvm_rdx_write(vcpu, cpuid_0x1 ? cpuid_0x1->eax : 0x600); |
| 11228 | 11298 | ||
| 11229 | vcpu->arch.ia32_xss = 0; | ||
| 11230 | |||
| 11231 | static_call(kvm_x86_vcpu_reset)(vcpu, init_event); | 11299 | static_call(kvm_x86_vcpu_reset)(vcpu, init_event); |
| 11232 | 11300 | ||
| 11233 | kvm_set_rflags(vcpu, X86_EFLAGS_FIXED); | 11301 | kvm_set_rflags(vcpu, X86_EFLAGS_FIXED); |
| @@ -316,10 +316,7 @@ int __kvm_xen_has_interrupt(struct kvm_vcpu *v) · 315 unmodified lines | |||
| 316 | "\tnotq %0\n" | 316 | "\tnotq %0\n" |
| 317 | "\t" LOCK_PREFIX "andq %0, %2\n" | 317 | "\t" LOCK_PREFIX "andq %0, %2\n" |
| 318 | "2:\n" | 318 | "2:\n" |
| 319 | "\t.section .fixup,\"ax\"\n" | 319 | _ASM_EXTABLE_UA(1b, 2b) |
| 320 | "3:\tjmp\t2b\n" | ||
| 321 | "\t.previous\n" | ||
| 322 | _ASM_EXTABLE_UA(1b, 3b) | ||
| 323 | : "=r" (evtchn_pending_sel), | 320 | : "=r" (evtchn_pending_sel), |
| 324 | "+m" (vi->evtchn_pending_sel), | 321 | "+m" (vi->evtchn_pending_sel), |
| 325 | "+m" (v->arch.xen.evtchn_pending_sel) | 322 | "+m" (v->arch.xen.evtchn_pending_sel) |
| @@ -335,10 +332,7 @@ int __kvm_xen_has_interrupt(struct kvm_vcpu *v) · 9 unmodified lines | |||
| 335 | "\tnotl %0\n" | 332 | "\tnotl %0\n" |
| 336 | "\t" LOCK_PREFIX "andl %0, %2\n" | 333 | "\t" LOCK_PREFIX "andl %0, %2\n" |
| 337 | "2:\n" | 334 | "2:\n" |
| 338 | "\t.section .fixup,\"ax\"\n" | 335 | _ASM_EXTABLE_UA(1b, 2b) |
| 339 | "3:\tjmp\t2b\n" | ||
| 340 | "\t.previous\n" | ||
| 341 | _ASM_EXTABLE_UA(1b, 3b) | ||
| 342 | : "=r" (evtchn_pending_sel32), | 336 | : "=r" (evtchn_pending_sel32), |
| 343 | "+m" (vi->evtchn_pending_sel), | 337 | "+m" (vi->evtchn_pending_sel), |
| 344 | "+m" (v->arch.xen.evtchn_pending_sel) | 338 | "+m" (v->arch.xen.evtchn_pending_sel) |
| @@ -353,8 +353,8 @@ static void pci_fixup_video(struct pci_dev *pdev) · 352 unmodified lines | |||
| 353 | } | 353 | } |
| 354 | } | 354 | } |
| 355 | } | 355 | } |
| 356 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, | 356 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, |
| 357 | PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); | 357 | PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
| 358 | 358 | ||
| 359 | 359 | ||
| 360 | static const struct dmi_system_id msi_k8t_dmi_table[] = { | 360 | static const struct dmi_system_id msi_k8t_dmi_table[] = { |
| @@ -1061,20 +1061,32 @@ again: · 1060 unmodified lines | |||
| 1061 | } | 1061 | } |
| 1062 | 1062 | ||
| 1063 | static unsigned long __part_start_io_acct(struct block_device *part, | 1063 | static unsigned long __part_start_io_acct(struct block_device *part, |
| 1064 | unsigned int sectors, unsigned int op) | 1064 | unsigned int sectors, unsigned int op, |
| 1065 | unsigned long start_time) | ||
| 1065 | { | 1066 | { |
| 1066 | const int sgrp = op_stat_group(op); | 1067 | const int sgrp = op_stat_group(op); |
| 1067 | unsigned long now = READ_ONCE(jiffies); | ||
| 1068 | 1068 | ||
| 1069 | part_stat_lock(); | 1069 | part_stat_lock(); |
| 1070 | update_io_ticks(part, now, false); | 1070 | update_io_ticks(part, start_time, false); |
| 1071 | part_stat_inc(part, ios[sgrp]); | 1071 | part_stat_inc(part, ios[sgrp]); |
| 1072 | part_stat_add(part, sectors[sgrp], sectors); | 1072 | part_stat_add(part, sectors[sgrp], sectors); |
| 1073 | part_stat_local_inc(part, in_flight[op_is_write(op)]); | 1073 | part_stat_local_inc(part, in_flight[op_is_write(op)]); |
| 1074 | part_stat_unlock(); | 1074 | part_stat_unlock(); |
| 1075 | 1075 | ||
| 1076 | return now; | 1076 | return start_time; |
| 1077 | } | ||
| 1078 | |||
| 1079 | /** | ||
| 1080 | * bio_start_io_acct_time - start I/O accounting for bio based drivers | ||
| 1081 | * @bio: bio to start account for | ||
| 1082 | * @start_time: start time that should be passed back to bio_end_io_acct(). | ||
| 1083 | */ | ||
| 1084 | void bio_start_io_acct_time(struct bio *bio, unsigned long start_time) | ||
| 1085 | { | ||
| 1086 | __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), | ||
| 1087 | bio_op(bio), start_time); | ||
| 1077 | } | 1088 | } |
| 1089 | EXPORT_SYMBOL_GPL(bio_start_io_acct_time); | ||
| 1078 | 1090 | ||
| 1079 | /** | 1091 | /** |
| 1080 | * bio_start_io_acct - start I/O accounting for bio based drivers | 1092 | * bio_start_io_acct - start I/O accounting for bio based drivers |
| @@ -1084,14 +1096,15 @@ static unsigned long __part_start_io_acct(struct block_device *part, · 3 unmodified lines | |||
| 1084 | */ | 1096 | */ |
| 1085 | unsigned long bio_start_io_acct(struct bio *bio) | 1097 | unsigned long bio_start_io_acct(struct bio *bio) |
| 1086 | { | 1098 | { |
| 1087 | return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), bio_op(bio)); | 1099 | return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), |
| 1100 | bio_op(bio), jiffies); | ||
| 1088 | } | 1101 | } |
| 1089 | EXPORT_SYMBOL_GPL(bio_start_io_acct); | 1102 | EXPORT_SYMBOL_GPL(bio_start_io_acct); |
| 1090 | 1103 | ||
| 1091 | unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, | 1104 | unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, |
| 1092 | unsigned int op) | 1105 | unsigned int op) |
| 1093 | { | 1106 | { |
| 1094 | return __part_start_io_acct(disk->part0, sectors, op); | 1107 | return __part_start_io_acct(disk->part0, sectors, op, jiffies); |
| 1095 | } | 1108 | } |
| 1096 | EXPORT_SYMBOL(disk_start_io_acct); | 1109 | EXPORT_SYMBOL(disk_start_io_acct); |
| 1097 | 1110 | ||
| @@ -144,7 +144,7 @@ int disk_register_independent_access_ranges(struct gendisk *disk, · 143 unmodified lines | |||
| 144 | &q->kobj, "%s", "independent_access_ranges"); | 144 | &q->kobj, "%s", "independent_access_ranges"); |
| 145 | if (ret) { | 145 | if (ret) { |
| 146 | q->ia_ranges = NULL; | 146 | q->ia_ranges = NULL; |
| 147 | kfree(iars); | 147 | kobject_put(&iars->kobj); |
| 148 | return ret; | 148 | return ret; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| @@ -2922,6 +2922,8 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request * · 2921 unmodified lines | |||
| 2922 | */ | 2922 | */ |
| 2923 | blk_mq_run_dispatch_ops(rq->q, | 2923 | blk_mq_run_dispatch_ops(rq->q, |
| 2924 | ret = blk_mq_request_issue_directly(rq, true)); | 2924 | ret = blk_mq_request_issue_directly(rq, true)); |
| 2925 | if (ret) | ||
| 2926 | blk_account_io_done(rq, ktime_get_ns()); | ||
| 2925 | return ret; | 2927 | return ret; |
| 2926 | } | 2928 | } |
| 2927 | EXPORT_SYMBOL_GPL(blk_insert_cloned_request); | 2929 | EXPORT_SYMBOL_GPL(blk_insert_cloned_request); |
| @@ -128,6 +128,8 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res, · 127 unmodified lines | |||
| 128 | ap = host->ports[0]; | 128 | ap = host->ports[0]; |
| 129 | 129 | ||
| 130 | ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL); | 130 | ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL); |
| 131 | if (!ap->ops) | ||
| 132 | return -ENOMEM; | ||
| 131 | ap->ops->inherits = &ata_sff_port_ops; | 133 | ap->ops->inherits = &ata_sff_port_ops; |
| 132 | ap->ops->cable_detect = ata_cable_unknown; | 134 | ap->ops->cable_detect = ata_cable_unknown; |
| 133 | ap->ops->set_mode = pata_platform_set_mode; | 135 | ap->ops->set_mode = pata_platform_set_mode; |
| @@ -90,10 +90,8 @@ struct counter_device *counter_alloc(size_t sizeof_priv) · 89 unmodified lines | |||
| 90 | int err; | 90 | int err; |
| 91 | 91 | ||
| 92 | ch = kzalloc(sizeof(*ch) + sizeof_priv, GFP_KERNEL); | 92 | ch = kzalloc(sizeof(*ch) + sizeof_priv, GFP_KERNEL); |
| 93 | if (!ch) { | 93 | if (!ch) |
| 94 | err = -ENOMEM; | 94 | return NULL; |
| 95 | goto err_alloc_ch; | ||
| 96 | } | ||
| 97 | 95 | ||
| 98 | counter = &ch->counter; | 96 | counter = &ch->counter; |
| 99 | dev = &counter->dev; | 97 | dev = &counter->dev; |
| @@ -123,9 +121,8 @@ err_chrdev_add: · 23 unmodified lines | |||
| 123 | err_ida_alloc: | 121 | err_ida_alloc: |
| 124 | 122 | ||
| 125 | kfree(ch); | 123 | kfree(ch); |
| 126 | err_alloc_ch: | ||
| 127 | 124 | ||
| 128 | return ERR_PTR(err); | 125 | return NULL; |
| 129 | } | 126 | } |
| 130 | EXPORT_SYMBOL_GPL(counter_alloc); | 127 | EXPORT_SYMBOL_GPL(counter_alloc); |
| 131 | 128 | ||
| @@ -208,12 +205,12 @@ struct counter_device *devm_counter_alloc(struct device *dev, size_t sizeof_priv · 76 unmodified lines | |||
| 208 | int err; | 205 | int err; |
| 209 | 206 | ||
| 210 | counter = counter_alloc(sizeof_priv); | 207 | counter = counter_alloc(sizeof_priv); |
| 211 | if (IS_ERR(counter)) | 208 | if (!counter) |
| 212 | return counter; | 209 | return NULL; |
| 213 | 210 | ||
| 214 | err = devm_add_action_or_reset(dev, devm_counter_put, counter); | 211 | err = devm_add_action_or_reset(dev, devm_counter_put, counter); |
| 215 | if (err < 0) | 212 | if (err < 0) |
| 216 | return ERR_PTR(err); | 213 | return NULL; |
| 217 | 214 | ||
| 218 | return counter; | 215 | return counter; |
| 219 | } | 216 | } |
| @@ -722,6 +722,13 @@ void __init efi_systab_report_header(const efi_table_hdr_t *systab_hdr, · 721 unmodified lines | |||
| 722 | systab_hdr->revision >> 16, | 722 | systab_hdr->revision >> 16, |
| 723 | systab_hdr->revision & 0xffff, | 723 | systab_hdr->revision & 0xffff, |
| 724 | vendor); | 724 | vendor); |
| 725 | |||
| 726 | if (IS_ENABLED(CONFIG_X86_64) && | ||
| 727 | systab_hdr->revision > EFI_1_10_SYSTEM_TABLE_REVISION && | ||
| 728 | !strcmp(vendor, "Apple")) { | ||
| 729 | pr_info("Apple Mac detected, using EFI v1.10 runtime services only\n"); | ||
| 730 | efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION; | ||
| 731 | } | ||
| 725 | } | 732 | } |
| 726 | 733 | ||
| 727 | static __initdata char memory_type_name[][13] = { | 734 | static __initdata char memory_type_name[][13] = { |
| @@ -119,9 +119,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, · 118 unmodified lines | |||
| 119 | if (image->image_base != _text) | 119 | if (image->image_base != _text) |
| 120 | efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n"); | 120 | efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n"); |
| 121 | 121 | ||
| 122 | if (!IS_ALIGNED((u64)_text, EFI_KIMG_ALIGN)) | 122 | if (!IS_ALIGNED((u64)_text, SEGMENT_ALIGN)) |
| 123 | efi_err("FIRMWARE BUG: kernel image not aligned on %ldk boundary\n", | 123 | efi_err("FIRMWARE BUG: kernel image not aligned on %dk boundary\n", |
| 124 | EFI_KIMG_ALIGN >> 10); | 124 | SEGMENT_ALIGN >> 10); |
| 125 | 125 | ||
| 126 | kernel_size = _edata - _text; | 126 | kernel_size = _edata - _text; |
| 127 | kernel_memsize = kernel_size + (_end - _edata); | 127 | kernel_memsize = kernel_size + (_end - _edata); |
| @@ -816,7 +816,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 815 unmodified lines | |||
| 816 | 816 | ||
| 817 | properties[prop_idx++] = PROPERTY_ENTRY_U32("ngpios", bank->num_lines); | 817 | properties[prop_idx++] = PROPERTY_ENTRY_U32("ngpios", bank->num_lines); |
| 818 | 818 | ||
| 819 | if (bank->label) | 819 | if (bank->label && (strlen(bank->label) > 0)) |
| 820 | properties[prop_idx++] = PROPERTY_ENTRY_STRING("gpio-sim,label", | 820 | properties[prop_idx++] = PROPERTY_ENTRY_STRING("gpio-sim,label", |
| 821 | bank->label); | 821 | bank->label); |
| 822 | 822 | ||
| @@ -1525,6 +1525,87 @@ static const u16 amdgpu_unsupported_pciidlist[] = { · 1524 unmodified lines | |||
| 1525 | 0x99A0, | 1525 | 0x99A0, |
| 1526 | 0x99A2, | 1526 | 0x99A2, |
| 1527 | 0x99A4, | 1527 | 0x99A4, |
| 1528 | /* radeon secondary ids */ | ||
| 1529 | 0x3171, | ||
| 1530 | 0x3e70, | ||
| 1531 | 0x4164, | ||
| 1532 | 0x4165, | ||
| 1533 | 0x4166, | ||
| 1534 | 0x4168, | ||
| 1535 | 0x4170, | ||
| 1536 | 0x4171, | ||
| 1537 | 0x4172, | ||
| 1538 | 0x4173, | ||
| 1539 | 0x496e, | ||
| 1540 | 0x4a69, | ||
| 1541 | 0x4a6a, | ||
| 1542 | 0x4a6b, | ||
| 1543 | 0x4a70, | ||
| 1544 | 0x4a74, | ||
| 1545 | 0x4b69, | ||
| 1546 | 0x4b6b, | ||
| 1547 | 0x4b6c, | ||
| 1548 | 0x4c6e, | ||
| 1549 | 0x4e64, | ||
| 1550 | 0x4e65, | ||
| 1551 | 0x4e66, | ||
| 1552 | 0x4e67, | ||
| 1553 | 0x4e68, | ||
| 1554 | 0x4e69, | ||
| 1555 | 0x4e6a, | ||
| 1556 | 0x4e71, | ||
| 1557 | 0x4f73, | ||
| 1558 | 0x5569, | ||
| 1559 | 0x556b, | ||
| 1560 | 0x556d, | ||
| 1561 | 0x556f, | ||
| 1562 | 0x5571, | ||
| 1563 | 0x5854, | ||
| 1564 | 0x5874, | ||
| 1565 | 0x5940, | ||
| 1566 | 0x5941, | ||
| 1567 | 0x5b72, | ||
| 1568 | 0x5b73, | ||
| 1569 | 0x5b74, | ||
| 1570 | 0x5b75, | ||
| 1571 | 0x5d44, | ||
| 1572 | 0x5d45, | ||
| 1573 | 0x5d6d, | ||
| 1574 | 0x5d6f, | ||
| 1575 | 0x5d72, | ||
| 1576 | 0x5d77, | ||
| 1577 | 0x5e6b, | ||
| 1578 | 0x5e6d, | ||
| 1579 | 0x7120, | ||
| 1580 | 0x7124, | ||
| 1581 | 0x7129, | ||
| 1582 | 0x712e, | ||
| 1583 | 0x712f, | ||
| 1584 | 0x7162, | ||
| 1585 | 0x7163, | ||
| 1586 | 0x7166, | ||
| 1587 | 0x7167, | ||
| 1588 | 0x7172, | ||
| 1589 | 0x7173, | ||
| 1590 | 0x71a0, | ||
| 1591 | 0x71a1, | ||
| 1592 | 0x71a3, | ||
| 1593 | 0x71a7, | ||
| 1594 | 0x71bb, | ||
| 1595 | 0x71e0, | ||
| 1596 | 0x71e1, | ||
| 1597 | 0x71e2, | ||
| 1598 | 0x71e6, | ||
| 1599 | 0x71e7, | ||
| 1600 | 0x71f2, | ||
| 1601 | 0x7269, | ||
| 1602 | 0x726b, | ||
| 1603 | 0x726e, | ||
| 1604 | 0x72a0, | ||
| 1605 | 0x72a8, | ||
| 1606 | 0x72b1, | ||
| 1607 | 0x72b3, | ||
| 1608 | 0x793f, | ||
| 1528 | }; | 1609 | }; |
| 1529 | 1610 | ||
| 1530 | static const struct pci_device_id pciidlist[] = { | 1611 | static const struct pci_device_id pciidlist[] = { |
| @@ -2033,10 +2033,10 @@ static void calculate_bandwidth( · 2032 unmodified lines | |||
| 2033 | kfree(surface_type); | 2033 | kfree(surface_type); |
| 2034 | free_tiling_mode: | 2034 | free_tiling_mode: |
| 2035 | kfree(tiling_mode); | 2035 | kfree(tiling_mode); |
| 2036 | free_yclk: | ||
| 2037 | kfree(yclk); | ||
| 2038 | free_sclk: | 2036 | free_sclk: |
| 2039 | kfree(sclk); | 2037 | kfree(sclk); |
| 2038 | free_yclk: | ||
| 2039 | kfree(yclk); | ||
| 2040 | } | 2040 | } |
| 2041 | 2041 | ||
| 2042 | /******************************************************************************* | 2042 | /******************************************************************************* |
| @@ -503,7 +503,6 @@ static void dcn_bw_calc_rq_dlg_ttu( · 502 unmodified lines | |||
| 503 | //input[in_idx].dout.output_standard; | 503 | //input[in_idx].dout.output_standard; |
| 504 | 504 | ||
| 505 | /*todo: soc->sr_enter_plus_exit_time??*/ | 505 | /*todo: soc->sr_enter_plus_exit_time??*/ |
| 506 | dlg_sys_param->t_srx_delay_us = dc->dcn_ip->dcfclk_cstate_latency / v->dcf_clk_deep_sleep; | ||
| 507 | 506 | ||
| 508 | dml1_rq_dlg_get_rq_params(dml, rq_param, &input->pipe.src); | 507 | dml1_rq_dlg_get_rq_params(dml, rq_param, &input->pipe.src); |
| 509 | dml1_extract_rq_regs(dml, rq_regs, rq_param); | 508 | dml1_extract_rq_regs(dml, rq_regs, rq_param); |
| @@ -1404,20 +1404,34 @@ static void program_timing_sync( · 1403 unmodified lines | |||
| 1404 | status->timing_sync_info.master = false; | 1404 | status->timing_sync_info.master = false; |
| 1405 | 1405 | ||
| 1406 | } | 1406 | } |
| 1407 | /* remove any other unblanked pipes as they have already been synced */ | ||
| 1408 | for (j = j + 1; j < group_size; j++) { | ||
| 1409 | bool is_blanked; | ||
| 1410 | 1407 | ||
| 1411 | if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) | 1408 | /* remove any other pipes that are already been synced */ |
| 1412 | is_blanked = | 1409 | if (dc->config.use_pipe_ctx_sync_logic) { |
| 1413 | pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp); | 1410 | /* check pipe's syncd to decide which pipe to be removed */ |
| 1414 | else | 1411 | for (j = 1; j < group_size; j++) { |
| 1415 | is_blanked = | 1412 | if (pipe_set[j]->pipe_idx_syncd == pipe_set[0]->pipe_idx_syncd) { |
| 1416 | pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg); | 1413 | group_size--; |
| 1417 | if (!is_blanked) { | 1414 | pipe_set[j] = pipe_set[group_size]; |
| 1418 | group_size--; | 1415 | j--; |
| 1419 | pipe_set[j] = pipe_set[group_size]; | 1416 | } else |
| 1420 | j--; | 1417 | /* link slave pipe's syncd with master pipe */ |
| 1418 | pipe_set[j]->pipe_idx_syncd = pipe_set[0]->pipe_idx_syncd; | ||
| 1419 | } | ||
| 1420 | } else { | ||
| 1421 | for (j = j + 1; j < group_size; j++) { | ||
| 1422 | bool is_blanked; | ||
| 1423 | |||
| 1424 | if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) | ||
| 1425 | is_blanked = | ||
| 1426 | pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp); | ||
| 1427 | else | ||
| 1428 | is_blanked = | ||
| 1429 | pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg); | ||
| 1430 | if (!is_blanked) { | ||
| 1431 | group_size--; | ||
| 1432 | pipe_set[j] = pipe_set[group_size]; | ||
| 1433 | j--; | ||
| 1434 | } | ||
| 1421 | } | 1435 | } |
| 1422 | } | 1436 | } |
| 1423 | 1437 | ||
| @@ -202,7 +202,7 @@ void dp_wait_for_training_aux_rd_interval( · 201 unmodified lines | |||
| 202 | uint32_t wait_in_micro_secs) | 202 | uint32_t wait_in_micro_secs) |
| 203 | { | 203 | { |
| 204 | #if defined(CONFIG_DRM_AMD_DC_DCN) | 204 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 205 | if (wait_in_micro_secs > 16000) | 205 | if (wait_in_micro_secs > 1000) |
| 206 | msleep(wait_in_micro_secs/1000); | 206 | msleep(wait_in_micro_secs/1000); |
| 207 | else | 207 | else |
| 208 | udelay(wait_in_micro_secs); | 208 | udelay(wait_in_micro_secs); |
| @@ -6935,7 +6935,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( · 6726 unmodified lines | |||
| 6935 | } | 6935 | } |
| 6936 | } | 6936 | } |
| 6937 | retries++; | 6937 | retries++; |
| 6938 | udelay(5000); | 6938 | msleep(5); |
| 6939 | } | 6939 | } |
| 6940 | 6940 | ||
| 6941 | if (!result && retries == max_retries) { | 6941 | if (!result && retries == max_retries) { |
| @@ -6987,7 +6987,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link) · 45 unmodified lines | |||
| 6987 | break; | 6987 | break; |
| 6988 | } | 6988 | } |
| 6989 | 6989 | ||
| 6990 | udelay(5000); | 6990 | msleep(5); |
| 6991 | } | 6991 | } |
| 6992 | 6992 | ||
| 6993 | if (result == ACT_FAILED) { | 6993 | if (result == ACT_FAILED) { |
| @@ -3217,6 +3217,60 @@ struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt( · 3216 unmodified lines | |||
| 3217 | } | 3217 | } |
| 3218 | #endif | 3218 | #endif |
| 3219 | 3219 | ||
| 3220 | void reset_syncd_pipes_from_disabled_pipes(struct dc *dc, | ||
| 3221 | struct dc_state *context) | ||
| 3222 | { | ||
| 3223 | int i, j; | ||
| 3224 | struct pipe_ctx *pipe_ctx_old, *pipe_ctx, *pipe_ctx_syncd; | ||
| 3225 | |||
| 3226 | /* If pipe backend is reset, need to reset pipe syncd status */ | ||
| 3227 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 3228 | pipe_ctx_old = &dc->current_state->res_ctx.pipe_ctx[i]; | ||
| 3229 | pipe_ctx = &context->res_ctx.pipe_ctx[i]; | ||
| 3230 | |||
| 3231 | if (!pipe_ctx_old->stream) | ||
| 3232 | continue; | ||
| 3233 | |||
| 3234 | if (pipe_ctx_old->top_pipe || pipe_ctx_old->prev_odm_pipe) | ||
| 3235 | continue; | ||
| 3236 | |||
| 3237 | if (!pipe_ctx->stream || | ||
| 3238 | pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) { | ||
| 3239 | |||
| 3240 | /* Reset all the syncd pipes from the disabled pipe */ | ||
| 3241 | for (j = 0; j < dc->res_pool->pipe_count; j++) { | ||
| 3242 | pipe_ctx_syncd = &context->res_ctx.pipe_ctx[j]; | ||
| 3243 | if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_syncd) == pipe_ctx_old->pipe_idx) || | ||
| 3244 | !IS_PIPE_SYNCD_VALID(pipe_ctx_syncd)) | ||
| 3245 | SET_PIPE_SYNCD_TO_PIPE(pipe_ctx_syncd, j); | ||
| 3246 | } | ||
| 3247 | } | ||
| 3248 | } | ||
| 3249 | } | ||
| 3250 | |||
| 3251 | void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc, | ||
| 3252 | struct dc_state *context, | ||
| 3253 | uint8_t disabled_master_pipe_idx) | ||
| 3254 | { | ||
| 3255 | int i; | ||
| 3256 | struct pipe_ctx *pipe_ctx, *pipe_ctx_check; | ||
| 3257 | |||
| 3258 | pipe_ctx = &context->res_ctx.pipe_ctx[disabled_master_pipe_idx]; | ||
| 3259 | if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx) != disabled_master_pipe_idx) || | ||
| 3260 | !IS_PIPE_SYNCD_VALID(pipe_ctx)) | ||
| 3261 | SET_PIPE_SYNCD_TO_PIPE(pipe_ctx, disabled_master_pipe_idx); | ||
| 3262 | |||
| 3263 | /* for the pipe disabled, check if any slave pipe exists and assert */ | ||
| 3264 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 3265 | pipe_ctx_check = &context->res_ctx.pipe_ctx[i]; | ||
| 3266 | |||
| 3267 | if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_check) == disabled_master_pipe_idx) && | ||
| 3268 | IS_PIPE_SYNCD_VALID(pipe_ctx_check) && (i != disabled_master_pipe_idx)) | ||
| 3269 | DC_ERR("DC: Failure: pipe_idx[%d] syncd with disabled master pipe_idx[%d]\n", | ||
| 3270 | i, disabled_master_pipe_idx); | ||
| 3271 | } | ||
| 3272 | } | ||
| 3273 | |||
| 3220 | uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter) | 3274 | uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter) |
| 3221 | { | 3275 | { |
| 3222 | /* TODO - get transmitter to phy idx mapping from DMUB */ | 3276 | /* TODO - get transmitter to phy idx mapping from DMUB */ |
| @@ -344,6 +344,7 @@ struct dc_config { · 343 unmodified lines | |||
| 344 | uint8_t vblank_alignment_max_frame_time_diff; | 344 | uint8_t vblank_alignment_max_frame_time_diff; |
| 345 | bool is_asymmetric_memory; | 345 | bool is_asymmetric_memory; |
| 346 | bool is_single_rank_dimm; | 346 | bool is_single_rank_dimm; |
| 347 | bool use_pipe_ctx_sync_logic; | ||
| 347 | }; | 348 | }; |
| 348 | 349 | ||
| 349 | enum visual_confirm { | 350 | enum visual_confirm { |
| @@ -1566,6 +1566,10 @@ static enum dc_status apply_single_controller_ctx_to_hw( · 1565 unmodified lines | |||
| 1566 | &pipe_ctx->stream->audio_info); | 1566 | &pipe_ctx->stream->audio_info); |
| 1567 | } | 1567 | } |
| 1568 | 1568 | ||
| 1569 | /* make sure no pipes syncd to the pipe being enabled */ | ||
| 1570 | if (!pipe_ctx->stream->apply_seamless_boot_optimization && dc->config.use_pipe_ctx_sync_logic) | ||
| 1571 | check_syncd_pipes_for_disabled_master_pipe(dc, context, pipe_ctx->pipe_idx); | ||
| 1572 | |||
| 1569 | #if defined(CONFIG_DRM_AMD_DC_DCN) | 1573 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 1570 | /* DCN3.1 FPGA Workaround | 1574 | /* DCN3.1 FPGA Workaround |
| 1571 | * Need to enable HPO DP Stream Encoder before setting OTG master enable. | 1575 | * Need to enable HPO DP Stream Encoder before setting OTG master enable. |
| @@ -1604,7 +1608,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( · 32 unmodified lines | |||
| 1604 | pipe_ctx->stream_res.stream_enc, | 1608 | pipe_ctx->stream_res.stream_enc, |
| 1605 | pipe_ctx->stream_res.tg->inst); | 1609 | pipe_ctx->stream_res.tg->inst); |
| 1606 | 1610 | ||
| 1607 | if (dc_is_dp_signal(pipe_ctx->stream->signal) && | 1611 | if (dc_is_embedded_signal(pipe_ctx->stream->signal) && |
| 1608 | pipe_ctx->stream_res.stream_enc->funcs->reset_fifo) | 1612 | pipe_ctx->stream_res.stream_enc->funcs->reset_fifo) |
| 1609 | pipe_ctx->stream_res.stream_enc->funcs->reset_fifo( | 1613 | pipe_ctx->stream_res.stream_enc->funcs->reset_fifo( |
| 1610 | pipe_ctx->stream_res.stream_enc); | 1614 | pipe_ctx->stream_res.stream_enc); |
| @@ -2297,6 +2301,10 @@ enum dc_status dce110_apply_ctx_to_hw( · 686 unmodified lines | |||
| 2297 | enum dc_status status; | 2301 | enum dc_status status; |
| 2298 | int i; | 2302 | int i; |
| 2299 | 2303 | ||
| 2304 | /* reset syncd pipes from disabled pipes */ | ||
| 2305 | if (dc->config.use_pipe_ctx_sync_logic) | ||
| 2306 | reset_syncd_pipes_from_disabled_pipes(dc, context); | ||
| 2307 | |||
| 2300 | /* Reset old context */ | 2308 | /* Reset old context */ |
| 2301 | /* look up the targets that have been removed since last commit */ | 2309 | /* look up the targets that have been removed since last commit */ |
| 2302 | hws->funcs.reset_hw_ctx_wrap(dc, context); | 2310 | hws->funcs.reset_hw_ctx_wrap(dc, context); |
| @@ -1878,7 +1878,6 @@ noinline bool dcn30_internal_validate_bw( · 1877 unmodified lines | |||
| 1878 | dc->res_pool->funcs->update_soc_for_wm_a(dc, context); | 1878 | dc->res_pool->funcs->update_soc_for_wm_a(dc, context); |
| 1879 | pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, fast_validate); | 1879 | pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, fast_validate); |
| 1880 | 1880 | ||
| 1881 | DC_FP_START(); | ||
| 1882 | if (!pipe_cnt) { | 1881 | if (!pipe_cnt) { |
| 1883 | out = true; | 1882 | out = true; |
| 1884 | goto validate_out; | 1883 | goto validate_out; |
| @@ -2104,7 +2103,6 @@ validate_fail: · 219 unmodified lines | |||
| 2104 | out = false; | 2103 | out = false; |
| 2105 | 2104 | ||
| 2106 | validate_out: | 2105 | validate_out: |
| 2107 | DC_FP_END(); | ||
| 2108 | return out; | 2106 | return out; |
| 2109 | } | 2107 | } |
| 2110 | 2108 | ||
| @@ -2306,7 +2304,9 @@ bool dcn30_validate_bandwidth(struct dc *dc, · 195 unmodified lines | |||
| 2306 | 2304 | ||
| 2307 | BW_VAL_TRACE_COUNT(); | 2305 | BW_VAL_TRACE_COUNT(); |
| 2308 | 2306 | ||
| 2307 | DC_FP_START(); | ||
| 2309 | out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate); | 2308 | out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate); |
| 2309 | DC_FP_END(); | ||
| 2310 | 2310 | ||
| 2311 | if (pipe_cnt == 0) | 2311 | if (pipe_cnt == 0) |
| 2312 | goto validate_out; | 2312 | goto validate_out; |
| @@ -686,7 +686,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 685 unmodified lines | |||
| 686 | .disable_clock_gate = true, | 686 | .disable_clock_gate = true, |
| 687 | .disable_pplib_clock_request = true, | 687 | .disable_pplib_clock_request = true, |
| 688 | .disable_pplib_wm_range = true, | 688 | .disable_pplib_wm_range = true, |
| 689 | .pipe_split_policy = MPC_SPLIT_DYNAMIC, | 689 | .pipe_split_policy = MPC_SPLIT_AVOID, |
| 690 | .force_single_disp_pipe_split = false, | 690 | .force_single_disp_pipe_split = false, |
| 691 | .disable_dcc = DCC_ENABLE, | 691 | .disable_dcc = DCC_ENABLE, |
| 692 | .vsr_support = true, | 692 | .vsr_support = true, |
| @@ -1380,6 +1380,17 @@ static void set_wm_ranges( · 687 unmodified lines | |||
| 1380 | pp_smu->nv_funcs.set_wm_ranges(&pp_smu->nv_funcs.pp_smu, &ranges); | 1380 | pp_smu->nv_funcs.set_wm_ranges(&pp_smu->nv_funcs.pp_smu, &ranges); |
| 1381 | } | 1381 | } |
| 1382 | 1382 | ||
| 1383 | static void dcn301_calculate_wm_and_dlg( | ||
| 1384 | struct dc *dc, struct dc_state *context, | ||
| 1385 | display_e2e_pipe_params_st *pipes, | ||
| 1386 | int pipe_cnt, | ||
| 1387 | int vlevel) | ||
| 1388 | { | ||
| 1389 | DC_FP_START(); | ||
| 1390 | dcn301_calculate_wm_and_dlg_fp(dc, context, pipes, pipe_cnt, vlevel); | ||
| 1391 | DC_FP_END(); | ||
| 1392 | } | ||
| 1393 | |||
| 1383 | static struct resource_funcs dcn301_res_pool_funcs = { | 1394 | static struct resource_funcs dcn301_res_pool_funcs = { |
| 1384 | .destroy = dcn301_destroy_resource_pool, | 1395 | .destroy = dcn301_destroy_resource_pool, |
| 1385 | .link_enc_create = dcn301_link_encoder_create, | 1396 | .link_enc_create = dcn301_link_encoder_create, |
| @@ -2260,6 +2260,9 @@ static bool dcn31_resource_construct( · 2259 unmodified lines | |||
| 2260 | dc->caps.color.mpc.ogam_rom_caps.hlg = 0; | 2260 | dc->caps.color.mpc.ogam_rom_caps.hlg = 0; |
| 2261 | dc->caps.color.mpc.ocsc = 1; | 2261 | dc->caps.color.mpc.ocsc = 1; |
| 2262 | 2262 | ||
| 2263 | /* Use pipe context based otg sync logic */ | ||
| 2264 | dc->config.use_pipe_ctx_sync_logic = true; | ||
| 2265 | |||
| 2263 | /* read VBIOS LTTPR caps */ | 2266 | /* read VBIOS LTTPR caps */ |
| 2264 | { | 2267 | { |
| 2265 | if (ctx->dc_bios->funcs->get_lttpr_caps) { | 2268 | if (ctx->dc_bios->funcs->get_lttpr_caps) { |
| @@ -1576,8 +1576,6 @@ void dml20_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, · 1575 unmodified lines | |||
| 1576 | dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib, | 1576 | dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib, |
| 1577 | e2e_pipe_param, | 1577 | e2e_pipe_param, |
| 1578 | num_pipes); | 1578 | num_pipes); |
| 1579 | dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency | ||
| 1580 | / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated | ||
| 1581 | 1579 | ||
| 1582 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); | 1580 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); |
| 1583 | 1581 | ||
| @@ -1577,8 +1577,6 @@ void dml20v2_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, · 1576 unmodified lines | |||
| 1577 | dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib, | 1577 | dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib, |
| 1578 | e2e_pipe_param, | 1578 | e2e_pipe_param, |
| 1579 | num_pipes); | 1579 | num_pipes); |
| 1580 | dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency | ||
| 1581 | / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated | ||
| 1582 | 1580 | ||
| 1583 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); | 1581 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); |
| 1584 | 1582 | ||
| @@ -1688,8 +1688,6 @@ void dml21_rq_dlg_get_dlg_reg( · 1687 unmodified lines | |||
| 1688 | mode_lib, | 1688 | mode_lib, |
| 1689 | e2e_pipe_param, | 1689 | e2e_pipe_param, |
| 1690 | num_pipes); | 1690 | num_pipes); |
| 1691 | dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency | ||
| 1692 | / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated | ||
| 1693 | 1691 | ||
| 1694 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); | 1692 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); |
| 1695 | 1693 | ||
| @@ -1858,8 +1858,6 @@ void dml30_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, · 1857 unmodified lines | |||
| 1858 | dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib, | 1858 | dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib, |
| 1859 | e2e_pipe_param, | 1859 | e2e_pipe_param, |
| 1860 | num_pipes); | 1860 | num_pipes); |
| 1861 | dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency | ||
| 1862 | / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated | ||
| 1863 | 1861 | ||
| 1864 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); | 1862 | print__dlg_sys_params_st(mode_lib, &dlg_sys_param); |
| 1865 | 1863 | ||
| @@ -327,7 +327,7 @@ void dcn301_fpu_init_soc_bounding_box(struct bp_soc_bb_info bb_info) · 326 unmodified lines | |||
| 327 | dcn3_01_soc.sr_exit_time_us = bb_info.dram_sr_exit_latency_100ns * 10; | 327 | dcn3_01_soc.sr_exit_time_us = bb_info.dram_sr_exit_latency_100ns * 10; |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | void dcn301_calculate_wm_and_dlg(struct dc *dc, | 330 | void dcn301_calculate_wm_and_dlg_fp(struct dc *dc, |
| 331 | struct dc_state *context, | 331 | struct dc_state *context, |
| 332 | display_e2e_pipe_params_st *pipes, | 332 | display_e2e_pipe_params_st *pipes, |
| 333 | int pipe_cnt, | 333 | int pipe_cnt, |
| @@ -34,7 +34,7 @@ void dcn301_fpu_set_wm_ranges(int i, · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | void dcn301_fpu_init_soc_bounding_box(struct bp_soc_bb_info bb_info); | 35 | void dcn301_fpu_init_soc_bounding_box(struct bp_soc_bb_info bb_info); |
| 36 | 36 | ||
| 37 | void dcn301_calculate_wm_and_dlg(struct dc *dc, | 37 | void dcn301_calculate_wm_and_dlg_fp(struct dc *dc, |
| 38 | struct dc_state *context, | 38 | struct dc_state *context, |
| 39 | display_e2e_pipe_params_st *pipes, | 39 | display_e2e_pipe_params_st *pipes, |
| 40 | int pipe_cnt, | 40 | int pipe_cnt, |
| @@ -546,7 +546,6 @@ struct _vcs_dpi_display_dlg_sys_params_st { · 545 unmodified lines | |||
| 546 | double t_sr_wm_us; | 546 | double t_sr_wm_us; |
| 547 | double t_extra_us; | 547 | double t_extra_us; |
| 548 | double mem_trip_us; | 548 | double mem_trip_us; |
| 549 | double t_srx_delay_us; | ||
| 550 | double deepsleep_dcfclk_mhz; | 549 | double deepsleep_dcfclk_mhz; |
| 551 | double total_flip_bw; | 550 | double total_flip_bw; |
| 552 | unsigned int total_flip_bytes; | 551 | unsigned int total_flip_bytes; |
| @@ -141,9 +141,6 @@ void print__dlg_sys_params_st(struct display_mode_lib *mode_lib, const struct _v · 140 unmodified lines | |||
| 141 | dml_print("DML_RQ_DLG_CALC: t_urg_wm_us = %3.2f\n", dlg_sys_param->t_urg_wm_us); | 141 | dml_print("DML_RQ_DLG_CALC: t_urg_wm_us = %3.2f\n", dlg_sys_param->t_urg_wm_us); |
| 142 | dml_print("DML_RQ_DLG_CALC: t_sr_wm_us = %3.2f\n", dlg_sys_param->t_sr_wm_us); | 142 | dml_print("DML_RQ_DLG_CALC: t_sr_wm_us = %3.2f\n", dlg_sys_param->t_sr_wm_us); |
| 143 | dml_print("DML_RQ_DLG_CALC: t_extra_us = %3.2f\n", dlg_sys_param->t_extra_us); | 143 | dml_print("DML_RQ_DLG_CALC: t_extra_us = %3.2f\n", dlg_sys_param->t_extra_us); |
| 144 | dml_print( | ||
| 145 | "DML_RQ_DLG_CALC: t_srx_delay_us = %3.2f\n", | ||
| 146 | dlg_sys_param->t_srx_delay_us); | ||
| 147 | dml_print( | 144 | dml_print( |
| 148 | "DML_RQ_DLG_CALC: deepsleep_dcfclk_mhz = %3.2f\n", | 145 | "DML_RQ_DLG_CALC: deepsleep_dcfclk_mhz = %3.2f\n", |
| 149 | dlg_sys_param->deepsleep_dcfclk_mhz); | 146 | dlg_sys_param->deepsleep_dcfclk_mhz); |
| @@ -1331,10 +1331,6 @@ void dml1_rq_dlg_get_dlg_params( · 1330 unmodified lines | |||
| 1331 | if (dual_plane) | 1331 | if (dual_plane) |
| 1332 | DTRACE("DLG: %s: swath_height_c = %d", __func__, swath_height_c); | 1332 | DTRACE("DLG: %s: swath_height_c = %d", __func__, swath_height_c); |
| 1333 | 1333 | ||
| 1334 | DTRACE( | ||
| 1335 | "DLG: %s: t_srx_delay_us = %3.2f", | ||
| 1336 | __func__, | ||
| 1337 | (double) dlg_sys_param->t_srx_delay_us); | ||
| 1338 | DTRACE("DLG: %s: line_time_in_us = %3.2f", __func__, (double) line_time_in_us); | 1334 | DTRACE("DLG: %s: line_time_in_us = %3.2f", __func__, (double) line_time_in_us); |
| 1339 | DTRACE("DLG: %s: vupdate_offset = %d", __func__, vupdate_offset); | 1335 | DTRACE("DLG: %s: vupdate_offset = %d", __func__, vupdate_offset); |
| 1340 | DTRACE("DLG: %s: vupdate_width = %d", __func__, vupdate_width); | 1336 | DTRACE("DLG: %s: vupdate_width = %d", __func__, vupdate_width); |
| @@ -382,6 +382,7 @@ struct pipe_ctx { · 381 unmodified lines | |||
| 382 | struct pll_settings pll_settings; | 382 | struct pll_settings pll_settings; |
| 383 | 383 | ||
| 384 | uint8_t pipe_idx; | 384 | uint8_t pipe_idx; |
| 385 | uint8_t pipe_idx_syncd; | ||
| 385 | 386 | ||
| 386 | struct pipe_ctx *top_pipe; | 387 | struct pipe_ctx *top_pipe; |
| 387 | struct pipe_ctx *bottom_pipe; | 388 | struct pipe_ctx *bottom_pipe; |
| @@ -34,6 +34,10 @@ · 33 unmodified lines | |||
| 34 | #define MEMORY_TYPE_HBM 2 | 34 | #define MEMORY_TYPE_HBM 2 |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | #define IS_PIPE_SYNCD_VALID(pipe) ((((pipe)->pipe_idx_syncd) & 0x80)?1:0) | ||
| 38 | #define GET_PIPE_SYNCD_FROM_PIPE(pipe) ((pipe)->pipe_idx_syncd & 0x7F) | ||
| 39 | #define SET_PIPE_SYNCD_TO_PIPE(pipe, pipe_syncd) ((pipe)->pipe_idx_syncd = (0x80 | pipe_syncd)) | ||
| 40 | |||
| 37 | enum dce_version resource_parse_asic_id( | 41 | enum dce_version resource_parse_asic_id( |
| 38 | struct hw_asic_id asic_id); | 42 | struct hw_asic_id asic_id); |
| 39 | 43 | ||
| @@ -208,6 +212,13 @@ struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt( · 168 unmodified lines | |||
| 208 | const struct dc_link *link); | 212 | const struct dc_link *link); |
| 209 | #endif | 213 | #endif |
| 210 | 214 | ||
| 215 | void reset_syncd_pipes_from_disabled_pipes(struct dc *dc, | ||
| 216 | struct dc_state *context); | ||
| 217 | |||
| 218 | void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc, | ||
| 219 | struct dc_state *context, | ||
| 220 | uint8_t disabled_master_pipe_idx); | ||
| 221 | |||
| 211 | uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter); | 222 | uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter); |
| 212 | 223 | ||
| 213 | #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */ | 224 | #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */ |
| @@ -282,8 +282,6 @@ static const struct ast_vbios_enhtable res_1360x768[] = { · 281 unmodified lines | |||
| 282 | }; | 282 | }; |
| 283 | 283 | ||
| 284 | static const struct ast_vbios_enhtable res_1600x900[] = { | 284 | static const struct ast_vbios_enhtable res_1600x900[] = { |
| 285 | {1800, 1600, 24, 80, 1000, 900, 1, 3, VCLK108, /* 60Hz */ | ||
| 286 | (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 3, 0x3A }, | ||
| 287 | {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ | 285 | {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ |
| 288 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | | 286 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | |
| 289 | AST2500PreCatchCRT), 60, 1, 0x3A }, | 287 | AST2500PreCatchCRT), 60, 1, 0x3A }, |
| @@ -1327,8 +1327,10 @@ int drm_atomic_check_only(struct drm_atomic_state *state) · 1326 unmodified lines | |||
| 1327 | 1327 | ||
| 1328 | drm_dbg_atomic(dev, "checking %p\n", state); | 1328 | drm_dbg_atomic(dev, "checking %p\n", state); |
| 1329 | 1329 | ||
| 1330 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) | 1330 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { |
| 1331 | requested_crtc |= drm_crtc_mask(crtc); | 1331 | if (new_crtc_state->enable) |
| 1332 | requested_crtc |= drm_crtc_mask(crtc); | ||
| 1333 | } | ||
| 1332 | 1334 | ||
| 1333 | for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { | 1335 | for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { |
| 1334 | ret = drm_atomic_plane_check(old_plane_state, new_plane_state); | 1336 | ret = drm_atomic_plane_check(old_plane_state, new_plane_state); |
| @@ -1377,8 +1379,10 @@ int drm_atomic_check_only(struct drm_atomic_state *state) · 42 unmodified lines | |||
| 1377 | } | 1379 | } |
| 1378 | } | 1380 | } |
| 1379 | 1381 | ||
| 1380 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) | 1382 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { |
| 1381 | affected_crtc |= drm_crtc_mask(crtc); | 1383 | if (new_crtc_state->enable) |
| 1384 | affected_crtc |= drm_crtc_mask(crtc); | ||
| 1385 | } | ||
| 1382 | 1386 | ||
| 1383 | /* | 1387 | /* |
| 1384 | * For commits that allow modesets drivers can add other CRTCs to the | 1388 | * For commits that allow modesets drivers can add other CRTCs to the |
| @@ -115,6 +115,12 @@ static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = { · 114 unmodified lines | |||
| 115 | .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, | 115 | .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | static const struct drm_dmi_panel_orientation_data lcd1600x2560_leftside_up = { | ||
| 119 | .width = 1600, | ||
| 120 | .height = 2560, | ||
| 121 | .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP, | ||
| 122 | }; | ||
| 123 | |||
| 118 | static const struct dmi_system_id orientation_data[] = { | 124 | static const struct dmi_system_id orientation_data[] = { |
| 119 | { /* Acer One 10 (S1003) */ | 125 | { /* Acer One 10 (S1003) */ |
| 120 | .matches = { | 126 | .matches = { |
| @@ -275,6 +281,12 @@ static const struct dmi_system_id orientation_data[] = { · 154 unmodified lines | |||
| 275 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), | 281 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), |
| 276 | }, | 282 | }, |
| 277 | .driver_data = (void *)&onegx1_pro, | 283 | .driver_data = (void *)&onegx1_pro, |
| 284 | }, { /* OneXPlayer */ | ||
| 285 | .matches = { | ||
| 286 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK TECHNOLOGY CO., LTD."), | ||
| 287 | DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), | ||
| 288 | }, | ||
| 289 | .driver_data = (void *)&lcd1600x2560_leftside_up, | ||
| 278 | }, { /* Samsung GalaxyBook 10.6 */ | 290 | }, { /* Samsung GalaxyBook 10.6 */ |
| 279 | .matches = { | 291 | .matches = { |
| 280 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | 292 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), |
| @@ -33,6 +33,9 @@ static bool __init detect_thinkpad_privacy_screen(void) · 32 unmodified lines | |||
| 33 | unsigned long long output; | 33 | unsigned long long output; |
| 34 | acpi_status status; | 34 | acpi_status status; |
| 35 | 35 | ||
| 36 | if (acpi_disabled) | ||
| 37 | return false; | ||
| 38 | |||
| 36 | /* Get embedded-controller handle */ | 39 | /* Get embedded-controller handle */ |
| 37 | status = acpi_get_devices("PNP0C09", acpi_set_handle, NULL, &ec_handle); | 40 | status = acpi_get_devices("PNP0C09", acpi_set_handle, NULL, &ec_handle); |
| 38 | if (ACPI_FAILURE(status) || !ec_handle) | 41 | if (ACPI_FAILURE(status) || !ec_handle) |
| @@ -469,8 +469,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, · 468 unmodified lines | |||
| 469 | return -EINVAL; | 469 | return -EINVAL; |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K || | 472 | if (args->stream_size > SZ_128K || args->nr_relocs > SZ_128K || |
| 473 | args->nr_bos > SZ_64K || args->nr_pmrs > 128) { | 473 | args->nr_bos > SZ_128K || args->nr_pmrs > 128) { |
| 474 | DRM_ERROR("submit arguments out of size limits\n"); | 474 | DRM_ERROR("submit arguments out of size limits\n"); |
| 475 | return -EINVAL; | 475 | return -EINVAL; |
| 476 | } | 476 | } |
| @@ -1560,6 +1560,8 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) · 1559 unmodified lines | |||
| 1560 | for (i = 0; i < gpu->nr_rings; i++) | 1560 | for (i = 0; i < gpu->nr_rings; i++) |
| 1561 | a6xx_gpu->shadow[i] = 0; | 1561 | a6xx_gpu->shadow[i] = 0; |
| 1562 | 1562 | ||
| 1563 | gpu->suspend_count++; | ||
| 1564 | |||
| 1563 | return 0; | 1565 | return 0; |
| 1564 | } | 1566 | } |
| 1565 | 1567 | ||
| @@ -608,9 +608,27 @@ static int adreno_resume(struct device *dev) · 607 unmodified lines | |||
| 608 | return gpu->funcs->pm_resume(gpu); | 608 | return gpu->funcs->pm_resume(gpu); |
| 609 | } | 609 | } |
| 610 | 610 | ||
| 611 | static int active_submits(struct msm_gpu *gpu) | ||
| 612 | { | ||
| 613 | int active_submits; | ||
| 614 | mutex_lock(&gpu->active_lock); | ||
| 615 | active_submits = gpu->active_submits; | ||
| 616 | mutex_unlock(&gpu->active_lock); | ||
| 617 | return active_submits; | ||
| 618 | } | ||
| 619 | |||
| 611 | static int adreno_suspend(struct device *dev) | 620 | static int adreno_suspend(struct device *dev) |
| 612 | { | 621 | { |
| 613 | struct msm_gpu *gpu = dev_to_gpu(dev); | 622 | struct msm_gpu *gpu = dev_to_gpu(dev); |
| 623 | int remaining; | ||
| 624 | |||
| 625 | remaining = wait_event_timeout(gpu->retire_event, | ||
| 626 | active_submits(gpu) == 0, | ||
| 627 | msecs_to_jiffies(1000)); | ||
| 628 | if (remaining == 0) { | ||
| 629 | dev_err(dev, "Timeout waiting for GPU to suspend\n"); | ||
| 630 | return -EBUSY; | ||
| 631 | } | ||
| 614 | 632 | ||
| 615 | return gpu->funcs->pm_suspend(gpu); | 633 | return gpu->funcs->pm_suspend(gpu); |
| 616 | } | 634 | } |
| @@ -26,9 +26,16 @@ static void dpu_setup_dspp_pcc(struct dpu_hw_dspp *ctx, · 25 unmodified lines | |||
| 26 | struct dpu_hw_pcc_cfg *cfg) | 26 | struct dpu_hw_pcc_cfg *cfg) |
| 27 | { | 27 | { |
| 28 | 28 | ||
| 29 | u32 base = ctx->cap->sblk->pcc.base; | 29 | u32 base; |
| 30 | 30 | ||
| 31 | if (!ctx || !base) { | 31 | if (!ctx) { |
| 32 | DRM_ERROR("invalid ctx %pK\n", ctx); | ||
| 33 | return; | ||
| 34 | } | ||
| 35 | |||
| 36 | base = ctx->cap->sblk->pcc.base; | ||
| 37 | |||
| 38 | if (!base) { | ||
| 32 | DRM_ERROR("invalid ctx %pK pcc base 0x%x\n", ctx, base); | 39 | DRM_ERROR("invalid ctx %pK pcc base 0x%x\n", ctx, base); |
| 33 | return; | 40 | return; |
| 34 | } | 41 | } |
| @@ -40,7 +40,12 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi) · 39 unmodified lines | |||
| 40 | 40 | ||
| 41 | of_node_put(phy_node); | 41 | of_node_put(phy_node); |
| 42 | 42 | ||
| 43 | if (!phy_pdev || !msm_dsi->phy) { | 43 | if (!phy_pdev) { |
| 44 | DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__); | ||
| 45 | return -EPROBE_DEFER; | ||
| 46 | } | ||
| 47 | if (!msm_dsi->phy) { | ||
| 48 | put_device(&phy_pdev->dev); | ||
| 44 | DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__); | 49 | DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__); |
| 45 | return -EPROBE_DEFER; | 50 | return -EPROBE_DEFER; |
| 46 | } | 51 | } |
| @@ -808,12 +808,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy, · 807 unmodified lines | |||
| 808 | struct msm_dsi_phy_clk_request *clk_req, | 808 | struct msm_dsi_phy_clk_request *clk_req, |
| 809 | struct msm_dsi_phy_shared_timings *shared_timings) | 809 | struct msm_dsi_phy_shared_timings *shared_timings) |
| 810 | { | 810 | { |
| 811 | struct device *dev = &phy->pdev->dev; | 811 | struct device *dev; |
| 812 | int ret; | 812 | int ret; |
| 813 | 813 | ||
| 814 | if (!phy || !phy->cfg->ops.enable) | 814 | if (!phy || !phy->cfg->ops.enable) |
| 815 | return -EINVAL; | 815 | return -EINVAL; |
| 816 | 816 | ||
| 817 | dev = &phy->pdev->dev; | ||
| 818 | |||
| 817 | ret = dsi_phy_enable_resource(phy); | 819 | ret = dsi_phy_enable_resource(phy); |
| 818 | if (ret) { | 820 | if (ret) { |
| 819 | DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n", | 821 | DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n", |
| @@ -97,10 +97,15 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi) · 96 unmodified lines | |||
| 97 | 97 | ||
| 98 | of_node_put(phy_node); | 98 | of_node_put(phy_node); |
| 99 | 99 | ||
| 100 | if (!phy_pdev || !hdmi->phy) { | 100 | if (!phy_pdev) { |
| 101 | DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n"); | 101 | DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n"); |
| 102 | return -EPROBE_DEFER; | 102 | return -EPROBE_DEFER; |
| 103 | } | 103 | } |
| 104 | if (!hdmi->phy) { | ||
| 105 | DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n"); | ||
| 106 | put_device(&phy_pdev->dev); | ||
| 107 | return -EPROBE_DEFER; | ||
| 108 | } | ||
| 104 | 109 | ||
| 105 | hdmi->phy_dev = get_device(&phy_pdev->dev); | 110 | hdmi->phy_dev = get_device(&phy_pdev->dev); |
| 106 | 111 | ||
| @@ -461,7 +461,7 @@ static int msm_init_vram(struct drm_device *dev) · 460 unmodified lines | |||
| 461 | of_node_put(node); | 461 | of_node_put(node); |
| 462 | if (ret) | 462 | if (ret) |
| 463 | return ret; | 463 | return ret; |
| 464 | size = r.end - r.start; | 464 | size = r.end - r.start + 1; |
| 465 | DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start); | 465 | DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start); |
| 466 | 466 | ||
| 467 | /* if we have no IOMMU, then we need to use carveout allocator. | 467 | /* if we have no IOMMU, then we need to use carveout allocator. |
| @@ -510,7 +510,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) · 42 unmodified lines | |||
| 510 | struct msm_drm_private *priv = dev_get_drvdata(dev); | 510 | struct msm_drm_private *priv = dev_get_drvdata(dev); |
| 511 | struct drm_device *ddev; | 511 | struct drm_device *ddev; |
| 512 | struct msm_kms *kms; | 512 | struct msm_kms *kms; |
| 513 | struct msm_mdss *mdss; | ||
| 514 | int ret, i; | 513 | int ret, i; |
| 515 | 514 | ||
| 516 | ddev = drm_dev_alloc(drv, dev); | 515 | ddev = drm_dev_alloc(drv, dev); |
| @@ -521,8 +520,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) · 4 unmodified lines | |||
| 521 | ddev->dev_private = priv; | 520 | ddev->dev_private = priv; |
| 522 | priv->dev = ddev; | 521 | priv->dev = ddev; |
| 523 | 522 | ||
| 524 | mdss = priv->mdss; | ||
| 525 | |||
| 526 | priv->wq = alloc_ordered_workqueue("msm", 0); | 523 | priv->wq = alloc_ordered_workqueue("msm", 0); |
| 527 | priv->hangcheck_period = DRM_MSM_HANGCHECK_DEFAULT_PERIOD; | 524 | priv->hangcheck_period = DRM_MSM_HANGCHECK_DEFAULT_PERIOD; |
| 528 | 525 | ||
| @@ -703,6 +703,8 @@ static void retire_submits(struct msm_gpu *gpu) · 702 unmodified lines | |||
| 703 | } | 703 | } |
| 704 | } | 704 | } |
| 705 | } | 705 | } |
| 706 | |||
| 707 | wake_up_all(&gpu->retire_event); | ||
| 706 | } | 708 | } |
| 707 | 709 | ||
| 708 | static void retire_worker(struct kthread_work *work) | 710 | static void retire_worker(struct kthread_work *work) |
| @@ -848,6 +850,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 139 unmodified lines | |||
| 848 | INIT_LIST_HEAD(&gpu->active_list); | 850 | INIT_LIST_HEAD(&gpu->active_list); |
| 849 | mutex_init(&gpu->active_lock); | 851 | mutex_init(&gpu->active_lock); |
| 850 | mutex_init(&gpu->lock); | 852 | mutex_init(&gpu->lock); |
| 853 | init_waitqueue_head(&gpu->retire_event); | ||
| 851 | kthread_init_work(&gpu->retire_work, retire_worker); | 854 | kthread_init_work(&gpu->retire_work, retire_worker); |
| 852 | kthread_init_work(&gpu->recover_work, recover_worker); | 855 | kthread_init_work(&gpu->recover_work, recover_worker); |
| 853 | kthread_init_work(&gpu->fault_work, fault_worker); | 856 | kthread_init_work(&gpu->fault_work, fault_worker); |
| @@ -230,6 +230,9 @@ struct msm_gpu { · 229 unmodified lines | |||
| 230 | /* work for handling GPU recovery: */ | 230 | /* work for handling GPU recovery: */ |
| 231 | struct kthread_work recover_work; | 231 | struct kthread_work recover_work; |
| 232 | 232 | ||
| 233 | /** retire_event: notified when submits are retired: */ | ||
| 234 | wait_queue_head_t retire_event; | ||
| 235 | |||
| 233 | /* work for handling active-list retiring: */ | 236 | /* work for handling active-list retiring: */ |
| 234 | struct kthread_work retire_work; | 237 | struct kthread_work retire_work; |
| 235 | 238 | ||
| @@ -133,6 +133,18 @@ void msm_devfreq_init(struct msm_gpu *gpu) · 132 unmodified lines | |||
| 133 | CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 133 | CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | static void cancel_idle_work(struct msm_gpu_devfreq *df) | ||
| 137 | { | ||
| 138 | hrtimer_cancel(&df->idle_work.timer); | ||
| 139 | kthread_cancel_work_sync(&df->idle_work.work); | ||
| 140 | } | ||
| 141 | |||
| 142 | static void cancel_boost_work(struct msm_gpu_devfreq *df) | ||
| 143 | { | ||
| 144 | hrtimer_cancel(&df->boost_work.timer); | ||
| 145 | kthread_cancel_work_sync(&df->boost_work.work); | ||
| 146 | } | ||
| 147 | |||
| 136 | void msm_devfreq_cleanup(struct msm_gpu *gpu) | 148 | void msm_devfreq_cleanup(struct msm_gpu *gpu) |
| 137 | { | 149 | { |
| 138 | struct msm_gpu_devfreq *df = &gpu->devfreq; | 150 | struct msm_gpu_devfreq *df = &gpu->devfreq; |
| @@ -152,7 +164,12 @@ void msm_devfreq_resume(struct msm_gpu *gpu) · 13 unmodified lines | |||
| 152 | 164 | ||
| 153 | void msm_devfreq_suspend(struct msm_gpu *gpu) | 165 | void msm_devfreq_suspend(struct msm_gpu *gpu) |
| 154 | { | 166 | { |
| 155 | devfreq_suspend_device(gpu->devfreq.devfreq); | 167 | struct msm_gpu_devfreq *df = &gpu->devfreq; |
| 168 | |||
| 169 | devfreq_suspend_device(df->devfreq); | ||
| 170 | |||
| 171 | cancel_idle_work(df); | ||
| 172 | cancel_boost_work(df); | ||
| 156 | } | 173 | } |
| 157 | 174 | ||
| 158 | static void msm_devfreq_boost_work(struct kthread_work *work) | 175 | static void msm_devfreq_boost_work(struct kthread_work *work) |
| @@ -196,7 +213,7 @@ void msm_devfreq_active(struct msm_gpu *gpu) · 37 unmodified lines | |||
| 196 | /* | 213 | /* |
| 197 | * Cancel any pending transition to idle frequency: | 214 | * Cancel any pending transition to idle frequency: |
| 198 | */ | 215 | */ |
| 199 | hrtimer_cancel(&df->idle_work.timer); | 216 | cancel_idle_work(df); |
| 200 | 217 | ||
| 201 | idle_time = ktime_to_ms(ktime_sub(ktime_get(), df->idle_time)); | 218 | idle_time = ktime_to_ms(ktime_sub(ktime_get(), df->idle_time)); |
| 202 | 219 | ||
| @@ -1262,7 +1262,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, · 1261 unmodified lines | |||
| 1262 | struct mipi_dsi_device *device) | 1262 | struct mipi_dsi_device *device) |
| 1263 | { | 1263 | { |
| 1264 | struct vc4_dsi *dsi = host_to_dsi(host); | 1264 | struct vc4_dsi *dsi = host_to_dsi(host); |
| 1265 | int ret; | ||
| 1266 | 1265 | ||
| 1267 | dsi->lanes = device->lanes; | 1266 | dsi->lanes = device->lanes; |
| 1268 | dsi->channel = device->channel; | 1267 | dsi->channel = device->channel; |
| @@ -1297,18 +1296,15 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, · 28 unmodified lines | |||
| 1297 | return 0; | 1296 | return 0; |
| 1298 | } | 1297 | } |
| 1299 | 1298 | ||
| 1300 | ret = component_add(&dsi->pdev->dev, &vc4_dsi_ops); | 1299 | return component_add(&dsi->pdev->dev, &vc4_dsi_ops); |
| 1301 | if (ret) { | ||
| 1302 | mipi_dsi_host_unregister(&dsi->dsi_host); | ||
| 1303 | return ret; | ||
| 1304 | } | ||
| 1305 | |||
| 1306 | return 0; | ||
| 1307 | } | 1300 | } |
| 1308 | 1301 | ||
| 1309 | static int vc4_dsi_host_detach(struct mipi_dsi_host *host, | 1302 | static int vc4_dsi_host_detach(struct mipi_dsi_host *host, |
| 1310 | struct mipi_dsi_device *device) | 1303 | struct mipi_dsi_device *device) |
| 1311 | { | 1304 | { |
| 1305 | struct vc4_dsi *dsi = host_to_dsi(host); | ||
| 1306 | |||
| 1307 | component_del(&dsi->pdev->dev, &vc4_dsi_ops); | ||
| 1312 | return 0; | 1308 | return 0; |
| 1313 | } | 1309 | } |
| 1314 | 1310 | ||
| @@ -1686,9 +1682,7 @@ static int vc4_dsi_dev_remove(struct platform_device *pdev) · 371 unmodified lines | |||
| 1686 | struct device *dev = &pdev->dev; | 1682 | struct device *dev = &pdev->dev; |
| 1687 | struct vc4_dsi *dsi = dev_get_drvdata(dev); | 1683 | struct vc4_dsi *dsi = dev_get_drvdata(dev); |
| 1688 | 1684 | ||
| 1689 | component_del(&pdev->dev, &vc4_dsi_ops); | ||
| 1690 | mipi_dsi_host_unregister(&dsi->dsi_host); | 1685 | mipi_dsi_host_unregister(&dsi->dsi_host); |
| 1691 | |||
| 1692 | return 0; | 1686 | return 0; |
| 1693 | } | 1687 | } |
| 1694 | 1688 | ||
| @@ -1660,6 +1660,13 @@ static int balloon_connect_vsp(struct hv_device *dev) · 1659 unmodified lines | |||
| 1660 | unsigned long t; | 1660 | unsigned long t; |
| 1661 | int ret; | 1661 | int ret; |
| 1662 | 1662 | ||
| 1663 | /* | ||
| 1664 | * max_pkt_size should be large enough for one vmbus packet header plus | ||
| 1665 | * our receive buffer size. Hyper-V sends messages up to | ||
| 1666 | * HV_HYP_PAGE_SIZE bytes long on balloon channel. | ||
| 1667 | */ | ||
| 1668 | dev->channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2; | ||
| 1669 | |||
| 1663 | ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0, | 1670 | ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0, |
| 1664 | balloon_onchannelcallback, dev); | 1671 | balloon_onchannelcallback, dev); |
| 1665 | if (ret) | 1672 | if (ret) |
| @@ -662,6 +662,9 @@ static int adt7470_fan_write(struct device *dev, u32 attr, int channel, long val · 661 unmodified lines | |||
| 662 | struct adt7470_data *data = dev_get_drvdata(dev); | 662 | struct adt7470_data *data = dev_get_drvdata(dev); |
| 663 | int err; | 663 | int err; |
| 664 | 664 | ||
| 665 | if (val <= 0) | ||
| 666 | return -EINVAL; | ||
| 667 | |||
| 665 | val = FAN_RPM_TO_PERIOD(val); | 668 | val = FAN_RPM_TO_PERIOD(val); |
| 666 | val = clamp_val(val, 1, 65534); | 669 | val = clamp_val(val, 1, 65534); |
| 667 | 670 | ||
| @@ -373,7 +373,7 @@ static const struct lm90_params lm90_params[] = { · 372 unmodified lines | |||
| 373 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | 373 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT |
| 374 | | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT, | 374 | | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT, |
| 375 | .alert_alarms = 0x7c, | 375 | .alert_alarms = 0x7c, |
| 376 | .max_convrate = 8, | 376 | .max_convrate = 7, |
| 377 | }, | 377 | }, |
| 378 | [lm86] = { | 378 | [lm86] = { |
| 379 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | 379 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT |
| @@ -394,12 +394,13 @@ static const struct lm90_params lm90_params[] = { · 14 unmodified lines | |||
| 394 | .max_convrate = 9, | 394 | .max_convrate = 9, |
| 395 | }, | 395 | }, |
| 396 | [max6646] = { | 396 | [max6646] = { |
| 397 | .flags = LM90_HAVE_CRIT, | 397 | .flags = LM90_HAVE_CRIT | LM90_HAVE_BROKEN_ALERT, |
| 398 | .alert_alarms = 0x7c, | 398 | .alert_alarms = 0x7c, |
| 399 | .max_convrate = 6, | 399 | .max_convrate = 6, |
| 400 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, | 400 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, |
| 401 | }, | 401 | }, |
| 402 | [max6654] = { | 402 | [max6654] = { |
| 403 | .flags = LM90_HAVE_BROKEN_ALERT, | ||
| 403 | .alert_alarms = 0x7c, | 404 | .alert_alarms = 0x7c, |
| 404 | .max_convrate = 7, | 405 | .max_convrate = 7, |
| 405 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, | 406 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, |
| @@ -418,7 +419,7 @@ static const struct lm90_params lm90_params[] = { · 12 unmodified lines | |||
| 418 | }, | 419 | }, |
| 419 | [max6680] = { | 420 | [max6680] = { |
| 420 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT | 421 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT |
| 421 | | LM90_HAVE_CRIT_ALRM_SWP, | 422 | | LM90_HAVE_CRIT_ALRM_SWP | LM90_HAVE_BROKEN_ALERT, |
| 422 | .alert_alarms = 0x7c, | 423 | .alert_alarms = 0x7c, |
| 423 | .max_convrate = 7, | 424 | .max_convrate = 7, |
| 424 | }, | 425 | }, |
| @@ -848,7 +849,7 @@ static int lm90_update_device(struct device *dev) · 423 unmodified lines | |||
| 848 | * Re-enable ALERT# output if it was originally enabled and | 849 | * Re-enable ALERT# output if it was originally enabled and |
| 849 | * relevant alarms are all clear | 850 | * relevant alarms are all clear |
| 850 | */ | 851 | */ |
| 851 | if (!(data->config_orig & 0x80) && | 852 | if ((client->irq || !(data->config_orig & 0x80)) && |
| 852 | !(data->alarms & data->alert_alarms)) { | 853 | !(data->alarms & data->alert_alarms)) { |
| 853 | if (data->config & 0x80) { | 854 | if (data->config & 0x80) { |
| 854 | dev_dbg(&client->dev, "Re-enabling ALERT#\n"); | 855 | dev_dbg(&client->dev, "Re-enabling ALERT#\n"); |
| @@ -1807,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · 952 unmodified lines | |||
| 1807 | 1808 | ||
| 1808 | if (st & LM90_STATUS_LLOW) | 1809 | if (st & LM90_STATUS_LLOW) |
| 1809 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, | 1810 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
| 1810 | hwmon_temp_min, 0); | 1811 | hwmon_temp_min_alarm, 0); |
| 1811 | if (st & LM90_STATUS_RLOW) | 1812 | if (st & LM90_STATUS_RLOW) |
| 1812 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, | 1813 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
| 1813 | hwmon_temp_min, 1); | 1814 | hwmon_temp_min_alarm, 1); |
| 1814 | if (st2 & MAX6696_STATUS2_R2LOW) | 1815 | if (st2 & MAX6696_STATUS2_R2LOW) |
| 1815 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, | 1816 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
| 1816 | hwmon_temp_min, 2); | 1817 | hwmon_temp_min_alarm, 2); |
| 1817 | if (st & LM90_STATUS_LHIGH) | 1818 | if (st & LM90_STATUS_LHIGH) |
| 1818 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, | 1819 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
| 1819 | hwmon_temp_max, 0); | 1820 | hwmon_temp_max_alarm, 0); |
| 1820 | if (st & LM90_STATUS_RHIGH) | 1821 | if (st & LM90_STATUS_RHIGH) |
| 1821 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, | 1822 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
| 1822 | hwmon_temp_max, 1); | 1823 | hwmon_temp_max_alarm, 1); |
| 1823 | if (st2 & MAX6696_STATUS2_R2HIGH) | 1824 | if (st2 & MAX6696_STATUS2_R2HIGH) |
| 1824 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, | 1825 | hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
| 1825 | hwmon_temp_max, 2); | 1826 | hwmon_temp_max_alarm, 2); |
| 1826 | 1827 | ||
| 1827 | return true; | 1828 | return true; |
| 1828 | } | 1829 | } |
| @@ -1175,7 +1175,7 @@ static inline u8 in_to_reg(u32 val, u8 nr) · 1174 unmodified lines | |||
| 1175 | 1175 | ||
| 1176 | struct nct6775_data { | 1176 | struct nct6775_data { |
| 1177 | int addr; /* IO base of hw monitor block */ | 1177 | int addr; /* IO base of hw monitor block */ |
| 1178 | int sioreg; /* SIO register address */ | 1178 | struct nct6775_sio_data *sio_data; |
| 1179 | enum kinds kind; | 1179 | enum kinds kind; |
| 1180 | const char *name; | 1180 | const char *name; |
| 1181 | 1181 | ||
| @@ -3559,7 +3559,7 @@ clear_caseopen(struct device *dev, struct device_attribute *attr, · 2377 unmodified lines | |||
| 3559 | const char *buf, size_t count) | 3559 | const char *buf, size_t count) |
| 3560 | { | 3560 | { |
| 3561 | struct nct6775_data *data = dev_get_drvdata(dev); | 3561 | struct nct6775_data *data = dev_get_drvdata(dev); |
| 3562 | struct nct6775_sio_data *sio_data = dev_get_platdata(dev); | 3562 | struct nct6775_sio_data *sio_data = data->sio_data; |
| 3563 | int nr = to_sensor_dev_attr(attr)->index - INTRUSION_ALARM_BASE; | 3563 | int nr = to_sensor_dev_attr(attr)->index - INTRUSION_ALARM_BASE; |
| 3564 | unsigned long val; | 3564 | unsigned long val; |
| 3565 | u8 reg; | 3565 | u8 reg; |
| @@ -3967,7 +3967,7 @@ static int nct6775_probe(struct platform_device *pdev) · 401 unmodified lines | |||
| 3967 | return -ENOMEM; | 3967 | return -ENOMEM; |
| 3968 | 3968 | ||
| 3969 | data->kind = sio_data->kind; | 3969 | data->kind = sio_data->kind; |
| 3970 | data->sioreg = sio_data->sioreg; | 3970 | data->sio_data = sio_data; |
| 3971 | 3971 | ||
| 3972 | if (sio_data->access == access_direct) { | 3972 | if (sio_data->access == access_direct) { |
| 3973 | data->addr = res->start; | 3973 | data->addr = res->start; |
| @@ -62,7 +62,7 @@ static const struct i2c_device_id ir38064_id[] = { · 61 unmodified lines | |||
| 62 | 62 | ||
| 63 | MODULE_DEVICE_TABLE(i2c, ir38064_id); | 63 | MODULE_DEVICE_TABLE(i2c, ir38064_id); |
| 64 | 64 | ||
| 65 | static const struct of_device_id ir38064_of_match[] = { | 65 | static const struct of_device_id __maybe_unused ir38064_of_match[] = { |
| 66 | { .compatible = "infineon,ir38060" }, | 66 | { .compatible = "infineon,ir38060" }, |
| 67 | { .compatible = "infineon,ir38064" }, | 67 | { .compatible = "infineon,ir38064" }, |
| 68 | { .compatible = "infineon,ir38164" }, | 68 | { .compatible = "infineon,ir38164" }, |
| @@ -178,7 +178,6 @@ struct aic_irq_chip { · 177 unmodified lines | |||
| 178 | struct irq_domain *hw_domain; | 178 | struct irq_domain *hw_domain; |
| 179 | struct irq_domain *ipi_domain; | 179 | struct irq_domain *ipi_domain; |
| 180 | int nr_hw; | 180 | int nr_hw; |
| 181 | int ipi_hwirq; | ||
| 182 | }; | 181 | }; |
| 183 | 182 | ||
| 184 | static DEFINE_PER_CPU(uint32_t, aic_fiq_unmasked); | 183 | static DEFINE_PER_CPU(uint32_t, aic_fiq_unmasked); |
| @@ -4856,6 +4856,38 @@ static struct syscore_ops its_syscore_ops = { · 4855 unmodified lines | |||
| 4856 | .resume = its_restore_enable, | 4856 | .resume = its_restore_enable, |
| 4857 | }; | 4857 | }; |
| 4858 | 4858 | ||
| 4859 | static void __init __iomem *its_map_one(struct resource *res, int *err) | ||
| 4860 | { | ||
| 4861 | void __iomem *its_base; | ||
| 4862 | u32 val; | ||
| 4863 | |||
| 4864 | its_base = ioremap(res->start, SZ_64K); | ||
| 4865 | if (!its_base) { | ||
| 4866 | pr_warn("ITS@%pa: Unable to map ITS registers\n", &res->start); | ||
| 4867 | *err = -ENOMEM; | ||
| 4868 | return NULL; | ||
| 4869 | } | ||
| 4870 | |||
| 4871 | val = readl_relaxed(its_base + GITS_PIDR2) & GIC_PIDR2_ARCH_MASK; | ||
| 4872 | if (val != 0x30 && val != 0x40) { | ||
| 4873 | pr_warn("ITS@%pa: No ITS detected, giving up\n", &res->start); | ||
| 4874 | *err = -ENODEV; | ||
| 4875 | goto out_unmap; | ||
| 4876 | } | ||
| 4877 | |||
| 4878 | *err = its_force_quiescent(its_base); | ||
| 4879 | if (*err) { | ||
| 4880 | pr_warn("ITS@%pa: Failed to quiesce, giving up\n", &res->start); | ||
| 4881 | goto out_unmap; | ||
| 4882 | } | ||
| 4883 | |||
| 4884 | return its_base; | ||
| 4885 | |||
| 4886 | out_unmap: | ||
| 4887 | iounmap(its_base); | ||
| 4888 | return NULL; | ||
| 4889 | } | ||
| 4890 | |||
| 4859 | static int its_init_domain(struct fwnode_handle *handle, struct its_node *its) | 4891 | static int its_init_domain(struct fwnode_handle *handle, struct its_node *its) |
| 4860 | { | 4892 | { |
| 4861 | struct irq_domain *inner_domain; | 4893 | struct irq_domain *inner_domain; |
| @@ -4963,29 +4995,14 @@ static int __init its_probe_one(struct resource *res, · 101 unmodified lines | |||
| 4963 | { | 4995 | { |
| 4964 | struct its_node *its; | 4996 | struct its_node *its; |
| 4965 | void __iomem *its_base; | 4997 | void __iomem *its_base; |
| 4966 | u32 val, ctlr; | ||
| 4967 | u64 baser, tmp, typer; | 4998 | u64 baser, tmp, typer; |
| 4968 | struct page *page; | 4999 | struct page *page; |
| 5000 | u32 ctlr; | ||
| 4969 | int err; | 5001 | int err; |
| 4970 | 5002 | ||
| 4971 | its_base = ioremap(res->start, SZ_64K); | 5003 | its_base = its_map_one(res, &err); |
| 4972 | if (!its_base) { | 5004 | if (!its_base) |
| 4973 | pr_warn("ITS@%pa: Unable to map ITS registers\n", &res->start); | 5005 | return err; |
| 4974 | return -ENOMEM; | ||
| 4975 | } | ||
| 4976 | |||
| 4977 | val = readl_relaxed(its_base + GITS_PIDR2) & GIC_PIDR2_ARCH_MASK; | ||
| 4978 | if (val != 0x30 && val != 0x40) { | ||
| 4979 | pr_warn("ITS@%pa: No ITS detected, giving up\n", &res->start); | ||
| 4980 | err = -ENODEV; | ||
| 4981 | goto out_unmap; | ||
| 4982 | } | ||
| 4983 | |||
| 4984 | err = its_force_quiescent(its_base); | ||
| 4985 | if (err) { | ||
| 4986 | pr_warn("ITS@%pa: Failed to quiesce, giving up\n", &res->start); | ||
| 4987 | goto out_unmap; | ||
| 4988 | } | ||
| 4989 | 5006 | ||
| 4990 | pr_info("ITS %pR\n", res); | 5007 | pr_info("ITS %pR\n", res); |
| 4991 | 5008 | ||
| @@ -5241,13 +5258,31 @@ static int its_cpu_memreserve_lpi(unsigned int cpu) · 249 unmodified lines | |||
| 5241 | 5258 | ||
| 5242 | out: | 5259 | out: |
| 5243 | /* Last CPU being brought up gets to issue the cleanup */ | 5260 | /* Last CPU being brought up gets to issue the cleanup */ |
| 5244 | if (cpumask_equal(&cpus_booted_once_mask, cpu_possible_mask)) | 5261 | if (!IS_ENABLED(CONFIG_SMP) || |
| 5262 | cpumask_equal(&cpus_booted_once_mask, cpu_possible_mask)) | ||
| 5245 | schedule_work(&rdist_memreserve_cpuhp_cleanup_work); | 5263 | schedule_work(&rdist_memreserve_cpuhp_cleanup_work); |
| 5246 | 5264 | ||
| 5247 | gic_data_rdist()->flags |= RD_LOCAL_MEMRESERVE_DONE; | 5265 | gic_data_rdist()->flags |= RD_LOCAL_MEMRESERVE_DONE; |
| 5248 | return ret; | 5266 | return ret; |
| 5249 | } | 5267 | } |
| 5250 | 5268 | ||
| 5269 | /* Mark all the BASER registers as invalid before they get reprogrammed */ | ||
| 5270 | static int __init its_reset_one(struct resource *res) | ||
| 5271 | { | ||
| 5272 | void __iomem *its_base; | ||
| 5273 | int err, i; | ||
| 5274 | |||
| 5275 | its_base = its_map_one(res, &err); | ||
| 5276 | if (!its_base) | ||
| 5277 | return err; | ||
| 5278 | |||
| 5279 | for (i = 0; i < GITS_BASER_NR_REGS; i++) | ||
| 5280 | gits_write_baser(0, its_base + GITS_BASER + (i << 3)); | ||
| 5281 | |||
| 5282 | iounmap(its_base); | ||
| 5283 | return 0; | ||
| 5284 | } | ||
| 5285 | |||
| 5251 | static const struct of_device_id its_device_id[] = { | 5286 | static const struct of_device_id its_device_id[] = { |
| 5252 | { .compatible = "arm,gic-v3-its", }, | 5287 | { .compatible = "arm,gic-v3-its", }, |
| 5253 | {}, | 5288 | {}, |
| @@ -5258,6 +5293,26 @@ static int __init its_of_probe(struct device_node *node) · 4 unmodified lines | |||
| 5258 | struct device_node *np; | 5293 | struct device_node *np; |
| 5259 | struct resource res; | 5294 | struct resource res; |
| 5260 | 5295 | ||
| 5296 | /* | ||
| 5297 | * Make sure *all* the ITS are reset before we probe any, as | ||
| 5298 | * they may be sharing memory. If any of the ITS fails to | ||
| 5299 | * reset, don't even try to go any further, as this could | ||
| 5300 | * result in something even worse. | ||
| 5301 | */ | ||
| 5302 | for (np = of_find_matching_node(node, its_device_id); np; | ||
| 5303 | np = of_find_matching_node(np, its_device_id)) { | ||
| 5304 | int err; | ||
| 5305 | |||
| 5306 | if (!of_device_is_available(np) || | ||
| 5307 | !of_property_read_bool(np, "msi-controller") || | ||
| 5308 | of_address_to_resource(np, 0, &res)) | ||
| 5309 | continue; | ||
| 5310 | |||
| 5311 | err = its_reset_one(&res); | ||
| 5312 | if (err) | ||
| 5313 | return err; | ||
| 5314 | } | ||
| 5315 | |||
| 5261 | for (np = of_find_matching_node(node, its_device_id); np; | 5316 | for (np = of_find_matching_node(node, its_device_id); np; |
| 5262 | np = of_find_matching_node(np, its_device_id)) { | 5317 | np = of_find_matching_node(np, its_device_id)) { |
| 5263 | if (!of_device_is_available(np)) | 5318 | if (!of_device_is_available(np)) |
| @@ -5420,11 +5475,35 @@ dom_err: · 156 unmodified lines | |||
| 5420 | return err; | 5475 | return err; |
| 5421 | } | 5476 | } |
| 5422 | 5477 | ||
| 5478 | static int __init its_acpi_reset(union acpi_subtable_headers *header, | ||
| 5479 | const unsigned long end) | ||
| 5480 | { | ||
| 5481 | struct acpi_madt_generic_translator *its_entry; | ||
| 5482 | struct resource res; | ||
| 5483 | |||
| 5484 | its_entry = (struct acpi_madt_generic_translator *)header; | ||
| 5485 | res = (struct resource) { | ||
| 5486 | .start = its_entry->base_address, | ||
| 5487 | .end = its_entry->base_address + ACPI_GICV3_ITS_MEM_SIZE - 1, | ||
| 5488 | .flags = IORESOURCE_MEM, | ||
| 5489 | }; | ||
| 5490 | |||
| 5491 | return its_reset_one(&res); | ||
| 5492 | } | ||
| 5493 | |||
| 5423 | static void __init its_acpi_probe(void) | 5494 | static void __init its_acpi_probe(void) |
| 5424 | { | 5495 | { |
| 5425 | acpi_table_parse_srat_its(); | 5496 | acpi_table_parse_srat_its(); |
| 5426 | acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, | 5497 | /* |
| 5427 | gic_acpi_parse_madt_its, 0); | 5498 | * Make sure *all* the ITS are reset before we probe any, as |
| 5499 | * they may be sharing memory. If any of the ITS fails to | ||
| 5500 | * reset, don't even try to go any further, as this could | ||
| 5501 | * result in something even worse. | ||
| 5502 | */ | ||
| 5503 | if (acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, | ||
| 5504 | its_acpi_reset, 0) > 0) | ||
| 5505 | acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, | ||
| 5506 | gic_acpi_parse_madt_its, 0); | ||
| 5428 | acpi_its_srat_maps_free(); | 5507 | acpi_its_srat_maps_free(); |
| 5429 | } | 5508 | } |
| 5430 | #else | 5509 | #else |
| @@ -241,7 +241,7 @@ static int pch_msi_init(struct device_node *node, · 240 unmodified lines | |||
| 241 | return 0; | 241 | return 0; |
| 242 | 242 | ||
| 243 | err_map: | 243 | err_map: |
| 244 | kfree(priv->msi_map); | 244 | bitmap_free(priv->msi_map); |
| 245 | err_priv: | 245 | err_priv: |
| 246 | kfree(priv); | 246 | kfree(priv); |
| 247 | return ret; | 247 | return ret; |
| @@ -62,7 +62,7 @@ static struct irq_chip realtek_ictl_irq = { · 61 unmodified lines | |||
| 62 | 62 | ||
| 63 | static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) | 63 | static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) |
| 64 | { | 64 | { |
| 65 | irq_set_chip_and_handler(hw, &realtek_ictl_irq, handle_level_irq); | 65 | irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq); |
| 66 | 66 | ||
| 67 | return 0; | 67 | return 0; |
| 68 | } | 68 | } |
| @@ -76,16 +76,20 @@ static void realtek_irq_dispatch(struct irq_desc *desc) · 7 unmodified lines | |||
| 76 | { | 76 | { |
| 77 | struct irq_chip *chip = irq_desc_get_chip(desc); | 77 | struct irq_chip *chip = irq_desc_get_chip(desc); |
| 78 | struct irq_domain *domain; | 78 | struct irq_domain *domain; |
| 79 | unsigned int pending; | 79 | unsigned long pending; |
| 80 | unsigned int soc_int; | ||
| 80 | 81 | ||
| 81 | chained_irq_enter(chip, desc); | 82 | chained_irq_enter(chip, desc); |
| 82 | pending = readl(REG(RTL_ICTL_GIMR)) & readl(REG(RTL_ICTL_GISR)); | 83 | pending = readl(REG(RTL_ICTL_GIMR)) & readl(REG(RTL_ICTL_GISR)); |
| 84 | |||
| 83 | if (unlikely(!pending)) { | 85 | if (unlikely(!pending)) { |
| 84 | spurious_interrupt(); | 86 | spurious_interrupt(); |
| 85 | goto out; | 87 | goto out; |
| 86 | } | 88 | } |
| 89 | |||
| 87 | domain = irq_desc_get_handler_data(desc); | 90 | domain = irq_desc_get_handler_data(desc); |
| 88 | generic_handle_domain_irq(domain, __ffs(pending)); | 91 | for_each_set_bit(soc_int, &pending, 32) |
| 92 | generic_handle_domain_irq(domain, soc_int); | ||
| 89 | 93 | ||
| 90 | out: | 94 | out: |
| 91 | chained_irq_exit(chip, desc); | 95 | chained_irq_exit(chip, desc); |
| @@ -95,7 +99,8 @@ out: · 3 unmodified lines | |||
| 95 | * SoC interrupts are cascaded to MIPS CPU interrupts according to the | 99 | * SoC interrupts are cascaded to MIPS CPU interrupts according to the |
| 96 | * interrupt-map in the device tree. Each SoC interrupt gets 4 bits for | 100 | * interrupt-map in the device tree. Each SoC interrupt gets 4 bits for |
| 97 | * the CPU interrupt in an Interrupt Routing Register. Max 32 SoC interrupts | 101 | * the CPU interrupt in an Interrupt Routing Register. Max 32 SoC interrupts |
| 98 | * thus go into 4 IRRs. | 102 | * thus go into 4 IRRs. A routing value of '0' means the interrupt is left |
| 103 | * disconnected. Routing values {1..15} connect to output lines {0..14}. | ||
| 99 | */ | 104 | */ |
| 100 | static int __init map_interrupts(struct device_node *node, struct irq_domain *domain) | 105 | static int __init map_interrupts(struct device_node *node, struct irq_domain *domain) |
| 101 | { | 106 | { |
| @@ -134,7 +139,7 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do · 32 unmodified lines | |||
| 134 | of_node_put(cpu_ictl); | 139 | of_node_put(cpu_ictl); |
| 135 | 140 | ||
| 136 | cpu_int = be32_to_cpup(imap + 2); | 141 | cpu_int = be32_to_cpup(imap + 2); |
| 137 | if (cpu_int > 7) | 142 | if (cpu_int > 7 || cpu_int < 2) |
| 138 | return -EINVAL; | 143 | return -EINVAL; |
| 139 | 144 | ||
| 140 | if (!(mips_irqs_set & BIT(cpu_int))) { | 145 | if (!(mips_irqs_set & BIT(cpu_int))) { |
| @@ -143,7 +148,8 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do · 2 unmodified lines | |||
| 143 | mips_irqs_set |= BIT(cpu_int); | 148 | mips_irqs_set |= BIT(cpu_int); |
| 144 | } | 149 | } |
| 145 | 150 | ||
| 146 | regs[(soc_int * 4) / 32] |= cpu_int << (soc_int * 4) % 32; | 151 | /* Use routing values (1..6) for CPU interrupts (2..7) */ |
| 152 | regs[(soc_int * 4) / 32] |= (cpu_int - 1) << (soc_int * 4) % 32; | ||
| 147 | imap += 3; | 153 | imap += 3; |
| 148 | } | 154 | } |
| 149 | 155 | ||
| @@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io) · 488 unmodified lines | |||
| 489 | struct mapped_device *md = io->md; | 489 | struct mapped_device *md = io->md; |
| 490 | struct bio *bio = io->orig_bio; | 490 | struct bio *bio = io->orig_bio; |
| 491 | 491 | ||
| 492 | io->start_time = bio_start_io_acct(bio); | 492 | bio_start_io_acct_time(bio, io->start_time); |
| 493 | if (unlikely(dm_stats_used(&md->stats))) | 493 | if (unlikely(dm_stats_used(&md->stats))) |
| 494 | dm_stats_account_io(&md->stats, bio_data_dir(bio), | 494 | dm_stats_account_io(&md->stats, bio_data_dir(bio), |
| 495 | bio->bi_iter.bi_sector, bio_sectors(bio), | 495 | bio->bi_iter.bi_sector, bio_sectors(bio), |
| @@ -535,7 +535,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio) · 39 unmodified lines | |||
| 535 | io->md = md; | 535 | io->md = md; |
| 536 | spin_lock_init(&io->endio_lock); | 536 | spin_lock_init(&io->endio_lock); |
| 537 | 537 | ||
| 538 | start_io_acct(io); | 538 | io->start_time = jiffies; |
| 539 | 539 | ||
| 540 | return io; | 540 | return io; |
| 541 | } | 541 | } |
| @@ -1442,9 +1442,6 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, · 900 unmodified lines | |||
| 1442 | ci->sector = bio->bi_iter.bi_sector; | 1442 | ci->sector = bio->bi_iter.bi_sector; |
| 1443 | } | 1443 | } |
| 1444 | 1444 | ||
| 1445 | #define __dm_part_stat_sub(part, field, subnd) \ | ||
| 1446 | (part_stat_get(part, field) -= (subnd)) | ||
| 1447 | |||
| 1448 | /* | 1445 | /* |
| 1449 | * Entry point to split a bio into clones and submit them to the targets. | 1446 | * Entry point to split a bio into clones and submit them to the targets. |
| 1450 | */ | 1447 | */ |
| @@ -1480,23 +1477,12 @@ static void __split_and_process_bio(struct mapped_device *md, · 29 unmodified lines | |||
| 1480 | GFP_NOIO, &md->queue->bio_split); | 1477 | GFP_NOIO, &md->queue->bio_split); |
| 1481 | ci.io->orig_bio = b; | 1478 | ci.io->orig_bio = b; |
| 1482 | 1479 | ||
| 1483 | /* | ||
| 1484 | * Adjust IO stats for each split, otherwise upon queue | ||
| 1485 | * reentry there will be redundant IO accounting. | ||
| 1486 | * NOTE: this is a stop-gap fix, a proper fix involves | ||
| 1487 | * significant refactoring of DM core's bio splitting | ||
| 1488 | * (by eliminating DM's splitting and just using bio_split) | ||
| 1489 | */ | ||
| 1490 | part_stat_lock(); | ||
| 1491 | __dm_part_stat_sub(dm_disk(md)->part0, | ||
| 1492 | sectors[op_stat_group(bio_op(bio))], ci.sector_count); | ||
| 1493 | part_stat_unlock(); | ||
| 1494 | |||
| 1495 | bio_chain(b, bio); | 1480 | bio_chain(b, bio); |
| 1496 | trace_block_split(b, bio->bi_iter.bi_sector); | 1481 | trace_block_split(b, bio->bi_iter.bi_sector); |
| 1497 | submit_bio_noacct(bio); | 1482 | submit_bio_noacct(bio); |
| 1498 | } | 1483 | } |
| 1499 | } | 1484 | } |
| 1485 | start_io_acct(ci.io); | ||
| 1500 | 1486 | ||
| 1501 | /* drop the extra reference count */ | 1487 | /* drop the extra reference count */ |
| 1502 | dm_io_dec_pending(ci.io, errno_to_blk_status(error)); | 1488 | dm_io_dec_pending(ci.io, errno_to_blk_status(error)); |
| @@ -440,6 +440,10 @@ static int at25_probe(struct spi_device *spi) · 439 unmodified lines | |||
| 440 | return -ENXIO; | 440 | return -ENXIO; |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | at25 = devm_kzalloc(&spi->dev, sizeof(*at25), GFP_KERNEL); | ||
| 444 | if (!at25) | ||
| 445 | return -ENOMEM; | ||
| 446 | |||
| 443 | mutex_init(&at25->lock); | 447 | mutex_init(&at25->lock); |
| 444 | at25->spi = spi; | 448 | at25->spi = spi; |
| 445 | spi_set_drvdata(spi, at25); | 449 | spi_set_drvdata(spi, at25); |
| @@ -36,6 +36,7 @@ config NET_DSA_LANTIQ_GSWIP · 35 unmodified lines | |||
| 36 | config NET_DSA_MT7530 | 36 | config NET_DSA_MT7530 |
| 37 | tristate "MediaTek MT753x and MT7621 Ethernet switch support" | 37 | tristate "MediaTek MT753x and MT7621 Ethernet switch support" |
| 38 | select NET_DSA_TAG_MTK | 38 | select NET_DSA_TAG_MTK |
| 39 | select MEDIATEK_GE_PHY | ||
| 39 | help | 40 | help |
| 40 | This enables support for the MediaTek MT7530, MT7531, and MT7621 | 41 | This enables support for the MediaTek MT7530, MT7531, and MT7621 |
| 41 | Ethernet switch chips. | 42 | Ethernet switch chips. |
| @@ -721,7 +721,9 @@ static void xgbe_stop_timers(struct xgbe_prv_data *pdata) · 720 unmodified lines | |||
| 721 | if (!channel->tx_ring) | 721 | if (!channel->tx_ring) |
| 722 | break; | 722 | break; |
| 723 | 723 | ||
| 724 | /* Deactivate the Tx timer */ | ||
| 724 | del_timer_sync(&channel->tx_timer); | 725 | del_timer_sync(&channel->tx_timer); |
| 726 | channel->tx_timer_active = 0; | ||
| 725 | } | 727 | } |
| 726 | } | 728 | } |
| 727 | 729 | ||
| @@ -2550,6 +2552,14 @@ read_again: · 1822 unmodified lines | |||
| 2550 | buf2_len = xgbe_rx_buf2_len(rdata, packet, len); | 2552 | buf2_len = xgbe_rx_buf2_len(rdata, packet, len); |
| 2551 | len += buf2_len; | 2553 | len += buf2_len; |
| 2552 | 2554 | ||
| 2555 | if (buf2_len > rdata->rx.buf.dma_len) { | ||
| 2556 | /* Hardware inconsistency within the descriptors | ||
| 2557 | * that has resulted in a length underflow. | ||
| 2558 | */ | ||
| 2559 | error = 1; | ||
| 2560 | goto skip_data; | ||
| 2561 | } | ||
| 2562 | |||
| 2553 | if (!skb) { | 2563 | if (!skb) { |
| 2554 | skb = xgbe_create_skb(pdata, napi, rdata, | 2564 | skb = xgbe_create_skb(pdata, napi, rdata, |
| 2555 | buf1_len); | 2565 | buf1_len); |
| @@ -2579,8 +2589,10 @@ skip_data: · 23 unmodified lines | |||
| 2579 | if (!last || context_next) | 2589 | if (!last || context_next) |
| 2580 | goto read_again; | 2590 | goto read_again; |
| 2581 | 2591 | ||
| 2582 | if (!skb) | 2592 | if (!skb || error) { |
| 2593 | dev_kfree_skb(skb); | ||
| 2583 | goto next_packet; | 2594 | goto next_packet; |
| 2595 | } | ||
| 2584 | 2596 | ||
| 2585 | /* Be sure we don't exceed the configured MTU */ | 2597 | /* Be sure we don't exceed the configured MTU */ |
| 2586 | max_len = netdev->mtu + ETH_HLEN; | 2598 | max_len = netdev->mtu + ETH_HLEN; |
| @@ -301,7 +301,7 @@ static int gve_adminq_parse_err(struct gve_priv *priv, u32 status) · 300 unmodified lines | |||
| 301 | */ | 301 | */ |
| 302 | static int gve_adminq_kick_and_wait(struct gve_priv *priv) | 302 | static int gve_adminq_kick_and_wait(struct gve_priv *priv) |
| 303 | { | 303 | { |
| 304 | u32 tail, head; | 304 | int tail, head; |
| 305 | int i; | 305 | int i; |
| 306 | 306 | ||
| 307 | tail = ioread32be(&priv->reg_bar0->adminq_event_counter); | 307 | tail = ioread32be(&priv->reg_bar0->adminq_event_counter); |
| @@ -115,7 +115,8 @@ enum e1000_boards { · 114 unmodified lines | |||
| 115 | board_pch_lpt, | 115 | board_pch_lpt, |
| 116 | board_pch_spt, | 116 | board_pch_spt, |
| 117 | board_pch_cnp, | 117 | board_pch_cnp, |
| 118 | board_pch_tgp | 118 | board_pch_tgp, |
| 119 | board_pch_adp | ||
| 119 | }; | 120 | }; |
| 120 | 121 | ||
| 121 | struct e1000_ps_page { | 122 | struct e1000_ps_page { |
| @@ -502,6 +503,7 @@ extern const struct e1000_info e1000_pch_lpt_info; · 380 unmodified lines | |||
| 502 | extern const struct e1000_info e1000_pch_spt_info; | 503 | extern const struct e1000_info e1000_pch_spt_info; |
| 503 | extern const struct e1000_info e1000_pch_cnp_info; | 504 | extern const struct e1000_info e1000_pch_cnp_info; |
| 504 | extern const struct e1000_info e1000_pch_tgp_info; | 505 | extern const struct e1000_info e1000_pch_tgp_info; |
| 506 | extern const struct e1000_info e1000_pch_adp_info; | ||
| 505 | extern const struct e1000_info e1000_es2_info; | 507 | extern const struct e1000_info e1000_es2_info; |
| 506 | 508 | ||
| 507 | void e1000e_ptp_init(struct e1000_adapter *adapter); | 509 | void e1000e_ptp_init(struct e1000_adapter *adapter); |
| @@ -6021,3 +6021,23 @@ const struct e1000_info e1000_pch_tgp_info = { · 6020 unmodified lines | |||
| 6021 | .phy_ops = &ich8_phy_ops, | 6021 | .phy_ops = &ich8_phy_ops, |
| 6022 | .nvm_ops = &spt_nvm_ops, | 6022 | .nvm_ops = &spt_nvm_ops, |
| 6023 | }; | 6023 | }; |
| 6024 | |||
| 6025 | const struct e1000_info e1000_pch_adp_info = { | ||
| 6026 | .mac = e1000_pch_adp, | ||
| 6027 | .flags = FLAG_IS_ICH | ||
| 6028 | | FLAG_HAS_WOL | ||
| 6029 | | FLAG_HAS_HW_TIMESTAMP | ||
| 6030 | | FLAG_HAS_CTRLEXT_ON_LOAD | ||
| 6031 | | FLAG_HAS_AMT | ||
| 6032 | | FLAG_HAS_FLASH | ||
| 6033 | | FLAG_HAS_JUMBO_FRAMES | ||
| 6034 | | FLAG_APME_IN_WUC, | ||
| 6035 | .flags2 = FLAG2_HAS_PHY_STATS | ||
| 6036 | | FLAG2_HAS_EEE, | ||
| 6037 | .pba = 26, | ||
| 6038 | .max_hw_frame_size = 9022, | ||
| 6039 | .get_variants = e1000_get_variants_ich8lan, | ||
| 6040 | .mac_ops = &ich8_mac_ops, | ||
| 6041 | .phy_ops = &ich8_phy_ops, | ||
| 6042 | .nvm_ops = &spt_nvm_ops, | ||
| 6043 | }; | ||
| @@ -52,6 +52,7 @@ static const struct e1000_info *e1000_info_tbl[] = { · 51 unmodified lines | |||
| 52 | [board_pch_spt] = &e1000_pch_spt_info, | 52 | [board_pch_spt] = &e1000_pch_spt_info, |
| 53 | [board_pch_cnp] = &e1000_pch_cnp_info, | 53 | [board_pch_cnp] = &e1000_pch_cnp_info, |
| 54 | [board_pch_tgp] = &e1000_pch_tgp_info, | 54 | [board_pch_tgp] = &e1000_pch_tgp_info, |
| 55 | [board_pch_adp] = &e1000_pch_adp_info, | ||
| 55 | }; | 56 | }; |
| 56 | 57 | ||
| 57 | struct e1000_reg_info { | 58 | struct e1000_reg_info { |
| @@ -6341,7 +6342,8 @@ static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter) · 6283 unmodified lines | |||
| 6341 | u32 mac_data; | 6342 | u32 mac_data; |
| 6342 | u16 phy_data; | 6343 | u16 phy_data; |
| 6343 | 6344 | ||
| 6344 | if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) { | 6345 | if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID && |
| 6346 | hw->mac.type >= e1000_pch_adp) { | ||
| 6345 | /* Request ME configure the device for S0ix */ | 6347 | /* Request ME configure the device for S0ix */ |
| 6346 | mac_data = er32(H2ME); | 6348 | mac_data = er32(H2ME); |
| 6347 | mac_data |= E1000_H2ME_START_DPG; | 6349 | mac_data |= E1000_H2ME_START_DPG; |
| @@ -6490,7 +6492,8 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) · 142 unmodified lines | |||
| 6490 | u16 phy_data; | 6492 | u16 phy_data; |
| 6491 | u32 i = 0; | 6493 | u32 i = 0; |
| 6492 | 6494 | ||
| 6493 | if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) { | 6495 | if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID && |
| 6496 | hw->mac.type >= e1000_pch_adp) { | ||
| 6494 | /* Request ME unconfigure the device from S0ix */ | 6497 | /* Request ME unconfigure the device from S0ix */ |
| 6495 | mac_data = er32(H2ME); | 6498 | mac_data = er32(H2ME); |
| 6496 | mac_data &= ~E1000_H2ME_START_DPG; | 6499 | mac_data &= ~E1000_H2ME_START_DPG; |
| @@ -7890,22 +7893,22 @@ static const struct pci_device_id e1000_pci_tbl[] = { · 1393 unmodified lines | |||
| 7890 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp }, | 7893 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp }, |
| 7891 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp }, | 7894 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp }, |
| 7892 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp }, | 7895 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp }, |
| 7893 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_tgp }, | 7896 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_adp }, |
| 7894 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_tgp }, | 7897 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_adp }, |
| 7895 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_tgp }, | 7898 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_adp }, |
| 7896 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_tgp }, | 7899 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_adp }, |
| 7897 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_tgp }, | 7900 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_adp }, |
| 7898 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_tgp }, | 7901 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp }, |
| 7899 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_tgp }, | 7902 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp }, |
| 7900 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_tgp }, | 7903 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp }, |
| 7901 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_tgp }, | 7904 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_adp }, |
| 7902 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_tgp }, | 7905 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_adp }, |
| 7903 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_tgp }, | 7906 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_adp }, |
| 7904 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_tgp }, | 7907 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_adp }, |
| 7905 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_tgp }, | 7908 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_adp }, |
| 7906 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_tgp }, | 7909 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_adp }, |
| 7907 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_tgp }, | 7910 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_adp }, |
| 7908 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_tgp }, | 7911 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_adp }, |
| 7909 | 7912 | ||
| 7910 | { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */ | 7913 | { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */ |
| 7911 | }; | 7914 | }; |
| @@ -144,6 +144,7 @@ enum i40e_state_t { · 143 unmodified lines | |||
| 144 | __I40E_VIRTCHNL_OP_PENDING, | 144 | __I40E_VIRTCHNL_OP_PENDING, |
| 145 | __I40E_RECOVERY_MODE, | 145 | __I40E_RECOVERY_MODE, |
| 146 | __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ | 146 | __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ |
| 147 | __I40E_IN_REMOVE, | ||
| 147 | __I40E_VFS_RELEASING, | 148 | __I40E_VFS_RELEASING, |
| 148 | /* This must be last as it determines the size of the BITMAP */ | 149 | /* This must be last as it determines the size of the BITMAP */ |
| 149 | __I40E_STATE_SIZE__, | 150 | __I40E_STATE_SIZE__, |
| @@ -5372,7 +5372,15 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 5371 unmodified lines | |||
| 5372 | /* There is no need to reset BW when mqprio mode is on. */ | 5372 | /* There is no need to reset BW when mqprio mode is on. */ |
| 5373 | if (pf->flags & I40E_FLAG_TC_MQPRIO) | 5373 | if (pf->flags & I40E_FLAG_TC_MQPRIO) |
| 5374 | return 0; | 5374 | return 0; |
| 5375 | if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) { | 5375 | |
| 5376 | if (!vsi->mqprio_qopt.qopt.hw) { | ||
| 5377 | if (pf->flags & I40E_FLAG_DCB_ENABLED) | ||
| 5378 | goto skip_reset; | ||
| 5379 | |||
| 5380 | if (IS_ENABLED(CONFIG_I40E_DCB) && | ||
| 5381 | i40e_dcb_hw_get_num_tc(&pf->hw) == 1) | ||
| 5382 | goto skip_reset; | ||
| 5383 | |||
| 5376 | ret = i40e_set_bw_limit(vsi, vsi->seid, 0); | 5384 | ret = i40e_set_bw_limit(vsi, vsi->seid, 0); |
| 5377 | if (ret) | 5385 | if (ret) |
| 5378 | dev_info(&pf->pdev->dev, | 5386 | dev_info(&pf->pdev->dev, |
| @@ -5380,6 +5388,8 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 1 unmodified line | |||
| 5380 | vsi->seid); | 5388 | vsi->seid); |
| 5381 | return ret; | 5389 | return ret; |
| 5382 | } | 5390 | } |
| 5391 | |||
| 5392 | skip_reset: | ||
| 5383 | memset(&bw_data, 0, sizeof(bw_data)); | 5393 | memset(&bw_data, 0, sizeof(bw_data)); |
| 5384 | bw_data.tc_valid_bits = enabled_tc; | 5394 | bw_data.tc_valid_bits = enabled_tc; |
| 5385 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) | 5395 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) |
| @@ -10853,6 +10863,9 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit, · 5467 unmodified lines | |||
| 10853 | bool lock_acquired) | 10863 | bool lock_acquired) |
| 10854 | { | 10864 | { |
| 10855 | int ret; | 10865 | int ret; |
| 10866 | |||
| 10867 | if (test_bit(__I40E_IN_REMOVE, pf->state)) | ||
| 10868 | return; | ||
| 10856 | /* Now we wait for GRST to settle out. | 10869 | /* Now we wait for GRST to settle out. |
| 10857 | * We don't have to delete the VEBs or VSIs from the hw switch | 10870 | * We don't have to delete the VEBs or VSIs from the hw switch |
| 10858 | * because the reset will make them disappear. | 10871 | * because the reset will make them disappear. |
| @@ -12212,6 +12225,8 @@ int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count) · 1353 unmodified lines | |||
| 12212 | 12225 | ||
| 12213 | vsi->req_queue_pairs = queue_count; | 12226 | vsi->req_queue_pairs = queue_count; |
| 12214 | i40e_prep_for_reset(pf); | 12227 | i40e_prep_for_reset(pf); |
| 12228 | if (test_bit(__I40E_IN_REMOVE, pf->state)) | ||
| 12229 | return pf->alloc_rss_size; | ||
| 12215 | 12230 | ||
| 12216 | pf->alloc_rss_size = new_rss_size; | 12231 | pf->alloc_rss_size = new_rss_size; |
| 12217 | 12232 | ||
| @@ -13038,6 +13053,10 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog, · 820 unmodified lines | |||
| 13038 | if (need_reset) | 13053 | if (need_reset) |
| 13039 | i40e_prep_for_reset(pf); | 13054 | i40e_prep_for_reset(pf); |
| 13040 | 13055 | ||
| 13056 | /* VSI shall be deleted in a moment, just return EINVAL */ | ||
| 13057 | if (test_bit(__I40E_IN_REMOVE, pf->state)) | ||
| 13058 | return -EINVAL; | ||
| 13059 | |||
| 13041 | old_prog = xchg(&vsi->xdp_prog, prog); | 13060 | old_prog = xchg(&vsi->xdp_prog, prog); |
| 13042 | 13061 | ||
| 13043 | if (need_reset) { | 13062 | if (need_reset) { |
| @@ -15925,8 +15944,13 @@ static void i40e_remove(struct pci_dev *pdev) · 2881 unmodified lines | |||
| 15925 | i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), 0); | 15944 | i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), 0); |
| 15926 | i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), 0); | 15945 | i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), 0); |
| 15927 | 15946 | ||
| 15928 | while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) | 15947 | /* Grab __I40E_RESET_RECOVERY_PENDING and set __I40E_IN_REMOVE |
| 15948 | * flags, once they are set, i40e_rebuild should not be called as | ||
| 15949 | * i40e_prep_for_reset always returns early. | ||
| 15950 | */ | ||
| 15951 | while (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) | ||
| 15929 | usleep_range(1000, 2000); | 15952 | usleep_range(1000, 2000); |
| 15953 | set_bit(__I40E_IN_REMOVE, pf->state); | ||
| 15930 | 15954 | ||
| 15931 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { | 15955 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { |
| 15932 | set_bit(__I40E_VF_RESETS_DISABLED, pf->state); | 15956 | set_bit(__I40E_VF_RESETS_DISABLED, pf->state); |
| @@ -16125,6 +16149,9 @@ static void i40e_pci_error_reset_done(struct pci_dev *pdev) · 192 unmodified lines | |||
| 16125 | { | 16149 | { |
| 16126 | struct i40e_pf *pf = pci_get_drvdata(pdev); | 16150 | struct i40e_pf *pf = pci_get_drvdata(pdev); |
| 16127 | 16151 | ||
| 16152 | if (test_bit(__I40E_IN_REMOVE, pf->state)) | ||
| 16153 | return; | ||
| 16154 | |||
| 16128 | i40e_reset_and_rebuild(pf, false, false); | 16155 | i40e_reset_and_rebuild(pf, false, false); |
| 16129 | } | 16156 | } |
| 16130 | 16157 | ||
| @@ -224,7 +224,7 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev) · 223 unmodified lines | |||
| 224 | struct mlx5e_tx_wqe { | 224 | struct mlx5e_tx_wqe { |
| 225 | struct mlx5_wqe_ctrl_seg ctrl; | 225 | struct mlx5_wqe_ctrl_seg ctrl; |
| 226 | struct mlx5_wqe_eth_seg eth; | 226 | struct mlx5_wqe_eth_seg eth; |
| 227 | struct mlx5_wqe_data_seg data[0]; | 227 | struct mlx5_wqe_data_seg data[]; |
| 228 | }; | 228 | }; |
| 229 | 229 | ||
| 230 | struct mlx5e_rx_wqe_ll { | 230 | struct mlx5e_rx_wqe_ll { |
| @@ -241,8 +241,8 @@ struct mlx5e_umr_wqe { · 10 unmodified lines | |||
| 241 | struct mlx5_wqe_umr_ctrl_seg uctrl; | 241 | struct mlx5_wqe_umr_ctrl_seg uctrl; |
| 242 | struct mlx5_mkey_seg mkc; | 242 | struct mlx5_mkey_seg mkc; |
| 243 | union { | 243 | union { |
| 244 | struct mlx5_mtt inline_mtts[0]; | 244 | DECLARE_FLEX_ARRAY(struct mlx5_mtt, inline_mtts); |
| 245 | struct mlx5_klm inline_klms[0]; | 245 | DECLARE_FLEX_ARRAY(struct mlx5_klm, inline_klms); |
| 246 | }; | 246 | }; |
| 247 | }; | 247 | }; |
| 248 | 248 | ||
| @@ -570,7 +570,8 @@ static int mlx5e_htb_convert_rate(struct mlx5e_priv *priv, u64 rate, · 569 unmodified lines | |||
| 570 | 570 | ||
| 571 | static void mlx5e_htb_convert_ceil(struct mlx5e_priv *priv, u64 ceil, u32 *max_average_bw) | 571 | static void mlx5e_htb_convert_ceil(struct mlx5e_priv *priv, u64 ceil, u32 *max_average_bw) |
| 572 | { | 572 | { |
| 573 | *max_average_bw = div_u64(ceil, BYTES_IN_MBIT); | 573 | /* Hardware treats 0 as "unlimited", set at least 1. */ |
| 574 | *max_average_bw = max_t(u32, div_u64(ceil, BYTES_IN_MBIT), 1); | ||
| 574 | 575 | ||
| 575 | qos_dbg(priv->mdev, "Convert: ceil %llu -> max_average_bw %u\n", | 576 | qos_dbg(priv->mdev, "Convert: ceil %llu -> max_average_bw %u\n", |
| 576 | ceil, *max_average_bw); | 577 | ceil, *max_average_bw); |
| @@ -183,18 +183,7 @@ void mlx5e_rep_bond_unslave(struct mlx5_eswitch *esw, · 182 unmodified lines | |||
| 183 | 183 | ||
| 184 | static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev) | 184 | static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev) |
| 185 | { | 185 | { |
| 186 | struct mlx5e_rep_priv *rpriv; | 186 | return netif_is_lag_port(netdev) && mlx5e_eswitch_vf_rep(netdev); |
| 187 | struct mlx5e_priv *priv; | ||
| 188 | |||
| 189 | /* A given netdev is not a representor or not a slave of LAG configuration */ | ||
| 190 | if (!mlx5e_eswitch_rep(netdev) || !netif_is_lag_port(netdev)) | ||
| 191 | return false; | ||
| 192 | |||
| 193 | priv = netdev_priv(netdev); | ||
| 194 | rpriv = priv->ppriv; | ||
| 195 | |||
| 196 | /* Egress acl forward to vport is supported only non-uplink representor */ | ||
| 197 | return rpriv->rep->vport != MLX5_VPORT_UPLINK; | ||
| 198 | } | 187 | } |
| 199 | 188 | ||
| 200 | static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *ptr) | 189 | static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *ptr) |
| @@ -210,9 +199,6 @@ static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *pt · 9 unmodified lines | |||
| 210 | u16 fwd_vport_num; | 199 | u16 fwd_vport_num; |
| 211 | int err; | 200 | int err; |
| 212 | 201 | ||
| 213 | if (!mlx5e_rep_is_lag_netdev(netdev)) | ||
| 214 | return; | ||
| 215 | |||
| 216 | info = ptr; | 202 | info = ptr; |
| 217 | lag_info = info->lower_state_info; | 203 | lag_info = info->lower_state_info; |
| 218 | /* This is not an event of a representor becoming active slave */ | 204 | /* This is not an event of a representor becoming active slave */ |
| @@ -266,9 +252,6 @@ static void mlx5e_rep_changeupper_event(struct net_device *netdev, void *ptr) · 47 unmodified lines | |||
| 266 | struct net_device *lag_dev; | 252 | struct net_device *lag_dev; |
| 267 | struct mlx5e_priv *priv; | 253 | struct mlx5e_priv *priv; |
| 268 | 254 | ||
| 269 | if (!mlx5e_rep_is_lag_netdev(netdev)) | ||
| 270 | return; | ||
| 271 | |||
| 272 | priv = netdev_priv(netdev); | 255 | priv = netdev_priv(netdev); |
| 273 | rpriv = priv->ppriv; | 256 | rpriv = priv->ppriv; |
| 274 | lag_dev = info->upper_dev; | 257 | lag_dev = info->upper_dev; |
| @@ -293,6 +276,19 @@ static int mlx5e_rep_esw_bond_netevent(struct notifier_block *nb, · 18 unmodified lines | |||
| 293 | unsigned long event, void *ptr) | 276 | unsigned long event, void *ptr) |
| 294 | { | 277 | { |
| 295 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); | 278 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); |
| 279 | struct mlx5e_rep_priv *rpriv; | ||
| 280 | struct mlx5e_rep_bond *bond; | ||
| 281 | struct mlx5e_priv *priv; | ||
| 282 | |||
| 283 | if (!mlx5e_rep_is_lag_netdev(netdev)) | ||
| 284 | return NOTIFY_DONE; | ||
| 285 | |||
| 286 | bond = container_of(nb, struct mlx5e_rep_bond, nb); | ||
| 287 | priv = netdev_priv(netdev); | ||
| 288 | rpriv = mlx5_eswitch_get_uplink_priv(priv->mdev->priv.eswitch, REP_ETH); | ||
| 289 | /* Verify VF representor is on the same device of the bond handling the netevent. */ | ||
| 290 | if (rpriv->uplink_priv.bond != bond) | ||
| 291 | return NOTIFY_DONE; | ||
| 296 | 292 | ||
| 297 | switch (event) { | 293 | switch (event) { |
| 298 | case NETDEV_CHANGELOWERSTATE: | 294 | case NETDEV_CHANGELOWERSTATE: |
| @@ -491,7 +491,7 @@ void mlx5e_rep_bridge_init(struct mlx5e_priv *priv) · 490 unmodified lines | |||
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | br_offloads->netdev_nb.notifier_call = mlx5_esw_bridge_switchdev_port_event; | 493 | br_offloads->netdev_nb.notifier_call = mlx5_esw_bridge_switchdev_port_event; |
| 494 | err = register_netdevice_notifier(&br_offloads->netdev_nb); | 494 | err = register_netdevice_notifier_net(&init_net, &br_offloads->netdev_nb); |
| 495 | if (err) { | 495 | if (err) { |
| 496 | esw_warn(mdev, "Failed to register bridge offloads netdevice notifier (err=%d)\n", | 496 | esw_warn(mdev, "Failed to register bridge offloads netdevice notifier (err=%d)\n", |
| 497 | err); | 497 | err); |
| @@ -509,7 +509,9 @@ err_register_swdev_blk: · 11 unmodified lines | |||
| 509 | err_register_swdev: | 509 | err_register_swdev: |
| 510 | destroy_workqueue(br_offloads->wq); | 510 | destroy_workqueue(br_offloads->wq); |
| 511 | err_alloc_wq: | 511 | err_alloc_wq: |
| 512 | rtnl_lock(); | ||
| 512 | mlx5_esw_bridge_cleanup(esw); | 513 | mlx5_esw_bridge_cleanup(esw); |
| 514 | rtnl_unlock(); | ||
| 513 | } | 515 | } |
| 514 | 516 | ||
| 515 | void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv) | 517 | void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv) |
| @@ -524,7 +526,7 @@ void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv) · 8 unmodified lines | |||
| 524 | return; | 526 | return; |
| 525 | 527 | ||
| 526 | cancel_delayed_work_sync(&br_offloads->update_work); | 528 | cancel_delayed_work_sync(&br_offloads->update_work); |
| 527 | unregister_netdevice_notifier(&br_offloads->netdev_nb); | 529 | unregister_netdevice_notifier_net(&init_net, &br_offloads->netdev_nb); |
| 528 | unregister_switchdev_blocking_notifier(&br_offloads->nb_blk); | 530 | unregister_switchdev_blocking_notifier(&br_offloads->nb_blk); |
| 529 | unregister_switchdev_notifier(&br_offloads->nb); | 531 | unregister_switchdev_notifier(&br_offloads->nb); |
| 530 | destroy_workqueue(br_offloads->wq); | 532 | destroy_workqueue(br_offloads->wq); |
| @@ -167,6 +167,11 @@ static inline u16 mlx5e_txqsq_get_next_pi(struct mlx5e_txqsq *sq, u16 size) · 166 unmodified lines | |||
| 167 | return pi; | 167 | return pi; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | static inline u16 mlx5e_shampo_get_cqe_header_index(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) | ||
| 171 | { | ||
| 172 | return be16_to_cpu(cqe->shampo.header_entry_index) & (rq->mpwqe.shampo->hd_per_wq - 1); | ||
| 173 | } | ||
| 174 | |||
| 170 | struct mlx5e_shampo_umr { | 175 | struct mlx5e_shampo_umr { |
| 171 | u16 len; | 176 | u16 len; |
| 172 | }; | 177 | }; |
| @@ -341,8 +341,10 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd, · 340 unmodified lines | |||
| 341 | 341 | ||
| 342 | /* copy the inline part if required */ | 342 | /* copy the inline part if required */ |
| 343 | if (sq->min_inline_mode != MLX5_INLINE_MODE_NONE) { | 343 | if (sq->min_inline_mode != MLX5_INLINE_MODE_NONE) { |
| 344 | memcpy(eseg->inline_hdr.start, xdptxd->data, MLX5E_XDP_MIN_INLINE); | 344 | memcpy(eseg->inline_hdr.start, xdptxd->data, sizeof(eseg->inline_hdr.start)); |
| 345 | eseg->inline_hdr.sz = cpu_to_be16(MLX5E_XDP_MIN_INLINE); | 345 | eseg->inline_hdr.sz = cpu_to_be16(MLX5E_XDP_MIN_INLINE); |
| 346 | memcpy(dseg, xdptxd->data + sizeof(eseg->inline_hdr.start), | ||
| 347 | MLX5E_XDP_MIN_INLINE - sizeof(eseg->inline_hdr.start)); | ||
| 346 | dma_len -= MLX5E_XDP_MIN_INLINE; | 348 | dma_len -= MLX5E_XDP_MIN_INLINE; |
| 347 | dma_addr += MLX5E_XDP_MIN_INLINE; | 349 | dma_addr += MLX5E_XDP_MIN_INLINE; |
| 348 | dseg++; | 350 | dseg++; |
| @@ -157,11 +157,20 @@ static void mlx5e_ipsec_set_swp(struct sk_buff *skb, · 156 unmodified lines | |||
| 157 | /* Tunnel mode */ | 157 | /* Tunnel mode */ |
| 158 | if (mode == XFRM_MODE_TUNNEL) { | 158 | if (mode == XFRM_MODE_TUNNEL) { |
| 159 | eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2; | 159 | eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2; |
| 160 | eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2; | ||
| 161 | if (xo->proto == IPPROTO_IPV6) | 160 | if (xo->proto == IPPROTO_IPV6) |
| 162 | eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6; | 161 | eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6; |
| 163 | if (inner_ip_hdr(skb)->protocol == IPPROTO_UDP) | 162 | |
| 163 | switch (xo->inner_ipproto) { | ||
| 164 | case IPPROTO_UDP: | ||
| 164 | eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP; | 165 | eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP; |
| 166 | fallthrough; | ||
| 167 | case IPPROTO_TCP: | ||
| 168 | /* IP | ESP | IP | [TCP | UDP] */ | ||
| 169 | eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2; | ||
| 170 | break; | ||
| 171 | default: | ||
| 172 | break; | ||
| 173 | } | ||
| 165 | return; | 174 | return; |
| 166 | } | 175 | } |
| 167 | 176 | ||
| @@ -131,14 +131,17 @@ static inline bool · 130 unmodified lines | |||
| 131 | mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, | 131 | mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, |
| 132 | struct mlx5_wqe_eth_seg *eseg) | 132 | struct mlx5_wqe_eth_seg *eseg) |
| 133 | { | 133 | { |
| 134 | struct xfrm_offload *xo = xfrm_offload(skb); | 134 | u8 inner_ipproto; |
| 135 | 135 | ||
| 136 | if (!mlx5e_ipsec_eseg_meta(eseg)) | 136 | if (!mlx5e_ipsec_eseg_meta(eseg)) |
| 137 | return false; | 137 | return false; |
| 138 | 138 | ||
| 139 | eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM; | 139 | eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM; |
| 140 | if (xo->inner_ipproto) { | 140 | inner_ipproto = xfrm_offload(skb)->inner_ipproto; |
| 141 | eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM | MLX5_ETH_WQE_L3_INNER_CSUM; | 141 | if (inner_ipproto) { |
| 142 | eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; | ||
| 143 | if (inner_ipproto == IPPROTO_TCP || inner_ipproto == IPPROTO_UDP) | ||
| 144 | eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; | ||
| 142 | } else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 145 | } else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
| 143 | eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM; | 146 | eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM; |
| 144 | sq->stats->csum_partial_inner++; | 147 | sq->stats->csum_partial_inner++; |
| @@ -1117,7 +1117,7 @@ static void mlx5e_shampo_update_ipv6_udp_hdr(struct mlx5e_rq *rq, struct ipv6hdr · 1116 unmodified lines | |||
| 1117 | static void mlx5e_shampo_update_fin_psh_flags(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, | 1117 | static void mlx5e_shampo_update_fin_psh_flags(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, |
| 1118 | struct tcphdr *skb_tcp_hd) | 1118 | struct tcphdr *skb_tcp_hd) |
| 1119 | { | 1119 | { |
| 1120 | u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index); | 1120 | u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe); |
| 1121 | struct tcphdr *last_tcp_hd; | 1121 | struct tcphdr *last_tcp_hd; |
| 1122 | void *last_hd_addr; | 1122 | void *last_hd_addr; |
| 1123 | 1123 | ||
| @@ -1871,7 +1871,7 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 747 unmodified lines | |||
| 1871 | return skb; | 1871 | return skb; |
| 1872 | } | 1872 | } |
| 1873 | 1873 | ||
| 1874 | static void | 1874 | static struct sk_buff * |
| 1875 | mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, | 1875 | mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, |
| 1876 | struct mlx5_cqe64 *cqe, u16 header_index) | 1876 | struct mlx5_cqe64 *cqe, u16 header_index) |
| 1877 | { | 1877 | { |
| @@ -1895,7 +1895,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 17 unmodified lines | |||
| 1895 | skb = mlx5e_build_linear_skb(rq, hdr, frag_size, rx_headroom, head_size); | 1895 | skb = mlx5e_build_linear_skb(rq, hdr, frag_size, rx_headroom, head_size); |
| 1896 | 1896 | ||
| 1897 | if (unlikely(!skb)) | 1897 | if (unlikely(!skb)) |
| 1898 | return; | 1898 | return NULL; |
| 1899 | 1899 | ||
| 1900 | /* queue up for recycling/reuse */ | 1900 | /* queue up for recycling/reuse */ |
| 1901 | page_ref_inc(head->page); | 1901 | page_ref_inc(head->page); |
| @@ -1907,7 +1907,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 5 unmodified lines | |||
| 1907 | ALIGN(head_size, sizeof(long))); | 1907 | ALIGN(head_size, sizeof(long))); |
| 1908 | if (unlikely(!skb)) { | 1908 | if (unlikely(!skb)) { |
| 1909 | rq->stats->buff_alloc_err++; | 1909 | rq->stats->buff_alloc_err++; |
| 1910 | return; | 1910 | return NULL; |
| 1911 | } | 1911 | } |
| 1912 | 1912 | ||
| 1913 | prefetchw(skb->data); | 1913 | prefetchw(skb->data); |
| @@ -1918,9 +1918,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 4 unmodified lines | |||
| 1918 | skb->tail += head_size; | 1918 | skb->tail += head_size; |
| 1919 | skb->len += head_size; | 1919 | skb->len += head_size; |
| 1920 | } | 1920 | } |
| 1921 | rq->hw_gro_data->skb = skb; | 1921 | return skb; |
| 1922 | NAPI_GRO_CB(skb)->count = 1; | ||
| 1923 | skb_shinfo(skb)->gso_size = mpwrq_get_cqe_byte_cnt(cqe) - head_size; | ||
| 1924 | } | 1922 | } |
| 1925 | 1923 | ||
| 1926 | static void | 1924 | static void |
| @@ -1973,13 +1971,14 @@ mlx5e_free_rx_shampo_hd_entry(struct mlx5e_rq *rq, u16 header_index) · 46 unmodified lines | |||
| 1973 | static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) | 1971 | static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) |
| 1974 | { | 1972 | { |
| 1975 | u16 data_bcnt = mpwrq_get_cqe_byte_cnt(cqe) - cqe->shampo.header_size; | 1973 | u16 data_bcnt = mpwrq_get_cqe_byte_cnt(cqe) - cqe->shampo.header_size; |
| 1976 | u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index); | 1974 | u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe); |
| 1977 | u32 wqe_offset = be32_to_cpu(cqe->shampo.data_offset); | 1975 | u32 wqe_offset = be32_to_cpu(cqe->shampo.data_offset); |
| 1978 | u16 cstrides = mpwrq_get_cqe_consumed_strides(cqe); | 1976 | u16 cstrides = mpwrq_get_cqe_consumed_strides(cqe); |
| 1979 | u32 data_offset = wqe_offset & (PAGE_SIZE - 1); | 1977 | u32 data_offset = wqe_offset & (PAGE_SIZE - 1); |
| 1980 | u32 cqe_bcnt = mpwrq_get_cqe_byte_cnt(cqe); | 1978 | u32 cqe_bcnt = mpwrq_get_cqe_byte_cnt(cqe); |
| 1981 | u16 wqe_id = be16_to_cpu(cqe->wqe_id); | 1979 | u16 wqe_id = be16_to_cpu(cqe->wqe_id); |
| 1982 | u32 page_idx = wqe_offset >> PAGE_SHIFT; | 1980 | u32 page_idx = wqe_offset >> PAGE_SHIFT; |
| 1981 | u16 head_size = cqe->shampo.header_size; | ||
| 1983 | struct sk_buff **skb = &rq->hw_gro_data->skb; | 1982 | struct sk_buff **skb = &rq->hw_gro_data->skb; |
| 1984 | bool flush = cqe->shampo.flush; | 1983 | bool flush = cqe->shampo.flush; |
| 1985 | bool match = cqe->shampo.match; | 1984 | bool match = cqe->shampo.match; |
| @@ -2011,9 +2010,16 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq · 25 unmodified lines | |||
| 2011 | } | 2010 | } |
| 2012 | 2011 | ||
| 2013 | if (!*skb) { | 2012 | if (!*skb) { |
| 2014 | mlx5e_skb_from_cqe_shampo(rq, wi, cqe, header_index); | 2013 | if (likely(head_size)) |
| 2014 | *skb = mlx5e_skb_from_cqe_shampo(rq, wi, cqe, header_index); | ||
| 2015 | else | ||
| 2016 | *skb = mlx5e_skb_from_cqe_mpwrq_nonlinear(rq, wi, cqe_bcnt, data_offset, | ||
| 2017 | page_idx); | ||
| 2015 | if (unlikely(!*skb)) | 2018 | if (unlikely(!*skb)) |
| 2016 | goto free_hd_entry; | 2019 | goto free_hd_entry; |
| 2020 | |||
| 2021 | NAPI_GRO_CB(*skb)->count = 1; | ||
| 2022 | skb_shinfo(*skb)->gso_size = cqe_bcnt - head_size; | ||
| 2017 | } else { | 2023 | } else { |
| 2018 | NAPI_GRO_CB(*skb)->count++; | 2024 | NAPI_GRO_CB(*skb)->count++; |
| 2019 | if (NAPI_GRO_CB(*skb)->count == 2 && | 2025 | if (NAPI_GRO_CB(*skb)->count == 2 && |
| @@ -2027,8 +2033,10 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq · 7 unmodified lines | |||
| 2027 | } | 2033 | } |
| 2028 | } | 2034 | } |
| 2029 | 2035 | ||
| 2030 | di = &wi->umr.dma_info[page_idx]; | 2036 | if (likely(head_size)) { |
| 2031 | mlx5e_fill_skb_data(*skb, rq, di, data_bcnt, data_offset); | 2037 | di = &wi->umr.dma_info[page_idx]; |
| 2038 | mlx5e_fill_skb_data(*skb, rq, di, data_bcnt, data_offset); | ||
| 2039 | } | ||
| 2032 | 2040 | ||
| 2033 | mlx5e_shampo_complete_rx_cqe(rq, cqe, cqe_bcnt, *skb); | 2041 | mlx5e_shampo_complete_rx_cqe(rq, cqe, cqe_bcnt, *skb); |
| 2034 | if (flush) | 2042 | if (flush) |
| @@ -1539,7 +1539,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 1538 unmodified lines | |||
| 1539 | if (err) | 1539 | if (err) |
| 1540 | goto err_out; | 1540 | goto err_out; |
| 1541 | 1541 | ||
| 1542 | if (!attr->chain && esw_attr->int_port) { | 1542 | if (!attr->chain && esw_attr->int_port && |
| 1543 | attr->action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { | ||
| 1543 | /* If decap route device is internal port, change the | 1544 | /* If decap route device is internal port, change the |
| 1544 | * source vport value in reg_c0 back to uplink just in | 1545 | * source vport value in reg_c0 back to uplink just in |
| 1545 | * case the rule performs goto chain > 0. If we have a miss | 1546 | * case the rule performs goto chain > 0. If we have a miss |
| @@ -3272,6 +3273,18 @@ actions_match_supported(struct mlx5e_priv *priv, · 1726 unmodified lines | |||
| 3272 | return false; | 3273 | return false; |
| 3273 | } | 3274 | } |
| 3274 | 3275 | ||
| 3276 | if (!(~actions & | ||
| 3277 | (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_DROP))) { | ||
| 3278 | NL_SET_ERR_MSG_MOD(extack, "Rule cannot support forward+drop action"); | ||
| 3279 | return false; | ||
| 3280 | } | ||
| 3281 | |||
| 3282 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR && | ||
| 3283 | actions & MLX5_FLOW_CONTEXT_ACTION_DROP) { | ||
| 3284 | NL_SET_ERR_MSG_MOD(extack, "Drop with modify header action is not supported"); | ||
| 3285 | return false; | ||
| 3286 | } | ||
| 3287 | |||
| 3275 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR && | 3288 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR && |
| 3276 | !modify_header_match_supported(priv, &parse_attr->spec, flow_action, | 3289 | !modify_header_match_supported(priv, &parse_attr->spec, flow_action, |
| 3277 | actions, ct_flow, ct_clear, extack)) | 3290 | actions, ct_flow, ct_clear, extack)) |
| @@ -208,7 +208,7 @@ static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs) · 207 unmodified lines | |||
| 208 | int cpy1_sz = 2 * ETH_ALEN; | 208 | int cpy1_sz = 2 * ETH_ALEN; |
| 209 | int cpy2_sz = ihs - cpy1_sz; | 209 | int cpy2_sz = ihs - cpy1_sz; |
| 210 | 210 | ||
| 211 | memcpy(vhdr, skb->data, cpy1_sz); | 211 | memcpy(&vhdr->addrs, skb->data, cpy1_sz); |
| 212 | vhdr->h_vlan_proto = skb->vlan_proto; | 212 | vhdr->h_vlan_proto = skb->vlan_proto; |
| 213 | vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb)); | 213 | vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb)); |
| 214 | memcpy(&vhdr->h_vlan_encapsulated_proto, skb->data + cpy1_sz, cpy2_sz); | 214 | memcpy(&vhdr->h_vlan_encapsulated_proto, skb->data + cpy1_sz, cpy2_sz); |
| @@ -1574,6 +1574,8 @@ struct mlx5_esw_bridge_offloads *mlx5_esw_bridge_init(struct mlx5_eswitch *esw) · 1573 unmodified lines | |||
| 1574 | { | 1574 | { |
| 1575 | struct mlx5_esw_bridge_offloads *br_offloads; | 1575 | struct mlx5_esw_bridge_offloads *br_offloads; |
| 1576 | 1576 | ||
| 1577 | ASSERT_RTNL(); | ||
| 1578 | |||
| 1577 | br_offloads = kvzalloc(sizeof(*br_offloads), GFP_KERNEL); | 1579 | br_offloads = kvzalloc(sizeof(*br_offloads), GFP_KERNEL); |
| 1578 | if (!br_offloads) | 1580 | if (!br_offloads) |
| 1579 | return ERR_PTR(-ENOMEM); | 1581 | return ERR_PTR(-ENOMEM); |
| @@ -1590,6 +1592,8 @@ void mlx5_esw_bridge_cleanup(struct mlx5_eswitch *esw) · 10 unmodified lines | |||
| 1590 | { | 1592 | { |
| 1591 | struct mlx5_esw_bridge_offloads *br_offloads = esw->br_offloads; | 1593 | struct mlx5_esw_bridge_offloads *br_offloads = esw->br_offloads; |
| 1592 | 1594 | ||
| 1595 | ASSERT_RTNL(); | ||
| 1596 | |||
| 1593 | if (!br_offloads) | 1597 | if (!br_offloads) |
| 1594 | return; | 1598 | return; |
| 1595 | 1599 | ||
| @@ -21,7 +21,7 @@ DECLARE_EVENT_CLASS(mlx5_esw_bridge_fdb_template, · 20 unmodified lines | |||
| 21 | __field(unsigned int, used) | 21 | __field(unsigned int, used) |
| 22 | ), | 22 | ), |
| 23 | TP_fast_assign( | 23 | TP_fast_assign( |
| 24 | strncpy(__entry->dev_name, | 24 | strscpy(__entry->dev_name, |
| 25 | netdev_name(fdb->dev), | 25 | netdev_name(fdb->dev), |
| 26 | IFNAMSIZ); | 26 | IFNAMSIZ); |
| 27 | memcpy(__entry->addr, fdb->key.addr, ETH_ALEN); | 27 | memcpy(__entry->addr, fdb->key.addr, ETH_ALEN); |
| @@ -132,7 +132,7 @@ static void mlx5_stop_sync_reset_poll(struct mlx5_core_dev *dev) · 131 unmodified lines | |||
| 132 | { | 132 | { |
| 133 | struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; | 133 | struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; |
| 134 | 134 | ||
| 135 | del_timer(&fw_reset->timer); | 135 | del_timer_sync(&fw_reset->timer); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | static void mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, bool poll_health) | 138 | static void mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, bool poll_health) |
| @@ -121,12 +121,13 @@ u32 mlx5_chains_get_nf_ft_chain(struct mlx5_fs_chains *chains) · 120 unmodified lines | |||
| 121 | 121 | ||
| 122 | u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains) | 122 | u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains) |
| 123 | { | 123 | { |
| 124 | if (!mlx5_chains_prios_supported(chains)) | ||
| 125 | return 1; | ||
| 126 | |||
| 127 | if (mlx5_chains_ignore_flow_level_supported(chains)) | 124 | if (mlx5_chains_ignore_flow_level_supported(chains)) |
| 128 | return UINT_MAX; | 125 | return UINT_MAX; |
| 129 | 126 | ||
| 127 | if (!chains->dev->priv.eswitch || | ||
| 128 | chains->dev->priv.eswitch->mode != MLX5_ESWITCH_OFFLOADS) | ||
| 129 | return 1; | ||
| 130 | |||
| 130 | /* We should get here only for eswitch case */ | 131 | /* We should get here only for eswitch case */ |
| 131 | return FDB_TC_MAX_PRIO; | 132 | return FDB_TC_MAX_PRIO; |
| 132 | } | 133 | } |
| @@ -211,7 +212,7 @@ static int · 78 unmodified lines | |||
| 211 | create_chain_restore(struct fs_chain *chain) | 212 | create_chain_restore(struct fs_chain *chain) |
| 212 | { | 213 | { |
| 213 | struct mlx5_eswitch *esw = chain->chains->dev->priv.eswitch; | 214 | struct mlx5_eswitch *esw = chain->chains->dev->priv.eswitch; |
| 214 | char modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)]; | 215 | u8 modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)] = {}; |
| 215 | struct mlx5_fs_chains *chains = chain->chains; | 216 | struct mlx5_fs_chains *chains = chain->chains; |
| 216 | enum mlx5e_tc_attr_to_reg chain_to_reg; | 217 | enum mlx5e_tc_attr_to_reg chain_to_reg; |
| 217 | struct mlx5_modify_hdr *mod_hdr; | 218 | struct mlx5_modify_hdr *mod_hdr; |
| @@ -406,23 +406,24 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev, · 405 unmodified lines | |||
| 406 | 406 | ||
| 407 | switch (module_id) { | 407 | switch (module_id) { |
| 408 | case MLX5_MODULE_ID_SFP: | 408 | case MLX5_MODULE_ID_SFP: |
| 409 | mlx5_sfp_eeprom_params_set(&query.i2c_address, &query.page, &query.offset); | 409 | mlx5_sfp_eeprom_params_set(&query.i2c_address, &query.page, &offset); |
| 410 | break; | 410 | break; |
| 411 | case MLX5_MODULE_ID_QSFP: | 411 | case MLX5_MODULE_ID_QSFP: |
| 412 | case MLX5_MODULE_ID_QSFP_PLUS: | 412 | case MLX5_MODULE_ID_QSFP_PLUS: |
| 413 | case MLX5_MODULE_ID_QSFP28: | 413 | case MLX5_MODULE_ID_QSFP28: |
| 414 | mlx5_qsfp_eeprom_params_set(&query.i2c_address, &query.page, &query.offset); | 414 | mlx5_qsfp_eeprom_params_set(&query.i2c_address, &query.page, &offset); |
| 415 | break; | 415 | break; |
| 416 | default: | 416 | default: |
| 417 | mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id); | 417 | mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id); |
| 418 | return -EINVAL; | 418 | return -EINVAL; |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | if (query.offset + size > MLX5_EEPROM_PAGE_LENGTH) | 421 | if (offset + size > MLX5_EEPROM_PAGE_LENGTH) |
| 422 | /* Cross pages read, read until offset 256 in low page */ | 422 | /* Cross pages read, read until offset 256 in low page */ |
| 423 | size -= offset + size - MLX5_EEPROM_PAGE_LENGTH; | 423 | size = MLX5_EEPROM_PAGE_LENGTH - offset; |
| 424 | 424 | ||
| 425 | query.size = size; | 425 | query.size = size; |
| 426 | query.offset = offset; | ||
| 426 | 427 | ||
| 427 | return mlx5_query_mcia(dev, &query, data); | 428 | return mlx5_query_mcia(dev, &query, data); |
| 428 | } | 429 | } |
| @@ -145,9 +145,9 @@ static void sparx5_xtr_grp(struct sparx5 *sparx5, u8 grp, bool byte_swap) · 144 unmodified lines | |||
| 145 | skb_put(skb, byte_cnt - ETH_FCS_LEN); | 145 | skb_put(skb, byte_cnt - ETH_FCS_LEN); |
| 146 | eth_skb_pad(skb); | 146 | eth_skb_pad(skb); |
| 147 | skb->protocol = eth_type_trans(skb, netdev); | 147 | skb->protocol = eth_type_trans(skb, netdev); |
| 148 | netif_rx(skb); | ||
| 149 | netdev->stats.rx_bytes += skb->len; | 148 | netdev->stats.rx_bytes += skb->len; |
| 150 | netdev->stats.rx_packets++; | 149 | netdev->stats.rx_packets++; |
| 150 | netif_rx(skb); | ||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | static int sparx5_inject(struct sparx5 *sparx5, | 153 | static int sparx5_inject(struct sparx5 *sparx5, |
| @@ -1648,7 +1648,7 @@ static int smc911x_ethtool_geteeprom(struct net_device *dev, · 1647 unmodified lines | |||
| 1648 | return ret; | 1648 | return ret; |
| 1649 | if ((ret=smc911x_ethtool_read_eeprom_byte(dev, &eebuf[i]))!=0) | 1649 | if ((ret=smc911x_ethtool_read_eeprom_byte(dev, &eebuf[i]))!=0) |
| 1650 | return ret; | 1650 | return ret; |
| 1651 | } | 1651 | } |
| 1652 | memcpy(data, eebuf+eeprom->offset, eeprom->len); | 1652 | memcpy(data, eebuf+eeprom->offset, eeprom->len); |
| 1653 | return 0; | 1653 | return 0; |
| 1654 | } | 1654 | } |
| @@ -1667,11 +1667,11 @@ static int smc911x_ethtool_seteeprom(struct net_device *dev, · 12 unmodified lines | |||
| 1667 | return ret; | 1667 | return ret; |
| 1668 | /* write byte */ | 1668 | /* write byte */ |
| 1669 | if ((ret=smc911x_ethtool_write_eeprom_byte(dev, *data))!=0) | 1669 | if ((ret=smc911x_ethtool_write_eeprom_byte(dev, *data))!=0) |
| 1670 | return ret; | 1670 | return ret; |
| 1671 | if ((ret=smc911x_ethtool_write_eeprom_cmd(dev, E2P_CMD_EPC_CMD_WRITE_, i ))!=0) | 1671 | if ((ret=smc911x_ethtool_write_eeprom_cmd(dev, E2P_CMD_EPC_CMD_WRITE_, i ))!=0) |
| 1672 | return ret; | 1672 | return ret; |
| 1673 | } | 1673 | } |
| 1674 | return 0; | 1674 | return 0; |
| 1675 | } | 1675 | } |
| 1676 | 1676 | ||
| 1677 | static int smc911x_ethtool_geteeprom_len(struct net_device *dev) | 1677 | static int smc911x_ethtool_geteeprom_len(struct net_device *dev) |
| @@ -49,13 +49,15 @@ struct visconti_eth { · 48 unmodified lines | |||
| 49 | void __iomem *reg; | 49 | void __iomem *reg; |
| 50 | u32 phy_intf_sel; | 50 | u32 phy_intf_sel; |
| 51 | struct clk *phy_ref_clk; | 51 | struct clk *phy_ref_clk; |
| 52 | struct device *dev; | ||
| 52 | spinlock_t lock; /* lock to protect register update */ | 53 | spinlock_t lock; /* lock to protect register update */ |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) | 56 | static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) |
| 56 | { | 57 | { |
| 57 | struct visconti_eth *dwmac = priv; | 58 | struct visconti_eth *dwmac = priv; |
| 58 | unsigned int val, clk_sel_val; | 59 | struct net_device *netdev = dev_get_drvdata(dwmac->dev); |
| 60 | unsigned int val, clk_sel_val = 0; | ||
| 59 | unsigned long flags; | 61 | unsigned long flags; |
| 60 | 62 | ||
| 61 | spin_lock_irqsave(&dwmac->lock, flags); | 63 | spin_lock_irqsave(&dwmac->lock, flags); |
| @@ -85,7 +87,9 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) · 23 unmodified lines | |||
| 85 | break; | 87 | break; |
| 86 | default: | 88 | default: |
| 87 | /* No bit control */ | 89 | /* No bit control */ |
| 88 | break; | 90 | netdev_err(netdev, "Unsupported speed request (%d)", speed); |
| 91 | spin_unlock_irqrestore(&dwmac->lock, flags); | ||
| 92 | return; | ||
| 89 | } | 93 | } |
| 90 | 94 | ||
| 91 | writel(val, dwmac->reg + MAC_CTRL_REG); | 95 | writel(val, dwmac->reg + MAC_CTRL_REG); |
| @@ -229,6 +233,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) · 137 unmodified lines | |||
| 229 | 233 | ||
| 230 | spin_lock_init(&dwmac->lock); | 234 | spin_lock_init(&dwmac->lock); |
| 231 | dwmac->reg = stmmac_res.addr; | 235 | dwmac->reg = stmmac_res.addr; |
| 236 | dwmac->dev = &pdev->dev; | ||
| 232 | plat_dat->bsp_priv = dwmac; | 237 | plat_dat->bsp_priv = dwmac; |
| 233 | plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed; | 238 | plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed; |
| 234 | 239 | ||
| @@ -150,6 +150,7 @@ · 149 unmodified lines | |||
| 150 | 150 | ||
| 151 | #define NUM_DWMAC100_DMA_REGS 9 | 151 | #define NUM_DWMAC100_DMA_REGS 9 |
| 152 | #define NUM_DWMAC1000_DMA_REGS 23 | 152 | #define NUM_DWMAC1000_DMA_REGS 23 |
| 153 | #define NUM_DWMAC4_DMA_REGS 27 | ||
| 153 | 154 | ||
| 154 | void dwmac_enable_dma_transmission(void __iomem *ioaddr); | 155 | void dwmac_enable_dma_transmission(void __iomem *ioaddr); |
| 155 | void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx); | 156 | void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx); |
| @@ -21,10 +21,18 @@ · 20 unmodified lines | |||
| 21 | #include "dwxgmac2.h" | 21 | #include "dwxgmac2.h" |
| 22 | 22 | ||
| 23 | #define REG_SPACE_SIZE 0x1060 | 23 | #define REG_SPACE_SIZE 0x1060 |
| 24 | #define GMAC4_REG_SPACE_SIZE 0x116C | ||
| 24 | #define MAC100_ETHTOOL_NAME "st_mac100" | 25 | #define MAC100_ETHTOOL_NAME "st_mac100" |
| 25 | #define GMAC_ETHTOOL_NAME "st_gmac" | 26 | #define GMAC_ETHTOOL_NAME "st_gmac" |
| 26 | #define XGMAC_ETHTOOL_NAME "st_xgmac" | 27 | #define XGMAC_ETHTOOL_NAME "st_xgmac" |
| 27 | 28 | ||
| 29 | /* Same as DMA_CHAN_BASE_ADDR defined in dwmac4_dma.h | ||
| 30 | * | ||
| 31 | * It is here because dwmac_dma.h and dwmac4_dam.h can not be included at the | ||
| 32 | * same time due to the conflicting macro names. | ||
| 33 | */ | ||
| 34 | #define GMAC4_DMA_CHAN_BASE_ADDR 0x00001100 | ||
| 35 | |||
| 28 | #define ETHTOOL_DMA_OFFSET 55 | 36 | #define ETHTOOL_DMA_OFFSET 55 |
| 29 | 37 | ||
| 30 | struct stmmac_stats { | 38 | struct stmmac_stats { |
| @@ -434,6 +442,8 @@ static int stmmac_ethtool_get_regs_len(struct net_device *dev) · 403 unmodified lines | |||
| 434 | 442 | ||
| 435 | if (priv->plat->has_xgmac) | 443 | if (priv->plat->has_xgmac) |
| 436 | return XGMAC_REGSIZE * 4; | 444 | return XGMAC_REGSIZE * 4; |
| 445 | else if (priv->plat->has_gmac4) | ||
| 446 | return GMAC4_REG_SPACE_SIZE; | ||
| 437 | return REG_SPACE_SIZE; | 447 | return REG_SPACE_SIZE; |
| 438 | } | 448 | } |
| 439 | 449 | ||
| @@ -446,8 +456,13 @@ static void stmmac_ethtool_gregs(struct net_device *dev, · 6 unmodified lines | |||
| 446 | stmmac_dump_mac_regs(priv, priv->hw, reg_space); | 456 | stmmac_dump_mac_regs(priv, priv->hw, reg_space); |
| 447 | stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space); | 457 | stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space); |
| 448 | 458 | ||
| 449 | if (!priv->plat->has_xgmac) { | 459 | /* Copy DMA registers to where ethtool expects them */ |
| 450 | /* Copy DMA registers to where ethtool expects them */ | 460 | if (priv->plat->has_gmac4) { |
| 461 | /* GMAC4 dumps its DMA registers at its DMA_CHAN_BASE_ADDR */ | ||
| 462 | memcpy(®_space[ETHTOOL_DMA_OFFSET], | ||
| 463 | ®_space[GMAC4_DMA_CHAN_BASE_ADDR / 4], | ||
| 464 | NUM_DWMAC4_DMA_REGS * 4); | ||
| 465 | } else if (!priv->plat->has_xgmac) { | ||
| 451 | memcpy(®_space[ETHTOOL_DMA_OFFSET], | 466 | memcpy(®_space[ETHTOOL_DMA_OFFSET], |
| 452 | ®_space[DMA_BUS_MODE / 4], | 467 | ®_space[DMA_BUS_MODE / 4], |
| 453 | NUM_DWMAC1000_DMA_REGS * 4); | 468 | NUM_DWMAC1000_DMA_REGS * 4); |
| @@ -145,15 +145,20 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec, · 144 unmodified lines | |||
| 145 | 145 | ||
| 146 | static void get_systime(void __iomem *ioaddr, u64 *systime) | 146 | static void get_systime(void __iomem *ioaddr, u64 *systime) |
| 147 | { | 147 | { |
| 148 | u64 ns; | 148 | u64 ns, sec0, sec1; |
| 149 | 149 | ||
| 150 | /* Get the TSSS value */ | 150 | /* Get the TSS value */ |
| 151 | ns = readl(ioaddr + PTP_STNSR); | 151 | sec1 = readl_relaxed(ioaddr + PTP_STSR); |
| 152 | /* Get the TSS and convert sec time value to nanosecond */ | 152 | do { |
| 153 | ns += readl(ioaddr + PTP_STSR) * 1000000000ULL; | 153 | sec0 = sec1; |
| 154 | /* Get the TSSS value */ | ||
| 155 | ns = readl_relaxed(ioaddr + PTP_STNSR); | ||
| 156 | /* Get the TSS value */ | ||
| 157 | sec1 = readl_relaxed(ioaddr + PTP_STSR); | ||
| 158 | } while (sec0 != sec1); | ||
| 154 | 159 | ||
| 155 | if (systime) | 160 | if (systime) |
| 156 | *systime = ns; | 161 | *systime = ns + (sec1 * 1000000000ULL); |
| 157 | } | 162 | } |
| 158 | 163 | ||
| 159 | static void get_ptptime(void __iomem *ptpaddr, u64 *ptp_time) | 164 | static void get_ptptime(void __iomem *ptpaddr, u64 *ptp_time) |
| @@ -7199,6 +7199,10 @@ int stmmac_dvr_remove(struct device *dev) · 7198 unmodified lines | |||
| 7199 | 7199 | ||
| 7200 | netdev_info(priv->dev, "%s: removing driver", __func__); | 7200 | netdev_info(priv->dev, "%s: removing driver", __func__); |
| 7201 | 7201 | ||
| 7202 | pm_runtime_get_sync(dev); | ||
| 7203 | pm_runtime_disable(dev); | ||
| 7204 | pm_runtime_put_noidle(dev); | ||
| 7205 | |||
| 7202 | stmmac_stop_all_dma(priv); | 7206 | stmmac_stop_all_dma(priv); |
| 7203 | stmmac_mac_set(priv, priv->ioaddr, false); | 7207 | stmmac_mac_set(priv, priv->ioaddr, false); |
| 7204 | netif_carrier_off(ndev); | 7208 | netif_carrier_off(ndev); |
| @@ -7217,8 +7221,6 @@ int stmmac_dvr_remove(struct device *dev) · 12 unmodified lines | |||
| 7217 | if (priv->plat->stmmac_rst) | 7221 | if (priv->plat->stmmac_rst) |
| 7218 | reset_control_assert(priv->plat->stmmac_rst); | 7222 | reset_control_assert(priv->plat->stmmac_rst); |
| 7219 | reset_control_assert(priv->plat->stmmac_ahb_rst); | 7223 | reset_control_assert(priv->plat->stmmac_ahb_rst); |
| 7220 | pm_runtime_put(dev); | ||
| 7221 | pm_runtime_disable(dev); | ||
| 7222 | if (priv->hw->pcs != STMMAC_PCS_TBI && | 7224 | if (priv->hw->pcs != STMMAC_PCS_TBI && |
| 7223 | priv->hw->pcs != STMMAC_PCS_RTBI) | 7225 | priv->hw->pcs != STMMAC_PCS_RTBI) |
| 7224 | stmmac_mdio_unregister(ndev); | 7226 | stmmac_mdio_unregister(ndev); |
| @@ -100,6 +100,7 @@ struct at86rf230_local { · 99 unmodified lines | |||
| 100 | unsigned long cal_timeout; | 100 | unsigned long cal_timeout; |
| 101 | bool is_tx; | 101 | bool is_tx; |
| 102 | bool is_tx_from_off; | 102 | bool is_tx_from_off; |
| 103 | bool was_tx; | ||
| 103 | u8 tx_retry; | 104 | u8 tx_retry; |
| 104 | struct sk_buff *tx_skb; | 105 | struct sk_buff *tx_skb; |
| 105 | struct at86rf230_state_change tx; | 106 | struct at86rf230_state_change tx; |
| @@ -343,7 +344,11 @@ at86rf230_async_error_recover_complete(void *context) · 237 unmodified lines | |||
| 343 | if (ctx->free) | 344 | if (ctx->free) |
| 344 | kfree(ctx); | 345 | kfree(ctx); |
| 345 | 346 | ||
| 346 | ieee802154_wake_queue(lp->hw); | 347 | if (lp->was_tx) { |
| 348 | lp->was_tx = 0; | ||
| 349 | dev_kfree_skb_any(lp->tx_skb); | ||
| 350 | ieee802154_wake_queue(lp->hw); | ||
| 351 | } | ||
| 347 | } | 352 | } |
| 348 | 353 | ||
| 349 | static void | 354 | static void |
| @@ -352,7 +357,11 @@ at86rf230_async_error_recover(void *context) · 2 unmodified lines | |||
| 352 | struct at86rf230_state_change *ctx = context; | 357 | struct at86rf230_state_change *ctx = context; |
| 353 | struct at86rf230_local *lp = ctx->lp; | 358 | struct at86rf230_local *lp = ctx->lp; |
| 354 | 359 | ||
| 355 | lp->is_tx = 0; | 360 | if (lp->is_tx) { |
| 361 | lp->was_tx = 1; | ||
| 362 | lp->is_tx = 0; | ||
| 363 | } | ||
| 364 | |||
| 356 | at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON, | 365 | at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON, |
| 357 | at86rf230_async_error_recover_complete); | 366 | at86rf230_async_error_recover_complete); |
| 358 | } | 367 | } |
| @@ -1771,6 +1771,7 @@ static int ca8210_async_xmit_complete( · 1770 unmodified lines | |||
| 1771 | status | 1771 | status |
| 1772 | ); | 1772 | ); |
| 1773 | if (status != MAC_TRANSACTION_OVERFLOW) { | 1773 | if (status != MAC_TRANSACTION_OVERFLOW) { |
| 1774 | dev_kfree_skb_any(priv->tx_skb); | ||
| 1774 | ieee802154_wake_queue(priv->hw); | 1775 | ieee802154_wake_queue(priv->hw); |
| 1775 | return 0; | 1776 | return 0; |
| 1776 | } | 1777 | } |
| @@ -786,6 +786,7 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev, · 785 unmodified lines | |||
| 786 | goto err_pib; | 786 | goto err_pib; |
| 787 | } | 787 | } |
| 788 | 788 | ||
| 789 | pib->channel = 13; | ||
| 789 | rcu_assign_pointer(phy->pib, pib); | 790 | rcu_assign_pointer(phy->pib, pib); |
| 790 | phy->idx = idx; | 791 | phy->idx = idx; |
| 791 | INIT_LIST_HEAD(&phy->edges); | 792 | INIT_LIST_HEAD(&phy->edges); |
| @@ -976,8 +976,8 @@ static void mcr20a_hw_setup(struct mcr20a_local *lp) · 975 unmodified lines | |||
| 976 | dev_dbg(printdev(lp), "%s\n", __func__); | 976 | dev_dbg(printdev(lp), "%s\n", __func__); |
| 977 | 977 | ||
| 978 | phy->symbol_duration = 16; | 978 | phy->symbol_duration = 16; |
| 979 | phy->lifs_period = 40; | 979 | phy->lifs_period = 40 * phy->symbol_duration; |
| 980 | phy->sifs_period = 12; | 980 | phy->sifs_period = 12 * phy->symbol_duration; |
| 981 | 981 | ||
| 982 | hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | | 982 | hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | |
| 983 | IEEE802154_HW_AFILT | | 983 | IEEE802154_HW_AFILT | |
| @@ -11,6 +11,8 @@ · 10 unmodified lines | |||
| 11 | #include <linux/pm_runtime.h> | 11 | #include <linux/pm_runtime.h> |
| 12 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
| 13 | 13 | ||
| 14 | #include "linux/soc/qcom/qcom_aoss.h" | ||
| 15 | |||
| 14 | #include "ipa.h" | 16 | #include "ipa.h" |
| 15 | #include "ipa_power.h" | 17 | #include "ipa_power.h" |
| 16 | #include "ipa_endpoint.h" | 18 | #include "ipa_endpoint.h" |
| @@ -64,6 +66,7 @@ enum ipa_power_flag { · 47 unmodified lines | |||
| 64 | * struct ipa_power - IPA power management information | 66 | * struct ipa_power - IPA power management information |
| 65 | * @dev: IPA device pointer | 67 | * @dev: IPA device pointer |
| 66 | * @core: IPA core clock | 68 | * @core: IPA core clock |
| 69 | * @qmp: QMP handle for AOSS communication | ||
| 67 | * @spinlock: Protects modem TX queue enable/disable | 70 | * @spinlock: Protects modem TX queue enable/disable |
| 68 | * @flags: Boolean state flags | 71 | * @flags: Boolean state flags |
| 69 | * @interconnect_count: Number of elements in interconnect[] | 72 | * @interconnect_count: Number of elements in interconnect[] |
| @@ -72,6 +75,7 @@ enum ipa_power_flag { · 2 unmodified lines | |||
| 72 | struct ipa_power { | 75 | struct ipa_power { |
| 73 | struct device *dev; | 76 | struct device *dev; |
| 74 | struct clk *core; | 77 | struct clk *core; |
| 78 | struct qmp *qmp; | ||
| 75 | spinlock_t spinlock; /* used with STOPPED/STARTED power flags */ | 79 | spinlock_t spinlock; /* used with STOPPED/STARTED power flags */ |
| 76 | DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT); | 80 | DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT); |
| 77 | u32 interconnect_count; | 81 | u32 interconnect_count; |
| @@ -382,6 +386,47 @@ void ipa_power_modem_queue_active(struct ipa *ipa) · 304 unmodified lines | |||
| 382 | clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags); | 386 | clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags); |
| 383 | } | 387 | } |
| 384 | 388 | ||
| 389 | static int ipa_power_retention_init(struct ipa_power *power) | ||
| 390 | { | ||
| 391 | struct qmp *qmp = qmp_get(power->dev); | ||
| 392 | |||
| 393 | if (IS_ERR(qmp)) { | ||
| 394 | if (PTR_ERR(qmp) == -EPROBE_DEFER) | ||
| 395 | return -EPROBE_DEFER; | ||
| 396 | |||
| 397 | /* We assume any other error means it's not defined/needed */ | ||
| 398 | qmp = NULL; | ||
| 399 | } | ||
| 400 | power->qmp = qmp; | ||
| 401 | |||
| 402 | return 0; | ||
| 403 | } | ||
| 404 | |||
| 405 | static void ipa_power_retention_exit(struct ipa_power *power) | ||
| 406 | { | ||
| 407 | qmp_put(power->qmp); | ||
| 408 | power->qmp = NULL; | ||
| 409 | } | ||
| 410 | |||
| 411 | /* Control register retention on power collapse */ | ||
| 412 | void ipa_power_retention(struct ipa *ipa, bool enable) | ||
| 413 | { | ||
| 414 | static const char fmt[] = "{ class: bcm, res: ipa_pc, val: %c }"; | ||
| 415 | struct ipa_power *power = ipa->power; | ||
| 416 | char buf[36]; /* Exactly enough for fmt[]; size a multiple of 4 */ | ||
| 417 | int ret; | ||
| 418 | |||
| 419 | if (!power->qmp) | ||
| 420 | return; /* Not needed on this platform */ | ||
| 421 | |||
| 422 | (void)snprintf(buf, sizeof(buf), fmt, enable ? '1' : '0'); | ||
| 423 | |||
| 424 | ret = qmp_send(power->qmp, buf, sizeof(buf)); | ||
| 425 | if (ret) | ||
| 426 | dev_err(power->dev, "error %d sending QMP %sable request\n", | ||
| 427 | ret, enable ? "en" : "dis"); | ||
| 428 | } | ||
| 429 | |||
| 385 | int ipa_power_setup(struct ipa *ipa) | 430 | int ipa_power_setup(struct ipa *ipa) |
| 386 | { | 431 | { |
| 387 | int ret; | 432 | int ret; |
| @@ -438,12 +483,18 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data) · 50 unmodified lines | |||
| 438 | if (ret) | 483 | if (ret) |
| 439 | goto err_kfree; | 484 | goto err_kfree; |
| 440 | 485 | ||
| 486 | ret = ipa_power_retention_init(power); | ||
| 487 | if (ret) | ||
| 488 | goto err_interconnect_exit; | ||
| 489 | |||
| 441 | pm_runtime_set_autosuspend_delay(dev, IPA_AUTOSUSPEND_DELAY); | 490 | pm_runtime_set_autosuspend_delay(dev, IPA_AUTOSUSPEND_DELAY); |
| 442 | pm_runtime_use_autosuspend(dev); | 491 | pm_runtime_use_autosuspend(dev); |
| 443 | pm_runtime_enable(dev); | 492 | pm_runtime_enable(dev); |
| 444 | 493 | ||
| 445 | return power; | 494 | return power; |
| 446 | 495 | ||
| 496 | err_interconnect_exit: | ||
| 497 | ipa_interconnect_exit(power); | ||
| 447 | err_kfree: | 498 | err_kfree: |
| 448 | kfree(power); | 499 | kfree(power); |
| 449 | err_clk_put: | 500 | err_clk_put: |
| @@ -460,6 +511,7 @@ void ipa_power_exit(struct ipa_power *power) · 10 unmodified lines | |||
| 460 | 511 | ||
| 461 | pm_runtime_disable(dev); | 512 | pm_runtime_disable(dev); |
| 462 | pm_runtime_dont_use_autosuspend(dev); | 513 | pm_runtime_dont_use_autosuspend(dev); |
| 514 | ipa_power_retention_exit(power); | ||
| 463 | ipa_interconnect_exit(power); | 515 | ipa_interconnect_exit(power); |
| 464 | kfree(power); | 516 | kfree(power); |
| 465 | clk_put(clk); | 517 | clk_put(clk); |
| @@ -40,6 +40,13 @@ void ipa_power_modem_queue_wake(struct ipa *ipa); · 39 unmodified lines | |||
| 40 | */ | 40 | */ |
| 41 | void ipa_power_modem_queue_active(struct ipa *ipa); | 41 | void ipa_power_modem_queue_active(struct ipa *ipa); |
| 42 | 42 | ||
| 43 | /** | ||
| 44 | * ipa_power_retention() - Control register retention on power collapse | ||
| 45 | * @ipa: IPA pointer | ||
| 46 | * @enable: Whether retention should be enabled or disabled | ||
| 47 | */ | ||
| 48 | void ipa_power_retention(struct ipa *ipa, bool enable); | ||
| 49 | |||
| 43 | /** | 50 | /** |
| 44 | * ipa_power_setup() - Set up IPA power management | 51 | * ipa_power_setup() - Set up IPA power management |
| 45 | * @ipa: IPA pointer | 52 | * @ipa: IPA pointer |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | #include "ipa.h" | 12 | #include "ipa.h" |
| 13 | #include "ipa_uc.h" | 13 | #include "ipa_uc.h" |
| 14 | #include "ipa_power.h" | ||
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| 16 | * DOC: The IPA embedded microcontroller | 17 | * DOC: The IPA embedded microcontroller |
| @@ -154,6 +155,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) · 137 unmodified lines | |||
| 154 | case IPA_UC_RESPONSE_INIT_COMPLETED: | 155 | case IPA_UC_RESPONSE_INIT_COMPLETED: |
| 155 | if (ipa->uc_powered) { | 156 | if (ipa->uc_powered) { |
| 156 | ipa->uc_loaded = true; | 157 | ipa->uc_loaded = true; |
| 158 | ipa_power_retention(ipa, true); | ||
| 157 | pm_runtime_mark_last_busy(dev); | 159 | pm_runtime_mark_last_busy(dev); |
| 158 | (void)pm_runtime_put_autosuspend(dev); | 160 | (void)pm_runtime_put_autosuspend(dev); |
| 159 | ipa->uc_powered = false; | 161 | ipa->uc_powered = false; |
| @@ -184,6 +186,9 @@ void ipa_uc_deconfig(struct ipa *ipa) · 24 unmodified lines | |||
| 184 | 186 | ||
| 185 | ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); | 187 | ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); |
| 186 | ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); | 188 | ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); |
| 189 | if (ipa->uc_loaded) | ||
| 190 | ipa_power_retention(ipa, false); | ||
| 191 | |||
| 187 | if (!ipa->uc_powered) | 192 | if (!ipa->uc_powered) |
| 188 | return; | 193 | return; |
| 189 | 194 | ||
| @@ -3870,6 +3870,18 @@ static void macsec_common_dellink(struct net_device *dev, struct list_head *head · 3869 unmodified lines | |||
| 3870 | struct macsec_dev *macsec = macsec_priv(dev); | 3870 | struct macsec_dev *macsec = macsec_priv(dev); |
| 3871 | struct net_device *real_dev = macsec->real_dev; | 3871 | struct net_device *real_dev = macsec->real_dev; |
| 3872 | 3872 | ||
| 3873 | /* If h/w offloading is available, propagate to the device */ | ||
| 3874 | if (macsec_is_offloaded(macsec)) { | ||
| 3875 | const struct macsec_ops *ops; | ||
| 3876 | struct macsec_context ctx; | ||
| 3877 | |||
| 3878 | ops = macsec_get_ops(netdev_priv(dev), &ctx); | ||
| 3879 | if (ops) { | ||
| 3880 | ctx.secy = &macsec->secy; | ||
| 3881 | macsec_offload(ops->mdo_del_secy, &ctx); | ||
| 3882 | } | ||
| 3883 | } | ||
| 3884 | |||
| 3873 | unregister_netdevice_queue(dev, head); | 3885 | unregister_netdevice_queue(dev, head); |
| 3874 | list_del_rcu(&macsec->secys); | 3886 | list_del_rcu(&macsec->secys); |
| 3875 | macsec_del_dev(macsec); | 3887 | macsec_del_dev(macsec); |
| @@ -3884,18 +3896,6 @@ static void macsec_dellink(struct net_device *dev, struct list_head *head) · 8 unmodified lines | |||
| 3884 | struct net_device *real_dev = macsec->real_dev; | 3896 | struct net_device *real_dev = macsec->real_dev; |
| 3885 | struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev); | 3897 | struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev); |
| 3886 | 3898 | ||
| 3887 | /* If h/w offloading is available, propagate to the device */ | ||
| 3888 | if (macsec_is_offloaded(macsec)) { | ||
| 3889 | const struct macsec_ops *ops; | ||
| 3890 | struct macsec_context ctx; | ||
| 3891 | |||
| 3892 | ops = macsec_get_ops(netdev_priv(dev), &ctx); | ||
| 3893 | if (ops) { | ||
| 3894 | ctx.secy = &macsec->secy; | ||
| 3895 | macsec_offload(ops->mdo_del_secy, &ctx); | ||
| 3896 | } | ||
| 3897 | } | ||
| 3898 | |||
| 3899 | macsec_common_dellink(dev, head); | 3899 | macsec_common_dellink(dev, head); |
| 3900 | 3900 | ||
| 3901 | if (list_empty(&rxd->secys)) { | 3901 | if (list_empty(&rxd->secys)) { |
| @@ -4018,6 +4018,15 @@ static int macsec_newlink(struct net *net, struct net_device *dev, · 116 unmodified lines | |||
| 4018 | !macsec_check_offload(macsec->offload, macsec)) | 4018 | !macsec_check_offload(macsec->offload, macsec)) |
| 4019 | return -EOPNOTSUPP; | 4019 | return -EOPNOTSUPP; |
| 4020 | 4020 | ||
| 4021 | /* send_sci must be set to true when transmit sci explicitly is set */ | ||
| 4022 | if ((data && data[IFLA_MACSEC_SCI]) && | ||
| 4023 | (data && data[IFLA_MACSEC_INC_SCI])) { | ||
| 4024 | u8 send_sci = !!nla_get_u8(data[IFLA_MACSEC_INC_SCI]); | ||
| 4025 | |||
| 4026 | if (!send_sci) | ||
| 4027 | return -EINVAL; | ||
| 4028 | } | ||
| 4029 | |||
| 4021 | if (data && data[IFLA_MACSEC_ICV_LEN]) | 4030 | if (data && data[IFLA_MACSEC_ICV_LEN]) |
| 4022 | icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); | 4031 | icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); |
| 4023 | mtu = real_dev->mtu - icv_len - macsec_extra_len(true); | 4032 | mtu = real_dev->mtu - icv_len - macsec_extra_len(true); |
| @@ -1794,19 +1794,19 @@ static int qca808x_read_status(struct phy_device *phydev) · 1793 unmodified lines | |||
| 1794 | if (ret < 0) | 1794 | if (ret < 0) |
| 1795 | return ret; | 1795 | return ret; |
| 1796 | 1796 | ||
| 1797 | if (phydev->link && phydev->speed == SPEED_2500) | 1797 | if (phydev->link) { |
| 1798 | phydev->interface = PHY_INTERFACE_MODE_2500BASEX; | 1798 | if (phydev->speed == SPEED_2500) |
| 1799 | else | 1799 | phydev->interface = PHY_INTERFACE_MODE_2500BASEX; |
| 1800 | phydev->interface = PHY_INTERFACE_MODE_SMII; | 1800 | else |
| 1801 | 1801 | phydev->interface = PHY_INTERFACE_MODE_SGMII; | |
| 1802 | /* generate seed as a lower random value to make PHY linked as SLAVE easily, | 1802 | } else { |
| 1803 | * except for master/slave configuration fault detected. | 1803 | /* generate seed as a lower random value to make PHY linked as SLAVE easily, |
| 1804 | * the reason for not putting this code into the function link_change_notify is | 1804 | * except for master/slave configuration fault detected. |
| 1805 | * the corner case where the link partner is also the qca8081 PHY and the seed | 1805 | * the reason for not putting this code into the function link_change_notify is |
| 1806 | * value is configured as the same value, the link can't be up and no link change | 1806 | * the corner case where the link partner is also the qca8081 PHY and the seed |
| 1807 | * occurs. | 1807 | * value is configured as the same value, the link can't be up and no link change |
| 1808 | */ | 1808 | * occurs. |
| 1809 | if (!phydev->link) { | 1809 | */ |
| 1810 | if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) { | 1810 | if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) { |
| 1811 | qca808x_phy_ms_seed_enable(phydev, false); | 1811 | qca808x_phy_ms_seed_enable(phydev, false); |
| 1812 | } else { | 1812 | } else { |
| @@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone) · 120 unmodified lines | |||
| 121 | if (tx_buf == NULL) | 121 | if (tx_buf == NULL) |
| 122 | goto free_rx_urb; | 122 | goto free_rx_urb; |
| 123 | 123 | ||
| 124 | rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE, | 124 | rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, |
| 125 | GFP_KERNEL, &rx_urb->transfer_dma); | 125 | GFP_KERNEL, &rx_urb->transfer_dma); |
| 126 | if (rx_buf == NULL) | 126 | if (rx_buf == NULL) |
| 127 | goto free_tx_buf; | 127 | goto free_tx_buf; |
| @@ -146,7 +146,7 @@ error_nomem: · 18 unmodified lines | |||
| 146 | 146 | ||
| 147 | static void ipheth_free_urbs(struct ipheth_device *iphone) | 147 | static void ipheth_free_urbs(struct ipheth_device *iphone) |
| 148 | { | 148 | { |
| 149 | usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf, | 149 | usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, iphone->rx_buf, |
| 150 | iphone->rx_urb->transfer_dma); | 150 | iphone->rx_urb->transfer_dma); |
| 151 | usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf, | 151 | usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf, |
| 152 | iphone->tx_urb->transfer_dma); | 152 | iphone->tx_urb->transfer_dma); |
| @@ -317,7 +317,7 @@ static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags) · 164 unmodified lines | |||
| 317 | 317 | ||
| 318 | usb_fill_bulk_urb(dev->rx_urb, udev, | 318 | usb_fill_bulk_urb(dev->rx_urb, udev, |
| 319 | usb_rcvbulkpipe(udev, dev->bulk_in), | 319 | usb_rcvbulkpipe(udev, dev->bulk_in), |
| 320 | dev->rx_buf, IPHETH_BUF_SIZE, | 320 | dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, |
| 321 | ipheth_rcvbulk_callback, | 321 | ipheth_rcvbulk_callback, |
| 322 | dev); | 322 | dev); |
| 323 | dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 323 | dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
| @@ -1092,7 +1092,6 @@ static void __nvmf_concat_opt_tokens(struct seq_file *seq_file) · 1091 unmodified lines | |||
| 1092 | static int nvmf_dev_show(struct seq_file *seq_file, void *private) | 1092 | static int nvmf_dev_show(struct seq_file *seq_file, void *private) |
| 1093 | { | 1093 | { |
| 1094 | struct nvme_ctrl *ctrl; | 1094 | struct nvme_ctrl *ctrl; |
| 1095 | int ret = 0; | ||
| 1096 | 1095 | ||
| 1097 | mutex_lock(&nvmf_dev_mutex); | 1096 | mutex_lock(&nvmf_dev_mutex); |
| 1098 | ctrl = seq_file->private; | 1097 | ctrl = seq_file->private; |
| @@ -1106,7 +1105,7 @@ static int nvmf_dev_show(struct seq_file *seq_file, void *private) · 7 unmodified lines | |||
| 1106 | 1105 | ||
| 1107 | out_unlock: | 1106 | out_unlock: |
| 1108 | mutex_unlock(&nvmf_dev_mutex); | 1107 | mutex_unlock(&nvmf_dev_mutex); |
| 1109 | return ret; | 1108 | return 0; |
| 1110 | } | 1109 | } |
| 1111 | 1110 | ||
| 1112 | static int nvmf_dev_open(struct inode *inode, struct file *file) | 1111 | static int nvmf_dev_open(struct inode *inode, struct file *file) |
| @@ -3391,7 +3391,8 @@ static const struct pci_device_id nvme_id_table[] = { · 3390 unmodified lines | |||
| 3391 | NVME_QUIRK_DEALLOCATE_ZEROES, }, | 3391 | NVME_QUIRK_DEALLOCATE_ZEROES, }, |
| 3392 | { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ | 3392 | { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ |
| 3393 | .driver_data = NVME_QUIRK_STRIPE_SIZE | | 3393 | .driver_data = NVME_QUIRK_STRIPE_SIZE | |
| 3394 | NVME_QUIRK_DEALLOCATE_ZEROES, }, | 3394 | NVME_QUIRK_DEALLOCATE_ZEROES | |
| 3395 | NVME_QUIRK_IGNORE_DEV_SUBNQN, }, | ||
| 3395 | { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ | 3396 | { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ |
| 3396 | .driver_data = NVME_QUIRK_STRIPE_SIZE | | 3397 | .driver_data = NVME_QUIRK_STRIPE_SIZE | |
| 3397 | NVME_QUIRK_DEALLOCATE_ZEROES, }, | 3398 | NVME_QUIRK_DEALLOCATE_ZEROES, }, |
| @@ -109,15 +109,6 @@ static inline void pcie_write(struct mt7621_pcie *pcie, u32 val, u32 reg) · 108 unmodified lines | |||
| 109 | writel_relaxed(val, pcie->base + reg); | 109 | writel_relaxed(val, pcie->base + reg); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | static inline void pcie_rmw(struct mt7621_pcie *pcie, u32 reg, u32 clr, u32 set) | ||
| 113 | { | ||
| 114 | u32 val = readl_relaxed(pcie->base + reg); | ||
| 115 | |||
| 116 | val &= ~clr; | ||
| 117 | val |= set; | ||
| 118 | writel_relaxed(val, pcie->base + reg); | ||
| 119 | } | ||
| 120 | |||
| 121 | static inline u32 pcie_port_read(struct mt7621_pcie_port *port, u32 reg) | 112 | static inline u32 pcie_port_read(struct mt7621_pcie_port *port, u32 reg) |
| 122 | { | 113 | { |
| 123 | return readl_relaxed(port->base + reg); | 114 | return readl_relaxed(port->base + reg); |
| @@ -557,7 +548,7 @@ static struct platform_driver mt7621_pcie_driver = { · 433 unmodified lines | |||
| 557 | .remove = mt7621_pcie_remove, | 548 | .remove = mt7621_pcie_remove, |
| 558 | .driver = { | 549 | .driver = { |
| 559 | .name = "mt7621-pci", | 550 | .name = "mt7621-pci", |
| 560 | .of_match_table = of_match_ptr(mt7621_pcie_ids), | 551 | .of_match_table = mt7621_pcie_ids, |
| 561 | }, | 552 | }, |
| 562 | }; | 553 | }; |
| 563 | builtin_platform_driver(mt7621_pcie_driver); | 554 | builtin_platform_driver(mt7621_pcie_driver); |
| @@ -42,9 +42,9 @@ obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o · 41 unmodified lines | |||
| 42 | obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o | 42 | obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o |
| 43 | obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o | 43 | obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o |
| 44 | obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o | 44 | obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o |
| 45 | obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o | ||
| 45 | obj-$(CONFIG_PINCTRL_STARFIVE) += pinctrl-starfive.o | 46 | obj-$(CONFIG_PINCTRL_STARFIVE) += pinctrl-starfive.o |
| 46 | obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o | 47 | obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o |
| 47 | obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o | ||
| 48 | obj-$(CONFIG_PINCTRL_SX150X) += pinctrl-sx150x.o | 48 | obj-$(CONFIG_PINCTRL_SX150X) += pinctrl-sx150x.o |
| 49 | obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o | 49 | obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o |
| 50 | obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o | 50 | obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o |
| @@ -35,6 +35,7 @@ config PINCTRL_BCM63XX · 34 unmodified lines | |||
| 35 | select PINCONF | 35 | select PINCONF |
| 36 | select GENERIC_PINCONF | 36 | select GENERIC_PINCONF |
| 37 | select GPIOLIB | 37 | select GPIOLIB |
| 38 | select REGMAP | ||
| 38 | select GPIO_REGMAP | 39 | select GPIO_REGMAP |
| 39 | 40 | ||
| 40 | config PINCTRL_BCM6318 | 41 | config PINCTRL_BCM6318 |
| @@ -1269,16 +1269,18 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 1268 unmodified lines | |||
| 1269 | sizeof(*girq->parents), | 1269 | sizeof(*girq->parents), |
| 1270 | GFP_KERNEL); | 1270 | GFP_KERNEL); |
| 1271 | if (!girq->parents) { | 1271 | if (!girq->parents) { |
| 1272 | pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); | 1272 | err = -ENOMEM; |
| 1273 | return -ENOMEM; | 1273 | goto out_remove; |
| 1274 | } | 1274 | } |
| 1275 | 1275 | ||
| 1276 | if (is_7211) { | 1276 | if (is_7211) { |
| 1277 | pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS, | 1277 | pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS, |
| 1278 | sizeof(*pc->wake_irq), | 1278 | sizeof(*pc->wake_irq), |
| 1279 | GFP_KERNEL); | 1279 | GFP_KERNEL); |
| 1280 | if (!pc->wake_irq) | 1280 | if (!pc->wake_irq) { |
| 1281 | return -ENOMEM; | 1281 | err = -ENOMEM; |
| 1282 | goto out_remove; | ||
| 1283 | } | ||
| 1282 | } | 1284 | } |
| 1283 | 1285 | ||
| 1284 | /* | 1286 | /* |
| @@ -1306,8 +1308,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 21 unmodified lines | |||
| 1306 | 1308 | ||
| 1307 | len = strlen(dev_name(pc->dev)) + 16; | 1309 | len = strlen(dev_name(pc->dev)) + 16; |
| 1308 | name = devm_kzalloc(pc->dev, len, GFP_KERNEL); | 1310 | name = devm_kzalloc(pc->dev, len, GFP_KERNEL); |
| 1309 | if (!name) | 1311 | if (!name) { |
| 1310 | return -ENOMEM; | 1312 | err = -ENOMEM; |
| 1313 | goto out_remove; | ||
| 1314 | } | ||
| 1311 | 1315 | ||
| 1312 | snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i); | 1316 | snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i); |
| 1313 | 1317 | ||
| @@ -1326,11 +1330,14 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 12 unmodified lines | |||
| 1326 | err = gpiochip_add_data(&pc->gpio_chip, pc); | 1330 | err = gpiochip_add_data(&pc->gpio_chip, pc); |
| 1327 | if (err) { | 1331 | if (err) { |
| 1328 | dev_err(dev, "could not add GPIO chip\n"); | 1332 | dev_err(dev, "could not add GPIO chip\n"); |
| 1329 | pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); | 1333 | goto out_remove; |
| 1330 | return err; | ||
| 1331 | } | 1334 | } |
| 1332 | 1335 | ||
| 1333 | return 0; | 1336 | return 0; |
| 1337 | |||
| 1338 | out_remove: | ||
| 1339 | pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); | ||
| 1340 | return err; | ||
| 1334 | } | 1341 | } |
| 1335 | 1342 | ||
| 1336 | static struct platform_driver bcm2835_pinctrl_driver = { | 1343 | static struct platform_driver bcm2835_pinctrl_driver = { |
| @@ -1471,8 +1471,9 @@ static void chv_gpio_irq_handler(struct irq_desc *desc) · 1470 unmodified lines | |||
| 1471 | 1471 | ||
| 1472 | offset = cctx->intr_lines[intr_line]; | 1472 | offset = cctx->intr_lines[intr_line]; |
| 1473 | if (offset == CHV_INVALID_HWIRQ) { | 1473 | if (offset == CHV_INVALID_HWIRQ) { |
| 1474 | dev_err(dev, "interrupt on unused interrupt line %u\n", intr_line); | 1474 | dev_warn_once(dev, "interrupt on unmapped interrupt line %u\n", intr_line); |
| 1475 | continue; | 1475 | /* Some boards expect hwirq 0 to trigger in this case */ |
| 1476 | offset = 0; | ||
| 1476 | } | 1477 | } |
| 1477 | 1478 | ||
| 1478 | generic_handle_domain_irq(gc->irq.domain, offset); | 1479 | generic_handle_domain_irq(gc->irq.domain, offset); |
| @@ -451,8 +451,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0) · 450 unmodified lines | |||
| 451 | value &= ~PADCFG0_PMODE_MASK; | 451 | value &= ~PADCFG0_PMODE_MASK; |
| 452 | value |= PADCFG0_PMODE_GPIO; | 452 | value |= PADCFG0_PMODE_GPIO; |
| 453 | 453 | ||
| 454 | /* Disable input and output buffers */ | 454 | /* Disable TX buffer and enable RX (this will be input) */ |
| 455 | value |= PADCFG0_GPIORXDIS; | 455 | value &= ~PADCFG0_GPIORXDIS; |
| 456 | value |= PADCFG0_GPIOTXDIS; | 456 | value |= PADCFG0_GPIOTXDIS; |
| 457 | 457 | ||
| 458 | /* Disable SCI/SMI/NMI generation */ | 458 | /* Disable SCI/SMI/NMI generation */ |
| @@ -497,9 +497,6 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, · 38 unmodified lines | |||
| 497 | 497 | ||
| 498 | intel_gpio_set_gpio_mode(padcfg0); | 498 | intel_gpio_set_gpio_mode(padcfg0); |
| 499 | 499 | ||
| 500 | /* Disable TX buffer and enable RX (this will be input) */ | ||
| 501 | __intel_gpio_set_direction(padcfg0, true); | ||
| 502 | |||
| 503 | raw_spin_unlock_irqrestore(&pctrl->lock, flags); | 500 | raw_spin_unlock_irqrestore(&pctrl->lock, flags); |
| 504 | 501 | ||
| 505 | return 0; | 502 | return 0; |
| @@ -1115,9 +1112,6 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type) · 609 unmodified lines | |||
| 1115 | 1112 | ||
| 1116 | intel_gpio_set_gpio_mode(reg); | 1113 | intel_gpio_set_gpio_mode(reg); |
| 1117 | 1114 | ||
| 1118 | /* Disable TX buffer and enable RX (this will be input) */ | ||
| 1119 | __intel_gpio_set_direction(reg, true); | ||
| 1120 | |||
| 1121 | value = readl(reg); | 1115 | value = readl(reg); |
| 1122 | 1116 | ||
| 1123 | value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV); | 1117 | value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV); |
| @@ -1216,6 +1210,39 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) · 92 unmodified lines | |||
| 1216 | return IRQ_RETVAL(ret); | 1210 | return IRQ_RETVAL(ret); |
| 1217 | } | 1211 | } |
| 1218 | 1212 | ||
| 1213 | static void intel_gpio_irq_init(struct intel_pinctrl *pctrl) | ||
| 1214 | { | ||
| 1215 | int i; | ||
| 1216 | |||
| 1217 | for (i = 0; i < pctrl->ncommunities; i++) { | ||
| 1218 | const struct intel_community *community; | ||
| 1219 | void __iomem *base; | ||
| 1220 | unsigned int gpp; | ||
| 1221 | |||
| 1222 | community = &pctrl->communities[i]; | ||
| 1223 | base = community->regs; | ||
| 1224 | |||
| 1225 | for (gpp = 0; gpp < community->ngpps; gpp++) { | ||
| 1226 | /* Mask and clear all interrupts */ | ||
| 1227 | writel(0, base + community->ie_offset + gpp * 4); | ||
| 1228 | writel(0xffff, base + community->is_offset + gpp * 4); | ||
| 1229 | } | ||
| 1230 | } | ||
| 1231 | } | ||
| 1232 | |||
| 1233 | static int intel_gpio_irq_init_hw(struct gpio_chip *gc) | ||
| 1234 | { | ||
| 1235 | struct intel_pinctrl *pctrl = gpiochip_get_data(gc); | ||
| 1236 | |||
| 1237 | /* | ||
| 1238 | * Make sure the interrupt lines are in a proper state before | ||
| 1239 | * further configuration. | ||
| 1240 | */ | ||
| 1241 | intel_gpio_irq_init(pctrl); | ||
| 1242 | |||
| 1243 | return 0; | ||
| 1244 | } | ||
| 1245 | |||
| 1219 | static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl, | 1246 | static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl, |
| 1220 | const struct intel_community *community) | 1247 | const struct intel_community *community) |
| 1221 | { | 1248 | { |
| @@ -1320,6 +1347,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) · 98 unmodified lines | |||
| 1320 | girq->num_parents = 0; | 1347 | girq->num_parents = 0; |
| 1321 | girq->default_type = IRQ_TYPE_NONE; | 1348 | girq->default_type = IRQ_TYPE_NONE; |
| 1322 | girq->handler = handle_bad_irq; | 1349 | girq->handler = handle_bad_irq; |
| 1350 | girq->init_hw = intel_gpio_irq_init_hw; | ||
| 1323 | 1351 | ||
| 1324 | ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl); | 1352 | ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl); |
| 1325 | if (ret) { | 1353 | if (ret) { |
| @@ -1695,26 +1723,6 @@ int intel_pinctrl_suspend_noirq(struct device *dev) · 369 unmodified lines | |||
| 1695 | } | 1723 | } |
| 1696 | EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq); | 1724 | EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq); |
| 1697 | 1725 | ||
| 1698 | static void intel_gpio_irq_init(struct intel_pinctrl *pctrl) | ||
| 1699 | { | ||
| 1700 | size_t i; | ||
| 1701 | |||
| 1702 | for (i = 0; i < pctrl->ncommunities; i++) { | ||
| 1703 | const struct intel_community *community; | ||
| 1704 | void __iomem *base; | ||
| 1705 | unsigned int gpp; | ||
| 1706 | |||
| 1707 | community = &pctrl->communities[i]; | ||
| 1708 | base = community->regs; | ||
| 1709 | |||
| 1710 | for (gpp = 0; gpp < community->ngpps; gpp++) { | ||
| 1711 | /* Mask and clear all interrupts */ | ||
| 1712 | writel(0, base + community->ie_offset + gpp * 4); | ||
| 1713 | writel(0xffff, base + community->is_offset + gpp * 4); | ||
| 1714 | } | ||
| 1715 | } | ||
| 1716 | } | ||
| 1717 | |||
| 1718 | static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value) | 1726 | static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value) |
| 1719 | { | 1727 | { |
| 1720 | u32 curr, updated; | 1728 | u32 curr, updated; |
| @@ -137,7 +137,8 @@ static inline int sgpio_addr_to_pin(struct sgpio_priv *priv, int port, int bit) · 136 unmodified lines | |||
| 137 | 137 | ||
| 138 | static inline u32 sgpio_get_addr(struct sgpio_priv *priv, u32 rno, u32 off) | 138 | static inline u32 sgpio_get_addr(struct sgpio_priv *priv, u32 rno, u32 off) |
| 139 | { | 139 | { |
| 140 | return priv->properties->regoff[rno] + off; | 140 | return (priv->properties->regoff[rno] + off) * |
| 141 | regmap_get_reg_stride(priv->regs); | ||
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off) | 144 | static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off) |
| @@ -773,63 +773,42 @@ static int thunderbay_build_groups(struct thunderbay_pinctrl *tpc) · 772 unmodified lines | |||
| 773 | 773 | ||
| 774 | static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct function_desc *funcs) | 774 | static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct function_desc *funcs) |
| 775 | { | 775 | { |
| 776 | struct function_desc *function = funcs; | ||
| 777 | int i; | 776 | int i; |
| 778 | 777 | ||
| 779 | /* Assign the groups for each function */ | 778 | /* Assign the groups for each function */ |
| 780 | for (i = 0; i < tpc->soc->npins; i++) { | 779 | for (i = 0; i < tpc->nfuncs; i++) { |
| 781 | const struct pinctrl_pin_desc *pin_info = thunderbay_pins + i; | 780 | struct function_desc *func = &funcs[i]; |
| 782 | struct thunderbay_mux_desc *pin_mux = pin_info->drv_data; | 781 | const char **group_names; |
| 783 | 782 | unsigned int grp_idx = 0; | |
| 784 | while (pin_mux->name) { | 783 | int j; |
| 785 | const char **grp; | 784 | |
| 786 | int j, grp_num, match = 0; | 785 | group_names = devm_kcalloc(tpc->dev, func->num_group_names, |
| 787 | size_t grp_size; | 786 | sizeof(*group_names), GFP_KERNEL); |
| 788 | struct function_desc *func; | 787 | if (!group_names) |
| 789 | 788 | return -ENOMEM; | |
| 790 | for (j = 0; j < tpc->nfuncs; j++) { | 789 | |
| 791 | if (!strcmp(pin_mux->name, function[j].name)) { | 790 | for (j = 0; j < tpc->soc->npins; j++) { |
| 792 | match = 1; | 791 | const struct pinctrl_pin_desc *pin_info = &thunderbay_pins[j]; |
| 793 | break; | 792 | struct thunderbay_mux_desc *pin_mux; |
| 794 | } | 793 | |
| 795 | } | 794 | for (pin_mux = pin_info->drv_data; pin_mux->name; pin_mux++) { |
| 796 | 795 | if (!strcmp(pin_mux->name, func->name)) | |
| 797 | if (!match) | 796 | group_names[grp_idx++] = pin_info->name; |
| 798 | return -EINVAL; | ||
| 799 | |||
| 800 | func = function + j; | ||
| 801 | grp_num = func->num_group_names; | ||
| 802 | grp_size = sizeof(*func->group_names); | ||
| 803 | |||
| 804 | if (!func->group_names) { | ||
| 805 | func->group_names = devm_kcalloc(tpc->dev, | ||
| 806 | grp_num, | ||
| 807 | grp_size, | ||
| 808 | GFP_KERNEL); | ||
| 809 | if (!func->group_names) { | ||
| 810 | kfree(func); | ||
| 811 | return -ENOMEM; | ||
| 812 | } | ||
| 813 | } | 797 | } |
| 814 | |||
| 815 | grp = func->group_names; | ||
| 816 | while (*grp) | ||
| 817 | grp++; | ||
| 818 | |||
| 819 | *grp = pin_info->name; | ||
| 820 | pin_mux++; | ||
| 821 | } | 798 | } |
| 799 | |||
| 800 | func->group_names = group_names; | ||
| 822 | } | 801 | } |
| 823 | 802 | ||
| 824 | /* Add all functions */ | 803 | /* Add all functions */ |
| 825 | for (i = 0; i < tpc->nfuncs; i++) { | 804 | for (i = 0; i < tpc->nfuncs; i++) { |
| 826 | pinmux_generic_add_function(tpc->pctrl, | 805 | pinmux_generic_add_function(tpc->pctrl, |
| 827 | function[i].name, | 806 | funcs[i].name, |
| 828 | function[i].group_names, | 807 | funcs[i].group_names, |
| 829 | function[i].num_group_names, | 808 | funcs[i].num_group_names, |
| 830 | function[i].data); | 809 | funcs[i].data); |
| 831 | } | 810 | } |
| 832 | kfree(function); | 811 | kfree(funcs); |
| 833 | return 0; | 812 | return 0; |
| 834 | } | 813 | } |
| 835 | 814 | ||
| @@ -839,27 +818,30 @@ static int thunderbay_build_functions(struct thunderbay_pinctrl *tpc) · 3 unmodified lines | |||
| 839 | void *ptr; | 818 | void *ptr; |
| 840 | int pin; | 819 | int pin; |
| 841 | 820 | ||
| 842 | /* Total number of functions is unknown at this point. Allocate first. */ | 821 | /* |
| 822 | * Allocate maximum possible number of functions. Assume every pin | ||
| 823 | * being part of 8 (hw maximum) globally unique muxes. | ||
| 824 | */ | ||
| 843 | tpc->nfuncs = 0; | 825 | tpc->nfuncs = 0; |
| 844 | thunderbay_funcs = kcalloc(tpc->soc->npins * 8, | 826 | thunderbay_funcs = kcalloc(tpc->soc->npins * 8, |
| 845 | sizeof(*thunderbay_funcs), GFP_KERNEL); | 827 | sizeof(*thunderbay_funcs), GFP_KERNEL); |
| 846 | if (!thunderbay_funcs) | 828 | if (!thunderbay_funcs) |
| 847 | return -ENOMEM; | 829 | return -ENOMEM; |
| 848 | 830 | ||
| 849 | /* Find total number of functions and each's properties */ | 831 | /* Setup 1 function for each unique mux */ |
| 850 | for (pin = 0; pin < tpc->soc->npins; pin++) { | 832 | for (pin = 0; pin < tpc->soc->npins; pin++) { |
| 851 | const struct pinctrl_pin_desc *pin_info = thunderbay_pins + pin; | 833 | const struct pinctrl_pin_desc *pin_info = thunderbay_pins + pin; |
| 852 | struct thunderbay_mux_desc *pin_mux = pin_info->drv_data; | 834 | struct thunderbay_mux_desc *pin_mux; |
| 853 | 835 | ||
| 854 | while (pin_mux->name) { | 836 | for (pin_mux = pin_info->drv_data; pin_mux->name; pin_mux++) { |
| 855 | struct function_desc *func = thunderbay_funcs; | 837 | struct function_desc *func; |
| 856 | 838 | ||
| 857 | while (func->name) { | 839 | /* Check if we already have function for this mux */ |
| 840 | for (func = thunderbay_funcs; func->name; func++) { | ||
| 858 | if (!strcmp(pin_mux->name, func->name)) { | 841 | if (!strcmp(pin_mux->name, func->name)) { |
| 859 | func->num_group_names++; | 842 | func->num_group_names++; |
| 860 | break; | 843 | break; |
| 861 | } | 844 | } |
| 862 | func++; | ||
| 863 | } | 845 | } |
| 864 | 846 | ||
| 865 | if (!func->name) { | 847 | if (!func->name) { |
| @@ -868,8 +850,6 @@ static int thunderbay_build_functions(struct thunderbay_pinctrl *tpc) · 2 unmodified lines | |||
| 868 | func->data = (int *)&pin_mux->mode; | 850 | func->data = (int *)&pin_mux->mode; |
| 869 | tpc->nfuncs++; | 851 | tpc->nfuncs++; |
| 870 | } | 852 | } |
| 871 | |||
| 872 | pin_mux++; | ||
| 873 | } | 853 | } |
| 874 | } | 854 | } |
| 875 | 855 | ||
| @@ -809,7 +809,6 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, · 808 unmodified lines | |||
| 809 | unsigned int *npins) | 809 | unsigned int *npins) |
| 810 | { | 810 | { |
| 811 | struct pinctrl_pin_desc *pins, *pin; | 811 | struct pinctrl_pin_desc *pins, *pin; |
| 812 | char **pin_names; | ||
| 813 | int ret; | 812 | int ret; |
| 814 | int i; | 813 | int i; |
| 815 | 814 | ||
| @@ -821,14 +820,13 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, · 5 unmodified lines | |||
| 821 | if (!pins) | 820 | if (!pins) |
| 822 | return -ENOMEM; | 821 | return -ENOMEM; |
| 823 | 822 | ||
| 824 | pin_names = devm_kasprintf_strarray(dev, ZYNQMP_PIN_PREFIX, *npins); | ||
| 825 | if (IS_ERR(pin_names)) | ||
| 826 | return PTR_ERR(pin_names); | ||
| 827 | |||
| 828 | for (i = 0; i < *npins; i++) { | 823 | for (i = 0; i < *npins; i++) { |
| 829 | pin = &pins[i]; | 824 | pin = &pins[i]; |
| 830 | pin->number = i; | 825 | pin->number = i; |
| 831 | pin->name = pin_names[i]; | 826 | pin->name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", |
| 827 | ZYNQMP_PIN_PREFIX, i); | ||
| 828 | if (!pin->name) | ||
| 829 | return -ENOMEM; | ||
| 832 | } | 830 | } |
| 833 | 831 | ||
| 834 | *zynqmp_pins = pins; | 832 | *zynqmp_pins = pins; |
| @@ -363,16 +363,16 @@ static const struct sunxi_desc_pin h616_pins[] = { · 362 unmodified lines | |||
| 363 | SUNXI_FUNCTION(0x0, "gpio_in"), | 363 | SUNXI_FUNCTION(0x0, "gpio_in"), |
| 364 | SUNXI_FUNCTION(0x1, "gpio_out"), | 364 | SUNXI_FUNCTION(0x1, "gpio_out"), |
| 365 | SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ | 365 | SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ |
| 366 | SUNXI_FUNCTION(0x3, "i2s3"), /* DO0 */ | 366 | SUNXI_FUNCTION(0x3, "i2s3_dout0"), /* DO0 */ |
| 367 | SUNXI_FUNCTION(0x4, "spi1"), /* MISO */ | 367 | SUNXI_FUNCTION(0x4, "spi1"), /* MISO */ |
| 368 | SUNXI_FUNCTION(0x5, "i2s3"), /* DI1 */ | 368 | SUNXI_FUNCTION(0x5, "i2s3_din1"), /* DI1 */ |
| 369 | SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 8)), /* PH_EINT8 */ | 369 | SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 8)), /* PH_EINT8 */ |
| 370 | SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9), | 370 | SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9), |
| 371 | SUNXI_FUNCTION(0x0, "gpio_in"), | 371 | SUNXI_FUNCTION(0x0, "gpio_in"), |
| 372 | SUNXI_FUNCTION(0x1, "gpio_out"), | 372 | SUNXI_FUNCTION(0x1, "gpio_out"), |
| 373 | SUNXI_FUNCTION(0x3, "i2s3"), /* DI0 */ | 373 | SUNXI_FUNCTION(0x3, "i2s3_din0"), /* DI0 */ |
| 374 | SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */ | 374 | SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */ |
| 375 | SUNXI_FUNCTION(0x3, "i2s3"), /* DO1 */ | 375 | SUNXI_FUNCTION(0x5, "i2s3_dout1"), /* DO1 */ |
| 376 | SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 9)), /* PH_EINT9 */ | 376 | SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 9)), /* PH_EINT9 */ |
| 377 | SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10), | 377 | SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10), |
| 378 | SUNXI_FUNCTION(0x0, "gpio_in"), | 378 | SUNXI_FUNCTION(0x0, "gpio_in"), |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | menuconfig SURFACE_PLATFORMS | 6 | menuconfig SURFACE_PLATFORMS |
| 7 | bool "Microsoft Surface Platform-Specific Device Drivers" | 7 | bool "Microsoft Surface Platform-Specific Device Drivers" |
| 8 | depends on ARM64 || X86 || COMPILE_TEST | ||
| 8 | default y | 9 | default y |
| 9 | help | 10 | help |
| 10 | Say Y here to get to see options for platform-specific device drivers | 11 | Say Y here to get to see options for platform-specific device drivers |
| @@ -124,9 +124,10 @@ struct amd_pmc_dev { · 123 unmodified lines | |||
| 124 | u32 cpu_id; | 124 | u32 cpu_id; |
| 125 | u32 active_ips; | 125 | u32 active_ips; |
| 126 | /* SMU version information */ | 126 | /* SMU version information */ |
| 127 | u16 major; | 127 | u8 smu_program; |
| 128 | u16 minor; | 128 | u8 major; |
| 129 | u16 rev; | 129 | u8 minor; |
| 130 | u8 rev; | ||
| 130 | struct device *dev; | 131 | struct device *dev; |
| 131 | struct pci_dev *rdev; | 132 | struct pci_dev *rdev; |
| 132 | struct mutex lock; /* generic mutex lock */ | 133 | struct mutex lock; /* generic mutex lock */ |
| @@ -180,11 +181,13 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) · 47 unmodified lines | |||
| 180 | if (rc) | 181 | if (rc) |
| 181 | return rc; | 182 | return rc; |
| 182 | 183 | ||
| 183 | dev->major = (val >> 16) & GENMASK(15, 0); | 184 | dev->smu_program = (val >> 24) & GENMASK(7, 0); |
| 185 | dev->major = (val >> 16) & GENMASK(7, 0); | ||
| 184 | dev->minor = (val >> 8) & GENMASK(7, 0); | 186 | dev->minor = (val >> 8) & GENMASK(7, 0); |
| 185 | dev->rev = (val >> 0) & GENMASK(7, 0); | 187 | dev->rev = (val >> 0) & GENMASK(7, 0); |
| 186 | 188 | ||
| 187 | dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev); | 189 | dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n", |
| 190 | dev->smu_program, dev->major, dev->minor, dev->rev); | ||
| 188 | 191 | ||
| 189 | return 0; | 192 | return 0; |
| 190 | } | 193 | } |
| @@ -226,7 +229,7 @@ static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp) · 35 unmodified lines | |||
| 226 | return 0; | 229 | return 0; |
| 227 | } | 230 | } |
| 228 | 231 | ||
| 229 | const struct file_operations amd_pmc_stb_debugfs_fops = { | 232 | static const struct file_operations amd_pmc_stb_debugfs_fops = { |
| 230 | .owner = THIS_MODULE, | 233 | .owner = THIS_MODULE, |
| 231 | .open = amd_pmc_stb_debugfs_open, | 234 | .open = amd_pmc_stb_debugfs_open, |
| 232 | .read = amd_pmc_stb_debugfs_read, | 235 | .read = amd_pmc_stb_debugfs_read, |
| @@ -250,7 +250,7 @@ static int tf103c_dock_hid_raw_request(struct hid_device *hid, u8 reportnum, · 249 unmodified lines | |||
| 250 | return 0; | 250 | return 0; |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | struct hid_ll_driver tf103c_dock_hid_ll_driver = { | 253 | static struct hid_ll_driver tf103c_dock_hid_ll_driver = { |
| 254 | .parse = tf103c_dock_hid_parse, | 254 | .parse = tf103c_dock_hid_parse, |
| 255 | .start = tf103c_dock_hid_start, | 255 | .start = tf103c_dock_hid_start, |
| 256 | .stop = tf103c_dock_hid_stop, | 256 | .stop = tf103c_dock_hid_stop, |
| @@ -921,7 +921,7 @@ static int __maybe_unused tf103c_dock_resume(struct device *dev) · 664 unmodified lines | |||
| 921 | return 0; | 921 | return 0; |
| 922 | } | 922 | } |
| 923 | 923 | ||
| 924 | SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume); | 924 | static SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume); |
| 925 | 925 | ||
| 926 | static const struct acpi_device_id tf103c_dock_acpi_match[] = { | 926 | static const struct acpi_device_id tf103c_dock_acpi_match[] = { |
| 927 | {"NPCE69A"}, | 927 | {"NPCE69A"}, |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include <linux/regmap.h> | 17 | #include <linux/regmap.h> |
| 18 | 18 | ||
| 19 | #define CHGRIRQ_REG 0x0a | 19 | #define CHGRIRQ_REG 0x0a |
| 20 | #define MCHGRIRQ_REG 0x17 | ||
| 20 | 21 | ||
| 21 | struct crystal_cove_charger_data { | 22 | struct crystal_cove_charger_data { |
| 22 | struct mutex buslock; /* irq_bus_lock */ | 23 | struct mutex buslock; /* irq_bus_lock */ |
| @@ -25,8 +26,8 @@ struct crystal_cove_charger_data { · 2 unmodified lines | |||
| 25 | struct irq_domain *irq_domain; | 26 | struct irq_domain *irq_domain; |
| 26 | int irq; | 27 | int irq; |
| 27 | int charger_irq; | 28 | int charger_irq; |
| 28 | bool irq_enabled; | 29 | u8 mask; |
| 29 | bool irq_is_enabled; | 30 | u8 new_mask; |
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | static irqreturn_t crystal_cove_charger_irq(int irq, void *data) | 33 | static irqreturn_t crystal_cove_charger_irq(int irq, void *data) |
| @@ -53,13 +54,9 @@ static void crystal_cove_charger_irq_bus_sync_unlock(struct irq_data *data) · 20 unmodified lines | |||
| 53 | { | 54 | { |
| 54 | struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); | 55 | struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); |
| 55 | 56 | ||
| 56 | if (charger->irq_is_enabled != charger->irq_enabled) { | 57 | if (charger->mask != charger->new_mask) { |
| 57 | if (charger->irq_enabled) | 58 | regmap_write(charger->regmap, MCHGRIRQ_REG, charger->new_mask); |
| 58 | enable_irq(charger->irq); | 59 | charger->mask = charger->new_mask; |
| 59 | else | ||
| 60 | disable_irq(charger->irq); | ||
| 61 | |||
| 62 | charger->irq_is_enabled = charger->irq_enabled; | ||
| 63 | } | 60 | } |
| 64 | 61 | ||
| 65 | mutex_unlock(&charger->buslock); | 62 | mutex_unlock(&charger->buslock); |
| @@ -69,14 +66,14 @@ static void crystal_cove_charger_irq_unmask(struct irq_data *data) · 3 unmodified lines | |||
| 69 | { | 66 | { |
| 70 | struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); | 67 | struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); |
| 71 | 68 | ||
| 72 | charger->irq_enabled = true; | 69 | charger->new_mask &= ~BIT(data->hwirq); |
| 73 | } | 70 | } |
| 74 | 71 | ||
| 75 | static void crystal_cove_charger_irq_mask(struct irq_data *data) | 72 | static void crystal_cove_charger_irq_mask(struct irq_data *data) |
| 76 | { | 73 | { |
| 77 | struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); | 74 | struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data); |
| 78 | 75 | ||
| 79 | charger->irq_enabled = false; | 76 | charger->new_mask |= BIT(data->hwirq); |
| 80 | } | 77 | } |
| 81 | 78 | ||
| 82 | static void crystal_cove_charger_rm_irq_domain(void *data) | 79 | static void crystal_cove_charger_rm_irq_domain(void *data) |
| @@ -130,10 +127,13 @@ static int crystal_cove_charger_probe(struct platform_device *pdev) · 47 unmodified lines | |||
| 130 | irq_set_nested_thread(charger->charger_irq, true); | 127 | irq_set_nested_thread(charger->charger_irq, true); |
| 131 | irq_set_noprobe(charger->charger_irq); | 128 | irq_set_noprobe(charger->charger_irq); |
| 132 | 129 | ||
| 130 | /* Mask the single 2nd level IRQ before enabling the 1st level IRQ */ | ||
| 131 | charger->mask = charger->new_mask = BIT(0); | ||
| 132 | regmap_write(charger->regmap, MCHGRIRQ_REG, charger->mask); | ||
| 133 | |||
| 133 | ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL, | 134 | ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL, |
| 134 | crystal_cove_charger_irq, | 135 | crystal_cove_charger_irq, |
| 135 | IRQF_ONESHOT | IRQF_NO_AUTOEN, | 136 | IRQF_ONESHOT, KBUILD_MODNAME, charger); |
| 136 | KBUILD_MODNAME, charger); | ||
| 137 | if (ret) | 137 | if (ret) |
| 138 | return dev_err_probe(&pdev->dev, ret, "requesting irq\n"); | 138 | return dev_err_probe(&pdev->dev, ret, "requesting irq\n"); |
| 139 | 139 | ||
| @@ -596,7 +596,10 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd, · 595 unmodified lines | |||
| 596 | return ret; | 596 | return ret; |
| 597 | } | 597 | } |
| 598 | 598 | ||
| 599 | static DEFINE_MUTEX(punit_misc_dev_lock); | 599 | /* Lock to prevent module registration when already opened by user space */ |
| 600 | static DEFINE_MUTEX(punit_misc_dev_open_lock); | ||
| 601 | /* Lock to allow one share misc device for all ISST interace */ | ||
| 602 | static DEFINE_MUTEX(punit_misc_dev_reg_lock); | ||
| 600 | static int misc_usage_count; | 603 | static int misc_usage_count; |
| 601 | static int misc_device_ret; | 604 | static int misc_device_ret; |
| 602 | static int misc_device_open; | 605 | static int misc_device_open; |
| @@ -606,7 +609,7 @@ static int isst_if_open(struct inode *inode, struct file *file) · 3 unmodified lines | |||
| 606 | int i, ret = 0; | 609 | int i, ret = 0; |
| 607 | 610 | ||
| 608 | /* Fail open, if a module is going away */ | 611 | /* Fail open, if a module is going away */ |
| 609 | mutex_lock(&punit_misc_dev_lock); | 612 | mutex_lock(&punit_misc_dev_open_lock); |
| 610 | for (i = 0; i < ISST_IF_DEV_MAX; ++i) { | 613 | for (i = 0; i < ISST_IF_DEV_MAX; ++i) { |
| 611 | struct isst_if_cmd_cb *cb = &punit_callbacks[i]; | 614 | struct isst_if_cmd_cb *cb = &punit_callbacks[i]; |
| 612 | 615 | ||
| @@ -628,7 +631,7 @@ static int isst_if_open(struct inode *inode, struct file *file) · 15 unmodified lines | |||
| 628 | } else { | 631 | } else { |
| 629 | misc_device_open++; | 632 | misc_device_open++; |
| 630 | } | 633 | } |
| 631 | mutex_unlock(&punit_misc_dev_lock); | 634 | mutex_unlock(&punit_misc_dev_open_lock); |
| 632 | 635 | ||
| 633 | return ret; | 636 | return ret; |
| 634 | } | 637 | } |
| @@ -637,7 +640,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) · 2 unmodified lines | |||
| 637 | { | 640 | { |
| 638 | int i; | 641 | int i; |
| 639 | 642 | ||
| 640 | mutex_lock(&punit_misc_dev_lock); | 643 | mutex_lock(&punit_misc_dev_open_lock); |
| 641 | misc_device_open--; | 644 | misc_device_open--; |
| 642 | for (i = 0; i < ISST_IF_DEV_MAX; ++i) { | 645 | for (i = 0; i < ISST_IF_DEV_MAX; ++i) { |
| 643 | struct isst_if_cmd_cb *cb = &punit_callbacks[i]; | 646 | struct isst_if_cmd_cb *cb = &punit_callbacks[i]; |
| @@ -645,7 +648,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) · 1 unmodified line | |||
| 645 | if (cb->registered) | 648 | if (cb->registered) |
| 646 | module_put(cb->owner); | 649 | module_put(cb->owner); |
| 647 | } | 650 | } |
| 648 | mutex_unlock(&punit_misc_dev_lock); | 651 | mutex_unlock(&punit_misc_dev_open_lock); |
| 649 | 652 | ||
| 650 | return 0; | 653 | return 0; |
| 651 | } | 654 | } |
| @@ -662,6 +665,43 @@ static struct miscdevice isst_if_char_driver = { · 10 unmodified lines | |||
| 662 | .fops = &isst_if_char_driver_ops, | 665 | .fops = &isst_if_char_driver_ops, |
| 663 | }; | 666 | }; |
| 664 | 667 | ||
| 668 | static int isst_misc_reg(void) | ||
| 669 | { | ||
| 670 | mutex_lock(&punit_misc_dev_reg_lock); | ||
| 671 | if (misc_device_ret) | ||
| 672 | goto unlock_exit; | ||
| 673 | |||
| 674 | if (!misc_usage_count) { | ||
| 675 | misc_device_ret = isst_if_cpu_info_init(); | ||
| 676 | if (misc_device_ret) | ||
| 677 | goto unlock_exit; | ||
| 678 | |||
| 679 | misc_device_ret = misc_register(&isst_if_char_driver); | ||
| 680 | if (misc_device_ret) { | ||
| 681 | isst_if_cpu_info_exit(); | ||
| 682 | goto unlock_exit; | ||
| 683 | } | ||
| 684 | } | ||
| 685 | misc_usage_count++; | ||
| 686 | |||
| 687 | unlock_exit: | ||
| 688 | mutex_unlock(&punit_misc_dev_reg_lock); | ||
| 689 | |||
| 690 | return misc_device_ret; | ||
| 691 | } | ||
| 692 | |||
| 693 | static void isst_misc_unreg(void) | ||
| 694 | { | ||
| 695 | mutex_lock(&punit_misc_dev_reg_lock); | ||
| 696 | if (misc_usage_count) | ||
| 697 | misc_usage_count--; | ||
| 698 | if (!misc_usage_count && !misc_device_ret) { | ||
| 699 | misc_deregister(&isst_if_char_driver); | ||
| 700 | isst_if_cpu_info_exit(); | ||
| 701 | } | ||
| 702 | mutex_unlock(&punit_misc_dev_reg_lock); | ||
| 703 | } | ||
| 704 | |||
| 665 | /** | 705 | /** |
| 666 | * isst_if_cdev_register() - Register callback for IOCTL | 706 | * isst_if_cdev_register() - Register callback for IOCTL |
| 667 | * @device_type: The device type this callback handling. | 707 | * @device_type: The device type this callback handling. |
| @@ -679,38 +719,31 @@ static struct miscdevice isst_if_char_driver = { · 11 unmodified lines | |||
| 679 | */ | 719 | */ |
| 680 | int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb) | 720 | int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb) |
| 681 | { | 721 | { |
| 682 | if (misc_device_ret) | 722 | int ret; |
| 683 | return misc_device_ret; | ||
| 684 | 723 | ||
| 685 | if (device_type >= ISST_IF_DEV_MAX) | 724 | if (device_type >= ISST_IF_DEV_MAX) |
| 686 | return -EINVAL; | 725 | return -EINVAL; |
| 687 | 726 | ||
| 688 | mutex_lock(&punit_misc_dev_lock); | 727 | mutex_lock(&punit_misc_dev_open_lock); |
| 728 | /* Device is already open, we don't want to add new callbacks */ | ||
| 689 | if (misc_device_open) { | 729 | if (misc_device_open) { |
| 690 | mutex_unlock(&punit_misc_dev_lock); | 730 | mutex_unlock(&punit_misc_dev_open_lock); |
| 691 | return -EAGAIN; | 731 | return -EAGAIN; |
| 692 | } | 732 | } |
| 693 | if (!misc_usage_count) { | ||
| 694 | int ret; | ||
| 695 | |||
| 696 | misc_device_ret = misc_register(&isst_if_char_driver); | ||
| 697 | if (misc_device_ret) | ||
| 698 | goto unlock_exit; | ||
| 699 | |||
| 700 | ret = isst_if_cpu_info_init(); | ||
| 701 | if (ret) { | ||
| 702 | misc_deregister(&isst_if_char_driver); | ||
| 703 | misc_device_ret = ret; | ||
| 704 | goto unlock_exit; | ||
| 705 | } | ||
| 706 | } | ||
| 707 | memcpy(&punit_callbacks[device_type], cb, sizeof(*cb)); | 733 | memcpy(&punit_callbacks[device_type], cb, sizeof(*cb)); |
| 708 | punit_callbacks[device_type].registered = 1; | 734 | punit_callbacks[device_type].registered = 1; |
| 709 | misc_usage_count++; | 735 | mutex_unlock(&punit_misc_dev_open_lock); |
| 710 | unlock_exit: | ||
| 711 | mutex_unlock(&punit_misc_dev_lock); | ||
| 712 | 736 | ||
| 713 | return misc_device_ret; | 737 | ret = isst_misc_reg(); |
| 738 | if (ret) { | ||
| 739 | /* | ||
| 740 | * No need of mutex as the misc device register failed | ||
| 741 | * as no one can open device yet. Hence no contention. | ||
| 742 | */ | ||
| 743 | punit_callbacks[device_type].registered = 0; | ||
| 744 | return ret; | ||
| 745 | } | ||
| 746 | return 0; | ||
| 714 | } | 747 | } |
| 715 | EXPORT_SYMBOL_GPL(isst_if_cdev_register); | 748 | EXPORT_SYMBOL_GPL(isst_if_cdev_register); |
| 716 | 749 | ||
| @@ -725,16 +758,12 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register); · 8 unmodified lines | |||
| 725 | */ | 758 | */ |
| 726 | void isst_if_cdev_unregister(int device_type) | 759 | void isst_if_cdev_unregister(int device_type) |
| 727 | { | 760 | { |
| 728 | mutex_lock(&punit_misc_dev_lock); | 761 | isst_misc_unreg(); |
| 729 | misc_usage_count--; | 762 | mutex_lock(&punit_misc_dev_open_lock); |
| 730 | punit_callbacks[device_type].registered = 0; | 763 | punit_callbacks[device_type].registered = 0; |
| 731 | if (device_type == ISST_IF_DEV_MBOX) | 764 | if (device_type == ISST_IF_DEV_MBOX) |
| 732 | isst_delete_hash(); | 765 | isst_delete_hash(); |
| 733 | if (!misc_usage_count && !misc_device_ret) { | 766 | mutex_unlock(&punit_misc_dev_open_lock); |
| 734 | misc_deregister(&isst_if_char_driver); | ||
| 735 | isst_if_cpu_info_exit(); | ||
| 736 | } | ||
| 737 | mutex_unlock(&punit_misc_dev_lock); | ||
| 738 | } | 767 | } |
| 739 | EXPORT_SYMBOL_GPL(isst_if_cdev_unregister); | 768 | EXPORT_SYMBOL_GPL(isst_if_cdev_unregister); |
| 740 | 769 | ||
| @@ -8679,9 +8679,10 @@ static const struct attribute_group fan_driver_attr_group = { · 8678 unmodified lines | |||
| 8679 | .attrs = fan_driver_attributes, | 8679 | .attrs = fan_driver_attributes, |
| 8680 | }; | 8680 | }; |
| 8681 | 8681 | ||
| 8682 | #define TPACPI_FAN_Q1 0x0001 /* Unitialized HFSP */ | 8682 | #define TPACPI_FAN_Q1 0x0001 /* Uninitialized HFSP */ |
| 8683 | #define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */ | 8683 | #define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */ |
| 8684 | #define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */ | 8684 | #define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */ |
| 8685 | #define TPACPI_FAN_NOFAN 0x0008 /* no fan available */ | ||
| 8685 | 8686 | ||
| 8686 | static const struct tpacpi_quirk fan_quirk_table[] __initconst = { | 8687 | static const struct tpacpi_quirk fan_quirk_table[] __initconst = { |
| 8687 | TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1), | 8688 | TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1), |
| @@ -8702,6 +8703,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 14 unmodified lines | |||
| 8702 | TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */ | 8703 | TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */ |
| 8703 | TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */ | 8704 | TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */ |
| 8704 | TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */ | 8705 | TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */ |
| 8706 | TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */ | ||
| 8705 | }; | 8707 | }; |
| 8706 | 8708 | ||
| 8707 | static int __init fan_init(struct ibm_init_struct *iibm) | 8709 | static int __init fan_init(struct ibm_init_struct *iibm) |
| @@ -8730,6 +8732,11 @@ static int __init fan_init(struct ibm_init_struct *iibm) · 22 unmodified lines | |||
| 8730 | quirks = tpacpi_check_quirks(fan_quirk_table, | 8732 | quirks = tpacpi_check_quirks(fan_quirk_table, |
| 8731 | ARRAY_SIZE(fan_quirk_table)); | 8733 | ARRAY_SIZE(fan_quirk_table)); |
| 8732 | 8734 | ||
| 8735 | if (quirks & TPACPI_FAN_NOFAN) { | ||
| 8736 | pr_info("No integrated ThinkPad fan available\n"); | ||
| 8737 | return -ENODEV; | ||
| 8738 | } | ||
| 8739 | |||
| 8733 | if (gfan_handle) { | 8740 | if (gfan_handle) { |
| 8734 | /* 570, 600e/x, 770e, 770x */ | 8741 | /* 570, 600e/x, 770e, 770x */ |
| 8735 | fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN; | 8742 | fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN; |
| @@ -10112,6 +10119,9 @@ static struct ibm_struct proxsensor_driver_data = { · 1376 unmodified lines | |||
| 10112 | #define DYTC_CMD_MMC_GET 8 /* To get current MMC function and mode */ | 10119 | #define DYTC_CMD_MMC_GET 8 /* To get current MMC function and mode */ |
| 10113 | #define DYTC_CMD_RESET 0x1ff /* To reset back to default */ | 10120 | #define DYTC_CMD_RESET 0x1ff /* To reset back to default */ |
| 10114 | 10121 | ||
| 10122 | #define DYTC_CMD_FUNC_CAP 3 /* To get DYTC capabilities */ | ||
| 10123 | #define DYTC_FC_MMC 27 /* MMC Mode supported */ | ||
| 10124 | |||
| 10115 | #define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */ | 10125 | #define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */ |
| 10116 | #define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */ | 10126 | #define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */ |
| 10117 | 10127 | ||
| @@ -10324,6 +10334,15 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 206 unmodified lines | |||
| 10324 | if (dytc_version < 5) | 10334 | if (dytc_version < 5) |
| 10325 | return -ENODEV; | 10335 | return -ENODEV; |
| 10326 | 10336 | ||
| 10337 | /* Check what capabilities are supported. Currently MMC is needed */ | ||
| 10338 | err = dytc_command(DYTC_CMD_FUNC_CAP, &output); | ||
| 10339 | if (err) | ||
| 10340 | return err; | ||
| 10341 | if (!(output & BIT(DYTC_FC_MMC))) { | ||
| 10342 | dbg_printk(TPACPI_DBG_INIT, " DYTC MMC mode not supported\n"); | ||
| 10343 | return -ENODEV; | ||
| 10344 | } | ||
| 10345 | |||
| 10327 | dbg_printk(TPACPI_DBG_INIT, | 10346 | dbg_printk(TPACPI_DBG_INIT, |
| 10328 | "DYTC version %d: thermal mode available\n", dytc_version); | 10347 | "DYTC version %d: thermal mode available\n", dytc_version); |
| 10329 | /* | 10348 | /* |
| @@ -770,6 +770,21 @@ static const struct ts_dmi_data predia_basic_data = { · 769 unmodified lines | |||
| 770 | .properties = predia_basic_props, | 770 | .properties = predia_basic_props, |
| 771 | }; | 771 | }; |
| 772 | 772 | ||
| 773 | static const struct property_entry rwc_nanote_p8_props[] = { | ||
| 774 | PROPERTY_ENTRY_U32("touchscreen-min-y", 46), | ||
| 775 | PROPERTY_ENTRY_U32("touchscreen-size-x", 1728), | ||
| 776 | PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), | ||
| 777 | PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), | ||
| 778 | PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-rwc-nanote-p8.fw"), | ||
| 779 | PROPERTY_ENTRY_U32("silead,max-fingers", 10), | ||
| 780 | { } | ||
| 781 | }; | ||
| 782 | |||
| 783 | static const struct ts_dmi_data rwc_nanote_p8_data = { | ||
| 784 | .acpi_name = "MSSL1680:00", | ||
| 785 | .properties = rwc_nanote_p8_props, | ||
| 786 | }; | ||
| 787 | |||
| 773 | static const struct property_entry schneider_sct101ctm_props[] = { | 788 | static const struct property_entry schneider_sct101ctm_props[] = { |
| 774 | PROPERTY_ENTRY_U32("touchscreen-size-x", 1715), | 789 | PROPERTY_ENTRY_U32("touchscreen-size-x", 1715), |
| 775 | PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), | 790 | PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), |
| @@ -1394,6 +1409,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { · 618 unmodified lines | |||
| 1394 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), | 1409 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), |
| 1395 | }, | 1410 | }, |
| 1396 | }, | 1411 | }, |
| 1412 | { | ||
| 1413 | /* RWC NANOTE P8 */ | ||
| 1414 | .driver_data = (void *)&rwc_nanote_p8_data, | ||
| 1415 | .matches = { | ||
| 1416 | DMI_MATCH(DMI_BOARD_VENDOR, "Default string"), | ||
| 1417 | DMI_MATCH(DMI_PRODUCT_NAME, "AY07J"), | ||
| 1418 | DMI_MATCH(DMI_PRODUCT_SKU, "0001") | ||
| 1419 | }, | ||
| 1420 | }, | ||
| 1397 | { | 1421 | { |
| 1398 | /* Schneider SCT101CTM */ | 1422 | /* Schneider SCT101CTM */ |
| 1399 | .driver_data = (void *)&schneider_sct101ctm_data, | 1423 | .driver_data = (void *)&schneider_sct101ctm_data, |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 27 | /* For gpio_get_desc() which is EXPORT_SYMBOL_GPL() */ | 27 | /* For gpio_get_desc() which is EXPORT_SYMBOL_GPL() */ |
| 28 | #include "../../gpio/gpiolib.h" | 28 | #include "../../gpio/gpiolib.h" |
| 29 | #include "../../gpio/gpiolib-acpi.h" | ||
| 29 | 30 | ||
| 30 | /* | 31 | /* |
| 31 | * Helper code to get Linux IRQ numbers given a description of the IRQ source | 32 | * Helper code to get Linux IRQ numbers given a description of the IRQ source |
| @@ -47,7 +48,7 @@ struct x86_acpi_irq_data { · 15 unmodified lines | |||
| 47 | int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */ | 48 | int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */ |
| 48 | }; | 49 | }; |
| 49 | 50 | ||
| 50 | static int x86_acpi_irq_helper_gpiochip_find(struct gpio_chip *gc, void *data) | 51 | static int gpiochip_find_match_label(struct gpio_chip *gc, void *data) |
| 51 | { | 52 | { |
| 52 | return gc->label && !strcmp(gc->label, data); | 53 | return gc->label && !strcmp(gc->label, data); |
| 53 | } | 54 | } |
| @@ -73,7 +74,7 @@ static int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data) · 19 unmodified lines | |||
| 73 | return irq; | 74 | return irq; |
| 74 | case X86_ACPI_IRQ_TYPE_GPIOINT: | 75 | case X86_ACPI_IRQ_TYPE_GPIOINT: |
| 75 | /* Like acpi_dev_gpio_irq_get(), but without parsing ACPI resources */ | 76 | /* Like acpi_dev_gpio_irq_get(), but without parsing ACPI resources */ |
| 76 | chip = gpiochip_find(data->chip, x86_acpi_irq_helper_gpiochip_find); | 77 | chip = gpiochip_find(data->chip, gpiochip_find_match_label); |
| 77 | if (!chip) { | 78 | if (!chip) { |
| 78 | pr_err("error cannot find GPIO chip %s\n", data->chip); | 79 | pr_err("error cannot find GPIO chip %s\n", data->chip); |
| 79 | return -ENODEV; | 80 | return -ENODEV; |
| @@ -143,14 +144,17 @@ struct x86_serdev_info { · 63 unmodified lines | |||
| 143 | }; | 144 | }; |
| 144 | 145 | ||
| 145 | struct x86_dev_info { | 146 | struct x86_dev_info { |
| 147 | char *invalid_aei_gpiochip; | ||
| 146 | const char * const *modules; | 148 | const char * const *modules; |
| 147 | struct gpiod_lookup_table **gpiod_lookup_tables; | 149 | struct gpiod_lookup_table * const *gpiod_lookup_tables; |
| 148 | const struct x86_i2c_client_info *i2c_client_info; | 150 | const struct x86_i2c_client_info *i2c_client_info; |
| 149 | const struct platform_device_info *pdev_info; | 151 | const struct platform_device_info *pdev_info; |
| 150 | const struct x86_serdev_info *serdev_info; | 152 | const struct x86_serdev_info *serdev_info; |
| 151 | int i2c_client_count; | 153 | int i2c_client_count; |
| 152 | int pdev_count; | 154 | int pdev_count; |
| 153 | int serdev_count; | 155 | int serdev_count; |
| 156 | int (*init)(void); | ||
| 157 | void (*exit)(void); | ||
| 154 | }; | 158 | }; |
| 155 | 159 | ||
| 156 | /* Generic / shared bq24190 settings */ | 160 | /* Generic / shared bq24190 settings */ |
| @@ -187,8 +191,8 @@ static struct bq24190_platform_data bq24190_pdata = { · 30 unmodified lines | |||
| 187 | }; | 191 | }; |
| 188 | 192 | ||
| 189 | static const char * const bq24190_modules[] __initconst = { | 193 | static const char * const bq24190_modules[] __initconst = { |
| 190 | "crystal_cove_charger", /* For the bq24190 IRQ */ | 194 | "intel_crystal_cove_charger", /* For the bq24190 IRQ */ |
| 191 | "bq24190_charger", /* For the Vbus regulator for intel-int3496 */ | 195 | "bq24190_charger", /* For the Vbus regulator for intel-int3496 */ |
| 192 | NULL | 196 | NULL |
| 193 | }; | 197 | }; |
| 194 | 198 | ||
| @@ -302,7 +306,7 @@ static struct gpiod_lookup_table asus_me176c_goodix_gpios = { · 107 unmodified lines | |||
| 302 | }, | 306 | }, |
| 303 | }; | 307 | }; |
| 304 | 308 | ||
| 305 | static struct gpiod_lookup_table *asus_me176c_gpios[] = { | 309 | static struct gpiod_lookup_table * const asus_me176c_gpios[] = { |
| 306 | &int3496_gpo2_pin22_gpios, | 310 | &int3496_gpo2_pin22_gpios, |
| 307 | &asus_me176c_goodix_gpios, | 311 | &asus_me176c_goodix_gpios, |
| 308 | NULL | 312 | NULL |
| @@ -317,6 +321,7 @@ static const struct x86_dev_info asus_me176c_info __initconst = { · 8 unmodified lines | |||
| 317 | .serdev_count = ARRAY_SIZE(asus_me176c_serdevs), | 321 | .serdev_count = ARRAY_SIZE(asus_me176c_serdevs), |
| 318 | .gpiod_lookup_tables = asus_me176c_gpios, | 322 | .gpiod_lookup_tables = asus_me176c_gpios, |
| 319 | .modules = bq24190_modules, | 323 | .modules = bq24190_modules, |
| 324 | .invalid_aei_gpiochip = "INT33FC:02", | ||
| 320 | }; | 325 | }; |
| 321 | 326 | ||
| 322 | /* Asus TF103C tablets have an Android factory img with everything hardcoded */ | 327 | /* Asus TF103C tablets have an Android factory img with everything hardcoded */ |
| @@ -405,7 +410,7 @@ static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst = · 82 unmodified lines | |||
| 405 | }, | 410 | }, |
| 406 | }; | 411 | }; |
| 407 | 412 | ||
| 408 | static struct gpiod_lookup_table *asus_tf103c_gpios[] = { | 413 | static struct gpiod_lookup_table * const asus_tf103c_gpios[] = { |
| 409 | &int3496_gpo2_pin22_gpios, | 414 | &int3496_gpo2_pin22_gpios, |
| 410 | NULL | 415 | NULL |
| 411 | }; | 416 | }; |
| @@ -417,6 +422,7 @@ static const struct x86_dev_info asus_tf103c_info __initconst = { · 5 unmodified lines | |||
| 417 | .pdev_count = ARRAY_SIZE(int3496_pdevs), | 422 | .pdev_count = ARRAY_SIZE(int3496_pdevs), |
| 418 | .gpiod_lookup_tables = asus_tf103c_gpios, | 423 | .gpiod_lookup_tables = asus_tf103c_gpios, |
| 419 | .modules = bq24190_modules, | 424 | .modules = bq24190_modules, |
| 425 | .invalid_aei_gpiochip = "INT33FC:02", | ||
| 420 | }; | 426 | }; |
| 421 | 427 | ||
| 422 | /* | 428 | /* |
| @@ -490,6 +496,39 @@ static const struct x86_dev_info chuwi_hi8_info __initconst = { · 67 unmodified lines | |||
| 490 | .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients), | 496 | .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients), |
| 491 | }; | 497 | }; |
| 492 | 498 | ||
| 499 | #define CZC_EC_EXTRA_PORT 0x68 | ||
| 500 | #define CZC_EC_ANDROID_KEYS 0x63 | ||
| 501 | |||
| 502 | static int __init czc_p10t_init(void) | ||
| 503 | { | ||
| 504 | /* | ||
| 505 | * The device boots up in "Windows 7" mode, when the home button sends a | ||
| 506 | * Windows specific key sequence (Left Meta + D) and the second button | ||
| 507 | * sends an unknown one while also toggling the Radio Kill Switch. | ||
| 508 | * This is a surprising behavior when the second button is labeled "Back". | ||
| 509 | * | ||
| 510 | * The vendor-supplied Android-x86 build switches the device to a "Android" | ||
| 511 | * mode by writing value 0x63 to the I/O port 0x68. This just seems to just | ||
| 512 | * set bit 6 on address 0x96 in the EC region; switching the bit directly | ||
| 513 | * seems to achieve the same result. It uses a "p10t_switcher" to do the | ||
| 514 | * job. It doesn't seem to be able to do anything else, and no other use | ||
| 515 | * of the port 0x68 is known. | ||
| 516 | * | ||
| 517 | * In the Android mode, the home button sends just a single scancode, | ||
| 518 | * which can be handled in Linux userspace more reasonably and the back | ||
| 519 | * button only sends a scancode without toggling the kill switch. | ||
| 520 | * The scancode can then be mapped either to Back or RF Kill functionality | ||
| 521 | * in userspace, depending on how the button is labeled on that particular | ||
| 522 | * model. | ||
| 523 | */ | ||
| 524 | outb(CZC_EC_ANDROID_KEYS, CZC_EC_EXTRA_PORT); | ||
| 525 | return 0; | ||
| 526 | } | ||
| 527 | |||
| 528 | static const struct x86_dev_info czc_p10t __initconst = { | ||
| 529 | .init = czc_p10t_init, | ||
| 530 | }; | ||
| 531 | |||
| 493 | /* | 532 | /* |
| 494 | * Whitelabel (sold as various brands) TM800A550L tablets. | 533 | * Whitelabel (sold as various brands) TM800A550L tablets. |
| 495 | * These tablet's DSDT contains a whole bunch of bogus ACPI I2C devices | 534 | * These tablet's DSDT contains a whole bunch of bogus ACPI I2C devices |
| @@ -559,7 +598,7 @@ static struct gpiod_lookup_table whitelabel_tm800a550l_goodix_gpios = { · 63 unmodified lines | |||
| 559 | }, | 598 | }, |
| 560 | }; | 599 | }; |
| 561 | 600 | ||
| 562 | static struct gpiod_lookup_table *whitelabel_tm800a550l_gpios[] = { | 601 | static struct gpiod_lookup_table * const whitelabel_tm800a550l_gpios[] = { |
| 563 | &whitelabel_tm800a550l_goodix_gpios, | 602 | &whitelabel_tm800a550l_goodix_gpios, |
| 564 | NULL | 603 | NULL |
| 565 | }; | 604 | }; |
| @@ -641,6 +680,24 @@ static const struct dmi_system_id x86_android_tablet_ids[] __initconst = { · 75 unmodified lines | |||
| 641 | }, | 680 | }, |
| 642 | .driver_data = (void *)&chuwi_hi8_info, | 681 | .driver_data = (void *)&chuwi_hi8_info, |
| 643 | }, | 682 | }, |
| 683 | { | ||
| 684 | /* CZC P10T */ | ||
| 685 | .ident = "CZC ODEON TPC-10 (\"P10T\")", | ||
| 686 | .matches = { | ||
| 687 | DMI_MATCH(DMI_SYS_VENDOR, "CZC"), | ||
| 688 | DMI_MATCH(DMI_PRODUCT_NAME, "ODEON*TPC-10"), | ||
| 689 | }, | ||
| 690 | .driver_data = (void *)&czc_p10t, | ||
| 691 | }, | ||
| 692 | { | ||
| 693 | /* A variant of CZC P10T */ | ||
| 694 | .ident = "ViewSonic ViewPad 10", | ||
| 695 | .matches = { | ||
| 696 | DMI_MATCH(DMI_SYS_VENDOR, "ViewSonic"), | ||
| 697 | DMI_MATCH(DMI_PRODUCT_NAME, "VPAD10"), | ||
| 698 | }, | ||
| 699 | .driver_data = (void *)&czc_p10t, | ||
| 700 | }, | ||
| 644 | { | 701 | { |
| 645 | /* Whitelabel (sold as various brands) TM800A550L */ | 702 | /* Whitelabel (sold as various brands) TM800A550L */ |
| 646 | .matches = { | 703 | .matches = { |
| @@ -669,7 +726,8 @@ static int serdev_count; · 22 unmodified lines | |||
| 669 | static struct i2c_client **i2c_clients; | 726 | static struct i2c_client **i2c_clients; |
| 670 | static struct platform_device **pdevs; | 727 | static struct platform_device **pdevs; |
| 671 | static struct serdev_device **serdevs; | 728 | static struct serdev_device **serdevs; |
| 672 | static struct gpiod_lookup_table **gpiod_lookup_tables; | 729 | static struct gpiod_lookup_table * const *gpiod_lookup_tables; |
| 730 | static void (*exit_handler)(void); | ||
| 673 | 731 | ||
| 674 | static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info, | 732 | static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info, |
| 675 | int idx) | 733 | int idx) |
| @@ -787,6 +845,9 @@ static void x86_android_tablet_cleanup(void) · 111 unmodified lines | |||
| 787 | 845 | ||
| 788 | kfree(i2c_clients); | 846 | kfree(i2c_clients); |
| 789 | 847 | ||
| 848 | if (exit_handler) | ||
| 849 | exit_handler(); | ||
| 850 | |||
| 790 | for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++) | 851 | for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++) |
| 791 | gpiod_remove_lookup_table(gpiod_lookup_tables[i]); | 852 | gpiod_remove_lookup_table(gpiod_lookup_tables[i]); |
| 792 | } | 853 | } |
| @@ -795,6 +856,7 @@ static __init int x86_android_tablet_init(void) · 2 unmodified lines | |||
| 795 | { | 856 | { |
| 796 | const struct x86_dev_info *dev_info; | 857 | const struct x86_dev_info *dev_info; |
| 797 | const struct dmi_system_id *id; | 858 | const struct dmi_system_id *id; |
| 859 | struct gpio_chip *chip; | ||
| 798 | int i, ret = 0; | 860 | int i, ret = 0; |
| 799 | 861 | ||
| 800 | id = dmi_first_match(x86_android_tablet_ids); | 862 | id = dmi_first_match(x86_android_tablet_ids); |
| @@ -803,6 +865,20 @@ static __init int x86_android_tablet_init(void) · 2 unmodified lines | |||
| 803 | 865 | ||
| 804 | dev_info = id->driver_data; | 866 | dev_info = id->driver_data; |
| 805 | 867 | ||
| 868 | /* | ||
| 869 | * The broken DSDTs on these devices often also include broken | ||
| 870 | * _AEI (ACPI Event Interrupt) handlers, disable these. | ||
| 871 | */ | ||
| 872 | if (dev_info->invalid_aei_gpiochip) { | ||
| 873 | chip = gpiochip_find(dev_info->invalid_aei_gpiochip, | ||
| 874 | gpiochip_find_match_label); | ||
| 875 | if (!chip) { | ||
| 876 | pr_err("error cannot find GPIO chip %s\n", dev_info->invalid_aei_gpiochip); | ||
| 877 | return -ENODEV; | ||
| 878 | } | ||
| 879 | acpi_gpiochip_free_interrupts(chip); | ||
| 880 | } | ||
| 881 | |||
| 806 | /* | 882 | /* |
| 807 | * Since this runs from module_init() it cannot use -EPROBE_DEFER, | 883 | * Since this runs from module_init() it cannot use -EPROBE_DEFER, |
| 808 | * instead pre-load any modules which are listed as requirements. | 884 | * instead pre-load any modules which are listed as requirements. |
| @@ -814,6 +890,15 @@ static __init int x86_android_tablet_init(void) · 5 unmodified lines | |||
| 814 | for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++) | 890 | for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++) |
| 815 | gpiod_add_lookup_table(gpiod_lookup_tables[i]); | 891 | gpiod_add_lookup_table(gpiod_lookup_tables[i]); |
| 816 | 892 | ||
| 893 | if (dev_info->init) { | ||
| 894 | ret = dev_info->init(); | ||
| 895 | if (ret < 0) { | ||
| 896 | x86_android_tablet_cleanup(); | ||
| 897 | return ret; | ||
| 898 | } | ||
| 899 | exit_handler = dev_info->exit; | ||
| 900 | } | ||
| 901 | |||
| 817 | i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL); | 902 | i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL); |
| 818 | if (!i2c_clients) { | 903 | if (!i2c_clients) { |
| 819 | x86_android_tablet_cleanup(); | 904 | x86_android_tablet_cleanup(); |
| @@ -865,6 +950,6 @@ static __init int x86_android_tablet_init(void) · 45 unmodified lines | |||
| 865 | module_init(x86_android_tablet_init); | 950 | module_init(x86_android_tablet_init); |
| 866 | module_exit(x86_android_tablet_cleanup); | 951 | module_exit(x86_android_tablet_cleanup); |
| 867 | 952 | ||
| 868 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com"); | 953 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); |
| 869 | MODULE_DESCRIPTION("X86 Android tablets DSDT fixups driver"); | 954 | MODULE_DESCRIPTION("X86 Android tablets DSDT fixups driver"); |
| 870 | MODULE_LICENSE("GPL"); | 955 | MODULE_LICENSE("GPL"); |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #include <linux/err.h> | 8 | #include <linux/err.h> |
| 9 | #include <linux/gpio.h> | 9 | #include <linux/gpio.h> |
| 10 | #include <linux/gpio/consumer.h> | ||
| 10 | #include <linux/i2c.h> | 11 | #include <linux/i2c.h> |
| 11 | #include <linux/module.h> | 12 | #include <linux/module.h> |
| 12 | #include <linux/regmap.h> | 13 | #include <linux/regmap.h> |
| @@ -140,7 +141,7 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on) · 127 unmodified lines | |||
| 140 | node = of_get_child_by_name(chip->dev->of_node, "regulators"); | 141 | node = of_get_child_by_name(chip->dev->of_node, "regulators"); |
| 141 | if (!node) { | 142 | if (!node) { |
| 142 | dev_err(chip->dev, "regulators node not found\n"); | 143 | dev_err(chip->dev, "regulators node not found\n"); |
| 143 | return PTR_ERR(node); | 144 | return -ENODEV; |
| 144 | } | 145 | } |
| 145 | 146 | ||
| 146 | for (i = 0; i < chip->info->num_outputs; ++i) | 147 | for (i = 0; i < chip->info->num_outputs; ++i) |
| @@ -521,6 +521,8 @@ static void zfcp_fc_adisc_handler(void *data) · 520 unmodified lines | |||
| 521 | goto out; | 521 | goto out; |
| 522 | } | 522 | } |
| 523 | 523 | ||
| 524 | /* re-init to undo drop from zfcp_fc_adisc() */ | ||
| 525 | port->d_id = ntoh24(adisc_resp->adisc_port_id); | ||
| 524 | /* port is good, unblock rport without going through erp */ | 526 | /* port is good, unblock rport without going through erp */ |
| 525 | zfcp_scsi_schedule_rport_register(port); | 527 | zfcp_scsi_schedule_rport_register(port); |
| 526 | out: | 528 | out: |
| @@ -534,6 +536,7 @@ static int zfcp_fc_adisc(struct zfcp_port *port) · 7 unmodified lines | |||
| 534 | struct zfcp_fc_req *fc_req; | 536 | struct zfcp_fc_req *fc_req; |
| 535 | struct zfcp_adapter *adapter = port->adapter; | 537 | struct zfcp_adapter *adapter = port->adapter; |
| 536 | struct Scsi_Host *shost = adapter->scsi_host; | 538 | struct Scsi_Host *shost = adapter->scsi_host; |
| 539 | u32 d_id; | ||
| 537 | int ret; | 540 | int ret; |
| 538 | 541 | ||
| 539 | fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC); | 542 | fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC); |
| @@ -558,7 +561,15 @@ static int zfcp_fc_adisc(struct zfcp_port *port) · 18 unmodified lines | |||
| 558 | fc_req->u.adisc.req.adisc_cmd = ELS_ADISC; | 561 | fc_req->u.adisc.req.adisc_cmd = ELS_ADISC; |
| 559 | hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost)); | 562 | hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost)); |
| 560 | 563 | ||
| 561 | ret = zfcp_fsf_send_els(adapter, port->d_id, &fc_req->ct_els, | 564 | d_id = port->d_id; /* remember as destination for send els below */ |
| 565 | /* | ||
| 566 | * Force fresh GID_PN lookup on next port recovery. | ||
| 567 | * Must happen after request setup and before sending request, | ||
| 568 | * to prevent race with port->d_id re-init in zfcp_fc_adisc_handler(). | ||
| 569 | */ | ||
| 570 | port->d_id = 0; | ||
| 571 | |||
| 572 | ret = zfcp_fsf_send_els(adapter, d_id, &fc_req->ct_els, | ||
| 562 | ZFCP_FC_CTELS_TMO); | 573 | ZFCP_FC_CTELS_TMO); |
| 563 | if (ret) | 574 | if (ret) |
| 564 | kmem_cache_free(zfcp_fc_req_cache, fc_req); | 575 | kmem_cache_free(zfcp_fc_req_cache, fc_req); |
| @@ -1567,8 +1567,6 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 1566 unmodified lines | |||
| 1567 | pci_try_set_mwi(pdev); | 1567 | pci_try_set_mwi(pdev); |
| 1568 | 1568 | ||
| 1569 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | 1569 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
| 1570 | if (retval) | ||
| 1571 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
| 1572 | if (retval) { | 1570 | if (retval) { |
| 1573 | TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); | 1571 | TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); |
| 1574 | retval = -ENODEV; | 1572 | retval = -ENODEV; |
| @@ -1786,8 +1784,6 @@ static int __maybe_unused twl_resume(struct device *dev) · 211 unmodified lines | |||
| 1786 | pci_try_set_mwi(pdev); | 1784 | pci_try_set_mwi(pdev); |
| 1787 | 1785 | ||
| 1788 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | 1786 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
| 1789 | if (retval) | ||
| 1790 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
| 1791 | if (retval) { | 1787 | if (retval) { |
| 1792 | TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); | 1788 | TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); |
| 1793 | retval = -ENODEV; | 1789 | retval = -ENODEV; |
| @@ -1507,7 +1507,6 @@ NCR_700_intr(int irq, void *dev_id) · 1506 unmodified lines | |||
| 1507 | struct scsi_cmnd *SCp = hostdata->cmd; | 1507 | struct scsi_cmnd *SCp = hostdata->cmd; |
| 1508 | 1508 | ||
| 1509 | handled = 1; | 1509 | handled = 1; |
| 1510 | SCp = hostdata->cmd; | ||
| 1511 | 1510 | ||
| 1512 | if(istat & SCSI_INT_PENDING) { | 1511 | if(istat & SCSI_INT_PENDING) { |
| 1513 | udelay(10); | 1512 | udelay(10); |
| @@ -732,9 +732,6 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) · 731 unmodified lines | |||
| 732 | pci_set_master(pdev); | 732 | pci_set_master(pdev); |
| 733 | 733 | ||
| 734 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | 734 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
| 735 | if (rc) | ||
| 736 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
| 737 | |||
| 738 | if (rc) { | 735 | if (rc) { |
| 739 | rc = -ENODEV; | 736 | rc = -ENODEV; |
| 740 | printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); | 737 | printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); |
| @@ -1559,9 +1556,6 @@ bfad_pci_slot_reset(struct pci_dev *pdev) · 818 unmodified lines | |||
| 1559 | pci_set_master(pdev); | 1556 | pci_set_master(pdev); |
| 1560 | 1557 | ||
| 1561 | rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)); | 1558 | rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)); |
| 1562 | if (rc) | ||
| 1563 | rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, | ||
| 1564 | DMA_BIT_MASK(32)); | ||
| 1565 | if (rc) | 1559 | if (rc) |
| 1566 | goto out_disable_device; | 1560 | goto out_disable_device; |
| 1567 | 1561 | ||
| @@ -82,7 +82,7 @@ static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba); · 81 unmodified lines | |||
| 82 | static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba); | 82 | static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba); |
| 83 | static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, | 83 | static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, |
| 84 | struct device *parent, int npiv); | 84 | struct device *parent, int npiv); |
| 85 | static void bnx2fc_destroy_work(struct work_struct *work); | 85 | static void bnx2fc_port_destroy(struct fcoe_port *port); |
| 86 | 86 | ||
| 87 | static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev); | 87 | static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev); |
| 88 | static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device | 88 | static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device |
| @@ -907,9 +907,6 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event, · 818 unmodified lines | |||
| 907 | __bnx2fc_destroy(interface); | 907 | __bnx2fc_destroy(interface); |
| 908 | } | 908 | } |
| 909 | mutex_unlock(&bnx2fc_dev_lock); | 909 | mutex_unlock(&bnx2fc_dev_lock); |
| 910 | |||
| 911 | /* Ensure ALL destroy work has been completed before return */ | ||
| 912 | flush_workqueue(bnx2fc_wq); | ||
| 913 | return; | 910 | return; |
| 914 | 911 | ||
| 915 | default: | 912 | default: |
| @@ -1215,8 +1212,8 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport) · 299 unmodified lines | |||
| 1215 | mutex_unlock(&n_port->lp_mutex); | 1212 | mutex_unlock(&n_port->lp_mutex); |
| 1216 | bnx2fc_free_vport(interface->hba, port->lport); | 1213 | bnx2fc_free_vport(interface->hba, port->lport); |
| 1217 | bnx2fc_port_shutdown(port->lport); | 1214 | bnx2fc_port_shutdown(port->lport); |
| 1215 | bnx2fc_port_destroy(port); | ||
| 1218 | bnx2fc_interface_put(interface); | 1216 | bnx2fc_interface_put(interface); |
| 1219 | queue_work(bnx2fc_wq, &port->destroy_work); | ||
| 1220 | return 0; | 1217 | return 0; |
| 1221 | } | 1218 | } |
| 1222 | 1219 | ||
| @@ -1525,7 +1522,6 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, · 302 unmodified lines | |||
| 1525 | port->lport = lport; | 1522 | port->lport = lport; |
| 1526 | port->priv = interface; | 1523 | port->priv = interface; |
| 1527 | port->get_netdev = bnx2fc_netdev; | 1524 | port->get_netdev = bnx2fc_netdev; |
| 1528 | INIT_WORK(&port->destroy_work, bnx2fc_destroy_work); | ||
| 1529 | 1525 | ||
| 1530 | /* Configure fcoe_port */ | 1526 | /* Configure fcoe_port */ |
| 1531 | rc = bnx2fc_lport_config(lport); | 1527 | rc = bnx2fc_lport_config(lport); |
| @@ -1653,8 +1649,8 @@ static void __bnx2fc_destroy(struct bnx2fc_interface *interface) · 121 unmodified lines | |||
| 1653 | bnx2fc_interface_cleanup(interface); | 1649 | bnx2fc_interface_cleanup(interface); |
| 1654 | bnx2fc_stop(interface); | 1650 | bnx2fc_stop(interface); |
| 1655 | list_del(&interface->list); | 1651 | list_del(&interface->list); |
| 1652 | bnx2fc_port_destroy(port); | ||
| 1656 | bnx2fc_interface_put(interface); | 1653 | bnx2fc_interface_put(interface); |
| 1657 | queue_work(bnx2fc_wq, &port->destroy_work); | ||
| 1658 | } | 1654 | } |
| 1659 | 1655 | ||
| 1660 | /** | 1656 | /** |
| @@ -1694,15 +1690,12 @@ netdev_err: · 33 unmodified lines | |||
| 1694 | return rc; | 1690 | return rc; |
| 1695 | } | 1691 | } |
| 1696 | 1692 | ||
| 1697 | static void bnx2fc_destroy_work(struct work_struct *work) | 1693 | static void bnx2fc_port_destroy(struct fcoe_port *port) |
| 1698 | { | 1694 | { |
| 1699 | struct fcoe_port *port; | ||
| 1700 | struct fc_lport *lport; | 1695 | struct fc_lport *lport; |
| 1701 | 1696 | ||
| 1702 | port = container_of(work, struct fcoe_port, destroy_work); | ||
| 1703 | lport = port->lport; | 1697 | lport = port->lport; |
| 1704 | 1698 | BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport); | |
| 1705 | BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n"); | ||
| 1706 | 1699 | ||
| 1707 | bnx2fc_if_destroy(lport); | 1700 | bnx2fc_if_destroy(lport); |
| 1708 | } | 1701 | } |
| @@ -2556,9 +2549,6 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev) · 847 unmodified lines | |||
| 2556 | __bnx2fc_destroy(interface); | 2549 | __bnx2fc_destroy(interface); |
| 2557 | mutex_unlock(&bnx2fc_dev_lock); | 2550 | mutex_unlock(&bnx2fc_dev_lock); |
| 2558 | 2551 | ||
| 2559 | /* Ensure ALL destroy work has been completed before return */ | ||
| 2560 | flush_workqueue(bnx2fc_wq); | ||
| 2561 | |||
| 2562 | bnx2fc_ulp_stop(hba); | 2552 | bnx2fc_ulp_stop(hba); |
| 2563 | /* unregister cnic device */ | 2553 | /* unregister cnic device */ |
| 2564 | if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic)) | 2554 | if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic)) |
| @@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) · 45 unmodified lines | |||
| 46 | 46 | ||
| 47 | efc = node->efc; | 47 | efc = node->efc; |
| 48 | 48 | ||
| 49 | spin_lock_irqsave(&node->els_ios_lock, flags); | ||
| 50 | |||
| 51 | if (!node->els_io_enabled) { | 49 | if (!node->els_io_enabled) { |
| 52 | efc_log_err(efc, "els io alloc disabled\n"); | 50 | efc_log_err(efc, "els io alloc disabled\n"); |
| 53 | spin_unlock_irqrestore(&node->els_ios_lock, flags); | ||
| 54 | return NULL; | 51 | return NULL; |
| 55 | } | 52 | } |
| 56 | 53 | ||
| 57 | els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC); | 54 | els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC); |
| 58 | if (!els) { | 55 | if (!els) { |
| 59 | atomic_add_return(1, &efc->els_io_alloc_failed_count); | 56 | atomic_add_return(1, &efc->els_io_alloc_failed_count); |
| 60 | spin_unlock_irqrestore(&node->els_ios_lock, flags); | ||
| 61 | return NULL; | 57 | return NULL; |
| 62 | } | 58 | } |
| 63 | 59 | ||
| @@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) · 10 unmodified lines | |||
| 74 | &els->io.req.phys, GFP_KERNEL); | 70 | &els->io.req.phys, GFP_KERNEL); |
| 75 | if (!els->io.req.virt) { | 71 | if (!els->io.req.virt) { |
| 76 | mempool_free(els, efc->els_io_pool); | 72 | mempool_free(els, efc->els_io_pool); |
| 77 | spin_unlock_irqrestore(&node->els_ios_lock, flags); | ||
| 78 | return NULL; | 73 | return NULL; |
| 79 | } | 74 | } |
| 80 | 75 | ||
| @@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) · 13 unmodified lines | |||
| 94 | 89 | ||
| 95 | /* add els structure to ELS IO list */ | 90 | /* add els structure to ELS IO list */ |
| 96 | INIT_LIST_HEAD(&els->list_entry); | 91 | INIT_LIST_HEAD(&els->list_entry); |
| 92 | spin_lock_irqsave(&node->els_ios_lock, flags); | ||
| 97 | list_add_tail(&els->list_entry, &node->els_ios_list); | 93 | list_add_tail(&els->list_entry, &node->els_ios_list); |
| 94 | spin_unlock_irqrestore(&node->els_ios_lock, flags); | ||
| 98 | } | 95 | } |
| 99 | 96 | ||
| 100 | spin_unlock_irqrestore(&node->els_ios_lock, flags); | ||
| 101 | return els; | 97 | return els; |
| 102 | } | 98 | } |
| 103 | 99 | ||
| @@ -2666,9 +2666,6 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, · 2665 unmodified lines | |||
| 2666 | goto err_out; | 2666 | goto err_out; |
| 2667 | 2667 | ||
| 2668 | error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); | 2668 | error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); |
| 2669 | if (error) | ||
| 2670 | error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); | ||
| 2671 | |||
| 2672 | if (error) { | 2669 | if (error) { |
| 2673 | dev_err(dev, "No usable DMA addressing method\n"); | 2670 | dev_err(dev, "No usable DMA addressing method\n"); |
| 2674 | goto err_out; | 2671 | goto err_out; |
| @@ -4695,8 +4695,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 4694 unmodified lines | |||
| 4695 | goto err_out; | 4695 | goto err_out; |
| 4696 | 4696 | ||
| 4697 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | 4697 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
| 4698 | if (rc) | ||
| 4699 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
| 4700 | if (rc) { | 4698 | if (rc) { |
| 4701 | dev_err(dev, "No usable DMA addressing method\n"); | 4699 | dev_err(dev, "No usable DMA addressing method\n"); |
| 4702 | rc = -ENODEV; | 4700 | rc = -ENODEV; |
| @@ -2267,7 +2267,8 @@ static void myrs_cleanup(struct myrs_hba *cs) · 2266 unmodified lines | |||
| 2267 | myrs_unmap(cs); | 2267 | myrs_unmap(cs); |
| 2268 | 2268 | ||
| 2269 | if (cs->mmio_base) { | 2269 | if (cs->mmio_base) { |
| 2270 | cs->disable_intr(cs); | 2270 | if (cs->disable_intr) |
| 2271 | cs->disable_intr(cs); | ||
| 2271 | iounmap(cs->mmio_base); | 2272 | iounmap(cs->mmio_base); |
| 2272 | cs->mmio_base = NULL; | 2273 | cs->mmio_base = NULL; |
| 2273 | } | 2274 | } |
| @@ -4151,10 +4151,22 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) · 4150 unmodified lines | |||
| 4151 | u32 ret = MPI_IO_STATUS_FAIL; | 4151 | u32 ret = MPI_IO_STATUS_FAIL; |
| 4152 | u32 regval; | 4152 | u32 regval; |
| 4153 | 4153 | ||
| 4154 | /* | ||
| 4155 | * Fatal errors are programmed to be signalled in irq vector | ||
| 4156 | * pm8001_ha->max_q_num - 1 through pm8001_ha->main_cfg_tbl.pm80xx_tbl. | ||
| 4157 | * fatal_err_interrupt | ||
| 4158 | */ | ||
| 4154 | if (vec == (pm8001_ha->max_q_num - 1)) { | 4159 | if (vec == (pm8001_ha->max_q_num - 1)) { |
| 4160 | u32 mipsall_ready; | ||
| 4161 | |||
| 4162 | if (pm8001_ha->chip_id == chip_8008 || | ||
| 4163 | pm8001_ha->chip_id == chip_8009) | ||
| 4164 | mipsall_ready = SCRATCH_PAD_MIPSALL_READY_8PORT; | ||
| 4165 | else | ||
| 4166 | mipsall_ready = SCRATCH_PAD_MIPSALL_READY_16PORT; | ||
| 4167 | |||
| 4155 | regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); | 4168 | regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); |
| 4156 | if ((regval & SCRATCH_PAD_MIPSALL_READY) != | 4169 | if ((regval & mipsall_ready) != mipsall_ready) { |
| 4157 | SCRATCH_PAD_MIPSALL_READY) { | ||
| 4158 | pm8001_ha->controller_fatal_error = true; | 4170 | pm8001_ha->controller_fatal_error = true; |
| 4159 | pm8001_dbg(pm8001_ha, FAIL, | 4171 | pm8001_dbg(pm8001_ha, FAIL, |
| 4160 | "Firmware Fatal error! Regval:0x%x\n", | 4172 | "Firmware Fatal error! Regval:0x%x\n", |
| @@ -1405,8 +1405,12 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t; · 1404 unmodified lines | |||
| 1405 | #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0 | 1405 | #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0 |
| 1406 | #define SCRATCH_PAD_IOP0_READY 0xC00 | 1406 | #define SCRATCH_PAD_IOP0_READY 0xC00 |
| 1407 | #define SCRATCH_PAD_IOP1_READY 0x3000 | 1407 | #define SCRATCH_PAD_IOP1_READY 0x3000 |
| 1408 | #define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \ | 1408 | #define SCRATCH_PAD_MIPSALL_READY_16PORT (SCRATCH_PAD_IOP1_READY | \ |
| 1409 | SCRATCH_PAD_IOP0_READY | \ | 1409 | SCRATCH_PAD_IOP0_READY | \ |
| 1410 | SCRATCH_PAD_ILA_READY | \ | ||
| 1411 | SCRATCH_PAD_RAAE_READY) | ||
| 1412 | #define SCRATCH_PAD_MIPSALL_READY_8PORT (SCRATCH_PAD_IOP0_READY | \ | ||
| 1413 | SCRATCH_PAD_ILA_READY | \ | ||
| 1410 | SCRATCH_PAD_RAAE_READY) | 1414 | SCRATCH_PAD_RAAE_READY) |
| 1411 | 1415 | ||
| 1412 | /* boot loader state */ | 1416 | /* boot loader state */ |
| @@ -2250,6 +2250,7 @@ process_els: · 2249 unmodified lines | |||
| 2250 | io_req->tm_flags == FCP_TMF_TGT_RESET) { | 2250 | io_req->tm_flags == FCP_TMF_TGT_RESET) { |
| 2251 | clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); | 2251 | clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); |
| 2252 | io_req->sc_cmd = NULL; | 2252 | io_req->sc_cmd = NULL; |
| 2253 | kref_put(&io_req->refcount, qedf_release_cmd); | ||
| 2253 | complete(&io_req->tm_done); | 2254 | complete(&io_req->tm_done); |
| 2254 | } | 2255 | } |
| 2255 | 2256 | ||
| @@ -911,7 +911,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport) · 910 unmodified lines | |||
| 911 | struct qed_link_output if_link; | 911 | struct qed_link_output if_link; |
| 912 | 912 | ||
| 913 | if (lport->vport) { | 913 | if (lport->vport) { |
| 914 | QEDF_ERR(NULL, "Cannot issue host reset on NPIV port.\n"); | 914 | printk_ratelimited("Cannot issue host reset on NPIV port.\n"); |
| 915 | return; | 915 | return; |
| 916 | } | 916 | } |
| 917 | 917 | ||
| @@ -1864,6 +1864,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 946 unmodified lines | |||
| 1864 | vport_qedf->cmd_mgr = base_qedf->cmd_mgr; | 1864 | vport_qedf->cmd_mgr = base_qedf->cmd_mgr; |
| 1865 | init_completion(&vport_qedf->flogi_compl); | 1865 | init_completion(&vport_qedf->flogi_compl); |
| 1866 | INIT_LIST_HEAD(&vport_qedf->fcports); | 1866 | INIT_LIST_HEAD(&vport_qedf->fcports); |
| 1867 | INIT_DELAYED_WORK(&vport_qedf->stag_work, qedf_stag_change_work); | ||
| 1867 | 1868 | ||
| 1868 | rc = qedf_vport_libfc_config(vport, vn_port); | 1869 | rc = qedf_vport_libfc_config(vport, vn_port); |
| 1869 | if (rc) { | 1870 | if (rc) { |
| @@ -3980,7 +3981,9 @@ void qedf_stag_change_work(struct work_struct *work) · 2110 unmodified lines | |||
| 3980 | struct qedf_ctx *qedf = | 3981 | struct qedf_ctx *qedf = |
| 3981 | container_of(work, struct qedf_ctx, stag_work.work); | 3982 | container_of(work, struct qedf_ctx, stag_work.work); |
| 3982 | 3983 | ||
| 3983 | QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n"); | 3984 | printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.", |
| 3985 | dev_name(&qedf->pdev->dev), __func__, __LINE__, | ||
| 3986 | qedf->dbg_ctx.host_no); | ||
| 3984 | qedf_ctx_soft_reset(qedf->lport); | 3987 | qedf_ctx_soft_reset(qedf->lport); |
| 3985 | } | 3988 | } |
| 3986 | 3989 | ||
| @@ -92,6 +92,11 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) · 91 unmodified lines | |||
| 92 | clki->min_freq = clkfreq[i]; | 92 | clki->min_freq = clkfreq[i]; |
| 93 | clki->max_freq = clkfreq[i+1]; | 93 | clki->max_freq = clkfreq[i+1]; |
| 94 | clki->name = devm_kstrdup(dev, name, GFP_KERNEL); | 94 | clki->name = devm_kstrdup(dev, name, GFP_KERNEL); |
| 95 | if (!clki->name) { | ||
| 96 | ret = -ENOMEM; | ||
| 97 | goto out; | ||
| 98 | } | ||
| 99 | |||
| 95 | if (!strcmp(name, "ref_clk")) | 100 | if (!strcmp(name, "ref_clk")) |
| 96 | clki->keep_link_active = true; | 101 | clki->keep_link_active = true; |
| 97 | dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz", | 102 | dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz", |
| @@ -127,6 +132,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, · 29 unmodified lines | |||
| 127 | return -ENOMEM; | 132 | return -ENOMEM; |
| 128 | 133 | ||
| 129 | vreg->name = devm_kstrdup(dev, name, GFP_KERNEL); | 134 | vreg->name = devm_kstrdup(dev, name, GFP_KERNEL); |
| 135 | if (!vreg->name) | ||
| 136 | return -ENOMEM; | ||
| 130 | 137 | ||
| 131 | snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name); | 138 | snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name); |
| 132 | if (of_property_read_u32(np, prop_name, &vreg->max_uA)) { | 139 | if (of_property_read_u32(np, prop_name, &vreg->max_uA)) { |
| @@ -8613,7 +8613,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba) · 8612 unmodified lines | |||
| 8613 | * @pwr_mode: device power mode to set | 8613 | * @pwr_mode: device power mode to set |
| 8614 | * | 8614 | * |
| 8615 | * Returns 0 if requested power mode is set successfully | 8615 | * Returns 0 if requested power mode is set successfully |
| 8616 | * Returns non-zero if failed to set the requested power mode | 8616 | * Returns < 0 if failed to set the requested power mode |
| 8617 | */ | 8617 | */ |
| 8618 | static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, | 8618 | static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, |
| 8619 | enum ufs_dev_pwr_mode pwr_mode) | 8619 | enum ufs_dev_pwr_mode pwr_mode) |
| @@ -8667,8 +8667,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, · 47 unmodified lines | |||
| 8667 | sdev_printk(KERN_WARNING, sdp, | 8667 | sdev_printk(KERN_WARNING, sdp, |
| 8668 | "START_STOP failed for power mode: %d, result %x\n", | 8668 | "START_STOP failed for power mode: %d, result %x\n", |
| 8669 | pwr_mode, ret); | 8669 | pwr_mode, ret); |
| 8670 | if (ret > 0 && scsi_sense_valid(&sshdr)) | 8670 | if (ret > 0) { |
| 8671 | scsi_print_sense_hdr(sdp, NULL, &sshdr); | 8671 | if (scsi_sense_valid(&sshdr)) |
| 8672 | scsi_print_sense_hdr(sdp, NULL, &sshdr); | ||
| 8673 | ret = -EIO; | ||
| 8674 | } | ||
| 8672 | } | 8675 | } |
| 8673 | 8676 | ||
| 8674 | if (!ret) | 8677 | if (!ret) |
| @@ -142,7 +142,8 @@ static inline u32 ufshci_version(u32 major, u32 minor) · 141 unmodified lines | |||
| 142 | #define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\ | 142 | #define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\ |
| 143 | CONTROLLER_FATAL_ERROR |\ | 143 | CONTROLLER_FATAL_ERROR |\ |
| 144 | SYSTEM_BUS_FATAL_ERROR |\ | 144 | SYSTEM_BUS_FATAL_ERROR |\ |
| 145 | CRYPTO_ENGINE_FATAL_ERROR) | 145 | CRYPTO_ENGINE_FATAL_ERROR |\ |
| 146 | UIC_LINK_LOST) | ||
| 146 | 147 | ||
| 147 | /* HCS - Host Controller Status 30h */ | 148 | /* HCS - Host Controller Status 30h */ |
| 148 | #define DEVICE_PRESENT 0x1 | 149 | #define DEVICE_PRESENT 0x1 |
| @@ -585,7 +585,7 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs) · 584 unmodified lines | |||
| 585 | u32 rd = 0; | 585 | u32 rd = 0; |
| 586 | u32 wr = 0; | 586 | u32 wr = 0; |
| 587 | 587 | ||
| 588 | if (qspi->base[CHIP_SELECT]) { | 588 | if (cs >= 0 && qspi->base[CHIP_SELECT]) { |
| 589 | rd = bcm_qspi_read(qspi, CHIP_SELECT, 0); | 589 | rd = bcm_qspi_read(qspi, CHIP_SELECT, 0); |
| 590 | wr = (rd & ~0xff) | (1 << cs); | 590 | wr = (rd & ~0xff) | (1 << cs); |
| 591 | if (rd == wr) | 591 | if (rd == wr) |
| @@ -693,6 +693,11 @@ static int meson_spicc_probe(struct platform_device *pdev) · 692 unmodified lines | |||
| 693 | writel_relaxed(0, spicc->base + SPICC_INTREG); | 693 | writel_relaxed(0, spicc->base + SPICC_INTREG); |
| 694 | 694 | ||
| 695 | irq = platform_get_irq(pdev, 0); | 695 | irq = platform_get_irq(pdev, 0); |
| 696 | if (irq < 0) { | ||
| 697 | ret = irq; | ||
| 698 | goto out_master; | ||
| 699 | } | ||
| 700 | |||
| 696 | ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq, | 701 | ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq, |
| 697 | 0, NULL, spicc); | 702 | 0, NULL, spicc); |
| 698 | if (ret) { | 703 | if (ret) { |
| @@ -624,7 +624,7 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) · 623 unmodified lines | |||
| 624 | else | 624 | else |
| 625 | mdata->state = MTK_SPI_IDLE; | 625 | mdata->state = MTK_SPI_IDLE; |
| 626 | 626 | ||
| 627 | if (!master->can_dma(master, master->cur_msg->spi, trans)) { | 627 | if (!master->can_dma(master, NULL, trans)) { |
| 628 | if (trans->rx_buf) { | 628 | if (trans->rx_buf) { |
| 629 | cnt = mdata->xfer_len / 4; | 629 | cnt = mdata->xfer_len / 4; |
| 630 | ioread32_rep(mdata->base + SPI_RX_DATA_REG, | 630 | ioread32_rep(mdata->base + SPI_RX_DATA_REG, |
| @@ -688,7 +688,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 687 unmodified lines | |||
| 688 | struct resource *res; | 688 | struct resource *res; |
| 689 | int ret, irq; | 689 | int ret, irq; |
| 690 | 690 | ||
| 691 | ctrl = spi_alloc_master(dev, sizeof(*qspi)); | 691 | ctrl = devm_spi_alloc_master(dev, sizeof(*qspi)); |
| 692 | if (!ctrl) | 692 | if (!ctrl) |
| 693 | return -ENOMEM; | 693 | return -ENOMEM; |
| 694 | 694 | ||
| @@ -697,58 +697,46 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 697 | 697 | ||
| 698 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi"); | 698 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi"); |
| 699 | qspi->io_base = devm_ioremap_resource(dev, res); | 699 | qspi->io_base = devm_ioremap_resource(dev, res); |
| 700 | if (IS_ERR(qspi->io_base)) { | 700 | if (IS_ERR(qspi->io_base)) |
| 701 | ret = PTR_ERR(qspi->io_base); | 701 | return PTR_ERR(qspi->io_base); |
| 702 | goto err_master_put; | ||
| 703 | } | ||
| 704 | 702 | ||
| 705 | qspi->phys_base = res->start; | 703 | qspi->phys_base = res->start; |
| 706 | 704 | ||
| 707 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm"); | 705 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm"); |
| 708 | qspi->mm_base = devm_ioremap_resource(dev, res); | 706 | qspi->mm_base = devm_ioremap_resource(dev, res); |
| 709 | if (IS_ERR(qspi->mm_base)) { | 707 | if (IS_ERR(qspi->mm_base)) |
| 710 | ret = PTR_ERR(qspi->mm_base); | 708 | return PTR_ERR(qspi->mm_base); |
| 711 | goto err_master_put; | ||
| 712 | } | ||
| 713 | 709 | ||
| 714 | qspi->mm_size = resource_size(res); | 710 | qspi->mm_size = resource_size(res); |
| 715 | if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) { | 711 | if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) |
| 716 | ret = -EINVAL; | 712 | return -EINVAL; |
| 717 | goto err_master_put; | ||
| 718 | } | ||
| 719 | 713 | ||
| 720 | irq = platform_get_irq(pdev, 0); | 714 | irq = platform_get_irq(pdev, 0); |
| 721 | if (irq < 0) { | 715 | if (irq < 0) |
| 722 | ret = irq; | 716 | return irq; |
| 723 | goto err_master_put; | ||
| 724 | } | ||
| 725 | 717 | ||
| 726 | ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0, | 718 | ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0, |
| 727 | dev_name(dev), qspi); | 719 | dev_name(dev), qspi); |
| 728 | if (ret) { | 720 | if (ret) { |
| 729 | dev_err(dev, "failed to request irq\n"); | 721 | dev_err(dev, "failed to request irq\n"); |
| 730 | goto err_master_put; | 722 | return ret; |
| 731 | } | 723 | } |
| 732 | 724 | ||
| 733 | init_completion(&qspi->data_completion); | 725 | init_completion(&qspi->data_completion); |
| 734 | init_completion(&qspi->match_completion); | 726 | init_completion(&qspi->match_completion); |
| 735 | 727 | ||
| 736 | qspi->clk = devm_clk_get(dev, NULL); | 728 | qspi->clk = devm_clk_get(dev, NULL); |
| 737 | if (IS_ERR(qspi->clk)) { | 729 | if (IS_ERR(qspi->clk)) |
| 738 | ret = PTR_ERR(qspi->clk); | 730 | return PTR_ERR(qspi->clk); |
| 739 | goto err_master_put; | ||
| 740 | } | ||
| 741 | 731 | ||
| 742 | qspi->clk_rate = clk_get_rate(qspi->clk); | 732 | qspi->clk_rate = clk_get_rate(qspi->clk); |
| 743 | if (!qspi->clk_rate) { | 733 | if (!qspi->clk_rate) |
| 744 | ret = -EINVAL; | 734 | return -EINVAL; |
| 745 | goto err_master_put; | ||
| 746 | } | ||
| 747 | 735 | ||
| 748 | ret = clk_prepare_enable(qspi->clk); | 736 | ret = clk_prepare_enable(qspi->clk); |
| 749 | if (ret) { | 737 | if (ret) { |
| 750 | dev_err(dev, "can not enable the clock\n"); | 738 | dev_err(dev, "can not enable the clock\n"); |
| 751 | goto err_master_put; | 739 | return ret; |
| 752 | } | 740 | } |
| 753 | 741 | ||
| 754 | rstc = devm_reset_control_get_exclusive(dev, NULL); | 742 | rstc = devm_reset_control_get_exclusive(dev, NULL); |
| @@ -784,7 +772,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 29 unmodified lines | |||
| 784 | pm_runtime_enable(dev); | 772 | pm_runtime_enable(dev); |
| 785 | pm_runtime_get_noresume(dev); | 773 | pm_runtime_get_noresume(dev); |
| 786 | 774 | ||
| 787 | ret = devm_spi_register_master(dev, ctrl); | 775 | ret = spi_register_master(ctrl); |
| 788 | if (ret) | 776 | if (ret) |
| 789 | goto err_pm_runtime_free; | 777 | goto err_pm_runtime_free; |
| 790 | 778 | ||
| @@ -806,8 +794,6 @@ err_dma_free: · 15 unmodified lines | |||
| 806 | stm32_qspi_dma_free(qspi); | 794 | stm32_qspi_dma_free(qspi); |
| 807 | err_clk_disable: | 795 | err_clk_disable: |
| 808 | clk_disable_unprepare(qspi->clk); | 796 | clk_disable_unprepare(qspi->clk); |
| 809 | err_master_put: | ||
| 810 | spi_master_put(qspi->ctrl); | ||
| 811 | 797 | ||
| 812 | return ret; | 798 | return ret; |
| 813 | } | 799 | } |
| @@ -817,6 +803,7 @@ static int stm32_qspi_remove(struct platform_device *pdev) · 3 unmodified lines | |||
| 817 | struct stm32_qspi *qspi = platform_get_drvdata(pdev); | 803 | struct stm32_qspi *qspi = platform_get_drvdata(pdev); |
| 818 | 804 | ||
| 819 | pm_runtime_get_sync(qspi->dev); | 805 | pm_runtime_get_sync(qspi->dev); |
| 806 | spi_unregister_master(qspi->ctrl); | ||
| 820 | /* disable qspi */ | 807 | /* disable qspi */ |
| 821 | writel_relaxed(0, qspi->io_base + QSPI_CR); | 808 | writel_relaxed(0, qspi->io_base + QSPI_CR); |
| 822 | stm32_qspi_dma_free(qspi); | 809 | stm32_qspi_dma_free(qspi); |
| @@ -221,7 +221,6 @@ struct stm32_spi; · 220 unmodified lines | |||
| 221 | * time between frames (if driver has this functionality) | 221 | * time between frames (if driver has this functionality) |
| 222 | * @set_number_of_data: optional routine to configure registers to desired | 222 | * @set_number_of_data: optional routine to configure registers to desired |
| 223 | * number of data (if driver has this functionality) | 223 | * number of data (if driver has this functionality) |
| 224 | * @can_dma: routine to determine if the transfer is eligible for DMA use | ||
| 225 | * @transfer_one_dma_start: routine to start transfer a single spi_transfer | 224 | * @transfer_one_dma_start: routine to start transfer a single spi_transfer |
| 226 | * using DMA | 225 | * using DMA |
| 227 | * @dma_rx_cb: routine to call after DMA RX channel operation is complete | 226 | * @dma_rx_cb: routine to call after DMA RX channel operation is complete |
| @@ -232,7 +231,7 @@ struct stm32_spi; · 4 unmodified lines | |||
| 232 | * @baud_rate_div_min: minimum baud rate divisor | 231 | * @baud_rate_div_min: minimum baud rate divisor |
| 233 | * @baud_rate_div_max: maximum baud rate divisor | 232 | * @baud_rate_div_max: maximum baud rate divisor |
| 234 | * @has_fifo: boolean to know if fifo is used for driver | 233 | * @has_fifo: boolean to know if fifo is used for driver |
| 235 | * @has_startbit: boolean to know if start bit is used to start transfer | 234 | * @flags: compatible specific SPI controller flags used at registration time |
| 236 | */ | 235 | */ |
| 237 | struct stm32_spi_cfg { | 236 | struct stm32_spi_cfg { |
| 238 | const struct stm32_spi_regspec *regs; | 237 | const struct stm32_spi_regspec *regs; |
| @@ -253,6 +252,7 @@ struct stm32_spi_cfg { · 14 unmodified lines | |||
| 253 | unsigned int baud_rate_div_min; | 252 | unsigned int baud_rate_div_min; |
| 254 | unsigned int baud_rate_div_max; | 253 | unsigned int baud_rate_div_max; |
| 255 | bool has_fifo; | 254 | bool has_fifo; |
| 255 | u16 flags; | ||
| 256 | }; | 256 | }; |
| 257 | 257 | ||
| 258 | /** | 258 | /** |
| @@ -1722,6 +1722,7 @@ static const struct stm32_spi_cfg stm32f4_spi_cfg = { · 1463 unmodified lines | |||
| 1722 | .baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN, | 1722 | .baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN, |
| 1723 | .baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX, | 1723 | .baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX, |
| 1724 | .has_fifo = false, | 1724 | .has_fifo = false, |
| 1725 | .flags = SPI_MASTER_MUST_TX, | ||
| 1725 | }; | 1726 | }; |
| 1726 | 1727 | ||
| 1727 | static const struct stm32_spi_cfg stm32h7_spi_cfg = { | 1728 | static const struct stm32_spi_cfg stm32h7_spi_cfg = { |
| @@ -1854,7 +1855,7 @@ static int stm32_spi_probe(struct platform_device *pdev) · 126 unmodified lines | |||
| 1854 | master->prepare_message = stm32_spi_prepare_msg; | 1855 | master->prepare_message = stm32_spi_prepare_msg; |
| 1855 | master->transfer_one = stm32_spi_transfer_one; | 1856 | master->transfer_one = stm32_spi_transfer_one; |
| 1856 | master->unprepare_message = stm32_spi_unprepare_msg; | 1857 | master->unprepare_message = stm32_spi_unprepare_msg; |
| 1857 | master->flags = SPI_MASTER_MUST_TX; | 1858 | master->flags = spi->cfg->flags; |
| 1858 | 1859 | ||
| 1859 | spi->dma_tx = dma_request_chan(spi->dev, "tx"); | 1860 | spi->dma_tx = dma_request_chan(spi->dev, "tx"); |
| 1860 | if (IS_ERR(spi->dma_tx)) { | 1861 | if (IS_ERR(spi->dma_tx)) { |
| @@ -726,7 +726,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 725 unmodified lines | |||
| 726 | if (ret) { | 726 | if (ret) { |
| 727 | dev_err(&pdev->dev, "failed to get TX DMA capacities: %d\n", | 727 | dev_err(&pdev->dev, "failed to get TX DMA capacities: %d\n", |
| 728 | ret); | 728 | ret); |
| 729 | goto out_disable_clk; | 729 | goto out_release_dma; |
| 730 | } | 730 | } |
| 731 | dma_tx_burst = caps.max_burst; | 731 | dma_tx_burst = caps.max_burst; |
| 732 | } | 732 | } |
| @@ -735,7 +735,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 735 | if (IS_ERR_OR_NULL(master->dma_rx)) { | 735 | if (IS_ERR_OR_NULL(master->dma_rx)) { |
| 736 | if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) { | 736 | if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) { |
| 737 | ret = -EPROBE_DEFER; | 737 | ret = -EPROBE_DEFER; |
| 738 | goto out_disable_clk; | 738 | goto out_release_dma; |
| 739 | } | 739 | } |
| 740 | master->dma_rx = NULL; | 740 | master->dma_rx = NULL; |
| 741 | dma_rx_burst = INT_MAX; | 741 | dma_rx_burst = INT_MAX; |
| @@ -744,7 +744,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 744 | if (ret) { | 744 | if (ret) { |
| 745 | dev_err(&pdev->dev, "failed to get RX DMA capacities: %d\n", | 745 | dev_err(&pdev->dev, "failed to get RX DMA capacities: %d\n", |
| 746 | ret); | 746 | ret); |
| 747 | goto out_disable_clk; | 747 | goto out_release_dma; |
| 748 | } | 748 | } |
| 749 | dma_rx_burst = caps.max_burst; | 749 | dma_rx_burst = caps.max_burst; |
| 750 | } | 750 | } |
| @@ -753,10 +753,20 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 753 | 753 | ||
| 754 | ret = devm_spi_register_master(&pdev->dev, master); | 754 | ret = devm_spi_register_master(&pdev->dev, master); |
| 755 | if (ret) | 755 | if (ret) |
| 756 | goto out_disable_clk; | 756 | goto out_release_dma; |
| 757 | 757 | ||
| 758 | return 0; | 758 | return 0; |
| 759 | 759 | ||
| 760 | out_release_dma: | ||
| 761 | if (!IS_ERR_OR_NULL(master->dma_rx)) { | ||
| 762 | dma_release_channel(master->dma_rx); | ||
| 763 | master->dma_rx = NULL; | ||
| 764 | } | ||
| 765 | if (!IS_ERR_OR_NULL(master->dma_tx)) { | ||
| 766 | dma_release_channel(master->dma_tx); | ||
| 767 | master->dma_tx = NULL; | ||
| 768 | } | ||
| 769 | |||
| 760 | out_disable_clk: | 770 | out_disable_clk: |
| 761 | clk_disable_unprepare(priv->clk); | 771 | clk_disable_unprepare(priv->clk); |
| 762 | 772 | ||
| @@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal( · 442 unmodified lines | |||
| 443 | break; | 443 | break; |
| 444 | } | 444 | } |
| 445 | spin_unlock(&tpg->tpg_np_lock); | 445 | spin_unlock(&tpg->tpg_np_lock); |
| 446 | |||
| 447 | if (match) | ||
| 448 | break; | ||
| 446 | } | 449 | } |
| 447 | spin_unlock(&tiqn->tiqn_tpg_lock); | 450 | spin_unlock(&tiqn->tiqn_tpg_lock); |
| 448 | 451 | ||
| @@ -322,6 +322,7 @@ static int addr_cnt; · 321 unmodified lines | |||
| 322 | #define GSM1_ESCAPE_BITS 0x20 | 322 | #define GSM1_ESCAPE_BITS 0x20 |
| 323 | #define XON 0x11 | 323 | #define XON 0x11 |
| 324 | #define XOFF 0x13 | 324 | #define XOFF 0x13 |
| 325 | #define ISO_IEC_646_MASK 0x7F | ||
| 325 | 326 | ||
| 326 | static const struct tty_port_operations gsm_port_ops; | 327 | static const struct tty_port_operations gsm_port_ops; |
| 327 | 328 | ||
| @@ -531,7 +532,8 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len) · 203 unmodified lines | |||
| 531 | int olen = 0; | 532 | int olen = 0; |
| 532 | while (len--) { | 533 | while (len--) { |
| 533 | if (*input == GSM1_SOF || *input == GSM1_ESCAPE | 534 | if (*input == GSM1_SOF || *input == GSM1_ESCAPE |
| 534 | || *input == XON || *input == XOFF) { | 535 | || (*input & ISO_IEC_646_MASK) == XON |
| 536 | || (*input & ISO_IEC_646_MASK) == XOFF) { | ||
| 535 | *output++ = GSM1_ESCAPE; | 537 | *output++ = GSM1_ESCAPE; |
| 536 | *output++ = *input++ ^ GSM1_ESCAPE_BITS; | 538 | *output++ = *input++ ^ GSM1_ESCAPE_BITS; |
| 537 | olen++; | 539 | olen++; |
| @@ -50,10 +50,17 @@ static int rpmsg_tty_cb(struct rpmsg_device *rpdev, void *data, int len, void *p · 49 unmodified lines | |||
| 50 | static int rpmsg_tty_install(struct tty_driver *driver, struct tty_struct *tty) | 50 | static int rpmsg_tty_install(struct tty_driver *driver, struct tty_struct *tty) |
| 51 | { | 51 | { |
| 52 | struct rpmsg_tty_port *cport = idr_find(&tty_idr, tty->index); | 52 | struct rpmsg_tty_port *cport = idr_find(&tty_idr, tty->index); |
| 53 | struct tty_port *port; | ||
| 53 | 54 | ||
| 54 | tty->driver_data = cport; | 55 | tty->driver_data = cport; |
| 55 | 56 | ||
| 56 | return tty_port_install(&cport->port, driver, tty); | 57 | port = tty_port_get(&cport->port); |
| 58 | return tty_port_install(port, driver, tty); | ||
| 59 | } | ||
| 60 | |||
| 61 | static void rpmsg_tty_cleanup(struct tty_struct *tty) | ||
| 62 | { | ||
| 63 | tty_port_put(tty->port); | ||
| 57 | } | 64 | } |
| 58 | 65 | ||
| 59 | static int rpmsg_tty_open(struct tty_struct *tty, struct file *filp) | 66 | static int rpmsg_tty_open(struct tty_struct *tty, struct file *filp) |
| @@ -106,12 +113,19 @@ static unsigned int rpmsg_tty_write_room(struct tty_struct *tty) · 46 unmodified lines | |||
| 106 | return size; | 113 | return size; |
| 107 | } | 114 | } |
| 108 | 115 | ||
| 116 | static void rpmsg_tty_hangup(struct tty_struct *tty) | ||
| 117 | { | ||
| 118 | tty_port_hangup(tty->port); | ||
| 119 | } | ||
| 120 | |||
| 109 | static const struct tty_operations rpmsg_tty_ops = { | 121 | static const struct tty_operations rpmsg_tty_ops = { |
| 110 | .install = rpmsg_tty_install, | 122 | .install = rpmsg_tty_install, |
| 111 | .open = rpmsg_tty_open, | 123 | .open = rpmsg_tty_open, |
| 112 | .close = rpmsg_tty_close, | 124 | .close = rpmsg_tty_close, |
| 113 | .write = rpmsg_tty_write, | 125 | .write = rpmsg_tty_write, |
| 114 | .write_room = rpmsg_tty_write_room, | 126 | .write_room = rpmsg_tty_write_room, |
| 127 | .hangup = rpmsg_tty_hangup, | ||
| 128 | .cleanup = rpmsg_tty_cleanup, | ||
| 115 | }; | 129 | }; |
| 116 | 130 | ||
| 117 | static struct rpmsg_tty_port *rpmsg_tty_alloc_cport(void) | 131 | static struct rpmsg_tty_port *rpmsg_tty_alloc_cport(void) |
| @@ -137,8 +151,10 @@ static struct rpmsg_tty_port *rpmsg_tty_alloc_cport(void) · 19 unmodified lines | |||
| 137 | return cport; | 151 | return cport; |
| 138 | } | 152 | } |
| 139 | 153 | ||
| 140 | static void rpmsg_tty_release_cport(struct rpmsg_tty_port *cport) | 154 | static void rpmsg_tty_destruct_port(struct tty_port *port) |
| 141 | { | 155 | { |
| 156 | struct rpmsg_tty_port *cport = container_of(port, struct rpmsg_tty_port, port); | ||
| 157 | |||
| 142 | mutex_lock(&idr_lock); | 158 | mutex_lock(&idr_lock); |
| 143 | idr_remove(&tty_idr, cport->id); | 159 | idr_remove(&tty_idr, cport->id); |
| 144 | mutex_unlock(&idr_lock); | 160 | mutex_unlock(&idr_lock); |
| @@ -146,7 +162,10 @@ static void rpmsg_tty_release_cport(struct rpmsg_tty_port *cport) · 1 unmodified line | |||
| 146 | kfree(cport); | 162 | kfree(cport); |
| 147 | } | 163 | } |
| 148 | 164 | ||
| 149 | static const struct tty_port_operations rpmsg_tty_port_ops = { }; | 165 | static const struct tty_port_operations rpmsg_tty_port_ops = { |
| 166 | .destruct = rpmsg_tty_destruct_port, | ||
| 167 | }; | ||
| 168 | |||
| 150 | 169 | ||
| 151 | static int rpmsg_tty_probe(struct rpmsg_device *rpdev) | 170 | static int rpmsg_tty_probe(struct rpmsg_device *rpdev) |
| 152 | { | 171 | { |
| @@ -166,7 +185,8 @@ static int rpmsg_tty_probe(struct rpmsg_device *rpdev) · 13 unmodified lines | |||
| 166 | cport->id, dev); | 185 | cport->id, dev); |
| 167 | if (IS_ERR(tty_dev)) { | 186 | if (IS_ERR(tty_dev)) { |
| 168 | ret = dev_err_probe(dev, PTR_ERR(tty_dev), "Failed to register tty port\n"); | 187 | ret = dev_err_probe(dev, PTR_ERR(tty_dev), "Failed to register tty port\n"); |
| 169 | goto err_destroy; | 188 | tty_port_put(&cport->port); |
| 189 | return ret; | ||
| 170 | } | 190 | } |
| 171 | 191 | ||
| 172 | cport->rpdev = rpdev; | 192 | cport->rpdev = rpdev; |
| @@ -177,12 +197,6 @@ static int rpmsg_tty_probe(struct rpmsg_device *rpdev) · 4 unmodified lines | |||
| 177 | rpdev->src, rpdev->dst, cport->id); | 197 | rpdev->src, rpdev->dst, cport->id); |
| 178 | 198 | ||
| 179 | return 0; | 199 | return 0; |
| 180 | |||
| 181 | err_destroy: | ||
| 182 | tty_port_destroy(&cport->port); | ||
| 183 | rpmsg_tty_release_cport(cport); | ||
| 184 | |||
| 185 | return ret; | ||
| 186 | } | 200 | } |
| 187 | 201 | ||
| 188 | static void rpmsg_tty_remove(struct rpmsg_device *rpdev) | 202 | static void rpmsg_tty_remove(struct rpmsg_device *rpdev) |
| @@ -192,13 +206,11 @@ static void rpmsg_tty_remove(struct rpmsg_device *rpdev) · 3 unmodified lines | |||
| 192 | dev_dbg(&rpdev->dev, "Removing rpmsg tty device %d\n", cport->id); | 206 | dev_dbg(&rpdev->dev, "Removing rpmsg tty device %d\n", cport->id); |
| 193 | 207 | ||
| 194 | /* User hang up to release the tty */ | 208 | /* User hang up to release the tty */ |
| 195 | if (tty_port_initialized(&cport->port)) | 209 | tty_port_tty_hangup(&cport->port, false); |
| 196 | tty_port_tty_hangup(&cport->port, false); | ||
| 197 | 210 | ||
| 198 | tty_unregister_device(rpmsg_tty_driver, cport->id); | 211 | tty_unregister_device(rpmsg_tty_driver, cport->id); |
| 199 | 212 | ||
| 200 | tty_port_destroy(&cport->port); | 213 | tty_port_put(&cport->port); |
| 201 | rpmsg_tty_release_cport(cport); | ||
| 202 | } | 214 | } |
| 203 | 215 | ||
| 204 | static struct rpmsg_device_id rpmsg_driver_tty_id_table[] = { | 216 | static struct rpmsg_device_id rpmsg_driver_tty_id_table[] = { |
| @@ -83,8 +83,17 @@ static int of_platform_serial_setup(struct platform_device *ofdev, · 82 unmodified lines | |||
| 83 | port->mapsize = resource_size(&resource); | 83 | port->mapsize = resource_size(&resource); |
| 84 | 84 | ||
| 85 | /* Check for shifted address mapping */ | 85 | /* Check for shifted address mapping */ |
| 86 | if (of_property_read_u32(np, "reg-offset", &prop) == 0) | 86 | if (of_property_read_u32(np, "reg-offset", &prop) == 0) { |
| 87 | if (prop >= port->mapsize) { | ||
| 88 | dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n", | ||
| 89 | prop, &port->mapsize); | ||
| 90 | ret = -EINVAL; | ||
| 91 | goto err_unprepare; | ||
| 92 | } | ||
| 93 | |||
| 87 | port->mapbase += prop; | 94 | port->mapbase += prop; |
| 95 | port->mapsize -= prop; | ||
| 96 | } | ||
| 88 | 97 | ||
| 89 | port->iotype = UPIO_MEM; | 98 | port->iotype = UPIO_MEM; |
| 90 | if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { | 99 | if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { |
| @@ -4779,8 +4779,30 @@ static const struct pci_device_id serial_pci_tbl[] = { · 4778 unmodified lines | |||
| 4779 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400, | 4779 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400, |
| 4780 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */ | 4780 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */ |
| 4781 | pbn_b2_4_115200 }, | 4781 | pbn_b2_4_115200 }, |
| 4782 | /* Brainboxes Devices */ | ||
| 4782 | /* | 4783 | /* |
| 4783 | * BrainBoxes UC-260 | 4784 | * Brainboxes UC-101 |
| 4785 | */ | ||
| 4786 | { PCI_VENDOR_ID_INTASHIELD, 0x0BA1, | ||
| 4787 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4788 | 0, 0, | ||
| 4789 | pbn_b2_2_115200 }, | ||
| 4790 | /* | ||
| 4791 | * Brainboxes UC-235/246 | ||
| 4792 | */ | ||
| 4793 | { PCI_VENDOR_ID_INTASHIELD, 0x0AA1, | ||
| 4794 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4795 | 0, 0, | ||
| 4796 | pbn_b2_1_115200 }, | ||
| 4797 | /* | ||
| 4798 | * Brainboxes UC-257 | ||
| 4799 | */ | ||
| 4800 | { PCI_VENDOR_ID_INTASHIELD, 0x0861, | ||
| 4801 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4802 | 0, 0, | ||
| 4803 | pbn_b2_2_115200 }, | ||
| 4804 | /* | ||
| 4805 | * Brainboxes UC-260/271/701/756 | ||
| 4784 | */ | 4806 | */ |
| 4785 | { PCI_VENDOR_ID_INTASHIELD, 0x0D21, | 4807 | { PCI_VENDOR_ID_INTASHIELD, 0x0D21, |
| 4786 | PCI_ANY_ID, PCI_ANY_ID, | 4808 | PCI_ANY_ID, PCI_ANY_ID, |
| @@ -4788,7 +4810,81 @@ static const struct pci_device_id serial_pci_tbl[] = { · 1 unmodified line | |||
| 4788 | pbn_b2_4_115200 }, | 4810 | pbn_b2_4_115200 }, |
| 4789 | { PCI_VENDOR_ID_INTASHIELD, 0x0E34, | 4811 | { PCI_VENDOR_ID_INTASHIELD, 0x0E34, |
| 4790 | PCI_ANY_ID, PCI_ANY_ID, | 4812 | PCI_ANY_ID, PCI_ANY_ID, |
| 4791 | PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00, | 4813 | PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00, |
| 4814 | pbn_b2_4_115200 }, | ||
| 4815 | /* | ||
| 4816 | * Brainboxes UC-268 | ||
| 4817 | */ | ||
| 4818 | { PCI_VENDOR_ID_INTASHIELD, 0x0841, | ||
| 4819 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4820 | 0, 0, | ||
| 4821 | pbn_b2_4_115200 }, | ||
| 4822 | /* | ||
| 4823 | * Brainboxes UC-275/279 | ||
| 4824 | */ | ||
| 4825 | { PCI_VENDOR_ID_INTASHIELD, 0x0881, | ||
| 4826 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4827 | 0, 0, | ||
| 4828 | pbn_b2_8_115200 }, | ||
| 4829 | /* | ||
| 4830 | * Brainboxes UC-302 | ||
| 4831 | */ | ||
| 4832 | { PCI_VENDOR_ID_INTASHIELD, 0x08E1, | ||
| 4833 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4834 | 0, 0, | ||
| 4835 | pbn_b2_2_115200 }, | ||
| 4836 | /* | ||
| 4837 | * Brainboxes UC-310 | ||
| 4838 | */ | ||
| 4839 | { PCI_VENDOR_ID_INTASHIELD, 0x08C1, | ||
| 4840 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4841 | 0, 0, | ||
| 4842 | pbn_b2_2_115200 }, | ||
| 4843 | /* | ||
| 4844 | * Brainboxes UC-313 | ||
| 4845 | */ | ||
| 4846 | { PCI_VENDOR_ID_INTASHIELD, 0x08A3, | ||
| 4847 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4848 | 0, 0, | ||
| 4849 | pbn_b2_2_115200 }, | ||
| 4850 | /* | ||
| 4851 | * Brainboxes UC-320/324 | ||
| 4852 | */ | ||
| 4853 | { PCI_VENDOR_ID_INTASHIELD, 0x0A61, | ||
| 4854 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4855 | 0, 0, | ||
| 4856 | pbn_b2_1_115200 }, | ||
| 4857 | /* | ||
| 4858 | * Brainboxes UC-346 | ||
| 4859 | */ | ||
| 4860 | { PCI_VENDOR_ID_INTASHIELD, 0x0B02, | ||
| 4861 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4862 | 0, 0, | ||
| 4863 | pbn_b2_4_115200 }, | ||
| 4864 | /* | ||
| 4865 | * Brainboxes UC-357 | ||
| 4866 | */ | ||
| 4867 | { PCI_VENDOR_ID_INTASHIELD, 0x0A81, | ||
| 4868 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4869 | 0, 0, | ||
| 4870 | pbn_b2_2_115200 }, | ||
| 4871 | { PCI_VENDOR_ID_INTASHIELD, 0x0A83, | ||
| 4872 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4873 | 0, 0, | ||
| 4874 | pbn_b2_2_115200 }, | ||
| 4875 | /* | ||
| 4876 | * Brainboxes UC-368 | ||
| 4877 | */ | ||
| 4878 | { PCI_VENDOR_ID_INTASHIELD, 0x0C41, | ||
| 4879 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4880 | 0, 0, | ||
| 4881 | pbn_b2_4_115200 }, | ||
| 4882 | /* | ||
| 4883 | * Brainboxes UC-420/431 | ||
| 4884 | */ | ||
| 4885 | { PCI_VENDOR_ID_INTASHIELD, 0x0921, | ||
| 4886 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 4887 | 0, 0, | ||
| 4792 | pbn_b2_4_115200 }, | 4888 | pbn_b2_4_115200 }, |
| 4793 | /* | 4889 | /* |
| 4794 | * Perle PCI-RAS cards | 4890 | * Perle PCI-RAS cards |
| @@ -2056,7 +2056,10 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state) · 2055 unmodified lines | |||
| 2056 | serial8250_rpm_put(up); | 2056 | serial8250_rpm_put(up); |
| 2057 | } | 2057 | } |
| 2058 | 2058 | ||
| 2059 | static void wait_for_lsr(struct uart_8250_port *up, int bits) | 2059 | /* |
| 2060 | * Wait for transmitter & holding register to empty | ||
| 2061 | */ | ||
| 2062 | static void wait_for_xmitr(struct uart_8250_port *up, int bits) | ||
| 2060 | { | 2063 | { |
| 2061 | unsigned int status, tmout = 10000; | 2064 | unsigned int status, tmout = 10000; |
| 2062 | 2065 | ||
| @@ -2073,16 +2076,6 @@ static void wait_for_lsr(struct uart_8250_port *up, int bits) · 10 unmodified lines | |||
| 2073 | udelay(1); | 2076 | udelay(1); |
| 2074 | touch_nmi_watchdog(); | 2077 | touch_nmi_watchdog(); |
| 2075 | } | 2078 | } |
| 2076 | } | ||
| 2077 | |||
| 2078 | /* | ||
| 2079 | * Wait for transmitter & holding register to empty | ||
| 2080 | */ | ||
| 2081 | static void wait_for_xmitr(struct uart_8250_port *up, int bits) | ||
| 2082 | { | ||
| 2083 | unsigned int tmout; | ||
| 2084 | |||
| 2085 | wait_for_lsr(up, bits); | ||
| 2086 | 2079 | ||
| 2087 | /* Wait up to 1s for flow control if necessary */ | 2080 | /* Wait up to 1s for flow control if necessary */ |
| 2088 | if (up->port.flags & UPF_CONS_FLOW) { | 2081 | if (up->port.flags & UPF_CONS_FLOW) { |
| @@ -3332,35 +3325,6 @@ static void serial8250_console_restore(struct uart_8250_port *up) · 1243 unmodified lines | |||
| 3332 | serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS); | 3325 | serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS); |
| 3333 | } | 3326 | } |
| 3334 | 3327 | ||
| 3335 | /* | ||
| 3336 | * Print a string to the serial port using the device FIFO | ||
| 3337 | * | ||
| 3338 | * It sends fifosize bytes and then waits for the fifo | ||
| 3339 | * to get empty. | ||
| 3340 | */ | ||
| 3341 | static void serial8250_console_fifo_write(struct uart_8250_port *up, | ||
| 3342 | const char *s, unsigned int count) | ||
| 3343 | { | ||
| 3344 | int i; | ||
| 3345 | const char *end = s + count; | ||
| 3346 | unsigned int fifosize = up->port.fifosize; | ||
| 3347 | bool cr_sent = false; | ||
| 3348 | |||
| 3349 | while (s != end) { | ||
| 3350 | wait_for_lsr(up, UART_LSR_THRE); | ||
| 3351 | |||
| 3352 | for (i = 0; i < fifosize && s != end; ++i) { | ||
| 3353 | if (*s == '\n' && !cr_sent) { | ||
| 3354 | serial_out(up, UART_TX, '\r'); | ||
| 3355 | cr_sent = true; | ||
| 3356 | } else { | ||
| 3357 | serial_out(up, UART_TX, *s++); | ||
| 3358 | cr_sent = false; | ||
| 3359 | } | ||
| 3360 | } | ||
| 3361 | } | ||
| 3362 | } | ||
| 3363 | |||
| 3364 | /* | 3328 | /* |
| 3365 | * Print a string to the serial port trying not to disturb | 3329 | * Print a string to the serial port trying not to disturb |
| 3366 | * any possible real use of the port... | 3330 | * any possible real use of the port... |
| @@ -3376,7 +3340,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, · 9 unmodified lines | |||
| 3376 | struct uart_8250_em485 *em485 = up->em485; | 3340 | struct uart_8250_em485 *em485 = up->em485; |
| 3377 | struct uart_port *port = &up->port; | 3341 | struct uart_port *port = &up->port; |
| 3378 | unsigned long flags; | 3342 | unsigned long flags; |
| 3379 | unsigned int ier, use_fifo; | 3343 | unsigned int ier; |
| 3380 | int locked = 1; | 3344 | int locked = 1; |
| 3381 | 3345 | ||
| 3382 | touch_nmi_watchdog(); | 3346 | touch_nmi_watchdog(); |
| @@ -3408,20 +3372,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, · 25 unmodified lines | |||
| 3408 | mdelay(port->rs485.delay_rts_before_send); | 3372 | mdelay(port->rs485.delay_rts_before_send); |
| 3409 | } | 3373 | } |
| 3410 | 3374 | ||
| 3411 | use_fifo = (up->capabilities & UART_CAP_FIFO) && | 3375 | uart_console_write(port, s, count, serial8250_console_putchar); |
| 3412 | port->fifosize > 1 && | ||
| 3413 | (serial_port_in(port, UART_FCR) & UART_FCR_ENABLE_FIFO) && | ||
| 3414 | /* | ||
| 3415 | * After we put a data in the fifo, the controller will send | ||
| 3416 | * it regardless of the CTS state. Therefore, only use fifo | ||
| 3417 | * if we don't use control flow. | ||
| 3418 | */ | ||
| 3419 | !(up->port.flags & UPF_CONS_FLOW); | ||
| 3420 | |||
| 3421 | if (likely(use_fifo)) | ||
| 3422 | serial8250_console_fifo_write(up, s, count); | ||
| 3423 | else | ||
| 3424 | uart_console_write(port, s, count, serial8250_console_putchar); | ||
| 3425 | 3376 | ||
| 3426 | /* | 3377 | /* |
| 3427 | * Finally, wait for transmitter to become empty | 3378 | * Finally, wait for transmitter to become empty |
| @@ -1582,9 +1582,6 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl) · 1581 unmodified lines | |||
| 1582 | container_of(port, struct uart_amba_port, port); | 1582 | container_of(port, struct uart_amba_port, port); |
| 1583 | unsigned int cr; | 1583 | unsigned int cr; |
| 1584 | 1584 | ||
| 1585 | if (port->rs485.flags & SER_RS485_ENABLED) | ||
| 1586 | mctrl &= ~TIOCM_RTS; | ||
| 1587 | |||
| 1588 | cr = pl011_read(uap, REG_CR); | 1585 | cr = pl011_read(uap, REG_CR); |
| 1589 | 1586 | ||
| 1590 | #define TIOCMBIT(tiocmbit, uartbit) \ | 1587 | #define TIOCMBIT(tiocmbit, uartbit) \ |
| @@ -1808,14 +1805,8 @@ static int pl011_startup(struct uart_port *port) · 217 unmodified lines | |||
| 1808 | cr &= UART011_CR_RTS | UART011_CR_DTR; | 1805 | cr &= UART011_CR_RTS | UART011_CR_DTR; |
| 1809 | cr |= UART01x_CR_UARTEN | UART011_CR_RXE; | 1806 | cr |= UART01x_CR_UARTEN | UART011_CR_RXE; |
| 1810 | 1807 | ||
| 1811 | if (port->rs485.flags & SER_RS485_ENABLED) { | 1808 | if (!(port->rs485.flags & SER_RS485_ENABLED)) |
| 1812 | if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND) | ||
| 1813 | cr &= ~UART011_CR_RTS; | ||
| 1814 | else | ||
| 1815 | cr |= UART011_CR_RTS; | ||
| 1816 | } else { | ||
| 1817 | cr |= UART011_CR_TXE; | 1809 | cr |= UART011_CR_TXE; |
| 1818 | } | ||
| 1819 | 1810 | ||
| 1820 | pl011_write(cr, uap, REG_CR); | 1811 | pl011_write(cr, uap, REG_CR); |
| 1821 | 1812 | ||
| @@ -144,6 +144,11 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear) · 143 unmodified lines | |||
| 144 | unsigned long flags; | 144 | unsigned long flags; |
| 145 | unsigned int old; | 145 | unsigned int old; |
| 146 | 146 | ||
| 147 | if (port->rs485.flags & SER_RS485_ENABLED) { | ||
| 148 | set &= ~TIOCM_RTS; | ||
| 149 | clear &= ~TIOCM_RTS; | ||
| 150 | } | ||
| 151 | |||
| 147 | spin_lock_irqsave(&port->lock, flags); | 152 | spin_lock_irqsave(&port->lock, flags); |
| 148 | old = port->mctrl; | 153 | old = port->mctrl; |
| 149 | port->mctrl = (old & ~clear) | set; | 154 | port->mctrl = (old & ~clear) | set; |
| @@ -157,23 +162,10 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear) · 7 unmodified lines | |||
| 157 | 162 | ||
| 158 | static void uart_port_dtr_rts(struct uart_port *uport, int raise) | 163 | static void uart_port_dtr_rts(struct uart_port *uport, int raise) |
| 159 | { | 164 | { |
| 160 | int rs485_on = uport->rs485_config && | 165 | if (raise) |
| 161 | (uport->rs485.flags & SER_RS485_ENABLED); | 166 | uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS); |
| 162 | int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); | 167 | else |
| 163 | 168 | uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); | |
| 164 | if (raise) { | ||
| 165 | if (rs485_on && RTS_after_send) { | ||
| 166 | uart_set_mctrl(uport, TIOCM_DTR); | ||
| 167 | uart_clear_mctrl(uport, TIOCM_RTS); | ||
| 168 | } else { | ||
| 169 | uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS); | ||
| 170 | } | ||
| 171 | } else { | ||
| 172 | unsigned int clear = TIOCM_DTR; | ||
| 173 | |||
| 174 | clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; | ||
| 175 | uart_clear_mctrl(uport, clear); | ||
| 176 | } | ||
| 177 | } | 169 | } |
| 178 | 170 | ||
| 179 | /* | 171 | /* |
| @@ -1075,11 +1067,6 @@ uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) · 895 unmodified lines | |||
| 1075 | goto out; | 1067 | goto out; |
| 1076 | 1068 | ||
| 1077 | if (!tty_io_error(tty)) { | 1069 | if (!tty_io_error(tty)) { |
| 1078 | if (uport->rs485.flags & SER_RS485_ENABLED) { | ||
| 1079 | set &= ~TIOCM_RTS; | ||
| 1080 | clear &= ~TIOCM_RTS; | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | uart_update_mctrl(uport, set, clear); | 1070 | uart_update_mctrl(uport, set, clear); |
| 1084 | ret = 0; | 1071 | ret = 0; |
| 1085 | } | 1072 | } |
| @@ -2390,6 +2377,9 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, · 1304 unmodified lines | |||
| 2390 | */ | 2377 | */ |
| 2391 | spin_lock_irqsave(&port->lock, flags); | 2378 | spin_lock_irqsave(&port->lock, flags); |
| 2392 | port->mctrl &= TIOCM_DTR; | 2379 | port->mctrl &= TIOCM_DTR; |
| 2380 | if (port->rs485.flags & SER_RS485_ENABLED && | ||
| 2381 | !(port->rs485.flags & SER_RS485_RTS_AFTER_SEND)) | ||
| 2382 | port->mctrl |= TIOCM_RTS; | ||
| 2393 | port->ops->set_mctrl(port, port->mctrl); | 2383 | port->ops->set_mctrl(port, port->mctrl); |
| 2394 | spin_unlock_irqrestore(&port->lock, flags); | 2384 | spin_unlock_irqrestore(&port->lock, flags); |
| 2395 | 2385 | ||
| @@ -550,11 +550,23 @@ static void stm32_usart_transmit_chars(struct uart_port *port) · 549 unmodified lines | |||
| 550 | struct stm32_port *stm32_port = to_stm32_port(port); | 550 | struct stm32_port *stm32_port = to_stm32_port(port); |
| 551 | const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; | 551 | const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; |
| 552 | struct circ_buf *xmit = &port->state->xmit; | 552 | struct circ_buf *xmit = &port->state->xmit; |
| 553 | u32 isr; | ||
| 554 | int ret; | ||
| 553 | 555 | ||
| 554 | if (port->x_char) { | 556 | if (port->x_char) { |
| 555 | if (stm32_usart_tx_dma_started(stm32_port) && | 557 | if (stm32_usart_tx_dma_started(stm32_port) && |
| 556 | stm32_usart_tx_dma_enabled(stm32_port)) | 558 | stm32_usart_tx_dma_enabled(stm32_port)) |
| 557 | stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT); | 559 | stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT); |
| 560 | |||
| 561 | /* Check that TDR is empty before filling FIFO */ | ||
| 562 | ret = | ||
| 563 | readl_relaxed_poll_timeout_atomic(port->membase + ofs->isr, | ||
| 564 | isr, | ||
| 565 | (isr & USART_SR_TXE), | ||
| 566 | 10, 1000); | ||
| 567 | if (ret) | ||
| 568 | dev_warn(port->dev, "1 character may be erased\n"); | ||
| 569 | |||
| 558 | writel_relaxed(port->x_char, port->membase + ofs->tdr); | 570 | writel_relaxed(port->x_char, port->membase + ofs->tdr); |
| 559 | port->x_char = 0; | 571 | port->x_char = 0; |
| 560 | port->icount.tx++; | 572 | port->icount.tx++; |
| @@ -730,7 +742,7 @@ static void stm32_usart_start_tx(struct uart_port *port) · 169 unmodified lines | |||
| 730 | struct serial_rs485 *rs485conf = &port->rs485; | 742 | struct serial_rs485 *rs485conf = &port->rs485; |
| 731 | struct circ_buf *xmit = &port->state->xmit; | 743 | struct circ_buf *xmit = &port->state->xmit; |
| 732 | 744 | ||
| 733 | if (uart_circ_empty(xmit)) | 745 | if (uart_circ_empty(xmit) && !port->x_char) |
| 734 | return; | 746 | return; |
| 735 | 747 | ||
| 736 | if (rs485conf->flags & SER_RS485_ENABLED) { | 748 | if (rs485conf->flags & SER_RS485_ENABLED) { |
| @@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns) · 482 unmodified lines | |||
| 483 | /* Indicate the cdns3 core was power lost before */ | 483 | /* Indicate the cdns3 core was power lost before */ |
| 484 | bool cdns_power_is_lost(struct cdns *cdns) | 484 | bool cdns_power_is_lost(struct cdns *cdns) |
| 485 | { | 485 | { |
| 486 | if (cdns->version == CDNS3_CONTROLLER_V1) { | 486 | if (cdns->version == CDNS3_CONTROLLER_V0) { |
| 487 | if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) | 487 | if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) |
| 488 | return true; | 488 | return true; |
| 489 | } else { | 489 | } else { |
| 490 | if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) | 490 | if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) |
| 491 | return true; | 491 | return true; |
| 492 | } | 492 | } |
| 493 | return false; | 493 | return false; |
| @@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev, struct device_driver *driver) · 38 unmodified lines | |||
| 39 | struct ulpi *ulpi = to_ulpi_dev(dev); | 39 | struct ulpi *ulpi = to_ulpi_dev(dev); |
| 40 | const struct ulpi_device_id *id; | 40 | const struct ulpi_device_id *id; |
| 41 | 41 | ||
| 42 | /* Some ULPI devices don't have a vendor id so rely on OF match */ | 42 | /* |
| 43 | if (ulpi->id.vendor == 0) | 43 | * Some ULPI devices don't have a vendor id |
| 44 | * or provide an id_table so rely on OF match. | ||
| 45 | */ | ||
| 46 | if (ulpi->id.vendor == 0 || !drv->id_table) | ||
| 44 | return of_driver_match_device(dev, driver); | 47 | return of_driver_match_device(dev, driver); |
| 45 | 48 | ||
| 46 | for (id = drv->id_table; id->vendor; id++) | 49 | for (id = drv->id_table; id->vendor; id++) |
| @@ -1563,6 +1563,13 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags) · 1562 unmodified lines | |||
| 1563 | urb->hcpriv = NULL; | 1563 | urb->hcpriv = NULL; |
| 1564 | INIT_LIST_HEAD(&urb->urb_list); | 1564 | INIT_LIST_HEAD(&urb->urb_list); |
| 1565 | atomic_dec(&urb->use_count); | 1565 | atomic_dec(&urb->use_count); |
| 1566 | /* | ||
| 1567 | * Order the write of urb->use_count above before the read | ||
| 1568 | * of urb->reject below. Pairs with the memory barriers in | ||
| 1569 | * usb_kill_urb() and usb_poison_urb(). | ||
| 1570 | */ | ||
| 1571 | smp_mb__after_atomic(); | ||
| 1572 | |||
| 1566 | atomic_dec(&urb->dev->urbnum); | 1573 | atomic_dec(&urb->dev->urbnum); |
| 1567 | if (atomic_read(&urb->reject)) | 1574 | if (atomic_read(&urb->reject)) |
| 1568 | wake_up(&usb_kill_urb_queue); | 1575 | wake_up(&usb_kill_urb_queue); |
| @@ -1665,6 +1672,13 @@ static void __usb_hcd_giveback_urb(struct urb *urb) · 96 unmodified lines | |||
| 1665 | 1672 | ||
| 1666 | usb_anchor_resume_wakeups(anchor); | 1673 | usb_anchor_resume_wakeups(anchor); |
| 1667 | atomic_dec(&urb->use_count); | 1674 | atomic_dec(&urb->use_count); |
| 1675 | /* | ||
| 1676 | * Order the write of urb->use_count above before the read | ||
| 1677 | * of urb->reject below. Pairs with the memory barriers in | ||
| 1678 | * usb_kill_urb() and usb_poison_urb(). | ||
| 1679 | */ | ||
| 1680 | smp_mb__after_atomic(); | ||
| 1681 | |||
| 1668 | if (unlikely(atomic_read(&urb->reject))) | 1682 | if (unlikely(atomic_read(&urb->reject))) |
| 1669 | wake_up(&usb_kill_urb_queue); | 1683 | wake_up(&usb_kill_urb_queue); |
| 1670 | usb_put_urb(urb); | 1684 | usb_put_urb(urb); |
| @@ -715,6 +715,12 @@ void usb_kill_urb(struct urb *urb) · 714 unmodified lines | |||
| 715 | if (!(urb && urb->dev && urb->ep)) | 715 | if (!(urb && urb->dev && urb->ep)) |
| 716 | return; | 716 | return; |
| 717 | atomic_inc(&urb->reject); | 717 | atomic_inc(&urb->reject); |
| 718 | /* | ||
| 719 | * Order the write of urb->reject above before the read | ||
| 720 | * of urb->use_count below. Pairs with the barriers in | ||
| 721 | * __usb_hcd_giveback_urb() and usb_hcd_submit_urb(). | ||
| 722 | */ | ||
| 723 | smp_mb__after_atomic(); | ||
| 718 | 724 | ||
| 719 | usb_hcd_unlink_urb(urb, -ENOENT); | 725 | usb_hcd_unlink_urb(urb, -ENOENT); |
| 720 | wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); | 726 | wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); |
| @@ -756,6 +762,12 @@ void usb_poison_urb(struct urb *urb) · 35 unmodified lines | |||
| 756 | if (!urb) | 762 | if (!urb) |
| 757 | return; | 763 | return; |
| 758 | atomic_inc(&urb->reject); | 764 | atomic_inc(&urb->reject); |
| 765 | /* | ||
| 766 | * Order the write of urb->reject above before the read | ||
| 767 | * of urb->use_count below. Pairs with the barriers in | ||
| 768 | * __usb_hcd_giveback_urb() and usb_hcd_submit_urb(). | ||
| 769 | */ | ||
| 770 | smp_mb__after_atomic(); | ||
| 759 | 771 | ||
| 760 | if (!urb->dev || !urb->ep) | 772 | if (!urb->dev || !urb->ep) |
| 761 | return; | 773 | return; |
| @@ -5097,7 +5097,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) · 5096 unmodified lines | |||
| 5097 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; | 5097 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; |
| 5098 | spin_unlock_irqrestore(&hsotg->lock, flags); | 5098 | spin_unlock_irqrestore(&hsotg->lock, flags); |
| 5099 | 5099 | ||
| 5100 | for (ep = 0; ep < hsotg->num_of_eps; ep++) { | 5100 | for (ep = 1; ep < hsotg->num_of_eps; ep++) { |
| 5101 | if (hsotg->eps_in[ep]) | 5101 | if (hsotg->eps_in[ep]) |
| 5102 | dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); | 5102 | dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); |
| 5103 | if (hsotg->eps_out[ep]) | 5103 | if (hsotg->eps_out[ep]) |
| @@ -102,14 +102,26 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) · 101 unmodified lines | |||
| 102 | int ret; | 102 | int ret; |
| 103 | u32 reg; | 103 | u32 reg; |
| 104 | 104 | ||
| 105 | usb3_phy = devm_phy_get(dev, "usb3-phy"); | 105 | usb3_phy = devm_phy_optional_get(dev, "usb3-phy"); |
| 106 | if (PTR_ERR(usb3_phy) == -EPROBE_DEFER) { | 106 | if (IS_ERR(usb3_phy)) { |
| 107 | ret = -EPROBE_DEFER; | 107 | ret = PTR_ERR(usb3_phy); |
| 108 | dev_err_probe(dev, ret, | ||
| 109 | "failed to get USB3 PHY\n"); | ||
| 108 | goto err; | 110 | goto err; |
| 109 | } else if (IS_ERR(usb3_phy)) { | ||
| 110 | usb3_phy = NULL; | ||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | /* | ||
| 114 | * The following core resets are not required unless a USB3 PHY | ||
| 115 | * is used, and the subsequent register settings are not required | ||
| 116 | * unless a core reset is performed (they should be set properly | ||
| 117 | * by the first-stage boot loader, but may be reverted by a core | ||
| 118 | * reset). They may also break the configuration if USB3 is actually | ||
| 119 | * in use but the usb3-phy entry is missing from the device tree. | ||
| 120 | * Therefore, skip these operations in this case. | ||
| 121 | */ | ||
| 122 | if (!usb3_phy) | ||
| 123 | goto skip_usb3_phy; | ||
| 124 | |||
| 113 | crst = devm_reset_control_get_exclusive(dev, "usb_crst"); | 125 | crst = devm_reset_control_get_exclusive(dev, "usb_crst"); |
| 114 | if (IS_ERR(crst)) { | 126 | if (IS_ERR(crst)) { |
| 115 | ret = PTR_ERR(crst); | 127 | ret = PTR_ERR(crst); |
| @@ -188,6 +200,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) · 72 unmodified lines | |||
| 188 | goto err; | 200 | goto err; |
| 189 | } | 201 | } |
| 190 | 202 | ||
| 203 | skip_usb3_phy: | ||
| 191 | /* | 204 | /* |
| 192 | * This routes the USB DMA traffic to go through FPD path instead | 205 | * This routes the USB DMA traffic to go through FPD path instead |
| 193 | * of reaching DDR directly. This traffic routing is needed to | 206 | * of reaching DDR directly. This traffic routing is needed to |
| @@ -584,6 +584,7 @@ static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in, · 583 unmodified lines | |||
| 584 | 584 | ||
| 585 | if (is_iso) { | 585 | if (is_iso) { |
| 586 | switch (speed) { | 586 | switch (speed) { |
| 587 | case USB_SPEED_SUPER_PLUS: | ||
| 587 | case USB_SPEED_SUPER: | 588 | case USB_SPEED_SUPER: |
| 588 | size = ss->isoc_maxpacket * | 589 | size = ss->isoc_maxpacket * |
| 589 | (ss->isoc_mult + 1) * | 590 | (ss->isoc_mult + 1) * |
| @@ -1895,7 +1895,7 @@ static int at91udc_probe(struct platform_device *pdev) · 1894 unmodified lines | |||
| 1895 | at91_vbus_irq, 0, driver_name, udc); | 1895 | at91_vbus_irq, 0, driver_name, udc); |
| 1896 | if (retval) { | 1896 | if (retval) { |
| 1897 | DBG("request vbus irq %d failed\n", | 1897 | DBG("request vbus irq %d failed\n", |
| 1898 | udc->board.vbus_pin); | 1898 | desc_to_gpio(udc->board.vbus_pin)); |
| 1899 | goto err_unprepare_iclk; | 1899 | goto err_unprepare_iclk; |
| 1900 | } | 1900 | } |
| 1901 | } | 1901 | } |
| @@ -437,6 +437,9 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) · 436 unmodified lines | |||
| 437 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 437 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 438 | int ret; | 438 | int ret; |
| 439 | 439 | ||
| 440 | if (pm_runtime_suspended(dev)) | ||
| 441 | pm_runtime_resume(dev); | ||
| 442 | |||
| 440 | ret = xhci_priv_suspend_quirk(hcd); | 443 | ret = xhci_priv_suspend_quirk(hcd); |
| 441 | if (ret) | 444 | if (ret) |
| 442 | return ret; | 445 | return ret; |
| @@ -2301,6 +2301,16 @@ UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999, · 2300 unmodified lines | |||
| 2301 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | 2301 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, |
| 2302 | US_FL_SCM_MULT_TARG ), | 2302 | US_FL_SCM_MULT_TARG ), |
| 2303 | 2303 | ||
| 2304 | /* | ||
| 2305 | * Reported by DocMAX <mail@vacharakis.de> | ||
| 2306 | * and Thomas Weißschuh <linux@weissschuh.net> | ||
| 2307 | */ | ||
| 2308 | UNUSUAL_DEV( 0x2109, 0x0715, 0x9999, 0x9999, | ||
| 2309 | "VIA Labs, Inc.", | ||
| 2310 | "VL817 SATA Bridge", | ||
| 2311 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 2312 | US_FL_IGNORE_UAS), | ||
| 2313 | |||
| 2304 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, | 2314 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
| 2305 | "ST", | 2315 | "ST", |
| 2306 | "2A", | 2316 | "2A", |
| @@ -56,7 +56,12 @@ int typec_link_ports(struct typec_port *con) · 55 unmodified lines | |||
| 56 | { | 56 | { |
| 57 | struct each_port_arg arg = { .port = con, .match = NULL }; | 57 | struct each_port_arg arg = { .port = con, .match = NULL }; |
| 58 | 58 | ||
| 59 | if (!has_acpi_companion(&con->dev)) | ||
| 60 | return 0; | ||
| 61 | |||
| 59 | bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match); | 62 | bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match); |
| 63 | if (!arg.match) | ||
| 64 | return 0; | ||
| 60 | 65 | ||
| 61 | /* | 66 | /* |
| 62 | * REVISIT: Now each connector can have only a single component master. | 67 | * REVISIT: Now each connector can have only a single component master. |
| @@ -74,5 +79,6 @@ int typec_link_ports(struct typec_port *con) · 11 unmodified lines | |||
| 74 | 79 | ||
| 75 | void typec_unlink_ports(struct typec_port *con) | 80 | void typec_unlink_ports(struct typec_port *con) |
| 76 | { | 81 | { |
| 77 | component_master_del(&con->dev, &typec_aggregate_ops); | 82 | if (has_acpi_companion(&con->dev)) |
| 83 | component_master_del(&con->dev, &typec_aggregate_ops); | ||
| 78 | } | 84 | } |
| @@ -75,9 +75,25 @@ static int tcpci_write16(struct tcpci *tcpci, unsigned int reg, u16 val) · 74 unmodified lines | |||
| 75 | static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) | 75 | static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) |
| 76 | { | 76 | { |
| 77 | struct tcpci *tcpci = tcpc_to_tcpci(tcpc); | 77 | struct tcpci *tcpci = tcpc_to_tcpci(tcpc); |
| 78 | bool vconn_pres; | ||
| 79 | enum typec_cc_polarity polarity = TYPEC_POLARITY_CC1; | ||
| 78 | unsigned int reg; | 80 | unsigned int reg; |
| 79 | int ret; | 81 | int ret; |
| 80 | 82 | ||
| 83 | ret = regmap_read(tcpci->regmap, TCPC_POWER_STATUS, ®); | ||
| 84 | if (ret < 0) | ||
| 85 | return ret; | ||
| 86 | |||
| 87 | vconn_pres = !!(reg & TCPC_POWER_STATUS_VCONN_PRES); | ||
| 88 | if (vconn_pres) { | ||
| 89 | ret = regmap_read(tcpci->regmap, TCPC_TCPC_CTRL, ®); | ||
| 90 | if (ret < 0) | ||
| 91 | return ret; | ||
| 92 | |||
| 93 | if (reg & TCPC_TCPC_CTRL_ORIENTATION) | ||
| 94 | polarity = TYPEC_POLARITY_CC2; | ||
| 95 | } | ||
| 96 | |||
| 81 | switch (cc) { | 97 | switch (cc) { |
| 82 | case TYPEC_CC_RA: | 98 | case TYPEC_CC_RA: |
| 83 | reg = (TCPC_ROLE_CTRL_CC_RA << TCPC_ROLE_CTRL_CC1_SHIFT) | | 99 | reg = (TCPC_ROLE_CTRL_CC_RA << TCPC_ROLE_CTRL_CC1_SHIFT) | |
| @@ -112,6 +128,16 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) · 28 unmodified lines | |||
| 112 | break; | 128 | break; |
| 113 | } | 129 | } |
| 114 | 130 | ||
| 131 | if (vconn_pres) { | ||
| 132 | if (polarity == TYPEC_POLARITY_CC2) { | ||
| 133 | reg &= ~(TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT); | ||
| 134 | reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC1_SHIFT); | ||
| 135 | } else { | ||
| 136 | reg &= ~(TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT); | ||
| 137 | reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC2_SHIFT); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | |||
| 115 | ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); | 141 | ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); |
| 116 | if (ret < 0) | 142 | if (ret < 0) |
| 117 | return ret; | 143 | return ret; |
| @@ -98,6 +98,7 @@ · 97 unmodified lines | |||
| 98 | #define TCPC_POWER_STATUS_SOURCING_VBUS BIT(4) | 98 | #define TCPC_POWER_STATUS_SOURCING_VBUS BIT(4) |
| 99 | #define TCPC_POWER_STATUS_VBUS_DET BIT(3) | 99 | #define TCPC_POWER_STATUS_VBUS_DET BIT(3) |
| 100 | #define TCPC_POWER_STATUS_VBUS_PRES BIT(2) | 100 | #define TCPC_POWER_STATUS_VBUS_PRES BIT(2) |
| 101 | #define TCPC_POWER_STATUS_VCONN_PRES BIT(1) | ||
| 101 | #define TCPC_POWER_STATUS_SINKING_VBUS BIT(0) | 102 | #define TCPC_POWER_STATUS_SINKING_VBUS BIT(0) |
| 102 | 103 | ||
| 103 | #define TCPC_FAULT_STATUS 0x1f | 104 | #define TCPC_FAULT_STATUS 0x1f |
| @@ -5156,7 +5156,8 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) · 5155 unmodified lines | |||
| 5156 | case SNK_TRYWAIT_DEBOUNCE: | 5156 | case SNK_TRYWAIT_DEBOUNCE: |
| 5157 | break; | 5157 | break; |
| 5158 | case SNK_ATTACH_WAIT: | 5158 | case SNK_ATTACH_WAIT: |
| 5159 | tcpm_set_state(port, SNK_UNATTACHED, 0); | 5159 | case SNK_DEBOUNCED: |
| 5160 | /* Do nothing, as TCPM is still waiting for vbus to reaach VSAFE5V to connect */ | ||
| 5160 | break; | 5161 | break; |
| 5161 | 5162 | ||
| 5162 | case SNK_NEGOTIATE_CAPABILITIES: | 5163 | case SNK_NEGOTIATE_CAPABILITIES: |
| @@ -5263,6 +5264,10 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) · 100 unmodified lines | |||
| 5263 | case PR_SWAP_SNK_SRC_SOURCE_ON: | 5264 | case PR_SWAP_SNK_SRC_SOURCE_ON: |
| 5264 | /* Do nothing, vsafe0v is expected during transition */ | 5265 | /* Do nothing, vsafe0v is expected during transition */ |
| 5265 | break; | 5266 | break; |
| 5267 | case SNK_ATTACH_WAIT: | ||
| 5268 | case SNK_DEBOUNCED: | ||
| 5269 | /*Do nothing, still waiting for VSAFE5V for connect */ | ||
| 5270 | break; | ||
| 5266 | default: | 5271 | default: |
| 5267 | if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) | 5272 | if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) |
| 5268 | tcpm_set_state(port, SNK_UNATTACHED, 0); | 5273 | tcpm_set_state(port, SNK_UNATTACHED, 0); |
| @@ -325,7 +325,7 @@ static int ucsi_ccg_init(struct ucsi_ccg *uc) · 324 unmodified lines | |||
| 325 | if (status < 0) | 325 | if (status < 0) |
| 326 | return status; | 326 | return status; |
| 327 | 327 | ||
| 328 | if (!data) | 328 | if (!(data & DEV_INT)) |
| 329 | return 0; | 329 | return 0; |
| 330 | 330 | ||
| 331 | status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); | 331 | status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); |
| @@ -287,8 +287,6 @@ struct hvfb_par { · 286 unmodified lines | |||
| 287 | 287 | ||
| 288 | static uint screen_width = HVFB_WIDTH; | 288 | static uint screen_width = HVFB_WIDTH; |
| 289 | static uint screen_height = HVFB_HEIGHT; | 289 | static uint screen_height = HVFB_HEIGHT; |
| 290 | static uint screen_width_max = HVFB_WIDTH; | ||
| 291 | static uint screen_height_max = HVFB_HEIGHT; | ||
| 292 | static uint screen_depth; | 290 | static uint screen_depth; |
| 293 | static uint screen_fb_size; | 291 | static uint screen_fb_size; |
| 294 | static uint dio_fb_size; /* FB size for deferred IO */ | 292 | static uint dio_fb_size; /* FB size for deferred IO */ |
| @@ -582,7 +580,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) · 287 unmodified lines | |||
| 582 | int ret = 0; | 580 | int ret = 0; |
| 583 | unsigned long t; | 581 | unsigned long t; |
| 584 | u8 index; | 582 | u8 index; |
| 585 | int i; | ||
| 586 | 583 | ||
| 587 | memset(msg, 0, sizeof(struct synthvid_msg)); | 584 | memset(msg, 0, sizeof(struct synthvid_msg)); |
| 588 | msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST; | 585 | msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST; |
| @@ -613,13 +610,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) · 24 unmodified lines | |||
| 613 | goto out; | 610 | goto out; |
| 614 | } | 611 | } |
| 615 | 612 | ||
| 616 | for (i = 0; i < msg->resolution_resp.resolution_count; i++) { | ||
| 617 | screen_width_max = max_t(unsigned int, screen_width_max, | ||
| 618 | msg->resolution_resp.supported_resolution[i].width); | ||
| 619 | screen_height_max = max_t(unsigned int, screen_height_max, | ||
| 620 | msg->resolution_resp.supported_resolution[i].height); | ||
| 621 | } | ||
| 622 | |||
| 623 | screen_width = | 613 | screen_width = |
| 624 | msg->resolution_resp.supported_resolution[index].width; | 614 | msg->resolution_resp.supported_resolution[index].width; |
| 625 | screen_height = | 615 | screen_height = |
| @@ -941,7 +931,7 @@ static void hvfb_get_option(struct fb_info *info) · 315 unmodified lines | |||
| 941 | 931 | ||
| 942 | if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN || | 932 | if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN || |
| 943 | (synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) && | 933 | (synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) && |
| 944 | (x > screen_width_max || y > screen_height_max)) || | 934 | (x * y * screen_depth / 8 > screen_fb_size)) || |
| 945 | (par->synthvid_version == SYNTHVID_VERSION_WIN8 && | 935 | (par->synthvid_version == SYNTHVID_VERSION_WIN8 && |
| 946 | x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) || | 936 | x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) || |
| 947 | (par->synthvid_version == SYNTHVID_VERSION_WIN7 && | 937 | (par->synthvid_version == SYNTHVID_VERSION_WIN7 && |
| @@ -1194,8 +1184,8 @@ static int hvfb_probe(struct hv_device *hdev, · 246 unmodified lines | |||
| 1194 | } | 1184 | } |
| 1195 | 1185 | ||
| 1196 | hvfb_get_option(info); | 1186 | hvfb_get_option(info); |
| 1197 | pr_info("Screen resolution: %dx%d, Color depth: %d\n", | 1187 | pr_info("Screen resolution: %dx%d, Color depth: %d, Frame buffer size: %d\n", |
| 1198 | screen_width, screen_height, screen_depth); | 1188 | screen_width, screen_height, screen_depth, screen_fb_size); |
| 1199 | 1189 | ||
| 1200 | ret = hvfb_getmem(hdev, info); | 1190 | ret = hvfb_getmem(hdev, info); |
| 1201 | if (ret) { | 1191 | if (ret) { |
| @@ -96,7 +96,7 @@ obj-$(CONFIG_EXPORTFS) += exportfs/ · 95 unmodified lines | |||
| 96 | obj-$(CONFIG_NFSD) += nfsd/ | 96 | obj-$(CONFIG_NFSD) += nfsd/ |
| 97 | obj-$(CONFIG_LOCKD) += lockd/ | 97 | obj-$(CONFIG_LOCKD) += lockd/ |
| 98 | obj-$(CONFIG_NLS) += nls/ | 98 | obj-$(CONFIG_NLS) += nls/ |
| 99 | obj-$(CONFIG_UNICODE) += unicode/ | 99 | obj-y += unicode/ |
| 100 | obj-$(CONFIG_SYSV_FS) += sysv/ | 100 | obj-$(CONFIG_SYSV_FS) += sysv/ |
| 101 | obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/ | 101 | obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/ |
| 102 | obj-$(CONFIG_CIFS) += cifs/ | 102 | obj-$(CONFIG_CIFS) += cifs/ |
| @@ -817,20 +817,20 @@ static struct file_system_type bm_fs_type = { · 816 unmodified lines | |||
| 817 | }; | 817 | }; |
| 818 | MODULE_ALIAS_FS("binfmt_misc"); | 818 | MODULE_ALIAS_FS("binfmt_misc"); |
| 819 | 819 | ||
| 820 | static struct ctl_table_header *binfmt_misc_header; | ||
| 821 | |||
| 820 | static int __init init_misc_binfmt(void) | 822 | static int __init init_misc_binfmt(void) |
| 821 | { | 823 | { |
| 822 | int err = register_filesystem(&bm_fs_type); | 824 | int err = register_filesystem(&bm_fs_type); |
| 823 | if (!err) | 825 | if (!err) |
| 824 | insert_binfmt(&misc_format); | 826 | insert_binfmt(&misc_format); |
| 825 | if (!register_sysctl_mount_point("fs/binfmt_misc")) { | 827 | binfmt_misc_header = register_sysctl_mount_point("fs/binfmt_misc"); |
| 826 | pr_warn("Failed to create fs/binfmt_misc sysctl mount point"); | ||
| 827 | return -ENOMEM; | ||
| 828 | } | ||
| 829 | return 0; | 828 | return 0; |
| 830 | } | 829 | } |
| 831 | 830 | ||
| 832 | static void __exit exit_misc_binfmt(void) | 831 | static void __exit exit_misc_binfmt(void) |
| 833 | { | 832 | { |
| 833 | unregister_sysctl_table(binfmt_misc_header); | ||
| 834 | unregister_binfmt(&misc_format); | 834 | unregister_binfmt(&misc_format); |
| 835 | unregister_filesystem(&bm_fs_type); | 835 | unregister_filesystem(&bm_fs_type); |
| 836 | } | 836 | } |
| @@ -3152,10 +3152,8 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, · 3151 unmodified lines | |||
| 3152 | btrfs_inode_lock(inode, 0); | 3152 | btrfs_inode_lock(inode, 0); |
| 3153 | err = btrfs_delete_subvolume(dir, dentry); | 3153 | err = btrfs_delete_subvolume(dir, dentry); |
| 3154 | btrfs_inode_unlock(inode, 0); | 3154 | btrfs_inode_unlock(inode, 0); |
| 3155 | if (!err) { | 3155 | if (!err) |
| 3156 | fsnotify_rmdir(dir, dentry); | 3156 | d_delete_notify(dir, dentry); |
| 3157 | d_delete(dentry); | ||
| 3158 | } | ||
| 3159 | 3157 | ||
| 3160 | out_dput: | 3158 | out_dput: |
| 3161 | dput(dentry); | 3159 | dput(dentry); |
| @@ -2218,6 +2218,7 @@ static int unsafe_request_wait(struct inode *inode) · 2217 unmodified lines | |||
| 2218 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; | 2218 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; |
| 2219 | struct ceph_inode_info *ci = ceph_inode(inode); | 2219 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 2220 | struct ceph_mds_request *req1 = NULL, *req2 = NULL; | 2220 | struct ceph_mds_request *req1 = NULL, *req2 = NULL; |
| 2221 | unsigned int max_sessions; | ||
| 2221 | int ret, err = 0; | 2222 | int ret, err = 0; |
| 2222 | 2223 | ||
| 2223 | spin_lock(&ci->i_unsafe_lock); | 2224 | spin_lock(&ci->i_unsafe_lock); |
| @@ -2235,37 +2236,45 @@ static int unsafe_request_wait(struct inode *inode) · 11 unmodified lines | |||
| 2235 | } | 2236 | } |
| 2236 | spin_unlock(&ci->i_unsafe_lock); | 2237 | spin_unlock(&ci->i_unsafe_lock); |
| 2237 | 2238 | ||
| 2239 | /* | ||
| 2240 | * The mdsc->max_sessions is unlikely to be changed | ||
| 2241 | * mostly, here we will retry it by reallocating the | ||
| 2242 | * sessions array memory to get rid of the mdsc->mutex | ||
| 2243 | * lock. | ||
| 2244 | */ | ||
| 2245 | retry: | ||
| 2246 | max_sessions = mdsc->max_sessions; | ||
| 2247 | |||
| 2238 | /* | 2248 | /* |
| 2239 | * Trigger to flush the journal logs in all the relevant MDSes | 2249 | * Trigger to flush the journal logs in all the relevant MDSes |
| 2240 | * manually, or in the worst case we must wait at most 5 seconds | 2250 | * manually, or in the worst case we must wait at most 5 seconds |
| 2241 | * to wait the journal logs to be flushed by the MDSes periodically. | 2251 | * to wait the journal logs to be flushed by the MDSes periodically. |
| 2242 | */ | 2252 | */ |
| 2243 | if (req1 || req2) { | 2253 | if ((req1 || req2) && likely(max_sessions)) { |
| 2244 | struct ceph_mds_session **sessions = NULL; | 2254 | struct ceph_mds_session **sessions = NULL; |
| 2245 | struct ceph_mds_session *s; | 2255 | struct ceph_mds_session *s; |
| 2246 | struct ceph_mds_request *req; | 2256 | struct ceph_mds_request *req; |
| 2247 | unsigned int max; | ||
| 2248 | int i; | 2257 | int i; |
| 2249 | 2258 | ||
| 2250 | /* | 2259 | sessions = kzalloc(max_sessions * sizeof(s), GFP_KERNEL); |
| 2251 | * The mdsc->max_sessions is unlikely to be changed | 2260 | if (!sessions) { |
| 2252 | * mostly, here we will retry it by reallocating the | 2261 | err = -ENOMEM; |
| 2253 | * sessions arrary memory to get rid of the mdsc->mutex | 2262 | goto out; |
| 2254 | * lock. | 2263 | } |
| 2255 | */ | ||
| 2256 | retry: | ||
| 2257 | max = mdsc->max_sessions; | ||
| 2258 | sessions = krealloc(sessions, max * sizeof(s), __GFP_ZERO); | ||
| 2259 | if (!sessions) | ||
| 2260 | return -ENOMEM; | ||
| 2261 | 2264 | ||
| 2262 | spin_lock(&ci->i_unsafe_lock); | 2265 | spin_lock(&ci->i_unsafe_lock); |
| 2263 | if (req1) { | 2266 | if (req1) { |
| 2264 | list_for_each_entry(req, &ci->i_unsafe_dirops, | 2267 | list_for_each_entry(req, &ci->i_unsafe_dirops, |
| 2265 | r_unsafe_dir_item) { | 2268 | r_unsafe_dir_item) { |
| 2266 | s = req->r_session; | 2269 | s = req->r_session; |
| 2267 | if (unlikely(s->s_mds >= max)) { | 2270 | if (unlikely(s->s_mds >= max_sessions)) { |
| 2268 | spin_unlock(&ci->i_unsafe_lock); | 2271 | spin_unlock(&ci->i_unsafe_lock); |
| 2272 | for (i = 0; i < max_sessions; i++) { | ||
| 2273 | s = sessions[i]; | ||
| 2274 | if (s) | ||
| 2275 | ceph_put_mds_session(s); | ||
| 2276 | } | ||
| 2277 | kfree(sessions); | ||
| 2269 | goto retry; | 2278 | goto retry; |
| 2270 | } | 2279 | } |
| 2271 | if (!sessions[s->s_mds]) { | 2280 | if (!sessions[s->s_mds]) { |
| @@ -2278,8 +2287,14 @@ retry: · 6 unmodified lines | |||
| 2278 | list_for_each_entry(req, &ci->i_unsafe_iops, | 2287 | list_for_each_entry(req, &ci->i_unsafe_iops, |
| 2279 | r_unsafe_target_item) { | 2288 | r_unsafe_target_item) { |
| 2280 | s = req->r_session; | 2289 | s = req->r_session; |
| 2281 | if (unlikely(s->s_mds >= max)) { | 2290 | if (unlikely(s->s_mds >= max_sessions)) { |
| 2282 | spin_unlock(&ci->i_unsafe_lock); | 2291 | spin_unlock(&ci->i_unsafe_lock); |
| 2292 | for (i = 0; i < max_sessions; i++) { | ||
| 2293 | s = sessions[i]; | ||
| 2294 | if (s) | ||
| 2295 | ceph_put_mds_session(s); | ||
| 2296 | } | ||
| 2297 | kfree(sessions); | ||
| 2283 | goto retry; | 2298 | goto retry; |
| 2284 | } | 2299 | } |
| 2285 | if (!sessions[s->s_mds]) { | 2300 | if (!sessions[s->s_mds]) { |
| @@ -2300,7 +2315,7 @@ retry: · 14 unmodified lines | |||
| 2300 | spin_unlock(&ci->i_ceph_lock); | 2315 | spin_unlock(&ci->i_ceph_lock); |
| 2301 | 2316 | ||
| 2302 | /* send flush mdlog request to MDSes */ | 2317 | /* send flush mdlog request to MDSes */ |
| 2303 | for (i = 0; i < max; i++) { | 2318 | for (i = 0; i < max_sessions; i++) { |
| 2304 | s = sessions[i]; | 2319 | s = sessions[i]; |
| 2305 | if (s) { | 2320 | if (s) { |
| 2306 | send_flush_mdlog(s); | 2321 | send_flush_mdlog(s); |
| @@ -2317,15 +2332,19 @@ retry: · 10 unmodified lines | |||
| 2317 | ceph_timeout_jiffies(req1->r_timeout)); | 2332 | ceph_timeout_jiffies(req1->r_timeout)); |
| 2318 | if (ret) | 2333 | if (ret) |
| 2319 | err = -EIO; | 2334 | err = -EIO; |
| 2320 | ceph_mdsc_put_request(req1); | ||
| 2321 | } | 2335 | } |
| 2322 | if (req2) { | 2336 | if (req2) { |
| 2323 | ret = !wait_for_completion_timeout(&req2->r_safe_completion, | 2337 | ret = !wait_for_completion_timeout(&req2->r_safe_completion, |
| 2324 | ceph_timeout_jiffies(req2->r_timeout)); | 2338 | ceph_timeout_jiffies(req2->r_timeout)); |
| 2325 | if (ret) | 2339 | if (ret) |
| 2326 | err = -EIO; | 2340 | err = -EIO; |
| 2327 | ceph_mdsc_put_request(req2); | ||
| 2328 | } | 2341 | } |
| 2342 | |||
| 2343 | out: | ||
| 2344 | if (req1) | ||
| 2345 | ceph_mdsc_put_request(req1); | ||
| 2346 | if (req2) | ||
| 2347 | ceph_mdsc_put_request(req2); | ||
| 2329 | return err; | 2348 | return err; |
| 2330 | } | 2349 | } |
| 2331 | 2350 | ||
| @@ -583,6 +583,7 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, · 582 unmodified lines | |||
| 583 | struct ceph_inode_info *ci = ceph_inode(dir); | 583 | struct ceph_inode_info *ci = ceph_inode(dir); |
| 584 | struct inode *inode; | 584 | struct inode *inode; |
| 585 | struct timespec64 now; | 585 | struct timespec64 now; |
| 586 | struct ceph_string *pool_ns; | ||
| 586 | struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); | 587 | struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); |
| 587 | struct ceph_vino vino = { .ino = req->r_deleg_ino, | 588 | struct ceph_vino vino = { .ino = req->r_deleg_ino, |
| 588 | .snap = CEPH_NOSNAP }; | 589 | .snap = CEPH_NOSNAP }; |
| @@ -632,6 +633,12 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, · 43 unmodified lines | |||
| 632 | in.max_size = cpu_to_le64(lo->stripe_unit); | 633 | in.max_size = cpu_to_le64(lo->stripe_unit); |
| 633 | 634 | ||
| 634 | ceph_file_layout_to_legacy(lo, &in.layout); | 635 | ceph_file_layout_to_legacy(lo, &in.layout); |
| 636 | /* lo is private, so pool_ns can't change */ | ||
| 637 | pool_ns = rcu_dereference_raw(lo->pool_ns); | ||
| 638 | if (pool_ns) { | ||
| 639 | iinfo.pool_ns_len = pool_ns->len; | ||
| 640 | iinfo.pool_ns_data = pool_ns->str; | ||
| 641 | } | ||
| 635 | 642 | ||
| 636 | down_read(&mdsc->snap_rwsem); | 643 | down_read(&mdsc->snap_rwsem); |
| 637 | ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session, | 644 | ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session, |
| @@ -750,8 +757,10 @@ retry: · 112 unmodified lines | |||
| 750 | restore_deleg_ino(dir, req->r_deleg_ino); | 757 | restore_deleg_ino(dir, req->r_deleg_ino); |
| 751 | ceph_mdsc_put_request(req); | 758 | ceph_mdsc_put_request(req); |
| 752 | try_async = false; | 759 | try_async = false; |
| 760 | ceph_put_string(rcu_dereference_raw(lo.pool_ns)); | ||
| 753 | goto retry; | 761 | goto retry; |
| 754 | } | 762 | } |
| 763 | ceph_put_string(rcu_dereference_raw(lo.pool_ns)); | ||
| 755 | goto out_req; | 764 | goto out_req; |
| 756 | } | 765 | } |
| 757 | } | 766 | } |
| @@ -1780,8 +1780,8 @@ void configfs_unregister_group(struct config_group *group) · 1779 unmodified lines | |||
| 1780 | configfs_detach_group(&group->cg_item); | 1780 | configfs_detach_group(&group->cg_item); |
| 1781 | d_inode(dentry)->i_flags |= S_DEAD; | 1781 | d_inode(dentry)->i_flags |= S_DEAD; |
| 1782 | dont_mount(dentry); | 1782 | dont_mount(dentry); |
| 1783 | d_drop(dentry); | ||
| 1783 | fsnotify_rmdir(d_inode(parent), dentry); | 1784 | fsnotify_rmdir(d_inode(parent), dentry); |
| 1784 | d_delete(dentry); | ||
| 1785 | inode_unlock(d_inode(parent)); | 1785 | inode_unlock(d_inode(parent)); |
| 1786 | 1786 | ||
| 1787 | dput(dentry); | 1787 | dput(dentry); |
| @@ -1922,10 +1922,10 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) · 134 unmodified lines | |||
| 1922 | configfs_detach_group(&group->cg_item); | 1922 | configfs_detach_group(&group->cg_item); |
| 1923 | d_inode(dentry)->i_flags |= S_DEAD; | 1923 | d_inode(dentry)->i_flags |= S_DEAD; |
| 1924 | dont_mount(dentry); | 1924 | dont_mount(dentry); |
| 1925 | fsnotify_rmdir(d_inode(root), dentry); | ||
| 1926 | inode_unlock(d_inode(dentry)); | 1925 | inode_unlock(d_inode(dentry)); |
| 1927 | 1926 | ||
| 1928 | d_delete(dentry); | 1927 | d_drop(dentry); |
| 1928 | fsnotify_rmdir(d_inode(root), dentry); | ||
| 1929 | 1929 | ||
| 1930 | inode_unlock(d_inode(root)); | 1930 | inode_unlock(d_inode(root)); |
| 1931 | 1931 | ||
| @@ -621,8 +621,8 @@ void devpts_pty_kill(struct dentry *dentry) · 620 unmodified lines | |||
| 621 | 621 | ||
| 622 | dentry->d_fsdata = NULL; | 622 | dentry->d_fsdata = NULL; |
| 623 | drop_nlink(dentry->d_inode); | 623 | drop_nlink(dentry->d_inode); |
| 624 | fsnotify_unlink(d_inode(dentry->d_parent), dentry); | ||
| 625 | d_drop(dentry); | 624 | d_drop(dentry); |
| 625 | fsnotify_unlink(d_inode(dentry->d_parent), dentry); | ||
| 626 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ | 626 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ |
| 627 | } | 627 | } |
| 628 | 628 | ||
| @@ -2485,7 +2485,7 @@ struct ext4_filename { · 2484 unmodified lines | |||
| 2485 | #ifdef CONFIG_FS_ENCRYPTION | 2485 | #ifdef CONFIG_FS_ENCRYPTION |
| 2486 | struct fscrypt_str crypto_buf; | 2486 | struct fscrypt_str crypto_buf; |
| 2487 | #endif | 2487 | #endif |
| 2488 | #ifdef CONFIG_UNICODE | 2488 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2489 | struct fscrypt_str cf_name; | 2489 | struct fscrypt_str cf_name; |
| 2490 | #endif | 2490 | #endif |
| 2491 | }; | 2491 | }; |
| @@ -2721,7 +2721,7 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb, · 229 unmodified lines | |||
| 2721 | struct ext4_group_desc *gdp); | 2721 | struct ext4_group_desc *gdp); |
| 2722 | ext4_fsblk_t ext4_inode_to_goal_block(struct inode *); | 2722 | ext4_fsblk_t ext4_inode_to_goal_block(struct inode *); |
| 2723 | 2723 | ||
| 2724 | #ifdef CONFIG_UNICODE | 2724 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2725 | extern int ext4_fname_setup_ci_filename(struct inode *dir, | 2725 | extern int ext4_fname_setup_ci_filename(struct inode *dir, |
| 2726 | const struct qstr *iname, | 2726 | const struct qstr *iname, |
| 2727 | struct ext4_filename *fname); | 2727 | struct ext4_filename *fname); |
| @@ -2754,7 +2754,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir, · 26 unmodified lines | |||
| 2754 | 2754 | ||
| 2755 | ext4_fname_from_fscrypt_name(fname, &name); | 2755 | ext4_fname_from_fscrypt_name(fname, &name); |
| 2756 | 2756 | ||
| 2757 | #ifdef CONFIG_UNICODE | 2757 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2758 | err = ext4_fname_setup_ci_filename(dir, iname, fname); | 2758 | err = ext4_fname_setup_ci_filename(dir, iname, fname); |
| 2759 | #endif | 2759 | #endif |
| 2760 | return err; | 2760 | return err; |
| @@ -2773,7 +2773,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir, · 12 unmodified lines | |||
| 2773 | 2773 | ||
| 2774 | ext4_fname_from_fscrypt_name(fname, &name); | 2774 | ext4_fname_from_fscrypt_name(fname, &name); |
| 2775 | 2775 | ||
| 2776 | #ifdef CONFIG_UNICODE | 2776 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2777 | err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname); | 2777 | err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname); |
| 2778 | #endif | 2778 | #endif |
| 2779 | return err; | 2779 | return err; |
| @@ -2790,7 +2790,7 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname) · 10 unmodified lines | |||
| 2790 | fname->usr_fname = NULL; | 2790 | fname->usr_fname = NULL; |
| 2791 | fname->disk_name.name = NULL; | 2791 | fname->disk_name.name = NULL; |
| 2792 | 2792 | ||
| 2793 | #ifdef CONFIG_UNICODE | 2793 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2794 | kfree(fname->cf_name.name); | 2794 | kfree(fname->cf_name.name); |
| 2795 | fname->cf_name.name = NULL; | 2795 | fname->cf_name.name = NULL; |
| 2796 | #endif | 2796 | #endif |
| @@ -2806,7 +2806,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir, · 9 unmodified lines | |||
| 2806 | fname->disk_name.name = (unsigned char *) iname->name; | 2806 | fname->disk_name.name = (unsigned char *) iname->name; |
| 2807 | fname->disk_name.len = iname->len; | 2807 | fname->disk_name.len = iname->len; |
| 2808 | 2808 | ||
| 2809 | #ifdef CONFIG_UNICODE | 2809 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2810 | err = ext4_fname_setup_ci_filename(dir, iname, fname); | 2810 | err = ext4_fname_setup_ci_filename(dir, iname, fname); |
| 2811 | #endif | 2811 | #endif |
| 2812 | 2812 | ||
| @@ -2822,7 +2822,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir, · 9 unmodified lines | |||
| 2822 | 2822 | ||
| 2823 | static inline void ext4_fname_free_filename(struct ext4_filename *fname) | 2823 | static inline void ext4_fname_free_filename(struct ext4_filename *fname) |
| 2824 | { | 2824 | { |
| 2825 | #ifdef CONFIG_UNICODE | 2825 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2826 | kfree(fname->cf_name.name); | 2826 | kfree(fname->cf_name.name); |
| 2827 | fname->cf_name.name = NULL; | 2827 | fname->cf_name.name = NULL; |
| 2828 | #endif | 2828 | #endif |
| @@ -290,7 +290,7 @@ static int __ext4fs_dirhash(const struct inode *dir, const char *name, int len, · 289 unmodified lines | |||
| 290 | int ext4fs_dirhash(const struct inode *dir, const char *name, int len, | 290 | int ext4fs_dirhash(const struct inode *dir, const char *name, int len, |
| 291 | struct dx_hash_info *hinfo) | 291 | struct dx_hash_info *hinfo) |
| 292 | { | 292 | { |
| 293 | #ifdef CONFIG_UNICODE | 293 | #if IS_ENABLED(CONFIG_UNICODE) |
| 294 | const struct unicode_map *um = dir->i_sb->s_encoding; | 294 | const struct unicode_map *um = dir->i_sb->s_encoding; |
| 295 | int r, dlen; | 295 | int r, dlen; |
| 296 | unsigned char *buff; | 296 | unsigned char *buff; |
| @@ -1317,7 +1317,7 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block) · 1316 unmodified lines | |||
| 1317 | dx_set_count(entries, count + 1); | 1317 | dx_set_count(entries, count + 1); |
| 1318 | } | 1318 | } |
| 1319 | 1319 | ||
| 1320 | #ifdef CONFIG_UNICODE | 1320 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1321 | /* | 1321 | /* |
| 1322 | * Test whether a case-insensitive directory entry matches the filename | 1322 | * Test whether a case-insensitive directory entry matches the filename |
| 1323 | * being searched for. If quick is set, assume the name being looked up | 1323 | * being searched for. If quick is set, assume the name being looked up |
| @@ -1428,7 +1428,7 @@ static bool ext4_match(struct inode *parent, · 104 unmodified lines | |||
| 1428 | f.crypto_buf = fname->crypto_buf; | 1428 | f.crypto_buf = fname->crypto_buf; |
| 1429 | #endif | 1429 | #endif |
| 1430 | 1430 | ||
| 1431 | #ifdef CONFIG_UNICODE | 1431 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1432 | if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) && | 1432 | if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) && |
| 1433 | (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) { | 1433 | (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) { |
| 1434 | if (fname->cf_name.name) { | 1434 | if (fname->cf_name.name) { |
| @@ -1800,7 +1800,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi · 365 unmodified lines | |||
| 1800 | } | 1800 | } |
| 1801 | } | 1801 | } |
| 1802 | 1802 | ||
| 1803 | #ifdef CONFIG_UNICODE | 1803 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1804 | if (!inode && IS_CASEFOLDED(dir)) { | 1804 | if (!inode && IS_CASEFOLDED(dir)) { |
| 1805 | /* Eventually we want to call d_add_ci(dentry, NULL) | 1805 | /* Eventually we want to call d_add_ci(dentry, NULL) |
| 1806 | * for negative dentries in the encoding case as | 1806 | * for negative dentries in the encoding case as |
| @@ -2308,7 +2308,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, · 501 unmodified lines | |||
| 2308 | if (fscrypt_is_nokey_name(dentry)) | 2308 | if (fscrypt_is_nokey_name(dentry)) |
| 2309 | return -ENOKEY; | 2309 | return -ENOKEY; |
| 2310 | 2310 | ||
| 2311 | #ifdef CONFIG_UNICODE | 2311 | #if IS_ENABLED(CONFIG_UNICODE) |
| 2312 | if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) && | 2312 | if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) && |
| 2313 | sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name)) | 2313 | sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name)) |
| 2314 | return -EINVAL; | 2314 | return -EINVAL; |
| @@ -3126,7 +3126,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) · 811 unmodified lines | |||
| 3126 | ext4_fc_track_unlink(handle, dentry); | 3126 | ext4_fc_track_unlink(handle, dentry); |
| 3127 | retval = ext4_mark_inode_dirty(handle, dir); | 3127 | retval = ext4_mark_inode_dirty(handle, dir); |
| 3128 | 3128 | ||
| 3129 | #ifdef CONFIG_UNICODE | 3129 | #if IS_ENABLED(CONFIG_UNICODE) |
| 3130 | /* VFS negative dentries are incompatible with Encoding and | 3130 | /* VFS negative dentries are incompatible with Encoding and |
| 3131 | * Case-insensitiveness. Eventually we'll want avoid | 3131 | * Case-insensitiveness. Eventually we'll want avoid |
| 3132 | * invalidating the dentries here, alongside with returning the | 3132 | * invalidating the dentries here, alongside with returning the |
| @@ -3231,7 +3231,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) · 98 unmodified lines | |||
| 3231 | retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry)); | 3231 | retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry)); |
| 3232 | if (!retval) | 3232 | if (!retval) |
| 3233 | ext4_fc_track_unlink(handle, dentry); | 3233 | ext4_fc_track_unlink(handle, dentry); |
| 3234 | #ifdef CONFIG_UNICODE | 3234 | #if IS_ENABLED(CONFIG_UNICODE) |
| 3235 | /* VFS negative dentries are incompatible with Encoding and | 3235 | /* VFS negative dentries are incompatible with Encoding and |
| 3236 | * Case-insensitiveness. Eventually we'll want avoid | 3236 | * Case-insensitiveness. Eventually we'll want avoid |
| 3237 | * invalidating the dentries here, alongside with returning the | 3237 | * invalidating the dentries here, alongside with returning the |
| @@ -1301,7 +1301,7 @@ static void ext4_put_super(struct super_block *sb) · 1300 unmodified lines | |||
| 1301 | kfree(sbi->s_blockgroup_lock); | 1301 | kfree(sbi->s_blockgroup_lock); |
| 1302 | fs_put_dax(sbi->s_daxdev); | 1302 | fs_put_dax(sbi->s_daxdev); |
| 1303 | fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy); | 1303 | fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy); |
| 1304 | #ifdef CONFIG_UNICODE | 1304 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1305 | utf8_unload(sb->s_encoding); | 1305 | utf8_unload(sb->s_encoding); |
| 1306 | #endif | 1306 | #endif |
| 1307 | kfree(sbi); | 1307 | kfree(sbi); |
| @@ -1961,7 +1961,7 @@ static const struct mount_opts { · 653 unmodified lines | |||
| 1961 | {Opt_err, 0, 0} | 1961 | {Opt_err, 0, 0} |
| 1962 | }; | 1962 | }; |
| 1963 | 1963 | ||
| 1964 | #ifdef CONFIG_UNICODE | 1964 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1965 | static const struct ext4_sb_encodings { | 1965 | static const struct ext4_sb_encodings { |
| 1966 | __u16 magic; | 1966 | __u16 magic; |
| 1967 | char *name; | 1967 | char *name; |
| @@ -3606,7 +3606,7 @@ int ext4_feature_set_ok(struct super_block *sb, int readonly) · 1638 unmodified lines | |||
| 3606 | return 0; | 3606 | return 0; |
| 3607 | } | 3607 | } |
| 3608 | 3608 | ||
| 3609 | #ifndef CONFIG_UNICODE | 3609 | #if !IS_ENABLED(CONFIG_UNICODE) |
| 3610 | if (ext4_has_feature_casefold(sb)) { | 3610 | if (ext4_has_feature_casefold(sb)) { |
| 3611 | ext4_msg(sb, KERN_ERR, | 3611 | ext4_msg(sb, KERN_ERR, |
| 3612 | "Filesystem with casefold feature cannot be " | 3612 | "Filesystem with casefold feature cannot be " |
| @@ -4610,7 +4610,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) · 997 unmodified lines | |||
| 4610 | if (err < 0) | 4610 | if (err < 0) |
| 4611 | goto failed_mount; | 4611 | goto failed_mount; |
| 4612 | 4612 | ||
| 4613 | #ifdef CONFIG_UNICODE | 4613 | #if IS_ENABLED(CONFIG_UNICODE) |
| 4614 | if (ext4_has_feature_casefold(sb) && !sb->s_encoding) { | 4614 | if (ext4_has_feature_casefold(sb) && !sb->s_encoding) { |
| 4615 | const struct ext4_sb_encodings *encoding_info; | 4615 | const struct ext4_sb_encodings *encoding_info; |
| 4616 | struct unicode_map *encoding; | 4616 | struct unicode_map *encoding; |
| @@ -5514,7 +5514,7 @@ failed_mount: · 897 unmodified lines | |||
| 5514 | if (sbi->s_chksum_driver) | 5514 | if (sbi->s_chksum_driver) |
| 5515 | crypto_free_shash(sbi->s_chksum_driver); | 5515 | crypto_free_shash(sbi->s_chksum_driver); |
| 5516 | 5516 | ||
| 5517 | #ifdef CONFIG_UNICODE | 5517 | #if IS_ENABLED(CONFIG_UNICODE) |
| 5518 | utf8_unload(sb->s_encoding); | 5518 | utf8_unload(sb->s_encoding); |
| 5519 | #endif | 5519 | #endif |
| 5520 | 5520 | ||
| @@ -309,7 +309,7 @@ EXT4_ATTR_FEATURE(meta_bg_resize); · 308 unmodified lines | |||
| 309 | EXT4_ATTR_FEATURE(encryption); | 309 | EXT4_ATTR_FEATURE(encryption); |
| 310 | EXT4_ATTR_FEATURE(test_dummy_encryption_v2); | 310 | EXT4_ATTR_FEATURE(test_dummy_encryption_v2); |
| 311 | #endif | 311 | #endif |
| 312 | #ifdef CONFIG_UNICODE | 312 | #if IS_ENABLED(CONFIG_UNICODE) |
| 313 | EXT4_ATTR_FEATURE(casefold); | 313 | EXT4_ATTR_FEATURE(casefold); |
| 314 | #endif | 314 | #endif |
| 315 | #ifdef CONFIG_FS_VERITY | 315 | #ifdef CONFIG_FS_VERITY |
| @@ -317,7 +317,7 @@ EXT4_ATTR_FEATURE(verity); · 1 unmodified line | |||
| 317 | #endif | 317 | #endif |
| 318 | EXT4_ATTR_FEATURE(metadata_csum_seed); | 318 | EXT4_ATTR_FEATURE(metadata_csum_seed); |
| 319 | EXT4_ATTR_FEATURE(fast_commit); | 319 | EXT4_ATTR_FEATURE(fast_commit); |
| 320 | #if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION) | 320 | #if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION) |
| 321 | EXT4_ATTR_FEATURE(encrypted_casefold); | 321 | EXT4_ATTR_FEATURE(encrypted_casefold); |
| 322 | #endif | 322 | #endif |
| 323 | 323 | ||
| @@ -329,7 +329,7 @@ static struct attribute *ext4_feat_attrs[] = { · 5 unmodified lines | |||
| 329 | ATTR_LIST(encryption), | 329 | ATTR_LIST(encryption), |
| 330 | ATTR_LIST(test_dummy_encryption_v2), | 330 | ATTR_LIST(test_dummy_encryption_v2), |
| 331 | #endif | 331 | #endif |
| 332 | #ifdef CONFIG_UNICODE | 332 | #if IS_ENABLED(CONFIG_UNICODE) |
| 333 | ATTR_LIST(casefold), | 333 | ATTR_LIST(casefold), |
| 334 | #endif | 334 | #endif |
| 335 | #ifdef CONFIG_FS_VERITY | 335 | #ifdef CONFIG_FS_VERITY |
| @@ -337,7 +337,7 @@ static struct attribute *ext4_feat_attrs[] = { · 1 unmodified line | |||
| 337 | #endif | 337 | #endif |
| 338 | ATTR_LIST(metadata_csum_seed), | 338 | ATTR_LIST(metadata_csum_seed), |
| 339 | ATTR_LIST(fast_commit), | 339 | ATTR_LIST(fast_commit), |
| 340 | #if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION) | 340 | #if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION) |
| 341 | ATTR_LIST(encrypted_casefold), | 341 | ATTR_LIST(encrypted_casefold), |
| 342 | #endif | 342 | #endif |
| 343 | NULL, | 343 | NULL, |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | |||
| 16 | #include "xattr.h" | 16 | #include "xattr.h" |
| 17 | #include <trace/events/f2fs.h> | 17 | #include <trace/events/f2fs.h> |
| 18 | 18 | ||
| 19 | #ifdef CONFIG_UNICODE | 19 | #if IS_ENABLED(CONFIG_UNICODE) |
| 20 | extern struct kmem_cache *f2fs_cf_name_slab; | 20 | extern struct kmem_cache *f2fs_cf_name_slab; |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| @@ -79,7 +79,7 @@ unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de) · 56 unmodified lines | |||
| 79 | int f2fs_init_casefolded_name(const struct inode *dir, | 79 | int f2fs_init_casefolded_name(const struct inode *dir, |
| 80 | struct f2fs_filename *fname) | 80 | struct f2fs_filename *fname) |
| 81 | { | 81 | { |
| 82 | #ifdef CONFIG_UNICODE | 82 | #if IS_ENABLED(CONFIG_UNICODE) |
| 83 | struct super_block *sb = dir->i_sb; | 83 | struct super_block *sb = dir->i_sb; |
| 84 | 84 | ||
| 85 | if (IS_CASEFOLDED(dir)) { | 85 | if (IS_CASEFOLDED(dir)) { |
| @@ -174,7 +174,7 @@ void f2fs_free_filename(struct f2fs_filename *fname) · 88 unmodified lines | |||
| 174 | kfree(fname->crypto_buf.name); | 174 | kfree(fname->crypto_buf.name); |
| 175 | fname->crypto_buf.name = NULL; | 175 | fname->crypto_buf.name = NULL; |
| 176 | #endif | 176 | #endif |
| 177 | #ifdef CONFIG_UNICODE | 177 | #if IS_ENABLED(CONFIG_UNICODE) |
| 178 | if (fname->cf_name.name) { | 178 | if (fname->cf_name.name) { |
| 179 | kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name); | 179 | kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name); |
| 180 | fname->cf_name.name = NULL; | 180 | fname->cf_name.name = NULL; |
| @@ -208,7 +208,7 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir, · 27 unmodified lines | |||
| 208 | return f2fs_find_target_dentry(&d, fname, max_slots); | 208 | return f2fs_find_target_dentry(&d, fname, max_slots); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | #ifdef CONFIG_UNICODE | 211 | #if IS_ENABLED(CONFIG_UNICODE) |
| 212 | /* | 212 | /* |
| 213 | * Test whether a case-insensitive directory entry matches the filename | 213 | * Test whether a case-insensitive directory entry matches the filename |
| 214 | * being searched for. | 214 | * being searched for. |
| @@ -266,7 +266,7 @@ static inline int f2fs_match_name(const struct inode *dir, · 51 unmodified lines | |||
| 266 | { | 266 | { |
| 267 | struct fscrypt_name f; | 267 | struct fscrypt_name f; |
| 268 | 268 | ||
| 269 | #ifdef CONFIG_UNICODE | 269 | #if IS_ENABLED(CONFIG_UNICODE) |
| 270 | if (fname->cf_name.name) { | 270 | if (fname->cf_name.name) { |
| 271 | struct qstr cf = FSTR_TO_QSTR(&fname->cf_name); | 271 | struct qstr cf = FSTR_TO_QSTR(&fname->cf_name); |
| 272 | 272 | ||
| @@ -488,7 +488,7 @@ struct f2fs_filename { · 487 unmodified lines | |||
| 488 | */ | 488 | */ |
| 489 | struct fscrypt_str crypto_buf; | 489 | struct fscrypt_str crypto_buf; |
| 490 | #endif | 490 | #endif |
| 491 | #ifdef CONFIG_UNICODE | 491 | #if IS_ENABLED(CONFIG_UNICODE) |
| 492 | /* | 492 | /* |
| 493 | * For casefolded directories: the casefolded name, but it's left NULL | 493 | * For casefolded directories: the casefolded name, but it's left NULL |
| 494 | * if the original name is not valid Unicode, if the directory is both | 494 | * if the original name is not valid Unicode, if the directory is both |
| @@ -105,7 +105,7 @@ void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname) · 104 unmodified lines | |||
| 105 | return; | 105 | return; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | #ifdef CONFIG_UNICODE | 108 | #if IS_ENABLED(CONFIG_UNICODE) |
| 109 | if (IS_CASEFOLDED(dir)) { | 109 | if (IS_CASEFOLDED(dir)) { |
| 110 | /* | 110 | /* |
| 111 | * If the casefolded name is provided, hash it instead of the | 111 | * If the casefolded name is provided, hash it instead of the |
| @@ -561,7 +561,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, · 560 unmodified lines | |||
| 561 | goto out_iput; | 561 | goto out_iput; |
| 562 | } | 562 | } |
| 563 | out_splice: | 563 | out_splice: |
| 564 | #ifdef CONFIG_UNICODE | 564 | #if IS_ENABLED(CONFIG_UNICODE) |
| 565 | if (!inode && IS_CASEFOLDED(dir)) { | 565 | if (!inode && IS_CASEFOLDED(dir)) { |
| 566 | /* Eventually we want to call d_add_ci(dentry, NULL) | 566 | /* Eventually we want to call d_add_ci(dentry, NULL) |
| 567 | * for negative dentries in the encoding case as | 567 | * for negative dentries in the encoding case as |
| @@ -622,7 +622,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) · 54 unmodified lines | |||
| 622 | goto fail; | 622 | goto fail; |
| 623 | } | 623 | } |
| 624 | f2fs_delete_entry(de, page, dir, inode); | 624 | f2fs_delete_entry(de, page, dir, inode); |
| 625 | #ifdef CONFIG_UNICODE | 625 | #if IS_ENABLED(CONFIG_UNICODE) |
| 626 | /* VFS negative dentries are incompatible with Encoding and | 626 | /* VFS negative dentries are incompatible with Encoding and |
| 627 | * Case-insensitiveness. Eventually we'll want avoid | 627 | * Case-insensitiveness. Eventually we'll want avoid |
| 628 | * invalidating the dentries here, alongside with returning the | 628 | * invalidating the dentries here, alongside with returning the |
| @@ -46,7 +46,7 @@ · 45 unmodified lines | |||
| 46 | 46 | ||
| 47 | static struct kmem_cache *fsync_entry_slab; | 47 | static struct kmem_cache *fsync_entry_slab; |
| 48 | 48 | ||
| 49 | #ifdef CONFIG_UNICODE | 49 | #if IS_ENABLED(CONFIG_UNICODE) |
| 50 | extern struct kmem_cache *f2fs_cf_name_slab; | 50 | extern struct kmem_cache *f2fs_cf_name_slab; |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
| @@ -149,7 +149,7 @@ static int init_recovered_filename(const struct inode *dir, · 96 unmodified lines | |||
| 149 | if (err) | 149 | if (err) |
| 150 | return err; | 150 | return err; |
| 151 | f2fs_hash_filename(dir, fname); | 151 | f2fs_hash_filename(dir, fname); |
| 152 | #ifdef CONFIG_UNICODE | 152 | #if IS_ENABLED(CONFIG_UNICODE) |
| 153 | /* Case-sensitive match is fine for recovery */ | 153 | /* Case-sensitive match is fine for recovery */ |
| 154 | kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name); | 154 | kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name); |
| 155 | fname->cf_name.name = NULL; | 155 | fname->cf_name.name = NULL; |
| @@ -257,7 +257,7 @@ void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...) · 256 unmodified lines | |||
| 257 | va_end(args); | 257 | va_end(args); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | #ifdef CONFIG_UNICODE | 260 | #if IS_ENABLED(CONFIG_UNICODE) |
| 261 | static const struct f2fs_sb_encodings { | 261 | static const struct f2fs_sb_encodings { |
| 262 | __u16 magic; | 262 | __u16 magic; |
| 263 | char *name; | 263 | char *name; |
| @@ -1259,7 +1259,7 @@ default_check: · 995 unmodified lines | |||
| 1259 | return -EINVAL; | 1259 | return -EINVAL; |
| 1260 | } | 1260 | } |
| 1261 | #endif | 1261 | #endif |
| 1262 | #ifndef CONFIG_UNICODE | 1262 | #if !IS_ENABLED(CONFIG_UNICODE) |
| 1263 | if (f2fs_sb_has_casefold(sbi)) { | 1263 | if (f2fs_sb_has_casefold(sbi)) { |
| 1264 | f2fs_err(sbi, | 1264 | f2fs_err(sbi, |
| 1265 | "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE"); | 1265 | "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE"); |
| @@ -1619,7 +1619,7 @@ static void f2fs_put_super(struct super_block *sb) · 353 unmodified lines | |||
| 1619 | f2fs_destroy_iostat(sbi); | 1619 | f2fs_destroy_iostat(sbi); |
| 1620 | for (i = 0; i < NR_PAGE_TYPE; i++) | 1620 | for (i = 0; i < NR_PAGE_TYPE; i++) |
| 1621 | kvfree(sbi->write_io[i]); | 1621 | kvfree(sbi->write_io[i]); |
| 1622 | #ifdef CONFIG_UNICODE | 1622 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1623 | utf8_unload(sb->s_encoding); | 1623 | utf8_unload(sb->s_encoding); |
| 1624 | #endif | 1624 | #endif |
| 1625 | kfree(sbi); | 1625 | kfree(sbi); |
| @@ -3903,7 +3903,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) · 2277 unmodified lines | |||
| 3903 | 3903 | ||
| 3904 | static int f2fs_setup_casefold(struct f2fs_sb_info *sbi) | 3904 | static int f2fs_setup_casefold(struct f2fs_sb_info *sbi) |
| 3905 | { | 3905 | { |
| 3906 | #ifdef CONFIG_UNICODE | 3906 | #if IS_ENABLED(CONFIG_UNICODE) |
| 3907 | if (f2fs_sb_has_casefold(sbi) && !sbi->sb->s_encoding) { | 3907 | if (f2fs_sb_has_casefold(sbi) && !sbi->sb->s_encoding) { |
| 3908 | const struct f2fs_sb_encodings *encoding_info; | 3908 | const struct f2fs_sb_encodings *encoding_info; |
| 3909 | struct unicode_map *encoding; | 3909 | struct unicode_map *encoding; |
| @@ -4458,7 +4458,7 @@ free_bio_info: · 548 unmodified lines | |||
| 4458 | for (i = 0; i < NR_PAGE_TYPE; i++) | 4458 | for (i = 0; i < NR_PAGE_TYPE; i++) |
| 4459 | kvfree(sbi->write_io[i]); | 4459 | kvfree(sbi->write_io[i]); |
| 4460 | 4460 | ||
| 4461 | #ifdef CONFIG_UNICODE | 4461 | #if IS_ENABLED(CONFIG_UNICODE) |
| 4462 | utf8_unload(sb->s_encoding); | 4462 | utf8_unload(sb->s_encoding); |
| 4463 | sb->s_encoding = NULL; | 4463 | sb->s_encoding = NULL; |
| 4464 | #endif | 4464 | #endif |
| @@ -201,7 +201,7 @@ static ssize_t unusable_show(struct f2fs_attr *a, · 200 unmodified lines | |||
| 201 | static ssize_t encoding_show(struct f2fs_attr *a, | 201 | static ssize_t encoding_show(struct f2fs_attr *a, |
| 202 | struct f2fs_sb_info *sbi, char *buf) | 202 | struct f2fs_sb_info *sbi, char *buf) |
| 203 | { | 203 | { |
| 204 | #ifdef CONFIG_UNICODE | 204 | #if IS_ENABLED(CONFIG_UNICODE) |
| 205 | struct super_block *sb = sbi->sb; | 205 | struct super_block *sb = sbi->sb; |
| 206 | 206 | ||
| 207 | if (f2fs_sb_has_casefold(sbi)) | 207 | if (f2fs_sb_has_casefold(sbi)) |
| @@ -778,7 +778,7 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks); · 570 unmodified lines | |||
| 778 | #ifdef CONFIG_FS_ENCRYPTION | 778 | #ifdef CONFIG_FS_ENCRYPTION |
| 779 | F2FS_FEATURE_RO_ATTR(encryption); | 779 | F2FS_FEATURE_RO_ATTR(encryption); |
| 780 | F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2); | 780 | F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2); |
| 781 | #ifdef CONFIG_UNICODE | 781 | #if IS_ENABLED(CONFIG_UNICODE) |
| 782 | F2FS_FEATURE_RO_ATTR(encrypted_casefold); | 782 | F2FS_FEATURE_RO_ATTR(encrypted_casefold); |
| 783 | #endif | 783 | #endif |
| 784 | #endif /* CONFIG_FS_ENCRYPTION */ | 784 | #endif /* CONFIG_FS_ENCRYPTION */ |
| @@ -797,7 +797,7 @@ F2FS_FEATURE_RO_ATTR(lost_found); · 12 unmodified lines | |||
| 797 | F2FS_FEATURE_RO_ATTR(verity); | 797 | F2FS_FEATURE_RO_ATTR(verity); |
| 798 | #endif | 798 | #endif |
| 799 | F2FS_FEATURE_RO_ATTR(sb_checksum); | 799 | F2FS_FEATURE_RO_ATTR(sb_checksum); |
| 800 | #ifdef CONFIG_UNICODE | 800 | #if IS_ENABLED(CONFIG_UNICODE) |
| 801 | F2FS_FEATURE_RO_ATTR(casefold); | 801 | F2FS_FEATURE_RO_ATTR(casefold); |
| 802 | #endif | 802 | #endif |
| 803 | F2FS_FEATURE_RO_ATTR(readonly); | 803 | F2FS_FEATURE_RO_ATTR(readonly); |
| @@ -910,7 +910,7 @@ static struct attribute *f2fs_feat_attrs[] = { · 106 unmodified lines | |||
| 910 | #ifdef CONFIG_FS_ENCRYPTION | 910 | #ifdef CONFIG_FS_ENCRYPTION |
| 911 | ATTR_LIST(encryption), | 911 | ATTR_LIST(encryption), |
| 912 | ATTR_LIST(test_dummy_encryption_v2), | 912 | ATTR_LIST(test_dummy_encryption_v2), |
| 913 | #ifdef CONFIG_UNICODE | 913 | #if IS_ENABLED(CONFIG_UNICODE) |
| 914 | ATTR_LIST(encrypted_casefold), | 914 | ATTR_LIST(encrypted_casefold), |
| 915 | #endif | 915 | #endif |
| 916 | #endif /* CONFIG_FS_ENCRYPTION */ | 916 | #endif /* CONFIG_FS_ENCRYPTION */ |
| @@ -929,7 +929,7 @@ static struct attribute *f2fs_feat_attrs[] = { · 12 unmodified lines | |||
| 929 | ATTR_LIST(verity), | 929 | ATTR_LIST(verity), |
| 930 | #endif | 930 | #endif |
| 931 | ATTR_LIST(sb_checksum), | 931 | ATTR_LIST(sb_checksum), |
| 932 | #ifdef CONFIG_UNICODE | 932 | #if IS_ENABLED(CONFIG_UNICODE) |
| 933 | ATTR_LIST(casefold), | 933 | ATTR_LIST(casefold), |
| 934 | #endif | 934 | #endif |
| 935 | ATTR_LIST(readonly), | 935 | ATTR_LIST(readonly), |
| @@ -7822,10 +7822,15 @@ static __cold void io_rsrc_node_ref_zero(struct percpu_ref *ref) · 7821 unmodified lines | |||
| 7822 | struct io_ring_ctx *ctx = node->rsrc_data->ctx; | 7822 | struct io_ring_ctx *ctx = node->rsrc_data->ctx; |
| 7823 | unsigned long flags; | 7823 | unsigned long flags; |
| 7824 | bool first_add = false; | 7824 | bool first_add = false; |
| 7825 | unsigned long delay = HZ; | ||
| 7825 | 7826 | ||
| 7826 | spin_lock_irqsave(&ctx->rsrc_ref_lock, flags); | 7827 | spin_lock_irqsave(&ctx->rsrc_ref_lock, flags); |
| 7827 | node->done = true; | 7828 | node->done = true; |
| 7828 | 7829 | ||
| 7830 | /* if we are mid-quiesce then do not delay */ | ||
| 7831 | if (node->rsrc_data->quiesce) | ||
| 7832 | delay = 0; | ||
| 7833 | |||
| 7829 | while (!list_empty(&ctx->rsrc_ref_list)) { | 7834 | while (!list_empty(&ctx->rsrc_ref_list)) { |
| 7830 | node = list_first_entry(&ctx->rsrc_ref_list, | 7835 | node = list_first_entry(&ctx->rsrc_ref_list, |
| 7831 | struct io_rsrc_node, node); | 7836 | struct io_rsrc_node, node); |
| @@ -7838,10 +7843,10 @@ static __cold void io_rsrc_node_ref_zero(struct percpu_ref *ref) · 6 unmodified lines | |||
| 7838 | spin_unlock_irqrestore(&ctx->rsrc_ref_lock, flags); | 7843 | spin_unlock_irqrestore(&ctx->rsrc_ref_lock, flags); |
| 7839 | 7844 | ||
| 7840 | if (first_add) | 7845 | if (first_add) |
| 7841 | mod_delayed_work(system_wq, &ctx->rsrc_put_work, HZ); | 7846 | mod_delayed_work(system_wq, &ctx->rsrc_put_work, delay); |
| 7842 | } | 7847 | } |
| 7843 | 7848 | ||
| 7844 | static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx) | 7849 | static struct io_rsrc_node *io_rsrc_node_alloc(void) |
| 7845 | { | 7850 | { |
| 7846 | struct io_rsrc_node *ref_node; | 7851 | struct io_rsrc_node *ref_node; |
| 7847 | 7852 | ||
| @@ -7892,7 +7897,7 @@ static int io_rsrc_node_switch_start(struct io_ring_ctx *ctx) · 44 unmodified lines | |||
| 7892 | { | 7897 | { |
| 7893 | if (ctx->rsrc_backup_node) | 7898 | if (ctx->rsrc_backup_node) |
| 7894 | return 0; | 7899 | return 0; |
| 7895 | ctx->rsrc_backup_node = io_rsrc_node_alloc(ctx); | 7900 | ctx->rsrc_backup_node = io_rsrc_node_alloc(); |
| 7896 | return ctx->rsrc_backup_node ? 0 : -ENOMEM; | 7901 | return ctx->rsrc_backup_node ? 0 : -ENOMEM; |
| 7897 | } | 7902 | } |
| 7898 | 7903 | ||
| @@ -2972,6 +2972,7 @@ struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh) · 2971 unmodified lines | |||
| 2972 | jbd_unlock_bh_journal_head(bh); | 2972 | jbd_unlock_bh_journal_head(bh); |
| 2973 | return jh; | 2973 | return jh; |
| 2974 | } | 2974 | } |
| 2975 | EXPORT_SYMBOL(jbd2_journal_grab_journal_head); | ||
| 2975 | 2976 | ||
| 2976 | static void __journal_remove_journal_head(struct buffer_head *bh) | 2977 | static void __journal_remove_journal_head(struct buffer_head *bh) |
| 2977 | { | 2978 | { |
| @@ -3024,6 +3025,7 @@ void jbd2_journal_put_journal_head(struct journal_head *jh) · 46 unmodified lines | |||
| 3024 | jbd_unlock_bh_journal_head(bh); | 3025 | jbd_unlock_bh_journal_head(bh); |
| 3025 | } | 3026 | } |
| 3026 | } | 3027 | } |
| 3028 | EXPORT_SYMBOL(jbd2_journal_put_journal_head); | ||
| 3027 | 3029 | ||
| 3028 | /* | 3030 | /* |
| 3029 | * Initialize jbd inode head | 3031 | * Initialize jbd inode head |
| @@ -1379,7 +1379,7 @@ bool is_empty_dir_inode(struct inode *inode) · 1378 unmodified lines | |||
| 1379 | (inode->i_op == &empty_dir_inode_operations); | 1379 | (inode->i_op == &empty_dir_inode_operations); |
| 1380 | } | 1380 | } |
| 1381 | 1381 | ||
| 1382 | #ifdef CONFIG_UNICODE | 1382 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1383 | /* | 1383 | /* |
| 1384 | * Determine if the name of a dentry should be casefolded. | 1384 | * Determine if the name of a dentry should be casefolded. |
| 1385 | * | 1385 | * |
| @@ -1473,7 +1473,7 @@ static const struct dentry_operations generic_encrypted_dentry_ops = { · 87 unmodified lines | |||
| 1473 | }; | 1473 | }; |
| 1474 | #endif | 1474 | #endif |
| 1475 | 1475 | ||
| 1476 | #if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE) | 1476 | #if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE) |
| 1477 | static const struct dentry_operations generic_encrypted_ci_dentry_ops = { | 1477 | static const struct dentry_operations generic_encrypted_ci_dentry_ops = { |
| 1478 | .d_hash = generic_ci_d_hash, | 1478 | .d_hash = generic_ci_d_hash, |
| 1479 | .d_compare = generic_ci_d_compare, | 1479 | .d_compare = generic_ci_d_compare, |
| @@ -1508,10 +1508,10 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry) · 28 unmodified lines | |||
| 1508 | #ifdef CONFIG_FS_ENCRYPTION | 1508 | #ifdef CONFIG_FS_ENCRYPTION |
| 1509 | bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME; | 1509 | bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME; |
| 1510 | #endif | 1510 | #endif |
| 1511 | #ifdef CONFIG_UNICODE | 1511 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1512 | bool needs_ci_ops = dentry->d_sb->s_encoding; | 1512 | bool needs_ci_ops = dentry->d_sb->s_encoding; |
| 1513 | #endif | 1513 | #endif |
| 1514 | #if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE) | 1514 | #if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE) |
| 1515 | if (needs_encrypt_ops && needs_ci_ops) { | 1515 | if (needs_encrypt_ops && needs_ci_ops) { |
| 1516 | d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops); | 1516 | d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops); |
| 1517 | return; | 1517 | return; |
| @@ -1523,7 +1523,7 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry) · 5 unmodified lines | |||
| 1523 | return; | 1523 | return; |
| 1524 | } | 1524 | } |
| 1525 | #endif | 1525 | #endif |
| 1526 | #ifdef CONFIG_UNICODE | 1526 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1527 | if (needs_ci_ops) { | 1527 | if (needs_ci_ops) { |
| 1528 | d_set_d_op(dentry, &generic_ci_dentry_ops); | 1528 | d_set_d_op(dentry, &generic_ci_dentry_ops); |
| 1529 | return; | 1529 | return; |
| @@ -179,19 +179,21 @@ nlm_delete_file(struct nlm_file *file) · 178 unmodified lines | |||
| 179 | static int nlm_unlock_files(struct nlm_file *file) | 179 | static int nlm_unlock_files(struct nlm_file *file) |
| 180 | { | 180 | { |
| 181 | struct file_lock lock; | 181 | struct file_lock lock; |
| 182 | struct file *f; | ||
| 183 | 182 | ||
| 183 | locks_init_lock(&lock); | ||
| 184 | lock.fl_type = F_UNLCK; | 184 | lock.fl_type = F_UNLCK; |
| 185 | lock.fl_start = 0; | 185 | lock.fl_start = 0; |
| 186 | lock.fl_end = OFFSET_MAX; | 186 | lock.fl_end = OFFSET_MAX; |
| 187 | for (f = file->f_file[0]; f <= file->f_file[1]; f++) { | 187 | if (file->f_file[O_RDONLY] && |
| 188 | if (f && vfs_lock_file(f, F_SETLK, &lock, NULL) < 0) { | 188 | vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL)) |
| 189 | pr_warn("lockd: unlock failure in %s:%d\n", | 189 | goto out_err; |
| 190 | __FILE__, __LINE__); | 190 | if (file->f_file[O_WRONLY] && |
| 191 | return 1; | 191 | vfs_lock_file(file->f_file[O_WRONLY], F_SETLK, &lock, NULL)) |
| 192 | } | 192 | goto out_err; |
| 193 | } | ||
| 194 | return 0; | 193 | return 0; |
| 194 | out_err: | ||
| 195 | pr_warn("lockd: unlock failure in %s:%d\n", __FILE__, __LINE__); | ||
| 196 | return 1; | ||
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | /* | 199 | /* |
| @@ -4024,13 +4024,12 @@ int vfs_rmdir(struct user_namespace *mnt_userns, struct inode *dir, · 4023 unmodified lines | |||
| 4024 | dentry->d_inode->i_flags |= S_DEAD; | 4024 | dentry->d_inode->i_flags |= S_DEAD; |
| 4025 | dont_mount(dentry); | 4025 | dont_mount(dentry); |
| 4026 | detach_mounts(dentry); | 4026 | detach_mounts(dentry); |
| 4027 | fsnotify_rmdir(dir, dentry); | ||
| 4028 | 4027 | ||
| 4029 | out: | 4028 | out: |
| 4030 | inode_unlock(dentry->d_inode); | 4029 | inode_unlock(dentry->d_inode); |
| 4031 | dput(dentry); | 4030 | dput(dentry); |
| 4032 | if (!error) | 4031 | if (!error) |
| 4033 | d_delete(dentry); | 4032 | d_delete_notify(dir, dentry); |
| 4034 | return error; | 4033 | return error; |
| 4035 | } | 4034 | } |
| 4036 | EXPORT_SYMBOL(vfs_rmdir); | 4035 | EXPORT_SYMBOL(vfs_rmdir); |
| @@ -4152,7 +4151,6 @@ int vfs_unlink(struct user_namespace *mnt_userns, struct inode *dir, · 115 unmodified lines | |||
| 4152 | if (!error) { | 4151 | if (!error) { |
| 4153 | dont_mount(dentry); | 4152 | dont_mount(dentry); |
| 4154 | detach_mounts(dentry); | 4153 | detach_mounts(dentry); |
| 4155 | fsnotify_unlink(dir, dentry); | ||
| 4156 | } | 4154 | } |
| 4157 | } | 4155 | } |
| 4158 | } | 4156 | } |
| @@ -4160,9 +4158,11 @@ out: · 1 unmodified line | |||
| 4160 | inode_unlock(target); | 4158 | inode_unlock(target); |
| 4161 | 4159 | ||
| 4162 | /* We don't d_delete() NFS sillyrenamed files--they still exist. */ | 4160 | /* We don't d_delete() NFS sillyrenamed files--they still exist. */ |
| 4163 | if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { | 4161 | if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) { |
| 4162 | fsnotify_unlink(dir, dentry); | ||
| 4163 | } else if (!error) { | ||
| 4164 | fsnotify_link_count(target); | 4164 | fsnotify_link_count(target); |
| 4165 | d_delete(dentry); | 4165 | d_delete_notify(dir, dentry); |
| 4166 | } | 4166 | } |
| 4167 | 4167 | ||
| 4168 | return error; | 4168 | return error; |
| @@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, · 4129 unmodified lines | |||
| 4130 | status = nfserr_clid_inuse; | 4130 | status = nfserr_clid_inuse; |
| 4131 | if (client_has_state(old) | 4131 | if (client_has_state(old) |
| 4132 | && !same_creds(&unconf->cl_cred, | 4132 | && !same_creds(&unconf->cl_cred, |
| 4133 | &old->cl_cred)) | 4133 | &old->cl_cred)) { |
| 4134 | old = NULL; | ||
| 4134 | goto out; | 4135 | goto out; |
| 4136 | } | ||
| 4135 | status = mark_client_expired_locked(old); | 4137 | status = mark_client_expired_locked(old); |
| 4136 | if (status) { | 4138 | if (status) { |
| 4137 | old = NULL; | 4139 | old = NULL; |
| @@ -1247,7 +1247,8 @@ static void nfsdfs_remove_file(struct inode *dir, struct dentry *dentry) · 1246 unmodified lines | |||
| 1247 | clear_ncl(d_inode(dentry)); | 1247 | clear_ncl(d_inode(dentry)); |
| 1248 | dget(dentry); | 1248 | dget(dentry); |
| 1249 | ret = simple_unlink(dir, dentry); | 1249 | ret = simple_unlink(dir, dentry); |
| 1250 | d_delete(dentry); | 1250 | d_drop(dentry); |
| 1251 | fsnotify_unlink(dir, dentry); | ||
| 1251 | dput(dentry); | 1252 | dput(dentry); |
| 1252 | WARN_ON_ONCE(ret); | 1253 | WARN_ON_ONCE(ret); |
| 1253 | } | 1254 | } |
| @@ -1338,8 +1339,8 @@ void nfsd_client_rmdir(struct dentry *dentry) · 84 unmodified lines | |||
| 1338 | dget(dentry); | 1339 | dget(dentry); |
| 1339 | ret = simple_rmdir(dir, dentry); | 1340 | ret = simple_rmdir(dir, dentry); |
| 1340 | WARN_ON_ONCE(ret); | 1341 | WARN_ON_ONCE(ret); |
| 1342 | d_drop(dentry); | ||
| 1341 | fsnotify_rmdir(dir, dentry); | 1343 | fsnotify_rmdir(dir, dentry); |
| 1342 | d_delete(dentry); | ||
| 1343 | dput(dentry); | 1344 | dput(dentry); |
| 1344 | inode_unlock(dir); | 1345 | inode_unlock(dir); |
| 1345 | } | 1346 | } |
| @@ -158,7 +158,6 @@ static size_t fanotify_event_len(unsigned int info_mode, · 157 unmodified lines | |||
| 158 | struct fanotify_event *event) | 158 | struct fanotify_event *event) |
| 159 | { | 159 | { |
| 160 | size_t event_len = FAN_EVENT_METADATA_LEN; | 160 | size_t event_len = FAN_EVENT_METADATA_LEN; |
| 161 | struct fanotify_info *info; | ||
| 162 | int fh_len; | 161 | int fh_len; |
| 163 | int dot_len = 0; | 162 | int dot_len = 0; |
| 164 | 163 | ||
| @@ -168,8 +167,6 @@ static size_t fanotify_event_len(unsigned int info_mode, · 3 unmodified lines | |||
| 168 | if (fanotify_is_error_event(event->mask)) | 167 | if (fanotify_is_error_event(event->mask)) |
| 169 | event_len += FANOTIFY_ERROR_INFO_LEN; | 168 | event_len += FANOTIFY_ERROR_INFO_LEN; |
| 170 | 169 | ||
| 171 | info = fanotify_event_info(event); | ||
| 172 | |||
| 173 | if (fanotify_event_has_any_dir_fh(event)) { | 170 | if (fanotify_event_has_any_dir_fh(event)) { |
| 174 | event_len += fanotify_dir_name_info_len(event); | 171 | event_len += fanotify_dir_name_info_len(event); |
| 175 | } else if ((info_mode & FAN_REPORT_NAME) && | 172 | } else if ((info_mode & FAN_REPORT_NAME) && |
| @@ -704,9 +701,6 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, · 528 unmodified lines | |||
| 704 | if (fanotify_is_perm_event(event->mask)) | 701 | if (fanotify_is_perm_event(event->mask)) |
| 705 | FANOTIFY_PERM(event)->fd = fd; | 702 | FANOTIFY_PERM(event)->fd = fd; |
| 706 | 703 | ||
| 707 | if (f) | ||
| 708 | fd_install(fd, f); | ||
| 709 | |||
| 710 | if (info_mode) { | 704 | if (info_mode) { |
| 711 | ret = copy_info_records_to_user(event, info, info_mode, pidfd, | 705 | ret = copy_info_records_to_user(event, info, info_mode, pidfd, |
| 712 | buf, count); | 706 | buf, count); |
| @@ -714,6 +708,9 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, · 1 unmodified line | |||
| 714 | goto out_close_fd; | 708 | goto out_close_fd; |
| 715 | } | 709 | } |
| 716 | 710 | ||
| 711 | if (f) | ||
| 712 | fd_install(fd, f); | ||
| 713 | |||
| 717 | return metadata.event_len; | 714 | return metadata.event_len; |
| 718 | 715 | ||
| 719 | out_close_fd: | 716 | out_close_fd: |
| @@ -661,17 +661,6 @@ static struct ctl_table ocfs2_nm_table[] = { · 660 unmodified lines | |||
| 661 | { } | 661 | { } |
| 662 | }; | 662 | }; |
| 663 | 663 | ||
| 664 | static struct ctl_table ocfs2_mod_table[] = { | ||
| 665 | { | ||
| 666 | .procname = "nm", | ||
| 667 | .data = NULL, | ||
| 668 | .maxlen = 0, | ||
| 669 | .mode = 0555, | ||
| 670 | .child = ocfs2_nm_table | ||
| 671 | }, | ||
| 672 | { } | ||
| 673 | }; | ||
| 674 | |||
| 675 | static struct ctl_table_header *ocfs2_table_header; | 664 | static struct ctl_table_header *ocfs2_table_header; |
| 676 | 665 | ||
| 677 | /* | 666 | /* |
| @@ -682,7 +671,7 @@ static int __init ocfs2_stack_glue_init(void) · 4 unmodified lines | |||
| 682 | { | 671 | { |
| 683 | strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); | 672 | strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); |
| 684 | 673 | ||
| 685 | ocfs2_table_header = register_sysctl("fs/ocfs2", ocfs2_mod_table); | 674 | ocfs2_table_header = register_sysctl("fs/ocfs2/nm", ocfs2_nm_table); |
| 686 | if (!ocfs2_table_header) { | 675 | if (!ocfs2_table_header) { |
| 687 | printk(KERN_ERR | 676 | printk(KERN_ERR |
| 688 | "ocfs2 stack glue: unable to register sysctl\n"); | 677 | "ocfs2 stack glue: unable to register sysctl\n"); |
| @@ -1251,26 +1251,23 @@ static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, · 1250 unmodified lines | |||
| 1251 | { | 1251 | { |
| 1252 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; | 1252 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; |
| 1253 | struct journal_head *jh; | 1253 | struct journal_head *jh; |
| 1254 | int ret = 1; | 1254 | int ret; |
| 1255 | 1255 | ||
| 1256 | if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) | 1256 | if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) |
| 1257 | return 0; | 1257 | return 0; |
| 1258 | 1258 | ||
| 1259 | if (!buffer_jbd(bg_bh)) | 1259 | jh = jbd2_journal_grab_journal_head(bg_bh); |
| 1260 | if (!jh) | ||
| 1260 | return 1; | 1261 | return 1; |
| 1261 | 1262 | ||
| 1262 | jbd_lock_bh_journal_head(bg_bh); | 1263 | spin_lock(&jh->b_state_lock); |
| 1263 | if (buffer_jbd(bg_bh)) { | 1264 | bg = (struct ocfs2_group_desc *) jh->b_committed_data; |
| 1264 | jh = bh2jh(bg_bh); | 1265 | if (bg) |
| 1265 | spin_lock(&jh->b_state_lock); | 1266 | ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); |
| 1266 | bg = (struct ocfs2_group_desc *) jh->b_committed_data; | 1267 | else |
| 1267 | if (bg) | 1268 | ret = 1; |
| 1268 | ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); | 1269 | spin_unlock(&jh->b_state_lock); |
| 1269 | else | 1270 | jbd2_journal_put_journal_head(jh); |
| 1270 | ret = 1; | ||
| 1271 | spin_unlock(&jh->b_state_lock); | ||
| 1272 | } | ||
| 1273 | jbd_unlock_bh_journal_head(bg_bh); | ||
| 1274 | 1271 | ||
| 1275 | return ret; | 1272 | return ret; |
| 1276 | } | 1273 | } |
| @@ -145,7 +145,7 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 144 unmodified lines | |||
| 145 | if (err == -ENOTTY || err == -EINVAL) | 145 | if (err == -ENOTTY || err == -EINVAL) |
| 146 | return 0; | 146 | return 0; |
| 147 | pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n", | 147 | pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n", |
| 148 | old, err); | 148 | old->dentry, err); |
| 149 | return err; | 149 | return err; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| @@ -157,7 +157,9 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 5 unmodified lines | |||
| 157 | */ | 157 | */ |
| 158 | if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) { | 158 | if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) { |
| 159 | err = ovl_set_protattr(inode, new->dentry, &oldfa); | 159 | err = ovl_set_protattr(inode, new->dentry, &oldfa); |
| 160 | if (err) | 160 | if (err == -EPERM) |
| 161 | pr_warn_once("copying fileattr: no xattr on upper\n"); | ||
| 162 | else if (err) | ||
| 161 | return err; | 163 | return err; |
| 162 | } | 164 | } |
| 163 | 165 | ||
| @@ -167,8 +169,16 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 3 unmodified lines | |||
| 167 | 169 | ||
| 168 | err = ovl_real_fileattr_get(new, &newfa); | 170 | err = ovl_real_fileattr_get(new, &newfa); |
| 169 | if (err) { | 171 | if (err) { |
| 172 | /* | ||
| 173 | * Returning an error if upper doesn't support fileattr will | ||
| 174 | * result in a regression, so revert to the old behavior. | ||
| 175 | */ | ||
| 176 | if (err == -ENOTTY || err == -EINVAL) { | ||
| 177 | pr_warn_once("copying fileattr: no support on upper\n"); | ||
| 178 | return 0; | ||
| 179 | } | ||
| 170 | pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n", | 180 | pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n", |
| 171 | new, err); | 181 | new->dentry, err); |
| 172 | return err; | 182 | return err; |
| 173 | } | 183 | } |
| 174 | 184 | ||
| @@ -258,10 +258,6 @@ int udf_expand_file_adinicb(struct inode *inode) · 257 unmodified lines | |||
| 258 | char *kaddr; | 258 | char *kaddr; |
| 259 | struct udf_inode_info *iinfo = UDF_I(inode); | 259 | struct udf_inode_info *iinfo = UDF_I(inode); |
| 260 | int err; | 260 | int err; |
| 261 | struct writeback_control udf_wbc = { | ||
| 262 | .sync_mode = WB_SYNC_NONE, | ||
| 263 | .nr_to_write = 1, | ||
| 264 | }; | ||
| 265 | 261 | ||
| 266 | WARN_ON_ONCE(!inode_is_locked(inode)); | 262 | WARN_ON_ONCE(!inode_is_locked(inode)); |
| 267 | if (!iinfo->i_lenAlloc) { | 263 | if (!iinfo->i_lenAlloc) { |
| @@ -305,8 +301,10 @@ int udf_expand_file_adinicb(struct inode *inode) · 37 unmodified lines | |||
| 305 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 301 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
| 306 | /* from now on we have normal address_space methods */ | 302 | /* from now on we have normal address_space methods */ |
| 307 | inode->i_data.a_ops = &udf_aops; | 303 | inode->i_data.a_ops = &udf_aops; |
| 304 | set_page_dirty(page); | ||
| 305 | unlock_page(page); | ||
| 308 | up_write(&iinfo->i_data_sem); | 306 | up_write(&iinfo->i_data_sem); |
| 309 | err = inode->i_data.a_ops->writepage(page, &udf_wbc); | 307 | err = filemap_fdatawrite(inode->i_mapping); |
| 310 | if (err) { | 308 | if (err) { |
| 311 | /* Restore everything back so that we don't lose data... */ | 309 | /* Restore everything back so that we don't lose data... */ |
| 312 | lock_page(page); | 310 | lock_page(page); |
| @@ -317,6 +315,7 @@ int udf_expand_file_adinicb(struct inode *inode) · 4 unmodified lines | |||
| 317 | unlock_page(page); | 315 | unlock_page(page); |
| 318 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; | 316 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
| 319 | inode->i_data.a_ops = &udf_adinicb_aops; | 317 | inode->i_data.a_ops = &udf_adinicb_aops; |
| 318 | iinfo->i_lenAlloc = inode->i_size; | ||
| 320 | up_write(&iinfo->i_data_sem); | 319 | up_write(&iinfo->i_data_sem); |
| 321 | } | 320 | } |
| 322 | put_page(page); | 321 | put_page(page); |
| @@ -3,21 +3,13 @@ · 2 unmodified lines | |||
| 3 | # UTF-8 normalization | 3 | # UTF-8 normalization |
| 4 | # | 4 | # |
| 5 | config UNICODE | 5 | config UNICODE |
| 6 | bool "UTF-8 normalization and casefolding support" | 6 | tristate "UTF-8 normalization and casefolding support" |
| 7 | help | 7 | help |
| 8 | Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding | 8 | Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding |
| 9 | support. | 9 | support. If you say M here the large table of case foldings will |
| 10 | 10 | be a separate loadable module that gets requested only when a file | |
| 11 | config UNICODE_UTF8_DATA | 11 | system actually use it. |
| 12 | tristate "UTF-8 normalization and casefolding tables" | ||
| 13 | depends on UNICODE | ||
| 14 | default UNICODE | ||
| 15 | help | ||
| 16 | This contains a large table of case foldings, which can be loaded as | ||
| 17 | a separate module if you say M here. To be on the safe side stick | ||
| 18 | to the default of Y. Saying N here makes no sense, if you do not want | ||
| 19 | utf8 casefolding support, disable CONFIG_UNICODE instead. | ||
| 20 | 12 | ||
| 21 | config UNICODE_NORMALIZATION_SELFTEST | 13 | config UNICODE_NORMALIZATION_SELFTEST |
| 22 | tristate "Test UTF-8 normalization support" | 14 | tristate "Test UTF-8 normalization support" |
| 23 | depends on UNICODE_UTF8_DATA | 15 | depends on UNICODE |
| @@ -1,8 +1,10 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | obj-$(CONFIG_UNICODE) += unicode.o | 3 | ifneq ($(CONFIG_UNICODE),) |
| 4 | obj-y += unicode.o | ||
| 5 | endif | ||
| 6 | obj-$(CONFIG_UNICODE) += utf8data.o | ||
| 4 | obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o | 7 | obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o |
| 5 | obj-$(CONFIG_UNICODE_UTF8_DATA) += utf8data.o | ||
| 6 | 8 | ||
| 7 | unicode-y := utf8-norm.o utf8-core.o | 9 | unicode-y := utf8-norm.o utf8-core.o |
| 8 | 10 | ||
| @@ -1258,6 +1258,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, · 1257 unmodified lines | |||
| 1258 | void disk_end_io_acct(struct gendisk *disk, unsigned int op, | 1258 | void disk_end_io_acct(struct gendisk *disk, unsigned int op, |
| 1259 | unsigned long start_time); | 1259 | unsigned long start_time); |
| 1260 | 1260 | ||
| 1261 | void bio_start_io_acct_time(struct bio *bio, unsigned long start_time); | ||
| 1261 | unsigned long bio_start_io_acct(struct bio *bio); | 1262 | unsigned long bio_start_io_acct(struct bio *bio); |
| 1262 | void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time, | 1263 | void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time, |
| 1263 | struct block_device *orig_bdev); | 1264 | struct block_device *orig_bdev); |
| @@ -1483,7 +1483,7 @@ struct super_block { · 1482 unmodified lines | |||
| 1483 | #ifdef CONFIG_FS_VERITY | 1483 | #ifdef CONFIG_FS_VERITY |
| 1484 | const struct fsverity_operations *s_vop; | 1484 | const struct fsverity_operations *s_vop; |
| 1485 | #endif | 1485 | #endif |
| 1486 | #ifdef CONFIG_UNICODE | 1486 | #if IS_ENABLED(CONFIG_UNICODE) |
| 1487 | struct unicode_map *s_encoding; | 1487 | struct unicode_map *s_encoding; |
| 1488 | __u16 s_encoding_flags; | 1488 | __u16 s_encoding_flags; |
| 1489 | #endif | 1489 | #endif |
| @@ -224,6 +224,43 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, · 223 unmodified lines | |||
| 224 | dir, &new_dentry->d_name, 0); | 224 | dir, &new_dentry->d_name, 0); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | /* | ||
| 228 | * fsnotify_delete - @dentry was unlinked and unhashed | ||
| 229 | * | ||
| 230 | * Caller must make sure that dentry->d_name is stable. | ||
| 231 | * | ||
| 232 | * Note: unlike fsnotify_unlink(), we have to pass also the unlinked inode | ||
| 233 | * as this may be called after d_delete() and old_dentry may be negative. | ||
| 234 | */ | ||
| 235 | static inline void fsnotify_delete(struct inode *dir, struct inode *inode, | ||
| 236 | struct dentry *dentry) | ||
| 237 | { | ||
| 238 | __u32 mask = FS_DELETE; | ||
| 239 | |||
| 240 | if (S_ISDIR(inode->i_mode)) | ||
| 241 | mask |= FS_ISDIR; | ||
| 242 | |||
| 243 | fsnotify_name(mask, inode, FSNOTIFY_EVENT_INODE, dir, &dentry->d_name, | ||
| 244 | 0); | ||
| 245 | } | ||
| 246 | |||
| 247 | /** | ||
| 248 | * d_delete_notify - delete a dentry and call fsnotify_delete() | ||
| 249 | * @dentry: The dentry to delete | ||
| 250 | * | ||
| 251 | * This helper is used to guaranty that the unlinked inode cannot be found | ||
| 252 | * by lookup of this name after fsnotify_delete() event has been delivered. | ||
| 253 | */ | ||
| 254 | static inline void d_delete_notify(struct inode *dir, struct dentry *dentry) | ||
| 255 | { | ||
| 256 | struct inode *inode = d_inode(dentry); | ||
| 257 | |||
| 258 | ihold(inode); | ||
| 259 | d_delete(dentry); | ||
| 260 | fsnotify_delete(dir, inode, dentry); | ||
| 261 | iput(inode); | ||
| 262 | } | ||
| 263 | |||
| 227 | /* | 264 | /* |
| 228 | * fsnotify_unlink - 'name' was unlinked | 265 | * fsnotify_unlink - 'name' was unlinked |
| 229 | * | 266 | * |
| @@ -231,10 +268,10 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, · 1 unmodified line | |||
| 231 | */ | 268 | */ |
| 232 | static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) | 269 | static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) |
| 233 | { | 270 | { |
| 234 | /* Expected to be called before d_delete() */ | 271 | if (WARN_ON_ONCE(d_is_negative(dentry))) |
| 235 | WARN_ON_ONCE(d_is_negative(dentry)); | 272 | return; |
| 236 | 273 | ||
| 237 | fsnotify_dirent(dir, dentry, FS_DELETE); | 274 | fsnotify_delete(dir, d_inode(dentry), dentry); |
| 238 | } | 275 | } |
| 239 | 276 | ||
| 240 | /* | 277 | /* |
| @@ -258,10 +295,10 @@ static inline void fsnotify_mkdir(struct inode *dir, struct dentry *dentry) · 17 unmodified lines | |||
| 258 | */ | 295 | */ |
| 259 | static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) | 296 | static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) |
| 260 | { | 297 | { |
| 261 | /* Expected to be called before d_delete() */ | 298 | if (WARN_ON_ONCE(d_is_negative(dentry))) |
| 262 | WARN_ON_ONCE(d_is_negative(dentry)); | 299 | return; |
| 263 | 300 | ||
| 264 | fsnotify_dirent(dir, dentry, FS_DELETE | FS_ISDIR); | 301 | fsnotify_delete(dir, d_inode(dentry), dentry); |
| 265 | } | 302 | } |
| 266 | 303 | ||
| 267 | /* | 304 | /* |
| @@ -46,8 +46,10 @@ struct vlan_hdr { · 45 unmodified lines | |||
| 46 | * @h_vlan_encapsulated_proto: packet type ID or len | 46 | * @h_vlan_encapsulated_proto: packet type ID or len |
| 47 | */ | 47 | */ |
| 48 | struct vlan_ethhdr { | 48 | struct vlan_ethhdr { |
| 49 | unsigned char h_dest[ETH_ALEN]; | 49 | struct_group(addrs, |
| 50 | unsigned char h_source[ETH_ALEN]; | 50 | unsigned char h_dest[ETH_ALEN]; |
| 51 | unsigned char h_source[ETH_ALEN]; | ||
| 52 | ); | ||
| 51 | __be16 h_vlan_proto; | 53 | __be16 h_vlan_proto; |
| 52 | __be16 h_vlan_TCI; | 54 | __be16 h_vlan_TCI; |
| 53 | __be16 h_vlan_encapsulated_proto; | 55 | __be16 h_vlan_encapsulated_proto; |
| @@ -80,7 +80,7 @@ LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb, · 79 unmodified lines | |||
| 80 | unsigned long *set_kern_flags) | 80 | unsigned long *set_kern_flags) |
| 81 | LSM_HOOK(int, 0, move_mount, const struct path *from_path, | 81 | LSM_HOOK(int, 0, move_mount, const struct path *from_path, |
| 82 | const struct path *to_path) | 82 | const struct path *to_path) |
| 83 | LSM_HOOK(int, 0, dentry_init_security, struct dentry *dentry, | 83 | LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry, |
| 84 | int mode, const struct qstr *name, const char **xattr_name, | 84 | int mode, const struct qstr *name, const char **xattr_name, |
| 85 | void **ctx, u32 *ctxlen) | 85 | void **ctx, u32 *ctxlen) |
| 86 | LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode, | 86 | LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode, |
| @@ -1506,11 +1506,18 @@ static inline u8 page_kasan_tag(const struct page *page) · 1505 unmodified lines | |||
| 1506 | 1506 | ||
| 1507 | static inline void page_kasan_tag_set(struct page *page, u8 tag) | 1507 | static inline void page_kasan_tag_set(struct page *page, u8 tag) |
| 1508 | { | 1508 | { |
| 1509 | if (kasan_enabled()) { | 1509 | unsigned long old_flags, flags; |
| 1510 | tag ^= 0xff; | 1510 | |
| 1511 | page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); | 1511 | if (!kasan_enabled()) |
| 1512 | page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; | 1512 | return; |
| 1513 | } | 1513 | |
| 1514 | tag ^= 0xff; | ||
| 1515 | old_flags = READ_ONCE(page->flags); | ||
| 1516 | do { | ||
| 1517 | flags = old_flags; | ||
| 1518 | flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); | ||
| 1519 | flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; | ||
| 1520 | } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); | ||
| 1514 | } | 1521 | } |
| 1515 | 1522 | ||
| 1516 | static inline void page_kasan_tag_reset(struct page *page) | 1523 | static inline void page_kasan_tag_reset(struct page *page) |
| @@ -261,6 +261,7 @@ static_assert(sizeof(struct page) == sizeof(struct folio)); · 260 unmodified lines | |||
| 261 | static_assert(offsetof(struct page, pg) == offsetof(struct folio, fl)) | 261 | static_assert(offsetof(struct page, pg) == offsetof(struct folio, fl)) |
| 262 | FOLIO_MATCH(flags, flags); | 262 | FOLIO_MATCH(flags, flags); |
| 263 | FOLIO_MATCH(lru, lru); | 263 | FOLIO_MATCH(lru, lru); |
| 264 | FOLIO_MATCH(mapping, mapping); | ||
| 264 | FOLIO_MATCH(compound_head, lru); | 265 | FOLIO_MATCH(compound_head, lru); |
| 265 | FOLIO_MATCH(index, index); | 266 | FOLIO_MATCH(index, index); |
| 266 | FOLIO_MATCH(private, private); | 267 | FOLIO_MATCH(private, private); |
| @@ -25,18 +25,17 @@ void psi_memstall_enter(unsigned long *flags); · 24 unmodified lines | |||
| 25 | void psi_memstall_leave(unsigned long *flags); | 25 | void psi_memstall_leave(unsigned long *flags); |
| 26 | 26 | ||
| 27 | int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res); | 27 | int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res); |
| 28 | |||
| 29 | #ifdef CONFIG_CGROUPS | ||
| 30 | int psi_cgroup_alloc(struct cgroup *cgrp); | ||
| 31 | void psi_cgroup_free(struct cgroup *cgrp); | ||
| 32 | void cgroup_move_task(struct task_struct *p, struct css_set *to); | ||
| 33 | |||
| 34 | struct psi_trigger *psi_trigger_create(struct psi_group *group, | 28 | struct psi_trigger *psi_trigger_create(struct psi_group *group, |
| 35 | char *buf, size_t nbytes, enum psi_res res); | 29 | char *buf, size_t nbytes, enum psi_res res); |
| 36 | void psi_trigger_destroy(struct psi_trigger *t); | 30 | void psi_trigger_destroy(struct psi_trigger *t); |
| 37 | 31 | ||
| 38 | __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file, | 32 | __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file, |
| 39 | poll_table *wait); | 33 | poll_table *wait); |
| 34 | |||
| 35 | #ifdef CONFIG_CGROUPS | ||
| 36 | int psi_cgroup_alloc(struct cgroup *cgrp); | ||
| 37 | void psi_cgroup_free(struct cgroup *cgrp); | ||
| 38 | void cgroup_move_task(struct task_struct *p, struct css_set *to); | ||
| 40 | #endif | 39 | #endif |
| 41 | 40 | ||
| 42 | #else /* CONFIG_PSI */ | 41 | #else /* CONFIG_PSI */ |
| @@ -91,7 +91,7 @@ extern bool qid_valid(struct kqid qid); · 90 unmodified lines | |||
| 91 | * | 91 | * |
| 92 | * When there is no mapping defined for the user-namespace, type, | 92 | * When there is no mapping defined for the user-namespace, type, |
| 93 | * qid tuple an invalid kqid is returned. Callers are expected to | 93 | * qid tuple an invalid kqid is returned. Callers are expected to |
| 94 | * test for and handle handle invalid kqids being returned. | 94 | * test for and handle invalid kqids being returned. |
| 95 | * Invalid kqids may be tested for using qid_valid(). | 95 | * Invalid kqids may be tested for using qid_valid(). |
| 96 | */ | 96 | */ |
| 97 | static inline struct kqid make_kqid(struct user_namespace *from, | 97 | static inline struct kqid make_kqid(struct user_namespace *from, |
| @@ -1680,7 +1680,6 @@ extern struct pid *cad_pid; · 1679 unmodified lines | |||
| 1680 | #define PF_MEMALLOC 0x00000800 /* Allocating memory */ | 1680 | #define PF_MEMALLOC 0x00000800 /* Allocating memory */ |
| 1681 | #define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */ | 1681 | #define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */ |
| 1682 | #define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */ | 1682 | #define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */ |
| 1683 | #define PF_USED_ASYNC 0x00004000 /* Used async_schedule*(), used by module init */ | ||
| 1684 | #define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */ | 1683 | #define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */ |
| 1685 | #define PF_FROZEN 0x00010000 /* Frozen for system suspend */ | 1684 | #define PF_FROZEN 0x00010000 /* Frozen for system suspend */ |
| 1686 | #define PF_KSWAPD 0x00020000 /* I am kswapd */ | 1685 | #define PF_KSWAPD 0x00020000 /* I am kswapd */ |
| @@ -430,15 +430,7 @@ struct platform_hibernation_ops { · 429 unmodified lines | |||
| 430 | 430 | ||
| 431 | #ifdef CONFIG_HIBERNATION | 431 | #ifdef CONFIG_HIBERNATION |
| 432 | /* kernel/power/snapshot.c */ | 432 | /* kernel/power/snapshot.c */ |
| 433 | extern void __register_nosave_region(unsigned long b, unsigned long e, int km); | 433 | extern void register_nosave_region(unsigned long b, unsigned long e); |
| 434 | static inline void __init register_nosave_region(unsigned long b, unsigned long e) | ||
| 435 | { | ||
| 436 | __register_nosave_region(b, e, 0); | ||
| 437 | } | ||
| 438 | static inline void __init register_nosave_region_late(unsigned long b, unsigned long e) | ||
| 439 | { | ||
| 440 | __register_nosave_region(b, e, 1); | ||
| 441 | } | ||
| 442 | extern int swsusp_page_is_forbidden(struct page *); | 434 | extern int swsusp_page_is_forbidden(struct page *); |
| 443 | extern void swsusp_set_page_free(struct page *); | 435 | extern void swsusp_set_page_free(struct page *); |
| 444 | extern void swsusp_unset_page_free(struct page *); | 436 | extern void swsusp_unset_page_free(struct page *); |
| @@ -458,7 +450,6 @@ int pfn_is_nosave(unsigned long pfn); · 13 unmodified lines | |||
| 458 | int hibernate_quiet_exec(int (*func)(void *data), void *data); | 450 | int hibernate_quiet_exec(int (*func)(void *data), void *data); |
| 459 | #else /* CONFIG_HIBERNATION */ | 451 | #else /* CONFIG_HIBERNATION */ |
| 460 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} | 452 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} |
| 461 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} | ||
| 462 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } | 453 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } |
| 463 | static inline void swsusp_set_page_free(struct page *p) {} | 454 | static inline void swsusp_set_page_free(struct page *p) {} |
| 464 | static inline void swsusp_unset_page_free(struct page *p) {} | 455 | static inline void swsusp_unset_page_free(struct page *p) {} |
| @@ -265,7 +265,7 @@ static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * · 264 unmodified lines | |||
| 265 | return NULL; | 265 | return NULL; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | static inline struct sysctl_header *register_sysctl_mount_point(const char *path) | 268 | static inline struct ctl_table_header *register_sysctl_mount_point(const char *path) |
| 269 | { | 269 | { |
| 270 | return NULL; | 270 | return NULL; |
| 271 | } | 271 | } |
| @@ -91,6 +91,12 @@ fwnode_usb_role_switch_get(struct fwnode_handle *node) · 90 unmodified lines | |||
| 91 | 91 | ||
| 92 | static inline void usb_role_switch_put(struct usb_role_switch *sw) { } | 92 | static inline void usb_role_switch_put(struct usb_role_switch *sw) { } |
| 93 | 93 | ||
| 94 | static inline struct usb_role_switch * | ||
| 95 | usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode) | ||
| 96 | { | ||
| 97 | return NULL; | ||
| 98 | } | ||
| 99 | |||
| 94 | static inline struct usb_role_switch * | 100 | static inline struct usb_role_switch * |
| 95 | usb_role_switch_register(struct device *parent, | 101 | usb_role_switch_register(struct device *parent, |
| 96 | const struct usb_role_switch_desc *desc) | 102 | const struct usb_role_switch_desc *desc) |
| @@ -227,6 +227,7 @@ typedef struct ax25_dev { · 226 unmodified lines | |||
| 227 | #if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER) | 227 | #if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER) |
| 228 | ax25_dama_info dama; | 228 | ax25_dama_info dama; |
| 229 | #endif | 229 | #endif |
| 230 | refcount_t refcount; | ||
| 230 | } ax25_dev; | 231 | } ax25_dev; |
| 231 | 232 | ||
| 232 | typedef struct ax25_cb { | 233 | typedef struct ax25_cb { |
| @@ -281,6 +282,17 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25) · 48 unmodified lines | |||
| 281 | } | 282 | } |
| 282 | } | 283 | } |
| 283 | 284 | ||
| 285 | static inline void ax25_dev_hold(ax25_dev *ax25_dev) | ||
| 286 | { | ||
| 287 | refcount_inc(&ax25_dev->refcount); | ||
| 288 | } | ||
| 289 | |||
| 290 | static inline void ax25_dev_put(ax25_dev *ax25_dev) | ||
| 291 | { | ||
| 292 | if (refcount_dec_and_test(&ax25_dev->refcount)) { | ||
| 293 | kfree(ax25_dev); | ||
| 294 | } | ||
| 295 | } | ||
| 284 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) | 296 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) |
| 285 | { | 297 | { |
| 286 | skb->dev = dev; | 298 | skb->dev = dev; |
| @@ -350,7 +350,8 @@ static inline struct neighbour *neigh_create(struct neigh_table *tbl, · 349 unmodified lines | |||
| 350 | return __neigh_create(tbl, pkey, dev, true); | 350 | return __neigh_create(tbl, pkey, dev, true); |
| 351 | } | 351 | } |
| 352 | void neigh_destroy(struct neighbour *neigh); | 352 | void neigh_destroy(struct neighbour *neigh); |
| 353 | int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb); | 353 | int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb, |
| 354 | const bool immediate_ok); | ||
| 354 | int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags, | 355 | int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags, |
| 355 | u32 nlmsg_pid); | 356 | u32 nlmsg_pid); |
| 356 | void __neigh_set_probe_once(struct neighbour *neigh); | 357 | void __neigh_set_probe_once(struct neighbour *neigh); |
| @@ -460,17 +461,24 @@ static inline struct neighbour * neigh_clone(struct neighbour *neigh) · 103 unmodified lines | |||
| 460 | 461 | ||
| 461 | #define neigh_hold(n) refcount_inc(&(n)->refcnt) | 462 | #define neigh_hold(n) refcount_inc(&(n)->refcnt) |
| 462 | 463 | ||
| 463 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 464 | static __always_inline int neigh_event_send_probe(struct neighbour *neigh, |
| 465 | struct sk_buff *skb, | ||
| 466 | const bool immediate_ok) | ||
| 464 | { | 467 | { |
| 465 | unsigned long now = jiffies; | 468 | unsigned long now = jiffies; |
| 466 | 469 | ||
| 467 | if (READ_ONCE(neigh->used) != now) | 470 | if (READ_ONCE(neigh->used) != now) |
| 468 | WRITE_ONCE(neigh->used, now); | 471 | WRITE_ONCE(neigh->used, now); |
| 469 | if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE))) | 472 | if (!(neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE))) |
| 470 | return __neigh_event_send(neigh, skb); | 473 | return __neigh_event_send(neigh, skb, immediate_ok); |
| 471 | return 0; | 474 | return 0; |
| 472 | } | 475 | } |
| 473 | 476 | ||
| 477 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | ||
| 478 | { | ||
| 479 | return neigh_event_send_probe(neigh, skb, true); | ||
| 480 | } | ||
| 481 | |||
| 474 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) | 482 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 475 | static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) | 483 | static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) |
| 476 | { | 484 | { |
| @@ -23,8 +23,9 @@ · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | #undef __get_rel_dynamic_array | 24 | #undef __get_rel_dynamic_array |
| 25 | #define __get_rel_dynamic_array(field) \ | 25 | #define __get_rel_dynamic_array(field) \ |
| 26 | ((void *)(&__entry->__rel_loc_##field) + \ | 26 | ((void *)__entry + \ |
| 27 | sizeof(__entry->__rel_loc_##field) + \ | 27 | offsetof(typeof(*__entry), __rel_loc_##field) + \ |
| 28 | sizeof(__entry->__rel_loc_##field) + \ | ||
| 28 | (__entry->__rel_loc_##field & 0xffff)) | 29 | (__entry->__rel_loc_##field & 0xffff)) |
| 29 | 30 | ||
| 30 | #undef __get_rel_dynamic_array_len | 31 | #undef __get_rel_dynamic_array_len |
| @@ -128,7 +128,7 @@ TRACE_MAKE_SYSTEM_STR(); · 127 unmodified lines | |||
| 128 | struct trace_event_raw_##name { \ | 128 | struct trace_event_raw_##name { \ |
| 129 | struct trace_entry ent; \ | 129 | struct trace_entry ent; \ |
| 130 | tstruct \ | 130 | tstruct \ |
| 131 | char __data[0]; \ | 131 | char __data[]; \ |
| 132 | }; \ | 132 | }; \ |
| 133 | \ | 133 | \ |
| 134 | static struct trace_event_class event_class_##name; | 134 | static struct trace_event_class event_class_##name; |
| @@ -318,9 +318,10 @@ TRACE_MAKE_SYSTEM_STR(); · 183 unmodified lines | |||
| 318 | #define __get_str(field) ((char *)__get_dynamic_array(field)) | 318 | #define __get_str(field) ((char *)__get_dynamic_array(field)) |
| 319 | 319 | ||
| 320 | #undef __get_rel_dynamic_array | 320 | #undef __get_rel_dynamic_array |
| 321 | #define __get_rel_dynamic_array(field) \ | 321 | #define __get_rel_dynamic_array(field) \ |
| 322 | ((void *)(&__entry->__rel_loc_##field) + \ | 322 | ((void *)__entry + \ |
| 323 | sizeof(__entry->__rel_loc_##field) + \ | 323 | offsetof(typeof(*__entry), __rel_loc_##field) + \ |
| 324 | sizeof(__entry->__rel_loc_##field) + \ | ||
| 324 | (__entry->__rel_loc_##field & 0xffff)) | 325 | (__entry->__rel_loc_##field & 0xffff)) |
| 325 | 326 | ||
| 326 | #undef __get_rel_dynamic_array_len | 327 | #undef __get_rel_dynamic_array_len |
| @@ -0,0 +1,35 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | |||
| 3 | #ifndef _UAPI_LINUX_CYCLADES_H | ||
| 4 | #define _UAPI_LINUX_CYCLADES_H | ||
| 5 | |||
| 6 | #warning "Support for features provided by this header has been removed" | ||
| 7 | #warning "Please consider updating your code" | ||
| 8 | |||
| 9 | struct cyclades_monitor { | ||
| 10 | unsigned long int_count; | ||
| 11 | unsigned long char_count; | ||
| 12 | unsigned long char_max; | ||
| 13 | unsigned long char_last; | ||
| 14 | }; | ||
| 15 | |||
| 16 | #define CYGETMON 0x435901 | ||
| 17 | #define CYGETTHRESH 0x435902 | ||
| 18 | #define CYSETTHRESH 0x435903 | ||
| 19 | #define CYGETDEFTHRESH 0x435904 | ||
| 20 | #define CYSETDEFTHRESH 0x435905 | ||
| 21 | #define CYGETTIMEOUT 0x435906 | ||
| 22 | #define CYSETTIMEOUT 0x435907 | ||
| 23 | #define CYGETDEFTIMEOUT 0x435908 | ||
| 24 | #define CYSETDEFTIMEOUT 0x435909 | ||
| 25 | #define CYSETRFLOW 0x43590a | ||
| 26 | #define CYGETRFLOW 0x43590b | ||
| 27 | #define CYSETRTSDTR_INV 0x43590c | ||
| 28 | #define CYGETRTSDTR_INV 0x43590d | ||
| 29 | #define CYZSETPOLLCYCLE 0x43590e | ||
| 30 | #define CYZGETPOLLCYCLE 0x43590f | ||
| 31 | #define CYGETCD1400VER 0x435910 | ||
| 32 | #define CYSETWAIT 0x435912 | ||
| 33 | #define CYGETWAIT 0x435913 | ||
| 34 | |||
| 35 | #endif /* _UAPI_LINUX_CYCLADES_H */ | ||
| @@ -1133,6 +1133,7 @@ struct kvm_ppc_resize_hpt { · 1132 unmodified lines | |||
| 1133 | #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 | 1133 | #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 |
| 1134 | #define KVM_CAP_VM_GPA_BITS 207 | 1134 | #define KVM_CAP_VM_GPA_BITS 207 |
| 1135 | #define KVM_CAP_XSAVE2 208 | 1135 | #define KVM_CAP_XSAVE2 208 |
| 1136 | #define KVM_CAP_SYS_ATTRIBUTES 209 | ||
| 1136 | 1137 | ||
| 1137 | #ifdef KVM_CAP_IRQ_ROUTING | 1138 | #ifdef KVM_CAP_IRQ_ROUTING |
| 1138 | 1139 | ||
| @@ -84,12 +84,11 @@ struct smc_diag_conninfo { · 83 unmodified lines | |||
| 84 | /* SMC_DIAG_LINKINFO */ | 84 | /* SMC_DIAG_LINKINFO */ |
| 85 | 85 | ||
| 86 | struct smc_diag_linkinfo { | 86 | struct smc_diag_linkinfo { |
| 87 | __u8 link_id; /* link identifier */ | 87 | __u8 link_id; /* link identifier */ |
| 88 | __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ | 88 | __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ |
| 89 | __u8 ibport; /* RDMA device port number */ | 89 | __u8 ibport; /* RDMA device port number */ |
| 90 | __u8 gid[40]; /* local GID */ | 90 | __u8 gid[40]; /* local GID */ |
| 91 | __u8 peer_gid[40]; /* peer GID */ | 91 | __u8 peer_gid[40]; /* peer GID */ |
| 92 | __aligned_u64 net_cookie; /* RDMA device net namespace */ | ||
| 93 | }; | 92 | }; |
| 94 | 93 | ||
| 95 | struct smc_diag_lgrinfo { | 94 | struct smc_diag_lgrinfo { |
| @@ -205,9 +205,6 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data, · 204 unmodified lines | |||
| 205 | atomic_inc(&entry_count); | 205 | atomic_inc(&entry_count); |
| 206 | spin_unlock_irqrestore(&async_lock, flags); | 206 | spin_unlock_irqrestore(&async_lock, flags); |
| 207 | 207 | ||
| 208 | /* mark that this task has queued an async job, used by module init */ | ||
| 209 | current->flags |= PF_USED_ASYNC; | ||
| 210 | |||
| 211 | /* schedule for execution */ | 208 | /* schedule for execution */ |
| 212 | queue_work_node(node, system_unbound_wq, &entry->work); | 209 | queue_work_node(node, system_unbound_wq, &entry->work); |
| 213 | 210 | ||
| @@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk_buff *skb) · 540 unmodified lines | |||
| 541 | /** | 541 | /** |
| 542 | * kauditd_rehold_skb - Handle a audit record send failure in the hold queue | 542 | * kauditd_rehold_skb - Handle a audit record send failure in the hold queue |
| 543 | * @skb: audit record | 543 | * @skb: audit record |
| 544 | * @error: error code (unused) | ||
| 544 | * | 545 | * |
| 545 | * Description: | 546 | * Description: |
| 546 | * This should only be used by the kauditd_thread when it fails to flush the | 547 | * This should only be used by the kauditd_thread when it fails to flush the |
| 547 | * hold queue. | 548 | * hold queue. |
| 548 | */ | 549 | */ |
| 549 | static void kauditd_rehold_skb(struct sk_buff *skb) | 550 | static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error) |
| 550 | { | 551 | { |
| 551 | /* put the record back in the queue at the same place */ | 552 | /* put the record back in the queue */ |
| 552 | skb_queue_head(&audit_hold_queue, skb); | 553 | skb_queue_tail(&audit_hold_queue, skb); |
| 553 | } | 554 | } |
| 554 | 555 | ||
| 555 | /** | 556 | /** |
| 556 | * kauditd_hold_skb - Queue an audit record, waiting for auditd | 557 | * kauditd_hold_skb - Queue an audit record, waiting for auditd |
| 557 | * @skb: audit record | 558 | * @skb: audit record |
| 559 | * @error: error code | ||
| 558 | * | 560 | * |
| 559 | * Description: | 561 | * Description: |
| 560 | * Queue the audit record, waiting for an instance of auditd. When this | 562 | * Queue the audit record, waiting for an instance of auditd. When this |
| @@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb) · 3 unmodified lines | |||
| 564 | * and queue it, if we have room. If we want to hold on to the record, but we | 566 | * and queue it, if we have room. If we want to hold on to the record, but we |
| 565 | * don't have room, record a record lost message. | 567 | * don't have room, record a record lost message. |
| 566 | */ | 568 | */ |
| 567 | static void kauditd_hold_skb(struct sk_buff *skb) | 569 | static void kauditd_hold_skb(struct sk_buff *skb, int error) |
| 568 | { | 570 | { |
| 569 | /* at this point it is uncertain if we will ever send this to auditd so | 571 | /* at this point it is uncertain if we will ever send this to auditd so |
| 570 | * try to send the message via printk before we go any further */ | 572 | * try to send the message via printk before we go any further */ |
| 571 | kauditd_printk_skb(skb); | 573 | kauditd_printk_skb(skb); |
| 572 | 574 | ||
| 573 | /* can we just silently drop the message? */ | 575 | /* can we just silently drop the message? */ |
| 574 | if (!audit_default) { | 576 | if (!audit_default) |
| 575 | kfree_skb(skb); | 577 | goto drop; |
| 576 | return; | 578 | |
| 579 | /* the hold queue is only for when the daemon goes away completely, | ||
| 580 | * not -EAGAIN failures; if we are in a -EAGAIN state requeue the | ||
| 581 | * record on the retry queue unless it's full, in which case drop it | ||
| 582 | */ | ||
| 583 | if (error == -EAGAIN) { | ||
| 584 | if (!audit_backlog_limit || | ||
| 585 | skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { | ||
| 586 | skb_queue_tail(&audit_retry_queue, skb); | ||
| 587 | return; | ||
| 588 | } | ||
| 589 | audit_log_lost("kauditd retry queue overflow"); | ||
| 590 | goto drop; | ||
| 577 | } | 591 | } |
| 578 | 592 | ||
| 579 | /* if we have room, queue the message */ | 593 | /* if we have room in the hold queue, queue the message */ |
| 580 | if (!audit_backlog_limit || | 594 | if (!audit_backlog_limit || |
| 581 | skb_queue_len(&audit_hold_queue) < audit_backlog_limit) { | 595 | skb_queue_len(&audit_hold_queue) < audit_backlog_limit) { |
| 582 | skb_queue_tail(&audit_hold_queue, skb); | 596 | skb_queue_tail(&audit_hold_queue, skb); |
| @@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_buff *skb) · 2 unmodified lines | |||
| 585 | 599 | ||
| 586 | /* we have no other options - drop the message */ | 600 | /* we have no other options - drop the message */ |
| 587 | audit_log_lost("kauditd hold queue overflow"); | 601 | audit_log_lost("kauditd hold queue overflow"); |
| 602 | drop: | ||
| 588 | kfree_skb(skb); | 603 | kfree_skb(skb); |
| 589 | } | 604 | } |
| 590 | 605 | ||
| 591 | /** | 606 | /** |
| 592 | * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd | 607 | * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd |
| 593 | * @skb: audit record | 608 | * @skb: audit record |
| 609 | * @error: error code (unused) | ||
| 594 | * | 610 | * |
| 595 | * Description: | 611 | * Description: |
| 596 | * Not as serious as kauditd_hold_skb() as we still have a connected auditd, | 612 | * Not as serious as kauditd_hold_skb() as we still have a connected auditd, |
| 597 | * but for some reason we are having problems sending it audit records so | 613 | * but for some reason we are having problems sending it audit records so |
| 598 | * queue the given record and attempt to resend. | 614 | * queue the given record and attempt to resend. |
| 599 | */ | 615 | */ |
| 600 | static void kauditd_retry_skb(struct sk_buff *skb) | 616 | static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error) |
| 601 | { | 617 | { |
| 602 | /* NOTE: because records should only live in the retry queue for a | 618 | if (!audit_backlog_limit || |
| 603 | * short period of time, before either being sent or moved to the hold | 619 | skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { |
| 604 | * queue, we don't currently enforce a limit on this queue */ | 620 | skb_queue_tail(&audit_retry_queue, skb); |
| 605 | skb_queue_tail(&audit_retry_queue, skb); | 621 | return; |
| 622 | } | ||
| 623 | |||
| 624 | /* we have to drop the record, send it via printk as a last effort */ | ||
| 625 | kauditd_printk_skb(skb); | ||
| 626 | audit_log_lost("kauditd retry queue overflow"); | ||
| 627 | kfree_skb(skb); | ||
| 606 | } | 628 | } |
| 607 | 629 | ||
| 608 | /** | 630 | /** |
| @@ -640,7 +662,7 @@ static void auditd_reset(const struct auditd_connection *ac) · 31 unmodified lines | |||
| 640 | /* flush the retry queue to the hold queue, but don't touch the main | 662 | /* flush the retry queue to the hold queue, but don't touch the main |
| 641 | * queue since we need to process that normally for multicast */ | 663 | * queue since we need to process that normally for multicast */ |
| 642 | while ((skb = skb_dequeue(&audit_retry_queue))) | 664 | while ((skb = skb_dequeue(&audit_retry_queue))) |
| 643 | kauditd_hold_skb(skb); | 665 | kauditd_hold_skb(skb, -ECONNREFUSED); |
| 644 | } | 666 | } |
| 645 | 667 | ||
| 646 | /** | 668 | /** |
| @@ -714,16 +736,18 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 67 unmodified lines | |||
| 714 | struct sk_buff_head *queue, | 736 | struct sk_buff_head *queue, |
| 715 | unsigned int retry_limit, | 737 | unsigned int retry_limit, |
| 716 | void (*skb_hook)(struct sk_buff *skb), | 738 | void (*skb_hook)(struct sk_buff *skb), |
| 717 | void (*err_hook)(struct sk_buff *skb)) | 739 | void (*err_hook)(struct sk_buff *skb, int error)) |
| 718 | { | 740 | { |
| 719 | int rc = 0; | 741 | int rc = 0; |
| 720 | struct sk_buff *skb; | 742 | struct sk_buff *skb = NULL; |
| 743 | struct sk_buff *skb_tail; | ||
| 721 | unsigned int failed = 0; | 744 | unsigned int failed = 0; |
| 722 | 745 | ||
| 723 | /* NOTE: kauditd_thread takes care of all our locking, we just use | 746 | /* NOTE: kauditd_thread takes care of all our locking, we just use |
| 724 | * the netlink info passed to us (e.g. sk and portid) */ | 747 | * the netlink info passed to us (e.g. sk and portid) */ |
| 725 | 748 | ||
| 726 | while ((skb = skb_dequeue(queue))) { | 749 | skb_tail = skb_peek_tail(queue); |
| 750 | while ((skb != skb_tail) && (skb = skb_dequeue(queue))) { | ||
| 727 | /* call the skb_hook for each skb we touch */ | 751 | /* call the skb_hook for each skb we touch */ |
| 728 | if (skb_hook) | 752 | if (skb_hook) |
| 729 | (*skb_hook)(skb); | 753 | (*skb_hook)(skb); |
| @@ -731,7 +755,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 1 unmodified line | |||
| 731 | /* can we send to anyone via unicast? */ | 755 | /* can we send to anyone via unicast? */ |
| 732 | if (!sk) { | 756 | if (!sk) { |
| 733 | if (err_hook) | 757 | if (err_hook) |
| 734 | (*err_hook)(skb); | 758 | (*err_hook)(skb, -ECONNREFUSED); |
| 735 | continue; | 759 | continue; |
| 736 | } | 760 | } |
| 737 | 761 | ||
| @@ -745,7 +769,7 @@ retry: · 7 unmodified lines | |||
| 745 | rc == -ECONNREFUSED || rc == -EPERM) { | 769 | rc == -ECONNREFUSED || rc == -EPERM) { |
| 746 | sk = NULL; | 770 | sk = NULL; |
| 747 | if (err_hook) | 771 | if (err_hook) |
| 748 | (*err_hook)(skb); | 772 | (*err_hook)(skb, rc); |
| 749 | if (rc == -EAGAIN) | 773 | if (rc == -EAGAIN) |
| 750 | rc = 0; | 774 | rc = 0; |
| 751 | /* continue to drain the queue */ | 775 | /* continue to drain the queue */ |
| @@ -207,7 +207,7 @@ BTF_ID(func, bpf_lsm_socket_socketpair) · 206 unmodified lines | |||
| 207 | 207 | ||
| 208 | BTF_ID(func, bpf_lsm_syslog) | 208 | BTF_ID(func, bpf_lsm_syslog) |
| 209 | BTF_ID(func, bpf_lsm_task_alloc) | 209 | BTF_ID(func, bpf_lsm_task_alloc) |
| 210 | BTF_ID(func, bpf_lsm_task_getsecid_subj) | 210 | BTF_ID(func, bpf_lsm_current_getsecid_subj) |
| 211 | BTF_ID(func, bpf_lsm_task_getsecid_obj) | 211 | BTF_ID(func, bpf_lsm_task_getsecid_obj) |
| 212 | BTF_ID(func, bpf_lsm_task_prctl) | 212 | BTF_ID(func, bpf_lsm_task_prctl) |
| 213 | BTF_ID(func, bpf_lsm_task_setscheduler) | 213 | BTF_ID(func, bpf_lsm_task_setscheduler) |
| @@ -104,7 +104,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node) · 103 unmodified lines | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages, | 106 | rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages, |
| 107 | VM_ALLOC | VM_USERMAP, PAGE_KERNEL); | 107 | VM_MAP | VM_USERMAP, PAGE_KERNEL); |
| 108 | if (rb) { | 108 | if (rb) { |
| 109 | kmemleak_not_leak(pages); | 109 | kmemleak_not_leak(pages); |
| 110 | rb->pages = pages; | 110 | rb->pages = pages; |
| @@ -550,11 +550,12 @@ static __always_inline u64 notrace bpf_prog_start_time(void) · 549 unmodified lines | |||
| 550 | static void notrace inc_misses_counter(struct bpf_prog *prog) | 550 | static void notrace inc_misses_counter(struct bpf_prog *prog) |
| 551 | { | 551 | { |
| 552 | struct bpf_prog_stats *stats; | 552 | struct bpf_prog_stats *stats; |
| 553 | unsigned int flags; | ||
| 553 | 554 | ||
| 554 | stats = this_cpu_ptr(prog->stats); | 555 | stats = this_cpu_ptr(prog->stats); |
| 555 | u64_stats_update_begin(&stats->syncp); | 556 | flags = u64_stats_update_begin_irqsave(&stats->syncp); |
| 556 | u64_stats_inc(&stats->misses); | 557 | u64_stats_inc(&stats->misses); |
| 557 | u64_stats_update_end(&stats->syncp); | 558 | u64_stats_update_end_irqrestore(&stats->syncp, flags); |
| 558 | } | 559 | } |
| 559 | 560 | ||
| 560 | /* The logic is similar to bpf_prog_run(), but with an explicit | 561 | /* The logic is similar to bpf_prog_run(), but with an explicit |
| @@ -549,6 +549,14 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 548 unmodified lines | |||
| 549 | 549 | ||
| 550 | BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); | 550 | BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); |
| 551 | 551 | ||
| 552 | /* | ||
| 553 | * Release agent gets called with all capabilities, | ||
| 554 | * require capabilities to set release agent. | ||
| 555 | */ | ||
| 556 | if ((of->file->f_cred->user_ns != &init_user_ns) || | ||
| 557 | !capable(CAP_SYS_ADMIN)) | ||
| 558 | return -EPERM; | ||
| 559 | |||
| 552 | cgrp = cgroup_kn_lock_live(of->kn, false); | 560 | cgrp = cgroup_kn_lock_live(of->kn, false); |
| 553 | if (!cgrp) | 561 | if (!cgrp) |
| 554 | return -ENODEV; | 562 | return -ENODEV; |
| @@ -954,6 +962,12 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) · 399 unmodified lines | |||
| 954 | /* Specifying two release agents is forbidden */ | 962 | /* Specifying two release agents is forbidden */ |
| 955 | if (ctx->release_agent) | 963 | if (ctx->release_agent) |
| 956 | return invalfc(fc, "release_agent respecified"); | 964 | return invalfc(fc, "release_agent respecified"); |
| 965 | /* | ||
| 966 | * Release agent gets called with all capabilities, | ||
| 967 | * require capabilities to set release agent. | ||
| 968 | */ | ||
| 969 | if ((fc->user_ns != &init_user_ns) || !capable(CAP_SYS_ADMIN)) | ||
| 970 | return invalfc(fc, "Setting release_agent not allowed"); | ||
| 957 | ctx->release_agent = param->string; | 971 | ctx->release_agent = param->string; |
| 958 | param->string = NULL; | 972 | param->string = NULL; |
| 959 | break; | 973 | break; |
| @@ -590,6 +590,35 @@ static inline void free_cpuset(struct cpuset *cs) · 589 unmodified lines | |||
| 590 | kfree(cs); | 590 | kfree(cs); |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | /* | ||
| 594 | * validate_change_legacy() - Validate conditions specific to legacy (v1) | ||
| 595 | * behavior. | ||
| 596 | */ | ||
| 597 | static int validate_change_legacy(struct cpuset *cur, struct cpuset *trial) | ||
| 598 | { | ||
| 599 | struct cgroup_subsys_state *css; | ||
| 600 | struct cpuset *c, *par; | ||
| 601 | int ret; | ||
| 602 | |||
| 603 | WARN_ON_ONCE(!rcu_read_lock_held()); | ||
| 604 | |||
| 605 | /* Each of our child cpusets must be a subset of us */ | ||
| 606 | ret = -EBUSY; | ||
| 607 | cpuset_for_each_child(c, css, cur) | ||
| 608 | if (!is_cpuset_subset(c, trial)) | ||
| 609 | goto out; | ||
| 610 | |||
| 611 | /* On legacy hierarchy, we must be a subset of our parent cpuset. */ | ||
| 612 | ret = -EACCES; | ||
| 613 | par = parent_cs(cur); | ||
| 614 | if (par && !is_cpuset_subset(trial, par)) | ||
| 615 | goto out; | ||
| 616 | |||
| 617 | ret = 0; | ||
| 618 | out: | ||
| 619 | return ret; | ||
| 620 | } | ||
| 621 | |||
| 593 | /* | 622 | /* |
| 594 | * validate_change() - Used to validate that any proposed cpuset change | 623 | * validate_change() - Used to validate that any proposed cpuset change |
| 595 | * follows the structural rules for cpusets. | 624 | * follows the structural rules for cpusets. |
| @@ -614,20 +643,21 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial) · 18 unmodified lines | |||
| 614 | { | 643 | { |
| 615 | struct cgroup_subsys_state *css; | 644 | struct cgroup_subsys_state *css; |
| 616 | struct cpuset *c, *par; | 645 | struct cpuset *c, *par; |
| 617 | int ret; | 646 | int ret = 0; |
| 618 | |||
| 619 | /* The checks don't apply to root cpuset */ | ||
| 620 | if (cur == &top_cpuset) | ||
| 621 | return 0; | ||
| 622 | 647 | ||
| 623 | rcu_read_lock(); | 648 | rcu_read_lock(); |
| 624 | par = parent_cs(cur); | ||
| 625 | 649 | ||
| 626 | /* On legacy hierarchy, we must be a subset of our parent cpuset. */ | 650 | if (!is_in_v2_mode()) |
| 627 | ret = -EACCES; | 651 | ret = validate_change_legacy(cur, trial); |
| 628 | if (!is_in_v2_mode() && !is_cpuset_subset(trial, par)) | 652 | if (ret) |
| 653 | goto out; | ||
| 654 | |||
| 655 | /* Remaining checks don't apply to root cpuset */ | ||
| 656 | if (cur == &top_cpuset) | ||
| 629 | goto out; | 657 | goto out; |
| 630 | 658 | ||
| 659 | par = parent_cs(cur); | ||
| 660 | |||
| 631 | /* | 661 | /* |
| 632 | * If either I or some sibling (!= me) is exclusive, we can't | 662 | * If either I or some sibling (!= me) is exclusive, we can't |
| 633 | * overlap | 663 | * overlap |
| @@ -1175,9 +1205,7 @@ enum subparts_cmd { · 541 unmodified lines | |||
| 1175 | * | 1205 | * |
| 1176 | * Because of the implicit cpu exclusive nature of a partition root, | 1206 | * Because of the implicit cpu exclusive nature of a partition root, |
| 1177 | * cpumask changes that violates the cpu exclusivity rule will not be | 1207 | * cpumask changes that violates the cpu exclusivity rule will not be |
| 1178 | * permitted when checked by validate_change(). The validate_change() | 1208 | * permitted when checked by validate_change(). |
| 1179 | * function will also prevent any changes to the cpu list if it is not | ||
| 1180 | * a superset of children's cpu lists. | ||
| 1181 | */ | 1209 | */ |
| 1182 | static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, | 1210 | static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, |
| 1183 | struct cpumask *newmask, | 1211 | struct cpumask *newmask, |
| @@ -1522,10 +1550,15 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 338 unmodified lines | |||
| 1522 | struct cpuset *sibling; | 1550 | struct cpuset *sibling; |
| 1523 | struct cgroup_subsys_state *pos_css; | 1551 | struct cgroup_subsys_state *pos_css; |
| 1524 | 1552 | ||
| 1553 | percpu_rwsem_assert_held(&cpuset_rwsem); | ||
| 1554 | |||
| 1525 | /* | 1555 | /* |
| 1526 | * Check all its siblings and call update_cpumasks_hier() | 1556 | * Check all its siblings and call update_cpumasks_hier() |
| 1527 | * if their use_parent_ecpus flag is set in order for them | 1557 | * if their use_parent_ecpus flag is set in order for them |
| 1528 | * to use the right effective_cpus value. | 1558 | * to use the right effective_cpus value. |
| 1559 | * | ||
| 1560 | * The update_cpumasks_hier() function may sleep. So we have to | ||
| 1561 | * release the RCU read lock before calling it. | ||
| 1529 | */ | 1562 | */ |
| 1530 | rcu_read_lock(); | 1563 | rcu_read_lock(); |
| 1531 | cpuset_for_each_child(sibling, pos_css, parent) { | 1564 | cpuset_for_each_child(sibling, pos_css, parent) { |
| @@ -1533,8 +1566,13 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 1 unmodified line | |||
| 1533 | continue; | 1566 | continue; |
| 1534 | if (!sibling->use_parent_ecpus) | 1567 | if (!sibling->use_parent_ecpus) |
| 1535 | continue; | 1568 | continue; |
| 1569 | if (!css_tryget_online(&sibling->css)) | ||
| 1570 | continue; | ||
| 1536 | 1571 | ||
| 1572 | rcu_read_unlock(); | ||
| 1537 | update_cpumasks_hier(sibling, tmp); | 1573 | update_cpumasks_hier(sibling, tmp); |
| 1574 | rcu_read_lock(); | ||
| 1575 | css_put(&sibling->css); | ||
| 1538 | } | 1576 | } |
| 1539 | rcu_read_unlock(); | 1577 | rcu_read_unlock(); |
| 1540 | } | 1578 | } |
| @@ -1607,8 +1645,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, · 66 unmodified lines | |||
| 1607 | * Make sure that subparts_cpus is a subset of cpus_allowed. | 1645 | * Make sure that subparts_cpus is a subset of cpus_allowed. |
| 1608 | */ | 1646 | */ |
| 1609 | if (cs->nr_subparts_cpus) { | 1647 | if (cs->nr_subparts_cpus) { |
| 1610 | cpumask_andnot(cs->subparts_cpus, cs->subparts_cpus, | 1648 | cpumask_and(cs->subparts_cpus, cs->subparts_cpus, cs->cpus_allowed); |
| 1611 | cs->cpus_allowed); | ||
| 1612 | cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus); | 1649 | cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus); |
| 1613 | } | 1650 | } |
| 1614 | spin_unlock_irq(&callback_lock); | 1651 | spin_unlock_irq(&callback_lock); |
| @@ -2462,7 +2462,11 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla · 2461 unmodified lines | |||
| 2462 | * event_function_call() user. | 2462 | * event_function_call() user. |
| 2463 | */ | 2463 | */ |
| 2464 | raw_spin_lock_irq(&ctx->lock); | 2464 | raw_spin_lock_irq(&ctx->lock); |
| 2465 | if (!ctx->is_active) { | 2465 | /* |
| 2466 | * Cgroup events are per-cpu events, and must IPI because of | ||
| 2467 | * cgrp_cpuctx_list. | ||
| 2468 | */ | ||
| 2469 | if (!ctx->is_active && !is_cgroup_event(event)) { | ||
| 2466 | __perf_remove_from_context(event, __get_cpu_context(ctx), | 2470 | __perf_remove_from_context(event, __get_cpu_context(ctx), |
| 2467 | ctx, (void *)flags); | 2471 | ctx, (void *)flags); |
| 2468 | raw_spin_unlock_irq(&ctx->lock); | 2472 | raw_spin_unlock_irq(&ctx->lock); |
| @@ -2895,11 +2899,14 @@ perf_install_in_context(struct perf_event_context *ctx, · 426 unmodified lines | |||
| 2895 | * perf_event_attr::disabled events will not run and can be initialized | 2899 | * perf_event_attr::disabled events will not run and can be initialized |
| 2896 | * without IPI. Except when this is the first event for the context, in | 2900 | * without IPI. Except when this is the first event for the context, in |
| 2897 | * that case we need the magic of the IPI to set ctx->is_active. | 2901 | * that case we need the magic of the IPI to set ctx->is_active. |
| 2902 | * Similarly, cgroup events for the context also needs the IPI to | ||
| 2903 | * manipulate the cgrp_cpuctx_list. | ||
| 2898 | * | 2904 | * |
| 2899 | * The IOC_ENABLE that is sure to follow the creation of a disabled | 2905 | * The IOC_ENABLE that is sure to follow the creation of a disabled |
| 2900 | * event will issue the IPI and reprogram the hardware. | 2906 | * event will issue the IPI and reprogram the hardware. |
| 2901 | */ | 2907 | */ |
| 2902 | if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) { | 2908 | if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && |
| 2909 | ctx->nr_events && !is_cgroup_event(event)) { | ||
| 2903 | raw_spin_lock_irq(&ctx->lock); | 2910 | raw_spin_lock_irq(&ctx->lock); |
| 2904 | if (ctx->task == TASK_TOMBSTONE) { | 2911 | if (ctx->task == TASK_TOMBSTONE) { |
| 2905 | raw_spin_unlock_irq(&ctx->lock); | 2912 | raw_spin_unlock_irq(&ctx->lock); |
| @@ -5985,6 +5992,8 @@ static void ring_buffer_attach(struct perf_event *event, · 3079 unmodified lines | |||
| 5985 | struct perf_buffer *old_rb = NULL; | 5992 | struct perf_buffer *old_rb = NULL; |
| 5986 | unsigned long flags; | 5993 | unsigned long flags; |
| 5987 | 5994 | ||
| 5995 | WARN_ON_ONCE(event->parent); | ||
| 5996 | |||
| 5988 | if (event->rb) { | 5997 | if (event->rb) { |
| 5989 | /* | 5998 | /* |
| 5990 | * Should be impossible, we set this when removing | 5999 | * Should be impossible, we set this when removing |
| @@ -6042,6 +6051,9 @@ static void ring_buffer_wakeup(struct perf_event *event) · 51 unmodified lines | |||
| 6042 | { | 6051 | { |
| 6043 | struct perf_buffer *rb; | 6052 | struct perf_buffer *rb; |
| 6044 | 6053 | ||
| 6054 | if (event->parent) | ||
| 6055 | event = event->parent; | ||
| 6056 | |||
| 6045 | rcu_read_lock(); | 6057 | rcu_read_lock(); |
| 6046 | rb = rcu_dereference(event->rb); | 6058 | rb = rcu_dereference(event->rb); |
| 6047 | if (rb) { | 6059 | if (rb) { |
| @@ -6055,6 +6067,9 @@ struct perf_buffer *ring_buffer_get(struct perf_event *event) · 7 unmodified lines | |||
| 6055 | { | 6067 | { |
| 6056 | struct perf_buffer *rb; | 6068 | struct perf_buffer *rb; |
| 6057 | 6069 | ||
| 6070 | if (event->parent) | ||
| 6071 | event = event->parent; | ||
| 6072 | |||
| 6058 | rcu_read_lock(); | 6073 | rcu_read_lock(); |
| 6059 | rb = rcu_dereference(event->rb); | 6074 | rb = rcu_dereference(event->rb); |
| 6060 | if (rb) { | 6075 | if (rb) { |
| @@ -6763,7 +6778,7 @@ static unsigned long perf_prepare_sample_aux(struct perf_event *event, · 702 unmodified lines | |||
| 6763 | if (WARN_ON_ONCE(READ_ONCE(sampler->oncpu) != smp_processor_id())) | 6778 | if (WARN_ON_ONCE(READ_ONCE(sampler->oncpu) != smp_processor_id())) |
| 6764 | goto out; | 6779 | goto out; |
| 6765 | 6780 | ||
| 6766 | rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler); | 6781 | rb = ring_buffer_get(sampler); |
| 6767 | if (!rb) | 6782 | if (!rb) |
| 6768 | goto out; | 6783 | goto out; |
| 6769 | 6784 | ||
| @@ -6829,7 +6844,7 @@ static void perf_aux_sample_output(struct perf_event *event, · 59 unmodified lines | |||
| 6829 | if (WARN_ON_ONCE(!sampler || !data->aux_size)) | 6844 | if (WARN_ON_ONCE(!sampler || !data->aux_size)) |
| 6830 | return; | 6845 | return; |
| 6831 | 6846 | ||
| 6832 | rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler); | 6847 | rb = ring_buffer_get(sampler); |
| 6833 | if (!rb) | 6848 | if (!rb) |
| 6834 | return; | 6849 | return; |
| 6835 | 6850 | ||
| @@ -3725,12 +3725,6 @@ static noinline int do_init_module(struct module *mod) · 3724 unmodified lines | |||
| 3725 | } | 3725 | } |
| 3726 | freeinit->module_init = mod->init_layout.base; | 3726 | freeinit->module_init = mod->init_layout.base; |
| 3727 | 3727 | ||
| 3728 | /* | ||
| 3729 | * We want to find out whether @mod uses async during init. Clear | ||
| 3730 | * PF_USED_ASYNC. async_schedule*() will set it. | ||
| 3731 | */ | ||
| 3732 | current->flags &= ~PF_USED_ASYNC; | ||
| 3733 | |||
| 3734 | do_mod_ctors(mod); | 3728 | do_mod_ctors(mod); |
| 3735 | /* Start the module */ | 3729 | /* Start the module */ |
| 3736 | if (mod->init != NULL) | 3730 | if (mod->init != NULL) |
| @@ -3756,22 +3750,13 @@ static noinline int do_init_module(struct module *mod) · 19 unmodified lines | |||
| 3756 | 3750 | ||
| 3757 | /* | 3751 | /* |
| 3758 | * We need to finish all async code before the module init sequence | 3752 | * We need to finish all async code before the module init sequence |
| 3759 | * is done. This has potential to deadlock. For example, a newly | 3753 | * is done. This has potential to deadlock if synchronous module |
| 3760 | * detected block device can trigger request_module() of the | 3754 | * loading is requested from async (which is not allowed!). |
| 3761 | * default iosched from async probing task. Once userland helper | ||
| 3762 | * reaches here, async_synchronize_full() will wait on the async | ||
| 3763 | * task waiting on request_module() and deadlock. | ||
| 3764 | * | ||
| 3765 | * This deadlock is avoided by perfomring async_synchronize_full() | ||
| 3766 | * iff module init queued any async jobs. This isn't a full | ||
| 3767 | * solution as it will deadlock the same if module loading from | ||
| 3768 | * async jobs nests more than once; however, due to the various | ||
| 3769 | * constraints, this hack seems to be the best option for now. | ||
| 3770 | * Please refer to the following thread for details. | ||
| 3771 | * | 3755 | * |
| 3772 | * http://thread.gmane.org/gmane.linux.kernel/1420814 | 3756 | * See commit 0fdff3ec6d87 ("async, kmod: warn on synchronous |
| 3757 | * request_module() from async workers") for more details. | ||
| 3773 | */ | 3758 | */ |
| 3774 | if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC)) | 3759 | if (!mod->async_probe_requested) |
| 3775 | async_synchronize_full(); | 3760 | async_synchronize_full(); |
| 3776 | 3761 | ||
| 3777 | ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base + | 3762 | ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base + |
| @@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm) · 977 unmodified lines | |||
| 978 | * Register a range of page frames the contents of which should not be saved | 978 | * Register a range of page frames the contents of which should not be saved |
| 979 | * during hibernation (to be used in the early initialization code). | 979 | * during hibernation (to be used in the early initialization code). |
| 980 | */ | 980 | */ |
| 981 | void __init __register_nosave_region(unsigned long start_pfn, | 981 | void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) |
| 982 | unsigned long end_pfn, int use_kmalloc) | ||
| 983 | { | 982 | { |
| 984 | struct nosave_region *region; | 983 | struct nosave_region *region; |
| 985 | 984 | ||
| @@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long start_pfn, · 9 unmodified lines | |||
| 995 | goto Report; | 994 | goto Report; |
| 996 | } | 995 | } |
| 997 | } | 996 | } |
| 998 | if (use_kmalloc) { | 997 | /* This allocation cannot fail */ |
| 999 | /* During init, this shouldn't fail */ | 998 | region = memblock_alloc(sizeof(struct nosave_region), |
| 1000 | region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL); | 999 | SMP_CACHE_BYTES); |
| 1001 | BUG_ON(!region); | 1000 | if (!region) |
| 1002 | } else { | 1001 | panic("%s: Failed to allocate %zu bytes\n", __func__, |
| 1003 | /* This allocation cannot fail */ | 1002 | sizeof(struct nosave_region)); |
| 1004 | region = memblock_alloc(sizeof(struct nosave_region), | ||
| 1005 | SMP_CACHE_BYTES); | ||
| 1006 | if (!region) | ||
| 1007 | panic("%s: Failed to allocate %zu bytes\n", __func__, | ||
| 1008 | sizeof(struct nosave_region)); | ||
| 1009 | } | ||
| 1010 | region->start_pfn = start_pfn; | 1003 | region->start_pfn = start_pfn; |
| 1011 | region->end_pfn = end_pfn; | 1004 | region->end_pfn = end_pfn; |
| 1012 | list_add_tail(®ion->list, &nosave_regions); | 1005 | list_add_tail(®ion->list, &nosave_regions); |
| @@ -39,23 +39,20 @@ ssize_t pm_show_wakelocks(char *buf, bool show_active) · 38 unmodified lines | |||
| 39 | { | 39 | { |
| 40 | struct rb_node *node; | 40 | struct rb_node *node; |
| 41 | struct wakelock *wl; | 41 | struct wakelock *wl; |
| 42 | char *str = buf; | 42 | int len = 0; |
| 43 | char *end = buf + PAGE_SIZE; | ||
| 44 | 43 | ||
| 45 | mutex_lock(&wakelocks_lock); | 44 | mutex_lock(&wakelocks_lock); |
| 46 | 45 | ||
| 47 | for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) { | 46 | for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) { |
| 48 | wl = rb_entry(node, struct wakelock, node); | 47 | wl = rb_entry(node, struct wakelock, node); |
| 49 | if (wl->ws->active == show_active) | 48 | if (wl->ws->active == show_active) |
| 50 | str += scnprintf(str, end - str, "%s ", wl->name); | 49 | len += sysfs_emit_at(buf, len, "%s ", wl->name); |
| 51 | } | 50 | } |
| 52 | if (str > buf) | ||
| 53 | str--; | ||
| 54 | 51 | ||
| 55 | str += scnprintf(str, end - str, "\n"); | 52 | len += sysfs_emit_at(buf, len, "\n"); |
| 56 | 53 | ||
| 57 | mutex_unlock(&wakelocks_lock); | 54 | mutex_unlock(&wakelocks_lock); |
| 58 | return (str - buf); | 55 | return len; |
| 59 | } | 56 | } |
| 60 | 57 | ||
| 61 | #if CONFIG_PM_WAKELOCKS_LIMIT > 0 | 58 | #if CONFIG_PM_WAKELOCKS_LIMIT > 0 |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | |||
| 12 | static const int ten_thousand = 10000; | 12 | static const int ten_thousand = 10000; |
| 13 | 13 | ||
| 14 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, | 14 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
| 15 | void __user *buffer, size_t *lenp, loff_t *ppos) | 15 | void *buffer, size_t *lenp, loff_t *ppos) |
| 16 | { | 16 | { |
| 17 | if (write && !capable(CAP_SYS_ADMIN)) | 17 | if (write && !capable(CAP_SYS_ADMIN)) |
| 18 | return -EPERM; | 18 | return -EPERM; |
| @@ -123,7 +123,7 @@ static struct rcu_tasks rt_name = \ · 122 unmodified lines | |||
| 123 | .call_func = call, \ | 123 | .call_func = call, \ |
| 124 | .rtpcpu = &rt_name ## __percpu, \ | 124 | .rtpcpu = &rt_name ## __percpu, \ |
| 125 | .name = n, \ | 125 | .name = n, \ |
| 126 | .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS), \ | 126 | .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS) + 1, \ |
| 127 | .percpu_enqueue_lim = 1, \ | 127 | .percpu_enqueue_lim = 1, \ |
| 128 | .percpu_dequeue_lim = 1, \ | 128 | .percpu_dequeue_lim = 1, \ |
| 129 | .barrier_q_mutex = __MUTEX_INITIALIZER(rt_name.barrier_q_mutex), \ | 129 | .barrier_q_mutex = __MUTEX_INITIALIZER(rt_name.barrier_q_mutex), \ |
| @@ -216,6 +216,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 86 unmodified lines | |||
| 216 | int cpu; | 216 | int cpu; |
| 217 | unsigned long flags; | 217 | unsigned long flags; |
| 218 | int lim; | 218 | int lim; |
| 219 | int shift; | ||
| 219 | 220 | ||
| 220 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); | 221 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 221 | if (rcu_task_enqueue_lim < 0) { | 222 | if (rcu_task_enqueue_lim < 0) { |
| @@ -229,7 +230,10 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 7 unmodified lines | |||
| 229 | 230 | ||
| 230 | if (lim > nr_cpu_ids) | 231 | if (lim > nr_cpu_ids) |
| 231 | lim = nr_cpu_ids; | 232 | lim = nr_cpu_ids; |
| 232 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids / lim)); | 233 | shift = ilog2(nr_cpu_ids / lim); |
| 234 | if (((nr_cpu_ids - 1) >> shift) >= lim) | ||
| 235 | shift++; | ||
| 236 | WRITE_ONCE(rtp->percpu_enqueue_shift, shift); | ||
| 233 | WRITE_ONCE(rtp->percpu_dequeue_lim, lim); | 237 | WRITE_ONCE(rtp->percpu_dequeue_lim, lim); |
| 234 | smp_store_release(&rtp->percpu_enqueue_lim, lim); | 238 | smp_store_release(&rtp->percpu_enqueue_lim, lim); |
| 235 | for_each_possible_cpu(cpu) { | 239 | for_each_possible_cpu(cpu) { |
| @@ -298,7 +302,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func, · 62 unmodified lines | |||
| 298 | if (unlikely(needadjust)) { | 302 | if (unlikely(needadjust)) { |
| 299 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); | 303 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 300 | if (rtp->percpu_enqueue_lim != nr_cpu_ids) { | 304 | if (rtp->percpu_enqueue_lim != nr_cpu_ids) { |
| 301 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids)); | 305 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1); |
| 302 | WRITE_ONCE(rtp->percpu_dequeue_lim, nr_cpu_ids); | 306 | WRITE_ONCE(rtp->percpu_dequeue_lim, nr_cpu_ids); |
| 303 | smp_store_release(&rtp->percpu_enqueue_lim, nr_cpu_ids); | 307 | smp_store_release(&rtp->percpu_enqueue_lim, nr_cpu_ids); |
| 304 | pr_info("Switching %s to per-CPU callback queuing.\n", rtp->name); | 308 | pr_info("Switching %s to per-CPU callback queuing.\n", rtp->name); |
| @@ -413,7 +417,7 @@ static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp) · 108 unmodified lines | |||
| 413 | if (rcu_task_cb_adjust && ncbs <= rcu_task_collapse_lim) { | 417 | if (rcu_task_cb_adjust && ncbs <= rcu_task_collapse_lim) { |
| 414 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); | 418 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 415 | if (rtp->percpu_enqueue_lim > 1) { | 419 | if (rtp->percpu_enqueue_lim > 1) { |
| 416 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids)); | 420 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1); |
| 417 | smp_store_release(&rtp->percpu_enqueue_lim, 1); | 421 | smp_store_release(&rtp->percpu_enqueue_lim, 1); |
| 418 | rtp->percpu_dequeue_gpseq = get_state_synchronize_rcu(); | 422 | rtp->percpu_dequeue_gpseq = get_state_synchronize_rcu(); |
| 419 | pr_info("Starting switch %s to CPU-0 callback queuing.\n", rtp->name); | 423 | pr_info("Starting switch %s to CPU-0 callback queuing.\n", rtp->name); |
| @@ -147,11 +147,11 @@ · 146 unmodified lines | |||
| 147 | #endif | 147 | #endif |
| 148 | 148 | ||
| 149 | #ifdef CONFIG_RSEQ | 149 | #ifdef CONFIG_RSEQ |
| 150 | #define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK \ | 150 | #define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK \ |
| 151 | (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \ | 151 | (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \ |
| 152 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ_BITMASK) | 152 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ) |
| 153 | #else | 153 | #else |
| 154 | #define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 | 154 | #define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 |
| 155 | #endif | 155 | #endif |
| 156 | 156 | ||
| 157 | #define MEMBARRIER_CMD_BITMASK \ | 157 | #define MEMBARRIER_CMD_BITMASK \ |
| @@ -159,7 +159,8 @@ · 1 unmodified line | |||
| 159 | | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \ | 159 | | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \ |
| 160 | | MEMBARRIER_CMD_PRIVATE_EXPEDITED \ | 160 | | MEMBARRIER_CMD_PRIVATE_EXPEDITED \ |
| 161 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ | 161 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ |
| 162 | | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK) | 162 | | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK \ |
| 163 | | MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK) | ||
| 163 | 164 | ||
| 164 | static void ipi_mb(void *info) | 165 | static void ipi_mb(void *info) |
| 165 | { | 166 | { |
| @@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) · 1081 unmodified lines | |||
| 1082 | return 0; | 1082 | return 0; |
| 1083 | } | 1083 | } |
| 1084 | 1084 | ||
| 1085 | static int psi_io_show(struct seq_file *m, void *v) | ||
| 1086 | { | ||
| 1087 | return psi_show(m, &psi_system, PSI_IO); | ||
| 1088 | } | ||
| 1089 | |||
| 1090 | static int psi_memory_show(struct seq_file *m, void *v) | ||
| 1091 | { | ||
| 1092 | return psi_show(m, &psi_system, PSI_MEM); | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | static int psi_cpu_show(struct seq_file *m, void *v) | ||
| 1096 | { | ||
| 1097 | return psi_show(m, &psi_system, PSI_CPU); | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) | ||
| 1101 | { | ||
| 1102 | if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) | ||
| 1103 | return -EPERM; | ||
| 1104 | |||
| 1105 | return single_open(file, psi_show, NULL); | ||
| 1106 | } | ||
| 1107 | |||
| 1108 | static int psi_io_open(struct inode *inode, struct file *file) | ||
| 1109 | { | ||
| 1110 | return psi_open(file, psi_io_show); | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | static int psi_memory_open(struct inode *inode, struct file *file) | ||
| 1114 | { | ||
| 1115 | return psi_open(file, psi_memory_show); | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | static int psi_cpu_open(struct inode *inode, struct file *file) | ||
| 1119 | { | ||
| 1120 | return psi_open(file, psi_cpu_show); | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | struct psi_trigger *psi_trigger_create(struct psi_group *group, | 1085 | struct psi_trigger *psi_trigger_create(struct psi_group *group, |
| 1124 | char *buf, size_t nbytes, enum psi_res res) | 1086 | char *buf, size_t nbytes, enum psi_res res) |
| 1125 | { | 1087 | { |
| @@ -1278,6 +1240,45 @@ __poll_t psi_trigger_poll(void **trigger_ptr, · 152 unmodified lines | |||
| 1278 | return ret; | 1240 | return ret; |
| 1279 | } | 1241 | } |
| 1280 | 1242 | ||
| 1243 | #ifdef CONFIG_PROC_FS | ||
| 1244 | static int psi_io_show(struct seq_file *m, void *v) | ||
| 1245 | { | ||
| 1246 | return psi_show(m, &psi_system, PSI_IO); | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | static int psi_memory_show(struct seq_file *m, void *v) | ||
| 1250 | { | ||
| 1251 | return psi_show(m, &psi_system, PSI_MEM); | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | static int psi_cpu_show(struct seq_file *m, void *v) | ||
| 1255 | { | ||
| 1256 | return psi_show(m, &psi_system, PSI_CPU); | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) | ||
| 1260 | { | ||
| 1261 | if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) | ||
| 1262 | return -EPERM; | ||
| 1263 | |||
| 1264 | return single_open(file, psi_show, NULL); | ||
| 1265 | } | ||
| 1266 | |||
| 1267 | static int psi_io_open(struct inode *inode, struct file *file) | ||
| 1268 | { | ||
| 1269 | return psi_open(file, psi_io_show); | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | static int psi_memory_open(struct inode *inode, struct file *file) | ||
| 1273 | { | ||
| 1274 | return psi_open(file, psi_memory_show); | ||
| 1275 | } | ||
| 1276 | |||
| 1277 | static int psi_cpu_open(struct inode *inode, struct file *file) | ||
| 1278 | { | ||
| 1279 | return psi_open(file, psi_cpu_show); | ||
| 1280 | } | ||
| 1281 | |||
| 1281 | static ssize_t psi_write(struct file *file, const char __user *user_buf, | 1282 | static ssize_t psi_write(struct file *file, const char __user *user_buf, |
| 1282 | size_t nbytes, enum psi_res res) | 1283 | size_t nbytes, enum psi_res res) |
| 1283 | { | 1284 | { |
| @@ -1392,3 +1393,5 @@ static int __init psi_proc_init(void) · 108 unmodified lines | |||
| 1392 | return 0; | 1393 | return 0; |
| 1393 | } | 1394 | } |
| 1394 | module_init(psi_proc_init); | 1395 | module_init(psi_proc_init); |
| 1396 | |||
| 1397 | #endif /* CONFIG_PROC_FS */ | ||
| @@ -70,7 +70,7 @@ late_initcall(stackleak_sysctls_init); · 69 unmodified lines | |||
| 70 | #define skip_erasing() false | 70 | #define skip_erasing() false |
| 71 | #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */ | 71 | #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */ |
| 72 | 72 | ||
| 73 | asmlinkage void notrace stackleak_erase(void) | 73 | asmlinkage void noinstr stackleak_erase(void) |
| 74 | { | 74 | { |
| 75 | /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */ | 75 | /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */ |
| 76 | unsigned long kstack_ptr = current->lowest_stack; | 76 | unsigned long kstack_ptr = current->lowest_stack; |
| @@ -124,9 +124,8 @@ asmlinkage void notrace stackleak_erase(void) · 47 unmodified lines | |||
| 124 | /* Reset the 'lowest_stack' value for the next syscall */ | 124 | /* Reset the 'lowest_stack' value for the next syscall */ |
| 125 | current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; | 125 | current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; |
| 126 | } | 126 | } |
| 127 | NOKPROBE_SYMBOL(stackleak_erase); | ||
| 128 | 127 | ||
| 129 | void __used __no_caller_saved_registers notrace stackleak_track_stack(void) | 128 | void __used __no_caller_saved_registers noinstr stackleak_track_stack(void) |
| 130 | { | 129 | { |
| 131 | unsigned long sp = current_stack_pointer; | 130 | unsigned long sp = current_stack_pointer; |
| 132 | 131 | ||
| @@ -70,10 +70,16 @@ config HAVE_C_RECORDMCOUNT · 69 unmodified lines | |||
| 70 | help | 70 | help |
| 71 | C version of recordmcount available? | 71 | C version of recordmcount available? |
| 72 | 72 | ||
| 73 | config HAVE_BUILDTIME_MCOUNT_SORT | ||
| 74 | bool | ||
| 75 | help | ||
| 76 | An architecture selects this if it sorts the mcount_loc section | ||
| 77 | at build time. | ||
| 78 | |||
| 73 | config BUILDTIME_MCOUNT_SORT | 79 | config BUILDTIME_MCOUNT_SORT |
| 74 | bool | 80 | bool |
| 75 | default y | 81 | default y |
| 76 | depends on BUILDTIME_TABLE_SORT && !S390 | 82 | depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE |
| 77 | help | 83 | help |
| 78 | Sort the mcount_loc section at build time. | 84 | Sort the mcount_loc section at build time. |
| 79 | 85 | ||
| @@ -7740,7 +7740,8 @@ static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) · 7739 unmodified lines | |||
| 7740 | err = kzalloc(sizeof(*err), GFP_KERNEL); | 7740 | err = kzalloc(sizeof(*err), GFP_KERNEL); |
| 7741 | if (!err) | 7741 | if (!err) |
| 7742 | err = ERR_PTR(-ENOMEM); | 7742 | err = ERR_PTR(-ENOMEM); |
| 7743 | tr->n_err_log_entries++; | 7743 | else |
| 7744 | tr->n_err_log_entries++; | ||
| 7744 | 7745 | ||
| 7745 | return err; | 7746 | return err; |
| 7746 | } | 7747 | } |
| @@ -2503,6 +2503,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, · 2502 unmodified lines | |||
| 2503 | (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); | 2503 | (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); |
| 2504 | expr->fn = hist_field_unary_minus; | 2504 | expr->fn = hist_field_unary_minus; |
| 2505 | expr->operands[0] = operand1; | 2505 | expr->operands[0] = operand1; |
| 2506 | expr->size = operand1->size; | ||
| 2507 | expr->is_signed = operand1->is_signed; | ||
| 2506 | expr->operator = FIELD_OP_UNARY_MINUS; | 2508 | expr->operator = FIELD_OP_UNARY_MINUS; |
| 2507 | expr->name = expr_str(expr, 0); | 2509 | expr->name = expr_str(expr, 0); |
| 2508 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); | 2510 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |
| @@ -2719,6 +2721,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, · 210 unmodified lines | |||
| 2719 | 2721 | ||
| 2720 | /* The operand sizes should be the same, so just pick one */ | 2722 | /* The operand sizes should be the same, so just pick one */ |
| 2721 | expr->size = operand1->size; | 2723 | expr->size = operand1->size; |
| 2724 | expr->is_signed = operand1->is_signed; | ||
| 2722 | 2725 | ||
| 2723 | expr->operator = field_op; | 2726 | expr->operator = field_op; |
| 2724 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); | 2727 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |
| @@ -3935,6 +3938,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data, · 1210 unmodified lines | |||
| 3935 | 3938 | ||
| 3936 | var_ref_idx = find_var_ref_idx(hist_data, var_ref); | 3939 | var_ref_idx = find_var_ref_idx(hist_data, var_ref); |
| 3937 | if (WARN_ON(var_ref_idx < 0)) { | 3940 | if (WARN_ON(var_ref_idx < 0)) { |
| 3941 | kfree(p); | ||
| 3938 | ret = var_ref_idx; | 3942 | ret = var_ref_idx; |
| 3939 | goto err; | 3943 | goto err; |
| 3940 | } | 3944 | } |
| @@ -6163,7 +6167,9 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 2222 unmodified lines | |||
| 6163 | 6167 | ||
| 6164 | lockdep_assert_held(&event_mutex); | 6168 | lockdep_assert_held(&event_mutex); |
| 6165 | 6169 | ||
| 6166 | if (glob && strlen(glob)) { | 6170 | WARN_ON(!glob); |
| 6171 | |||
| 6172 | if (strlen(glob)) { | ||
| 6167 | hist_err_clear(); | 6173 | hist_err_clear(); |
| 6168 | last_cmd_set(file, param); | 6174 | last_cmd_set(file, param); |
| 6169 | } | 6175 | } |
| @@ -6196,7 +6202,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 26 unmodified lines | |||
| 6196 | continue; | 6202 | continue; |
| 6197 | } | 6203 | } |
| 6198 | break; | 6204 | break; |
| 6199 | } while (p); | 6205 | } while (1); |
| 6200 | 6206 | ||
| 6201 | if (!p) | 6207 | if (!p) |
| 6202 | param = NULL; | 6208 | param = NULL; |
| @@ -190,6 +190,7 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) · 189 unmodified lines | |||
| 190 | kfree(new); | 190 | kfree(new); |
| 191 | } else { | 191 | } else { |
| 192 | hlist_add_head(&new->node, hashent); | 192 | hlist_add_head(&new->node, hashent); |
| 193 | get_user_ns(new->ns); | ||
| 193 | spin_unlock_irq(&ucounts_lock); | 194 | spin_unlock_irq(&ucounts_lock); |
| 194 | return new; | 195 | return new; |
| 195 | } | 196 | } |
| @@ -210,6 +211,7 @@ void put_ucounts(struct ucounts *ucounts) · 14 unmodified lines | |||
| 210 | if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) { | 211 | if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) { |
| 211 | hlist_del_init(&ucounts->node); | 212 | hlist_del_init(&ucounts->node); |
| 212 | spin_unlock_irqrestore(&ucounts_lock, flags); | 213 | spin_unlock_irqrestore(&ucounts_lock, flags); |
| 214 | put_user_ns(ucounts->ns); | ||
| 213 | kfree(ucounts); | 215 | kfree(ucounts); |
| 214 | } | 216 | } |
| 215 | } | 217 | } |
| @@ -488,9 +488,13 @@ void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq, · 487 unmodified lines | |||
| 488 | unsigned int users) | 488 | unsigned int users) |
| 489 | { | 489 | { |
| 490 | unsigned int wake_batch; | 490 | unsigned int wake_batch; |
| 491 | unsigned int min_batch; | ||
| 492 | unsigned int depth = (sbq->sb.depth + users - 1) / users; | ||
| 491 | 493 | ||
| 492 | wake_batch = clamp_val((sbq->sb.depth + users - 1) / | 494 | min_batch = sbq->sb.depth >= (4 * SBQ_WAIT_QUEUES) ? 4 : 1; |
| 493 | users, 4, SBQ_WAKE_BATCH); | 495 | |
| 496 | wake_batch = clamp_val(depth / SBQ_WAIT_QUEUES, | ||
| 497 | min_batch, SBQ_WAKE_BATCH); | ||
| 494 | __sbitmap_queue_update_wake_batch(sbq, wake_batch); | 498 | __sbitmap_queue_update_wake_batch(sbq, wake_batch); |
| 495 | } | 499 | } |
| 496 | EXPORT_SYMBOL_GPL(sbitmap_queue_recalculate_wake_batch); | 500 | EXPORT_SYMBOL_GPL(sbitmap_queue_recalculate_wake_batch); |
| @@ -492,6 +492,7 @@ static void kmalloc_oob_in_memset(struct kunit *test) · 491 unmodified lines | |||
| 492 | ptr = kmalloc(size, GFP_KERNEL); | 492 | ptr = kmalloc(size, GFP_KERNEL); |
| 493 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); | 493 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); |
| 494 | 494 | ||
| 495 | OPTIMIZER_HIDE_VAR(ptr); | ||
| 495 | OPTIMIZER_HIDE_VAR(size); | 496 | OPTIMIZER_HIDE_VAR(size); |
| 496 | KUNIT_EXPECT_KASAN_FAIL(test, | 497 | KUNIT_EXPECT_KASAN_FAIL(test, |
| 497 | memset(ptr, 0, size + KASAN_GRANULE_SIZE)); | 498 | memset(ptr, 0, size + KASAN_GRANULE_SIZE)); |
| @@ -515,6 +516,7 @@ static void kmalloc_memmove_negative_size(struct kunit *test) · 17 unmodified lines | |||
| 515 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); | 516 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); |
| 516 | 517 | ||
| 517 | memset((char *)ptr, 0, 64); | 518 | memset((char *)ptr, 0, 64); |
| 519 | OPTIMIZER_HIDE_VAR(ptr); | ||
| 518 | OPTIMIZER_HIDE_VAR(invalid_size); | 520 | OPTIMIZER_HIDE_VAR(invalid_size); |
| 519 | KUNIT_EXPECT_KASAN_FAIL(test, | 521 | KUNIT_EXPECT_KASAN_FAIL(test, |
| 520 | memmove((char *)ptr, (char *)ptr + 4, invalid_size)); | 522 | memmove((char *)ptr, (char *)ptr + 4, invalid_size)); |
| @@ -531,6 +533,7 @@ static void kmalloc_memmove_invalid_size(struct kunit *test) · 10 unmodified lines | |||
| 531 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); | 533 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); |
| 532 | 534 | ||
| 533 | memset((char *)ptr, 0, 64); | 535 | memset((char *)ptr, 0, 64); |
| 536 | OPTIMIZER_HIDE_VAR(ptr); | ||
| 534 | KUNIT_EXPECT_KASAN_FAIL(test, | 537 | KUNIT_EXPECT_KASAN_FAIL(test, |
| 535 | memmove((char *)ptr, (char *)ptr + 4, invalid_size)); | 538 | memmove((char *)ptr, (char *)ptr + 4, invalid_size)); |
| 536 | kfree(ptr); | 539 | kfree(ptr); |
| @@ -893,6 +896,7 @@ static void kasan_memchr(struct kunit *test) · 356 unmodified lines | |||
| 893 | ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); | 896 | ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); |
| 894 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); | 897 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); |
| 895 | 898 | ||
| 899 | OPTIMIZER_HIDE_VAR(ptr); | ||
| 896 | OPTIMIZER_HIDE_VAR(size); | 900 | OPTIMIZER_HIDE_VAR(size); |
| 897 | KUNIT_EXPECT_KASAN_FAIL(test, | 901 | KUNIT_EXPECT_KASAN_FAIL(test, |
| 898 | kasan_ptr_result = memchr(ptr, '1', size + 1)); | 902 | kasan_ptr_result = memchr(ptr, '1', size + 1)); |
| @@ -919,6 +923,7 @@ static void kasan_memcmp(struct kunit *test) · 20 unmodified lines | |||
| 919 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); | 923 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); |
| 920 | memset(arr, 0, sizeof(arr)); | 924 | memset(arr, 0, sizeof(arr)); |
| 921 | 925 | ||
| 926 | OPTIMIZER_HIDE_VAR(ptr); | ||
| 922 | OPTIMIZER_HIDE_VAR(size); | 927 | OPTIMIZER_HIDE_VAR(size); |
| 923 | KUNIT_EXPECT_KASAN_FAIL(test, | 928 | KUNIT_EXPECT_KASAN_FAIL(test, |
| 924 | kasan_int_result = memcmp(ptr, arr, size+1)); | 929 | kasan_int_result = memcmp(ptr, arr, size+1)); |
| @@ -124,8 +124,8 @@ static inline struct page *try_get_compound_head(struct page *page, int refs) · 123 unmodified lines | |||
| 124 | * considered failure, and furthermore, a likely bug in the caller, so a warning | 124 | * considered failure, and furthermore, a likely bug in the caller, so a warning |
| 125 | * is also emitted. | 125 | * is also emitted. |
| 126 | */ | 126 | */ |
| 127 | struct page *try_grab_compound_head(struct page *page, | 127 | __maybe_unused struct page *try_grab_compound_head(struct page *page, |
| 128 | int refs, unsigned int flags) | 128 | int refs, unsigned int flags) |
| 129 | { | 129 | { |
| 130 | if (flags & FOLL_GET) | 130 | if (flags & FOLL_GET) |
| 131 | return try_get_compound_head(page, refs); | 131 | return try_get_compound_head(page, refs); |
| @@ -208,10 +208,35 @@ static void put_compound_head(struct page *page, int refs, unsigned int flags) · 76 unmodified lines | |||
| 208 | */ | 208 | */ |
| 209 | bool __must_check try_grab_page(struct page *page, unsigned int flags) | 209 | bool __must_check try_grab_page(struct page *page, unsigned int flags) |
| 210 | { | 210 | { |
| 211 | if (!(flags & (FOLL_GET | FOLL_PIN))) | 211 | WARN_ON_ONCE((flags & (FOLL_GET | FOLL_PIN)) == (FOLL_GET | FOLL_PIN)); |
| 212 | return true; | ||
| 213 | 212 | ||
| 214 | return try_grab_compound_head(page, 1, flags); | 213 | if (flags & FOLL_GET) |
| 214 | return try_get_page(page); | ||
| 215 | else if (flags & FOLL_PIN) { | ||
| 216 | int refs = 1; | ||
| 217 | |||
| 218 | page = compound_head(page); | ||
| 219 | |||
| 220 | if (WARN_ON_ONCE(page_ref_count(page) <= 0)) | ||
| 221 | return false; | ||
| 222 | |||
| 223 | if (hpage_pincount_available(page)) | ||
| 224 | hpage_pincount_add(page, 1); | ||
| 225 | else | ||
| 226 | refs = GUP_PIN_COUNTING_BIAS; | ||
| 227 | |||
| 228 | /* | ||
| 229 | * Similar to try_grab_compound_head(): even if using the | ||
| 230 | * hpage_pincount_add/_sub() routines, be sure to | ||
| 231 | * *also* increment the normal page refcount field at least | ||
| 232 | * once, so that the page really is pinned. | ||
| 233 | */ | ||
| 234 | page_ref_add(page, refs); | ||
| 235 | |||
| 236 | mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_ACQUIRED, 1); | ||
| 237 | } | ||
| 238 | |||
| 239 | return true; | ||
| 215 | } | 240 | } |
| 216 | 241 | ||
| 217 | /** | 242 | /** |
| @@ -1595,6 +1595,12 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags, · 1594 unmodified lines | |||
| 1595 | goto out; | 1595 | goto out; |
| 1596 | } | 1596 | } |
| 1597 | 1597 | ||
| 1598 | /* | ||
| 1599 | * Pages instantiated by device-dax (not filesystem-dax) | ||
| 1600 | * may be compound pages. | ||
| 1601 | */ | ||
| 1602 | page = compound_head(page); | ||
| 1603 | |||
| 1598 | /* | 1604 | /* |
| 1599 | * Prevent the inode from being freed while we are interrogating | 1605 | * Prevent the inode from being freed while we are interrogating |
| 1600 | * the address_space, typically this would be handled by | 1606 | * the address_space, typically this would be handled by |
| @@ -77,6 +77,7 @@ static void ax25_kill_by_device(struct net_device *dev) · 76 unmodified lines | |||
| 77 | { | 77 | { |
| 78 | ax25_dev *ax25_dev; | 78 | ax25_dev *ax25_dev; |
| 79 | ax25_cb *s; | 79 | ax25_cb *s; |
| 80 | struct sock *sk; | ||
| 80 | 81 | ||
| 81 | if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) | 82 | if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) |
| 82 | return; | 83 | return; |
| @@ -85,13 +86,16 @@ static void ax25_kill_by_device(struct net_device *dev) · 2 unmodified lines | |||
| 85 | again: | 86 | again: |
| 86 | ax25_for_each(s, &ax25_list) { | 87 | ax25_for_each(s, &ax25_list) { |
| 87 | if (s->ax25_dev == ax25_dev) { | 88 | if (s->ax25_dev == ax25_dev) { |
| 89 | sk = s->sk; | ||
| 90 | sock_hold(sk); | ||
| 88 | spin_unlock_bh(&ax25_list_lock); | 91 | spin_unlock_bh(&ax25_list_lock); |
| 89 | lock_sock(s->sk); | 92 | lock_sock(sk); |
| 90 | s->ax25_dev = NULL; | 93 | s->ax25_dev = NULL; |
| 91 | release_sock(s->sk); | 94 | ax25_dev_put(ax25_dev); |
| 95 | release_sock(sk); | ||
| 92 | ax25_disconnect(s, ENETUNREACH); | 96 | ax25_disconnect(s, ENETUNREACH); |
| 93 | spin_lock_bh(&ax25_list_lock); | 97 | spin_lock_bh(&ax25_list_lock); |
| 94 | 98 | sock_put(sk); | |
| 95 | /* The entry could have been deleted from the | 99 | /* The entry could have been deleted from the |
| 96 | * list meanwhile and thus the next pointer is | 100 | * list meanwhile and thus the next pointer is |
| 97 | * no longer valid. Play it safe and restart | 101 | * no longer valid. Play it safe and restart |
| @@ -355,21 +359,25 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) · 257 unmodified lines | |||
| 355 | if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl))) | 359 | if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl))) |
| 356 | return -EFAULT; | 360 | return -EFAULT; |
| 357 | 361 | ||
| 358 | if ((ax25_dev = ax25_addr_ax25dev(&ax25_ctl.port_addr)) == NULL) | ||
| 359 | return -ENODEV; | ||
| 360 | |||
| 361 | if (ax25_ctl.digi_count > AX25_MAX_DIGIS) | 362 | if (ax25_ctl.digi_count > AX25_MAX_DIGIS) |
| 362 | return -EINVAL; | 363 | return -EINVAL; |
| 363 | 364 | ||
| 364 | if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL) | 365 | if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL) |
| 365 | return -EINVAL; | 366 | return -EINVAL; |
| 366 | 367 | ||
| 368 | ax25_dev = ax25_addr_ax25dev(&ax25_ctl.port_addr); | ||
| 369 | if (!ax25_dev) | ||
| 370 | return -ENODEV; | ||
| 371 | |||
| 367 | digi.ndigi = ax25_ctl.digi_count; | 372 | digi.ndigi = ax25_ctl.digi_count; |
| 368 | for (k = 0; k < digi.ndigi; k++) | 373 | for (k = 0; k < digi.ndigi; k++) |
| 369 | digi.calls[k] = ax25_ctl.digi_addr[k]; | 374 | digi.calls[k] = ax25_ctl.digi_addr[k]; |
| 370 | 375 | ||
| 371 | if ((ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev)) == NULL) | 376 | ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev); |
| 377 | if (!ax25) { | ||
| 378 | ax25_dev_put(ax25_dev); | ||
| 372 | return -ENOTCONN; | 379 | return -ENOTCONN; |
| 380 | } | ||
| 373 | 381 | ||
| 374 | switch (ax25_ctl.cmd) { | 382 | switch (ax25_ctl.cmd) { |
| 375 | case AX25_KILL: | 383 | case AX25_KILL: |
| @@ -436,6 +444,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) · 60 unmodified lines | |||
| 436 | } | 444 | } |
| 437 | 445 | ||
| 438 | out_put: | 446 | out_put: |
| 447 | ax25_dev_put(ax25_dev); | ||
| 439 | ax25_cb_put(ax25); | 448 | ax25_cb_put(ax25); |
| 440 | return ret; | 449 | return ret; |
| 441 | 450 | ||
| @@ -37,6 +37,7 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr) · 36 unmodified lines | |||
| 37 | for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) | 37 | for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) |
| 38 | if (ax25cmp(addr, (const ax25_address *)ax25_dev->dev->dev_addr) == 0) { | 38 | if (ax25cmp(addr, (const ax25_address *)ax25_dev->dev->dev_addr) == 0) { |
| 39 | res = ax25_dev; | 39 | res = ax25_dev; |
| 40 | ax25_dev_hold(ax25_dev); | ||
| 40 | } | 41 | } |
| 41 | spin_unlock_bh(&ax25_dev_lock); | 42 | spin_unlock_bh(&ax25_dev_lock); |
| 42 | 43 | ||
| @@ -56,6 +57,7 @@ void ax25_dev_device_up(struct net_device *dev) · 13 unmodified lines | |||
| 56 | return; | 57 | return; |
| 57 | } | 58 | } |
| 58 | 59 | ||
| 60 | refcount_set(&ax25_dev->refcount, 1); | ||
| 59 | dev->ax25_ptr = ax25_dev; | 61 | dev->ax25_ptr = ax25_dev; |
| 60 | ax25_dev->dev = dev; | 62 | ax25_dev->dev = dev; |
| 61 | dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC); | 63 | dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC); |
| @@ -84,6 +86,7 @@ void ax25_dev_device_up(struct net_device *dev) · 22 unmodified lines | |||
| 84 | ax25_dev->next = ax25_dev_list; | 86 | ax25_dev->next = ax25_dev_list; |
| 85 | ax25_dev_list = ax25_dev; | 87 | ax25_dev_list = ax25_dev; |
| 86 | spin_unlock_bh(&ax25_dev_lock); | 88 | spin_unlock_bh(&ax25_dev_lock); |
| 89 | ax25_dev_hold(ax25_dev); | ||
| 87 | 90 | ||
| 88 | ax25_register_dev_sysctl(ax25_dev); | 91 | ax25_register_dev_sysctl(ax25_dev); |
| 89 | } | 92 | } |
| @@ -113,9 +116,10 @@ void ax25_dev_device_down(struct net_device *dev) · 23 unmodified lines | |||
| 113 | if ((s = ax25_dev_list) == ax25_dev) { | 116 | if ((s = ax25_dev_list) == ax25_dev) { |
| 114 | ax25_dev_list = s->next; | 117 | ax25_dev_list = s->next; |
| 115 | spin_unlock_bh(&ax25_dev_lock); | 118 | spin_unlock_bh(&ax25_dev_lock); |
| 119 | ax25_dev_put(ax25_dev); | ||
| 116 | dev->ax25_ptr = NULL; | 120 | dev->ax25_ptr = NULL; |
| 117 | dev_put_track(dev, &ax25_dev->dev_tracker); | 121 | dev_put_track(dev, &ax25_dev->dev_tracker); |
| 118 | kfree(ax25_dev); | 122 | ax25_dev_put(ax25_dev); |
| 119 | return; | 123 | return; |
| 120 | } | 124 | } |
| 121 | 125 | ||
| @@ -123,9 +127,10 @@ void ax25_dev_device_down(struct net_device *dev) · 1 unmodified line | |||
| 123 | if (s->next == ax25_dev) { | 127 | if (s->next == ax25_dev) { |
| 124 | s->next = ax25_dev->next; | 128 | s->next = ax25_dev->next; |
| 125 | spin_unlock_bh(&ax25_dev_lock); | 129 | spin_unlock_bh(&ax25_dev_lock); |
| 130 | ax25_dev_put(ax25_dev); | ||
| 126 | dev->ax25_ptr = NULL; | 131 | dev->ax25_ptr = NULL; |
| 127 | dev_put_track(dev, &ax25_dev->dev_tracker); | 132 | dev_put_track(dev, &ax25_dev->dev_tracker); |
| 128 | kfree(ax25_dev); | 133 | ax25_dev_put(ax25_dev); |
| 129 | return; | 134 | return; |
| 130 | } | 135 | } |
| 131 | 136 | ||
| @@ -133,6 +138,7 @@ void ax25_dev_device_down(struct net_device *dev) · 1 unmodified line | |||
| 133 | } | 138 | } |
| 134 | spin_unlock_bh(&ax25_dev_lock); | 139 | spin_unlock_bh(&ax25_dev_lock); |
| 135 | dev->ax25_ptr = NULL; | 140 | dev->ax25_ptr = NULL; |
| 141 | ax25_dev_put(ax25_dev); | ||
| 136 | } | 142 | } |
| 137 | 143 | ||
| 138 | int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd) | 144 | int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd) |
| @@ -144,20 +150,32 @@ int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd) · 5 unmodified lines | |||
| 144 | 150 | ||
| 145 | switch (cmd) { | 151 | switch (cmd) { |
| 146 | case SIOCAX25ADDFWD: | 152 | case SIOCAX25ADDFWD: |
| 147 | if ((fwd_dev = ax25_addr_ax25dev(&fwd->port_to)) == NULL) | 153 | fwd_dev = ax25_addr_ax25dev(&fwd->port_to); |
| 154 | if (!fwd_dev) { | ||
| 155 | ax25_dev_put(ax25_dev); | ||
| 148 | return -EINVAL; | 156 | return -EINVAL; |
| 149 | if (ax25_dev->forward != NULL) | 157 | } |
| 158 | if (ax25_dev->forward) { | ||
| 159 | ax25_dev_put(fwd_dev); | ||
| 160 | ax25_dev_put(ax25_dev); | ||
| 150 | return -EINVAL; | 161 | return -EINVAL; |
| 162 | } | ||
| 151 | ax25_dev->forward = fwd_dev->dev; | 163 | ax25_dev->forward = fwd_dev->dev; |
| 164 | ax25_dev_put(fwd_dev); | ||
| 165 | ax25_dev_put(ax25_dev); | ||
| 152 | break; | 166 | break; |
| 153 | 167 | ||
| 154 | case SIOCAX25DELFWD: | 168 | case SIOCAX25DELFWD: |
| 155 | if (ax25_dev->forward == NULL) | 169 | if (!ax25_dev->forward) { |
| 170 | ax25_dev_put(ax25_dev); | ||
| 156 | return -EINVAL; | 171 | return -EINVAL; |
| 172 | } | ||
| 157 | ax25_dev->forward = NULL; | 173 | ax25_dev->forward = NULL; |
| 174 | ax25_dev_put(ax25_dev); | ||
| 158 | break; | 175 | break; |
| 159 | 176 | ||
| 160 | default: | 177 | default: |
| 178 | ax25_dev_put(ax25_dev); | ||
| 161 | return -EINVAL; | 179 | return -EINVAL; |
| 162 | } | 180 | } |
| 163 | 181 | ||
| @@ -75,11 +75,13 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 74 unmodified lines | |||
| 75 | ax25_dev *ax25_dev; | 75 | ax25_dev *ax25_dev; |
| 76 | int i; | 76 | int i; |
| 77 | 77 | ||
| 78 | if ((ax25_dev = ax25_addr_ax25dev(&route->port_addr)) == NULL) | ||
| 79 | return -EINVAL; | ||
| 80 | if (route->digi_count > AX25_MAX_DIGIS) | 78 | if (route->digi_count > AX25_MAX_DIGIS) |
| 81 | return -EINVAL; | 79 | return -EINVAL; |
| 82 | 80 | ||
| 81 | ax25_dev = ax25_addr_ax25dev(&route->port_addr); | ||
| 82 | if (!ax25_dev) | ||
| 83 | return -EINVAL; | ||
| 84 | |||
| 83 | write_lock_bh(&ax25_route_lock); | 85 | write_lock_bh(&ax25_route_lock); |
| 84 | 86 | ||
| 85 | ax25_rt = ax25_route_list; | 87 | ax25_rt = ax25_route_list; |
| @@ -91,6 +93,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 5 unmodified lines | |||
| 91 | if (route->digi_count != 0) { | 93 | if (route->digi_count != 0) { |
| 92 | if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { | 94 | if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { |
| 93 | write_unlock_bh(&ax25_route_lock); | 95 | write_unlock_bh(&ax25_route_lock); |
| 96 | ax25_dev_put(ax25_dev); | ||
| 94 | return -ENOMEM; | 97 | return -ENOMEM; |
| 95 | } | 98 | } |
| 96 | ax25_rt->digipeat->lastrepeat = -1; | 99 | ax25_rt->digipeat->lastrepeat = -1; |
| @@ -101,6 +104,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 4 unmodified lines | |||
| 101 | } | 104 | } |
| 102 | } | 105 | } |
| 103 | write_unlock_bh(&ax25_route_lock); | 106 | write_unlock_bh(&ax25_route_lock); |
| 107 | ax25_dev_put(ax25_dev); | ||
| 104 | return 0; | 108 | return 0; |
| 105 | } | 109 | } |
| 106 | ax25_rt = ax25_rt->next; | 110 | ax25_rt = ax25_rt->next; |
| @@ -108,6 +112,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 1 unmodified line | |||
| 108 | 112 | ||
| 109 | if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) { | 113 | if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) { |
| 110 | write_unlock_bh(&ax25_route_lock); | 114 | write_unlock_bh(&ax25_route_lock); |
| 115 | ax25_dev_put(ax25_dev); | ||
| 111 | return -ENOMEM; | 116 | return -ENOMEM; |
| 112 | } | 117 | } |
| 113 | 118 | ||
| @@ -119,6 +124,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 5 unmodified lines | |||
| 119 | if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { | 124 | if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { |
| 120 | write_unlock_bh(&ax25_route_lock); | 125 | write_unlock_bh(&ax25_route_lock); |
| 121 | kfree(ax25_rt); | 126 | kfree(ax25_rt); |
| 127 | ax25_dev_put(ax25_dev); | ||
| 122 | return -ENOMEM; | 128 | return -ENOMEM; |
| 123 | } | 129 | } |
| 124 | ax25_rt->digipeat->lastrepeat = -1; | 130 | ax25_rt->digipeat->lastrepeat = -1; |
| @@ -131,6 +137,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 6 unmodified lines | |||
| 131 | ax25_rt->next = ax25_route_list; | 137 | ax25_rt->next = ax25_route_list; |
| 132 | ax25_route_list = ax25_rt; | 138 | ax25_route_list = ax25_rt; |
| 133 | write_unlock_bh(&ax25_route_lock); | 139 | write_unlock_bh(&ax25_route_lock); |
| 140 | ax25_dev_put(ax25_dev); | ||
| 134 | 141 | ||
| 135 | return 0; | 142 | return 0; |
| 136 | } | 143 | } |
| @@ -172,6 +179,7 @@ static int ax25_rt_del(struct ax25_routes_struct *route) · 35 unmodified lines | |||
| 172 | } | 179 | } |
| 173 | } | 180 | } |
| 174 | write_unlock_bh(&ax25_route_lock); | 181 | write_unlock_bh(&ax25_route_lock); |
| 182 | ax25_dev_put(ax25_dev); | ||
| 175 | 183 | ||
| 176 | return 0; | 184 | return 0; |
| 177 | } | 185 | } |
| @@ -214,6 +222,7 @@ static int ax25_rt_opt(struct ax25_route_opt_struct *rt_option) · 36 unmodified lines | |||
| 214 | 222 | ||
| 215 | out: | 223 | out: |
| 216 | write_unlock_bh(&ax25_route_lock); | 224 | write_unlock_bh(&ax25_route_lock); |
| 225 | ax25_dev_put(ax25_dev); | ||
| 217 | return err; | 226 | return err; |
| 218 | } | 227 | } |
| 219 | 228 | ||
| @@ -49,7 +49,7 @@ static void nft_reject_br_send_v4_tcp_reset(struct net *net, · 48 unmodified lines | |||
| 49 | { | 49 | { |
| 50 | struct sk_buff *nskb; | 50 | struct sk_buff *nskb; |
| 51 | 51 | ||
| 52 | nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, dev, hook); | 52 | nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, NULL, hook); |
| 53 | if (!nskb) | 53 | if (!nskb) |
| 54 | return; | 54 | return; |
| 55 | 55 | ||
| @@ -65,7 +65,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net, · 9 unmodified lines | |||
| 65 | { | 65 | { |
| 66 | struct sk_buff *nskb; | 66 | struct sk_buff *nskb; |
| 67 | 67 | ||
| 68 | nskb = nf_reject_skb_v4_unreach(net, oldskb, dev, hook, code); | 68 | nskb = nf_reject_skb_v4_unreach(net, oldskb, NULL, hook, code); |
| 69 | if (!nskb) | 69 | if (!nskb) |
| 70 | return; | 70 | return; |
| 71 | 71 | ||
| @@ -81,7 +81,7 @@ static void nft_reject_br_send_v6_tcp_reset(struct net *net, · 9 unmodified lines | |||
| 81 | { | 81 | { |
| 82 | struct sk_buff *nskb; | 82 | struct sk_buff *nskb; |
| 83 | 83 | ||
| 84 | nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, dev, hook); | 84 | nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, NULL, hook); |
| 85 | if (!nskb) | 85 | if (!nskb) |
| 86 | return; | 86 | return; |
| 87 | 87 | ||
| @@ -98,7 +98,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net, · 10 unmodified lines | |||
| 98 | { | 98 | { |
| 99 | struct sk_buff *nskb; | 99 | struct sk_buff *nskb; |
| 100 | 100 | ||
| 101 | nskb = nf_reject_skb_v6_unreach(net, oldskb, dev, hook, code); | 101 | nskb = nf_reject_skb_v6_unreach(net, oldskb, NULL, hook, code); |
| 102 | if (!nskb) | 102 | if (!nskb) |
| 103 | return; | 103 | return; |
| 104 | 104 | ||
| @@ -1133,7 +1133,8 @@ out: · 1132 unmodified lines | |||
| 1133 | neigh_release(neigh); | 1133 | neigh_release(neigh); |
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| 1136 | int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 1136 | int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb, |
| 1137 | const bool immediate_ok) | ||
| 1137 | { | 1138 | { |
| 1138 | int rc; | 1139 | int rc; |
| 1139 | bool immediate_probe = false; | 1140 | bool immediate_probe = false; |
| @@ -1154,12 +1155,17 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) · 14 unmodified lines | |||
| 1154 | atomic_set(&neigh->probes, | 1155 | atomic_set(&neigh->probes, |
| 1155 | NEIGH_VAR(neigh->parms, UCAST_PROBES)); | 1156 | NEIGH_VAR(neigh->parms, UCAST_PROBES)); |
| 1156 | neigh_del_timer(neigh); | 1157 | neigh_del_timer(neigh); |
| 1157 | neigh->nud_state = NUD_INCOMPLETE; | 1158 | neigh->nud_state = NUD_INCOMPLETE; |
| 1158 | neigh->updated = now; | 1159 | neigh->updated = now; |
| 1159 | next = now + max(NEIGH_VAR(neigh->parms, RETRANS_TIME), | 1160 | if (!immediate_ok) { |
| 1160 | HZ/100); | 1161 | next = now + 1; |
| 1162 | } else { | ||
| 1163 | immediate_probe = true; | ||
| 1164 | next = now + max(NEIGH_VAR(neigh->parms, | ||
| 1165 | RETRANS_TIME), | ||
| 1166 | HZ / 100); | ||
| 1167 | } | ||
| 1161 | neigh_add_timer(neigh, next); | 1168 | neigh_add_timer(neigh, next); |
| 1162 | immediate_probe = true; | ||
| 1163 | } else { | 1169 | } else { |
| 1164 | neigh->nud_state = NUD_FAILED; | 1170 | neigh->nud_state = NUD_FAILED; |
| 1165 | neigh->updated = jiffies; | 1171 | neigh->updated = jiffies; |
| @@ -1571,7 +1577,7 @@ static void neigh_managed_work(struct work_struct *work) · 405 unmodified lines | |||
| 1571 | 1577 | ||
| 1572 | write_lock_bh(&tbl->lock); | 1578 | write_lock_bh(&tbl->lock); |
| 1573 | list_for_each_entry(neigh, &tbl->managed_list, managed_list) | 1579 | list_for_each_entry(neigh, &tbl->managed_list, managed_list) |
| 1574 | neigh_event_send(neigh, NULL); | 1580 | neigh_event_send_probe(neigh, NULL, false); |
| 1575 | queue_delayed_work(system_power_efficient_wq, &tbl->managed_work, | 1581 | queue_delayed_work(system_power_efficient_wq, &tbl->managed_work, |
| 1576 | NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME)); | 1582 | NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME)); |
| 1577 | write_unlock_bh(&tbl->lock); | 1583 | write_unlock_bh(&tbl->lock); |
| @@ -3275,8 +3275,8 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, · 3274 unmodified lines | |||
| 3275 | struct nlattr *slave_attr[RTNL_SLAVE_MAX_TYPE + 1]; | 3275 | struct nlattr *slave_attr[RTNL_SLAVE_MAX_TYPE + 1]; |
| 3276 | unsigned char name_assign_type = NET_NAME_USER; | 3276 | unsigned char name_assign_type = NET_NAME_USER; |
| 3277 | struct nlattr *linkinfo[IFLA_INFO_MAX + 1]; | 3277 | struct nlattr *linkinfo[IFLA_INFO_MAX + 1]; |
| 3278 | const struct rtnl_link_ops *m_ops = NULL; | 3278 | const struct rtnl_link_ops *m_ops; |
| 3279 | struct net_device *master_dev = NULL; | 3279 | struct net_device *master_dev; |
| 3280 | struct net *net = sock_net(skb->sk); | 3280 | struct net *net = sock_net(skb->sk); |
| 3281 | const struct rtnl_link_ops *ops; | 3281 | const struct rtnl_link_ops *ops; |
| 3282 | struct nlattr *tb[IFLA_MAX + 1]; | 3282 | struct nlattr *tb[IFLA_MAX + 1]; |
| @@ -3314,6 +3314,8 @@ replay: · 31 unmodified lines | |||
| 3314 | else | 3314 | else |
| 3315 | dev = NULL; | 3315 | dev = NULL; |
| 3316 | 3316 | ||
| 3317 | master_dev = NULL; | ||
| 3318 | m_ops = NULL; | ||
| 3317 | if (dev) { | 3319 | if (dev) { |
| 3318 | master_dev = netdev_master_upper_dev_get(dev); | 3320 | master_dev = netdev_master_upper_dev_get(dev); |
| 3319 | if (master_dev) | 3321 | if (master_dev) |
| @@ -1441,7 +1441,7 @@ static int nl802154_send_key(struct sk_buff *msg, u32 cmd, u32 portid, · 1440 unmodified lines | |||
| 1441 | 1441 | ||
| 1442 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); | 1442 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
| 1443 | if (!hdr) | 1443 | if (!hdr) |
| 1444 | return -1; | 1444 | return -ENOBUFS; |
| 1445 | 1445 | ||
| 1446 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) | 1446 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
| 1447 | goto nla_put_failure; | 1447 | goto nla_put_failure; |
| @@ -1634,7 +1634,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 cmd, u32 portid, · 186 unmodified lines | |||
| 1634 | 1634 | ||
| 1635 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); | 1635 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
| 1636 | if (!hdr) | 1636 | if (!hdr) |
| 1637 | return -1; | 1637 | return -ENOBUFS; |
| 1638 | 1638 | ||
| 1639 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) | 1639 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
| 1640 | goto nla_put_failure; | 1640 | goto nla_put_failure; |
| @@ -1812,7 +1812,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 cmd, u32 portid, · 171 unmodified lines | |||
| 1812 | 1812 | ||
| 1813 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); | 1813 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
| 1814 | if (!hdr) | 1814 | if (!hdr) |
| 1815 | return -1; | 1815 | return -ENOBUFS; |
| 1816 | 1816 | ||
| 1817 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) | 1817 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
| 1818 | goto nla_put_failure; | 1818 | goto nla_put_failure; |
| @@ -1988,7 +1988,7 @@ static int nl802154_send_seclevel(struct sk_buff *msg, u32 cmd, u32 portid, · 169 unmodified lines | |||
| 1988 | 1988 | ||
| 1989 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); | 1989 | hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
| 1990 | if (!hdr) | 1990 | if (!hdr) |
| 1991 | return -1; | 1991 | return -ENOBUFS; |
| 1992 | 1992 | ||
| 1993 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) | 1993 | if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
| 1994 | goto nla_put_failure; | 1994 | goto nla_put_failure; |
| @@ -58,10 +58,6 @@ config NF_TABLES_ARP · 57 unmodified lines | |||
| 58 | 58 | ||
| 59 | endif # NF_TABLES | 59 | endif # NF_TABLES |
| 60 | 60 | ||
| 61 | config NF_FLOW_TABLE_IPV4 | ||
| 62 | tristate | ||
| 63 | select NF_FLOW_TABLE_INET | ||
| 64 | |||
| 65 | config NF_DUP_IPV4 | 61 | config NF_DUP_IPV4 |
| 66 | tristate "Netfilter IPv4 packet duplication to alternate destination" | 62 | tristate "Netfilter IPv4 packet duplication to alternate destination" |
| 67 | depends on !NF_CONNTRACK || NF_CONNTRACK | 63 | depends on !NF_CONNTRACK || NF_CONNTRACK |
| @@ -1321,10 +1321,13 @@ new_segment: · 1320 unmodified lines | |||
| 1321 | 1321 | ||
| 1322 | /* skb changing from pure zc to mixed, must charge zc */ | 1322 | /* skb changing from pure zc to mixed, must charge zc */ |
| 1323 | if (unlikely(skb_zcopy_pure(skb))) { | 1323 | if (unlikely(skb_zcopy_pure(skb))) { |
| 1324 | if (!sk_wmem_schedule(sk, skb->data_len)) | 1324 | u32 extra = skb->truesize - |
| 1325 | SKB_TRUESIZE(skb_end_offset(skb)); | ||
| 1326 | |||
| 1327 | if (!sk_wmem_schedule(sk, extra)) | ||
| 1325 | goto wait_for_space; | 1328 | goto wait_for_space; |
| 1326 | 1329 | ||
| 1327 | sk_mem_charge(sk, skb->data_len); | 1330 | sk_mem_charge(sk, extra); |
| 1328 | skb_shinfo(skb)->flags &= ~SKBFL_PURE_ZEROCOPY; | 1331 | skb_shinfo(skb)->flags &= ~SKBFL_PURE_ZEROCOPY; |
| 1329 | } | 1332 | } |
| 1330 | 1333 | ||
| @@ -1660,6 +1660,8 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb, · 1659 unmodified lines | |||
| 1660 | (mss != tcp_skb_seglen(skb))) | 1660 | (mss != tcp_skb_seglen(skb))) |
| 1661 | goto out; | 1661 | goto out; |
| 1662 | 1662 | ||
| 1663 | if (!tcp_skb_can_collapse(prev, skb)) | ||
| 1664 | goto out; | ||
| 1663 | len = skb->len; | 1665 | len = skb->len; |
| 1664 | pcount = tcp_skb_pcount(skb); | 1666 | pcount = tcp_skb_pcount(skb); |
| 1665 | if (tcp_skb_shift(prev, skb, pcount, len)) | 1667 | if (tcp_skb_shift(prev, skb, pcount, len)) |
| @@ -47,10 +47,6 @@ config NFT_FIB_IPV6 · 46 unmodified lines | |||
| 47 | endif # NF_TABLES_IPV6 | 47 | endif # NF_TABLES_IPV6 |
| 48 | endif # NF_TABLES | 48 | endif # NF_TABLES |
| 49 | 49 | ||
| 50 | config NF_FLOW_TABLE_IPV6 | ||
| 51 | tristate | ||
| 52 | select NF_FLOW_TABLE_INET | ||
| 53 | |||
| 54 | config NF_DUP_IPV6 | 50 | config NF_DUP_IPV6 |
| 55 | tristate "Netfilter IPv6 packet duplication to alternate destination" | 51 | tristate "Netfilter IPv6 packet duplication to alternate destination" |
| 56 | depends on !NF_CONNTRACK || NF_CONNTRACK | 52 | depends on !NF_CONNTRACK || NF_CONNTRACK |
| @@ -28,9 +28,6 @@ obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o · 27 unmodified lines | |||
| 28 | obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o | 28 | obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o |
| 29 | obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o | 29 | obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o |
| 30 | 30 | ||
| 31 | # flow table support | ||
| 32 | obj-$(CONFIG_NF_FLOW_TABLE_IPV6) += nf_flow_table_ipv6.o | ||
| 33 | |||
| 34 | # matches | 31 | # matches |
| 35 | obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o | 32 | obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o |
| 36 | obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o | 33 | obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o |
Empty file deleted.
| @@ -2011,7 +2011,6 @@ static void nft_last_rule(struct nft_rule_blob *blob, const void *ptr) · 2010 unmodified lines | |||
| 2011 | 2011 | ||
| 2012 | prule = (struct nft_rule_dp *)ptr; | 2012 | prule = (struct nft_rule_dp *)ptr; |
| 2013 | prule->is_last = 1; | 2013 | prule->is_last = 1; |
| 2014 | ptr += offsetof(struct nft_rule_dp, data); | ||
| 2015 | /* blob size does not include the trailer rule */ | 2014 | /* blob size does not include the trailer rule */ |
| 2016 | } | 2015 | } |
| 2017 | 2016 | ||
| @@ -167,12 +167,24 @@ nla_put_failure: · 166 unmodified lines | |||
| 167 | return -1; | 167 | return -1; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | static bool nft_byteorder_reduce(struct nft_regs_track *track, | ||
| 171 | const struct nft_expr *expr) | ||
| 172 | { | ||
| 173 | struct nft_byteorder *priv = nft_expr_priv(expr); | ||
| 174 | |||
| 175 | track->regs[priv->dreg].selector = NULL; | ||
| 176 | track->regs[priv->dreg].bitwise = NULL; | ||
| 177 | |||
| 178 | return false; | ||
| 179 | } | ||
| 180 | |||
| 170 | static const struct nft_expr_ops nft_byteorder_ops = { | 181 | static const struct nft_expr_ops nft_byteorder_ops = { |
| 171 | .type = &nft_byteorder_type, | 182 | .type = &nft_byteorder_type, |
| 172 | .size = NFT_EXPR_SIZE(sizeof(struct nft_byteorder)), | 183 | .size = NFT_EXPR_SIZE(sizeof(struct nft_byteorder)), |
| 173 | .eval = nft_byteorder_eval, | 184 | .eval = nft_byteorder_eval, |
| 174 | .init = nft_byteorder_init, | 185 | .init = nft_byteorder_init, |
| 175 | .dump = nft_byteorder_dump, | 186 | .dump = nft_byteorder_dump, |
| 187 | .reduce = nft_byteorder_reduce, | ||
| 176 | }; | 188 | }; |
| 177 | 189 | ||
| 178 | struct nft_expr_type nft_byteorder_type __read_mostly = { | 190 | struct nft_expr_type nft_byteorder_type __read_mostly = { |
| @@ -260,9 +260,12 @@ static void nft_ct_set_zone_eval(const struct nft_expr *expr, · 259 unmodified lines | |||
| 260 | ct = this_cpu_read(nft_ct_pcpu_template); | 260 | ct = this_cpu_read(nft_ct_pcpu_template); |
| 261 | 261 | ||
| 262 | if (likely(refcount_read(&ct->ct_general.use) == 1)) { | 262 | if (likely(refcount_read(&ct->ct_general.use) == 1)) { |
| 263 | refcount_inc(&ct->ct_general.use); | ||
| 263 | nf_ct_zone_add(ct, &zone); | 264 | nf_ct_zone_add(ct, &zone); |
| 264 | } else { | 265 | } else { |
| 265 | /* previous skb got queued to userspace */ | 266 | /* previous skb got queued to userspace, allocate temporary |
| 267 | * one until percpu template can be reused. | ||
| 268 | */ | ||
| 266 | ct = nf_ct_tmpl_alloc(nft_net(pkt), &zone, GFP_ATOMIC); | 269 | ct = nf_ct_tmpl_alloc(nft_net(pkt), &zone, GFP_ATOMIC); |
| 267 | if (!ct) { | 270 | if (!ct) { |
| 268 | regs->verdict.code = NF_DROP; | 271 | regs->verdict.code = NF_DROP; |
| @@ -1789,7 +1789,10 @@ static int fanout_add(struct sock *sk, struct fanout_args *args) · 1788 unmodified lines | |||
| 1789 | err = -ENOSPC; | 1789 | err = -ENOSPC; |
| 1790 | if (refcount_read(&match->sk_ref) < match->max_num_members) { | 1790 | if (refcount_read(&match->sk_ref) < match->max_num_members) { |
| 1791 | __dev_remove_pack(&po->prot_hook); | 1791 | __dev_remove_pack(&po->prot_hook); |
| 1792 | po->fanout = match; | 1792 | |
| 1793 | /* Paired with packet_setsockopt(PACKET_FANOUT_DATA) */ | ||
| 1794 | WRITE_ONCE(po->fanout, match); | ||
| 1795 | |||
| 1793 | po->rollover = rollover; | 1796 | po->rollover = rollover; |
| 1794 | rollover = NULL; | 1797 | rollover = NULL; |
| 1795 | refcount_set(&match->sk_ref, refcount_read(&match->sk_ref) + 1); | 1798 | refcount_set(&match->sk_ref, refcount_read(&match->sk_ref) + 1); |
| @@ -3934,7 +3937,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval, · 2138 unmodified lines | |||
| 3934 | } | 3937 | } |
| 3935 | case PACKET_FANOUT_DATA: | 3938 | case PACKET_FANOUT_DATA: |
| 3936 | { | 3939 | { |
| 3937 | if (!po->fanout) | 3940 | /* Paired with the WRITE_ONCE() in fanout_add() */ |
| 3941 | if (!READ_ONCE(po->fanout)) | ||
| 3938 | return -EINVAL; | 3942 | return -EINVAL; |
| 3939 | 3943 | ||
| 3940 | return fanout_set_data(po, optval, optlen); | 3944 | return fanout_set_data(po, optval, optlen); |
| @@ -1945,9 +1945,9 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 1944 unmodified lines | |||
| 1945 | bool prio_allocate; | 1945 | bool prio_allocate; |
| 1946 | u32 parent; | 1946 | u32 parent; |
| 1947 | u32 chain_index; | 1947 | u32 chain_index; |
| 1948 | struct Qdisc *q = NULL; | 1948 | struct Qdisc *q; |
| 1949 | struct tcf_chain_info chain_info; | 1949 | struct tcf_chain_info chain_info; |
| 1950 | struct tcf_chain *chain = NULL; | 1950 | struct tcf_chain *chain; |
| 1951 | struct tcf_block *block; | 1951 | struct tcf_block *block; |
| 1952 | struct tcf_proto *tp; | 1952 | struct tcf_proto *tp; |
| 1953 | unsigned long cl; | 1953 | unsigned long cl; |
| @@ -1976,6 +1976,8 @@ replay: · 22 unmodified lines | |||
| 1976 | tp = NULL; | 1976 | tp = NULL; |
| 1977 | cl = 0; | 1977 | cl = 0; |
| 1978 | block = NULL; | 1978 | block = NULL; |
| 1979 | q = NULL; | ||
| 1980 | chain = NULL; | ||
| 1979 | flags = 0; | 1981 | flags = 0; |
| 1980 | 1982 | ||
| 1981 | if (prio == 0) { | 1983 | if (prio == 0) { |
| @@ -2798,8 +2800,8 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n, · 816 unmodified lines | |||
| 2798 | struct tcmsg *t; | 2800 | struct tcmsg *t; |
| 2799 | u32 parent; | 2801 | u32 parent; |
| 2800 | u32 chain_index; | 2802 | u32 chain_index; |
| 2801 | struct Qdisc *q = NULL; | 2803 | struct Qdisc *q; |
| 2802 | struct tcf_chain *chain = NULL; | 2804 | struct tcf_chain *chain; |
| 2803 | struct tcf_block *block; | 2805 | struct tcf_block *block; |
| 2804 | unsigned long cl; | 2806 | unsigned long cl; |
| 2805 | int err; | 2807 | int err; |
| @@ -2809,6 +2811,7 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n, · 3 unmodified lines | |||
| 2809 | return -EPERM; | 2811 | return -EPERM; |
| 2810 | 2812 | ||
| 2811 | replay: | 2813 | replay: |
| 2814 | q = NULL; | ||
| 2812 | err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, | 2815 | err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, |
| 2813 | rtm_tca_policy, extack); | 2816 | rtm_tca_policy, extack); |
| 2814 | if (err < 0) | 2817 | if (err < 0) |
| @@ -566,17 +566,115 @@ static void smc_stat_fallback(struct smc_sock *smc) · 565 unmodified lines | |||
| 566 | mutex_unlock(&net->smc.mutex_fback_rsn); | 566 | mutex_unlock(&net->smc.mutex_fback_rsn); |
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | /* must be called under rcu read lock */ | ||
| 570 | static void smc_fback_wakeup_waitqueue(struct smc_sock *smc, void *key) | ||
| 571 | { | ||
| 572 | struct socket_wq *wq; | ||
| 573 | __poll_t flags; | ||
| 574 | |||
| 575 | wq = rcu_dereference(smc->sk.sk_wq); | ||
| 576 | if (!skwq_has_sleeper(wq)) | ||
| 577 | return; | ||
| 578 | |||
| 579 | /* wake up smc sk->sk_wq */ | ||
| 580 | if (!key) { | ||
| 581 | /* sk_state_change */ | ||
| 582 | wake_up_interruptible_all(&wq->wait); | ||
| 583 | } else { | ||
| 584 | flags = key_to_poll(key); | ||
| 585 | if (flags & (EPOLLIN | EPOLLOUT)) | ||
| 586 | /* sk_data_ready or sk_write_space */ | ||
| 587 | wake_up_interruptible_sync_poll(&wq->wait, flags); | ||
| 588 | else if (flags & EPOLLERR) | ||
| 589 | /* sk_error_report */ | ||
| 590 | wake_up_interruptible_poll(&wq->wait, flags); | ||
| 591 | } | ||
| 592 | } | ||
| 593 | |||
| 594 | static int smc_fback_mark_woken(wait_queue_entry_t *wait, | ||
| 595 | unsigned int mode, int sync, void *key) | ||
| 596 | { | ||
| 597 | struct smc_mark_woken *mark = | ||
| 598 | container_of(wait, struct smc_mark_woken, wait_entry); | ||
| 599 | |||
| 600 | mark->woken = true; | ||
| 601 | mark->key = key; | ||
| 602 | return 0; | ||
| 603 | } | ||
| 604 | |||
| 605 | static void smc_fback_forward_wakeup(struct smc_sock *smc, struct sock *clcsk, | ||
| 606 | void (*clcsock_callback)(struct sock *sk)) | ||
| 607 | { | ||
| 608 | struct smc_mark_woken mark = { .woken = false }; | ||
| 609 | struct socket_wq *wq; | ||
| 610 | |||
| 611 | init_waitqueue_func_entry(&mark.wait_entry, | ||
| 612 | smc_fback_mark_woken); | ||
| 613 | rcu_read_lock(); | ||
| 614 | wq = rcu_dereference(clcsk->sk_wq); | ||
| 615 | if (!wq) | ||
| 616 | goto out; | ||
| 617 | add_wait_queue(sk_sleep(clcsk), &mark.wait_entry); | ||
| 618 | clcsock_callback(clcsk); | ||
| 619 | remove_wait_queue(sk_sleep(clcsk), &mark.wait_entry); | ||
| 620 | |||
| 621 | if (mark.woken) | ||
| 622 | smc_fback_wakeup_waitqueue(smc, mark.key); | ||
| 623 | out: | ||
| 624 | rcu_read_unlock(); | ||
| 625 | } | ||
| 626 | |||
| 627 | static void smc_fback_state_change(struct sock *clcsk) | ||
| 628 | { | ||
| 629 | struct smc_sock *smc = | ||
| 630 | smc_clcsock_user_data(clcsk); | ||
| 631 | |||
| 632 | if (!smc) | ||
| 633 | return; | ||
| 634 | smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_state_change); | ||
| 635 | } | ||
| 636 | |||
| 637 | static void smc_fback_data_ready(struct sock *clcsk) | ||
| 638 | { | ||
| 639 | struct smc_sock *smc = | ||
| 640 | smc_clcsock_user_data(clcsk); | ||
| 641 | |||
| 642 | if (!smc) | ||
| 643 | return; | ||
| 644 | smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_data_ready); | ||
| 645 | } | ||
| 646 | |||
| 647 | static void smc_fback_write_space(struct sock *clcsk) | ||
| 648 | { | ||
| 649 | struct smc_sock *smc = | ||
| 650 | smc_clcsock_user_data(clcsk); | ||
| 651 | |||
| 652 | if (!smc) | ||
| 653 | return; | ||
| 654 | smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_write_space); | ||
| 655 | } | ||
| 656 | |||
| 657 | static void smc_fback_error_report(struct sock *clcsk) | ||
| 658 | { | ||
| 659 | struct smc_sock *smc = | ||
| 660 | smc_clcsock_user_data(clcsk); | ||
| 661 | |||
| 662 | if (!smc) | ||
| 663 | return; | ||
| 664 | smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_error_report); | ||
| 665 | } | ||
| 666 | |||
| 569 | static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) | 667 | static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) |
| 570 | { | 668 | { |
| 571 | wait_queue_head_t *smc_wait = sk_sleep(&smc->sk); | 669 | struct sock *clcsk; |
| 572 | wait_queue_head_t *clc_wait; | ||
| 573 | unsigned long flags; | ||
| 574 | 670 | ||
| 575 | mutex_lock(&smc->clcsock_release_lock); | 671 | mutex_lock(&smc->clcsock_release_lock); |
| 576 | if (!smc->clcsock) { | 672 | if (!smc->clcsock) { |
| 577 | mutex_unlock(&smc->clcsock_release_lock); | 673 | mutex_unlock(&smc->clcsock_release_lock); |
| 578 | return -EBADF; | 674 | return -EBADF; |
| 579 | } | 675 | } |
| 676 | clcsk = smc->clcsock->sk; | ||
| 677 | |||
| 580 | smc->use_fallback = true; | 678 | smc->use_fallback = true; |
| 581 | smc->fallback_rsn = reason_code; | 679 | smc->fallback_rsn = reason_code; |
| 582 | smc_stat_fallback(smc); | 680 | smc_stat_fallback(smc); |
| @@ -587,16 +685,22 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) · 4 unmodified lines | |||
| 587 | smc->clcsock->wq.fasync_list = | 685 | smc->clcsock->wq.fasync_list = |
| 588 | smc->sk.sk_socket->wq.fasync_list; | 686 | smc->sk.sk_socket->wq.fasync_list; |
| 589 | 687 | ||
| 590 | /* There may be some entries remaining in | 688 | /* There might be some wait entries remaining |
| 591 | * smc socket->wq, which should be removed | 689 | * in smc sk->sk_wq and they should be woken up |
| 592 | * to clcsocket->wq during the fallback. | 690 | * as clcsock's wait queue is woken up. |
| 593 | */ | 691 | */ |
| 594 | clc_wait = sk_sleep(smc->clcsock->sk); | 692 | smc->clcsk_state_change = clcsk->sk_state_change; |
| 595 | spin_lock_irqsave(&smc_wait->lock, flags); | 693 | smc->clcsk_data_ready = clcsk->sk_data_ready; |
| 596 | spin_lock_nested(&clc_wait->lock, SINGLE_DEPTH_NESTING); | 694 | smc->clcsk_write_space = clcsk->sk_write_space; |
| 597 | list_splice_init(&smc_wait->head, &clc_wait->head); | 695 | smc->clcsk_error_report = clcsk->sk_error_report; |
| 598 | spin_unlock(&clc_wait->lock); | 696 | |
| 599 | spin_unlock_irqrestore(&smc_wait->lock, flags); | 697 | clcsk->sk_state_change = smc_fback_state_change; |
| 698 | clcsk->sk_data_ready = smc_fback_data_ready; | ||
| 699 | clcsk->sk_write_space = smc_fback_write_space; | ||
| 700 | clcsk->sk_error_report = smc_fback_error_report; | ||
| 701 | |||
| 702 | smc->clcsock->sk->sk_user_data = | ||
| 703 | (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY); | ||
| 600 | } | 704 | } |
| 601 | mutex_unlock(&smc->clcsock_release_lock); | 705 | mutex_unlock(&smc->clcsock_release_lock); |
| 602 | return 0; | 706 | return 0; |
| @@ -2115,10 +2219,9 @@ out: · 1512 unmodified lines | |||
| 2115 | 2219 | ||
| 2116 | static void smc_clcsock_data_ready(struct sock *listen_clcsock) | 2220 | static void smc_clcsock_data_ready(struct sock *listen_clcsock) |
| 2117 | { | 2221 | { |
| 2118 | struct smc_sock *lsmc; | 2222 | struct smc_sock *lsmc = |
| 2223 | smc_clcsock_user_data(listen_clcsock); | ||
| 2119 | 2224 | ||
| 2120 | lsmc = (struct smc_sock *) | ||
| 2121 | ((uintptr_t)listen_clcsock->sk_user_data & ~SK_USER_DATA_NOCOPY); | ||
| 2122 | if (!lsmc) | 2225 | if (!lsmc) |
| 2123 | return; | 2226 | return; |
| 2124 | lsmc->clcsk_data_ready(listen_clcsock); | 2227 | lsmc->clcsk_data_ready(listen_clcsock); |
| @@ -139,6 +139,12 @@ enum smc_urg_state { · 138 unmodified lines | |||
| 139 | SMC_URG_READ = 3, /* data was already read */ | 139 | SMC_URG_READ = 3, /* data was already read */ |
| 140 | }; | 140 | }; |
| 141 | 141 | ||
| 142 | struct smc_mark_woken { | ||
| 143 | bool woken; | ||
| 144 | void *key; | ||
| 145 | wait_queue_entry_t wait_entry; | ||
| 146 | }; | ||
| 147 | |||
| 142 | struct smc_connection { | 148 | struct smc_connection { |
| 143 | struct rb_node alert_node; | 149 | struct rb_node alert_node; |
| 144 | struct smc_link_group *lgr; /* link group of connection */ | 150 | struct smc_link_group *lgr; /* link group of connection */ |
| @@ -228,8 +234,14 @@ struct smc_connection { · 83 unmodified lines | |||
| 228 | struct smc_sock { /* smc sock container */ | 234 | struct smc_sock { /* smc sock container */ |
| 229 | struct sock sk; | 235 | struct sock sk; |
| 230 | struct socket *clcsock; /* internal tcp socket */ | 236 | struct socket *clcsock; /* internal tcp socket */ |
| 237 | void (*clcsk_state_change)(struct sock *sk); | ||
| 238 | /* original stat_change fct. */ | ||
| 231 | void (*clcsk_data_ready)(struct sock *sk); | 239 | void (*clcsk_data_ready)(struct sock *sk); |
| 232 | /* original data_ready fct. **/ | 240 | /* original data_ready fct. */ |
| 241 | void (*clcsk_write_space)(struct sock *sk); | ||
| 242 | /* original write_space fct. */ | ||
| 243 | void (*clcsk_error_report)(struct sock *sk); | ||
| 244 | /* original error_report fct. */ | ||
| 233 | struct smc_connection conn; /* smc connection */ | 245 | struct smc_connection conn; /* smc connection */ |
| 234 | struct smc_sock *listen_smc; /* listen parent */ | 246 | struct smc_sock *listen_smc; /* listen parent */ |
| 235 | struct work_struct connect_work; /* handle non-blocking connect*/ | 247 | struct work_struct connect_work; /* handle non-blocking connect*/ |
| @@ -264,6 +276,12 @@ static inline struct smc_sock *smc_sk(const struct sock *sk) · 28 unmodified lines | |||
| 264 | return (struct smc_sock *)sk; | 276 | return (struct smc_sock *)sk; |
| 265 | } | 277 | } |
| 266 | 278 | ||
| 279 | static inline struct smc_sock *smc_clcsock_user_data(struct sock *clcsk) | ||
| 280 | { | ||
| 281 | return (struct smc_sock *) | ||
| 282 | ((uintptr_t)clcsk->sk_user_data & ~SK_USER_DATA_NOCOPY); | ||
| 283 | } | ||
| 284 | |||
| 267 | extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */ | 285 | extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */ |
| 268 | extern struct workqueue_struct *smc_close_wq; /* wq for close work */ | 286 | extern struct workqueue_struct *smc_close_wq; /* wq for close work */ |
| 269 | 287 | ||
| @@ -146,13 +146,11 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, · 145 unmodified lines | |||
| 146 | (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) && | 146 | (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) && |
| 147 | !list_empty(&smc->conn.lgr->list)) { | 147 | !list_empty(&smc->conn.lgr->list)) { |
| 148 | struct smc_link *link = smc->conn.lnk; | 148 | struct smc_link *link = smc->conn.lnk; |
| 149 | struct net *net = read_pnet(&link->smcibdev->ibdev->coredev.rdma_net); | ||
| 150 | 149 | ||
| 151 | struct smc_diag_lgrinfo linfo = { | 150 | struct smc_diag_lgrinfo linfo = { |
| 152 | .role = smc->conn.lgr->role, | 151 | .role = smc->conn.lgr->role, |
| 153 | .lnk[0].ibport = link->ibport, | 152 | .lnk[0].ibport = link->ibport, |
| 154 | .lnk[0].link_id = link->link_id, | 153 | .lnk[0].link_id = link->link_id, |
| 155 | .lnk[0].net_cookie = net->net_cookie, | ||
| 156 | }; | 154 | }; |
| 157 | 155 | ||
| 158 | memcpy(linfo.lnk[0].ibname, | 156 | memcpy(linfo.lnk[0].ibname, |
| @@ -600,9 +600,9 @@ static int __rpc_rmdir(struct inode *dir, struct dentry *dentry) · 599 unmodified lines | |||
| 600 | 600 | ||
| 601 | dget(dentry); | 601 | dget(dentry); |
| 602 | ret = simple_rmdir(dir, dentry); | 602 | ret = simple_rmdir(dir, dentry); |
| 603 | d_drop(dentry); | ||
| 603 | if (!ret) | 604 | if (!ret) |
| 604 | fsnotify_rmdir(dir, dentry); | 605 | fsnotify_rmdir(dir, dentry); |
| 605 | d_delete(dentry); | ||
| 606 | dput(dentry); | 606 | dput(dentry); |
| 607 | return ret; | 607 | return ret; |
| 608 | } | 608 | } |
| @@ -613,9 +613,9 @@ static int __rpc_unlink(struct inode *dir, struct dentry *dentry) · 4 unmodified lines | |||
| 613 | 613 | ||
| 614 | dget(dentry); | 614 | dget(dentry); |
| 615 | ret = simple_unlink(dir, dentry); | 615 | ret = simple_unlink(dir, dentry); |
| 616 | d_drop(dentry); | ||
| 616 | if (!ret) | 617 | if (!ret) |
| 617 | fsnotify_unlink(dir, dentry); | 618 | fsnotify_unlink(dir, dentry); |
| 618 | d_delete(dentry); | ||
| 619 | dput(dentry); | 619 | dput(dentry); |
| 620 | return ret; | 620 | return ret; |
| 621 | } | 621 | } |
| @@ -25,7 +25,7 @@ HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/x86/include · 24 unmodified lines | |||
| 25 | HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED | 25 | HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED |
| 26 | endif | 26 | endif |
| 27 | 27 | ||
| 28 | ifdef CONFIG_DYNAMIC_FTRACE | 28 | ifdef CONFIG_BUILDTIME_MCOUNT_SORT |
| 29 | HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED | 29 | HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED |
| 30 | endif | 30 | endif |
| 31 | 31 | ||
| @@ -1048,8 +1048,19 @@ int security_dentry_init_security(struct dentry *dentry, int mode, · 1047 unmodified lines | |||
| 1048 | const char **xattr_name, void **ctx, | 1048 | const char **xattr_name, void **ctx, |
| 1049 | u32 *ctxlen) | 1049 | u32 *ctxlen) |
| 1050 | { | 1050 | { |
| 1051 | return call_int_hook(dentry_init_security, -EOPNOTSUPP, dentry, mode, | 1051 | struct security_hook_list *hp; |
| 1052 | name, xattr_name, ctx, ctxlen); | 1052 | int rc; |
| 1053 | |||
| 1054 | /* | ||
| 1055 | * Only one module will provide a security context. | ||
| 1056 | */ | ||
| 1057 | hlist_for_each_entry(hp, &security_hook_heads.dentry_init_security, list) { | ||
| 1058 | rc = hp->hook.dentry_init_security(dentry, mode, name, | ||
| 1059 | xattr_name, ctx, ctxlen); | ||
| 1060 | if (rc != LSM_RET_DEFAULT(dentry_init_security)) | ||
| 1061 | return rc; | ||
| 1062 | } | ||
| 1063 | return LSM_RET_DEFAULT(dentry_init_security); | ||
| 1053 | } | 1064 | } |
| 1054 | EXPORT_SYMBOL(security_dentry_init_security); | 1065 | EXPORT_SYMBOL(security_dentry_init_security); |
| 1055 | 1066 | ||
| @@ -152,6 +152,8 @@ static void cond_list_destroy(struct policydb *p) · 151 unmodified lines | |||
| 152 | for (i = 0; i < p->cond_list_len; i++) | 152 | for (i = 0; i < p->cond_list_len; i++) |
| 153 | cond_node_destroy(&p->cond_list[i]); | 153 | cond_node_destroy(&p->cond_list[i]); |
| 154 | kfree(p->cond_list); | 154 | kfree(p->cond_list); |
| 155 | p->cond_list = NULL; | ||
| 156 | p->cond_list_len = 0; | ||
| 155 | } | 157 | } |
| 156 | 158 | ||
| 157 | void cond_policydb_destroy(struct policydb *p) | 159 | void cond_policydb_destroy(struct policydb *p) |
| @@ -441,7 +443,6 @@ int cond_read_list(struct policydb *p, void *fp) · 283 unmodified lines | |||
| 441 | return 0; | 443 | return 0; |
| 442 | err: | 444 | err: |
| 443 | cond_list_destroy(p); | 445 | cond_list_destroy(p); |
| 444 | p->cond_list = NULL; | ||
| 445 | return rc; | 446 | return rc; |
| 446 | } | 447 | } |
| 447 | 448 | ||
| @@ -452,6 +452,9 @@ struct kvm_sync_regs { · 451 unmodified lines | |||
| 452 | 452 | ||
| 453 | #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001 | 453 | #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001 |
| 454 | 454 | ||
| 455 | /* attributes for system fd (group 0) */ | ||
| 456 | #define KVM_X86_XCOMP_GUEST_SUPP 0 | ||
| 457 | |||
| 455 | struct kvm_vmx_nested_state_data { | 458 | struct kvm_vmx_nested_state_data { |
| 456 | __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; | 459 | __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; |
| 457 | __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; | 460 | __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; |
| @@ -9,7 +9,11 @@ ifeq ($(V),1) · 8 unmodified lines | |||
| 9 | msg = | 9 | msg = |
| 10 | else | 10 | else |
| 11 | Q = @ | 11 | Q = @ |
| 12 | msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))"; | 12 | ifeq ($(silent),1) |
| 13 | msg = | ||
| 14 | else | ||
| 15 | msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))"; | ||
| 16 | endif | ||
| 13 | MAKEFLAGS=--no-print-directory | 17 | MAKEFLAGS=--no-print-directory |
| 14 | endif | 18 | endif |
| 15 | 19 | ||
| @@ -1133,6 +1133,7 @@ struct kvm_ppc_resize_hpt { · 1132 unmodified lines | |||
| 1133 | #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 | 1133 | #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 |
| 1134 | #define KVM_CAP_VM_GPA_BITS 207 | 1134 | #define KVM_CAP_VM_GPA_BITS 207 |
| 1135 | #define KVM_CAP_XSAVE2 208 | 1135 | #define KVM_CAP_XSAVE2 208 |
| 1136 | #define KVM_CAP_SYS_ATTRIBUTES 209 | ||
| 1136 | 1137 | ||
| 1137 | #ifdef KVM_CAP_IRQ_ROUTING | 1138 | #ifdef KVM_CAP_IRQ_ROUTING |
| 1138 | 1139 | ||
| @@ -1,229 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* | ||
| 3 | * lirc.h - linux infrared remote control header file | ||
| 4 | * last modified 2010/07/13 by Jarod Wilson | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _LINUX_LIRC_H | ||
| 8 | #define _LINUX_LIRC_H | ||
| 9 | |||
| 10 | #include <linux/types.h> | ||
| 11 | #include <linux/ioctl.h> | ||
| 12 | |||
| 13 | #define PULSE_BIT 0x01000000 | ||
| 14 | #define PULSE_MASK 0x00FFFFFF | ||
| 15 | |||
| 16 | #define LIRC_MODE2_SPACE 0x00000000 | ||
| 17 | #define LIRC_MODE2_PULSE 0x01000000 | ||
| 18 | #define LIRC_MODE2_FREQUENCY 0x02000000 | ||
| 19 | #define LIRC_MODE2_TIMEOUT 0x03000000 | ||
| 20 | |||
| 21 | #define LIRC_VALUE_MASK 0x00FFFFFF | ||
| 22 | #define LIRC_MODE2_MASK 0xFF000000 | ||
| 23 | |||
| 24 | #define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE) | ||
| 25 | #define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE) | ||
| 26 | #define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY) | ||
| 27 | #define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT) | ||
| 28 | |||
| 29 | #define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK) | ||
| 30 | #define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK) | ||
| 31 | |||
| 32 | #define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE) | ||
| 33 | #define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE) | ||
| 34 | #define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY) | ||
| 35 | #define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT) | ||
| 36 | |||
| 37 | /* used heavily by lirc userspace */ | ||
| 38 | #define lirc_t int | ||
| 39 | |||
| 40 | /*** lirc compatible hardware features ***/ | ||
| 41 | |||
| 42 | #define LIRC_MODE2SEND(x) (x) | ||
| 43 | #define LIRC_SEND2MODE(x) (x) | ||
| 44 | #define LIRC_MODE2REC(x) ((x) << 16) | ||
| 45 | #define LIRC_REC2MODE(x) ((x) >> 16) | ||
| 46 | |||
| 47 | #define LIRC_MODE_RAW 0x00000001 | ||
| 48 | #define LIRC_MODE_PULSE 0x00000002 | ||
| 49 | #define LIRC_MODE_MODE2 0x00000004 | ||
| 50 | #define LIRC_MODE_SCANCODE 0x00000008 | ||
| 51 | #define LIRC_MODE_LIRCCODE 0x00000010 | ||
| 52 | |||
| 53 | |||
| 54 | #define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW) | ||
| 55 | #define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE) | ||
| 56 | #define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2) | ||
| 57 | #define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE) | ||
| 58 | |||
| 59 | #define LIRC_CAN_SEND_MASK 0x0000003f | ||
| 60 | |||
| 61 | #define LIRC_CAN_SET_SEND_CARRIER 0x00000100 | ||
| 62 | #define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200 | ||
| 63 | #define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400 | ||
| 64 | |||
| 65 | #define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW) | ||
| 66 | #define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE) | ||
| 67 | #define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2) | ||
| 68 | #define LIRC_CAN_REC_SCANCODE LIRC_MODE2REC(LIRC_MODE_SCANCODE) | ||
| 69 | #define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE) | ||
| 70 | |||
| 71 | #define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK) | ||
| 72 | |||
| 73 | #define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16) | ||
| 74 | #define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16) | ||
| 75 | |||
| 76 | #define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000 | ||
| 77 | #define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000 | ||
| 78 | #define LIRC_CAN_GET_REC_RESOLUTION 0x20000000 | ||
| 79 | #define LIRC_CAN_SET_REC_TIMEOUT 0x10000000 | ||
| 80 | #define LIRC_CAN_SET_REC_FILTER 0x08000000 | ||
| 81 | |||
| 82 | #define LIRC_CAN_MEASURE_CARRIER 0x02000000 | ||
| 83 | #define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000 | ||
| 84 | |||
| 85 | #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) | ||
| 86 | #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) | ||
| 87 | |||
| 88 | #define LIRC_CAN_NOTIFY_DECODE 0x01000000 | ||
| 89 | |||
| 90 | /*** IOCTL commands for lirc driver ***/ | ||
| 91 | |||
| 92 | #define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32) | ||
| 93 | |||
| 94 | #define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32) | ||
| 95 | #define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32) | ||
| 96 | #define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32) | ||
| 97 | |||
| 98 | #define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32) | ||
| 99 | #define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32) | ||
| 100 | |||
| 101 | /* code length in bits, currently only for LIRC_MODE_LIRCCODE */ | ||
| 102 | #define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32) | ||
| 103 | |||
| 104 | #define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32) | ||
| 105 | #define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32) | ||
| 106 | /* Note: these can reset the according pulse_width */ | ||
| 107 | #define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32) | ||
| 108 | #define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32) | ||
| 109 | #define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32) | ||
| 110 | #define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32) | ||
| 111 | |||
| 112 | /* | ||
| 113 | * when a timeout != 0 is set the driver will send a | ||
| 114 | * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is | ||
| 115 | * never sent, timeout is disabled by default | ||
| 116 | */ | ||
| 117 | #define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32) | ||
| 118 | |||
| 119 | /* 1 enables, 0 disables timeout reports in MODE2 */ | ||
| 120 | #define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32) | ||
| 121 | |||
| 122 | /* | ||
| 123 | * if enabled from the next key press on the driver will send | ||
| 124 | * LIRC_MODE2_FREQUENCY packets | ||
| 125 | */ | ||
| 126 | #define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) | ||
| 127 | |||
| 128 | /* | ||
| 129 | * to set a range use LIRC_SET_REC_CARRIER_RANGE with the | ||
| 130 | * lower bound first and later LIRC_SET_REC_CARRIER with the upper bound | ||
| 131 | */ | ||
| 132 | #define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32) | ||
| 133 | |||
| 134 | #define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32) | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Return the recording timeout, which is either set by | ||
| 138 | * the ioctl LIRC_SET_REC_TIMEOUT or by the kernel after setting the protocols. | ||
| 139 | */ | ||
| 140 | #define LIRC_GET_REC_TIMEOUT _IOR('i', 0x00000024, __u32) | ||
| 141 | |||
| 142 | /* | ||
| 143 | * struct lirc_scancode - decoded scancode with protocol for use with | ||
| 144 | * LIRC_MODE_SCANCODE | ||
| 145 | * | ||
| 146 | * @timestamp: Timestamp in nanoseconds using CLOCK_MONOTONIC when IR | ||
| 147 | * was decoded. | ||
| 148 | * @flags: should be 0 for transmit. When receiving scancodes, | ||
| 149 | * LIRC_SCANCODE_FLAG_TOGGLE or LIRC_SCANCODE_FLAG_REPEAT can be set | ||
| 150 | * depending on the protocol | ||
| 151 | * @rc_proto: see enum rc_proto | ||
| 152 | * @keycode: the translated keycode. Set to 0 for transmit. | ||
| 153 | * @scancode: the scancode received or to be sent | ||
| 154 | */ | ||
| 155 | struct lirc_scancode { | ||
| 156 | __u64 timestamp; | ||
| 157 | __u16 flags; | ||
| 158 | __u16 rc_proto; | ||
| 159 | __u32 keycode; | ||
| 160 | __u64 scancode; | ||
| 161 | }; | ||
| 162 | |||
| 163 | /* Set if the toggle bit of rc-5 or rc-6 is enabled */ | ||
| 164 | #define LIRC_SCANCODE_FLAG_TOGGLE 1 | ||
| 165 | /* Set if this is a nec or sanyo repeat */ | ||
| 166 | #define LIRC_SCANCODE_FLAG_REPEAT 2 | ||
| 167 | |||
| 168 | /** | ||
| 169 | * enum rc_proto - the Remote Controller protocol | ||
| 170 | * | ||
| 171 | * @RC_PROTO_UNKNOWN: Protocol not known | ||
| 172 | * @RC_PROTO_OTHER: Protocol known but proprietary | ||
| 173 | * @RC_PROTO_RC5: Philips RC5 protocol | ||
| 174 | * @RC_PROTO_RC5X_20: Philips RC5x 20 bit protocol | ||
| 175 | * @RC_PROTO_RC5_SZ: StreamZap variant of RC5 | ||
| 176 | * @RC_PROTO_JVC: JVC protocol | ||
| 177 | * @RC_PROTO_SONY12: Sony 12 bit protocol | ||
| 178 | * @RC_PROTO_SONY15: Sony 15 bit protocol | ||
| 179 | * @RC_PROTO_SONY20: Sony 20 bit protocol | ||
| 180 | * @RC_PROTO_NEC: NEC protocol | ||
| 181 | * @RC_PROTO_NECX: Extended NEC protocol | ||
| 182 | * @RC_PROTO_NEC32: NEC 32 bit protocol | ||
| 183 | * @RC_PROTO_SANYO: Sanyo protocol | ||
| 184 | * @RC_PROTO_MCIR2_KBD: RC6-ish MCE keyboard | ||
| 185 | * @RC_PROTO_MCIR2_MSE: RC6-ish MCE mouse | ||
| 186 | * @RC_PROTO_RC6_0: Philips RC6-0-16 protocol | ||
| 187 | * @RC_PROTO_RC6_6A_20: Philips RC6-6A-20 protocol | ||
| 188 | * @RC_PROTO_RC6_6A_24: Philips RC6-6A-24 protocol | ||
| 189 | * @RC_PROTO_RC6_6A_32: Philips RC6-6A-32 protocol | ||
| 190 | * @RC_PROTO_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol | ||
| 191 | * @RC_PROTO_SHARP: Sharp protocol | ||
| 192 | * @RC_PROTO_XMP: XMP protocol | ||
| 193 | * @RC_PROTO_CEC: CEC protocol | ||
| 194 | * @RC_PROTO_IMON: iMon Pad protocol | ||
| 195 | * @RC_PROTO_RCMM12: RC-MM protocol 12 bits | ||
| 196 | * @RC_PROTO_RCMM24: RC-MM protocol 24 bits | ||
| 197 | * @RC_PROTO_RCMM32: RC-MM protocol 32 bits | ||
| 198 | */ | ||
| 199 | enum rc_proto { | ||
| 200 | RC_PROTO_UNKNOWN = 0, | ||
| 201 | RC_PROTO_OTHER = 1, | ||
| 202 | RC_PROTO_RC5 = 2, | ||
| 203 | RC_PROTO_RC5X_20 = 3, | ||
| 204 | RC_PROTO_RC5_SZ = 4, | ||
| 205 | RC_PROTO_JVC = 5, | ||
| 206 | RC_PROTO_SONY12 = 6, | ||
| 207 | RC_PROTO_SONY15 = 7, | ||
| 208 | RC_PROTO_SONY20 = 8, | ||
| 209 | RC_PROTO_NEC = 9, | ||
| 210 | RC_PROTO_NECX = 10, | ||
| 211 | RC_PROTO_NEC32 = 11, | ||
| 212 | RC_PROTO_SANYO = 12, | ||
| 213 | RC_PROTO_MCIR2_KBD = 13, | ||
| 214 | RC_PROTO_MCIR2_MSE = 14, | ||
| 215 | RC_PROTO_RC6_0 = 15, | ||
| 216 | RC_PROTO_RC6_6A_20 = 16, | ||
| 217 | RC_PROTO_RC6_6A_24 = 17, | ||
| 218 | RC_PROTO_RC6_6A_32 = 18, | ||
| 219 | RC_PROTO_RC6_MCE = 19, | ||
| 220 | RC_PROTO_SHARP = 20, | ||
| 221 | RC_PROTO_XMP = 21, | ||
| 222 | RC_PROTO_CEC = 22, | ||
| 223 | RC_PROTO_IMON = 23, | ||
| 224 | RC_PROTO_RCMM12 = 24, | ||
| 225 | RC_PROTO_RCMM24 = 25, | ||
| 226 | RC_PROTO_RCMM32 = 26, | ||
| 227 | }; | ||
| 228 | |||
| 229 | #endif | ||
| @@ -90,7 +90,7 @@ EXTRA_WARNINGS += -Wstrict-aliasing=3 · 89 unmodified lines | |||
| 90 | 90 | ||
| 91 | else ifneq ($(CROSS_COMPILE),) | 91 | else ifneq ($(CROSS_COMPILE),) |
| 92 | CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) | 92 | CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) |
| 93 | GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc)) | 93 | GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null)) |
| 94 | ifneq ($(GCC_TOOLCHAIN_DIR),) | 94 | ifneq ($(GCC_TOOLCHAIN_DIR),) |
| 95 | CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) | 95 | CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) |
| 96 | CLANG_CROSS_FLAGS += --sysroot=$(shell $(CROSS_COMPILE)gcc -print-sysroot) | 96 | CLANG_CROSS_FLAGS += --sysroot=$(shell $(CROSS_COMPILE)gcc -print-sysroot) |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | |||
| 6 | # Author: Felix Guo <felixguoxiuping@gmail.com> | 6 | # Author: Felix Guo <felixguoxiuping@gmail.com> |
| 7 | # Author: Brendan Higgins <brendanhiggins@google.com> | 7 | # Author: Brendan Higgins <brendanhiggins@google.com> |
| 8 | 8 | ||
| 9 | import importlib.abc | ||
| 9 | import importlib.util | 10 | import importlib.util |
| 10 | import logging | 11 | import logging |
| 11 | import subprocess | 12 | import subprocess |
| @@ -74,7 +74,7 @@ static inline unsigned long page_to_phys(struct page *page) · 73 unmodified lines | |||
| 74 | __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \ | 74 | __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \ |
| 75 | x, y) | 75 | x, y) |
| 76 | 76 | ||
| 77 | #define preemptible() (1) | 77 | #define pagefault_disabled() (0) |
| 78 | 78 | ||
| 79 | static inline void *kmap(struct page *page) | 79 | static inline void *kmap(struct page *page) |
| 80 | { | 80 | { |
| @@ -127,6 +127,7 @@ kmalloc_array(unsigned int n, unsigned int size, unsigned int flags) · 46 unmodified lines | |||
| 127 | #define kmemleak_free(a) | 127 | #define kmemleak_free(a) |
| 128 | 128 | ||
| 129 | #define PageSlab(p) (0) | 129 | #define PageSlab(p) (0) |
| 130 | #define flush_dcache_page(p) | ||
| 130 | 131 | ||
| 131 | #define MAX_ERRNO 4095 | 132 | #define MAX_ERRNO 4095 |
| 132 | 133 | ||
| @@ -261,7 +261,7 @@ static void ptrace_sve_fpsimd(pid_t child, const struct vec_type *type) · 260 unmodified lines | |||
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | ksft_test_result((sve->flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD, | 263 | ksft_test_result((sve->flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD, |
| 264 | "Set FPSIMD registers via %s\n", type->name); | 264 | "Got FPSIMD registers via %s\n", type->name); |
| 265 | if ((sve->flags & SVE_PT_REGS_MASK) != SVE_PT_REGS_FPSIMD) | 265 | if ((sve->flags & SVE_PT_REGS_MASK) != SVE_PT_REGS_FPSIMD) |
| 266 | goto out; | 266 | goto out; |
| 267 | 267 | ||
| @@ -557,7 +557,14 @@ static int do_parent(pid_t child) · 289 unmodified lines | |||
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | /* prctl() flags */ | 559 | /* prctl() flags */ |
| 560 | ptrace_set_get_inherit(child, &vec_types[i]); | 560 | if (getauxval(vec_types[i].hwcap_type) & vec_types[i].hwcap) { |
| 561 | ptrace_set_get_inherit(child, &vec_types[i]); | ||
| 562 | } else { | ||
| 563 | ksft_test_result_skip("%s SVE_PT_VL_INHERIT set\n", | ||
| 564 | vec_types[i].name); | ||
| 565 | ksft_test_result_skip("%s SVE_PT_VL_INHERIT cleared\n", | ||
| 566 | vec_types[i].name); | ||
| 567 | } | ||
| 561 | 568 | ||
| 562 | /* Step through every possible VQ */ | 569 | /* Step through every possible VQ */ |
| 563 | for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) { | 570 | for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) { |
| @@ -28,7 +28,6 @@ · 27 unmodified lines | |||
| 28 | // 5. We can read keycode from same /dev/lirc device | 28 | // 5. We can read keycode from same /dev/lirc device |
| 29 | 29 | ||
| 30 | #include <linux/bpf.h> | 30 | #include <linux/bpf.h> |
| 31 | #include <linux/lirc.h> | ||
| 32 | #include <linux/input.h> | 31 | #include <linux/input.h> |
| 33 | #include <errno.h> | 32 | #include <errno.h> |
| 34 | #include <stdio.h> | 33 | #include <stdio.h> |
| @@ -194,5 +194,5 @@ prerequisite · 193 unmodified lines | |||
| 194 | 194 | ||
| 195 | # Run requested functions | 195 | # Run requested functions |
| 196 | clear_dumps $OUTFILE | 196 | clear_dumps $OUTFILE |
| 197 | do_test >> $OUTFILE.txt | 197 | do_test | tee -a $OUTFILE.txt |
| 198 | dmesg_dumps $OUTFILE | 198 | dmesg_dumps $OUTFILE |
| @@ -5,7 +5,7 @@ CFLAGS += -D_GNU_SOURCE · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | TEST_PROGS := binfmt_script non-regular | 6 | TEST_PROGS := binfmt_script non-regular |
| 7 | TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 | 7 | TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 |
| 8 | TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe | 8 | TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir |
| 9 | # Makefile is a run-time dependency, since it's accessed by the execveat test | 9 | # Makefile is a run-time dependency, since it's accessed by the execveat test |
| 10 | TEST_FILES := Makefile | 10 | TEST_FILES := Makefile |
| 11 | 11 | ||
| @@ -11,7 +11,7 @@ all: · 10 unmodified lines | |||
| 11 | @for DIR in $(SUBDIRS); do \ | 11 | @for DIR in $(SUBDIRS); do \ |
| 12 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ | 12 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
| 13 | mkdir $$BUILD_TARGET -p; \ | 13 | mkdir $$BUILD_TARGET -p; \ |
| 14 | make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ | 14 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
| 15 | if [ -e $$DIR/$(TEST_PROGS) ]; then \ | 15 | if [ -e $$DIR/$(TEST_PROGS) ]; then \ |
| 16 | rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \ | 16 | rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \ |
| 17 | fi \ | 17 | fi \ |
| @@ -32,6 +32,6 @@ override define CLEAN · 14 unmodified lines | |||
| 32 | @for DIR in $(SUBDIRS); do \ | 32 | @for DIR in $(SUBDIRS); do \ |
| 33 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ | 33 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
| 34 | mkdir $$BUILD_TARGET -p; \ | 34 | mkdir $$BUILD_TARGET -p; \ |
| 35 | make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ | 35 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
| 36 | done | 36 | done |
| 37 | endef | 37 | endef |
| @@ -877,7 +877,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext) · 876 unmodified lines | |||
| 877 | } | 877 | } |
| 878 | 878 | ||
| 879 | t->timed_out = true; | 879 | t->timed_out = true; |
| 880 | kill(t->pid, SIGKILL); | 880 | // signal process group |
| 881 | kill(-(t->pid), SIGKILL); | ||
| 881 | } | 882 | } |
| 882 | 883 | ||
| 883 | void __wait_for_test(struct __test_metadata *t) | 884 | void __wait_for_test(struct __test_metadata *t) |
| @@ -987,6 +988,7 @@ void __run_test(struct __fixture_metadata *f, · 103 unmodified lines | |||
| 987 | ksft_print_msg("ERROR SPAWNING TEST CHILD\n"); | 988 | ksft_print_msg("ERROR SPAWNING TEST CHILD\n"); |
| 988 | t->passed = 0; | 989 | t->passed = 0; |
| 989 | } else if (t->pid == 0) { | 990 | } else if (t->pid == 0) { |
| 991 | setpgrp(); | ||
| 990 | t->fn(t, variant); | 992 | t->fn(t, variant); |
| 991 | if (t->skip) | 993 | if (t->skip) |
| 992 | _exit(255); | 994 | _exit(255); |
| @@ -85,6 +85,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test · 84 unmodified lines | |||
| 85 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_pi_mmio_test | 85 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_pi_mmio_test |
| 86 | TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests | 86 | TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests |
| 87 | TEST_GEN_PROGS_x86_64 += x86_64/amx_test | 87 | TEST_GEN_PROGS_x86_64 += x86_64/amx_test |
| 88 | TEST_GEN_PROGS_x86_64 += access_tracking_perf_test | ||
| 88 | TEST_GEN_PROGS_x86_64 += demand_paging_test | 89 | TEST_GEN_PROGS_x86_64 += demand_paging_test |
| 89 | TEST_GEN_PROGS_x86_64 += dirty_log_test | 90 | TEST_GEN_PROGS_x86_64 += dirty_log_test |
| 90 | TEST_GEN_PROGS_x86_64 += dirty_log_perf_test | 91 | TEST_GEN_PROGS_x86_64 += dirty_log_perf_test |
| @@ -345,7 +345,6 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, · 344 unmodified lines | |||
| 345 | * guest_code - The vCPU's entry point | 345 | * guest_code - The vCPU's entry point |
| 346 | */ | 346 | */ |
| 347 | void vm_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid, void *guest_code); | 347 | void vm_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid, void *guest_code); |
| 348 | void vm_xsave_req_perm(void); | ||
| 349 | 348 | ||
| 350 | bool vm_is_unrestricted_guest(struct kvm_vm *vm); | 349 | bool vm_is_unrestricted_guest(struct kvm_vm *vm); |
| 351 | 350 | ||
| @@ -458,6 +458,7 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2, · 457 unmodified lines | |||
| 458 | struct kvm_cpuid2 *kvm_get_supported_hv_cpuid(void); | 458 | struct kvm_cpuid2 *kvm_get_supported_hv_cpuid(void); |
| 459 | void vcpu_set_hv_cpuid(struct kvm_vm *vm, uint32_t vcpuid); | 459 | void vcpu_set_hv_cpuid(struct kvm_vm *vm, uint32_t vcpuid); |
| 460 | struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vm *vm, uint32_t vcpuid); | 460 | struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vm *vm, uint32_t vcpuid); |
| 461 | void vm_xsave_req_perm(int bit); | ||
| 461 | 462 | ||
| 462 | enum x86_page_size { | 463 | enum x86_page_size { |
| 463 | X86_PAGE_SIZE_4K = 0, | 464 | X86_PAGE_SIZE_4K = 0, |
| @@ -393,13 +393,6 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, · 392 unmodified lines | |||
| 393 | struct kvm_vm *vm; | 393 | struct kvm_vm *vm; |
| 394 | int i; | 394 | int i; |
| 395 | 395 | ||
| 396 | #ifdef __x86_64__ | ||
| 397 | /* | ||
| 398 | * Permission needs to be requested before KVM_SET_CPUID2. | ||
| 399 | */ | ||
| 400 | vm_xsave_req_perm(); | ||
| 401 | #endif | ||
| 402 | |||
| 403 | /* Force slot0 memory size not small than DEFAULT_GUEST_PHY_PAGES */ | 396 | /* Force slot0 memory size not small than DEFAULT_GUEST_PHY_PAGES */ |
| 404 | if (slot0_mem_pages < DEFAULT_GUEST_PHY_PAGES) | 397 | if (slot0_mem_pages < DEFAULT_GUEST_PHY_PAGES) |
| 405 | slot0_mem_pages = DEFAULT_GUEST_PHY_PAGES; | 398 | slot0_mem_pages = DEFAULT_GUEST_PHY_PAGES; |
| @@ -665,16 +665,31 @@ static bool is_xfd_supported(void) · 664 unmodified lines | |||
| 665 | return !!(eax & CPUID_XFD_BIT); | 665 | return !!(eax & CPUID_XFD_BIT); |
| 666 | } | 666 | } |
| 667 | 667 | ||
| 668 | void vm_xsave_req_perm(void) | 668 | void vm_xsave_req_perm(int bit) |
| 669 | { | 669 | { |
| 670 | unsigned long bitmask; | 670 | int kvm_fd; |
| 671 | u64 bitmask; | ||
| 671 | long rc; | 672 | long rc; |
| 673 | struct kvm_device_attr attr = { | ||
| 674 | .group = 0, | ||
| 675 | .attr = KVM_X86_XCOMP_GUEST_SUPP, | ||
| 676 | .addr = (unsigned long) &bitmask | ||
| 677 | }; | ||
| 678 | |||
| 679 | kvm_fd = open_kvm_dev_path_or_exit(); | ||
| 680 | rc = ioctl(kvm_fd, KVM_GET_DEVICE_ATTR, &attr); | ||
| 681 | close(kvm_fd); | ||
| 682 | if (rc == -1 && (errno == ENXIO || errno == EINVAL)) | ||
| 683 | exit(KSFT_SKIP); | ||
| 684 | TEST_ASSERT(rc == 0, "KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) error: %ld", rc); | ||
| 685 | if (!(bitmask & (1ULL << bit))) | ||
| 686 | exit(KSFT_SKIP); | ||
| 672 | 687 | ||
| 673 | if (!is_xfd_supported()) | 688 | if (!is_xfd_supported()) |
| 674 | return; | 689 | exit(KSFT_SKIP); |
| 690 | |||
| 691 | rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit); | ||
| 675 | 692 | ||
| 676 | rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, | ||
| 677 | XSTATE_XTILE_DATA_BIT); | ||
| 678 | /* | 693 | /* |
| 679 | * The older kernel version(<5.15) can't support | 694 | * The older kernel version(<5.15) can't support |
| 680 | * ARCH_REQ_XCOMP_GUEST_PERM and directly return. | 695 | * ARCH_REQ_XCOMP_GUEST_PERM and directly return. |
| @@ -684,7 +699,7 @@ void vm_xsave_req_perm(void) · 3 unmodified lines | |||
| 684 | 699 | ||
| 685 | rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_GUEST_PERM, &bitmask); | 700 | rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_GUEST_PERM, &bitmask); |
| 686 | TEST_ASSERT(rc == 0, "prctl(ARCH_GET_XCOMP_GUEST_PERM) error: %ld", rc); | 701 | TEST_ASSERT(rc == 0, "prctl(ARCH_GET_XCOMP_GUEST_PERM) error: %ld", rc); |
| 687 | TEST_ASSERT(bitmask & XFEATURE_XTILE_MASK, | 702 | TEST_ASSERT(bitmask & (1ULL << bit), |
| 688 | "prctl(ARCH_REQ_XCOMP_GUEST_PERM) failure bitmask=0x%lx", | 703 | "prctl(ARCH_REQ_XCOMP_GUEST_PERM) failure bitmask=0x%lx", |
| 689 | bitmask); | 704 | bitmask); |
| 690 | } | 705 | } |
| @@ -329,6 +329,8 @@ int main(int argc, char *argv[]) · 328 unmodified lines | |||
| 329 | u32 amx_offset; | 329 | u32 amx_offset; |
| 330 | int stage, ret; | 330 | int stage, ret; |
| 331 | 331 | ||
| 332 | vm_xsave_req_perm(XSTATE_XTILE_DATA_BIT); | ||
| 333 | |||
| 332 | /* Create VM */ | 334 | /* Create VM */ |
| 333 | vm = vm_create_default(VCPU_ID, 0, guest_code); | 335 | vm = vm_create_default(VCPU_ID, 0, guest_code); |
| 334 | 336 | ||
| @@ -105,7 +105,6 @@ static void guest_code(void *arg) · 104 unmodified lines | |||
| 105 | 105 | ||
| 106 | if (cpu_has_svm()) { | 106 | if (cpu_has_svm()) { |
| 107 | run_guest(svm->vmcb, svm->vmcb_gpa); | 107 | run_guest(svm->vmcb, svm->vmcb_gpa); |
| 108 | svm->vmcb->save.rip += 3; | ||
| 109 | run_guest(svm->vmcb, svm->vmcb_gpa); | 108 | run_guest(svm->vmcb, svm->vmcb_gpa); |
| 110 | } else { | 109 | } else { |
| 111 | vmlaunch(); | 110 | vmlaunch(); |
| @@ -207,15 +207,21 @@ TEST(check_file_mmap) · 206 unmodified lines | |||
| 207 | 207 | ||
| 208 | errno = 0; | 208 | errno = 0; |
| 209 | fd = open(".", O_TMPFILE | O_RDWR, 0600); | 209 | fd = open(".", O_TMPFILE | O_RDWR, 0600); |
| 210 | ASSERT_NE(-1, fd) { | 210 | if (fd < 0) { |
| 211 | TH_LOG("Can't create temporary file: %s", | 211 | ASSERT_EQ(errno, EOPNOTSUPP) { |
| 212 | strerror(errno)); | 212 | TH_LOG("Can't create temporary file: %s", |
| 213 | strerror(errno)); | ||
| 214 | } | ||
| 215 | SKIP(goto out_free, "O_TMPFILE not supported by filesystem."); | ||
| 213 | } | 216 | } |
| 214 | errno = 0; | 217 | errno = 0; |
| 215 | retval = fallocate(fd, 0, 0, FILE_SIZE); | 218 | retval = fallocate(fd, 0, 0, FILE_SIZE); |
| 216 | ASSERT_EQ(0, retval) { | 219 | if (retval) { |
| 217 | TH_LOG("Error allocating space for the temporary file: %s", | 220 | ASSERT_EQ(errno, EOPNOTSUPP) { |
| 218 | strerror(errno)); | 221 | TH_LOG("Error allocating space for the temporary file: %s", |
| 222 | strerror(errno)); | ||
| 223 | } | ||
| 224 | SKIP(goto out_close, "fallocate not supported by filesystem."); | ||
| 219 | } | 225 | } |
| 220 | 226 | ||
| 221 | /* | 227 | /* |
| @@ -271,7 +277,9 @@ TEST(check_file_mmap) · 49 unmodified lines | |||
| 271 | } | 277 | } |
| 272 | 278 | ||
| 273 | munmap(addr, FILE_SIZE); | 279 | munmap(addr, FILE_SIZE); |
| 280 | out_close: | ||
| 274 | close(fd); | 281 | close(fd); |
| 282 | out_free: | ||
| 275 | free(vec); | 283 | free(vec); |
| 276 | } | 284 | } |
| 277 | 285 | ||
| @@ -27,7 +27,7 @@ TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto · 26 unmodified lines | |||
| 27 | net6_port_net6_port net_port_mac_proto_net" | 27 | net6_port_net6_port net_port_mac_proto_net" |
| 28 | 28 | ||
| 29 | # Reported bugs, also described by TYPE_ variables below | 29 | # Reported bugs, also described by TYPE_ variables below |
| 30 | BUGS="flush_remove_add" | 30 | BUGS="flush_remove_add reload" |
| 31 | 31 | ||
| 32 | # List of possible paths to pktgen script from kernel tree for performance tests | 32 | # List of possible paths to pktgen script from kernel tree for performance tests |
| 33 | PKTGEN_SCRIPT_PATHS=" | 33 | PKTGEN_SCRIPT_PATHS=" |
| @@ -354,6 +354,23 @@ TYPE_flush_remove_add=" · 320 unmodified lines | |||
| 354 | display Add two elements, flush, re-add | 354 | display Add two elements, flush, re-add |
| 355 | " | 355 | " |
| 356 | 356 | ||
| 357 | TYPE_reload=" | ||
| 358 | display net,mac with reload | ||
| 359 | type_spec ipv4_addr . ether_addr | ||
| 360 | chain_spec ip daddr . ether saddr | ||
| 361 | dst addr4 | ||
| 362 | src mac | ||
| 363 | start 1 | ||
| 364 | count 1 | ||
| 365 | src_delta 2000 | ||
| 366 | tools sendip nc bash | ||
| 367 | proto udp | ||
| 368 | |||
| 369 | race_repeat 0 | ||
| 370 | |||
| 371 | perf_duration 0 | ||
| 372 | " | ||
| 373 | |||
| 357 | # Set template for all tests, types and rules are filled in depending on test | 374 | # Set template for all tests, types and rules are filled in depending on test |
| 358 | set_template=' | 375 | set_template=' |
| 359 | flush ruleset | 376 | flush ruleset |
| @@ -1473,6 +1490,59 @@ test_bug_flush_remove_add() { · 1113 unmodified lines | |||
| 1473 | nft flush ruleset | 1490 | nft flush ruleset |
| 1474 | } | 1491 | } |
| 1475 | 1492 | ||
| 1493 | # - add ranged element, check that packets match it | ||
| 1494 | # - reload the set, check packets still match | ||
| 1495 | test_bug_reload() { | ||
| 1496 | setup veth send_"${proto}" set || return ${KSELFTEST_SKIP} | ||
| 1497 | rstart=${start} | ||
| 1498 | |||
| 1499 | range_size=1 | ||
| 1500 | for i in $(seq "${start}" $((start + count))); do | ||
| 1501 | end=$((start + range_size)) | ||
| 1502 | |||
| 1503 | # Avoid negative or zero-sized port ranges | ||
| 1504 | if [ $((end / 65534)) -gt $((start / 65534)) ]; then | ||
| 1505 | start=${end} | ||
| 1506 | end=$((end + 1)) | ||
| 1507 | fi | ||
| 1508 | srcstart=$((start + src_delta)) | ||
| 1509 | srcend=$((end + src_delta)) | ||
| 1510 | |||
| 1511 | add "$(format)" || return 1 | ||
| 1512 | range_size=$((range_size + 1)) | ||
| 1513 | start=$((end + range_size)) | ||
| 1514 | done | ||
| 1515 | |||
| 1516 | # check kernel does allocate pcpu sctrach map | ||
| 1517 | # for reload with no elemet add/delete | ||
| 1518 | ( echo flush set inet filter test ; | ||
| 1519 | nft list set inet filter test ) | nft -f - | ||
| 1520 | |||
| 1521 | start=${rstart} | ||
| 1522 | range_size=1 | ||
| 1523 | |||
| 1524 | for i in $(seq "${start}" $((start + count))); do | ||
| 1525 | end=$((start + range_size)) | ||
| 1526 | |||
| 1527 | # Avoid negative or zero-sized port ranges | ||
| 1528 | if [ $((end / 65534)) -gt $((start / 65534)) ]; then | ||
| 1529 | start=${end} | ||
| 1530 | end=$((end + 1)) | ||
| 1531 | fi | ||
| 1532 | srcstart=$((start + src_delta)) | ||
| 1533 | srcend=$((end + src_delta)) | ||
| 1534 | |||
| 1535 | for j in $(seq ${start} $((range_size / 2 + 1)) ${end}); do | ||
| 1536 | send_match "${j}" $((j + src_delta)) || return 1 | ||
| 1537 | done | ||
| 1538 | |||
| 1539 | range_size=$((range_size + 1)) | ||
| 1540 | start=$((end + range_size)) | ||
| 1541 | done | ||
| 1542 | |||
| 1543 | nft flush ruleset | ||
| 1544 | } | ||
| 1545 | |||
| 1476 | test_reported_issues() { | 1546 | test_reported_issues() { |
| 1477 | eval test_bug_"${subtest}" | 1547 | eval test_bug_"${subtest}" |
| 1478 | } | 1548 | } |
| @@ -899,6 +899,144 @@ EOF · 898 unmodified lines | |||
| 899 | ip netns exec "$ns0" nft delete table $family nat | 899 | ip netns exec "$ns0" nft delete table $family nat |
| 900 | } | 900 | } |
| 901 | 901 | ||
| 902 | test_stateless_nat_ip() | ||
| 903 | { | ||
| 904 | local lret=0 | ||
| 905 | |||
| 906 | ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null | ||
| 907 | ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null | ||
| 908 | |||
| 909 | ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 | ||
| 910 | if [ $? -ne 0 ] ; then | ||
| 911 | echo "ERROR: cannot ping $ns1 from $ns2 before loading stateless rules" | ||
| 912 | return 1 | ||
| 913 | fi | ||
| 914 | |||
| 915 | ip netns exec "$ns0" nft -f /dev/stdin <<EOF | ||
| 916 | table ip stateless { | ||
| 917 | map xlate_in { | ||
| 918 | typeof meta iifname . ip saddr . ip daddr : ip daddr | ||
| 919 | elements = { | ||
| 920 | "veth1" . 10.0.2.99 . 10.0.1.99 : 10.0.2.2, | ||
| 921 | } | ||
| 922 | } | ||
| 923 | map xlate_out { | ||
| 924 | typeof meta iifname . ip saddr . ip daddr : ip daddr | ||
| 925 | elements = { | ||
| 926 | "veth0" . 10.0.1.99 . 10.0.2.2 : 10.0.2.99 | ||
| 927 | } | ||
| 928 | } | ||
| 929 | |||
| 930 | chain prerouting { | ||
| 931 | type filter hook prerouting priority -400; policy accept; | ||
| 932 | ip saddr set meta iifname . ip saddr . ip daddr map @xlate_in | ||
| 933 | ip daddr set meta iifname . ip saddr . ip daddr map @xlate_out | ||
| 934 | } | ||
| 935 | } | ||
| 936 | EOF | ||
| 937 | if [ $? -ne 0 ]; then | ||
| 938 | echo "SKIP: Could not add ip statless rules" | ||
| 939 | return $ksft_skip | ||
| 940 | fi | ||
| 941 | |||
| 942 | reset_counters | ||
| 943 | |||
| 944 | ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 | ||
| 945 | if [ $? -ne 0 ] ; then | ||
| 946 | echo "ERROR: cannot ping $ns1 from $ns2 with stateless rules" | ||
| 947 | lret=1 | ||
| 948 | fi | ||
| 949 | |||
| 950 | # ns1 should have seen packets from .2.2, due to stateless rewrite. | ||
| 951 | expect="packets 1 bytes 84" | ||
| 952 | cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect") | ||
| 953 | if [ $? -ne 0 ]; then | ||
| 954 | bad_counter "$ns1" ns0insl "$expect" "test_stateless 1" | ||
| 955 | lret=1 | ||
| 956 | fi | ||
| 957 | |||
| 958 | for dir in "in" "out" ; do | ||
| 959 | cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") | ||
| 960 | if [ $? -ne 0 ]; then | ||
| 961 | bad_counter "$ns2" ns1$dir "$expect" "test_stateless 2" | ||
| 962 | lret=1 | ||
| 963 | fi | ||
| 964 | done | ||
| 965 | |||
| 966 | # ns1 should not have seen packets from ns2, due to masquerade | ||
| 967 | expect="packets 0 bytes 0" | ||
| 968 | for dir in "in" "out" ; do | ||
| 969 | cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") | ||
| 970 | if [ $? -ne 0 ]; then | ||
| 971 | bad_counter "$ns1" ns0$dir "$expect" "test_stateless 3" | ||
| 972 | lret=1 | ||
| 973 | fi | ||
| 974 | |||
| 975 | cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") | ||
| 976 | if [ $? -ne 0 ]; then | ||
| 977 | bad_counter "$ns0" ns1$dir "$expect" "test_stateless 4" | ||
| 978 | lret=1 | ||
| 979 | fi | ||
| 980 | done | ||
| 981 | |||
| 982 | reset_counters | ||
| 983 | |||
| 984 | socat -h > /dev/null 2>&1 | ||
| 985 | if [ $? -ne 0 ];then | ||
| 986 | echo "SKIP: Could not run stateless nat frag test without socat tool" | ||
| 987 | if [ $lret -eq 0 ]; then | ||
| 988 | return $ksft_skip | ||
| 989 | fi | ||
| 990 | |||
| 991 | ip netns exec "$ns0" nft delete table ip stateless | ||
| 992 | return $lret | ||
| 993 | fi | ||
| 994 | |||
| 995 | local tmpfile=$(mktemp) | ||
| 996 | dd if=/dev/urandom of=$tmpfile bs=4096 count=1 2>/dev/null | ||
| 997 | |||
| 998 | local outfile=$(mktemp) | ||
| 999 | ip netns exec "$ns1" timeout 3 socat -u UDP4-RECV:4233 OPEN:$outfile < /dev/null & | ||
| 1000 | sc_r=$! | ||
| 1001 | |||
| 1002 | sleep 1 | ||
| 1003 | # re-do with large ping -> ip fragmentation | ||
| 1004 | ip netns exec "$ns2" timeout 3 socat - UDP4-SENDTO:"10.0.1.99:4233" < "$tmpfile" > /dev/null | ||
| 1005 | if [ $? -ne 0 ] ; then | ||
| 1006 | echo "ERROR: failed to test udp $ns1 to $ns2 with stateless ip nat" 1>&2 | ||
| 1007 | lret=1 | ||
| 1008 | fi | ||
| 1009 | |||
| 1010 | wait | ||
| 1011 | |||
| 1012 | cmp "$tmpfile" "$outfile" | ||
| 1013 | if [ $? -ne 0 ]; then | ||
| 1014 | ls -l "$tmpfile" "$outfile" | ||
| 1015 | echo "ERROR: in and output file mismatch when checking udp with stateless nat" 1>&2 | ||
| 1016 | lret=1 | ||
| 1017 | fi | ||
| 1018 | |||
| 1019 | rm -f "$tmpfile" "$outfile" | ||
| 1020 | |||
| 1021 | # ns1 should have seen packets from 2.2, due to stateless rewrite. | ||
| 1022 | expect="packets 3 bytes 4164" | ||
| 1023 | cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect") | ||
| 1024 | if [ $? -ne 0 ]; then | ||
| 1025 | bad_counter "$ns1" ns0insl "$expect" "test_stateless 5" | ||
| 1026 | lret=1 | ||
| 1027 | fi | ||
| 1028 | |||
| 1029 | ip netns exec "$ns0" nft delete table ip stateless | ||
| 1030 | if [ $? -ne 0 ]; then | ||
| 1031 | echo "ERROR: Could not delete table ip stateless" 1>&2 | ||
| 1032 | lret=1 | ||
| 1033 | fi | ||
| 1034 | |||
| 1035 | test $lret -eq 0 && echo "PASS: IP statless for $ns2" | ||
| 1036 | |||
| 1037 | return $lret | ||
| 1038 | } | ||
| 1039 | |||
| 902 | # ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 | 1040 | # ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 |
| 903 | for i in 0 1 2; do | 1041 | for i in 0 1 2; do |
| 904 | ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF | 1042 | ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF |
| @@ -965,6 +1103,19 @@ table inet filter { · 60 unmodified lines | |||
| 965 | EOF | 1103 | EOF |
| 966 | done | 1104 | done |
| 967 | 1105 | ||
| 1106 | # special case for stateless nat check, counter needs to | ||
| 1107 | # be done before (input) ip defragmentation | ||
| 1108 | ip netns exec ns1-$sfx nft -f /dev/stdin <<EOF | ||
| 1109 | table inet filter { | ||
| 1110 | counter ns0insl {} | ||
| 1111 | |||
| 1112 | chain pre { | ||
| 1113 | type filter hook prerouting priority -400; policy accept; | ||
| 1114 | ip saddr 10.0.2.2 counter name "ns0insl" | ||
| 1115 | } | ||
| 1116 | } | ||
| 1117 | EOF | ||
| 1118 | |||
| 968 | sleep 3 | 1119 | sleep 3 |
| 969 | # test basic connectivity | 1120 | # test basic connectivity |
| 970 | for i in 1 2; do | 1121 | for i in 1 2; do |
| @@ -1019,6 +1170,7 @@ $test_inet_nat && test_redirect inet · 48 unmodified lines | |||
| 1019 | $test_inet_nat && test_redirect6 inet | 1170 | $test_inet_nat && test_redirect6 inet |
| 1020 | 1171 | ||
| 1021 | test_port_shadowing | 1172 | test_port_shadowing |
| 1173 | test_stateless_nat_ip | ||
| 1022 | 1174 | ||
| 1023 | if [ $ret -ne 0 ];then | 1175 | if [ $ret -ne 0 ];then |
| 1024 | echo -n "FAIL: " | 1176 | echo -n "FAIL: " |
| @@ -9,7 +9,7 @@ ns="ns-$sfx" · 8 unmodified lines | |||
| 9 | # Kselftest framework requirement - SKIP code is 4. | 9 | # Kselftest framework requirement - SKIP code is 4. |
| 10 | ksft_skip=4 | 10 | ksft_skip=4 |
| 11 | 11 | ||
| 12 | zones=20000 | 12 | zones=2000 |
| 13 | have_ct_tool=0 | 13 | have_ct_tool=0 |
| 14 | ret=0 | 14 | ret=0 |
| 15 | 15 | ||
| @@ -75,10 +75,10 @@ EOF · 59 unmodified lines | |||
| 75 | 75 | ||
| 76 | while [ $i -lt $max_zones ]; do | 76 | while [ $i -lt $max_zones ]; do |
| 77 | local start=$(date +%s%3N) | 77 | local start=$(date +%s%3N) |
| 78 | i=$((i + 10000)) | 78 | i=$((i + 1000)) |
| 79 | j=$((j + 1)) | 79 | j=$((j + 1)) |
| 80 | # nft rule in output places each packet in a different zone. | 80 | # nft rule in output places each packet in a different zone. |
| 81 | dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345 | 81 | dd if=/dev/zero of=/dev/stdout bs=8k count=1000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345 |
| 82 | if [ $? -ne 0 ] ;then | 82 | if [ $? -ne 0 ] ;then |
| 83 | ret=1 | 83 | ret=1 |
| 84 | break | 84 | break |
| @@ -86,7 +86,7 @@ EOF · 1 unmodified line | |||
| 86 | 86 | ||
| 87 | stop=$(date +%s%3N) | 87 | stop=$(date +%s%3N) |
| 88 | local duration=$((stop-start)) | 88 | local duration=$((stop-start)) |
| 89 | echo "PASS: added 10000 entries in $duration ms (now $i total, loop $j)" | 89 | echo "PASS: added 1000 entries in $duration ms (now $i total, loop $j)" |
| 90 | done | 90 | done |
| 91 | 91 | ||
| 92 | if [ $have_ct_tool -eq 1 ]; then | 92 | if [ $have_ct_tool -eq 1 ]; then |
| @@ -128,11 +128,11 @@ test_conntrack_tool() { · 35 unmodified lines | |||
| 128 | break | 128 | break |
| 129 | fi | 129 | fi |
| 130 | 130 | ||
| 131 | if [ $((i%10000)) -eq 0 ];then | 131 | if [ $((i%1000)) -eq 0 ];then |
| 132 | stop=$(date +%s%3N) | 132 | stop=$(date +%s%3N) |
| 133 | 133 | ||
| 134 | local duration=$((stop-start)) | 134 | local duration=$((stop-start)) |
| 135 | echo "PASS: added 10000 entries in $duration ms (now $i total)" | 135 | echo "PASS: added 1000 entries in $duration ms (now $i total)" |
| 136 | start=$stop | 136 | start=$stop |
| 137 | fi | 137 | fi |
| 138 | done | 138 | done |
| @@ -5,4 +5,4 @@ TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | include ../lib.mk | 6 | include ../lib.mk |
| 7 | 7 | ||
| 8 | $(TEST_GEN_PROGS): helpers.c | 8 | $(TEST_GEN_PROGS): helpers.c helpers.h |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | #define _GNU_SOURCE | 10 | #define _GNU_SOURCE |
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include <stdbool.h> | ||
| 12 | #include <errno.h> | 13 | #include <errno.h> |
| 13 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 14 | #include "../kselftest.h" | 15 | #include "../kselftest.h" |
| @@ -62,11 +63,12 @@ bool needs_openat2(const struct open_how *how); · 47 unmodified lines | |||
| 62 | (similar to chroot(2)). */ | 63 | (similar to chroot(2)). */ |
| 63 | #endif /* RESOLVE_IN_ROOT */ | 64 | #endif /* RESOLVE_IN_ROOT */ |
| 64 | 65 | ||
| 65 | #define E_func(func, ...) \ | 66 | #define E_func(func, ...) \ |
| 66 | do { \ | 67 | do { \ |
| 67 | if (func(__VA_ARGS__) < 0) \ | 68 | errno = 0; \ |
| 68 | ksft_exit_fail_msg("%s:%d %s failed\n", \ | 69 | if (func(__VA_ARGS__) < 0) \ |
| 69 | __FILE__, __LINE__, #func);\ | 70 | ksft_exit_fail_msg("%s:%d %s failed - errno:%d\n", \ |
| 71 | __FILE__, __LINE__, #func, errno); \ | ||
| 70 | } while (0) | 72 | } while (0) |
| 71 | 73 | ||
| 72 | #define E_asprintf(...) E_func(asprintf, __VA_ARGS__) | 74 | #define E_asprintf(...) E_func(asprintf, __VA_ARGS__) |
| @@ -259,6 +259,16 @@ void test_openat2_flags(void) · 258 unmodified lines | |||
| 259 | unlink(path); | 259 | unlink(path); |
| 260 | 260 | ||
| 261 | fd = sys_openat2(AT_FDCWD, path, &test->how); | 261 | fd = sys_openat2(AT_FDCWD, path, &test->how); |
| 262 | if (fd < 0 && fd == -EOPNOTSUPP) { | ||
| 263 | /* | ||
| 264 | * Skip the testcase if it failed because not supported | ||
| 265 | * by FS. (e.g. a valid O_TMPFILE combination on NFS) | ||
| 266 | */ | ||
| 267 | ksft_test_result_skip("openat2 with %s fails with %d (%s)\n", | ||
| 268 | test->name, fd, strerror(-fd)); | ||
| 269 | goto next; | ||
| 270 | } | ||
| 271 | |||
| 262 | if (test->err >= 0) | 272 | if (test->err >= 0) |
| 263 | failed = (fd < 0); | 273 | failed = (fd < 0); |
| 264 | else | 274 | else |
| @@ -303,7 +313,7 @@ skip: · 38 unmodified lines | |||
| 303 | else | 313 | else |
| 304 | resultfn("openat2 with %s fails with %d (%s)\n", | 314 | resultfn("openat2 with %s fails with %d (%s)\n", |
| 305 | test->name, test->err, strerror(-test->err)); | 315 | test->name, test->err, strerror(-test->err)); |
| 306 | 316 | next: | |
| 307 | free(fdpath); | 317 | free(fdpath); |
| 308 | fflush(stdout); | 318 | fflush(stdout); |
| 309 | } | 319 | } |
| @@ -1 +1 @@ | |||
| 1 | timeout=90 | 1 | timeout=180 |
| @@ -33,110 +33,114 @@ typedef long (*vdso_clock_gettime_t)(clockid_t clk_id, struct timespec *ts); · 32 unmodified lines | |||
| 33 | typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts); | 33 | typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts); |
| 34 | typedef time_t (*vdso_time_t)(time_t *t); | 34 | typedef time_t (*vdso_time_t)(time_t *t); |
| 35 | 35 | ||
| 36 | static int vdso_test_gettimeofday(void) | 36 | #define VDSO_TEST_PASS_MSG() "\n%s(): PASS\n", __func__ |
| 37 | #define VDSO_TEST_FAIL_MSG(x) "\n%s(): %s FAIL\n", __func__, x | ||
| 38 | #define VDSO_TEST_SKIP_MSG(x) "\n%s(): SKIP: Could not find %s\n", __func__, x | ||
| 39 | |||
| 40 | static void vdso_test_gettimeofday(void) | ||
| 37 | { | 41 | { |
| 38 | /* Find gettimeofday. */ | 42 | /* Find gettimeofday. */ |
| 39 | vdso_gettimeofday_t vdso_gettimeofday = | 43 | vdso_gettimeofday_t vdso_gettimeofday = |
| 40 | (vdso_gettimeofday_t)vdso_sym(version, name[0]); | 44 | (vdso_gettimeofday_t)vdso_sym(version, name[0]); |
| 41 | 45 | ||
| 42 | if (!vdso_gettimeofday) { | 46 | if (!vdso_gettimeofday) { |
| 43 | printf("Could not find %s\n", name[0]); | 47 | ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[0])); |
| 44 | return KSFT_SKIP; | 48 | return; |
| 45 | } | 49 | } |
| 46 | 50 | ||
| 47 | struct timeval tv; | 51 | struct timeval tv; |
| 48 | long ret = vdso_gettimeofday(&tv, 0); | 52 | long ret = vdso_gettimeofday(&tv, 0); |
| 49 | 53 | ||
| 50 | if (ret == 0) { | 54 | if (ret == 0) { |
| 51 | printf("The time is %lld.%06lld\n", | 55 | ksft_print_msg("The time is %lld.%06lld\n", |
| 52 | (long long)tv.tv_sec, (long long)tv.tv_usec); | 56 | (long long)tv.tv_sec, (long long)tv.tv_usec); |
| 57 | ksft_test_result_pass(VDSO_TEST_PASS_MSG()); | ||
| 53 | } else { | 58 | } else { |
| 54 | printf("%s failed\n", name[0]); | 59 | ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[0])); |
| 55 | return KSFT_FAIL; | ||
| 56 | } | 60 | } |
| 57 | |||
| 58 | return KSFT_PASS; | ||
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | static int vdso_test_clock_gettime(clockid_t clk_id) | 63 | static void vdso_test_clock_gettime(clockid_t clk_id) |
| 62 | { | 64 | { |
| 63 | /* Find clock_gettime. */ | 65 | /* Find clock_gettime. */ |
| 64 | vdso_clock_gettime_t vdso_clock_gettime = | 66 | vdso_clock_gettime_t vdso_clock_gettime = |
| 65 | (vdso_clock_gettime_t)vdso_sym(version, name[1]); | 67 | (vdso_clock_gettime_t)vdso_sym(version, name[1]); |
| 66 | 68 | ||
| 67 | if (!vdso_clock_gettime) { | 69 | if (!vdso_clock_gettime) { |
| 68 | printf("Could not find %s\n", name[1]); | 70 | ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[1])); |
| 69 | return KSFT_SKIP; | 71 | return; |
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | struct timespec ts; | 74 | struct timespec ts; |
| 73 | long ret = vdso_clock_gettime(clk_id, &ts); | 75 | long ret = vdso_clock_gettime(clk_id, &ts); |
| 74 | 76 | ||
| 75 | if (ret == 0) { | 77 | if (ret == 0) { |
| 76 | printf("The time is %lld.%06lld\n", | 78 | ksft_print_msg("The time is %lld.%06lld\n", |
| 77 | (long long)ts.tv_sec, (long long)ts.tv_nsec); | 79 | (long long)ts.tv_sec, (long long)ts.tv_nsec); |
| 80 | ksft_test_result_pass(VDSO_TEST_PASS_MSG()); | ||
| 78 | } else { | 81 | } else { |
| 79 | printf("%s failed\n", name[1]); | 82 | ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[1])); |
| 80 | return KSFT_FAIL; | ||
| 81 | } | 83 | } |
| 82 | |||
| 83 | return KSFT_PASS; | ||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static int vdso_test_time(void) | 86 | static void vdso_test_time(void) |
| 87 | { | 87 | { |
| 88 | /* Find time. */ | 88 | /* Find time. */ |
| 89 | vdso_time_t vdso_time = | 89 | vdso_time_t vdso_time = |
| 90 | (vdso_time_t)vdso_sym(version, name[2]); | 90 | (vdso_time_t)vdso_sym(version, name[2]); |
| 91 | 91 | ||
| 92 | if (!vdso_time) { | 92 | if (!vdso_time) { |
| 93 | printf("Could not find %s\n", name[2]); | 93 | ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[2])); |
| 94 | return KSFT_SKIP; | 94 | return; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | long ret = vdso_time(NULL); | 97 | long ret = vdso_time(NULL); |
| 98 | 98 | ||
| 99 | if (ret > 0) { | 99 | if (ret > 0) { |
| 100 | printf("The time in hours since January 1, 1970 is %lld\n", | 100 | ksft_print_msg("The time in hours since January 1, 1970 is %lld\n", |
| 101 | (long long)(ret / 3600)); | 101 | (long long)(ret / 3600)); |
| 102 | ksft_test_result_pass(VDSO_TEST_PASS_MSG()); | ||
| 102 | } else { | 103 | } else { |
| 103 | printf("%s failed\n", name[2]); | 104 | ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[2])); |
| 104 | return KSFT_FAIL; | ||
| 105 | } | 105 | } |
| 106 | |||
| 107 | return KSFT_PASS; | ||
| 108 | } | 106 | } |
| 109 | 107 | ||
| 110 | static int vdso_test_clock_getres(clockid_t clk_id) | 108 | static void vdso_test_clock_getres(clockid_t clk_id) |
| 111 | { | 109 | { |
| 110 | int clock_getres_fail = 0; | ||
| 111 | |||
| 112 | /* Find clock_getres. */ | 112 | /* Find clock_getres. */ |
| 113 | vdso_clock_getres_t vdso_clock_getres = | 113 | vdso_clock_getres_t vdso_clock_getres = |
| 114 | (vdso_clock_getres_t)vdso_sym(version, name[3]); | 114 | (vdso_clock_getres_t)vdso_sym(version, name[3]); |
| 115 | 115 | ||
| 116 | if (!vdso_clock_getres) { | 116 | if (!vdso_clock_getres) { |
| 117 | printf("Could not find %s\n", name[3]); | 117 | ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[3])); |
| 118 | return KSFT_SKIP; | 118 | return; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | struct timespec ts, sys_ts; | 121 | struct timespec ts, sys_ts; |
| 122 | long ret = vdso_clock_getres(clk_id, &ts); | 122 | long ret = vdso_clock_getres(clk_id, &ts); |
| 123 | 123 | ||
| 124 | if (ret == 0) { | 124 | if (ret == 0) { |
| 125 | printf("The resolution is %lld %lld\n", | 125 | ksft_print_msg("The vdso resolution is %lld %lld\n", |
| 126 | (long long)ts.tv_sec, (long long)ts.tv_nsec); | 126 | (long long)ts.tv_sec, (long long)ts.tv_nsec); |
| 127 | } else { | 127 | } else { |
| 128 | printf("%s failed\n", name[3]); | 128 | clock_getres_fail++; |
| 129 | return KSFT_FAIL; | ||
| 130 | } | 129 | } |
| 131 | 130 | ||
| 132 | ret = syscall(SYS_clock_getres, clk_id, &sys_ts); | 131 | ret = syscall(SYS_clock_getres, clk_id, &sys_ts); |
| 133 | 132 | ||
| 134 | if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec)) { | 133 | ksft_print_msg("The syscall resolution is %lld %lld\n", |
| 135 | printf("%s failed\n", name[3]); | 134 | (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec); |
| 136 | return KSFT_FAIL; | ||
| 137 | } | ||
| 138 | 135 | ||
| 139 | return KSFT_PASS; | 136 | if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec)) |
| 137 | clock_getres_fail++; | ||
| 138 | |||
| 139 | if (clock_getres_fail > 0) { | ||
| 140 | ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[3])); | ||
| 141 | } else { | ||
| 142 | ksft_test_result_pass(VDSO_TEST_PASS_MSG()); | ||
| 143 | } | ||
| 140 | } | 144 | } |
| 141 | 145 | ||
| 142 | const char *vdso_clock_name[12] = { | 146 | const char *vdso_clock_name[12] = { |
| @@ -158,36 +162,23 @@ const char *vdso_clock_name[12] = { · 15 unmodified lines | |||
| 158 | * This function calls vdso_test_clock_gettime and vdso_test_clock_getres | 162 | * This function calls vdso_test_clock_gettime and vdso_test_clock_getres |
| 159 | * with different values for clock_id. | 163 | * with different values for clock_id. |
| 160 | */ | 164 | */ |
| 161 | static inline int vdso_test_clock(clockid_t clock_id) | 165 | static inline void vdso_test_clock(clockid_t clock_id) |
| 162 | { | 166 | { |
| 163 | int ret0, ret1; | 167 | ksft_print_msg("\nclock_id: %s\n", vdso_clock_name[clock_id]); |
| 164 | |||
| 165 | ret0 = vdso_test_clock_gettime(clock_id); | ||
| 166 | /* A skipped test is considered passed */ | ||
| 167 | if (ret0 == KSFT_SKIP) | ||
| 168 | ret0 = KSFT_PASS; | ||
| 169 | |||
| 170 | ret1 = vdso_test_clock_getres(clock_id); | ||
| 171 | /* A skipped test is considered passed */ | ||
| 172 | if (ret1 == KSFT_SKIP) | ||
| 173 | ret1 = KSFT_PASS; | ||
| 174 | 168 | ||
| 175 | ret0 += ret1; | 169 | vdso_test_clock_gettime(clock_id); |
| 176 | 170 | ||
| 177 | printf("clock_id: %s", vdso_clock_name[clock_id]); | 171 | vdso_test_clock_getres(clock_id); |
| 178 | |||
| 179 | if (ret0 > 0) | ||
| 180 | printf(" [FAIL]\n"); | ||
| 181 | else | ||
| 182 | printf(" [PASS]\n"); | ||
| 183 | |||
| 184 | return ret0; | ||
| 185 | } | 172 | } |
| 186 | 173 | ||
| 174 | #define VDSO_TEST_PLAN 16 | ||
| 175 | |||
| 187 | int main(int argc, char **argv) | 176 | int main(int argc, char **argv) |
| 188 | { | 177 | { |
| 189 | unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); | 178 | unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); |
| 190 | int ret; | 179 | |
| 180 | ksft_print_header(); | ||
| 181 | ksft_set_plan(VDSO_TEST_PLAN); | ||
| 191 | 182 | ||
| 192 | if (!sysinfo_ehdr) { | 183 | if (!sysinfo_ehdr) { |
| 193 | printf("AT_SYSINFO_EHDR is not present!\n"); | 184 | printf("AT_SYSINFO_EHDR is not present!\n"); |
| @@ -201,44 +192,42 @@ int main(int argc, char **argv) · 7 unmodified lines | |||
| 201 | 192 | ||
| 202 | vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR)); | 193 | vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR)); |
| 203 | 194 | ||
| 204 | ret = vdso_test_gettimeofday(); | 195 | vdso_test_gettimeofday(); |
| 205 | 196 | ||
| 206 | #if _POSIX_TIMERS > 0 | 197 | #if _POSIX_TIMERS > 0 |
| 207 | 198 | ||
| 208 | #ifdef CLOCK_REALTIME | 199 | #ifdef CLOCK_REALTIME |
| 209 | ret += vdso_test_clock(CLOCK_REALTIME); | 200 | vdso_test_clock(CLOCK_REALTIME); |
| 210 | #endif | 201 | #endif |
| 211 | 202 | ||
| 212 | #ifdef CLOCK_BOOTTIME | 203 | #ifdef CLOCK_BOOTTIME |
| 213 | ret += vdso_test_clock(CLOCK_BOOTTIME); | 204 | vdso_test_clock(CLOCK_BOOTTIME); |
| 214 | #endif | 205 | #endif |
| 215 | 206 | ||
| 216 | #ifdef CLOCK_TAI | 207 | #ifdef CLOCK_TAI |
| 217 | ret += vdso_test_clock(CLOCK_TAI); | 208 | vdso_test_clock(CLOCK_TAI); |
| 218 | #endif | 209 | #endif |
| 219 | 210 | ||
| 220 | #ifdef CLOCK_REALTIME_COARSE | 211 | #ifdef CLOCK_REALTIME_COARSE |
| 221 | ret += vdso_test_clock(CLOCK_REALTIME_COARSE); | 212 | vdso_test_clock(CLOCK_REALTIME_COARSE); |
| 222 | #endif | 213 | #endif |
| 223 | 214 | ||
| 224 | #ifdef CLOCK_MONOTONIC | 215 | #ifdef CLOCK_MONOTONIC |
| 225 | ret += vdso_test_clock(CLOCK_MONOTONIC); | 216 | vdso_test_clock(CLOCK_MONOTONIC); |
| 226 | #endif | 217 | #endif |
| 227 | 218 | ||
| 228 | #ifdef CLOCK_MONOTONIC_RAW | 219 | #ifdef CLOCK_MONOTONIC_RAW |
| 229 | ret += vdso_test_clock(CLOCK_MONOTONIC_RAW); | 220 | vdso_test_clock(CLOCK_MONOTONIC_RAW); |
| 230 | #endif | 221 | #endif |
| 231 | 222 | ||
| 232 | #ifdef CLOCK_MONOTONIC_COARSE | 223 | #ifdef CLOCK_MONOTONIC_COARSE |
| 233 | ret += vdso_test_clock(CLOCK_MONOTONIC_COARSE); | 224 | vdso_test_clock(CLOCK_MONOTONIC_COARSE); |
| 234 | #endif | 225 | #endif |
| 235 | 226 | ||
| 236 | #endif | 227 | #endif |
| 237 | 228 | ||
| 238 | ret += vdso_test_time(); | 229 | vdso_test_time(); |
| 239 | |||
| 240 | if (ret > 0) | ||
| 241 | return KSFT_FAIL; | ||
| 242 | 230 | ||
| 243 | return KSFT_PASS; | 231 | ksft_print_cnts(); |
| 232 | return ksft_get_fail_cnt() == 0 ? KSFT_PASS : KSFT_FAIL; | ||
| 244 | } | 233 | } |
| @@ -2,9 +2,6 @@ · 1 unmodified line | |||
| 2 | # SPDX-License-Identifier: GPL-2.0 | 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | TCID="zram.sh" | 3 | TCID="zram.sh" |
| 4 | 4 | ||
| 5 | # Kselftest framework requirement - SKIP code is 4. | ||
| 6 | ksft_skip=4 | ||
| 7 | |||
| 8 | . ./zram_lib.sh | 5 | . ./zram_lib.sh |
| 9 | 6 | ||
| 10 | run_zram () { | 7 | run_zram () { |
| @@ -18,14 +15,4 @@ echo "" · 7 unmodified lines | |||
| 18 | 15 | ||
| 19 | check_prereqs | 16 | check_prereqs |
| 20 | 17 | ||
| 21 | # check zram module exists | 18 | run_zram |
| 22 | MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko | ||
| 23 | if [ -f $MODULE_PATH ]; then | ||
| 24 | run_zram | ||
| 25 | elif [ -b /dev/zram0 ]; then | ||
| 26 | run_zram | ||
| 27 | else | ||
| 28 | echo "$TCID : No zram.ko module or /dev/zram0 device file not found" | ||
| 29 | echo "$TCID : CONFIG_ZRAM is not set" | ||
| 30 | exit $ksft_skip | ||
| 31 | fi | ||
| @@ -33,9 +33,7 @@ zram_algs="lzo" · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | zram_fill_fs() | 34 | zram_fill_fs() |
| 35 | { | 35 | { |
| 36 | local mem_free0=$(free -m | awk 'NR==2 {print $4}') | 36 | for i in $(seq $dev_start $dev_end); do |
| 37 | |||
| 38 | for i in $(seq 0 $(($dev_num - 1))); do | ||
| 39 | echo "fill zram$i..." | 37 | echo "fill zram$i..." |
| 40 | local b=0 | 38 | local b=0 |
| 41 | while [ true ]; do | 39 | while [ true ]; do |
| @@ -45,29 +43,17 @@ zram_fill_fs() · 3 unmodified lines | |||
| 45 | b=$(($b + 1)) | 43 | b=$(($b + 1)) |
| 46 | done | 44 | done |
| 47 | echo "zram$i can be filled with '$b' KB" | 45 | echo "zram$i can be filled with '$b' KB" |
| 48 | done | ||
| 49 | 46 | ||
| 50 | local mem_free1=$(free -m | awk 'NR==2 {print $4}') | 47 | local mem_used_total=`awk '{print $3}' "/sys/block/zram$i/mm_stat"` |
| 51 | local used_mem=$(($mem_free0 - $mem_free1)) | 48 | local v=$((100 * 1024 * $b / $mem_used_total)) |
| 49 | if [ "$v" -lt 100 ]; then | ||
| 50 | echo "FAIL compression ratio: 0.$v:1" | ||
| 51 | ERR_CODE=-1 | ||
| 52 | return | ||
| 53 | fi | ||
| 52 | 54 | ||
| 53 | local total_size=0 | 55 | echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK" |
| 54 | for sm in $zram_sizes; do | ||
| 55 | local s=$(echo $sm | sed 's/M//') | ||
| 56 | total_size=$(($total_size + $s)) | ||
| 57 | done | 56 | done |
| 58 | |||
| 59 | echo "zram used ${used_mem}M, zram disk sizes ${total_size}M" | ||
| 60 | |||
| 61 | local v=$((100 * $total_size / $used_mem)) | ||
| 62 | |||
| 63 | if [ "$v" -lt 100 ]; then | ||
| 64 | echo "FAIL compression ratio: 0.$v:1" | ||
| 65 | ERR_CODE=-1 | ||
| 66 | zram_cleanup | ||
| 67 | return | ||
| 68 | fi | ||
| 69 | |||
| 70 | echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK" | ||
| 71 | } | 57 | } |
| 72 | 58 | ||
| 73 | check_prereqs | 59 | check_prereqs |
| @@ -81,7 +67,6 @@ zram_mount · 7 unmodified lines | |||
| 81 | 67 | ||
| 82 | zram_fill_fs | 68 | zram_fill_fs |
| 83 | zram_cleanup | 69 | zram_cleanup |
| 84 | zram_unload | ||
| 85 | 70 | ||
| 86 | if [ $ERR_CODE -ne 0 ]; then | 71 | if [ $ERR_CODE -ne 0 ]; then |
| 87 | echo "$TCID : [FAIL]" | 72 | echo "$TCID : [FAIL]" |
| @@ -36,7 +36,6 @@ zram_set_memlimit · 35 unmodified lines | |||
| 36 | zram_makeswap | 36 | zram_makeswap |
| 37 | zram_swapoff | 37 | zram_swapoff |
| 38 | zram_cleanup | 38 | zram_cleanup |
| 39 | zram_unload | ||
| 40 | 39 | ||
| 41 | if [ $ERR_CODE -ne 0 ]; then | 40 | if [ $ERR_CODE -ne 0 ]; then |
| 42 | echo "$TCID : [FAIL]" | 41 | echo "$TCID : [FAIL]" |
| @@ -5,12 +5,17 @@ · 4 unmodified lines | |||
| 5 | # Author: Alexey Kodanev <alexey.kodanev@oracle.com> | 5 | # Author: Alexey Kodanev <alexey.kodanev@oracle.com> |
| 6 | # Modified: Naresh Kamboju <naresh.kamboju@linaro.org> | 6 | # Modified: Naresh Kamboju <naresh.kamboju@linaro.org> |
| 7 | 7 | ||
| 8 | MODULE=0 | ||
| 9 | dev_makeswap=-1 | 8 | dev_makeswap=-1 |
| 10 | dev_mounted=-1 | 9 | dev_mounted=-1 |
| 11 | 10 | dev_start=0 | |
| 11 | dev_end=-1 | ||
| 12 | module_load=-1 | ||
| 13 | sys_control=-1 | ||
| 12 | # Kselftest framework requirement - SKIP code is 4. | 14 | # Kselftest framework requirement - SKIP code is 4. |
| 13 | ksft_skip=4 | 15 | ksft_skip=4 |
| 16 | kernel_version=`uname -r | cut -d'.' -f1,2` | ||
| 17 | kernel_major=${kernel_version%.*} | ||
| 18 | kernel_minor=${kernel_version#*.} | ||
| 14 | 19 | ||
| 15 | trap INT | 20 | trap INT |
| 16 | 21 | ||
| @@ -25,68 +30,104 @@ check_prereqs() · 8 unmodified lines | |||
| 25 | fi | 30 | fi |
| 26 | } | 31 | } |
| 27 | 32 | ||
| 33 | kernel_gte() | ||
| 34 | { | ||
| 35 | major=${1%.*} | ||
| 36 | minor=${1#*.} | ||
| 37 | |||
| 38 | if [ $kernel_major -gt $major ]; then | ||
| 39 | return 0 | ||
| 40 | elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then | ||
| 41 | return 0 | ||
| 42 | fi | ||
| 43 | |||
| 44 | return 1 | ||
| 45 | } | ||
| 46 | |||
| 28 | zram_cleanup() | 47 | zram_cleanup() |
| 29 | { | 48 | { |
| 30 | echo "zram cleanup" | 49 | echo "zram cleanup" |
| 31 | local i= | 50 | local i= |
| 32 | for i in $(seq 0 $dev_makeswap); do | 51 | for i in $(seq $dev_start $dev_makeswap); do |
| 33 | swapoff /dev/zram$i | 52 | swapoff /dev/zram$i |
| 34 | done | 53 | done |
| 35 | 54 | ||
| 36 | for i in $(seq 0 $dev_mounted); do | 55 | for i in $(seq $dev_start $dev_mounted); do |
| 37 | umount /dev/zram$i | 56 | umount /dev/zram$i |
| 38 | done | 57 | done |
| 39 | 58 | ||
| 40 | for i in $(seq 0 $(($dev_num - 1))); do | 59 | for i in $(seq $dev_start $dev_end); do |
| 41 | echo 1 > /sys/block/zram${i}/reset | 60 | echo 1 > /sys/block/zram${i}/reset |
| 42 | rm -rf zram$i | 61 | rm -rf zram$i |
| 43 | done | 62 | done |
| 44 | 63 | ||
| 45 | } | 64 | if [ $sys_control -eq 1 ]; then |
| 65 | for i in $(seq $dev_start $dev_end); do | ||
| 66 | echo $i > /sys/class/zram-control/hot_remove | ||
| 67 | done | ||
| 68 | fi | ||
| 46 | 69 | ||
| 47 | zram_unload() | 70 | if [ $module_load -eq 1 ]; then |
| 48 | { | ||
| 49 | if [ $MODULE -ne 0 ] ; then | ||
| 50 | echo "zram rmmod zram" | ||
| 51 | rmmod zram > /dev/null 2>&1 | 71 | rmmod zram > /dev/null 2>&1 |
| 52 | fi | 72 | fi |
| 53 | } | 73 | } |
| 54 | 74 | ||
| 55 | zram_load() | 75 | zram_load() |
| 56 | { | 76 | { |
| 57 | # check zram module exists | 77 | echo "create '$dev_num' zram device(s)" |
| 58 | MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko | 78 | |
| 59 | if [ -f $MODULE_PATH ]; then | 79 | # zram module loaded, new kernel |
| 60 | MODULE=1 | 80 | if [ -d "/sys/class/zram-control" ]; then |
| 61 | echo "create '$dev_num' zram device(s)" | 81 | echo "zram modules already loaded, kernel supports" \ |
| 62 | modprobe zram num_devices=$dev_num | 82 | "zram-control interface" |
| 63 | if [ $? -ne 0 ]; then | 83 | dev_start=$(ls /dev/zram* | wc -w) |
| 64 | echo "failed to insert zram module" | 84 | dev_end=$(($dev_start + $dev_num - 1)) |
| 65 | exit 1 | 85 | sys_control=1 |
| 66 | fi | 86 | |
| 67 | 87 | for i in $(seq $dev_start $dev_end); do | |
| 68 | dev_num_created=$(ls /dev/zram* | wc -w) | 88 | cat /sys/class/zram-control/hot_add > /dev/null |
| 89 | done | ||
| 90 | |||
| 91 | echo "all zram devices (/dev/zram$dev_start~$dev_end" \ | ||
| 92 | "successfully created" | ||
| 93 | return 0 | ||
| 94 | fi | ||
| 69 | 95 | ||
| 70 | if [ "$dev_num_created" -ne "$dev_num" ]; then | 96 | # detect old kernel or built-in |
| 71 | echo "unexpected num of devices: $dev_num_created" | 97 | modprobe zram num_devices=$dev_num |
| 72 | ERR_CODE=-1 | 98 | if [ ! -d "/sys/class/zram-control" ]; then |
| 99 | if grep -q '^zram' /proc/modules; then | ||
| 100 | rmmod zram > /dev/null 2>&1 | ||
| 101 | if [ $? -ne 0 ]; then | ||
| 102 | echo "zram module is being used on old kernel" \ | ||
| 103 | "without zram-control interface" | ||
| 104 | exit $ksft_skip | ||
| 105 | fi | ||
| 73 | else | 106 | else |
| 74 | echo "zram load module successful" | 107 | echo "test needs CONFIG_ZRAM=m on old kernel without" \ |
| 108 | "zram-control interface" | ||
| 109 | exit $ksft_skip | ||
| 75 | fi | 110 | fi |
| 76 | elif [ -b /dev/zram0 ]; then | 111 | modprobe zram num_devices=$dev_num |
| 77 | echo "/dev/zram0 device file found: OK" | ||
| 78 | else | ||
| 79 | echo "ERROR: No zram.ko module or no /dev/zram0 device found" | ||
| 80 | echo "$TCID : CONFIG_ZRAM is not set" | ||
| 81 | exit 1 | ||
| 82 | fi | 112 | fi |
| 113 | |||
| 114 | module_load=1 | ||
| 115 | dev_end=$(($dev_num - 1)) | ||
| 116 | echo "all zram devices (/dev/zram0~$dev_end) successfully created" | ||
| 83 | } | 117 | } |
| 84 | 118 | ||
| 85 | zram_max_streams() | 119 | zram_max_streams() |
| 86 | { | 120 | { |
| 87 | echo "set max_comp_streams to zram device(s)" | 121 | echo "set max_comp_streams to zram device(s)" |
| 88 | 122 | ||
| 89 | local i=0 | 123 | kernel_gte 4.7 |
| 124 | if [ $? -eq 0 ]; then | ||
| 125 | echo "The device attribute max_comp_streams was"\ | ||
| 126 | "deprecated in 4.7" | ||
| 127 | return 0 | ||
| 128 | fi | ||
| 129 | |||
| 130 | local i=$dev_start | ||
| 90 | for max_s in $zram_max_streams; do | 131 | for max_s in $zram_max_streams; do |
| 91 | local sys_path="/sys/block/zram${i}/max_comp_streams" | 132 | local sys_path="/sys/block/zram${i}/max_comp_streams" |
| 92 | echo $max_s > $sys_path || \ | 133 | echo $max_s > $sys_path || \ |
| @@ -98,7 +139,7 @@ zram_max_streams() · 5 unmodified lines | |||
| 98 | echo "FAIL can't set max_streams '$max_s', get $max_stream" | 139 | echo "FAIL can't set max_streams '$max_s', get $max_stream" |
| 99 | 140 | ||
| 100 | i=$(($i + 1)) | 141 | i=$(($i + 1)) |
| 101 | echo "$sys_path = '$max_streams' ($i/$dev_num)" | 142 | echo "$sys_path = '$max_streams'" |
| 102 | done | 143 | done |
| 103 | 144 | ||
| 104 | echo "zram max streams: OK" | 145 | echo "zram max streams: OK" |
| @@ -108,15 +149,16 @@ zram_compress_alg() · 3 unmodified lines | |||
| 108 | { | 149 | { |
| 109 | echo "test that we can set compression algorithm" | 150 | echo "test that we can set compression algorithm" |
| 110 | 151 | ||
| 111 | local algs=$(cat /sys/block/zram0/comp_algorithm) | 152 | local i=$dev_start |
| 153 | local algs=$(cat /sys/block/zram${i}/comp_algorithm) | ||
| 112 | echo "supported algs: $algs" | 154 | echo "supported algs: $algs" |
| 113 | local i=0 | 155 | |
| 114 | for alg in $zram_algs; do | 156 | for alg in $zram_algs; do |
| 115 | local sys_path="/sys/block/zram${i}/comp_algorithm" | 157 | local sys_path="/sys/block/zram${i}/comp_algorithm" |
| 116 | echo "$alg" > $sys_path || \ | 158 | echo "$alg" > $sys_path || \ |
| 117 | echo "FAIL can't set '$alg' to $sys_path" | 159 | echo "FAIL can't set '$alg' to $sys_path" |
| 118 | i=$(($i + 1)) | 160 | i=$(($i + 1)) |
| 119 | echo "$sys_path = '$alg' ($i/$dev_num)" | 161 | echo "$sys_path = '$alg'" |
| 120 | done | 162 | done |
| 121 | 163 | ||
| 122 | echo "zram set compression algorithm: OK" | 164 | echo "zram set compression algorithm: OK" |
| @@ -125,14 +167,14 @@ zram_compress_alg() · 2 unmodified lines | |||
| 125 | zram_set_disksizes() | 167 | zram_set_disksizes() |
| 126 | { | 168 | { |
| 127 | echo "set disk size to zram device(s)" | 169 | echo "set disk size to zram device(s)" |
| 128 | local i=0 | 170 | local i=$dev_start |
| 129 | for ds in $zram_sizes; do | 171 | for ds in $zram_sizes; do |
| 130 | local sys_path="/sys/block/zram${i}/disksize" | 172 | local sys_path="/sys/block/zram${i}/disksize" |
| 131 | echo "$ds" > $sys_path || \ | 173 | echo "$ds" > $sys_path || \ |
| 132 | echo "FAIL can't set '$ds' to $sys_path" | 174 | echo "FAIL can't set '$ds' to $sys_path" |
| 133 | 175 | ||
| 134 | i=$(($i + 1)) | 176 | i=$(($i + 1)) |
| 135 | echo "$sys_path = '$ds' ($i/$dev_num)" | 177 | echo "$sys_path = '$ds'" |
| 136 | done | 178 | done |
| 137 | 179 | ||
| 138 | echo "zram set disksizes: OK" | 180 | echo "zram set disksizes: OK" |
| @@ -142,14 +184,14 @@ zram_set_memlimit() · 3 unmodified lines | |||
| 142 | { | 184 | { |
| 143 | echo "set memory limit to zram device(s)" | 185 | echo "set memory limit to zram device(s)" |
| 144 | 186 | ||
| 145 | local i=0 | 187 | local i=$dev_start |
| 146 | for ds in $zram_mem_limits; do | 188 | for ds in $zram_mem_limits; do |
| 147 | local sys_path="/sys/block/zram${i}/mem_limit" | 189 | local sys_path="/sys/block/zram${i}/mem_limit" |
| 148 | echo "$ds" > $sys_path || \ | 190 | echo "$ds" > $sys_path || \ |
| 149 | echo "FAIL can't set '$ds' to $sys_path" | 191 | echo "FAIL can't set '$ds' to $sys_path" |
| 150 | 192 | ||
| 151 | i=$(($i + 1)) | 193 | i=$(($i + 1)) |
| 152 | echo "$sys_path = '$ds' ($i/$dev_num)" | 194 | echo "$sys_path = '$ds'" |
| 153 | done | 195 | done |
| 154 | 196 | ||
| 155 | echo "zram set memory limit: OK" | 197 | echo "zram set memory limit: OK" |
| @@ -158,8 +200,8 @@ zram_set_memlimit() · 2 unmodified lines | |||
| 158 | zram_makeswap() | 200 | zram_makeswap() |
| 159 | { | 201 | { |
| 160 | echo "make swap with zram device(s)" | 202 | echo "make swap with zram device(s)" |
| 161 | local i=0 | 203 | local i=$dev_start |
| 162 | for i in $(seq 0 $(($dev_num - 1))); do | 204 | for i in $(seq $dev_start $dev_end); do |
| 163 | mkswap /dev/zram$i > err.log 2>&1 | 205 | mkswap /dev/zram$i > err.log 2>&1 |
| 164 | if [ $? -ne 0 ]; then | 206 | if [ $? -ne 0 ]; then |
| 165 | cat err.log | 207 | cat err.log |
| @@ -182,7 +224,7 @@ zram_makeswap() · 16 unmodified lines | |||
| 182 | zram_swapoff() | 224 | zram_swapoff() |
| 183 | { | 225 | { |
| 184 | local i= | 226 | local i= |
| 185 | for i in $(seq 0 $dev_makeswap); do | 227 | for i in $(seq $dev_start $dev_end); do |
| 186 | swapoff /dev/zram$i > err.log 2>&1 | 228 | swapoff /dev/zram$i > err.log 2>&1 |
| 187 | if [ $? -ne 0 ]; then | 229 | if [ $? -ne 0 ]; then |
| 188 | cat err.log | 230 | cat err.log |
| @@ -196,7 +238,7 @@ zram_swapoff() · 7 unmodified lines | |||
| 196 | 238 | ||
| 197 | zram_makefs() | 239 | zram_makefs() |
| 198 | { | 240 | { |
| 199 | local i=0 | 241 | local i=$dev_start |
| 200 | for fs in $zram_filesystems; do | 242 | for fs in $zram_filesystems; do |
| 201 | # if requested fs not supported default it to ext2 | 243 | # if requested fs not supported default it to ext2 |
| 202 | which mkfs.$fs > /dev/null 2>&1 || fs=ext2 | 244 | which mkfs.$fs > /dev/null 2>&1 || fs=ext2 |
| @@ -215,7 +257,7 @@ zram_makefs() · 12 unmodified lines | |||
| 215 | zram_mount() | 257 | zram_mount() |
| 216 | { | 258 | { |
| 217 | local i=0 | 259 | local i=0 |
| 218 | for i in $(seq 0 $(($dev_num - 1))); do | 260 | for i in $(seq $dev_start $dev_end); do |
| 219 | echo "mount /dev/zram$i" | 261 | echo "mount /dev/zram$i" |
| 220 | mkdir zram$i | 262 | mkdir zram$i |
| 221 | mount /dev/zram$i zram$i > /dev/null || \ | 263 | mount /dev/zram$i zram$i > /dev/null || \ |
| @@ -1,11 +1,11 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | include ../scripts/Makefile.include | 2 | include ../scripts/Makefile.include |
| 3 | 3 | ||
| 4 | all: latency | 4 | all: latency rtla |
| 5 | 5 | ||
| 6 | clean: latency_clean | 6 | clean: latency_clean rtla_clean |
| 7 | 7 | ||
| 8 | install: latency_install | 8 | install: latency_install rtla_install |
| 9 | 9 | ||
| 10 | latency: | 10 | latency: |
| 11 | $(call descend,latency) | 11 | $(call descend,latency) |
| @@ -16,4 +16,14 @@ latency_install: · 4 unmodified lines | |||
| 16 | latency_clean: | 16 | latency_clean: |
| 17 | $(call descend,latency,clean) | 17 | $(call descend,latency,clean) |
| 18 | 18 | ||
| 19 | .PHONY: all install clean latency latency_install latency_clean | 19 | rtla: |
| 20 | $(call descend,rtla) | ||
| 21 | |||
| 22 | rtla_install: | ||
| 23 | $(call descend,rtla,install) | ||
| 24 | |||
| 25 | rtla_clean: | ||
| 26 | $(call descend,rtla,clean) | ||
| 27 | |||
| 28 | .PHONY: all install clean latency latency_install latency_clean \ | ||
| 29 | rtla rtla_install rtla_clean | ||
| @@ -59,7 +59,7 @@ endif · 58 unmodified lines | |||
| 59 | .PHONY: all | 59 | .PHONY: all |
| 60 | all: rtla | 60 | all: rtla |
| 61 | 61 | ||
| 62 | rtla: $(OBJ) doc | 62 | rtla: $(OBJ) |
| 63 | $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS) | 63 | $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS) |
| 64 | 64 | ||
| 65 | static: $(OBJ) | 65 | static: $(OBJ) |
| @@ -28,6 +28,7 @@ no-header-test += linux/am437x-vpfe.h · 27 unmodified lines | |||
| 28 | no-header-test += linux/android/binder.h | 28 | no-header-test += linux/android/binder.h |
| 29 | no-header-test += linux/android/binderfs.h | 29 | no-header-test += linux/android/binderfs.h |
| 30 | no-header-test += linux/coda.h | 30 | no-header-test += linux/coda.h |
| 31 | no-header-test += linux/cyclades.h | ||
| 31 | no-header-test += linux/errqueue.h | 32 | no-header-test += linux/errqueue.h |
| 32 | no-header-test += linux/fsmap.h | 33 | no-header-test += linux/fsmap.h |
| 33 | no-header-test += linux/hdlc/ioctl.h | 34 | no-header-test += linux/hdlc/ioctl.h |
| @@ -463,8 +463,8 @@ bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin) · 462 unmodified lines | |||
| 463 | idx = srcu_read_lock(&kvm->irq_srcu); | 463 | idx = srcu_read_lock(&kvm->irq_srcu); |
| 464 | gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); | 464 | gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); |
| 465 | if (gsi != -1) | 465 | if (gsi != -1) |
| 466 | hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, | 466 | hlist_for_each_entry_srcu(kian, &kvm->irq_ack_notifier_list, |
| 467 | link) | 467 | link, srcu_read_lock_held(&kvm->irq_srcu)) |
| 468 | if (kian->gsi == gsi) { | 468 | if (kian->gsi == gsi) { |
| 469 | srcu_read_unlock(&kvm->irq_srcu, idx); | 469 | srcu_read_unlock(&kvm->irq_srcu, idx); |
| 470 | return true; | 470 | return true; |
| @@ -480,8 +480,8 @@ void kvm_notify_acked_gsi(struct kvm *kvm, int gsi) · 9 unmodified lines | |||
| 480 | { | 480 | { |
| 481 | struct kvm_irq_ack_notifier *kian; | 481 | struct kvm_irq_ack_notifier *kian; |
| 482 | 482 | ||
| 483 | hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, | 483 | hlist_for_each_entry_srcu(kian, &kvm->irq_ack_notifier_list, |
| 484 | link) | 484 | link, srcu_read_lock_held(&kvm->irq_srcu)) |
| 485 | if (kian->gsi == gsi) | 485 | if (kian->gsi == gsi) |
| 486 | kian->irq_acked(kian); | 486 | kian->irq_acked(kian); |
| 487 | } | 487 | } |
| @@ -2248,7 +2248,6 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn · 2247 unmodified lines | |||
| 2248 | 2248 | ||
| 2249 | return NULL; | 2249 | return NULL; |
| 2250 | } | 2250 | } |
| 2251 | EXPORT_SYMBOL_GPL(kvm_vcpu_gfn_to_memslot); | ||
| 2252 | 2251 | ||
| 2253 | bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) | 2252 | bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) |
| 2254 | { | 2253 | { |
| @@ -2463,9 +2462,8 @@ static int kvm_try_get_pfn(kvm_pfn_t pfn) · 208 unmodified lines | |||
| 2463 | } | 2462 | } |
| 2464 | 2463 | ||
| 2465 | static int hva_to_pfn_remapped(struct vm_area_struct *vma, | 2464 | static int hva_to_pfn_remapped(struct vm_area_struct *vma, |
| 2466 | unsigned long addr, bool *async, | 2465 | unsigned long addr, bool write_fault, |
| 2467 | bool write_fault, bool *writable, | 2466 | bool *writable, kvm_pfn_t *p_pfn) |
| 2468 | kvm_pfn_t *p_pfn) | ||
| 2469 | { | 2467 | { |
| 2470 | kvm_pfn_t pfn; | 2468 | kvm_pfn_t pfn; |
| 2471 | pte_t *ptep; | 2469 | pte_t *ptep; |
| @@ -2575,7 +2573,7 @@ retry: · 103 unmodified lines | |||
| 2575 | if (vma == NULL) | 2573 | if (vma == NULL) |
| 2576 | pfn = KVM_PFN_ERR_FAULT; | 2574 | pfn = KVM_PFN_ERR_FAULT; |
| 2577 | else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) { | 2575 | else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) { |
| 2578 | r = hva_to_pfn_remapped(vma, addr, async, write_fault, writable, &pfn); | 2576 | r = hva_to_pfn_remapped(vma, addr, write_fault, writable, &pfn); |
| 2579 | if (r == -EAGAIN) | 2577 | if (r == -EAGAIN) |
| 2580 | goto retry; | 2578 | goto retry; |
| 2581 | if (r < 0) | 2579 | if (r < 0) |