Backmerge Linux 5.13-rc7 to make some pulls from later bases apply, and to bake in the conflicts so far.
Unified · Split
| @@ -109,8 +109,8 @@ ForEachMacros: · 108 unmodified lines | ||
| 109 | 109 | - 'css_for_each_child' |
| 110 | 110 | - 'css_for_each_descendant_post' |
| 111 | 111 | - 'css_for_each_descendant_pre' |
| 112 | − - 'cxl_for_each_cmd' | |
| 113 | 112 | - 'device_for_each_child_node' |
| 113 | + - 'displayid_iter_for_each' | |
| 114 | 114 | - 'dma_fence_chain_for_each' |
| 115 | 115 | - 'do_for_each_ftrace_op' |
| 116 | 116 | - 'drm_atomic_crtc_for_each_plane' |
| @@ -136,6 +136,7 @@ ForEachMacros: · 19 unmodified lines | ||
| 136 | 136 | - 'drm_mm_for_each_node_in_range' |
| 137 | 137 | - 'drm_mm_for_each_node_safe' |
| 138 | 138 | - 'flow_action_for_each' |
| 139 | + - 'for_each_acpi_dev_match' | |
| 139 | 140 | - 'for_each_active_dev_scope' |
| 140 | 141 | - 'for_each_active_drhd_unit' |
| 141 | 142 | - 'for_each_active_iommu' |
| @@ -171,7 +172,6 @@ ForEachMacros: · 29 unmodified lines | ||
| 171 | 172 | - 'for_each_dapm_widgets' |
| 172 | 173 | - 'for_each_dev_addr' |
| 173 | 174 | - 'for_each_dev_scope' |
| 174 | − - 'for_each_displayid_db' | |
| 175 | 175 | - 'for_each_dma_cap_mask' |
| 176 | 176 | - 'for_each_dpcm_be' |
| 177 | 177 | - 'for_each_dpcm_be_rollback' |
| @@ -179,6 +179,7 @@ ForEachMacros: · 1 unmodified line | ||
| 179 | 179 | - 'for_each_dpcm_fe' |
| 180 | 180 | - 'for_each_drhd_unit' |
| 181 | 181 | - 'for_each_dss_dev' |
| 182 | + - 'for_each_dtpm_table' | |
| 182 | 183 | - 'for_each_efi_memory_desc' |
| 183 | 184 | - 'for_each_efi_memory_desc_in_map' |
| 184 | 185 | - 'for_each_element' |
| @@ -215,6 +216,7 @@ ForEachMacros: · 30 unmodified lines | ||
| 215 | 216 | - 'for_each_migratetype_order' |
| 216 | 217 | - 'for_each_msi_entry' |
| 217 | 218 | - 'for_each_msi_entry_safe' |
| 219 | + - 'for_each_msi_vector' | |
| 218 | 220 | - 'for_each_net' |
| 219 | 221 | - 'for_each_net_continue_reverse' |
| 220 | 222 | - 'for_each_netdev' |
| @@ -270,6 +272,12 @@ ForEachMacros: · 49 unmodified lines | ||
| 270 | 272 | - 'for_each_prime_number_from' |
| 271 | 273 | - 'for_each_process' |
| 272 | 274 | - 'for_each_process_thread' |
| 275 | + - 'for_each_prop_codec_conf' | |
| 276 | + - 'for_each_prop_dai_codec' | |
| 277 | + - 'for_each_prop_dai_cpu' | |
| 278 | + - 'for_each_prop_dlc_codecs' | |
| 279 | + - 'for_each_prop_dlc_cpus' | |
| 280 | + - 'for_each_prop_dlc_platforms' | |
| 273 | 281 | - 'for_each_property_of_node' |
| 274 | 282 | - 'for_each_registered_fb' |
| 275 | 283 | - 'for_each_requested_gpio' |
| @@ -430,6 +438,7 @@ ForEachMacros: · 154 unmodified lines | ||
| 430 | 438 | - 'queue_for_each_hw_ctx' |
| 431 | 439 | - 'radix_tree_for_each_slot' |
| 432 | 440 | - 'radix_tree_for_each_tagged' |
| 441 | + - 'rb_for_each' | |
| 433 | 442 | - 'rbtree_postorder_for_each_entry_safe' |
| 434 | 443 | - 'rdma_for_each_block' |
| 435 | 444 | - 'rdma_for_each_port' |
| @@ -243,6 +243,9 @@ Maxime Ripard <mripard@kernel.org> <maxime.ripard@free-electrons.com> · 242 unmodified lines | ||
| 243 | 243 | Mayuresh Janorkar <mayur@ti.com> |
| 244 | 244 | Michael Buesch <m@bues.ch> |
| 245 | 245 | Michel Dänzer <michel@tungstengraphics.com> |
| 246 | +Michel Lespinasse <michel@lespinasse.org> | |
| 247 | +Michel Lespinasse <michel@lespinasse.org> <walken@google.com> | |
| 248 | +Michel Lespinasse <michel@lespinasse.org> <walken@zoy.org> | |
| 246 | 249 | Miguel Ojeda <ojeda@kernel.org> <miguel.ojeda.sandonis@gmail.com> |
| 247 | 250 | Mike Rapoport <rppt@kernel.org> <mike@compulab.co.il> |
| 248 | 251 | Mike Rapoport <rppt@kernel.org> <mike.rapoport@gmail.com> |
| @@ -1458,11 +1458,22 @@ unprivileged_bpf_disabled · 1457 unmodified lines | ||
| 1458 | 1458 | ========================= |
| 1459 | 1459 | |
| 1460 | 1460 | Writing 1 to this entry will disable unprivileged calls to ``bpf()``; |
| 1461 | −once disabled, calling ``bpf()`` without ``CAP_SYS_ADMIN`` will return | |
| 1462 | −``-EPERM``. | |
| 1461 | +once disabled, calling ``bpf()`` without ``CAP_SYS_ADMIN`` or ``CAP_BPF`` | |
| 1462 | +will return ``-EPERM``. Once set to 1, this can't be cleared from the | |
| 1463 | +running kernel anymore. | |
| 1463 | 1464 | |
| 1464 | −Once set, this can't be cleared. | |
| 1465 | +Writing 2 to this entry will also disable unprivileged calls to ``bpf()``, | |
| 1466 | +however, an admin can still change this setting later on, if needed, by | |
| 1467 | +writing 0 or 1 to this entry. | |
| 1465 | 1468 | |
| 1469 | +If ``BPF_UNPRIV_DEFAULT_OFF`` is enabled in the kernel config, then this | |
| 1470 | +entry will default to 2 instead of 0. | |
| 1471 | + | |
| 1472 | += ============================================================= | |
| 1473 | +0 Unprivileged calls to ``bpf()`` are enabled | |
| 1474 | +1 Unprivileged calls to ``bpf()`` are disabled without recovery | |
| 1475 | +2 Unprivileged calls to ``bpf()`` are disabled | |
| 1476 | += ============================================================= | |
| 1466 | 1477 | |
| 1467 | 1478 | watchdog |
| 1468 | 1479 | ======== |
| @@ -149,6 +149,17 @@ properties: · 148 unmodified lines | ||
| 149 | 149 | maxItems: 6 |
| 150 | 150 | $ref: /schemas/types.yaml#/definitions/uint32-array |
| 151 | 151 | |
| 152 | + sink-vdos-v1: | |
| 153 | + description: An array of u32 with each entry, a Vendor Defined Message Object (VDO), | |
| 154 | + providing additional information corresponding to the product, the detailed bit | |
| 155 | + definitions and the order of each VDO can be found in | |
| 156 | + "USB Power Delivery Specification Revision 2.0, Version 1.3" chapter 6.4.4.3.1 Discover | |
| 157 | + Identity. User can specify the VDO array via VDO_IDH/_CERT/_PRODUCT/_CABLE/_AMA defined in | |
| 158 | + dt-bindings/usb/pd.h. | |
| 159 | + minItems: 3 | |
| 160 | + maxItems: 6 | |
| 161 | + $ref: /schemas/types.yaml#/definitions/uint32-array | |
| 162 | + | |
| 152 | 163 | op-sink-microwatt: |
| 153 | 164 | description: Sink required operating power in microwatt, if source can't |
| 154 | 165 | offer the power, Capability Mismatch is set. Required for power sink and |
| @@ -207,6 +218,10 @@ properties: · 52 unmodified lines | ||
| 207 | 218 | SNK_READY for non-pd link. |
| 208 | 219 | type: boolean |
| 209 | 220 | |
| 221 | +dependencies: | |
| 222 | + sink-vdos-v1: [ 'sink-vdos' ] | |
| 223 | + sink-vdos: [ 'sink-vdos-v1' ] | |
| 224 | + | |
| 210 | 225 | required: |
| 211 | 226 | - compatible |
| 212 | 227 | |
| @@ -49,7 +49,7 @@ examples: · 48 unmodified lines | ||
| 49 | 49 | #size-cells = <0>; |
| 50 | 50 | |
| 51 | 51 | adc@48 { |
| 52 | − comatible = "ti,ads7828"; | |
| 52 | + compatible = "ti,ads7828"; | |
| 53 | 53 | reg = <0x48>; |
| 54 | 54 | vref-supply = <&vref>; |
| 55 | 55 | ti,differential-input; |
| @@ -46,6 +46,13 @@ properties: · 45 unmodified lines | ||
| 46 | 46 | description: | |
| 47 | 47 | I2C bus timeout in microseconds |
| 48 | 48 | |
| 49 | + fsl,i2c-erratum-a004447: | |
| 50 | + $ref: /schemas/types.yaml#/definitions/flag | |
| 51 | + description: | | |
| 52 | + Indicates the presence of QorIQ erratum A-004447, which | |
| 53 | + says that the standard i2c recovery scheme mechanism does | |
| 54 | + not work and an alternate implementation is needed. | |
| 55 | + | |
| 49 | 56 | required: |
| 50 | 57 | - compatible |
| 51 | 58 | - reg |
| @@ -67,9 +67,7 @@ properties: · 66 unmodified lines | ||
| 67 | 67 | maxItems: 1 |
| 68 | 68 | |
| 69 | 69 | clock-names: |
| 70 | − maxItems: 1 | |
| 71 | − items: | |
| 72 | − - const: fck | |
| 70 | + const: fck | |
| 73 | 71 | |
| 74 | 72 | resets: |
| 75 | 73 | maxItems: 1 |
| @@ -10,7 +10,7 @@ allOf: · 9 unmodified lines | ||
| 10 | 10 | - $ref: ethernet-controller.yaml# |
| 11 | 11 | |
| 12 | 12 | maintainers: |
| 13 | − - Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | |
| 13 | + - Sergei Shtylyov <sergei.shtylyov@gmail.com> | |
| 14 | 14 | |
| 15 | 15 | properties: |
| 16 | 16 | compatible: |
| @@ -57,7 +57,7 @@ patternProperties: · 56 unmodified lines | ||
| 57 | 57 | rate |
| 58 | 58 | |
| 59 | 59 | sound-dai: |
| 60 | − $ref: /schemas/types.yaml#/definitions/phandle | |
| 60 | + $ref: /schemas/types.yaml#/definitions/phandle-array | |
| 61 | 61 | description: phandle of the CPU DAI |
| 62 | 62 | |
| 63 | 63 | patternProperties: |
| @@ -71,7 +71,7 @@ patternProperties: · 7 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | properties: |
| 73 | 73 | sound-dai: |
| 74 | − $ref: /schemas/types.yaml#/definitions/phandle | |
| 74 | + $ref: /schemas/types.yaml#/definitions/phandle-array | |
| 75 | 75 | description: phandle of the codec DAI |
| 76 | 76 | |
| 77 | 77 | required: |
| @@ -72,7 +72,7 @@ examples: · 71 unmodified lines | ||
| 72 | 72 | |
| 73 | 73 | mux-controls = <&mux>; |
| 74 | 74 | |
| 75 | − spi-flash@0 { | |
| 75 | + flash@0 { | |
| 76 | 76 | compatible = "jedec,spi-nor"; |
| 77 | 77 | reg = <0>; |
| 78 | 78 | spi-max-frequency = <40000000>; |
| @@ -123,6 +123,8 @@ are in ``drivers/usb/common/common.c``. · 122 unmodified lines | ||
| 123 | 123 | In addition, some functions useful for creating debugging output are |
| 124 | 124 | defined in ``drivers/usb/common/debug.c``. |
| 125 | 125 | |
| 126 | +.. _usb_header: | |
| 127 | + | |
| 126 | 128 | Host-Side Data Types and Macros |
| 127 | 129 | =============================== |
| 128 | 130 | |
| @@ -58,6 +58,6 @@ RISC-V Linux Kernel SV39 · 57 unmodified lines | ||
| 58 | 58 | | |
| 59 | 59 | ____________________________________________________________|____________________________________________________________ |
| 60 | 60 | | | | | |
| 61 | − ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | modules | |
| 62 | − ffffffff80000000 | -2 GB | ffffffffffffffff | 2 GB | kernel, BPF | |
| 61 | + ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | modules, BPF | |
| 62 | + ffffffff80000000 | -2 GB | ffffffffffffffff | 2 GB | kernel | |
| 63 | 63 | __________________|____________|__________________|_________|____________________________________________________________ |
| @@ -250,14 +250,14 @@ Users can read via ``ioctl(SECCOMP_IOCTL_NOTIF_RECV)`` (or ``poll()``) on a · 249 unmodified lines | ||
| 250 | 250 | seccomp notification fd to receive a ``struct seccomp_notif``, which contains |
| 251 | 251 | five members: the input length of the structure, a unique-per-filter ``id``, |
| 252 | 252 | the ``pid`` of the task which triggered this request (which may be 0 if the |
| 253 | −task is in a pid ns not visible from the listener's pid namespace), a ``flags`` | |
| 254 | −member which for now only has ``SECCOMP_NOTIF_FLAG_SIGNALED``, representing | |
| 255 | −whether or not the notification is a result of a non-fatal signal, and the | |
| 256 | −``data`` passed to seccomp. Userspace can then make a decision based on this | |
| 257 | −information about what to do, and ``ioctl(SECCOMP_IOCTL_NOTIF_SEND)`` a | |
| 258 | −response, indicating what should be returned to userspace. The ``id`` member of | |
| 259 | −``struct seccomp_notif_resp`` should be the same ``id`` as in ``struct | |
| 260 | −seccomp_notif``. | |
| 253 | +task is in a pid ns not visible from the listener's pid namespace). The | |
| 254 | +notification also contains the ``data`` passed to seccomp, and a filters flag. | |
| 255 | +The structure should be zeroed out prior to calling the ioctl. | |
| 256 | + | |
| 257 | +Userspace can then make a decision based on this information about what to do, | |
| 258 | +and ``ioctl(SECCOMP_IOCTL_NOTIF_SEND)`` a response, indicating what should be | |
| 259 | +returned to userspace. The ``id`` member of ``struct seccomp_notif_resp`` should | |
| 260 | +be the same ``id`` as in ``struct seccomp_notif``. | |
| 261 | 261 | |
| 262 | 262 | It is worth noting that ``struct seccomp_data`` contains the values of register |
| 263 | 263 | arguments to the syscall, but does not contain pointers to memory. The task's |
| @@ -171,8 +171,8 @@ Shadow pages contain the following information: · 170 unmodified lines | ||
| 171 | 171 | shadow pages) so role.quadrant takes values in the range 0..3. Each |
| 172 | 172 | quadrant maps 1GB virtual address space. |
| 173 | 173 | role.access: |
| 174 | − Inherited guest access permissions in the form uwx. Note execute | |
| 175 | − permission is positive, not negative. | |
| 174 | + Inherited guest access permissions from the parent ptes in the form uwx. | |
| 175 | + Note execute permission is positive, not negative. | |
| 176 | 176 | role.invalid: |
| 177 | 177 | The page is invalid and should not be used. It is a root page that is |
| 178 | 178 | currently pinned (by a cpu hardware register pointing to it); once it is |
| @@ -118,10 +118,12 @@ KVM_REQ_MMU_RELOAD · 117 unmodified lines | ||
| 118 | 118 | necessary to inform each VCPU to completely refresh the tables. This |
| 119 | 119 | request is used for that. |
| 120 | 120 | |
| 121 | −KVM_REQ_PENDING_TIMER | |
| 121 | +KVM_REQ_UNBLOCK | |
| 122 | 122 | |
| 123 | − This request may be made from a timer handler run on the host on behalf | |
| 124 | − of a VCPU. It informs the VCPU thread to inject a timer interrupt. | |
| 123 | + This request informs the vCPU to exit kvm_vcpu_block. It is used for | |
| 124 | + example from timer handlers that run on the host on behalf of a vCPU, | |
| 125 | + or in order to update the interrupt routing and ensure that assigned | |
| 126 | + devices will wake up the vCPU. | |
| 125 | 127 | |
| 126 | 128 | KVM_REQ_UNHALT |
| 127 | 129 | |
| @@ -181,7 +181,7 @@ SLUB Debug output · 180 unmodified lines | ||
| 181 | 181 | Here is a sample of slub debug output:: |
| 182 | 182 | |
| 183 | 183 | ==================================================================== |
| 184 | − BUG kmalloc-8: Redzone overwritten | |
| 184 | + BUG kmalloc-8: Right Redzone overwritten | |
| 185 | 185 | -------------------------------------------------------------------- |
| 186 | 186 | |
| 187 | 187 | INFO: 0xc90f6d28-0xc90f6d2b. First byte 0x00 instead of 0xcc |
| @@ -189,10 +189,10 @@ Here is a sample of slub debug output:: · 1 unmodified line | ||
| 189 | 189 | INFO: Object 0xc90f6d20 @offset=3360 fp=0xc90f6d58 |
| 190 | 190 | INFO: Allocated in get_modalias+0x61/0xf5 age=53 cpu=1 pid=554 |
| 191 | 191 | |
| 192 | − Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ | |
| 193 | − Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005 | |
| 194 | − Redzone 0xc90f6d28: 00 cc cc cc . | |
| 195 | − Padding 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ | |
| 192 | + Bytes b4 (0xc90f6d10): 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ | |
| 193 | + Object (0xc90f6d20): 31 30 31 39 2e 30 30 35 1019.005 | |
| 194 | + Redzone (0xc90f6d28): 00 cc cc cc . | |
| 195 | + Padding (0xc90f6d50): 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ | |
| 196 | 196 | |
| 197 | 197 | [<c010523d>] dump_trace+0x63/0x1eb |
| 198 | 198 | [<c01053df>] show_trace_log_lvl+0x1a/0x2f |
| @@ -3877,6 +3877,7 @@ L: linux-btrfs@vger.kernel.org · 3876 unmodified lines | ||
| 3877 | 3877 | S: Maintained |
| 3878 | 3878 | W: http://btrfs.wiki.kernel.org/ |
| 3879 | 3879 | Q: http://patchwork.kernel.org/project/linux-btrfs/list/ |
| 3880 | +C: irc://irc.libera.chat/btrfs | |
| 3880 | 3881 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git |
| 3881 | 3882 | F: Documentation/filesystems/btrfs.rst |
| 3882 | 3883 | F: fs/btrfs/ |
| @@ -4138,6 +4139,14 @@ S: Odd Fixes · 255 unmodified lines | ||
| 4138 | 4139 | F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt |
| 4139 | 4140 | F: arch/arm64/boot/dts/cavium/thunder2-99xx* |
| 4140 | 4141 | |
| 4142 | +CBS/ETF/TAPRIO QDISCS | |
| 4143 | +M: Vinicius Costa Gomes <vinicius.gomes@intel.com> | |
| 4144 | +S: Maintained | |
| 4145 | +L: netdev@vger.kernel.org | |
| 4146 | +F: net/sched/sch_cbs.c | |
| 4147 | +F: net/sched/sch_etf.c | |
| 4148 | +F: net/sched/sch_taprio.c | |
| 4149 | + | |
| 4141 | 4150 | CC2520 IEEE-802.15.4 RADIO DRIVER |
| 4142 | 4151 | M: Varka Bhadram <varkabhadram@gmail.com> |
| 4143 | 4152 | L: linux-wpan@vger.kernel.org |
| @@ -5569,7 +5578,6 @@ F: drivers/soc/fsl/dpio · 1425 unmodified lines | ||
| 5569 | 5578 | |
| 5570 | 5579 | DPAA2 ETHERNET DRIVER |
| 5571 | 5580 | M: Ioana Ciornei <ioana.ciornei@nxp.com> |
| 5572 | −M: Ioana Radulescu <ruxandra.radulescu@nxp.com> | |
| 5573 | 5581 | L: netdev@vger.kernel.org |
| 5574 | 5582 | S: Maintained |
| 5575 | 5583 | F: Documentation/networking/device_drivers/ethernet/freescale/dpaa2/ethernet-driver.rst |
| @@ -6953,6 +6961,7 @@ F: net/core/failover.c · 1377 unmodified lines | ||
| 6953 | 6961 | FANOTIFY |
| 6954 | 6962 | M: Jan Kara <jack@suse.cz> |
| 6955 | 6963 | R: Amir Goldstein <amir73il@gmail.com> |
| 6964 | +R: Matthew Bobrowski <repnop@google.com> | |
| 6956 | 6965 | L: linux-fsdevel@vger.kernel.org |
| 6957 | 6966 | S: Maintained |
| 6958 | 6967 | F: fs/notify/fanotify/ |
| @@ -12704,9 +12713,9 @@ F: drivers/rtc/rtc-ntxec.c · 5745 unmodified lines | ||
| 12704 | 12713 | F: include/linux/mfd/ntxec.h |
| 12705 | 12714 | |
| 12706 | 12715 | NETRONOME ETHERNET DRIVERS |
| 12707 | −M: Simon Horman <simon.horman@netronome.com> | |
| 12716 | +M: Simon Horman <simon.horman@corigine.com> | |
| 12708 | 12717 | R: Jakub Kicinski <kuba@kernel.org> |
| 12709 | −L: oss-drivers@netronome.com | |
| 12718 | +L: oss-drivers@corigine.com | |
| 12710 | 12719 | S: Maintained |
| 12711 | 12720 | F: drivers/net/ethernet/netronome/ |
| 12712 | 12721 | |
| @@ -12733,7 +12742,6 @@ M: "David S. Miller" <davem@davemloft.net> · 20 unmodified lines | ||
| 12733 | 12742 | M: Jakub Kicinski <kuba@kernel.org> |
| 12734 | 12743 | L: netdev@vger.kernel.org |
| 12735 | 12744 | S: Maintained |
| 12736 | −W: http://www.linuxfoundation.org/en/Net | |
| 12737 | 12745 | Q: https://patchwork.kernel.org/project/netdevbpf/list/ |
| 12738 | 12746 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git |
| 12739 | 12747 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git |
| @@ -12778,7 +12786,6 @@ M: "David S. Miller" <davem@davemloft.net> · 38 unmodified lines | ||
| 12778 | 12786 | M: Jakub Kicinski <kuba@kernel.org> |
| 12779 | 12787 | L: netdev@vger.kernel.org |
| 12780 | 12788 | S: Maintained |
| 12781 | −W: http://www.linuxfoundation.org/en/Net | |
| 12782 | 12789 | Q: https://patchwork.kernel.org/project/netdevbpf/list/ |
| 12783 | 12790 | B: mailto:netdev@vger.kernel.org |
| 12784 | 12791 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git |
| @@ -12920,8 +12927,10 @@ F: include/uapi/linux/nexthop.h · 135 unmodified lines | ||
| 12920 | 12927 | F: net/ipv4/nexthop.c |
| 12921 | 12928 | |
| 12922 | 12929 | NFC SUBSYSTEM |
| 12930 | +M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | |
| 12931 | +L: linux-nfc@lists.01.org (subscribers-only) | |
| 12923 | 12932 | L: netdev@vger.kernel.org |
| 12924 | −S: Orphan | |
| 12933 | +S: Maintained | |
| 12925 | 12934 | F: Documentation/devicetree/bindings/net/nfc/ |
| 12926 | 12935 | F: drivers/nfc/ |
| 12927 | 12936 | F: include/linux/platform_data/nfcmrvl.h |
| @@ -12932,7 +12941,7 @@ F: net/nfc/ · 4 unmodified lines | ||
| 12932 | 12941 | NFC VIRTUAL NCI DEVICE DRIVER |
| 12933 | 12942 | M: Bongsu Jeon <bongsu.jeon@samsung.com> |
| 12934 | 12943 | L: netdev@vger.kernel.org |
| 12935 | −L: linux-nfc@lists.01.org (moderated for non-subscribers) | |
| 12944 | +L: linux-nfc@lists.01.org (subscribers-only) | |
| 12936 | 12945 | S: Supported |
| 12937 | 12946 | F: drivers/nfc/virtual_ncidev.c |
| 12938 | 12947 | F: tools/testing/selftests/nci/ |
| @@ -13229,9 +13238,8 @@ F: Documentation/devicetree/bindings/sound/tfa9879.txt · 290 unmodified lines | ||
| 13229 | 13238 | F: sound/soc/codecs/tfa9879* |
| 13230 | 13239 | |
| 13231 | 13240 | NXP-NCI NFC DRIVER |
| 13232 | −M: Clément Perrochaud <clement.perrochaud@effinnov.com> | |
| 13233 | 13241 | R: Charles Gorand <charles.gorand@effinnov.com> |
| 13234 | −L: linux-nfc@lists.01.org (moderated for non-subscribers) | |
| 13242 | +L: linux-nfc@lists.01.org (subscribers-only) | |
| 13235 | 13243 | S: Supported |
| 13236 | 13244 | F: drivers/nfc/nxp-nci |
| 13237 | 13245 | |
| @@ -14134,6 +14142,7 @@ F: drivers/pci/controller/pci-v3-semi.c · 896 unmodified lines | ||
| 14134 | 14142 | PCI ENDPOINT SUBSYSTEM |
| 14135 | 14143 | M: Kishon Vijay Abraham I <kishon@ti.com> |
| 14136 | 14144 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
| 14145 | +R: Krzysztof Wilczyński <kw@linux.com> | |
| 14137 | 14146 | L: linux-pci@vger.kernel.org |
| 14138 | 14147 | S: Supported |
| 14139 | 14148 | F: Documentation/PCI/endpoint/* |
| @@ -14182,6 +14191,7 @@ F: drivers/pci/controller/pci-xgene-msi.c · 42 unmodified lines | ||
| 14182 | 14191 | PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS |
| 14183 | 14192 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
| 14184 | 14193 | R: Rob Herring <robh@kernel.org> |
| 14194 | +R: Krzysztof Wilczyński <kw@linux.com> | |
| 14185 | 14195 | L: linux-pci@vger.kernel.org |
| 14186 | 14196 | S: Supported |
| 14187 | 14197 | Q: http://patchwork.ozlabs.org/project/linux-pci/list/ |
| @@ -14341,10 +14351,12 @@ PER-CPU MEMORY ALLOCATOR · 153 unmodified lines | ||
| 14341 | 14351 | M: Dennis Zhou <dennis@kernel.org> |
| 14342 | 14352 | M: Tejun Heo <tj@kernel.org> |
| 14343 | 14353 | M: Christoph Lameter <cl@linux.com> |
| 14354 | +L: linux-mm@kvack.org | |
| 14344 | 14355 | S: Maintained |
| 14345 | 14356 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu.git |
| 14346 | 14357 | F: arch/*/include/asm/percpu.h |
| 14347 | 14358 | F: include/linux/percpu*.h |
| 14359 | +F: lib/percpu*.c | |
| 14348 | 14360 | F: mm/percpu*.c |
| 14349 | 14361 | |
| 14350 | 14362 | PER-TASK DELAY ACCOUNTING |
| @@ -15969,6 +15981,7 @@ S390 IUCV NETWORK LAYER · 1618 unmodified lines | ||
| 15969 | 15981 | M: Julian Wiedmann <jwi@linux.ibm.com> |
| 15970 | 15982 | M: Karsten Graul <kgraul@linux.ibm.com> |
| 15971 | 15983 | L: linux-s390@vger.kernel.org |
| 15984 | +L: netdev@vger.kernel.org | |
| 15972 | 15985 | S: Supported |
| 15973 | 15986 | W: http://www.ibm.com/developerworks/linux/linux390/ |
| 15974 | 15987 | F: drivers/s390/net/*iucv* |
| @@ -15979,6 +15992,7 @@ S390 NETWORK DRIVERS · 4 unmodified lines | ||
| 15979 | 15992 | M: Julian Wiedmann <jwi@linux.ibm.com> |
| 15980 | 15993 | M: Karsten Graul <kgraul@linux.ibm.com> |
| 15981 | 15994 | L: linux-s390@vger.kernel.org |
| 15995 | +L: netdev@vger.kernel.org | |
| 15982 | 15996 | S: Supported |
| 15983 | 15997 | W: http://www.ibm.com/developerworks/linux/linux390/ |
| 15984 | 15998 | F: drivers/s390/net/ |
| @@ -16157,7 +16171,7 @@ F: include/media/drv-intf/s3c_camif.h · 172 unmodified lines | ||
| 16157 | 16171 | SAMSUNG S3FWRN5 NFC DRIVER |
| 16158 | 16172 | M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> |
| 16159 | 16173 | M: Krzysztof Opasiak <k.opasiak@samsung.com> |
| 16160 | −L: linux-nfc@lists.01.org (moderated for non-subscribers) | |
| 16174 | +L: linux-nfc@lists.01.org (subscribers-only) | |
| 16161 | 16175 | S: Maintained |
| 16162 | 16176 | F: Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml |
| 16163 | 16177 | F: drivers/nfc/s3fwrn5 |
| @@ -16570,6 +16584,7 @@ F: drivers/misc/sgi-xp/ · 406 unmodified lines | ||
| 16570 | 16584 | |
| 16571 | 16585 | SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS |
| 16572 | 16586 | M: Karsten Graul <kgraul@linux.ibm.com> |
| 16587 | +M: Guvenc Gulce <guvenc@linux.ibm.com> | |
| 16573 | 16588 | L: linux-s390@vger.kernel.org |
| 16574 | 16589 | S: Supported |
| 16575 | 16590 | W: http://www.ibm.com/developerworks/linux/linux390/ |
| @@ -17328,6 +17343,12 @@ L: linux-i2c@vger.kernel.org · 752 unmodified lines | ||
| 17328 | 17343 | S: Maintained |
| 17329 | 17344 | F: drivers/i2c/busses/i2c-stm32* |
| 17330 | 17345 | |
| 17346 | +ST STM32 SPI DRIVER | |
| 17347 | +M: Alain Volmat <alain.volmat@foss.st.com> | |
| 17348 | +L: linux-spi@vger.kernel.org | |
| 17349 | +S: Maintained | |
| 17350 | +F: drivers/spi/spi-stm32.c | |
| 17351 | + | |
| 17331 | 17352 | ST STPDDC60 DRIVER |
| 17332 | 17353 | M: Daniel Nilsson <daniel.nilsson@flex.com> |
| 17333 | 17354 | L: linux-hwmon@vger.kernel.org |
| @@ -17686,7 +17707,6 @@ R: Mika Westerberg <mika.westerberg@linux.intel.com> · 352 unmodified lines | ||
| 17686 | 17707 | L: linux-i2c@vger.kernel.org |
| 17687 | 17708 | S: Maintained |
| 17688 | 17709 | F: drivers/i2c/busses/i2c-designware-* |
| 17689 | −F: include/linux/platform_data/i2c-designware.h | |
| 17690 | 17710 | |
| 17691 | 17711 | SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER |
| 17692 | 17712 | M: Jaehoon Chung <jh80.chung@samsung.com> |
| @@ -18342,7 +18362,7 @@ F: sound/soc/codecs/tas571x* · 649 unmodified lines | ||
| 18342 | 18362 | TI TRF7970A NFC DRIVER |
| 18343 | 18363 | M: Mark Greer <mgreer@animalcreek.com> |
| 18344 | 18364 | L: linux-wireless@vger.kernel.org |
| 18345 | −L: linux-nfc@lists.01.org (moderated for non-subscribers) | |
| 18365 | +L: linux-nfc@lists.01.org (subscribers-only) | |
| 18346 | 18366 | S: Supported |
| 18347 | 18367 | F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt |
| 18348 | 18368 | F: drivers/nfc/trf7970a.c |
| @@ -18878,6 +18898,13 @@ S: Maintained · 529 unmodified lines | ||
| 18878 | 18898 | F: drivers/usb/host/isp116x* |
| 18879 | 18899 | F: include/linux/usb/isp116x.h |
| 18880 | 18900 | |
| 18901 | +USB ISP1760 DRIVER | |
| 18902 | +M: Rui Miguel Silva <rui.silva@linaro.org> | |
| 18903 | +L: linux-usb@vger.kernel.org | |
| 18904 | +S: Maintained | |
| 18905 | +F: drivers/usb/isp1760/* | |
| 18906 | +F: Documentation/devicetree/bindings/usb/nxp,isp1760.yaml | |
| 18907 | + | |
| 18881 | 18908 | USB LAN78XX ETHERNET DRIVER |
| 18882 | 18909 | M: Woojung Huh <woojung.huh@microchip.com> |
| 18883 | 18910 | M: UNGLinuxDriver@microchip.com |
| @@ -20022,6 +20049,7 @@ F: arch/x86/xen/*swiotlb* · 1138 unmodified lines | ||
| 20022 | 20049 | F: drivers/xen/*swiotlb* |
| 20023 | 20050 | |
| 20024 | 20051 | XFS FILESYSTEM |
| 20052 | +C: irc://irc.oftc.net/xfs | |
| 20025 | 20053 | M: Darrick J. Wong <djwong@kernel.org> |
| 20026 | 20054 | M: linux-xfs@vger.kernel.org |
| 20027 | 20055 | L: linux-xfs@vger.kernel.org |
| @@ -2,8 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 13 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc3 | |
| 6 | −NAME = Frozen Wasteland | |
| 5 | +EXTRAVERSION = -rc7 | |
| 6 | +NAME = Opossums on Parade | |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| 9 | 9 | # To see a list of typical targets execute "make help" |
| @@ -928,6 +928,14 @@ CC_FLAGS_LTO += -fvisibility=hidden · 918 unmodified lines | ||
| 928 | 928 | |
| 929 | 929 | # Limit inlining across translation units to reduce binary size |
| 930 | 930 | KBUILD_LDFLAGS += -mllvm -import-instr-limit=5 |
| 931 | + | |
| 932 | +# Check for frame size exceeding threshold during prolog/epilog insertion | |
| 933 | +# when using lld < 13.0.0. | |
| 934 | +ifneq ($(CONFIG_FRAME_WARN),0) | |
| 935 | +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0) | |
| 936 | +KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN) | |
| 937 | +endif | |
| 938 | +endif | |
| 931 | 939 | endif |
| 932 | 940 | |
| 933 | 941 | ifdef CONFIG_LTO |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | */ |
| 19 | 19 | struct sigcontext { |
| 20 | 20 | struct user_regs_struct regs; |
| 21 | + struct user_regs_arcv2 v2abi; | |
| 21 | 22 | }; |
| 22 | 23 | |
| 23 | 24 | #endif /* _ASM_ARC_SIGCONTEXT_H */ |
| @@ -61,6 +61,41 @@ struct rt_sigframe { · 60 unmodified lines | ||
| 61 | 61 | unsigned int sigret_magic; |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | +static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs) | |
| 65 | +{ | |
| 66 | + int err = 0; | |
| 67 | +#ifndef CONFIG_ISA_ARCOMPACT | |
| 68 | + struct user_regs_arcv2 v2abi; | |
| 69 | + | |
| 70 | + v2abi.r30 = regs->r30; | |
| 71 | +#ifdef CONFIG_ARC_HAS_ACCL_REGS | |
| 72 | + v2abi.r58 = regs->r58; | |
| 73 | + v2abi.r59 = regs->r59; | |
| 74 | +#else | |
| 75 | + v2abi.r58 = v2abi.r59 = 0; | |
| 76 | +#endif | |
| 77 | + err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi)); | |
| 78 | +#endif | |
| 79 | + return err; | |
| 80 | +} | |
| 81 | + | |
| 82 | +static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs) | |
| 83 | +{ | |
| 84 | + int err = 0; | |
| 85 | +#ifndef CONFIG_ISA_ARCOMPACT | |
| 86 | + struct user_regs_arcv2 v2abi; | |
| 87 | + | |
| 88 | + err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi)); | |
| 89 | + | |
| 90 | + regs->r30 = v2abi.r30; | |
| 91 | +#ifdef CONFIG_ARC_HAS_ACCL_REGS | |
| 92 | + regs->r58 = v2abi.r58; | |
| 93 | + regs->r59 = v2abi.r59; | |
| 94 | +#endif | |
| 95 | +#endif | |
| 96 | + return err; | |
| 97 | +} | |
| 98 | + | |
| 64 | 99 | static int |
| 65 | 100 | stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, |
| 66 | 101 | sigset_t *set) |
| @@ -94,6 +129,10 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, · 27 unmodified lines | ||
| 94 | 129 | |
| 95 | 130 | err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch, |
| 96 | 131 | sizeof(sf->uc.uc_mcontext.regs.scratch)); |
| 132 | + | |
| 133 | + if (is_isa_arcv2()) | |
| 134 | + err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs); | |
| 135 | + | |
| 97 | 136 | err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); |
| 98 | 137 | |
| 99 | 138 | return err ? -EFAULT : 0; |
| @@ -109,6 +148,10 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) · 9 unmodified lines | ||
| 109 | 148 | err |= __copy_from_user(&uregs.scratch, |
| 110 | 149 | &(sf->uc.uc_mcontext.regs.scratch), |
| 111 | 150 | sizeof(sf->uc.uc_mcontext.regs.scratch)); |
| 151 | + | |
| 152 | + if (is_isa_arcv2()) | |
| 153 | + err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs); | |
| 154 | + | |
| 112 | 155 | if (err) |
| 113 | 156 | return -EFAULT; |
| 114 | 157 | |
| @@ -57,7 +57,6 @@ SECTIONS · 56 unmodified lines | ||
| 57 | 57 | .init.ramfs : { INIT_RAM_FS } |
| 58 | 58 | |
| 59 | 59 | . = ALIGN(PAGE_SIZE); |
| 60 | − _stext = .; | |
| 61 | 60 | |
| 62 | 61 | HEAD_TEXT_SECTION |
| 63 | 62 | INIT_TEXT_SECTION(L1_CACHE_BYTES) |
| @@ -83,6 +82,7 @@ SECTIONS · 19 unmodified lines | ||
| 83 | 82 | |
| 84 | 83 | .text : { |
| 85 | 84 | _text = .; |
| 85 | + _stext = .; | |
| 86 | 86 | TEXT_TEXT |
| 87 | 87 | SCHED_TEXT |
| 88 | 88 | CPUIDLE_TEXT |
| @@ -105,9 +105,13 @@ · 104 unmodified lines | ||
| 105 | 105 | phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; |
| 106 | 106 | phy-reset-duration = <20>; |
| 107 | 107 | phy-supply = <&sw2_reg>; |
| 108 | − phy-handle = <ðphy0>; | |
| 109 | 108 | status = "okay"; |
| 110 | 109 | |
| 110 | + fixed-link { | |
| 111 | + speed = <1000>; | |
| 112 | + full-duplex; | |
| 113 | + }; | |
| 114 | + | |
| 111 | 115 | mdio { |
| 112 | 116 | #address-cells = <1>; |
| 113 | 117 | #size-cells = <0>; |
| @@ -406,6 +406,18 @@ · 405 unmodified lines | ||
| 406 | 406 | vin-supply = <&sw1_reg>; |
| 407 | 407 | }; |
| 408 | 408 | |
| 409 | +®_pu { | |
| 410 | + vin-supply = <&sw1_reg>; | |
| 411 | +}; | |
| 412 | + | |
| 413 | +®_vdd1p1 { | |
| 414 | + vin-supply = <&sw2_reg>; | |
| 415 | +}; | |
| 416 | + | |
| 417 | +®_vdd2p5 { | |
| 418 | + vin-supply = <&sw2_reg>; | |
| 419 | +}; | |
| 420 | + | |
| 409 | 421 | &uart1 { |
| 410 | 422 | pinctrl-names = "default"; |
| 411 | 423 | pinctrl-0 = <&pinctrl_uart1>; |
| @@ -126,7 +126,7 @@ · 125 unmodified lines | ||
| 126 | 126 | compatible = "nxp,pca8574"; |
| 127 | 127 | reg = <0x3a>; |
| 128 | 128 | gpio-controller; |
| 129 | − #gpio-cells = <1>; | |
| 129 | + #gpio-cells = <2>; | |
| 130 | 130 | }; |
| 131 | 131 | }; |
| 132 | 132 | |
| @@ -193,7 +193,7 @@ · 192 unmodified lines | ||
| 193 | 193 | pinctrl-names = "default"; |
| 194 | 194 | pinctrl-0 = <&pinctrl_usdhc1>; |
| 195 | 195 | keep-power-in-suspend; |
| 196 | − tuning-step = <2>; | |
| 196 | + fsl,tuning-step = <2>; | |
| 197 | 197 | vmmc-supply = <®_3p3v>; |
| 198 | 198 | no-1-8-v; |
| 199 | 199 | broken-cd; |
| @@ -351,7 +351,7 @@ · 350 unmodified lines | ||
| 351 | 351 | pinctrl-2 = <&pinctrl_usdhc1_200mhz>; |
| 352 | 352 | cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; |
| 353 | 353 | bus-width = <4>; |
| 354 | − tuning-step = <2>; | |
| 354 | + fsl,tuning-step = <2>; | |
| 355 | 355 | vmmc-supply = <®_3p3v>; |
| 356 | 356 | wakeup-source; |
| 357 | 357 | no-1-8-v; |
| @@ -7,9 +7,11 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifdef CONFIG_CPU_IDLE |
| 8 | 8 | extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev, |
| 9 | 9 | struct cpuidle_driver *drv, int index); |
| 10 | +#define __cpuidle_method_section __used __section("__cpuidle_method_of_table") | |
| 10 | 11 | #else |
| 11 | 12 | static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev, |
| 12 | 13 | struct cpuidle_driver *drv, int index) { return -ENODEV; } |
| 14 | +#define __cpuidle_method_section __maybe_unused /* drop silently */ | |
| 13 | 15 | #endif |
| 14 | 16 | |
| 15 | 17 | /* Common ARM WFI state */ |
| @@ -42,8 +44,7 @@ struct of_cpuidle_method { · 26 unmodified lines | ||
| 42 | 44 | |
| 43 | 45 | #define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \ |
| 44 | 46 | static const struct of_cpuidle_method __cpuidle_method_of_table_##name \ |
| 45 | − __used __section("__cpuidle_method_of_table") \ | |
| 46 | − = { .method = _method, .ops = _ops } | |
| 47 | + __cpuidle_method_section = { .method = _method, .ops = _ops } | |
| 47 | 48 | |
| 48 | 49 | extern int arm_cpuidle_suspend(int index); |
| 49 | 50 | |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/suspend.h> |
| 13 | 13 | #include <linux/io.h> |
| 14 | 14 | |
| 15 | +#include "common.h" | |
| 15 | 16 | #include "hardware.h" |
| 16 | 17 | |
| 17 | 18 | static int mx27_suspend_enter(suspend_state_t state) |
| @@ -458,20 +458,6 @@ static struct gpiod_lookup_table leds_gpio_table = { · 457 unmodified lines | ||
| 458 | 458 | |
| 459 | 459 | #ifdef CONFIG_LEDS_TRIGGERS |
| 460 | 460 | DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger); |
| 461 | − | |
| 462 | −static int ams_delta_camera_power(struct device *dev, int power) | |
| 463 | −{ | |
| 464 | − /* | |
| 465 | − * turn on camera LED | |
| 466 | − */ | |
| 467 | − if (power) | |
| 468 | − led_trigger_event(ams_delta_camera_led_trigger, LED_FULL); | |
| 469 | − else | |
| 470 | − led_trigger_event(ams_delta_camera_led_trigger, LED_OFF); | |
| 471 | − return 0; | |
| 472 | −} | |
| 473 | −#else | |
| 474 | −#define ams_delta_camera_power NULL | |
| 475 | 461 | #endif |
| 476 | 462 | |
| 477 | 463 | static struct platform_device ams_delta_audio_device = { |
| @@ -320,7 +320,7 @@ static int tps_setup(struct i2c_client *client, void *context) · 319 unmodified lines | ||
| 320 | 320 | { |
| 321 | 321 | if (!IS_BUILTIN(CONFIG_TPS65010)) |
| 322 | 322 | return -ENOSYS; |
| 323 | − | |
| 323 | + | |
| 324 | 324 | tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | |
| 325 | 325 | TPS_LDO1_ENABLE | TPS_VLDO1_3_0V); |
| 326 | 326 | |
| @@ -394,6 +394,8 @@ static void __init h2_init(void) · 67 unmodified lines | ||
| 394 | 394 | BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0); |
| 395 | 395 | gpio_direction_input(H2_NAND_RB_GPIO_PIN); |
| 396 | 396 | |
| 397 | + gpiod_add_lookup_table(&isp1301_gpiod_table); | |
| 398 | + | |
| 397 | 399 | omap_cfg_reg(L3_1610_FLASH_CS2B_OE); |
| 398 | 400 | omap_cfg_reg(M8_1610_FLASH_CS2B_WE); |
| 399 | 401 | |
| @@ -655,9 +655,13 @@ static int __init omap_pm_init(void) · 654 unmodified lines | ||
| 655 | 655 | irq = INT_7XX_WAKE_UP_REQ; |
| 656 | 656 | else if (cpu_is_omap16xx()) |
| 657 | 657 | irq = INT_1610_WAKE_UP_REQ; |
| 658 | − if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", | |
| 659 | − NULL)) | |
| 660 | − pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); | |
| 658 | + else | |
| 659 | + irq = -1; | |
| 660 | + | |
| 661 | + if (irq >= 0) { | |
| 662 | + if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", NULL)) | |
| 663 | + pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); | |
| 664 | + } | |
| 661 | 665 | |
| 662 | 666 | /* Program new power ramp-up time |
| 663 | 667 | * (0 for most boards since we don't lower voltage when in deep sleep) |
| @@ -322,6 +322,7 @@ static int n8x0_mmc_get_cover_state(struct device *dev, int slot) · 321 unmodified lines | ||
| 322 | 322 | |
| 323 | 323 | static void n8x0_mmc_callback(void *data, u8 card_mask) |
| 324 | 324 | { |
| 325 | +#ifdef CONFIG_MMC_OMAP | |
| 325 | 326 | int bit, *openp, index; |
| 326 | 327 | |
| 327 | 328 | if (board_is_n800()) { |
| @@ -339,7 +340,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask) · 11 unmodified lines | ||
| 339 | 340 | else |
| 340 | 341 | *openp = 0; |
| 341 | 342 | |
| 342 | −#ifdef CONFIG_MMC_OMAP | |
| 343 | 343 | omap_mmc_notify_cover_event(mmc_device, index, *openp); |
| 344 | 344 | #else |
| 345 | 345 | pr_warn("MMC: notify cover event not available\n"); |
| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | −obj-y += kernel/ mm/ | |
| 3 | −obj-$(CONFIG_NET) += net/ | |
| 2 | +obj-y += kernel/ mm/ net/ | |
| 4 | 3 | obj-$(CONFIG_KVM) += kvm/ |
| 5 | 4 | obj-$(CONFIG_XEN) += xen/ |
| 6 | 5 | obj-$(CONFIG_CRYPTO) += crypto/ |
| @@ -165,6 +165,7 @@ config ARCH_MEDIATEK · 164 unmodified lines | ||
| 165 | 165 | |
| 166 | 166 | config ARCH_MESON |
| 167 | 167 | bool "Amlogic Platforms" |
| 168 | + select COMMON_CLK | |
| 168 | 169 | select MESON_IRQ_GPIO |
| 169 | 170 | help |
| 170 | 171 | This enables support for the arm64 based Amlogic SoCs |
| @@ -46,7 +46,8 @@ · 45 unmodified lines | ||
| 46 | 46 | eee-broken-100tx; |
| 47 | 47 | qca,clk-out-frequency = <125000000>; |
| 48 | 48 | qca,clk-out-strength = <AR803X_STRENGTH_FULL>; |
| 49 | − vddio-supply = <&vddh>; | |
| 49 | + qca,keep-pll-enabled; | |
| 50 | + vddio-supply = <&vddio>; | |
| 50 | 51 | |
| 51 | 52 | vddio: vddio-regulator { |
| 52 | 53 | regulator-name = "VDDIO"; |
| @@ -31,11 +31,10 @@ · 30 unmodified lines | ||
| 31 | 31 | reg = <0x4>; |
| 32 | 32 | eee-broken-1000t; |
| 33 | 33 | eee-broken-100tx; |
| 34 | − | |
| 35 | 34 | qca,clk-out-frequency = <125000000>; |
| 36 | 35 | qca,clk-out-strength = <AR803X_STRENGTH_FULL>; |
| 37 | − | |
| 38 | − vddio-supply = <&vddh>; | |
| 36 | + qca,keep-pll-enabled; | |
| 37 | + vddio-supply = <&vddio>; | |
| 39 | 38 | |
| 40 | 39 | vddio: vddio-regulator { |
| 41 | 40 | regulator-name = "VDDIO"; |
| @@ -197,8 +197,8 @@ · 196 unmodified lines | ||
| 197 | 197 | ddr: memory-controller@1080000 { |
| 198 | 198 | compatible = "fsl,qoriq-memory-controller"; |
| 199 | 199 | reg = <0x0 0x1080000 0x0 0x1000>; |
| 200 | − interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>; | |
| 201 | − big-endian; | |
| 200 | + interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; | |
| 201 | + little-endian; | |
| 202 | 202 | }; |
| 203 | 203 | |
| 204 | 204 | dcfg: syscon@1e00000 { |
| @@ -88,11 +88,11 @@ · 87 unmodified lines | ||
| 88 | 88 | pinctrl-0 = <&pinctrl_codec2>; |
| 89 | 89 | reg = <0x18>; |
| 90 | 90 | #sound-dai-cells = <0>; |
| 91 | − HPVDD-supply = <®_3p3v>; | |
| 92 | − SPRVDD-supply = <®_3p3v>; | |
| 93 | − SPLVDD-supply = <®_3p3v>; | |
| 94 | − AVDD-supply = <®_3p3v>; | |
| 95 | − IOVDD-supply = <®_3p3v>; | |
| 91 | + HPVDD-supply = <®_gen_3p3>; | |
| 92 | + SPRVDD-supply = <®_gen_3p3>; | |
| 93 | + SPLVDD-supply = <®_gen_3p3>; | |
| 94 | + AVDD-supply = <®_gen_3p3>; | |
| 95 | + IOVDD-supply = <®_gen_3p3>; | |
| 96 | 96 | DVDD-supply = <&vgen4_reg>; |
| 97 | 97 | reset-gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>; |
| 98 | 98 | }; |
| @@ -45,8 +45,8 @@ · 44 unmodified lines | ||
| 45 | 45 | reg_12p0_main: regulator-12p0-main { |
| 46 | 46 | compatible = "regulator-fixed"; |
| 47 | 47 | regulator-name = "12V_MAIN"; |
| 48 | − regulator-min-microvolt = <5000000>; | |
| 49 | − regulator-max-microvolt = <5000000>; | |
| 48 | + regulator-min-microvolt = <12000000>; | |
| 49 | + regulator-max-microvolt = <12000000>; | |
| 50 | 50 | regulator-always-on; |
| 51 | 51 | }; |
| 52 | 52 | |
| @@ -77,15 +77,6 @@ · 24 unmodified lines | ||
| 77 | 77 | regulator-always-on; |
| 78 | 78 | }; |
| 79 | 79 | |
| 80 | − reg_3p3v: regulator-3p3v { | |
| 81 | − compatible = "regulator-fixed"; | |
| 82 | − vin-supply = <®_3p3_main>; | |
| 83 | − regulator-name = "GEN_3V3"; | |
| 84 | − regulator-min-microvolt = <3300000>; | |
| 85 | − regulator-max-microvolt = <3300000>; | |
| 86 | − regulator-always-on; | |
| 87 | − }; | |
| 88 | − | |
| 89 | 80 | reg_usdhc2_vmmc: regulator-vsd-3v3 { |
| 90 | 81 | pinctrl-names = "default"; |
| 91 | 82 | pinctrl-0 = <&pinctrl_reg_usdhc2>; |
| @@ -415,11 +406,11 @@ · 323 unmodified lines | ||
| 415 | 406 | pinctrl-0 = <&pinctrl_codec1>; |
| 416 | 407 | reg = <0x18>; |
| 417 | 408 | #sound-dai-cells = <0>; |
| 418 | − HPVDD-supply = <®_3p3v>; | |
| 419 | − SPRVDD-supply = <®_3p3v>; | |
| 420 | − SPLVDD-supply = <®_3p3v>; | |
| 421 | − AVDD-supply = <®_3p3v>; | |
| 422 | − IOVDD-supply = <®_3p3v>; | |
| 409 | + HPVDD-supply = <®_gen_3p3>; | |
| 410 | + SPRVDD-supply = <®_gen_3p3>; | |
| 411 | + SPLVDD-supply = <®_gen_3p3>; | |
| 412 | + AVDD-supply = <®_gen_3p3>; | |
| 413 | + IOVDD-supply = <®_gen_3p3>; | |
| 423 | 414 | DVDD-supply = <&vgen4_reg>; |
| 424 | 415 | reset-gpios = <&gpio3 3 GPIO_ACTIVE_LOW>; |
| 425 | 416 | }; |
| @@ -42,12 +42,12 @@ · 41 unmodified lines | ||
| 42 | 42 | }; |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | − dmss: dmss { | |
| 45 | + dmss: bus@48000000 { | |
| 46 | 46 | compatible = "simple-mfd"; |
| 47 | 47 | #address-cells = <2>; |
| 48 | 48 | #size-cells = <2>; |
| 49 | 49 | dma-ranges; |
| 50 | − ranges; | |
| 50 | + ranges = <0x00 0x48000000 0x00 0x48000000 0x00 0x06400000>; | |
| 51 | 51 | |
| 52 | 52 | ti,sci-dev-id = <25>; |
| 53 | 53 | |
| @@ -134,7 +134,7 @@ · 80 unmodified lines | ||
| 134 | 134 | }; |
| 135 | 135 | }; |
| 136 | 136 | |
| 137 | − dmsc: dmsc@44043000 { | |
| 137 | + dmsc: system-controller@44043000 { | |
| 138 | 138 | compatible = "ti,k2g-sci"; |
| 139 | 139 | ti,host-id = <12>; |
| 140 | 140 | mbox-names = "rx", "tx"; |
| @@ -148,7 +148,7 @@ · 7 unmodified lines | ||
| 148 | 148 | #power-domain-cells = <2>; |
| 149 | 149 | }; |
| 150 | 150 | |
| 151 | − k3_clks: clocks { | |
| 151 | + k3_clks: clock-controller { | |
| 152 | 152 | compatible = "ti,k2g-sci-clk"; |
| 153 | 153 | #clock-cells = <2>; |
| 154 | 154 | }; |
| @@ -373,8 +373,9 @@ · 218 unmodified lines | ||
| 373 | 373 | clocks = <&k3_clks 145 0>; |
| 374 | 374 | }; |
| 375 | 375 | |
| 376 | − main_gpio_intr: interrupt-controller0 { | |
| 376 | + main_gpio_intr: interrupt-controller@a00000 { | |
| 377 | 377 | compatible = "ti,sci-intr"; |
| 378 | + reg = <0x00 0x00a00000 0x00 0x800>; | |
| 378 | 379 | ti,intr-trigger-type = <1>; |
| 379 | 380 | interrupt-controller; |
| 380 | 381 | interrupt-parent = <&gic500>; |
| @@ -74,8 +74,9 @@ · 73 unmodified lines | ||
| 74 | 74 | clocks = <&k3_clks 148 0>; |
| 75 | 75 | }; |
| 76 | 76 | |
| 77 | − mcu_gpio_intr: interrupt-controller1 { | |
| 77 | + mcu_gpio_intr: interrupt-controller@4210000 { | |
| 78 | 78 | compatible = "ti,sci-intr"; |
| 79 | + reg = <0x00 0x04210000 0x00 0x200>; | |
| 79 | 80 | ti,intr-trigger-type = <1>; |
| 80 | 81 | interrupt-controller; |
| 81 | 82 | interrupt-parent = <&gic500>; |
| @@ -433,8 +433,9 @@ · 432 unmodified lines | ||
| 433 | 433 | #phy-cells = <0>; |
| 434 | 434 | }; |
| 435 | 435 | |
| 436 | − intr_main_gpio: interrupt-controller0 { | |
| 436 | + intr_main_gpio: interrupt-controller@a00000 { | |
| 437 | 437 | compatible = "ti,sci-intr"; |
| 438 | + reg = <0x0 0x00a00000 0x0 0x400>; | |
| 438 | 439 | ti,intr-trigger-type = <1>; |
| 439 | 440 | interrupt-controller; |
| 440 | 441 | interrupt-parent = <&gic500>; |
| @@ -444,18 +445,19 @@ · 3 unmodified lines | ||
| 444 | 445 | ti,interrupt-ranges = <0 392 32>; |
| 445 | 446 | }; |
| 446 | 447 | |
| 447 | − main-navss { | |
| 448 | + main_navss: bus@30800000 { | |
| 448 | 449 | compatible = "simple-mfd"; |
| 449 | 450 | #address-cells = <2>; |
| 450 | 451 | #size-cells = <2>; |
| 451 | − ranges; | |
| 452 | + ranges = <0x0 0x30800000 0x0 0x30800000 0x0 0xbc00000>; | |
| 452 | 453 | dma-coherent; |
| 453 | 454 | dma-ranges; |
| 454 | 455 | |
| 455 | 456 | ti,sci-dev-id = <118>; |
| 456 | 457 | |
| 457 | − intr_main_navss: interrupt-controller1 { | |
| 458 | + intr_main_navss: interrupt-controller@310e0000 { | |
| 458 | 459 | compatible = "ti,sci-intr"; |
| 460 | + reg = <0x0 0x310e0000 0x0 0x2000>; | |
| 459 | 461 | ti,intr-trigger-type = <4>; |
| 460 | 462 | interrupt-controller; |
| 461 | 463 | interrupt-parent = <&gic500>; |
| @@ -116,11 +116,11 @@ · 115 unmodified lines | ||
| 116 | 116 | }; |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | − mcu-navss { | |
| 119 | + mcu_navss: bus@28380000 { | |
| 120 | 120 | compatible = "simple-mfd"; |
| 121 | 121 | #address-cells = <2>; |
| 122 | 122 | #size-cells = <2>; |
| 123 | − ranges; | |
| 123 | + ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>; | |
| 124 | 124 | dma-coherent; |
| 125 | 125 | dma-ranges; |
| 126 | 126 | |
| @@ -6,24 +6,24 @@ · 5 unmodified lines | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | &cbass_wakeup { |
| 9 | − dmsc: dmsc { | |
| 9 | + dmsc: system-controller@44083000 { | |
| 10 | 10 | compatible = "ti,am654-sci"; |
| 11 | 11 | ti,host-id = <12>; |
| 12 | − #address-cells = <1>; | |
| 13 | − #size-cells = <1>; | |
| 14 | − ranges; | |
| 15 | 12 | |
| 16 | 13 | mbox-names = "rx", "tx"; |
| 17 | 14 | |
| 18 | 15 | mboxes= <&secure_proxy_main 11>, |
| 19 | 16 | <&secure_proxy_main 13>; |
| 20 | 17 | |
| 18 | + reg-names = "debug_messages"; | |
| 19 | + reg = <0x44083000 0x1000>; | |
| 20 | + | |
| 21 | 21 | k3_pds: power-controller { |
| 22 | 22 | compatible = "ti,sci-pm-domain"; |
| 23 | 23 | #power-domain-cells = <2>; |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | − k3_clks: clocks { | |
| 26 | + k3_clks: clock-controller { | |
| 27 | 27 | compatible = "ti,k2g-sci-clk"; |
| 28 | 28 | #clock-cells = <2>; |
| 29 | 29 | }; |
| @@ -69,8 +69,9 @@ · 39 unmodified lines | ||
| 69 | 69 | power-domains = <&k3_pds 115 TI_SCI_PD_EXCLUSIVE>; |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | − intr_wkup_gpio: interrupt-controller2 { | |
| 72 | + intr_wkup_gpio: interrupt-controller@42200000 { | |
| 73 | 73 | compatible = "ti,sci-intr"; |
| 74 | + reg = <0x42200000 0x200>; | |
| 74 | 75 | ti,intr-trigger-type = <1>; |
| 75 | 76 | interrupt-controller; |
| 76 | 77 | interrupt-parent = <&gic500>; |
| @@ -85,12 +85,6 @@ · 84 unmodified lines | ||
| 85 | 85 | gpios = <&wkup_gpio0 27 GPIO_ACTIVE_LOW>; |
| 86 | 86 | }; |
| 87 | 87 | }; |
| 88 | − | |
| 89 | − clk_ov5640_fixed: clock { | |
| 90 | − compatible = "fixed-clock"; | |
| 91 | − #clock-cells = <0>; | |
| 92 | − clock-frequency = <24000000>; | |
| 93 | − }; | |
| 94 | 88 | }; |
| 95 | 89 | |
| 96 | 90 | &wkup_pmx0 { |
| @@ -287,23 +281,6 @@ · 190 unmodified lines | ||
| 287 | 281 | pinctrl-names = "default"; |
| 288 | 282 | pinctrl-0 = <&main_i2c1_pins_default>; |
| 289 | 283 | clock-frequency = <400000>; |
| 290 | − | |
| 291 | − ov5640: camera@3c { | |
| 292 | − compatible = "ovti,ov5640"; | |
| 293 | − reg = <0x3c>; | |
| 294 | − | |
| 295 | − clocks = <&clk_ov5640_fixed>; | |
| 296 | − clock-names = "xclk"; | |
| 297 | − | |
| 298 | − port { | |
| 299 | − csi2_cam0: endpoint { | |
| 300 | − remote-endpoint = <&csi2_phy0>; | |
| 301 | − clock-lanes = <0>; | |
| 302 | − data-lanes = <1 2>; | |
| 303 | − }; | |
| 304 | − }; | |
| 305 | − }; | |
| 306 | − | |
| 307 | 284 | }; |
| 308 | 285 | |
| 309 | 286 | &main_i2c2 { |
| @@ -496,14 +473,6 @@ · 186 unmodified lines | ||
| 496 | 473 | }; |
| 497 | 474 | }; |
| 498 | 475 | |
| 499 | −&csi2_0 { | |
| 500 | − csi2_phy0: endpoint { | |
| 501 | − remote-endpoint = <&csi2_cam0>; | |
| 502 | − clock-lanes = <0>; | |
| 503 | − data-lanes = <1 2>; | |
| 504 | − }; | |
| 505 | −}; | |
| 506 | − | |
| 507 | 476 | &mcu_cpsw { |
| 508 | 477 | pinctrl-names = "default"; |
| 509 | 478 | pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>; |
| @@ -68,8 +68,9 @@ · 67 unmodified lines | ||
| 68 | 68 | }; |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | − main_gpio_intr: interrupt-controller0 { | |
| 71 | + main_gpio_intr: interrupt-controller@a00000 { | |
| 72 | 72 | compatible = "ti,sci-intr"; |
| 73 | + reg = <0x00 0x00a00000 0x00 0x800>; | |
| 73 | 74 | ti,intr-trigger-type = <1>; |
| 74 | 75 | interrupt-controller; |
| 75 | 76 | interrupt-parent = <&gic500>; |
| @@ -85,9 +86,12 @@ · 9 unmodified lines | ||
| 85 | 86 | #size-cells = <2>; |
| 86 | 87 | ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>; |
| 87 | 88 | ti,sci-dev-id = <199>; |
| 89 | + dma-coherent; | |
| 90 | + dma-ranges; | |
| 88 | 91 | |
| 89 | − main_navss_intr: interrupt-controller1 { | |
| 92 | + main_navss_intr: interrupt-controller@310e0000 { | |
| 90 | 93 | compatible = "ti,sci-intr"; |
| 94 | + reg = <0x00 0x310e0000 0x00 0x4000>; | |
| 91 | 95 | ti,intr-trigger-type = <4>; |
| 92 | 96 | interrupt-controller; |
| 93 | 97 | interrupt-parent = <&gic500>; |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | &cbass_mcu_wakeup { |
| 9 | − dmsc: dmsc@44083000 { | |
| 9 | + dmsc: system-controller@44083000 { | |
| 10 | 10 | compatible = "ti,k2g-sci"; |
| 11 | 11 | ti,host-id = <12>; |
| 12 | 12 | |
| @@ -23,7 +23,7 @@ · 10 unmodified lines | ||
| 23 | 23 | #power-domain-cells = <2>; |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | − k3_clks: clocks { | |
| 26 | + k3_clks: clock-controller { | |
| 27 | 27 | compatible = "ti,k2g-sci-clk"; |
| 28 | 28 | #clock-cells = <2>; |
| 29 | 29 | }; |
| @@ -96,8 +96,9 @@ · 66 unmodified lines | ||
| 96 | 96 | clock-names = "fclk"; |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | − wkup_gpio_intr: interrupt-controller2 { | |
| 99 | + wkup_gpio_intr: interrupt-controller@42200000 { | |
| 100 | 100 | compatible = "ti,sci-intr"; |
| 101 | + reg = <0x00 0x42200000 0x00 0x400>; | |
| 101 | 102 | ti,intr-trigger-type = <1>; |
| 102 | 103 | interrupt-controller; |
| 103 | 104 | interrupt-parent = <&gic500>; |
| @@ -76,8 +76,9 @@ · 75 unmodified lines | ||
| 76 | 76 | }; |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | − main_gpio_intr: interrupt-controller0 { | |
| 79 | + main_gpio_intr: interrupt-controller@a00000 { | |
| 80 | 80 | compatible = "ti,sci-intr"; |
| 81 | + reg = <0x00 0x00a00000 0x00 0x800>; | |
| 81 | 82 | ti,intr-trigger-type = <1>; |
| 82 | 83 | interrupt-controller; |
| 83 | 84 | interrupt-parent = <&gic500>; |
| @@ -87,18 +88,19 @@ · 3 unmodified lines | ||
| 87 | 88 | ti,interrupt-ranges = <8 392 56>; |
| 88 | 89 | }; |
| 89 | 90 | |
| 90 | − main-navss { | |
| 91 | + main_navss: bus@30000000 { | |
| 91 | 92 | compatible = "simple-mfd"; |
| 92 | 93 | #address-cells = <2>; |
| 93 | 94 | #size-cells = <2>; |
| 94 | − ranges; | |
| 95 | + ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>; | |
| 95 | 96 | dma-coherent; |
| 96 | 97 | dma-ranges; |
| 97 | 98 | |
| 98 | 99 | ti,sci-dev-id = <199>; |
| 99 | 100 | |
| 100 | − main_navss_intr: interrupt-controller1 { | |
| 101 | + main_navss_intr: interrupt-controller@310e0000 { | |
| 101 | 102 | compatible = "ti,sci-intr"; |
| 103 | + reg = <0x0 0x310e0000 0x0 0x4000>; | |
| 102 | 104 | ti,intr-trigger-type = <4>; |
| 103 | 105 | interrupt-controller; |
| 104 | 106 | interrupt-parent = <&gic500>; |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | &cbass_mcu_wakeup { |
| 9 | − dmsc: dmsc@44083000 { | |
| 9 | + dmsc: system-controller@44083000 { | |
| 10 | 10 | compatible = "ti,k2g-sci"; |
| 11 | 11 | ti,host-id = <12>; |
| 12 | 12 | |
| @@ -23,7 +23,7 @@ · 10 unmodified lines | ||
| 23 | 23 | #power-domain-cells = <2>; |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | − k3_clks: clocks { | |
| 26 | + k3_clks: clock-controller { | |
| 27 | 27 | compatible = "ti,k2g-sci-clk"; |
| 28 | 28 | #clock-cells = <2>; |
| 29 | 29 | }; |
| @@ -96,8 +96,9 @@ · 66 unmodified lines | ||
| 96 | 96 | clock-names = "fclk"; |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | − wkup_gpio_intr: interrupt-controller2 { | |
| 99 | + wkup_gpio_intr: interrupt-controller@42200000 { | |
| 100 | 100 | compatible = "ti,sci-intr"; |
| 101 | + reg = <0x00 0x42200000 0x00 0x400>; | |
| 101 | 102 | ti,intr-trigger-type = <1>; |
| 102 | 103 | interrupt-controller; |
| 103 | 104 | interrupt-parent = <&gic500>; |
| @@ -249,11 +250,11 @@ · 145 unmodified lines | ||
| 249 | 250 | }; |
| 250 | 251 | }; |
| 251 | 252 | |
| 252 | − mcu-navss { | |
| 253 | + mcu_navss: bus@28380000 { | |
| 253 | 254 | compatible = "simple-mfd"; |
| 254 | 255 | #address-cells = <2>; |
| 255 | 256 | #size-cells = <2>; |
| 256 | − ranges; | |
| 257 | + ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>; | |
| 257 | 258 | dma-coherent; |
| 258 | 259 | dma-ranges; |
| 259 | 260 | |
| @@ -74,7 +74,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long idx, · 73 unmodified lines | ||
| 74 | 74 | * This insanity brought to you by speculative system register reads, |
| 75 | 75 | * out-of-order memory accesses, sequence locks and Thomas Gleixner. |
| 76 | 76 | * |
| 77 | − * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html | |
| 77 | + * https://lore.kernel.org/r/alpine.DEB.2.21.1902081950260.1662@nanos.tec.linutronix.de/ | |
| 78 | 78 | */ |
| 79 | 79 | #define arch_counter_enforce_ordering(val) do { \ |
| 80 | 80 | u64 tmp, _val = (val); \ |
| @@ -63,6 +63,7 @@ · 62 unmodified lines | ||
| 63 | 63 | #define __KVM_HOST_SMCCC_FUNC___pkvm_cpu_set_vector 18 |
| 64 | 64 | #define __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize 19 |
| 65 | 65 | #define __KVM_HOST_SMCCC_FUNC___pkvm_mark_hyp 20 |
| 66 | +#define __KVM_HOST_SMCCC_FUNC___kvm_adjust_pc 21 | |
| 66 | 67 | |
| 67 | 68 | #ifndef __ASSEMBLY__ |
| 68 | 69 | |
| @@ -201,6 +202,8 @@ extern void __kvm_timer_set_cntvoff(u64 cntvoff); · 132 unmodified lines | ||
| 201 | 202 | |
| 202 | 203 | extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); |
| 203 | 204 | |
| 205 | +extern void __kvm_adjust_pc(struct kvm_vcpu *vcpu); | |
| 206 | + | |
| 204 | 207 | extern u64 __vgic_v3_get_gic_config(void); |
| 205 | 208 | extern u64 __vgic_v3_read_vmcr(void); |
| 206 | 209 | extern void __vgic_v3_write_vmcr(u32 vmcr); |
| @@ -463,4 +463,9 @@ static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu) · 462 unmodified lines | ||
| 463 | 463 | vcpu->arch.flags |= KVM_ARM64_INCREMENT_PC; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | +static inline bool vcpu_has_feature(struct kvm_vcpu *vcpu, int feature) | |
| 467 | +{ | |
| 468 | + return test_bit(feature, vcpu->arch.features); | |
| 469 | +} | |
| 470 | + | |
| 466 | 471 | #endif /* __ARM64_KVM_EMULATE_H__ */ |
| @@ -720,11 +720,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 719 unmodified lines | ||
| 720 | 720 | return ret; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | − if (run->immediate_exit) | |
| 724 | − return -EINTR; | |
| 725 | − | |
| 726 | 723 | vcpu_load(vcpu); |
| 727 | 724 | |
| 725 | + if (run->immediate_exit) { | |
| 726 | + ret = -EINTR; | |
| 727 | + goto out; | |
| 728 | + } | |
| 729 | + | |
| 728 | 730 | kvm_sigset_activate(vcpu); |
| 729 | 731 | |
| 730 | 732 | ret = 1; |
| @@ -897,6 +899,18 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 166 unmodified lines | ||
| 897 | 899 | |
| 898 | 900 | kvm_sigset_deactivate(vcpu); |
| 899 | 901 | |
| 902 | +out: | |
| 903 | + /* | |
| 904 | + * In the unlikely event that we are returning to userspace | |
| 905 | + * with pending exceptions or PC adjustment, commit these | |
| 906 | + * adjustments in order to give userspace a consistent view of | |
| 907 | + * the vcpu state. Note that this relies on __kvm_adjust_pc() | |
| 908 | + * being preempt-safe on VHE. | |
| 909 | + */ | |
| 910 | + if (unlikely(vcpu->arch.flags & (KVM_ARM64_PENDING_EXCEPTION | | |
| 911 | + KVM_ARM64_INCREMENT_PC))) | |
| 912 | + kvm_call_hyp(__kvm_adjust_pc, vcpu); | |
| 913 | + | |
| 900 | 914 | vcpu_put(vcpu); |
| 901 | 915 | return ret; |
| 902 | 916 | } |
| @@ -296,7 +296,7 @@ static void enter_exception32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) · 295 unmodified lines | ||
| 296 | 296 | *vcpu_pc(vcpu) = vect_offset; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | −void kvm_inject_exception(struct kvm_vcpu *vcpu) | |
| 299 | +static void kvm_inject_exception(struct kvm_vcpu *vcpu) | |
| 300 | 300 | { |
| 301 | 301 | if (vcpu_el1_is_32bit(vcpu)) { |
| 302 | 302 | switch (vcpu->arch.flags & KVM_ARM64_EXCEPT_MASK) { |
| @@ -329,3 +329,19 @@ void kvm_inject_exception(struct kvm_vcpu *vcpu) · 26 unmodified lines | ||
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | + | |
| 333 | +/* | |
| 334 | + * Adjust the guest PC (and potentially exception state) depending on | |
| 335 | + * flags provided by the emulation code. | |
| 336 | + */ | |
| 337 | +void __kvm_adjust_pc(struct kvm_vcpu *vcpu) | |
| 338 | +{ | |
| 339 | + if (vcpu->arch.flags & KVM_ARM64_PENDING_EXCEPTION) { | |
| 340 | + kvm_inject_exception(vcpu); | |
| 341 | + vcpu->arch.flags &= ~(KVM_ARM64_PENDING_EXCEPTION | | |
| 342 | + KVM_ARM64_EXCEPT_MASK); | |
| 343 | + } else if (vcpu->arch.flags & KVM_ARM64_INCREMENT_PC) { | |
| 344 | + kvm_skip_instr(vcpu); | |
| 345 | + vcpu->arch.flags &= ~KVM_ARM64_INCREMENT_PC; | |
| 346 | + } | |
| 347 | +} | |
| @@ -13,8 +13,6 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <asm/kvm_emulate.h> |
| 14 | 14 | #include <asm/kvm_host.h> |
| 15 | 15 | |
| 16 | −void kvm_inject_exception(struct kvm_vcpu *vcpu); | |
| 17 | − | |
| 18 | 16 | static inline void kvm_skip_instr(struct kvm_vcpu *vcpu) |
| 19 | 17 | { |
| 20 | 18 | if (vcpu_mode_is_32bit(vcpu)) { |
| @@ -43,22 +41,6 @@ static inline void __kvm_skip_instr(struct kvm_vcpu *vcpu) · 22 unmodified lines | ||
| 43 | 41 | write_sysreg_el2(*vcpu_pc(vcpu), SYS_ELR); |
| 44 | 42 | } |
| 45 | 43 | |
| 46 | −/* | |
| 47 | − * Adjust the guest PC on entry, depending on flags provided by EL1 | |
| 48 | − * for the purpose of emulation (MMIO, sysreg) or exception injection. | |
| 49 | − */ | |
| 50 | −static inline void __adjust_pc(struct kvm_vcpu *vcpu) | |
| 51 | −{ | |
| 52 | − if (vcpu->arch.flags & KVM_ARM64_PENDING_EXCEPTION) { | |
| 53 | − kvm_inject_exception(vcpu); | |
| 54 | − vcpu->arch.flags &= ~(KVM_ARM64_PENDING_EXCEPTION | | |
| 55 | − KVM_ARM64_EXCEPT_MASK); | |
| 56 | − } else if (vcpu->arch.flags & KVM_ARM64_INCREMENT_PC) { | |
| 57 | − kvm_skip_instr(vcpu); | |
| 58 | − vcpu->arch.flags &= ~KVM_ARM64_INCREMENT_PC; | |
| 59 | − } | |
| 60 | −} | |
| 61 | − | |
| 62 | 44 | /* |
| 63 | 45 | * Skip an instruction while host sysregs are live. |
| 64 | 46 | * Assumes host is always 64-bit. |
| @@ -28,6 +28,13 @@ static void handle___kvm_vcpu_run(struct kvm_cpu_context *host_ctxt) · 27 unmodified lines | ||
| 28 | 28 | cpu_reg(host_ctxt, 1) = __kvm_vcpu_run(kern_hyp_va(vcpu)); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | +static void handle___kvm_adjust_pc(struct kvm_cpu_context *host_ctxt) | |
| 32 | +{ | |
| 33 | + DECLARE_REG(struct kvm_vcpu *, vcpu, host_ctxt, 1); | |
| 34 | + | |
| 35 | + __kvm_adjust_pc(kern_hyp_va(vcpu)); | |
| 36 | +} | |
| 37 | + | |
| 31 | 38 | static void handle___kvm_flush_vm_context(struct kvm_cpu_context *host_ctxt) |
| 32 | 39 | { |
| 33 | 40 | __kvm_flush_vm_context(); |
| @@ -170,6 +177,7 @@ typedef void (*hcall_t)(struct kvm_cpu_context *); · 136 unmodified lines | ||
| 170 | 177 | |
| 171 | 178 | static const hcall_t host_hcall[] = { |
| 172 | 179 | HANDLE_FUNC(__kvm_vcpu_run), |
| 180 | + HANDLE_FUNC(__kvm_adjust_pc), | |
| 173 | 181 | HANDLE_FUNC(__kvm_flush_vm_context), |
| 174 | 182 | HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa), |
| 175 | 183 | HANDLE_FUNC(__kvm_tlb_flush_vmid), |
| @@ -23,8 +23,8 @@ · 22 unmodified lines | ||
| 23 | 23 | extern unsigned long hyp_nr_cpus; |
| 24 | 24 | struct host_kvm host_kvm; |
| 25 | 25 | |
| 26 | −struct hyp_pool host_s2_mem; | |
| 27 | −struct hyp_pool host_s2_dev; | |
| 26 | +static struct hyp_pool host_s2_mem; | |
| 27 | +static struct hyp_pool host_s2_dev; | |
| 28 | 28 | |
| 29 | 29 | /* |
| 30 | 30 | * Copies of the host's CPU features registers holding sanitized values. |
| @@ -17,7 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <nvhe/trap_handler.h> |
| 18 | 18 | |
| 19 | 19 | struct hyp_pool hpool; |
| 20 | −struct kvm_pgtable_mm_ops pkvm_pgtable_mm_ops; | |
| 21 | 20 | unsigned long hyp_nr_cpus; |
| 22 | 21 | |
| 23 | 22 | #define hyp_percpu_size ((unsigned long)__per_cpu_end - \ |
| @@ -27,6 +26,7 @@ static void *vmemmap_base; · 3 unmodified lines | ||
| 27 | 26 | static void *hyp_pgt_base; |
| 28 | 27 | static void *host_s2_mem_pgt_base; |
| 29 | 28 | static void *host_s2_dev_pgt_base; |
| 29 | +static struct kvm_pgtable_mm_ops pkvm_pgtable_mm_ops; | |
| 30 | 30 | |
| 31 | 31 | static int divide_memory_pool(void *virt, unsigned long size) |
| 32 | 32 | { |
| @@ -4,7 +4,6 @@ · 3 unmodified lines | ||
| 4 | 4 | * Author: Marc Zyngier <marc.zyngier@arm.com> |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | −#include <hyp/adjust_pc.h> | |
| 8 | 7 | #include <hyp/switch.h> |
| 9 | 8 | #include <hyp/sysreg-sr.h> |
| 10 | 9 | |
| @@ -201,7 +200,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) · 190 unmodified lines | ||
| 201 | 200 | */ |
| 202 | 201 | __debug_save_host_buffers_nvhe(vcpu); |
| 203 | 202 | |
| 204 | − __adjust_pc(vcpu); | |
| 203 | + __kvm_adjust_pc(vcpu); | |
| 205 | 204 | |
| 206 | 205 | /* |
| 207 | 206 | * We must restore the 32-bit state before the sysregs, thanks |
| @@ -4,7 +4,6 @@ · 3 unmodified lines | ||
| 4 | 4 | * Author: Marc Zyngier <marc.zyngier@arm.com> |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | −#include <hyp/adjust_pc.h> | |
| 8 | 7 | #include <hyp/switch.h> |
| 9 | 8 | |
| 10 | 9 | #include <linux/arm-smccc.h> |
| @@ -132,7 +131,7 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) · 121 unmodified lines | ||
| 132 | 131 | __load_guest_stage2(vcpu->arch.hw_mmu); |
| 133 | 132 | __activate_traps(vcpu); |
| 134 | 133 | |
| 135 | − __adjust_pc(vcpu); | |
| 134 | + __kvm_adjust_pc(vcpu); | |
| 136 | 135 | |
| 137 | 136 | sysreg_restore_guest_state_vhe(guest_ctxt); |
| 138 | 137 | __debug_switch_to_guest(vcpu); |
| @@ -1156,13 +1156,13 @@ out_unlock: · 1155 unmodified lines | ||
| 1156 | 1156 | bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range) |
| 1157 | 1157 | { |
| 1158 | 1158 | if (!kvm->arch.mmu.pgt) |
| 1159 | − return 0; | |
| 1159 | + return false; | |
| 1160 | 1160 | |
| 1161 | 1161 | __unmap_stage2_range(&kvm->arch.mmu, range->start << PAGE_SHIFT, |
| 1162 | 1162 | (range->end - range->start) << PAGE_SHIFT, |
| 1163 | 1163 | range->may_block); |
| 1164 | 1164 | |
| 1165 | − return 0; | |
| 1165 | + return false; | |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) |
| @@ -1170,7 +1170,7 @@ bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 1 unmodified line | ||
| 1170 | 1170 | kvm_pfn_t pfn = pte_pfn(range->pte); |
| 1171 | 1171 | |
| 1172 | 1172 | if (!kvm->arch.mmu.pgt) |
| 1173 | − return 0; | |
| 1173 | + return false; | |
| 1174 | 1174 | |
| 1175 | 1175 | WARN_ON(range->end - range->start != 1); |
| 1176 | 1176 | |
| @@ -1190,7 +1190,7 @@ bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 13 unmodified lines | ||
| 1190 | 1190 | PAGE_SIZE, __pfn_to_phys(pfn), |
| 1191 | 1191 | KVM_PGTABLE_PROT_R, NULL); |
| 1192 | 1192 | |
| 1193 | − return 0; | |
| 1193 | + return false; | |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) |
| @@ -1200,7 +1200,7 @@ bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 3 unmodified lines | ||
| 1200 | 1200 | pte_t pte; |
| 1201 | 1201 | |
| 1202 | 1202 | if (!kvm->arch.mmu.pgt) |
| 1203 | − return 0; | |
| 1203 | + return false; | |
| 1204 | 1204 | |
| 1205 | 1205 | WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PUD_SIZE); |
| 1206 | 1206 | |
| @@ -1213,7 +1213,7 @@ bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 6 unmodified lines | ||
| 1213 | 1213 | bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) |
| 1214 | 1214 | { |
| 1215 | 1215 | if (!kvm->arch.mmu.pgt) |
| 1216 | − return 0; | |
| 1216 | + return false; | |
| 1217 | 1217 | |
| 1218 | 1218 | return kvm_pgtable_stage2_is_young(kvm->arch.mmu.pgt, |
| 1219 | 1219 | range->start << PAGE_SHIFT); |
| @@ -166,6 +166,25 @@ static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu) · 165 unmodified lines | ||
| 166 | 166 | return 0; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | +static bool vcpu_allowed_register_width(struct kvm_vcpu *vcpu) | |
| 170 | +{ | |
| 171 | + struct kvm_vcpu *tmp; | |
| 172 | + bool is32bit; | |
| 173 | + int i; | |
| 174 | + | |
| 175 | + is32bit = vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT); | |
| 176 | + if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1) && is32bit) | |
| 177 | + return false; | |
| 178 | + | |
| 179 | + /* Check that the vcpus are either all 32bit or all 64bit */ | |
| 180 | + kvm_for_each_vcpu(i, tmp, vcpu->kvm) { | |
| 181 | + if (vcpu_has_feature(tmp, KVM_ARM_VCPU_EL1_32BIT) != is32bit) | |
| 182 | + return false; | |
| 183 | + } | |
| 184 | + | |
| 185 | + return true; | |
| 186 | +} | |
| 187 | + | |
| 169 | 188 | /** |
| 170 | 189 | * kvm_reset_vcpu - sets core registers and sys_regs to reset value |
| 171 | 190 | * @vcpu: The VCPU pointer |
| @@ -217,13 +236,14 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) · 45 unmodified lines | ||
| 217 | 236 | } |
| 218 | 237 | } |
| 219 | 238 | |
| 239 | + if (!vcpu_allowed_register_width(vcpu)) { | |
| 240 | + ret = -EINVAL; | |
| 241 | + goto out; | |
| 242 | + } | |
| 243 | + | |
| 220 | 244 | switch (vcpu->arch.target) { |
| 221 | 245 | default: |
| 222 | 246 | if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) { |
| 223 | − if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1)) { | |
| 224 | − ret = -EINVAL; | |
| 225 | − goto out; | |
| 226 | − } | |
| 227 | 247 | pstate = VCPU_RESET_PSTATE_SVC; |
| 228 | 248 | } else { |
| 229 | 249 | pstate = VCPU_RESET_PSTATE_EL1; |
| @@ -399,14 +399,14 @@ static bool trap_bvr(struct kvm_vcpu *vcpu, · 398 unmodified lines | ||
| 399 | 399 | struct sys_reg_params *p, |
| 400 | 400 | const struct sys_reg_desc *rd) |
| 401 | 401 | { |
| 402 | − u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg]; | |
| 402 | + u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm]; | |
| 403 | 403 | |
| 404 | 404 | if (p->is_write) |
| 405 | 405 | reg_to_dbg(vcpu, p, rd, dbg_reg); |
| 406 | 406 | else |
| 407 | 407 | dbg_to_reg(vcpu, p, rd, dbg_reg); |
| 408 | 408 | |
| 409 | − trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg); | |
| 409 | + trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg); | |
| 410 | 410 | |
| 411 | 411 | return true; |
| 412 | 412 | } |
| @@ -414,7 +414,7 @@ static bool trap_bvr(struct kvm_vcpu *vcpu, · 1 unmodified line | ||
| 414 | 414 | static int set_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 415 | 415 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 416 | 416 | { |
| 417 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg]; | |
| 417 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm]; | |
| 418 | 418 | |
| 419 | 419 | if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0) |
| 420 | 420 | return -EFAULT; |
| @@ -424,7 +424,7 @@ static int set_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines | ||
| 424 | 424 | static int get_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 425 | 425 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 426 | 426 | { |
| 427 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg]; | |
| 427 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm]; | |
| 428 | 428 | |
| 429 | 429 | if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0) |
| 430 | 430 | return -EFAULT; |
| @@ -434,21 +434,21 @@ static int get_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines | ||
| 434 | 434 | static void reset_bvr(struct kvm_vcpu *vcpu, |
| 435 | 435 | const struct sys_reg_desc *rd) |
| 436 | 436 | { |
| 437 | − vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg] = rd->val; | |
| 437 | + vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm] = rd->val; | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | static bool trap_bcr(struct kvm_vcpu *vcpu, |
| 441 | 441 | struct sys_reg_params *p, |
| 442 | 442 | const struct sys_reg_desc *rd) |
| 443 | 443 | { |
| 444 | − u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg]; | |
| 444 | + u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm]; | |
| 445 | 445 | |
| 446 | 446 | if (p->is_write) |
| 447 | 447 | reg_to_dbg(vcpu, p, rd, dbg_reg); |
| 448 | 448 | else |
| 449 | 449 | dbg_to_reg(vcpu, p, rd, dbg_reg); |
| 450 | 450 | |
| 451 | − trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg); | |
| 451 | + trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg); | |
| 452 | 452 | |
| 453 | 453 | return true; |
| 454 | 454 | } |
| @@ -456,7 +456,7 @@ static bool trap_bcr(struct kvm_vcpu *vcpu, · 1 unmodified line | ||
| 456 | 456 | static int set_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 457 | 457 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 458 | 458 | { |
| 459 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg]; | |
| 459 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm]; | |
| 460 | 460 | |
| 461 | 461 | if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0) |
| 462 | 462 | return -EFAULT; |
| @@ -467,7 +467,7 @@ static int set_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 4 unmodified lines | ||
| 467 | 467 | static int get_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 468 | 468 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 469 | 469 | { |
| 470 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg]; | |
| 470 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm]; | |
| 471 | 471 | |
| 472 | 472 | if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0) |
| 473 | 473 | return -EFAULT; |
| @@ -477,22 +477,22 @@ static int get_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines | ||
| 477 | 477 | static void reset_bcr(struct kvm_vcpu *vcpu, |
| 478 | 478 | const struct sys_reg_desc *rd) |
| 479 | 479 | { |
| 480 | − vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg] = rd->val; | |
| 480 | + vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm] = rd->val; | |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | static bool trap_wvr(struct kvm_vcpu *vcpu, |
| 484 | 484 | struct sys_reg_params *p, |
| 485 | 485 | const struct sys_reg_desc *rd) |
| 486 | 486 | { |
| 487 | − u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg]; | |
| 487 | + u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]; | |
| 488 | 488 | |
| 489 | 489 | if (p->is_write) |
| 490 | 490 | reg_to_dbg(vcpu, p, rd, dbg_reg); |
| 491 | 491 | else |
| 492 | 492 | dbg_to_reg(vcpu, p, rd, dbg_reg); |
| 493 | 493 | |
| 494 | − trace_trap_reg(__func__, rd->reg, p->is_write, | |
| 495 | − vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg]); | |
| 494 | + trace_trap_reg(__func__, rd->CRm, p->is_write, | |
| 495 | + vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]); | |
| 496 | 496 | |
| 497 | 497 | return true; |
| 498 | 498 | } |
| @@ -500,7 +500,7 @@ static bool trap_wvr(struct kvm_vcpu *vcpu, · 1 unmodified line | ||
| 500 | 500 | static int set_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 501 | 501 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 502 | 502 | { |
| 503 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg]; | |
| 503 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]; | |
| 504 | 504 | |
| 505 | 505 | if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0) |
| 506 | 506 | return -EFAULT; |
| @@ -510,7 +510,7 @@ static int set_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines | ||
| 510 | 510 | static int get_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 511 | 511 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 512 | 512 | { |
| 513 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg]; | |
| 513 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]; | |
| 514 | 514 | |
| 515 | 515 | if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0) |
| 516 | 516 | return -EFAULT; |
| @@ -520,21 +520,21 @@ static int get_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines | ||
| 520 | 520 | static void reset_wvr(struct kvm_vcpu *vcpu, |
| 521 | 521 | const struct sys_reg_desc *rd) |
| 522 | 522 | { |
| 523 | − vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg] = rd->val; | |
| 523 | + vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm] = rd->val; | |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | static bool trap_wcr(struct kvm_vcpu *vcpu, |
| 527 | 527 | struct sys_reg_params *p, |
| 528 | 528 | const struct sys_reg_desc *rd) |
| 529 | 529 | { |
| 530 | − u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg]; | |
| 530 | + u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm]; | |
| 531 | 531 | |
| 532 | 532 | if (p->is_write) |
| 533 | 533 | reg_to_dbg(vcpu, p, rd, dbg_reg); |
| 534 | 534 | else |
| 535 | 535 | dbg_to_reg(vcpu, p, rd, dbg_reg); |
| 536 | 536 | |
| 537 | − trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg); | |
| 537 | + trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg); | |
| 538 | 538 | |
| 539 | 539 | return true; |
| 540 | 540 | } |
| @@ -542,7 +542,7 @@ static bool trap_wcr(struct kvm_vcpu *vcpu, · 1 unmodified line | ||
| 542 | 542 | static int set_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 543 | 543 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 544 | 544 | { |
| 545 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg]; | |
| 545 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm]; | |
| 546 | 546 | |
| 547 | 547 | if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0) |
| 548 | 548 | return -EFAULT; |
| @@ -552,7 +552,7 @@ static int set_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines | ||
| 552 | 552 | static int get_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, |
| 553 | 553 | const struct kvm_one_reg *reg, void __user *uaddr) |
| 554 | 554 | { |
| 555 | − __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg]; | |
| 555 | + __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm]; | |
| 556 | 556 | |
| 557 | 557 | if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0) |
| 558 | 558 | return -EFAULT; |
| @@ -562,7 +562,7 @@ static int get_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines | ||
| 562 | 562 | static void reset_wcr(struct kvm_vcpu *vcpu, |
| 563 | 563 | const struct sys_reg_desc *rd) |
| 564 | 564 | { |
| 565 | − vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg] = rd->val; | |
| 565 | + vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm] = rd->val; | |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | static void reset_amair_el1(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) |
| @@ -515,7 +515,8 @@ static void __init map_mem(pgd_t *pgdp) · 514 unmodified lines | ||
| 515 | 515 | */ |
| 516 | 516 | BUILD_BUG_ON(pgd_index(direct_map_end - 1) == pgd_index(direct_map_end)); |
| 517 | 517 | |
| 518 | − if (rodata_full || crash_mem_map || debug_pagealloc_enabled()) | |
| 518 | + if (rodata_full || crash_mem_map || debug_pagealloc_enabled() || | |
| 519 | + IS_ENABLED(CONFIG_KFENCE)) | |
| 519 | 520 | flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; |
| 520 | 521 | |
| 521 | 522 | /* |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <asm/reboot.h> |
| 19 | 19 | #include <asm/setup.h> |
| 20 | 20 | #include <asm/mach-au1x00/au1000.h> |
| 21 | +#include <asm/mach-au1x00/gpio-au1000.h> | |
| 21 | 22 | #include <prom.h> |
| 22 | 23 | |
| 23 | 24 | const char *get_system_type(void) |
| @@ -3,6 +3,9 @@ · 2 unmodified lines | ||
| 3 | 3 | * |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +#ifndef _ASM_MIPS_BOARDS_LAUNCH_H | |
| 7 | +#define _ASM_MIPS_BOARDS_LAUNCH_H | |
| 8 | + | |
| 6 | 9 | #ifndef _ASSEMBLER_ |
| 7 | 10 | |
| 8 | 11 | struct cpulaunch { |
| @@ -34,3 +37,5 @@ struct cpulaunch { · 25 unmodified lines | ||
| 34 | 37 | |
| 35 | 38 | /* Polling period in count cycles for secondary CPU's */ |
| 36 | 39 | #define LAUNCHPERIOD 10000 |
| 40 | + | |
| 41 | +#endif /* _ASM_MIPS_BOARDS_LAUNCH_H */ | |
| @@ -37,7 +37,7 @@ · 36 unmodified lines | ||
| 37 | 37 | */ |
| 38 | 38 | notrace void arch_local_irq_disable(void) |
| 39 | 39 | { |
| 40 | − preempt_disable(); | |
| 40 | + preempt_disable_notrace(); | |
| 41 | 41 | |
| 42 | 42 | __asm__ __volatile__( |
| 43 | 43 | " .set push \n" |
| @@ -53,7 +53,7 @@ notrace void arch_local_irq_disable(void) · 9 unmodified lines | ||
| 53 | 53 | : /* no inputs */ |
| 54 | 54 | : "memory"); |
| 55 | 55 | |
| 56 | − preempt_enable(); | |
| 56 | + preempt_enable_notrace(); | |
| 57 | 57 | } |
| 58 | 58 | EXPORT_SYMBOL(arch_local_irq_disable); |
| 59 | 59 | |
| @@ -61,7 +61,7 @@ notrace unsigned long arch_local_irq_save(void) · 1 unmodified line | ||
| 61 | 61 | { |
| 62 | 62 | unsigned long flags; |
| 63 | 63 | |
| 64 | − preempt_disable(); | |
| 64 | + preempt_disable_notrace(); | |
| 65 | 65 | |
| 66 | 66 | __asm__ __volatile__( |
| 67 | 67 | " .set push \n" |
| @@ -78,7 +78,7 @@ notrace unsigned long arch_local_irq_save(void) · 10 unmodified lines | ||
| 78 | 78 | : /* no inputs */ |
| 79 | 79 | : "memory"); |
| 80 | 80 | |
| 81 | − preempt_enable(); | |
| 81 | + preempt_enable_notrace(); | |
| 82 | 82 | |
| 83 | 83 | return flags; |
| 84 | 84 | } |
| @@ -88,7 +88,7 @@ notrace void arch_local_irq_restore(unsigned long flags) · 3 unmodified lines | ||
| 88 | 88 | { |
| 89 | 89 | unsigned long __tmp1; |
| 90 | 90 | |
| 91 | − preempt_disable(); | |
| 91 | + preempt_disable_notrace(); | |
| 92 | 92 | |
| 93 | 93 | __asm__ __volatile__( |
| 94 | 94 | " .set push \n" |
| @@ -106,7 +106,7 @@ notrace void arch_local_irq_restore(unsigned long flags) · 11 unmodified lines | ||
| 106 | 106 | : "0" (flags) |
| 107 | 107 | : "memory"); |
| 108 | 108 | |
| 109 | − preempt_enable(); | |
| 109 | + preempt_enable_notrace(); | |
| 110 | 110 | } |
| 111 | 111 | EXPORT_SYMBOL(arch_local_irq_restore); |
| 112 | 112 | |
| @@ -158,31 +158,29 @@ unsigned long _page_cachable_default; · 157 unmodified lines | ||
| 158 | 158 | EXPORT_SYMBOL(_page_cachable_default); |
| 159 | 159 | |
| 160 | 160 | #define PM(p) __pgprot(_page_cachable_default | (p)) |
| 161 | −#define PVA(p) PM(_PAGE_VALID | _PAGE_ACCESSED | (p)) | |
| 162 | 161 | |
| 163 | 162 | static inline void setup_protection_map(void) |
| 164 | 163 | { |
| 165 | 164 | protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); |
| 166 | − protection_map[1] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); | |
| 167 | − protection_map[2] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); | |
| 168 | − protection_map[3] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); | |
| 169 | − protection_map[4] = PVA(_PAGE_PRESENT); | |
| 170 | − protection_map[5] = PVA(_PAGE_PRESENT); | |
| 171 | − protection_map[6] = PVA(_PAGE_PRESENT); | |
| 172 | − protection_map[7] = PVA(_PAGE_PRESENT); | |
| 165 | + protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); | |
| 166 | + protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); | |
| 167 | + protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); | |
| 168 | + protection_map[4] = PM(_PAGE_PRESENT); | |
| 169 | + protection_map[5] = PM(_PAGE_PRESENT); | |
| 170 | + protection_map[6] = PM(_PAGE_PRESENT); | |
| 171 | + protection_map[7] = PM(_PAGE_PRESENT); | |
| 173 | 172 | |
| 174 | 173 | protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); |
| 175 | − protection_map[9] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); | |
| 176 | − protection_map[10] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | | |
| 174 | + protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); | |
| 175 | + protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | | |
| 177 | 176 | _PAGE_NO_READ); |
| 178 | − protection_map[11] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); | |
| 179 | − protection_map[12] = PVA(_PAGE_PRESENT); | |
| 180 | − protection_map[13] = PVA(_PAGE_PRESENT); | |
| 181 | − protection_map[14] = PVA(_PAGE_PRESENT); | |
| 182 | − protection_map[15] = PVA(_PAGE_PRESENT); | |
| 177 | + protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); | |
| 178 | + protection_map[12] = PM(_PAGE_PRESENT); | |
| 179 | + protection_map[13] = PM(_PAGE_PRESENT); | |
| 180 | + protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE); | |
| 181 | + protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE); | |
| 183 | 182 | } |
| 184 | 183 | |
| 185 | −#undef _PVA | |
| 186 | 184 | #undef PM |
| 187 | 185 | |
| 188 | 186 | void cpu_cache_init(void) |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #include <linux/io.h> |
| 10 | 10 | #include <linux/clk.h> |
| 11 | +#include <linux/export.h> | |
| 11 | 12 | #include <linux/init.h> |
| 12 | 13 | #include <linux/sizes.h> |
| 13 | 14 | #include <linux/of_fdt.h> |
| @@ -25,6 +26,7 @@ · 11 unmodified lines | ||
| 25 | 26 | |
| 26 | 27 | __iomem void *rt_sysc_membase; |
| 27 | 28 | __iomem void *rt_memc_membase; |
| 29 | +EXPORT_SYMBOL_GPL(rt_sysc_membase); | |
| 28 | 30 | |
| 29 | 31 | __iomem void *plat_of_remap_node(const char *node) |
| 30 | 32 | { |
| @@ -122,7 +122,15 @@ · 121 unmodified lines | ||
| 122 | 122 | }; |
| 123 | 123 | |
| 124 | 124 | /include/ "pq3-i2c-0.dtsi" |
| 125 | + i2c@3000 { | |
| 126 | + fsl,i2c-erratum-a004447; | |
| 127 | + }; | |
| 128 | + | |
| 125 | 129 | /include/ "pq3-i2c-1.dtsi" |
| 130 | + i2c@3100 { | |
| 131 | + fsl,i2c-erratum-a004447; | |
| 132 | + }; | |
| 133 | + | |
| 126 | 134 | /include/ "pq3-duart-0.dtsi" |
| 127 | 135 | /include/ "pq3-espi-0.dtsi" |
| 128 | 136 | spi0: spi@7000 { |
| @@ -371,7 +371,23 @@ · 370 unmodified lines | ||
| 371 | 371 | }; |
| 372 | 372 | |
| 373 | 373 | /include/ "qoriq-i2c-0.dtsi" |
| 374 | + i2c@118000 { | |
| 375 | + fsl,i2c-erratum-a004447; | |
| 376 | + }; | |
| 377 | + | |
| 378 | + i2c@118100 { | |
| 379 | + fsl,i2c-erratum-a004447; | |
| 380 | + }; | |
| 381 | + | |
| 374 | 382 | /include/ "qoriq-i2c-1.dtsi" |
| 383 | + i2c@119000 { | |
| 384 | + fsl,i2c-erratum-a004447; | |
| 385 | + }; | |
| 386 | + | |
| 387 | + i2c@119100 { | |
| 388 | + fsl,i2c-erratum-a004447; | |
| 389 | + }; | |
| 390 | + | |
| 375 | 391 | /include/ "qoriq-duart-0.dtsi" |
| 376 | 392 | /include/ "qoriq-duart-1.dtsi" |
| 377 | 393 | /include/ "qoriq-gpio-0.dtsi" |
| @@ -50,7 +50,7 @@ l_yes: · 49 unmodified lines | ||
| 50 | 50 | 1098: nop; \ |
| 51 | 51 | .pushsection __jump_table, "aw"; \ |
| 52 | 52 | .long 1098b - ., LABEL - .; \ |
| 53 | − FTR_ENTRY_LONG KEY; \ | |
| 53 | + FTR_ENTRY_LONG KEY - .; \ | |
| 54 | 54 | .popsection |
| 55 | 55 | #endif |
| 56 | 56 | |
| @@ -51,6 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | /* PPC-specific vcpu->requests bit members */ |
| 52 | 52 | #define KVM_REQ_WATCHDOG KVM_ARCH_REQ(0) |
| 53 | 53 | #define KVM_REQ_EPR_EXIT KVM_ARCH_REQ(1) |
| 54 | +#define KVM_REQ_PENDING_TIMER KVM_ARCH_REQ(2) | |
| 54 | 55 | |
| 55 | 56 | #include <linux/mmu_notifier.h> |
| 56 | 57 | |
| @@ -31,6 +31,35 @@ static inline pte_t *find_init_mm_pte(unsigned long ea, unsigned *hshift) · 30 unmodified lines | ||
| 31 | 31 | pgd_t *pgdir = init_mm.pgd; |
| 32 | 32 | return __find_linux_pte(pgdir, ea, NULL, hshift); |
| 33 | 33 | } |
| 34 | + | |
| 35 | +/* | |
| 36 | + * Convert a kernel vmap virtual address (vmalloc or ioremap space) to a | |
| 37 | + * physical address, without taking locks. This can be used in real-mode. | |
| 38 | + */ | |
| 39 | +static inline phys_addr_t ppc_find_vmap_phys(unsigned long addr) | |
| 40 | +{ | |
| 41 | + pte_t *ptep; | |
| 42 | + phys_addr_t pa; | |
| 43 | + int hugepage_shift; | |
| 44 | + | |
| 45 | + /* | |
| 46 | + * init_mm does not free page tables, and does not do THP. It may | |
| 47 | + * have huge pages from huge vmalloc / ioremap etc. | |
| 48 | + */ | |
| 49 | + ptep = find_init_mm_pte(addr, &hugepage_shift); | |
| 50 | + if (WARN_ON(!ptep)) | |
| 51 | + return 0; | |
| 52 | + | |
| 53 | + pa = PFN_PHYS(pte_pfn(*ptep)); | |
| 54 | + | |
| 55 | + if (!hugepage_shift) | |
| 56 | + hugepage_shift = PAGE_SHIFT; | |
| 57 | + | |
| 58 | + pa |= addr & ((1ul << hugepage_shift) - 1); | |
| 59 | + | |
| 60 | + return pa; | |
| 61 | +} | |
| 62 | + | |
| 34 | 63 | /* |
| 35 | 64 | * This is what we should always use. Any other lockless page table lookup needs |
| 36 | 65 | * careful audit against THP split. |
| @@ -346,28 +346,7 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity) · 345 unmodified lines | ||
| 346 | 346 | */ |
| 347 | 347 | static inline unsigned long eeh_token_to_phys(unsigned long token) |
| 348 | 348 | { |
| 349 | − pte_t *ptep; | |
| 350 | − unsigned long pa; | |
| 351 | − int hugepage_shift; | |
| 352 | − | |
| 353 | − /* | |
| 354 | − * We won't find hugepages here(this is iomem). Hence we are not | |
| 355 | − * worried about _PAGE_SPLITTING/collapse. Also we will not hit | |
| 356 | − * page table free, because of init_mm. | |
| 357 | − */ | |
| 358 | − ptep = find_init_mm_pte(token, &hugepage_shift); | |
| 359 | − if (!ptep) | |
| 360 | − return token; | |
| 361 | − | |
| 362 | − pa = pte_pfn(*ptep); | |
| 363 | − | |
| 364 | − /* On radix we can do hugepage mappings for io, so handle that */ | |
| 365 | − if (!hugepage_shift) | |
| 366 | − hugepage_shift = PAGE_SHIFT; | |
| 367 | − | |
| 368 | − pa <<= PAGE_SHIFT; | |
| 369 | − pa |= token & ((1ul << hugepage_shift) - 1); | |
| 370 | − return pa; | |
| 349 | + return ppc_find_vmap_phys(token); | |
| 371 | 350 | } |
| 372 | 351 | |
| 373 | 352 | /* |
| @@ -55,7 +55,6 @@ static struct iowa_bus *iowa_pci_find(unsigned long vaddr, unsigned long paddr) · 54 unmodified lines | ||
| 55 | 55 | #ifdef CONFIG_PPC_INDIRECT_MMIO |
| 56 | 56 | struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) |
| 57 | 57 | { |
| 58 | − unsigned hugepage_shift; | |
| 59 | 58 | struct iowa_bus *bus; |
| 60 | 59 | int token; |
| 61 | 60 | |
| @@ -65,22 +64,13 @@ struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) · 3 unmodified lines | ||
| 65 | 64 | bus = &iowa_busses[token - 1]; |
| 66 | 65 | else { |
| 67 | 66 | unsigned long vaddr, paddr; |
| 68 | − pte_t *ptep; | |
| 69 | 67 | |
| 70 | 68 | vaddr = (unsigned long)PCI_FIX_ADDR(addr); |
| 71 | 69 | if (vaddr < PHB_IO_BASE || vaddr >= PHB_IO_END) |
| 72 | 70 | return NULL; |
| 73 | − /* | |
| 74 | − * We won't find huge pages here (iomem). Also can't hit | |
| 75 | − * a page table free due to init_mm | |
| 76 | − */ | |
| 77 | − ptep = find_init_mm_pte(vaddr, &hugepage_shift); | |
| 78 | − if (ptep == NULL) | |
| 79 | − paddr = 0; | |
| 80 | − else { | |
| 81 | − WARN_ON(hugepage_shift); | |
| 82 | − paddr = pte_pfn(*ptep) << PAGE_SHIFT; | |
| 83 | − } | |
| 71 | + | |
| 72 | + paddr = ppc_find_vmap_phys(vaddr); | |
| 73 | + | |
| 84 | 74 | bus = iowa_pci_find(vaddr, paddr); |
| 85 | 75 | |
| 86 | 76 | if (bus == NULL) |
| @@ -898,7 +898,6 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, · 897 unmodified lines | ||
| 898 | 898 | unsigned int order; |
| 899 | 899 | unsigned int nio_pages, io_order; |
| 900 | 900 | struct page *page; |
| 901 | − size_t size_io = size; | |
| 902 | 901 | |
| 903 | 902 | size = PAGE_ALIGN(size); |
| 904 | 903 | order = get_order(size); |
| @@ -925,9 +924,8 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, · 20 unmodified lines | ||
| 925 | 924 | memset(ret, 0, size); |
| 926 | 925 | |
| 927 | 926 | /* Set up tces to cover the allocated range */ |
| 928 | − size_io = IOMMU_PAGE_ALIGN(size_io, tbl); | |
| 929 | − nio_pages = size_io >> tbl->it_page_shift; | |
| 930 | − io_order = get_iommu_order(size_io, tbl); | |
| 927 | + nio_pages = size >> tbl->it_page_shift; | |
| 928 | + io_order = get_iommu_order(size, tbl); | |
| 931 | 929 | mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL, |
| 932 | 930 | mask >> tbl->it_page_shift, io_order, 0); |
| 933 | 931 | if (mapping == DMA_MAPPING_ERROR) { |
| @@ -942,9 +940,10 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size, · 8 unmodified lines | ||
| 942 | 940 | void *vaddr, dma_addr_t dma_handle) |
| 943 | 941 | { |
| 944 | 942 | if (tbl) { |
| 945 | − size_t size_io = IOMMU_PAGE_ALIGN(size, tbl); | |
| 946 | − unsigned int nio_pages = size_io >> tbl->it_page_shift; | |
| 943 | + unsigned int nio_pages; | |
| 947 | 944 | |
| 945 | + size = PAGE_ALIGN(size); | |
| 946 | + nio_pages = size >> tbl->it_page_shift; | |
| 948 | 947 | iommu_free(tbl, dma_handle, nio_pages); |
| 949 | 948 | size = PAGE_ALIGN(size); |
| 950 | 949 | free_pages((unsigned long)vaddr, get_order(size)); |
| @@ -108,7 +108,6 @@ int arch_prepare_kprobe(struct kprobe *p) · 107 unmodified lines | ||
| 108 | 108 | int ret = 0; |
| 109 | 109 | struct kprobe *prev; |
| 110 | 110 | struct ppc_inst insn = ppc_inst_read((struct ppc_inst *)p->addr); |
| 111 | − struct ppc_inst prefix = ppc_inst_read((struct ppc_inst *)(p->addr - 1)); | |
| 112 | 111 | |
| 113 | 112 | if ((unsigned long)p->addr & 0x03) { |
| 114 | 113 | printk("Attempt to register kprobe at an unaligned address\n"); |
| @@ -116,7 +115,8 @@ int arch_prepare_kprobe(struct kprobe *p) · 1 unmodified line | ||
| 116 | 115 | } else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) { |
| 117 | 116 | printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n"); |
| 118 | 117 | ret = -EINVAL; |
| 119 | − } else if (ppc_inst_prefixed(prefix)) { | |
| 118 | + } else if ((unsigned long)p->addr & ~PAGE_MASK && | |
| 119 | + ppc_inst_prefixed(ppc_inst_read((struct ppc_inst *)(p->addr - 1)))) { | |
| 120 | 120 | printk("Cannot register a kprobe on the second word of prefixed instruction\n"); |
| 121 | 121 | ret = -EINVAL; |
| 122 | 122 | } |
| @@ -902,6 +902,10 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, · 901 unmodified lines | ||
| 902 | 902 | unsafe_copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set), badframe_block); |
| 903 | 903 | user_write_access_end(); |
| 904 | 904 | |
| 905 | + /* Save the siginfo outside of the unsafe block. */ | |
| 906 | + if (copy_siginfo_to_user(&frame->info, &ksig->info)) | |
| 907 | + goto badframe; | |
| 908 | + | |
| 905 | 909 | /* Make sure signal handler doesn't get spurious FP exceptions */ |
| 906 | 910 | tsk->thread.fp_state.fpscr = 0; |
| 907 | 911 | |
| @@ -915,11 +919,6 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, · 7 unmodified lines | ||
| 915 | 919 | regs->nip = (unsigned long) &frame->tramp[0]; |
| 916 | 920 | } |
| 917 | 921 | |
| 918 | − | |
| 919 | − /* Save the siginfo outside of the unsafe block. */ | |
| 920 | − if (copy_siginfo_to_user(&frame->info, &ksig->info)) | |
| 921 | − goto badframe; | |
| 922 | − | |
| 923 | 922 | /* Allocate a dummy caller frame for the signal handler. */ |
| 924 | 923 | newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE; |
| 925 | 924 | err |= put_user(regs->gpr[1], (unsigned long __user *)newsp); |
| @@ -3936,7 +3936,7 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) · 3935 unmodified lines | ||
| 3936 | 3936 | break; |
| 3937 | 3937 | } |
| 3938 | 3938 | cur = ktime_get(); |
| 3939 | − } while (single_task_running() && ktime_before(cur, stop)); | |
| 3939 | + } while (kvm_vcpu_can_poll(cur, stop)); | |
| 3940 | 3940 | |
| 3941 | 3941 | spin_lock(&vc->lock); |
| 3942 | 3942 | vc->vcore_state = VCORE_INACTIVE; |
| @@ -4455,7 +4455,6 @@ static int kvmppc_vcpu_run_hv(struct kvm_vcpu *vcpu) · 512 unmodified lines | ||
| 4455 | 4455 | mtspr(SPRN_EBBRR, ebb_regs[1]); |
| 4456 | 4456 | mtspr(SPRN_BESCR, ebb_regs[2]); |
| 4457 | 4457 | mtspr(SPRN_TAR, user_tar); |
| 4458 | − mtspr(SPRN_FSCR, current->thread.fscr); | |
| 4459 | 4458 | } |
| 4460 | 4459 | mtspr(SPRN_VRSAVE, user_vrsave); |
| 4461 | 4460 | |
| @@ -23,20 +23,9 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <asm/pte-walk.h> |
| 24 | 24 | |
| 25 | 25 | /* Translate address of a vmalloc'd thing to a linear map address */ |
| 26 | −static void *real_vmalloc_addr(void *x) | |
| 26 | +static void *real_vmalloc_addr(void *addr) | |
| 27 | 27 | { |
| 28 | − unsigned long addr = (unsigned long) x; | |
| 29 | − pte_t *p; | |
| 30 | − /* | |
| 31 | − * assume we don't have huge pages in vmalloc space... | |
| 32 | − * So don't worry about THP collapse/split. Called | |
| 33 | − * Only in realmode with MSR_EE = 0, hence won't need irq_save/restore. | |
| 34 | − */ | |
| 35 | − p = find_init_mm_pte(addr, NULL); | |
| 36 | − if (!p || !pte_present(*p)) | |
| 37 | − return NULL; | |
| 38 | − addr = (pte_pfn(*p) << PAGE_SHIFT) | (addr & ~PAGE_MASK); | |
| 39 | − return __va(addr); | |
| 28 | + return __va(ppc_find_vmap_phys((unsigned long)addr)); | |
| 40 | 29 | } |
| 41 | 30 | |
| 42 | 31 | /* Return 1 if we need to do a global tlbie, 0 if we can use tlbiel */ |
| @@ -59,6 +59,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) · 58 unmodified lines | ||
| 59 | 59 | #define STACK_SLOT_UAMOR (SFS-88) |
| 60 | 60 | #define STACK_SLOT_DAWR1 (SFS-96) |
| 61 | 61 | #define STACK_SLOT_DAWRX1 (SFS-104) |
| 62 | +#define STACK_SLOT_FSCR (SFS-112) | |
| 62 | 63 | /* the following is used by the P9 short path */ |
| 63 | 64 | #define STACK_SLOT_NVGPRS (SFS-152) /* 18 gprs */ |
| 64 | 65 | |
| @@ -686,6 +687,8 @@ BEGIN_FTR_SECTION · 621 unmodified lines | ||
| 686 | 687 | std r6, STACK_SLOT_DAWR0(r1) |
| 687 | 688 | std r7, STACK_SLOT_DAWRX0(r1) |
| 688 | 689 | std r8, STACK_SLOT_IAMR(r1) |
| 690 | + mfspr r5, SPRN_FSCR | |
| 691 | + std r5, STACK_SLOT_FSCR(r1) | |
| 689 | 692 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) |
| 690 | 693 | BEGIN_FTR_SECTION |
| 691 | 694 | mfspr r6, SPRN_DAWR1 |
| @@ -1663,6 +1666,10 @@ FTR_SECTION_ELSE · 971 unmodified lines | ||
| 1663 | 1666 | ld r7, STACK_SLOT_HFSCR(r1) |
| 1664 | 1667 | mtspr SPRN_HFSCR, r7 |
| 1665 | 1668 | ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) |
| 1669 | +BEGIN_FTR_SECTION | |
| 1670 | + ld r5, STACK_SLOT_FSCR(r1) | |
| 1671 | + mtspr SPRN_FSCR, r5 | |
| 1672 | +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |
| 1666 | 1673 | /* |
| 1667 | 1674 | * Restore various registers to 0, where non-zero values |
| 1668 | 1675 | * set by the guest could disrupt the host. |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <asm/machdep.h> |
| 21 | 21 | #include <asm/rtas.h> |
| 22 | 22 | #include <asm/kasan.h> |
| 23 | +#include <asm/sparsemem.h> | |
| 23 | 24 | #include <asm/svm.h> |
| 24 | 25 | |
| 25 | 26 | #include <mm/mmu_decl.h> |
| @@ -2254,7 +2254,7 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs) · 2253 unmodified lines | ||
| 2254 | 2254 | bool use_siar = regs_use_siar(regs); |
| 2255 | 2255 | unsigned long siar = mfspr(SPRN_SIAR); |
| 2256 | 2256 | |
| 2257 | − if (ppmu->flags & PPMU_P10_DD1) { | |
| 2257 | + if (ppmu && (ppmu->flags & PPMU_P10_DD1)) { | |
| 2258 | 2258 | if (siar) |
| 2259 | 2259 | return siar; |
| 2260 | 2260 | else |
| @@ -34,6 +34,7 @@ config RISCV · 33 unmodified lines | ||
| 34 | 34 | select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX |
| 35 | 35 | select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT |
| 36 | 36 | select ARCH_SUPPORTS_HUGETLBFS if MMU |
| 37 | + select ARCH_USE_MEMTEST | |
| 37 | 38 | select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU |
| 38 | 39 | select ARCH_WANT_FRAME_POINTERS |
| 39 | 40 | select ARCH_WANT_HUGE_PMD_SHARE if 64BIT |
| @@ -60,11 +61,11 @@ config RISCV · 20 unmodified lines | ||
| 60 | 61 | select GENERIC_TIME_VSYSCALL if MMU && 64BIT |
| 61 | 62 | select HANDLE_DOMAIN_IRQ |
| 62 | 63 | select HAVE_ARCH_AUDITSYSCALL |
| 63 | − select HAVE_ARCH_JUMP_LABEL | |
| 64 | − select HAVE_ARCH_JUMP_LABEL_RELATIVE | |
| 64 | + select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL | |
| 65 | + select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL | |
| 65 | 66 | select HAVE_ARCH_KASAN if MMU && 64BIT |
| 66 | 67 | select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT |
| 67 | − select HAVE_ARCH_KGDB | |
| 68 | + select HAVE_ARCH_KGDB if !XIP_KERNEL | |
| 68 | 69 | select HAVE_ARCH_KGDB_QXFER_PKT |
| 69 | 70 | select HAVE_ARCH_MMAP_RND_BITS if MMU |
| 70 | 71 | select HAVE_ARCH_SECCOMP_FILTER |
| @@ -79,9 +80,9 @@ config RISCV · 8 unmodified lines | ||
| 79 | 80 | select HAVE_GCC_PLUGINS |
| 80 | 81 | select HAVE_GENERIC_VDSO if MMU && 64BIT |
| 81 | 82 | select HAVE_IRQ_TIME_ACCOUNTING |
| 82 | − select HAVE_KPROBES | |
| 83 | − select HAVE_KPROBES_ON_FTRACE | |
| 84 | − select HAVE_KRETPROBES | |
| 83 | + select HAVE_KPROBES if !XIP_KERNEL | |
| 84 | + select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL | |
| 85 | + select HAVE_KRETPROBES if !XIP_KERNEL | |
| 85 | 86 | select HAVE_PCI |
| 86 | 87 | select HAVE_PERF_EVENTS |
| 87 | 88 | select HAVE_PERF_REGS |
| @@ -230,11 +231,11 @@ config ARCH_RV64I · 142 unmodified lines | ||
| 230 | 231 | bool "RV64I" |
| 231 | 232 | select 64BIT |
| 232 | 233 | select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000 |
| 233 | − select HAVE_DYNAMIC_FTRACE if MMU && $(cc-option,-fpatchable-function-entry=8) | |
| 234 | + select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8) | |
| 234 | 235 | select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE |
| 235 | − select HAVE_FTRACE_MCOUNT_RECORD | |
| 236 | + select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL | |
| 236 | 237 | select HAVE_FUNCTION_GRAPH_TRACER |
| 237 | − select HAVE_FUNCTION_TRACER | |
| 238 | + select HAVE_FUNCTION_TRACER if !XIP_KERNEL | |
| 238 | 239 | select SWIOTLB if MMU |
| 239 | 240 | |
| 240 | 241 | endchoice |
| @@ -14,6 +14,7 @@ config SOC_SIFIVE · 13 unmodified lines | ||
| 14 | 14 | select CLK_SIFIVE |
| 15 | 15 | select CLK_SIFIVE_PRCI |
| 16 | 16 | select SIFIVE_PLIC |
| 17 | + select RISCV_ERRATA_ALTERNATIVE | |
| 17 | 18 | select ERRATA_SIFIVE |
| 18 | 19 | help |
| 19 | 20 | This enables support for SiFive SoC platform hardware. |
| @@ -16,7 +16,7 @@ ifeq ($(CONFIG_DYNAMIC_FTRACE),y) · 15 unmodified lines | ||
| 16 | 16 | CC_FLAGS_FTRACE := -fpatchable-function-entry=8 |
| 17 | 17 | endif |
| 18 | 18 | |
| 19 | −ifeq ($(CONFIG_64BIT)$(CONFIG_CMODEL_MEDLOW),yy) | |
| 19 | +ifeq ($(CONFIG_CMODEL_MEDLOW),y) | |
| 20 | 20 | KBUILD_CFLAGS_MODULE += -mcmodel=medany |
| 21 | 21 | endif |
| 22 | 22 | |
| @@ -38,6 +38,15 @@ else · 15 unmodified lines | ||
| 38 | 38 | KBUILD_LDFLAGS += -melf32lriscv |
| 39 | 39 | endif |
| 40 | 40 | |
| 41 | +ifeq ($(CONFIG_LD_IS_LLD),y) | |
| 42 | + KBUILD_CFLAGS += -mno-relax | |
| 43 | + KBUILD_AFLAGS += -mno-relax | |
| 44 | +ifneq ($(LLVM_IAS),1) | |
| 45 | + KBUILD_CFLAGS += -Wa,-mno-relax | |
| 46 | + KBUILD_AFLAGS += -Wa,-mno-relax | |
| 47 | +endif | |
| 48 | +endif | |
| 49 | + | |
| 41 | 50 | # ISA string setting |
| 42 | 51 | riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima |
| 43 | 52 | riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima |
| @@ -1,2 +1,3 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | dtb-$(CONFIG_SOC_MICROCHIP_POLARFIRE) += microchip-mpfs-icicle-kit.dtb |
| 3 | +obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y)) | |
| @@ -1,3 +1,4 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | dtb-$(CONFIG_SOC_SIFIVE) += hifive-unleashed-a00.dtb \ |
| 3 | 3 | hifive-unmatched-a00.dtb |
| 4 | +obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y)) | |
| @@ -273,7 +273,7 @@ · 272 unmodified lines | ||
| 273 | 273 | cache-size = <2097152>; |
| 274 | 274 | cache-unified; |
| 275 | 275 | interrupt-parent = <&plic0>; |
| 276 | − interrupts = <19 20 21 22>; | |
| 276 | + interrupts = <19 21 22 20>; | |
| 277 | 277 | reg = <0x0 0x2010000 0x0 0x1000>; |
| 278 | 278 | }; |
| 279 | 279 | gpio: gpio@10060000 { |
| @@ -1,2 +1,2 @@ | ||
| 1 | −obj-y += errata_cip_453.o | |
| 1 | +obj-$(CONFIG_ERRATA_SIFIVE_CIP_453) += errata_cip_453.o | |
| 2 | 2 | obj-y += errata.o |
| @@ -51,7 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | REG_ASM " " newlen "\n" \ |
| 52 | 52 | ".word " errata_id "\n" |
| 53 | 53 | |
| 54 | −#define ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c) \ | |
| 54 | +#define ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c) \ | |
| 55 | 55 | ".if " __stringify(enable) " == 1\n" \ |
| 56 | 56 | ".pushsection .alternative, \"a\"\n" \ |
| 57 | 57 | ALT_ENTRY("886b", "888f", __stringify(vendor_id), __stringify(errata_id), "889f - 888f") \ |
| @@ -69,7 +69,7 @@ · 11 unmodified lines | ||
| 69 | 69 | "886 :\n" \ |
| 70 | 70 | old_c "\n" \ |
| 71 | 71 | "887 :\n" \ |
| 72 | − ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c) | |
| 72 | + ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c) | |
| 73 | 73 | |
| 74 | 74 | #define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \ |
| 75 | 75 | __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k)) |
| @@ -42,8 +42,8 @@ struct kimage_arch { · 41 unmodified lines | ||
| 42 | 42 | unsigned long fdt_addr; |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | −const extern unsigned char riscv_kexec_relocate[]; | |
| 46 | −const extern unsigned int riscv_kexec_relocate_size; | |
| 45 | +extern const unsigned char riscv_kexec_relocate[]; | |
| 46 | +extern const unsigned int riscv_kexec_relocate_size; | |
| 47 | 47 | |
| 48 | 48 | typedef void (*riscv_kexec_method)(unsigned long first_ind_entry, |
| 49 | 49 | unsigned long jump_addr, |
| @@ -30,9 +30,8 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | #define BPF_JIT_REGION_SIZE (SZ_128M) |
| 32 | 32 | #ifdef CONFIG_64BIT |
| 33 | −/* KASLR should leave at least 128MB for BPF after the kernel */ | |
| 34 | −#define BPF_JIT_REGION_START PFN_ALIGN((unsigned long)&_end) | |
| 35 | −#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE) | |
| 33 | +#define BPF_JIT_REGION_START (BPF_JIT_REGION_END - BPF_JIT_REGION_SIZE) | |
| 34 | +#define BPF_JIT_REGION_END (MODULES_END) | |
| 36 | 35 | #else |
| 37 | 36 | #define BPF_JIT_REGION_START (PAGE_OFFSET - BPF_JIT_REGION_SIZE) |
| 38 | 37 | #define BPF_JIT_REGION_END (VMALLOC_END) |
| @@ -14,8 +14,9 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <asm/set_memory.h> /* For set_memory_x() */ |
| 15 | 15 | #include <linux/compiler.h> /* For unreachable() */ |
| 16 | 16 | #include <linux/cpu.h> /* For cpu_down() */ |
| 17 | +#include <linux/reboot.h> | |
| 17 | 18 | |
| 18 | −/** | |
| 19 | +/* | |
| 19 | 20 | * kexec_image_info - Print received image details |
| 20 | 21 | */ |
| 21 | 22 | static void |
| @@ -39,7 +40,7 @@ kexec_image_info(const struct kimage *image) · 17 unmodified lines | ||
| 39 | 40 | } |
| 40 | 41 | } |
| 41 | 42 | |
| 42 | −/** | |
| 43 | +/* | |
| 43 | 44 | * machine_kexec_prepare - Initialize kexec |
| 44 | 45 | * |
| 45 | 46 | * This function is called from do_kexec_load, when the user has |
| @@ -100,7 +101,7 @@ machine_kexec_prepare(struct kimage *image) · 54 unmodified lines | ||
| 100 | 101 | } |
| 101 | 102 | |
| 102 | 103 | |
| 103 | −/** | |
| 104 | +/* | |
| 104 | 105 | * machine_kexec_cleanup - Cleanup any leftovers from |
| 105 | 106 | * machine_kexec_prepare |
| 106 | 107 | * |
| @@ -135,7 +136,7 @@ void machine_shutdown(void) · 28 unmodified lines | ||
| 135 | 136 | #endif |
| 136 | 137 | } |
| 137 | 138 | |
| 138 | −/** | |
| 139 | +/* | |
| 139 | 140 | * machine_crash_shutdown - Prepare to kexec after a kernel crash |
| 140 | 141 | * |
| 141 | 142 | * This function is called by crash_kexec just before machine_kexec |
| @@ -151,7 +152,7 @@ machine_crash_shutdown(struct pt_regs *regs) · 9 unmodified lines | ||
| 151 | 152 | pr_info("Starting crashdump kernel...\n"); |
| 152 | 153 | } |
| 153 | 154 | |
| 154 | −/** | |
| 155 | +/* | |
| 155 | 156 | * machine_kexec - Jump to the loaded kimage |
| 156 | 157 | * |
| 157 | 158 | * This function is called by kernel_kexec which is called by the |
| @@ -84,6 +84,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) · 83 unmodified lines | ||
| 84 | 84 | return 0; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | +#ifdef CONFIG_MMU | |
| 87 | 88 | void *alloc_insn_page(void) |
| 88 | 89 | { |
| 89 | 90 | return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END, |
| @@ -91,6 +92,7 @@ void *alloc_insn_page(void) · 1 unmodified line | ||
| 91 | 92 | VM_FLUSH_RESET_PERMS, NUMA_NO_NODE, |
| 92 | 93 | __builtin_return_address(0)); |
| 93 | 94 | } |
| 95 | +#endif | |
| 94 | 96 | |
| 95 | 97 | /* install breakpoint in text */ |
| 96 | 98 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
| @@ -231,13 +231,13 @@ static void __init init_resources(void) · 230 unmodified lines | ||
| 231 | 231 | |
| 232 | 232 | /* Clean-up any unused pre-allocated resources */ |
| 233 | 233 | mem_res_sz = (num_resources - res_idx + 1) * sizeof(*mem_res); |
| 234 | − memblock_free((phys_addr_t) mem_res, mem_res_sz); | |
| 234 | + memblock_free(__pa(mem_res), mem_res_sz); | |
| 235 | 235 | return; |
| 236 | 236 | |
| 237 | 237 | error: |
| 238 | 238 | /* Better an empty resource tree than an inconsistent one */ |
| 239 | 239 | release_child_resources(&iomem_resource); |
| 240 | − memblock_free((phys_addr_t) mem_res, mem_res_sz); | |
| 240 | + memblock_free(__pa(mem_res), mem_res_sz); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
| @@ -27,10 +27,10 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, · 26 unmodified lines | ||
| 27 | 27 | fp = frame_pointer(regs); |
| 28 | 28 | sp = user_stack_pointer(regs); |
| 29 | 29 | pc = instruction_pointer(regs); |
| 30 | − } else if (task == NULL || task == current) { | |
| 31 | − fp = (unsigned long)__builtin_frame_address(0); | |
| 32 | − sp = sp_in_global; | |
| 33 | − pc = (unsigned long)walk_stackframe; | |
| 30 | + } else if (task == current) { | |
| 31 | + fp = (unsigned long)__builtin_frame_address(1); | |
| 32 | + sp = (unsigned long)__builtin_frame_address(0); | |
| 33 | + pc = (unsigned long)__builtin_return_address(0); | |
| 34 | 34 | } else { |
| 35 | 35 | /* task blocked in __switch_to */ |
| 36 | 36 | fp = task->thread.s[0]; |
| @@ -106,15 +106,15 @@ static bool print_trace_address(void *arg, unsigned long pc) · 69 unmodified lines | ||
| 106 | 106 | return true; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | −void dump_backtrace(struct pt_regs *regs, struct task_struct *task, | |
| 109 | +noinline void dump_backtrace(struct pt_regs *regs, struct task_struct *task, | |
| 110 | 110 | const char *loglvl) |
| 111 | 111 | { |
| 112 | − pr_cont("%sCall Trace:\n", loglvl); | |
| 113 | 112 | walk_stackframe(task, regs, print_trace_address, (void *)loglvl); |
| 114 | 113 | } |
| 115 | 114 | |
| 116 | 115 | void show_stack(struct task_struct *task, unsigned long *sp, const char *loglvl) |
| 117 | 116 | { |
| 117 | + pr_cont("%sCall Trace:\n", loglvl); | |
| 118 | 118 | dump_backtrace(NULL, task, loglvl); |
| 119 | 119 | } |
| 120 | 120 | |
| @@ -139,7 +139,7 @@ unsigned long get_wchan(struct task_struct *task) · 18 unmodified lines | ||
| 139 | 139 | |
| 140 | 140 | #ifdef CONFIG_STACKTRACE |
| 141 | 141 | |
| 142 | −void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, | |
| 142 | +noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, | |
| 143 | 143 | struct task_struct *task, struct pt_regs *regs) |
| 144 | 144 | { |
| 145 | 145 | walk_stackframe(task, regs, consume_entry, cookie); |
| @@ -86,8 +86,13 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code, · 85 unmodified lines | ||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | +#if defined (CONFIG_XIP_KERNEL) && defined (CONFIG_RISCV_ERRATA_ALTERNATIVE) | |
| 90 | +#define __trap_section __section(".xip.traps") | |
| 91 | +#else | |
| 92 | +#define __trap_section | |
| 93 | +#endif | |
| 89 | 94 | #define DO_ERROR_INFO(name, signo, code, str) \ |
| 90 | −asmlinkage __visible void name(struct pt_regs *regs) \ | |
| 95 | +asmlinkage __visible __trap_section void name(struct pt_regs *regs) \ | |
| 91 | 96 | { \ |
| 92 | 97 | do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \ |
| 93 | 98 | } |
| @@ -111,7 +116,7 @@ DO_ERROR_INFO(do_trap_store_misaligned, · 17 unmodified lines | ||
| 111 | 116 | int handle_misaligned_load(struct pt_regs *regs); |
| 112 | 117 | int handle_misaligned_store(struct pt_regs *regs); |
| 113 | 118 | |
| 114 | −asmlinkage void do_trap_load_misaligned(struct pt_regs *regs) | |
| 119 | +asmlinkage void __trap_section do_trap_load_misaligned(struct pt_regs *regs) | |
| 115 | 120 | { |
| 116 | 121 | if (!handle_misaligned_load(regs)) |
| 117 | 122 | return; |
| @@ -119,7 +124,7 @@ asmlinkage void do_trap_load_misaligned(struct pt_regs *regs) · 1 unmodified line | ||
| 119 | 124 | "Oops - load address misaligned"); |
| 120 | 125 | } |
| 121 | 126 | |
| 122 | −asmlinkage void do_trap_store_misaligned(struct pt_regs *regs) | |
| 127 | +asmlinkage void __trap_section do_trap_store_misaligned(struct pt_regs *regs) | |
| 123 | 128 | { |
| 124 | 129 | if (!handle_misaligned_store(regs)) |
| 125 | 130 | return; |
| @@ -146,7 +151,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 20 unmodified lines | ||
| 146 | 151 | return GET_INSN_LENGTH(insn); |
| 147 | 152 | } |
| 148 | 153 | |
| 149 | −asmlinkage __visible void do_trap_break(struct pt_regs *regs) | |
| 154 | +asmlinkage __visible __trap_section void do_trap_break(struct pt_regs *regs) | |
| 150 | 155 | { |
| 151 | 156 | #ifdef CONFIG_KPROBES |
| 152 | 157 | if (kprobe_single_step_handler(regs)) |
| @@ -99,9 +99,22 @@ SECTIONS · 98 unmodified lines | ||
| 99 | 99 | } |
| 100 | 100 | PERCPU_SECTION(L1_CACHE_BYTES) |
| 101 | 101 | |
| 102 | − . = ALIGN(PAGE_SIZE); | |
| 102 | + . = ALIGN(8); | |
| 103 | + .alternative : { | |
| 104 | + __alt_start = .; | |
| 105 | + *(.alternative) | |
| 106 | + __alt_end = .; | |
| 107 | + } | |
| 103 | 108 | __init_end = .; |
| 104 | 109 | |
| 110 | + . = ALIGN(16); | |
| 111 | + .xip.traps : { | |
| 112 | + __xip_traps_start = .; | |
| 113 | + *(.xip.traps) | |
| 114 | + __xip_traps_end = .; | |
| 115 | + } | |
| 116 | + | |
| 117 | + . = ALIGN(PAGE_SIZE); | |
| 105 | 118 | .sdata : { |
| 106 | 119 | __global_pointer$ = . + 0x800; |
| 107 | 120 | *(.sdata*) |
| @@ -746,14 +746,18 @@ void __init protect_kernel_text_data(void) · 745 unmodified lines | ||
| 746 | 746 | unsigned long init_data_start = (unsigned long)__init_data_begin; |
| 747 | 747 | unsigned long rodata_start = (unsigned long)__start_rodata; |
| 748 | 748 | unsigned long data_start = (unsigned long)_data; |
| 749 | − unsigned long max_low = (unsigned long)(__va(PFN_PHYS(max_low_pfn))); | |
| 749 | +#if defined(CONFIG_64BIT) && defined(CONFIG_MMU) | |
| 750 | + unsigned long end_va = kernel_virt_addr + load_sz; | |
| 751 | +#else | |
| 752 | + unsigned long end_va = (unsigned long)(__va(PFN_PHYS(max_low_pfn))); | |
| 753 | +#endif | |
| 750 | 754 | |
| 751 | 755 | set_memory_ro(text_start, (init_text_start - text_start) >> PAGE_SHIFT); |
| 752 | 756 | set_memory_ro(init_text_start, (init_data_start - init_text_start) >> PAGE_SHIFT); |
| 753 | 757 | set_memory_nx(init_data_start, (rodata_start - init_data_start) >> PAGE_SHIFT); |
| 754 | 758 | /* rodata section is marked readonly in mark_rodata_ro */ |
| 755 | 759 | set_memory_nx(rodata_start, (data_start - rodata_start) >> PAGE_SHIFT); |
| 756 | − set_memory_nx(data_start, (max_low - data_start) >> PAGE_SHIFT); | |
| 760 | + set_memory_nx(data_start, (end_va - data_start) >> PAGE_SHIFT); | |
| 757 | 761 | } |
| 758 | 762 | |
| 759 | 763 | void mark_rodata_ro(void) |
| @@ -169,7 +169,7 @@ static void __init kasan_shallow_populate(void *start, void *end) · 168 unmodified lines | ||
| 169 | 169 | |
| 170 | 170 | void __init kasan_init(void) |
| 171 | 171 | { |
| 172 | − phys_addr_t _start, _end; | |
| 172 | + phys_addr_t p_start, p_end; | |
| 173 | 173 | u64 i; |
| 174 | 174 | |
| 175 | 175 | /* |
| @@ -189,9 +189,9 @@ void __init kasan_init(void) · 13 unmodified lines | ||
| 189 | 189 | (void *)kasan_mem_to_shadow((void *)VMALLOC_END)); |
| 190 | 190 | |
| 191 | 191 | /* Populate the linear mapping */ |
| 192 | − for_each_mem_range(i, &_start, &_end) { | |
| 193 | − void *start = (void *)__va(_start); | |
| 194 | − void *end = (void *)__va(_end); | |
| 192 | + for_each_mem_range(i, &p_start, &p_end) { | |
| 193 | + void *start = (void *)__va(p_start); | |
| 194 | + void *end = (void *)__va(p_end); | |
| 195 | 195 | |
| 196 | 196 | if (start >= end) |
| 197 | 197 | break; |
| @@ -201,7 +201,7 @@ void __init kasan_init(void) · 3 unmodified lines | ||
| 201 | 201 | |
| 202 | 202 | /* Populate kernel, BPF, modules mapping */ |
| 203 | 203 | kasan_populate(kasan_mem_to_shadow((const void *)MODULES_VADDR), |
| 204 | − kasan_mem_to_shadow((const void *)BPF_JIT_REGION_END)); | |
| 204 | + kasan_mem_to_shadow((const void *)MODULES_VADDR + SZ_2G)); | |
| 205 | 205 | |
| 206 | 206 | for (i = 0; i < PTRS_PER_PTE; i++) |
| 207 | 207 | set_pte(&kasan_early_shadow_pte[i], |
| @@ -651,9 +651,9 @@ ENDPROC(stack_overflow) · 650 unmodified lines | ||
| 651 | 651 | .Lcleanup_sie_mcck: |
| 652 | 652 | larl %r13,.Lsie_entry |
| 653 | 653 | slgr %r9,%r13 |
| 654 | − larl %r13,.Lsie_skip | |
| 654 | + lghi %r13,.Lsie_skip - .Lsie_entry | |
| 655 | 655 | clgr %r9,%r13 |
| 656 | − jh .Lcleanup_sie_int | |
| 656 | + jhe .Lcleanup_sie_int | |
| 657 | 657 | oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST |
| 658 | 658 | .Lcleanup_sie_int: |
| 659 | 659 | BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST) |
| @@ -200,8 +200,9 @@ endif · 199 unmodified lines | ||
| 200 | 200 | KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE) |
| 201 | 201 | |
| 202 | 202 | ifdef CONFIG_LTO_CLANG |
| 203 | −KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \ | |
| 204 | − -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) | |
| 203 | +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0) | |
| 204 | +KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) | |
| 205 | +endif | |
| 205 | 206 | endif |
| 206 | 207 | |
| 207 | 208 | ifdef CONFIG_X86_NEED_RELOCS |
| @@ -1406,6 +1406,8 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool · 1405 unmodified lines | ||
| 1406 | 1406 | die_id = i; |
| 1407 | 1407 | else |
| 1408 | 1408 | die_id = topology_phys_to_logical_pkg(i); |
| 1409 | + if (die_id < 0) | |
| 1410 | + die_id = -ENODEV; | |
| 1409 | 1411 | map->pbus_to_dieid[bus] = die_id; |
| 1410 | 1412 | break; |
| 1411 | 1413 | } |
| @@ -1452,14 +1454,14 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool · 40 unmodified lines | ||
| 1452 | 1454 | i = -1; |
| 1453 | 1455 | if (reverse) { |
| 1454 | 1456 | for (bus = 255; bus >= 0; bus--) { |
| 1455 | − if (map->pbus_to_dieid[bus] >= 0) | |
| 1457 | + if (map->pbus_to_dieid[bus] != -1) | |
| 1456 | 1458 | i = map->pbus_to_dieid[bus]; |
| 1457 | 1459 | else |
| 1458 | 1460 | map->pbus_to_dieid[bus] = i; |
| 1459 | 1461 | } |
| 1460 | 1462 | } else { |
| 1461 | 1463 | for (bus = 0; bus <= 255; bus++) { |
| 1462 | − if (map->pbus_to_dieid[bus] >= 0) | |
| 1464 | + if (map->pbus_to_dieid[bus] != -1) | |
| 1463 | 1465 | i = map->pbus_to_dieid[bus]; |
| 1464 | 1466 | else |
| 1465 | 1467 | map->pbus_to_dieid[bus] = i; |
| @@ -5097,9 +5099,10 @@ static struct intel_uncore_type icx_uncore_m2m = { · 3631 unmodified lines | ||
| 5097 | 5099 | .perf_ctr = SNR_M2M_PCI_PMON_CTR0, |
| 5098 | 5100 | .event_ctl = SNR_M2M_PCI_PMON_CTL0, |
| 5099 | 5101 | .event_mask = SNBEP_PMON_RAW_EVENT_MASK, |
| 5102 | + .event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT, | |
| 5100 | 5103 | .box_ctl = SNR_M2M_PCI_PMON_BOX_CTL, |
| 5101 | 5104 | .ops = &snr_m2m_uncore_pci_ops, |
| 5102 | − .format_group = &skx_uncore_format_group, | |
| 5105 | + .format_group = &snr_m2m_uncore_format_group, | |
| 5103 | 5106 | }; |
| 5104 | 5107 | |
| 5105 | 5108 | static struct attribute *icx_upi_uncore_formats_attr[] = { |
| @@ -174,6 +174,7 @@ static inline int apic_is_clustered_box(void) · 173 unmodified lines | ||
| 174 | 174 | extern int setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask); |
| 175 | 175 | extern void lapic_assign_system_vectors(void); |
| 176 | 176 | extern void lapic_assign_legacy_vector(unsigned int isairq, bool replace); |
| 177 | +extern void lapic_update_legacy_vectors(void); | |
| 177 | 178 | extern void lapic_online(void); |
| 178 | 179 | extern void lapic_offline(void); |
| 179 | 180 | extern bool apic_needs_pit(void); |
| @@ -56,11 +56,8 @@ · 55 unmodified lines | ||
| 56 | 56 | # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31)) |
| 57 | 57 | #endif |
| 58 | 58 | |
| 59 | −#ifdef CONFIG_IOMMU_SUPPORT | |
| 60 | −# define DISABLE_ENQCMD 0 | |
| 61 | −#else | |
| 62 | −# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31)) | |
| 63 | −#endif | |
| 59 | +/* Force disable because it's broken beyond repair */ | |
| 60 | +#define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31)) | |
| 64 | 61 | |
| 65 | 62 | #ifdef CONFIG_X86_SGX |
| 66 | 63 | # define DISABLE_SGX 0 |
| @@ -106,10 +106,6 @@ extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name); · 105 unmodified lines | ||
| 106 | 106 | */ |
| 107 | 107 | #define PASID_DISABLED 0 |
| 108 | 108 | |
| 109 | −#ifdef CONFIG_IOMMU_SUPPORT | |
| 110 | −/* Update current's PASID MSR/state by mm's PASID. */ | |
| 111 | −void update_pasid(void); | |
| 112 | −#else | |
| 113 | 109 | static inline void update_pasid(void) { } |
| 114 | −#endif | |
| 110 | + | |
| 115 | 111 | #endif /* _ASM_X86_FPU_API_H */ |
| @@ -578,19 +578,19 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) · 577 unmodified lines | ||
| 578 | 578 | * PKRU state is switched eagerly because it needs to be valid before we |
| 579 | 579 | * return to userland e.g. for a copy_to_user() operation. |
| 580 | 580 | */ |
| 581 | − if (current->mm) { | |
| 581 | + if (!(current->flags & PF_KTHREAD)) { | |
| 582 | + /* | |
| 583 | + * If the PKRU bit in xsave.header.xfeatures is not set, | |
| 584 | + * then the PKRU component was in init state, which means | |
| 585 | + * XRSTOR will set PKRU to 0. If the bit is not set then | |
| 586 | + * get_xsave_addr() will return NULL because the PKRU value | |
| 587 | + * in memory is not valid. This means pkru_val has to be | |
| 588 | + * set to 0 and not to init_pkru_value. | |
| 589 | + */ | |
| 582 | 590 | pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU); |
| 583 | − if (pk) | |
| 584 | − pkru_val = pk->pkru; | |
| 591 | + pkru_val = pk ? pk->pkru : 0; | |
| 585 | 592 | } |
| 586 | 593 | __write_pkru(pkru_val); |
| 587 | − | |
| 588 | − /* | |
| 589 | − * Expensive PASID MSR write will be avoided in update_pasid() because | |
| 590 | − * TIF_NEED_FPU_LOAD was set. And the PASID state won't be updated | |
| 591 | − * unless it's different from mm->pasid to reduce overhead. | |
| 592 | − */ | |
| 593 | − update_pasid(); | |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | #endif /* _ASM_X86_FPU_INTERNAL_H */ |
| @@ -99,6 +99,7 @@ KVM_X86_OP_NULL(post_block) · 98 unmodified lines | ||
| 99 | 99 | KVM_X86_OP_NULL(vcpu_blocking) |
| 100 | 100 | KVM_X86_OP_NULL(vcpu_unblocking) |
| 101 | 101 | KVM_X86_OP_NULL(update_pi_irte) |
| 102 | +KVM_X86_OP_NULL(start_assignment) | |
| 102 | 103 | KVM_X86_OP_NULL(apicv_post_state_restore) |
| 103 | 104 | KVM_X86_OP_NULL(dy_apicv_has_pending_interrupt) |
| 104 | 105 | KVM_X86_OP_NULL(set_hv_timer) |
| @@ -1352,6 +1352,7 @@ struct kvm_x86_ops { · 1351 unmodified lines | ||
| 1352 | 1352 | |
| 1353 | 1353 | int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq, |
| 1354 | 1354 | uint32_t guest_irq, bool set); |
| 1355 | + void (*start_assignment)(struct kvm *kvm); | |
| 1355 | 1356 | void (*apicv_post_state_restore)(struct kvm_vcpu *vcpu); |
| 1356 | 1357 | bool (*dy_apicv_has_pending_interrupt)(struct kvm_vcpu *vcpu); |
| 1357 | 1358 | |
| @@ -3,11 +3,13 @@ · 2 unmodified lines | ||
| 3 | 3 | #define _ASM_X86_THERMAL_H |
| 4 | 4 | |
| 5 | 5 | #ifdef CONFIG_X86_THERMAL_VECTOR |
| 6 | +void therm_lvt_init(void); | |
| 6 | 7 | void intel_init_thermal(struct cpuinfo_x86 *c); |
| 7 | 8 | bool x86_thermal_enabled(void); |
| 8 | 9 | void intel_thermal_interrupt(void); |
| 9 | 10 | #else |
| 10 | −static inline void intel_init_thermal(struct cpuinfo_x86 *c) { } | |
| 11 | +static inline void therm_lvt_init(void) { } | |
| 12 | +static inline void intel_init_thermal(struct cpuinfo_x86 *c) { } | |
| 11 | 13 | #endif |
| 12 | 14 | |
| 13 | 15 | #endif /* _ASM_X86_THERMAL_H */ |
| @@ -182,42 +182,70 @@ done: · 181 unmodified lines | ||
| 182 | 182 | n_dspl, (unsigned long)orig_insn + n_dspl + repl_len); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | +/* | |
| 186 | + * optimize_nops_range() - Optimize a sequence of single byte NOPs (0x90) | |
| 187 | + * | |
| 188 | + * @instr: instruction byte stream | |
| 189 | + * @instrlen: length of the above | |
| 190 | + * @off: offset within @instr where the first NOP has been detected | |
| 191 | + * | |
| 192 | + * Return: number of NOPs found (and replaced). | |
| 193 | + */ | |
| 194 | +static __always_inline int optimize_nops_range(u8 *instr, u8 instrlen, int off) | |
| 195 | +{ | |
| 196 | + unsigned long flags; | |
| 197 | + int i = off, nnops; | |
| 198 | + | |
| 199 | + while (i < instrlen) { | |
| 200 | + if (instr[i] != 0x90) | |
| 201 | + break; | |
| 202 | + | |
| 203 | + i++; | |
| 204 | + } | |
| 205 | + | |
| 206 | + nnops = i - off; | |
| 207 | + | |
| 208 | + if (nnops <= 1) | |
| 209 | + return nnops; | |
| 210 | + | |
| 211 | + local_irq_save(flags); | |
| 212 | + add_nops(instr + off, nnops); | |
| 213 | + local_irq_restore(flags); | |
| 214 | + | |
| 215 | + DUMP_BYTES(instr, instrlen, "%px: [%d:%d) optimized NOPs: ", instr, off, i); | |
| 216 | + | |
| 217 | + return nnops; | |
| 218 | +} | |
| 219 | + | |
| 185 | 220 | /* |
| 186 | 221 | * "noinline" to cause control flow change and thus invalidate I$ and |
| 187 | 222 | * cause refetch after modification. |
| 188 | 223 | */ |
| 189 | 224 | static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *instr) |
| 190 | 225 | { |
| 191 | − unsigned long flags; | |
| 192 | 226 | struct insn insn; |
| 193 | − int nop, i = 0; | |
| 227 | + int i = 0; | |
| 194 | 228 | |
| 195 | 229 | /* |
| 196 | − * Jump over the non-NOP insns, the remaining bytes must be single-byte | |
| 197 | − * NOPs, optimize them. | |
| 230 | + * Jump over the non-NOP insns and optimize single-byte NOPs into bigger | |
| 231 | + * ones. | |
| 198 | 232 | */ |
| 199 | 233 | for (;;) { |
| 200 | 234 | if (insn_decode_kernel(&insn, &instr[i])) |
| 201 | 235 | return; |
| 202 | 236 | |
| 237 | + /* | |
| 238 | + * See if this and any potentially following NOPs can be | |
| 239 | + * optimized. | |
| 240 | + */ | |
| 203 | 241 | if (insn.length == 1 && insn.opcode.bytes[0] == 0x90) |
| 204 | − break; | |
| 205 | − | |
| 206 | − if ((i += insn.length) >= a->instrlen) | |
| 207 | − return; | |
| 208 | − } | |
| 242 | + i += optimize_nops_range(instr, a->instrlen, i); | |
| 243 | + else | |
| 244 | + i += insn.length; | |
| 209 | 245 | |
| 210 | − for (nop = i; i < a->instrlen; i++) { | |
| 211 | − if (WARN_ONCE(instr[i] != 0x90, "Not a NOP at 0x%px\n", &instr[i])) | |
| 246 | + if (i >= a->instrlen) | |
| 212 | 247 | return; |
| 213 | 248 | } |
| 214 | − | |
| 215 | − local_irq_save(flags); | |
| 216 | − add_nops(instr + nop, i - nop); | |
| 217 | − local_irq_restore(flags); | |
| 218 | − | |
| 219 | − DUMP_BYTES(instr, a->instrlen, "%px: [%d:%d) optimized NOPs: ", | |
| 220 | − instr, nop, a->instrlen); | |
| 221 | 249 | } |
| 222 | 250 | |
| 223 | 251 | /* |
| @@ -2604,6 +2604,7 @@ static void __init apic_bsp_setup(bool upmode) · 2603 unmodified lines | ||
| 2604 | 2604 | end_local_APIC_setup(); |
| 2605 | 2605 | irq_remap_enable_fault_handling(); |
| 2606 | 2606 | setup_IO_APIC(); |
| 2607 | + lapic_update_legacy_vectors(); | |
| 2607 | 2608 | } |
| 2608 | 2609 | |
| 2609 | 2610 | #ifdef CONFIG_UP_LATE_INIT |
| @@ -738,6 +738,26 @@ void lapic_assign_legacy_vector(unsigned int irq, bool replace) · 737 unmodified lines | ||
| 738 | 738 | irq_matrix_assign_system(vector_matrix, ISA_IRQ_VECTOR(irq), replace); |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | +void __init lapic_update_legacy_vectors(void) | |
| 742 | +{ | |
| 743 | + unsigned int i; | |
| 744 | + | |
| 745 | + if (IS_ENABLED(CONFIG_X86_IO_APIC) && nr_ioapics > 0) | |
| 746 | + return; | |
| 747 | + | |
| 748 | + /* | |
| 749 | + * If the IO/APIC is disabled via config, kernel command line or | |
| 750 | + * lack of enumeration then all legacy interrupts are routed | |
| 751 | + * through the PIC. Make sure that they are marked as legacy | |
| 752 | + * vectors. PIC_CASCADE_IRQ has already been marked in | |
| 753 | + * lapic_assign_system_vectors(). | |
| 754 | + */ | |
| 755 | + for (i = 0; i < nr_legacy_irqs(); i++) { | |
| 756 | + if (i != PIC_CASCADE_IR) | |
| 757 | + lapic_assign_legacy_vector(i, true); | |
| 758 | + } | |
| 759 | +} | |
| 760 | + | |
| 741 | 761 | void __init lapic_assign_system_vectors(void) |
| 742 | 762 | { |
| 743 | 763 | unsigned int i, vector = 0; |
| @@ -63,7 +63,7 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr) · 62 unmodified lines | ||
| 63 | 63 | case 15: |
| 64 | 64 | return msr - MSR_P4_BPU_PERFCTR0; |
| 65 | 65 | } |
| 66 | − fallthrough; | |
| 66 | + break; | |
| 67 | 67 | case X86_VENDOR_ZHAOXIN: |
| 68 | 68 | case X86_VENDOR_CENTAUR: |
| 69 | 69 | return msr - MSR_ARCH_PERFMON_PERFCTR0; |
| @@ -96,7 +96,7 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) · 26 unmodified lines | ||
| 96 | 96 | case 15: |
| 97 | 97 | return msr - MSR_P4_BSU_ESCR0; |
| 98 | 98 | } |
| 99 | − fallthrough; | |
| 99 | + break; | |
| 100 | 100 | case X86_VENDOR_ZHAOXIN: |
| 101 | 101 | case X86_VENDOR_CENTAUR: |
| 102 | 102 | return msr - MSR_ARCH_PERFMON_EVENTSEL0; |
| @@ -212,6 +212,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file) · 211 unmodified lines | ||
| 212 | 212 | list_splice_tail(&secs_pages, &zombie_secs_pages); |
| 213 | 213 | mutex_unlock(&zombie_secs_pages_lock); |
| 214 | 214 | |
| 215 | + xa_destroy(&vepc->page_array); | |
| 215 | 216 | kfree(vepc); |
| 216 | 217 | |
| 217 | 218 | return 0; |
| @@ -307,13 +307,17 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 306 unmodified lines | ||
| 307 | 307 | return 0; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | − if (!access_ok(buf, size)) | |
| 311 | − return -EACCES; | |
| 310 | + if (!access_ok(buf, size)) { | |
| 311 | + ret = -EACCES; | |
| 312 | + goto out; | |
| 313 | + } | |
| 312 | 314 | |
| 313 | − if (!static_cpu_has(X86_FEATURE_FPU)) | |
| 314 | − return fpregs_soft_set(current, NULL, | |
| 315 | − 0, sizeof(struct user_i387_ia32_struct), | |
| 316 | − NULL, buf) != 0; | |
| 315 | + if (!static_cpu_has(X86_FEATURE_FPU)) { | |
| 316 | + ret = fpregs_soft_set(current, NULL, 0, | |
| 317 | + sizeof(struct user_i387_ia32_struct), | |
| 318 | + NULL, buf); | |
| 319 | + goto out; | |
| 320 | + } | |
| 317 | 321 | |
| 318 | 322 | if (use_xsave()) { |
| 319 | 323 | struct _fpx_sw_bytes fx_sw_user; |
| @@ -369,6 +373,25 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 49 unmodified lines | ||
| 369 | 373 | fpregs_unlock(); |
| 370 | 374 | return 0; |
| 371 | 375 | } |
| 376 | + | |
| 377 | + /* | |
| 378 | + * The above did an FPU restore operation, restricted to | |
| 379 | + * the user portion of the registers, and failed, but the | |
| 380 | + * microcode might have modified the FPU registers | |
| 381 | + * nevertheless. | |
| 382 | + * | |
| 383 | + * If the FPU registers do not belong to current, then | |
| 384 | + * invalidate the FPU register state otherwise the task might | |
| 385 | + * preempt current and return to user space with corrupted | |
| 386 | + * FPU registers. | |
| 387 | + * | |
| 388 | + * In case current owns the FPU registers then no further | |
| 389 | + * action is required. The fixup below will handle it | |
| 390 | + * correctly. | |
| 391 | + */ | |
| 392 | + if (test_thread_flag(TIF_NEED_FPU_LOAD)) | |
| 393 | + __cpu_invalidate_fpregs_state(); | |
| 394 | + | |
| 372 | 395 | fpregs_unlock(); |
| 373 | 396 | } else { |
| 374 | 397 | /* |
| @@ -377,7 +400,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 2 unmodified lines | ||
| 377 | 400 | */ |
| 378 | 401 | ret = __copy_from_user(&env, buf, sizeof(env)); |
| 379 | 402 | if (ret) |
| 380 | − goto err_out; | |
| 403 | + goto out; | |
| 381 | 404 | envp = &env; |
| 382 | 405 | } |
| 383 | 406 | |
| @@ -405,16 +428,9 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 21 unmodified lines | ||
| 405 | 428 | if (use_xsave() && !fx_only) { |
| 406 | 429 | u64 init_bv = xfeatures_mask_user() & ~user_xfeatures; |
| 407 | 430 | |
| 408 | − if (using_compacted_format()) { | |
| 409 | − ret = copy_user_to_xstate(&fpu->state.xsave, buf_fx); | |
| 410 | − } else { | |
| 411 | − ret = __copy_from_user(&fpu->state.xsave, buf_fx, state_size); | |
| 412 | − | |
| 413 | − if (!ret && state_size > offsetof(struct xregs_state, header)) | |
| 414 | − ret = validate_user_xstate_header(&fpu->state.xsave.header); | |
| 415 | − } | |
| 431 | + ret = copy_user_to_xstate(&fpu->state.xsave, buf_fx); | |
| 416 | 432 | if (ret) |
| 417 | − goto err_out; | |
| 433 | + goto out; | |
| 418 | 434 | |
| 419 | 435 | sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures, |
| 420 | 436 | fx_only); |
| @@ -434,7 +450,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 13 unmodified lines | ||
| 434 | 450 | ret = __copy_from_user(&fpu->state.fxsave, buf_fx, state_size); |
| 435 | 451 | if (ret) { |
| 436 | 452 | ret = -EFAULT; |
| 437 | − goto err_out; | |
| 453 | + goto out; | |
| 438 | 454 | } |
| 439 | 455 | |
| 440 | 456 | sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures, |
| @@ -452,7 +468,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 11 unmodified lines | ||
| 452 | 468 | } else { |
| 453 | 469 | ret = __copy_from_user(&fpu->state.fsave, buf_fx, state_size); |
| 454 | 470 | if (ret) |
| 455 | − goto err_out; | |
| 471 | + goto out; | |
| 456 | 472 | |
| 457 | 473 | fpregs_lock(); |
| 458 | 474 | ret = copy_kernel_to_fregs_err(&fpu->state.fsave); |
| @@ -463,7 +479,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 4 unmodified lines | ||
| 463 | 479 | fpregs_deactivate(fpu); |
| 464 | 480 | fpregs_unlock(); |
| 465 | 481 | |
| 466 | −err_out: | |
| 482 | +out: | |
| 467 | 483 | if (ret) |
| 468 | 484 | fpu__clear_user_states(fpu); |
| 469 | 485 | return ret; |
| @@ -1402,60 +1402,3 @@ int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns, · 1401 unmodified lines | ||
| 1402 | 1402 | return 0; |
| 1403 | 1403 | } |
| 1404 | 1404 | #endif /* CONFIG_PROC_PID_ARCH_STATUS */ |
| 1405 | − | |
| 1406 | −#ifdef CONFIG_IOMMU_SUPPORT | |
| 1407 | −void update_pasid(void) | |
| 1408 | −{ | |
| 1409 | − u64 pasid_state; | |
| 1410 | − u32 pasid; | |
| 1411 | − | |
| 1412 | − if (!cpu_feature_enabled(X86_FEATURE_ENQCMD)) | |
| 1413 | − return; | |
| 1414 | − | |
| 1415 | − if (!current->mm) | |
| 1416 | − return; | |
| 1417 | − | |
| 1418 | − pasid = READ_ONCE(current->mm->pasid); | |
| 1419 | − /* Set the valid bit in the PASID MSR/state only for valid pasid. */ | |
| 1420 | − pasid_state = pasid == PASID_DISABLED ? | |
| 1421 | − pasid : pasid | MSR_IA32_PASID_VALID; | |
| 1422 | − | |
| 1423 | − /* | |
| 1424 | − * No need to hold fregs_lock() since the task's fpstate won't | |
| 1425 | − * be changed by others (e.g. ptrace) while the task is being | |
| 1426 | − * switched to or is in IPI. | |
| 1427 | − */ | |
| 1428 | − if (!test_thread_flag(TIF_NEED_FPU_LOAD)) { | |
| 1429 | − /* The MSR is active and can be directly updated. */ | |
| 1430 | − wrmsrl(MSR_IA32_PASID, pasid_state); | |
| 1431 | − } else { | |
| 1432 | − struct fpu *fpu = ¤t->thread.fpu; | |
| 1433 | − struct ia32_pasid_state *ppasid_state; | |
| 1434 | − struct xregs_state *xsave; | |
| 1435 | − | |
| 1436 | − /* | |
| 1437 | − * The CPU's xstate registers are not currently active. Just | |
| 1438 | − * update the PASID state in the memory buffer here. The | |
| 1439 | − * PASID MSR will be loaded when returning to user mode. | |
| 1440 | − */ | |
| 1441 | − xsave = &fpu->state.xsave; | |
| 1442 | − xsave->header.xfeatures |= XFEATURE_MASK_PASID; | |
| 1443 | − ppasid_state = get_xsave_addr(xsave, XFEATURE_PASID); | |
| 1444 | − /* | |
| 1445 | − * Since XFEATURE_MASK_PASID is set in xfeatures, ppasid_state | |
| 1446 | − * won't be NULL and no need to check its value. | |
| 1447 | − * | |
| 1448 | − * Only update the task's PASID state when it's different | |
| 1449 | − * from the mm's pasid. | |
| 1450 | − */ | |
| 1451 | − if (ppasid_state->pasid != pasid_state) { | |
| 1452 | − /* | |
| 1453 | − * Invalid fpregs so that state restoring will pick up | |
| 1454 | − * the PASID state. | |
| 1455 | − */ | |
| 1456 | − __fpu_invalidate_fpregs_state(fpu); | |
| 1457 | − ppasid_state->pasid = pasid_state; | |
| 1458 | − } | |
| 1459 | − } | |
| 1460 | −} | |
| 1461 | −#endif /* CONFIG_IOMMU_SUPPORT */ | |
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #include <asm/pci-direct.h> |
| 45 | 45 | #include <asm/prom.h> |
| 46 | 46 | #include <asm/proto.h> |
| 47 | +#include <asm/thermal.h> | |
| 47 | 48 | #include <asm/unwind.h> |
| 48 | 49 | #include <asm/vsyscall.h> |
| 49 | 50 | #include <linux/vmalloc.h> |
| @@ -637,11 +638,11 @@ static void __init trim_snb_memory(void) · 587 unmodified lines | ||
| 637 | 638 | * them from accessing certain memory ranges, namely anything below |
| 638 | 639 | * 1M and in the pages listed in bad_pages[] above. |
| 639 | 640 | * |
| 640 | − * To avoid these pages being ever accessed by SNB gfx devices | |
| 641 | − * reserve all memory below the 1 MB mark and bad_pages that have | |
| 642 | − * not already been reserved at boot time. | |
| 641 | + * To avoid these pages being ever accessed by SNB gfx devices reserve | |
| 642 | + * bad_pages that have not already been reserved at boot time. | |
| 643 | + * All memory below the 1 MB mark is anyway reserved later during | |
| 644 | + * setup_arch(), so there is no need to reserve it here. | |
| 643 | 645 | */ |
| 644 | − memblock_reserve(0, 1<<20); | |
| 645 | 646 | |
| 646 | 647 | for (i = 0; i < ARRAY_SIZE(bad_pages); i++) { |
| 647 | 648 | if (memblock_reserve(bad_pages[i], PAGE_SIZE)) |
| @@ -733,14 +734,14 @@ static void __init early_reserve_memory(void) · 85 unmodified lines | ||
| 733 | 734 | * The first 4Kb of memory is a BIOS owned area, but generally it is |
| 734 | 735 | * not listed as such in the E820 table. |
| 735 | 736 | * |
| 736 | − * Reserve the first memory page and typically some additional | |
| 737 | − * memory (64KiB by default) since some BIOSes are known to corrupt | |
| 738 | − * low memory. See the Kconfig help text for X86_RESERVE_LOW. | |
| 737 | + * Reserve the first 64K of memory since some BIOSes are known to | |
| 738 | + * corrupt low memory. After the real mode trampoline is allocated the | |
| 739 | + * rest of the memory below 640k is reserved. | |
| 739 | 740 | * |
| 740 | 741 | * In addition, make sure page 0 is always reserved because on |
| 741 | 742 | * systems with L1TF its contents can be leaked to user processes. |
| 742 | 743 | */ |
| 743 | − memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE)); | |
| 744 | + memblock_reserve(0, SZ_64K); | |
| 744 | 745 | |
| 745 | 746 | early_reserve_initrd(); |
| 746 | 747 | |
| @@ -751,6 +752,7 @@ static void __init early_reserve_memory(void) · 4 unmodified lines | ||
| 751 | 752 | |
| 752 | 753 | reserve_ibft_region(); |
| 753 | 754 | reserve_bios_regions(); |
| 755 | + trim_snb_memory(); | |
| 754 | 756 | } |
| 755 | 757 | |
| 756 | 758 | /* |
| @@ -1081,14 +1083,20 @@ void __init setup_arch(char **cmdline_p) · 324 unmodified lines | ||
| 1081 | 1083 | (max_pfn_mapped<<PAGE_SHIFT) - 1); |
| 1082 | 1084 | #endif |
| 1083 | 1085 | |
| 1084 | − reserve_real_mode(); | |
| 1085 | − | |
| 1086 | 1086 | /* |
| 1087 | − * Reserving memory causing GPU hangs on Sandy Bridge integrated | |
| 1088 | − * graphics devices should be done after we allocated memory under | |
| 1089 | − * 1M for the real mode trampoline. | |
| 1087 | + * Find free memory for the real mode trampoline and place it | |
| 1088 | + * there. | |
| 1089 | + * If there is not enough free memory under 1M, on EFI-enabled | |
| 1090 | + * systems there will be additional attempt to reclaim the memory | |
| 1091 | + * for the real mode trampoline at efi_free_boot_services(). | |
| 1092 | + * | |
| 1093 | + * Unconditionally reserve the entire first 1M of RAM because | |
| 1094 | + * BIOSes are know to corrupt low memory and several | |
| 1095 | + * hundred kilobytes are not worth complex detection what memory gets | |
| 1096 | + * clobbered. Moreover, on machines with SandyBridge graphics or in | |
| 1097 | + * setups that use crashkernel the entire 1M is reserved anyway. | |
| 1090 | 1098 | */ |
| 1091 | − trim_snb_memory(); | |
| 1099 | + reserve_real_mode(); | |
| 1092 | 1100 | |
| 1093 | 1101 | init_mem_mapping(); |
| 1094 | 1102 | |
| @@ -1226,6 +1234,14 @@ void __init setup_arch(char **cmdline_p) · 131 unmodified lines | ||
| 1226 | 1234 | |
| 1227 | 1235 | x86_init.timers.wallclock_init(); |
| 1228 | 1236 | |
| 1237 | + /* | |
| 1238 | + * This needs to run before setup_local_APIC() which soft-disables the | |
| 1239 | + * local APIC temporarily and that masks the thermal LVT interrupt, | |
| 1240 | + * leading to softlockups on machines which have configured SMI | |
| 1241 | + * interrupt delivery. | |
| 1242 | + */ | |
| 1243 | + therm_lvt_init(); | |
| 1244 | + | |
| 1229 | 1245 | mcheck_init(); |
| 1230 | 1246 | |
| 1231 | 1247 | register_refined_jiffies(CLOCK_TICK_RATE); |
| @@ -655,6 +655,7 @@ static int __do_cpuid_func_emulated(struct kvm_cpuid_array *array, u32 func) · 654 unmodified lines | ||
| 655 | 655 | if (kvm_cpu_cap_has(X86_FEATURE_RDTSCP)) |
| 656 | 656 | entry->ecx = F(RDPID); |
| 657 | 657 | ++array->nent; |
| 658 | + break; | |
| 658 | 659 | default: |
| 659 | 660 | break; |
| 660 | 661 | } |
| @@ -5111,7 +5111,7 @@ done: · 5110 unmodified lines | ||
| 5111 | 5111 | return rc; |
| 5112 | 5112 | } |
| 5113 | 5113 | |
| 5114 | −int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len) | |
| 5114 | +int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len, int emulation_type) | |
| 5115 | 5115 | { |
| 5116 | 5116 | int rc = X86EMUL_CONTINUE; |
| 5117 | 5117 | int mode = ctxt->mode; |
| @@ -5322,7 +5322,8 @@ done_prefixes: · 204 unmodified lines | ||
| 5322 | 5322 | |
| 5323 | 5323 | ctxt->execute = opcode.u.execute; |
| 5324 | 5324 | |
| 5325 | − if (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD))) | |
| 5325 | + if (unlikely(emulation_type & EMULTYPE_TRAP_UD) && | |
| 5326 | + likely(!(ctxt->d & EmulateOnUD))) | |
| 5326 | 5327 | return EMULATION_FAILED; |
| 5327 | 5328 | |
| 5328 | 5329 | if (unlikely(ctxt->d & |
| @@ -1172,6 +1172,7 @@ void kvm_hv_invalidate_tsc_page(struct kvm *kvm) · 1171 unmodified lines | ||
| 1172 | 1172 | { |
| 1173 | 1173 | struct kvm_hv *hv = to_kvm_hv(kvm); |
| 1174 | 1174 | u64 gfn; |
| 1175 | + int idx; | |
| 1175 | 1176 | |
| 1176 | 1177 | if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN || |
| 1177 | 1178 | hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET || |
| @@ -1190,9 +1191,16 @@ void kvm_hv_invalidate_tsc_page(struct kvm *kvm) · 12 unmodified lines | ||
| 1190 | 1191 | gfn = hv->hv_tsc_page >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; |
| 1191 | 1192 | |
| 1192 | 1193 | hv->tsc_ref.tsc_sequence = 0; |
| 1194 | + | |
| 1195 | + /* | |
| 1196 | + * Take the srcu lock as memslots will be accessed to check the gfn | |
| 1197 | + * cache generation against the memslots generation. | |
| 1198 | + */ | |
| 1199 | + idx = srcu_read_lock(&kvm->srcu); | |
| 1193 | 1200 | if (kvm_write_guest(kvm, gfn_to_gpa(gfn), |
| 1194 | 1201 | &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence))) |
| 1195 | 1202 | hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN; |
| 1203 | + srcu_read_unlock(&kvm->srcu, idx); | |
| 1196 | 1204 | |
| 1197 | 1205 | out_unlock: |
| 1198 | 1206 | mutex_unlock(&hv->hv_lock); |
| @@ -314,7 +314,6 @@ struct x86_emulate_ctxt { · 313 unmodified lines | ||
| 314 | 314 | int interruptibility; |
| 315 | 315 | |
| 316 | 316 | bool perm_ok; /* do not check permissions if true */ |
| 317 | − bool ud; /* inject an #UD if host doesn't support insn */ | |
| 318 | 317 | bool tf; /* TF value before instruction (after for syscall/sysret) */ |
| 319 | 318 | |
| 320 | 319 | bool have_exception; |
| @@ -491,7 +490,7 @@ enum x86_intercept { · 170 unmodified lines | ||
| 491 | 490 | #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 |
| 492 | 491 | #endif |
| 493 | 492 | |
| 494 | −int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len); | |
| 493 | +int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len, int emulation_type); | |
| 495 | 494 | bool x86_page_table_writing_insn(struct x86_emulate_ctxt *ctxt); |
| 496 | 495 | #define EMULATION_FAILED -1 |
| 497 | 496 | #define EMULATION_OK 0 |
| @@ -1410,6 +1410,9 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len, · 1409 unmodified lines | ||
| 1410 | 1410 | if (!apic_x2apic_mode(apic)) |
| 1411 | 1411 | valid_reg_mask |= APIC_REG_MASK(APIC_ARBPRI); |
| 1412 | 1412 | |
| 1413 | + if (alignment + len > 4) | |
| 1414 | + return 1; | |
| 1415 | + | |
| 1413 | 1416 | if (offset > 0x3f0 || !(valid_reg_mask & APIC_REG_MASK(offset))) |
| 1414 | 1417 | return 1; |
| 1415 | 1418 | |
| @@ -1494,6 +1497,15 @@ static void limit_periodic_timer_frequency(struct kvm_lapic *apic) · 78 unmodified lines | ||
| 1494 | 1497 | |
| 1495 | 1498 | static void cancel_hv_timer(struct kvm_lapic *apic); |
| 1496 | 1499 | |
| 1500 | +static void cancel_apic_timer(struct kvm_lapic *apic) | |
| 1501 | +{ | |
| 1502 | + hrtimer_cancel(&apic->lapic_timer.timer); | |
| 1503 | + preempt_disable(); | |
| 1504 | + if (apic->lapic_timer.hv_timer_in_use) | |
| 1505 | + cancel_hv_timer(apic); | |
| 1506 | + preempt_enable(); | |
| 1507 | +} | |
| 1508 | + | |
| 1497 | 1509 | static void apic_update_lvtt(struct kvm_lapic *apic) |
| 1498 | 1510 | { |
| 1499 | 1511 | u32 timer_mode = kvm_lapic_get_reg(apic, APIC_LVTT) & |
| @@ -1502,11 +1514,7 @@ static void apic_update_lvtt(struct kvm_lapic *apic) · 2 unmodified lines | ||
| 1502 | 1514 | if (apic->lapic_timer.timer_mode != timer_mode) { |
| 1503 | 1515 | if (apic_lvtt_tscdeadline(apic) != (timer_mode == |
| 1504 | 1516 | APIC_LVT_TIMER_TSCDEADLINE)) { |
| 1505 | − hrtimer_cancel(&apic->lapic_timer.timer); | |
| 1506 | − preempt_disable(); | |
| 1507 | − if (apic->lapic_timer.hv_timer_in_use) | |
| 1508 | − cancel_hv_timer(apic); | |
| 1509 | − preempt_enable(); | |
| 1517 | + cancel_apic_timer(apic); | |
| 1510 | 1518 | kvm_lapic_set_reg(apic, APIC_TMICT, 0); |
| 1511 | 1519 | apic->lapic_timer.period = 0; |
| 1512 | 1520 | apic->lapic_timer.tscdeadline = 0; |
| @@ -1598,11 +1606,19 @@ static void __kvm_wait_lapic_expire(struct kvm_vcpu *vcpu) · 85 unmodified lines | ||
| 1598 | 1606 | guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc()); |
| 1599 | 1607 | apic->lapic_timer.advance_expire_delta = guest_tsc - tsc_deadline; |
| 1600 | 1608 | |
| 1609 | + if (lapic_timer_advance_dynamic) { | |
| 1610 | + adjust_lapic_timer_advance(vcpu, apic->lapic_timer.advance_expire_delta); | |
| 1611 | + /* | |
| 1612 | + * If the timer fired early, reread the TSC to account for the | |
| 1613 | + * overhead of the above adjustment to avoid waiting longer | |
| 1614 | + * than is necessary. | |
| 1615 | + */ | |
| 1616 | + if (guest_tsc < tsc_deadline) | |
| 1617 | + guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc()); | |
| 1618 | + } | |
| 1619 | + | |
| 1601 | 1620 | if (guest_tsc < tsc_deadline) |
| 1602 | 1621 | __wait_lapic_expire(vcpu, tsc_deadline - guest_tsc); |
| 1603 | − | |
| 1604 | − if (lapic_timer_advance_dynamic) | |
| 1605 | − adjust_lapic_timer_advance(vcpu, apic->lapic_timer.advance_expire_delta); | |
| 1606 | 1622 | } |
| 1607 | 1623 | |
| 1608 | 1624 | void kvm_wait_lapic_expire(struct kvm_vcpu *vcpu) |
| @@ -1661,7 +1677,7 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn) · 52 unmodified lines | ||
| 1661 | 1677 | } |
| 1662 | 1678 | |
| 1663 | 1679 | atomic_inc(&apic->lapic_timer.pending); |
| 1664 | − kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu); | |
| 1680 | + kvm_make_request(KVM_REQ_UNBLOCK, vcpu); | |
| 1665 | 1681 | if (from_timer_fn) |
| 1666 | 1682 | kvm_vcpu_kick(vcpu); |
| 1667 | 1683 | } |
| @@ -2084,7 +2100,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) · 416 unmodified lines | ||
| 2084 | 2100 | if (apic_lvtt_tscdeadline(apic)) |
| 2085 | 2101 | break; |
| 2086 | 2102 | |
| 2087 | − hrtimer_cancel(&apic->lapic_timer.timer); | |
| 2103 | + cancel_apic_timer(apic); | |
| 2088 | 2104 | kvm_lapic_set_reg(apic, APIC_TMICT, val); |
| 2089 | 2105 | start_apic_timer(apic); |
| 2090 | 2106 | break; |
| @@ -4739,9 +4739,33 @@ static void init_kvm_softmmu(struct kvm_vcpu *vcpu) · 4738 unmodified lines | ||
| 4739 | 4739 | context->inject_page_fault = kvm_inject_page_fault; |
| 4740 | 4740 | } |
| 4741 | 4741 | |
| 4742 | +static union kvm_mmu_role kvm_calc_nested_mmu_role(struct kvm_vcpu *vcpu) | |
| 4743 | +{ | |
| 4744 | + union kvm_mmu_role role = kvm_calc_shadow_root_page_role_common(vcpu, false); | |
| 4745 | + | |
| 4746 | + /* | |
| 4747 | + * Nested MMUs are used only for walking L2's gva->gpa, they never have | |
| 4748 | + * shadow pages of their own and so "direct" has no meaning. Set it | |
| 4749 | + * to "true" to try to detect bogus usage of the nested MMU. | |
| 4750 | + */ | |
| 4751 | + role.base.direct = true; | |
| 4752 | + | |
| 4753 | + if (!is_paging(vcpu)) | |
| 4754 | + role.base.level = 0; | |
| 4755 | + else if (is_long_mode(vcpu)) | |
| 4756 | + role.base.level = is_la57_mode(vcpu) ? PT64_ROOT_5LEVEL : | |
| 4757 | + PT64_ROOT_4LEVEL; | |
| 4758 | + else if (is_pae(vcpu)) | |
| 4759 | + role.base.level = PT32E_ROOT_LEVEL; | |
| 4760 | + else | |
| 4761 | + role.base.level = PT32_ROOT_LEVEL; | |
| 4762 | + | |
| 4763 | + return role; | |
| 4764 | +} | |
| 4765 | + | |
| 4742 | 4766 | static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu) |
| 4743 | 4767 | { |
| 4744 | − union kvm_mmu_role new_role = kvm_calc_mmu_role_common(vcpu, false); | |
| 4768 | + union kvm_mmu_role new_role = kvm_calc_nested_mmu_role(vcpu); | |
| 4745 | 4769 | struct kvm_mmu *g_context = &vcpu->arch.nested_mmu; |
| 4746 | 4770 | |
| 4747 | 4771 | if (new_role.as_u64 == g_context->mmu_role.as_u64) |
| @@ -90,8 +90,8 @@ struct guest_walker { · 89 unmodified lines | ||
| 90 | 90 | gpa_t pte_gpa[PT_MAX_FULL_LEVELS]; |
| 91 | 91 | pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS]; |
| 92 | 92 | bool pte_writable[PT_MAX_FULL_LEVELS]; |
| 93 | − unsigned pt_access; | |
| 94 | − unsigned pte_access; | |
| 93 | + unsigned int pt_access[PT_MAX_FULL_LEVELS]; | |
| 94 | + unsigned int pte_access; | |
| 95 | 95 | gfn_t gfn; |
| 96 | 96 | struct x86_exception fault; |
| 97 | 97 | }; |
| @@ -418,13 +418,15 @@ retry_walk: · 320 unmodified lines | ||
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | walker->ptes[walker->level - 1] = pte; |
| 421 | + | |
| 422 | + /* Convert to ACC_*_MASK flags for struct guest_walker. */ | |
| 423 | + walker->pt_access[walker->level - 1] = FNAME(gpte_access)(pt_access ^ walk_nx_mask); | |
| 421 | 424 | } while (!is_last_gpte(mmu, walker->level, pte)); |
| 422 | 425 | |
| 423 | 426 | pte_pkey = FNAME(gpte_pkeys)(vcpu, pte); |
| 424 | 427 | accessed_dirty = have_ad ? pte_access & PT_GUEST_ACCESSED_MASK : 0; |
| 425 | 428 | |
| 426 | 429 | /* Convert to ACC_*_MASK flags for struct guest_walker. */ |
| 427 | − walker->pt_access = FNAME(gpte_access)(pt_access ^ walk_nx_mask); | |
| 428 | 430 | walker->pte_access = FNAME(gpte_access)(pte_access ^ walk_nx_mask); |
| 429 | 431 | errcode = permission_fault(vcpu, mmu, walker->pte_access, pte_pkey, access); |
| 430 | 432 | if (unlikely(errcode)) |
| @@ -463,7 +465,8 @@ retry_walk: · 32 unmodified lines | ||
| 463 | 465 | } |
| 464 | 466 | |
| 465 | 467 | pgprintk("%s: pte %llx pte_access %x pt_access %x\n", |
| 466 | − __func__, (u64)pte, walker->pte_access, walker->pt_access); | |
| 468 | + __func__, (u64)pte, walker->pte_access, | |
| 469 | + walker->pt_access[walker->level - 1]); | |
| 467 | 470 | return 1; |
| 468 | 471 | |
| 469 | 472 | error: |
| @@ -643,7 +646,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr, · 173 unmodified lines | ||
| 643 | 646 | bool huge_page_disallowed = exec && nx_huge_page_workaround_enabled; |
| 644 | 647 | struct kvm_mmu_page *sp = NULL; |
| 645 | 648 | struct kvm_shadow_walk_iterator it; |
| 646 | − unsigned direct_access, access = gw->pt_access; | |
| 649 | + unsigned int direct_access, access; | |
| 647 | 650 | int top_level, level, req_level, ret; |
| 648 | 651 | gfn_t base_gfn = gw->gfn; |
| 649 | 652 | |
| @@ -675,6 +678,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr, · 25 unmodified lines | ||
| 675 | 678 | sp = NULL; |
| 676 | 679 | if (!is_shadow_present_pte(*it.sptep)) { |
| 677 | 680 | table_gfn = gw->table_gfn[it.level - 2]; |
| 681 | + access = gw->pt_access[it.level - 2]; | |
| 678 | 682 | sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1, |
| 679 | 683 | false, access); |
| 680 | 684 | } |
| @@ -1192,9 +1192,9 @@ bool kvm_tdp_mmu_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 1191 unmodified lines | ||
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | /* |
| 1195 | − * Remove write access from all the SPTEs mapping GFNs [start, end). If | |
| 1196 | − * skip_4k is set, SPTEs that map 4k pages, will not be write-protected. | |
| 1197 | − * Returns true if an SPTE has been changed and the TLBs need to be flushed. | |
| 1195 | + * Remove write access from all SPTEs at or above min_level that map GFNs | |
| 1196 | + * [start, end). Returns true if an SPTE has been changed and the TLBs need to | |
| 1197 | + * be flushed. | |
| 1198 | 1198 | */ |
| 1199 | 1199 | static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, |
| 1200 | 1200 | gfn_t start, gfn_t end, int min_level) |
| @@ -28,10 +28,8 @@ · 27 unmodified lines | ||
| 28 | 28 | #include "svm.h" |
| 29 | 29 | |
| 30 | 30 | /* enable / disable AVIC */ |
| 31 | −int avic; | |
| 32 | −#ifdef CONFIG_X86_LOCAL_APIC | |
| 33 | −module_param(avic, int, S_IRUGO); | |
| 34 | −#endif | |
| 31 | +bool avic; | |
| 32 | +module_param(avic, bool, S_IRUGO); | |
| 35 | 33 | |
| 36 | 34 | #define SVM_AVIC_DOORBELL 0xc001011b |
| 37 | 35 | |
| @@ -223,7 +221,7 @@ static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, · 185 unmodified lines | ||
| 223 | 221 | return &avic_physical_id_table[index]; |
| 224 | 222 | } |
| 225 | 223 | |
| 226 | −/** | |
| 224 | +/* | |
| 227 | 225 | * Note: |
| 228 | 226 | * AVIC hardware walks the nested page table to check permissions, |
| 229 | 227 | * but does not use the SPA address specified in the leaf page |
| @@ -766,7 +764,7 @@ out: · 536 unmodified lines | ||
| 766 | 764 | return ret; |
| 767 | 765 | } |
| 768 | 766 | |
| 769 | −/** | |
| 767 | +/* | |
| 770 | 768 | * Note: |
| 771 | 769 | * The HW cannot support posting multicast/broadcast |
| 772 | 770 | * interrupts to a vCPU. So, we still use legacy interrupt |
| @@ -1007,7 +1005,7 @@ void avic_vcpu_put(struct kvm_vcpu *vcpu) · 234 unmodified lines | ||
| 1007 | 1005 | WRITE_ONCE(*(svm->avic_physical_id_cache), entry); |
| 1008 | 1006 | } |
| 1009 | 1007 | |
| 1010 | −/** | |
| 1008 | +/* | |
| 1011 | 1009 | * This function is called during VCPU halt/unhalt. |
| 1012 | 1010 | */ |
| 1013 | 1011 | static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run) |
| @@ -199,9 +199,19 @@ static void sev_asid_free(struct kvm_sev_info *sev) · 198 unmodified lines | ||
| 199 | 199 | sev->misc_cg = NULL; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | −static void sev_unbind_asid(struct kvm *kvm, unsigned int handle) | |
| 202 | +static void sev_decommission(unsigned int handle) | |
| 203 | 203 | { |
| 204 | 204 | struct sev_data_decommission decommission; |
| 205 | + | |
| 206 | + if (!handle) | |
| 207 | + return; | |
| 208 | + | |
| 209 | + decommission.handle = handle; | |
| 210 | + sev_guest_decommission(&decommission, NULL); | |
| 211 | +} | |
| 212 | + | |
| 213 | +static void sev_unbind_asid(struct kvm *kvm, unsigned int handle) | |
| 214 | +{ | |
| 205 | 215 | struct sev_data_deactivate deactivate; |
| 206 | 216 | |
| 207 | 217 | if (!handle) |
| @@ -214,9 +224,7 @@ static void sev_unbind_asid(struct kvm *kvm, unsigned int handle) · 6 unmodified lines | ||
| 214 | 224 | sev_guest_deactivate(&deactivate, NULL); |
| 215 | 225 | up_read(&sev_deactivate_lock); |
| 216 | 226 | |
| 217 | − /* decommission handle */ | |
| 218 | − decommission.handle = handle; | |
| 219 | − sev_guest_decommission(&decommission, NULL); | |
| 227 | + sev_decommission(handle); | |
| 220 | 228 | } |
| 221 | 229 | |
| 222 | 230 | static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) |
| @@ -341,8 +349,10 @@ static int sev_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp) · 118 unmodified lines | ||
| 341 | 349 | |
| 342 | 350 | /* Bind ASID to this guest */ |
| 343 | 351 | ret = sev_bind_asid(kvm, start.handle, error); |
| 344 | − if (ret) | |
| 352 | + if (ret) { | |
| 353 | + sev_decommission(start.handle); | |
| 345 | 354 | goto e_free_session; |
| 355 | + } | |
| 346 | 356 | |
| 347 | 357 | /* return handle to userspace */ |
| 348 | 358 | params.handle = start.handle; |
| @@ -1103,10 +1113,9 @@ __sev_send_start_query_session_length(struct kvm *kvm, struct kvm_sev_cmd *argp, · 754 unmodified lines | ||
| 1103 | 1113 | struct sev_data_send_start data; |
| 1104 | 1114 | int ret; |
| 1105 | 1115 | |
| 1116 | + memset(&data, 0, sizeof(data)); | |
| 1106 | 1117 | data.handle = sev->handle; |
| 1107 | 1118 | ret = sev_issue_cmd(kvm, SEV_CMD_SEND_START, &data, &argp->error); |
| 1108 | − if (ret < 0) | |
| 1109 | − return ret; | |
| 1110 | 1119 | |
| 1111 | 1120 | params->session_len = data.session_len; |
| 1112 | 1121 | if (copy_to_user((void __user *)(uintptr_t)argp->data, params, |
| @@ -1215,10 +1224,9 @@ __sev_send_update_data_query_lengths(struct kvm *kvm, struct kvm_sev_cmd *argp, · 102 unmodified lines | ||
| 1215 | 1224 | struct sev_data_send_update_data data; |
| 1216 | 1225 | int ret; |
| 1217 | 1226 | |
| 1227 | + memset(&data, 0, sizeof(data)); | |
| 1218 | 1228 | data.handle = sev->handle; |
| 1219 | 1229 | ret = sev_issue_cmd(kvm, SEV_CMD_SEND_UPDATE_DATA, &data, &argp->error); |
| 1220 | − if (ret < 0) | |
| 1221 | − return ret; | |
| 1222 | 1230 | |
| 1223 | 1231 | params->hdr_len = data.hdr_len; |
| 1224 | 1232 | params->trans_len = data.trans_len; |
| @@ -1010,9 +1010,7 @@ static __init int svm_hardware_setup(void) · 1009 unmodified lines | ||
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | if (avic) { |
| 1013 | − if (!npt_enabled || | |
| 1014 | − !boot_cpu_has(X86_FEATURE_AVIC) || | |
| 1015 | − !IS_ENABLED(CONFIG_X86_LOCAL_APIC)) { | |
| 1013 | + if (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC)) { | |
| 1016 | 1014 | avic = false; |
| 1017 | 1015 | } else { |
| 1018 | 1016 | pr_info("AVIC enabled\n"); |
| @@ -480,7 +480,7 @@ extern struct kvm_x86_nested_ops svm_nested_ops; · 479 unmodified lines | ||
| 480 | 480 | |
| 481 | 481 | #define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL |
| 482 | 482 | |
| 483 | −extern int avic; | |
| 483 | +extern bool avic; | |
| 484 | 484 | |
| 485 | 485 | static inline void avic_update_vapic_bar(struct vcpu_svm *svm, u64 data) |
| 486 | 486 | { |
| @@ -1550,16 +1550,16 @@ TRACE_EVENT(kvm_nested_vmenter_failed, · 1549 unmodified lines | ||
| 1550 | 1550 | TP_ARGS(msg, err), |
| 1551 | 1551 | |
| 1552 | 1552 | TP_STRUCT__entry( |
| 1553 | − __field(const char *, msg) | |
| 1553 | + __string(msg, msg) | |
| 1554 | 1554 | __field(u32, err) |
| 1555 | 1555 | ), |
| 1556 | 1556 | |
| 1557 | 1557 | TP_fast_assign( |
| 1558 | − __entry->msg = msg; | |
| 1558 | + __assign_str(msg, msg); | |
| 1559 | 1559 | __entry->err = err; |
| 1560 | 1560 | ), |
| 1561 | 1561 | |
| 1562 | − TP_printk("%s%s", __entry->msg, !__entry->err ? "" : | |
| 1562 | + TP_printk("%s%s", __get_str(msg), !__entry->err ? "" : | |
| 1563 | 1563 | __print_symbolic(__entry->err, VMX_VMENTER_INSTRUCTION_ERRORS)) |
| 1564 | 1564 | ); |
| 1565 | 1565 | |
| @@ -90,8 +90,7 @@ static inline bool cpu_has_vmx_preemption_timer(void) · 89 unmodified lines | ||
| 90 | 90 | |
| 91 | 91 | static inline bool cpu_has_vmx_posted_intr(void) |
| 92 | 92 | { |
| 93 | − return IS_ENABLED(CONFIG_X86_LOCAL_APIC) && | |
| 94 | − vmcs_config.pin_based_exec_ctrl & PIN_BASED_POSTED_INTR; | |
| 93 | + return vmcs_config.pin_based_exec_ctrl & PIN_BASED_POSTED_INTR; | |
| 95 | 94 | } |
| 96 | 95 | |
| 97 | 96 | static inline bool cpu_has_load_ia32_efer(void) |
| @@ -237,6 +237,20 @@ bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu) · 236 unmodified lines | ||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
| 240 | +/* | |
| 241 | + * Bail out of the block loop if the VM has an assigned | |
| 242 | + * device, but the blocking vCPU didn't reconfigure the | |
| 243 | + * PI.NV to the wakeup vector, i.e. the assigned device | |
| 244 | + * came along after the initial check in pi_pre_block(). | |
| 245 | + */ | |
| 246 | +void vmx_pi_start_assignment(struct kvm *kvm) | |
| 247 | +{ | |
| 248 | + if (!irq_remapping_cap(IRQ_POSTING_CAP)) | |
| 249 | + return; | |
| 250 | + | |
| 251 | + kvm_make_all_cpus_request(kvm, KVM_REQ_UNBLOCK); | |
| 252 | +} | |
| 253 | + | |
| 240 | 254 | /* |
| 241 | 255 | * pi_update_irte - set IRTE for Posted-Interrupts |
| 242 | 256 | * |
| @@ -95,5 +95,6 @@ void __init pi_init_cpu(int cpu); · 94 unmodified lines | ||
| 95 | 95 | bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu); |
| 96 | 96 | int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq, |
| 97 | 97 | bool set); |
| 98 | +void vmx_pi_start_assignment(struct kvm *kvm); | |
| 98 | 99 | |
| 99 | 100 | #endif /* __KVM_X86_VMX_POSTED_INTR_H */ |
| @@ -4843,7 +4843,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) · 4842 unmodified lines | ||
| 4843 | 4843 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 4844 | 4844 | struct kvm_run *kvm_run = vcpu->run; |
| 4845 | 4845 | u32 intr_info, ex_no, error_code; |
| 4846 | − unsigned long cr2, rip, dr6; | |
| 4846 | + unsigned long cr2, dr6; | |
| 4847 | 4847 | u32 vect_info; |
| 4848 | 4848 | |
| 4849 | 4849 | vect_info = vmx->idt_vectoring_info; |
| @@ -4933,8 +4933,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) · 83 unmodified lines | ||
| 4933 | 4933 | vmx->vcpu.arch.event_exit_inst_len = |
| 4934 | 4934 | vmcs_read32(VM_EXIT_INSTRUCTION_LEN); |
| 4935 | 4935 | kvm_run->exit_reason = KVM_EXIT_DEBUG; |
| 4936 | − rip = kvm_rip_read(vcpu); | |
| 4937 | − kvm_run->debug.arch.pc = vmcs_readl(GUEST_CS_BASE) + rip; | |
| 4936 | + kvm_run->debug.arch.pc = kvm_get_linear_rip(vcpu); | |
| 4938 | 4937 | kvm_run->debug.arch.exception = ex_no; |
| 4939 | 4938 | break; |
| 4940 | 4939 | case AC_VECTOR: |
| @@ -6248,6 +6247,7 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu) · 1307 unmodified lines | ||
| 6248 | 6247 | switch (kvm_get_apic_mode(vcpu)) { |
| 6249 | 6248 | case LAPIC_MODE_INVALID: |
| 6250 | 6249 | WARN_ONCE(true, "Invalid local APIC state"); |
| 6250 | + break; | |
| 6251 | 6251 | case LAPIC_MODE_DISABLED: |
| 6252 | 6252 | break; |
| 6253 | 6253 | case LAPIC_MODE_XAPIC: |
| @@ -7721,6 +7721,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = { · 1467 unmodified lines | ||
| 7721 | 7721 | .nested_ops = &vmx_nested_ops, |
| 7722 | 7722 | |
| 7723 | 7723 | .update_pi_irte = pi_update_irte, |
| 7724 | + .start_assignment = vmx_pi_start_assignment, | |
| 7724 | 7725 | |
| 7725 | 7726 | #ifdef CONFIG_X86_64 |
| 7726 | 7727 | .set_hv_timer = vmx_set_hv_timer, |
| @@ -3072,6 +3072,19 @@ static void kvm_vcpu_flush_tlb_all(struct kvm_vcpu *vcpu) · 3071 unmodified lines | ||
| 3072 | 3072 | static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu) |
| 3073 | 3073 | { |
| 3074 | 3074 | ++vcpu->stat.tlb_flush; |
| 3075 | + | |
| 3076 | + if (!tdp_enabled) { | |
| 3077 | + /* | |
| 3078 | + * A TLB flush on behalf of the guest is equivalent to | |
| 3079 | + * INVPCID(all), toggling CR4.PGE, etc., which requires | |
| 3080 | + * a forced sync of the shadow page tables. Unload the | |
| 3081 | + * entire MMU here and the subsequent load will sync the | |
| 3082 | + * shadow page tables, and also flush the TLB. | |
| 3083 | + */ | |
| 3084 | + kvm_mmu_unload(vcpu); | |
| 3085 | + return; | |
| 3086 | + } | |
| 3087 | + | |
| 3075 | 3088 | static_call(kvm_x86_tlb_flush_guest)(vcpu); |
| 3076 | 3089 | } |
| 3077 | 3090 | |
| @@ -3101,10 +3114,14 @@ static void record_steal_time(struct kvm_vcpu *vcpu) · 23 unmodified lines | ||
| 3101 | 3114 | * expensive IPIs. |
| 3102 | 3115 | */ |
| 3103 | 3116 | if (guest_pv_has(vcpu, KVM_FEATURE_PV_TLB_FLUSH)) { |
| 3117 | + u8 st_preempted = xchg(&st->preempted, 0); | |
| 3118 | + | |
| 3104 | 3119 | trace_kvm_pv_tlb_flush(vcpu->vcpu_id, |
| 3105 | − st->preempted & KVM_VCPU_FLUSH_TLB); | |
| 3106 | − if (xchg(&st->preempted, 0) & KVM_VCPU_FLUSH_TLB) | |
| 3120 | + st_preempted & KVM_VCPU_FLUSH_TLB); | |
| 3121 | + if (st_preempted & KVM_VCPU_FLUSH_TLB) | |
| 3107 | 3122 | kvm_vcpu_flush_tlb_guest(vcpu); |
| 3123 | + } else { | |
| 3124 | + st->preempted = 0; | |
| 3108 | 3125 | } |
| 3109 | 3126 | |
| 3110 | 3127 | vcpu->arch.st.preempted = 0; |
| @@ -7089,7 +7106,10 @@ static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt) · 3978 unmodified lines | ||
| 7089 | 7106 | |
| 7090 | 7107 | static void emulator_set_hflags(struct x86_emulate_ctxt *ctxt, unsigned emul_flags) |
| 7091 | 7108 | { |
| 7092 | − emul_to_vcpu(ctxt)->arch.hflags = emul_flags; | |
| 7109 | + struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); | |
| 7110 | + | |
| 7111 | + vcpu->arch.hflags = emul_flags; | |
| 7112 | + kvm_mmu_reset_context(vcpu); | |
| 7093 | 7113 | } |
| 7094 | 7114 | |
| 7095 | 7115 | static int emulator_pre_leave_smm(struct x86_emulate_ctxt *ctxt, |
| @@ -7226,6 +7246,11 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) · 130 unmodified lines | ||
| 7226 | 7246 | BUILD_BUG_ON(HF_SMM_MASK != X86EMUL_SMM_MASK); |
| 7227 | 7247 | BUILD_BUG_ON(HF_SMM_INSIDE_NMI_MASK != X86EMUL_SMM_INSIDE_NMI_MASK); |
| 7228 | 7248 | |
| 7249 | + ctxt->interruptibility = 0; | |
| 7250 | + ctxt->have_exception = false; | |
| 7251 | + ctxt->exception.vector = -1; | |
| 7252 | + ctxt->perm_ok = false; | |
| 7253 | + | |
| 7229 | 7254 | init_decode_cache(ctxt); |
| 7230 | 7255 | vcpu->arch.emulate_regs_need_sync_from_vcpu = false; |
| 7231 | 7256 | } |
| @@ -7561,14 +7586,7 @@ int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type, · 329 unmodified lines | ||
| 7561 | 7586 | kvm_vcpu_check_breakpoint(vcpu, &r)) |
| 7562 | 7587 | return r; |
| 7563 | 7588 | |
| 7564 | − ctxt->interruptibility = 0; | |
| 7565 | − ctxt->have_exception = false; | |
| 7566 | − ctxt->exception.vector = -1; | |
| 7567 | − ctxt->perm_ok = false; | |
| 7568 | − | |
| 7569 | − ctxt->ud = emulation_type & EMULTYPE_TRAP_UD; | |
| 7570 | − | |
| 7571 | − r = x86_decode_insn(ctxt, insn, insn_len); | |
| 7589 | + r = x86_decode_insn(ctxt, insn, insn_len, emulation_type); | |
| 7572 | 7590 | |
| 7573 | 7591 | trace_kvm_emulate_insn_start(vcpu); |
| 7574 | 7592 | ++vcpu->stat.insn_emulation; |
| @@ -8243,6 +8261,7 @@ void kvm_arch_exit(void) · 668 unmodified lines | ||
| 8243 | 8261 | kvm_x86_ops.hardware_enable = NULL; |
| 8244 | 8262 | kvm_mmu_module_exit(); |
| 8245 | 8263 | free_percpu(user_return_msrs); |
| 8264 | + kmem_cache_destroy(x86_emulator_cache); | |
| 8246 | 8265 | kmem_cache_destroy(x86_fpu_cache); |
| 8247 | 8266 | #ifdef CONFIG_KVM_XEN |
| 8248 | 8267 | static_key_deferred_flush(&kvm_xen_enabled); |
| @@ -8360,6 +8379,9 @@ static void kvm_sched_yield(struct kvm_vcpu *vcpu, unsigned long dest_id) · 111 unmodified lines | ||
| 8360 | 8379 | |
| 8361 | 8380 | vcpu->stat.directed_yield_attempted++; |
| 8362 | 8381 | |
| 8382 | + if (single_task_running()) | |
| 8383 | + goto no_yield; | |
| 8384 | + | |
| 8363 | 8385 | rcu_read_lock(); |
| 8364 | 8386 | map = rcu_dereference(vcpu->kvm->arch.apic_map); |
| 8365 | 8387 | |
| @@ -9496,7 +9518,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu) · 1130 unmodified lines | ||
| 9496 | 9518 | if (r <= 0) |
| 9497 | 9519 | break; |
| 9498 | 9520 | |
| 9499 | − kvm_clear_request(KVM_REQ_PENDING_TIMER, vcpu); | |
| 9521 | + kvm_clear_request(KVM_REQ_UNBLOCK, vcpu); | |
| 9500 | 9522 | if (kvm_cpu_has_pending_timer(vcpu)) |
| 9501 | 9523 | kvm_inject_pending_timer_irqs(vcpu); |
| 9502 | 9524 | |
| @@ -10115,8 +10137,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, · 612 unmodified lines | ||
| 10115 | 10137 | kvm_update_dr7(vcpu); |
| 10116 | 10138 | |
| 10117 | 10139 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) |
| 10118 | − vcpu->arch.singlestep_rip = kvm_rip_read(vcpu) + | |
| 10119 | − get_segment_base(vcpu, VCPU_SREG_CS); | |
| 10140 | + vcpu->arch.singlestep_rip = kvm_get_linear_rip(vcpu); | |
| 10120 | 10141 | |
| 10121 | 10142 | /* |
| 10122 | 10143 | * Trigger an rflags update that will inject or remove the trace |
| @@ -11499,7 +11520,8 @@ bool kvm_arch_can_dequeue_async_page_present(struct kvm_vcpu *vcpu) · 1376 unmodified lines | ||
| 11499 | 11520 | |
| 11500 | 11521 | void kvm_arch_start_assignment(struct kvm *kvm) |
| 11501 | 11522 | { |
| 11502 | − atomic_inc(&kvm->arch.assigned_device_count); | |
| 11523 | + if (atomic_inc_return(&kvm->arch.assigned_device_count) == 1) | |
| 11524 | + static_call_cond(kvm_x86_start_assignment)(kvm); | |
| 11503 | 11525 | } |
| 11504 | 11526 | EXPORT_SYMBOL_GPL(kvm_arch_start_assignment); |
| 11505 | 11527 | |
| @@ -836,8 +836,8 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, · 835 unmodified lines | ||
| 836 | 836 | |
| 837 | 837 | if (si_code == SEGV_PKUERR) |
| 838 | 838 | force_sig_pkuerr((void __user *)address, pkey); |
| 839 | − | |
| 840 | − force_sig_fault(SIGSEGV, si_code, (void __user *)address); | |
| 839 | + else | |
| 840 | + force_sig_fault(SIGSEGV, si_code, (void __user *)address); | |
| 841 | 841 | |
| 842 | 842 | local_irq_disable(); |
| 843 | 843 | } |
| @@ -118,7 +118,9 @@ static void __ioremap_check_other(resource_size_t addr, struct ioremap_desc *des · 117 unmodified lines | ||
| 118 | 118 | if (!IS_ENABLED(CONFIG_EFI)) |
| 119 | 119 | return; |
| 120 | 120 | |
| 121 | − if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA) | |
| 121 | + if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA || | |
| 122 | + (efi_mem_type(addr) == EFI_BOOT_SERVICES_DATA && | |
| 123 | + efi_mem_attributes(addr) & EFI_MEMORY_RUNTIME)) | |
| 122 | 124 | desc->flags |= IORES_MAP_ENCRYPTED; |
| 123 | 125 | } |
| 124 | 126 | |
| @@ -504,10 +504,6 @@ void __init sme_enable(struct boot_params *bp) · 503 unmodified lines | ||
| 504 | 504 | #define AMD_SME_BIT BIT(0) |
| 505 | 505 | #define AMD_SEV_BIT BIT(1) |
| 506 | 506 | |
| 507 | − /* Check the SEV MSR whether SEV or SME is enabled */ | |
| 508 | − sev_status = __rdmsr(MSR_AMD64_SEV); | |
| 509 | − feature_mask = (sev_status & MSR_AMD64_SEV_ENABLED) ? AMD_SEV_BIT : AMD_SME_BIT; | |
| 510 | − | |
| 511 | 507 | /* |
| 512 | 508 | * Check for the SME/SEV feature: |
| 513 | 509 | * CPUID Fn8000_001F[EAX] |
| @@ -519,11 +515,16 @@ void __init sme_enable(struct boot_params *bp) · 5 unmodified lines | ||
| 519 | 515 | eax = 0x8000001f; |
| 520 | 516 | ecx = 0; |
| 521 | 517 | native_cpuid(&eax, &ebx, &ecx, &edx); |
| 522 | − if (!(eax & feature_mask)) | |
| 518 | + /* Check whether SEV or SME is supported */ | |
| 519 | + if (!(eax & (AMD_SEV_BIT | AMD_SME_BIT))) | |
| 523 | 520 | return; |
| 524 | 521 | |
| 525 | 522 | me_mask = 1UL << (ebx & 0x3f); |
| 526 | 523 | |
| 524 | + /* Check the SEV MSR whether SEV or SME is enabled */ | |
| 525 | + sev_status = __rdmsr(MSR_AMD64_SEV); | |
| 526 | + feature_mask = (sev_status & MSR_AMD64_SEV_ENABLED) ? AMD_SEV_BIT : AMD_SME_BIT; | |
| 527 | + | |
| 527 | 528 | /* Check if memory encryption is enabled */ |
| 528 | 529 | if (feature_mask == AMD_SME_BIT) { |
| 529 | 530 | /* |
| @@ -254,7 +254,13 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi) · 253 unmodified lines | ||
| 254 | 254 | |
| 255 | 255 | /* make sure all non-reserved blocks are inside the limits */ |
| 256 | 256 | bi->start = max(bi->start, low); |
| 257 | − bi->end = min(bi->end, high); | |
| 257 | + | |
| 258 | + /* preserve info for non-RAM areas above 'max_pfn': */ | |
| 259 | + if (bi->end > high) { | |
| 260 | + numa_add_memblk_to(bi->nid, high, bi->end, | |
| 261 | + &numa_reserved_meminfo); | |
| 262 | + bi->end = high; | |
| 263 | + } | |
| 258 | 264 | |
| 259 | 265 | /* and there's no empty block */ |
| 260 | 266 | if (bi->start >= bi->end) |
| @@ -779,4 +779,48 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar); · 778 unmodified lines | ||
| 779 | 779 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar); |
| 780 | 780 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar); |
| 781 | 781 | |
| 782 | +#define RS690_LOWER_TOP_OF_DRAM2 0x30 | |
| 783 | +#define RS690_LOWER_TOP_OF_DRAM2_VALID 0x1 | |
| 784 | +#define RS690_UPPER_TOP_OF_DRAM2 0x31 | |
| 785 | +#define RS690_HTIU_NB_INDEX 0xA8 | |
| 786 | +#define RS690_HTIU_NB_INDEX_WR_ENABLE 0x100 | |
| 787 | +#define RS690_HTIU_NB_DATA 0xAC | |
| 788 | + | |
| 789 | +/* | |
| 790 | + * Some BIOS implementations support RAM above 4GB, but do not configure the | |
| 791 | + * PCI host to respond to bus master accesses for these addresses. These | |
| 792 | + * implementations set the TOP_OF_DRAM_SLOT1 register correctly, so PCI DMA | |
| 793 | + * works as expected for addresses below 4GB. | |
| 794 | + * | |
| 795 | + * Reference: "AMD RS690 ASIC Family Register Reference Guide" (pg. 2-57) | |
| 796 | + * https://www.amd.com/system/files/TechDocs/43372_rs690_rrg_3.00o.pdf | |
| 797 | + */ | |
| 798 | +static void rs690_fix_64bit_dma(struct pci_dev *pdev) | |
| 799 | +{ | |
| 800 | + u32 val = 0; | |
| 801 | + phys_addr_t top_of_dram = __pa(high_memory - 1) + 1; | |
| 802 | + | |
| 803 | + if (top_of_dram <= (1ULL << 32)) | |
| 804 | + return; | |
| 805 | + | |
| 806 | + pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX, | |
| 807 | + RS690_LOWER_TOP_OF_DRAM2); | |
| 808 | + pci_read_config_dword(pdev, RS690_HTIU_NB_DATA, &val); | |
| 809 | + | |
| 810 | + if (val) | |
| 811 | + return; | |
| 812 | + | |
| 813 | + pci_info(pdev, "Adjusting top of DRAM to %pa for 64-bit DMA support\n", &top_of_dram); | |
| 814 | + | |
| 815 | + pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX, | |
| 816 | + RS690_UPPER_TOP_OF_DRAM2 | RS690_HTIU_NB_INDEX_WR_ENABLE); | |
| 817 | + pci_write_config_dword(pdev, RS690_HTIU_NB_DATA, top_of_dram >> 32); | |
| 818 | + | |
| 819 | + pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX, | |
| 820 | + RS690_LOWER_TOP_OF_DRAM2 | RS690_HTIU_NB_INDEX_WR_ENABLE); | |
| 821 | + pci_write_config_dword(pdev, RS690_HTIU_NB_DATA, | |
| 822 | + top_of_dram | RS690_LOWER_TOP_OF_DRAM2_VALID); | |
| 823 | +} | |
| 824 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7910, rs690_fix_64bit_dma); | |
| 825 | + | |
| 782 | 826 | #endif |
| @@ -450,6 +450,18 @@ void __init efi_free_boot_services(void) · 449 unmodified lines | ||
| 450 | 450 | size -= rm_size; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | + /* | |
| 454 | + * Don't free memory under 1M for two reasons: | |
| 455 | + * - BIOS might clobber it | |
| 456 | + * - Crash kernel needs it to be reserved | |
| 457 | + */ | |
| 458 | + if (start + size < SZ_1M) | |
| 459 | + continue; | |
| 460 | + if (start < SZ_1M) { | |
| 461 | + size -= (SZ_1M - start); | |
| 462 | + start = SZ_1M; | |
| 463 | + } | |
| 464 | + | |
| 453 | 465 | memblock_free_late(start, size); |
| 454 | 466 | } |
| 455 | 467 | |
| @@ -29,14 +29,16 @@ void __init reserve_real_mode(void) · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | /* Has to be under 1M so we can execute real-mode AP code. */ |
| 31 | 31 | mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE); |
| 32 | − if (!mem) { | |
| 32 | + if (!mem) | |
| 33 | 33 | pr_info("No sub-1M memory is available for the trampoline\n"); |
| 34 | − return; | |
| 35 | − } | |
| 34 | + else | |
| 35 | + set_real_mode_mem(mem); | |
| 36 | 36 | |
| 37 | − memblock_reserve(mem, size); | |
| 38 | − set_real_mode_mem(mem); | |
| 39 | − crash_reserve_low_1M(); | |
| 37 | + /* | |
| 38 | + * Unconditionally reserve the entire fisrt 1M, see comment in | |
| 39 | + * setup_arch(). | |
| 40 | + */ | |
| 41 | + memblock_reserve(0, SZ_1M); | |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | static void sme_sev_setup_real_mode(struct trampoline_header *th) |
| @@ -233,7 +233,8 @@ async_xor_offs(struct page *dest, unsigned int offset, · 232 unmodified lines | ||
| 233 | 233 | if (submit->flags & ASYNC_TX_XOR_DROP_DST) { |
| 234 | 234 | src_cnt--; |
| 235 | 235 | src_list++; |
| 236 | − src_offs++; | |
| 236 | + if (src_offs) | |
| 237 | + src_offs++; | |
| 237 | 238 | } |
| 238 | 239 | |
| 239 | 240 | /* wait for any prerequisite operations */ |
| @@ -226,6 +226,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = { · 225 unmodified lines | ||
| 226 | 226 | { "AMDI0010", APD_ADDR(wt_i2c_desc) }, |
| 227 | 227 | { "AMD0020", APD_ADDR(cz_uart_desc) }, |
| 228 | 228 | { "AMDI0020", APD_ADDR(cz_uart_desc) }, |
| 229 | + { "AMDI0022", APD_ADDR(cz_uart_desc) }, | |
| 229 | 230 | { "AMD0030", }, |
| 230 | 231 | { "AMD0040", APD_ADDR(fch_misc_desc)}, |
| 231 | 232 | { "HYGO0010", APD_ADDR(wt_i2c_desc) }, |
| @@ -285,6 +285,14 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) · 284 unmodified lines | ||
| 285 | 285 | } |
| 286 | 286 | break; |
| 287 | 287 | |
| 288 | + case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: | |
| 289 | + | |
| 290 | + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | |
| 291 | + "***** Address handler %p\n", object)); | |
| 292 | + | |
| 293 | + acpi_os_delete_mutex(object->address_space.context_mutex); | |
| 294 | + break; | |
| 295 | + | |
| 288 | 296 | default: |
| 289 | 297 | |
| 290 | 298 | break; |
| @@ -330,32 +330,21 @@ static void acpi_bus_osc_negotiate_platform_control(void) · 329 unmodified lines | ||
| 330 | 330 | if (ACPI_FAILURE(acpi_run_osc(handle, &context))) |
| 331 | 331 | return; |
| 332 | 332 | |
| 333 | − capbuf_ret = context.ret.pointer; | |
| 334 | − if (context.ret.length <= OSC_SUPPORT_DWORD) { | |
| 335 | − kfree(context.ret.pointer); | |
| 336 | − return; | |
| 337 | − } | |
| 333 | + kfree(context.ret.pointer); | |
| 338 | 334 | |
| 339 | − /* | |
| 340 | − * Now run _OSC again with query flag clear and with the caps | |
| 341 | − * supported by both the OS and the platform. | |
| 342 | − */ | |
| 335 | + /* Now run _OSC again with query flag clear */ | |
| 343 | 336 | capbuf[OSC_QUERY_DWORD] = 0; |
| 344 | − capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD]; | |
| 345 | − kfree(context.ret.pointer); | |
| 346 | 337 | |
| 347 | 338 | if (ACPI_FAILURE(acpi_run_osc(handle, &context))) |
| 348 | 339 | return; |
| 349 | 340 | |
| 350 | 341 | capbuf_ret = context.ret.pointer; |
| 351 | − if (context.ret.length > OSC_SUPPORT_DWORD) { | |
| 352 | − osc_sb_apei_support_acked = | |
| 353 | − capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; | |
| 354 | − osc_pc_lpi_support_confirmed = | |
| 355 | − capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT; | |
| 356 | − osc_sb_native_usb4_support_confirmed = | |
| 357 | − capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT; | |
| 358 | − } | |
| 342 | + osc_sb_apei_support_acked = | |
| 343 | + capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; | |
| 344 | + osc_pc_lpi_support_confirmed = | |
| 345 | + capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT; | |
| 346 | + osc_sb_native_usb4_support_confirmed = | |
| 347 | + capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT; | |
| 359 | 348 | |
| 360 | 349 | kfree(context.ret.pointer); |
| 361 | 350 | } |
| @@ -134,7 +134,7 @@ int acpi_power_init(void); · 133 unmodified lines | ||
| 134 | 134 | void acpi_power_resources_list_free(struct list_head *list); |
| 135 | 135 | int acpi_extract_power_resources(union acpi_object *package, unsigned int start, |
| 136 | 136 | struct list_head *list); |
| 137 | −int acpi_add_power_resource(acpi_handle handle); | |
| 137 | +struct acpi_device *acpi_add_power_resource(acpi_handle handle); | |
| 138 | 138 | void acpi_power_add_remove_device(struct acpi_device *adev, bool add); |
| 139 | 139 | int acpi_power_wakeup_list_init(struct list_head *list, int *system_level); |
| 140 | 140 | int acpi_device_sleep_wake(struct acpi_device *dev, |
| @@ -142,7 +142,7 @@ int acpi_device_sleep_wake(struct acpi_device *dev, · 1 unmodified line | ||
| 142 | 142 | int acpi_power_get_inferred_state(struct acpi_device *device, int *state); |
| 143 | 143 | int acpi_power_on_resources(struct acpi_device *device, int state); |
| 144 | 144 | int acpi_power_transition(struct acpi_device *device, int state); |
| 145 | −void acpi_turn_off_unused_power_resources(void); | |
| 145 | +void acpi_turn_off_unused_power_resources(bool init); | |
| 146 | 146 | |
| 147 | 147 | /* -------------------------------------------------------------------------- |
| 148 | 148 | Device Power Management |
| @@ -52,6 +52,7 @@ struct acpi_power_resource { · 51 unmodified lines | ||
| 52 | 52 | u32 system_level; |
| 53 | 53 | u32 order; |
| 54 | 54 | unsigned int ref_count; |
| 55 | + unsigned int users; | |
| 55 | 56 | bool wakeup_enabled; |
| 56 | 57 | struct mutex resource_lock; |
| 57 | 58 | struct list_head dependents; |
| @@ -147,6 +148,7 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start, · 89 unmodified lines | ||
| 147 | 148 | |
| 148 | 149 | for (i = start; i < package->package.count; i++) { |
| 149 | 150 | union acpi_object *element = &package->package.elements[i]; |
| 151 | + struct acpi_device *rdev; | |
| 150 | 152 | acpi_handle rhandle; |
| 151 | 153 | |
| 152 | 154 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { |
| @@ -163,13 +165,16 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start, · 10 unmodified lines | ||
| 163 | 165 | if (acpi_power_resource_is_dup(package, start, i)) |
| 164 | 166 | continue; |
| 165 | 167 | |
| 166 | − err = acpi_add_power_resource(rhandle); | |
| 167 | − if (err) | |
| 168 | + rdev = acpi_add_power_resource(rhandle); | |
| 169 | + if (!rdev) { | |
| 170 | + err = -ENODEV; | |
| 168 | 171 | break; |
| 169 | − | |
| 172 | + } | |
| 170 | 173 | err = acpi_power_resources_list_add(rhandle, list); |
| 171 | 174 | if (err) |
| 172 | 175 | break; |
| 176 | + | |
| 177 | + to_power_resource(rdev)->users++; | |
| 173 | 178 | } |
| 174 | 179 | if (err) |
| 175 | 180 | acpi_power_resources_list_free(list); |
| @@ -907,7 +912,7 @@ static void acpi_power_add_resource_to_list(struct acpi_power_resource *resource · 731 unmodified lines | ||
| 907 | 912 | mutex_unlock(&power_resource_list_lock); |
| 908 | 913 | } |
| 909 | 914 | |
| 910 | −int acpi_add_power_resource(acpi_handle handle) | |
| 915 | +struct acpi_device *acpi_add_power_resource(acpi_handle handle) | |
| 911 | 916 | { |
| 912 | 917 | struct acpi_power_resource *resource; |
| 913 | 918 | struct acpi_device *device = NULL; |
| @@ -918,11 +923,11 @@ int acpi_add_power_resource(acpi_handle handle) · 4 unmodified lines | ||
| 918 | 923 | |
| 919 | 924 | acpi_bus_get_device(handle, &device); |
| 920 | 925 | if (device) |
| 921 | − return 0; | |
| 926 | + return device; | |
| 922 | 927 | |
| 923 | 928 | resource = kzalloc(sizeof(*resource), GFP_KERNEL); |
| 924 | 929 | if (!resource) |
| 925 | − return -ENOMEM; | |
| 930 | + return NULL; | |
| 926 | 931 | |
| 927 | 932 | device = &resource->device; |
| 928 | 933 | acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER); |
| @@ -959,11 +964,11 @@ int acpi_add_power_resource(acpi_handle handle) · 30 unmodified lines | ||
| 959 | 964 | |
| 960 | 965 | acpi_power_add_resource_to_list(resource); |
| 961 | 966 | acpi_device_add_finalize(device); |
| 962 | − return 0; | |
| 967 | + return device; | |
| 963 | 968 | |
| 964 | 969 | err: |
| 965 | 970 | acpi_release_power_resource(&device->dev); |
| 966 | − return result; | |
| 971 | + return NULL; | |
| 967 | 972 | } |
| 968 | 973 | |
| 969 | 974 | #ifdef CONFIG_ACPI_SLEEP |
| @@ -997,7 +1002,38 @@ void acpi_resume_power_resources(void) · 27 unmodified lines | ||
| 997 | 1002 | } |
| 998 | 1003 | #endif |
| 999 | 1004 | |
| 1000 | −void acpi_turn_off_unused_power_resources(void) | |
| 1005 | +static void acpi_power_turn_off_if_unused(struct acpi_power_resource *resource, | |
| 1006 | + bool init) | |
| 1007 | +{ | |
| 1008 | + if (resource->ref_count > 0) | |
| 1009 | + return; | |
| 1010 | + | |
| 1011 | + if (init) { | |
| 1012 | + if (resource->users > 0) | |
| 1013 | + return; | |
| 1014 | + } else { | |
| 1015 | + int result, state; | |
| 1016 | + | |
| 1017 | + result = acpi_power_get_state(resource->device.handle, &state); | |
| 1018 | + if (result || state == ACPI_POWER_RESOURCE_STATE_OFF) | |
| 1019 | + return; | |
| 1020 | + } | |
| 1021 | + | |
| 1022 | + dev_info(&resource->device.dev, "Turning OFF\n"); | |
| 1023 | + __acpi_power_off(resource); | |
| 1024 | +} | |
| 1025 | + | |
| 1026 | +/** | |
| 1027 | + * acpi_turn_off_unused_power_resources - Turn off power resources not in use. | |
| 1028 | + * @init: Control switch. | |
| 1029 | + * | |
| 1030 | + * If @ainit is set, unconditionally turn off all of the ACPI power resources | |
| 1031 | + * without any users. | |
| 1032 | + * | |
| 1033 | + * Otherwise, turn off all ACPI power resources without active references (that | |
| 1034 | + * is, the ones that should be "off" at the moment) that are "on". | |
| 1035 | + */ | |
| 1036 | +void acpi_turn_off_unused_power_resources(bool init) | |
| 1001 | 1037 | { |
| 1002 | 1038 | struct acpi_power_resource *resource; |
| 1003 | 1039 | |
| @@ -1006,10 +1042,7 @@ void acpi_turn_off_unused_power_resources(void) · 2 unmodified lines | ||
| 1006 | 1042 | list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) { |
| 1007 | 1043 | mutex_lock(&resource->resource_lock); |
| 1008 | 1044 | |
| 1009 | − if (!resource->ref_count) { | |
| 1010 | − dev_info(&resource->device.dev, "Turning OFF\n"); | |
| 1011 | − __acpi_power_off(resource); | |
| 1012 | − } | |
| 1045 | + acpi_power_turn_off_if_unused(resource, init); | |
| 1013 | 1046 | |
| 1014 | 1047 | mutex_unlock(&resource->resource_lock); |
| 1015 | 1048 | } |
| @@ -2360,7 +2360,7 @@ int __init acpi_scan_init(void) · 2359 unmodified lines | ||
| 2360 | 2360 | } |
| 2361 | 2361 | } |
| 2362 | 2362 | |
| 2363 | − acpi_turn_off_unused_power_resources(); | |
| 2363 | + acpi_turn_off_unused_power_resources(true); | |
| 2364 | 2364 | |
| 2365 | 2365 | acpi_scan_initialized = true; |
| 2366 | 2366 | |
| @@ -504,7 +504,7 @@ static void acpi_pm_start(u32 acpi_state) · 503 unmodified lines | ||
| 504 | 504 | */ |
| 505 | 505 | static void acpi_pm_end(void) |
| 506 | 506 | { |
| 507 | − acpi_turn_off_unused_power_resources(); | |
| 507 | + acpi_turn_off_unused_power_resources(false); | |
| 508 | 508 | acpi_scan_lock_release(); |
| 509 | 509 | /* |
| 510 | 510 | * This is necessary in case acpi_pm_finish() is not called during a |
| @@ -1009,10 +1009,8 @@ static void acpi_sleep_hibernate_setup(void) · 498 unmodified lines | ||
| 1009 | 1009 | return; |
| 1010 | 1010 | |
| 1011 | 1011 | acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs); |
| 1012 | − if (facs) { | |
| 1012 | + if (facs) | |
| 1013 | 1013 | s4_hardware_signature = facs->hardware_signature; |
| 1014 | − acpi_put_table((struct acpi_table_header *)facs); | |
| 1015 | − } | |
| 1016 | 1014 | } |
| 1017 | 1015 | #else /* !CONFIG_HIBERNATION */ |
| 1018 | 1016 | static inline void acpi_sleep_hibernate_setup(void) {} |
| @@ -194,6 +194,17 @@ int device_links_read_lock_held(void) · 193 unmodified lines | ||
| 194 | 194 | { |
| 195 | 195 | return srcu_read_lock_held(&device_links_srcu); |
| 196 | 196 | } |
| 197 | + | |
| 198 | +static void device_link_synchronize_removal(void) | |
| 199 | +{ | |
| 200 | + synchronize_srcu(&device_links_srcu); | |
| 201 | +} | |
| 202 | + | |
| 203 | +static void device_link_remove_from_lists(struct device_link *link) | |
| 204 | +{ | |
| 205 | + list_del_rcu(&link->s_node); | |
| 206 | + list_del_rcu(&link->c_node); | |
| 207 | +} | |
| 197 | 208 | #else /* !CONFIG_SRCU */ |
| 198 | 209 | static DECLARE_RWSEM(device_links_lock); |
| 199 | 210 | |
| @@ -224,6 +235,16 @@ int device_links_read_lock_held(void) · 24 unmodified lines | ||
| 224 | 235 | return lockdep_is_held(&device_links_lock); |
| 225 | 236 | } |
| 226 | 237 | #endif |
| 238 | + | |
| 239 | +static inline void device_link_synchronize_removal(void) | |
| 240 | +{ | |
| 241 | +} | |
| 242 | + | |
| 243 | +static void device_link_remove_from_lists(struct device_link *link) | |
| 244 | +{ | |
| 245 | + list_del(&link->s_node); | |
| 246 | + list_del(&link->c_node); | |
| 247 | +} | |
| 227 | 248 | #endif /* !CONFIG_SRCU */ |
| 228 | 249 | |
| 229 | 250 | static bool device_is_ancestor(struct device *dev, struct device *target) |
| @@ -445,8 +466,13 @@ static struct attribute *devlink_attrs[] = { · 215 unmodified lines | ||
| 445 | 466 | }; |
| 446 | 467 | ATTRIBUTE_GROUPS(devlink); |
| 447 | 468 | |
| 448 | −static void device_link_free(struct device_link *link) | |
| 469 | +static void device_link_release_fn(struct work_struct *work) | |
| 449 | 470 | { |
| 471 | + struct device_link *link = container_of(work, struct device_link, rm_work); | |
| 472 | + | |
| 473 | + /* Ensure that all references to the link object have been dropped. */ | |
| 474 | + device_link_synchronize_removal(); | |
| 475 | + | |
| 450 | 476 | while (refcount_dec_not_one(&link->rpm_active)) |
| 451 | 477 | pm_runtime_put(link->supplier); |
| 452 | 478 | |
| @@ -455,24 +481,19 @@ static void device_link_free(struct device_link *link) · 2 unmodified lines | ||
| 455 | 481 | kfree(link); |
| 456 | 482 | } |
| 457 | 483 | |
| 458 | −#ifdef CONFIG_SRCU | |
| 459 | −static void __device_link_free_srcu(struct rcu_head *rhead) | |
| 460 | −{ | |
| 461 | − device_link_free(container_of(rhead, struct device_link, rcu_head)); | |
| 462 | −} | |
| 463 | − | |
| 464 | 484 | static void devlink_dev_release(struct device *dev) |
| 465 | 485 | { |
| 466 | 486 | struct device_link *link = to_devlink(dev); |
| 467 | 487 | |
| 468 | − call_srcu(&device_links_srcu, &link->rcu_head, __device_link_free_srcu); | |
| 469 | −} | |
| 470 | −#else | |
| 471 | −static void devlink_dev_release(struct device *dev) | |
| 472 | −{ | |
| 473 | − device_link_free(to_devlink(dev)); | |
| 488 | + INIT_WORK(&link->rm_work, device_link_release_fn); | |
| 489 | + /* | |
| 490 | + * It may take a while to complete this work because of the SRCU | |
| 491 | + * synchronization in device_link_release_fn() and if the consumer or | |
| 492 | + * supplier devices get deleted when it runs, so put it into the "long" | |
| 493 | + * workqueue. | |
| 494 | + */ | |
| 495 | + queue_work(system_long_wq, &link->rm_work); | |
| 474 | 496 | } |
| 475 | −#endif | |
| 476 | 497 | |
| 477 | 498 | static struct class devlink_class = { |
| 478 | 499 | .name = "devlink", |
| @@ -846,7 +867,6 @@ out: · 367 unmodified lines | ||
| 846 | 867 | } |
| 847 | 868 | EXPORT_SYMBOL_GPL(device_link_add); |
| 848 | 869 | |
| 849 | −#ifdef CONFIG_SRCU | |
| 850 | 870 | static void __device_link_del(struct kref *kref) |
| 851 | 871 | { |
| 852 | 872 | struct device_link *link = container_of(kref, struct device_link, kref); |
| @@ -856,25 +876,9 @@ static void __device_link_del(struct kref *kref) · 3 unmodified lines | ||
| 856 | 876 | |
| 857 | 877 | pm_runtime_drop_link(link); |
| 858 | 878 | |
| 859 | − list_del_rcu(&link->s_node); | |
| 860 | − list_del_rcu(&link->c_node); | |
| 861 | − device_unregister(&link->link_dev); | |
| 862 | −} | |
| 863 | −#else /* !CONFIG_SRCU */ | |
| 864 | −static void __device_link_del(struct kref *kref) | |
| 865 | −{ | |
| 866 | − struct device_link *link = container_of(kref, struct device_link, kref); | |
| 867 | − | |
| 868 | − dev_info(link->consumer, "Dropping the link to %s\n", | |
| 869 | − dev_name(link->supplier)); | |
| 870 | − | |
| 871 | − pm_runtime_drop_link(link); | |
| 872 | − | |
| 873 | − list_del(&link->s_node); | |
| 874 | − list_del(&link->c_node); | |
| 879 | + device_link_remove_from_lists(link); | |
| 875 | 880 | device_unregister(&link->link_dev); |
| 876 | 881 | } |
| 877 | −#endif /* !CONFIG_SRCU */ | |
| 878 | 882 | |
| 879 | 883 | static void device_link_put_kref(struct device_link *link) |
| 880 | 884 | { |
| @@ -218,14 +218,14 @@ static int memory_block_offline(struct memory_block *mem) · 217 unmodified lines | ||
| 218 | 218 | struct zone *zone; |
| 219 | 219 | int ret; |
| 220 | 220 | |
| 221 | − zone = page_zone(pfn_to_page(start_pfn)); | |
| 222 | − | |
| 223 | 221 | /* |
| 224 | 222 | * Unaccount before offlining, such that unpopulated zone and kthreads |
| 225 | 223 | * can properly be torn down in offline_pages(). |
| 226 | 224 | */ |
| 227 | − if (nr_vmemmap_pages) | |
| 225 | + if (nr_vmemmap_pages) { | |
| 226 | + zone = page_zone(pfn_to_page(start_pfn)); | |
| 228 | 227 | adjust_present_page_count(zone, -nr_vmemmap_pages); |
| 228 | + } | |
| 229 | 229 | |
| 230 | 230 | ret = offline_pages(start_pfn + nr_vmemmap_pages, |
| 231 | 231 | nr_pages - nr_vmemmap_pages); |
| @@ -1879,29 +1879,18 @@ static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode, · 1878 unmodified lines | ||
| 1879 | 1879 | |
| 1880 | 1880 | static int lo_open(struct block_device *bdev, fmode_t mode) |
| 1881 | 1881 | { |
| 1882 | − struct loop_device *lo; | |
| 1882 | + struct loop_device *lo = bdev->bd_disk->private_data; | |
| 1883 | 1883 | int err; |
| 1884 | 1884 | |
| 1885 | − /* | |
| 1886 | − * take loop_ctl_mutex to protect lo pointer from race with | |
| 1887 | − * loop_control_ioctl(LOOP_CTL_REMOVE), however, to reduce contention | |
| 1888 | − * release it prior to updating lo->lo_refcnt. | |
| 1889 | − */ | |
| 1890 | − err = mutex_lock_killable(&loop_ctl_mutex); | |
| 1891 | − if (err) | |
| 1892 | − return err; | |
| 1893 | − lo = bdev->bd_disk->private_data; | |
| 1894 | − if (!lo) { | |
| 1895 | − mutex_unlock(&loop_ctl_mutex); | |
| 1896 | − return -ENXIO; | |
| 1897 | − } | |
| 1898 | 1885 | err = mutex_lock_killable(&lo->lo_mutex); |
| 1899 | − mutex_unlock(&loop_ctl_mutex); | |
| 1900 | 1886 | if (err) |
| 1901 | 1887 | return err; |
| 1902 | − atomic_inc(&lo->lo_refcnt); | |
| 1888 | + if (lo->lo_state == Lo_deleting) | |
| 1889 | + err = -ENXIO; | |
| 1890 | + else | |
| 1891 | + atomic_inc(&lo->lo_refcnt); | |
| 1903 | 1892 | mutex_unlock(&lo->lo_mutex); |
| 1904 | − return 0; | |
| 1893 | + return err; | |
| 1905 | 1894 | } |
| 1906 | 1895 | |
| 1907 | 1896 | static void lo_release(struct gendisk *disk, fmode_t mode) |
| @@ -2285,7 +2274,7 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd, · 377 unmodified lines | ||
| 2285 | 2274 | mutex_unlock(&lo->lo_mutex); |
| 2286 | 2275 | break; |
| 2287 | 2276 | } |
| 2288 | − lo->lo_disk->private_data = NULL; | |
| 2277 | + lo->lo_state = Lo_deleting; | |
| 2289 | 2278 | mutex_unlock(&lo->lo_mutex); |
| 2290 | 2279 | idr_remove(&loop_index_idr, lo->lo_number); |
| 2291 | 2280 | loop_remove(lo); |
| @@ -22,6 +22,7 @@ enum { · 21 unmodified lines | ||
| 22 | 22 | Lo_unbound, |
| 23 | 23 | Lo_bound, |
| 24 | 24 | Lo_rundown, |
| 25 | + Lo_deleting, | |
| 25 | 26 | }; |
| 26 | 27 | |
| 27 | 28 | struct loop_func_table; |
| @@ -388,6 +388,8 @@ static const struct usb_device_id blacklist_table[] = { · 387 unmodified lines | ||
| 388 | 388 | /* Realtek 8822CE Bluetooth devices */ |
| 389 | 389 | { USB_DEVICE(0x0bda, 0xb00c), .driver_info = BTUSB_REALTEK | |
| 390 | 390 | BTUSB_WIDEBAND_SPEECH }, |
| 391 | + { USB_DEVICE(0x0bda, 0xc822), .driver_info = BTUSB_REALTEK | | |
| 392 | + BTUSB_WIDEBAND_SPEECH }, | |
| 391 | 393 | |
| 392 | 394 | /* Realtek 8852AE Bluetooth devices */ |
| 393 | 395 | { USB_DEVICE(0x0bda, 0xc852), .driver_info = BTUSB_REALTEK | |
| @@ -2527,10 +2529,17 @@ static int btusb_intel_download_firmware_newgen(struct hci_dev *hdev, · 2133 unmodified lines | ||
| 2527 | 2529 | } |
| 2528 | 2530 | |
| 2529 | 2531 | btusb_setup_intel_newgen_get_fw_name(ver, fwname, sizeof(fwname), "sfi"); |
| 2530 | − err = request_firmware(&fw, fwname, &hdev->dev); | |
| 2532 | + err = firmware_request_nowarn(&fw, fwname, &hdev->dev); | |
| 2531 | 2533 | if (err < 0) { |
| 2534 | + if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) { | |
| 2535 | + /* Firmware has already been loaded */ | |
| 2536 | + set_bit(BTUSB_FIRMWARE_LOADED, &data->flags); | |
| 2537 | + return 0; | |
| 2538 | + } | |
| 2539 | + | |
| 2532 | 2540 | bt_dev_err(hdev, "Failed to load Intel firmware file %s (%d)", |
| 2533 | 2541 | fwname, err); |
| 2542 | + | |
| 2534 | 2543 | return err; |
| 2535 | 2544 | } |
| 2536 | 2545 | |
| @@ -2680,12 +2689,24 @@ download: · 143 unmodified lines | ||
| 2680 | 2689 | err = btusb_setup_intel_new_get_fw_name(ver, params, fwname, |
| 2681 | 2690 | sizeof(fwname), "sfi"); |
| 2682 | 2691 | if (err < 0) { |
| 2692 | + if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) { | |
| 2693 | + /* Firmware has already been loaded */ | |
| 2694 | + set_bit(BTUSB_FIRMWARE_LOADED, &data->flags); | |
| 2695 | + return 0; | |
| 2696 | + } | |
| 2697 | + | |
| 2683 | 2698 | bt_dev_err(hdev, "Unsupported Intel firmware naming"); |
| 2684 | 2699 | return -EINVAL; |
| 2685 | 2700 | } |
| 2686 | 2701 | |
| 2687 | − err = request_firmware(&fw, fwname, &hdev->dev); | |
| 2702 | + err = firmware_request_nowarn(&fw, fwname, &hdev->dev); | |
| 2688 | 2703 | if (err < 0) { |
| 2704 | + if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) { | |
| 2705 | + /* Firmware has already been loaded */ | |
| 2706 | + set_bit(BTUSB_FIRMWARE_LOADED, &data->flags); | |
| 2707 | + return 0; | |
| 2708 | + } | |
| 2709 | + | |
| 2689 | 2710 | bt_dev_err(hdev, "Failed to load Intel firmware file %s (%d)", |
| 2690 | 2711 | fwname, err); |
| 2691 | 2712 | return err; |
| @@ -311,8 +311,8 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = { · 310 unmodified lines | ||
| 311 | 311 | MHI_CHANNEL_CONFIG_DL(5, "DIAG", 32, 1), |
| 312 | 312 | MHI_CHANNEL_CONFIG_UL(12, "MBIM", 32, 0), |
| 313 | 313 | MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0), |
| 314 | − MHI_CHANNEL_CONFIG_UL(32, "AT", 32, 0), | |
| 315 | − MHI_CHANNEL_CONFIG_DL(33, "AT", 32, 0), | |
| 314 | + MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0), | |
| 315 | + MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0), | |
| 316 | 316 | MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 128, 2), |
| 317 | 317 | MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3), |
| 318 | 318 | }; |
| @@ -708,7 +708,7 @@ static void mhi_pci_remove(struct pci_dev *pdev) · 389 unmodified lines | ||
| 708 | 708 | struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev); |
| 709 | 709 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 710 | 710 | |
| 711 | − del_timer(&mhi_pdev->health_check_timer); | |
| 711 | + del_timer_sync(&mhi_pdev->health_check_timer); | |
| 712 | 712 | cancel_work_sync(&mhi_pdev->recovery_work); |
| 713 | 713 | |
| 714 | 714 | if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { |
| @@ -935,9 +935,43 @@ static int __maybe_unused mhi_pci_resume(struct device *dev) · 220 unmodified lines | ||
| 935 | 935 | return ret; |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | +static int __maybe_unused mhi_pci_freeze(struct device *dev) | |
| 939 | +{ | |
| 940 | + struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev); | |
| 941 | + struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; | |
| 942 | + | |
| 943 | + /* We want to stop all operations, hibernation does not guarantee that | |
| 944 | + * device will be in the same state as before freezing, especially if | |
| 945 | + * the intermediate restore kernel reinitializes MHI device with new | |
| 946 | + * context. | |
| 947 | + */ | |
| 948 | + if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { | |
| 949 | + mhi_power_down(mhi_cntrl, false); | |
| 950 | + mhi_unprepare_after_power_down(mhi_cntrl); | |
| 951 | + } | |
| 952 | + | |
| 953 | + return 0; | |
| 954 | +} | |
| 955 | + | |
| 956 | +static int __maybe_unused mhi_pci_restore(struct device *dev) | |
| 957 | +{ | |
| 958 | + struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev); | |
| 959 | + | |
| 960 | + /* Reinitialize the device */ | |
| 961 | + queue_work(system_long_wq, &mhi_pdev->recovery_work); | |
| 962 | + | |
| 963 | + return 0; | |
| 964 | +} | |
| 965 | + | |
| 938 | 966 | static const struct dev_pm_ops mhi_pci_pm_ops = { |
| 939 | 967 | SET_RUNTIME_PM_OPS(mhi_pci_runtime_suspend, mhi_pci_runtime_resume, NULL) |
| 940 | − SET_SYSTEM_SLEEP_PM_OPS(mhi_pci_suspend, mhi_pci_resume) | |
| 968 | +#ifdef CONFIG_PM_SLEEP | |
| 969 | + .suspend = mhi_pci_suspend, | |
| 970 | + .resume = mhi_pci_resume, | |
| 971 | + .freeze = mhi_pci_freeze, | |
| 972 | + .thaw = mhi_pci_restore, | |
| 973 | + .restore = mhi_pci_restore, | |
| 974 | +#endif | |
| 941 | 975 | }; |
| 942 | 976 | |
| 943 | 977 | static struct pci_driver mhi_pci_driver = { |
| @@ -1334,6 +1334,34 @@ err_allow_idle: · 1333 unmodified lines | ||
| 1334 | 1334 | return error; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | +static int sysc_reinit_module(struct sysc *ddata, bool leave_enabled) | |
| 1338 | +{ | |
| 1339 | + struct device *dev = ddata->dev; | |
| 1340 | + int error; | |
| 1341 | + | |
| 1342 | + /* Disable target module if it is enabled */ | |
| 1343 | + if (ddata->enabled) { | |
| 1344 | + error = sysc_runtime_suspend(dev); | |
| 1345 | + if (error) | |
| 1346 | + dev_warn(dev, "reinit suspend failed: %i\n", error); | |
| 1347 | + } | |
| 1348 | + | |
| 1349 | + /* Enable target module */ | |
| 1350 | + error = sysc_runtime_resume(dev); | |
| 1351 | + if (error) | |
| 1352 | + dev_warn(dev, "reinit resume failed: %i\n", error); | |
| 1353 | + | |
| 1354 | + if (leave_enabled) | |
| 1355 | + return error; | |
| 1356 | + | |
| 1357 | + /* Disable target module if no leave_enabled was set */ | |
| 1358 | + error = sysc_runtime_suspend(dev); | |
| 1359 | + if (error) | |
| 1360 | + dev_warn(dev, "reinit suspend failed: %i\n", error); | |
| 1361 | + | |
| 1362 | + return error; | |
| 1363 | +} | |
| 1364 | + | |
| 1337 | 1365 | static int __maybe_unused sysc_noirq_suspend(struct device *dev) |
| 1338 | 1366 | { |
| 1339 | 1367 | struct sysc *ddata; |
| @@ -1344,12 +1372,18 @@ static int __maybe_unused sysc_noirq_suspend(struct device *dev) · 4 unmodified lines | ||
| 1344 | 1372 | (SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE)) |
| 1345 | 1373 | return 0; |
| 1346 | 1374 | |
| 1347 | − return pm_runtime_force_suspend(dev); | |
| 1375 | + if (!ddata->enabled) | |
| 1376 | + return 0; | |
| 1377 | + | |
| 1378 | + ddata->needs_resume = 1; | |
| 1379 | + | |
| 1380 | + return sysc_runtime_suspend(dev); | |
| 1348 | 1381 | } |
| 1349 | 1382 | |
| 1350 | 1383 | static int __maybe_unused sysc_noirq_resume(struct device *dev) |
| 1351 | 1384 | { |
| 1352 | 1385 | struct sysc *ddata; |
| 1386 | + int error = 0; | |
| 1353 | 1387 | |
| 1354 | 1388 | ddata = dev_get_drvdata(dev); |
| 1355 | 1389 | |
| @@ -1357,7 +1391,19 @@ static int __maybe_unused sysc_noirq_resume(struct device *dev) · 1 unmodified line | ||
| 1357 | 1391 | (SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE)) |
| 1358 | 1392 | return 0; |
| 1359 | 1393 | |
| 1360 | − return pm_runtime_force_resume(dev); | |
| 1394 | + if (ddata->cfg.quirks & SYSC_QUIRK_REINIT_ON_RESUME) { | |
| 1395 | + error = sysc_reinit_module(ddata, ddata->needs_resume); | |
| 1396 | + if (error) | |
| 1397 | + dev_warn(dev, "noirq_resume failed: %i\n", error); | |
| 1398 | + } else if (ddata->needs_resume) { | |
| 1399 | + error = sysc_runtime_resume(dev); | |
| 1400 | + if (error) | |
| 1401 | + dev_warn(dev, "noirq_resume failed: %i\n", error); | |
| 1402 | + } | |
| 1403 | + | |
| 1404 | + ddata->needs_resume = 0; | |
| 1405 | + | |
| 1406 | + return error; | |
| 1361 | 1407 | } |
| 1362 | 1408 | |
| 1363 | 1409 | static const struct dev_pm_ops sysc_pm_ops = { |
| @@ -1408,9 +1454,9 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 44 unmodified lines | ||
| 1408 | 1454 | SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), |
| 1409 | 1455 | /* Uarts on omap4 and later */ |
| 1410 | 1456 | SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff, |
| 1411 | − SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), | |
| 1457 | + SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), | |
| 1412 | 1458 | SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff, |
| 1413 | − SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), | |
| 1459 | + SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), | |
| 1414 | 1460 | |
| 1415 | 1461 | /* Quirks that need to be set based on the module address */ |
| 1416 | 1462 | SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff, |
| @@ -1459,6 +1505,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 42 unmodified lines | ||
| 1459 | 1505 | SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
| 1460 | 1506 | SYSC_QUIRK("tptc", 0, 0, -ENODEV, -ENODEV, 0x40007c00, 0xffffffff, |
| 1461 | 1507 | SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
| 1508 | + SYSC_QUIRK("sata", 0, 0xfc, 0x1100, -ENODEV, 0x5e412000, 0xffffffff, | |
| 1509 | + SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), | |
| 1462 | 1510 | SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, |
| 1463 | 1511 | SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
| 1464 | 1512 | SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff, |
| @@ -1466,7 +1514,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 1 unmodified line | ||
| 1466 | 1514 | SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, |
| 1467 | 1515 | 0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
| 1468 | 1516 | SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -ENODEV, 0x4ea2080d, 0xffffffff, |
| 1469 | − SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), | |
| 1517 | + SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY | | |
| 1518 | + SYSC_QUIRK_REINIT_ON_RESUME), | |
| 1470 | 1519 | SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0, |
| 1471 | 1520 | SYSC_MODULE_QUIRK_WDT), |
| 1472 | 1521 | /* PRUSS on am3, am4 and am5 */ |
| @@ -1524,7 +1573,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 51 unmodified lines | ||
| 1524 | 1573 | SYSC_QUIRK("prcm", 0, 0, -ENODEV, -ENODEV, 0x40000400, 0xffffffff, 0), |
| 1525 | 1574 | SYSC_QUIRK("rfbi", 0x4832a800, 0, 0x10, 0x14, 0x00000010, 0xffffffff, 0), |
| 1526 | 1575 | SYSC_QUIRK("rfbi", 0x58002000, 0, 0x10, 0x14, 0x00000010, 0xffffffff, 0), |
| 1527 | − SYSC_QUIRK("sata", 0, 0xfc, 0x1100, -ENODEV, 0x5e412000, 0xffffffff, 0), | |
| 1528 | 1576 | SYSC_QUIRK("scm", 0, 0, 0x10, -ENODEV, 0x40000900, 0xffffffff, 0), |
| 1529 | 1577 | SYSC_QUIRK("scm", 0, 0, -ENODEV, -ENODEV, 0x4e8b0100, 0xffffffff, 0), |
| 1530 | 1578 | SYSC_QUIRK("scm", 0, 0, -ENODEV, -ENODEV, 0x4f000100, 0xffffffff, 0), |
| @@ -19,16 +19,6 @@ config ACPI_CPPC_CPUFREQ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | If in doubt, say N. |
| 21 | 21 | |
| 22 | −config ACPI_CPPC_CPUFREQ_FIE | |
| 23 | − bool "Frequency Invariance support for CPPC cpufreq driver" | |
| 24 | − depends on ACPI_CPPC_CPUFREQ && GENERIC_ARCH_TOPOLOGY | |
| 25 | − default y | |
| 26 | − help | |
| 27 | − This extends frequency invariance support in the CPPC cpufreq driver, | |
| 28 | − by using CPPC delivered and reference performance counters. | |
| 29 | − | |
| 30 | − If in doubt, say N. | |
| 31 | − | |
| 32 | 22 | config ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM |
| 33 | 23 | tristate "Allwinner nvmem based SUN50I CPUFreq driver" |
| 34 | 24 | depends on ARCH_SUNXI |
| @@ -10,18 +10,14 @@ · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | #define pr_fmt(fmt) "CPPC Cpufreq:" fmt |
| 12 | 12 | |
| 13 | −#include <linux/arch_topology.h> | |
| 14 | 13 | #include <linux/kernel.h> |
| 15 | 14 | #include <linux/module.h> |
| 16 | 15 | #include <linux/delay.h> |
| 17 | 16 | #include <linux/cpu.h> |
| 18 | 17 | #include <linux/cpufreq.h> |
| 19 | 18 | #include <linux/dmi.h> |
| 20 | −#include <linux/irq_work.h> | |
| 21 | −#include <linux/kthread.h> | |
| 22 | 19 | #include <linux/time.h> |
| 23 | 20 | #include <linux/vmalloc.h> |
| 24 | −#include <uapi/linux/sched/types.h> | |
| 25 | 21 | |
| 26 | 22 | #include <asm/unaligned.h> |
| 27 | 23 | |
| @@ -61,204 +57,6 @@ static struct cppc_workaround_oem_info wa_info[] = { · 33 unmodified lines | ||
| 61 | 57 | } |
| 62 | 58 | }; |
| 63 | 59 | |
| 64 | −#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE | |
| 65 | − | |
| 66 | −/* Frequency invariance support */ | |
| 67 | −struct cppc_freq_invariance { | |
| 68 | − int cpu; | |
| 69 | − struct irq_work irq_work; | |
| 70 | − struct kthread_work work; | |
| 71 | − struct cppc_perf_fb_ctrs prev_perf_fb_ctrs; | |
| 72 | − struct cppc_cpudata *cpu_data; | |
| 73 | −}; | |
| 74 | − | |
| 75 | −static DEFINE_PER_CPU(struct cppc_freq_invariance, cppc_freq_inv); | |
| 76 | −static struct kthread_worker *kworker_fie; | |
| 77 | −static bool fie_disabled; | |
| 78 | − | |
| 79 | −static struct cpufreq_driver cppc_cpufreq_driver; | |
| 80 | −static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu); | |
| 81 | −static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data, | |
| 82 | − struct cppc_perf_fb_ctrs fb_ctrs_t0, | |
| 83 | − struct cppc_perf_fb_ctrs fb_ctrs_t1); | |
| 84 | − | |
| 85 | −/** | |
| 86 | − * cppc_scale_freq_workfn - CPPC arch_freq_scale updater for frequency invariance | |
| 87 | − * @work: The work item. | |
| 88 | − * | |
| 89 | − * The CPPC driver register itself with the topology core to provide its own | |
| 90 | − * implementation (cppc_scale_freq_tick()) of topology_scale_freq_tick() which | |
| 91 | − * gets called by the scheduler on every tick. | |
| 92 | − * | |
| 93 | − * Note that the arch specific counters have higher priority than CPPC counters, | |
| 94 | − * if available, though the CPPC driver doesn't need to have any special | |
| 95 | − * handling for that. | |
| 96 | − * | |
| 97 | − * On an invocation of cppc_scale_freq_tick(), we schedule an irq work (since we | |
| 98 | − * reach here from hard-irq context), which then schedules a normal work item | |
| 99 | − * and cppc_scale_freq_workfn() updates the per_cpu arch_freq_scale variable | |
| 100 | − * based on the counter updates since the last tick. | |
| 101 | − */ | |
| 102 | −static void cppc_scale_freq_workfn(struct kthread_work *work) | |
| 103 | −{ | |
| 104 | − struct cppc_freq_invariance *cppc_fi; | |
| 105 | − struct cppc_perf_fb_ctrs fb_ctrs = {0}; | |
| 106 | − struct cppc_cpudata *cpu_data; | |
| 107 | − unsigned long local_freq_scale; | |
| 108 | − u64 perf; | |
| 109 | − | |
| 110 | − cppc_fi = container_of(work, struct cppc_freq_invariance, work); | |
| 111 | − cpu_data = cppc_fi->cpu_data; | |
| 112 | − | |
| 113 | − if (cppc_get_perf_ctrs(cppc_fi->cpu, &fb_ctrs)) { | |
| 114 | − pr_warn("%s: failed to read perf counters\n", __func__); | |
| 115 | − return; | |
| 116 | − } | |
| 117 | − | |
| 118 | − cppc_fi->prev_perf_fb_ctrs = fb_ctrs; | |
| 119 | − perf = cppc_perf_from_fbctrs(cpu_data, cppc_fi->prev_perf_fb_ctrs, | |
| 120 | − fb_ctrs); | |
| 121 | − | |
| 122 | − perf <<= SCHED_CAPACITY_SHIFT; | |
| 123 | − local_freq_scale = div64_u64(perf, cpu_data->perf_caps.highest_perf); | |
| 124 | − if (WARN_ON(local_freq_scale > 1024)) | |
| 125 | − local_freq_scale = 1024; | |
| 126 | − | |
| 127 | − per_cpu(arch_freq_scale, cppc_fi->cpu) = local_freq_scale; | |
| 128 | −} | |
| 129 | − | |
| 130 | −static void cppc_irq_work(struct irq_work *irq_work) | |
| 131 | −{ | |
| 132 | − struct cppc_freq_invariance *cppc_fi; | |
| 133 | − | |
| 134 | − cppc_fi = container_of(irq_work, struct cppc_freq_invariance, irq_work); | |
| 135 | − kthread_queue_work(kworker_fie, &cppc_fi->work); | |
| 136 | −} | |
| 137 | − | |
| 138 | −static void cppc_scale_freq_tick(void) | |
| 139 | −{ | |
| 140 | − struct cppc_freq_invariance *cppc_fi = &per_cpu(cppc_freq_inv, smp_processor_id()); | |
| 141 | − | |
| 142 | − /* | |
| 143 | − * cppc_get_perf_ctrs() can potentially sleep, call that from the right | |
| 144 | − * context. | |
| 145 | − */ | |
| 146 | − irq_work_queue(&cppc_fi->irq_work); | |
| 147 | −} | |
| 148 | − | |
| 149 | −static struct scale_freq_data cppc_sftd = { | |
| 150 | − .source = SCALE_FREQ_SOURCE_CPPC, | |
| 151 | − .set_freq_scale = cppc_scale_freq_tick, | |
| 152 | −}; | |
| 153 | − | |
| 154 | −static void cppc_freq_invariance_policy_init(struct cpufreq_policy *policy, | |
| 155 | − struct cppc_cpudata *cpu_data) | |
| 156 | −{ | |
| 157 | − struct cppc_perf_fb_ctrs fb_ctrs = {0}; | |
| 158 | − struct cppc_freq_invariance *cppc_fi; | |
| 159 | − int i, ret; | |
| 160 | − | |
| 161 | − if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate) | |
| 162 | − return; | |
| 163 | − | |
| 164 | − if (fie_disabled) | |
| 165 | − return; | |
| 166 | − | |
| 167 | − for_each_cpu(i, policy->cpus) { | |
| 168 | − cppc_fi = &per_cpu(cppc_freq_inv, i); | |
| 169 | − cppc_fi->cpu = i; | |
| 170 | − cppc_fi->cpu_data = cpu_data; | |
| 171 | − kthread_init_work(&cppc_fi->work, cppc_scale_freq_workfn); | |
| 172 | − init_irq_work(&cppc_fi->irq_work, cppc_irq_work); | |
| 173 | − | |
| 174 | − ret = cppc_get_perf_ctrs(i, &fb_ctrs); | |
| 175 | − if (ret) { | |
| 176 | − pr_warn("%s: failed to read perf counters: %d\n", | |
| 177 | − __func__, ret); | |
| 178 | − fie_disabled = true; | |
| 179 | − } else { | |
| 180 | − cppc_fi->prev_perf_fb_ctrs = fb_ctrs; | |
| 181 | − } | |
| 182 | − } | |
| 183 | −} | |
| 184 | − | |
| 185 | −static void __init cppc_freq_invariance_init(void) | |
| 186 | −{ | |
| 187 | − struct sched_attr attr = { | |
| 188 | − .size = sizeof(struct sched_attr), | |
| 189 | − .sched_policy = SCHED_DEADLINE, | |
| 190 | − .sched_nice = 0, | |
| 191 | − .sched_priority = 0, | |
| 192 | − /* | |
| 193 | − * Fake (unused) bandwidth; workaround to "fix" | |
| 194 | − * priority inheritance. | |
| 195 | − */ | |
| 196 | − .sched_runtime = 1000000, | |
| 197 | − .sched_deadline = 10000000, | |
| 198 | − .sched_period = 10000000, | |
| 199 | − }; | |
| 200 | − int ret; | |
| 201 | − | |
| 202 | − if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate) | |
| 203 | − return; | |
| 204 | − | |
| 205 | − if (fie_disabled) | |
| 206 | − return; | |
| 207 | − | |
| 208 | − kworker_fie = kthread_create_worker(0, "cppc_fie"); | |
| 209 | − if (IS_ERR(kworker_fie)) | |
| 210 | − return; | |
| 211 | − | |
| 212 | − ret = sched_setattr_nocheck(kworker_fie->task, &attr); | |
| 213 | − if (ret) { | |
| 214 | − pr_warn("%s: failed to set SCHED_DEADLINE: %d\n", __func__, | |
| 215 | − ret); | |
| 216 | − kthread_destroy_worker(kworker_fie); | |
| 217 | − return; | |
| 218 | − } | |
| 219 | − | |
| 220 | − /* Register for freq-invariance */ | |
| 221 | − topology_set_scale_freq_source(&cppc_sftd, cpu_present_mask); | |
| 222 | −} | |
| 223 | − | |
| 224 | −static void cppc_freq_invariance_exit(void) | |
| 225 | −{ | |
| 226 | − struct cppc_freq_invariance *cppc_fi; | |
| 227 | − int i; | |
| 228 | − | |
| 229 | − if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate) | |
| 230 | − return; | |
| 231 | − | |
| 232 | − if (fie_disabled) | |
| 233 | − return; | |
| 234 | − | |
| 235 | − topology_clear_scale_freq_source(SCALE_FREQ_SOURCE_CPPC, cpu_present_mask); | |
| 236 | − | |
| 237 | − for_each_possible_cpu(i) { | |
| 238 | − cppc_fi = &per_cpu(cppc_freq_inv, i); | |
| 239 | − irq_work_sync(&cppc_fi->irq_work); | |
| 240 | − } | |
| 241 | − | |
| 242 | − kthread_destroy_worker(kworker_fie); | |
| 243 | − kworker_fie = NULL; | |
| 244 | −} | |
| 245 | − | |
| 246 | −#else | |
| 247 | −static inline void | |
| 248 | −cppc_freq_invariance_policy_init(struct cpufreq_policy *policy, | |
| 249 | − struct cppc_cpudata *cpu_data) | |
| 250 | −{ | |
| 251 | −} | |
| 252 | − | |
| 253 | −static inline void cppc_freq_invariance_init(void) | |
| 254 | −{ | |
| 255 | −} | |
| 256 | − | |
| 257 | −static inline void cppc_freq_invariance_exit(void) | |
| 258 | −{ | |
| 259 | −} | |
| 260 | −#endif /* CONFIG_ACPI_CPPC_CPUFREQ_FIE */ | |
| 261 | − | |
| 262 | 60 | /* Callback function used to retrieve the max frequency from DMI */ |
| 263 | 61 | static void cppc_find_dmi_mhz(const struct dmi_header *dm, void *private) |
| 264 | 62 | { |
| @@ -547,12 +345,9 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) · 282 unmodified lines | ||
| 547 | 345 | cpu_data->perf_ctrls.desired_perf = caps->highest_perf; |
| 548 | 346 | |
| 549 | 347 | ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls); |
| 550 | − if (ret) { | |
| 348 | + if (ret) | |
| 551 | 349 | pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", |
| 552 | 350 | caps->highest_perf, cpu, ret); |
| 553 | − } else { | |
| 554 | − cppc_freq_invariance_policy_init(policy, cpu_data); | |
| 555 | − } | |
| 556 | 351 | |
| 557 | 352 | return ret; |
| 558 | 353 | } |
| @@ -565,12 +360,12 @@ static inline u64 get_delta(u64 t1, u64 t0) · 6 unmodified lines | ||
| 565 | 360 | return (u32)t1 - (u32)t0; |
| 566 | 361 | } |
| 567 | 362 | |
| 568 | −static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data, | |
| 569 | − struct cppc_perf_fb_ctrs fb_ctrs_t0, | |
| 570 | − struct cppc_perf_fb_ctrs fb_ctrs_t1) | |
| 363 | +static int cppc_get_rate_from_fbctrs(struct cppc_cpudata *cpu_data, | |
| 364 | + struct cppc_perf_fb_ctrs fb_ctrs_t0, | |
| 365 | + struct cppc_perf_fb_ctrs fb_ctrs_t1) | |
| 571 | 366 | { |
| 572 | 367 | u64 delta_reference, delta_delivered; |
| 573 | − u64 reference_perf; | |
| 368 | + u64 reference_perf, delivered_perf; | |
| 574 | 369 | |
| 575 | 370 | reference_perf = fb_ctrs_t0.reference_perf; |
| 576 | 371 | |
| @@ -579,21 +374,12 @@ static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data, · 2 unmodified lines | ||
| 579 | 374 | delta_delivered = get_delta(fb_ctrs_t1.delivered, |
| 580 | 375 | fb_ctrs_t0.delivered); |
| 581 | 376 | |
| 582 | − /* Check to avoid divide-by zero and invalid delivered_perf */ | |
| 583 | − if (!delta_reference || !delta_delivered) | |
| 584 | − return cpu_data->perf_ctrls.desired_perf; | |
| 585 | − | |
| 586 | − return (reference_perf * delta_delivered) / delta_reference; | |
| 587 | −} | |
| 588 | − | |
| 589 | −static int cppc_get_rate_from_fbctrs(struct cppc_cpudata *cpu_data, | |
| 590 | − struct cppc_perf_fb_ctrs fb_ctrs_t0, | |
| 591 | − struct cppc_perf_fb_ctrs fb_ctrs_t1) | |
| 592 | −{ | |
| 593 | − u64 delivered_perf; | |
| 594 | − | |
| 595 | − delivered_perf = cppc_perf_from_fbctrs(cpu_data, fb_ctrs_t0, | |
| 596 | − fb_ctrs_t1); | |
| 377 | + /* Check to avoid divide-by zero */ | |
| 378 | + if (delta_reference || delta_delivered) | |
| 379 | + delivered_perf = (reference_perf * delta_delivered) / | |
| 380 | + delta_reference; | |
| 381 | + else | |
| 382 | + delivered_perf = cpu_data->perf_ctrls.desired_perf; | |
| 597 | 383 | |
| 598 | 384 | return cppc_cpufreq_perf_to_khz(cpu_data, delivered_perf); |
| 599 | 385 | } |
| @@ -718,8 +504,6 @@ static void cppc_check_hisi_workaround(void) · 118 unmodified lines | ||
| 718 | 504 | |
| 719 | 505 | static int __init cppc_cpufreq_init(void) |
| 720 | 506 | { |
| 721 | − int ret; | |
| 722 | − | |
| 723 | 507 | if ((acpi_disabled) || !acpi_cpc_valid()) |
| 724 | 508 | return -ENODEV; |
| 725 | 509 | |
| @@ -727,11 +511,7 @@ static int __init cppc_cpufreq_init(void) · 1 unmodified line | ||
| 727 | 511 | |
| 728 | 512 | cppc_check_hisi_workaround(); |
| 729 | 513 | |
| 730 | − ret = cpufreq_register_driver(&cppc_cpufreq_driver); | |
| 731 | − if (!ret) | |
| 732 | − cppc_freq_invariance_init(); | |
| 733 | − | |
| 734 | − return ret; | |
| 514 | + return cpufreq_register_driver(&cppc_cpufreq_driver); | |
| 735 | 515 | } |
| 736 | 516 | |
| 737 | 517 | static inline void free_cpu_data(void) |
| @@ -748,7 +528,6 @@ static inline void free_cpu_data(void) · 10 unmodified lines | ||
| 748 | 528 | |
| 749 | 529 | static void __exit cppc_cpufreq_exit(void) |
| 750 | 530 | { |
| 751 | − cppc_freq_invariance_exit(); | |
| 752 | 531 | cpufreq_unregister_driver(&cppc_cpufreq_driver); |
| 753 | 532 | |
| 754 | 533 | free_cpu_data(); |
| @@ -59,6 +59,7 @@ config DMA_OF · 58 unmodified lines | ||
| 59 | 59 | #devices |
| 60 | 60 | config ALTERA_MSGDMA |
| 61 | 61 | tristate "Altera / Intel mSGDMA Engine" |
| 62 | + depends on HAS_IOMEM | |
| 62 | 63 | select DMA_ENGINE |
| 63 | 64 | help |
| 64 | 65 | Enable support for Altera / Intel mSGDMA controller. |
| @@ -701,6 +702,7 @@ config XILINX_ZYNQMP_DMA · 636 unmodified lines | ||
| 701 | 702 | |
| 702 | 703 | config XILINX_ZYNQMP_DPDMA |
| 703 | 704 | tristate "Xilinx DPDMA Engine" |
| 705 | + depends on HAS_IOMEM && OF | |
| 704 | 706 | select DMA_ENGINE |
| 705 | 707 | select DMA_VIRTUAL_CHANNELS |
| 706 | 708 | help |
| @@ -332,6 +332,7 @@ static int __cold dpaa2_qdma_setup(struct fsl_mc_device *ls_dev) · 331 unmodified lines | ||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | if (priv->dpdmai_attr.version.major > DPDMAI_VER_MAJOR) { |
| 335 | + err = -EINVAL; | |
| 335 | 336 | dev_err(dev, "DPDMAI major version mismatch\n" |
| 336 | 337 | "Found %u.%u, supported version is %u.%u\n", |
| 337 | 338 | priv->dpdmai_attr.version.major, |
| @@ -341,6 +342,7 @@ static int __cold dpaa2_qdma_setup(struct fsl_mc_device *ls_dev) · 3 unmodified lines | ||
| 341 | 342 | } |
| 342 | 343 | |
| 343 | 344 | if (priv->dpdmai_attr.version.minor > DPDMAI_VER_MINOR) { |
| 345 | + err = -EINVAL; | |
| 344 | 346 | dev_err(dev, "DPDMAI minor version mismatch\n" |
| 345 | 347 | "Found %u.%u, supported version is %u.%u\n", |
| 346 | 348 | priv->dpdmai_attr.version.major, |
| @@ -475,6 +477,7 @@ static int __cold dpaa2_qdma_dpio_setup(struct dpaa2_qdma_priv *priv) · 128 unmodified lines | ||
| 475 | 477 | ppriv->store = |
| 476 | 478 | dpaa2_io_store_create(DPAA2_QDMA_STORE_SIZE, dev); |
| 477 | 479 | if (!ppriv->store) { |
| 480 | + err = -ENOMEM; | |
| 478 | 481 | dev_err(dev, "dpaa2_io_store_create() failed\n"); |
| 479 | 482 | goto err_store; |
| 480 | 483 | } |
| @@ -110,6 +110,7 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp) · 109 unmodified lines | ||
| 110 | 110 | pasid = iommu_sva_get_pasid(sva); |
| 111 | 111 | if (pasid == IOMMU_PASID_INVALID) { |
| 112 | 112 | iommu_sva_unbind_device(sva); |
| 113 | + rc = -EINVAL; | |
| 113 | 114 | goto failed; |
| 114 | 115 | } |
| 115 | 116 | |
| @@ -168,6 +168,32 @@ static int idxd_setup_interrupts(struct idxd_device *idxd) · 167 unmodified lines | ||
| 168 | 168 | return rc; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | +static void idxd_cleanup_interrupts(struct idxd_device *idxd) | |
| 172 | +{ | |
| 173 | + struct pci_dev *pdev = idxd->pdev; | |
| 174 | + struct idxd_irq_entry *irq_entry; | |
| 175 | + int i, msixcnt; | |
| 176 | + | |
| 177 | + msixcnt = pci_msix_vec_count(pdev); | |
| 178 | + if (msixcnt <= 0) | |
| 179 | + return; | |
| 180 | + | |
| 181 | + irq_entry = &idxd->irq_entries[0]; | |
| 182 | + free_irq(irq_entry->vector, irq_entry); | |
| 183 | + | |
| 184 | + for (i = 1; i < msixcnt; i++) { | |
| 185 | + | |
| 186 | + irq_entry = &idxd->irq_entries[i]; | |
| 187 | + if (idxd->hw.cmd_cap & BIT(IDXD_CMD_RELEASE_INT_HANDLE)) | |
| 188 | + idxd_device_release_int_handle(idxd, idxd->int_handles[i], | |
| 189 | + IDXD_IRQ_MSIX); | |
| 190 | + free_irq(irq_entry->vector, irq_entry); | |
| 191 | + } | |
| 192 | + | |
| 193 | + idxd_mask_error_interrupts(idxd); | |
| 194 | + pci_free_irq_vectors(pdev); | |
| 195 | +} | |
| 196 | + | |
| 171 | 197 | static int idxd_setup_wqs(struct idxd_device *idxd) |
| 172 | 198 | { |
| 173 | 199 | struct device *dev = &idxd->pdev->dev; |
| @@ -242,6 +268,7 @@ static int idxd_setup_engines(struct idxd_device *idxd) · 68 unmodified lines | ||
| 242 | 268 | engine->idxd = idxd; |
| 243 | 269 | device_initialize(&engine->conf_dev); |
| 244 | 270 | engine->conf_dev.parent = &idxd->conf_dev; |
| 271 | + engine->conf_dev.bus = &dsa_bus_type; | |
| 245 | 272 | engine->conf_dev.type = &idxd_engine_device_type; |
| 246 | 273 | rc = dev_set_name(&engine->conf_dev, "engine%d.%d", idxd->id, engine->id); |
| 247 | 274 | if (rc < 0) { |
| @@ -303,6 +330,19 @@ static int idxd_setup_groups(struct idxd_device *idxd) · 55 unmodified lines | ||
| 303 | 330 | return rc; |
| 304 | 331 | } |
| 305 | 332 | |
| 333 | +static void idxd_cleanup_internals(struct idxd_device *idxd) | |
| 334 | +{ | |
| 335 | + int i; | |
| 336 | + | |
| 337 | + for (i = 0; i < idxd->max_groups; i++) | |
| 338 | + put_device(&idxd->groups[i]->conf_dev); | |
| 339 | + for (i = 0; i < idxd->max_engines; i++) | |
| 340 | + put_device(&idxd->engines[i]->conf_dev); | |
| 341 | + for (i = 0; i < idxd->max_wqs; i++) | |
| 342 | + put_device(&idxd->wqs[i]->conf_dev); | |
| 343 | + destroy_workqueue(idxd->wq); | |
| 344 | +} | |
| 345 | + | |
| 306 | 346 | static int idxd_setup_internals(struct idxd_device *idxd) |
| 307 | 347 | { |
| 308 | 348 | struct device *dev = &idxd->pdev->dev; |
| @@ -531,12 +571,12 @@ static int idxd_probe(struct idxd_device *idxd) · 222 unmodified lines | ||
| 531 | 571 | dev_dbg(dev, "Loading RO device config\n"); |
| 532 | 572 | rc = idxd_device_load_config(idxd); |
| 533 | 573 | if (rc < 0) |
| 534 | − goto err; | |
| 574 | + goto err_config; | |
| 535 | 575 | } |
| 536 | 576 | |
| 537 | 577 | rc = idxd_setup_interrupts(idxd); |
| 538 | 578 | if (rc) |
| 539 | − goto err; | |
| 579 | + goto err_config; | |
| 540 | 580 | |
| 541 | 581 | dev_dbg(dev, "IDXD interrupt setup complete.\n"); |
| 542 | 582 | |
| @@ -549,6 +589,8 @@ static int idxd_probe(struct idxd_device *idxd) · 6 unmodified lines | ||
| 549 | 589 | dev_dbg(dev, "IDXD device %d probed successfully\n", idxd->id); |
| 550 | 590 | return 0; |
| 551 | 591 | |
| 592 | + err_config: | |
| 593 | + idxd_cleanup_internals(idxd); | |
| 552 | 594 | err: |
| 553 | 595 | if (device_pasid_enabled(idxd)) |
| 554 | 596 | idxd_disable_system_pasid(idxd); |
| @@ -556,6 +598,18 @@ static int idxd_probe(struct idxd_device *idxd) · 1 unmodified line | ||
| 556 | 598 | return rc; |
| 557 | 599 | } |
| 558 | 600 | |
| 601 | +static void idxd_cleanup(struct idxd_device *idxd) | |
| 602 | +{ | |
| 603 | + struct device *dev = &idxd->pdev->dev; | |
| 604 | + | |
| 605 | + perfmon_pmu_remove(idxd); | |
| 606 | + idxd_cleanup_interrupts(idxd); | |
| 607 | + idxd_cleanup_internals(idxd); | |
| 608 | + if (device_pasid_enabled(idxd)) | |
| 609 | + idxd_disable_system_pasid(idxd); | |
| 610 | + iommu_dev_disable_feature(dev, IOMMU_DEV_FEAT_SVA); | |
| 611 | +} | |
| 612 | + | |
| 559 | 613 | static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
| 560 | 614 | { |
| 561 | 615 | struct device *dev = &pdev->dev; |
| @@ -608,7 +662,7 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 46 unmodified lines | ||
| 608 | 662 | rc = idxd_register_devices(idxd); |
| 609 | 663 | if (rc) { |
| 610 | 664 | dev_err(dev, "IDXD sysfs setup failed\n"); |
| 611 | − goto err; | |
| 665 | + goto err_dev_register; | |
| 612 | 666 | } |
| 613 | 667 | |
| 614 | 668 | idxd->state = IDXD_DEV_CONF_READY; |
| @@ -618,6 +672,8 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 3 unmodified lines | ||
| 618 | 672 | |
| 619 | 673 | return 0; |
| 620 | 674 | |
| 675 | + err_dev_register: | |
| 676 | + idxd_cleanup(idxd); | |
| 621 | 677 | err: |
| 622 | 678 | pci_iounmap(pdev, idxd->reg_base); |
| 623 | 679 | err_iomap: |
| @@ -745,12 +801,12 @@ static int __init idxd_init_module(void) · 121 unmodified lines | ||
| 745 | 801 | * If the CPU does not support MOVDIR64B or ENQCMDS, there's no point in |
| 746 | 802 | * enumerating the device. We can not utilize it. |
| 747 | 803 | */ |
| 748 | − if (!boot_cpu_has(X86_FEATURE_MOVDIR64B)) { | |
| 804 | + if (!cpu_feature_enabled(X86_FEATURE_MOVDIR64B)) { | |
| 749 | 805 | pr_warn("idxd driver failed to load without MOVDIR64B.\n"); |
| 750 | 806 | return -ENODEV; |
| 751 | 807 | } |
| 752 | 808 | |
| 753 | − if (!boot_cpu_has(X86_FEATURE_ENQCMD)) | |
| 809 | + if (!cpu_feature_enabled(X86_FEATURE_ENQCMD)) | |
| 754 | 810 | pr_warn("Platform does not have ENQCMD(S) support.\n"); |
| 755 | 811 | else |
| 756 | 812 | support_enqcmd = true; |
| @@ -787,6 +843,7 @@ module_init(idxd_init_module); · 30 unmodified lines | ||
| 787 | 843 | |
| 788 | 844 | static void __exit idxd_exit_module(void) |
| 789 | 845 | { |
| 846 | + idxd_unregister_driver(); | |
| 790 | 847 | pci_unregister_driver(&idxd_pci_driver); |
| 791 | 848 | idxd_cdev_remove(); |
| 792 | 849 | idxd_unregister_bus_type(); |
| @@ -230,7 +230,7 @@ out: · 229 unmodified lines | ||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | − * ipu_irq_map() - map an IPU interrupt source to an IRQ number | |
| 233 | + * ipu_irq_unmap() - unmap an IPU interrupt source | |
| 234 | 234 | * @source: interrupt source bit position (see ipu_irq_map()) |
| 235 | 235 | * @return: 0 or negative error code |
| 236 | 236 | */ |
| @@ -131,10 +131,7 @@ static unsigned int mtk_uart_apdma_read(struct mtk_chan *c, unsigned int reg) · 130 unmodified lines | ||
| 131 | 131 | |
| 132 | 132 | static void mtk_uart_apdma_desc_free(struct virt_dma_desc *vd) |
| 133 | 133 | { |
| 134 | − struct dma_chan *chan = vd->tx.chan; | |
| 135 | − struct mtk_chan *c = to_mtk_uart_apdma_chan(chan); | |
| 136 | − | |
| 137 | − kfree(c->desc); | |
| 134 | + kfree(container_of(vd, struct mtk_uart_apdma_desc, vd)); | |
| 138 | 135 | } |
| 139 | 136 | |
| 140 | 137 | static void mtk_uart_apdma_start_tx(struct mtk_chan *c) |
| @@ -207,14 +204,9 @@ static void mtk_uart_apdma_start_rx(struct mtk_chan *c) · 66 unmodified lines | ||
| 207 | 204 | |
| 208 | 205 | static void mtk_uart_apdma_tx_handler(struct mtk_chan *c) |
| 209 | 206 | { |
| 210 | − struct mtk_uart_apdma_desc *d = c->desc; | |
| 211 | − | |
| 212 | 207 | mtk_uart_apdma_write(c, VFF_INT_FLAG, VFF_TX_INT_CLR_B); |
| 213 | 208 | mtk_uart_apdma_write(c, VFF_INT_EN, VFF_INT_EN_CLR_B); |
| 214 | 209 | mtk_uart_apdma_write(c, VFF_EN, VFF_EN_CLR_B); |
| 215 | − | |
| 216 | − list_del(&d->vd.node); | |
| 217 | − vchan_cookie_complete(&d->vd); | |
| 218 | 210 | } |
| 219 | 211 | |
| 220 | 212 | static void mtk_uart_apdma_rx_handler(struct mtk_chan *c) |
| @@ -245,9 +237,17 @@ static void mtk_uart_apdma_rx_handler(struct mtk_chan *c) · 24 unmodified lines | ||
| 245 | 237 | |
| 246 | 238 | c->rx_status = d->avail_len - cnt; |
| 247 | 239 | mtk_uart_apdma_write(c, VFF_RPT, wg); |
| 240 | +} | |
| 248 | 241 | |
| 249 | − list_del(&d->vd.node); | |
| 250 | − vchan_cookie_complete(&d->vd); | |
| 242 | +static void mtk_uart_apdma_chan_complete_handler(struct mtk_chan *c) | |
| 243 | +{ | |
| 244 | + struct mtk_uart_apdma_desc *d = c->desc; | |
| 245 | + | |
| 246 | + if (d) { | |
| 247 | + list_del(&d->vd.node); | |
| 248 | + vchan_cookie_complete(&d->vd); | |
| 249 | + c->desc = NULL; | |
| 250 | + } | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | static irqreturn_t mtk_uart_apdma_irq_handler(int irq, void *dev_id) |
| @@ -261,6 +261,7 @@ static irqreturn_t mtk_uart_apdma_irq_handler(int irq, void *dev_id) · 7 unmodified lines | ||
| 261 | 261 | mtk_uart_apdma_rx_handler(c); |
| 262 | 262 | else if (c->dir == DMA_MEM_TO_DEV) |
| 263 | 263 | mtk_uart_apdma_tx_handler(c); |
| 264 | + mtk_uart_apdma_chan_complete_handler(c); | |
| 264 | 265 | spin_unlock_irqrestore(&c->vc.lock, flags); |
| 265 | 266 | |
| 266 | 267 | return IRQ_HANDLED; |
| @@ -348,7 +349,7 @@ static struct dma_async_tx_descriptor *mtk_uart_apdma_prep_slave_sg · 81 unmodified lines | ||
| 348 | 349 | return NULL; |
| 349 | 350 | |
| 350 | 351 | /* Now allocate and setup the descriptor */ |
| 351 | − d = kzalloc(sizeof(*d), GFP_ATOMIC); | |
| 352 | + d = kzalloc(sizeof(*d), GFP_NOWAIT); | |
| 352 | 353 | if (!d) |
| 353 | 354 | return NULL; |
| 354 | 355 | |
| @@ -366,7 +367,7 @@ static void mtk_uart_apdma_issue_pending(struct dma_chan *chan) · 11 unmodified lines | ||
| 366 | 367 | unsigned long flags; |
| 367 | 368 | |
| 368 | 369 | spin_lock_irqsave(&c->vc.lock, flags); |
| 369 | − if (vchan_issue_pending(&c->vc)) { | |
| 370 | + if (vchan_issue_pending(&c->vc) && !c->desc) { | |
| 370 | 371 | vd = vchan_next_desc(&c->vc); |
| 371 | 372 | c->desc = to_mtk_uart_apdma_desc(&vd->tx); |
| 372 | 373 | |
| @@ -2694,13 +2694,15 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( · 2693 unmodified lines | ||
| 2694 | 2694 | for (i = 0; i < len / period_len; i++) { |
| 2695 | 2695 | desc = pl330_get_desc(pch); |
| 2696 | 2696 | if (!desc) { |
| 2697 | + unsigned long iflags; | |
| 2698 | + | |
| 2697 | 2699 | dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n", |
| 2698 | 2700 | __func__, __LINE__); |
| 2699 | 2701 | |
| 2700 | 2702 | if (!first) |
| 2701 | 2703 | return NULL; |
| 2702 | 2704 | |
| 2703 | − spin_lock_irqsave(&pl330->pool_lock, flags); | |
| 2705 | + spin_lock_irqsave(&pl330->pool_lock, iflags); | |
| 2704 | 2706 | |
| 2705 | 2707 | while (!list_empty(&first->node)) { |
| 2706 | 2708 | desc = list_entry(first->node.next, |
| @@ -2710,7 +2712,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( · 3 unmodified lines | ||
| 2710 | 2712 | |
| 2711 | 2713 | list_move_tail(&first->node, &pl330->desc_pool); |
| 2712 | 2714 | |
| 2713 | − spin_unlock_irqrestore(&pl330->pool_lock, flags); | |
| 2715 | + spin_unlock_irqrestore(&pl330->pool_lock, iflags); | |
| 2714 | 2716 | |
| 2715 | 2717 | return NULL; |
| 2716 | 2718 | } |
| @@ -33,6 +33,7 @@ config QCOM_GPI_DMA · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | config QCOM_HIDMA_MGMT |
| 35 | 35 | tristate "Qualcomm Technologies HIDMA Management support" |
| 36 | + depends on HAS_IOMEM | |
| 36 | 37 | select DMA_ENGINE |
| 37 | 38 | help |
| 38 | 39 | Enable support for the Qualcomm Technologies HIDMA Management. |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | config SF_PDMA |
| 2 | 2 | tristate "Sifive PDMA controller driver" |
| 3 | + depends on HAS_IOMEM | |
| 3 | 4 | select DMA_ENGINE |
| 4 | 5 | select DMA_VIRTUAL_CHANNELS |
| 5 | 6 | help |
| @@ -1913,7 +1913,7 @@ static int rcar_dmac_probe(struct platform_device *pdev) · 1912 unmodified lines | ||
| 1913 | 1913 | |
| 1914 | 1914 | /* Enable runtime PM and initialize the device. */ |
| 1915 | 1915 | pm_runtime_enable(&pdev->dev); |
| 1916 | − ret = pm_runtime_get_sync(&pdev->dev); | |
| 1916 | + ret = pm_runtime_resume_and_get(&pdev->dev); | |
| 1917 | 1917 | if (ret < 0) { |
| 1918 | 1918 | dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret); |
| 1919 | 1919 | return ret; |
| @@ -3675,6 +3675,9 @@ static int __init d40_probe(struct platform_device *pdev) · 3674 unmodified lines | ||
| 3675 | 3675 | |
| 3676 | 3676 | kfree(base->lcla_pool.base_unaligned); |
| 3677 | 3677 | |
| 3678 | + if (base->lcpa_base) | |
| 3679 | + iounmap(base->lcpa_base); | |
| 3680 | + | |
| 3678 | 3681 | if (base->phy_lcpa) |
| 3679 | 3682 | release_mem_region(base->phy_lcpa, |
| 3680 | 3683 | base->lcpa_size); |
| @@ -1452,7 +1452,7 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c) · 1451 unmodified lines | ||
| 1452 | 1452 | return -ENOMEM; |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | − ret = pm_runtime_get_sync(dmadev->ddev.dev); | |
| 1455 | + ret = pm_runtime_resume_and_get(dmadev->ddev.dev); | |
| 1456 | 1456 | if (ret < 0) |
| 1457 | 1457 | return ret; |
| 1458 | 1458 | |
| @@ -1718,7 +1718,7 @@ static int stm32_mdma_pm_suspend(struct device *dev) · 259 unmodified lines | ||
| 1718 | 1718 | u32 ccr, id; |
| 1719 | 1719 | int ret; |
| 1720 | 1720 | |
| 1721 | − ret = pm_runtime_get_sync(dev); | |
| 1721 | + ret = pm_runtime_resume_and_get(dev); | |
| 1722 | 1722 | if (ret < 0) |
| 1723 | 1723 | return ret; |
| 1724 | 1724 | |
| @@ -113,6 +113,7 @@ · 112 unmodified lines | ||
| 113 | 113 | #define XILINX_DPDMA_CH_VDO 0x020 |
| 114 | 114 | #define XILINX_DPDMA_CH_PYLD_SZ 0x024 |
| 115 | 115 | #define XILINX_DPDMA_CH_DESC_ID 0x028 |
| 116 | +#define XILINX_DPDMA_CH_DESC_ID_MASK GENMASK(15, 0) | |
| 116 | 117 | |
| 117 | 118 | /* DPDMA descriptor fields */ |
| 118 | 119 | #define XILINX_DPDMA_DESC_CONTROL_PREEMBLE 0xa5 |
| @@ -866,7 +867,8 @@ static void xilinx_dpdma_chan_queue_transfer(struct xilinx_dpdma_chan *chan) · 747 unmodified lines | ||
| 866 | 867 | * will be used, but it should be enough. |
| 867 | 868 | */ |
| 868 | 869 | list_for_each_entry(sw_desc, &desc->descriptors, node) |
| 869 | − sw_desc->hw.desc_id = desc->vdesc.tx.cookie; | |
| 870 | + sw_desc->hw.desc_id = desc->vdesc.tx.cookie | |
| 871 | + & XILINX_DPDMA_CH_DESC_ID_MASK; | |
| 870 | 872 | |
| 871 | 873 | sw_desc = list_first_entry(&desc->descriptors, |
| 872 | 874 | struct xilinx_dpdma_sw_desc, node); |
| @@ -1086,7 +1088,8 @@ static void xilinx_dpdma_chan_vsync_irq(struct xilinx_dpdma_chan *chan) · 213 unmodified lines | ||
| 1086 | 1088 | if (!chan->running || !pending) |
| 1087 | 1089 | goto out; |
| 1088 | 1090 | |
| 1089 | − desc_id = dpdma_read(chan->reg, XILINX_DPDMA_CH_DESC_ID); | |
| 1091 | + desc_id = dpdma_read(chan->reg, XILINX_DPDMA_CH_DESC_ID) | |
| 1092 | + & XILINX_DPDMA_CH_DESC_ID_MASK; | |
| 1090 | 1093 | |
| 1091 | 1094 | /* If the retrigger raced with vsync, retry at the next frame. */ |
| 1092 | 1095 | sw_desc = list_first_entry(&pending->descriptors, |
| @@ -1459,7 +1462,7 @@ static void xilinx_dpdma_enable_irq(struct xilinx_dpdma_device *xdev) · 366 unmodified lines | ||
| 1459 | 1462 | */ |
| 1460 | 1463 | static void xilinx_dpdma_disable_irq(struct xilinx_dpdma_device *xdev) |
| 1461 | 1464 | { |
| 1462 | − dpdma_write(xdev->reg, XILINX_DPDMA_IDS, XILINX_DPDMA_INTR_ERR_ALL); | |
| 1465 | + dpdma_write(xdev->reg, XILINX_DPDMA_IDS, XILINX_DPDMA_INTR_ALL); | |
| 1463 | 1466 | dpdma_write(xdev->reg, XILINX_DPDMA_EIDS, XILINX_DPDMA_EINTR_ALL); |
| 1464 | 1467 | } |
| 1465 | 1468 | |
| @@ -1596,6 +1599,26 @@ static struct dma_chan *of_dma_xilinx_xlate(struct of_phandle_args *dma_spec, · 130 unmodified lines | ||
| 1596 | 1599 | return dma_get_slave_channel(&xdev->chan[chan_id]->vchan.chan); |
| 1597 | 1600 | } |
| 1598 | 1601 | |
| 1602 | +static void dpdma_hw_init(struct xilinx_dpdma_device *xdev) | |
| 1603 | +{ | |
| 1604 | + unsigned int i; | |
| 1605 | + void __iomem *reg; | |
| 1606 | + | |
| 1607 | + /* Disable all interrupts */ | |
| 1608 | + xilinx_dpdma_disable_irq(xdev); | |
| 1609 | + | |
| 1610 | + /* Stop all channels */ | |
| 1611 | + for (i = 0; i < ARRAY_SIZE(xdev->chan); i++) { | |
| 1612 | + reg = xdev->reg + XILINX_DPDMA_CH_BASE | |
| 1613 | + + XILINX_DPDMA_CH_OFFSET * i; | |
| 1614 | + dpdma_clr(reg, XILINX_DPDMA_CH_CNTL, XILINX_DPDMA_CH_CNTL_ENABLE); | |
| 1615 | + } | |
| 1616 | + | |
| 1617 | + /* Clear the interrupt status registers */ | |
| 1618 | + dpdma_write(xdev->reg, XILINX_DPDMA_ISR, XILINX_DPDMA_INTR_ALL); | |
| 1619 | + dpdma_write(xdev->reg, XILINX_DPDMA_EISR, XILINX_DPDMA_EINTR_ALL); | |
| 1620 | +} | |
| 1621 | + | |
| 1599 | 1622 | static int xilinx_dpdma_probe(struct platform_device *pdev) |
| 1600 | 1623 | { |
| 1601 | 1624 | struct xilinx_dpdma_device *xdev; |
| @@ -1622,6 +1645,8 @@ static int xilinx_dpdma_probe(struct platform_device *pdev) · 20 unmodified lines | ||
| 1622 | 1645 | if (IS_ERR(xdev->reg)) |
| 1623 | 1646 | return PTR_ERR(xdev->reg); |
| 1624 | 1647 | |
| 1648 | + dpdma_hw_init(xdev); | |
| 1649 | + | |
| 1625 | 1650 | xdev->irq = platform_get_irq(pdev, 0); |
| 1626 | 1651 | if (xdev->irq < 0) { |
| 1627 | 1652 | dev_err(xdev->dev, "failed to get platform irq\n"); |
| @@ -468,7 +468,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) · 467 unmodified lines | ||
| 468 | 468 | struct zynqmp_dma_desc_sw *desc; |
| 469 | 469 | int i, ret; |
| 470 | 470 | |
| 471 | − ret = pm_runtime_get_sync(chan->dev); | |
| 471 | + ret = pm_runtime_resume_and_get(chan->dev); | |
| 472 | 472 | if (ret < 0) |
| 473 | 473 | return ret; |
| 474 | 474 | |
| @@ -276,8 +276,7 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg) · 275 unmodified lines | ||
| 276 | 276 | if (!msg || !(mem->validation_bits & CPER_MEM_VALID_MODULE_HANDLE)) |
| 277 | 277 | return 0; |
| 278 | 278 | |
| 279 | − n = 0; | |
| 280 | − len = CPER_REC_LEN - 1; | |
| 279 | + len = CPER_REC_LEN; | |
| 281 | 280 | dmi_memdev_name(mem->mem_dev_handle, &bank, &device); |
| 282 | 281 | if (bank && device) |
| 283 | 282 | n = snprintf(msg, len, "DIMM location: %s %s ", bank, device); |
| @@ -286,7 +285,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg) · 2 unmodified lines | ||
| 286 | 285 | "DIMM location: not present. DMI handle: 0x%.4x ", |
| 287 | 286 | mem->mem_dev_handle); |
| 288 | 287 | |
| 289 | − msg[n] = '\0'; | |
| 290 | 288 | return n; |
| 291 | 289 | } |
| 292 | 290 | |
| @@ -98,6 +98,9 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm) · 97 unmodified lines | ||
| 98 | 98 | BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(name)); |
| 99 | 99 | BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(dt_params[0].params)); |
| 100 | 100 | |
| 101 | + if (!fdt) | |
| 102 | + return 0; | |
| 103 | + | |
| 101 | 104 | for (i = 0; i < ARRAY_SIZE(dt_params); i++) { |
| 102 | 105 | node = fdt_path_offset(fdt, dt_params[i].path); |
| 103 | 106 | if (node < 0) |
| @@ -103,7 +103,7 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len, · 102 unmodified lines | ||
| 103 | 103 | return 0; |
| 104 | 104 | |
| 105 | 105 | /* Skip any leading slashes */ |
| 106 | − while (cmdline[i] == L'/' || cmdline[i] == L'\\') | |
| 106 | + while (i < cmdline_len && (cmdline[i] == L'/' || cmdline[i] == L'\\')) | |
| 107 | 107 | i++; |
| 108 | 108 | |
| 109 | 109 | while (--result_len > 0 && i < cmdline_len) { |
| @@ -67,11 +67,6 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out) · 66 unmodified lines | ||
| 67 | 67 | return false; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | − if (!(in->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))) { | |
| 71 | − pr_warn("Entry attributes invalid: RO and XP bits both cleared\n"); | |
| 72 | − return false; | |
| 73 | − } | |
| 74 | − | |
| 75 | 70 | if (PAGE_SIZE > EFI_PAGE_SIZE && |
| 76 | 71 | (!PAGE_ALIGNED(in->phys_addr) || |
| 77 | 72 | !PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) { |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/slab.h> |
| 8 | 8 | #include <linux/of_device.h> |
| 9 | 9 | |
| 10 | −#define WCD_PIN_MASK(p) BIT(p - 1) | |
| 10 | +#define WCD_PIN_MASK(p) BIT(p) | |
| 11 | 11 | #define WCD_REG_DIR_CTL_OFFSET 0x42 |
| 12 | 12 | #define WCD_REG_VAL_CTL_OFFSET 0x43 |
| 13 | 13 | #define WCD934X_NPINS 5 |
| @@ -315,9 +315,10 @@ int drm_master_open(struct drm_file *file_priv) · 314 unmodified lines | ||
| 315 | 315 | void drm_master_release(struct drm_file *file_priv) |
| 316 | 316 | { |
| 317 | 317 | struct drm_device *dev = file_priv->minor->dev; |
| 318 | − struct drm_master *master = file_priv->master; | |
| 318 | + struct drm_master *master; | |
| 319 | 319 | |
| 320 | 320 | mutex_lock(&dev->master_mutex); |
| 321 | + master = file_priv->master; | |
| 321 | 322 | if (file_priv->magic) |
| 322 | 323 | idr_remove(&file_priv->master->magic_map, file_priv->magic); |
| 323 | 324 | |
| @@ -117,17 +117,18 @@ int drm_getunique(struct drm_device *dev, void *data, · 116 unmodified lines | ||
| 117 | 117 | struct drm_file *file_priv) |
| 118 | 118 | { |
| 119 | 119 | struct drm_unique *u = data; |
| 120 | − struct drm_master *master = file_priv->master; | |
| 120 | + struct drm_master *master; | |
| 121 | 121 | |
| 122 | − mutex_lock(&master->dev->master_mutex); | |
| 122 | + mutex_lock(&dev->master_mutex); | |
| 123 | + master = file_priv->master; | |
| 123 | 124 | if (u->unique_len >= master->unique_len) { |
| 124 | 125 | if (copy_to_user(u->unique, master->unique, master->unique_len)) { |
| 125 | − mutex_unlock(&master->dev->master_mutex); | |
| 126 | + mutex_unlock(&dev->master_mutex); | |
| 126 | 127 | return -EFAULT; |
| 127 | 128 | } |
| 128 | 129 | } |
| 129 | 130 | u->unique_len = master->unique_len; |
| 130 | − mutex_unlock(&master->dev->master_mutex); | |
| 131 | + mutex_unlock(&dev->master_mutex); | |
| 131 | 132 | |
| 132 | 133 | return 0; |
| 133 | 134 | } |
| @@ -577,7 +577,7 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d, · 576 unmodified lines | ||
| 577 | 577 | * porches and sync. |
| 578 | 578 | */ |
| 579 | 579 | /* (ps/s) / (pixels/s) = ps/pixels */ |
| 580 | − pclk = DIV_ROUND_UP_ULL(1000000000000, mode->clock); | |
| 580 | + pclk = DIV_ROUND_UP_ULL(1000000000000, (mode->clock * 1000)); | |
| 581 | 581 | dev_dbg(d->dev, "picoseconds between two pixels: %llu\n", |
| 582 | 582 | pclk); |
| 583 | 583 | |
| @@ -474,11 +474,12 @@ static int meson_probe_remote(struct platform_device *pdev, · 473 unmodified lines | ||
| 474 | 474 | static void meson_drv_shutdown(struct platform_device *pdev) |
| 475 | 475 | { |
| 476 | 476 | struct meson_drm *priv = dev_get_drvdata(&pdev->dev); |
| 477 | − struct drm_device *drm = priv->drm; | |
| 478 | 477 | |
| 479 | − DRM_DEBUG_DRIVER("\n"); | |
| 480 | − drm_kms_helper_poll_fini(drm); | |
| 481 | − drm_atomic_helper_shutdown(drm); | |
| 478 | + if (!priv) | |
| 479 | + return; | |
| 480 | + | |
| 481 | + drm_kms_helper_poll_fini(priv->drm); | |
| 482 | + drm_atomic_helper_shutdown(priv->drm); | |
| 482 | 483 | } |
| 483 | 484 | |
| 484 | 485 | static int meson_drv_probe(struct platform_device *pdev) |
| @@ -157,7 +157,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 156 unmodified lines | ||
| 157 | 157 | * GPU registers so we need to add 0x1a800 to the register value on A630 |
| 158 | 158 | * to get the right value from PM4. |
| 159 | 159 | */ |
| 160 | − get_stats_counter(ring, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L + 0x1a800, | |
| 160 | + get_stats_counter(ring, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO, | |
| 161 | 161 | rbmemptr_stats(ring, index, alwayson_start)); |
| 162 | 162 | |
| 163 | 163 | /* Invalidate CCU depth and color */ |
| @@ -187,7 +187,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 23 unmodified lines | ||
| 187 | 187 | |
| 188 | 188 | get_stats_counter(ring, REG_A6XX_RBBM_PERFCTR_CP_0_LO, |
| 189 | 189 | rbmemptr_stats(ring, index, cpcycles_end)); |
| 190 | − get_stats_counter(ring, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L + 0x1a800, | |
| 190 | + get_stats_counter(ring, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO, | |
| 191 | 191 | rbmemptr_stats(ring, index, alwayson_end)); |
| 192 | 192 | |
| 193 | 193 | /* Write the fence to the scratch register */ |
| @@ -206,8 +206,8 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 12 unmodified lines | ||
| 206 | 206 | OUT_RING(ring, submit->seqno); |
| 207 | 207 | |
| 208 | 208 | trace_msm_gpu_submit_flush(submit, |
| 209 | − gmu_read64(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L, | |
| 210 | − REG_A6XX_GMU_ALWAYS_ON_COUNTER_H)); | |
| 209 | + gpu_read64(gpu, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO, | |
| 210 | + REG_A6XX_CP_ALWAYS_ON_COUNTER_HI)); | |
| 211 | 211 | |
| 212 | 212 | a6xx_flush(gpu, ring); |
| 213 | 213 | } |
| @@ -462,6 +462,113 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state) · 248 unmodified lines | ||
| 462 | 462 | gpu_write(gpu, REG_A6XX_RBBM_CLOCK_CNTL, state ? clock_cntl_on : 0); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | +/* For a615, a616, a618, A619, a630, a640 and a680 */ | |
| 466 | +static const u32 a6xx_protect[] = { | |
| 467 | + A6XX_PROTECT_RDONLY(0x00000, 0x04ff), | |
| 468 | + A6XX_PROTECT_RDONLY(0x00501, 0x0005), | |
| 469 | + A6XX_PROTECT_RDONLY(0x0050b, 0x02f4), | |
| 470 | + A6XX_PROTECT_NORDWR(0x0050e, 0x0000), | |
| 471 | + A6XX_PROTECT_NORDWR(0x00510, 0x0000), | |
| 472 | + A6XX_PROTECT_NORDWR(0x00534, 0x0000), | |
| 473 | + A6XX_PROTECT_NORDWR(0x00800, 0x0082), | |
| 474 | + A6XX_PROTECT_NORDWR(0x008a0, 0x0008), | |
| 475 | + A6XX_PROTECT_NORDWR(0x008ab, 0x0024), | |
| 476 | + A6XX_PROTECT_RDONLY(0x008de, 0x00ae), | |
| 477 | + A6XX_PROTECT_NORDWR(0x00900, 0x004d), | |
| 478 | + A6XX_PROTECT_NORDWR(0x0098d, 0x0272), | |
| 479 | + A6XX_PROTECT_NORDWR(0x00e00, 0x0001), | |
| 480 | + A6XX_PROTECT_NORDWR(0x00e03, 0x000c), | |
| 481 | + A6XX_PROTECT_NORDWR(0x03c00, 0x00c3), | |
| 482 | + A6XX_PROTECT_RDONLY(0x03cc4, 0x1fff), | |
| 483 | + A6XX_PROTECT_NORDWR(0x08630, 0x01cf), | |
| 484 | + A6XX_PROTECT_NORDWR(0x08e00, 0x0000), | |
| 485 | + A6XX_PROTECT_NORDWR(0x08e08, 0x0000), | |
| 486 | + A6XX_PROTECT_NORDWR(0x08e50, 0x001f), | |
| 487 | + A6XX_PROTECT_NORDWR(0x09624, 0x01db), | |
| 488 | + A6XX_PROTECT_NORDWR(0x09e70, 0x0001), | |
| 489 | + A6XX_PROTECT_NORDWR(0x09e78, 0x0187), | |
| 490 | + A6XX_PROTECT_NORDWR(0x0a630, 0x01cf), | |
| 491 | + A6XX_PROTECT_NORDWR(0x0ae02, 0x0000), | |
| 492 | + A6XX_PROTECT_NORDWR(0x0ae50, 0x032f), | |
| 493 | + A6XX_PROTECT_NORDWR(0x0b604, 0x0000), | |
| 494 | + A6XX_PROTECT_NORDWR(0x0be02, 0x0001), | |
| 495 | + A6XX_PROTECT_NORDWR(0x0be20, 0x17df), | |
| 496 | + A6XX_PROTECT_NORDWR(0x0f000, 0x0bff), | |
| 497 | + A6XX_PROTECT_RDONLY(0x0fc00, 0x1fff), | |
| 498 | + A6XX_PROTECT_NORDWR(0x11c00, 0x0000), /* note: infinite range */ | |
| 499 | +}; | |
| 500 | + | |
| 501 | +/* These are for a620 and a650 */ | |
| 502 | +static const u32 a650_protect[] = { | |
| 503 | + A6XX_PROTECT_RDONLY(0x00000, 0x04ff), | |
| 504 | + A6XX_PROTECT_RDONLY(0x00501, 0x0005), | |
| 505 | + A6XX_PROTECT_RDONLY(0x0050b, 0x02f4), | |
| 506 | + A6XX_PROTECT_NORDWR(0x0050e, 0x0000), | |
| 507 | + A6XX_PROTECT_NORDWR(0x00510, 0x0000), | |
| 508 | + A6XX_PROTECT_NORDWR(0x00534, 0x0000), | |
| 509 | + A6XX_PROTECT_NORDWR(0x00800, 0x0082), | |
| 510 | + A6XX_PROTECT_NORDWR(0x008a0, 0x0008), | |
| 511 | + A6XX_PROTECT_NORDWR(0x008ab, 0x0024), | |
| 512 | + A6XX_PROTECT_RDONLY(0x008de, 0x00ae), | |
| 513 | + A6XX_PROTECT_NORDWR(0x00900, 0x004d), | |
| 514 | + A6XX_PROTECT_NORDWR(0x0098d, 0x0272), | |
| 515 | + A6XX_PROTECT_NORDWR(0x00e00, 0x0001), | |
| 516 | + A6XX_PROTECT_NORDWR(0x00e03, 0x000c), | |
| 517 | + A6XX_PROTECT_NORDWR(0x03c00, 0x00c3), | |
| 518 | + A6XX_PROTECT_RDONLY(0x03cc4, 0x1fff), | |
| 519 | + A6XX_PROTECT_NORDWR(0x08630, 0x01cf), | |
| 520 | + A6XX_PROTECT_NORDWR(0x08e00, 0x0000), | |
| 521 | + A6XX_PROTECT_NORDWR(0x08e08, 0x0000), | |
| 522 | + A6XX_PROTECT_NORDWR(0x08e50, 0x001f), | |
| 523 | + A6XX_PROTECT_NORDWR(0x08e80, 0x027f), | |
| 524 | + A6XX_PROTECT_NORDWR(0x09624, 0x01db), | |
| 525 | + A6XX_PROTECT_NORDWR(0x09e60, 0x0011), | |
| 526 | + A6XX_PROTECT_NORDWR(0x09e78, 0x0187), | |
| 527 | + A6XX_PROTECT_NORDWR(0x0a630, 0x01cf), | |
| 528 | + A6XX_PROTECT_NORDWR(0x0ae02, 0x0000), | |
| 529 | + A6XX_PROTECT_NORDWR(0x0ae50, 0x032f), | |
| 530 | + A6XX_PROTECT_NORDWR(0x0b604, 0x0000), | |
| 531 | + A6XX_PROTECT_NORDWR(0x0b608, 0x0007), | |
| 532 | + A6XX_PROTECT_NORDWR(0x0be02, 0x0001), | |
| 533 | + A6XX_PROTECT_NORDWR(0x0be20, 0x17df), | |
| 534 | + A6XX_PROTECT_NORDWR(0x0f000, 0x0bff), | |
| 535 | + A6XX_PROTECT_RDONLY(0x0fc00, 0x1fff), | |
| 536 | + A6XX_PROTECT_NORDWR(0x18400, 0x1fff), | |
| 537 | + A6XX_PROTECT_NORDWR(0x1a800, 0x1fff), | |
| 538 | + A6XX_PROTECT_NORDWR(0x1f400, 0x0443), | |
| 539 | + A6XX_PROTECT_RDONLY(0x1f844, 0x007b), | |
| 540 | + A6XX_PROTECT_NORDWR(0x1f887, 0x001b), | |
| 541 | + A6XX_PROTECT_NORDWR(0x1f8c0, 0x0000), /* note: infinite range */ | |
| 542 | +}; | |
| 543 | + | |
| 544 | +static void a6xx_set_cp_protect(struct msm_gpu *gpu) | |
| 545 | +{ | |
| 546 | + struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); | |
| 547 | + const u32 *regs = a6xx_protect; | |
| 548 | + unsigned i, count = ARRAY_SIZE(a6xx_protect), count_max = 32; | |
| 549 | + | |
| 550 | + BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32); | |
| 551 | + BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48); | |
| 552 | + | |
| 553 | + if (adreno_is_a650(adreno_gpu)) { | |
| 554 | + regs = a650_protect; | |
| 555 | + count = ARRAY_SIZE(a650_protect); | |
| 556 | + count_max = 48; | |
| 557 | + } | |
| 558 | + | |
| 559 | + /* | |
| 560 | + * Enable access protection to privileged registers, fault on an access | |
| 561 | + * protect violation and select the last span to protect from the start | |
| 562 | + * address all the way to the end of the register address space | |
| 563 | + */ | |
| 564 | + gpu_write(gpu, REG_A6XX_CP_PROTECT_CNTL, BIT(0) | BIT(1) | BIT(3)); | |
| 565 | + | |
| 566 | + for (i = 0; i < count - 1; i++) | |
| 567 | + gpu_write(gpu, REG_A6XX_CP_PROTECT(i), regs[i]); | |
| 568 | + /* last CP_PROTECT to have "infinite" length on the last entry */ | |
| 569 | + gpu_write(gpu, REG_A6XX_CP_PROTECT(count_max - 1), regs[i]); | |
| 570 | +} | |
| 571 | + | |
| 465 | 572 | static void a6xx_set_ubwc_config(struct msm_gpu *gpu) |
| 466 | 573 | { |
| 467 | 574 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); |
| @@ -489,7 +596,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu) · 21 unmodified lines | ||
| 489 | 596 | rgb565_predicator << 11 | amsbc << 4 | lower_bit << 1); |
| 490 | 597 | gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, lower_bit << 1); |
| 491 | 598 | gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL, |
| 492 | − uavflagprd_inv >> 4 | lower_bit << 1); | |
| 599 | + uavflagprd_inv << 4 | lower_bit << 1); | |
| 493 | 600 | gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, lower_bit << 21); |
| 494 | 601 | } |
| 495 | 602 | |
| @@ -776,41 +883,7 @@ static int a6xx_hw_init(struct msm_gpu *gpu) · 280 unmodified lines | ||
| 776 | 883 | } |
| 777 | 884 | |
| 778 | 885 | /* Protect registers from the CP */ |
| 779 | − gpu_write(gpu, REG_A6XX_CP_PROTECT_CNTL, 0x00000003); | |
| 780 | − | |
| 781 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(0), | |
| 782 | − A6XX_PROTECT_RDONLY(0x600, 0x51)); | |
| 783 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(1), A6XX_PROTECT_RW(0xae50, 0x2)); | |
| 784 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(2), A6XX_PROTECT_RW(0x9624, 0x13)); | |
| 785 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(3), A6XX_PROTECT_RW(0x8630, 0x8)); | |
| 786 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(4), A6XX_PROTECT_RW(0x9e70, 0x1)); | |
| 787 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(5), A6XX_PROTECT_RW(0x9e78, 0x187)); | |
| 788 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(6), A6XX_PROTECT_RW(0xf000, 0x810)); | |
| 789 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(7), | |
| 790 | − A6XX_PROTECT_RDONLY(0xfc00, 0x3)); | |
| 791 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(8), A6XX_PROTECT_RW(0x50e, 0x0)); | |
| 792 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(9), A6XX_PROTECT_RDONLY(0x50f, 0x0)); | |
| 793 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(10), A6XX_PROTECT_RW(0x510, 0x0)); | |
| 794 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(11), | |
| 795 | − A6XX_PROTECT_RDONLY(0x0, 0x4f9)); | |
| 796 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(12), | |
| 797 | − A6XX_PROTECT_RDONLY(0x501, 0xa)); | |
| 798 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(13), | |
| 799 | − A6XX_PROTECT_RDONLY(0x511, 0x44)); | |
| 800 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(14), A6XX_PROTECT_RW(0xe00, 0xe)); | |
| 801 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(15), A6XX_PROTECT_RW(0x8e00, 0x0)); | |
| 802 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(16), A6XX_PROTECT_RW(0x8e50, 0xf)); | |
| 803 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(17), A6XX_PROTECT_RW(0xbe02, 0x0)); | |
| 804 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(18), | |
| 805 | − A6XX_PROTECT_RW(0xbe20, 0x11f3)); | |
| 806 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(19), A6XX_PROTECT_RW(0x800, 0x82)); | |
| 807 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(20), A6XX_PROTECT_RW(0x8a0, 0x8)); | |
| 808 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(21), A6XX_PROTECT_RW(0x8ab, 0x19)); | |
| 809 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(22), A6XX_PROTECT_RW(0x900, 0x4d)); | |
| 810 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(23), A6XX_PROTECT_RW(0x98d, 0x76)); | |
| 811 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(24), | |
| 812 | − A6XX_PROTECT_RDONLY(0x980, 0x4)); | |
| 813 | − gpu_write(gpu, REG_A6XX_CP_PROTECT(25), A6XX_PROTECT_RW(0xa630, 0x0)); | |
| 886 | + a6xx_set_cp_protect(gpu); | |
| 814 | 887 | |
| 815 | 888 | /* Enable expanded apriv for targets that support it */ |
| 816 | 889 | if (gpu->hw_apriv) { |
| @@ -1211,7 +1284,7 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) · 394 unmodified lines | ||
| 1211 | 1284 | if (ret) |
| 1212 | 1285 | return ret; |
| 1213 | 1286 | |
| 1214 | − if (adreno_gpu->base.hw_apriv || a6xx_gpu->has_whereami) | |
| 1287 | + if (a6xx_gpu->shadow_bo) | |
| 1215 | 1288 | for (i = 0; i < gpu->nr_rings; i++) |
| 1216 | 1289 | a6xx_gpu->shadow[i] = 0; |
| 1217 | 1290 | |
| @@ -44,7 +44,7 @@ struct a6xx_gpu { · 43 unmodified lines | ||
| 44 | 44 | * REG_CP_PROTECT_REG(n) - this will block both reads and writes for _len |
| 45 | 45 | * registers starting at _reg. |
| 46 | 46 | */ |
| 47 | −#define A6XX_PROTECT_RW(_reg, _len) \ | |
| 47 | +#define A6XX_PROTECT_NORDWR(_reg, _len) \ | |
| 48 | 48 | ((1 << 31) | \ |
| 49 | 49 | (((_len) & 0x3FFF) << 18) | ((_reg) & 0x3FFFF)) |
| 50 | 50 | |
| @@ -432,6 +432,7 @@ static unsigned long dsi_pll_10nm_vco_recalc_rate(struct clk_hw *hw, · 431 unmodified lines | ||
| 432 | 432 | pll_freq += div_u64(tmp64, multiplier); |
| 433 | 433 | |
| 434 | 434 | vco_rate = pll_freq; |
| 435 | + pll_10nm->vco_current_rate = vco_rate; | |
| 435 | 436 | |
| 436 | 437 | DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x", |
| 437 | 438 | pll_10nm->phy->id, (unsigned long)vco_rate, dec, frac); |
| @@ -460,6 +460,7 @@ static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw, · 459 unmodified lines | ||
| 460 | 460 | pll_freq += div_u64(tmp64, multiplier); |
| 461 | 461 | |
| 462 | 462 | vco_rate = pll_freq; |
| 463 | + pll_7nm->vco_current_rate = vco_rate; | |
| 463 | 464 | |
| 464 | 465 | DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x", |
| 465 | 466 | pll_7nm->phy->id, (unsigned long)vco_rate, dec, frac); |
| @@ -1240,6 +1240,13 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, · 1239 unmodified lines | ||
| 1240 | 1240 | |
| 1241 | 1241 | to_msm_bo(obj)->vram_node = &vma->node; |
| 1242 | 1242 | |
| 1243 | + /* Call chain get_pages() -> update_inactive() tries to | |
| 1244 | + * access msm_obj->mm_list, but it is not initialized yet. | |
| 1245 | + * To avoid NULL pointer dereference error, initialize | |
| 1246 | + * mm_list to be empty. | |
| 1247 | + */ | |
| 1248 | + INIT_LIST_HEAD(&msm_obj->mm_list); | |
| 1249 | + | |
| 1243 | 1250 | msm_gem_lock(obj); |
| 1244 | 1251 | pages = get_pages(obj); |
| 1245 | 1252 | msm_gem_unlock(obj); |
| @@ -209,7 +209,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, · 208 unmodified lines | ||
| 209 | 209 | goto err_disable_clk_tmds; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | − ret = sun8i_hdmi_phy_probe(hdmi, phy_node); | |
| 212 | + ret = sun8i_hdmi_phy_get(hdmi, phy_node); | |
| 213 | 213 | of_node_put(phy_node); |
| 214 | 214 | if (ret) { |
| 215 | 215 | dev_err(dev, "Couldn't get the HDMI PHY\n"); |
| @@ -242,7 +242,6 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, · 26 unmodified lines | ||
| 242 | 242 | |
| 243 | 243 | cleanup_encoder: |
| 244 | 244 | drm_encoder_cleanup(encoder); |
| 245 | − sun8i_hdmi_phy_remove(hdmi); | |
| 246 | 245 | err_disable_clk_tmds: |
| 247 | 246 | clk_disable_unprepare(hdmi->clk_tmds); |
| 248 | 247 | err_assert_ctrl_reset: |
| @@ -263,7 +262,6 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master, · 14 unmodified lines | ||
| 263 | 262 | struct sun8i_dw_hdmi *hdmi = dev_get_drvdata(dev); |
| 264 | 263 | |
| 265 | 264 | dw_hdmi_unbind(hdmi->hdmi); |
| 266 | − sun8i_hdmi_phy_remove(hdmi); | |
| 267 | 265 | clk_disable_unprepare(hdmi->clk_tmds); |
| 268 | 266 | reset_control_assert(hdmi->rst_ctrl); |
| 269 | 267 | gpiod_set_value(hdmi->ddc_en, 0); |
| @@ -320,7 +318,32 @@ static struct platform_driver sun8i_dw_hdmi_pltfm_driver = { · 50 unmodified lines | ||
| 320 | 318 | .of_match_table = sun8i_dw_hdmi_dt_ids, |
| 321 | 319 | }, |
| 322 | 320 | }; |
| 323 | −module_platform_driver(sun8i_dw_hdmi_pltfm_driver); | |
| 321 | + | |
| 322 | +static int __init sun8i_dw_hdmi_init(void) | |
| 323 | +{ | |
| 324 | + int ret; | |
| 325 | + | |
| 326 | + ret = platform_driver_register(&sun8i_dw_hdmi_pltfm_driver); | |
| 327 | + if (ret) | |
| 328 | + return ret; | |
| 329 | + | |
| 330 | + ret = platform_driver_register(&sun8i_hdmi_phy_driver); | |
| 331 | + if (ret) { | |
| 332 | + platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver); | |
| 333 | + return ret; | |
| 334 | + } | |
| 335 | + | |
| 336 | + return ret; | |
| 337 | +} | |
| 338 | + | |
| 339 | +static void __exit sun8i_dw_hdmi_exit(void) | |
| 340 | +{ | |
| 341 | + platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver); | |
| 342 | + platform_driver_unregister(&sun8i_hdmi_phy_driver); | |
| 343 | +} | |
| 344 | + | |
| 345 | +module_init(sun8i_dw_hdmi_init); | |
| 346 | +module_exit(sun8i_dw_hdmi_exit); | |
| 324 | 347 | |
| 325 | 348 | MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@siol.net>"); |
| 326 | 349 | MODULE_DESCRIPTION("Allwinner DW HDMI bridge"); |
| @@ -195,14 +195,15 @@ struct sun8i_dw_hdmi { · 194 unmodified lines | ||
| 195 | 195 | struct gpio_desc *ddc_en; |
| 196 | 196 | }; |
| 197 | 197 | |
| 198 | +extern struct platform_driver sun8i_hdmi_phy_driver; | |
| 199 | + | |
| 198 | 200 | static inline struct sun8i_dw_hdmi * |
| 199 | 201 | encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder) |
| 200 | 202 | { |
| 201 | 203 | return container_of(encoder, struct sun8i_dw_hdmi, encoder); |
| 202 | 204 | } |
| 203 | 205 | |
| 204 | −int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node); | |
| 205 | −void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi); | |
| 206 | +int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node); | |
| 206 | 207 | |
| 207 | 208 | void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy); |
| 208 | 209 | void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy, |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | #include <linux/delay.h> |
| 7 | 7 | #include <linux/of_address.h> |
| 8 | +#include <linux/of_platform.h> | |
| 8 | 9 | |
| 9 | 10 | #include "sun8i_dw_hdmi.h" |
| 10 | 11 | |
| @@ -597,10 +598,30 @@ static const struct of_device_id sun8i_hdmi_phy_of_table[] = { · 586 unmodified lines | ||
| 597 | 598 | { /* sentinel */ } |
| 598 | 599 | }; |
| 599 | 600 | |
| 600 | −int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node) | |
| 601 | +int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node) | |
| 602 | +{ | |
| 603 | + struct platform_device *pdev = of_find_device_by_node(node); | |
| 604 | + struct sun8i_hdmi_phy *phy; | |
| 605 | + | |
| 606 | + if (!pdev) | |
| 607 | + return -EPROBE_DEFER; | |
| 608 | + | |
| 609 | + phy = platform_get_drvdata(pdev); | |
| 610 | + if (!phy) | |
| 611 | + return -EPROBE_DEFER; | |
| 612 | + | |
| 613 | + hdmi->phy = phy; | |
| 614 | + | |
| 615 | + put_device(&pdev->dev); | |
| 616 | + | |
| 617 | + return 0; | |
| 618 | +} | |
| 619 | + | |
| 620 | +static int sun8i_hdmi_phy_probe(struct platform_device *pdev) | |
| 601 | 621 | { |
| 602 | 622 | const struct of_device_id *match; |
| 603 | − struct device *dev = hdmi->dev; | |
| 623 | + struct device *dev = &pdev->dev; | |
| 624 | + struct device_node *node = dev->of_node; | |
| 604 | 625 | struct sun8i_hdmi_phy *phy; |
| 605 | 626 | struct resource res; |
| 606 | 627 | void __iomem *regs; |
| @@ -704,7 +725,7 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node) · 97 unmodified lines | ||
| 704 | 725 | clk_prepare_enable(phy->clk_phy); |
| 705 | 726 | } |
| 706 | 727 | |
| 707 | − hdmi->phy = phy; | |
| 728 | + platform_set_drvdata(pdev, phy); | |
| 708 | 729 | |
| 709 | 730 | return 0; |
| 710 | 731 | |
| @@ -728,9 +749,9 @@ err_put_clk_bus: · 17 unmodified lines | ||
| 728 | 749 | return ret; |
| 729 | 750 | } |
| 730 | 751 | |
| 731 | −void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi) | |
| 752 | +static int sun8i_hdmi_phy_remove(struct platform_device *pdev) | |
| 732 | 753 | { |
| 733 | − struct sun8i_hdmi_phy *phy = hdmi->phy; | |
| 754 | + struct sun8i_hdmi_phy *phy = platform_get_drvdata(pdev); | |
| 734 | 755 | |
| 735 | 756 | clk_disable_unprepare(phy->clk_mod); |
| 736 | 757 | clk_disable_unprepare(phy->clk_bus); |
| @@ -744,4 +765,14 @@ void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi) · 7 unmodified lines | ||
| 744 | 765 | clk_put(phy->clk_pll1); |
| 745 | 766 | clk_put(phy->clk_mod); |
| 746 | 767 | clk_put(phy->clk_bus); |
| 768 | + return 0; | |
| 747 | 769 | } |
| 770 | + | |
| 771 | +struct platform_driver sun8i_hdmi_phy_driver = { | |
| 772 | + .probe = sun8i_hdmi_phy_probe, | |
| 773 | + .remove = sun8i_hdmi_phy_remove, | |
| 774 | + .driver = { | |
| 775 | + .name = "sun8i-hdmi-phy", | |
| 776 | + .of_match_table = sun8i_hdmi_phy_of_table, | |
| 777 | + }, | |
| 778 | +}; | |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "trace.h" |
| 26 | 26 | |
| 27 | 27 | /* XXX move to include/uapi/drm/drm_fourcc.h? */ |
| 28 | −#define DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT BIT(22) | |
| 28 | +#define DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT BIT_ULL(22) | |
| 29 | 29 | |
| 30 | 30 | struct reset_control; |
| 31 | 31 | |
| @@ -510,7 +510,7 @@ static void tegra_shared_plane_atomic_update(struct drm_plane *plane, · 509 unmodified lines | ||
| 510 | 510 | * dGPU sector layout. |
| 511 | 511 | */ |
| 512 | 512 | if (tegra_plane_state->tiling.sector_layout == TEGRA_BO_SECTOR_LAYOUT_GPU) |
| 513 | − base |= BIT(39); | |
| 513 | + base |= BIT_ULL(39); | |
| 514 | 514 | #endif |
| 515 | 515 | |
| 516 | 516 | tegra_plane_writel(p, tegra_plane_state->format, DC_WIN_COLOR_DEPTH); |
| @@ -3125,21 +3125,21 @@ static int tegra_sor_init(struct host1x_client *client) · 3124 unmodified lines | ||
| 3125 | 3125 | if (err < 0) { |
| 3126 | 3126 | dev_err(sor->dev, "failed to acquire SOR reset: %d\n", |
| 3127 | 3127 | err); |
| 3128 | − return err; | |
| 3128 | + goto rpm_put; | |
| 3129 | 3129 | } |
| 3130 | 3130 | |
| 3131 | 3131 | err = reset_control_assert(sor->rst); |
| 3132 | 3132 | if (err < 0) { |
| 3133 | 3133 | dev_err(sor->dev, "failed to assert SOR reset: %d\n", |
| 3134 | 3134 | err); |
| 3135 | − return err; | |
| 3135 | + goto rpm_put; | |
| 3136 | 3136 | } |
| 3137 | 3137 | } |
| 3138 | 3138 | |
| 3139 | 3139 | err = clk_prepare_enable(sor->clk); |
| 3140 | 3140 | if (err < 0) { |
| 3141 | 3141 | dev_err(sor->dev, "failed to enable clock: %d\n", err); |
| 3142 | − return err; | |
| 3142 | + goto rpm_put; | |
| 3143 | 3143 | } |
| 3144 | 3144 | |
| 3145 | 3145 | usleep_range(1000, 3000); |
| @@ -3150,7 +3150,7 @@ static int tegra_sor_init(struct host1x_client *client) · 4 unmodified lines | ||
| 3150 | 3150 | dev_err(sor->dev, "failed to deassert SOR reset: %d\n", |
| 3151 | 3151 | err); |
| 3152 | 3152 | clk_disable_unprepare(sor->clk); |
| 3153 | − return err; | |
| 3153 | + goto rpm_put; | |
| 3154 | 3154 | } |
| 3155 | 3155 | |
| 3156 | 3156 | reset_control_release(sor->rst); |
| @@ -3171,6 +3171,12 @@ static int tegra_sor_init(struct host1x_client *client) · 14 unmodified lines | ||
| 3171 | 3171 | } |
| 3172 | 3172 | |
| 3173 | 3173 | return 0; |
| 3174 | + | |
| 3175 | +rpm_put: | |
| 3176 | + if (sor->rst) | |
| 3177 | + pm_runtime_put(sor->dev); | |
| 3178 | + | |
| 3179 | + return err; | |
| 3174 | 3180 | } |
| 3175 | 3181 | |
| 3176 | 3182 | static int tegra_sor_exit(struct host1x_client *client) |
| @@ -3739,12 +3745,8 @@ static int tegra_sor_probe(struct platform_device *pdev) · 562 unmodified lines | ||
| 3739 | 3745 | if (!sor->aux) |
| 3740 | 3746 | return -EPROBE_DEFER; |
| 3741 | 3747 | |
| 3742 | − if (get_device(&sor->aux->ddc.dev)) { | |
| 3743 | − if (try_module_get(sor->aux->ddc.owner)) | |
| 3744 | − sor->output.ddc = &sor->aux->ddc; | |
| 3745 | − else | |
| 3746 | − put_device(&sor->aux->ddc.dev); | |
| 3747 | − } | |
| 3748 | + if (get_device(sor->aux->dev)) | |
| 3749 | + sor->output.ddc = &sor->aux->ddc; | |
| 3748 | 3750 | } |
| 3749 | 3751 | |
| 3750 | 3752 | if (!sor->aux) { |
| @@ -3772,12 +3774,13 @@ static int tegra_sor_probe(struct platform_device *pdev) · 21 unmodified lines | ||
| 3772 | 3774 | |
| 3773 | 3775 | err = tegra_sor_parse_dt(sor); |
| 3774 | 3776 | if (err < 0) |
| 3775 | − return err; | |
| 3777 | + goto put_aux; | |
| 3776 | 3778 | |
| 3777 | 3779 | err = tegra_output_probe(&sor->output); |
| 3778 | − if (err < 0) | |
| 3779 | − return dev_err_probe(&pdev->dev, err, | |
| 3780 | − "failed to probe output\n"); | |
| 3780 | + if (err < 0) { | |
| 3781 | + dev_err_probe(&pdev->dev, err, "failed to probe output\n"); | |
| 3782 | + goto put_aux; | |
| 3783 | + } | |
| 3781 | 3784 | |
| 3782 | 3785 | if (sor->ops && sor->ops->probe) { |
| 3783 | 3786 | err = sor->ops->probe(sor); |
| @@ -3916,17 +3919,10 @@ static int tegra_sor_probe(struct platform_device *pdev) · 132 unmodified lines | ||
| 3916 | 3919 | platform_set_drvdata(pdev, sor); |
| 3917 | 3920 | pm_runtime_enable(&pdev->dev); |
| 3918 | 3921 | |
| 3919 | − INIT_LIST_HEAD(&sor->client.list); | |
| 3922 | + host1x_client_init(&sor->client); | |
| 3920 | 3923 | sor->client.ops = &sor_client_ops; |
| 3921 | 3924 | sor->client.dev = &pdev->dev; |
| 3922 | 3925 | |
| 3923 | − err = host1x_client_register(&sor->client); | |
| 3924 | − if (err < 0) { | |
| 3925 | − dev_err(&pdev->dev, "failed to register host1x client: %d\n", | |
| 3926 | − err); | |
| 3927 | − goto rpm_disable; | |
| 3928 | − } | |
| 3929 | − | |
| 3930 | 3926 | /* |
| 3931 | 3927 | * On Tegra210 and earlier, provide our own implementation for the |
| 3932 | 3928 | * pad output clock. |
| @@ -3938,13 +3934,13 @@ static int tegra_sor_probe(struct platform_device *pdev) · 5 unmodified lines | ||
| 3938 | 3934 | sor->index); |
| 3939 | 3935 | if (!name) { |
| 3940 | 3936 | err = -ENOMEM; |
| 3941 | − goto unregister; | |
| 3937 | + goto uninit; | |
| 3942 | 3938 | } |
| 3943 | 3939 | |
| 3944 | 3940 | err = host1x_client_resume(&sor->client); |
| 3945 | 3941 | if (err < 0) { |
| 3946 | 3942 | dev_err(sor->dev, "failed to resume: %d\n", err); |
| 3947 | − goto unregister; | |
| 3943 | + goto uninit; | |
| 3948 | 3944 | } |
| 3949 | 3945 | |
| 3950 | 3946 | sor->clk_pad = tegra_clk_sor_pad_register(sor, name); |
| @@ -3955,17 +3951,30 @@ static int tegra_sor_probe(struct platform_device *pdev) · 4 unmodified lines | ||
| 3955 | 3951 | err = PTR_ERR(sor->clk_pad); |
| 3956 | 3952 | dev_err(sor->dev, "failed to register SOR pad clock: %d\n", |
| 3957 | 3953 | err); |
| 3958 | − goto unregister; | |
| 3954 | + goto uninit; | |
| 3955 | + } | |
| 3956 | + | |
| 3957 | + err = __host1x_client_register(&sor->client); | |
| 3958 | + if (err < 0) { | |
| 3959 | + dev_err(&pdev->dev, "failed to register host1x client: %d\n", | |
| 3960 | + err); | |
| 3961 | + goto uninit; | |
| 3959 | 3962 | } |
| 3960 | 3963 | |
| 3961 | 3964 | return 0; |
| 3962 | 3965 | |
| 3963 | −unregister: | |
| 3964 | − host1x_client_unregister(&sor->client); | |
| 3965 | −rpm_disable: | |
| 3966 | +uninit: | |
| 3967 | + host1x_client_exit(&sor->client); | |
| 3966 | 3968 | pm_runtime_disable(&pdev->dev); |
| 3967 | 3969 | remove: |
| 3970 | + if (sor->aux) | |
| 3971 | + sor->output.ddc = NULL; | |
| 3972 | + | |
| 3968 | 3973 | tegra_output_remove(&sor->output); |
| 3974 | +put_aux: | |
| 3975 | + if (sor->aux) | |
| 3976 | + put_device(sor->aux->dev); | |
| 3977 | + | |
| 3969 | 3978 | return err; |
| 3970 | 3979 | } |
| 3971 | 3980 | |
| @@ -3983,6 +3992,11 @@ static int tegra_sor_remove(struct platform_device *pdev) · 11 unmodified lines | ||
| 3983 | 3992 | |
| 3984 | 3993 | pm_runtime_disable(&pdev->dev); |
| 3985 | 3994 | |
| 3995 | + if (sor->aux) { | |
| 3996 | + put_device(sor->aux->dev); | |
| 3997 | + sor->output.ddc = NULL; | |
| 3998 | + } | |
| 3999 | + | |
| 3986 | 4000 | tegra_output_remove(&sor->output); |
| 3987 | 4001 | |
| 3988 | 4002 | return 0; |
| @@ -1139,7 +1139,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, · 1138 unmodified lines | ||
| 1139 | 1139 | if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL)) |
| 1140 | 1140 | return -EBUSY; |
| 1141 | 1141 | |
| 1142 | − if (!ttm_bo_get_unless_zero(bo)) { | |
| 1142 | + if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) || | |
| 1143 | + bo->ttm->page_flags & TTM_PAGE_FLAG_SG || | |
| 1144 | + bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED || | |
| 1145 | + !ttm_bo_get_unless_zero(bo)) { | |
| 1143 | 1146 | if (locked) |
| 1144 | 1147 | dma_resv_unlock(bo->base.resv); |
| 1145 | 1148 | return -EBUSY; |
| @@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx, · 142 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) { |
| 145 | 145 | list_for_each_entry(bo, &man->lru[j], lru) { |
| 146 | − uint32_t num_pages; | |
| 146 | + uint32_t num_pages = PFN_UP(bo->base.size); | |
| 147 | 147 | |
| 148 | − if (!bo->ttm || | |
| 149 | − bo->ttm->page_flags & TTM_PAGE_FLAG_SG || | |
| 150 | − bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED) | |
| 151 | − continue; | |
| 152 | − | |
| 153 | − num_pages = bo->ttm->num_pages; | |
| 154 | 148 | ret = ttm_bo_swapout(bo, ctx, gfp_flags); |
| 155 | 149 | /* ttm_bo_swapout has dropped the lru_lock */ |
| 156 | 150 | if (!ret) |
| @@ -372,7 +372,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) · 371 unmodified lines | ||
| 372 | 372 | if (!old_hvs_state->fifo_state[channel].in_use) |
| 373 | 373 | continue; |
| 374 | 374 | |
| 375 | − ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[i].pending_commit); | |
| 375 | + ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[channel].pending_commit); | |
| 376 | 376 | if (ret) |
| 377 | 377 | drm_err(dev, "Timed out waiting for commit\n"); |
| 378 | 378 | } |
| @@ -735,6 +735,29 @@ void host1x_driver_unregister(struct host1x_driver *driver) · 734 unmodified lines | ||
| 735 | 735 | } |
| 736 | 736 | EXPORT_SYMBOL(host1x_driver_unregister); |
| 737 | 737 | |
| 738 | +/** | |
| 739 | + * __host1x_client_init() - initialize a host1x client | |
| 740 | + * @client: host1x client | |
| 741 | + * @key: lock class key for the client-specific mutex | |
| 742 | + */ | |
| 743 | +void __host1x_client_init(struct host1x_client *client, struct lock_class_key *key) | |
| 744 | +{ | |
| 745 | + INIT_LIST_HEAD(&client->list); | |
| 746 | + __mutex_init(&client->lock, "host1x client lock", key); | |
| 747 | + client->usecount = 0; | |
| 748 | +} | |
| 749 | +EXPORT_SYMBOL(__host1x_client_init); | |
| 750 | + | |
| 751 | +/** | |
| 752 | + * host1x_client_exit() - uninitialize a host1x client | |
| 753 | + * @client: host1x client | |
| 754 | + */ | |
| 755 | +void host1x_client_exit(struct host1x_client *client) | |
| 756 | +{ | |
| 757 | + mutex_destroy(&client->lock); | |
| 758 | +} | |
| 759 | +EXPORT_SYMBOL(host1x_client_exit); | |
| 760 | + | |
| 738 | 761 | /** |
| 739 | 762 | * __host1x_client_register() - register a host1x client |
| 740 | 763 | * @client: host1x client |
| @@ -747,16 +770,11 @@ EXPORT_SYMBOL(host1x_driver_unregister); · 6 unmodified lines | ||
| 747 | 770 | * device and call host1x_device_init(), which will in turn call each client's |
| 748 | 771 | * &host1x_client_ops.init implementation. |
| 749 | 772 | */ |
| 750 | −int __host1x_client_register(struct host1x_client *client, | |
| 751 | − struct lock_class_key *key) | |
| 773 | +int __host1x_client_register(struct host1x_client *client) | |
| 752 | 774 | { |
| 753 | 775 | struct host1x *host1x; |
| 754 | 776 | int err; |
| 755 | 777 | |
| 756 | − INIT_LIST_HEAD(&client->list); | |
| 757 | − __mutex_init(&client->lock, "host1x client lock", key); | |
| 758 | − client->usecount = 0; | |
| 759 | − | |
| 760 | 778 | mutex_lock(&devices_lock); |
| 761 | 779 | |
| 762 | 780 | list_for_each_entry(host1x, &devices, list) { |
| @@ -93,11 +93,11 @@ menu "Special HID drivers" · 92 unmodified lines | ||
| 93 | 93 | depends on HID |
| 94 | 94 | |
| 95 | 95 | config HID_A4TECH |
| 96 | − tristate "A4 tech mice" | |
| 96 | + tristate "A4TECH mice" | |
| 97 | 97 | depends on HID |
| 98 | 98 | default !EXPERT |
| 99 | 99 | help |
| 100 | − Support for A4 tech X5 and WOP-35 / Trust 450L mice. | |
| 100 | + Support for some A4TECH mice with two scroll wheels. | |
| 101 | 101 | |
| 102 | 102 | config HID_ACCUTOUCH |
| 103 | 103 | tristate "Accutouch touch device" |
| @@ -922,6 +922,21 @@ config HID_SAMSUNG · 818 unmodified lines | ||
| 922 | 922 | help |
| 923 | 923 | Support for Samsung InfraRed remote control or keyboards. |
| 924 | 924 | |
| 925 | +config HID_SEMITEK | |
| 926 | + tristate "Semitek USB keyboards" | |
| 927 | + depends on HID | |
| 928 | + help | |
| 929 | + Support for Semitek USB keyboards that are not fully compliant | |
| 930 | + with the HID standard. | |
| 931 | + | |
| 932 | + There are many variants, including: | |
| 933 | + - GK61, GK64, GK68, GK84, GK96, etc. | |
| 934 | + - SK61, SK64, SK68, SK84, SK96, etc. | |
| 935 | + - Dierya DK61/DK66 | |
| 936 | + - Tronsmart TK09R | |
| 937 | + - Woo-dy | |
| 938 | + - X-Bows Nature/Knight | |
| 939 | + | |
| 925 | 940 | config HID_SONY |
| 926 | 941 | tristate "Sony PS2/3/4 accessories" |
| 927 | 942 | depends on USB_HID |
| @@ -106,6 +106,7 @@ obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ · 105 unmodified lines | ||
| 106 | 106 | obj-$(CONFIG_HID_RMI) += hid-rmi.o |
| 107 | 107 | obj-$(CONFIG_HID_SAITEK) += hid-saitek.o |
| 108 | 108 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o |
| 109 | +obj-$(CONFIG_HID_SEMITEK) += hid-semitek.o | |
| 109 | 110 | obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o |
| 110 | 111 | obj-$(CONFIG_HID_SONY) += hid-sony.o |
| 111 | 112 | obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o |
| @@ -88,6 +88,7 @@ static void amd_sfh_work(struct work_struct *work) · 87 unmodified lines | ||
| 88 | 88 | sensor_index = req_node->sensor_idx; |
| 89 | 89 | report_id = req_node->report_id; |
| 90 | 90 | node_type = req_node->report_type; |
| 91 | + kfree(req_node); | |
| 91 | 92 | |
| 92 | 93 | if (node_type == HID_FEATURE_REPORT) { |
| 93 | 94 | report_size = get_feature_report(sensor_index, report_id, |
| @@ -142,7 +143,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) · 48 unmodified lines | ||
| 142 | 143 | int rc, i; |
| 143 | 144 | |
| 144 | 145 | dev = &privdata->pdev->dev; |
| 145 | − cl_data = kzalloc(sizeof(*cl_data), GFP_KERNEL); | |
| 146 | + cl_data = devm_kzalloc(dev, sizeof(*cl_data), GFP_KERNEL); | |
| 146 | 147 | if (!cl_data) |
| 147 | 148 | return -ENOMEM; |
| 148 | 149 | |
| @@ -175,12 +176,12 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) · 26 unmodified lines | ||
| 175 | 176 | rc = -EINVAL; |
| 176 | 177 | goto cleanup; |
| 177 | 178 | } |
| 178 | − cl_data->feature_report[i] = kzalloc(feature_report_size, GFP_KERNEL); | |
| 179 | + cl_data->feature_report[i] = devm_kzalloc(dev, feature_report_size, GFP_KERNEL); | |
| 179 | 180 | if (!cl_data->feature_report[i]) { |
| 180 | 181 | rc = -ENOMEM; |
| 181 | 182 | goto cleanup; |
| 182 | 183 | } |
| 183 | − cl_data->input_report[i] = kzalloc(input_report_size, GFP_KERNEL); | |
| 184 | + cl_data->input_report[i] = devm_kzalloc(dev, input_report_size, GFP_KERNEL); | |
| 184 | 185 | if (!cl_data->input_report[i]) { |
| 185 | 186 | rc = -ENOMEM; |
| 186 | 187 | goto cleanup; |
| @@ -189,7 +190,8 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) · 2 unmodified lines | ||
| 189 | 190 | info.sensor_idx = cl_idx; |
| 190 | 191 | info.dma_address = cl_data->sensor_dma_addr[i]; |
| 191 | 192 | |
| 192 | − cl_data->report_descr[i] = kzalloc(cl_data->report_descr_sz[i], GFP_KERNEL); | |
| 193 | + cl_data->report_descr[i] = | |
| 194 | + devm_kzalloc(dev, cl_data->report_descr_sz[i], GFP_KERNEL); | |
| 193 | 195 | if (!cl_data->report_descr[i]) { |
| 194 | 196 | rc = -ENOMEM; |
| 195 | 197 | goto cleanup; |
| @@ -214,11 +216,11 @@ cleanup: · 18 unmodified lines | ||
| 214 | 216 | cl_data->sensor_virt_addr[i], |
| 215 | 217 | cl_data->sensor_dma_addr[i]); |
| 216 | 218 | } |
| 217 | − kfree(cl_data->feature_report[i]); | |
| 218 | − kfree(cl_data->input_report[i]); | |
| 219 | − kfree(cl_data->report_descr[i]); | |
| 219 | + devm_kfree(dev, cl_data->feature_report[i]); | |
| 220 | + devm_kfree(dev, cl_data->input_report[i]); | |
| 221 | + devm_kfree(dev, cl_data->report_descr[i]); | |
| 220 | 222 | } |
| 221 | − kfree(cl_data); | |
| 223 | + devm_kfree(dev, cl_data); | |
| 222 | 224 | return rc; |
| 223 | 225 | } |
| 224 | 226 | |
| @@ -241,6 +243,5 @@ int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata) · 16 unmodified lines | ||
| 241 | 243 | cl_data->sensor_dma_addr[i]); |
| 242 | 244 | } |
| 243 | 245 | } |
| 244 | − kfree(cl_data); | |
| 245 | 246 | return 0; |
| 246 | 247 | } |
| @@ -162,9 +162,6 @@ void amdtp_hid_remove(struct amdtp_cl_data *cli_data) · 161 unmodified lines | ||
| 162 | 162 | int i; |
| 163 | 163 | |
| 164 | 164 | for (i = 0; i < cli_data->num_hid_devices; ++i) { |
| 165 | − kfree(cli_data->feature_report[i]); | |
| 166 | − kfree(cli_data->input_report[i]); | |
| 167 | − kfree(cli_data->report_descr[i]); | |
| 168 | 165 | if (cli_data->hid_sensor_hubs[i]) { |
| 169 | 166 | kfree(cli_data->hid_sensor_hubs[i]->driver_data); |
| 170 | 167 | hid_destroy_device(cli_data->hid_sensor_hubs[i]); |
| @@ -147,6 +147,8 @@ static const struct hid_device_id a4_devices[] = { · 146 unmodified lines | ||
| 147 | 147 | .driver_data = A4_2WHEEL_MOUSE_HACK_B8 }, |
| 148 | 148 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649), |
| 149 | 149 | .driver_data = A4_2WHEEL_MOUSE_HACK_B8 }, |
| 150 | + { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_NB_95), | |
| 151 | + .driver_data = A4_2WHEEL_MOUSE_HACK_B8 }, | |
| 150 | 152 | { } |
| 151 | 153 | }; |
| 152 | 154 | MODULE_DEVICE_TABLE(hid, a4_devices); |
| @@ -79,10 +79,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); · 78 unmodified lines | ||
| 79 | 79 | #define QUIRK_T100_KEYBOARD BIT(6) |
| 80 | 80 | #define QUIRK_T100CHI BIT(7) |
| 81 | 81 | #define QUIRK_G752_KEYBOARD BIT(8) |
| 82 | −#define QUIRK_T101HA_DOCK BIT(9) | |
| 83 | −#define QUIRK_T90CHI BIT(10) | |
| 84 | −#define QUIRK_MEDION_E1239T BIT(11) | |
| 85 | −#define QUIRK_ROG_NKEY_KEYBOARD BIT(12) | |
| 82 | +#define QUIRK_T90CHI BIT(9) | |
| 83 | +#define QUIRK_MEDION_E1239T BIT(10) | |
| 84 | +#define QUIRK_ROG_NKEY_KEYBOARD BIT(11) | |
| 86 | 85 | |
| 87 | 86 | #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ |
| 88 | 87 | QUIRK_NO_INIT_REPORTS | \ |
| @@ -335,7 +334,7 @@ static int asus_raw_event(struct hid_device *hdev, · 246 unmodified lines | ||
| 335 | 334 | if (drvdata->quirks & QUIRK_MEDION_E1239T) |
| 336 | 335 | return asus_e1239t_event(drvdata, data, size); |
| 337 | 336 | |
| 338 | − if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { | |
| 337 | + if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) { | |
| 339 | 338 | /* |
| 340 | 339 | * Skip these report ID, the device emits a continuous stream associated |
| 341 | 340 | * with the AURA mode it is in which looks like an 'echo'. |
| @@ -355,6 +354,16 @@ static int asus_raw_event(struct hid_device *hdev, · 13 unmodified lines | ||
| 355 | 354 | return -1; |
| 356 | 355 | } |
| 357 | 356 | } |
| 357 | + if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { | |
| 358 | + /* | |
| 359 | + * G713 and G733 send these codes on some keypresses, depending on | |
| 360 | + * the key pressed it can trigger a shutdown event if not caught. | |
| 361 | + */ | |
| 362 | + if(data[0] == 0x02 && data[1] == 0x30) { | |
| 363 | + return -1; | |
| 364 | + } | |
| 365 | + } | |
| 366 | + | |
| 358 | 367 | } |
| 359 | 368 | |
| 360 | 369 | return 0; |
| @@ -1072,11 +1081,6 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) · 711 unmodified lines | ||
| 1072 | 1081 | return ret; |
| 1073 | 1082 | } |
| 1074 | 1083 | |
| 1075 | − /* use hid-multitouch for T101HA touchpad */ | |
| 1076 | − if (id->driver_data & QUIRK_T101HA_DOCK && | |
| 1077 | − hdev->collection->usage == HID_GD_MOUSE) | |
| 1078 | − return -ENODEV; | |
| 1079 | − | |
| 1080 | 1084 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
| 1081 | 1085 | if (ret) { |
| 1082 | 1086 | hid_err(hdev, "Asus hw start failed: %d\n", ret); |
| @@ -1230,8 +1234,6 @@ static const struct hid_device_id asus_devices[] = { · 147 unmodified lines | ||
| 1230 | 1234 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, |
| 1231 | 1235 | USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD), |
| 1232 | 1236 | QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES }, |
| 1233 | − { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, | |
| 1234 | − USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD), QUIRK_T101HA_DOCK }, | |
| 1235 | 1237 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) }, |
| 1236 | 1238 | { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) }, |
| 1237 | 1239 | { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) }, |
| @@ -1239,6 +1241,12 @@ static const struct hid_device_id asus_devices[] = { · 1 unmodified line | ||
| 1239 | 1241 | USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), QUIRK_T100CHI }, |
| 1240 | 1242 | { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE_MEDION_E1239T), |
| 1241 | 1243 | QUIRK_MEDION_E1239T }, |
| 1244 | + /* | |
| 1245 | + * Note bind to the HID_GROUP_GENERIC group, so that we only bind to the keyboard | |
| 1246 | + * part, while letting hid-multitouch.c handle the touchpad. | |
| 1247 | + */ | |
| 1248 | + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, | |
| 1249 | + USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) }, | |
| 1242 | 1250 | { } |
| 1243 | 1251 | }; |
| 1244 | 1252 | MODULE_DEVICE_TABLE(hid, asus_devices); |
| @@ -2005,6 +2005,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) · 2004 unmodified lines | ||
| 2005 | 2005 | case BUS_I2C: |
| 2006 | 2006 | bus = "I2C"; |
| 2007 | 2007 | break; |
| 2008 | + case BUS_VIRTUAL: | |
| 2009 | + bus = "VIRTUAL"; | |
| 2010 | + break; | |
| 2008 | 2011 | default: |
| 2009 | 2012 | bus = "<UNKNOWN>"; |
| 2010 | 2013 | } |
| @@ -2588,7 +2591,6 @@ int hid_check_keys_pressed(struct hid_device *hid) · 577 unmodified lines | ||
| 2588 | 2591 | |
| 2589 | 2592 | return 0; |
| 2590 | 2593 | } |
| 2591 | − | |
| 2592 | 2594 | EXPORT_SYMBOL_GPL(hid_check_keys_pressed); |
| 2593 | 2595 | |
| 2594 | 2596 | static int __init hid_init(void) |
| @@ -930,6 +930,9 @@ static const char *keys[KEY_MAX + 1] = { · 929 unmodified lines | ||
| 930 | 930 | [KEY_APPSELECT] = "AppSelect", |
| 931 | 931 | [KEY_SCREENSAVER] = "ScreenSaver", |
| 932 | 932 | [KEY_VOICECOMMAND] = "VoiceCommand", |
| 933 | + [KEY_ASSISTANT] = "Assistant", | |
| 934 | + [KEY_KBD_LAYOUT_NEXT] = "KbdLayoutNext", | |
| 935 | + [KEY_EMOJI_PICKER] = "EmojiPicker", | |
| 933 | 936 | [KEY_BRIGHTNESS_MIN] = "BrightnessMin", |
| 934 | 937 | [KEY_BRIGHTNESS_MAX] = "BrightnessMax", |
| 935 | 938 | [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto", |
| @@ -201,7 +201,7 @@ struct ft260_i2c_write_request_report { · 200 unmodified lines | ||
| 201 | 201 | u8 address; /* 7-bit I2C address */ |
| 202 | 202 | u8 flag; /* I2C transaction condition */ |
| 203 | 203 | u8 length; /* data payload length */ |
| 204 | − u8 data[60]; /* data payload */ | |
| 204 | + u8 data[FT260_WR_DATA_MAX]; /* data payload */ | |
| 205 | 205 | } __packed; |
| 206 | 206 | |
| 207 | 207 | struct ft260_i2c_read_request_report { |
| @@ -249,7 +249,10 @@ static int ft260_hid_feature_report_get(struct hid_device *hdev, · 41 unmodified lines | ||
| 249 | 249 | |
| 250 | 250 | ret = hid_hw_raw_request(hdev, report_id, buf, len, HID_FEATURE_REPORT, |
| 251 | 251 | HID_REQ_GET_REPORT); |
| 252 | − memcpy(data, buf, len); | |
| 252 | + if (likely(ret == len)) | |
| 253 | + memcpy(data, buf, len); | |
| 254 | + else if (ret >= 0) | |
| 255 | + ret = -EIO; | |
| 253 | 256 | kfree(buf); |
| 254 | 257 | return ret; |
| 255 | 258 | } |
| @@ -298,7 +301,7 @@ static int ft260_xfer_status(struct ft260_device *dev) · 42 unmodified lines | ||
| 298 | 301 | |
| 299 | 302 | ret = ft260_hid_feature_report_get(hdev, FT260_I2C_STATUS, |
| 300 | 303 | (u8 *)&report, sizeof(report)); |
| 301 | − if (ret < 0) { | |
| 304 | + if (unlikely(ret < 0)) { | |
| 302 | 305 | hid_err(hdev, "failed to retrieve status: %d\n", ret); |
| 303 | 306 | return ret; |
| 304 | 307 | } |
| @@ -429,6 +432,9 @@ static int ft260_smbus_write(struct ft260_device *dev, u8 addr, u8 cmd, · 124 unmodified lines | ||
| 429 | 432 | struct ft260_i2c_write_request_report *rep = |
| 430 | 433 | (struct ft260_i2c_write_request_report *)dev->write_buf; |
| 431 | 434 | |
| 435 | + if (data_len >= sizeof(rep->data)) | |
| 436 | + return -EINVAL; | |
| 437 | + | |
| 432 | 438 | rep->address = addr; |
| 433 | 439 | rep->data[0] = cmd; |
| 434 | 440 | rep->length = data_len + 1; |
| @@ -721,10 +727,9 @@ static int ft260_get_system_config(struct hid_device *hdev, · 286 unmodified lines | ||
| 721 | 727 | |
| 722 | 728 | ret = ft260_hid_feature_report_get(hdev, FT260_SYSTEM_SETTINGS, |
| 723 | 729 | (u8 *)cfg, len); |
| 724 | − if (ret != len) { | |
| 730 | + if (ret < 0) { | |
| 725 | 731 | hid_err(hdev, "failed to retrieve system status\n"); |
| 726 | − if (ret >= 0) | |
| 727 | − return -EIO; | |
| 732 | + return ret; | |
| 728 | 733 | } |
| 729 | 734 | return 0; |
| 730 | 735 | } |
| @@ -777,8 +782,8 @@ static int ft260_byte_show(struct hid_device *hdev, int id, u8 *cfg, int len, · 46 unmodified lines | ||
| 777 | 782 | int ret; |
| 778 | 783 | |
| 779 | 784 | ret = ft260_hid_feature_report_get(hdev, id, cfg, len); |
| 780 | − if (ret != len && ret >= 0) | |
| 781 | − return -EIO; | |
| 785 | + if (ret < 0) | |
| 786 | + return ret; | |
| 782 | 787 | |
| 783 | 788 | return scnprintf(buf, PAGE_SIZE, "%hi\n", *field); |
| 784 | 789 | } |
| @@ -789,8 +794,8 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, · 4 unmodified lines | ||
| 789 | 794 | int ret; |
| 790 | 795 | |
| 791 | 796 | ret = ft260_hid_feature_report_get(hdev, id, cfg, len); |
| 792 | − if (ret != len && ret >= 0) | |
| 793 | − return -EIO; | |
| 797 | + if (ret < 0) | |
| 798 | + return ret; | |
| 794 | 799 | |
| 795 | 800 | return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field)); |
| 796 | 801 | } |
| @@ -941,10 +946,8 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id) · 144 unmodified lines | ||
| 941 | 946 | |
| 942 | 947 | ret = ft260_hid_feature_report_get(hdev, FT260_CHIP_VERSION, |
| 943 | 948 | (u8 *)&version, sizeof(version)); |
| 944 | − if (ret != sizeof(version)) { | |
| 949 | + if (ret < 0) { | |
| 945 | 950 | hid_err(hdev, "failed to retrieve chip version\n"); |
| 946 | − if (ret >= 0) | |
| 947 | − ret = -EIO; | |
| 948 | 951 | goto err_hid_close; |
| 949 | 952 | } |
| 950 | 953 | |
| @@ -54,6 +54,7 @@ static const struct hid_device_id gt683r_led_id[] = { · 53 unmodified lines | ||
| 54 | 54 | { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, |
| 55 | 55 | { } |
| 56 | 56 | }; |
| 57 | +MODULE_DEVICE_TABLE(hid, gt683r_led_id); | |
| 57 | 58 | |
| 58 | 59 | static void gt683r_brightness_set(struct led_classdev *led_cdev, |
| 59 | 60 | enum led_brightness brightness) |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 |
| 27 | 27 | #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a |
| 28 | 28 | #define USB_DEVICE_ID_A4TECH_RP_649 0x001a |
| 29 | +#define USB_DEVICE_ID_A4TECH_NB_95 0x022b | |
| 29 | 30 | |
| 30 | 31 | #define USB_VENDOR_ID_AASHIMA 0x06d6 |
| 31 | 32 | #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 |
| @@ -299,8 +300,6 @@ · 267 unmodified lines | ||
| 299 | 300 | |
| 300 | 301 | #define USB_VENDOR_ID_CORSAIR 0x1b1c |
| 301 | 302 | #define USB_DEVICE_ID_CORSAIR_K90 0x1b02 |
| 302 | − | |
| 303 | −#define USB_VENDOR_ID_CORSAIR 0x1b1c | |
| 304 | 303 | #define USB_DEVICE_ID_CORSAIR_K70R 0x1b09 |
| 305 | 304 | #define USB_DEVICE_ID_CORSAIR_K95RGB 0x1b11 |
| 306 | 305 | #define USB_DEVICE_ID_CORSAIR_M65RGB 0x1b12 |
| @@ -751,6 +750,7 @@ · 444 unmodified lines | ||
| 751 | 750 | #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 |
| 752 | 751 | #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 |
| 753 | 752 | #define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5 |
| 753 | +#define USB_DEVICE_ID_LENOVO_OPTICAL_USB_MOUSE_600E 0x600e | |
| 754 | 754 | #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d |
| 755 | 755 | #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019 0x6019 |
| 756 | 756 | #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E 0x602e |
| @@ -1051,6 +1051,7 @@ · 294 unmodified lines | ||
| 1051 | 1051 | #define USB_DEVICE_ID_SAITEK_X52 0x075c |
| 1052 | 1052 | #define USB_DEVICE_ID_SAITEK_X52_2 0x0255 |
| 1053 | 1053 | #define USB_DEVICE_ID_SAITEK_X52_PRO 0x0762 |
| 1054 | +#define USB_DEVICE_ID_SAITEK_X65 0x0b6a | |
| 1054 | 1055 | |
| 1055 | 1056 | #define USB_VENDOR_ID_SAMSUNG 0x0419 |
| 1056 | 1057 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
| @@ -1060,6 +1061,9 @@ · 3 unmodified lines | ||
| 1060 | 1061 | #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD 0x0023 |
| 1061 | 1062 | #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD2 0x0027 |
| 1062 | 1063 | |
| 1064 | +#define USB_VENDOR_ID_SEMITEK 0x1ea7 | |
| 1065 | +#define USB_DEVICE_ID_SEMITEK_KEYBOARD 0x0907 | |
| 1066 | + | |
| 1063 | 1067 | #define USB_VENDOR_ID_SENNHEISER 0x1395 |
| 1064 | 1068 | #define USB_DEVICE_ID_SENNHEISER_BTD500USB 0x002c |
| 1065 | 1069 | |
| @@ -1161,6 +1165,7 @@ · 95 unmodified lines | ||
| 1161 | 1165 | #define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819 |
| 1162 | 1166 | #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968 |
| 1163 | 1167 | #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 |
| 1168 | +#define USB_DEVICE_ID_SYNAPTICS_DELL_K15A 0x6e21 | |
| 1164 | 1169 | #define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1002 0x73f4 |
| 1165 | 1170 | #define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5 |
| 1166 | 1171 | #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7 |
| @@ -964,6 +964,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 963 unmodified lines | ||
| 964 | 964 | |
| 965 | 965 | case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; |
| 966 | 966 | case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; |
| 967 | + | |
| 968 | + case 0x0d9: map_key_clear(KEY_EMOJI_PICKER); break; | |
| 969 | + | |
| 967 | 970 | case 0x0e0: map_abs_clear(ABS_VOLUME); break; |
| 968 | 971 | case 0x0e2: map_key_clear(KEY_MUTE); break; |
| 969 | 972 | case 0x0e5: map_key_clear(KEY_BASSBOOST); break; |
| @@ -1263,6 +1263,7 @@ static int hidpp20_battery_map_status_voltage(u8 data[3], int *voltage, · 1262 unmodified lines | ||
| 1263 | 1263 | int status; |
| 1264 | 1264 | |
| 1265 | 1265 | long flags = (long) data[2]; |
| 1266 | + *level = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN; | |
| 1266 | 1267 | |
| 1267 | 1268 | if (flags & 0x80) |
| 1268 | 1269 | switch (flags & 0x07) { |
| @@ -693,7 +693,7 @@ static int magicmouse_probe(struct hid_device *hdev, · 692 unmodified lines | ||
| 693 | 693 | if (id->vendor == USB_VENDOR_ID_APPLE && |
| 694 | 694 | id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && |
| 695 | 695 | hdev->type != HID_TYPE_USBMOUSE) |
| 696 | − return 0; | |
| 696 | + return -ENODEV; | |
| 697 | 697 | |
| 698 | 698 | msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL); |
| 699 | 699 | if (msc == NULL) { |
| @@ -779,7 +779,10 @@ err_stop_hw: · 79 unmodified lines | ||
| 779 | 779 | static void magicmouse_remove(struct hid_device *hdev) |
| 780 | 780 | { |
| 781 | 781 | struct magicmouse_sc *msc = hid_get_drvdata(hdev); |
| 782 | − cancel_delayed_work_sync(&msc->work); | |
| 782 | + | |
| 783 | + if (msc) | |
| 784 | + cancel_delayed_work_sync(&msc->work); | |
| 785 | + | |
| 783 | 786 | hid_hw_stop(hdev); |
| 784 | 787 | } |
| 785 | 788 | |
| @@ -70,6 +70,7 @@ MODULE_LICENSE("GPL"); · 69 unmodified lines | ||
| 70 | 70 | #define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18) |
| 71 | 71 | #define MT_QUIRK_SEPARATE_APP_REPORT BIT(19) |
| 72 | 72 | #define MT_QUIRK_FORCE_MULTI_INPUT BIT(20) |
| 73 | +#define MT_QUIRK_DISABLE_WAKEUP BIT(21) | |
| 73 | 74 | |
| 74 | 75 | #define MT_INPUTMODE_TOUCHSCREEN 0x02 |
| 75 | 76 | #define MT_INPUTMODE_TOUCHPAD 0x03 |
| @@ -191,6 +192,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app); · 115 unmodified lines | ||
| 191 | 192 | #define MT_CLS_EXPORT_ALL_INPUTS 0x0013 |
| 192 | 193 | /* reserved 0x0014 */ |
| 193 | 194 | #define MT_CLS_WIN_8_FORCE_MULTI_INPUT 0x0015 |
| 195 | +#define MT_CLS_WIN_8_DISABLE_WAKEUP 0x0016 | |
| 194 | 196 | |
| 195 | 197 | /* vendor specific classes */ |
| 196 | 198 | #define MT_CLS_3M 0x0101 |
| @@ -283,6 +285,15 @@ static const struct mt_class mt_classes[] = { · 86 unmodified lines | ||
| 283 | 285 | MT_QUIRK_WIN8_PTP_BUTTONS | |
| 284 | 286 | MT_QUIRK_FORCE_MULTI_INPUT, |
| 285 | 287 | .export_all_inputs = true }, |
| 288 | + { .name = MT_CLS_WIN_8_DISABLE_WAKEUP, | |
| 289 | + .quirks = MT_QUIRK_ALWAYS_VALID | | |
| 290 | + MT_QUIRK_IGNORE_DUPLICATES | | |
| 291 | + MT_QUIRK_HOVERING | | |
| 292 | + MT_QUIRK_CONTACT_CNT_ACCURATE | | |
| 293 | + MT_QUIRK_STICKY_FINGERS | | |
| 294 | + MT_QUIRK_WIN8_PTP_BUTTONS | | |
| 295 | + MT_QUIRK_DISABLE_WAKEUP, | |
| 296 | + .export_all_inputs = true }, | |
| 286 | 297 | |
| 287 | 298 | /* |
| 288 | 299 | * vendor specific classes |
| @@ -604,9 +615,13 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td, · 315 unmodified lines | ||
| 604 | 615 | if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) |
| 605 | 616 | continue; |
| 606 | 617 | |
| 607 | − for (n = 0; n < field->report_count; n++) { | |
| 608 | − if (field->usage[n].hid == HID_DG_CONTACTID) | |
| 609 | − rdata->is_mt_collection = true; | |
| 618 | + if (field->logical == HID_DG_FINGER || td->hdev->group != HID_GROUP_MULTITOUCH_WIN_8) { | |
| 619 | + for (n = 0; n < field->report_count; n++) { | |
| 620 | + if (field->usage[n].hid == HID_DG_CONTACTID) { | |
| 621 | + rdata->is_mt_collection = true; | |
| 622 | + break; | |
| 623 | + } | |
| 624 | + } | |
| 610 | 625 | } |
| 611 | 626 | } |
| 612 | 627 | |
| @@ -759,7 +774,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, · 146 unmodified lines | ||
| 759 | 774 | return 1; |
| 760 | 775 | case HID_DG_CONFIDENCE: |
| 761 | 776 | if ((cls->name == MT_CLS_WIN_8 || |
| 762 | − cls->name == MT_CLS_WIN_8_FORCE_MULTI_INPUT) && | |
| 777 | + cls->name == MT_CLS_WIN_8_FORCE_MULTI_INPUT || | |
| 778 | + cls->name == MT_CLS_WIN_8_DISABLE_WAKEUP) && | |
| 763 | 779 | (field->application == HID_DG_TOUCHPAD || |
| 764 | 780 | field->application == HID_DG_TOUCHSCREEN)) |
| 765 | 781 | app->quirks |= MT_QUIRK_CONFIDENCE; |
| @@ -1576,13 +1592,13 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) · 810 unmodified lines | ||
| 1576 | 1592 | /* we do not set suffix = "Touchscreen" */ |
| 1577 | 1593 | hi->input->name = hdev->name; |
| 1578 | 1594 | break; |
| 1579 | − case HID_DG_STYLUS: | |
| 1580 | − /* force BTN_STYLUS to allow tablet matching in udev */ | |
| 1581 | − __set_bit(BTN_STYLUS, hi->input->keybit); | |
| 1582 | − break; | |
| 1583 | 1595 | case HID_VD_ASUS_CUSTOM_MEDIA_KEYS: |
| 1584 | 1596 | suffix = "Custom Media Keys"; |
| 1585 | 1597 | break; |
| 1598 | + case HID_DG_STYLUS: | |
| 1599 | + /* force BTN_STYLUS to allow tablet matching in udev */ | |
| 1600 | + __set_bit(BTN_STYLUS, hi->input->keybit); | |
| 1601 | + fallthrough; | |
| 1586 | 1602 | case HID_DG_PEN: |
| 1587 | 1603 | suffix = "Stylus"; |
| 1588 | 1604 | break; |
| @@ -1749,8 +1765,14 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) · 160 unmodified lines | ||
| 1749 | 1765 | #ifdef CONFIG_PM |
| 1750 | 1766 | static int mt_suspend(struct hid_device *hdev, pm_message_t state) |
| 1751 | 1767 | { |
| 1768 | + struct mt_device *td = hid_get_drvdata(hdev); | |
| 1769 | + | |
| 1752 | 1770 | /* High latency is desirable for power savings during S3/S0ix */ |
| 1753 | − mt_set_modes(hdev, HID_LATENCY_HIGH, true, true); | |
| 1771 | + if (td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP) | |
| 1772 | + mt_set_modes(hdev, HID_LATENCY_HIGH, false, false); | |
| 1773 | + else | |
| 1774 | + mt_set_modes(hdev, HID_LATENCY_HIGH, true, true); | |
| 1775 | + | |
| 1754 | 1776 | return 0; |
| 1755 | 1777 | } |
| 1756 | 1778 | |
| @@ -1809,6 +1831,12 @@ static const struct hid_device_id mt_devices[] = { · 52 unmodified lines | ||
| 1809 | 1831 | MT_USB_DEVICE(USB_VENDOR_ID_ANTON, |
| 1810 | 1832 | USB_DEVICE_ID_ANTON_TOUCH_PAD) }, |
| 1811 | 1833 | |
| 1834 | + /* Asus T101HA */ | |
| 1835 | + { .driver_data = MT_CLS_WIN_8_DISABLE_WAKEUP, | |
| 1836 | + HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, | |
| 1837 | + USB_VENDOR_ID_ASUSTEK, | |
| 1838 | + USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) }, | |
| 1839 | + | |
| 1812 | 1840 | /* Asus T304UA */ |
| 1813 | 1841 | { .driver_data = MT_CLS_ASUS, |
| 1814 | 1842 | HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, |
| @@ -110,6 +110,7 @@ static const struct hid_device_id hid_quirks[] = { · 109 unmodified lines | ||
| 110 | 110 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912), HID_QUIRK_MULTI_INPUT }, |
| 111 | 111 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT }, |
| 112 | 112 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL }, |
| 113 | + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_OPTICAL_USB_MOUSE_600E), HID_QUIRK_ALWAYS_POLL }, | |
| 113 | 114 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL }, |
| 114 | 115 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019), HID_QUIRK_ALWAYS_POLL }, |
| 115 | 116 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E), HID_QUIRK_ALWAYS_POLL }, |
| @@ -158,6 +159,7 @@ static const struct hid_device_id hid_quirks[] = { · 42 unmodified lines | ||
| 158 | 159 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
| 159 | 160 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
| 160 | 161 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
| 162 | + { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X65), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | |
| 161 | 163 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS }, |
| 162 | 164 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, |
| 163 | 165 | { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET }, |
| @@ -176,6 +178,7 @@ static const struct hid_device_id hid_quirks[] = { · 12 unmodified lines | ||
| 176 | 178 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS }, |
| 177 | 179 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS }, |
| 178 | 180 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K12A), HID_QUIRK_NO_INIT_REPORTS }, |
| 181 | + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K15A), HID_QUIRK_NO_INIT_REPORTS }, | |
| 179 | 182 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD }, |
| 180 | 183 | { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, |
| 181 | 184 | { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET }, |
| @@ -211,6 +214,7 @@ static const struct hid_device_id hid_have_special_driver[] = { · 29 unmodified lines | ||
| 211 | 214 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, |
| 212 | 215 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
| 213 | 216 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, |
| 217 | + { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_NB_95) }, | |
| 214 | 218 | #endif |
| 215 | 219 | #if IS_ENABLED(CONFIG_HID_ACCUTOUCH) |
| 216 | 220 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) }, |
| @@ -0,0 +1,40 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | +/* | |
| 3 | + * HID driver for Semitek keyboards | |
| 4 | + * | |
| 5 | + * Copyright (c) 2021 Benjamin Moody | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#include <linux/device.h> | |
| 9 | +#include <linux/hid.h> | |
| 10 | +#include <linux/module.h> | |
| 11 | + | |
| 12 | +#include "hid-ids.h" | |
| 13 | + | |
| 14 | +static __u8 *semitek_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |
| 15 | + unsigned int *rsize) | |
| 16 | +{ | |
| 17 | + /* In the report descriptor for interface 2, fix the incorrect | |
| 18 | + description of report ID 0x04 (the report contains a | |
| 19 | + bitmask, not an array of keycodes.) */ | |
| 20 | + if (*rsize == 0xcb && rdesc[0x83] == 0x81 && rdesc[0x84] == 0x00) { | |
| 21 | + hid_info(hdev, "fixing up Semitek report descriptor\n"); | |
| 22 | + rdesc[0x84] = 0x02; | |
| 23 | + } | |
| 24 | + return rdesc; | |
| 25 | +} | |
| 26 | + | |
| 27 | +static const struct hid_device_id semitek_devices[] = { | |
| 28 | + { HID_USB_DEVICE(USB_VENDOR_ID_SEMITEK, USB_DEVICE_ID_SEMITEK_KEYBOARD) }, | |
| 29 | + { } | |
| 30 | +}; | |
| 31 | +MODULE_DEVICE_TABLE(hid, semitek_devices); | |
| 32 | + | |
| 33 | +static struct hid_driver semitek_driver = { | |
| 34 | + .name = "semitek", | |
| 35 | + .id_table = semitek_devices, | |
| 36 | + .report_fixup = semitek_report_fixup, | |
| 37 | +}; | |
| 38 | +module_hid_driver(semitek_driver); | |
| 39 | + | |
| 40 | +MODULE_LICENSE("GPL"); | |
| @@ -387,7 +387,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr, · 386 unmodified lines | ||
| 387 | 387 | struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev); |
| 388 | 388 | int index, field_index, usage; |
| 389 | 389 | char name[HID_CUSTOM_NAME_LENGTH]; |
| 390 | − int value; | |
| 390 | + int value, ret; | |
| 391 | 391 | |
| 392 | 392 | if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage, |
| 393 | 393 | name) == 3) { |
| @@ -403,8 +403,10 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr, · 9 unmodified lines | ||
| 403 | 403 | |
| 404 | 404 | report_id = sensor_inst->fields[field_index].attribute. |
| 405 | 405 | report_id; |
| 406 | − sensor_hub_set_feature(sensor_inst->hsdev, report_id, | |
| 407 | − index, sizeof(value), &value); | |
| 406 | + ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id, | |
| 407 | + index, sizeof(value), &value); | |
| 408 | + if (ret) | |
| 409 | + return ret; | |
| 408 | 410 | } else |
| 409 | 411 | return -EINVAL; |
| 410 | 412 | |
| @@ -209,16 +209,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, · 208 unmodified lines | ||
| 209 | 209 | buffer_size = buffer_size / sizeof(__s32); |
| 210 | 210 | if (buffer_size) { |
| 211 | 211 | for (i = 0; i < buffer_size; ++i) { |
| 212 | − hid_set_field(report->field[field_index], i, | |
| 213 | − (__force __s32)cpu_to_le32(*buf32)); | |
| 212 | + ret = hid_set_field(report->field[field_index], i, | |
| 213 | + (__force __s32)cpu_to_le32(*buf32)); | |
| 214 | + if (ret) | |
| 215 | + goto done_proc; | |
| 216 | + | |
| 214 | 217 | ++buf32; |
| 215 | 218 | } |
| 216 | 219 | } |
| 217 | 220 | if (remaining_bytes) { |
| 218 | 221 | value = 0; |
| 219 | 222 | memcpy(&value, (u8 *)buf32, remaining_bytes); |
| 220 | − hid_set_field(report->field[field_index], i, | |
| 221 | − (__force __s32)cpu_to_le32(value)); | |
| 223 | + ret = hid_set_field(report->field[field_index], i, | |
| 224 | + (__force __s32)cpu_to_le32(value)); | |
| 225 | + if (ret) | |
| 226 | + goto done_proc; | |
| 222 | 227 | } |
| 223 | 228 | hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT); |
| 224 | 229 | hid_hw_wait(hsdev->hdev); |
| @@ -312,7 +312,7 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i · 311 unmodified lines | ||
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | tm_wheel->change_request = kzalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); |
| 315 | − if (!tm_wheel->model_request) { | |
| 315 | + if (!tm_wheel->change_request) { | |
| 316 | 316 | ret = -ENOMEM; |
| 317 | 317 | goto error5; |
| 318 | 318 | } |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) |
| 46 | 46 | #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) |
| 47 | 47 | #define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) |
| 48 | +#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(7) | |
| 48 | 49 | |
| 49 | 50 | |
| 50 | 51 | /* flags */ |
| @@ -178,6 +179,11 @@ static const struct i2c_hid_quirks { · 127 unmodified lines | ||
| 178 | 179 | I2C_HID_QUIRK_RESET_ON_RESUME }, |
| 179 | 180 | { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720, |
| 180 | 181 | I2C_HID_QUIRK_BAD_INPUT_SIZE }, |
| 182 | + /* | |
| 183 | + * Sending the wakeup after reset actually break ELAN touchscreen controller | |
| 184 | + */ | |
| 185 | + { USB_VENDOR_ID_ELAN, HID_ANY_ID, | |
| 186 | + I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET }, | |
| 181 | 187 | { 0, 0 } |
| 182 | 188 | }; |
| 183 | 189 | |
| @@ -461,7 +467,8 @@ static int i2c_hid_hwreset(struct i2c_client *client) · 277 unmodified lines | ||
| 461 | 467 | } |
| 462 | 468 | |
| 463 | 469 | /* At least some SIS devices need this after reset */ |
| 464 | − ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); | |
| 470 | + if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET)) | |
| 471 | + ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); | |
| 465 | 472 | |
| 466 | 473 | out_unlock: |
| 467 | 474 | mutex_unlock(&ihid->reset_lock); |
| @@ -990,8 +997,8 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, · 522 unmodified lines | ||
| 990 | 997 | hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); |
| 991 | 998 | hid->product = le16_to_cpu(ihid->hdesc.wProductID); |
| 992 | 999 | |
| 993 | − snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX", | |
| 994 | − client->name, hid->vendor, hid->product); | |
| 1000 | + snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", | |
| 1001 | + client->name, (u16)hid->vendor, (u16)hid->product); | |
| 995 | 1002 | strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys)); |
| 996 | 1003 | |
| 997 | 1004 | ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); |
| @@ -28,6 +28,8 @@ · 27 unmodified lines | ||
| 28 | 28 | #define EHL_Ax_DEVICE_ID 0x4BB3 |
| 29 | 29 | #define TGL_LP_DEVICE_ID 0xA0FC |
| 30 | 30 | #define TGL_H_DEVICE_ID 0x43FC |
| 31 | +#define ADL_S_DEVICE_ID 0x7AF8 | |
| 32 | +#define ADL_P_DEVICE_ID 0x51FC | |
| 31 | 33 | |
| 32 | 34 | #define REVISION_ID_CHT_A0 0x6 |
| 33 | 35 | #define REVISION_ID_CHT_Ax_SI 0x0 |
| @@ -39,6 +39,8 @@ static const struct pci_device_id ish_pci_tbl[] = { · 38 unmodified lines | ||
| 39 | 39 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, EHL_Ax_DEVICE_ID)}, |
| 40 | 40 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_LP_DEVICE_ID)}, |
| 41 | 41 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_H_DEVICE_ID)}, |
| 42 | + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_S_DEVICE_ID)}, | |
| 43 | + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_P_DEVICE_ID)}, | |
| 42 | 44 | {0, } |
| 43 | 45 | }; |
| 44 | 46 | MODULE_DEVICE_TABLE(pci, ish_pci_tbl); |
| @@ -168,9 +168,9 @@ int surface_hid_device_add(struct surface_hid_device *shid) · 167 unmodified lines | ||
| 168 | 168 | |
| 169 | 169 | shid->hid->dev.parent = shid->dev; |
| 170 | 170 | shid->hid->bus = BUS_HOST; |
| 171 | − shid->hid->vendor = cpu_to_le16(shid->attrs.vendor); | |
| 172 | − shid->hid->product = cpu_to_le16(shid->attrs.product); | |
| 173 | − shid->hid->version = cpu_to_le16(shid->hid_desc.hid_version); | |
| 171 | + shid->hid->vendor = get_unaligned_le16(&shid->attrs.vendor); | |
| 172 | + shid->hid->product = get_unaligned_le16(&shid->attrs.product); | |
| 173 | + shid->hid->version = get_unaligned_le16(&shid->hid_desc.hid_version); | |
| 174 | 174 | shid->hid->country = shid->hid_desc.country_code; |
| 175 | 175 | |
| 176 | 176 | snprintf(shid->hid->name, sizeof(shid->hid->name), "Microsoft Surface %04X:%04X", |
| @@ -374,7 +374,7 @@ static int hid_submit_ctrl(struct hid_device *hid) · 373 unmodified lines | ||
| 374 | 374 | raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report; |
| 375 | 375 | dir = usbhid->ctrl[usbhid->ctrltail].dir; |
| 376 | 376 | |
| 377 | − len = ((report->size - 1) >> 3) + 1 + (report->id > 0); | |
| 377 | + len = hid_report_len(report); | |
| 378 | 378 | if (dir == USB_DIR_OUT) { |
| 379 | 379 | usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0); |
| 380 | 380 | usbhid->urbctrl->transfer_buffer_length = len; |
| @@ -1292,6 +1292,7 @@ int hid_pidff_init(struct hid_device *hid) · 1291 unmodified lines | ||
| 1292 | 1292 | |
| 1293 | 1293 | if (pidff->pool[PID_DEVICE_MANAGED_POOL].value && |
| 1294 | 1294 | pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) { |
| 1295 | + error = -EPERM; | |
| 1295 | 1296 | hid_notice(hid, |
| 1296 | 1297 | "device does not support device managed pool\n"); |
| 1297 | 1298 | goto fail; |
| @@ -771,6 +771,16 @@ static int corsairpsu_raw_event(struct hid_device *hdev, struct hid_report *repo · 770 unmodified lines | ||
| 771 | 771 | return 0; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | +#ifdef CONFIG_PM | |
| 775 | +static int corsairpsu_resume(struct hid_device *hdev) | |
| 776 | +{ | |
| 777 | + struct corsairpsu_data *priv = hid_get_drvdata(hdev); | |
| 778 | + | |
| 779 | + /* some PSUs turn off the microcontroller during standby, so a reinit is required */ | |
| 780 | + return corsairpsu_init(priv); | |
| 781 | +} | |
| 782 | +#endif | |
| 783 | + | |
| 774 | 784 | static const struct hid_device_id corsairpsu_idtable[] = { |
| 775 | 785 | { HID_USB_DEVICE(0x1b1c, 0x1c03) }, /* Corsair HX550i */ |
| 776 | 786 | { HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */ |
| @@ -793,6 +803,10 @@ static struct hid_driver corsairpsu_driver = { · 16 unmodified lines | ||
| 793 | 803 | .probe = corsairpsu_probe, |
| 794 | 804 | .remove = corsairpsu_remove, |
| 795 | 805 | .raw_event = corsairpsu_raw_event, |
| 806 | +#ifdef CONFIG_PM | |
| 807 | + .resume = corsairpsu_resume, | |
| 808 | + .reset_resume = corsairpsu_resume, | |
| 809 | +#endif | |
| 796 | 810 | }; |
| 797 | 811 | module_hid_driver(corsairpsu_driver); |
| 798 | 812 | |
| @@ -838,10 +838,10 @@ static struct attribute *i8k_attrs[] = { · 837 unmodified lines | ||
| 838 | 838 | static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr, |
| 839 | 839 | int index) |
| 840 | 840 | { |
| 841 | − if (disallow_fan_support && index >= 8) | |
| 841 | + if (disallow_fan_support && index >= 20) | |
| 842 | 842 | return 0; |
| 843 | 843 | if (disallow_fan_type_call && |
| 844 | − (index == 9 || index == 12 || index == 15)) | |
| 844 | + (index == 21 || index == 25 || index == 28)) | |
| 845 | 845 | return 0; |
| 846 | 846 | if (index >= 0 && index <= 1 && |
| 847 | 847 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP1)) |
| @@ -37,6 +37,8 @@ struct fsp3y_data { · 36 unmodified lines | ||
| 37 | 37 | struct pmbus_driver_info info; |
| 38 | 38 | int chip; |
| 39 | 39 | int page; |
| 40 | + | |
| 41 | + bool vout_linear_11; | |
| 40 | 42 | }; |
| 41 | 43 | |
| 42 | 44 | #define to_fsp3y_data(x) container_of(x, struct fsp3y_data, info) |
| @@ -108,11 +110,9 @@ static int fsp3y_read_byte_data(struct i2c_client *client, int page, int reg) · 65 unmodified lines | ||
| 108 | 110 | int rv; |
| 109 | 111 | |
| 110 | 112 | /* |
| 111 | − * YH5151-E outputs vout in linear11. The conversion is done when | |
| 112 | − * reading. Here, we have to inject pmbus_core with the correct | |
| 113 | − * exponent (it is -6). | |
| 113 | + * Inject an exponent for non-compliant YH5151-E. | |
| 114 | 114 | */ |
| 115 | − if (data->chip == yh5151e && reg == PMBUS_VOUT_MODE) | |
| 115 | + if (data->vout_linear_11 && reg == PMBUS_VOUT_MODE) | |
| 116 | 116 | return 0x1A; |
| 117 | 117 | |
| 118 | 118 | rv = set_page(client, page); |
| @@ -161,10 +161,9 @@ static int fsp3y_read_word_data(struct i2c_client *client, int page, int phase, · 42 unmodified lines | ||
| 161 | 161 | return rv; |
| 162 | 162 | |
| 163 | 163 | /* |
| 164 | − * YH-5151E is non-compliant and outputs output voltages in linear11 | |
| 165 | − * instead of linear16. | |
| 164 | + * Handle YH-5151E non-compliant linear11 vout voltage. | |
| 166 | 165 | */ |
| 167 | − if (data->chip == yh5151e && reg == PMBUS_READ_VOUT) | |
| 166 | + if (data->vout_linear_11 && reg == PMBUS_READ_VOUT) | |
| 168 | 167 | rv = sign_extend32(rv, 10) & 0xffff; |
| 169 | 168 | |
| 170 | 169 | return rv; |
| @@ -256,6 +255,25 @@ static int fsp3y_probe(struct i2c_client *client) · 85 unmodified lines | ||
| 256 | 255 | |
| 257 | 256 | data->info = fsp3y_info[data->chip]; |
| 258 | 257 | |
| 258 | + /* | |
| 259 | + * YH-5151E sometimes reports vout in linear11 and sometimes in | |
| 260 | + * linear16. This depends on the exact individual piece of hardware. One | |
| 261 | + * YH-5151E can use linear16 and another might use linear11 instead. | |
| 262 | + * | |
| 263 | + * The format can be recognized by reading VOUT_MODE - if it doesn't | |
| 264 | + * report a valid exponent, then vout uses linear11. Otherwise, the | |
| 265 | + * device is compliant and uses linear16. | |
| 266 | + */ | |
| 267 | + data->vout_linear_11 = false; | |
| 268 | + if (data->chip == yh5151e) { | |
| 269 | + rv = i2c_smbus_read_byte_data(client, PMBUS_VOUT_MODE); | |
| 270 | + if (rv < 0) | |
| 271 | + return rv; | |
| 272 | + | |
| 273 | + if (rv == 0xFF) | |
| 274 | + data->vout_linear_11 = true; | |
| 275 | + } | |
| 276 | + | |
| 259 | 277 | return pmbus_do_probe(client, &data->info); |
| 260 | 278 | } |
| 261 | 279 | |
| @@ -244,8 +244,8 @@ static int isl68137_probe(struct i2c_client *client) · 243 unmodified lines | ||
| 244 | 244 | info->read_word_data = raa_dmpvr2_read_word_data; |
| 245 | 245 | break; |
| 246 | 246 | case raa_dmpvr2_2rail_nontc: |
| 247 | − info->func[0] &= ~PMBUS_HAVE_TEMP; | |
| 248 | − info->func[1] &= ~PMBUS_HAVE_TEMP; | |
| 247 | + info->func[0] &= ~PMBUS_HAVE_TEMP3; | |
| 248 | + info->func[1] &= ~PMBUS_HAVE_TEMP3; | |
| 249 | 249 | fallthrough; |
| 250 | 250 | case raa_dmpvr2_2rail: |
| 251 | 251 | info->pages = 2; |
| @@ -299,7 +299,7 @@ static int q54sj108a2_probe(struct i2c_client *client) · 298 unmodified lines | ||
| 299 | 299 | dev_err(&client->dev, "Failed to read Manufacturer ID\n"); |
| 300 | 300 | return ret; |
| 301 | 301 | } |
| 302 | − if (ret != 5 || strncmp(buf, "DELTA", 5)) { | |
| 302 | + if (ret != 6 || strncmp(buf, "DELTA", 5)) { | |
| 303 | 303 | buf[ret] = '\0'; |
| 304 | 304 | dev_err(dev, "Unsupported Manufacturer ID '%s'\n", buf); |
| 305 | 305 | return -ENODEV; |
| @@ -99,6 +99,15 @@ scpi_show_sensor(struct device *dev, struct device_attribute *attr, char *buf) · 98 unmodified lines | ||
| 99 | 99 | |
| 100 | 100 | scpi_scale_reading(&value, sensor); |
| 101 | 101 | |
| 102 | + /* | |
| 103 | + * Temperature sensor values are treated as signed values based on | |
| 104 | + * observation even though that is not explicitly specified, and | |
| 105 | + * because an unsigned u64 temperature does not really make practical | |
| 106 | + * sense especially when the temperature is below zero degrees Celsius. | |
| 107 | + */ | |
| 108 | + if (sensor->info.class == TEMPERATURE) | |
| 109 | + return sprintf(buf, "%lld\n", (s64)value); | |
| 110 | + | |
| 102 | 111 | return sprintf(buf, "%llu\n", value); |
| 103 | 112 | } |
| 104 | 113 | |
| @@ -99,11 +99,14 @@ · 98 unmodified lines | ||
| 99 | 99 | #define POWER_ENABLE 0x19 |
| 100 | 100 | #define TPS23861_NUM_PORTS 4 |
| 101 | 101 | |
| 102 | +#define TPS23861_GENERAL_MASK_1 0x17 | |
| 103 | +#define TPS23861_CURRENT_SHUNT_MASK BIT(0) | |
| 104 | + | |
| 102 | 105 | #define TEMPERATURE_LSB 652 /* 0.652 degrees Celsius */ |
| 103 | 106 | #define VOLTAGE_LSB 3662 /* 3.662 mV */ |
| 104 | 107 | #define SHUNT_RESISTOR_DEFAULT 255000 /* 255 mOhm */ |
| 105 | −#define CURRENT_LSB_255 62260 /* 62.260 uA */ | |
| 106 | −#define CURRENT_LSB_250 61039 /* 61.039 uA */ | |
| 108 | +#define CURRENT_LSB_250 62260 /* 62.260 uA */ | |
| 109 | +#define CURRENT_LSB_255 61039 /* 61.039 uA */ | |
| 107 | 110 | #define RESISTANCE_LSB 110966 /* 11.0966 Ohm*/ |
| 108 | 111 | #define RESISTANCE_LSB_LOW 157216 /* 15.7216 Ohm*/ |
| 109 | 112 | |
| @@ -117,6 +120,7 @@ struct tps23861_data { · 7 unmodified lines | ||
| 117 | 120 | static struct regmap_config tps23861_regmap_config = { |
| 118 | 121 | .reg_bits = 8, |
| 119 | 122 | .val_bits = 8, |
| 123 | + .max_register = 0x6f, | |
| 120 | 124 | }; |
| 121 | 125 | |
| 122 | 126 | static int tps23861_read_temp(struct tps23861_data *data, long *val) |
| @@ -560,6 +564,15 @@ static int tps23861_probe(struct i2c_client *client) · 437 unmodified lines | ||
| 560 | 564 | else |
| 561 | 565 | data->shunt_resistor = SHUNT_RESISTOR_DEFAULT; |
| 562 | 566 | |
| 567 | + if (data->shunt_resistor == SHUNT_RESISTOR_DEFAULT) | |
| 568 | + regmap_clear_bits(data->regmap, | |
| 569 | + TPS23861_GENERAL_MASK_1, | |
| 570 | + TPS23861_CURRENT_SHUNT_MASK); | |
| 571 | + else | |
| 572 | + regmap_set_bits(data->regmap, | |
| 573 | + TPS23861_GENERAL_MASK_1, | |
| 574 | + TPS23861_CURRENT_SHUNT_MASK); | |
| 575 | + | |
| 563 | 576 | hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, |
| 564 | 577 | data, &tps23861_chip_info, |
| 565 | 578 | NULL); |
| @@ -647,7 +647,7 @@ config I2C_HIGHLANDER · 646 unmodified lines | ||
| 647 | 647 | |
| 648 | 648 | config I2C_HISI |
| 649 | 649 | tristate "HiSilicon I2C controller" |
| 650 | − depends on ARM64 || COMPILE_TEST | |
| 650 | + depends on (ARM64 && ACPI) || COMPILE_TEST | |
| 651 | 651 | help |
| 652 | 652 | Say Y here if you want to have Hisilicon I2C controller support |
| 653 | 653 | available on the Kunpeng Server. |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | −/** | |
| 2 | +/* | |
| 3 | 3 | * i2c-ali1563.c - i2c driver for the ALi 1563 Southbridge |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2004 Patrick Mochel |
| @@ -55,7 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | #define ALTR_I2C_XFER_TIMEOUT (msecs_to_jiffies(250)) |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | − * altr_i2c_dev - I2C device context | |
| 58 | + * struct altr_i2c_dev - I2C device context | |
| 59 | 59 | * @base: pointer to register struct |
| 60 | 60 | * @msg: pointer to current message |
| 61 | 61 | * @msg_len: number of bytes transferred in msg |
| @@ -172,7 +172,7 @@ static void altr_i2c_init(struct altr_i2c_dev *idev) · 110 unmodified lines | ||
| 172 | 172 | altr_i2c_int_enable(idev, ALTR_I2C_ALL_IRQ, false); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | −/** | |
| 175 | +/* | |
| 176 | 176 | * altr_i2c_transfer - On the last byte to be transmitted, send |
| 177 | 177 | * a Stop bit on the last byte. |
| 178 | 178 | */ |
| @@ -185,7 +185,7 @@ static void altr_i2c_transfer(struct altr_i2c_dev *idev, u32 data) · 6 unmodified lines | ||
| 185 | 185 | writel(data, idev->base + ALTR_I2C_TFR_CMD); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | −/** | |
| 188 | +/* | |
| 189 | 189 | * altr_i2c_empty_rx_fifo - Fetch data from RX FIFO until end of |
| 190 | 190 | * transfer. Send a Stop bit on the last byte. |
| 191 | 191 | */ |
| @@ -201,9 +201,8 @@ static void altr_i2c_empty_rx_fifo(struct altr_i2c_dev *idev) · 9 unmodified lines | ||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | −/** | |
| 204 | +/* | |
| 205 | 205 | * altr_i2c_fill_tx_fifo - Fill TX FIFO from current message buffer. |
| 206 | − * @return: Number of bytes left to transfer. | |
| 207 | 206 | */ |
| 208 | 207 | static int altr_i2c_fill_tx_fifo(struct altr_i2c_dev *idev) |
| 209 | 208 | { |
| @@ -144,7 +144,7 @@ enum cdns_i2c_mode { · 143 unmodified lines | ||
| 144 | 144 | }; |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | − * enum cdns_i2c_slave_mode - Slave state when I2C is operating in slave mode | |
| 147 | + * enum cdns_i2c_slave_state - Slave state when I2C is operating in slave mode | |
| 148 | 148 | * |
| 149 | 149 | * @CDNS_I2C_SLAVE_STATE_IDLE: I2C slave idle |
| 150 | 150 | * @CDNS_I2C_SLAVE_STATE_SEND: I2C slave sending data to master |
| @@ -165,7 +165,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) · 164 unmodified lines | ||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | − * i2c_dw_init() - Initialize the designware I2C master hardware | |
| 168 | + * i2c_dw_init_master() - Initialize the designware I2C master hardware | |
| 169 | 169 | * @dev: device private data |
| 170 | 170 | * |
| 171 | 171 | * This functions configures and enables the I2C master. |
| @@ -148,7 +148,7 @@ struct i2c_algo_pch_data { · 147 unmodified lines | ||
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * struct adapter_info - This structure holds the adapter information for the |
| 151 | − PCH i2c controller | |
| 151 | + * PCH i2c controller | |
| 152 | 152 | * @pch_data: stores a list of i2c_algo_pch_data |
| 153 | 153 | * @pch_i2c_suspended: specifies whether the system is suspended or not |
| 154 | 154 | * perhaps with more lines and words. |
| @@ -358,6 +358,7 @@ static void pch_i2c_repstart(struct i2c_algo_pch_data *adap) · 203 unmodified lines | ||
| 358 | 358 | /** |
| 359 | 359 | * pch_i2c_writebytes() - write data to I2C bus in normal mode |
| 360 | 360 | * @i2c_adap: Pointer to the struct i2c_adapter. |
| 361 | + * @msgs: Pointer to the i2c message structure. | |
| 361 | 362 | * @last: specifies whether last message or not. |
| 362 | 363 | * In the case of compound mode it will be 1 for last message, |
| 363 | 364 | * otherwise 0. |
| @@ -395,11 +395,9 @@ static int i801_check_post(struct i801_priv *priv, int status) · 394 unmodified lines | ||
| 395 | 395 | dev_err(&priv->pci_dev->dev, "Transaction timeout\n"); |
| 396 | 396 | /* try to stop the current command */ |
| 397 | 397 | dev_dbg(&priv->pci_dev->dev, "Terminating the current operation\n"); |
| 398 | − outb_p(inb_p(SMBHSTCNT(priv)) | SMBHSTCNT_KILL, | |
| 399 | − SMBHSTCNT(priv)); | |
| 398 | + outb_p(SMBHSTCNT_KILL, SMBHSTCNT(priv)); | |
| 400 | 399 | usleep_range(1000, 2000); |
| 401 | − outb_p(inb_p(SMBHSTCNT(priv)) & (~SMBHSTCNT_KILL), | |
| 402 | − SMBHSTCNT(priv)); | |
| 400 | + outb_p(0, SMBHSTCNT(priv)); | |
| 403 | 401 | |
| 404 | 402 | /* Check if it worked */ |
| 405 | 403 | status = inb_p(SMBHSTSTS(priv)); |
| @@ -123,7 +123,6 @@ static int icy_probe(struct zorro_dev *z, · 122 unmodified lines | ||
| 123 | 123 | { |
| 124 | 124 | struct icy_i2c *i2c; |
| 125 | 125 | struct i2c_algo_pcf_data *algo_data; |
| 126 | − struct fwnode_handle *new_fwnode; | |
| 127 | 126 | struct i2c_board_info ltc2990_info = { |
| 128 | 127 | .type = "ltc2990", |
| 129 | 128 | .swnode = &icy_ltc2990_node, |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #include <linux/clk.h> |
| 21 | 21 | #include <linux/io.h> |
| 22 | +#include <linux/iopoll.h> | |
| 22 | 23 | #include <linux/fsl_devices.h> |
| 23 | 24 | #include <linux/i2c.h> |
| 24 | 25 | #include <linux/interrupt.h> |
| @@ -45,6 +46,7 @@ · 20 unmodified lines | ||
| 45 | 46 | #define CCR_MTX 0x10 |
| 46 | 47 | #define CCR_TXAK 0x08 |
| 47 | 48 | #define CCR_RSTA 0x04 |
| 49 | +#define CCR_RSVD 0x02 | |
| 48 | 50 | |
| 49 | 51 | #define CSR_MCF 0x80 |
| 50 | 52 | #define CSR_MAAS 0x40 |
| @@ -97,7 +99,7 @@ struct mpc_i2c { · 46 unmodified lines | ||
| 97 | 99 | u32 block; |
| 98 | 100 | int rc; |
| 99 | 101 | int expect_rxack; |
| 100 | − | |
| 102 | + bool has_errata_A004447; | |
| 101 | 103 | }; |
| 102 | 104 | |
| 103 | 105 | struct mpc_i2c_divider { |
| @@ -136,6 +138,75 @@ static void mpc_i2c_fixup(struct mpc_i2c *i2c) · 32 unmodified lines | ||
| 136 | 138 | } |
| 137 | 139 | } |
| 138 | 140 | |
| 141 | +static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask) | |
| 142 | +{ | |
| 143 | + void __iomem *addr = i2c->base + MPC_I2C_SR; | |
| 144 | + u8 val; | |
| 145 | + | |
| 146 | + return readb_poll_timeout(addr, val, val & mask, 0, 100); | |
| 147 | +} | |
| 148 | + | |
| 149 | +/* | |
| 150 | + * Workaround for Erratum A004447. From the P2040CE Rev Q | |
| 151 | + * | |
| 152 | + * 1. Set up the frequency divider and sampling rate. | |
| 153 | + * 2. I2CCR - a0h | |
| 154 | + * 3. Poll for I2CSR[MBB] to get set. | |
| 155 | + * 4. If I2CSR[MAL] is set (an indication that SDA is stuck low), then go to | |
| 156 | + * step 5. If MAL is not set, then go to step 13. | |
| 157 | + * 5. I2CCR - 00h | |
| 158 | + * 6. I2CCR - 22h | |
| 159 | + * 7. I2CCR - a2h | |
| 160 | + * 8. Poll for I2CSR[MBB] to get set. | |
| 161 | + * 9. Issue read to I2CDR. | |
| 162 | + * 10. Poll for I2CSR[MIF] to be set. | |
| 163 | + * 11. I2CCR - 82h | |
| 164 | + * 12. Workaround complete. Skip the next steps. | |
| 165 | + * 13. Issue read to I2CDR. | |
| 166 | + * 14. Poll for I2CSR[MIF] to be set. | |
| 167 | + * 15. I2CCR - 80h | |
| 168 | + */ | |
| 169 | +static void mpc_i2c_fixup_A004447(struct mpc_i2c *i2c) | |
| 170 | +{ | |
| 171 | + int ret; | |
| 172 | + u32 val; | |
| 173 | + | |
| 174 | + writeccr(i2c, CCR_MEN | CCR_MSTA); | |
| 175 | + ret = i2c_mpc_wait_sr(i2c, CSR_MBB); | |
| 176 | + if (ret) { | |
| 177 | + dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); | |
| 178 | + return; | |
| 179 | + } | |
| 180 | + | |
| 181 | + val = readb(i2c->base + MPC_I2C_SR); | |
| 182 | + | |
| 183 | + if (val & CSR_MAL) { | |
| 184 | + writeccr(i2c, 0x00); | |
| 185 | + writeccr(i2c, CCR_MSTA | CCR_RSVD); | |
| 186 | + writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSVD); | |
| 187 | + ret = i2c_mpc_wait_sr(i2c, CSR_MBB); | |
| 188 | + if (ret) { | |
| 189 | + dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); | |
| 190 | + return; | |
| 191 | + } | |
| 192 | + val = readb(i2c->base + MPC_I2C_DR); | |
| 193 | + ret = i2c_mpc_wait_sr(i2c, CSR_MIF); | |
| 194 | + if (ret) { | |
| 195 | + dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); | |
| 196 | + return; | |
| 197 | + } | |
| 198 | + writeccr(i2c, CCR_MEN | CCR_RSVD); | |
| 199 | + } else { | |
| 200 | + val = readb(i2c->base + MPC_I2C_DR); | |
| 201 | + ret = i2c_mpc_wait_sr(i2c, CSR_MIF); | |
| 202 | + if (ret) { | |
| 203 | + dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); | |
| 204 | + return; | |
| 205 | + } | |
| 206 | + writeccr(i2c, CCR_MEN); | |
| 207 | + } | |
| 208 | +} | |
| 209 | + | |
| 139 | 210 | #if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) |
| 140 | 211 | static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { |
| 141 | 212 | {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, |
| @@ -670,7 +741,10 @@ static int fsl_i2c_bus_recovery(struct i2c_adapter *adap) · 528 unmodified lines | ||
| 670 | 741 | { |
| 671 | 742 | struct mpc_i2c *i2c = i2c_get_adapdata(adap); |
| 672 | 743 | |
| 673 | − mpc_i2c_fixup(i2c); | |
| 744 | + if (i2c->has_errata_A004447) | |
| 745 | + mpc_i2c_fixup_A004447(i2c); | |
| 746 | + else | |
| 747 | + mpc_i2c_fixup(i2c); | |
| 674 | 748 | |
| 675 | 749 | return 0; |
| 676 | 750 | } |
| @@ -767,6 +841,9 @@ static int fsl_i2c_probe(struct platform_device *op) · 90 unmodified lines | ||
| 767 | 841 | } |
| 768 | 842 | dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ); |
| 769 | 843 | |
| 844 | + if (of_property_read_bool(op->dev.of_node, "fsl,i2c-erratum-a004447")) | |
| 845 | + i2c->has_errata_A004447 = true; | |
| 846 | + | |
| 770 | 847 | i2c->adap = mpc_ops; |
| 771 | 848 | scnprintf(i2c->adap.name, sizeof(i2c->adap.name), |
| 772 | 849 | "MPC adapter (%s)", of_node_full_name(op->dev.of_node)); |
| @@ -479,6 +479,11 @@ static void mtk_i2c_clock_disable(struct mtk_i2c *i2c) · 478 unmodified lines | ||
| 479 | 479 | static void mtk_i2c_init_hw(struct mtk_i2c *i2c) |
| 480 | 480 | { |
| 481 | 481 | u16 control_reg; |
| 482 | + u16 intr_stat_reg; | |
| 483 | + | |
| 484 | + mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_START); | |
| 485 | + intr_stat_reg = mtk_i2c_readw(i2c, OFFSET_INTR_STAT); | |
| 486 | + mtk_i2c_writew(i2c, intr_stat_reg, OFFSET_INTR_STAT); | |
| 482 | 487 | |
| 483 | 488 | if (i2c->dev_comp->apdma_sync) { |
| 484 | 489 | writel(I2C_DMA_WARM_RST, i2c->pdmabase + OFFSET_RST); |
| @@ -159,7 +159,7 @@ struct i2c_nmk_client { · 158 unmodified lines | ||
| 159 | 159 | * @clk_freq: clock frequency for the operation mode |
| 160 | 160 | * @tft: Tx FIFO Threshold in bytes |
| 161 | 161 | * @rft: Rx FIFO Threshold in bytes |
| 162 | − * @timeout Slave response timeout (ms) | |
| 162 | + * @timeout: Slave response timeout (ms) | |
| 163 | 163 | * @sm: speed mode |
| 164 | 164 | * @stop: stop condition. |
| 165 | 165 | * @xfer_complete: acknowledge completion for a I2C message. |
| @@ -250,7 +250,7 @@ static irqreturn_t ocores_isr(int irq, void *dev_id) · 249 unmodified lines | ||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | − * Process timeout event | |
| 253 | + * ocores_process_timeout() - Process timeout event | |
| 254 | 254 | * @i2c: ocores I2C device instance |
| 255 | 255 | */ |
| 256 | 256 | static void ocores_process_timeout(struct ocores_i2c *i2c) |
| @@ -264,7 +264,7 @@ static void ocores_process_timeout(struct ocores_i2c *i2c) · 7 unmodified lines | ||
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
| 267 | − * Wait until something change in a given register | |
| 267 | + * ocores_wait() - Wait until something change in a given register | |
| 268 | 268 | * @i2c: ocores I2C device instance |
| 269 | 269 | * @reg: register to query |
| 270 | 270 | * @mask: bitmask to apply on register value |
| @@ -296,7 +296,7 @@ static int ocores_wait(struct ocores_i2c *i2c, · 25 unmodified lines | ||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | − * Wait until is possible to process some data | |
| 299 | + * ocores_poll_wait() - Wait until is possible to process some data | |
| 300 | 300 | * @i2c: ocores I2C device instance |
| 301 | 301 | * |
| 302 | 302 | * Used when the device is in polling mode (interrupts disabled). |
| @@ -334,7 +334,7 @@ static int ocores_poll_wait(struct ocores_i2c *i2c) · 31 unmodified lines | ||
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
| 337 | − * It handles an IRQ-less transfer | |
| 337 | + * ocores_process_polling() - It handles an IRQ-less transfer | |
| 338 | 338 | * @i2c: ocores I2C device instance |
| 339 | 339 | * |
| 340 | 340 | * Even if IRQ are disabled, the I2C OpenCore IP behavior is exactly the same |
| @@ -138,7 +138,7 @@ static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) · 137 unmodified lines | ||
| 138 | 138 | /** |
| 139 | 139 | * i2c_pnx_start - start a device |
| 140 | 140 | * @slave_addr: slave address |
| 141 | − * @adap: pointer to adapter structure | |
| 141 | + * @alg_data: pointer to local driver data structure | |
| 142 | 142 | * |
| 143 | 143 | * Generate a START signal in the desired mode. |
| 144 | 144 | */ |
| @@ -194,7 +194,7 @@ static int i2c_pnx_start(unsigned char slave_addr, · 49 unmodified lines | ||
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | 196 | * i2c_pnx_stop - stop a device |
| 197 | − * @adap: pointer to I2C adapter structure | |
| 197 | + * @alg_data: pointer to local driver data structure | |
| 198 | 198 | * |
| 199 | 199 | * Generate a STOP signal to terminate the master transaction. |
| 200 | 200 | */ |
| @@ -223,7 +223,7 @@ static void i2c_pnx_stop(struct i2c_pnx_algo_data *alg_data) · 22 unmodified lines | ||
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * i2c_pnx_master_xmit - transmit data to slave |
| 226 | − * @adap: pointer to I2C adapter structure | |
| 226 | + * @alg_data: pointer to local driver data structure | |
| 227 | 227 | * |
| 228 | 228 | * Sends one byte of data to the slave |
| 229 | 229 | */ |
| @@ -293,7 +293,7 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data) · 63 unmodified lines | ||
| 293 | 293 | |
| 294 | 294 | /** |
| 295 | 295 | * i2c_pnx_master_rcv - receive data from slave |
| 296 | − * @adap: pointer to I2C adapter structure | |
| 296 | + * @alg_data: pointer to local driver data structure | |
| 297 | 297 | * |
| 298 | 298 | * Reads one byte data from the slave |
| 299 | 299 | */ |
| @@ -100,7 +100,7 @@ static const struct geni_i2c_err_log gi2c_log[] = { · 99 unmodified lines | ||
| 100 | 100 | [GP_IRQ0] = {-EIO, "Unknown I2C err GP_IRQ0"}, |
| 101 | 101 | [NACK] = {-ENXIO, "NACK: slv unresponsive, check its power/reset-ln"}, |
| 102 | 102 | [GP_IRQ2] = {-EIO, "Unknown I2C err GP IRQ2"}, |
| 103 | − [BUS_PROTO] = {-EPROTO, "Bus proto err, noisy/unepxected start/stop"}, | |
| 103 | + [BUS_PROTO] = {-EPROTO, "Bus proto err, noisy/unexpected start/stop"}, | |
| 104 | 104 | [ARB_LOST] = {-EAGAIN, "Bus arbitration lost, clock line undriveable"}, |
| 105 | 105 | [GP_IRQ5] = {-EIO, "Unknown I2C err GP IRQ5"}, |
| 106 | 106 | [GENI_OVERRUN] = {-EIO, "Cmd overrun, check GENI cmd-state machine"}, |
| @@ -650,6 +650,14 @@ static int geni_i2c_remove(struct platform_device *pdev) · 543 unmodified lines | ||
| 650 | 650 | return 0; |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | +static void geni_i2c_shutdown(struct platform_device *pdev) | |
| 654 | +{ | |
| 655 | + struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev); | |
| 656 | + | |
| 657 | + /* Make client i2c transfers start failing */ | |
| 658 | + i2c_mark_adapter_suspended(&gi2c->adap); | |
| 659 | +} | |
| 660 | + | |
| 653 | 661 | static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev) |
| 654 | 662 | { |
| 655 | 663 | int ret; |
| @@ -690,6 +698,8 @@ static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev) · 34 unmodified lines | ||
| 690 | 698 | { |
| 691 | 699 | struct geni_i2c_dev *gi2c = dev_get_drvdata(dev); |
| 692 | 700 | |
| 701 | + i2c_mark_adapter_suspended(&gi2c->adap); | |
| 702 | + | |
| 693 | 703 | if (!gi2c->suspended) { |
| 694 | 704 | geni_i2c_runtime_suspend(dev); |
| 695 | 705 | pm_runtime_disable(dev); |
| @@ -699,8 +709,16 @@ static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev) · 3 unmodified lines | ||
| 699 | 709 | return 0; |
| 700 | 710 | } |
| 701 | 711 | |
| 712 | +static int __maybe_unused geni_i2c_resume_noirq(struct device *dev) | |
| 713 | +{ | |
| 714 | + struct geni_i2c_dev *gi2c = dev_get_drvdata(dev); | |
| 715 | + | |
| 716 | + i2c_mark_adapter_resumed(&gi2c->adap); | |
| 717 | + return 0; | |
| 718 | +} | |
| 719 | + | |
| 702 | 720 | static const struct dev_pm_ops geni_i2c_pm_ops = { |
| 703 | − SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, NULL) | |
| 721 | + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, geni_i2c_resume_noirq) | |
| 704 | 722 | SET_RUNTIME_PM_OPS(geni_i2c_runtime_suspend, geni_i2c_runtime_resume, |
| 705 | 723 | NULL) |
| 706 | 724 | }; |
| @@ -714,6 +732,7 @@ MODULE_DEVICE_TABLE(of, geni_i2c_dt_match); · 7 unmodified lines | ||
| 714 | 732 | static struct platform_driver geni_i2c_driver = { |
| 715 | 733 | .probe = geni_i2c_probe, |
| 716 | 734 | .remove = geni_i2c_remove, |
| 735 | + .shutdown = geni_i2c_shutdown, | |
| 717 | 736 | .driver = { |
| 718 | 737 | .name = "geni_i2c", |
| 719 | 738 | .pm = &geni_i2c_pm_ops, |
| @@ -480,7 +480,10 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat) · 479 unmodified lines | ||
| 480 | 480 | * forces us to send a new START |
| 481 | 481 | * when we change direction |
| 482 | 482 | */ |
| 483 | + dev_dbg(i2c->dev, | |
| 484 | + "missing START before write->read\n"); | |
| 483 | 485 | s3c24xx_i2c_stop(i2c, -EINVAL); |
| 486 | + break; | |
| 484 | 487 | } |
| 485 | 488 | |
| 486 | 489 | goto retry_write; |
| @@ -807,7 +807,7 @@ static const struct sh_mobile_dt_config r8a7740_dt_config = { · 806 unmodified lines | ||
| 807 | 807 | static const struct of_device_id sh_mobile_i2c_dt_ids[] = { |
| 808 | 808 | { .compatible = "renesas,iic-r8a73a4", .data = &fast_clock_dt_config }, |
| 809 | 809 | { .compatible = "renesas,iic-r8a7740", .data = &r8a7740_dt_config }, |
| 810 | − { .compatible = "renesas,iic-r8a774c0", .data = &fast_clock_dt_config }, | |
| 810 | + { .compatible = "renesas,iic-r8a774c0", .data = &v2_freq_calc_dt_config }, | |
| 811 | 811 | { .compatible = "renesas,iic-r8a7790", .data = &v2_freq_calc_dt_config }, |
| 812 | 812 | { .compatible = "renesas,iic-r8a7791", .data = &v2_freq_calc_dt_config }, |
| 813 | 813 | { .compatible = "renesas,iic-r8a7792", .data = &v2_freq_calc_dt_config }, |
| @@ -524,7 +524,7 @@ static void st_i2c_handle_write(struct st_i2c_dev *i2c_dev) · 523 unmodified lines | ||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /** |
| 527 | − * st_i2c_handle_write() - Handle FIFO enmpty interrupt in case of read | |
| 527 | + * st_i2c_handle_read() - Handle FIFO empty interrupt in case of read | |
| 528 | 528 | * @i2c_dev: Controller's private data |
| 529 | 529 | */ |
| 530 | 530 | static void st_i2c_handle_read(struct st_i2c_dev *i2c_dev) |
| @@ -558,7 +558,7 @@ static void st_i2c_handle_read(struct st_i2c_dev *i2c_dev) · 27 unmodified lines | ||
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /** |
| 561 | − * st_i2c_isr() - Interrupt routine | |
| 561 | + * st_i2c_isr_thread() - Interrupt routine | |
| 562 | 562 | * @irq: interrupt number |
| 563 | 563 | * @data: Controller's private data |
| 564 | 564 | */ |
| @@ -313,7 +313,7 @@ static int stm32f4_i2c_wait_free_bus(struct stm32f4_i2c_dev *i2c_dev) · 312 unmodified lines | ||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | − * stm32f4_i2c_write_ byte() - Write a byte in the data register | |
| 316 | + * stm32f4_i2c_write_byte() - Write a byte in the data register | |
| 317 | 317 | * @i2c_dev: Controller's private data |
| 318 | 318 | * @byte: Data to write in the register |
| 319 | 319 | */ |
| @@ -65,7 +65,7 @@ static void tegra_bpmp_xlate_flags(u16 flags, u16 *out) · 64 unmodified lines | ||
| 65 | 65 | *out |= SERIALI2C_RECV_LEN; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | −/** | |
| 68 | +/* | |
| 69 | 69 | * The serialized I2C format is simply the following: |
| 70 | 70 | * [addr little-endian][flags little-endian][len little-endian][data if write] |
| 71 | 71 | * [addr little-endian][flags little-endian][len little-endian][data if write] |
| @@ -109,7 +109,7 @@ static void tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c, · 37 unmodified lines | ||
| 109 | 109 | request->xfer.data_size = pos; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | −/** | |
| 112 | +/* | |
| 113 | 113 | * The data in the BPMP -> CPU direction is composed of sequential blocks for |
| 114 | 114 | * those messages that have I2C_M_RD. So, for example, if you have: |
| 115 | 115 | * |
| @@ -34,7 +34,7 @@ struct i2c_arbitrator_data { · 33 unmodified lines | ||
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | 36 | |
| 37 | −/** | |
| 37 | +/* | |
| 38 | 38 | * i2c_arbitrator_select - claim the I2C bus |
| 39 | 39 | * |
| 40 | 40 | * Use the GPIO-based signalling protocol; return -EBUSY if we fail. |
| @@ -77,7 +77,7 @@ static int i2c_arbitrator_select(struct i2c_mux_core *muxc, u32 chan) · 36 unmodified lines | ||
| 77 | 77 | return -EBUSY; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | −/** | |
| 80 | +/* | |
| 81 | 81 | * i2c_arbitrator_deselect - release the I2C bus |
| 82 | 82 | * |
| 83 | 83 | * Release the I2C bus using the GPIO-based signalling protocol. |
| @@ -771,6 +771,13 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, · 770 unmodified lines | ||
| 771 | 771 | if (ret) |
| 772 | 772 | goto err; |
| 773 | 773 | |
| 774 | + if (channel >= indio_dev->num_channels) { | |
| 775 | + dev_err(indio_dev->dev.parent, | |
| 776 | + "Channel index >= number of channels\n"); | |
| 777 | + ret = -EINVAL; | |
| 778 | + goto err; | |
| 779 | + } | |
| 780 | + | |
| 774 | 781 | ret = of_property_read_u32_array(child, "diff-channels", |
| 775 | 782 | ain, 2); |
| 776 | 783 | if (ret) |
| @@ -850,6 +857,11 @@ static int ad7124_setup(struct ad7124_state *st) · 73 unmodified lines | ||
| 850 | 857 | return ret; |
| 851 | 858 | } |
| 852 | 859 | |
| 860 | +static void ad7124_reg_disable(void *r) | |
| 861 | +{ | |
| 862 | + regulator_disable(r); | |
| 863 | +} | |
| 864 | + | |
| 853 | 865 | static int ad7124_probe(struct spi_device *spi) |
| 854 | 866 | { |
| 855 | 867 | const struct ad7124_chip_info *info; |
| @@ -895,17 +907,20 @@ static int ad7124_probe(struct spi_device *spi) · 39 unmodified lines | ||
| 895 | 907 | ret = regulator_enable(st->vref[i]); |
| 896 | 908 | if (ret) |
| 897 | 909 | return ret; |
| 910 | + | |
| 911 | + ret = devm_add_action_or_reset(&spi->dev, ad7124_reg_disable, | |
| 912 | + st->vref[i]); | |
| 913 | + if (ret) | |
| 914 | + return ret; | |
| 898 | 915 | } |
| 899 | 916 | |
| 900 | 917 | st->mclk = devm_clk_get(&spi->dev, "mclk"); |
| 901 | − if (IS_ERR(st->mclk)) { | |
| 902 | − ret = PTR_ERR(st->mclk); | |
| 903 | − goto error_regulator_disable; | |
| 904 | − } | |
| 918 | + if (IS_ERR(st->mclk)) | |
| 919 | + return PTR_ERR(st->mclk); | |
| 905 | 920 | |
| 906 | 921 | ret = clk_prepare_enable(st->mclk); |
| 907 | 922 | if (ret < 0) |
| 908 | − goto error_regulator_disable; | |
| 923 | + return ret; | |
| 909 | 924 | |
| 910 | 925 | ret = ad7124_soft_reset(st); |
| 911 | 926 | if (ret < 0) |
| @@ -935,11 +950,6 @@ error_remove_trigger: · 23 unmodified lines | ||
| 935 | 950 | ad_sd_cleanup_buffer_and_trigger(indio_dev); |
| 936 | 951 | error_clk_disable_unprepare: |
| 937 | 952 | clk_disable_unprepare(st->mclk); |
| 938 | −error_regulator_disable: | |
| 939 | − for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) { | |
| 940 | − if (!IS_ERR_OR_NULL(st->vref[i])) | |
| 941 | − regulator_disable(st->vref[i]); | |
| 942 | − } | |
| 943 | 953 | |
| 944 | 954 | return ret; |
| 945 | 955 | } |
| @@ -948,17 +958,11 @@ static int ad7124_remove(struct spi_device *spi) · 2 unmodified lines | ||
| 948 | 958 | { |
| 949 | 959 | struct iio_dev *indio_dev = spi_get_drvdata(spi); |
| 950 | 960 | struct ad7124_state *st = iio_priv(indio_dev); |
| 951 | − int i; | |
| 952 | 961 | |
| 953 | 962 | iio_device_unregister(indio_dev); |
| 954 | 963 | ad_sd_cleanup_buffer_and_trigger(indio_dev); |
| 955 | 964 | clk_disable_unprepare(st->mclk); |
| 956 | 965 | |
| 957 | − for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) { | |
| 958 | − if (!IS_ERR_OR_NULL(st->vref[i])) | |
| 959 | − regulator_disable(st->vref[i]); | |
| 960 | − } | |
| 961 | − | |
| 962 | 966 | return 0; |
| 963 | 967 | } |
| 964 | 968 | |
| @@ -912,7 +912,7 @@ static int ad7192_probe(struct spi_device *spi) · 911 unmodified lines | ||
| 912 | 912 | { |
| 913 | 913 | struct ad7192_state *st; |
| 914 | 914 | struct iio_dev *indio_dev; |
| 915 | − int ret, voltage_uv = 0; | |
| 915 | + int ret; | |
| 916 | 916 | |
| 917 | 917 | if (!spi->irq) { |
| 918 | 918 | dev_err(&spi->dev, "no IRQ?\n"); |
| @@ -949,15 +949,12 @@ static int ad7192_probe(struct spi_device *spi) · 30 unmodified lines | ||
| 949 | 949 | goto error_disable_avdd; |
| 950 | 950 | } |
| 951 | 951 | |
| 952 | − voltage_uv = regulator_get_voltage(st->avdd); | |
| 953 | − | |
| 954 | − if (voltage_uv > 0) { | |
| 955 | − st->int_vref_mv = voltage_uv / 1000; | |
| 956 | − } else { | |
| 957 | − ret = voltage_uv; | |
| 952 | + ret = regulator_get_voltage(st->avdd); | |
| 953 | + if (ret < 0) { | |
| 958 | 954 | dev_err(&spi->dev, "Device tree error, reference voltage undefined\n"); |
| 959 | 955 | goto error_disable_avdd; |
| 960 | 956 | } |
| 957 | + st->int_vref_mv = ret / 1000; | |
| 961 | 958 | |
| 962 | 959 | spi_set_drvdata(spi, indio_dev); |
| 963 | 960 | st->chip_info = of_device_get_match_data(&spi->dev); |
| @@ -1014,7 +1011,9 @@ static int ad7192_probe(struct spi_device *spi) · 50 unmodified lines | ||
| 1014 | 1011 | return 0; |
| 1015 | 1012 | |
| 1016 | 1013 | error_disable_clk: |
| 1017 | − clk_disable_unprepare(st->mclk); | |
| 1014 | + if (st->clock_sel == AD7192_CLK_EXT_MCLK1_2 || | |
| 1015 | + st->clock_sel == AD7192_CLK_EXT_MCLK2) | |
| 1016 | + clk_disable_unprepare(st->mclk); | |
| 1018 | 1017 | error_remove_trigger: |
| 1019 | 1018 | ad_sd_cleanup_buffer_and_trigger(indio_dev); |
| 1020 | 1019 | error_disable_dvdd: |
| @@ -1031,7 +1030,9 @@ static int ad7192_remove(struct spi_device *spi) · 10 unmodified lines | ||
| 1031 | 1030 | struct ad7192_state *st = iio_priv(indio_dev); |
| 1032 | 1031 | |
| 1033 | 1032 | iio_device_unregister(indio_dev); |
| 1034 | − clk_disable_unprepare(st->mclk); | |
| 1033 | + if (st->clock_sel == AD7192_CLK_EXT_MCLK1_2 || | |
| 1034 | + st->clock_sel == AD7192_CLK_EXT_MCLK2) | |
| 1035 | + clk_disable_unprepare(st->mclk); | |
| 1035 | 1036 | ad_sd_cleanup_buffer_and_trigger(indio_dev); |
| 1036 | 1037 | |
| 1037 | 1038 | regulator_disable(st->dvdd); |
| @@ -167,6 +167,10 @@ struct ad7768_state { · 166 unmodified lines | ||
| 167 | 167 | * transfer buffers to live in their own cache lines. |
| 168 | 168 | */ |
| 169 | 169 | union { |
| 170 | + struct { | |
| 171 | + __be32 chan; | |
| 172 | + s64 timestamp; | |
| 173 | + } scan; | |
| 170 | 174 | __be32 d32; |
| 171 | 175 | u8 d8[2]; |
| 172 | 176 | } data ____cacheline_aligned; |
| @@ -469,11 +473,11 @@ static irqreturn_t ad7768_trigger_handler(int irq, void *p) · 296 unmodified lines | ||
| 469 | 473 | |
| 470 | 474 | mutex_lock(&st->lock); |
| 471 | 475 | |
| 472 | − ret = spi_read(st->spi, &st->data.d32, 3); | |
| 476 | + ret = spi_read(st->spi, &st->data.scan.chan, 3); | |
| 473 | 477 | if (ret < 0) |
| 474 | 478 | goto err_unlock; |
| 475 | 479 | |
| 476 | − iio_push_to_buffers_with_timestamp(indio_dev, &st->data.d32, | |
| 480 | + iio_push_to_buffers_with_timestamp(indio_dev, &st->data.scan, | |
| 477 | 481 | iio_get_time_ns(indio_dev)); |
| 478 | 482 | |
| 479 | 483 | iio_trigger_notify_done(indio_dev->trig); |
| @@ -279,6 +279,7 @@ static int ad7793_setup(struct iio_dev *indio_dev, · 278 unmodified lines | ||
| 279 | 279 | id &= AD7793_ID_MASK; |
| 280 | 280 | |
| 281 | 281 | if (id != st->chip_info->id) { |
| 282 | + ret = -ENODEV; | |
| 282 | 283 | dev_err(&st->sd.spi->dev, "device ID query failed\n"); |
| 283 | 284 | goto out; |
| 284 | 285 | } |
| @@ -59,8 +59,10 @@ struct ad7923_state { · 58 unmodified lines | ||
| 59 | 59 | /* |
| 60 | 60 | * DMA (thus cache coherency maintenance) requires the |
| 61 | 61 | * transfer buffers to live in their own cache lines. |
| 62 | + * Ensure rx_buf can be directly used in iio_push_to_buffers_with_timetamp | |
| 63 | + * Length = 8 channels + 4 extra for 8 byte timestamp | |
| 62 | 64 | */ |
| 63 | − __be16 rx_buf[4] ____cacheline_aligned; | |
| 65 | + __be16 rx_buf[12] ____cacheline_aligned; | |
| 64 | 66 | __be16 tx_buf[4]; |
| 65 | 67 | }; |
| 66 | 68 | |
| @@ -524,23 +524,29 @@ static int ad5770r_channel_config(struct ad5770r_state *st) · 523 unmodified lines | ||
| 524 | 524 | device_for_each_child_node(&st->spi->dev, child) { |
| 525 | 525 | ret = fwnode_property_read_u32(child, "num", &num); |
| 526 | 526 | if (ret) |
| 527 | − return ret; | |
| 528 | − if (num >= AD5770R_MAX_CHANNELS) | |
| 529 | − return -EINVAL; | |
| 527 | + goto err_child_out; | |
| 528 | + if (num >= AD5770R_MAX_CHANNELS) { | |
| 529 | + ret = -EINVAL; | |
| 530 | + goto err_child_out; | |
| 531 | + } | |
| 530 | 532 | |
| 531 | 533 | ret = fwnode_property_read_u32_array(child, |
| 532 | 534 | "adi,range-microamp", |
| 533 | 535 | tmp, 2); |
| 534 | 536 | if (ret) |
| 535 | − return ret; | |
| 537 | + goto err_child_out; | |
| 536 | 538 | |
| 537 | 539 | min = tmp[0] / 1000; |
| 538 | 540 | max = tmp[1] / 1000; |
| 539 | 541 | ret = ad5770r_store_output_range(st, min, max, num); |
| 540 | 542 | if (ret) |
| 541 | − return ret; | |
| 543 | + goto err_child_out; | |
| 542 | 544 | } |
| 543 | 545 | |
| 546 | + return 0; | |
| 547 | + | |
| 548 | +err_child_out: | |
| 549 | + fwnode_handle_put(child); | |
| 544 | 550 | return ret; |
| 545 | 551 | } |
| 546 | 552 | |
| @@ -399,6 +399,7 @@ static int fxas21002c_temp_get(struct fxas21002c_data *data, int *val) · 398 unmodified lines | ||
| 399 | 399 | ret = regmap_field_read(data->regmap_fields[F_TEMP], &temp); |
| 400 | 400 | if (ret < 0) { |
| 401 | 401 | dev_err(dev, "failed to read temp: %d\n", ret); |
| 402 | + fxas21002c_pm_put(data); | |
| 402 | 403 | goto data_unlock; |
| 403 | 404 | } |
| 404 | 405 | |
| @@ -432,6 +433,7 @@ static int fxas21002c_axis_get(struct fxas21002c_data *data, · 27 unmodified lines | ||
| 432 | 433 | &axis_be, sizeof(axis_be)); |
| 433 | 434 | if (ret < 0) { |
| 434 | 435 | dev_err(dev, "failed to read axis: %d: %d\n", index, ret); |
| 436 | + fxas21002c_pm_put(data); | |
| 435 | 437 | goto data_unlock; |
| 436 | 438 | } |
| 437 | 439 | |
| @@ -3248,6 +3248,11 @@ static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs) · 3247 unmodified lines | ||
| 3248 | 3248 | goto err_free_attr; |
| 3249 | 3249 | } |
| 3250 | 3250 | |
| 3251 | + if (!rdma_is_port_valid(uobj->context->device, cmd.flow_attr.port)) { | |
| 3252 | + err = -EINVAL; | |
| 3253 | + goto err_uobj; | |
| 3254 | + } | |
| 3255 | + | |
| 3251 | 3256 | qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs); |
| 3252 | 3257 | if (!qp) { |
| 3253 | 3258 | err = -EINVAL; |
| @@ -581,12 +581,9 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 580 unmodified lines | ||
| 581 | 581 | props->cq_caps.max_cq_moderation_count = MLX4_MAX_CQ_COUNT; |
| 582 | 582 | props->cq_caps.max_cq_moderation_period = MLX4_MAX_CQ_PERIOD; |
| 583 | 583 | |
| 584 | − if (!mlx4_is_slave(dev->dev)) | |
| 585 | − err = mlx4_get_internal_clock_params(dev->dev, &clock_params); | |
| 586 | − | |
| 587 | 584 | if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { |
| 588 | 585 | resp.response_length += sizeof(resp.hca_core_clock_offset); |
| 589 | − if (!err && !mlx4_is_slave(dev->dev)) { | |
| 586 | + if (!mlx4_get_internal_clock_params(dev->dev, &clock_params)) { | |
| 590 | 587 | resp.comp_mask |= MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET; |
| 591 | 588 | resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE; |
| 592 | 589 | } |
| @@ -1702,9 +1699,6 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 1109 unmodified lines | ||
| 1702 | 1699 | struct mlx4_dev *dev = (to_mdev(qp->device))->dev; |
| 1703 | 1700 | int is_bonded = mlx4_is_bonded(dev); |
| 1704 | 1701 | |
| 1705 | − if (!rdma_is_port_valid(qp->device, flow_attr->port)) | |
| 1706 | − return ERR_PTR(-EINVAL); | |
| 1707 | − | |
| 1708 | 1702 | if (flow_attr->flags & ~IB_FLOW_ATTR_FLAGS_DONT_TRAP) |
| 1709 | 1703 | return ERR_PTR(-EOPNOTSUPP); |
| 1710 | 1704 | |
| @@ -849,15 +849,14 @@ static void destroy_cq_user(struct mlx5_ib_cq *cq, struct ib_udata *udata) · 848 unmodified lines | ||
| 849 | 849 | ib_umem_release(cq->buf.umem); |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | −static void init_cq_frag_buf(struct mlx5_ib_cq *cq, | |
| 853 | − struct mlx5_ib_cq_buf *buf) | |
| 852 | +static void init_cq_frag_buf(struct mlx5_ib_cq_buf *buf) | |
| 854 | 853 | { |
| 855 | 854 | int i; |
| 856 | 855 | void *cqe; |
| 857 | 856 | struct mlx5_cqe64 *cqe64; |
| 858 | 857 | |
| 859 | 858 | for (i = 0; i < buf->nent; i++) { |
| 860 | − cqe = get_cqe(cq, i); | |
| 859 | + cqe = mlx5_frag_buf_get_wqe(&buf->fbc, i); | |
| 861 | 860 | cqe64 = buf->cqe_size == 64 ? cqe : cqe + 64; |
| 862 | 861 | cqe64->op_own = MLX5_CQE_INVALID << 4; |
| 863 | 862 | } |
| @@ -883,7 +882,7 @@ static int create_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, · 19 unmodified lines | ||
| 883 | 882 | if (err) |
| 884 | 883 | goto err_db; |
| 885 | 884 | |
| 886 | − init_cq_frag_buf(cq, &cq->buf); | |
| 885 | + init_cq_frag_buf(&cq->buf); | |
| 887 | 886 | |
| 888 | 887 | *inlen = MLX5_ST_SZ_BYTES(create_cq_in) + |
| 889 | 888 | MLX5_FLD_SZ_BYTES(create_cq_in, pas[0]) * |
| @@ -1184,7 +1183,7 @@ static int resize_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, · 294 unmodified lines | ||
| 1184 | 1183 | if (err) |
| 1185 | 1184 | goto ex; |
| 1186 | 1185 | |
| 1187 | − init_cq_frag_buf(cq, cq->resize_buf); | |
| 1186 | + init_cq_frag_buf(cq->resize_buf); | |
| 1188 | 1187 | |
| 1189 | 1188 | return 0; |
| 1190 | 1189 | |
| @@ -41,6 +41,7 @@ struct mlx5_ib_user_db_page { · 40 unmodified lines | ||
| 41 | 41 | struct ib_umem *umem; |
| 42 | 42 | unsigned long user_virt; |
| 43 | 43 | int refcnt; |
| 44 | + struct mm_struct *mm; | |
| 44 | 45 | }; |
| 45 | 46 | |
| 46 | 47 | int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context, |
| @@ -53,7 +54,8 @@ int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context, · 6 unmodified lines | ||
| 53 | 54 | mutex_lock(&context->db_page_mutex); |
| 54 | 55 | |
| 55 | 56 | list_for_each_entry(page, &context->db_page_list, list) |
| 56 | − if (page->user_virt == (virt & PAGE_MASK)) | |
| 57 | + if ((current->mm == page->mm) && | |
| 58 | + (page->user_virt == (virt & PAGE_MASK))) | |
| 57 | 59 | goto found; |
| 58 | 60 | |
| 59 | 61 | page = kmalloc(sizeof(*page), GFP_KERNEL); |
| @@ -71,6 +73,8 @@ int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context, · 11 unmodified lines | ||
| 71 | 73 | kfree(page); |
| 72 | 74 | goto out; |
| 73 | 75 | } |
| 76 | + mmgrab(current->mm); | |
| 77 | + page->mm = current->mm; | |
| 74 | 78 | |
| 75 | 79 | list_add(&page->list, &context->db_page_list); |
| 76 | 80 | |
| @@ -91,6 +95,7 @@ void mlx5_ib_db_unmap_user(struct mlx5_ib_ucontext *context, struct mlx5_db *db) · 14 unmodified lines | ||
| 91 | 95 | |
| 92 | 96 | if (!--db->u.user_page->refcnt) { |
| 93 | 97 | list_del(&db->u.user_page->list); |
| 98 | + mmdrop(db->u.user_page->mm); | |
| 94 | 99 | ib_umem_release(db->u.user_page->umem); |
| 95 | 100 | kfree(db->u.user_page); |
| 96 | 101 | } |
| @@ -1194,9 +1194,8 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp, · 1193 unmodified lines | ||
| 1194 | 1194 | goto free_ucmd; |
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | − if (flow_attr->port > dev->num_ports || | |
| 1198 | − (flow_attr->flags & | |
| 1199 | − ~(IB_FLOW_ATTR_FLAGS_DONT_TRAP | IB_FLOW_ATTR_FLAGS_EGRESS))) { | |
| 1197 | + if (flow_attr->flags & | |
| 1198 | + ~(IB_FLOW_ATTR_FLAGS_DONT_TRAP | IB_FLOW_ATTR_FLAGS_EGRESS)) { | |
| 1200 | 1199 | err = -EINVAL; |
| 1201 | 1200 | goto free_ucmd; |
| 1202 | 1201 | } |
| @@ -2134,6 +2133,12 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_FLOW_MATCHER_CREATE)( · 931 unmodified lines | ||
| 2134 | 2133 | if (err) |
| 2135 | 2134 | goto end; |
| 2136 | 2135 | |
| 2136 | + if (obj->ns_type == MLX5_FLOW_NAMESPACE_FDB && | |
| 2137 | + mlx5_eswitch_mode(dev->mdev) != MLX5_ESWITCH_OFFLOADS) { | |
| 2138 | + err = -EINVAL; | |
| 2139 | + goto end; | |
| 2140 | + } | |
| 2141 | + | |
| 2137 | 2142 | uobj->object = obj; |
| 2138 | 2143 | obj->mdev = dev->mdev; |
| 2139 | 2144 | atomic_set(&obj->usecnt, 0); |
| @@ -743,10 +743,10 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev) · 742 unmodified lines | ||
| 743 | 743 | ent->xlt = (1 << ent->order) * sizeof(struct mlx5_mtt) / |
| 744 | 744 | MLX5_IB_UMR_OCTOWORD; |
| 745 | 745 | ent->access_mode = MLX5_MKC_ACCESS_MODE_MTT; |
| 746 | − if ((dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE) && | |
| 746 | + if ((dev->mdev->profile.mask & MLX5_PROF_MASK_MR_CACHE) && | |
| 747 | 747 | !dev->is_rep && mlx5_core_is_pf(dev->mdev) && |
| 748 | 748 | mlx5_ib_can_load_pas_with_umr(dev, 0)) |
| 749 | − ent->limit = dev->mdev->profile->mr_cache[i].limit; | |
| 749 | + ent->limit = dev->mdev->profile.mr_cache[i].limit; | |
| 750 | 750 | else |
| 751 | 751 | ent->limit = 0; |
| 752 | 752 | spin_lock_irq(&ent->lock); |
| @@ -1940,8 +1940,8 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · 1187 unmodified lines | ||
| 1940 | 1940 | mlx5r_deref_wait_odp_mkey(&mr->mmkey); |
| 1941 | 1941 | |
| 1942 | 1942 | if (ibmr->type == IB_MR_TYPE_INTEGRITY) { |
| 1943 | − xa_cmpxchg(&dev->sig_mrs, mlx5_base_mkey(mr->mmkey.key), ibmr, | |
| 1944 | − NULL, GFP_KERNEL); | |
| 1943 | + xa_cmpxchg(&dev->sig_mrs, mlx5_base_mkey(mr->mmkey.key), | |
| 1944 | + mr->sig, NULL, GFP_KERNEL); | |
| 1945 | 1945 | |
| 1946 | 1946 | if (mr->mtt_mr) { |
| 1947 | 1947 | rc = mlx5_ib_dereg_mr(&mr->mtt_mr->ibmr, NULL); |
| @@ -163,6 +163,7 @@ static size_t ipoib_get_size(const struct net_device *dev) · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | static struct rtnl_link_ops ipoib_link_ops __read_mostly = { |
| 165 | 165 | .kind = "ipoib", |
| 166 | + .netns_refund = true, | |
| 166 | 167 | .maxtype = IFLA_IPOIB_MAX, |
| 167 | 168 | .policy = ipoib_policy, |
| 168 | 169 | .priv_size = sizeof(struct ipoib_dev_priv), |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | /* |
| 3 | − * Copyright (c) 2020, The Linux Foundation. All rights reserved. | |
| 3 | + * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include <asm/div64.h> |
| @@ -205,6 +205,7 @@ struct bcm_voter *of_bcm_voter_get(struct device *dev, const char *name) · 198 unmodified lines | ||
| 205 | 205 | } |
| 206 | 206 | mutex_unlock(&bcm_voter_lock); |
| 207 | 207 | |
| 208 | + of_node_put(node); | |
| 208 | 209 | return voter; |
| 209 | 210 | } |
| 210 | 211 | EXPORT_SYMBOL_GPL(of_bcm_voter_get); |
| @@ -362,6 +363,7 @@ static const struct of_device_id bcm_voter_of_match[] = { · 151 unmodified lines | ||
| 362 | 363 | { .compatible = "qcom,bcm-voter" }, |
| 363 | 364 | { } |
| 364 | 365 | }; |
| 366 | +MODULE_DEVICE_TABLE(of, bcm_voter_of_match); | |
| 365 | 367 | |
| 366 | 368 | static struct platform_driver qcom_icc_bcm_voter_driver = { |
| 367 | 369 | .probe = qcom_icc_bcm_voter_probe, |
| @@ -884,7 +884,7 @@ static inline u64 build_inv_address(u64 address, size_t size) · 883 unmodified lines | ||
| 884 | 884 | * The msb-bit must be clear on the address. Just set all the |
| 885 | 885 | * lower bits. |
| 886 | 886 | */ |
| 887 | − address |= 1ull << (msb_diff - 1); | |
| 887 | + address |= (1ull << msb_diff) - 1; | |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | /* Clear bits 11:0 */ |
| @@ -1714,6 +1714,8 @@ static void amd_iommu_probe_finalize(struct device *dev) · 823 unmodified lines | ||
| 1714 | 1714 | domain = iommu_get_domain_for_dev(dev); |
| 1715 | 1715 | if (domain->type == IOMMU_DOMAIN_DMA) |
| 1716 | 1716 | iommu_setup_dma_ops(dev, IOVA_START_PFN << PAGE_SHIFT, 0); |
| 1717 | + else | |
| 1718 | + set_dma_ops(dev, NULL); | |
| 1717 | 1719 | } |
| 1718 | 1720 | |
| 1719 | 1721 | static void amd_iommu_release_device(struct device *dev) |
| @@ -1142,7 +1142,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) · 1141 unmodified lines | ||
| 1142 | 1142 | |
| 1143 | 1143 | err = iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL); |
| 1144 | 1144 | if (err) |
| 1145 | − goto err_unmap; | |
| 1145 | + goto err_sysfs; | |
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | drhd->iommu = iommu; |
| @@ -1150,6 +1150,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) · 1 unmodified line | ||
| 1150 | 1150 | |
| 1151 | 1151 | return 0; |
| 1152 | 1152 | |
| 1153 | +err_sysfs: | |
| 1154 | + iommu_device_sysfs_remove(&iommu->iommu); | |
| 1153 | 1155 | err_unmap: |
| 1154 | 1156 | unmap_iommu(iommu); |
| 1155 | 1157 | error_free_seq_id: |
| @@ -2525,9 +2525,9 @@ static int domain_setup_first_level(struct intel_iommu *iommu, · 2524 unmodified lines | ||
| 2525 | 2525 | struct device *dev, |
| 2526 | 2526 | u32 pasid) |
| 2527 | 2527 | { |
| 2528 | − int flags = PASID_FLAG_SUPERVISOR_MODE; | |
| 2529 | 2528 | struct dma_pte *pgd = domain->pgd; |
| 2530 | 2529 | int agaw, level; |
| 2530 | + int flags = 0; | |
| 2531 | 2531 | |
| 2532 | 2532 | /* |
| 2533 | 2533 | * Skip top levels of page tables for iommu which has |
| @@ -2543,7 +2543,10 @@ static int domain_setup_first_level(struct intel_iommu *iommu, · 9 unmodified lines | ||
| 2543 | 2543 | if (level != 4 && level != 5) |
| 2544 | 2544 | return -EINVAL; |
| 2545 | 2545 | |
| 2546 | − flags |= (level == 5) ? PASID_FLAG_FL5LP : 0; | |
| 2546 | + if (pasid != PASID_RID2PASID) | |
| 2547 | + flags |= PASID_FLAG_SUPERVISOR_MODE; | |
| 2548 | + if (level == 5) | |
| 2549 | + flags |= PASID_FLAG_FL5LP; | |
| 2547 | 2550 | |
| 2548 | 2551 | if (domain->domain.type == IOMMU_DOMAIN_UNMANAGED) |
| 2549 | 2552 | flags |= PASID_FLAG_PAGE_SNOOP; |
| @@ -4606,6 +4609,8 @@ static int auxiliary_link_device(struct dmar_domain *domain, · 2056 unmodified lines | ||
| 4606 | 4609 | |
| 4607 | 4610 | if (!sinfo) { |
| 4608 | 4611 | sinfo = kzalloc(sizeof(*sinfo), GFP_ATOMIC); |
| 4612 | + if (!sinfo) | |
| 4613 | + return -ENOMEM; | |
| 4609 | 4614 | sinfo->domain = domain; |
| 4610 | 4615 | sinfo->pdev = dev; |
| 4611 | 4616 | list_add(&sinfo->link_phys, &info->subdevices); |
| @@ -699,7 +699,8 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu, · 698 unmodified lines | ||
| 699 | 699 | * Since it is a second level only translation setup, we should |
| 700 | 700 | * set SRE bit as well (addresses are expected to be GPAs). |
| 701 | 701 | */ |
| 702 | − pasid_set_sre(pte); | |
| 702 | + if (pasid != PASID_RID2PASID) | |
| 703 | + pasid_set_sre(pte); | |
| 703 | 704 | pasid_set_present(pte); |
| 704 | 705 | pasid_flush_caches(iommu, pte, pasid, did); |
| 705 | 706 | |
| @@ -1136,6 +1136,7 @@ static struct virtio_device_id id_table[] = { · 1135 unmodified lines | ||
| 1136 | 1136 | { VIRTIO_ID_IOMMU, VIRTIO_DEV_ANY_ID }, |
| 1137 | 1137 | { 0 }, |
| 1138 | 1138 | }; |
| 1139 | +MODULE_DEVICE_TABLE(virtio, id_table); | |
| 1139 | 1140 | |
| 1140 | 1141 | static struct virtio_driver virtio_iommu_drv = { |
| 1141 | 1142 | .driver.name = KBUILD_MODNAME, |
| @@ -642,11 +642,45 @@ static inline void gic_handle_nmi(u32 irqnr, struct pt_regs *regs) · 641 unmodified lines | ||
| 642 | 642 | nmi_exit(); |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | +static u32 do_read_iar(struct pt_regs *regs) | |
| 646 | +{ | |
| 647 | + u32 iar; | |
| 648 | + | |
| 649 | + if (gic_supports_nmi() && unlikely(!interrupts_enabled(regs))) { | |
| 650 | + u64 pmr; | |
| 651 | + | |
| 652 | + /* | |
| 653 | + * We were in a context with IRQs disabled. However, the | |
| 654 | + * entry code has set PMR to a value that allows any | |
| 655 | + * interrupt to be acknowledged, and not just NMIs. This can | |
| 656 | + * lead to surprising effects if the NMI has been retired in | |
| 657 | + * the meantime, and that there is an IRQ pending. The IRQ | |
| 658 | + * would then be taken in NMI context, something that nobody | |
| 659 | + * wants to debug twice. | |
| 660 | + * | |
| 661 | + * Until we sort this, drop PMR again to a level that will | |
| 662 | + * actually only allow NMIs before reading IAR, and then | |
| 663 | + * restore it to what it was. | |
| 664 | + */ | |
| 665 | + pmr = gic_read_pmr(); | |
| 666 | + gic_pmr_mask_irqs(); | |
| 667 | + isb(); | |
| 668 | + | |
| 669 | + iar = gic_read_iar(); | |
| 670 | + | |
| 671 | + gic_write_pmr(pmr); | |
| 672 | + } else { | |
| 673 | + iar = gic_read_iar(); | |
| 674 | + } | |
| 675 | + | |
| 676 | + return iar; | |
| 677 | +} | |
| 678 | + | |
| 645 | 679 | static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs) |
| 646 | 680 | { |
| 647 | 681 | u32 irqnr; |
| 648 | 682 | |
| 649 | − irqnr = gic_read_iar(); | |
| 683 | + irqnr = do_read_iar(regs); | |
| 650 | 684 | |
| 651 | 685 | /* Check for special IDs first */ |
| 652 | 686 | if ((irqnr >= 1020 && irqnr <= 1023)) |
| @@ -1100,7 +1100,6 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1099 unmodified lines | ||
| 1100 | 1100 | card->typ = NETJET_S_TJ300; |
| 1101 | 1101 | |
| 1102 | 1102 | card->base = pci_resource_start(pdev, 0); |
| 1103 | − card->irq = pdev->irq; | |
| 1104 | 1103 | pci_set_drvdata(pdev, card); |
| 1105 | 1104 | err = setup_instance(card); |
| 1106 | 1105 | if (err) |
| @@ -364,7 +364,6 @@ struct cached_dev { · 363 unmodified lines | ||
| 364 | 364 | |
| 365 | 365 | /* The rest of this all shows up in sysfs */ |
| 366 | 366 | unsigned int sequential_cutoff; |
| 367 | − unsigned int readahead; | |
| 368 | 367 | |
| 369 | 368 | unsigned int io_disable:1; |
| 370 | 369 | unsigned int verify:1; |
| @@ -880,9 +880,9 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 879 unmodified lines | ||
| 880 | 880 | struct bio *bio, unsigned int sectors) |
| 881 | 881 | { |
| 882 | 882 | int ret = MAP_CONTINUE; |
| 883 | − unsigned int reada = 0; | |
| 884 | 883 | struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); |
| 885 | 884 | struct bio *miss, *cache_bio; |
| 885 | + unsigned int size_limit; | |
| 886 | 886 | |
| 887 | 887 | s->cache_missed = 1; |
| 888 | 888 | |
| @@ -892,14 +892,10 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 3 unmodified lines | ||
| 892 | 892 | goto out_submit; |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | − if (!(bio->bi_opf & REQ_RAHEAD) && | |
| 896 | − !(bio->bi_opf & (REQ_META|REQ_PRIO)) && | |
| 897 | − s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA) | |
| 898 | − reada = min_t(sector_t, dc->readahead >> 9, | |
| 899 | − get_capacity(bio->bi_bdev->bd_disk) - | |
| 900 | − bio_end_sector(bio)); | |
| 901 | − | |
| 902 | − s->insert_bio_sectors = min(sectors, bio_sectors(bio) + reada); | |
| 895 | + /* Limitation for valid replace key size and cache_bio bvecs number */ | |
| 896 | + size_limit = min_t(unsigned int, BIO_MAX_VECS * PAGE_SECTORS, | |
| 897 | + (1 << KEY_SIZE_BITS) - 1); | |
| 898 | + s->insert_bio_sectors = min3(size_limit, sectors, bio_sectors(bio)); | |
| 903 | 899 | |
| 904 | 900 | s->iop.replace_key = KEY(s->iop.inode, |
| 905 | 901 | bio->bi_iter.bi_sector + s->insert_bio_sectors, |
| @@ -911,7 +907,8 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 5 unmodified lines | ||
| 911 | 907 | |
| 912 | 908 | s->iop.replace = true; |
| 913 | 909 | |
| 914 | − miss = bio_next_split(bio, sectors, GFP_NOIO, &s->d->bio_split); | |
| 910 | + miss = bio_next_split(bio, s->insert_bio_sectors, GFP_NOIO, | |
| 911 | + &s->d->bio_split); | |
| 915 | 912 | |
| 916 | 913 | /* btree_search_recurse()'s btree iterator is no good anymore */ |
| 917 | 914 | ret = miss == bio ? MAP_DONE : -EINTR; |
| @@ -933,9 +930,6 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 15 unmodified lines | ||
| 933 | 930 | if (bch_bio_alloc_pages(cache_bio, __GFP_NOWARN|GFP_NOIO)) |
| 934 | 931 | goto out_put; |
| 935 | 932 | |
| 936 | − if (reada) | |
| 937 | − bch_mark_cache_readahead(s->iop.c, s->d); | |
| 938 | − | |
| 939 | 933 | s->cache_miss = miss; |
| 940 | 934 | s->iop.bio = cache_bio; |
| 941 | 935 | bio_get(cache_bio); |
| @@ -46,7 +46,6 @@ read_attribute(cache_misses); · 45 unmodified lines | ||
| 46 | 46 | read_attribute(cache_bypass_hits); |
| 47 | 47 | read_attribute(cache_bypass_misses); |
| 48 | 48 | read_attribute(cache_hit_ratio); |
| 49 | −read_attribute(cache_readaheads); | |
| 50 | 49 | read_attribute(cache_miss_collisions); |
| 51 | 50 | read_attribute(bypassed); |
| 52 | 51 | |
| @@ -64,7 +63,6 @@ SHOW(bch_stats) · 11 unmodified lines | ||
| 64 | 63 | DIV_SAFE(var(cache_hits) * 100, |
| 65 | 64 | var(cache_hits) + var(cache_misses))); |
| 66 | 65 | |
| 67 | − var_print(cache_readaheads); | |
| 68 | 66 | var_print(cache_miss_collisions); |
| 69 | 67 | sysfs_hprint(bypassed, var(sectors_bypassed) << 9); |
| 70 | 68 | #undef var |
| @@ -86,7 +84,6 @@ static struct attribute *bch_stats_files[] = { · 15 unmodified lines | ||
| 86 | 84 | &sysfs_cache_bypass_hits, |
| 87 | 85 | &sysfs_cache_bypass_misses, |
| 88 | 86 | &sysfs_cache_hit_ratio, |
| 89 | − &sysfs_cache_readaheads, | |
| 90 | 87 | &sysfs_cache_miss_collisions, |
| 91 | 88 | &sysfs_bypassed, |
| 92 | 89 | NULL |
| @@ -113,7 +110,6 @@ void bch_cache_accounting_clear(struct cache_accounting *acc) · 20 unmodified lines | ||
| 113 | 110 | acc->total.cache_misses = 0; |
| 114 | 111 | acc->total.cache_bypass_hits = 0; |
| 115 | 112 | acc->total.cache_bypass_misses = 0; |
| 116 | − acc->total.cache_readaheads = 0; | |
| 117 | 113 | acc->total.cache_miss_collisions = 0; |
| 118 | 114 | acc->total.sectors_bypassed = 0; |
| 119 | 115 | } |
| @@ -145,7 +141,6 @@ static void scale_stats(struct cache_stats *stats, unsigned long rescale_at) · 25 unmodified lines | ||
| 145 | 141 | scale_stat(&stats->cache_misses); |
| 146 | 142 | scale_stat(&stats->cache_bypass_hits); |
| 147 | 143 | scale_stat(&stats->cache_bypass_misses); |
| 148 | − scale_stat(&stats->cache_readaheads); | |
| 149 | 144 | scale_stat(&stats->cache_miss_collisions); |
| 150 | 145 | scale_stat(&stats->sectors_bypassed); |
| 151 | 146 | } |
| @@ -168,7 +163,6 @@ static void scale_accounting(struct timer_list *t) · 16 unmodified lines | ||
| 168 | 163 | move_stat(cache_misses); |
| 169 | 164 | move_stat(cache_bypass_hits); |
| 170 | 165 | move_stat(cache_bypass_misses); |
| 171 | − move_stat(cache_readaheads); | |
| 172 | 166 | move_stat(cache_miss_collisions); |
| 173 | 167 | move_stat(sectors_bypassed); |
| 174 | 168 | |
| @@ -209,14 +203,6 @@ void bch_mark_cache_accounting(struct cache_set *c, struct bcache_device *d, · 34 unmodified lines | ||
| 209 | 203 | mark_cache_stats(&c->accounting.collector, hit, bypass); |
| 210 | 204 | } |
| 211 | 205 | |
| 212 | −void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d) | |
| 213 | −{ | |
| 214 | − struct cached_dev *dc = container_of(d, struct cached_dev, disk); | |
| 215 | − | |
| 216 | − atomic_inc(&dc->accounting.collector.cache_readaheads); | |
| 217 | − atomic_inc(&c->accounting.collector.cache_readaheads); | |
| 218 | −} | |
| 219 | − | |
| 220 | 206 | void bch_mark_cache_miss_collision(struct cache_set *c, struct bcache_device *d) |
| 221 | 207 | { |
| 222 | 208 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); |
| @@ -7,7 +7,6 @@ struct cache_stat_collector { · 6 unmodified lines | ||
| 7 | 7 | atomic_t cache_misses; |
| 8 | 8 | atomic_t cache_bypass_hits; |
| 9 | 9 | atomic_t cache_bypass_misses; |
| 10 | − atomic_t cache_readaheads; | |
| 11 | 10 | atomic_t cache_miss_collisions; |
| 12 | 11 | atomic_t sectors_bypassed; |
| 13 | 12 | }; |
| @@ -137,7 +137,6 @@ rw_attribute(io_disable); · 136 unmodified lines | ||
| 137 | 137 | rw_attribute(discard); |
| 138 | 138 | rw_attribute(running); |
| 139 | 139 | rw_attribute(label); |
| 140 | −rw_attribute(readahead); | |
| 141 | 140 | rw_attribute(errors); |
| 142 | 141 | rw_attribute(io_error_limit); |
| 143 | 142 | rw_attribute(io_error_halflife); |
| @@ -260,7 +259,6 @@ SHOW(__bch_cached_dev) · 116 unmodified lines | ||
| 260 | 259 | var_printf(partial_stripes_expensive, "%u"); |
| 261 | 260 | |
| 262 | 261 | var_hprint(sequential_cutoff); |
| 263 | − var_hprint(readahead); | |
| 264 | 262 | |
| 265 | 263 | sysfs_print(running, atomic_read(&dc->running)); |
| 266 | 264 | sysfs_print(state, states[BDEV_STATE(&dc->sb)]); |
| @@ -365,7 +363,6 @@ STORE(__cached_dev) · 98 unmodified lines | ||
| 365 | 363 | sysfs_strtoul_clamp(sequential_cutoff, |
| 366 | 364 | dc->sequential_cutoff, |
| 367 | 365 | 0, UINT_MAX); |
| 368 | − d_strtoi_h(readahead); | |
| 369 | 366 | |
| 370 | 367 | if (attr == &sysfs_clear_stats) |
| 371 | 368 | bch_cache_accounting_clear(&dc->accounting); |
| @@ -538,7 +535,6 @@ static struct attribute *bch_cached_dev_files[] = { · 166 unmodified lines | ||
| 538 | 535 | &sysfs_running, |
| 539 | 536 | &sysfs_state, |
| 540 | 537 | &sysfs_label, |
| 541 | − &sysfs_readahead, | |
| 542 | 538 | #ifdef CONFIG_BCACHE_DEBUG |
| 543 | 539 | &sysfs_verify, |
| 544 | 540 | &sysfs_bypass_torture_test, |
| @@ -859,7 +859,8 @@ static uint32_t __minimum_chunk_size(struct origin *o) · 858 unmodified lines | ||
| 859 | 859 | |
| 860 | 860 | if (o) |
| 861 | 861 | list_for_each_entry(snap, &o->snapshots, list) |
| 862 | − chunk_size = min(chunk_size, snap->store->chunk_size); | |
| 862 | + chunk_size = min_not_zero(chunk_size, | |
| 863 | + snap->store->chunk_size); | |
| 863 | 864 | |
| 864 | 865 | return (uint32_t) chunk_size; |
| 865 | 866 | } |
| @@ -15,7 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #define DM_VERITY_VERIFY_ERR(s) DM_VERITY_ROOT_HASH_VERIFICATION " " s |
| 16 | 16 | |
| 17 | 17 | static bool require_signatures; |
| 18 | −module_param(require_signatures, bool, false); | |
| 18 | +module_param(require_signatures, bool, 0444); | |
| 19 | 19 | MODULE_PARM_DESC(require_signatures, |
| 20 | 20 | "Verify the roothash of dm-verity hash tree"); |
| 21 | 21 | |
| @@ -5311,8 +5311,6 @@ static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) · 5310 unmodified lines | ||
| 5311 | 5311 | unsigned int chunk_sectors; |
| 5312 | 5312 | unsigned int bio_sectors = bio_sectors(bio); |
| 5313 | 5313 | |
| 5314 | − WARN_ON_ONCE(bio->bi_bdev->bd_partno); | |
| 5315 | − | |
| 5316 | 5314 | chunk_sectors = min(conf->chunk_sectors, conf->prev_chunk_sectors); |
| 5317 | 5315 | return chunk_sectors >= |
| 5318 | 5316 | ((sector & (chunk_sectors - 1)) + bio_sectors); |
| @@ -468,6 +468,7 @@ static void rtl8411_init_common_params(struct rtsx_pcr *pcr) · 467 unmodified lines | ||
| 468 | 468 | pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B; |
| 469 | 469 | pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D; |
| 470 | 470 | pcr->aspm_en = ASPM_L1_EN; |
| 471 | + pcr->aspm_mode = ASPM_MODE_CFG; | |
| 471 | 472 | pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14); |
| 472 | 473 | pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10); |
| 473 | 474 | pcr->ic_version = rtl8411_get_ic_version(pcr); |
| @@ -255,6 +255,7 @@ void rts5209_init_params(struct rtsx_pcr *pcr) · 254 unmodified lines | ||
| 255 | 255 | pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B; |
| 256 | 256 | pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D; |
| 257 | 257 | pcr->aspm_en = ASPM_L1_EN; |
| 258 | + pcr->aspm_mode = ASPM_MODE_CFG; | |
| 258 | 259 | pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 16); |
| 259 | 260 | pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); |
| 260 | 261 | |
| @@ -358,6 +358,7 @@ void rts5227_init_params(struct rtsx_pcr *pcr) · 357 unmodified lines | ||
| 358 | 358 | pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B; |
| 359 | 359 | pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B; |
| 360 | 360 | pcr->aspm_en = ASPM_L1_EN; |
| 361 | + pcr->aspm_mode = ASPM_MODE_CFG; | |
| 361 | 362 | pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15); |
| 362 | 363 | pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 7, 7); |
| 363 | 364 | |
| @@ -483,6 +484,7 @@ void rts522a_init_params(struct rtsx_pcr *pcr) · 119 unmodified lines | ||
| 483 | 484 | |
| 484 | 485 | rts5227_init_params(pcr); |
| 485 | 486 | pcr->ops = &rts522a_pcr_ops; |
| 487 | + pcr->aspm_mode = ASPM_MODE_REG; | |
| 486 | 488 | pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11); |
| 487 | 489 | pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3; |
| 488 | 490 | |
| @@ -718,6 +718,7 @@ void rts5228_init_params(struct rtsx_pcr *pcr) · 717 unmodified lines | ||
| 718 | 718 | pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B; |
| 719 | 719 | pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B; |
| 720 | 720 | pcr->aspm_en = ASPM_L1_EN; |
| 721 | + pcr->aspm_mode = ASPM_MODE_REG; | |
| 721 | 722 | pcr->tx_initial_phase = SET_CLOCK_PHASE(28, 27, 11); |
| 722 | 723 | pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); |
| 723 | 724 | |
| @@ -246,6 +246,7 @@ void rts5229_init_params(struct rtsx_pcr *pcr) · 245 unmodified lines | ||
| 246 | 246 | pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B; |
| 247 | 247 | pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D; |
| 248 | 248 | pcr->aspm_en = ASPM_L1_EN; |
| 249 | + pcr->aspm_mode = ASPM_MODE_CFG; | |
| 249 | 250 | pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15); |
| 250 | 251 | pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 6, 6); |
| 251 | 252 | |
| @@ -566,6 +566,7 @@ void rts5249_init_params(struct rtsx_pcr *pcr) · 565 unmodified lines | ||
| 566 | 566 | pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B; |
| 567 | 567 | pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B; |
| 568 | 568 | pcr->aspm_en = ASPM_L1_EN; |
| 569 | + pcr->aspm_mode = ASPM_MODE_CFG; | |
| 569 | 570 | pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16); |
| 570 | 571 | pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); |
| 571 | 572 | |
| @@ -729,6 +730,7 @@ static const struct pcr_ops rts524a_pcr_ops = { · 157 unmodified lines | ||
| 729 | 730 | void rts524a_init_params(struct rtsx_pcr *pcr) |
| 730 | 731 | { |
| 731 | 732 | rts5249_init_params(pcr); |
| 733 | + pcr->aspm_mode = ASPM_MODE_REG; | |
| 732 | 734 | pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11); |
| 733 | 735 | pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF; |
| 734 | 736 | pcr->option.ltr_l1off_snooze_sspwrgate = |
| @@ -845,6 +847,7 @@ static const struct pcr_ops rts525a_pcr_ops = { · 110 unmodified lines | ||
| 845 | 847 | void rts525a_init_params(struct rtsx_pcr *pcr) |
| 846 | 848 | { |
| 847 | 849 | rts5249_init_params(pcr); |
| 850 | + pcr->aspm_mode = ASPM_MODE_REG; | |
| 848 | 851 | pcr->tx_initial_phase = SET_CLOCK_PHASE(25, 29, 11); |
| 849 | 852 | pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF; |
| 850 | 853 | pcr->option.ltr_l1off_snooze_sspwrgate = |
| @@ -628,6 +628,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr) · 627 unmodified lines | ||
| 628 | 628 | pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B; |
| 629 | 629 | pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B; |
| 630 | 630 | pcr->aspm_en = ASPM_L1_EN; |
| 631 | + pcr->aspm_mode = ASPM_MODE_REG; | |
| 631 | 632 | pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11); |
| 632 | 633 | pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); |
| 633 | 634 | |
| @@ -783,6 +783,7 @@ void rts5261_init_params(struct rtsx_pcr *pcr) · 782 unmodified lines | ||
| 783 | 783 | pcr->sd30_drive_sel_1v8 = 0x00; |
| 784 | 784 | pcr->sd30_drive_sel_3v3 = 0x00; |
| 785 | 785 | pcr->aspm_en = ASPM_L1_EN; |
| 786 | + pcr->aspm_mode = ASPM_MODE_REG; | |
| 786 | 787 | pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 11); |
| 787 | 788 | pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); |
| 788 | 789 | |
| @@ -85,12 +85,18 @@ static void rtsx_comm_set_aspm(struct rtsx_pcr *pcr, bool enable) · 84 unmodified lines | ||
| 85 | 85 | if (pcr->aspm_enabled == enable) |
| 86 | 86 | return; |
| 87 | 87 | |
| 88 | − if (pcr->aspm_en & 0x02) | |
| 89 | − rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 | | |
| 90 | − FORCE_ASPM_CTL1, enable ? 0 : FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1); | |
| 91 | − else | |
| 92 | − rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 | | |
| 93 | − FORCE_ASPM_CTL1, FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1); | |
| 88 | + if (pcr->aspm_mode == ASPM_MODE_CFG) { | |
| 89 | + pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL, | |
| 90 | + PCI_EXP_LNKCTL_ASPMC, | |
| 91 | + enable ? pcr->aspm_en : 0); | |
| 92 | + } else if (pcr->aspm_mode == ASPM_MODE_REG) { | |
| 93 | + if (pcr->aspm_en & 0x02) | |
| 94 | + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 | | |
| 95 | + FORCE_ASPM_CTL1, enable ? 0 : FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1); | |
| 96 | + else | |
| 97 | + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 | | |
| 98 | + FORCE_ASPM_CTL1, FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1); | |
| 99 | + } | |
| 94 | 100 | |
| 95 | 101 | if (!enable && (pcr->aspm_en & 0x02)) |
| 96 | 102 | mdelay(10); |
| @@ -1394,7 +1400,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 1297 unmodified lines | ||
| 1394 | 1400 | return err; |
| 1395 | 1401 | } |
| 1396 | 1402 | |
| 1397 | − rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30); | |
| 1403 | + if (pcr->aspm_mode == ASPM_MODE_REG) | |
| 1404 | + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30); | |
| 1398 | 1405 | |
| 1399 | 1406 | /* No CD interrupt if probing driver with card inserted. |
| 1400 | 1407 | * So we need to initialize pcr->card_exist here. |
| @@ -1410,6 +1417,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 9 unmodified lines | ||
| 1410 | 1417 | static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) |
| 1411 | 1418 | { |
| 1412 | 1419 | int err; |
| 1420 | + u16 cfg_val; | |
| 1421 | + u8 val; | |
| 1413 | 1422 | |
| 1414 | 1423 | spin_lock_init(&pcr->lock); |
| 1415 | 1424 | mutex_init(&pcr->pcr_mutex); |
| @@ -1477,6 +1486,21 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) · 61 unmodified lines | ||
| 1477 | 1486 | if (!pcr->slots) |
| 1478 | 1487 | return -ENOMEM; |
| 1479 | 1488 | |
| 1489 | + if (pcr->aspm_mode == ASPM_MODE_CFG) { | |
| 1490 | + pcie_capability_read_word(pcr->pci, PCI_EXP_LNKCTL, &cfg_val); | |
| 1491 | + if (cfg_val & PCI_EXP_LNKCTL_ASPM_L1) | |
| 1492 | + pcr->aspm_enabled = true; | |
| 1493 | + else | |
| 1494 | + pcr->aspm_enabled = false; | |
| 1495 | + | |
| 1496 | + } else if (pcr->aspm_mode == ASPM_MODE_REG) { | |
| 1497 | + rtsx_pci_read_register(pcr, ASPM_FORCE_CTL, &val); | |
| 1498 | + if (val & FORCE_ASPM_CTL0 && val & FORCE_ASPM_CTL1) | |
| 1499 | + pcr->aspm_enabled = false; | |
| 1500 | + else | |
| 1501 | + pcr->aspm_enabled = true; | |
| 1502 | + } | |
| 1503 | + | |
| 1480 | 1504 | if (pcr->ops->fetch_vendor_settings) |
| 1481 | 1505 | pcr->ops->fetch_vendor_settings(pcr); |
| 1482 | 1506 | |
| @@ -1506,7 +1530,6 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, · 23 unmodified lines | ||
| 1506 | 1530 | struct pcr_handle *handle; |
| 1507 | 1531 | u32 base, len; |
| 1508 | 1532 | int ret, i, bar = 0; |
| 1509 | − u8 val; | |
| 1510 | 1533 | |
| 1511 | 1534 | dev_dbg(&(pcidev->dev), |
| 1512 | 1535 | ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n", |
| @@ -1572,11 +1595,6 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, · 59 unmodified lines | ||
| 1572 | 1595 | pcr->host_cmds_addr = pcr->rtsx_resv_buf_addr; |
| 1573 | 1596 | pcr->host_sg_tbl_ptr = pcr->rtsx_resv_buf + HOST_CMDS_BUF_LEN; |
| 1574 | 1597 | pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr + HOST_CMDS_BUF_LEN; |
| 1575 | − rtsx_pci_read_register(pcr, ASPM_FORCE_CTL, &val); | |
| 1576 | − if (val & FORCE_ASPM_CTL0 && val & FORCE_ASPM_CTL1) | |
| 1577 | − pcr->aspm_enabled = false; | |
| 1578 | − else | |
| 1579 | − pcr->aspm_enabled = true; | |
| 1580 | 1598 | pcr->card_inserted = 0; |
| 1581 | 1599 | pcr->card_removed = 0; |
| 1582 | 1600 | INIT_DELAYED_WORK(&pcr->carddet_work, rtsx_pci_card_detect); |
| @@ -101,8 +101,9 @@ · 100 unmodified lines | ||
| 101 | 101 | printk(KERN_INFO a); \ |
| 102 | 102 | } while (0) |
| 103 | 103 | #define v2printk(a...) do { \ |
| 104 | − if (verbose > 1) \ | |
| 104 | + if (verbose > 1) { \ | |
| 105 | 105 | printk(KERN_INFO a); \ |
| 106 | + } \ | |
| 106 | 107 | touch_nmi_watchdog(); \ |
| 107 | 108 | } while (0) |
| 108 | 109 | #define eprintk(a...) do { \ |
| @@ -277,6 +277,9 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb, · 276 unmodified lines | ||
| 277 | 277 | return ret; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | + pm_runtime_mark_last_busy(dev->dev); | |
| 281 | + pm_request_autosuspend(dev->dev); | |
| 282 | + | |
| 280 | 283 | list_move_tail(&cb->list, &cl->rd_pending); |
| 281 | 284 | |
| 282 | 285 | return 0; |
| @@ -692,14 +692,19 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode) · 691 unmodified lines | ||
| 692 | 692 | |
| 693 | 693 | /* Issue CMD19 twice for each tap */ |
| 694 | 694 | for (i = 0; i < 2 * priv->tap_num; i++) { |
| 695 | + int cmd_error; | |
| 696 | + | |
| 695 | 697 | /* Set sampling clock position */ |
| 696 | 698 | sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num); |
| 697 | 699 | |
| 698 | − if (mmc_send_tuning(mmc, opcode, NULL) == 0) | |
| 700 | + if (mmc_send_tuning(mmc, opcode, &cmd_error) == 0) | |
| 699 | 701 | set_bit(i, priv->taps); |
| 700 | 702 | |
| 701 | 703 | if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_SMPCMP) == 0) |
| 702 | 704 | set_bit(i, priv->smpcmp); |
| 705 | + | |
| 706 | + if (cmd_error) | |
| 707 | + mmc_abort_tuning(mmc, opcode); | |
| 703 | 708 | } |
| 704 | 709 | |
| 705 | 710 | ret = renesas_sdhi_select_tuning(host); |
| @@ -939,7 +944,7 @@ static const struct soc_device_attribute sdhi_quirks_match[] = { · 233 unmodified lines | ||
| 939 | 944 | { .soc_id = "r8a7795", .revision = "ES3.*", .data = &sdhi_quirks_bad_taps2367 }, |
| 940 | 945 | { .soc_id = "r8a7796", .revision = "ES1.[012]", .data = &sdhi_quirks_4tap_nohs400 }, |
| 941 | 946 | { .soc_id = "r8a7796", .revision = "ES1.*", .data = &sdhi_quirks_r8a7796_es13 }, |
| 942 | − { .soc_id = "r8a7796", .revision = "ES3.*", .data = &sdhi_quirks_bad_taps1357 }, | |
| 947 | + { .soc_id = "r8a77961", .data = &sdhi_quirks_bad_taps1357 }, | |
| 943 | 948 | { .soc_id = "r8a77965", .data = &sdhi_quirks_r8a77965 }, |
| 944 | 949 | { .soc_id = "r8a77980", .data = &sdhi_quirks_nohs400 }, |
| 945 | 950 | { .soc_id = "r8a77990", .data = &sdhi_quirks_r8a77990 }, |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/module.h> |
| 19 | 19 | #include <linux/delay.h> |
| 20 | 20 | #include <linux/mtd/mtd.h> |
| 21 | +#include <linux/mtd/nand-ecc-sw-hamming.h> | |
| 21 | 22 | #include <linux/mtd/rawnand.h> |
| 22 | 23 | #include <linux/mtd/partitions.h> |
| 23 | 24 | #include <linux/iopoll.h> |
| @@ -240,6 +241,15 @@ static int cs_calculate_ecc(struct nand_chip *this, const u_char *dat, · 216 unmodified lines | ||
| 240 | 241 | return 0; |
| 241 | 242 | } |
| 242 | 243 | |
| 244 | +static int cs553x_ecc_correct(struct nand_chip *chip, | |
| 245 | + unsigned char *buf, | |
| 246 | + unsigned char *read_ecc, | |
| 247 | + unsigned char *calc_ecc) | |
| 248 | +{ | |
| 249 | + return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, | |
| 250 | + chip->ecc.size, false); | |
| 251 | +} | |
| 252 | + | |
| 243 | 253 | static struct cs553x_nand_controller *controllers[4]; |
| 244 | 254 | |
| 245 | 255 | static int cs553x_attach_chip(struct nand_chip *chip) |
| @@ -251,7 +261,7 @@ static int cs553x_attach_chip(struct nand_chip *chip) · 5 unmodified lines | ||
| 251 | 261 | chip->ecc.bytes = 3; |
| 252 | 262 | chip->ecc.hwctl = cs_enable_hwecc; |
| 253 | 263 | chip->ecc.calculate = cs_calculate_ecc; |
| 254 | − chip->ecc.correct = rawnand_sw_hamming_correct; | |
| 264 | + chip->ecc.correct = cs553x_ecc_correct; | |
| 255 | 265 | chip->ecc.strength = 1; |
| 256 | 266 | |
| 257 | 267 | return 0; |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include <linux/sched.h> |
| 26 | 26 | #include <linux/types.h> |
| 27 | 27 | #include <linux/mtd/mtd.h> |
| 28 | +#include <linux/mtd/nand-ecc-sw-hamming.h> | |
| 28 | 29 | #include <linux/mtd/rawnand.h> |
| 29 | 30 | #include <linux/platform_device.h> |
| 30 | 31 | #include <linux/of.h> |
| @@ -432,6 +433,15 @@ static int fsmc_read_hwecc_ecc1(struct nand_chip *chip, const u8 *data, · 401 unmodified lines | ||
| 432 | 433 | return 0; |
| 433 | 434 | } |
| 434 | 435 | |
| 436 | +static int fsmc_correct_ecc1(struct nand_chip *chip, | |
| 437 | + unsigned char *buf, | |
| 438 | + unsigned char *read_ecc, | |
| 439 | + unsigned char *calc_ecc) | |
| 440 | +{ | |
| 441 | + return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, | |
| 442 | + chip->ecc.size, false); | |
| 443 | +} | |
| 444 | + | |
| 435 | 445 | /* Count the number of 0's in buff upto a max of max_bits */ |
| 436 | 446 | static int count_written_bits(u8 *buff, int size, int max_bits) |
| 437 | 447 | { |
| @@ -917,7 +927,7 @@ static int fsmc_nand_attach_chip(struct nand_chip *nand) · 479 unmodified lines | ||
| 917 | 927 | case NAND_ECC_ENGINE_TYPE_ON_HOST: |
| 918 | 928 | dev_info(host->dev, "Using 1-bit HW ECC scheme\n"); |
| 919 | 929 | nand->ecc.calculate = fsmc_read_hwecc_ecc1; |
| 920 | − nand->ecc.correct = rawnand_sw_hamming_correct; | |
| 930 | + nand->ecc.correct = fsmc_correct_ecc1; | |
| 921 | 931 | nand->ecc.hwctl = fsmc_enable_hwecc; |
| 922 | 932 | nand->ecc.bytes = 3; |
| 923 | 933 | nand->ecc.strength = 1; |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/of.h> |
| 28 | 28 | #include <linux/of_gpio.h> |
| 29 | 29 | #include <linux/mtd/lpc32xx_slc.h> |
| 30 | +#include <linux/mtd/nand-ecc-sw-hamming.h> | |
| 30 | 31 | |
| 31 | 32 | #define LPC32XX_MODNAME "lpc32xx-nand" |
| 32 | 33 | |
| @@ -344,6 +345,18 @@ static int lpc32xx_nand_ecc_calculate(struct nand_chip *chip, · 311 unmodified lines | ||
| 344 | 345 | return 0; |
| 345 | 346 | } |
| 346 | 347 | |
| 348 | +/* | |
| 349 | + * Corrects the data | |
| 350 | + */ | |
| 351 | +static int lpc32xx_nand_ecc_correct(struct nand_chip *chip, | |
| 352 | + unsigned char *buf, | |
| 353 | + unsigned char *read_ecc, | |
| 354 | + unsigned char *calc_ecc) | |
| 355 | +{ | |
| 356 | + return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, | |
| 357 | + chip->ecc.size, false); | |
| 358 | +} | |
| 359 | + | |
| 347 | 360 | /* |
| 348 | 361 | * Read a single byte from NAND device |
| 349 | 362 | */ |
| @@ -802,7 +815,7 @@ static int lpc32xx_nand_attach_chip(struct nand_chip *chip) · 452 unmodified lines | ||
| 802 | 815 | chip->ecc.write_oob = lpc32xx_nand_write_oob_syndrome; |
| 803 | 816 | chip->ecc.read_oob = lpc32xx_nand_read_oob_syndrome; |
| 804 | 817 | chip->ecc.calculate = lpc32xx_nand_ecc_calculate; |
| 805 | − chip->ecc.correct = rawnand_sw_hamming_correct; | |
| 818 | + chip->ecc.correct = lpc32xx_nand_ecc_correct; | |
| 806 | 819 | chip->ecc.hwctl = lpc32xx_nand_ecc_enable; |
| 807 | 820 | |
| 808 | 821 | /* |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/mtd/ndfc.h> |
| 23 | 23 | #include <linux/slab.h> |
| 24 | 24 | #include <linux/mtd/mtd.h> |
| 25 | +#include <linux/mtd/nand-ecc-sw-hamming.h> | |
| 25 | 26 | #include <linux/of_address.h> |
| 26 | 27 | #include <linux/of_platform.h> |
| 27 | 28 | #include <asm/io.h> |
| @@ -100,6 +101,15 @@ static int ndfc_calculate_ecc(struct nand_chip *chip, · 72 unmodified lines | ||
| 100 | 101 | return 0; |
| 101 | 102 | } |
| 102 | 103 | |
| 104 | +static int ndfc_correct_ecc(struct nand_chip *chip, | |
| 105 | + unsigned char *buf, | |
| 106 | + unsigned char *read_ecc, | |
| 107 | + unsigned char *calc_ecc) | |
| 108 | +{ | |
| 109 | + return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, | |
| 110 | + chip->ecc.size, false); | |
| 111 | +} | |
| 112 | + | |
| 103 | 113 | /* |
| 104 | 114 | * Speedups for buffer read/write/verify |
| 105 | 115 | * |
| @@ -145,7 +155,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, · 39 unmodified lines | ||
| 145 | 155 | chip->controller = &ndfc->ndfc_control; |
| 146 | 156 | chip->legacy.read_buf = ndfc_read_buf; |
| 147 | 157 | chip->legacy.write_buf = ndfc_write_buf; |
| 148 | − chip->ecc.correct = rawnand_sw_hamming_correct; | |
| 158 | + chip->ecc.correct = ndfc_correct_ecc; | |
| 149 | 159 | chip->ecc.hwctl = ndfc_enable_hwecc; |
| 150 | 160 | chip->ecc.calculate = ndfc_calculate_ecc; |
| 151 | 161 | chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/module.h> |
| 12 | 12 | #include <linux/delay.h> |
| 13 | 13 | #include <linux/mtd/mtd.h> |
| 14 | +#include <linux/mtd/nand-ecc-sw-hamming.h> | |
| 14 | 15 | #include <linux/mtd/rawnand.h> |
| 15 | 16 | #include <linux/mtd/partitions.h> |
| 16 | 17 | #include <linux/mtd/sharpsl.h> |
| @@ -96,6 +97,15 @@ static int sharpsl_nand_calculate_ecc(struct nand_chip *chip, · 79 unmodified lines | ||
| 96 | 97 | return readb(sharpsl->io + ECCCNTR) != 0; |
| 97 | 98 | } |
| 98 | 99 | |
| 100 | +static int sharpsl_nand_correct_ecc(struct nand_chip *chip, | |
| 101 | + unsigned char *buf, | |
| 102 | + unsigned char *read_ecc, | |
| 103 | + unsigned char *calc_ecc) | |
| 104 | +{ | |
| 105 | + return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, | |
| 106 | + chip->ecc.size, false); | |
| 107 | +} | |
| 108 | + | |
| 99 | 109 | static int sharpsl_attach_chip(struct nand_chip *chip) |
| 100 | 110 | { |
| 101 | 111 | if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) |
| @@ -106,7 +116,7 @@ static int sharpsl_attach_chip(struct nand_chip *chip) · 4 unmodified lines | ||
| 106 | 116 | chip->ecc.strength = 1; |
| 107 | 117 | chip->ecc.hwctl = sharpsl_nand_enable_hwecc; |
| 108 | 118 | chip->ecc.calculate = sharpsl_nand_calculate_ecc; |
| 109 | − chip->ecc.correct = rawnand_sw_hamming_correct; | |
| 119 | + chip->ecc.correct = sharpsl_nand_correct_ecc; | |
| 110 | 120 | |
| 111 | 121 | return 0; |
| 112 | 122 | } |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include <linux/interrupt.h> |
| 35 | 35 | #include <linux/ioport.h> |
| 36 | 36 | #include <linux/mtd/mtd.h> |
| 37 | +#include <linux/mtd/nand-ecc-sw-hamming.h> | |
| 37 | 38 | #include <linux/mtd/rawnand.h> |
| 38 | 39 | #include <linux/mtd/partitions.h> |
| 39 | 40 | #include <linux/slab.h> |
| @@ -292,11 +293,12 @@ static int tmio_nand_correct_data(struct nand_chip *chip, unsigned char *buf, · 252 unmodified lines | ||
| 292 | 293 | int r0, r1; |
| 293 | 294 | |
| 294 | 295 | /* assume ecc.size = 512 and ecc.bytes = 6 */ |
| 295 | − r0 = rawnand_sw_hamming_correct(chip, buf, read_ecc, calc_ecc); | |
| 296 | + r0 = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, | |
| 297 | + chip->ecc.size, false); | |
| 296 | 298 | if (r0 < 0) |
| 297 | 299 | return r0; |
| 298 | − r1 = rawnand_sw_hamming_correct(chip, buf + 256, read_ecc + 3, | |
| 299 | − calc_ecc + 3); | |
| 300 | + r1 = ecc_sw_hamming_correct(buf + 256, read_ecc + 3, calc_ecc + 3, | |
| 301 | + chip->ecc.size, false); | |
| 300 | 302 | if (r1 < 0) |
| 301 | 303 | return r1; |
| 302 | 304 | return r0 + r1; |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/platform_device.h> |
| 14 | 14 | #include <linux/delay.h> |
| 15 | 15 | #include <linux/mtd/mtd.h> |
| 16 | +#include <linux/mtd/nand-ecc-sw-hamming.h> | |
| 16 | 17 | #include <linux/mtd/rawnand.h> |
| 17 | 18 | #include <linux/mtd/partitions.h> |
| 18 | 19 | #include <linux/io.h> |
| @@ -193,8 +194,8 @@ static int txx9ndfmc_correct_data(struct nand_chip *chip, unsigned char *buf, · 174 unmodified lines | ||
| 193 | 194 | int stat; |
| 194 | 195 | |
| 195 | 196 | for (eccsize = chip->ecc.size; eccsize > 0; eccsize -= 256) { |
| 196 | − stat = rawnand_sw_hamming_correct(chip, buf, read_ecc, | |
| 197 | − calc_ecc); | |
| 197 | + stat = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, | |
| 198 | + chip->ecc.size, false); | |
| 198 | 199 | if (stat < 0) |
| 199 | 200 | return stat; |
| 200 | 201 | corrected += stat; |
| @@ -57,20 +57,22 @@ static int parse_fixed_partitions(struct mtd_info *master, · 56 unmodified lines | ||
| 57 | 57 | if (!mtd_node) |
| 58 | 58 | return 0; |
| 59 | 59 | |
| 60 | − ofpart_node = of_get_child_by_name(mtd_node, "partitions"); | |
| 61 | − if (!ofpart_node && !master->parent) { | |
| 62 | − /* | |
| 63 | − * We might get here even when ofpart isn't used at all (e.g., | |
| 64 | − * when using another parser), so don't be louder than | |
| 65 | − * KERN_DEBUG | |
| 66 | − */ | |
| 67 | − pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n", | |
| 68 | − master->name, mtd_node); | |
| 60 | + if (!master->parent) { /* Master */ | |
| 61 | + ofpart_node = of_get_child_by_name(mtd_node, "partitions"); | |
| 62 | + if (!ofpart_node) { | |
| 63 | + /* | |
| 64 | + * We might get here even when ofpart isn't used at all (e.g., | |
| 65 | + * when using another parser), so don't be louder than | |
| 66 | + * KERN_DEBUG | |
| 67 | + */ | |
| 68 | + pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n", | |
| 69 | + master->name, mtd_node); | |
| 70 | + ofpart_node = mtd_node; | |
| 71 | + dedicated = false; | |
| 72 | + } | |
| 73 | + } else { /* Partition */ | |
| 69 | 74 | ofpart_node = mtd_node; |
| 70 | − dedicated = false; | |
| 71 | 75 | } |
| 72 | − if (!ofpart_node) | |
| 73 | − return 0; | |
| 74 | 76 | |
| 75 | 77 | of_id = of_match_node(parse_ofpart_match_table, ofpart_node); |
| 76 | 78 | if (dedicated && !of_id) { |
| @@ -327,6 +327,8 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) · 326 unmodified lines | ||
| 327 | 327 | break; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | + dev->base_addr = ioaddr; | |
| 331 | + | |
| 330 | 332 | /* Reserve any actual interrupt. */ |
| 331 | 333 | if (dev->irq) { |
| 332 | 334 | retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev); |
| @@ -334,8 +336,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) · 1 unmodified line | ||
| 334 | 336 | goto err_out; |
| 335 | 337 | } |
| 336 | 338 | |
| 337 | − dev->base_addr = ioaddr; | |
| 338 | − | |
| 339 | 339 | lp = netdev_priv(dev); |
| 340 | 340 | spin_lock_init(&lp->lock); |
| 341 | 341 | |
| @@ -1526,6 +1526,7 @@ static struct slave *bond_alloc_slave(struct bonding *bond, · 1525 unmodified lines | ||
| 1526 | 1526 | |
| 1527 | 1527 | slave->bond = bond; |
| 1528 | 1528 | slave->dev = slave_dev; |
| 1529 | + INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); | |
| 1529 | 1530 | |
| 1530 | 1531 | if (bond_kobj_init(slave)) |
| 1531 | 1532 | return NULL; |
| @@ -1538,7 +1539,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond, · 6 unmodified lines | ||
| 1538 | 1539 | return NULL; |
| 1539 | 1540 | } |
| 1540 | 1541 | } |
| 1541 | − INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); | |
| 1542 | 1542 | |
| 1543 | 1543 | return slave; |
| 1544 | 1544 | } |
| @@ -350,6 +350,7 @@ static int ldisc_open(struct tty_struct *tty) · 349 unmodified lines | ||
| 350 | 350 | rtnl_lock(); |
| 351 | 351 | result = register_netdevice(dev); |
| 352 | 352 | if (result) { |
| 353 | + tty_kref_put(tty); | |
| 353 | 354 | rtnl_unlock(); |
| 354 | 355 | free_netdev(dev); |
| 355 | 356 | return -ENODEV; |
| @@ -82,6 +82,8 @@ struct mcba_priv { · 81 unmodified lines | ||
| 82 | 82 | bool can_ka_first_pass; |
| 83 | 83 | bool can_speed_check; |
| 84 | 84 | atomic_t free_ctx_cnt; |
| 85 | + void *rxbuf[MCBA_MAX_RX_URBS]; | |
| 86 | + dma_addr_t rxbuf_dma[MCBA_MAX_RX_URBS]; | |
| 85 | 87 | }; |
| 86 | 88 | |
| 87 | 89 | /* CAN frame */ |
| @@ -633,6 +635,7 @@ static int mcba_usb_start(struct mcba_priv *priv) · 545 unmodified lines | ||
| 633 | 635 | for (i = 0; i < MCBA_MAX_RX_URBS; i++) { |
| 634 | 636 | struct urb *urb = NULL; |
| 635 | 637 | u8 *buf; |
| 638 | + dma_addr_t buf_dma; | |
| 636 | 639 | |
| 637 | 640 | /* create a URB, and a buffer for it */ |
| 638 | 641 | urb = usb_alloc_urb(0, GFP_KERNEL); |
| @@ -642,7 +645,7 @@ static int mcba_usb_start(struct mcba_priv *priv) · 3 unmodified lines | ||
| 642 | 645 | } |
| 643 | 646 | |
| 644 | 647 | buf = usb_alloc_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, |
| 645 | − GFP_KERNEL, &urb->transfer_dma); | |
| 648 | + GFP_KERNEL, &buf_dma); | |
| 646 | 649 | if (!buf) { |
| 647 | 650 | netdev_err(netdev, "No memory left for USB buffer\n"); |
| 648 | 651 | usb_free_urb(urb); |
| @@ -661,11 +664,14 @@ static int mcba_usb_start(struct mcba_priv *priv) · 12 unmodified lines | ||
| 661 | 664 | if (err) { |
| 662 | 665 | usb_unanchor_urb(urb); |
| 663 | 666 | usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, |
| 664 | − buf, urb->transfer_dma); | |
| 667 | + buf, buf_dma); | |
| 665 | 668 | usb_free_urb(urb); |
| 666 | 669 | break; |
| 667 | 670 | } |
| 668 | 671 | |
| 672 | + priv->rxbuf[i] = buf; | |
| 673 | + priv->rxbuf_dma[i] = buf_dma; | |
| 674 | + | |
| 669 | 675 | /* Drop reference, USB core will take care of freeing it */ |
| 670 | 676 | usb_free_urb(urb); |
| 671 | 677 | } |
| @@ -708,7 +714,14 @@ static int mcba_usb_open(struct net_device *netdev) · 36 unmodified lines | ||
| 708 | 714 | |
| 709 | 715 | static void mcba_urb_unlink(struct mcba_priv *priv) |
| 710 | 716 | { |
| 717 | + int i; | |
| 718 | + | |
| 711 | 719 | usb_kill_anchored_urbs(&priv->rx_submitted); |
| 720 | + | |
| 721 | + for (i = 0; i < MCBA_MAX_RX_URBS; ++i) | |
| 722 | + usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, | |
| 723 | + priv->rxbuf[i], priv->rxbuf_dma[i]); | |
| 724 | + | |
| 712 | 725 | usb_kill_anchored_urbs(&priv->tx_submitted); |
| 713 | 726 | } |
| 714 | 727 | |
| @@ -821,11 +821,9 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, · 820 unmodified lines | ||
| 821 | 821 | bcm_sf2_sw_mac_link_set(ds, port, interface, true); |
| 822 | 822 | |
| 823 | 823 | if (port != core_readl(priv, CORE_IMP0_PRT_ID)) { |
| 824 | − u32 reg_rgmii_ctrl; | |
| 824 | + u32 reg_rgmii_ctrl = 0; | |
| 825 | 825 | u32 reg, offset; |
| 826 | 826 | |
| 827 | − reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port); | |
| 828 | − | |
| 829 | 827 | if (priv->type == BCM4908_DEVICE_ID || |
| 830 | 828 | priv->type == BCM7445_DEVICE_ID) |
| 831 | 829 | offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); |
| @@ -836,6 +834,7 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, · 4 unmodified lines | ||
| 836 | 834 | interface == PHY_INTERFACE_MODE_RGMII_TXID || |
| 837 | 835 | interface == PHY_INTERFACE_MODE_MII || |
| 838 | 836 | interface == PHY_INTERFACE_MODE_REVMII) { |
| 837 | + reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port); | |
| 839 | 838 | reg = reg_readl(priv, reg_rgmii_ctrl); |
| 840 | 839 | reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); |
| 841 | 840 | |
| @@ -1530,6 +1530,7 @@ static const struct ksz_chip_data ksz9477_switch_chips[] = { · 1529 unmodified lines | ||
| 1530 | 1530 | .num_statics = 16, |
| 1531 | 1531 | .cpu_ports = 0x7F, /* can be configured as cpu port */ |
| 1532 | 1532 | .port_cnt = 7, /* total physical port count */ |
| 1533 | + .phy_errata_9477 = true, | |
| 1533 | 1534 | }, |
| 1534 | 1535 | }; |
| 1535 | 1536 | |
| @@ -1262,14 +1262,6 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) · 1261 unmodified lines | ||
| 1262 | 1262 | { |
| 1263 | 1263 | struct mt7530_priv *priv = ds->priv; |
| 1264 | 1264 | |
| 1265 | − /* The real fabric path would be decided on the membership in the | |
| 1266 | − * entry of VLAN table. PCR_MATRIX set up here with ALL_MEMBERS | |
| 1267 | − * means potential VLAN can be consisting of certain subset of all | |
| 1268 | − * ports. | |
| 1269 | − */ | |
| 1270 | − mt7530_rmw(priv, MT7530_PCR_P(port), | |
| 1271 | − PCR_MATRIX_MASK, PCR_MATRIX(MT7530_ALL_MEMBERS)); | |
| 1272 | − | |
| 1273 | 1265 | /* Trapped into security mode allows packet forwarding through VLAN |
| 1274 | 1266 | * table lookup. CPU port is set to fallback mode to let untagged |
| 1275 | 1267 | * frames pass through. |
| @@ -1227,12 +1227,17 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, · 1226 unmodified lines | ||
| 1227 | 1227 | if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX) |
| 1228 | 1228 | return -ERANGE; |
| 1229 | 1229 | |
| 1230 | − /* Set port num and disable ALWAYS_GUARD_BAND_SCH_Q, which means set | |
| 1231 | − * guard band to be implemented for nonschedule queues to schedule | |
| 1232 | − * queues transition. | |
| 1230 | + /* Enable guard band. The switch will schedule frames without taking | |
| 1231 | + * their length into account. Thus we'll always need to enable the | |
| 1232 | + * guard band which reserves the time of a maximum sized frame at the | |
| 1233 | + * end of the time window. | |
| 1234 | + * | |
| 1235 | + * Although the ALWAYS_GUARD_BAND_SCH_Q bit is global for all ports, we | |
| 1236 | + * need to set PORT_NUM, because subsequent writes to PARAM_CFG_REG_n | |
| 1237 | + * operate on the port number. | |
| 1233 | 1238 | */ |
| 1234 | − ocelot_rmw(ocelot, | |
| 1235 | − QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port), | |
| 1239 | + ocelot_rmw(ocelot, QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port) | | |
| 1240 | + QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q, | |
| 1236 | 1241 | QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM_M | |
| 1237 | 1242 | QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q, |
| 1238 | 1243 | QSYS_TAS_PARAM_CFG_CTRL); |
| @@ -167,9 +167,10 @@ enum sja1105_hostcmd { · 166 unmodified lines | ||
| 167 | 167 | SJA1105_HOSTCMD_INVALIDATE = 4, |
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | +/* Command and entry overlap */ | |
| 170 | 171 | static void |
| 171 | −sja1105_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, | |
| 172 | − enum packing_op op) | |
| 172 | +sja1105et_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, | |
| 173 | + enum packing_op op) | |
| 173 | 174 | { |
| 174 | 175 | const int size = SJA1105_SIZE_DYN_CMD; |
| 175 | 176 | |
| @@ -179,6 +180,20 @@ sja1105_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, · 3 unmodified lines | ||
| 179 | 180 | sja1105_packing(buf, &cmd->index, 9, 0, size, op); |
| 180 | 181 | } |
| 181 | 182 | |
| 183 | +/* Command and entry are separate */ | |
| 184 | +static void | |
| 185 | +sja1105pqrs_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, | |
| 186 | + enum packing_op op) | |
| 187 | +{ | |
| 188 | + u8 *p = buf + SJA1105_SIZE_VL_LOOKUP_ENTRY; | |
| 189 | + const int size = SJA1105_SIZE_DYN_CMD; | |
| 190 | + | |
| 191 | + sja1105_packing(p, &cmd->valid, 31, 31, size, op); | |
| 192 | + sja1105_packing(p, &cmd->errors, 30, 30, size, op); | |
| 193 | + sja1105_packing(p, &cmd->rdwrset, 29, 29, size, op); | |
| 194 | + sja1105_packing(p, &cmd->index, 9, 0, size, op); | |
| 195 | +} | |
| 196 | + | |
| 182 | 197 | static size_t sja1105et_vl_lookup_entry_packing(void *buf, void *entry_ptr, |
| 183 | 198 | enum packing_op op) |
| 184 | 199 | { |
| @@ -641,7 +656,7 @@ static size_t sja1105pqrs_cbs_entry_packing(void *buf, void *entry_ptr, · 456 unmodified lines | ||
| 641 | 656 | const struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN] = { |
| 642 | 657 | [BLK_IDX_VL_LOOKUP] = { |
| 643 | 658 | .entry_packing = sja1105et_vl_lookup_entry_packing, |
| 644 | − .cmd_packing = sja1105_vl_lookup_cmd_packing, | |
| 659 | + .cmd_packing = sja1105et_vl_lookup_cmd_packing, | |
| 645 | 660 | .access = OP_WRITE, |
| 646 | 661 | .max_entry_count = SJA1105_MAX_VL_LOOKUP_COUNT, |
| 647 | 662 | .packed_size = SJA1105ET_SIZE_VL_LOOKUP_DYN_CMD, |
| @@ -725,7 +740,7 @@ const struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN] = { · 77 unmodified lines | ||
| 725 | 740 | const struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN] = { |
| 726 | 741 | [BLK_IDX_VL_LOOKUP] = { |
| 727 | 742 | .entry_packing = sja1105_vl_lookup_entry_packing, |
| 728 | − .cmd_packing = sja1105_vl_lookup_cmd_packing, | |
| 743 | + .cmd_packing = sja1105pqrs_vl_lookup_cmd_packing, | |
| 729 | 744 | .access = (OP_READ | OP_WRITE), |
| 730 | 745 | .max_entry_count = SJA1105_MAX_VL_LOOKUP_COUNT, |
| 731 | 746 | .packed_size = SJA1105PQRS_SIZE_VL_LOOKUP_DYN_CMD, |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "sja1105_tas.h" |
| 27 | 27 | |
| 28 | 28 | #define SJA1105_UNKNOWN_MULTICAST 0x010000000000ull |
| 29 | +#define SJA1105_DEFAULT_VLAN (VLAN_N_VID - 1) | |
| 29 | 30 | |
| 30 | 31 | static const struct dsa_switch_ops sja1105_switch_ops; |
| 31 | 32 | |
| @@ -207,6 +208,7 @@ static int sja1105_init_mii_settings(struct sja1105_private *priv, · 175 unmodified lines | ||
| 207 | 208 | default: |
| 208 | 209 | dev_err(dev, "Unsupported PHY mode %s!\n", |
| 209 | 210 | phy_modes(ports[i].phy_mode)); |
| 211 | + return -EINVAL; | |
| 210 | 212 | } |
| 211 | 213 | |
| 212 | 214 | /* Even though the SerDes port is able to drive SGMII autoneg |
| @@ -321,6 +323,13 @@ static int sja1105_init_l2_lookup_params(struct sja1105_private *priv) · 108 unmodified lines | ||
| 321 | 323 | return 0; |
| 322 | 324 | } |
| 323 | 325 | |
| 326 | +/* Set up a default VLAN for untagged traffic injected from the CPU | |
| 327 | + * using management routes (e.g. STP, PTP) as opposed to tag_8021q. | |
| 328 | + * All DT-defined ports are members of this VLAN, and there are no | |
| 329 | + * restrictions on forwarding (since the CPU selects the destination). | |
| 330 | + * Frames from this VLAN will always be transmitted as untagged, and | |
| 331 | + * neither the bridge nor the 8021q module cannot create this VLAN ID. | |
| 332 | + */ | |
| 324 | 333 | static int sja1105_init_static_vlan(struct sja1105_private *priv) |
| 325 | 334 | { |
| 326 | 335 | struct sja1105_table *table; |
| @@ -330,17 +339,13 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv) · 3 unmodified lines | ||
| 330 | 339 | .vmemb_port = 0, |
| 331 | 340 | .vlan_bc = 0, |
| 332 | 341 | .tag_port = 0, |
| 333 | − .vlanid = 1, | |
| 342 | + .vlanid = SJA1105_DEFAULT_VLAN, | |
| 334 | 343 | }; |
| 335 | 344 | struct dsa_switch *ds = priv->ds; |
| 336 | 345 | int port; |
| 337 | 346 | |
| 338 | 347 | table = &priv->static_config.tables[BLK_IDX_VLAN_LOOKUP]; |
| 339 | 348 | |
| 340 | − /* The static VLAN table will only contain the initial pvid of 1. | |
| 341 | − * All other VLANs are to be configured through dynamic entries, | |
| 342 | − * and kept in the static configuration table as backing memory. | |
| 343 | − */ | |
| 344 | 349 | if (table->entry_count) { |
| 345 | 350 | kfree(table->entries); |
| 346 | 351 | table->entry_count = 0; |
| @@ -353,9 +358,6 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv) · 6 unmodified lines | ||
| 353 | 358 | |
| 354 | 359 | table->entry_count = 1; |
| 355 | 360 | |
| 356 | − /* VLAN 1: all DT-defined ports are members; no restrictions on | |
| 357 | − * forwarding; always transmit as untagged. | |
| 358 | − */ | |
| 359 | 361 | for (port = 0; port < ds->num_ports; port++) { |
| 360 | 362 | struct sja1105_bridge_vlan *v; |
| 361 | 363 | |
| @@ -366,15 +368,12 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv) · 4 unmodified lines | ||
| 366 | 368 | pvid.vlan_bc |= BIT(port); |
| 367 | 369 | pvid.tag_port &= ~BIT(port); |
| 368 | 370 | |
| 369 | − /* Let traffic that don't need dsa_8021q (e.g. STP, PTP) be | |
| 370 | − * transmitted as untagged. | |
| 371 | − */ | |
| 372 | 371 | v = kzalloc(sizeof(*v), GFP_KERNEL); |
| 373 | 372 | if (!v) |
| 374 | 373 | return -ENOMEM; |
| 375 | 374 | |
| 376 | 375 | v->port = port; |
| 377 | − v->vid = 1; | |
| 376 | + v->vid = SJA1105_DEFAULT_VLAN; | |
| 378 | 377 | v->untagged = true; |
| 379 | 378 | if (dsa_is_cpu_port(ds, port)) |
| 380 | 379 | v->pvid = true; |
| @@ -2817,11 +2816,22 @@ static int sja1105_vlan_add_one(struct dsa_switch *ds, int port, u16 vid, · 2436 unmodified lines | ||
| 2817 | 2816 | bool pvid = flags & BRIDGE_VLAN_INFO_PVID; |
| 2818 | 2817 | struct sja1105_bridge_vlan *v; |
| 2819 | 2818 | |
| 2820 | − list_for_each_entry(v, vlan_list, list) | |
| 2821 | − if (v->port == port && v->vid == vid && | |
| 2822 | − v->untagged == untagged && v->pvid == pvid) | |
| 2819 | + list_for_each_entry(v, vlan_list, list) { | |
| 2820 | + if (v->port == port && v->vid == vid) { | |
| 2823 | 2821 | /* Already added */ |
| 2824 | − return 0; | |
| 2822 | + if (v->untagged == untagged && v->pvid == pvid) | |
| 2823 | + /* Nothing changed */ | |
| 2824 | + return 0; | |
| 2825 | + | |
| 2826 | + /* It's the same VLAN, but some of the flags changed | |
| 2827 | + * and the user did not bother to delete it first. | |
| 2828 | + * Update it and trigger sja1105_build_vlan_table. | |
| 2829 | + */ | |
| 2830 | + v->untagged = untagged; | |
| 2831 | + v->pvid = pvid; | |
| 2832 | + return 1; | |
| 2833 | + } | |
| 2834 | + } | |
| 2825 | 2835 | |
| 2826 | 2836 | v = kzalloc(sizeof(*v), GFP_KERNEL); |
| 2827 | 2837 | if (!v) { |
| @@ -2976,13 +2986,13 @@ static int sja1105_setup(struct dsa_switch *ds) · 148 unmodified lines | ||
| 2976 | 2986 | rc = sja1105_static_config_load(priv, ports); |
| 2977 | 2987 | if (rc < 0) { |
| 2978 | 2988 | dev_err(ds->dev, "Failed to load static config: %d\n", rc); |
| 2979 | − return rc; | |
| 2989 | + goto out_ptp_clock_unregister; | |
| 2980 | 2990 | } |
| 2981 | 2991 | /* Configure the CGU (PHY link modes and speeds) */ |
| 2982 | 2992 | rc = sja1105_clocking_setup(priv); |
| 2983 | 2993 | if (rc < 0) { |
| 2984 | 2994 | dev_err(ds->dev, "Failed to configure MII clocking: %d\n", rc); |
| 2985 | − return rc; | |
| 2995 | + goto out_static_config_free; | |
| 2986 | 2996 | } |
| 2987 | 2997 | /* On SJA1105, VLAN filtering per se is always enabled in hardware. |
| 2988 | 2998 | * The only thing we can do to disable it is lie about what the 802.1Q |
| @@ -3003,7 +3013,7 @@ static int sja1105_setup(struct dsa_switch *ds) · 14 unmodified lines | ||
| 3003 | 3013 | |
| 3004 | 3014 | rc = sja1105_devlink_setup(ds); |
| 3005 | 3015 | if (rc < 0) |
| 3006 | − return rc; | |
| 3016 | + goto out_static_config_free; | |
| 3007 | 3017 | |
| 3008 | 3018 | /* The DSA/switchdev model brings up switch ports in standalone mode by |
| 3009 | 3019 | * default, and that means vlan_filtering is 0 since they're not under |
| @@ -3012,6 +3022,17 @@ static int sja1105_setup(struct dsa_switch *ds) · 2 unmodified lines | ||
| 3012 | 3022 | rtnl_lock(); |
| 3013 | 3023 | rc = sja1105_setup_8021q_tagging(ds, true); |
| 3014 | 3024 | rtnl_unlock(); |
| 3025 | + if (rc) | |
| 3026 | + goto out_devlink_teardown; | |
| 3027 | + | |
| 3028 | + return 0; | |
| 3029 | + | |
| 3030 | +out_devlink_teardown: | |
| 3031 | + sja1105_devlink_teardown(ds); | |
| 3032 | +out_ptp_clock_unregister: | |
| 3033 | + sja1105_ptp_clock_unregister(ds); | |
| 3034 | +out_static_config_free: | |
| 3035 | + sja1105_static_config_free(&priv->static_config); | |
| 3015 | 3036 | |
| 3016 | 3037 | return rc; |
| 3017 | 3038 | } |
| @@ -3646,8 +3667,10 @@ static int sja1105_probe(struct spi_device *spi) · 628 unmodified lines | ||
| 3646 | 3667 | priv->cbs = devm_kcalloc(dev, priv->info->num_cbs_shapers, |
| 3647 | 3668 | sizeof(struct sja1105_cbs_entry), |
| 3648 | 3669 | GFP_KERNEL); |
| 3649 | − if (!priv->cbs) | |
| 3650 | − return -ENOMEM; | |
| 3670 | + if (!priv->cbs) { | |
| 3671 | + rc = -ENOMEM; | |
| 3672 | + goto out_unregister_switch; | |
| 3673 | + } | |
| 3651 | 3674 | } |
| 3652 | 3675 | |
| 3653 | 3676 | /* Connections between dsa_port and sja1105_port */ |
| @@ -3672,7 +3695,7 @@ static int sja1105_probe(struct spi_device *spi) · 18 unmodified lines | ||
| 3672 | 3695 | dev_err(ds->dev, |
| 3673 | 3696 | "failed to create deferred xmit thread: %d\n", |
| 3674 | 3697 | rc); |
| 3675 | − goto out; | |
| 3698 | + goto out_destroy_workers; | |
| 3676 | 3699 | } |
| 3677 | 3700 | skb_queue_head_init(&sp->xmit_queue); |
| 3678 | 3701 | sp->xmit_tpid = ETH_P_SJA1105; |
| @@ -3682,7 +3705,8 @@ static int sja1105_probe(struct spi_device *spi) · 3 unmodified lines | ||
| 3682 | 3705 | } |
| 3683 | 3706 | |
| 3684 | 3707 | return 0; |
| 3685 | −out: | |
| 3708 | + | |
| 3709 | +out_destroy_workers: | |
| 3686 | 3710 | while (port-- > 0) { |
| 3687 | 3711 | struct sja1105_port *sp = &priv->ports[port]; |
| 3688 | 3712 | |
| @@ -3691,6 +3715,10 @@ out: · 2 unmodified lines | ||
| 3691 | 3715 | |
| 3692 | 3716 | kthread_destroy_worker(sp->xmit_worker); |
| 3693 | 3717 | } |
| 3718 | + | |
| 3719 | +out_unregister_switch: | |
| 3720 | + dsa_unregister_switch(ds); | |
| 3721 | + | |
| 3694 | 3722 | return rc; |
| 3695 | 3723 | } |
| 3696 | 3724 | |
| @@ -236,36 +236,48 @@ static int ena_xdp_io_poll(struct napi_struct *napi, int budget) · 235 unmodified lines | ||
| 236 | 236 | static int ena_xdp_tx_map_frame(struct ena_ring *xdp_ring, |
| 237 | 237 | struct ena_tx_buffer *tx_info, |
| 238 | 238 | struct xdp_frame *xdpf, |
| 239 | − void **push_hdr, | |
| 240 | − u32 *push_len) | |
| 239 | + struct ena_com_tx_ctx *ena_tx_ctx) | |
| 241 | 240 | { |
| 242 | 241 | struct ena_adapter *adapter = xdp_ring->adapter; |
| 243 | 242 | struct ena_com_buf *ena_buf; |
| 244 | − dma_addr_t dma = 0; | |
| 243 | + int push_len = 0; | |
| 244 | + dma_addr_t dma; | |
| 245 | + void *data; | |
| 245 | 246 | u32 size; |
| 246 | 247 | |
| 247 | 248 | tx_info->xdpf = xdpf; |
| 249 | + data = tx_info->xdpf->data; | |
| 248 | 250 | size = tx_info->xdpf->len; |
| 249 | − ena_buf = tx_info->bufs; | |
| 250 | 251 | |
| 251 | − /* llq push buffer */ | |
| 252 | − *push_len = min_t(u32, size, xdp_ring->tx_max_header_size); | |
| 253 | − *push_hdr = tx_info->xdpf->data; | |
| 252 | + if (xdp_ring->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) { | |
| 253 | + /* Designate part of the packet for LLQ */ | |
| 254 | + push_len = min_t(u32, size, xdp_ring->tx_max_header_size); | |
| 255 | + | |
| 256 | + ena_tx_ctx->push_header = data; | |
| 257 | + | |
| 258 | + size -= push_len; | |
| 259 | + data += push_len; | |
| 260 | + } | |
| 261 | + | |
| 262 | + ena_tx_ctx->header_len = push_len; | |
| 254 | 263 | |
| 255 | − if (size - *push_len > 0) { | |
| 264 | + if (size > 0) { | |
| 256 | 265 | dma = dma_map_single(xdp_ring->dev, |
| 257 | − *push_hdr + *push_len, | |
| 258 | − size - *push_len, | |
| 266 | + data, | |
| 267 | + size, | |
| 259 | 268 | DMA_TO_DEVICE); |
| 260 | 269 | if (unlikely(dma_mapping_error(xdp_ring->dev, dma))) |
| 261 | 270 | goto error_report_dma_error; |
| 262 | 271 | |
| 263 | − tx_info->map_linear_data = 1; | |
| 264 | − tx_info->num_of_bufs = 1; | |
| 265 | − } | |
| 272 | + tx_info->map_linear_data = 0; | |
| 266 | 273 | |
| 267 | − ena_buf->paddr = dma; | |
| 268 | − ena_buf->len = size; | |
| 274 | + ena_buf = tx_info->bufs; | |
| 275 | + ena_buf->paddr = dma; | |
| 276 | + ena_buf->len = size; | |
| 277 | + | |
| 278 | + ena_tx_ctx->ena_bufs = ena_buf; | |
| 279 | + ena_tx_ctx->num_bufs = tx_info->num_of_bufs = 1; | |
| 280 | + } | |
| 269 | 281 | |
| 270 | 282 | return 0; |
| 271 | 283 | |
| @@ -274,10 +286,6 @@ error_report_dma_error: · 2 unmodified lines | ||
| 274 | 286 | &xdp_ring->syncp); |
| 275 | 287 | netif_warn(adapter, tx_queued, adapter->netdev, "Failed to map xdp buff\n"); |
| 276 | 288 | |
| 277 | − xdp_return_frame_rx_napi(tx_info->xdpf); | |
| 278 | − tx_info->xdpf = NULL; | |
| 279 | − tx_info->num_of_bufs = 0; | |
| 280 | − | |
| 281 | 289 | return -EINVAL; |
| 282 | 290 | } |
| 283 | 291 | |
| @@ -289,8 +297,6 @@ static int ena_xdp_xmit_frame(struct ena_ring *xdp_ring, · 5 unmodified lines | ||
| 289 | 297 | struct ena_com_tx_ctx ena_tx_ctx = {}; |
| 290 | 298 | struct ena_tx_buffer *tx_info; |
| 291 | 299 | u16 next_to_use, req_id; |
| 292 | − void *push_hdr; | |
| 293 | − u32 push_len; | |
| 294 | 300 | int rc; |
| 295 | 301 | |
| 296 | 302 | next_to_use = xdp_ring->next_to_use; |
| @@ -298,15 +304,11 @@ static int ena_xdp_xmit_frame(struct ena_ring *xdp_ring, · 1 unmodified line | ||
| 298 | 304 | tx_info = &xdp_ring->tx_buffer_info[req_id]; |
| 299 | 305 | tx_info->num_of_bufs = 0; |
| 300 | 306 | |
| 301 | − rc = ena_xdp_tx_map_frame(xdp_ring, tx_info, xdpf, &push_hdr, &push_len); | |
| 307 | + rc = ena_xdp_tx_map_frame(xdp_ring, tx_info, xdpf, &ena_tx_ctx); | |
| 302 | 308 | if (unlikely(rc)) |
| 303 | 309 | return rc; |
| 304 | 310 | |
| 305 | − ena_tx_ctx.ena_bufs = tx_info->bufs; | |
| 306 | − ena_tx_ctx.push_header = push_hdr; | |
| 307 | − ena_tx_ctx.num_bufs = tx_info->num_of_bufs; | |
| 308 | 311 | ena_tx_ctx.req_id = req_id; |
| 309 | − ena_tx_ctx.header_len = push_len; | |
| 310 | 312 | |
| 311 | 313 | rc = ena_xmit_common(dev, |
| 312 | 314 | xdp_ring, |
| @@ -1849,6 +1849,7 @@ out_free_netdev: · 1848 unmodified lines | ||
| 1849 | 1849 | free_netdev(netdev); |
| 1850 | 1850 | out_pci_release: |
| 1851 | 1851 | pci_release_mem_regions(pdev); |
| 1852 | + pci_disable_pcie_error_reporting(pdev); | |
| 1852 | 1853 | out_pci_disable: |
| 1853 | 1854 | pci_disable_device(pdev); |
| 1854 | 1855 | return err; |
| @@ -8247,9 +8247,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 8246 unmodified lines | ||
| 8247 | 8247 | BNX2_WR(bp, PCI_COMMAND, reg); |
| 8248 | 8248 | } else if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) && |
| 8249 | 8249 | !(bp->flags & BNX2_FLAG_PCIX)) { |
| 8250 | − | |
| 8251 | 8250 | dev_err(&pdev->dev, |
| 8252 | 8251 | "5706 A1 can only be used in a PCIX bus, aborting\n"); |
| 8252 | + rc = -EPERM; | |
| 8253 | 8253 | goto err_out_unmap; |
| 8254 | 8254 | } |
| 8255 | 8255 | |
| @@ -1223,8 +1223,10 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, · 1222 unmodified lines | ||
| 1223 | 1223 | goto failed; |
| 1224 | 1224 | |
| 1225 | 1225 | /* SR-IOV capability was enabled but there are no VFs*/ |
| 1226 | − if (iov->total == 0) | |
| 1226 | + if (iov->total == 0) { | |
| 1227 | + err = -EINVAL; | |
| 1227 | 1228 | goto failed; |
| 1229 | + } | |
| 1228 | 1230 | |
| 1229 | 1231 | iov->nr_virtfn = min_t(u16, iov->total, num_vfs_param); |
| 1230 | 1232 | |
| @@ -282,7 +282,8 @@ static bool bnxt_vf_pciid(enum board_idx idx) · 281 unmodified lines | ||
| 282 | 282 | { |
| 283 | 283 | return (idx == NETXTREME_C_VF || idx == NETXTREME_E_VF || |
| 284 | 284 | idx == NETXTREME_S_VF || idx == NETXTREME_C_VF_HV || |
| 285 | − idx == NETXTREME_E_VF_HV || idx == NETXTREME_E_P5_VF); | |
| 285 | + idx == NETXTREME_E_VF_HV || idx == NETXTREME_E_P5_VF || | |
| 286 | + idx == NETXTREME_E_P5_VF_HV); | |
| 286 | 287 | } |
| 287 | 288 | |
| 288 | 289 | #define DB_CP_REARM_FLAGS (DB_KEY_CP | DB_IDX_VALID) |
| @@ -6932,17 +6933,10 @@ ctx_err: · 6643 unmodified lines | ||
| 6932 | 6933 | static void bnxt_hwrm_set_pg_attr(struct bnxt_ring_mem_info *rmem, u8 *pg_attr, |
| 6933 | 6934 | __le64 *pg_dir) |
| 6934 | 6935 | { |
| 6935 | − u8 pg_size = 0; | |
| 6936 | − | |
| 6937 | 6936 | if (!rmem->nr_pages) |
| 6938 | 6937 | return; |
| 6939 | 6938 | |
| 6940 | − if (BNXT_PAGE_SHIFT == 13) | |
| 6941 | − pg_size = 1 << 4; | |
| 6942 | − else if (BNXT_PAGE_SIZE == 16) | |
| 6943 | − pg_size = 2 << 4; | |
| 6944 | − | |
| 6945 | − *pg_attr = pg_size; | |
| 6939 | + BNXT_SET_CTX_PAGE_ATTR(*pg_attr); | |
| 6946 | 6940 | if (rmem->depth >= 1) { |
| 6947 | 6941 | if (rmem->depth == 2) |
| 6948 | 6942 | *pg_attr |= 2; |
| @@ -7314,7 +7308,7 @@ skip_rdma: · 365 unmodified lines | ||
| 7314 | 7308 | entries_sp = ctx->vnic_max_vnic_entries + ctx->qp_max_l2_entries + |
| 7315 | 7309 | 2 * (extra_qps + ctx->qp_min_qp1_entries) + min; |
| 7316 | 7310 | entries_sp = roundup(entries_sp, ctx->tqm_entries_multiple); |
| 7317 | − entries = ctx->qp_max_l2_entries + extra_qps + ctx->qp_min_qp1_entries; | |
| 7311 | + entries = ctx->qp_max_l2_entries + 2 * (extra_qps + ctx->qp_min_qp1_entries); | |
| 7318 | 7312 | entries = roundup(entries, ctx->tqm_entries_multiple); |
| 7319 | 7313 | entries = clamp_t(u32, entries, min, ctx->tqm_max_entries_per_ring); |
| 7320 | 7314 | for (i = 0; i < ctx->tqm_fp_rings_count + 1; i++) { |
| @@ -10785,37 +10779,125 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) · 3464 unmodified lines | ||
| 10785 | 10779 | return rc; |
| 10786 | 10780 | } |
| 10787 | 10781 | |
| 10782 | +static bool bnxt_exthdr_check(struct bnxt *bp, struct sk_buff *skb, int nw_off, | |
| 10783 | + u8 **nextp) | |
| 10784 | +{ | |
| 10785 | + struct ipv6hdr *ip6h = (struct ipv6hdr *)(skb->data + nw_off); | |
| 10786 | + int hdr_count = 0; | |
| 10787 | + u8 *nexthdr; | |
| 10788 | + int start; | |
| 10789 | + | |
| 10790 | + /* Check that there are at most 2 IPv6 extension headers, no | |
| 10791 | + * fragment header, and each is <= 64 bytes. | |
| 10792 | + */ | |
| 10793 | + start = nw_off + sizeof(*ip6h); | |
| 10794 | + nexthdr = &ip6h->nexthdr; | |
| 10795 | + while (ipv6_ext_hdr(*nexthdr)) { | |
| 10796 | + struct ipv6_opt_hdr *hp; | |
| 10797 | + int hdrlen; | |
| 10798 | + | |
| 10799 | + if (hdr_count >= 3 || *nexthdr == NEXTHDR_NONE || | |
| 10800 | + *nexthdr == NEXTHDR_FRAGMENT) | |
| 10801 | + return false; | |
| 10802 | + hp = __skb_header_pointer(NULL, start, sizeof(*hp), skb->data, | |
| 10803 | + skb_headlen(skb), NULL); | |
| 10804 | + if (!hp) | |
| 10805 | + return false; | |
| 10806 | + if (*nexthdr == NEXTHDR_AUTH) | |
| 10807 | + hdrlen = ipv6_authlen(hp); | |
| 10808 | + else | |
| 10809 | + hdrlen = ipv6_optlen(hp); | |
| 10810 | + | |
| 10811 | + if (hdrlen > 64) | |
| 10812 | + return false; | |
| 10813 | + nexthdr = &hp->nexthdr; | |
| 10814 | + start += hdrlen; | |
| 10815 | + hdr_count++; | |
| 10816 | + } | |
| 10817 | + if (nextp) { | |
| 10818 | + /* Caller will check inner protocol */ | |
| 10819 | + if (skb->encapsulation) { | |
| 10820 | + *nextp = nexthdr; | |
| 10821 | + return true; | |
| 10822 | + } | |
| 10823 | + *nextp = NULL; | |
| 10824 | + } | |
| 10825 | + /* Only support TCP/UDP for non-tunneled ipv6 and inner ipv6 */ | |
| 10826 | + return *nexthdr == IPPROTO_TCP || *nexthdr == IPPROTO_UDP; | |
| 10827 | +} | |
| 10828 | + | |
| 10829 | +/* For UDP, we can only handle 1 Vxlan port and 1 Geneve port. */ | |
| 10830 | +static bool bnxt_udp_tunl_check(struct bnxt *bp, struct sk_buff *skb) | |
| 10831 | +{ | |
| 10832 | + struct udphdr *uh = udp_hdr(skb); | |
| 10833 | + __be16 udp_port = uh->dest; | |
| 10834 | + | |
| 10835 | + if (udp_port != bp->vxlan_port && udp_port != bp->nge_port) | |
| 10836 | + return false; | |
| 10837 | + if (skb->inner_protocol_type == ENCAP_TYPE_ETHER) { | |
| 10838 | + struct ethhdr *eh = inner_eth_hdr(skb); | |
| 10839 | + | |
| 10840 | + switch (eh->h_proto) { | |
| 10841 | + case htons(ETH_P_IP): | |
| 10842 | + return true; | |
| 10843 | + case htons(ETH_P_IPV6): | |
| 10844 | + return bnxt_exthdr_check(bp, skb, | |
| 10845 | + skb_inner_network_offset(skb), | |
| 10846 | + NULL); | |
| 10847 | + } | |
| 10848 | + } | |
| 10849 | + return false; | |
| 10850 | +} | |
| 10851 | + | |
| 10852 | +static bool bnxt_tunl_check(struct bnxt *bp, struct sk_buff *skb, u8 l4_proto) | |
| 10853 | +{ | |
| 10854 | + switch (l4_proto) { | |
| 10855 | + case IPPROTO_UDP: | |
| 10856 | + return bnxt_udp_tunl_check(bp, skb); | |
| 10857 | + case IPPROTO_IPIP: | |
| 10858 | + return true; | |
| 10859 | + case IPPROTO_GRE: { | |
| 10860 | + switch (skb->inner_protocol) { | |
| 10861 | + default: | |
| 10862 | + return false; | |
| 10863 | + case htons(ETH_P_IP): | |
| 10864 | + return true; | |
| 10865 | + case htons(ETH_P_IPV6): | |
| 10866 | + fallthrough; | |
| 10867 | + } | |
| 10868 | + } | |
| 10869 | + case IPPROTO_IPV6: | |
| 10870 | + /* Check ext headers of inner ipv6 */ | |
| 10871 | + return bnxt_exthdr_check(bp, skb, skb_inner_network_offset(skb), | |
| 10872 | + NULL); | |
| 10873 | + } | |
| 10874 | + return false; | |
| 10875 | +} | |
| 10876 | + | |
| 10788 | 10877 | static netdev_features_t bnxt_features_check(struct sk_buff *skb, |
| 10789 | 10878 | struct net_device *dev, |
| 10790 | 10879 | netdev_features_t features) |
| 10791 | 10880 | { |
| 10792 | − struct bnxt *bp; | |
| 10793 | − __be16 udp_port; | |
| 10794 | − u8 l4_proto = 0; | |
| 10881 | + struct bnxt *bp = netdev_priv(dev); | |
| 10882 | + u8 *l4_proto; | |
| 10795 | 10883 | |
| 10796 | 10884 | features = vlan_features_check(skb, features); |
| 10797 | − if (!skb->encapsulation) | |
| 10798 | − return features; | |
| 10799 | − | |
| 10800 | 10885 | switch (vlan_get_protocol(skb)) { |
| 10801 | 10886 | case htons(ETH_P_IP): |
| 10802 | − l4_proto = ip_hdr(skb)->protocol; | |
| 10887 | + if (!skb->encapsulation) | |
| 10888 | + return features; | |
| 10889 | + l4_proto = &ip_hdr(skb)->protocol; | |
| 10890 | + if (bnxt_tunl_check(bp, skb, *l4_proto)) | |
| 10891 | + return features; | |
| 10803 | 10892 | break; |
| 10804 | 10893 | case htons(ETH_P_IPV6): |
| 10805 | − l4_proto = ipv6_hdr(skb)->nexthdr; | |
| 10894 | + if (!bnxt_exthdr_check(bp, skb, skb_network_offset(skb), | |
| 10895 | + &l4_proto)) | |
| 10896 | + break; | |
| 10897 | + if (!l4_proto || bnxt_tunl_check(bp, skb, *l4_proto)) | |
| 10898 | + return features; | |
| 10806 | 10899 | break; |
| 10807 | − default: | |
| 10808 | − return features; | |
| 10809 | 10900 | } |
| 10810 | − | |
| 10811 | − if (l4_proto != IPPROTO_UDP) | |
| 10812 | − return features; | |
| 10813 | − | |
| 10814 | − bp = netdev_priv(dev); | |
| 10815 | − /* For UDP, we can only handle 1 Vxlan port and 1 Geneve port. */ | |
| 10816 | − udp_port = udp_hdr(skb)->dest; | |
| 10817 | − if (udp_port == bp->vxlan_port || udp_port == bp->nge_port) | |
| 10818 | − return features; | |
| 10819 | 10901 | return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); |
| 10820 | 10902 | } |
| 10821 | 10903 | |
| @@ -11668,6 +11750,8 @@ static void bnxt_fw_init_one_p3(struct bnxt *bp) · 846 unmodified lines | ||
| 11668 | 11750 | bnxt_hwrm_coal_params_qcaps(bp); |
| 11669 | 11751 | } |
| 11670 | 11752 | |
| 11753 | +static int bnxt_probe_phy(struct bnxt *bp, bool fw_dflt); | |
| 11754 | + | |
| 11671 | 11755 | static int bnxt_fw_init_one(struct bnxt *bp) |
| 11672 | 11756 | { |
| 11673 | 11757 | int rc; |
| @@ -11682,6 +11766,9 @@ static int bnxt_fw_init_one(struct bnxt *bp) · 8 unmodified lines | ||
| 11682 | 11766 | netdev_err(bp->dev, "Firmware init phase 2 failed\n"); |
| 11683 | 11767 | return rc; |
| 11684 | 11768 | } |
| 11769 | + rc = bnxt_probe_phy(bp, false); | |
| 11770 | + if (rc) | |
| 11771 | + return rc; | |
| 11685 | 11772 | rc = bnxt_approve_mac(bp, bp->dev->dev_addr, false); |
| 11686 | 11773 | if (rc) |
| 11687 | 11774 | return rc; |
| @@ -13073,6 +13160,7 @@ init_err_pci_clean: · 1385 unmodified lines | ||
| 13073 | 13160 | bnxt_hwrm_func_drv_unrgtr(bp); |
| 13074 | 13161 | bnxt_free_hwrm_short_cmd_req(bp); |
| 13075 | 13162 | bnxt_free_hwrm_resources(bp); |
| 13163 | + bnxt_ethtool_free(bp); | |
| 13076 | 13164 | kfree(bp->fw_health); |
| 13077 | 13165 | bp->fw_health = NULL; |
| 13078 | 13166 | bnxt_cleanup_pci(bp); |
| @@ -1457,6 +1457,16 @@ struct bnxt_ctx_pg_info { · 1456 unmodified lines | ||
| 1457 | 1457 | |
| 1458 | 1458 | #define BNXT_BACKING_STORE_CFG_LEGACY_LEN 256 |
| 1459 | 1459 | |
| 1460 | +#define BNXT_SET_CTX_PAGE_ATTR(attr) \ | |
| 1461 | +do { \ | |
| 1462 | + if (BNXT_PAGE_SIZE == 0x2000) \ | |
| 1463 | + attr = FUNC_BACKING_STORE_CFG_REQ_SRQ_PG_SIZE_PG_8K; \ | |
| 1464 | + else if (BNXT_PAGE_SIZE == 0x10000) \ | |
| 1465 | + attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_64K; \ | |
| 1466 | + else \ | |
| 1467 | + attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_4K; \ | |
| 1468 | +} while (0) | |
| 1469 | + | |
| 1460 | 1470 | struct bnxt_ctx_mem_info { |
| 1461 | 1471 | u32 qp_max_entries; |
| 1462 | 1472 | u16 qp_min_qp1_entries; |
| @@ -2867,6 +2867,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) · 2866 unmodified lines | ||
| 2867 | 2867 | struct gem_stats *hwstat = &bp->hw_stats.gem; |
| 2868 | 2868 | struct net_device_stats *nstat = &bp->dev->stats; |
| 2869 | 2869 | |
| 2870 | + if (!netif_running(bp->dev)) | |
| 2871 | + return nstat; | |
| 2872 | + | |
| 2870 | 2873 | gem_update_stats(bp); |
| 2871 | 2874 | |
| 2872 | 2875 | nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors + |
| @@ -2177,8 +2177,6 @@ int cxgb4_update_mac_filt(struct port_info *pi, unsigned int viid, · 2176 unmodified lines | ||
| 2177 | 2177 | bool persistent, u8 *smt_idx); |
| 2178 | 2178 | int cxgb4_get_msix_idx_from_bmap(struct adapter *adap); |
| 2179 | 2179 | void cxgb4_free_msix_idx_in_bmap(struct adapter *adap, u32 msix_idx); |
| 2180 | −int cxgb_open(struct net_device *dev); | |
| 2181 | −int cxgb_close(struct net_device *dev); | |
| 2182 | 2180 | void cxgb4_enable_rx(struct adapter *adap, struct sge_rspq *q); |
| 2183 | 2181 | void cxgb4_quiesce_rx(struct sge_rspq *q); |
| 2184 | 2182 | int cxgb4_port_mirror_alloc(struct net_device *dev); |
| @@ -1337,13 +1337,27 @@ static int cxgb4_ethtool_flash_phy(struct net_device *netdev, · 1336 unmodified lines | ||
| 1337 | 1337 | return ret; |
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | − spin_lock_bh(&adap->win0_lock); | |
| 1340 | + /* We have to RESET the chip/firmware because we need the | |
| 1341 | + * chip in uninitialized state for loading new PHY image. | |
| 1342 | + * Otherwise, the running firmware will only store the PHY | |
| 1343 | + * image in local RAM which will be lost after next reset. | |
| 1344 | + */ | |
| 1345 | + ret = t4_fw_reset(adap, adap->mbox, PIORSTMODE_F | PIORST_F); | |
| 1346 | + if (ret < 0) { | |
| 1347 | + dev_err(adap->pdev_dev, | |
| 1348 | + "Set FW to RESET for flashing PHY FW failed. ret: %d\n", | |
| 1349 | + ret); | |
| 1350 | + return ret; | |
| 1351 | + } | |
| 1352 | + | |
| 1341 | 1353 | ret = t4_load_phy_fw(adap, MEMWIN_NIC, NULL, data, size); |
| 1342 | − spin_unlock_bh(&adap->win0_lock); | |
| 1343 | − if (ret) | |
| 1344 | − dev_err(adap->pdev_dev, "Failed to load PHY FW\n"); | |
| 1354 | + if (ret < 0) { | |
| 1355 | + dev_err(adap->pdev_dev, "Failed to load PHY FW. ret: %d\n", | |
| 1356 | + ret); | |
| 1357 | + return ret; | |
| 1358 | + } | |
| 1345 | 1359 | |
| 1346 | − return ret; | |
| 1360 | + return 0; | |
| 1347 | 1361 | } |
| 1348 | 1362 | |
| 1349 | 1363 | static int cxgb4_ethtool_flash_fw(struct net_device *netdev, |
| @@ -1610,16 +1624,14 @@ static struct filter_entry *cxgb4_get_filter_entry(struct adapter *adap, · 260 unmodified lines | ||
| 1610 | 1624 | u32 ftid) |
| 1611 | 1625 | { |
| 1612 | 1626 | struct tid_info *t = &adap->tids; |
| 1613 | − struct filter_entry *f; | |
| 1614 | 1627 | |
| 1615 | − if (ftid < t->nhpftids) | |
| 1616 | − f = &adap->tids.hpftid_tab[ftid]; | |
| 1617 | − else if (ftid < t->nftids) | |
| 1618 | − f = &adap->tids.ftid_tab[ftid - t->nhpftids]; | |
| 1619 | − else | |
| 1620 | − f = lookup_tid(&adap->tids, ftid); | |
| 1628 | + if (ftid >= t->hpftid_base && ftid < t->hpftid_base + t->nhpftids) | |
| 1629 | + return &t->hpftid_tab[ftid - t->hpftid_base]; | |
| 1621 | 1630 | |
| 1622 | − return f; | |
| 1631 | + if (ftid >= t->ftid_base && ftid < t->ftid_base + t->nftids) | |
| 1632 | + return &t->ftid_tab[ftid - t->ftid_base]; | |
| 1633 | + | |
| 1634 | + return lookup_tid(t, ftid); | |
| 1623 | 1635 | } |
| 1624 | 1636 | |
| 1625 | 1637 | static void cxgb4_fill_filter_rule(struct ethtool_rx_flow_spec *fs, |
| @@ -1826,6 +1838,11 @@ static int cxgb4_ntuple_del_filter(struct net_device *dev, · 200 unmodified lines | ||
| 1826 | 1838 | filter_id = filter_info->loc_array[cmd->fs.location]; |
| 1827 | 1839 | f = cxgb4_get_filter_entry(adapter, filter_id); |
| 1828 | 1840 | |
| 1841 | + if (f->fs.prio) | |
| 1842 | + filter_id -= adapter->tids.hpftid_base; | |
| 1843 | + else if (!f->fs.hash) | |
| 1844 | + filter_id -= (adapter->tids.ftid_base - adapter->tids.nhpftids); | |
| 1845 | + | |
| 1829 | 1846 | ret = cxgb4_flow_rule_destroy(dev, f->fs.tc_prio, &f->fs, filter_id); |
| 1830 | 1847 | if (ret) |
| 1831 | 1848 | goto err; |
| @@ -1885,6 +1902,11 @@ static int cxgb4_ntuple_set_filter(struct net_device *netdev, · 53 unmodified lines | ||
| 1885 | 1902 | |
| 1886 | 1903 | filter_info = &adapter->ethtool_filters->port[pi->port_id]; |
| 1887 | 1904 | |
| 1905 | + if (fs.prio) | |
| 1906 | + tid += adapter->tids.hpftid_base; | |
| 1907 | + else if (!fs.hash) | |
| 1908 | + tid += (adapter->tids.ftid_base - adapter->tids.nhpftids); | |
| 1909 | + | |
| 1888 | 1910 | filter_info->loc_array[cmd->fs.location] = tid; |
| 1889 | 1911 | set_bit(cmd->fs.location, filter_info->bmap); |
| 1890 | 1912 | filter_info->in_use++; |
| @@ -198,7 +198,7 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f, · 197 unmodified lines | ||
| 198 | 198 | WORD_MASK, f->fs.nat_lip[3] | |
| 199 | 199 | f->fs.nat_lip[2] << 8 | |
| 200 | 200 | f->fs.nat_lip[1] << 16 | |
| 201 | − (u64)f->fs.nat_lip[0] << 25, 1); | |
| 201 | + (u64)f->fs.nat_lip[0] << 24, 1); | |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| @@ -1042,7 +1042,7 @@ void clear_all_filters(struct adapter *adapter) · 837 unmodified lines | ||
| 1042 | 1042 | cxgb4_del_filter(dev, f->tid, &f->fs); |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | − sb = t4_read_reg(adapter, LE_DB_SRVR_START_INDEX_A); | |
| 1045 | + sb = adapter->tids.stid_base; | |
| 1046 | 1046 | for (i = 0; i < sb; i++) { |
| 1047 | 1047 | f = (struct filter_entry *)adapter->tids.tid_tab[i]; |
| 1048 | 1048 | |
| @@ -2834,7 +2834,7 @@ static void cxgb_down(struct adapter *adapter) · 2833 unmodified lines | ||
| 2834 | 2834 | /* |
| 2835 | 2835 | * net_device operations |
| 2836 | 2836 | */ |
| 2837 | −int cxgb_open(struct net_device *dev) | |
| 2837 | +static int cxgb_open(struct net_device *dev) | |
| 2838 | 2838 | { |
| 2839 | 2839 | struct port_info *pi = netdev_priv(dev); |
| 2840 | 2840 | struct adapter *adapter = pi->adapter; |
| @@ -2882,7 +2882,7 @@ out_unlock: · 41 unmodified lines | ||
| 2882 | 2882 | return err; |
| 2883 | 2883 | } |
| 2884 | 2884 | |
| 2885 | −int cxgb_close(struct net_device *dev) | |
| 2885 | +static int cxgb_close(struct net_device *dev) | |
| 2886 | 2886 | { |
| 2887 | 2887 | struct port_info *pi = netdev_priv(dev); |
| 2888 | 2888 | struct adapter *adapter = pi->adapter; |
| @@ -4424,10 +4424,8 @@ static int adap_init0_phy(struct adapter *adap) · 1535 unmodified lines | ||
| 4424 | 4424 | |
| 4425 | 4425 | /* Load PHY Firmware onto adapter. |
| 4426 | 4426 | */ |
| 4427 | − spin_lock_bh(&adap->win0_lock); | |
| 4428 | 4427 | ret = t4_load_phy_fw(adap, MEMWIN_NIC, phy_info->phy_fw_version, |
| 4429 | 4428 | (u8 *)phyf->data, phyf->size); |
| 4430 | − spin_unlock_bh(&adap->win0_lock); | |
| 4431 | 4429 | if (ret < 0) |
| 4432 | 4430 | dev_err(adap->pdev_dev, "PHY Firmware transfer error %d\n", |
| 4433 | 4431 | -ret); |
| @@ -6480,9 +6478,9 @@ static void cxgb4_ktls_dev_del(struct net_device *netdev, · 2046 unmodified lines | ||
| 6480 | 6478 | |
| 6481 | 6479 | adap->uld[CXGB4_ULD_KTLS].tlsdev_ops->tls_dev_del(netdev, tls_ctx, |
| 6482 | 6480 | direction); |
| 6483 | − cxgb4_set_ktls_feature(adap, FW_PARAMS_PARAM_DEV_KTLS_HW_DISABLE); | |
| 6484 | 6481 | |
| 6485 | 6482 | out_unlock: |
| 6483 | + cxgb4_set_ktls_feature(adap, FW_PARAMS_PARAM_DEV_KTLS_HW_DISABLE); | |
| 6486 | 6484 | mutex_unlock(&uld_mutex); |
| 6487 | 6485 | } |
| 6488 | 6486 | |
| @@ -997,20 +997,16 @@ int cxgb4_tc_flower_destroy(struct net_device *dev, · 996 unmodified lines | ||
| 997 | 997 | if (!ch_flower) |
| 998 | 998 | return -ENOENT; |
| 999 | 999 | |
| 1000 | + rhashtable_remove_fast(&adap->flower_tbl, &ch_flower->node, | |
| 1001 | + adap->flower_ht_params); | |
| 1002 | + | |
| 1000 | 1003 | ret = cxgb4_flow_rule_destroy(dev, ch_flower->fs.tc_prio, |
| 1001 | 1004 | &ch_flower->fs, ch_flower->filter_id); |
| 1002 | 1005 | if (ret) |
| 1003 | − goto err; | |
| 1006 | + netdev_err(dev, "Flow rule destroy failed for tid: %u, ret: %d", | |
| 1007 | + ch_flower->filter_id, ret); | |
| 1004 | 1008 | |
| 1005 | − ret = rhashtable_remove_fast(&adap->flower_tbl, &ch_flower->node, | |
| 1006 | − adap->flower_ht_params); | |
| 1007 | − if (ret) { | |
| 1008 | − netdev_err(dev, "Flow remove from rhashtable failed"); | |
| 1009 | − goto err; | |
| 1010 | − } | |
| 1011 | 1009 | kfree_rcu(ch_flower, rcu); |
| 1012 | − | |
| 1013 | −err: | |
| 1014 | 1010 | return ret; |
| 1015 | 1011 | } |
| 1016 | 1012 | |
| @@ -589,7 +589,8 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev, · 588 unmodified lines | ||
| 589 | 589 | * down before configuring tc params. |
| 590 | 590 | */ |
| 591 | 591 | if (netif_running(dev)) { |
| 592 | − cxgb_close(dev); | |
| 592 | + netif_tx_stop_all_queues(dev); | |
| 593 | + netif_carrier_off(dev); | |
| 593 | 594 | needs_bring_up = true; |
| 594 | 595 | } |
| 595 | 596 | |
| @@ -615,8 +616,10 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev, · 19 unmodified lines | ||
| 615 | 616 | } |
| 616 | 617 | |
| 617 | 618 | out: |
| 618 | − if (needs_bring_up) | |
| 619 | − cxgb_open(dev); | |
| 619 | + if (needs_bring_up) { | |
| 620 | + netif_tx_start_all_queues(dev); | |
| 621 | + netif_carrier_on(dev); | |
| 622 | + } | |
| 620 | 623 | |
| 621 | 624 | mutex_unlock(&adap->tc_mqprio->mqprio_mutex); |
| 622 | 625 | return ret; |
| @@ -2556,6 +2556,12 @@ int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc) · 2555 unmodified lines | ||
| 2556 | 2556 | if (!eosw_txq) |
| 2557 | 2557 | return -ENOMEM; |
| 2558 | 2558 | |
| 2559 | + if (!(adap->flags & CXGB4_FW_OK)) { | |
| 2560 | + /* Don't stall caller when access to FW is lost */ | |
| 2561 | + complete(&eosw_txq->completion); | |
| 2562 | + return -EIO; | |
| 2563 | + } | |
| 2564 | + | |
| 2559 | 2565 | skb = alloc_skb(len, GFP_KERNEL); |
| 2560 | 2566 | if (!skb) |
| 2561 | 2567 | return -ENOMEM; |
| @@ -3060,16 +3060,19 @@ int t4_read_flash(struct adapter *adapter, unsigned int addr, · 3059 unmodified lines | ||
| 3060 | 3060 | * @addr: the start address to write |
| 3061 | 3061 | * @n: length of data to write in bytes |
| 3062 | 3062 | * @data: the data to write |
| 3063 | + * @byte_oriented: whether to store data as bytes or as words | |
| 3063 | 3064 | * |
| 3064 | 3065 | * Writes up to a page of data (256 bytes) to the serial flash starting |
| 3065 | 3066 | * at the given address. All the data must be written to the same page. |
| 3067 | + * If @byte_oriented is set the write data is stored as byte stream | |
| 3068 | + * (i.e. matches what on disk), otherwise in big-endian. | |
| 3066 | 3069 | */ |
| 3067 | 3070 | static int t4_write_flash(struct adapter *adapter, unsigned int addr, |
| 3068 | − unsigned int n, const u8 *data) | |
| 3071 | + unsigned int n, const u8 *data, bool byte_oriented) | |
| 3069 | 3072 | { |
| 3070 | − int ret; | |
| 3071 | − u32 buf[64]; | |
| 3072 | 3073 | unsigned int i, c, left, val, offset = addr & 0xff; |
| 3074 | + u32 buf[64]; | |
| 3075 | + int ret; | |
| 3073 | 3076 | |
| 3074 | 3077 | if (addr >= adapter->params.sf_size || offset + n > SF_PAGE_SIZE) |
| 3075 | 3078 | return -EINVAL; |
| @@ -3080,10 +3083,14 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 4 unmodified lines | ||
| 3080 | 3083 | (ret = sf1_write(adapter, 4, 1, 1, val)) != 0) |
| 3081 | 3084 | goto unlock; |
| 3082 | 3085 | |
| 3083 | − for (left = n; left; left -= c) { | |
| 3086 | + for (left = n; left; left -= c, data += c) { | |
| 3084 | 3087 | c = min(left, 4U); |
| 3085 | − for (val = 0, i = 0; i < c; ++i) | |
| 3086 | − val = (val << 8) + *data++; | |
| 3088 | + for (val = 0, i = 0; i < c; ++i) { | |
| 3089 | + if (byte_oriented) | |
| 3090 | + val = (val << 8) + data[i]; | |
| 3091 | + else | |
| 3092 | + val = (val << 8) + data[c - i - 1]; | |
| 3093 | + } | |
| 3087 | 3094 | |
| 3088 | 3095 | ret = sf1_write(adapter, c, c != left, 1, val); |
| 3089 | 3096 | if (ret) |
| @@ -3096,7 +3103,8 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 6 unmodified lines | ||
| 3096 | 3103 | t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */ |
| 3097 | 3104 | |
| 3098 | 3105 | /* Read the page to verify the write succeeded */ |
| 3099 | − ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, 1); | |
| 3106 | + ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, | |
| 3107 | + byte_oriented); | |
| 3100 | 3108 | if (ret) |
| 3101 | 3109 | return ret; |
| 3102 | 3110 | |
| @@ -3692,7 +3700,7 @@ int t4_load_fw(struct adapter *adap, const u8 *fw_data, unsigned int size) · 589 unmodified lines | ||
| 3692 | 3700 | */ |
| 3693 | 3701 | memcpy(first_page, fw_data, SF_PAGE_SIZE); |
| 3694 | 3702 | ((struct fw_hdr *)first_page)->fw_ver = cpu_to_be32(0xffffffff); |
| 3695 | − ret = t4_write_flash(adap, fw_start, SF_PAGE_SIZE, first_page); | |
| 3703 | + ret = t4_write_flash(adap, fw_start, SF_PAGE_SIZE, first_page, true); | |
| 3696 | 3704 | if (ret) |
| 3697 | 3705 | goto out; |
| 3698 | 3706 | |
| @@ -3700,14 +3708,14 @@ int t4_load_fw(struct adapter *adap, const u8 *fw_data, unsigned int size) · 1 unmodified line | ||
| 3700 | 3708 | for (size -= SF_PAGE_SIZE; size; size -= SF_PAGE_SIZE) { |
| 3701 | 3709 | addr += SF_PAGE_SIZE; |
| 3702 | 3710 | fw_data += SF_PAGE_SIZE; |
| 3703 | − ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, fw_data); | |
| 3711 | + ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, fw_data, true); | |
| 3704 | 3712 | if (ret) |
| 3705 | 3713 | goto out; |
| 3706 | 3714 | } |
| 3707 | 3715 | |
| 3708 | − ret = t4_write_flash(adap, | |
| 3709 | − fw_start + offsetof(struct fw_hdr, fw_ver), | |
| 3710 | − sizeof(hdr->fw_ver), (const u8 *)&hdr->fw_ver); | |
| 3716 | + ret = t4_write_flash(adap, fw_start + offsetof(struct fw_hdr, fw_ver), | |
| 3717 | + sizeof(hdr->fw_ver), (const u8 *)&hdr->fw_ver, | |
| 3718 | + true); | |
| 3711 | 3719 | out: |
| 3712 | 3720 | if (ret) |
| 3713 | 3721 | dev_err(adap->pdev_dev, "firmware download failed, error %d\n", |
| @@ -3812,9 +3820,11 @@ int t4_load_phy_fw(struct adapter *adap, int win, · 98 unmodified lines | ||
| 3812 | 3820 | /* Copy the supplied PHY Firmware image to the adapter memory location |
| 3813 | 3821 | * allocated by the adapter firmware. |
| 3814 | 3822 | */ |
| 3823 | + spin_lock_bh(&adap->win0_lock); | |
| 3815 | 3824 | ret = t4_memory_rw(adap, win, mtype, maddr, |
| 3816 | 3825 | phy_fw_size, (__be32 *)phy_fw_data, |
| 3817 | 3826 | T4_MEMORY_WRITE); |
| 3827 | + spin_unlock_bh(&adap->win0_lock); | |
| 3818 | 3828 | if (ret) |
| 3819 | 3829 | return ret; |
| 3820 | 3830 | |
| @@ -10208,7 +10218,7 @@ int t4_load_cfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) · 6387 unmodified lines | ||
| 10208 | 10218 | n = size - i; |
| 10209 | 10219 | else |
| 10210 | 10220 | n = SF_PAGE_SIZE; |
| 10211 | − ret = t4_write_flash(adap, addr, n, cfg_data); | |
| 10221 | + ret = t4_write_flash(adap, addr, n, cfg_data, true); | |
| 10212 | 10222 | if (ret) |
| 10213 | 10223 | goto out; |
| 10214 | 10224 | |
| @@ -10677,13 +10687,14 @@ int t4_load_boot(struct adapter *adap, u8 *boot_data, · 462 unmodified lines | ||
| 10677 | 10687 | for (size -= SF_PAGE_SIZE; size; size -= SF_PAGE_SIZE) { |
| 10678 | 10688 | addr += SF_PAGE_SIZE; |
| 10679 | 10689 | boot_data += SF_PAGE_SIZE; |
| 10680 | − ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, boot_data); | |
| 10690 | + ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, boot_data, | |
| 10691 | + false); | |
| 10681 | 10692 | if (ret) |
| 10682 | 10693 | goto out; |
| 10683 | 10694 | } |
| 10684 | 10695 | |
| 10685 | 10696 | ret = t4_write_flash(adap, boot_sector, SF_PAGE_SIZE, |
| 10686 | − (const u8 *)header); | |
| 10697 | + (const u8 *)header, false); | |
| 10687 | 10698 | |
| 10688 | 10699 | out: |
| 10689 | 10700 | if (ret) |
| @@ -10758,7 +10769,7 @@ int t4_load_bootcfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) · 68 unmodified lines | ||
| 10758 | 10769 | for (i = 0; i < size; i += SF_PAGE_SIZE) { |
| 10759 | 10770 | n = min_t(u32, size - i, SF_PAGE_SIZE); |
| 10760 | 10771 | |
| 10761 | − ret = t4_write_flash(adap, addr, n, cfg_data); | |
| 10772 | + ret = t4_write_flash(adap, addr, n, cfg_data, false); | |
| 10762 | 10773 | if (ret) |
| 10763 | 10774 | goto out; |
| 10764 | 10775 | |
| @@ -10770,7 +10781,8 @@ int t4_load_bootcfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) · 5 unmodified lines | ||
| 10770 | 10781 | for (i = 0; i < npad; i++) { |
| 10771 | 10782 | u8 data = 0; |
| 10772 | 10783 | |
| 10773 | − ret = t4_write_flash(adap, cfg_addr + size + i, 1, &data); | |
| 10784 | + ret = t4_write_flash(adap, cfg_addr + size + i, 1, &data, | |
| 10785 | + false); | |
| 10774 | 10786 | if (ret) |
| 10775 | 10787 | goto out; |
| 10776 | 10788 | } |
| @@ -59,6 +59,7 @@ static int chcr_get_nfrags_to_send(struct sk_buff *skb, u32 start, u32 len) · 58 unmodified lines | ||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | static int chcr_init_tcb_fields(struct chcr_ktls_info *tx_info); |
| 62 | +static void clear_conn_resources(struct chcr_ktls_info *tx_info); | |
| 62 | 63 | /* |
| 63 | 64 | * chcr_ktls_save_keys: calculate and save crypto keys. |
| 64 | 65 | * @tx_info - driver specific tls info. |
| @@ -364,10 +365,14 @@ static void chcr_ktls_dev_del(struct net_device *netdev, · 299 unmodified lines | ||
| 364 | 365 | chcr_get_ktls_tx_context(tls_ctx); |
| 365 | 366 | struct chcr_ktls_info *tx_info = tx_ctx->chcr_info; |
| 366 | 367 | struct ch_ktls_port_stats_debug *port_stats; |
| 368 | + struct chcr_ktls_uld_ctx *u_ctx; | |
| 367 | 369 | |
| 368 | 370 | if (!tx_info) |
| 369 | 371 | return; |
| 370 | 372 | |
| 373 | + u_ctx = tx_info->adap->uld[CXGB4_ULD_KTLS].handle; | |
| 374 | + if (u_ctx && u_ctx->detach) | |
| 375 | + return; | |
| 371 | 376 | /* clear l2t entry */ |
| 372 | 377 | if (tx_info->l2te) |
| 373 | 378 | cxgb4_l2t_release(tx_info->l2te); |
| @@ -384,6 +389,8 @@ static void chcr_ktls_dev_del(struct net_device *netdev, · 10 unmodified lines | ||
| 384 | 389 | if (tx_info->tid != -1) { |
| 385 | 390 | cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan, |
| 386 | 391 | tx_info->tid, tx_info->ip_family); |
| 392 | + | |
| 393 | + xa_erase(&u_ctx->tid_list, tx_info->tid); | |
| 387 | 394 | } |
| 388 | 395 | |
| 389 | 396 | port_stats = &tx_info->adap->ch_ktls_stats.ktls_port[tx_info->port_id]; |
| @@ -411,6 +418,7 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk, · 21 unmodified lines | ||
| 411 | 418 | struct tls_context *tls_ctx = tls_get_ctx(sk); |
| 412 | 419 | struct ch_ktls_port_stats_debug *port_stats; |
| 413 | 420 | struct chcr_ktls_ofld_ctx_tx *tx_ctx; |
| 421 | + struct chcr_ktls_uld_ctx *u_ctx; | |
| 414 | 422 | struct chcr_ktls_info *tx_info; |
| 415 | 423 | struct dst_entry *dst; |
| 416 | 424 | struct adapter *adap; |
| @@ -425,6 +433,7 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk, · 8 unmodified lines | ||
| 425 | 433 | adap = pi->adapter; |
| 426 | 434 | port_stats = &adap->ch_ktls_stats.ktls_port[pi->port_id]; |
| 427 | 435 | atomic64_inc(&port_stats->ktls_tx_connection_open); |
| 436 | + u_ctx = adap->uld[CXGB4_ULD_KTLS].handle; | |
| 428 | 437 | |
| 429 | 438 | if (direction == TLS_OFFLOAD_CTX_DIR_RX) { |
| 430 | 439 | pr_err("not expecting for RX direction\n"); |
| @@ -434,6 +443,9 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk, · 3 unmodified lines | ||
| 434 | 443 | if (tx_ctx->chcr_info) |
| 435 | 444 | goto out; |
| 436 | 445 | |
| 446 | + if (u_ctx && u_ctx->detach) | |
| 447 | + goto out; | |
| 448 | + | |
| 437 | 449 | tx_info = kvzalloc(sizeof(*tx_info), GFP_KERNEL); |
| 438 | 450 | if (!tx_info) |
| 439 | 451 | goto out; |
| @@ -569,6 +581,8 @@ free_tid: · 129 unmodified lines | ||
| 569 | 581 | cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan, |
| 570 | 582 | tx_info->tid, tx_info->ip_family); |
| 571 | 583 | |
| 584 | + xa_erase(&u_ctx->tid_list, tx_info->tid); | |
| 585 | + | |
| 572 | 586 | put_module: |
| 573 | 587 | /* release module refcount */ |
| 574 | 588 | module_put(THIS_MODULE); |
| @@ -633,8 +647,12 @@ static int chcr_ktls_cpl_act_open_rpl(struct adapter *adap, · 58 unmodified lines | ||
| 633 | 647 | { |
| 634 | 648 | const struct cpl_act_open_rpl *p = (void *)input; |
| 635 | 649 | struct chcr_ktls_info *tx_info = NULL; |
| 650 | + struct chcr_ktls_ofld_ctx_tx *tx_ctx; | |
| 651 | + struct chcr_ktls_uld_ctx *u_ctx; | |
| 636 | 652 | unsigned int atid, tid, status; |
| 653 | + struct tls_context *tls_ctx; | |
| 637 | 654 | struct tid_info *t; |
| 655 | + int ret = 0; | |
| 638 | 656 | |
| 639 | 657 | tid = GET_TID(p); |
| 640 | 658 | status = AOPEN_STATUS_G(ntohl(p->atid_status)); |
| @@ -666,14 +684,29 @@ static int chcr_ktls_cpl_act_open_rpl(struct adapter *adap, · 25 unmodified lines | ||
| 666 | 684 | if (!status) { |
| 667 | 685 | tx_info->tid = tid; |
| 668 | 686 | cxgb4_insert_tid(t, tx_info, tx_info->tid, tx_info->ip_family); |
| 687 | + /* Adding tid */ | |
| 688 | + tls_ctx = tls_get_ctx(tx_info->sk); | |
| 689 | + tx_ctx = chcr_get_ktls_tx_context(tls_ctx); | |
| 690 | + u_ctx = adap->uld[CXGB4_ULD_KTLS].handle; | |
| 691 | + if (u_ctx) { | |
| 692 | + ret = xa_insert_bh(&u_ctx->tid_list, tid, tx_ctx, | |
| 693 | + GFP_NOWAIT); | |
| 694 | + if (ret < 0) { | |
| 695 | + pr_err("%s: Failed to allocate tid XA entry = %d\n", | |
| 696 | + __func__, tx_info->tid); | |
| 697 | + tx_info->open_state = CH_KTLS_OPEN_FAILURE; | |
| 698 | + goto out; | |
| 699 | + } | |
| 700 | + } | |
| 669 | 701 | tx_info->open_state = CH_KTLS_OPEN_SUCCESS; |
| 670 | 702 | } else { |
| 671 | 703 | tx_info->open_state = CH_KTLS_OPEN_FAILURE; |
| 672 | 704 | } |
| 705 | +out: | |
| 673 | 706 | spin_unlock(&tx_info->lock); |
| 674 | 707 | |
| 675 | 708 | complete(&tx_info->completion); |
| 676 | − return 0; | |
| 709 | + return ret; | |
| 677 | 710 | } |
| 678 | 711 | |
| 679 | 712 | /* |
| @@ -2090,6 +2123,8 @@ static void *chcr_ktls_uld_add(const struct cxgb4_lld_info *lldi) · 1410 unmodified lines | ||
| 2090 | 2123 | goto out; |
| 2091 | 2124 | } |
| 2092 | 2125 | u_ctx->lldi = *lldi; |
| 2126 | + u_ctx->detach = false; | |
| 2127 | + xa_init_flags(&u_ctx->tid_list, XA_FLAGS_LOCK_BH); | |
| 2093 | 2128 | out: |
| 2094 | 2129 | return u_ctx; |
| 2095 | 2130 | } |
| @@ -2123,6 +2158,45 @@ static int chcr_ktls_uld_rx_handler(void *handle, const __be64 *rsp, · 27 unmodified lines | ||
| 2123 | 2158 | return 0; |
| 2124 | 2159 | } |
| 2125 | 2160 | |
| 2161 | +static void clear_conn_resources(struct chcr_ktls_info *tx_info) | |
| 2162 | +{ | |
| 2163 | + /* clear l2t entry */ | |
| 2164 | + if (tx_info->l2te) | |
| 2165 | + cxgb4_l2t_release(tx_info->l2te); | |
| 2166 | + | |
| 2167 | +#if IS_ENABLED(CONFIG_IPV6) | |
| 2168 | + /* clear clip entry */ | |
| 2169 | + if (tx_info->ip_family == AF_INET6) | |
| 2170 | + cxgb4_clip_release(tx_info->netdev, (const u32 *) | |
| 2171 | + &tx_info->sk->sk_v6_rcv_saddr, | |
| 2172 | + 1); | |
| 2173 | +#endif | |
| 2174 | + | |
| 2175 | + /* clear tid */ | |
| 2176 | + if (tx_info->tid != -1) | |
| 2177 | + cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan, | |
| 2178 | + tx_info->tid, tx_info->ip_family); | |
| 2179 | +} | |
| 2180 | + | |
| 2181 | +static void ch_ktls_reset_all_conn(struct chcr_ktls_uld_ctx *u_ctx) | |
| 2182 | +{ | |
| 2183 | + struct ch_ktls_port_stats_debug *port_stats; | |
| 2184 | + struct chcr_ktls_ofld_ctx_tx *tx_ctx; | |
| 2185 | + struct chcr_ktls_info *tx_info; | |
| 2186 | + unsigned long index; | |
| 2187 | + | |
| 2188 | + xa_for_each(&u_ctx->tid_list, index, tx_ctx) { | |
| 2189 | + tx_info = tx_ctx->chcr_info; | |
| 2190 | + clear_conn_resources(tx_info); | |
| 2191 | + port_stats = &tx_info->adap->ch_ktls_stats.ktls_port[tx_info->port_id]; | |
| 2192 | + atomic64_inc(&port_stats->ktls_tx_connection_close); | |
| 2193 | + kvfree(tx_info); | |
| 2194 | + tx_ctx->chcr_info = NULL; | |
| 2195 | + /* release module refcount */ | |
| 2196 | + module_put(THIS_MODULE); | |
| 2197 | + } | |
| 2198 | +} | |
| 2199 | + | |
| 2126 | 2200 | static int chcr_ktls_uld_state_change(void *handle, enum cxgb4_state new_state) |
| 2127 | 2201 | { |
| 2128 | 2202 | struct chcr_ktls_uld_ctx *u_ctx = handle; |
| @@ -2139,7 +2213,10 @@ static int chcr_ktls_uld_state_change(void *handle, enum cxgb4_state new_state) · 10 unmodified lines | ||
| 2139 | 2213 | case CXGB4_STATE_DETACH: |
| 2140 | 2214 | pr_info("%s: Down\n", pci_name(u_ctx->lldi.pdev)); |
| 2141 | 2215 | mutex_lock(&dev_mutex); |
| 2216 | + u_ctx->detach = true; | |
| 2142 | 2217 | list_del(&u_ctx->entry); |
| 2218 | + ch_ktls_reset_all_conn(u_ctx); | |
| 2219 | + xa_destroy(&u_ctx->tid_list); | |
| 2143 | 2220 | mutex_unlock(&dev_mutex); |
| 2144 | 2221 | break; |
| 2145 | 2222 | default: |
| @@ -2178,6 +2255,7 @@ static void __exit chcr_ktls_exit(void) · 32 unmodified lines | ||
| 2178 | 2255 | adap = pci_get_drvdata(u_ctx->lldi.pdev); |
| 2179 | 2256 | memset(&adap->ch_ktls_stats, 0, sizeof(adap->ch_ktls_stats)); |
| 2180 | 2257 | list_del(&u_ctx->entry); |
| 2258 | + xa_destroy(&u_ctx->tid_list); | |
| 2181 | 2259 | kfree(u_ctx); |
| 2182 | 2260 | } |
| 2183 | 2261 | mutex_unlock(&dev_mutex); |
| @@ -75,6 +75,8 @@ struct chcr_ktls_ofld_ctx_tx { · 74 unmodified lines | ||
| 75 | 75 | struct chcr_ktls_uld_ctx { |
| 76 | 76 | struct list_head entry; |
| 77 | 77 | struct cxgb4_lld_info lldi; |
| 78 | + struct xarray tid_list; | |
| 79 | + bool detach; | |
| 78 | 80 | }; |
| 79 | 81 | |
| 80 | 82 | static inline struct chcr_ktls_ofld_ctx_tx * |
| @@ -1564,8 +1564,10 @@ found_ok_skb: · 1563 unmodified lines | ||
| 1564 | 1564 | cerr = put_cmsg(msg, SOL_TLS, TLS_GET_RECORD_TYPE, |
| 1565 | 1565 | sizeof(thdr->type), &thdr->type); |
| 1566 | 1566 | |
| 1567 | − if (cerr && thdr->type != TLS_RECORD_TYPE_DATA) | |
| 1568 | − return -EIO; | |
| 1567 | + if (cerr && thdr->type != TLS_RECORD_TYPE_DATA) { | |
| 1568 | + copied = -EIO; | |
| 1569 | + break; | |
| 1570 | + } | |
| 1569 | 1571 | /* don't send tls header, skip copy */ |
| 1570 | 1572 | goto skip_copy; |
| 1571 | 1573 | } |
| @@ -576,10 +576,12 @@ static void ec_bhf_remove(struct pci_dev *dev) · 575 unmodified lines | ||
| 576 | 576 | struct ec_bhf_priv *priv = netdev_priv(net_dev); |
| 577 | 577 | |
| 578 | 578 | unregister_netdev(net_dev); |
| 579 | − free_netdev(net_dev); | |
| 580 | 579 | |
| 581 | 580 | pci_iounmap(dev, priv->dma_io); |
| 582 | 581 | pci_iounmap(dev, priv->io); |
| 582 | + | |
| 583 | + free_netdev(net_dev); | |
| 584 | + | |
| 583 | 585 | pci_release_regions(dev); |
| 584 | 586 | pci_clear_master(dev); |
| 585 | 587 | pci_disable_device(dev); |
| @@ -5897,6 +5897,7 @@ drv_cleanup: · 5896 unmodified lines | ||
| 5897 | 5897 | unmap_bars: |
| 5898 | 5898 | be_unmap_pci_bars(adapter); |
| 5899 | 5899 | free_netdev: |
| 5900 | + pci_disable_pcie_error_reporting(pdev); | |
| 5900 | 5901 | free_netdev(netdev); |
| 5901 | 5902 | rel_reg: |
| 5902 | 5903 | pci_release_regions(pdev); |
| @@ -1662,7 +1662,7 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget) · 1661 unmodified lines | ||
| 1662 | 1662 | } |
| 1663 | 1663 | |
| 1664 | 1664 | /* ------------------------------------------------------------------------- */ |
| 1665 | −static void fec_get_mac(struct net_device *ndev) | |
| 1665 | +static int fec_get_mac(struct net_device *ndev) | |
| 1666 | 1666 | { |
| 1667 | 1667 | struct fec_enet_private *fep = netdev_priv(ndev); |
| 1668 | 1668 | unsigned char *iap, tmpaddr[ETH_ALEN]; |
| @@ -1685,6 +1685,8 @@ static void fec_get_mac(struct net_device *ndev) · 16 unmodified lines | ||
| 1685 | 1685 | ret = of_get_mac_address(np, tmpaddr); |
| 1686 | 1686 | if (!ret) |
| 1687 | 1687 | iap = tmpaddr; |
| 1688 | + else if (ret == -EPROBE_DEFER) | |
| 1689 | + return ret; | |
| 1688 | 1690 | } |
| 1689 | 1691 | } |
| 1690 | 1692 | |
| @@ -1723,7 +1725,7 @@ static void fec_get_mac(struct net_device *ndev) · 32 unmodified lines | ||
| 1723 | 1725 | eth_hw_addr_random(ndev); |
| 1724 | 1726 | dev_info(&fep->pdev->dev, "Using random MAC address: %pM\n", |
| 1725 | 1727 | ndev->dev_addr); |
| 1726 | − return; | |
| 1728 | + return 0; | |
| 1727 | 1729 | } |
| 1728 | 1730 | |
| 1729 | 1731 | memcpy(ndev->dev_addr, iap, ETH_ALEN); |
| @@ -1731,6 +1733,8 @@ static void fec_get_mac(struct net_device *ndev) · 1 unmodified line | ||
| 1731 | 1733 | /* Adjust MAC if using macaddr */ |
| 1732 | 1734 | if (iap == macaddr) |
| 1733 | 1735 | ndev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->dev_id; |
| 1736 | + | |
| 1737 | + return 0; | |
| 1734 | 1738 | } |
| 1735 | 1739 | |
| 1736 | 1740 | /* ------------------------------------------------------------------------- */ |
| @@ -3290,7 +3294,9 @@ static int fec_enet_init(struct net_device *ndev) · 1553 unmodified lines | ||
| 3290 | 3294 | return ret; |
| 3291 | 3295 | } |
| 3292 | 3296 | |
| 3293 | − fec_enet_alloc_queue(ndev); | |
| 3297 | + ret = fec_enet_alloc_queue(ndev); | |
| 3298 | + if (ret) | |
| 3299 | + return ret; | |
| 3294 | 3300 | |
| 3295 | 3301 | bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize; |
| 3296 | 3302 | |
| @@ -3298,11 +3304,15 @@ static int fec_enet_init(struct net_device *ndev) · 1 unmodified line | ||
| 3298 | 3304 | cbd_base = dmam_alloc_coherent(&fep->pdev->dev, bd_size, &bd_dma, |
| 3299 | 3305 | GFP_KERNEL); |
| 3300 | 3306 | if (!cbd_base) { |
| 3301 | − return -ENOMEM; | |
| 3307 | + ret = -ENOMEM; | |
| 3308 | + goto free_queue_mem; | |
| 3302 | 3309 | } |
| 3303 | 3310 | |
| 3304 | 3311 | /* Get the Ethernet address */ |
| 3305 | − fec_get_mac(ndev); | |
| 3312 | + ret = fec_get_mac(ndev); | |
| 3313 | + if (ret) | |
| 3314 | + goto free_queue_mem; | |
| 3315 | + | |
| 3306 | 3316 | /* make sure MAC we just acquired is programmed into the hw */ |
| 3307 | 3317 | fec_set_mac_address(ndev, NULL); |
| 3308 | 3318 | |
| @@ -3376,6 +3386,10 @@ static int fec_enet_init(struct net_device *ndev) · 67 unmodified lines | ||
| 3376 | 3386 | fec_enet_update_ethtool_stats(ndev); |
| 3377 | 3387 | |
| 3378 | 3388 | return 0; |
| 3389 | + | |
| 3390 | +free_queue_mem: | |
| 3391 | + fec_enet_free_queue(ndev); | |
| 3392 | + return ret; | |
| 3379 | 3393 | } |
| 3380 | 3394 | |
| 3381 | 3395 | #ifdef CONFIG_OF |
| @@ -215,15 +215,13 @@ static u64 fec_ptp_read(const struct cyclecounter *cc) · 214 unmodified lines | ||
| 215 | 215 | { |
| 216 | 216 | struct fec_enet_private *fep = |
| 217 | 217 | container_of(cc, struct fec_enet_private, cc); |
| 218 | − const struct platform_device_id *id_entry = | |
| 219 | − platform_get_device_id(fep->pdev); | |
| 220 | 218 | u32 tempval; |
| 221 | 219 | |
| 222 | 220 | tempval = readl(fep->hwp + FEC_ATIME_CTRL); |
| 223 | 221 | tempval |= FEC_T_CTRL_CAPTURE; |
| 224 | 222 | writel(tempval, fep->hwp + FEC_ATIME_CTRL); |
| 225 | 223 | |
| 226 | − if (id_entry->driver_data & FEC_QUIRK_BUG_CAPTURE) | |
| 224 | + if (fep->quirks & FEC_QUIRK_BUG_CAPTURE) | |
| 227 | 225 | udelay(1); |
| 228 | 226 | |
| 229 | 227 | return readl(fep->hwp + FEC_ATIME); |
| @@ -604,6 +602,10 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) · 374 unmodified lines | ||
| 604 | 602 | fep->ptp_caps.enable = fec_ptp_enable; |
| 605 | 603 | |
| 606 | 604 | fep->cycle_speed = clk_get_rate(fep->clk_ptp); |
| 605 | + if (!fep->cycle_speed) { | |
| 606 | + fep->cycle_speed = NSEC_PER_SEC; | |
| 607 | + dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n"); | |
| 608 | + } | |
| 607 | 609 | fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed; |
| 608 | 610 | |
| 609 | 611 | spin_lock_init(&fep->tmreg_lock); |
| @@ -180,7 +180,7 @@ static int gve_napi_poll(struct napi_struct *napi, int budget) · 179 unmodified lines | ||
| 180 | 180 | /* Double check we have no extra work. |
| 181 | 181 | * Ensure unmask synchronizes with checking for work. |
| 182 | 182 | */ |
| 183 | − dma_rmb(); | |
| 183 | + mb(); | |
| 184 | 184 | if (block->tx) |
| 185 | 185 | reschedule |= gve_tx_poll(block, -1); |
| 186 | 186 | if (block->rx) |
| @@ -220,6 +220,7 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv) · 33 unmodified lines | ||
| 220 | 220 | int vecs_left = new_num_ntfy_blks % 2; |
| 221 | 221 | |
| 222 | 222 | priv->num_ntfy_blks = new_num_ntfy_blks; |
| 223 | + priv->mgmt_msix_idx = priv->num_ntfy_blks; | |
| 223 | 224 | priv->tx_cfg.max_queues = min_t(int, priv->tx_cfg.max_queues, |
| 224 | 225 | vecs_per_type); |
| 225 | 226 | priv->rx_cfg.max_queues = min_t(int, priv->rx_cfg.max_queues, |
| @@ -300,20 +301,22 @@ static void gve_free_notify_blocks(struct gve_priv *priv) · 74 unmodified lines | ||
| 300 | 301 | { |
| 301 | 302 | int i; |
| 302 | 303 | |
| 303 | − /* Free the irqs */ | |
| 304 | − for (i = 0; i < priv->num_ntfy_blks; i++) { | |
| 305 | − struct gve_notify_block *block = &priv->ntfy_blocks[i]; | |
| 306 | − int msix_idx = i; | |
| 304 | + if (priv->msix_vectors) { | |
| 305 | + /* Free the irqs */ | |
| 306 | + for (i = 0; i < priv->num_ntfy_blks; i++) { | |
| 307 | + struct gve_notify_block *block = &priv->ntfy_blocks[i]; | |
| 308 | + int msix_idx = i; | |
| 307 | 309 | |
| 308 | − irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector, | |
| 309 | − NULL); | |
| 310 | − free_irq(priv->msix_vectors[msix_idx].vector, block); | |
| 310 | + irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector, | |
| 311 | + NULL); | |
| 312 | + free_irq(priv->msix_vectors[msix_idx].vector, block); | |
| 313 | + } | |
| 314 | + free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv); | |
| 311 | 315 | } |
| 312 | 316 | dma_free_coherent(&priv->pdev->dev, |
| 313 | 317 | priv->num_ntfy_blks * sizeof(*priv->ntfy_blocks), |
| 314 | 318 | priv->ntfy_blocks, priv->ntfy_block_bus); |
| 315 | 319 | priv->ntfy_blocks = NULL; |
| 316 | − free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv); | |
| 317 | 320 | pci_disable_msix(priv->pdev); |
| 318 | 321 | kvfree(priv->msix_vectors); |
| 319 | 322 | priv->msix_vectors = NULL; |
| @@ -212,10 +212,11 @@ static int gve_tx_alloc_ring(struct gve_priv *priv, int idx) · 211 unmodified lines | ||
| 212 | 212 | tx->dev = &priv->pdev->dev; |
| 213 | 213 | if (!tx->raw_addressing) { |
| 214 | 214 | tx->tx_fifo.qpl = gve_assign_tx_qpl(priv); |
| 215 | − | |
| 215 | + if (!tx->tx_fifo.qpl) | |
| 216 | + goto abort_with_desc; | |
| 216 | 217 | /* map Tx FIFO */ |
| 217 | 218 | if (gve_tx_fifo_init(priv, &tx->tx_fifo)) |
| 218 | − goto abort_with_desc; | |
| 219 | + goto abort_with_qpl; | |
| 219 | 220 | } |
| 220 | 221 | |
| 221 | 222 | tx->q_resources = |
| @@ -236,6 +237,9 @@ static int gve_tx_alloc_ring(struct gve_priv *priv, int idx) · 14 unmodified lines | ||
| 236 | 237 | abort_with_fifo: |
| 237 | 238 | if (!tx->raw_addressing) |
| 238 | 239 | gve_tx_fifo_release(priv, &tx->tx_fifo); |
| 240 | +abort_with_qpl: | |
| 241 | + if (!tx->raw_addressing) | |
| 242 | + gve_unassign_qpl(priv, tx->tx_fifo.qpl->id); | |
| 239 | 243 | abort_with_desc: |
| 240 | 244 | dma_free_coherent(hdev, bytes, tx->desc, tx->bus); |
| 241 | 245 | tx->desc = NULL; |
| @@ -589,7 +593,7 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) · 347 unmodified lines | ||
| 589 | 593 | struct gve_tx_ring *tx; |
| 590 | 594 | int nsegs; |
| 591 | 595 | |
| 592 | − WARN(skb_get_queue_mapping(skb) > priv->tx_cfg.num_queues, | |
| 596 | + WARN(skb_get_queue_mapping(skb) >= priv->tx_cfg.num_queues, | |
| 593 | 597 | "skb queue index out of range"); |
| 594 | 598 | tx = &priv->tx[skb_get_queue_mapping(skb)]; |
| 595 | 599 | if (unlikely(gve_maybe_stop_tx(tx, skb))) { |
| @@ -192,7 +192,7 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev, · 191 unmodified lines | ||
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | − *hns_nic_set_link_settings - implement ethtool set link ksettings | |
| 195 | + *hns_nic_set_link_ksettings - implement ethtool set link ksettings | |
| 196 | 196 | *@net_dev: net_device |
| 197 | 197 | *@cmd: ethtool_link_ksettings |
| 198 | 198 | *retuen 0 - success , negative --fail |
| @@ -827,7 +827,7 @@ hns_get_channels(struct net_device *net_dev, struct ethtool_channels *ch) · 628 unmodified lines | ||
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | /** |
| 830 | − * get_ethtool_stats - get detail statistics. | |
| 830 | + * hns_get_ethtool_stats - get detail statistics. | |
| 831 | 831 | * @netdev: net device |
| 832 | 832 | * @stats: statistics info. |
| 833 | 833 | * @data: statistics data. |
| @@ -885,7 +885,7 @@ static void hns_get_ethtool_stats(struct net_device *netdev, · 51 unmodified lines | ||
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | /** |
| 888 | − * get_strings: Return a set of strings that describe the requested objects | |
| 888 | + * hns_get_strings: Return a set of strings that describe the requested objects | |
| 889 | 889 | * @netdev: net device |
| 890 | 890 | * @stringset: string set ID. |
| 891 | 891 | * @data: objects data. |
| @@ -264,22 +264,17 @@ static void hns3_vector_coalesce_init(struct hns3_enet_tqp_vector *tqp_vector, · 263 unmodified lines | ||
| 264 | 264 | struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev); |
| 265 | 265 | struct hns3_enet_coalesce *tx_coal = &tqp_vector->tx_group.coal; |
| 266 | 266 | struct hns3_enet_coalesce *rx_coal = &tqp_vector->rx_group.coal; |
| 267 | + struct hns3_enet_coalesce *ptx_coal = &priv->tx_coal; | |
| 268 | + struct hns3_enet_coalesce *prx_coal = &priv->rx_coal; | |
| 267 | 269 | |
| 268 | − /* initialize the configuration for interrupt coalescing. | |
| 269 | − * 1. GL (Interrupt Gap Limiter) | |
| 270 | − * 2. RL (Interrupt Rate Limiter) | |
| 271 | − * 3. QL (Interrupt Quantity Limiter) | |
| 272 | − * | |
| 273 | − * Default: enable interrupt coalescing self-adaptive and GL | |
| 274 | − */ | |
| 275 | − tx_coal->adapt_enable = 1; | |
| 276 | − rx_coal->adapt_enable = 1; | |
| 270 | + tx_coal->adapt_enable = ptx_coal->adapt_enable; | |
| 271 | + rx_coal->adapt_enable = prx_coal->adapt_enable; | |
| 277 | 272 | |
| 278 | − tx_coal->int_gl = HNS3_INT_GL_50K; | |
| 279 | − rx_coal->int_gl = HNS3_INT_GL_50K; | |
| 273 | + tx_coal->int_gl = ptx_coal->int_gl; | |
| 274 | + rx_coal->int_gl = prx_coal->int_gl; | |
| 280 | 275 | |
| 281 | − rx_coal->flow_level = HNS3_FLOW_LOW; | |
| 282 | − tx_coal->flow_level = HNS3_FLOW_LOW; | |
| 276 | + rx_coal->flow_level = prx_coal->flow_level; | |
| 277 | + tx_coal->flow_level = ptx_coal->flow_level; | |
| 283 | 278 | |
| 284 | 279 | /* device version above V3(include V3), GL can configure 1us |
| 285 | 280 | * unit, so uses 1us unit. |
| @@ -294,8 +289,8 @@ static void hns3_vector_coalesce_init(struct hns3_enet_tqp_vector *tqp_vector, · 8 unmodified lines | ||
| 294 | 289 | rx_coal->ql_enable = 1; |
| 295 | 290 | tx_coal->int_ql_max = ae_dev->dev_specs.int_ql_max; |
| 296 | 291 | rx_coal->int_ql_max = ae_dev->dev_specs.int_ql_max; |
| 297 | − tx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG; | |
| 298 | − rx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG; | |
| 292 | + tx_coal->int_ql = ptx_coal->int_ql; | |
| 293 | + rx_coal->int_ql = prx_coal->int_ql; | |
| 299 | 294 | } |
| 300 | 295 | } |
| 301 | 296 | |
| @@ -846,8 +841,6 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb) · 544 unmodified lines | ||
| 846 | 841 | l4.udp->dest == htons(4790)))) |
| 847 | 842 | return false; |
| 848 | 843 | |
| 849 | − skb_checksum_help(skb); | |
| 850 | − | |
| 851 | 844 | return true; |
| 852 | 845 | } |
| 853 | 846 | |
| @@ -924,8 +917,7 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, · 70 unmodified lines | ||
| 924 | 917 | /* the stack computes the IP header already, |
| 925 | 918 | * driver calculate l4 checksum when not TSO. |
| 926 | 919 | */ |
| 927 | − skb_checksum_help(skb); | |
| 928 | − return 0; | |
| 920 | + return skb_checksum_help(skb); | |
| 929 | 921 | } |
| 930 | 922 | |
| 931 | 923 | hns3_set_outer_l2l3l4(skb, ol4_proto, ol_type_vlan_len_msec); |
| @@ -970,7 +962,7 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, · 38 unmodified lines | ||
| 970 | 962 | break; |
| 971 | 963 | case IPPROTO_UDP: |
| 972 | 964 | if (hns3_tunnel_csum_bug(skb)) |
| 973 | − break; | |
| 965 | + return skb_checksum_help(skb); | |
| 974 | 966 | |
| 975 | 967 | hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); |
| 976 | 968 | hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S, |
| @@ -995,8 +987,7 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, · 18 unmodified lines | ||
| 995 | 987 | /* the stack computes the IP header already, |
| 996 | 988 | * driver calculate l4 checksum when not TSO. |
| 997 | 989 | */ |
| 998 | − skb_checksum_help(skb); | |
| 999 | − return 0; | |
| 990 | + return skb_checksum_help(skb); | |
| 1000 | 991 | } |
| 1001 | 992 | |
| 1002 | 993 | return 0; |
| @@ -3844,6 +3835,34 @@ map_ring_fail: · 2841 unmodified lines | ||
| 3844 | 3835 | return ret; |
| 3845 | 3836 | } |
| 3846 | 3837 | |
| 3838 | +static void hns3_nic_init_coal_cfg(struct hns3_nic_priv *priv) | |
| 3839 | +{ | |
| 3840 | + struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev); | |
| 3841 | + struct hns3_enet_coalesce *tx_coal = &priv->tx_coal; | |
| 3842 | + struct hns3_enet_coalesce *rx_coal = &priv->rx_coal; | |
| 3843 | + | |
| 3844 | + /* initialize the configuration for interrupt coalescing. | |
| 3845 | + * 1. GL (Interrupt Gap Limiter) | |
| 3846 | + * 2. RL (Interrupt Rate Limiter) | |
| 3847 | + * 3. QL (Interrupt Quantity Limiter) | |
| 3848 | + * | |
| 3849 | + * Default: enable interrupt coalescing self-adaptive and GL | |
| 3850 | + */ | |
| 3851 | + tx_coal->adapt_enable = 1; | |
| 3852 | + rx_coal->adapt_enable = 1; | |
| 3853 | + | |
| 3854 | + tx_coal->int_gl = HNS3_INT_GL_50K; | |
| 3855 | + rx_coal->int_gl = HNS3_INT_GL_50K; | |
| 3856 | + | |
| 3857 | + rx_coal->flow_level = HNS3_FLOW_LOW; | |
| 3858 | + tx_coal->flow_level = HNS3_FLOW_LOW; | |
| 3859 | + | |
| 3860 | + if (ae_dev->dev_specs.int_ql_max) { | |
| 3861 | + tx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG; | |
| 3862 | + rx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG; | |
| 3863 | + } | |
| 3864 | +} | |
| 3865 | + | |
| 3847 | 3866 | static int hns3_nic_alloc_vector_data(struct hns3_nic_priv *priv) |
| 3848 | 3867 | { |
| 3849 | 3868 | struct hnae3_handle *h = priv->ae_handle; |
| @@ -4295,6 +4314,8 @@ static int hns3_client_init(struct hnae3_handle *handle) · 445 unmodified lines | ||
| 4295 | 4314 | goto out_get_ring_cfg; |
| 4296 | 4315 | } |
| 4297 | 4316 | |
| 4317 | + hns3_nic_init_coal_cfg(priv); | |
| 4318 | + | |
| 4298 | 4319 | ret = hns3_nic_alloc_vector_data(priv); |
| 4299 | 4320 | if (ret) { |
| 4300 | 4321 | ret = -ENOMEM; |
| @@ -4317,12 +4338,6 @@ static int hns3_client_init(struct hnae3_handle *handle) · 16 unmodified lines | ||
| 4317 | 4338 | if (ret) |
| 4318 | 4339 | goto out_init_phy; |
| 4319 | 4340 | |
| 4320 | − ret = register_netdev(netdev); | |
| 4321 | − if (ret) { | |
| 4322 | − dev_err(priv->dev, "probe register netdev fail!\n"); | |
| 4323 | − goto out_reg_netdev_fail; | |
| 4324 | − } | |
| 4325 | − | |
| 4326 | 4341 | /* the device can work without cpu rmap, only aRFS needs it */ |
| 4327 | 4342 | ret = hns3_set_rx_cpu_rmap(netdev); |
| 4328 | 4343 | if (ret) |
| @@ -4355,17 +4370,23 @@ static int hns3_client_init(struct hnae3_handle *handle) · 26 unmodified lines | ||
| 4355 | 4370 | if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) |
| 4356 | 4371 | set_bit(HNAE3_PFLAG_LIMIT_PROMISC, &handle->supported_pflags); |
| 4357 | 4372 | |
| 4373 | + ret = register_netdev(netdev); | |
| 4374 | + if (ret) { | |
| 4375 | + dev_err(priv->dev, "probe register netdev fail!\n"); | |
| 4376 | + goto out_reg_netdev_fail; | |
| 4377 | + } | |
| 4378 | + | |
| 4358 | 4379 | if (netif_msg_drv(handle)) |
| 4359 | 4380 | hns3_info_show(priv); |
| 4360 | 4381 | |
| 4361 | 4382 | return ret; |
| 4362 | 4383 | |
| 4384 | +out_reg_netdev_fail: | |
| 4385 | + hns3_dbg_uninit(handle); | |
| 4363 | 4386 | out_client_start: |
| 4364 | 4387 | hns3_free_rx_cpu_rmap(netdev); |
| 4365 | 4388 | hns3_nic_uninit_irq(priv); |
| 4366 | 4389 | out_init_irq_fail: |
| 4367 | − unregister_netdev(netdev); | |
| 4368 | −out_reg_netdev_fail: | |
| 4369 | 4390 | hns3_uninit_phy(netdev); |
| 4370 | 4391 | out_init_phy: |
| 4371 | 4392 | hns3_uninit_all_ring(priv); |
| @@ -4571,31 +4592,6 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h) · 199 unmodified lines | ||
| 4571 | 4592 | return 0; |
| 4572 | 4593 | } |
| 4573 | 4594 | |
| 4574 | −static void hns3_store_coal(struct hns3_nic_priv *priv) | |
| 4575 | −{ | |
| 4576 | − /* ethtool only support setting and querying one coal | |
| 4577 | − * configuration for now, so save the vector 0' coal | |
| 4578 | − * configuration here in order to restore it. | |
| 4579 | − */ | |
| 4580 | − memcpy(&priv->tx_coal, &priv->tqp_vector[0].tx_group.coal, | |
| 4581 | − sizeof(struct hns3_enet_coalesce)); | |
| 4582 | − memcpy(&priv->rx_coal, &priv->tqp_vector[0].rx_group.coal, | |
| 4583 | − sizeof(struct hns3_enet_coalesce)); | |
| 4584 | −} | |
| 4585 | − | |
| 4586 | −static void hns3_restore_coal(struct hns3_nic_priv *priv) | |
| 4587 | −{ | |
| 4588 | − u16 vector_num = priv->vector_num; | |
| 4589 | − int i; | |
| 4590 | − | |
| 4591 | − for (i = 0; i < vector_num; i++) { | |
| 4592 | − memcpy(&priv->tqp_vector[i].tx_group.coal, &priv->tx_coal, | |
| 4593 | − sizeof(struct hns3_enet_coalesce)); | |
| 4594 | − memcpy(&priv->tqp_vector[i].rx_group.coal, &priv->rx_coal, | |
| 4595 | − sizeof(struct hns3_enet_coalesce)); | |
| 4596 | − } | |
| 4597 | −} | |
| 4598 | − | |
| 4599 | 4595 | static int hns3_reset_notify_down_enet(struct hnae3_handle *handle) |
| 4600 | 4596 | { |
| 4601 | 4597 | struct hnae3_knic_private_info *kinfo = &handle->kinfo; |
| @@ -4654,8 +4650,6 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) · 52 unmodified lines | ||
| 4654 | 4650 | if (ret) |
| 4655 | 4651 | goto err_put_ring; |
| 4656 | 4652 | |
| 4657 | − hns3_restore_coal(priv); | |
| 4658 | − | |
| 4659 | 4653 | ret = hns3_nic_init_vector_data(priv); |
| 4660 | 4654 | if (ret) |
| 4661 | 4655 | goto err_dealloc_vector; |
| @@ -4721,8 +4715,6 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) · 59 unmodified lines | ||
| 4721 | 4715 | |
| 4722 | 4716 | hns3_nic_uninit_vector_data(priv); |
| 4723 | 4717 | |
| 4724 | − hns3_store_coal(priv); | |
| 4725 | − | |
| 4726 | 4718 | hns3_nic_dealloc_vector_data(priv); |
| 4727 | 4719 | |
| 4728 | 4720 | hns3_uninit_all_ring(priv); |
| @@ -1134,50 +1134,32 @@ static void hns3_get_channels(struct net_device *netdev, · 1133 unmodified lines | ||
| 1134 | 1134 | h->ae_algo->ops->get_channels(h, ch); |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | −static int hns3_get_coalesce_per_queue(struct net_device *netdev, u32 queue, | |
| 1138 | − struct ethtool_coalesce *cmd) | |
| 1137 | +static int hns3_get_coalesce(struct net_device *netdev, | |
| 1138 | + struct ethtool_coalesce *cmd) | |
| 1139 | 1139 | { |
| 1140 | − struct hns3_enet_tqp_vector *tx_vector, *rx_vector; | |
| 1141 | 1140 | struct hns3_nic_priv *priv = netdev_priv(netdev); |
| 1141 | + struct hns3_enet_coalesce *tx_coal = &priv->tx_coal; | |
| 1142 | + struct hns3_enet_coalesce *rx_coal = &priv->rx_coal; | |
| 1142 | 1143 | struct hnae3_handle *h = priv->ae_handle; |
| 1143 | − u16 queue_num = h->kinfo.num_tqps; | |
| 1144 | 1144 | |
| 1145 | 1145 | if (hns3_nic_resetting(netdev)) |
| 1146 | 1146 | return -EBUSY; |
| 1147 | 1147 | |
| 1148 | − if (queue >= queue_num) { | |
| 1149 | − netdev_err(netdev, | |
| 1150 | − "Invalid queue value %u! Queue max id=%u\n", | |
| 1151 | − queue, queue_num - 1); | |
| 1152 | − return -EINVAL; | |
| 1153 | − } | |
| 1154 | − | |
| 1155 | − tx_vector = priv->ring[queue].tqp_vector; | |
| 1156 | − rx_vector = priv->ring[queue_num + queue].tqp_vector; | |
| 1148 | + cmd->use_adaptive_tx_coalesce = tx_coal->adapt_enable; | |
| 1149 | + cmd->use_adaptive_rx_coalesce = rx_coal->adapt_enable; | |
| 1157 | 1150 | |
| 1158 | − cmd->use_adaptive_tx_coalesce = | |
| 1159 | − tx_vector->tx_group.coal.adapt_enable; | |
| 1160 | − cmd->use_adaptive_rx_coalesce = | |
| 1161 | − rx_vector->rx_group.coal.adapt_enable; | |
| 1162 | − | |
| 1163 | − cmd->tx_coalesce_usecs = tx_vector->tx_group.coal.int_gl; | |
| 1164 | − cmd->rx_coalesce_usecs = rx_vector->rx_group.coal.int_gl; | |
| 1151 | + cmd->tx_coalesce_usecs = tx_coal->int_gl; | |
| 1152 | + cmd->rx_coalesce_usecs = rx_coal->int_gl; | |
| 1165 | 1153 | |
| 1166 | 1154 | cmd->tx_coalesce_usecs_high = h->kinfo.int_rl_setting; |
| 1167 | 1155 | cmd->rx_coalesce_usecs_high = h->kinfo.int_rl_setting; |
| 1168 | 1156 | |
| 1169 | − cmd->tx_max_coalesced_frames = tx_vector->tx_group.coal.int_ql; | |
| 1170 | − cmd->rx_max_coalesced_frames = rx_vector->rx_group.coal.int_ql; | |
| 1157 | + cmd->tx_max_coalesced_frames = tx_coal->int_ql; | |
| 1158 | + cmd->rx_max_coalesced_frames = rx_coal->int_ql; | |
| 1171 | 1159 | |
| 1172 | 1160 | return 0; |
| 1173 | 1161 | } |
| 1174 | 1162 | |
| 1175 | −static int hns3_get_coalesce(struct net_device *netdev, | |
| 1176 | − struct ethtool_coalesce *cmd) | |
| 1177 | −{ | |
| 1178 | − return hns3_get_coalesce_per_queue(netdev, 0, cmd); | |
| 1179 | −} | |
| 1180 | − | |
| 1181 | 1163 | static int hns3_check_gl_coalesce_para(struct net_device *netdev, |
| 1182 | 1164 | struct ethtool_coalesce *cmd) |
| 1183 | 1165 | { |
| @@ -1292,19 +1274,7 @@ static int hns3_check_coalesce_para(struct net_device *netdev, · 108 unmodified lines | ||
| 1292 | 1274 | return ret; |
| 1293 | 1275 | } |
| 1294 | 1276 | |
| 1295 | − ret = hns3_check_ql_coalesce_param(netdev, cmd); | |
| 1296 | − if (ret) | |
| 1297 | − return ret; | |
| 1298 | − | |
| 1299 | − if (cmd->use_adaptive_tx_coalesce == 1 || | |
| 1300 | − cmd->use_adaptive_rx_coalesce == 1) { | |
| 1301 | − netdev_info(netdev, | |
| 1302 | − "adaptive-tx=%u and adaptive-rx=%u, tx_usecs or rx_usecs will changed dynamically.\n", | |
| 1303 | − cmd->use_adaptive_tx_coalesce, | |
| 1304 | − cmd->use_adaptive_rx_coalesce); | |
| 1305 | − } | |
| 1306 | − | |
| 1307 | − return 0; | |
| 1277 | + return hns3_check_ql_coalesce_param(netdev, cmd); | |
| 1308 | 1278 | } |
| 1309 | 1279 | |
| 1310 | 1280 | static void hns3_set_coalesce_per_queue(struct net_device *netdev, |
| @@ -1350,6 +1320,9 @@ static int hns3_set_coalesce(struct net_device *netdev, · 39 unmodified lines | ||
| 1350 | 1320 | struct ethtool_coalesce *cmd) |
| 1351 | 1321 | { |
| 1352 | 1322 | struct hnae3_handle *h = hns3_get_handle(netdev); |
| 1323 | + struct hns3_nic_priv *priv = netdev_priv(netdev); | |
| 1324 | + struct hns3_enet_coalesce *tx_coal = &priv->tx_coal; | |
| 1325 | + struct hns3_enet_coalesce *rx_coal = &priv->rx_coal; | |
| 1353 | 1326 | u16 queue_num = h->kinfo.num_tqps; |
| 1354 | 1327 | int ret; |
| 1355 | 1328 | int i; |
| @@ -1364,6 +1337,15 @@ static int hns3_set_coalesce(struct net_device *netdev, · 8 unmodified lines | ||
| 1364 | 1337 | h->kinfo.int_rl_setting = |
| 1365 | 1338 | hns3_rl_round_down(cmd->rx_coalesce_usecs_high); |
| 1366 | 1339 | |
| 1340 | + tx_coal->adapt_enable = cmd->use_adaptive_tx_coalesce; | |
| 1341 | + rx_coal->adapt_enable = cmd->use_adaptive_rx_coalesce; | |
| 1342 | + | |
| 1343 | + tx_coal->int_gl = cmd->tx_coalesce_usecs; | |
| 1344 | + rx_coal->int_gl = cmd->rx_coalesce_usecs; | |
| 1345 | + | |
| 1346 | + tx_coal->int_ql = cmd->tx_max_coalesced_frames; | |
| 1347 | + rx_coal->int_ql = cmd->rx_max_coalesced_frames; | |
| 1348 | + | |
| 1367 | 1349 | for (i = 0; i < queue_num; i++) |
| 1368 | 1350 | hns3_set_coalesce_per_queue(netdev, cmd, i); |
| 1369 | 1351 | |
| @@ -710,7 +710,6 @@ void hclge_mbx_handler(struct hclge_dev *hdev) · 709 unmodified lines | ||
| 710 | 710 | unsigned int flag; |
| 711 | 711 | int ret = 0; |
| 712 | 712 | |
| 713 | − memset(&resp_msg, 0, sizeof(resp_msg)); | |
| 714 | 713 | /* handle all the mailbox requests in the queue */ |
| 715 | 714 | while (!hclge_cmd_crq_empty(&hdev->hw)) { |
| 716 | 715 | if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) { |
| @@ -738,6 +737,9 @@ void hclge_mbx_handler(struct hclge_dev *hdev) · 21 unmodified lines | ||
| 738 | 737 | |
| 739 | 738 | trace_hclge_pf_mbx_get(hdev, req); |
| 740 | 739 | |
| 740 | + /* clear the resp_msg before processing every mailbox message */ | |
| 741 | + memset(&resp_msg, 0, sizeof(resp_msg)); | |
| 742 | + | |
| 741 | 743 | switch (req->msg.code) { |
| 742 | 744 | case HCLGE_MBX_MAP_RING_TO_VECTOR: |
| 743 | 745 | ret = hclge_map_unmap_ring_to_vf_vector(vport, true, |
| @@ -2313,15 +2313,20 @@ static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp) · 2312 unmodified lines | ||
| 2313 | 2313 | case XDP_TX: |
| 2314 | 2314 | xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index]; |
| 2315 | 2315 | result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring); |
| 2316 | + if (result == I40E_XDP_CONSUMED) | |
| 2317 | + goto out_failure; | |
| 2316 | 2318 | break; |
| 2317 | 2319 | case XDP_REDIRECT: |
| 2318 | 2320 | err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); |
| 2319 | − result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; | |
| 2321 | + if (err) | |
| 2322 | + goto out_failure; | |
| 2323 | + result = I40E_XDP_REDIR; | |
| 2320 | 2324 | break; |
| 2321 | 2325 | default: |
| 2322 | 2326 | bpf_warn_invalid_xdp_action(act); |
| 2323 | 2327 | fallthrough; |
| 2324 | 2328 | case XDP_ABORTED: |
| 2329 | +out_failure: | |
| 2325 | 2330 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 2326 | 2331 | fallthrough; /* handle aborts by dropping packet */ |
| 2327 | 2332 | case XDP_DROP: |
| @@ -162,9 +162,10 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) · 161 unmodified lines | ||
| 162 | 162 | |
| 163 | 163 | if (likely(act == XDP_REDIRECT)) { |
| 164 | 164 | err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); |
| 165 | − result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; | |
| 165 | + if (err) | |
| 166 | + goto out_failure; | |
| 166 | 167 | rcu_read_unlock(); |
| 167 | − return result; | |
| 168 | + return I40E_XDP_REDIR; | |
| 168 | 169 | } |
| 169 | 170 | |
| 170 | 171 | switch (act) { |
| @@ -173,11 +174,14 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) · 2 unmodified lines | ||
| 173 | 174 | case XDP_TX: |
| 174 | 175 | xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index]; |
| 175 | 176 | result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring); |
| 177 | + if (result == I40E_XDP_CONSUMED) | |
| 178 | + goto out_failure; | |
| 176 | 179 | break; |
| 177 | 180 | default: |
| 178 | 181 | bpf_warn_invalid_xdp_action(act); |
| 179 | 182 | fallthrough; |
| 180 | 183 | case XDP_ABORTED: |
| 184 | +out_failure: | |
| 181 | 185 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 182 | 186 | fallthrough; /* handle aborts by dropping packet */ |
| 183 | 187 | case XDP_DROP: |
| @@ -335,6 +335,7 @@ struct ice_vsi { · 334 unmodified lines | ||
| 335 | 335 | struct ice_tc_cfg tc_cfg; |
| 336 | 336 | struct bpf_prog *xdp_prog; |
| 337 | 337 | struct ice_ring **xdp_rings; /* XDP ring array */ |
| 338 | + unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */ | |
| 338 | 339 | u16 num_xdp_txq; /* Used XDP queues */ |
| 339 | 340 | u8 xdp_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */ |
| 340 | 341 | |
| @@ -547,15 +548,16 @@ static inline void ice_set_ring_xdp(struct ice_ring *ring) · 206 unmodified lines | ||
| 547 | 548 | */ |
| 548 | 549 | static inline struct xsk_buff_pool *ice_xsk_pool(struct ice_ring *ring) |
| 549 | 550 | { |
| 551 | + struct ice_vsi *vsi = ring->vsi; | |
| 550 | 552 | u16 qid = ring->q_index; |
| 551 | 553 | |
| 552 | 554 | if (ice_ring_is_xdp(ring)) |
| 553 | − qid -= ring->vsi->num_xdp_txq; | |
| 555 | + qid -= vsi->num_xdp_txq; | |
| 554 | 556 | |
| 555 | − if (!ice_is_xdp_ena_vsi(ring->vsi)) | |
| 557 | + if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps)) | |
| 556 | 558 | return NULL; |
| 557 | 559 | |
| 558 | − return xsk_get_pool_from_qid(ring->vsi->netdev, qid); | |
| 560 | + return xsk_get_pool_from_qid(vsi->netdev, qid); | |
| 559 | 561 | } |
| 560 | 562 | |
| 561 | 563 | /** |
| @@ -1773,49 +1773,6 @@ ice_phy_type_to_ethtool(struct net_device *netdev, · 1772 unmodified lines | ||
| 1773 | 1773 | ice_ethtool_advertise_link_mode(ICE_AQ_LINK_SPEED_100GB, |
| 1774 | 1774 | 100000baseKR4_Full); |
| 1775 | 1775 | } |
| 1776 | − | |
| 1777 | − /* Autoneg PHY types */ | |
| 1778 | − if (phy_types_low & ICE_PHY_TYPE_LOW_100BASE_TX || | |
| 1779 | − phy_types_low & ICE_PHY_TYPE_LOW_1000BASE_T || | |
| 1780 | − phy_types_low & ICE_PHY_TYPE_LOW_1000BASE_KX || | |
| 1781 | − phy_types_low & ICE_PHY_TYPE_LOW_2500BASE_T || | |
| 1782 | − phy_types_low & ICE_PHY_TYPE_LOW_2500BASE_KX || | |
| 1783 | − phy_types_low & ICE_PHY_TYPE_LOW_5GBASE_T || | |
| 1784 | − phy_types_low & ICE_PHY_TYPE_LOW_5GBASE_KR || | |
| 1785 | − phy_types_low & ICE_PHY_TYPE_LOW_10GBASE_T || | |
| 1786 | − phy_types_low & ICE_PHY_TYPE_LOW_10GBASE_KR_CR1 || | |
| 1787 | − phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_T || | |
| 1788 | − phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR || | |
| 1789 | − phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR_S || | |
| 1790 | − phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR1 || | |
| 1791 | − phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR || | |
| 1792 | − phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR_S || | |
| 1793 | − phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR1 || | |
| 1794 | − phy_types_low & ICE_PHY_TYPE_LOW_40GBASE_CR4 || | |
| 1795 | − phy_types_low & ICE_PHY_TYPE_LOW_40GBASE_KR4) { | |
| 1796 | − ethtool_link_ksettings_add_link_mode(ks, supported, | |
| 1797 | − Autoneg); | |
| 1798 | − ethtool_link_ksettings_add_link_mode(ks, advertising, | |
| 1799 | − Autoneg); | |
| 1800 | − } | |
| 1801 | − if (phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_CR2 || | |
| 1802 | − phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_KR2 || | |
| 1803 | − phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_CP || | |
| 1804 | − phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4) { | |
| 1805 | − ethtool_link_ksettings_add_link_mode(ks, supported, | |
| 1806 | − Autoneg); | |
| 1807 | − ethtool_link_ksettings_add_link_mode(ks, advertising, | |
| 1808 | − Autoneg); | |
| 1809 | − } | |
| 1810 | − if (phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_CR4 || | |
| 1811 | − phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_KR4 || | |
| 1812 | − phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4 || | |
| 1813 | − phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_CP2) { | |
| 1814 | − ethtool_link_ksettings_add_link_mode(ks, supported, | |
| 1815 | − Autoneg); | |
| 1816 | − ethtool_link_ksettings_add_link_mode(ks, advertising, | |
| 1817 | − Autoneg); | |
| 1818 | − } | |
| 1819 | 1776 | } |
| 1820 | 1777 | |
| 1821 | 1778 | #define TEST_SET_BITS_TIMEOUT 50 |
| @@ -1972,9 +1929,7 @@ ice_get_link_ksettings(struct net_device *netdev, · 150 unmodified lines | ||
| 1972 | 1929 | ks->base.port = PORT_TP; |
| 1973 | 1930 | break; |
| 1974 | 1931 | case ICE_MEDIA_BACKPLANE: |
| 1975 | − ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg); | |
| 1976 | 1932 | ethtool_link_ksettings_add_link_mode(ks, supported, Backplane); |
| 1977 | − ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg); | |
| 1978 | 1933 | ethtool_link_ksettings_add_link_mode(ks, advertising, |
| 1979 | 1934 | Backplane); |
| 1980 | 1935 | ks->base.port = PORT_NONE; |
| @@ -2049,6 +2004,12 @@ ice_get_link_ksettings(struct net_device *netdev, · 68 unmodified lines | ||
| 2049 | 2004 | if (caps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN) |
| 2050 | 2005 | ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS); |
| 2051 | 2006 | |
| 2007 | + /* Set supported and advertised autoneg */ | |
| 2008 | + if (ice_is_phy_caps_an_enabled(caps)) { | |
| 2009 | + ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg); | |
| 2010 | + ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg); | |
| 2011 | + } | |
| 2012 | + | |
| 2052 | 2013 | done: |
| 2053 | 2014 | kfree(caps); |
| 2054 | 2015 | return err; |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | #define PF_FW_ATQLEN_ATQOVFL_M BIT(29) |
| 32 | 32 | #define PF_FW_ATQLEN_ATQCRIT_M BIT(30) |
| 33 | 33 | #define VF_MBX_ARQLEN(_VF) (0x0022BC00 + ((_VF) * 4)) |
| 34 | +#define VF_MBX_ATQLEN(_VF) (0x0022A800 + ((_VF) * 4)) | |
| 34 | 35 | #define PF_FW_ATQLEN_ATQENABLE_M BIT(31) |
| 35 | 36 | #define PF_FW_ATQT 0x00080400 |
| 36 | 37 | #define PF_MBX_ARQBAH 0x0022E400 |
| @@ -105,8 +105,14 @@ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi) · 104 unmodified lines | ||
| 105 | 105 | if (!vsi->q_vectors) |
| 106 | 106 | goto err_vectors; |
| 107 | 107 | |
| 108 | + vsi->af_xdp_zc_qps = bitmap_zalloc(max_t(int, vsi->alloc_txq, vsi->alloc_rxq), GFP_KERNEL); | |
| 109 | + if (!vsi->af_xdp_zc_qps) | |
| 110 | + goto err_zc_qps; | |
| 111 | + | |
| 108 | 112 | return 0; |
| 109 | 113 | |
| 114 | +err_zc_qps: | |
| 115 | + devm_kfree(dev, vsi->q_vectors); | |
| 110 | 116 | err_vectors: |
| 111 | 117 | devm_kfree(dev, vsi->rxq_map); |
| 112 | 118 | err_rxq_map: |
| @@ -194,6 +200,8 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id) · 81 unmodified lines | ||
| 194 | 200 | break; |
| 195 | 201 | case ICE_VSI_VF: |
| 196 | 202 | vf = &pf->vf[vsi->vf_id]; |
| 203 | + if (vf->num_req_qs) | |
| 204 | + vf->num_vf_qs = vf->num_req_qs; | |
| 197 | 205 | vsi->alloc_txq = vf->num_vf_qs; |
| 198 | 206 | vsi->alloc_rxq = vf->num_vf_qs; |
| 199 | 207 | /* pf->num_msix_per_vf includes (VF miscellaneous vector + |
| @@ -288,6 +296,10 @@ static void ice_vsi_free_arrays(struct ice_vsi *vsi) · 88 unmodified lines | ||
| 288 | 296 | |
| 289 | 297 | dev = ice_pf_to_dev(pf); |
| 290 | 298 | |
| 299 | + if (vsi->af_xdp_zc_qps) { | |
| 300 | + bitmap_free(vsi->af_xdp_zc_qps); | |
| 301 | + vsi->af_xdp_zc_qps = NULL; | |
| 302 | + } | |
| 291 | 303 | /* free the ring and vector containers */ |
| 292 | 304 | if (vsi->q_vectors) { |
| 293 | 305 | devm_kfree(dev, vsi->q_vectors); |
| @@ -1705,12 +1717,13 @@ setup_rings: · 1411 unmodified lines | ||
| 1705 | 1717 | * ice_vsi_cfg_txqs - Configure the VSI for Tx |
| 1706 | 1718 | * @vsi: the VSI being configured |
| 1707 | 1719 | * @rings: Tx ring array to be configured |
| 1720 | + * @count: number of Tx ring array elements | |
| 1708 | 1721 | * |
| 1709 | 1722 | * Return 0 on success and a negative value on error |
| 1710 | 1723 | * Configure the Tx VSI for operation. |
| 1711 | 1724 | */ |
| 1712 | 1725 | static int |
| 1713 | −ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings) | |
| 1726 | +ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings, u16 count) | |
| 1714 | 1727 | { |
| 1715 | 1728 | struct ice_aqc_add_tx_qgrp *qg_buf; |
| 1716 | 1729 | u16 q_idx = 0; |
| @@ -1722,7 +1735,7 @@ ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings) · 5 unmodified lines | ||
| 1722 | 1735 | |
| 1723 | 1736 | qg_buf->num_txqs = 1; |
| 1724 | 1737 | |
| 1725 | − for (q_idx = 0; q_idx < vsi->num_txq; q_idx++) { | |
| 1738 | + for (q_idx = 0; q_idx < count; q_idx++) { | |
| 1726 | 1739 | err = ice_vsi_cfg_txq(vsi, rings[q_idx], qg_buf); |
| 1727 | 1740 | if (err) |
| 1728 | 1741 | goto err_cfg_txqs; |
| @@ -1742,7 +1755,7 @@ err_cfg_txqs: · 13 unmodified lines | ||
| 1742 | 1755 | */ |
| 1743 | 1756 | int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi) |
| 1744 | 1757 | { |
| 1745 | − return ice_vsi_cfg_txqs(vsi, vsi->tx_rings); | |
| 1758 | + return ice_vsi_cfg_txqs(vsi, vsi->tx_rings, vsi->num_txq); | |
| 1746 | 1759 | } |
| 1747 | 1760 | |
| 1748 | 1761 | /** |
| @@ -1757,7 +1770,7 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi) · 8 unmodified lines | ||
| 1757 | 1770 | int ret; |
| 1758 | 1771 | int i; |
| 1759 | 1772 | |
| 1760 | − ret = ice_vsi_cfg_txqs(vsi, vsi->xdp_rings); | |
| 1773 | + ret = ice_vsi_cfg_txqs(vsi, vsi->xdp_rings, vsi->num_xdp_txq); | |
| 1761 | 1774 | if (ret) |
| 1762 | 1775 | return ret; |
| 1763 | 1776 | |
| @@ -1997,17 +2010,18 @@ int ice_vsi_stop_all_rx_rings(struct ice_vsi *vsi) · 233 unmodified lines | ||
| 1997 | 2010 | * @rst_src: reset source |
| 1998 | 2011 | * @rel_vmvf_num: Relative ID of VF/VM |
| 1999 | 2012 | * @rings: Tx ring array to be stopped |
| 2013 | + * @count: number of Tx ring array elements | |
| 2000 | 2014 | */ |
| 2001 | 2015 | static int |
| 2002 | 2016 | ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, |
| 2003 | − u16 rel_vmvf_num, struct ice_ring **rings) | |
| 2017 | + u16 rel_vmvf_num, struct ice_ring **rings, u16 count) | |
| 2004 | 2018 | { |
| 2005 | 2019 | u16 q_idx; |
| 2006 | 2020 | |
| 2007 | 2021 | if (vsi->num_txq > ICE_LAN_TXQ_MAX_QDIS) |
| 2008 | 2022 | return -EINVAL; |
| 2009 | 2023 | |
| 2010 | − for (q_idx = 0; q_idx < vsi->num_txq; q_idx++) { | |
| 2024 | + for (q_idx = 0; q_idx < count; q_idx++) { | |
| 2011 | 2025 | struct ice_txq_meta txq_meta = { }; |
| 2012 | 2026 | int status; |
| 2013 | 2027 | |
| @@ -2035,7 +2049,7 @@ int · 21 unmodified lines | ||
| 2035 | 2049 | ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, |
| 2036 | 2050 | u16 rel_vmvf_num) |
| 2037 | 2051 | { |
| 2038 | − return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings); | |
| 2052 | + return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings, vsi->num_txq); | |
| 2039 | 2053 | } |
| 2040 | 2054 | |
| 2041 | 2055 | /** |
| @@ -2044,7 +2058,7 @@ ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, · 2 unmodified lines | ||
| 2044 | 2058 | */ |
| 2045 | 2059 | int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi) |
| 2046 | 2060 | { |
| 2047 | − return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings); | |
| 2061 | + return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings, vsi->num_xdp_txq); | |
| 2048 | 2062 | } |
| 2049 | 2063 | |
| 2050 | 2064 | /** |
| @@ -2555,6 +2555,20 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, · 2554 unmodified lines | ||
| 2555 | 2555 | return (ret || xdp_ring_err) ? -ENOMEM : 0; |
| 2556 | 2556 | } |
| 2557 | 2557 | |
| 2558 | +/** | |
| 2559 | + * ice_xdp_safe_mode - XDP handler for safe mode | |
| 2560 | + * @dev: netdevice | |
| 2561 | + * @xdp: XDP command | |
| 2562 | + */ | |
| 2563 | +static int ice_xdp_safe_mode(struct net_device __always_unused *dev, | |
| 2564 | + struct netdev_bpf *xdp) | |
| 2565 | +{ | |
| 2566 | + NL_SET_ERR_MSG_MOD(xdp->extack, | |
| 2567 | + "Please provide working DDP firmware package in order to use XDP\n" | |
| 2568 | + "Refer to Documentation/networking/device_drivers/ethernet/intel/ice.rst"); | |
| 2569 | + return -EOPNOTSUPP; | |
| 2570 | +} | |
| 2571 | + | |
| 2558 | 2572 | /** |
| 2559 | 2573 | * ice_xdp - implements XDP handler |
| 2560 | 2574 | * @dev: netdevice |
| @@ -6937,6 +6951,7 @@ static const struct net_device_ops ice_netdev_safe_mode_ops = { · 4376 unmodified lines | ||
| 6937 | 6951 | .ndo_change_mtu = ice_change_mtu, |
| 6938 | 6952 | .ndo_get_stats64 = ice_get_stats64, |
| 6939 | 6953 | .ndo_tx_timeout = ice_tx_timeout, |
| 6954 | + .ndo_bpf = ice_xdp_safe_mode, | |
| 6940 | 6955 | }; |
| 6941 | 6956 | |
| 6942 | 6957 | static const struct net_device_ops ice_netdev_ops = { |
| @@ -523,7 +523,7 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, · 522 unmodified lines | ||
| 523 | 523 | struct bpf_prog *xdp_prog) |
| 524 | 524 | { |
| 525 | 525 | struct ice_ring *xdp_ring; |
| 526 | − int err; | |
| 526 | + int err, result; | |
| 527 | 527 | u32 act; |
| 528 | 528 | |
| 529 | 529 | act = bpf_prog_run_xdp(xdp_prog, xdp); |
| @@ -532,14 +532,20 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, · 2 unmodified lines | ||
| 532 | 532 | return ICE_XDP_PASS; |
| 533 | 533 | case XDP_TX: |
| 534 | 534 | xdp_ring = rx_ring->vsi->xdp_rings[smp_processor_id()]; |
| 535 | − return ice_xmit_xdp_buff(xdp, xdp_ring); | |
| 535 | + result = ice_xmit_xdp_buff(xdp, xdp_ring); | |
| 536 | + if (result == ICE_XDP_CONSUMED) | |
| 537 | + goto out_failure; | |
| 538 | + return result; | |
| 536 | 539 | case XDP_REDIRECT: |
| 537 | 540 | err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); |
| 538 | − return !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; | |
| 541 | + if (err) | |
| 542 | + goto out_failure; | |
| 543 | + return ICE_XDP_REDIR; | |
| 539 | 544 | default: |
| 540 | 545 | bpf_warn_invalid_xdp_action(act); |
| 541 | 546 | fallthrough; |
| 542 | 547 | case XDP_ABORTED: |
| 548 | +out_failure: | |
| 543 | 549 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 544 | 550 | fallthrough; |
| 545 | 551 | case XDP_DROP: |
| @@ -2143,6 +2149,7 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) · 1597 unmodified lines | ||
| 2143 | 2149 | struct ice_tx_offload_params offload = { 0 }; |
| 2144 | 2150 | struct ice_vsi *vsi = tx_ring->vsi; |
| 2145 | 2151 | struct ice_tx_buf *first; |
| 2152 | + struct ethhdr *eth; | |
| 2146 | 2153 | unsigned int count; |
| 2147 | 2154 | int tso, csum; |
| 2148 | 2155 | |
| @@ -2189,7 +2196,9 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) · 40 unmodified lines | ||
| 2189 | 2196 | goto out_drop; |
| 2190 | 2197 | |
| 2191 | 2198 | /* allow CONTROL frames egress from main VSI if FW LLDP disabled */ |
| 2192 | − if (unlikely(skb->priority == TC_PRIO_CONTROL && | |
| 2199 | + eth = (struct ethhdr *)skb_mac_header(skb); | |
| 2200 | + if (unlikely((skb->priority == TC_PRIO_CONTROL || | |
| 2201 | + eth->h_proto == htons(ETH_P_LLDP)) && | |
| 2193 | 2202 | vsi->type == ICE_VSI_PF && |
| 2194 | 2203 | vsi->port_info->qos_cfg.is_sw_lldp)) |
| 2195 | 2204 | offload.cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX | |
| @@ -713,13 +713,15 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr) · 712 unmodified lines | ||
| 713 | 713 | */ |
| 714 | 714 | clear_bit(ICE_VF_STATE_INIT, vf->vf_states); |
| 715 | 715 | |
| 716 | − /* VF_MBX_ARQLEN is cleared by PFR, so the driver needs to clear it | |
| 717 | − * in the case of VFR. If this is done for PFR, it can mess up VF | |
| 718 | − * resets because the VF driver may already have started cleanup | |
| 719 | − * by the time we get here. | |
| 716 | + /* VF_MBX_ARQLEN and VF_MBX_ATQLEN are cleared by PFR, so the driver | |
| 717 | + * needs to clear them in the case of VFR/VFLR. If this is done for | |
| 718 | + * PFR, it can mess up VF resets because the VF driver may already | |
| 719 | + * have started cleanup by the time we get here. | |
| 720 | 720 | */ |
| 721 | − if (!is_pfr) | |
| 721 | + if (!is_pfr) { | |
| 722 | 722 | wr32(hw, VF_MBX_ARQLEN(vf->vf_id), 0); |
| 723 | + wr32(hw, VF_MBX_ATQLEN(vf->vf_id), 0); | |
| 724 | + } | |
| 723 | 725 | |
| 724 | 726 | /* In the case of a VFLR, the HW has already reset the VF and we |
| 725 | 727 | * just need to clean up, so don't hit the VFRTRIG register. |
| @@ -1698,7 +1700,12 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) · 972 unmodified lines | ||
| 1698 | 1700 | ice_vf_ctrl_vsi_release(vf); |
| 1699 | 1701 | |
| 1700 | 1702 | ice_vf_pre_vsi_rebuild(vf); |
| 1701 | − ice_vf_rebuild_vsi_with_release(vf); | |
| 1703 | + | |
| 1704 | + if (ice_vf_rebuild_vsi_with_release(vf)) { | |
| 1705 | + dev_err(dev, "Failed to release and setup the VF%u's VSI\n", vf->vf_id); | |
| 1706 | + return false; | |
| 1707 | + } | |
| 1708 | + | |
| 1702 | 1709 | ice_vf_post_vsi_rebuild(vf); |
| 1703 | 1710 | |
| 1704 | 1711 | /* if the VF has been reset allow it to come up again */ |
| @@ -270,6 +270,7 @@ static int ice_xsk_pool_disable(struct ice_vsi *vsi, u16 qid) · 269 unmodified lines | ||
| 270 | 270 | if (!pool) |
| 271 | 271 | return -EINVAL; |
| 272 | 272 | |
| 273 | + clear_bit(qid, vsi->af_xdp_zc_qps); | |
| 273 | 274 | xsk_pool_dma_unmap(pool, ICE_RX_DMA_ATTR); |
| 274 | 275 | |
| 275 | 276 | return 0; |
| @@ -300,6 +301,8 @@ ice_xsk_pool_enable(struct ice_vsi *vsi, struct xsk_buff_pool *pool, u16 qid) · 24 unmodified lines | ||
| 300 | 301 | if (err) |
| 301 | 302 | return err; |
| 302 | 303 | |
| 304 | + set_bit(qid, vsi->af_xdp_zc_qps); | |
| 305 | + | |
| 303 | 306 | return 0; |
| 304 | 307 | } |
| 305 | 308 | |
| @@ -473,9 +476,10 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) · 167 unmodified lines | ||
| 473 | 476 | |
| 474 | 477 | if (likely(act == XDP_REDIRECT)) { |
| 475 | 478 | err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); |
| 476 | − result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; | |
| 479 | + if (err) | |
| 480 | + goto out_failure; | |
| 477 | 481 | rcu_read_unlock(); |
| 478 | − return result; | |
| 482 | + return ICE_XDP_REDIR; | |
| 479 | 483 | } |
| 480 | 484 | |
| 481 | 485 | switch (act) { |
| @@ -484,11 +488,14 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) · 2 unmodified lines | ||
| 484 | 488 | case XDP_TX: |
| 485 | 489 | xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->q_index]; |
| 486 | 490 | result = ice_xmit_xdp_buff(xdp, xdp_ring); |
| 491 | + if (result == ICE_XDP_CONSUMED) | |
| 492 | + goto out_failure; | |
| 487 | 493 | break; |
| 488 | 494 | default: |
| 489 | 495 | bpf_warn_invalid_xdp_action(act); |
| 490 | 496 | fallthrough; |
| 491 | 497 | case XDP_ABORTED: |
| 498 | +out_failure: | |
| 492 | 499 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 493 | 500 | fallthrough; |
| 494 | 501 | case XDP_DROP: |
| @@ -749,7 +749,7 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter); · 748 unmodified lines | ||
| 749 | 749 | void igb_ptp_tx_hang(struct igb_adapter *adapter); |
| 750 | 750 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb); |
| 751 | 751 | int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, |
| 752 | − struct sk_buff *skb); | |
| 752 | + ktime_t *timestamp); | |
| 753 | 753 | int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); |
| 754 | 754 | int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); |
| 755 | 755 | void igb_set_flag_queue_pairs(struct igb_adapter *, const u32); |
| @@ -8280,7 +8280,7 @@ static void igb_add_rx_frag(struct igb_ring *rx_ring, · 8279 unmodified lines | ||
| 8280 | 8280 | static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring, |
| 8281 | 8281 | struct igb_rx_buffer *rx_buffer, |
| 8282 | 8282 | struct xdp_buff *xdp, |
| 8283 | − union e1000_adv_rx_desc *rx_desc) | |
| 8283 | + ktime_t timestamp) | |
| 8284 | 8284 | { |
| 8285 | 8285 | #if (PAGE_SIZE < 8192) |
| 8286 | 8286 | unsigned int truesize = igb_rx_pg_size(rx_ring) / 2; |
| @@ -8300,12 +8300,8 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring, · 13 unmodified lines | ||
| 8300 | 8300 | if (unlikely(!skb)) |
| 8301 | 8301 | return NULL; |
| 8302 | 8302 | |
| 8303 | − if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) { | |
| 8304 | − if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb)) { | |
| 8305 | − xdp->data += IGB_TS_HDR_LEN; | |
| 8306 | − size -= IGB_TS_HDR_LEN; | |
| 8307 | − } | |
| 8308 | − } | |
| 8303 | + if (timestamp) | |
| 8304 | + skb_hwtstamps(skb)->hwtstamp = timestamp; | |
| 8309 | 8305 | |
| 8310 | 8306 | /* Determine available headroom for copy */ |
| 8311 | 8307 | headlen = size; |
| @@ -8336,7 +8332,7 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring, · 24 unmodified lines | ||
| 8336 | 8332 | static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring, |
| 8337 | 8333 | struct igb_rx_buffer *rx_buffer, |
| 8338 | 8334 | struct xdp_buff *xdp, |
| 8339 | − union e1000_adv_rx_desc *rx_desc) | |
| 8335 | + ktime_t timestamp) | |
| 8340 | 8336 | { |
| 8341 | 8337 | #if (PAGE_SIZE < 8192) |
| 8342 | 8338 | unsigned int truesize = igb_rx_pg_size(rx_ring) / 2; |
| @@ -8363,11 +8359,8 @@ static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring, · 20 unmodified lines | ||
| 8363 | 8359 | if (metasize) |
| 8364 | 8360 | skb_metadata_set(skb, metasize); |
| 8365 | 8361 | |
| 8366 | − /* pull timestamp out of packet data */ | |
| 8367 | − if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { | |
| 8368 | − if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb)) | |
| 8369 | − __skb_pull(skb, IGB_TS_HDR_LEN); | |
| 8370 | − } | |
| 8362 | + if (timestamp) | |
| 8363 | + skb_hwtstamps(skb)->hwtstamp = timestamp; | |
| 8371 | 8364 | |
| 8372 | 8365 | /* update buffer offset */ |
| 8373 | 8366 | #if (PAGE_SIZE < 8192) |
| @@ -8401,18 +8394,20 @@ static struct sk_buff *igb_run_xdp(struct igb_adapter *adapter, · 27 unmodified lines | ||
| 8401 | 8394 | break; |
| 8402 | 8395 | case XDP_TX: |
| 8403 | 8396 | result = igb_xdp_xmit_back(adapter, xdp); |
| 8397 | + if (result == IGB_XDP_CONSUMED) | |
| 8398 | + goto out_failure; | |
| 8404 | 8399 | break; |
| 8405 | 8400 | case XDP_REDIRECT: |
| 8406 | 8401 | err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog); |
| 8407 | − if (!err) | |
| 8408 | − result = IGB_XDP_REDIR; | |
| 8409 | − else | |
| 8410 | − result = IGB_XDP_CONSUMED; | |
| 8402 | + if (err) | |
| 8403 | + goto out_failure; | |
| 8404 | + result = IGB_XDP_REDIR; | |
| 8411 | 8405 | break; |
| 8412 | 8406 | default: |
| 8413 | 8407 | bpf_warn_invalid_xdp_action(act); |
| 8414 | 8408 | fallthrough; |
| 8415 | 8409 | case XDP_ABORTED: |
| 8410 | +out_failure: | |
| 8416 | 8411 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 8417 | 8412 | fallthrough; |
| 8418 | 8413 | case XDP_DROP: |
| @@ -8682,7 +8677,10 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 263 unmodified lines | ||
| 8682 | 8677 | while (likely(total_packets < budget)) { |
| 8683 | 8678 | union e1000_adv_rx_desc *rx_desc; |
| 8684 | 8679 | struct igb_rx_buffer *rx_buffer; |
| 8680 | + ktime_t timestamp = 0; | |
| 8681 | + int pkt_offset = 0; | |
| 8685 | 8682 | unsigned int size; |
| 8683 | + void *pktbuf; | |
| 8686 | 8684 | |
| 8687 | 8685 | /* return some buffers to hardware, one at a time is too slow */ |
| 8688 | 8686 | if (cleaned_count >= IGB_RX_BUFFER_WRITE) { |
| @@ -8702,14 +8700,24 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 13 unmodified lines | ||
| 8702 | 8700 | dma_rmb(); |
| 8703 | 8701 | |
| 8704 | 8702 | rx_buffer = igb_get_rx_buffer(rx_ring, size, &rx_buf_pgcnt); |
| 8703 | + pktbuf = page_address(rx_buffer->page) + rx_buffer->page_offset; | |
| 8704 | + | |
| 8705 | + /* pull rx packet timestamp if available and valid */ | |
| 8706 | + if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { | |
| 8707 | + int ts_hdr_len; | |
| 8708 | + | |
| 8709 | + ts_hdr_len = igb_ptp_rx_pktstamp(rx_ring->q_vector, | |
| 8710 | + pktbuf, ×tamp); | |
| 8711 | + | |
| 8712 | + pkt_offset += ts_hdr_len; | |
| 8713 | + size -= ts_hdr_len; | |
| 8714 | + } | |
| 8705 | 8715 | |
| 8706 | 8716 | /* retrieve a buffer from the ring */ |
| 8707 | 8717 | if (!skb) { |
| 8708 | − unsigned int offset = igb_rx_offset(rx_ring); | |
| 8709 | − unsigned char *hard_start; | |
| 8718 | + unsigned char *hard_start = pktbuf - igb_rx_offset(rx_ring); | |
| 8719 | + unsigned int offset = pkt_offset + igb_rx_offset(rx_ring); | |
| 8710 | 8720 | |
| 8711 | − hard_start = page_address(rx_buffer->page) + | |
| 8712 | − rx_buffer->page_offset - offset; | |
| 8713 | 8721 | xdp_prepare_buff(&xdp, hard_start, offset, size, true); |
| 8714 | 8722 | #if (PAGE_SIZE > 4096) |
| 8715 | 8723 | /* At larger PAGE_SIZE, frame_sz depend on len size */ |
| @@ -8732,10 +8740,11 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 16 unmodified lines | ||
| 8732 | 8740 | } else if (skb) |
| 8733 | 8741 | igb_add_rx_frag(rx_ring, rx_buffer, skb, size); |
| 8734 | 8742 | else if (ring_uses_build_skb(rx_ring)) |
| 8735 | − skb = igb_build_skb(rx_ring, rx_buffer, &xdp, rx_desc); | |
| 8743 | + skb = igb_build_skb(rx_ring, rx_buffer, &xdp, | |
| 8744 | + timestamp); | |
| 8736 | 8745 | else |
| 8737 | 8746 | skb = igb_construct_skb(rx_ring, rx_buffer, |
| 8738 | − &xdp, rx_desc); | |
| 8747 | + &xdp, timestamp); | |
| 8739 | 8748 | |
| 8740 | 8749 | /* exit if we failed to retrieve a buffer */ |
| 8741 | 8750 | if (!skb) { |
| @@ -856,30 +856,28 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) · 855 unmodified lines | ||
| 856 | 856 | dev_kfree_skb_any(skb); |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | −#define IGB_RET_PTP_DISABLED 1 | |
| 860 | −#define IGB_RET_PTP_INVALID 2 | |
| 861 | − | |
| 862 | 859 | /** |
| 863 | 860 | * igb_ptp_rx_pktstamp - retrieve Rx per packet timestamp |
| 864 | 861 | * @q_vector: Pointer to interrupt specific structure |
| 865 | 862 | * @va: Pointer to address containing Rx buffer |
| 866 | − * @skb: Buffer containing timestamp and packet | |
| 863 | + * @timestamp: Pointer where timestamp will be stored | |
| 867 | 864 | * |
| 868 | 865 | * This function is meant to retrieve a timestamp from the first buffer of an |
| 869 | 866 | * incoming frame. The value is stored in little endian format starting on |
| 870 | 867 | * byte 8 |
| 871 | 868 | * |
| 872 | − * Returns: 0 if success, nonzero if failure | |
| 869 | + * Returns: The timestamp header length or 0 if not available | |
| 873 | 870 | **/ |
| 874 | 871 | int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, |
| 875 | − struct sk_buff *skb) | |
| 872 | + ktime_t *timestamp) | |
| 876 | 873 | { |
| 877 | 874 | struct igb_adapter *adapter = q_vector->adapter; |
| 875 | + struct skb_shared_hwtstamps ts; | |
| 878 | 876 | __le64 *regval = (__le64 *)va; |
| 879 | 877 | int adjust = 0; |
| 880 | 878 | |
| 881 | 879 | if (!(adapter->ptp_flags & IGB_PTP_ENABLED)) |
| 882 | − return IGB_RET_PTP_DISABLED; | |
| 880 | + return 0; | |
| 883 | 881 | |
| 884 | 882 | /* The timestamp is recorded in little endian format. |
| 885 | 883 | * DWORD: 0 1 2 3 |
| @@ -888,10 +886,9 @@ int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 2 unmodified lines | ||
| 888 | 886 | |
| 889 | 887 | /* check reserved dwords are zero, be/le doesn't matter for zero */ |
| 890 | 888 | if (regval[0]) |
| 891 | − return IGB_RET_PTP_INVALID; | |
| 889 | + return 0; | |
| 892 | 890 | |
| 893 | − igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), | |
| 894 | − le64_to_cpu(regval[1])); | |
| 891 | + igb_ptp_systim_to_hwtstamp(adapter, &ts, le64_to_cpu(regval[1])); | |
| 895 | 892 | |
| 896 | 893 | /* adjust timestamp for the RX latency based on link speed */ |
| 897 | 894 | if (adapter->hw.mac.type == e1000_i210) { |
| @@ -907,10 +904,10 @@ int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 9 unmodified lines | ||
| 907 | 904 | break; |
| 908 | 905 | } |
| 909 | 906 | } |
| 910 | − skb_hwtstamps(skb)->hwtstamp = | |
| 911 | − ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust); | |
| 912 | 907 | |
| 913 | − return 0; | |
| 908 | + *timestamp = ktime_sub_ns(ts.hwtstamp, adjust); | |
| 909 | + | |
| 910 | + return IGB_TS_HDR_LEN; | |
| 914 | 911 | } |
| 915 | 912 | |
| 916 | 913 | /** |
| @@ -2047,20 +2047,19 @@ static struct sk_buff *igc_xdp_run_prog(struct igc_adapter *adapter, · 2046 unmodified lines | ||
| 2047 | 2047 | break; |
| 2048 | 2048 | case XDP_TX: |
| 2049 | 2049 | if (igc_xdp_xmit_back(adapter, xdp) < 0) |
| 2050 | − res = IGC_XDP_CONSUMED; | |
| 2051 | − else | |
| 2052 | − res = IGC_XDP_TX; | |
| 2050 | + goto out_failure; | |
| 2051 | + res = IGC_XDP_TX; | |
| 2053 | 2052 | break; |
| 2054 | 2053 | case XDP_REDIRECT: |
| 2055 | 2054 | if (xdp_do_redirect(adapter->netdev, xdp, prog) < 0) |
| 2056 | − res = IGC_XDP_CONSUMED; | |
| 2057 | − else | |
| 2058 | − res = IGC_XDP_REDIRECT; | |
| 2055 | + goto out_failure; | |
| 2056 | + res = IGC_XDP_REDIRECT; | |
| 2059 | 2057 | break; |
| 2060 | 2058 | default: |
| 2061 | 2059 | bpf_warn_invalid_xdp_action(act); |
| 2062 | 2060 | fallthrough; |
| 2063 | 2061 | case XDP_ABORTED: |
| 2062 | +out_failure: | |
| 2064 | 2063 | trace_xdp_exception(adapter->netdev, prog, act); |
| 2065 | 2064 | fallthrough; |
| 2066 | 2065 | case XDP_DROP: |
| @@ -2213,23 +2213,23 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter, · 2212 unmodified lines | ||
| 2213 | 2213 | break; |
| 2214 | 2214 | case XDP_TX: |
| 2215 | 2215 | xdpf = xdp_convert_buff_to_frame(xdp); |
| 2216 | − if (unlikely(!xdpf)) { | |
| 2217 | − result = IXGBE_XDP_CONSUMED; | |
| 2218 | − break; | |
| 2219 | − } | |
| 2216 | + if (unlikely(!xdpf)) | |
| 2217 | + goto out_failure; | |
| 2220 | 2218 | result = ixgbe_xmit_xdp_ring(adapter, xdpf); |
| 2219 | + if (result == IXGBE_XDP_CONSUMED) | |
| 2220 | + goto out_failure; | |
| 2221 | 2221 | break; |
| 2222 | 2222 | case XDP_REDIRECT: |
| 2223 | 2223 | err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog); |
| 2224 | − if (!err) | |
| 2225 | − result = IXGBE_XDP_REDIR; | |
| 2226 | − else | |
| 2227 | − result = IXGBE_XDP_CONSUMED; | |
| 2224 | + if (err) | |
| 2225 | + goto out_failure; | |
| 2226 | + result = IXGBE_XDP_REDIR; | |
| 2228 | 2227 | break; |
| 2229 | 2228 | default: |
| 2230 | 2229 | bpf_warn_invalid_xdp_action(act); |
| 2231 | 2230 | fallthrough; |
| 2232 | 2231 | case XDP_ABORTED: |
| 2232 | +out_failure: | |
| 2233 | 2233 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 2234 | 2234 | fallthrough; /* handle aborts by dropping packet */ |
| 2235 | 2235 | case XDP_DROP: |
| @@ -467,12 +467,16 @@ static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, · 466 unmodified lines | ||
| 467 | 467 | return err; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | −static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) | |
| 470 | +static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf) | |
| 471 | 471 | { |
| 472 | 472 | struct ixgbe_hw *hw = &adapter->hw; |
| 473 | − int max_frame = msgbuf[1]; | |
| 474 | 473 | u32 max_frs; |
| 475 | 474 | |
| 475 | + if (max_frame < ETH_MIN_MTU || max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE) { | |
| 476 | + e_err(drv, "VF max_frame %d out of range\n", max_frame); | |
| 477 | + return -EINVAL; | |
| 478 | + } | |
| 479 | + | |
| 476 | 480 | /* |
| 477 | 481 | * For 82599EB we have to keep all PFs and VFs operating with |
| 478 | 482 | * the same max_frame value in order to avoid sending an oversize |
| @@ -533,12 +537,6 @@ static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) · 54 unmodified lines | ||
| 533 | 537 | } |
| 534 | 538 | } |
| 535 | 539 | |
| 536 | − /* MTU < 68 is an error and causes problems on some kernels */ | |
| 537 | − if (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE) { | |
| 538 | − e_err(drv, "VF max_frame %d out of range\n", max_frame); | |
| 539 | − return -EINVAL; | |
| 540 | − } | |
| 541 | − | |
| 542 | 540 | /* pull current max frame size from hardware */ |
| 543 | 541 | max_frs = IXGBE_READ_REG(hw, IXGBE_MAXFRS); |
| 544 | 542 | max_frs &= IXGBE_MHADD_MFS_MASK; |
| @@ -1249,7 +1247,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) · 704 unmodified lines | ||
| 1249 | 1247 | retval = ixgbe_set_vf_vlan_msg(adapter, msgbuf, vf); |
| 1250 | 1248 | break; |
| 1251 | 1249 | case IXGBE_VF_SET_LPE: |
| 1252 | − retval = ixgbe_set_vf_lpe(adapter, msgbuf, vf); | |
| 1250 | + retval = ixgbe_set_vf_lpe(adapter, msgbuf[1], vf); | |
| 1253 | 1251 | break; |
| 1254 | 1252 | case IXGBE_VF_SET_MACVLAN: |
| 1255 | 1253 | retval = ixgbe_set_vf_macvlan_msg(adapter, msgbuf, vf); |
| @@ -106,9 +106,10 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, · 105 unmodified lines | ||
| 106 | 106 | |
| 107 | 107 | if (likely(act == XDP_REDIRECT)) { |
| 108 | 108 | err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); |
| 109 | − result = !err ? IXGBE_XDP_REDIR : IXGBE_XDP_CONSUMED; | |
| 109 | + if (err) | |
| 110 | + goto out_failure; | |
| 110 | 111 | rcu_read_unlock(); |
| 111 | − return result; | |
| 112 | + return IXGBE_XDP_REDIR; | |
| 112 | 113 | } |
| 113 | 114 | |
| 114 | 115 | switch (act) { |
| @@ -116,16 +117,17 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, · 1 unmodified line | ||
| 116 | 117 | break; |
| 117 | 118 | case XDP_TX: |
| 118 | 119 | xdpf = xdp_convert_buff_to_frame(xdp); |
| 119 | − if (unlikely(!xdpf)) { | |
| 120 | − result = IXGBE_XDP_CONSUMED; | |
| 121 | − break; | |
| 122 | − } | |
| 120 | + if (unlikely(!xdpf)) | |
| 121 | + goto out_failure; | |
| 123 | 122 | result = ixgbe_xmit_xdp_ring(adapter, xdpf); |
| 123 | + if (result == IXGBE_XDP_CONSUMED) | |
| 124 | + goto out_failure; | |
| 124 | 125 | break; |
| 125 | 126 | default: |
| 126 | 127 | bpf_warn_invalid_xdp_action(act); |
| 127 | 128 | fallthrough; |
| 128 | 129 | case XDP_ABORTED: |
| 130 | +out_failure: | |
| 129 | 131 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 130 | 132 | fallthrough; /* handle aborts by dropping packet */ |
| 131 | 133 | case XDP_DROP: |
| @@ -1067,11 +1067,14 @@ static struct sk_buff *ixgbevf_run_xdp(struct ixgbevf_adapter *adapter, · 1066 unmodified lines | ||
| 1067 | 1067 | case XDP_TX: |
| 1068 | 1068 | xdp_ring = adapter->xdp_ring[rx_ring->queue_index]; |
| 1069 | 1069 | result = ixgbevf_xmit_xdp_ring(xdp_ring, xdp); |
| 1070 | + if (result == IXGBEVF_XDP_CONSUMED) | |
| 1071 | + goto out_failure; | |
| 1070 | 1072 | break; |
| 1071 | 1073 | default: |
| 1072 | 1074 | bpf_warn_invalid_xdp_action(act); |
| 1073 | 1075 | fallthrough; |
| 1074 | 1076 | case XDP_ABORTED: |
| 1077 | +out_failure: | |
| 1075 | 1078 | trace_xdp_exception(rx_ring->netdev, xdp_prog, act); |
| 1076 | 1079 | fallthrough; /* handle aborts by dropping packet */ |
| 1077 | 1080 | case XDP_DROP: |
| @@ -1315,23 +1315,23 @@ static int korina_probe(struct platform_device *pdev) · 1314 unmodified lines | ||
| 1315 | 1315 | lp->tx_irq = platform_get_irq_byname(pdev, "tx"); |
| 1316 | 1316 | |
| 1317 | 1317 | p = devm_platform_ioremap_resource_byname(pdev, "emac"); |
| 1318 | − if (!p) { | |
| 1318 | + if (IS_ERR(p)) { | |
| 1319 | 1319 | printk(KERN_ERR DRV_NAME ": cannot remap registers\n"); |
| 1320 | − return -ENOMEM; | |
| 1320 | + return PTR_ERR(p); | |
| 1321 | 1321 | } |
| 1322 | 1322 | lp->eth_regs = p; |
| 1323 | 1323 | |
| 1324 | 1324 | p = devm_platform_ioremap_resource_byname(pdev, "dma_rx"); |
| 1325 | − if (!p) { | |
| 1325 | + if (IS_ERR(p)) { | |
| 1326 | 1326 | printk(KERN_ERR DRV_NAME ": cannot remap Rx DMA registers\n"); |
| 1327 | − return -ENOMEM; | |
| 1327 | + return PTR_ERR(p); | |
| 1328 | 1328 | } |
| 1329 | 1329 | lp->rx_dma_regs = p; |
| 1330 | 1330 | |
| 1331 | 1331 | p = devm_platform_ioremap_resource_byname(pdev, "dma_tx"); |
| 1332 | − if (!p) { | |
| 1332 | + if (IS_ERR(p)) { | |
| 1333 | 1333 | printk(KERN_ERR DRV_NAME ": cannot remap Tx DMA registers\n"); |
| 1334 | − return -ENOMEM; | |
| 1334 | + return PTR_ERR(p); | |
| 1335 | 1335 | } |
| 1336 | 1336 | lp->tx_dma_regs = p; |
| 1337 | 1337 | |
| @@ -154,6 +154,8 @@ static int xrx200_close(struct net_device *net_dev) · 153 unmodified lines | ||
| 154 | 154 | |
| 155 | 155 | static int xrx200_alloc_skb(struct xrx200_chan *ch) |
| 156 | 156 | { |
| 157 | + struct sk_buff *skb = ch->skb[ch->dma.desc]; | |
| 158 | + dma_addr_t mapping; | |
| 157 | 159 | int ret = 0; |
| 158 | 160 | |
| 159 | 161 | ch->skb[ch->dma.desc] = netdev_alloc_skb_ip_align(ch->priv->net_dev, |
| @@ -163,16 +165,18 @@ static int xrx200_alloc_skb(struct xrx200_chan *ch) · 3 unmodified lines | ||
| 163 | 165 | goto skip; |
| 164 | 166 | } |
| 165 | 167 | |
| 166 | − ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(ch->priv->dev, | |
| 167 | − ch->skb[ch->dma.desc]->data, XRX200_DMA_DATA_LEN, | |
| 168 | − DMA_FROM_DEVICE); | |
| 169 | − if (unlikely(dma_mapping_error(ch->priv->dev, | |
| 170 | − ch->dma.desc_base[ch->dma.desc].addr))) { | |
| 168 | + mapping = dma_map_single(ch->priv->dev, ch->skb[ch->dma.desc]->data, | |
| 169 | + XRX200_DMA_DATA_LEN, DMA_FROM_DEVICE); | |
| 170 | + if (unlikely(dma_mapping_error(ch->priv->dev, mapping))) { | |
| 171 | 171 | dev_kfree_skb_any(ch->skb[ch->dma.desc]); |
| 172 | + ch->skb[ch->dma.desc] = skb; | |
| 172 | 173 | ret = -ENOMEM; |
| 173 | 174 | goto skip; |
| 174 | 175 | } |
| 175 | 176 | |
| 177 | + ch->dma.desc_base[ch->dma.desc].addr = mapping; | |
| 178 | + /* Make sure the address is written before we give it to HW */ | |
| 179 | + wmb(); | |
| 176 | 180 | skip: |
| 177 | 181 | ch->dma.desc_base[ch->dma.desc].ctl = |
| 178 | 182 | LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) | |
| @@ -196,6 +200,7 @@ static int xrx200_hw_receive(struct xrx200_chan *ch) · 17 unmodified lines | ||
| 196 | 200 | ch->dma.desc %= LTQ_DESC_NUM; |
| 197 | 201 | |
| 198 | 202 | if (ret) { |
| 203 | + net_dev->stats.rx_dropped++; | |
| 199 | 204 | netdev_err(net_dev, "failed to allocate new rx buffer\n"); |
| 200 | 205 | return ret; |
| 201 | 206 | } |
| @@ -348,8 +353,8 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr) · 146 unmodified lines | ||
| 348 | 353 | struct xrx200_chan *ch = ptr; |
| 349 | 354 | |
| 350 | 355 | if (napi_schedule_prep(&ch->napi)) { |
| 351 | − __napi_schedule(&ch->napi); | |
| 352 | 356 | ltq_dma_disable_irq(&ch->dma); |
| 357 | + __napi_schedule(&ch->napi); | |
| 353 | 358 | } |
| 354 | 359 | |
| 355 | 360 | ltq_dma_ack_irq(&ch->dma); |
| @@ -993,6 +993,14 @@ enum mvpp22_ptp_packet_format { · 992 unmodified lines | ||
| 993 | 993 | |
| 994 | 994 | #define MVPP2_DESC_DMA_MASK DMA_BIT_MASK(40) |
| 995 | 995 | |
| 996 | +/* Buffer header info bits */ | |
| 997 | +#define MVPP2_B_HDR_INFO_MC_ID_MASK 0xfff | |
| 998 | +#define MVPP2_B_HDR_INFO_MC_ID(info) ((info) & MVPP2_B_HDR_INFO_MC_ID_MASK) | |
| 999 | +#define MVPP2_B_HDR_INFO_LAST_OFFS 12 | |
| 1000 | +#define MVPP2_B_HDR_INFO_LAST_MASK BIT(12) | |
| 1001 | +#define MVPP2_B_HDR_INFO_IS_LAST(info) \ | |
| 1002 | + (((info) & MVPP2_B_HDR_INFO_LAST_MASK) >> MVPP2_B_HDR_INFO_LAST_OFFS) | |
| 1003 | + | |
| 996 | 1004 | struct mvpp2_tai; |
| 997 | 1005 | |
| 998 | 1006 | /* Definitions */ |
| @@ -1002,6 +1010,20 @@ struct mvpp2_rss_table { · 3 unmodified lines | ||
| 1002 | 1010 | u32 indir[MVPP22_RSS_TABLE_ENTRIES]; |
| 1003 | 1011 | }; |
| 1004 | 1012 | |
| 1013 | +struct mvpp2_buff_hdr { | |
| 1014 | + __le32 next_phys_addr; | |
| 1015 | + __le32 next_dma_addr; | |
| 1016 | + __le16 byte_count; | |
| 1017 | + __le16 info; | |
| 1018 | + __le16 reserved1; /* bm_qset (for future use, BM) */ | |
| 1019 | + u8 next_phys_addr_high; | |
| 1020 | + u8 next_dma_addr_high; | |
| 1021 | + __le16 reserved2; | |
| 1022 | + __le16 reserved3; | |
| 1023 | + __le16 reserved4; | |
| 1024 | + __le16 reserved5; | |
| 1025 | +}; | |
| 1026 | + | |
| 1005 | 1027 | /* Shared Packet Processor resources */ |
| 1006 | 1028 | struct mvpp2 { |
| 1007 | 1029 | /* Shared registers' base addresses */ |
| @@ -3839,6 +3839,35 @@ mvpp2_run_xdp(struct mvpp2_port *port, struct mvpp2_rx_queue *rxq, · 3838 unmodified lines | ||
| 3839 | 3839 | return ret; |
| 3840 | 3840 | } |
| 3841 | 3841 | |
| 3842 | +static void mvpp2_buff_hdr_pool_put(struct mvpp2_port *port, struct mvpp2_rx_desc *rx_desc, | |
| 3843 | + int pool, u32 rx_status) | |
| 3844 | +{ | |
| 3845 | + phys_addr_t phys_addr, phys_addr_next; | |
| 3846 | + dma_addr_t dma_addr, dma_addr_next; | |
| 3847 | + struct mvpp2_buff_hdr *buff_hdr; | |
| 3848 | + | |
| 3849 | + phys_addr = mvpp2_rxdesc_dma_addr_get(port, rx_desc); | |
| 3850 | + dma_addr = mvpp2_rxdesc_cookie_get(port, rx_desc); | |
| 3851 | + | |
| 3852 | + do { | |
| 3853 | + buff_hdr = (struct mvpp2_buff_hdr *)phys_to_virt(phys_addr); | |
| 3854 | + | |
| 3855 | + phys_addr_next = le32_to_cpu(buff_hdr->next_phys_addr); | |
| 3856 | + dma_addr_next = le32_to_cpu(buff_hdr->next_dma_addr); | |
| 3857 | + | |
| 3858 | + if (port->priv->hw_version >= MVPP22) { | |
| 3859 | + phys_addr_next |= ((u64)buff_hdr->next_phys_addr_high << 32); | |
| 3860 | + dma_addr_next |= ((u64)buff_hdr->next_dma_addr_high << 32); | |
| 3861 | + } | |
| 3862 | + | |
| 3863 | + mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr); | |
| 3864 | + | |
| 3865 | + phys_addr = phys_addr_next; | |
| 3866 | + dma_addr = dma_addr_next; | |
| 3867 | + | |
| 3868 | + } while (!MVPP2_B_HDR_INFO_IS_LAST(le16_to_cpu(buff_hdr->info))); | |
| 3869 | +} | |
| 3870 | + | |
| 3842 | 3871 | /* Main rx processing */ |
| 3843 | 3872 | static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, |
| 3844 | 3873 | int rx_todo, struct mvpp2_rx_queue *rxq) |
| @@ -3885,14 +3914,6 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, · 40 unmodified lines | ||
| 3885 | 3914 | MVPP2_RXD_BM_POOL_ID_OFFS; |
| 3886 | 3915 | bm_pool = &port->priv->bm_pools[pool]; |
| 3887 | 3916 | |
| 3888 | − /* In case of an error, release the requested buffer pointer | |
| 3889 | − * to the Buffer Manager. This request process is controlled | |
| 3890 | − * by the hardware, and the information about the buffer is | |
| 3891 | − * comprised by the RX descriptor. | |
| 3892 | − */ | |
| 3893 | − if (rx_status & MVPP2_RXD_ERR_SUMMARY) | |
| 3894 | − goto err_drop_frame; | |
| 3895 | − | |
| 3896 | 3917 | if (port->priv->percpu_pools) { |
| 3897 | 3918 | pp = port->priv->page_pool[pool]; |
| 3898 | 3919 | dma_dir = page_pool_get_dma_dir(pp); |
| @@ -3904,6 +3925,18 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, · 5 unmodified lines | ||
| 3904 | 3925 | rx_bytes + MVPP2_MH_SIZE, |
| 3905 | 3926 | dma_dir); |
| 3906 | 3927 | |
| 3928 | + /* Buffer header not supported */ | |
| 3929 | + if (rx_status & MVPP2_RXD_BUF_HDR) | |
| 3930 | + goto err_drop_frame; | |
| 3931 | + | |
| 3932 | + /* In case of an error, release the requested buffer pointer | |
| 3933 | + * to the Buffer Manager. This request process is controlled | |
| 3934 | + * by the hardware, and the information about the buffer is | |
| 3935 | + * comprised by the RX descriptor. | |
| 3936 | + */ | |
| 3937 | + if (rx_status & MVPP2_RXD_ERR_SUMMARY) | |
| 3938 | + goto err_drop_frame; | |
| 3939 | + | |
| 3907 | 3940 | /* Prefetch header */ |
| 3908 | 3941 | prefetch(data); |
| 3909 | 3942 | |
| @@ -3985,7 +4018,10 @@ err_drop_frame: · 75 unmodified lines | ||
| 3985 | 4018 | dev->stats.rx_errors++; |
| 3986 | 4019 | mvpp2_rx_error(port, rx_desc); |
| 3987 | 4020 | /* Return the buffer to the pool */ |
| 3988 | − mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr); | |
| 4021 | + if (rx_status & MVPP2_RXD_BUF_HDR) | |
| 4022 | + mvpp2_buff_hdr_pool_put(port, rx_desc, pool, rx_status); | |
| 4023 | + else | |
| 4024 | + mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr); | |
| 3989 | 4025 | } |
| 3990 | 4026 | |
| 3991 | 4027 | rcu_read_unlock(); |
| @@ -786,6 +786,10 @@ static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir, · 785 unmodified lines | ||
| 786 | 786 | if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) |
| 787 | 787 | return -EOPNOTSUPP; |
| 788 | 788 | |
| 789 | + if (*rss_context != ETH_RXFH_CONTEXT_ALLOC && | |
| 790 | + *rss_context >= MAX_RSS_GROUPS) | |
| 791 | + return -EINVAL; | |
| 792 | + | |
| 789 | 793 | rss = &pfvf->hw.rss_info; |
| 790 | 794 | |
| 791 | 795 | if (!rss->enable) { |
| @@ -681,32 +681,53 @@ static int mtk_set_mac_address(struct net_device *dev, void *p) · 680 unmodified lines | ||
| 681 | 681 | void mtk_stats_update_mac(struct mtk_mac *mac) |
| 682 | 682 | { |
| 683 | 683 | struct mtk_hw_stats *hw_stats = mac->hw_stats; |
| 684 | − unsigned int base = MTK_GDM1_TX_GBCNT; | |
| 685 | − u64 stats; | |
| 686 | − | |
| 687 | − base += hw_stats->reg_offset; | |
| 684 | + struct mtk_eth *eth = mac->hw; | |
| 688 | 685 | |
| 689 | 686 | u64_stats_update_begin(&hw_stats->syncp); |
| 690 | 687 | |
| 691 | − hw_stats->rx_bytes += mtk_r32(mac->hw, base); | |
| 692 | − stats = mtk_r32(mac->hw, base + 0x04); | |
| 693 | − if (stats) | |
| 694 | − hw_stats->rx_bytes += (stats << 32); | |
| 695 | − hw_stats->rx_packets += mtk_r32(mac->hw, base + 0x08); | |
| 696 | − hw_stats->rx_overflow += mtk_r32(mac->hw, base + 0x10); | |
| 697 | − hw_stats->rx_fcs_errors += mtk_r32(mac->hw, base + 0x14); | |
| 698 | − hw_stats->rx_short_errors += mtk_r32(mac->hw, base + 0x18); | |
| 699 | − hw_stats->rx_long_errors += mtk_r32(mac->hw, base + 0x1c); | |
| 700 | − hw_stats->rx_checksum_errors += mtk_r32(mac->hw, base + 0x20); | |
| 701 | − hw_stats->rx_flow_control_packets += | |
| 702 | − mtk_r32(mac->hw, base + 0x24); | |
| 703 | − hw_stats->tx_skip += mtk_r32(mac->hw, base + 0x28); | |
| 704 | − hw_stats->tx_collisions += mtk_r32(mac->hw, base + 0x2c); | |
| 705 | − hw_stats->tx_bytes += mtk_r32(mac->hw, base + 0x30); | |
| 706 | − stats = mtk_r32(mac->hw, base + 0x34); | |
| 707 | − if (stats) | |
| 708 | − hw_stats->tx_bytes += (stats << 32); | |
| 709 | − hw_stats->tx_packets += mtk_r32(mac->hw, base + 0x38); | |
| 688 | + if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { | |
| 689 | + hw_stats->tx_packets += mtk_r32(mac->hw, MT7628_SDM_TPCNT); | |
| 690 | + hw_stats->tx_bytes += mtk_r32(mac->hw, MT7628_SDM_TBCNT); | |
| 691 | + hw_stats->rx_packets += mtk_r32(mac->hw, MT7628_SDM_RPCNT); | |
| 692 | + hw_stats->rx_bytes += mtk_r32(mac->hw, MT7628_SDM_RBCNT); | |
| 693 | + hw_stats->rx_checksum_errors += | |
| 694 | + mtk_r32(mac->hw, MT7628_SDM_CS_ERR); | |
| 695 | + } else { | |
| 696 | + unsigned int offs = hw_stats->reg_offset; | |
| 697 | + u64 stats; | |
| 698 | + | |
| 699 | + hw_stats->rx_bytes += mtk_r32(mac->hw, | |
| 700 | + MTK_GDM1_RX_GBCNT_L + offs); | |
| 701 | + stats = mtk_r32(mac->hw, MTK_GDM1_RX_GBCNT_H + offs); | |
| 702 | + if (stats) | |
| 703 | + hw_stats->rx_bytes += (stats << 32); | |
| 704 | + hw_stats->rx_packets += | |
| 705 | + mtk_r32(mac->hw, MTK_GDM1_RX_GPCNT + offs); | |
| 706 | + hw_stats->rx_overflow += | |
| 707 | + mtk_r32(mac->hw, MTK_GDM1_RX_OERCNT + offs); | |
| 708 | + hw_stats->rx_fcs_errors += | |
| 709 | + mtk_r32(mac->hw, MTK_GDM1_RX_FERCNT + offs); | |
| 710 | + hw_stats->rx_short_errors += | |
| 711 | + mtk_r32(mac->hw, MTK_GDM1_RX_SERCNT + offs); | |
| 712 | + hw_stats->rx_long_errors += | |
| 713 | + mtk_r32(mac->hw, MTK_GDM1_RX_LENCNT + offs); | |
| 714 | + hw_stats->rx_checksum_errors += | |
| 715 | + mtk_r32(mac->hw, MTK_GDM1_RX_CERCNT + offs); | |
| 716 | + hw_stats->rx_flow_control_packets += | |
| 717 | + mtk_r32(mac->hw, MTK_GDM1_RX_FCCNT + offs); | |
| 718 | + hw_stats->tx_skip += | |
| 719 | + mtk_r32(mac->hw, MTK_GDM1_TX_SKIPCNT + offs); | |
| 720 | + hw_stats->tx_collisions += | |
| 721 | + mtk_r32(mac->hw, MTK_GDM1_TX_COLCNT + offs); | |
| 722 | + hw_stats->tx_bytes += | |
| 723 | + mtk_r32(mac->hw, MTK_GDM1_TX_GBCNT_L + offs); | |
| 724 | + stats = mtk_r32(mac->hw, MTK_GDM1_TX_GBCNT_H + offs); | |
| 725 | + if (stats) | |
| 726 | + hw_stats->tx_bytes += (stats << 32); | |
| 727 | + hw_stats->tx_packets += | |
| 728 | + mtk_r32(mac->hw, MTK_GDM1_TX_GPCNT + offs); | |
| 729 | + } | |
| 730 | + | |
| 710 | 731 | u64_stats_update_end(&hw_stats->syncp); |
| 711 | 732 | } |
| 712 | 733 | |
| @@ -2423,7 +2444,8 @@ static void mtk_dim_rx(struct work_struct *work) · 1710 unmodified lines | ||
| 2423 | 2444 | val |= cur << MTK_PDMA_DELAY_RX_PINT_SHIFT; |
| 2424 | 2445 | |
| 2425 | 2446 | mtk_w32(eth, val, MTK_PDMA_DELAY_INT); |
| 2426 | − mtk_w32(eth, val, MTK_QDMA_DELAY_INT); | |
| 2447 | + if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) | |
| 2448 | + mtk_w32(eth, val, MTK_QDMA_DELAY_INT); | |
| 2427 | 2449 | |
| 2428 | 2450 | spin_unlock_bh(ð->dim_lock); |
| 2429 | 2451 | |
| @@ -2452,7 +2474,8 @@ static void mtk_dim_tx(struct work_struct *work) · 22 unmodified lines | ||
| 2452 | 2474 | val |= cur << MTK_PDMA_DELAY_TX_PINT_SHIFT; |
| 2453 | 2475 | |
| 2454 | 2476 | mtk_w32(eth, val, MTK_PDMA_DELAY_INT); |
| 2455 | − mtk_w32(eth, val, MTK_QDMA_DELAY_INT); | |
| 2477 | + if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) | |
| 2478 | + mtk_w32(eth, val, MTK_QDMA_DELAY_INT); | |
| 2456 | 2479 | |
| 2457 | 2480 | spin_unlock_bh(ð->dim_lock); |
| 2458 | 2481 | |
| @@ -2480,6 +2503,10 @@ static int mtk_hw_init(struct mtk_eth *eth) · 21 unmodified lines | ||
| 2480 | 2503 | goto err_disable_pm; |
| 2481 | 2504 | } |
| 2482 | 2505 | |
| 2506 | + /* set interrupt delays based on current Net DIM sample */ | |
| 2507 | + mtk_dim_rx(ð->rx_dim.work); | |
| 2508 | + mtk_dim_tx(ð->tx_dim.work); | |
| 2509 | + | |
| 2483 | 2510 | /* disable delay and normal interrupt */ |
| 2484 | 2511 | mtk_tx_irq_disable(eth, ~0); |
| 2485 | 2512 | mtk_rx_irq_disable(eth, ~0); |
| @@ -278,8 +278,21 @@ · 277 unmodified lines | ||
| 278 | 278 | /* QDMA FQ Free Page Buffer Length Register */ |
| 279 | 279 | #define MTK_QDMA_FQ_BLEN 0x1B2C |
| 280 | 280 | |
| 281 | −/* GMA1 Received Good Byte Count Register */ | |
| 282 | −#define MTK_GDM1_TX_GBCNT 0x2400 | |
| 281 | +/* GMA1 counter / statics register */ | |
| 282 | +#define MTK_GDM1_RX_GBCNT_L 0x2400 | |
| 283 | +#define MTK_GDM1_RX_GBCNT_H 0x2404 | |
| 284 | +#define MTK_GDM1_RX_GPCNT 0x2408 | |
| 285 | +#define MTK_GDM1_RX_OERCNT 0x2410 | |
| 286 | +#define MTK_GDM1_RX_FERCNT 0x2414 | |
| 287 | +#define MTK_GDM1_RX_SERCNT 0x2418 | |
| 288 | +#define MTK_GDM1_RX_LENCNT 0x241c | |
| 289 | +#define MTK_GDM1_RX_CERCNT 0x2420 | |
| 290 | +#define MTK_GDM1_RX_FCCNT 0x2424 | |
| 291 | +#define MTK_GDM1_TX_SKIPCNT 0x2428 | |
| 292 | +#define MTK_GDM1_TX_COLCNT 0x242c | |
| 293 | +#define MTK_GDM1_TX_GBCNT_L 0x2430 | |
| 294 | +#define MTK_GDM1_TX_GBCNT_H 0x2434 | |
| 295 | +#define MTK_GDM1_TX_GPCNT 0x2438 | |
| 283 | 296 | #define MTK_STAT_OFFSET 0x40 |
| 284 | 297 | |
| 285 | 298 | /* QDMA descriptor txd4 */ |
| @@ -502,6 +515,13 @@ · 216 unmodified lines | ||
| 502 | 515 | #define MT7628_SDM_MAC_ADRL (MT7628_SDM_OFFSET + 0x0c) |
| 503 | 516 | #define MT7628_SDM_MAC_ADRH (MT7628_SDM_OFFSET + 0x10) |
| 504 | 517 | |
| 518 | +/* Counter / stat register */ | |
| 519 | +#define MT7628_SDM_TPCNT (MT7628_SDM_OFFSET + 0x100) | |
| 520 | +#define MT7628_SDM_TBCNT (MT7628_SDM_OFFSET + 0x104) | |
| 521 | +#define MT7628_SDM_RPCNT (MT7628_SDM_OFFSET + 0x108) | |
| 522 | +#define MT7628_SDM_RBCNT (MT7628_SDM_OFFSET + 0x10c) | |
| 523 | +#define MT7628_SDM_CS_ERR (MT7628_SDM_OFFSET + 0x110) | |
| 524 | + | |
| 505 | 525 | struct mtk_rx_dma { |
| 506 | 526 | unsigned int rxd1; |
| 507 | 527 | unsigned int rxd2; |
| @@ -2027,8 +2027,6 @@ static int mlx4_en_set_tunable(struct net_device *dev, · 2026 unmodified lines | ||
| 2027 | 2027 | return ret; |
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | −#define MLX4_EEPROM_PAGE_LEN 256 | |
| 2031 | − | |
| 2032 | 2030 | static int mlx4_en_get_module_info(struct net_device *dev, |
| 2033 | 2031 | struct ethtool_modinfo *modinfo) |
| 2034 | 2032 | { |
| @@ -2063,7 +2061,7 @@ static int mlx4_en_get_module_info(struct net_device *dev, · 28 unmodified lines | ||
| 2063 | 2061 | break; |
| 2064 | 2062 | case MLX4_MODULE_ID_SFP: |
| 2065 | 2063 | modinfo->type = ETH_MODULE_SFF_8472; |
| 2066 | − modinfo->eeprom_len = MLX4_EEPROM_PAGE_LEN; | |
| 2064 | + modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; | |
| 2067 | 2065 | break; |
| 2068 | 2066 | default: |
| 2069 | 2067 | return -EINVAL; |
| @@ -823,6 +823,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 822 unmodified lines | ||
| 823 | 823 | #define QUERY_DEV_CAP_MAD_DEMUX_OFFSET 0xb0 |
| 824 | 824 | #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_BASE_OFFSET 0xa8 |
| 825 | 825 | #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_RANGE_OFFSET 0xac |
| 826 | +#define QUERY_DEV_CAP_MAP_CLOCK_TO_USER 0xc1 | |
| 826 | 827 | #define QUERY_DEV_CAP_QP_RATE_LIMIT_NUM_OFFSET 0xcc |
| 827 | 828 | #define QUERY_DEV_CAP_QP_RATE_LIMIT_MAX_OFFSET 0xd0 |
| 828 | 829 | #define QUERY_DEV_CAP_QP_RATE_LIMIT_MIN_OFFSET 0xd2 |
| @@ -841,6 +842,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 12 unmodified lines | ||
| 841 | 842 | |
| 842 | 843 | if (mlx4_is_mfunc(dev)) |
| 843 | 844 | disable_unsupported_roce_caps(outbox); |
| 845 | + MLX4_GET(field, outbox, QUERY_DEV_CAP_MAP_CLOCK_TO_USER); | |
| 846 | + dev_cap->map_clock_to_user = field & 0x80; | |
| 844 | 847 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_QP_OFFSET); |
| 845 | 848 | dev_cap->reserved_qps = 1 << (field & 0xf); |
| 846 | 849 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_OFFSET); |
| @@ -131,6 +131,7 @@ struct mlx4_dev_cap { · 130 unmodified lines | ||
| 131 | 131 | u32 health_buffer_addrs; |
| 132 | 132 | struct mlx4_port_cap port_cap[MLX4_MAX_PORTS + 1]; |
| 133 | 133 | bool wol_port[MLX4_MAX_PORTS + 1]; |
| 134 | + bool map_clock_to_user; | |
| 134 | 135 | }; |
| 135 | 136 | |
| 136 | 137 | struct mlx4_func_cap { |
| @@ -498,6 +498,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 497 unmodified lines | ||
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | + dev->caps.map_clock_to_user = dev_cap->map_clock_to_user; | |
| 501 | 502 | dev->caps.uar_page_size = PAGE_SIZE; |
| 502 | 503 | dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE; |
| 503 | 504 | dev->caps.local_ca_ack_delay = dev_cap->local_ca_ack_delay; |
| @@ -1948,6 +1949,11 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, · 1444 unmodified lines | ||
| 1948 | 1949 | if (mlx4_is_slave(dev)) |
| 1949 | 1950 | return -EOPNOTSUPP; |
| 1950 | 1951 | |
| 1952 | + if (!dev->caps.map_clock_to_user) { | |
| 1953 | + mlx4_dbg(dev, "Map clock to user is not supported.\n"); | |
| 1954 | + return -EOPNOTSUPP; | |
| 1955 | + } | |
| 1956 | + | |
| 1951 | 1957 | if (!params) |
| 1952 | 1958 | return -EINVAL; |
| 1953 | 1959 | |
| @@ -1973,6 +1973,7 @@ EXPORT_SYMBOL(mlx4_get_roce_gid_from_slave); · 1972 unmodified lines | ||
| 1973 | 1973 | #define I2C_ADDR_LOW 0x50 |
| 1974 | 1974 | #define I2C_ADDR_HIGH 0x51 |
| 1975 | 1975 | #define I2C_PAGE_SIZE 256 |
| 1976 | +#define I2C_HIGH_PAGE_SIZE 128 | |
| 1976 | 1977 | |
| 1977 | 1978 | /* Module Info Data */ |
| 1978 | 1979 | struct mlx4_cable_info { |
| @@ -2026,6 +2027,88 @@ static inline const char *cable_info_mad_err_str(u16 mad_status) · 47 unmodified lines | ||
| 2026 | 2027 | return "Unknown Error"; |
| 2027 | 2028 | } |
| 2028 | 2029 | |
| 2030 | +static int mlx4_get_module_id(struct mlx4_dev *dev, u8 port, u8 *module_id) | |
| 2031 | +{ | |
| 2032 | + struct mlx4_cmd_mailbox *inbox, *outbox; | |
| 2033 | + struct mlx4_mad_ifc *inmad, *outmad; | |
| 2034 | + struct mlx4_cable_info *cable_info; | |
| 2035 | + int ret; | |
| 2036 | + | |
| 2037 | + inbox = mlx4_alloc_cmd_mailbox(dev); | |
| 2038 | + if (IS_ERR(inbox)) | |
| 2039 | + return PTR_ERR(inbox); | |
| 2040 | + | |
| 2041 | + outbox = mlx4_alloc_cmd_mailbox(dev); | |
| 2042 | + if (IS_ERR(outbox)) { | |
| 2043 | + mlx4_free_cmd_mailbox(dev, inbox); | |
| 2044 | + return PTR_ERR(outbox); | |
| 2045 | + } | |
| 2046 | + | |
| 2047 | + inmad = (struct mlx4_mad_ifc *)(inbox->buf); | |
| 2048 | + outmad = (struct mlx4_mad_ifc *)(outbox->buf); | |
| 2049 | + | |
| 2050 | + inmad->method = 0x1; /* Get */ | |
| 2051 | + inmad->class_version = 0x1; | |
| 2052 | + inmad->mgmt_class = 0x1; | |
| 2053 | + inmad->base_version = 0x1; | |
| 2054 | + inmad->attr_id = cpu_to_be16(0xFF60); /* Module Info */ | |
| 2055 | + | |
| 2056 | + cable_info = (struct mlx4_cable_info *)inmad->data; | |
| 2057 | + cable_info->dev_mem_address = 0; | |
| 2058 | + cable_info->page_num = 0; | |
| 2059 | + cable_info->i2c_addr = I2C_ADDR_LOW; | |
| 2060 | + cable_info->size = cpu_to_be16(1); | |
| 2061 | + | |
| 2062 | + ret = mlx4_cmd_box(dev, inbox->dma, outbox->dma, port, 3, | |
| 2063 | + MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C, | |
| 2064 | + MLX4_CMD_NATIVE); | |
| 2065 | + if (ret) | |
| 2066 | + goto out; | |
| 2067 | + | |
| 2068 | + if (be16_to_cpu(outmad->status)) { | |
| 2069 | + /* Mad returned with bad status */ | |
| 2070 | + ret = be16_to_cpu(outmad->status); | |
| 2071 | + mlx4_warn(dev, | |
| 2072 | + "MLX4_CMD_MAD_IFC Get Module ID attr(%x) port(%d) i2c_addr(%x) offset(%d) size(%d): Response Mad Status(%x) - %s\n", | |
| 2073 | + 0xFF60, port, I2C_ADDR_LOW, 0, 1, ret, | |
| 2074 | + cable_info_mad_err_str(ret)); | |
| 2075 | + ret = -ret; | |
| 2076 | + goto out; | |
| 2077 | + } | |
| 2078 | + cable_info = (struct mlx4_cable_info *)outmad->data; | |
| 2079 | + *module_id = cable_info->data[0]; | |
| 2080 | +out: | |
| 2081 | + mlx4_free_cmd_mailbox(dev, inbox); | |
| 2082 | + mlx4_free_cmd_mailbox(dev, outbox); | |
| 2083 | + return ret; | |
| 2084 | +} | |
| 2085 | + | |
| 2086 | +static void mlx4_sfp_eeprom_params_set(u8 *i2c_addr, u8 *page_num, u16 *offset) | |
| 2087 | +{ | |
| 2088 | + *i2c_addr = I2C_ADDR_LOW; | |
| 2089 | + *page_num = 0; | |
| 2090 | + | |
| 2091 | + if (*offset < I2C_PAGE_SIZE) | |
| 2092 | + return; | |
| 2093 | + | |
| 2094 | + *i2c_addr = I2C_ADDR_HIGH; | |
| 2095 | + *offset -= I2C_PAGE_SIZE; | |
| 2096 | +} | |
| 2097 | + | |
| 2098 | +static void mlx4_qsfp_eeprom_params_set(u8 *i2c_addr, u8 *page_num, u16 *offset) | |
| 2099 | +{ | |
| 2100 | + /* Offsets 0-255 belong to page 0. | |
| 2101 | + * Offsets 256-639 belong to pages 01, 02, 03. | |
| 2102 | + * For example, offset 400 is page 02: 1 + (400 - 256) / 128 = 2 | |
| 2103 | + */ | |
| 2104 | + if (*offset < I2C_PAGE_SIZE) | |
| 2105 | + *page_num = 0; | |
| 2106 | + else | |
| 2107 | + *page_num = 1 + (*offset - I2C_PAGE_SIZE) / I2C_HIGH_PAGE_SIZE; | |
| 2108 | + *i2c_addr = I2C_ADDR_LOW; | |
| 2109 | + *offset -= *page_num * I2C_HIGH_PAGE_SIZE; | |
| 2110 | +} | |
| 2111 | + | |
| 2029 | 2112 | /** |
| 2030 | 2113 | * mlx4_get_module_info - Read cable module eeprom data |
| 2031 | 2114 | * @dev: mlx4_dev. |
| @@ -2045,12 +2128,30 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, · 13 unmodified lines | ||
| 2045 | 2128 | struct mlx4_cmd_mailbox *inbox, *outbox; |
| 2046 | 2129 | struct mlx4_mad_ifc *inmad, *outmad; |
| 2047 | 2130 | struct mlx4_cable_info *cable_info; |
| 2048 | − u16 i2c_addr; | |
| 2131 | + u8 module_id, i2c_addr, page_num; | |
| 2049 | 2132 | int ret; |
| 2050 | 2133 | |
| 2051 | 2134 | if (size > MODULE_INFO_MAX_READ) |
| 2052 | 2135 | size = MODULE_INFO_MAX_READ; |
| 2053 | 2136 | |
| 2137 | + ret = mlx4_get_module_id(dev, port, &module_id); | |
| 2138 | + if (ret) | |
| 2139 | + return ret; | |
| 2140 | + | |
| 2141 | + switch (module_id) { | |
| 2142 | + case MLX4_MODULE_ID_SFP: | |
| 2143 | + mlx4_sfp_eeprom_params_set(&i2c_addr, &page_num, &offset); | |
| 2144 | + break; | |
| 2145 | + case MLX4_MODULE_ID_QSFP: | |
| 2146 | + case MLX4_MODULE_ID_QSFP_PLUS: | |
| 2147 | + case MLX4_MODULE_ID_QSFP28: | |
| 2148 | + mlx4_qsfp_eeprom_params_set(&i2c_addr, &page_num, &offset); | |
| 2149 | + break; | |
| 2150 | + default: | |
| 2151 | + mlx4_err(dev, "Module ID not recognized: %#x\n", module_id); | |
| 2152 | + return -EINVAL; | |
| 2153 | + } | |
| 2154 | + | |
| 2054 | 2155 | inbox = mlx4_alloc_cmd_mailbox(dev); |
| 2055 | 2156 | if (IS_ERR(inbox)) |
| 2056 | 2157 | return PTR_ERR(inbox); |
| @@ -2076,11 +2177,9 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, · 19 unmodified lines | ||
| 2076 | 2177 | */ |
| 2077 | 2178 | size -= offset + size - I2C_PAGE_SIZE; |
| 2078 | 2179 | |
| 2079 | − i2c_addr = I2C_ADDR_LOW; | |
| 2080 | − | |
| 2081 | 2180 | cable_info = (struct mlx4_cable_info *)inmad->data; |
| 2082 | 2181 | cable_info->dev_mem_address = cpu_to_be16(offset); |
| 2083 | − cable_info->page_num = 0; | |
| 2182 | + cable_info->page_num = page_num; | |
| 2084 | 2183 | cable_info->i2c_addr = i2c_addr; |
| 2085 | 2184 | cable_info->size = cpu_to_be16(size); |
| 2086 | 2185 | |
| @@ -303,6 +303,7 @@ int mlx5_attach_device(struct mlx5_core_dev *dev) · 302 unmodified lines | ||
| 303 | 303 | int ret = 0, i; |
| 304 | 304 | |
| 305 | 305 | mutex_lock(&mlx5_intf_mutex); |
| 306 | + priv->flags &= ~MLX5_PRIV_FLAGS_DETACH; | |
| 306 | 307 | for (i = 0; i < ARRAY_SIZE(mlx5_adev_devices); i++) { |
| 307 | 308 | if (!priv->adev[i]) { |
| 308 | 309 | bool is_supported = false; |
| @@ -320,6 +321,16 @@ int mlx5_attach_device(struct mlx5_core_dev *dev) · 11 unmodified lines | ||
| 320 | 321 | } |
| 321 | 322 | } else { |
| 322 | 323 | adev = &priv->adev[i]->adev; |
| 324 | + | |
| 325 | + /* Pay attention that this is not PCI driver that | |
| 326 | + * mlx5_core_dev is connected, but auxiliary driver. | |
| 327 | + * | |
| 328 | + * Here we can race of module unload with devlink | |
| 329 | + * reload, but we don't need to take extra lock because | |
| 330 | + * we are holding global mlx5_intf_mutex. | |
| 331 | + */ | |
| 332 | + if (!adev->dev.driver) | |
| 333 | + continue; | |
| 323 | 334 | adrv = to_auxiliary_drv(adev->dev.driver); |
| 324 | 335 | |
| 325 | 336 | if (adrv->resume) |
| @@ -350,6 +361,10 @@ void mlx5_detach_device(struct mlx5_core_dev *dev) · 24 unmodified lines | ||
| 350 | 361 | continue; |
| 351 | 362 | |
| 352 | 363 | adev = &priv->adev[i]->adev; |
| 364 | + /* Auxiliary driver was unbind manually through sysfs */ | |
| 365 | + if (!adev->dev.driver) | |
| 366 | + goto skip_suspend; | |
| 367 | + | |
| 353 | 368 | adrv = to_auxiliary_drv(adev->dev.driver); |
| 354 | 369 | |
| 355 | 370 | if (adrv->suspend) { |
| @@ -357,9 +372,11 @@ void mlx5_detach_device(struct mlx5_core_dev *dev) · 1 unmodified line | ||
| 357 | 372 | continue; |
| 358 | 373 | } |
| 359 | 374 | |
| 375 | +skip_suspend: | |
| 360 | 376 | del_adev(&priv->adev[i]->adev); |
| 361 | 377 | priv->adev[i] = NULL; |
| 362 | 378 | } |
| 379 | + priv->flags |= MLX5_PRIV_FLAGS_DETACH; | |
| 363 | 380 | mutex_unlock(&mlx5_intf_mutex); |
| 364 | 381 | } |
| 365 | 382 | |
| @@ -448,6 +465,8 @@ int mlx5_rescan_drivers_locked(struct mlx5_core_dev *dev) · 82 unmodified lines | ||
| 448 | 465 | struct mlx5_priv *priv = &dev->priv; |
| 449 | 466 | |
| 450 | 467 | lockdep_assert_held(&mlx5_intf_mutex); |
| 468 | + if (priv->flags & MLX5_PRIV_FLAGS_DETACH) | |
| 469 | + return 0; | |
| 451 | 470 | |
| 452 | 471 | delete_drivers(dev); |
| 453 | 472 | if (priv->flags & MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV) |
| @@ -64,6 +64,8 @@ struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev) · 63 unmodified lines | ||
| 64 | 64 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 65 | 65 | struct devlink_port *port; |
| 66 | 66 | |
| 67 | + if (!netif_device_present(dev)) | |
| 68 | + return NULL; | |
| 67 | 69 | port = mlx5e_devlink_get_dl_port(priv); |
| 68 | 70 | if (port->registered) |
| 69 | 71 | return port; |
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB |
| 2 | 2 | // Copyright (c) 2020 Mellanox Technologies |
| 3 | 3 | |
| 4 | −#include <linux/ptp_classify.h> | |
| 5 | 4 | #include "en/ptp.h" |
| 6 | 5 | #include "en/txrx.h" |
| 7 | 6 | #include "en/params.h" |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | #include "en.h" |
| 8 | 8 | #include "en_stats.h" |
| 9 | +#include <linux/ptp_classify.h> | |
| 9 | 10 | |
| 10 | 11 | struct mlx5e_ptpsq { |
| 11 | 12 | struct mlx5e_txqsq txqsq; |
| @@ -43,6 +44,27 @@ struct mlx5e_ptp { · 31 unmodified lines | ||
| 43 | 44 | DECLARE_BITMAP(state, MLX5E_PTP_STATE_NUM_STATES); |
| 44 | 45 | }; |
| 45 | 46 | |
| 47 | +static inline bool mlx5e_use_ptpsq(struct sk_buff *skb) | |
| 48 | +{ | |
| 49 | + struct flow_keys fk; | |
| 50 | + | |
| 51 | + if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) | |
| 52 | + return false; | |
| 53 | + | |
| 54 | + if (!skb_flow_dissect_flow_keys(skb, &fk, 0)) | |
| 55 | + return false; | |
| 56 | + | |
| 57 | + if (fk.basic.n_proto == htons(ETH_P_1588)) | |
| 58 | + return true; | |
| 59 | + | |
| 60 | + if (fk.basic.n_proto != htons(ETH_P_IP) && | |
| 61 | + fk.basic.n_proto != htons(ETH_P_IPV6)) | |
| 62 | + return false; | |
| 63 | + | |
| 64 | + return (fk.basic.ip_proto == IPPROTO_UDP && | |
| 65 | + fk.ports.dst == htons(PTP_EV_PORT)); | |
| 66 | +} | |
| 67 | + | |
| 46 | 68 | int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params, |
| 47 | 69 | u8 lag_port, struct mlx5e_ptp **cp); |
| 48 | 70 | void mlx5e_ptp_close(struct mlx5e_ptp *c); |
| @@ -223,6 +223,8 @@ static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *pt · 222 unmodified lines | ||
| 223 | 223 | rpriv = priv->ppriv; |
| 224 | 224 | fwd_vport_num = rpriv->rep->vport; |
| 225 | 225 | lag_dev = netdev_master_upper_dev_get(netdev); |
| 226 | + if (!lag_dev) | |
| 227 | + return; | |
| 226 | 228 | |
| 227 | 229 | netdev_dbg(netdev, "lag_dev(%s)'s slave vport(%d) is txable(%d)\n", |
| 228 | 230 | lag_dev->name, fwd_vport_num, net_lag_port_dev_txable(netdev)); |
| @@ -129,10 +129,9 @@ static void mlx5e_rep_neigh_update(struct work_struct *work) · 128 unmodified lines | ||
| 129 | 129 | work); |
| 130 | 130 | struct mlx5e_neigh_hash_entry *nhe = update_work->nhe; |
| 131 | 131 | struct neighbour *n = update_work->n; |
| 132 | + struct mlx5e_encap_entry *e = NULL; | |
| 132 | 133 | bool neigh_connected, same_dev; |
| 133 | − struct mlx5e_encap_entry *e; | |
| 134 | 134 | unsigned char ha[ETH_ALEN]; |
| 135 | − struct mlx5e_priv *priv; | |
| 136 | 135 | u8 nud_state, dead; |
| 137 | 136 | |
| 138 | 137 | rtnl_lock(); |
| @@ -156,14 +155,12 @@ static void mlx5e_rep_neigh_update(struct work_struct *work) · 17 unmodified lines | ||
| 156 | 155 | if (!same_dev) |
| 157 | 156 | goto out; |
| 158 | 157 | |
| 159 | − list_for_each_entry(e, &nhe->encap_list, encap_list) { | |
| 160 | − if (!mlx5e_encap_take(e)) | |
| 161 | − continue; | |
| 158 | + /* mlx5e_get_next_init_encap() releases previous encap before returning | |
| 159 | + * the next one. | |
| 160 | + */ | |
| 161 | + while ((e = mlx5e_get_next_init_encap(nhe, e)) != NULL) | |
| 162 | + mlx5e_rep_update_flows(netdev_priv(e->out_dev), e, neigh_connected, ha); | |
| 162 | 163 | |
| 163 | − priv = netdev_priv(e->out_dev); | |
| 164 | − mlx5e_rep_update_flows(priv, e, neigh_connected, ha); | |
| 165 | − mlx5e_encap_put(priv, e); | |
| 166 | − } | |
| 167 | 164 | out: |
| 168 | 165 | rtnl_unlock(); |
| 169 | 166 | mlx5e_release_neigh_update_work(update_work); |
| @@ -94,13 +94,9 @@ void mlx5e_rep_update_flows(struct mlx5e_priv *priv, · 93 unmodified lines | ||
| 94 | 94 | |
| 95 | 95 | ASSERT_RTNL(); |
| 96 | 96 | |
| 97 | − /* wait for encap to be fully initialized */ | |
| 98 | − wait_for_completion(&e->res_ready); | |
| 99 | − | |
| 100 | 97 | mutex_lock(&esw->offloads.encap_tbl_lock); |
| 101 | 98 | encap_connected = !!(e->flags & MLX5_ENCAP_ENTRY_VALID); |
| 102 | − if (e->compl_result < 0 || (encap_connected == neigh_connected && | |
| 103 | − ether_addr_equal(e->h_dest, ha))) | |
| 99 | + if (encap_connected == neigh_connected && ether_addr_equal(e->h_dest, ha)) | |
| 104 | 100 | goto unlock; |
| 105 | 101 | |
| 106 | 102 | mlx5e_take_all_encap_flows(e, &flow_list); |
| @@ -626,7 +622,7 @@ static bool mlx5e_restore_skb(struct sk_buff *skb, u32 chain, u32 reg_c1, · 519 unmodified lines | ||
| 626 | 622 | struct mlx5_eswitch *esw; |
| 627 | 623 | u32 zone_restore_id; |
| 628 | 624 | |
| 629 | − tc_skb_ext = skb_ext_add(skb, TC_SKB_EXT); | |
| 625 | + tc_skb_ext = tc_skb_ext_alloc(skb); | |
| 630 | 626 | if (!tc_skb_ext) { |
| 631 | 627 | WARN_ON(1); |
| 632 | 628 | return false; |
| @@ -251,9 +251,12 @@ static void mlx5e_take_all_route_decap_flows(struct mlx5e_route_entry *r, · 250 unmodified lines | ||
| 251 | 251 | mlx5e_take_tmp_flow(flow, flow_list, 0); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | +typedef bool (match_cb)(struct mlx5e_encap_entry *); | |
| 255 | + | |
| 254 | 256 | static struct mlx5e_encap_entry * |
| 255 | −mlx5e_get_next_valid_encap(struct mlx5e_neigh_hash_entry *nhe, | |
| 256 | − struct mlx5e_encap_entry *e) | |
| 257 | +mlx5e_get_next_matching_encap(struct mlx5e_neigh_hash_entry *nhe, | |
| 258 | + struct mlx5e_encap_entry *e, | |
| 259 | + match_cb match) | |
| 257 | 260 | { |
| 258 | 261 | struct mlx5e_encap_entry *next = NULL; |
| 259 | 262 | |
| @@ -288,7 +291,7 @@ retry: · 28 unmodified lines | ||
| 288 | 291 | /* wait for encap to be fully initialized */ |
| 289 | 292 | wait_for_completion(&next->res_ready); |
| 290 | 293 | /* continue searching if encap entry is not in valid state after completion */ |
| 291 | − if (!(next->flags & MLX5_ENCAP_ENTRY_VALID)) { | |
| 294 | + if (!match(next)) { | |
| 292 | 295 | e = next; |
| 293 | 296 | goto retry; |
| 294 | 297 | } |
| @@ -296,6 +299,30 @@ retry: · 1 unmodified line | ||
| 296 | 299 | return next; |
| 297 | 300 | } |
| 298 | 301 | |
| 302 | +static bool mlx5e_encap_valid(struct mlx5e_encap_entry *e) | |
| 303 | +{ | |
| 304 | + return e->flags & MLX5_ENCAP_ENTRY_VALID; | |
| 305 | +} | |
| 306 | + | |
| 307 | +static struct mlx5e_encap_entry * | |
| 308 | +mlx5e_get_next_valid_encap(struct mlx5e_neigh_hash_entry *nhe, | |
| 309 | + struct mlx5e_encap_entry *e) | |
| 310 | +{ | |
| 311 | + return mlx5e_get_next_matching_encap(nhe, e, mlx5e_encap_valid); | |
| 312 | +} | |
| 313 | + | |
| 314 | +static bool mlx5e_encap_initialized(struct mlx5e_encap_entry *e) | |
| 315 | +{ | |
| 316 | + return e->compl_result >= 0; | |
| 317 | +} | |
| 318 | + | |
| 319 | +struct mlx5e_encap_entry * | |
| 320 | +mlx5e_get_next_init_encap(struct mlx5e_neigh_hash_entry *nhe, | |
| 321 | + struct mlx5e_encap_entry *e) | |
| 322 | +{ | |
| 323 | + return mlx5e_get_next_matching_encap(nhe, e, mlx5e_encap_initialized); | |
| 324 | +} | |
| 325 | + | |
| 299 | 326 | void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe) |
| 300 | 327 | { |
| 301 | 328 | struct mlx5e_neigh *m_neigh = &nhe->m_neigh; |
| @@ -1505,7 +1532,7 @@ mlx5e_init_fib_work_ipv4(struct mlx5e_priv *priv, · 1203 unmodified lines | ||
| 1505 | 1532 | |
| 1506 | 1533 | fen_info = container_of(info, struct fib_entry_notifier_info, info); |
| 1507 | 1534 | fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev; |
| 1508 | − if (fib_dev->netdev_ops != &mlx5e_netdev_ops || | |
| 1535 | + if (!fib_dev || fib_dev->netdev_ops != &mlx5e_netdev_ops || | |
| 1509 | 1536 | fen_info->dst_len != 32) |
| 1510 | 1537 | return NULL; |
| 1511 | 1538 | |
| @@ -532,9 +532,6 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv) · 531 unmodified lines | ||
| 532 | 532 | struct mlx5_core_dev *mdev = priv->mdev; |
| 533 | 533 | struct net_device *netdev = priv->netdev; |
| 534 | 534 | |
| 535 | − if (!priv->ipsec) | |
| 536 | − return; | |
| 537 | − | |
| 538 | 535 | if (!(mlx5_accel_ipsec_device_caps(mdev) & MLX5_ACCEL_IPSEC_CAP_ESP) || |
| 539 | 536 | !MLX5_CAP_ETH(mdev, swp)) { |
| 540 | 537 | mlx5_core_dbg(mdev, "mlx5e: ESP and SWP offload not supported\n"); |
| @@ -356,7 +356,7 @@ err: · 355 unmodified lines | ||
| 356 | 356 | |
| 357 | 357 | int mlx5e_arfs_create_tables(struct mlx5e_priv *priv) |
| 358 | 358 | { |
| 359 | − int err = 0; | |
| 359 | + int err = -ENOMEM; | |
| 360 | 360 | int i; |
| 361 | 361 | |
| 362 | 362 | if (!(priv->netdev->hw_features & NETIF_F_NTUPLE)) |
| @@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev, · 1623 unmodified lines | ||
| 1624 | 1624 | { |
| 1625 | 1625 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 1626 | 1626 | struct mlx5_core_dev *mdev = priv->mdev; |
| 1627 | + unsigned long fec_bitmap; | |
| 1627 | 1628 | u16 fec_policy = 0; |
| 1628 | 1629 | int mode; |
| 1629 | 1630 | int err; |
| 1630 | 1631 | |
| 1631 | − if (bitmap_weight((unsigned long *)&fecparam->fec, | |
| 1632 | − ETHTOOL_FEC_LLRS_BIT + 1) > 1) | |
| 1632 | + bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE); | |
| 1633 | + if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1) | |
| 1633 | 1634 | return -EOPNOTSUPP; |
| 1634 | 1635 | |
| 1635 | 1636 | for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) { |
| @@ -1893,6 +1894,13 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val · 257 unmodified lines | ||
| 1893 | 1894 | if (curr_val == new_val) |
| 1894 | 1895 | return 0; |
| 1895 | 1896 | |
| 1897 | + if (new_val && !priv->profile->rx_ptp_support && | |
| 1898 | + priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) { | |
| 1899 | + netdev_err(priv->netdev, | |
| 1900 | + "Profile doesn't support enabling of CQE compression while hardware time-stamping is enabled.\n"); | |
| 1901 | + return -EINVAL; | |
| 1902 | + } | |
| 1903 | + | |
| 1896 | 1904 | new_params = priv->channels.params; |
| 1897 | 1905 | MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_CQE_COMPRESS, new_val); |
| 1898 | 1906 | if (priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) |
| @@ -35,6 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | #include <linux/ipv6.h> |
| 36 | 36 | #include <linux/tcp.h> |
| 37 | 37 | #include <linux/mlx5/fs.h> |
| 38 | +#include <linux/mlx5/mpfs.h> | |
| 38 | 39 | #include "en.h" |
| 39 | 40 | #include "en_rep.h" |
| 40 | 41 | #include "lib/mpfs.h" |
| @@ -889,10 +889,13 @@ err_free_rq: · 888 unmodified lines | ||
| 889 | 889 | void mlx5e_activate_rq(struct mlx5e_rq *rq) |
| 890 | 890 | { |
| 891 | 891 | set_bit(MLX5E_RQ_STATE_ENABLED, &rq->state); |
| 892 | − if (rq->icosq) | |
| 892 | + if (rq->icosq) { | |
| 893 | 893 | mlx5e_trigger_irq(rq->icosq); |
| 894 | − else | |
| 894 | + } else { | |
| 895 | + local_bh_disable(); | |
| 895 | 896 | napi_schedule(rq->cq.napi); |
| 897 | + local_bh_enable(); | |
| 898 | + } | |
| 896 | 899 | } |
| 897 | 900 | |
| 898 | 901 | void mlx5e_deactivate_rq(struct mlx5e_rq *rq) |
| @@ -2697,13 +2700,11 @@ static int mlx5e_update_netdev_queues(struct mlx5e_priv *priv) · 1798 unmodified lines | ||
| 2697 | 2700 | int err; |
| 2698 | 2701 | |
| 2699 | 2702 | old_num_txqs = netdev->real_num_tx_queues; |
| 2700 | − old_ntc = netdev->num_tc; | |
| 2703 | + old_ntc = netdev->num_tc ? : 1; | |
| 2701 | 2704 | |
| 2702 | 2705 | nch = priv->channels.params.num_channels; |
| 2703 | 2706 | ntc = priv->channels.params.num_tc; |
| 2704 | 2707 | num_rxqs = nch * priv->profile->rq_groups; |
| 2705 | − if (priv->channels.params.ptp_rx) | |
| 2706 | − num_rxqs++; | |
| 2707 | 2708 | |
| 2708 | 2709 | mlx5e_netdev_set_tcs(netdev, nch, ntc); |
| 2709 | 2710 | |
| @@ -3855,6 +3856,16 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, · 1145 unmodified lines | ||
| 3855 | 3856 | netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n"); |
| 3856 | 3857 | } |
| 3857 | 3858 | |
| 3859 | + if (mlx5e_is_uplink_rep(priv)) { | |
| 3860 | + features &= ~NETIF_F_HW_TLS_RX; | |
| 3861 | + if (netdev->features & NETIF_F_HW_TLS_RX) | |
| 3862 | + netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n"); | |
| 3863 | + | |
| 3864 | + features &= ~NETIF_F_HW_TLS_TX; | |
| 3865 | + if (netdev->features & NETIF_F_HW_TLS_TX) | |
| 3866 | + netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n"); | |
| 3867 | + } | |
| 3868 | + | |
| 3858 | 3869 | mutex_unlock(&priv->state_lock); |
| 3859 | 3870 | |
| 3860 | 3871 | return features; |
| @@ -3971,11 +3982,45 @@ int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx) · 110 unmodified lines | ||
| 3971 | 3982 | return mlx5e_ptp_rx_manage_fs(priv, set); |
| 3972 | 3983 | } |
| 3973 | 3984 | |
| 3974 | −int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) | |
| 3985 | +static int mlx5e_hwstamp_config_no_ptp_rx(struct mlx5e_priv *priv, bool rx_filter) | |
| 3986 | +{ | |
| 3987 | + bool rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def; | |
| 3988 | + int err; | |
| 3989 | + | |
| 3990 | + if (!rx_filter) | |
| 3991 | + /* Reset CQE compression to Admin default */ | |
| 3992 | + return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def); | |
| 3993 | + | |
| 3994 | + if (!MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS)) | |
| 3995 | + return 0; | |
| 3996 | + | |
| 3997 | + /* Disable CQE compression */ | |
| 3998 | + netdev_warn(priv->netdev, "Disabling RX cqe compression\n"); | |
| 3999 | + err = mlx5e_modify_rx_cqe_compression_locked(priv, false); | |
| 4000 | + if (err) | |
| 4001 | + netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err); | |
| 4002 | + | |
| 4003 | + return err; | |
| 4004 | +} | |
| 4005 | + | |
| 4006 | +static int mlx5e_hwstamp_config_ptp_rx(struct mlx5e_priv *priv, bool ptp_rx) | |
| 3975 | 4007 | { |
| 3976 | 4008 | struct mlx5e_params new_params; |
| 4009 | + | |
| 4010 | + if (ptp_rx == priv->channels.params.ptp_rx) | |
| 4011 | + return 0; | |
| 4012 | + | |
| 4013 | + new_params = priv->channels.params; | |
| 4014 | + new_params.ptp_rx = ptp_rx; | |
| 4015 | + return mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx, | |
| 4016 | + &new_params.ptp_rx, true); | |
| 4017 | +} | |
| 4018 | + | |
| 4019 | +int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) | |
| 4020 | +{ | |
| 3977 | 4021 | struct hwtstamp_config config; |
| 3978 | 4022 | bool rx_cqe_compress_def; |
| 4023 | + bool ptp_rx; | |
| 3979 | 4024 | int err; |
| 3980 | 4025 | |
| 3981 | 4026 | if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) || |
| @@ -3995,13 +4040,12 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) · 13 unmodified lines | ||
| 3995 | 4040 | } |
| 3996 | 4041 | |
| 3997 | 4042 | mutex_lock(&priv->state_lock); |
| 3998 | − new_params = priv->channels.params; | |
| 3999 | 4043 | rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def; |
| 4000 | 4044 | |
| 4001 | 4045 | /* RX HW timestamp */ |
| 4002 | 4046 | switch (config.rx_filter) { |
| 4003 | 4047 | case HWTSTAMP_FILTER_NONE: |
| 4004 | − new_params.ptp_rx = false; | |
| 4048 | + ptp_rx = false; | |
| 4005 | 4049 | break; |
| 4006 | 4050 | case HWTSTAMP_FILTER_ALL: |
| 4007 | 4051 | case HWTSTAMP_FILTER_SOME: |
| @@ -4018,24 +4062,25 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) · 10 unmodified lines | ||
| 4018 | 4062 | case HWTSTAMP_FILTER_PTP_V2_SYNC: |
| 4019 | 4063 | case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: |
| 4020 | 4064 | case HWTSTAMP_FILTER_NTP_ALL: |
| 4021 | − new_params.ptp_rx = rx_cqe_compress_def; | |
| 4022 | 4065 | config.rx_filter = HWTSTAMP_FILTER_ALL; |
| 4066 | + /* ptp_rx is set if both HW TS is set and CQE | |
| 4067 | + * compression is set | |
| 4068 | + */ | |
| 4069 | + ptp_rx = rx_cqe_compress_def; | |
| 4023 | 4070 | break; |
| 4024 | 4071 | default: |
| 4025 | − mutex_unlock(&priv->state_lock); | |
| 4026 | − return -ERANGE; | |
| 4072 | + err = -ERANGE; | |
| 4073 | + goto err_unlock; | |
| 4027 | 4074 | } |
| 4028 | 4075 | |
| 4029 | − if (new_params.ptp_rx == priv->channels.params.ptp_rx) | |
| 4030 | − goto out; | |
| 4076 | + if (!priv->profile->rx_ptp_support) | |
| 4077 | + err = mlx5e_hwstamp_config_no_ptp_rx(priv, | |
| 4078 | + config.rx_filter != HWTSTAMP_FILTER_NONE); | |
| 4079 | + else | |
| 4080 | + err = mlx5e_hwstamp_config_ptp_rx(priv, ptp_rx); | |
| 4081 | + if (err) | |
| 4082 | + goto err_unlock; | |
| 4031 | 4083 | |
| 4032 | − err = mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx, | |
| 4033 | − &new_params.ptp_rx, true); | |
| 4034 | − if (err) { | |
| 4035 | − mutex_unlock(&priv->state_lock); | |
| 4036 | − return err; | |
| 4037 | − } | |
| 4038 | −out: | |
| 4039 | 4084 | memcpy(&priv->tstamp, &config, sizeof(config)); |
| 4040 | 4085 | mutex_unlock(&priv->state_lock); |
| 4041 | 4086 | |
| @@ -4044,6 +4089,9 @@ out: · 2 unmodified lines | ||
| 4044 | 4089 | |
| 4045 | 4090 | return copy_to_user(ifr->ifr_data, &config, |
| 4046 | 4091 | sizeof(config)) ? -EFAULT : 0; |
| 4092 | +err_unlock: | |
| 4093 | + mutex_unlock(&priv->state_lock); | |
| 4094 | + return err; | |
| 4047 | 4095 | } |
| 4048 | 4096 | |
| 4049 | 4097 | int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr) |
| @@ -4774,22 +4822,15 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) · 724 unmodified lines | ||
| 4774 | 4822 | } |
| 4775 | 4823 | |
| 4776 | 4824 | if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { |
| 4777 | − netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | | |
| 4778 | − NETIF_F_GSO_UDP_TUNNEL_CSUM; | |
| 4779 | − netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL | | |
| 4780 | − NETIF_F_GSO_UDP_TUNNEL_CSUM; | |
| 4781 | − netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; | |
| 4782 | − netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL | | |
| 4783 | − NETIF_F_GSO_UDP_TUNNEL_CSUM; | |
| 4825 | + netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | |
| 4826 | + netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; | |
| 4827 | + netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL; | |
| 4784 | 4828 | } |
| 4785 | 4829 | |
| 4786 | 4830 | if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) { |
| 4787 | − netdev->hw_features |= NETIF_F_GSO_GRE | | |
| 4788 | − NETIF_F_GSO_GRE_CSUM; | |
| 4789 | − netdev->hw_enc_features |= NETIF_F_GSO_GRE | | |
| 4790 | − NETIF_F_GSO_GRE_CSUM; | |
| 4791 | − netdev->gso_partial_features |= NETIF_F_GSO_GRE | | |
| 4792 | − NETIF_F_GSO_GRE_CSUM; | |
| 4831 | + netdev->hw_features |= NETIF_F_GSO_GRE; | |
| 4832 | + netdev->hw_enc_features |= NETIF_F_GSO_GRE; | |
| 4833 | + netdev->gso_partial_features |= NETIF_F_GSO_GRE; | |
| 4793 | 4834 | } |
| 4794 | 4835 | |
| 4795 | 4836 | if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) { |
| @@ -5229,6 +5270,11 @@ static void mlx5e_update_features(struct net_device *netdev) · 433 unmodified lines | ||
| 5229 | 5270 | rtnl_unlock(); |
| 5230 | 5271 | } |
| 5231 | 5272 | |
| 5273 | +static void mlx5e_reset_channels(struct net_device *netdev) | |
| 5274 | +{ | |
| 5275 | + netdev_reset_tc(netdev); | |
| 5276 | +} | |
| 5277 | + | |
| 5232 | 5278 | int mlx5e_attach_netdev(struct mlx5e_priv *priv) |
| 5233 | 5279 | { |
| 5234 | 5280 | const bool take_rtnl = priv->netdev->reg_state == NETREG_REGISTERED; |
| @@ -5283,6 +5329,7 @@ err_cleanup_tx: · 48 unmodified lines | ||
| 5283 | 5329 | profile->cleanup_tx(priv); |
| 5284 | 5330 | |
| 5285 | 5331 | out: |
| 5332 | + mlx5e_reset_channels(priv->netdev); | |
| 5286 | 5333 | set_bit(MLX5E_STATE_DESTROYING, &priv->state); |
| 5287 | 5334 | cancel_work_sync(&priv->update_stats_work); |
| 5288 | 5335 | return err; |
| @@ -5300,6 +5347,7 @@ void mlx5e_detach_netdev(struct mlx5e_priv *priv) · 11 unmodified lines | ||
| 5300 | 5347 | |
| 5301 | 5348 | profile->cleanup_rx(priv); |
| 5302 | 5349 | profile->cleanup_tx(priv); |
| 5350 | + mlx5e_reset_channels(priv->netdev); | |
| 5303 | 5351 | cancel_work_sync(&priv->update_stats_work); |
| 5304 | 5352 | } |
| 5305 | 5353 | |
| @@ -1322,10 +1322,10 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 1321 unmodified lines | ||
| 1322 | 1322 | struct netlink_ext_ack *extack) |
| 1323 | 1323 | { |
| 1324 | 1324 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; |
| 1325 | − struct net_device *out_dev, *encap_dev = NULL; | |
| 1326 | 1325 | struct mlx5e_tc_flow_parse_attr *parse_attr; |
| 1327 | 1326 | struct mlx5_flow_attr *attr = flow->attr; |
| 1328 | 1327 | bool vf_tun = false, encap_valid = true; |
| 1328 | + struct net_device *encap_dev = NULL; | |
| 1329 | 1329 | struct mlx5_esw_flow_attr *esw_attr; |
| 1330 | 1330 | struct mlx5_fc *counter = NULL; |
| 1331 | 1331 | struct mlx5e_rep_priv *rpriv; |
| @@ -1371,16 +1371,22 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 39 unmodified lines | ||
| 1371 | 1371 | esw_attr = attr->esw_attr; |
| 1372 | 1372 | |
| 1373 | 1373 | for (out_index = 0; out_index < MLX5_MAX_FLOW_FWD_VPORTS; out_index++) { |
| 1374 | + struct net_device *out_dev; | |
| 1374 | 1375 | int mirred_ifindex; |
| 1375 | 1376 | |
| 1376 | 1377 | if (!(esw_attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP)) |
| 1377 | 1378 | continue; |
| 1378 | 1379 | |
| 1379 | 1380 | mirred_ifindex = parse_attr->mirred_ifindex[out_index]; |
| 1380 | − out_dev = __dev_get_by_index(dev_net(priv->netdev), | |
| 1381 | − mirred_ifindex); | |
| 1381 | + out_dev = dev_get_by_index(dev_net(priv->netdev), mirred_ifindex); | |
| 1382 | + if (!out_dev) { | |
| 1383 | + NL_SET_ERR_MSG_MOD(extack, "Requested mirred device not found"); | |
| 1384 | + err = -ENODEV; | |
| 1385 | + goto err_out; | |
| 1386 | + } | |
| 1382 | 1387 | err = mlx5e_attach_encap(priv, flow, out_dev, out_index, |
| 1383 | 1388 | extack, &encap_dev, &encap_valid); |
| 1389 | + dev_put(out_dev); | |
| 1384 | 1390 | if (err) |
| 1385 | 1391 | goto err_out; |
| 1386 | 1392 | |
| @@ -1393,6 +1399,12 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 6 unmodified lines | ||
| 1393 | 1399 | esw_attr->dests[out_index].mdev = out_priv->mdev; |
| 1394 | 1400 | } |
| 1395 | 1401 | |
| 1402 | + if (vf_tun && esw_attr->out_count > 1) { | |
| 1403 | + NL_SET_ERR_MSG_MOD(extack, "VF tunnel encap with mirroring is not supported"); | |
| 1404 | + err = -EOPNOTSUPP; | |
| 1405 | + goto err_out; | |
| 1406 | + } | |
| 1407 | + | |
| 1396 | 1408 | err = mlx5_eswitch_add_vlan_action(esw, attr); |
| 1397 | 1409 | if (err) |
| 1398 | 1410 | goto err_out; |
| @@ -2003,11 +2015,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 604 unmodified lines | ||
| 2003 | 2015 | misc_parameters_3); |
| 2004 | 2016 | struct flow_rule *rule = flow_cls_offload_flow_rule(f); |
| 2005 | 2017 | struct flow_dissector *dissector = rule->match.dissector; |
| 2018 | + enum fs_flow_table_type fs_type; | |
| 2006 | 2019 | u16 addr_type = 0; |
| 2007 | 2020 | u8 ip_proto = 0; |
| 2008 | 2021 | u8 *match_level; |
| 2009 | 2022 | int err; |
| 2010 | 2023 | |
| 2024 | + fs_type = mlx5e_is_eswitch_flow(flow) ? FS_FT_FDB : FS_FT_NIC_RX; | |
| 2011 | 2025 | match_level = outer_match_level; |
| 2012 | 2026 | |
| 2013 | 2027 | if (dissector->used_keys & |
| @@ -2133,6 +2147,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 119 unmodified lines | ||
| 2133 | 2147 | if (match.mask->vlan_id || |
| 2134 | 2148 | match.mask->vlan_priority || |
| 2135 | 2149 | match.mask->vlan_tpid) { |
| 2150 | + if (!MLX5_CAP_FLOWTABLE_TYPE(priv->mdev, ft_field_support.outer_second_vid, | |
| 2151 | + fs_type)) { | |
| 2152 | + NL_SET_ERR_MSG_MOD(extack, | |
| 2153 | + "Matching on CVLAN is not supported"); | |
| 2154 | + return -EOPNOTSUPP; | |
| 2155 | + } | |
| 2156 | + | |
| 2136 | 2157 | if (match.key->vlan_tpid == htons(ETH_P_8021AD)) { |
| 2137 | 2158 | MLX5_SET(fte_match_set_misc, misc_c, |
| 2138 | 2159 | outer_second_svlan_tag, 1); |
| @@ -3526,8 +3547,12 @@ static int add_vlan_push_action(struct mlx5e_priv *priv, · 1387 unmodified lines | ||
| 3526 | 3547 | if (err) |
| 3527 | 3548 | return err; |
| 3528 | 3549 | |
| 3529 | − *out_dev = dev_get_by_index_rcu(dev_net(vlan_dev), | |
| 3530 | − dev_get_iflink(vlan_dev)); | |
| 3550 | + rcu_read_lock(); | |
| 3551 | + *out_dev = dev_get_by_index_rcu(dev_net(vlan_dev), dev_get_iflink(vlan_dev)); | |
| 3552 | + rcu_read_unlock(); | |
| 3553 | + if (!*out_dev) | |
| 3554 | + return -ENODEV; | |
| 3555 | + | |
| 3531 | 3556 | if (is_vlan_dev(*out_dev)) |
| 3532 | 3557 | err = add_vlan_push_action(priv, attr, out_dev, action); |
| 3533 | 3558 | |
| @@ -4740,7 +4765,7 @@ static void mlx5e_tc_hairpin_update_dead_peer(struct mlx5e_priv *priv, · 1206 unmodified lines | ||
| 4740 | 4765 | list_for_each_entry_safe(hpe, tmp, &init_wait_list, dead_peer_wait_list) { |
| 4741 | 4766 | wait_for_completion(&hpe->res_ready); |
| 4742 | 4767 | if (!IS_ERR_OR_NULL(hpe->hp) && hpe->peer_vhca_id == peer_vhca_id) |
| 4743 | − hpe->hp->pair->peer_gone = true; | |
| 4768 | + mlx5_core_hairpin_clear_dead_peer(hpe->hp->pair); | |
| 4744 | 4769 | |
| 4745 | 4770 | mlx5e_hairpin_put(priv, hpe); |
| 4746 | 4771 | } |
| @@ -5074,7 +5099,7 @@ bool mlx5e_tc_update_skb(struct mlx5_cqe64 *cqe, · 327 unmodified lines | ||
| 5074 | 5099 | |
| 5075 | 5100 | if (mapped_obj.type == MLX5_MAPPED_OBJ_CHAIN) { |
| 5076 | 5101 | chain = mapped_obj.chain; |
| 5077 | − tc_skb_ext = skb_ext_add(skb, TC_SKB_EXT); | |
| 5102 | + tc_skb_ext = tc_skb_ext_alloc(skb); | |
| 5078 | 5103 | if (WARN_ON(!tc_skb_ext)) |
| 5079 | 5104 | return false; |
| 5080 | 5105 | |
| @@ -178,6 +178,9 @@ void mlx5e_take_all_encap_flows(struct mlx5e_encap_entry *e, struct list_head *f · 177 unmodified lines | ||
| 178 | 178 | void mlx5e_put_flow_list(struct mlx5e_priv *priv, struct list_head *flow_list); |
| 179 | 179 | |
| 180 | 180 | struct mlx5e_neigh_hash_entry; |
| 181 | +struct mlx5e_encap_entry * | |
| 182 | +mlx5e_get_next_init_encap(struct mlx5e_neigh_hash_entry *nhe, | |
| 183 | + struct mlx5e_encap_entry *e); | |
| 181 | 184 | void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe); |
| 182 | 185 | |
| 183 | 186 | void mlx5e_tc_reoffload_flows_work(struct work_struct *work); |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | #include <linux/tcp.h> |
| 34 | 34 | #include <linux/if_vlan.h> |
| 35 | −#include <linux/ptp_classify.h> | |
| 36 | 35 | #include <net/geneve.h> |
| 37 | 36 | #include <net/dsfield.h> |
| 38 | 37 | #include "en.h" |
| @@ -67,24 +66,6 @@ static inline int mlx5e_get_dscp_up(struct mlx5e_priv *priv, struct sk_buff *skb · 28 unmodified lines | ||
| 67 | 66 | } |
| 68 | 67 | #endif |
| 69 | 68 | |
| 70 | −static bool mlx5e_use_ptpsq(struct sk_buff *skb) | |
| 71 | −{ | |
| 72 | − struct flow_keys fk; | |
| 73 | − | |
| 74 | − if (!skb_flow_dissect_flow_keys(skb, &fk, 0)) | |
| 75 | − return false; | |
| 76 | − | |
| 77 | − if (fk.basic.n_proto == htons(ETH_P_1588)) | |
| 78 | − return true; | |
| 79 | − | |
| 80 | − if (fk.basic.n_proto != htons(ETH_P_IP) && | |
| 81 | − fk.basic.n_proto != htons(ETH_P_IPV6)) | |
| 82 | − return false; | |
| 83 | − | |
| 84 | − return (fk.basic.ip_proto == IPPROTO_UDP && | |
| 85 | − fk.ports.dst == htons(PTP_EV_PORT)); | |
| 86 | −} | |
| 87 | − | |
| 88 | 69 | static u16 mlx5e_select_ptpsq(struct net_device *dev, struct sk_buff *skb) |
| 89 | 70 | { |
| 90 | 71 | struct mlx5e_priv *priv = netdev_priv(dev); |
| @@ -145,9 +126,9 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, · 54 unmodified lines | ||
| 145 | 126 | } |
| 146 | 127 | |
| 147 | 128 | ptp_channel = READ_ONCE(priv->channels.ptp); |
| 148 | − if (unlikely(ptp_channel) && | |
| 149 | − test_bit(MLX5E_PTP_STATE_TX, ptp_channel->state) && | |
| 150 | − mlx5e_use_ptpsq(skb)) | |
| 129 | + if (unlikely(ptp_channel && | |
| 130 | + test_bit(MLX5E_PTP_STATE_TX, ptp_channel->state) && | |
| 131 | + mlx5e_use_ptpsq(skb))) | |
| 151 | 132 | return mlx5e_select_ptpsq(dev, skb); |
| 152 | 133 | |
| 153 | 134 | txq_ix = netdev_pick_tx(dev, skb, NULL); |
| @@ -136,7 +136,7 @@ static int mlx5_eq_comp_int(struct notifier_block *nb, · 135 unmodified lines | ||
| 136 | 136 | |
| 137 | 137 | eqe = next_eqe_sw(eq); |
| 138 | 138 | if (!eqe) |
| 139 | − return 0; | |
| 139 | + goto out; | |
| 140 | 140 | |
| 141 | 141 | do { |
| 142 | 142 | struct mlx5_core_cq *cq; |
| @@ -161,6 +161,8 @@ static int mlx5_eq_comp_int(struct notifier_block *nb, · 18 unmodified lines | ||
| 161 | 161 | ++eq->cons_index; |
| 162 | 162 | |
| 163 | 163 | } while ((++num_eqes < MLX5_EQ_POLLING_BUDGET) && (eqe = next_eqe_sw(eq))); |
| 164 | + | |
| 165 | +out: | |
| 164 | 166 | eq_update_ci(eq, 1); |
| 165 | 167 | |
| 166 | 168 | if (cqn != -1) |
| @@ -248,9 +250,9 @@ static int mlx5_eq_async_int(struct notifier_block *nb, · 81 unmodified lines | ||
| 248 | 250 | ++eq->cons_index; |
| 249 | 251 | |
| 250 | 252 | } while ((++num_eqes < MLX5_EQ_POLLING_BUDGET) && (eqe = next_eqe_sw(eq))); |
| 251 | − eq_update_ci(eq, 1); | |
| 252 | 253 | |
| 253 | 254 | out: |
| 255 | + eq_update_ci(eq, 1); | |
| 254 | 256 | mlx5_eq_async_int_unlock(eq_async, recovery, &flags); |
| 255 | 257 | |
| 256 | 258 | return unlikely(recovery) ? num_eqes : 0; |
| @@ -35,6 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | #include <linux/mlx5/mlx5_ifc.h> |
| 36 | 36 | #include <linux/mlx5/vport.h> |
| 37 | 37 | #include <linux/mlx5/fs.h> |
| 38 | +#include <linux/mlx5/mpfs.h> | |
| 38 | 39 | #include "esw/acl/lgcy.h" |
| 39 | 40 | #include "esw/legacy.h" |
| 40 | 41 | #include "mlx5_core.h" |
| @@ -1053,6 +1054,12 @@ int mlx5_esw_vport_enable(struct mlx5_eswitch *esw, u16 vport_num, · 1012 unmodified lines | ||
| 1053 | 1054 | goto err_vhca_mapping; |
| 1054 | 1055 | } |
| 1055 | 1056 | |
| 1057 | + /* External controller host PF has factory programmed MAC. | |
| 1058 | + * Read it from the device. | |
| 1059 | + */ | |
| 1060 | + if (mlx5_core_is_ecpf(esw->dev) && vport_num == MLX5_VPORT_PF) | |
| 1061 | + mlx5_query_nic_vport_mac_address(esw->dev, vport_num, true, vport->info.mac); | |
| 1062 | + | |
| 1056 | 1063 | esw_vport_change_handle_locked(vport); |
| 1057 | 1064 | |
| 1058 | 1065 | esw->enabled_vports++; |
| @@ -219,7 +219,8 @@ esw_setup_slow_path_dest(struct mlx5_flow_destination *dest, · 218 unmodified lines | ||
| 219 | 219 | struct mlx5_fs_chains *chains, |
| 220 | 220 | int i) |
| 221 | 221 | { |
| 222 | − flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL; | |
| 222 | + if (mlx5_chains_ignore_flow_level_supported(chains)) | |
| 223 | + flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL; | |
| 223 | 224 | dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; |
| 224 | 225 | dest[i].ft = mlx5_chains_get_tc_end_ft(chains); |
| 225 | 226 | } |
| @@ -65,7 +65,7 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev, · 64 unmodified lines | ||
| 65 | 65 | { |
| 66 | 66 | struct mlx5_flow_table_attr ft_attr = {}; |
| 67 | 67 | struct mlx5_flow_namespace *root_ns; |
| 68 | − int err; | |
| 68 | + int err, err2; | |
| 69 | 69 | |
| 70 | 70 | root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB); |
| 71 | 71 | if (!root_ns) { |
| @@ -76,33 +76,34 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev, · 4 unmodified lines | ||
| 76 | 76 | /* As this is the terminating action then the termination table is the |
| 77 | 77 | * same prio as the slow path |
| 78 | 78 | */ |
| 79 | − ft_attr.flags = MLX5_FLOW_TABLE_TERMINATION | | |
| 79 | + ft_attr.flags = MLX5_FLOW_TABLE_TERMINATION | MLX5_FLOW_TABLE_UNMANAGED | | |
| 80 | 80 | MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT; |
| 81 | − ft_attr.prio = FDB_SLOW_PATH; | |
| 81 | + ft_attr.prio = FDB_TC_OFFLOAD; | |
| 82 | 82 | ft_attr.max_fte = 1; |
| 83 | + ft_attr.level = 1; | |
| 83 | 84 | ft_attr.autogroup.max_num_groups = 1; |
| 84 | 85 | tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr); |
| 85 | 86 | if (IS_ERR(tt->termtbl)) { |
| 86 | − esw_warn(dev, "Failed to create termination table (error %d)\n", | |
| 87 | − IS_ERR(tt->termtbl)); | |
| 88 | − return -EOPNOTSUPP; | |
| 87 | + err = PTR_ERR(tt->termtbl); | |
| 88 | + esw_warn(dev, "Failed to create termination table, err %pe\n", tt->termtbl); | |
| 89 | + return err; | |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | 92 | tt->rule = mlx5_add_flow_rules(tt->termtbl, NULL, flow_act, |
| 92 | 93 | &tt->dest, 1); |
| 93 | 94 | if (IS_ERR(tt->rule)) { |
| 94 | − esw_warn(dev, "Failed to create termination table rule (error %d)\n", | |
| 95 | − IS_ERR(tt->rule)); | |
| 95 | + err = PTR_ERR(tt->rule); | |
| 96 | + esw_warn(dev, "Failed to create termination table rule, err %pe\n", tt->rule); | |
| 96 | 97 | goto add_flow_err; |
| 97 | 98 | } |
| 98 | 99 | return 0; |
| 99 | 100 | |
| 100 | 101 | add_flow_err: |
| 101 | − err = mlx5_destroy_flow_table(tt->termtbl); | |
| 102 | − if (err) | |
| 103 | − esw_warn(dev, "Failed to destroy termination table\n"); | |
| 102 | + err2 = mlx5_destroy_flow_table(tt->termtbl); | |
| 103 | + if (err2) | |
| 104 | + esw_warn(dev, "Failed to destroy termination table, err %d\n", err2); | |
| 104 | 105 | |
| 105 | − return -EOPNOTSUPP; | |
| 106 | + return err; | |
| 106 | 107 | } |
| 107 | 108 | |
| 108 | 109 | static struct mlx5_termtbl_handle * |
| @@ -172,19 +173,6 @@ mlx5_eswitch_termtbl_put(struct mlx5_eswitch *esw, · 63 unmodified lines | ||
| 172 | 173 | } |
| 173 | 174 | } |
| 174 | 175 | |
| 175 | −static bool mlx5_eswitch_termtbl_is_encap_reformat(struct mlx5_pkt_reformat *rt) | |
| 176 | −{ | |
| 177 | − switch (rt->reformat_type) { | |
| 178 | − case MLX5_REFORMAT_TYPE_L2_TO_VXLAN: | |
| 179 | − case MLX5_REFORMAT_TYPE_L2_TO_NVGRE: | |
| 180 | − case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL: | |
| 181 | − case MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL: | |
| 182 | − return true; | |
| 183 | − default: | |
| 184 | − return false; | |
| 185 | − } | |
| 186 | −} | |
| 187 | − | |
| 188 | 176 | static void |
| 189 | 177 | mlx5_eswitch_termtbl_actions_move(struct mlx5_flow_act *src, |
| 190 | 178 | struct mlx5_flow_act *dst) |
| @@ -202,14 +190,6 @@ mlx5_eswitch_termtbl_actions_move(struct mlx5_flow_act *src, · 11 unmodified lines | ||
| 202 | 190 | memset(&src->vlan[1], 0, sizeof(src->vlan[1])); |
| 203 | 191 | } |
| 204 | 192 | } |
| 205 | − | |
| 206 | − if (src->action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT && | |
| 207 | − mlx5_eswitch_termtbl_is_encap_reformat(src->pkt_reformat)) { | |
| 208 | − src->action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; | |
| 209 | − dst->action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; | |
| 210 | − dst->pkt_reformat = src->pkt_reformat; | |
| 211 | − src->pkt_reformat = NULL; | |
| 212 | − } | |
| 213 | 193 | } |
| 214 | 194 | |
| 215 | 195 | static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw, |
| @@ -238,6 +218,7 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, · 22 unmodified lines | ||
| 238 | 218 | int i; |
| 239 | 219 | |
| 240 | 220 | if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, termination_table) || |
| 221 | + !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ignore_flow_level) || | |
| 241 | 222 | attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH || |
| 242 | 223 | !mlx5_eswitch_offload_is_uplink_port(esw, spec)) |
| 243 | 224 | return false; |
| @@ -279,12 +260,19 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw, · 35 unmodified lines | ||
| 279 | 260 | if (dest[i].type != MLX5_FLOW_DESTINATION_TYPE_VPORT) |
| 280 | 261 | continue; |
| 281 | 262 | |
| 263 | + if (attr->dests[num_vport_dests].flags & MLX5_ESW_DEST_ENCAP) { | |
| 264 | + term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; | |
| 265 | + term_tbl_act.pkt_reformat = attr->dests[num_vport_dests].pkt_reformat; | |
| 266 | + } else { | |
| 267 | + term_tbl_act.action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; | |
| 268 | + term_tbl_act.pkt_reformat = NULL; | |
| 269 | + } | |
| 270 | + | |
| 282 | 271 | /* get the terminating table for the action list */ |
| 283 | 272 | tt = mlx5_eswitch_termtbl_get_create(esw, &term_tbl_act, |
| 284 | 273 | &dest[i], attr); |
| 285 | 274 | if (IS_ERR(tt)) { |
| 286 | − esw_warn(esw->dev, "Failed to get termination table (error %d)\n", | |
| 287 | − IS_ERR(tt)); | |
| 275 | + esw_warn(esw->dev, "Failed to get termination table, err %pe\n", tt); | |
| 288 | 276 | goto revert_changes; |
| 289 | 277 | } |
| 290 | 278 | attr->dests[num_vport_dests].termtbl = tt; |
| @@ -301,6 +289,9 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw, · 10 unmodified lines | ||
| 301 | 289 | goto revert_changes; |
| 302 | 290 | |
| 303 | 291 | /* create the FTE */ |
| 292 | + flow_act->action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; | |
| 293 | + flow_act->pkt_reformat = NULL; | |
| 294 | + flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL; | |
| 304 | 295 | rule = mlx5_add_flow_rules(fdb, spec, flow_act, dest, num_dest); |
| 305 | 296 | if (IS_ERR(rule)) |
| 306 | 297 | goto revert_changes; |
| @@ -349,6 +349,9 @@ static void mlx5_sync_reset_abort_event(struct work_struct *work) · 348 unmodified lines | ||
| 349 | 349 | reset_abort_work); |
| 350 | 350 | struct mlx5_core_dev *dev = fw_reset->dev; |
| 351 | 351 | |
| 352 | + if (!test_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags)) | |
| 353 | + return; | |
| 354 | + | |
| 352 | 355 | mlx5_sync_reset_clear_reset_requested(dev, true); |
| 353 | 356 | mlx5_core_warn(dev, "PCI Sync FW Update Reset Aborted.\n"); |
| 354 | 357 | } |
| @@ -307,6 +307,11 @@ int mlx5_lag_mp_init(struct mlx5_lag *ldev) · 306 unmodified lines | ||
| 307 | 307 | struct lag_mp *mp = &ldev->lag_mp; |
| 308 | 308 | int err; |
| 309 | 309 | |
| 310 | + /* always clear mfi, as it might become stale when a route delete event | |
| 311 | + * has been missed | |
| 312 | + */ | |
| 313 | + mp->mfi = NULL; | |
| 314 | + | |
| 310 | 315 | if (mp->fib_nb.notifier_call) |
| 311 | 316 | return 0; |
| 312 | 317 | |
| @@ -335,4 +340,5 @@ void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev) · 22 unmodified lines | ||
| 335 | 340 | unregister_fib_notifier(&init_net, &mp->fib_nb); |
| 336 | 341 | destroy_workqueue(mp->wq); |
| 337 | 342 | mp->fib_nb.notifier_call = NULL; |
| 343 | + mp->mfi = NULL; | |
| 338 | 344 | } |
| @@ -107,7 +107,7 @@ bool mlx5_chains_prios_supported(struct mlx5_fs_chains *chains) · 106 unmodified lines | ||
| 107 | 107 | return chains->flags & MLX5_CHAINS_AND_PRIOS_SUPPORTED; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | −static bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains) | |
| 110 | +bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains) | |
| 111 | 111 | { |
| 112 | 112 | return chains->flags & MLX5_CHAINS_IGNORE_FLOW_LEVEL_SUPPORTED; |
| 113 | 113 | } |
| @@ -28,6 +28,7 @@ struct mlx5_chains_attr { · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | bool |
| 30 | 30 | mlx5_chains_prios_supported(struct mlx5_fs_chains *chains); |
| 31 | +bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains); | |
| 31 | 32 | bool |
| 32 | 33 | mlx5_chains_backwards_supported(struct mlx5_fs_chains *chains); |
| 33 | 34 | u32 |
| @@ -70,6 +71,10 @@ mlx5_chains_set_end_ft(struct mlx5_fs_chains *chains, · 36 unmodified lines | ||
| 70 | 71 | |
| 71 | 72 | #else /* CONFIG_MLX5_CLS_ACT */ |
| 72 | 73 | |
| 74 | +static inline bool | |
| 75 | +mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains) | |
| 76 | +{ return false; } | |
| 77 | + | |
| 73 | 78 | static inline struct mlx5_flow_table * |
| 74 | 79 | mlx5_chains_get_table(struct mlx5_fs_chains *chains, u32 chain, u32 prio, |
| 75 | 80 | u32 level) { return ERR_PTR(-EOPNOTSUPP); } |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #include <linux/etherdevice.h> |
| 34 | 34 | #include <linux/mlx5/driver.h> |
| 35 | 35 | #include <linux/mlx5/mlx5_ifc.h> |
| 36 | +#include <linux/mlx5/mpfs.h> | |
| 36 | 37 | #include <linux/mlx5/eswitch.h> |
| 37 | 38 | #include "mlx5_core.h" |
| 38 | 39 | #include "lib/mpfs.h" |
| @@ -175,6 +176,7 @@ out: · 136 unmodified lines | ||
| 175 | 176 | mutex_unlock(&mpfs->lock); |
| 176 | 177 | return err; |
| 177 | 178 | } |
| 179 | +EXPORT_SYMBOL(mlx5_mpfs_add_mac); | |
| 178 | 180 | |
| 179 | 181 | int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac) |
| 180 | 182 | { |
| @@ -206,3 +208,4 @@ unlock: · 25 unmodified lines | ||
| 206 | 208 | mutex_unlock(&mpfs->lock); |
| 207 | 209 | return err; |
| 208 | 210 | } |
| 211 | +EXPORT_SYMBOL(mlx5_mpfs_del_mac); | |
| @@ -84,12 +84,9 @@ struct l2addr_node { · 83 unmodified lines | ||
| 84 | 84 | #ifdef CONFIG_MLX5_MPFS |
| 85 | 85 | int mlx5_mpfs_init(struct mlx5_core_dev *dev); |
| 86 | 86 | void mlx5_mpfs_cleanup(struct mlx5_core_dev *dev); |
| 87 | −int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac); | |
| 88 | −int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac); | |
| 89 | 87 | #else /* #ifndef CONFIG_MLX5_MPFS */ |
| 90 | 88 | static inline int mlx5_mpfs_init(struct mlx5_core_dev *dev) { return 0; } |
| 91 | 89 | static inline void mlx5_mpfs_cleanup(struct mlx5_core_dev *dev) {} |
| 92 | −static inline int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac) { return 0; } | |
| 93 | −static inline int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac) { return 0; } | |
| 94 | 90 | #endif |
| 91 | + | |
| 95 | 92 | #endif |
| @@ -503,7 +503,7 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev, void *set_ctx) · 502 unmodified lines | ||
| 503 | 503 | |
| 504 | 504 | static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) |
| 505 | 505 | { |
| 506 | − struct mlx5_profile *prof = dev->profile; | |
| 506 | + struct mlx5_profile *prof = &dev->profile; | |
| 507 | 507 | void *set_hca_cap; |
| 508 | 508 | int err; |
| 509 | 509 | |
| @@ -524,11 +524,11 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) · 14 unmodified lines | ||
| 524 | 524 | to_fw_pkey_sz(dev, 128)); |
| 525 | 525 | |
| 526 | 526 | /* Check log_max_qp from HCA caps to set in current profile */ |
| 527 | − if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) { | |
| 527 | + if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { | |
| 528 | 528 | mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n", |
| 529 | − profile[prof_sel].log_max_qp, | |
| 529 | + prof->log_max_qp, | |
| 530 | 530 | MLX5_CAP_GEN_MAX(dev, log_max_qp)); |
| 531 | − profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp); | |
| 531 | + prof->log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp); | |
| 532 | 532 | } |
| 533 | 533 | if (prof->mask & MLX5_PROF_MASK_QP_SIZE) |
| 534 | 534 | MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp, |
| @@ -1161,7 +1161,7 @@ static int mlx5_load(struct mlx5_core_dev *dev) · 626 unmodified lines | ||
| 1161 | 1161 | err = mlx5_core_set_hca_defaults(dev); |
| 1162 | 1162 | if (err) { |
| 1163 | 1163 | mlx5_core_err(dev, "Failed to set hca defaults\n"); |
| 1164 | − goto err_sriov; | |
| 1164 | + goto err_set_hca; | |
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | 1167 | mlx5_vhca_event_start(dev); |
| @@ -1194,6 +1194,7 @@ err_ec: · 26 unmodified lines | ||
| 1194 | 1194 | mlx5_sf_hw_table_destroy(dev); |
| 1195 | 1195 | err_vhca: |
| 1196 | 1196 | mlx5_vhca_event_stop(dev); |
| 1197 | +err_set_hca: | |
| 1197 | 1198 | mlx5_cleanup_fs(dev); |
| 1198 | 1199 | err_fs: |
| 1199 | 1200 | mlx5_accel_tls_cleanup(dev); |
| @@ -1381,8 +1382,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) · 181 unmodified lines | ||
| 1381 | 1382 | struct mlx5_priv *priv = &dev->priv; |
| 1382 | 1383 | int err; |
| 1383 | 1384 | |
| 1384 | − dev->profile = &profile[profile_idx]; | |
| 1385 | − | |
| 1385 | + memcpy(&dev->profile, &profile[profile_idx], sizeof(dev->profile)); | |
| 1386 | 1386 | INIT_LIST_HEAD(&priv->ctx_list); |
| 1387 | 1387 | spin_lock_init(&priv->ctx_lock); |
| 1388 | 1388 | mutex_init(&dev->intf_state_mutex); |
| @@ -54,7 +54,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, · 53 unmodified lines | ||
| 54 | 54 | mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index); |
| 55 | 55 | mkey->iova = MLX5_GET64(mkc, mkc, start_addr); |
| 56 | 56 | mkey->size = MLX5_GET64(mkc, mkc, len); |
| 57 | − mkey->key |= mlx5_idx_to_mkey(mkey_index); | |
| 57 | + mkey->key = (u32)mlx5_mkey_variant(mkey->key) | mlx5_idx_to_mkey(mkey_index); | |
| 58 | 58 | mkey->pd = MLX5_GET(mkc, mkc, pd); |
| 59 | 59 | init_waitqueue_head(&mkey->wait); |
| 60 | 60 | |
| @@ -95,9 +95,10 @@ int mlx5_get_default_msix_vec_count(struct mlx5_core_dev *dev, int num_vfs) · 94 unmodified lines | ||
| 95 | 95 | int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id, |
| 96 | 96 | int msix_vec_count) |
| 97 | 97 | { |
| 98 | − int sz = MLX5_ST_SZ_BYTES(set_hca_cap_in); | |
| 98 | + int query_sz = MLX5_ST_SZ_BYTES(query_hca_cap_out); | |
| 99 | + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in); | |
| 100 | + void *hca_cap = NULL, *query_cap = NULL, *cap; | |
| 99 | 101 | int num_vf_msix, min_msix, max_msix; |
| 100 | − void *hca_cap, *cap; | |
| 101 | 102 | int ret; |
| 102 | 103 | |
| 103 | 104 | num_vf_msix = MLX5_CAP_GEN_MAX(dev, num_total_dynamic_vf_msix); |
| @@ -116,11 +117,20 @@ int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id, · 12 unmodified lines | ||
| 116 | 117 | if (msix_vec_count > max_msix) |
| 117 | 118 | return -EOVERFLOW; |
| 118 | 119 | |
| 119 | − hca_cap = kzalloc(sz, GFP_KERNEL); | |
| 120 | − if (!hca_cap) | |
| 121 | − return -ENOMEM; | |
| 120 | + query_cap = kzalloc(query_sz, GFP_KERNEL); | |
| 121 | + hca_cap = kzalloc(set_sz, GFP_KERNEL); | |
| 122 | + if (!hca_cap || !query_cap) { | |
| 123 | + ret = -ENOMEM; | |
| 124 | + goto out; | |
| 125 | + } | |
| 126 | + | |
| 127 | + ret = mlx5_vport_get_other_func_cap(dev, function_id, query_cap); | |
| 128 | + if (ret) | |
| 129 | + goto out; | |
| 122 | 130 | |
| 123 | 131 | cap = MLX5_ADDR_OF(set_hca_cap_in, hca_cap, capability); |
| 132 | + memcpy(cap, MLX5_ADDR_OF(query_hca_cap_out, query_cap, capability), | |
| 133 | + MLX5_UN_SZ_BYTES(hca_cap_union)); | |
| 124 | 134 | MLX5_SET(cmd_hca_cap, cap, dynamic_msix_table_size, msix_vec_count); |
| 125 | 135 | |
| 126 | 136 | MLX5_SET(set_hca_cap_in, hca_cap, opcode, MLX5_CMD_OP_SET_HCA_CAP); |
| @@ -130,7 +140,9 @@ int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id, · 3 unmodified lines | ||
| 130 | 140 | MLX5_SET(set_hca_cap_in, hca_cap, op_mod, |
| 131 | 141 | MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE << 1); |
| 132 | 142 | ret = mlx5_cmd_exec_in(dev, set_hca_cap, hca_cap); |
| 143 | +out: | |
| 133 | 144 | kfree(hca_cap); |
| 145 | + kfree(query_cap); | |
| 134 | 146 | return ret; |
| 135 | 147 | } |
| 136 | 148 | |
| @@ -156,6 +156,9 @@ void mlx5_rdma_enable_roce(struct mlx5_core_dev *dev) · 155 unmodified lines | ||
| 156 | 156 | { |
| 157 | 157 | int err; |
| 158 | 158 | |
| 159 | + if (!MLX5_CAP_GEN(dev, roce)) | |
| 160 | + return; | |
| 161 | + | |
| 159 | 162 | err = mlx5_nic_vport_enable_roce(dev); |
| 160 | 163 | if (err) { |
| 161 | 164 | mlx5_core_err(dev, "Failed to enable RoCE: %d\n", err); |
| @@ -163,6 +163,7 @@ mlx5_sf_dev_state_change_handler(struct notifier_block *nb, unsigned long event_ · 162 unmodified lines | ||
| 163 | 163 | sf_index = event->function_id - base_id; |
| 164 | 164 | sf_dev = xa_load(&table->devices, sf_index); |
| 165 | 165 | switch (event->new_vhca_state) { |
| 166 | + case MLX5_VHCA_STATE_INVALID: | |
| 166 | 167 | case MLX5_VHCA_STATE_ALLOCATED: |
| 167 | 168 | if (sf_dev) |
| 168 | 169 | mlx5_sf_dev_del(table->dev, sf_dev, sf_index); |
| @@ -136,10 +136,10 @@ static enum devlink_port_fn_state mlx5_sf_to_devlink_state(u8 hw_state) · 135 unmodified lines | ||
| 136 | 136 | switch (hw_state) { |
| 137 | 137 | case MLX5_VHCA_STATE_ACTIVE: |
| 138 | 138 | case MLX5_VHCA_STATE_IN_USE: |
| 139 | − case MLX5_VHCA_STATE_TEARDOWN_REQUEST: | |
| 140 | 139 | return DEVLINK_PORT_FN_STATE_ACTIVE; |
| 141 | 140 | case MLX5_VHCA_STATE_INVALID: |
| 142 | 141 | case MLX5_VHCA_STATE_ALLOCATED: |
| 142 | + case MLX5_VHCA_STATE_TEARDOWN_REQUEST: | |
| 143 | 143 | default: |
| 144 | 144 | return DEVLINK_PORT_FN_STATE_INACTIVE; |
| 145 | 145 | } |
| @@ -192,14 +192,17 @@ sf_err: · 46 unmodified lines | ||
| 192 | 192 | return err; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | −static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf) | |
| 195 | +static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf, | |
| 196 | + struct netlink_ext_ack *extack) | |
| 196 | 197 | { |
| 197 | 198 | int err; |
| 198 | 199 | |
| 199 | 200 | if (mlx5_sf_is_active(sf)) |
| 200 | 201 | return 0; |
| 201 | − if (sf->hw_state != MLX5_VHCA_STATE_ALLOCATED) | |
| 202 | − return -EINVAL; | |
| 202 | + if (sf->hw_state != MLX5_VHCA_STATE_ALLOCATED) { | |
| 203 | + NL_SET_ERR_MSG_MOD(extack, "SF is inactivated but it is still attached"); | |
| 204 | + return -EBUSY; | |
| 205 | + } | |
| 203 | 206 | |
| 204 | 207 | err = mlx5_cmd_sf_enable_hca(dev, sf->hw_fn_id); |
| 205 | 208 | if (err) |
| @@ -226,7 +229,8 @@ static int mlx5_sf_deactivate(struct mlx5_core_dev *dev, struct mlx5_sf *sf) · 20 unmodified lines | ||
| 226 | 229 | |
| 227 | 230 | static int mlx5_sf_state_set(struct mlx5_core_dev *dev, struct mlx5_sf_table *table, |
| 228 | 231 | struct mlx5_sf *sf, |
| 229 | − enum devlink_port_fn_state state) | |
| 232 | + enum devlink_port_fn_state state, | |
| 233 | + struct netlink_ext_ack *extack) | |
| 230 | 234 | { |
| 231 | 235 | int err = 0; |
| 232 | 236 | |
| @@ -234,7 +238,7 @@ static int mlx5_sf_state_set(struct mlx5_core_dev *dev, struct mlx5_sf_table *ta · 1 unmodified line | ||
| 234 | 238 | if (state == mlx5_sf_to_devlink_state(sf->hw_state)) |
| 235 | 239 | goto out; |
| 236 | 240 | if (state == DEVLINK_PORT_FN_STATE_ACTIVE) |
| 237 | − err = mlx5_sf_activate(dev, sf); | |
| 241 | + err = mlx5_sf_activate(dev, sf, extack); | |
| 238 | 242 | else if (state == DEVLINK_PORT_FN_STATE_INACTIVE) |
| 239 | 243 | err = mlx5_sf_deactivate(dev, sf); |
| 240 | 244 | else |
| @@ -265,7 +269,7 @@ int mlx5_devlink_sf_port_fn_state_set(struct devlink *devlink, struct devlink_po · 24 unmodified lines | ||
| 265 | 269 | goto out; |
| 266 | 270 | } |
| 267 | 271 | |
| 268 | − err = mlx5_sf_state_set(dev, table, sf, state); | |
| 272 | + err = mlx5_sf_state_set(dev, table, sf, state, extack); | |
| 269 | 273 | out: |
| 270 | 274 | mlx5_sf_table_put(table); |
| 271 | 275 | return err; |
| @@ -112,7 +112,8 @@ int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn, · 111 unmodified lines | ||
| 112 | 112 | int ret; |
| 113 | 113 | |
| 114 | 114 | ft_attr.table_type = MLX5_FLOW_TABLE_TYPE_FDB; |
| 115 | − ft_attr.level = dmn->info.caps.max_ft_level - 2; | |
| 115 | + ft_attr.level = min_t(int, dmn->info.caps.max_ft_level - 2, | |
| 116 | + MLX5_FT_MAX_MULTIPATH_LEVEL); | |
| 116 | 117 | ft_attr.reformat_en = reformat_req; |
| 117 | 118 | ft_attr.decap_en = reformat_req; |
| 118 | 119 | |
| @@ -694,7 +694,11 @@ static int dr_ste_v1_set_action_decap_l3_list(void *data, · 693 unmodified lines | ||
| 694 | 694 | if (hw_action_sz / DR_STE_ACTION_DOUBLE_SZ < DR_STE_DECAP_L3_ACTION_NUM) |
| 695 | 695 | return -EINVAL; |
| 696 | 696 | |
| 697 | − memcpy(padded_data, data, data_sz); | |
| 697 | + inline_data_sz = | |
| 698 | + MLX5_FLD_SZ_BYTES(ste_double_action_insert_with_inline_v1, inline_data); | |
| 699 | + | |
| 700 | + /* Add an alignment padding */ | |
| 701 | + memcpy(padded_data + data_sz % inline_data_sz, data, data_sz); | |
| 698 | 702 | |
| 699 | 703 | /* Remove L2L3 outer headers */ |
| 700 | 704 | MLX5_SET(ste_single_action_remove_header_v1, hw_action, action_id, |
| @@ -706,32 +710,34 @@ static int dr_ste_v1_set_action_decap_l3_list(void *data, · 5 unmodified lines | ||
| 706 | 710 | hw_action += DR_STE_ACTION_DOUBLE_SZ; |
| 707 | 711 | used_actions++; /* Remove and NOP are a single double action */ |
| 708 | 712 | |
| 709 | − inline_data_sz = | |
| 710 | − MLX5_FLD_SZ_BYTES(ste_double_action_insert_with_inline_v1, inline_data); | |
| 713 | + /* Point to the last dword of the header */ | |
| 714 | + data_ptr += (data_sz / inline_data_sz) * inline_data_sz; | |
| 711 | 715 | |
| 712 | − /* Add the new header inline + 2 extra bytes */ | |
| 716 | + /* Add the new header using inline action 4Byte at a time, the header | |
| 717 | + * is added in reversed order to the beginning of the packet to avoid | |
| 718 | + * incorrect parsing by the HW. Since header is 14B or 18B an extra | |
| 719 | + * two bytes are padded and later removed. | |
| 720 | + */ | |
| 713 | 721 | for (i = 0; i < data_sz / inline_data_sz + 1; i++) { |
| 714 | 722 | void *addr_inline; |
| 715 | 723 | |
| 716 | 724 | MLX5_SET(ste_double_action_insert_with_inline_v1, hw_action, action_id, |
| 717 | 725 | DR_STE_V1_ACTION_ID_INSERT_INLINE); |
| 718 | 726 | /* The hardware expects here offset to words (2 bytes) */ |
| 719 | − MLX5_SET(ste_double_action_insert_with_inline_v1, hw_action, start_offset, | |
| 720 | − i * 2); | |
| 727 | + MLX5_SET(ste_double_action_insert_with_inline_v1, hw_action, start_offset, 0); | |
| 721 | 728 | |
| 722 | 729 | /* Copy bytes one by one to avoid endianness problem */ |
| 723 | 730 | addr_inline = MLX5_ADDR_OF(ste_double_action_insert_with_inline_v1, |
| 724 | 731 | hw_action, inline_data); |
| 725 | − memcpy(addr_inline, data_ptr, inline_data_sz); | |
| 732 | + memcpy(addr_inline, data_ptr - i * inline_data_sz, inline_data_sz); | |
| 726 | 733 | hw_action += DR_STE_ACTION_DOUBLE_SZ; |
| 727 | − data_ptr += inline_data_sz; | |
| 728 | 734 | used_actions++; |
| 729 | 735 | } |
| 730 | 736 | |
| 731 | − /* Remove 2 extra bytes */ | |
| 737 | + /* Remove first 2 extra bytes */ | |
| 732 | 738 | MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, action_id, |
| 733 | 739 | DR_STE_V1_ACTION_ID_REMOVE_BY_SIZE); |
| 734 | − MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, start_offset, data_sz / 2); | |
| 740 | + MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, start_offset, 0); | |
| 735 | 741 | /* The hardware expects here size in words (2 bytes) */ |
| 736 | 742 | MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, remove_size, 1); |
| 737 | 743 | used_actions++; |
| @@ -124,10 +124,11 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action); · 123 unmodified lines | ||
| 124 | 124 | static inline bool |
| 125 | 125 | mlx5dr_is_supported(struct mlx5_core_dev *dev) |
| 126 | 126 | { |
| 127 | − return MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner) || | |
| 128 | − (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner_v2) && | |
| 129 | − (MLX5_CAP_GEN(dev, steering_format_version) <= | |
| 130 | − MLX5_STEERING_FORMAT_CONNECTX_6DX)); | |
| 127 | + return MLX5_CAP_GEN(dev, roce) && | |
| 128 | + (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner) || | |
| 129 | + (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner_v2) && | |
| 130 | + (MLX5_CAP_GEN(dev, steering_format_version) <= | |
| 131 | + MLX5_STEERING_FORMAT_CONNECTX_6DX))); | |
| 131 | 132 | } |
| 132 | 133 | |
| 133 | 134 | /* buddy functions & structure */ |
| @@ -424,6 +424,15 @@ err_modify_sq: · 423 unmodified lines | ||
| 424 | 424 | return err; |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | +static void mlx5_hairpin_unpair_peer_sq(struct mlx5_hairpin *hp) | |
| 428 | +{ | |
| 429 | + int i; | |
| 430 | + | |
| 431 | + for (i = 0; i < hp->num_channels; i++) | |
| 432 | + mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY, | |
| 433 | + MLX5_SQC_STATE_RST, 0, 0); | |
| 434 | +} | |
| 435 | + | |
| 427 | 436 | static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp) |
| 428 | 437 | { |
| 429 | 438 | int i; |
| @@ -432,13 +441,9 @@ static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp) · 2 unmodified lines | ||
| 432 | 441 | for (i = 0; i < hp->num_channels; i++) |
| 433 | 442 | mlx5_hairpin_modify_rq(hp->func_mdev, hp->rqn[i], MLX5_RQC_STATE_RDY, |
| 434 | 443 | MLX5_RQC_STATE_RST, 0, 0); |
| 435 | − | |
| 436 | 444 | /* unset peer SQs */ |
| 437 | − if (hp->peer_gone) | |
| 438 | − return; | |
| 439 | − for (i = 0; i < hp->num_channels; i++) | |
| 440 | − mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY, | |
| 441 | − MLX5_SQC_STATE_RST, 0, 0); | |
| 445 | + if (!hp->peer_gone) | |
| 446 | + mlx5_hairpin_unpair_peer_sq(hp); | |
| 442 | 447 | } |
| 443 | 448 | |
| 444 | 449 | struct mlx5_hairpin * |
| @@ -485,3 +490,16 @@ void mlx5_core_hairpin_destroy(struct mlx5_hairpin *hp) · 40 unmodified lines | ||
| 485 | 490 | mlx5_hairpin_destroy_queues(hp); |
| 486 | 491 | kfree(hp); |
| 487 | 492 | } |
| 493 | + | |
| 494 | +void mlx5_core_hairpin_clear_dead_peer(struct mlx5_hairpin *hp) | |
| 495 | +{ | |
| 496 | + int i; | |
| 497 | + | |
| 498 | + mlx5_hairpin_unpair_peer_sq(hp); | |
| 499 | + | |
| 500 | + /* destroy peer SQ */ | |
| 501 | + for (i = 0; i < hp->num_channels; i++) | |
| 502 | + mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]); | |
| 503 | + | |
| 504 | + hp->peer_gone = true; | |
| 505 | +} | |
| @@ -465,8 +465,6 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, · 464 unmodified lines | ||
| 465 | 465 | void *in; |
| 466 | 466 | int err; |
| 467 | 467 | |
| 468 | − if (!vport) | |
| 469 | − return -EINVAL; | |
| 470 | 468 | if (!MLX5_CAP_GEN(mdev, vport_group_manager)) |
| 471 | 469 | return -EACCES; |
| 472 | 470 | |
| @@ -693,7 +693,8 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz) · 692 unmodified lines | ||
| 693 | 693 | MLXSW_THERMAL_TRIP_MASK, |
| 694 | 694 | module_tz, |
| 695 | 695 | &mlxsw_thermal_module_ops, |
| 696 | − NULL, 0, 0); | |
| 696 | + NULL, 0, | |
| 697 | + module_tz->parent->polling_delay); | |
| 697 | 698 | if (IS_ERR(module_tz->tzdev)) { |
| 698 | 699 | err = PTR_ERR(module_tz->tzdev); |
| 699 | 700 | return err; |
| @@ -815,7 +816,8 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz) · 115 unmodified lines | ||
| 815 | 816 | MLXSW_THERMAL_TRIP_MASK, |
| 816 | 817 | gearbox_tz, |
| 817 | 818 | &mlxsw_thermal_gearbox_ops, |
| 818 | − NULL, 0, 0); | |
| 819 | + NULL, 0, | |
| 820 | + gearbox_tz->parent->polling_delay); | |
| 819 | 821 | if (IS_ERR(gearbox_tz->tzdev)) |
| 820 | 822 | return PTR_ERR(gearbox_tz->tzdev); |
| 821 | 823 | |
| @@ -3907,7 +3907,7 @@ MLXSW_ITEM32(reg, qeec, max_shaper_bs, 0x1C, 0, 6); · 3906 unmodified lines | ||
| 3907 | 3907 | #define MLXSW_REG_QEEC_HIGHEST_SHAPER_BS 25 |
| 3908 | 3908 | #define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP1 5 |
| 3909 | 3909 | #define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP2 11 |
| 3910 | −#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3 5 | |
| 3910 | +#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3 11 | |
| 3911 | 3911 | |
| 3912 | 3912 | static inline void mlxsw_reg_qeec_pack(char *payload, u8 local_port, |
| 3913 | 3913 | enum mlxsw_reg_qeec_hr hr, u8 index, |
| @@ -1332,6 +1332,7 @@ __mlxsw_sp_qdisc_ets_graft(struct mlxsw_sp_port *mlxsw_sp_port, · 1331 unmodified lines | ||
| 1332 | 1332 | u8 band, u32 child_handle) |
| 1333 | 1333 | { |
| 1334 | 1334 | struct mlxsw_sp_qdisc *old_qdisc; |
| 1335 | + u32 parent; | |
| 1335 | 1336 | |
| 1336 | 1337 | if (band < mlxsw_sp_qdisc->num_classes && |
| 1337 | 1338 | mlxsw_sp_qdisc->qdiscs[band].handle == child_handle) |
| @@ -1352,7 +1353,9 @@ __mlxsw_sp_qdisc_ets_graft(struct mlxsw_sp_port *mlxsw_sp_port, · 14 unmodified lines | ||
| 1352 | 1353 | if (old_qdisc) |
| 1353 | 1354 | mlxsw_sp_qdisc_destroy(mlxsw_sp_port, old_qdisc); |
| 1354 | 1355 | |
| 1355 | − mlxsw_sp_qdisc = mlxsw_sp_qdisc->ops->find_class(mlxsw_sp_qdisc, band); | |
| 1356 | + parent = TC_H_MAKE(mlxsw_sp_qdisc->handle, band + 1); | |
| 1357 | + mlxsw_sp_qdisc = mlxsw_sp_qdisc->ops->find_class(mlxsw_sp_qdisc, | |
| 1358 | + parent); | |
| 1356 | 1359 | if (!WARN_ON(!mlxsw_sp_qdisc)) |
| 1357 | 1360 | mlxsw_sp_qdisc_destroy(mlxsw_sp_port, mlxsw_sp_qdisc); |
| 1358 | 1361 | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | −/** | |
| 2 | +/* | |
| 3 | 3 | * Microchip ENCX24J600 ethernet driver |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2015 Gridpoint |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | −/** | |
| 2 | +/* | |
| 3 | 3 | * encx24j600_hw.h: Register definitions |
| 4 | 4 | * |
| 5 | 5 | */ |
| @@ -379,6 +379,7 @@ static u32 ocelot_read_eq_avail(struct ocelot *ocelot, int port) · 378 unmodified lines | ||
| 379 | 379 | |
| 380 | 380 | int ocelot_port_flush(struct ocelot *ocelot, int port) |
| 381 | 381 | { |
| 382 | + unsigned int pause_ena; | |
| 382 | 383 | int err, val; |
| 383 | 384 | |
| 384 | 385 | /* Disable dequeuing from the egress queues */ |
| @@ -387,6 +388,7 @@ int ocelot_port_flush(struct ocelot *ocelot, int port) · 2 unmodified lines | ||
| 387 | 388 | QSYS_PORT_MODE, port); |
| 388 | 389 | |
| 389 | 390 | /* Disable flow control */ |
| 391 | + ocelot_fields_read(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, &pause_ena); | |
| 390 | 392 | ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 0); |
| 391 | 393 | |
| 392 | 394 | /* Disable priority flow control */ |
| @@ -422,6 +424,9 @@ int ocelot_port_flush(struct ocelot *ocelot, int port) · 29 unmodified lines | ||
| 422 | 424 | /* Clear flushing again. */ |
| 423 | 425 | ocelot_rmw_gix(ocelot, 0, REW_PORT_CFG_FLUSH_ENA, REW_PORT_CFG, port); |
| 424 | 426 | |
| 427 | + /* Re-enable flow control */ | |
| 428 | + ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, pause_ena); | |
| 429 | + | |
| 425 | 430 | return err; |
| 426 | 431 | } |
| 427 | 432 | EXPORT_SYMBOL(ocelot_port_flush); |
| @@ -3815,6 +3815,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 3814 unmodified lines | ||
| 3815 | 3815 | dev_err(&pdev->dev, |
| 3816 | 3816 | "invalid sram_size %dB or board span %ldB\n", |
| 3817 | 3817 | mgp->sram_size, mgp->board_span); |
| 3818 | + status = -EINVAL; | |
| 3818 | 3819 | goto abort_with_ioremap; |
| 3819 | 3820 | } |
| 3820 | 3821 | memcpy_fromio(mgp->eeprom_strings, |
| @@ -20,6 +20,7 @@ if NET_VENDOR_PENSANDO · 19 unmodified lines | ||
| 20 | 20 | config IONIC |
| 21 | 21 | tristate "Pensando Ethernet IONIC Support" |
| 22 | 22 | depends on 64BIT && PCI |
| 23 | + depends on PTP_1588_CLOCK || !PTP_1588_CLOCK | |
| 23 | 24 | select NET_DEVLINK |
| 24 | 25 | select DIMLIB |
| 25 | 26 | help |
| @@ -1602,6 +1602,8 @@ err_out_free_netdev: · 1601 unmodified lines | ||
| 1602 | 1602 | free_netdev(netdev); |
| 1603 | 1603 | |
| 1604 | 1604 | err_out_free_res: |
| 1605 | + if (NX_IS_REVISION_P3(pdev->revision)) | |
| 1606 | + pci_disable_pcie_error_reporting(pdev); | |
| 1605 | 1607 | pci_release_regions(pdev); |
| 1606 | 1608 | |
| 1607 | 1609 | err_out_disable_pdev: |
| @@ -1266,9 +1266,11 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn, · 1265 unmodified lines | ||
| 1266 | 1266 | p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_STATIC; |
| 1267 | 1267 | |
| 1268 | 1268 | p_hwfn->p_dcbx_info->set.enabled = dcbx_info->operational.enabled; |
| 1269 | + BUILD_BUG_ON(sizeof(dcbx_info->operational.params) != | |
| 1270 | + sizeof(p_hwfn->p_dcbx_info->set.config.params)); | |
| 1269 | 1271 | memcpy(&p_hwfn->p_dcbx_info->set.config.params, |
| 1270 | 1272 | &dcbx_info->operational.params, |
| 1271 | − sizeof(struct qed_dcbx_admin_params)); | |
| 1273 | + sizeof(p_hwfn->p_dcbx_info->set.config.params)); | |
| 1272 | 1274 | p_hwfn->p_dcbx_info->set.config.valid = true; |
| 1273 | 1275 | |
| 1274 | 1276 | memcpy(params, &p_hwfn->p_dcbx_info->set, sizeof(struct qed_dcbx_set)); |
| @@ -114,7 +114,7 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev, · 113 unmodified lines | ||
| 114 | 114 | value = readl(&port_regs->CommonRegs.semaphoreReg); |
| 115 | 115 | if ((value & (sem_mask >> 16)) == sem_bits) |
| 116 | 116 | return 0; |
| 117 | − ssleep(1); | |
| 117 | + mdelay(1000); | |
| 118 | 118 | } while (--seconds); |
| 119 | 119 | return -1; |
| 120 | 120 | } |
| @@ -2690,6 +2690,7 @@ err_out_free_hw_res: · 2689 unmodified lines | ||
| 2690 | 2690 | kfree(ahw); |
| 2691 | 2691 | |
| 2692 | 2692 | err_out_free_res: |
| 2693 | + pci_disable_pcie_error_reporting(pdev); | |
| 2693 | 2694 | pci_release_regions(pdev); |
| 2694 | 2695 | |
| 2695 | 2696 | err_out_disable_pdev: |
| @@ -126,24 +126,24 @@ static void rmnet_get_stats64(struct net_device *dev, · 125 unmodified lines | ||
| 126 | 126 | struct rtnl_link_stats64 *s) |
| 127 | 127 | { |
| 128 | 128 | struct rmnet_priv *priv = netdev_priv(dev); |
| 129 | − struct rmnet_vnd_stats total_stats; | |
| 129 | + struct rmnet_vnd_stats total_stats = { }; | |
| 130 | 130 | struct rmnet_pcpu_stats *pcpu_ptr; |
| 131 | + struct rmnet_vnd_stats snapshot; | |
| 131 | 132 | unsigned int cpu, start; |
| 132 | 133 | |
| 133 | − memset(&total_stats, 0, sizeof(struct rmnet_vnd_stats)); | |
| 134 | − | |
| 135 | 134 | for_each_possible_cpu(cpu) { |
| 136 | 135 | pcpu_ptr = per_cpu_ptr(priv->pcpu_stats, cpu); |
| 137 | 136 | |
| 138 | 137 | do { |
| 139 | 138 | start = u64_stats_fetch_begin_irq(&pcpu_ptr->syncp); |
| 140 | − total_stats.rx_pkts += pcpu_ptr->stats.rx_pkts; | |
| 141 | − total_stats.rx_bytes += pcpu_ptr->stats.rx_bytes; | |
| 142 | − total_stats.tx_pkts += pcpu_ptr->stats.tx_pkts; | |
| 143 | − total_stats.tx_bytes += pcpu_ptr->stats.tx_bytes; | |
| 139 | + snapshot = pcpu_ptr->stats; /* struct assignment */ | |
| 144 | 140 | } while (u64_stats_fetch_retry_irq(&pcpu_ptr->syncp, start)); |
| 145 | 141 | |
| 146 | − total_stats.tx_drops += pcpu_ptr->stats.tx_drops; | |
| 142 | + total_stats.rx_pkts += snapshot.rx_pkts; | |
| 143 | + total_stats.rx_bytes += snapshot.rx_bytes; | |
| 144 | + total_stats.tx_pkts += snapshot.tx_pkts; | |
| 145 | + total_stats.tx_bytes += snapshot.tx_bytes; | |
| 146 | + total_stats.tx_drops += snapshot.tx_drops; | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | s->rx_packets = total_stats.rx_pkts; |
| @@ -354,4 +354,4 @@ int rmnet_vnd_update_dev_mtu(struct rmnet_port *port, · 204 unmodified lines | ||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | return 0; |
| 357 | −} | |
| 357 | +} | |
| @@ -1671,7 +1671,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) · 1670 unmodified lines | ||
| 1671 | 1671 | { |
| 1672 | 1672 | switch(stringset) { |
| 1673 | 1673 | case ETH_SS_STATS: |
| 1674 | − memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings)); | |
| 1674 | + memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings)); | |
| 1675 | 1675 | break; |
| 1676 | 1676 | } |
| 1677 | 1677 | } |
| @@ -2287,7 +2287,7 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data) · 2286 unmodified lines | ||
| 2287 | 2287 | { |
| 2288 | 2288 | switch (stringset) { |
| 2289 | 2289 | case ETH_SS_STATS: |
| 2290 | − memcpy(data, *sh_eth_gstrings_stats, | |
| 2290 | + memcpy(data, sh_eth_gstrings_stats, | |
| 2291 | 2291 | sizeof(sh_eth_gstrings_stats)); |
| 2292 | 2292 | break; |
| 2293 | 2293 | } |
| @@ -90,6 +90,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx) · 89 unmodified lines | ||
| 90 | 90 | efx->pci_dev->irq); |
| 91 | 91 | goto fail1; |
| 92 | 92 | } |
| 93 | + efx->irqs_hooked = true; | |
| 93 | 94 | return 0; |
| 94 | 95 | } |
| 95 | 96 | |
| @@ -76,10 +76,10 @@ enum power_event { · 75 unmodified lines | ||
| 76 | 76 | #define LPI_CTRL_STATUS_TLPIEN 0x00000001 /* Transmit LPI Entry */ |
| 77 | 77 | |
| 78 | 78 | /* GMAC HW ADDR regs */ |
| 79 | −#define GMAC_ADDR_HIGH(reg) (((reg > 15) ? 0x00000800 : 0x00000040) + \ | |
| 80 | − (reg * 8)) | |
| 81 | −#define GMAC_ADDR_LOW(reg) (((reg > 15) ? 0x00000804 : 0x00000044) + \ | |
| 82 | − (reg * 8)) | |
| 79 | +#define GMAC_ADDR_HIGH(reg) ((reg > 15) ? 0x00000800 + (reg - 16) * 8 : \ | |
| 80 | + 0x00000040 + (reg * 8)) | |
| 81 | +#define GMAC_ADDR_LOW(reg) ((reg > 15) ? 0x00000804 + (reg - 16) * 8 : \ | |
| 82 | + 0x00000044 + (reg * 8)) | |
| 83 | 83 | #define GMAC_MAX_PERFECT_ADDRESSES 1 |
| 84 | 84 | |
| 85 | 85 | #define GMAC_PCS_BASE 0x000000c0 /* PCS register base */ |
| @@ -1196,7 +1196,6 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) · 1195 unmodified lines | ||
| 1196 | 1196 | */ |
| 1197 | 1197 | static int stmmac_init_phy(struct net_device *dev) |
| 1198 | 1198 | { |
| 1199 | − struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; | |
| 1200 | 1199 | struct stmmac_priv *priv = netdev_priv(dev); |
| 1201 | 1200 | struct device_node *node; |
| 1202 | 1201 | int ret; |
| @@ -1222,8 +1221,12 @@ static int stmmac_init_phy(struct net_device *dev) · 19 unmodified lines | ||
| 1222 | 1221 | ret = phylink_connect_phy(priv->phylink, phydev); |
| 1223 | 1222 | } |
| 1224 | 1223 | |
| 1225 | − phylink_ethtool_get_wol(priv->phylink, &wol); | |
| 1226 | − device_set_wakeup_capable(priv->device, !!wol.supported); | |
| 1224 | + if (!priv->plat->pmt) { | |
| 1225 | + struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; | |
| 1226 | + | |
| 1227 | + phylink_ethtool_get_wol(priv->phylink, &wol); | |
| 1228 | + device_set_wakeup_capable(priv->device, !!wol.supported); | |
| 1229 | + } | |
| 1227 | 1230 | |
| 1228 | 1231 | return ret; |
| 1229 | 1232 | } |
| @@ -1237,8 +1240,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) · 7 unmodified lines | ||
| 1237 | 1240 | priv->phylink_config.dev = &priv->dev->dev; |
| 1238 | 1241 | priv->phylink_config.type = PHYLINK_NETDEV; |
| 1239 | 1242 | priv->phylink_config.pcs_poll = true; |
| 1240 | − priv->phylink_config.ovr_an_inband = | |
| 1241 | − priv->plat->mdio_bus_data->xpcs_an_inband; | |
| 1243 | + if (priv->plat->mdio_bus_data) | |
| 1244 | + priv->phylink_config.ovr_an_inband = | |
| 1245 | + priv->plat->mdio_bus_data->xpcs_an_inband; | |
| 1242 | 1246 | |
| 1243 | 1247 | if (!fwnode) |
| 1244 | 1248 | fwnode = dev_fwnode(priv->device); |
| @@ -5888,12 +5892,21 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr) · 4643 unmodified lines | ||
| 5888 | 5892 | struct stmmac_priv *priv = netdev_priv(ndev); |
| 5889 | 5893 | int ret = 0; |
| 5890 | 5894 | |
| 5895 | + ret = pm_runtime_get_sync(priv->device); | |
| 5896 | + if (ret < 0) { | |
| 5897 | + pm_runtime_put_noidle(priv->device); | |
| 5898 | + return ret; | |
| 5899 | + } | |
| 5900 | + | |
| 5891 | 5901 | ret = eth_mac_addr(ndev, addr); |
| 5892 | 5902 | if (ret) |
| 5893 | − return ret; | |
| 5903 | + goto set_mac_error; | |
| 5894 | 5904 | |
| 5895 | 5905 | stmmac_set_umac_addr(priv, priv->hw, ndev->dev_addr, 0); |
| 5896 | 5906 | |
| 5907 | +set_mac_error: | |
| 5908 | + pm_runtime_put(priv->device); | |
| 5909 | + | |
| 5897 | 5910 | return ret; |
| 5898 | 5911 | } |
| 5899 | 5912 | |
| @@ -6188,12 +6201,6 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid · 288 unmodified lines | ||
| 6188 | 6201 | bool is_double = false; |
| 6189 | 6202 | int ret; |
| 6190 | 6203 | |
| 6191 | − ret = pm_runtime_get_sync(priv->device); | |
| 6192 | − if (ret < 0) { | |
| 6193 | − pm_runtime_put_noidle(priv->device); | |
| 6194 | − return ret; | |
| 6195 | − } | |
| 6196 | − | |
| 6197 | 6204 | if (be16_to_cpu(proto) == ETH_P_8021AD) |
| 6198 | 6205 | is_double = true; |
| 6199 | 6206 | |
| @@ -6219,6 +6226,12 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi · 19 unmodified lines | ||
| 6219 | 6226 | bool is_double = false; |
| 6220 | 6227 | int ret; |
| 6221 | 6228 | |
| 6229 | + ret = pm_runtime_get_sync(priv->device); | |
| 6230 | + if (ret < 0) { | |
| 6231 | + pm_runtime_put_noidle(priv->device); | |
| 6232 | + return ret; | |
| 6233 | + } | |
| 6234 | + | |
| 6222 | 6235 | if (be16_to_cpu(proto) == ETH_P_8021AD) |
| 6223 | 6236 | is_double = true; |
| 6224 | 6237 | |
| @@ -7036,7 +7049,6 @@ error_mdio_register: · 811 unmodified lines | ||
| 7036 | 7049 | stmmac_napi_del(ndev); |
| 7037 | 7050 | error_hw_init: |
| 7038 | 7051 | destroy_workqueue(priv->wq); |
| 7039 | − stmmac_bus_clks_config(priv, false); | |
| 7040 | 7052 | bitmap_free(priv->af_xdp_zc_qps); |
| 7041 | 7053 | |
| 7042 | 7054 | return ret; |
| @@ -622,6 +622,8 @@ error_pclk_get: · 621 unmodified lines | ||
| 622 | 622 | void stmmac_remove_config_dt(struct platform_device *pdev, |
| 623 | 623 | struct plat_stmmacenet_data *plat) |
| 624 | 624 | { |
| 625 | + clk_disable_unprepare(plat->stmmac_clk); | |
| 626 | + clk_disable_unprepare(plat->pclk); | |
| 625 | 627 | of_node_put(plat->phy_node); |
| 626 | 628 | of_node_put(plat->mdio_node); |
| 627 | 629 | } |
| @@ -1350,8 +1350,8 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe) · 1349 unmodified lines | ||
| 1350 | 1350 | tx_pipe->dma_queue = knav_queue_open(name, tx_pipe->dma_queue_id, |
| 1351 | 1351 | KNAV_QUEUE_SHARED); |
| 1352 | 1352 | if (IS_ERR(tx_pipe->dma_queue)) { |
| 1353 | − dev_err(dev, "Could not open DMA queue for channel \"%s\": %d\n", | |
| 1354 | − name, ret); | |
| 1353 | + dev_err(dev, "Could not open DMA queue for channel \"%s\": %pe\n", | |
| 1354 | + name, tx_pipe->dma_queue); | |
| 1355 | 1355 | ret = PTR_ERR(tx_pipe->dma_queue); |
| 1356 | 1356 | goto err; |
| 1357 | 1357 | } |
| @@ -774,12 +774,15 @@ static void temac_start_xmit_done(struct net_device *ndev) · 773 unmodified lines | ||
| 774 | 774 | stat = be32_to_cpu(cur_p->app0); |
| 775 | 775 | |
| 776 | 776 | while (stat & STS_CTRL_APP0_CMPLT) { |
| 777 | + /* Make sure that the other fields are read after bd is | |
| 778 | + * released by dma | |
| 779 | + */ | |
| 780 | + rmb(); | |
| 777 | 781 | dma_unmap_single(ndev->dev.parent, be32_to_cpu(cur_p->phys), |
| 778 | 782 | be32_to_cpu(cur_p->len), DMA_TO_DEVICE); |
| 779 | 783 | skb = (struct sk_buff *)ptr_from_txbd(cur_p); |
| 780 | 784 | if (skb) |
| 781 | 785 | dev_consume_skb_irq(skb); |
| 782 | − cur_p->app0 = 0; | |
| 783 | 786 | cur_p->app1 = 0; |
| 784 | 787 | cur_p->app2 = 0; |
| 785 | 788 | cur_p->app3 = 0; |
| @@ -788,6 +791,12 @@ static void temac_start_xmit_done(struct net_device *ndev) · 2 unmodified lines | ||
| 788 | 791 | ndev->stats.tx_packets++; |
| 789 | 792 | ndev->stats.tx_bytes += be32_to_cpu(cur_p->len); |
| 790 | 793 | |
| 794 | + /* app0 must be visible last, as it is used to flag | |
| 795 | + * availability of the bd | |
| 796 | + */ | |
| 797 | + smp_mb(); | |
| 798 | + cur_p->app0 = 0; | |
| 799 | + | |
| 791 | 800 | lp->tx_bd_ci++; |
| 792 | 801 | if (lp->tx_bd_ci >= lp->tx_bd_num) |
| 793 | 802 | lp->tx_bd_ci = 0; |
| @@ -814,6 +823,9 @@ static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag) · 20 unmodified lines | ||
| 814 | 823 | if (cur_p->app0) |
| 815 | 824 | return NETDEV_TX_BUSY; |
| 816 | 825 | |
| 826 | + /* Make sure to read next bd app0 after this one */ | |
| 827 | + rmb(); | |
| 828 | + | |
| 817 | 829 | tail++; |
| 818 | 830 | if (tail >= lp->tx_bd_num) |
| 819 | 831 | tail = 0; |
| @@ -849,7 +861,7 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 29 unmodified lines | ||
| 849 | 861 | smp_mb(); |
| 850 | 862 | |
| 851 | 863 | /* Space might have just been freed - check again */ |
| 852 | − if (temac_check_tx_bd_space(lp, num_frag)) | |
| 864 | + if (temac_check_tx_bd_space(lp, num_frag + 1)) | |
| 853 | 865 | return NETDEV_TX_BUSY; |
| 854 | 866 | |
| 855 | 867 | netif_wake_queue(ndev); |
| @@ -876,7 +888,6 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 20 unmodified lines | ||
| 876 | 888 | return NETDEV_TX_OK; |
| 877 | 889 | } |
| 878 | 890 | cur_p->phys = cpu_to_be32(skb_dma_addr); |
| 879 | − ptr_to_txbd((void *)skb, cur_p); | |
| 880 | 891 | |
| 881 | 892 | for (ii = 0; ii < num_frag; ii++) { |
| 882 | 893 | if (++lp->tx_bd_tail >= lp->tx_bd_num) |
| @@ -915,6 +926,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 32 unmodified lines | ||
| 915 | 926 | } |
| 916 | 927 | cur_p->app0 |= cpu_to_be32(STS_CTRL_APP0_EOP); |
| 917 | 928 | |
| 929 | + /* Mark last fragment with skb address, so it can be consumed | |
| 930 | + * in temac_start_xmit_done() | |
| 931 | + */ | |
| 932 | + ptr_to_txbd((void *)skb, cur_p); | |
| 933 | + | |
| 918 | 934 | tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail; |
| 919 | 935 | lp->tx_bd_tail++; |
| 920 | 936 | if (lp->tx_bd_tail >= lp->tx_bd_num) |
| @@ -926,6 +942,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 5 unmodified lines | ||
| 926 | 942 | wmb(); |
| 927 | 943 | lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */ |
| 928 | 944 | |
| 945 | + if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) { | |
| 946 | + netdev_info(ndev, "%s -> netif_stop_queue\n", __func__); | |
| 947 | + netif_stop_queue(ndev); | |
| 948 | + } | |
| 949 | + | |
| 929 | 950 | return NETDEV_TX_OK; |
| 930 | 951 | } |
| 931 | 952 | |
| @@ -799,6 +799,7 @@ static void mkiss_close(struct tty_struct *tty) · 798 unmodified lines | ||
| 799 | 799 | ax->tty = NULL; |
| 800 | 800 | |
| 801 | 801 | unregister_netdev(ax->dev); |
| 802 | + free_netdev(ax->dev); | |
| 802 | 803 | } |
| 803 | 804 | |
| 804 | 805 | /* Perform I/O control on an active ax25 channel. */ |
| @@ -8,8 +8,8 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #include <linux/spi/spi.h> |
| 10 | 10 | #include <linux/interrupt.h> |
| 11 | +#include <linux/mod_devicetable.h> | |
| 11 | 12 | #include <linux/module.h> |
| 12 | −#include <linux/of.h> | |
| 13 | 13 | #include <linux/regmap.h> |
| 14 | 14 | #include <linux/ieee802154.h> |
| 15 | 15 | #include <linux/irq.h> |
| @@ -1388,7 +1388,7 @@ MODULE_DEVICE_TABLE(spi, mrf24j40_ids); · 1372 unmodified lines | ||
| 1388 | 1388 | |
| 1389 | 1389 | static struct spi_driver mrf24j40_driver = { |
| 1390 | 1390 | .driver = { |
| 1391 | − .of_match_table = of_match_ptr(mrf24j40_of_match), | |
| 1391 | + .of_match_table = mrf24j40_of_match, | |
| 1392 | 1392 | .name = "mrf24j40", |
| 1393 | 1393 | }, |
| 1394 | 1394 | .id_table = mrf24j40_ids, |
| @@ -58,6 +58,7 @@ enum ipa_flag { · 57 unmodified lines | ||
| 58 | 58 | * @mem_virt: Virtual address of IPA-local memory space |
| 59 | 59 | * @mem_offset: Offset from @mem_virt used for access to IPA memory |
| 60 | 60 | * @mem_size: Total size (bytes) of memory at @mem_virt |
| 61 | + * @mem_count: Number of entries in the mem array | |
| 61 | 62 | * @mem: Array of IPA-local memory region descriptors |
| 62 | 63 | * @imem_iova: I/O virtual address of IPA region in IMEM |
| 63 | 64 | * @imem_size: Size of IMEM region |
| @@ -103,6 +104,7 @@ struct ipa { · 39 unmodified lines | ||
| 103 | 104 | void *mem_virt; |
| 104 | 105 | u32 mem_offset; |
| 105 | 106 | u32 mem_size; |
| 107 | + u32 mem_count; | |
| 106 | 108 | const struct ipa_mem *mem; |
| 107 | 109 | |
| 108 | 110 | unsigned long imem_iova; |
| @@ -180,7 +180,7 @@ int ipa_mem_config(struct ipa *ipa) · 179 unmodified lines | ||
| 180 | 180 | * for the region, write "canary" values in the space prior to |
| 181 | 181 | * the region's base address. |
| 182 | 182 | */ |
| 183 | − for (mem_id = 0; mem_id < IPA_MEM_COUNT; mem_id++) { | |
| 183 | + for (mem_id = 0; mem_id < ipa->mem_count; mem_id++) { | |
| 184 | 184 | const struct ipa_mem *mem = &ipa->mem[mem_id]; |
| 185 | 185 | u16 canary_count; |
| 186 | 186 | __le32 *canary; |
| @@ -487,6 +487,7 @@ int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data) · 300 unmodified lines | ||
| 487 | 487 | ipa->mem_size = resource_size(res); |
| 488 | 488 | |
| 489 | 489 | /* The ipa->mem[] array is indexed by enum ipa_mem_id values */ |
| 490 | + ipa->mem_count = mem_data->local_count; | |
| 490 | 491 | ipa->mem = mem_data->local; |
| 491 | 492 | |
| 492 | 493 | ret = ipa_imem_init(ipa, mem_data->imem_addr, mem_data->imem_size); |
| @@ -71,7 +71,6 @@ static int octeon_mdiobus_probe(struct platform_device *pdev) · 70 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | return 0; |
| 73 | 73 | fail_register: |
| 74 | − mdiobus_free(bus->mii_bus); | |
| 75 | 74 | smi_en.u64 = 0; |
| 76 | 75 | oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN); |
| 77 | 76 | return err; |
| @@ -85,7 +84,6 @@ static int octeon_mdiobus_remove(struct platform_device *pdev) · 7 unmodified lines | ||
| 85 | 84 | bus = platform_get_drvdata(pdev); |
| 86 | 85 | |
| 87 | 86 | mdiobus_unregister(bus->mii_bus); |
| 88 | − mdiobus_free(bus->mii_bus); | |
| 89 | 87 | smi_en.u64 = 0; |
| 90 | 88 | oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN); |
| 91 | 89 | return 0; |
| @@ -126,7 +126,6 @@ static void thunder_mdiobus_pci_remove(struct pci_dev *pdev) · 125 unmodified lines | ||
| 126 | 126 | continue; |
| 127 | 127 | |
| 128 | 128 | mdiobus_unregister(bus->mii_bus); |
| 129 | − mdiobus_free(bus->mii_bus); | |
| 130 | 129 | oct_mdio_writeq(0, bus->register_base + SMI_EN); |
| 131 | 130 | } |
| 132 | 131 | pci_release_regions(pdev); |
| @@ -49,7 +49,7 @@ static int mhi_ndo_stop(struct net_device *ndev) · 48 unmodified lines | ||
| 49 | 49 | return 0; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | −static int mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev) | |
| 52 | +static netdev_tx_t mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev) | |
| 53 | 53 | { |
| 54 | 54 | struct mhi_net_dev *mhi_netdev = netdev_priv(ndev); |
| 55 | 55 | const struct mhi_net_proto *proto = mhi_netdev->proto; |
| @@ -826,16 +826,12 @@ static int dp83867_phy_reset(struct phy_device *phydev) · 825 unmodified lines | ||
| 826 | 826 | { |
| 827 | 827 | int err; |
| 828 | 828 | |
| 829 | − err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET); | |
| 829 | + err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESTART); | |
| 830 | 830 | if (err < 0) |
| 831 | 831 | return err; |
| 832 | 832 | |
| 833 | 833 | usleep_range(10, 20); |
| 834 | 834 | |
| 835 | − /* After reset FORCE_LINK_GOOD bit is set. Although the | |
| 836 | − * default value should be unset. Disable FORCE_LINK_GOOD | |
| 837 | − * for the phy to work properly. | |
| 838 | − */ | |
| 839 | 835 | return phy_modify(phydev, MII_DP83867_PHYCTRL, |
| 840 | 836 | DP83867_PHYCR_FORCE_LINK_GOOD, 0); |
| 841 | 837 | } |
| @@ -607,7 +607,8 @@ void mdiobus_unregister(struct mii_bus *bus) · 606 unmodified lines | ||
| 607 | 607 | struct mdio_device *mdiodev; |
| 608 | 608 | int i; |
| 609 | 609 | |
| 610 | − BUG_ON(bus->state != MDIOBUS_REGISTERED); | |
| 610 | + if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED)) | |
| 611 | + return; | |
| 611 | 612 | bus->state = MDIOBUS_UNREGISTERED; |
| 612 | 613 | |
| 613 | 614 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | * for transport over USB using a simpler USB device model than the |
| 27 | 27 | * previous CDC "Ethernet Control Model" (ECM, or "CDC Ethernet"). |
| 28 | 28 | * |
| 29 | − * For details, see www.usb.org/developers/devclass_docs/CDC_EEM10.pdf | |
| 29 | + * For details, see https://usb.org/sites/default/files/CDC_EEM10.pdf | |
| 30 | 30 | * |
| 31 | 31 | * This version has been tested with GIGAntIC WuaoW SIM Smart Card on 2.6.24, |
| 32 | 32 | * 2.6.27 and 2.6.30rc2 kernel. |
| @@ -123,10 +123,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb, · 90 unmodified lines | ||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags); |
| 126 | + dev_kfree_skb_any(skb); | |
| 126 | 127 | if (!skb2) |
| 127 | 128 | return NULL; |
| 128 | 129 | |
| 129 | − dev_kfree_skb_any(skb); | |
| 130 | 130 | skb = skb2; |
| 131 | 131 | |
| 132 | 132 | done: |
| @@ -1880,7 +1880,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) · 1879 unmodified lines | ||
| 1880 | 1880 | static const struct driver_info cdc_ncm_info = { |
| 1881 | 1881 | .description = "CDC NCM", |
| 1882 | 1882 | .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET |
| 1883 | − | FLAG_LINK_INTR, | |
| 1883 | + | FLAG_LINK_INTR | FLAG_ETHER, | |
| 1884 | 1884 | .bind = cdc_ncm_bind, |
| 1885 | 1885 | .unbind = cdc_ncm_unbind, |
| 1886 | 1886 | .manage_power = usbnet_manage_power, |
| @@ -1689,7 +1689,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, · 1688 unmodified lines | ||
| 1689 | 1689 | spin_unlock_irqrestore(&serial->serial_lock, flags); |
| 1690 | 1690 | |
| 1691 | 1691 | return usb_control_msg(serial->parent->usb, |
| 1692 | − usb_rcvctrlpipe(serial->parent->usb, 0), 0x22, | |
| 1692 | + usb_sndctrlpipe(serial->parent->usb, 0), 0x22, | |
| 1693 | 1693 | 0x21, val, if_num, NULL, 0, |
| 1694 | 1694 | USB_CTRL_SET_TIMEOUT); |
| 1695 | 1695 | } |
| @@ -2436,7 +2436,7 @@ static int hso_rfkill_set_block(void *data, bool blocked) · 740 unmodified lines | ||
| 2436 | 2436 | if (hso_dev->usb_gone) |
| 2437 | 2437 | rv = 0; |
| 2438 | 2438 | else |
| 2439 | − rv = usb_control_msg(hso_dev->usb, usb_rcvctrlpipe(hso_dev->usb, 0), | |
| 2439 | + rv = usb_control_msg(hso_dev->usb, usb_sndctrlpipe(hso_dev->usb, 0), | |
| 2440 | 2440 | enabled ? 0x82 : 0x81, 0x40, 0, 0, NULL, 0, |
| 2441 | 2441 | USB_CTRL_SET_TIMEOUT); |
| 2442 | 2442 | mutex_unlock(&hso_dev->mutex); |
| @@ -2618,32 +2618,31 @@ static struct hso_device *hso_create_bulk_serial_device( · 175 unmodified lines | ||
| 2618 | 2618 | num_urbs = 2; |
| 2619 | 2619 | serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget), |
| 2620 | 2620 | GFP_KERNEL); |
| 2621 | + if (!serial->tiocmget) | |
| 2622 | + goto exit; | |
| 2621 | 2623 | serial->tiocmget->serial_state_notification |
| 2622 | 2624 | = kzalloc(sizeof(struct hso_serial_state_notification), |
| 2623 | 2625 | GFP_KERNEL); |
| 2624 | − /* it isn't going to break our heart if serial->tiocmget | |
| 2625 | − * allocation fails don't bother checking this. | |
| 2626 | − */ | |
| 2627 | − if (serial->tiocmget && serial->tiocmget->serial_state_notification) { | |
| 2628 | − tiocmget = serial->tiocmget; | |
| 2629 | − tiocmget->endp = hso_get_ep(interface, | |
| 2630 | − USB_ENDPOINT_XFER_INT, | |
| 2631 | − USB_DIR_IN); | |
| 2632 | − if (!tiocmget->endp) { | |
| 2633 | − dev_err(&interface->dev, "Failed to find INT IN ep\n"); | |
| 2634 | − goto exit; | |
| 2635 | − } | |
| 2636 | − | |
| 2637 | − tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL); | |
| 2638 | − if (tiocmget->urb) { | |
| 2639 | − mutex_init(&tiocmget->mutex); | |
| 2640 | − init_waitqueue_head(&tiocmget->waitq); | |
| 2641 | − } else | |
| 2642 | − hso_free_tiomget(serial); | |
| 2626 | + if (!serial->tiocmget->serial_state_notification) | |
| 2627 | + goto exit; | |
| 2628 | + tiocmget = serial->tiocmget; | |
| 2629 | + tiocmget->endp = hso_get_ep(interface, | |
| 2630 | + USB_ENDPOINT_XFER_INT, | |
| 2631 | + USB_DIR_IN); | |
| 2632 | + if (!tiocmget->endp) { | |
| 2633 | + dev_err(&interface->dev, "Failed to find INT IN ep\n"); | |
| 2634 | + goto exit; | |
| 2643 | 2635 | } |
| 2644 | − } | |
| 2645 | − else | |
| 2636 | + | |
| 2637 | + tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL); | |
| 2638 | + if (!tiocmget->urb) | |
| 2639 | + goto exit; | |
| 2640 | + | |
| 2641 | + mutex_init(&tiocmget->mutex); | |
| 2642 | + init_waitqueue_head(&tiocmget->waitq); | |
| 2643 | + } else { | |
| 2646 | 2644 | num_urbs = 1; |
| 2645 | + } | |
| 2647 | 2646 | |
| 2648 | 2647 | if (hso_serial_common_create(serial, num_urbs, BULK_URB_RX_SIZE, |
| 2649 | 2648 | BULK_URB_TX_SIZE)) |
| @@ -1645,6 +1645,7 @@ static const struct ethtool_ops lan78xx_ethtool_ops = { · 1644 unmodified lines | ||
| 1645 | 1645 | .get_strings = lan78xx_get_strings, |
| 1646 | 1646 | .get_wol = lan78xx_get_wol, |
| 1647 | 1647 | .set_wol = lan78xx_set_wol, |
| 1648 | + .get_ts_info = ethtool_op_get_ts_info, | |
| 1648 | 1649 | .get_eee = lan78xx_get_eee, |
| 1649 | 1650 | .set_eee = lan78xx_set_eee, |
| 1650 | 1651 | .get_pauseparam = lan78xx_get_pause, |
| @@ -575,7 +575,7 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 574 unmodified lines | ||
| 575 | 575 | |
| 576 | 576 | if (info->flags & QMI_WWAN_FLAG_PASS_THROUGH) { |
| 577 | 577 | skb->protocol = htons(ETH_P_MAP); |
| 578 | − return (netif_rx(skb) == NET_RX_SUCCESS); | |
| 578 | + return 1; | |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | switch (skb->data[0] & 0xf0) { |
| @@ -8107,6 +8107,37 @@ static void r8156b_init(struct r8152 *tp) · 8106 unmodified lines | ||
| 8107 | 8107 | tp->coalesce = 15000; /* 15 us */ |
| 8108 | 8108 | } |
| 8109 | 8109 | |
| 8110 | +static bool rtl_check_vendor_ok(struct usb_interface *intf) | |
| 8111 | +{ | |
| 8112 | + struct usb_host_interface *alt = intf->cur_altsetting; | |
| 8113 | + struct usb_endpoint_descriptor *in, *out, *intr; | |
| 8114 | + | |
| 8115 | + if (usb_find_common_endpoints(alt, &in, &out, &intr, NULL) < 0) { | |
| 8116 | + dev_err(&intf->dev, "Expected endpoints are not found\n"); | |
| 8117 | + return false; | |
| 8118 | + } | |
| 8119 | + | |
| 8120 | + /* Check Rx endpoint address */ | |
| 8121 | + if (usb_endpoint_num(in) != 1) { | |
| 8122 | + dev_err(&intf->dev, "Invalid Rx endpoint address\n"); | |
| 8123 | + return false; | |
| 8124 | + } | |
| 8125 | + | |
| 8126 | + /* Check Tx endpoint address */ | |
| 8127 | + if (usb_endpoint_num(out) != 2) { | |
| 8128 | + dev_err(&intf->dev, "Invalid Tx endpoint address\n"); | |
| 8129 | + return false; | |
| 8130 | + } | |
| 8131 | + | |
| 8132 | + /* Check interrupt endpoint address */ | |
| 8133 | + if (usb_endpoint_num(intr) != 3) { | |
| 8134 | + dev_err(&intf->dev, "Invalid interrupt endpoint address\n"); | |
| 8135 | + return false; | |
| 8136 | + } | |
| 8137 | + | |
| 8138 | + return true; | |
| 8139 | +} | |
| 8140 | + | |
| 8110 | 8141 | static bool rtl_vendor_mode(struct usb_interface *intf) |
| 8111 | 8142 | { |
| 8112 | 8143 | struct usb_host_interface *alt = intf->cur_altsetting; |
| @@ -8115,12 +8146,15 @@ static bool rtl_vendor_mode(struct usb_interface *intf) · 2 unmodified lines | ||
| 8115 | 8146 | int i, num_configs; |
| 8116 | 8147 | |
| 8117 | 8148 | if (alt->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) |
| 8118 | − return true; | |
| 8149 | + return rtl_check_vendor_ok(intf); | |
| 8119 | 8150 | |
| 8120 | 8151 | /* The vendor mode is not always config #1, so to find it out. */ |
| 8121 | 8152 | udev = interface_to_usbdev(intf); |
| 8122 | 8153 | c = udev->config; |
| 8123 | 8154 | num_configs = udev->descriptor.bNumConfigurations; |
| 8155 | + if (num_configs < 2) | |
| 8156 | + return false; | |
| 8157 | + | |
| 8124 | 8158 | for (i = 0; i < num_configs; (i++, c++)) { |
| 8125 | 8159 | struct usb_interface_descriptor *desc = NULL; |
| 8126 | 8160 | |
| @@ -8135,7 +8169,8 @@ static bool rtl_vendor_mode(struct usb_interface *intf) · 8 unmodified lines | ||
| 8135 | 8169 | } |
| 8136 | 8170 | } |
| 8137 | 8171 | |
| 8138 | − WARN_ON_ONCE(i == num_configs); | |
| 8172 | + if (i == num_configs) | |
| 8173 | + dev_err(&intf->dev, "Unexpected Device\n"); | |
| 8139 | 8174 | |
| 8140 | 8175 | return false; |
| 8141 | 8176 | } |
| @@ -8643,7 +8678,7 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data) · 501 unmodified lines | ||
| 8643 | 8678 | { |
| 8644 | 8679 | switch (stringset) { |
| 8645 | 8680 | case ETH_SS_STATS: |
| 8646 | − memcpy(data, *rtl8152_gstrings, sizeof(rtl8152_gstrings)); | |
| 8681 | + memcpy(data, rtl8152_gstrings, sizeof(rtl8152_gstrings)); | |
| 8647 | 8682 | break; |
| 8648 | 8683 | } |
| 8649 | 8684 | } |
| @@ -9381,9 +9416,6 @@ static int rtl8152_probe(struct usb_interface *intf, · 731 unmodified lines | ||
| 9381 | 9416 | if (!rtl_vendor_mode(intf)) |
| 9382 | 9417 | return -ENODEV; |
| 9383 | 9418 | |
| 9384 | − if (intf->cur_altsetting->desc.bNumEndpoints < 3) | |
| 9385 | − return -ENODEV; | |
| 9386 | − | |
| 9387 | 9419 | usb_reset_device(udev); |
| 9388 | 9420 | netdev = alloc_etherdev(sizeof(struct r8152)); |
| 9389 | 9421 | if (!netdev) { |
| @@ -1483,7 +1483,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) · 1482 unmodified lines | ||
| 1483 | 1483 | ret = smsc75xx_wait_ready(dev, 0); |
| 1484 | 1484 | if (ret < 0) { |
| 1485 | 1485 | netdev_warn(dev->net, "device not ready in smsc75xx_bind\n"); |
| 1486 | − return ret; | |
| 1486 | + goto free_pdata; | |
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | smsc75xx_init_mac_address(dev); |
| @@ -1492,7 +1492,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) · 2 unmodified lines | ||
| 1492 | 1492 | ret = smsc75xx_reset(dev); |
| 1493 | 1493 | if (ret < 0) { |
| 1494 | 1494 | netdev_warn(dev->net, "smsc75xx_reset error %d\n", ret); |
| 1495 | − return ret; | |
| 1495 | + goto cancel_work; | |
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | 1498 | dev->net->netdev_ops = &smsc75xx_netdev_ops; |
| @@ -1502,6 +1502,13 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) · 3 unmodified lines | ||
| 1502 | 1502 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; |
| 1503 | 1503 | dev->net->max_mtu = MAX_SINGLE_PACKET_SIZE; |
| 1504 | 1504 | return 0; |
| 1505 | + | |
| 1506 | +cancel_work: | |
| 1507 | + cancel_work_sync(&pdata->set_multicast); | |
| 1508 | +free_pdata: | |
| 1509 | + kfree(pdata); | |
| 1510 | + dev->data[0] = 0; | |
| 1511 | + return ret; | |
| 1505 | 1512 | } |
| 1506 | 1513 | |
| 1507 | 1514 | static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf) |
| @@ -1511,7 +1518,6 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf) · 3 unmodified lines | ||
| 1511 | 1518 | cancel_work_sync(&pdata->set_multicast); |
| 1512 | 1519 | netif_dbg(dev, ifdown, dev->net, "free pdata\n"); |
| 1513 | 1520 | kfree(pdata); |
| 1514 | − pdata = NULL; | |
| 1515 | 1521 | dev->data[0] = 0; |
| 1516 | 1522 | } |
| 1517 | 1523 | } |
| @@ -401,18 +401,13 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, · 400 unmodified lines | ||
| 401 | 401 | /* If headroom is not 0, there is an offset between the beginning of the |
| 402 | 402 | * data and the allocated space, otherwise the data and the allocated |
| 403 | 403 | * space are aligned. |
| 404 | + * | |
| 405 | + * Buffers with headroom use PAGE_SIZE as alloc size, see | |
| 406 | + * add_recvbuf_mergeable() + get_mergeable_buf_len() | |
| 404 | 407 | */ |
| 405 | − if (headroom) { | |
| 406 | − /* Buffers with headroom use PAGE_SIZE as alloc size, | |
| 407 | − * see add_recvbuf_mergeable() + get_mergeable_buf_len() | |
| 408 | − */ | |
| 409 | − truesize = PAGE_SIZE; | |
| 410 | − tailroom = truesize - len - offset; | |
| 411 | − buf = page_address(page); | |
| 412 | − } else { | |
| 413 | − tailroom = truesize - len; | |
| 414 | − buf = p; | |
| 415 | − } | |
| 408 | + truesize = headroom ? PAGE_SIZE : truesize; | |
| 409 | + tailroom = truesize - len - headroom - (hdr_padded_len - hdr_len); | |
| 410 | + buf = p - headroom; | |
| 416 | 411 | |
| 417 | 412 | len -= hdr_len; |
| 418 | 413 | offset += hdr_padded_len; |
| @@ -958,7 +953,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, · 539 unmodified lines | ||
| 958 | 953 | put_page(page); |
| 959 | 954 | head_skb = page_to_skb(vi, rq, xdp_page, offset, |
| 960 | 955 | len, PAGE_SIZE, false, |
| 961 | − metasize, headroom); | |
| 956 | + metasize, | |
| 957 | + VIRTIO_XDP_HEADROOM); | |
| 962 | 958 | return head_skb; |
| 963 | 959 | } |
| 964 | 960 | break; |
| @@ -1183,9 +1183,6 @@ static int vrf_dev_init(struct net_device *dev) · 1182 unmodified lines | ||
| 1183 | 1183 | |
| 1184 | 1184 | dev->flags = IFF_MASTER | IFF_NOARP; |
| 1185 | 1185 | |
| 1186 | − /* MTU is irrelevant for VRF device; set to 64k similar to lo */ | |
| 1187 | − dev->mtu = 64 * 1024; | |
| 1188 | − | |
| 1189 | 1186 | /* similarly, oper state is irrelevant; set to up to avoid confusion */ |
| 1190 | 1187 | dev->operstate = IF_OPER_UP; |
| 1191 | 1188 | netdev_lockdep_set_classes(dev); |
| @@ -1685,7 +1682,8 @@ static void vrf_setup(struct net_device *dev) · 493 unmodified lines | ||
| 1685 | 1682 | * which breaks networking. |
| 1686 | 1683 | */ |
| 1687 | 1684 | dev->min_mtu = IPV6_MIN_MTU; |
| 1688 | − dev->max_mtu = ETH_MAX_MTU; | |
| 1685 | + dev->max_mtu = IP6_MAX_MTU; | |
| 1686 | + dev->mtu = dev->max_mtu; | |
| 1689 | 1687 | } |
| 1690 | 1688 | |
| 1691 | 1689 | static int vrf_validate(struct nlattr *tb[], struct nlattr *data[], |
| @@ -1,5 +1,4 @@ | ||
| 1 | −ccflags-y := -O3 | |
| 2 | −ccflags-y += -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt' | |
| 1 | +ccflags-y := -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt' | |
| 3 | 2 | ccflags-$(CONFIG_WIREGUARD_DEBUG) += -DDEBUG |
| 4 | 3 | wireguard-y := main.o |
| 5 | 4 | wireguard-y += noise.o |
| @@ -6,6 +6,8 @@ · 5 unmodified lines | ||
| 6 | 6 | #include "allowedips.h" |
| 7 | 7 | #include "peer.h" |
| 8 | 8 | |
| 9 | +static struct kmem_cache *node_cache; | |
| 10 | + | |
| 9 | 11 | static void swap_endian(u8 *dst, const u8 *src, u8 bits) |
| 10 | 12 | { |
| 11 | 13 | if (bits == 32) { |
| @@ -28,8 +30,11 @@ static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src, · 16 unmodified lines | ||
| 28 | 30 | node->bitlen = bits; |
| 29 | 31 | memcpy(node->bits, src, bits / 8U); |
| 30 | 32 | } |
| 31 | −#define CHOOSE_NODE(parent, key) \ | |
| 32 | − parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1] | |
| 33 | + | |
| 34 | +static inline u8 choose(struct allowedips_node *node, const u8 *key) | |
| 35 | +{ | |
| 36 | + return (key[node->bit_at_a] >> node->bit_at_b) & 1; | |
| 37 | +} | |
| 33 | 38 | |
| 34 | 39 | static void push_rcu(struct allowedips_node **stack, |
| 35 | 40 | struct allowedips_node __rcu *p, unsigned int *len) |
| @@ -40,6 +45,11 @@ static void push_rcu(struct allowedips_node **stack, · 4 unmodified lines | ||
| 40 | 45 | } |
| 41 | 46 | } |
| 42 | 47 | |
| 48 | +static void node_free_rcu(struct rcu_head *rcu) | |
| 49 | +{ | |
| 50 | + kmem_cache_free(node_cache, container_of(rcu, struct allowedips_node, rcu)); | |
| 51 | +} | |
| 52 | + | |
| 43 | 53 | static void root_free_rcu(struct rcu_head *rcu) |
| 44 | 54 | { |
| 45 | 55 | struct allowedips_node *node, *stack[128] = { |
| @@ -49,7 +59,7 @@ static void root_free_rcu(struct rcu_head *rcu) · 3 unmodified lines | ||
| 49 | 59 | while (len > 0 && (node = stack[--len])) { |
| 50 | 60 | push_rcu(stack, node->bit[0], &len); |
| 51 | 61 | push_rcu(stack, node->bit[1], &len); |
| 52 | − kfree(node); | |
| 62 | + kmem_cache_free(node_cache, node); | |
| 53 | 63 | } |
| 54 | 64 | } |
| 55 | 65 | |
| @@ -66,60 +76,6 @@ static void root_remove_peer_lists(struct allowedips_node *root) · 10 unmodified lines | ||
| 66 | 76 | } |
| 67 | 77 | } |
| 68 | 78 | |
| 69 | −static void walk_remove_by_peer(struct allowedips_node __rcu **top, | |
| 70 | − struct wg_peer *peer, struct mutex *lock) | |
| 71 | −{ | |
| 72 | −#define REF(p) rcu_access_pointer(p) | |
| 73 | −#define DEREF(p) rcu_dereference_protected(*(p), lockdep_is_held(lock)) | |
| 74 | −#define PUSH(p) ({ \ | |
| 75 | − WARN_ON(IS_ENABLED(DEBUG) && len >= 128); \ | |
| 76 | − stack[len++] = p; \ | |
| 77 | − }) | |
| 78 | − | |
| 79 | − struct allowedips_node __rcu **stack[128], **nptr; | |
| 80 | − struct allowedips_node *node, *prev; | |
| 81 | − unsigned int len; | |
| 82 | − | |
| 83 | − if (unlikely(!peer || !REF(*top))) | |
| 84 | − return; | |
| 85 | − | |
| 86 | − for (prev = NULL, len = 0, PUSH(top); len > 0; prev = node) { | |
| 87 | − nptr = stack[len - 1]; | |
| 88 | − node = DEREF(nptr); | |
| 89 | − if (!node) { | |
| 90 | − --len; | |
| 91 | − continue; | |
| 92 | − } | |
| 93 | − if (!prev || REF(prev->bit[0]) == node || | |
| 94 | − REF(prev->bit[1]) == node) { | |
| 95 | − if (REF(node->bit[0])) | |
| 96 | − PUSH(&node->bit[0]); | |
| 97 | − else if (REF(node->bit[1])) | |
| 98 | − PUSH(&node->bit[1]); | |
| 99 | − } else if (REF(node->bit[0]) == prev) { | |
| 100 | − if (REF(node->bit[1])) | |
| 101 | − PUSH(&node->bit[1]); | |
| 102 | − } else { | |
| 103 | − if (rcu_dereference_protected(node->peer, | |
| 104 | − lockdep_is_held(lock)) == peer) { | |
| 105 | − RCU_INIT_POINTER(node->peer, NULL); | |
| 106 | − list_del_init(&node->peer_list); | |
| 107 | − if (!node->bit[0] || !node->bit[1]) { | |
| 108 | − rcu_assign_pointer(*nptr, DEREF( | |
| 109 | − &node->bit[!REF(node->bit[0])])); | |
| 110 | − kfree_rcu(node, rcu); | |
| 111 | − node = DEREF(nptr); | |
| 112 | − } | |
| 113 | − } | |
| 114 | − --len; | |
| 115 | − } | |
| 116 | − } | |
| 117 | − | |
| 118 | −#undef REF | |
| 119 | −#undef DEREF | |
| 120 | −#undef PUSH | |
| 121 | −} | |
| 122 | − | |
| 123 | 79 | static unsigned int fls128(u64 a, u64 b) |
| 124 | 80 | { |
| 125 | 81 | return a ? fls64(a) + 64U : fls64(b); |
| @@ -159,7 +115,7 @@ static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits, · 33 unmodified lines | ||
| 159 | 115 | found = node; |
| 160 | 116 | if (node->cidr == bits) |
| 161 | 117 | break; |
| 162 | − node = rcu_dereference_bh(CHOOSE_NODE(node, key)); | |
| 118 | + node = rcu_dereference_bh(node->bit[choose(node, key)]); | |
| 163 | 119 | } |
| 164 | 120 | return found; |
| 165 | 121 | } |
| @@ -191,8 +147,7 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, · 25 unmodified lines | ||
| 191 | 147 | u8 cidr, u8 bits, struct allowedips_node **rnode, |
| 192 | 148 | struct mutex *lock) |
| 193 | 149 | { |
| 194 | − struct allowedips_node *node = rcu_dereference_protected(trie, | |
| 195 | − lockdep_is_held(lock)); | |
| 150 | + struct allowedips_node *node = rcu_dereference_protected(trie, lockdep_is_held(lock)); | |
| 196 | 151 | struct allowedips_node *parent = NULL; |
| 197 | 152 | bool exact = false; |
| 198 | 153 | |
| @@ -202,13 +157,24 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, · 3 unmodified lines | ||
| 202 | 157 | exact = true; |
| 203 | 158 | break; |
| 204 | 159 | } |
| 205 | − node = rcu_dereference_protected(CHOOSE_NODE(parent, key), | |
| 206 | − lockdep_is_held(lock)); | |
| 160 | + node = rcu_dereference_protected(parent->bit[choose(parent, key)], lockdep_is_held(lock)); | |
| 207 | 161 | } |
| 208 | 162 | *rnode = parent; |
| 209 | 163 | return exact; |
| 210 | 164 | } |
| 211 | 165 | |
| 166 | +static inline void connect_node(struct allowedips_node **parent, u8 bit, struct allowedips_node *node) | |
| 167 | +{ | |
| 168 | + node->parent_bit_packed = (unsigned long)parent | bit; | |
| 169 | + rcu_assign_pointer(*parent, node); | |
| 170 | +} | |
| 171 | + | |
| 172 | +static inline void choose_and_connect_node(struct allowedips_node *parent, struct allowedips_node *node) | |
| 173 | +{ | |
| 174 | + u8 bit = choose(parent, node->bits); | |
| 175 | + connect_node(&parent->bit[bit], bit, node); | |
| 176 | +} | |
| 177 | + | |
| 212 | 178 | static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, |
| 213 | 179 | u8 cidr, struct wg_peer *peer, struct mutex *lock) |
| 214 | 180 | { |
| @@ -218,13 +184,13 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 3 unmodified lines | ||
| 218 | 184 | return -EINVAL; |
| 219 | 185 | |
| 220 | 186 | if (!rcu_access_pointer(*trie)) { |
| 221 | − node = kzalloc(sizeof(*node), GFP_KERNEL); | |
| 187 | + node = kmem_cache_zalloc(node_cache, GFP_KERNEL); | |
| 222 | 188 | if (unlikely(!node)) |
| 223 | 189 | return -ENOMEM; |
| 224 | 190 | RCU_INIT_POINTER(node->peer, peer); |
| 225 | 191 | list_add_tail(&node->peer_list, &peer->allowedips_list); |
| 226 | 192 | copy_and_assign_cidr(node, key, cidr, bits); |
| 227 | − rcu_assign_pointer(*trie, node); | |
| 193 | + connect_node(trie, 2, node); | |
| 228 | 194 | return 0; |
| 229 | 195 | } |
| 230 | 196 | if (node_placement(*trie, key, cidr, bits, &node, lock)) { |
| @@ -233,7 +199,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 2 unmodified lines | ||
| 233 | 199 | return 0; |
| 234 | 200 | } |
| 235 | 201 | |
| 236 | − newnode = kzalloc(sizeof(*newnode), GFP_KERNEL); | |
| 202 | + newnode = kmem_cache_zalloc(node_cache, GFP_KERNEL); | |
| 237 | 203 | if (unlikely(!newnode)) |
| 238 | 204 | return -ENOMEM; |
| 239 | 205 | RCU_INIT_POINTER(newnode->peer, peer); |
| @@ -243,10 +209,10 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 3 unmodified lines | ||
| 243 | 209 | if (!node) { |
| 244 | 210 | down = rcu_dereference_protected(*trie, lockdep_is_held(lock)); |
| 245 | 211 | } else { |
| 246 | − down = rcu_dereference_protected(CHOOSE_NODE(node, key), | |
| 247 | − lockdep_is_held(lock)); | |
| 212 | + const u8 bit = choose(node, key); | |
| 213 | + down = rcu_dereference_protected(node->bit[bit], lockdep_is_held(lock)); | |
| 248 | 214 | if (!down) { |
| 249 | − rcu_assign_pointer(CHOOSE_NODE(node, key), newnode); | |
| 215 | + connect_node(&node->bit[bit], bit, newnode); | |
| 250 | 216 | return 0; |
| 251 | 217 | } |
| 252 | 218 | } |
| @@ -254,30 +220,29 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 1 unmodified line | ||
| 254 | 220 | parent = node; |
| 255 | 221 | |
| 256 | 222 | if (newnode->cidr == cidr) { |
| 257 | − rcu_assign_pointer(CHOOSE_NODE(newnode, down->bits), down); | |
| 223 | + choose_and_connect_node(newnode, down); | |
| 258 | 224 | if (!parent) |
| 259 | − rcu_assign_pointer(*trie, newnode); | |
| 225 | + connect_node(trie, 2, newnode); | |
| 260 | 226 | else |
| 261 | − rcu_assign_pointer(CHOOSE_NODE(parent, newnode->bits), | |
| 262 | − newnode); | |
| 263 | − } else { | |
| 264 | − node = kzalloc(sizeof(*node), GFP_KERNEL); | |
| 265 | − if (unlikely(!node)) { | |
| 266 | − list_del(&newnode->peer_list); | |
| 267 | − kfree(newnode); | |
| 268 | − return -ENOMEM; | |
| 269 | − } | |
| 270 | − INIT_LIST_HEAD(&node->peer_list); | |
| 271 | − copy_and_assign_cidr(node, newnode->bits, cidr, bits); | |
| 227 | + choose_and_connect_node(parent, newnode); | |
| 228 | + return 0; | |
| 229 | + } | |
| 272 | 230 | |
| 273 | − rcu_assign_pointer(CHOOSE_NODE(node, down->bits), down); | |
| 274 | − rcu_assign_pointer(CHOOSE_NODE(node, newnode->bits), newnode); | |
| 275 | − if (!parent) | |
| 276 | − rcu_assign_pointer(*trie, node); | |
| 277 | − else | |
| 278 | − rcu_assign_pointer(CHOOSE_NODE(parent, node->bits), | |
| 279 | − node); | |
| 231 | + node = kmem_cache_zalloc(node_cache, GFP_KERNEL); | |
| 232 | + if (unlikely(!node)) { | |
| 233 | + list_del(&newnode->peer_list); | |
| 234 | + kmem_cache_free(node_cache, newnode); | |
| 235 | + return -ENOMEM; | |
| 280 | 236 | } |
| 237 | + INIT_LIST_HEAD(&node->peer_list); | |
| 238 | + copy_and_assign_cidr(node, newnode->bits, cidr, bits); | |
| 239 | + | |
| 240 | + choose_and_connect_node(node, down); | |
| 241 | + choose_and_connect_node(node, newnode); | |
| 242 | + if (!parent) | |
| 243 | + connect_node(trie, 2, node); | |
| 244 | + else | |
| 245 | + choose_and_connect_node(parent, node); | |
| 281 | 246 | return 0; |
| 282 | 247 | } |
| 283 | 248 | |
| @@ -335,9 +300,41 @@ int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip, · 51 unmodified lines | ||
| 335 | 300 | void wg_allowedips_remove_by_peer(struct allowedips *table, |
| 336 | 301 | struct wg_peer *peer, struct mutex *lock) |
| 337 | 302 | { |
| 303 | + struct allowedips_node *node, *child, **parent_bit, *parent, *tmp; | |
| 304 | + bool free_parent; | |
| 305 | + | |
| 306 | + if (list_empty(&peer->allowedips_list)) | |
| 307 | + return; | |
| 338 | 308 | ++table->seq; |
| 339 | − walk_remove_by_peer(&table->root4, peer, lock); | |
| 340 | − walk_remove_by_peer(&table->root6, peer, lock); | |
| 309 | + list_for_each_entry_safe(node, tmp, &peer->allowedips_list, peer_list) { | |
| 310 | + list_del_init(&node->peer_list); | |
| 311 | + RCU_INIT_POINTER(node->peer, NULL); | |
| 312 | + if (node->bit[0] && node->bit[1]) | |
| 313 | + continue; | |
| 314 | + child = rcu_dereference_protected(node->bit[!rcu_access_pointer(node->bit[0])], | |
| 315 | + lockdep_is_held(lock)); | |
| 316 | + if (child) | |
| 317 | + child->parent_bit_packed = node->parent_bit_packed; | |
| 318 | + parent_bit = (struct allowedips_node **)(node->parent_bit_packed & ~3UL); | |
| 319 | + *parent_bit = child; | |
| 320 | + parent = (void *)parent_bit - | |
| 321 | + offsetof(struct allowedips_node, bit[node->parent_bit_packed & 1]); | |
| 322 | + free_parent = !rcu_access_pointer(node->bit[0]) && | |
| 323 | + !rcu_access_pointer(node->bit[1]) && | |
| 324 | + (node->parent_bit_packed & 3) <= 1 && | |
| 325 | + !rcu_access_pointer(parent->peer); | |
| 326 | + if (free_parent) | |
| 327 | + child = rcu_dereference_protected( | |
| 328 | + parent->bit[!(node->parent_bit_packed & 1)], | |
| 329 | + lockdep_is_held(lock)); | |
| 330 | + call_rcu(&node->rcu, node_free_rcu); | |
| 331 | + if (!free_parent) | |
| 332 | + continue; | |
| 333 | + if (child) | |
| 334 | + child->parent_bit_packed = parent->parent_bit_packed; | |
| 335 | + *(struct allowedips_node **)(parent->parent_bit_packed & ~3UL) = child; | |
| 336 | + call_rcu(&parent->rcu, node_free_rcu); | |
| 337 | + } | |
| 341 | 338 | } |
| 342 | 339 | |
| 343 | 340 | int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr) |
| @@ -374,4 +371,16 @@ struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, · 30 unmodified lines | ||
| 374 | 371 | return NULL; |
| 375 | 372 | } |
| 376 | 373 | |
| 374 | +int __init wg_allowedips_slab_init(void) | |
| 375 | +{ | |
| 376 | + node_cache = KMEM_CACHE(allowedips_node, 0); | |
| 377 | + return node_cache ? 0 : -ENOMEM; | |
| 378 | +} | |
| 379 | + | |
| 380 | +void wg_allowedips_slab_uninit(void) | |
| 381 | +{ | |
| 382 | + rcu_barrier(); | |
| 383 | + kmem_cache_destroy(node_cache); | |
| 384 | +} | |
| 385 | + | |
| 377 | 386 | #include "selftest/allowedips.c" |
| @@ -15,14 +15,11 @@ struct wg_peer; · 14 unmodified lines | ||
| 15 | 15 | struct allowedips_node { |
| 16 | 16 | struct wg_peer __rcu *peer; |
| 17 | 17 | struct allowedips_node __rcu *bit[2]; |
| 18 | − /* While it may seem scandalous that we waste space for v4, | |
| 19 | − * we're alloc'ing to the nearest power of 2 anyway, so this | |
| 20 | − * doesn't actually make a difference. | |
| 21 | − */ | |
| 22 | − u8 bits[16] __aligned(__alignof(u64)); | |
| 23 | 18 | u8 cidr, bit_at_a, bit_at_b, bitlen; |
| 19 | + u8 bits[16] __aligned(__alignof(u64)); | |
| 24 | 20 | |
| 25 | − /* Keep rarely used list at bottom to be beyond cache line. */ | |
| 21 | + /* Keep rarely used members at bottom to be beyond cache line. */ | |
| 22 | + unsigned long parent_bit_packed; | |
| 26 | 23 | union { |
| 27 | 24 | struct list_head peer_list; |
| 28 | 25 | struct rcu_head rcu; |
| @@ -33,7 +30,7 @@ struct allowedips { · 4 unmodified lines | ||
| 33 | 30 | struct allowedips_node __rcu *root4; |
| 34 | 31 | struct allowedips_node __rcu *root6; |
| 35 | 32 | u64 seq; |
| 36 | −}; | |
| 33 | +} __aligned(4); /* We pack the lower 2 bits of &root, but m68k only gives 16-bit alignment. */ | |
| 37 | 34 | |
| 38 | 35 | void wg_allowedips_init(struct allowedips *table); |
| 39 | 36 | void wg_allowedips_free(struct allowedips *table, struct mutex *mutex); |
| @@ -56,4 +53,7 @@ struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, · 16 unmodified lines | ||
| 56 | 53 | bool wg_allowedips_selftest(void); |
| 57 | 54 | #endif |
| 58 | 55 | |
| 56 | +int wg_allowedips_slab_init(void); | |
| 57 | +void wg_allowedips_slab_uninit(void); | |
| 58 | + | |
| 59 | 59 | #endif /* _WG_ALLOWEDIPS_H */ |
| @@ -21,13 +21,22 @@ static int __init mod_init(void) · 20 unmodified lines | ||
| 21 | 21 | { |
| 22 | 22 | int ret; |
| 23 | 23 | |
| 24 | + ret = wg_allowedips_slab_init(); | |
| 25 | + if (ret < 0) | |
| 26 | + goto err_allowedips; | |
| 27 | + | |
| 24 | 28 | #ifdef DEBUG |
| 29 | + ret = -ENOTRECOVERABLE; | |
| 25 | 30 | if (!wg_allowedips_selftest() || !wg_packet_counter_selftest() || |
| 26 | 31 | !wg_ratelimiter_selftest()) |
| 27 | − return -ENOTRECOVERABLE; | |
| 32 | + goto err_peer; | |
| 28 | 33 | #endif |
| 29 | 34 | wg_noise_init(); |
| 30 | 35 | |
| 36 | + ret = wg_peer_init(); | |
| 37 | + if (ret < 0) | |
| 38 | + goto err_peer; | |
| 39 | + | |
| 31 | 40 | ret = wg_device_init(); |
| 32 | 41 | if (ret < 0) |
| 33 | 42 | goto err_device; |
| @@ -44,6 +53,10 @@ static int __init mod_init(void) · 10 unmodified lines | ||
| 44 | 53 | err_netlink: |
| 45 | 54 | wg_device_uninit(); |
| 46 | 55 | err_device: |
| 56 | + wg_peer_uninit(); | |
| 57 | +err_peer: | |
| 58 | + wg_allowedips_slab_uninit(); | |
| 59 | +err_allowedips: | |
| 47 | 60 | return ret; |
| 48 | 61 | } |
| 49 | 62 | |
| @@ -51,6 +64,8 @@ static void __exit mod_exit(void) · 1 unmodified line | ||
| 51 | 64 | { |
| 52 | 65 | wg_genetlink_uninit(); |
| 53 | 66 | wg_device_uninit(); |
| 67 | + wg_peer_uninit(); | |
| 68 | + wg_allowedips_slab_uninit(); | |
| 54 | 69 | } |
| 55 | 70 | |
| 56 | 71 | module_init(mod_init); |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/rcupdate.h> |
| 16 | 16 | #include <linux/list.h> |
| 17 | 17 | |
| 18 | +static struct kmem_cache *peer_cache; | |
| 18 | 19 | static atomic64_t peer_counter = ATOMIC64_INIT(0); |
| 19 | 20 | |
| 20 | 21 | struct wg_peer *wg_peer_create(struct wg_device *wg, |
| @@ -29,10 +30,10 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, · 8 unmodified lines | ||
| 29 | 30 | if (wg->num_peers >= MAX_PEERS_PER_DEVICE) |
| 30 | 31 | return ERR_PTR(ret); |
| 31 | 32 | |
| 32 | − peer = kzalloc(sizeof(*peer), GFP_KERNEL); | |
| 33 | + peer = kmem_cache_zalloc(peer_cache, GFP_KERNEL); | |
| 33 | 34 | if (unlikely(!peer)) |
| 34 | 35 | return ERR_PTR(ret); |
| 35 | − if (dst_cache_init(&peer->endpoint_cache, GFP_KERNEL)) | |
| 36 | + if (unlikely(dst_cache_init(&peer->endpoint_cache, GFP_KERNEL))) | |
| 36 | 37 | goto err; |
| 37 | 38 | |
| 38 | 39 | peer->device = wg; |
| @@ -64,7 +65,7 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, · 25 unmodified lines | ||
| 64 | 65 | return peer; |
| 65 | 66 | |
| 66 | 67 | err: |
| 67 | − kfree(peer); | |
| 68 | + kmem_cache_free(peer_cache, peer); | |
| 68 | 69 | return ERR_PTR(ret); |
| 69 | 70 | } |
| 70 | 71 | |
| @@ -88,7 +89,7 @@ static void peer_make_dead(struct wg_peer *peer) · 17 unmodified lines | ||
| 88 | 89 | /* Mark as dead, so that we don't allow jumping contexts after. */ |
| 89 | 90 | WRITE_ONCE(peer->is_dead, true); |
| 90 | 91 | |
| 91 | − /* The caller must now synchronize_rcu() for this to take effect. */ | |
| 92 | + /* The caller must now synchronize_net() for this to take effect. */ | |
| 92 | 93 | } |
| 93 | 94 | |
| 94 | 95 | static void peer_remove_after_dead(struct wg_peer *peer) |
| @@ -160,7 +161,7 @@ void wg_peer_remove(struct wg_peer *peer) · 65 unmodified lines | ||
| 160 | 161 | lockdep_assert_held(&peer->device->device_update_lock); |
| 161 | 162 | |
| 162 | 163 | peer_make_dead(peer); |
| 163 | − synchronize_rcu(); | |
| 164 | + synchronize_net(); | |
| 164 | 165 | peer_remove_after_dead(peer); |
| 165 | 166 | } |
| 166 | 167 | |
| @@ -178,7 +179,7 @@ void wg_peer_remove_all(struct wg_device *wg) · 11 unmodified lines | ||
| 178 | 179 | peer_make_dead(peer); |
| 179 | 180 | list_add_tail(&peer->peer_list, &dead_peers); |
| 180 | 181 | } |
| 181 | − synchronize_rcu(); | |
| 182 | + synchronize_net(); | |
| 182 | 183 | list_for_each_entry_safe(peer, temp, &dead_peers, peer_list) |
| 183 | 184 | peer_remove_after_dead(peer); |
| 184 | 185 | } |
| @@ -193,7 +194,8 @@ static void rcu_release(struct rcu_head *rcu) · 8 unmodified lines | ||
| 193 | 194 | /* The final zeroing takes care of clearing any remaining handshake key |
| 194 | 195 | * material and other potentially sensitive information. |
| 195 | 196 | */ |
| 196 | − kfree_sensitive(peer); | |
| 197 | + memzero_explicit(peer, sizeof(*peer)); | |
| 198 | + kmem_cache_free(peer_cache, peer); | |
| 197 | 199 | } |
| 198 | 200 | |
| 199 | 201 | static void kref_release(struct kref *refcount) |
| @@ -225,3 +227,14 @@ void wg_peer_put(struct wg_peer *peer) · 25 unmodified lines | ||
| 225 | 227 | return; |
| 226 | 228 | kref_put(&peer->refcount, kref_release); |
| 227 | 229 | } |
| 230 | + | |
| 231 | +int __init wg_peer_init(void) | |
| 232 | +{ | |
| 233 | + peer_cache = KMEM_CACHE(wg_peer, 0); | |
| 234 | + return peer_cache ? 0 : -ENOMEM; | |
| 235 | +} | |
| 236 | + | |
| 237 | +void wg_peer_uninit(void) | |
| 238 | +{ | |
| 239 | + kmem_cache_destroy(peer_cache); | |
| 240 | +} | |
| @@ -80,4 +80,7 @@ void wg_peer_put(struct wg_peer *peer); · 79 unmodified lines | ||
| 80 | 80 | void wg_peer_remove(struct wg_peer *peer); |
| 81 | 81 | void wg_peer_remove_all(struct wg_device *wg); |
| 82 | 82 | |
| 83 | +int wg_peer_init(void); | |
| 84 | +void wg_peer_uninit(void); | |
| 85 | + | |
| 83 | 86 | #endif /* _WG_PEER_H */ |
| @@ -19,32 +19,22 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #include <linux/siphash.h> |
| 21 | 21 | |
| 22 | −static __init void swap_endian_and_apply_cidr(u8 *dst, const u8 *src, u8 bits, | |
| 23 | − u8 cidr) | |
| 24 | −{ | |
| 25 | − swap_endian(dst, src, bits); | |
| 26 | − memset(dst + (cidr + 7) / 8, 0, bits / 8 - (cidr + 7) / 8); | |
| 27 | − if (cidr) | |
| 28 | − dst[(cidr + 7) / 8 - 1] &= ~0U << ((8 - (cidr % 8)) % 8); | |
| 29 | −} | |
| 30 | − | |
| 31 | 22 | static __init void print_node(struct allowedips_node *node, u8 bits) |
| 32 | 23 | { |
| 33 | 24 | char *fmt_connection = KERN_DEBUG "\t\"%p/%d\" -> \"%p/%d\";\n"; |
| 34 | − char *fmt_declaration = KERN_DEBUG | |
| 35 | − "\t\"%p/%d\"[style=%s, color=\"#%06x\"];\n"; | |
| 25 | + char *fmt_declaration = KERN_DEBUG "\t\"%p/%d\"[style=%s, color=\"#%06x\"];\n"; | |
| 26 | + u8 ip1[16], ip2[16], cidr1, cidr2; | |
| 36 | 27 | char *style = "dotted"; |
| 37 | − u8 ip1[16], ip2[16]; | |
| 38 | 28 | u32 color = 0; |
| 39 | 29 | |
| 30 | + if (node == NULL) | |
| 31 | + return; | |
| 40 | 32 | if (bits == 32) { |
| 41 | 33 | fmt_connection = KERN_DEBUG "\t\"%pI4/%d\" -> \"%pI4/%d\";\n"; |
| 42 | − fmt_declaration = KERN_DEBUG | |
| 43 | − "\t\"%pI4/%d\"[style=%s, color=\"#%06x\"];\n"; | |
| 34 | + fmt_declaration = KERN_DEBUG "\t\"%pI4/%d\"[style=%s, color=\"#%06x\"];\n"; | |
| 44 | 35 | } else if (bits == 128) { |
| 45 | 36 | fmt_connection = KERN_DEBUG "\t\"%pI6/%d\" -> \"%pI6/%d\";\n"; |
| 46 | − fmt_declaration = KERN_DEBUG | |
| 47 | − "\t\"%pI6/%d\"[style=%s, color=\"#%06x\"];\n"; | |
| 37 | + fmt_declaration = KERN_DEBUG "\t\"%pI6/%d\"[style=%s, color=\"#%06x\"];\n"; | |
| 48 | 38 | } |
| 49 | 39 | if (node->peer) { |
| 50 | 40 | hsiphash_key_t key = { { 0 } }; |
| @@ -55,24 +45,20 @@ static __init void print_node(struct allowedips_node *node, u8 bits) · 4 unmodified lines | ||
| 55 | 45 | hsiphash_1u32(0xabad1dea, &key) % 200; |
| 56 | 46 | style = "bold"; |
| 57 | 47 | } |
| 58 | − swap_endian_and_apply_cidr(ip1, node->bits, bits, node->cidr); | |
| 59 | − printk(fmt_declaration, ip1, node->cidr, style, color); | |
| 48 | + wg_allowedips_read_node(node, ip1, &cidr1); | |
| 49 | + printk(fmt_declaration, ip1, cidr1, style, color); | |
| 60 | 50 | if (node->bit[0]) { |
| 61 | − swap_endian_and_apply_cidr(ip2, | |
| 62 | − rcu_dereference_raw(node->bit[0])->bits, bits, | |
| 63 | − node->cidr); | |
| 64 | − printk(fmt_connection, ip1, node->cidr, ip2, | |
| 65 | − rcu_dereference_raw(node->bit[0])->cidr); | |
| 66 | − print_node(rcu_dereference_raw(node->bit[0]), bits); | |
| 51 | + wg_allowedips_read_node(rcu_dereference_raw(node->bit[0]), ip2, &cidr2); | |
| 52 | + printk(fmt_connection, ip1, cidr1, ip2, cidr2); | |
| 67 | 53 | } |
| 68 | 54 | if (node->bit[1]) { |
| 69 | − swap_endian_and_apply_cidr(ip2, | |
| 70 | − rcu_dereference_raw(node->bit[1])->bits, | |
| 71 | − bits, node->cidr); | |
| 72 | − printk(fmt_connection, ip1, node->cidr, ip2, | |
| 73 | − rcu_dereference_raw(node->bit[1])->cidr); | |
| 74 | − print_node(rcu_dereference_raw(node->bit[1]), bits); | |
| 55 | + wg_allowedips_read_node(rcu_dereference_raw(node->bit[1]), ip2, &cidr2); | |
| 56 | + printk(fmt_connection, ip1, cidr1, ip2, cidr2); | |
| 75 | 57 | } |
| 58 | + if (node->bit[0]) | |
| 59 | + print_node(rcu_dereference_raw(node->bit[0]), bits); | |
| 60 | + if (node->bit[1]) | |
| 61 | + print_node(rcu_dereference_raw(node->bit[1]), bits); | |
| 76 | 62 | } |
| 77 | 63 | |
| 78 | 64 | static __init void print_tree(struct allowedips_node __rcu *top, u8 bits) |
| @@ -121,8 +107,8 @@ static __init inline union nf_inet_addr horrible_cidr_to_mask(u8 cidr) · 42 unmodified lines | ||
| 121 | 107 | { |
| 122 | 108 | union nf_inet_addr mask; |
| 123 | 109 | |
| 124 | − memset(&mask, 0x00, 128 / 8); | |
| 125 | − memset(&mask, 0xff, cidr / 8); | |
| 110 | + memset(&mask, 0, sizeof(mask)); | |
| 111 | + memset(&mask.all, 0xff, cidr / 8); | |
| 126 | 112 | if (cidr % 32) |
| 127 | 113 | mask.all[cidr / 32] = (__force u32)htonl( |
| 128 | 114 | (0xFFFFFFFFUL << (32 - (cidr % 32))) & 0xFFFFFFFFUL); |
| @@ -149,42 +135,36 @@ horrible_mask_self(struct horrible_allowedips_node *node) · 20 unmodified lines | ||
| 149 | 135 | } |
| 150 | 136 | |
| 151 | 137 | static __init inline bool |
| 152 | −horrible_match_v4(const struct horrible_allowedips_node *node, | |
| 153 | − struct in_addr *ip) | |
| 138 | +horrible_match_v4(const struct horrible_allowedips_node *node, struct in_addr *ip) | |
| 154 | 139 | { |
| 155 | 140 | return (ip->s_addr & node->mask.ip) == node->ip.ip; |
| 156 | 141 | } |
| 157 | 142 | |
| 158 | 143 | static __init inline bool |
| 159 | −horrible_match_v6(const struct horrible_allowedips_node *node, | |
| 160 | − struct in6_addr *ip) | |
| 144 | +horrible_match_v6(const struct horrible_allowedips_node *node, struct in6_addr *ip) | |
| 161 | 145 | { |
| 162 | − return (ip->in6_u.u6_addr32[0] & node->mask.ip6[0]) == | |
| 163 | − node->ip.ip6[0] && | |
| 164 | − (ip->in6_u.u6_addr32[1] & node->mask.ip6[1]) == | |
| 165 | − node->ip.ip6[1] && | |
| 166 | − (ip->in6_u.u6_addr32[2] & node->mask.ip6[2]) == | |
| 167 | − node->ip.ip6[2] && | |
| 146 | + return (ip->in6_u.u6_addr32[0] & node->mask.ip6[0]) == node->ip.ip6[0] && | |
| 147 | + (ip->in6_u.u6_addr32[1] & node->mask.ip6[1]) == node->ip.ip6[1] && | |
| 148 | + (ip->in6_u.u6_addr32[2] & node->mask.ip6[2]) == node->ip.ip6[2] && | |
| 168 | 149 | (ip->in6_u.u6_addr32[3] & node->mask.ip6[3]) == node->ip.ip6[3]; |
| 169 | 150 | } |
| 170 | 151 | |
| 171 | 152 | static __init void |
| 172 | −horrible_insert_ordered(struct horrible_allowedips *table, | |
| 173 | − struct horrible_allowedips_node *node) | |
| 153 | +horrible_insert_ordered(struct horrible_allowedips *table, struct horrible_allowedips_node *node) | |
| 174 | 154 | { |
| 175 | 155 | struct horrible_allowedips_node *other = NULL, *where = NULL; |
| 176 | 156 | u8 my_cidr = horrible_mask_to_cidr(node->mask); |
| 177 | 157 | |
| 178 | 158 | hlist_for_each_entry(other, &table->head, table) { |
| 179 | − if (!memcmp(&other->mask, &node->mask, | |
| 180 | − sizeof(union nf_inet_addr)) && | |
| 181 | − !memcmp(&other->ip, &node->ip, | |
| 182 | − sizeof(union nf_inet_addr)) && | |
| 183 | − other->ip_version == node->ip_version) { | |
| 159 | + if (other->ip_version == node->ip_version && | |
| 160 | + !memcmp(&other->mask, &node->mask, sizeof(union nf_inet_addr)) && | |
| 161 | + !memcmp(&other->ip, &node->ip, sizeof(union nf_inet_addr))) { | |
| 184 | 162 | other->value = node->value; |
| 185 | 163 | kfree(node); |
| 186 | 164 | return; |
| 187 | 165 | } |
| 166 | + } | |
| 167 | + hlist_for_each_entry(other, &table->head, table) { | |
| 188 | 168 | where = other; |
| 189 | 169 | if (horrible_mask_to_cidr(other->mask) <= my_cidr) |
| 190 | 170 | break; |
| @@ -201,8 +181,7 @@ static __init int · 10 unmodified lines | ||
| 201 | 181 | horrible_allowedips_insert_v4(struct horrible_allowedips *table, |
| 202 | 182 | struct in_addr *ip, u8 cidr, void *value) |
| 203 | 183 | { |
| 204 | − struct horrible_allowedips_node *node = kzalloc(sizeof(*node), | |
| 205 | − GFP_KERNEL); | |
| 184 | + struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); | |
| 206 | 185 | |
| 207 | 186 | if (unlikely(!node)) |
| 208 | 187 | return -ENOMEM; |
| @@ -219,8 +198,7 @@ static __init int · 10 unmodified lines | ||
| 219 | 198 | horrible_allowedips_insert_v6(struct horrible_allowedips *table, |
| 220 | 199 | struct in6_addr *ip, u8 cidr, void *value) |
| 221 | 200 | { |
| 222 | − struct horrible_allowedips_node *node = kzalloc(sizeof(*node), | |
| 223 | − GFP_KERNEL); | |
| 201 | + struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); | |
| 224 | 202 | |
| 225 | 203 | if (unlikely(!node)) |
| 226 | 204 | return -ENOMEM; |
| @@ -234,39 +212,43 @@ horrible_allowedips_insert_v6(struct horrible_allowedips *table, · 7 unmodified lines | ||
| 234 | 212 | } |
| 235 | 213 | |
| 236 | 214 | static __init void * |
| 237 | −horrible_allowedips_lookup_v4(struct horrible_allowedips *table, | |
| 238 | − struct in_addr *ip) | |
| 215 | +horrible_allowedips_lookup_v4(struct horrible_allowedips *table, struct in_addr *ip) | |
| 239 | 216 | { |
| 240 | 217 | struct horrible_allowedips_node *node; |
| 241 | − void *ret = NULL; | |
| 242 | 218 | |
| 243 | 219 | hlist_for_each_entry(node, &table->head, table) { |
| 244 | − if (node->ip_version != 4) | |
| 245 | − continue; | |
| 246 | − if (horrible_match_v4(node, ip)) { | |
| 247 | − ret = node->value; | |
| 248 | − break; | |
| 249 | − } | |
| 220 | + if (node->ip_version == 4 && horrible_match_v4(node, ip)) | |
| 221 | + return node->value; | |
| 250 | 222 | } |
| 251 | − return ret; | |
| 223 | + return NULL; | |
| 252 | 224 | } |
| 253 | 225 | |
| 254 | 226 | static __init void * |
| 255 | −horrible_allowedips_lookup_v6(struct horrible_allowedips *table, | |
| 256 | − struct in6_addr *ip) | |
| 227 | +horrible_allowedips_lookup_v6(struct horrible_allowedips *table, struct in6_addr *ip) | |
| 257 | 228 | { |
| 258 | 229 | struct horrible_allowedips_node *node; |
| 259 | − void *ret = NULL; | |
| 260 | 230 | |
| 261 | 231 | hlist_for_each_entry(node, &table->head, table) { |
| 262 | − if (node->ip_version != 6) | |
| 232 | + if (node->ip_version == 6 && horrible_match_v6(node, ip)) | |
| 233 | + return node->value; | |
| 234 | + } | |
| 235 | + return NULL; | |
| 236 | +} | |
| 237 | + | |
| 238 | + | |
| 239 | +static __init void | |
| 240 | +horrible_allowedips_remove_by_value(struct horrible_allowedips *table, void *value) | |
| 241 | +{ | |
| 242 | + struct horrible_allowedips_node *node; | |
| 243 | + struct hlist_node *h; | |
| 244 | + | |
| 245 | + hlist_for_each_entry_safe(node, h, &table->head, table) { | |
| 246 | + if (node->value != value) | |
| 263 | 247 | continue; |
| 264 | − if (horrible_match_v6(node, ip)) { | |
| 265 | − ret = node->value; | |
| 266 | − break; | |
| 267 | − } | |
| 248 | + hlist_del(&node->table); | |
| 249 | + kfree(node); | |
| 268 | 250 | } |
| 269 | − return ret; | |
| 251 | + | |
| 270 | 252 | } |
| 271 | 253 | |
| 272 | 254 | static __init bool randomized_test(void) |
| @@ -296,6 +278,7 @@ static __init bool randomized_test(void) · 23 unmodified lines | ||
| 296 | 278 | goto free; |
| 297 | 279 | } |
| 298 | 280 | kref_init(&peers[i]->refcount); |
| 281 | + INIT_LIST_HEAD(&peers[i]->allowedips_list); | |
| 299 | 282 | } |
| 300 | 283 | |
| 301 | 284 | mutex_lock(&mutex); |
| @@ -333,7 +316,7 @@ static __init bool randomized_test(void) · 31 unmodified lines | ||
| 333 | 316 | if (wg_allowedips_insert_v4(&t, |
| 334 | 317 | (struct in_addr *)mutated, |
| 335 | 318 | cidr, peer, &mutex) < 0) { |
| 336 | − pr_err("allowedips random malloc: FAIL\n"); | |
| 319 | + pr_err("allowedips random self-test malloc: FAIL\n"); | |
| 337 | 320 | goto free_locked; |
| 338 | 321 | } |
| 339 | 322 | if (horrible_allowedips_insert_v4(&h, |
| @@ -396,23 +379,33 @@ static __init bool randomized_test(void) · 56 unmodified lines | ||
| 396 | 379 | print_tree(t.root6, 128); |
| 397 | 380 | } |
| 398 | 381 | |
| 399 | − for (i = 0; i < NUM_QUERIES; ++i) { | |
| 400 | − prandom_bytes(ip, 4); | |
| 401 | − if (lookup(t.root4, 32, ip) != | |
| 402 | − horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip)) { | |
| 403 | − pr_err("allowedips random self-test: FAIL\n"); | |
| 404 | − goto free; | |
| 382 | + for (j = 0;; ++j) { | |
| 383 | + for (i = 0; i < NUM_QUERIES; ++i) { | |
| 384 | + prandom_bytes(ip, 4); | |
| 385 | + if (lookup(t.root4, 32, ip) != horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip)) { | |
| 386 | + horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip); | |
| 387 | + pr_err("allowedips random v4 self-test: FAIL\n"); | |
| 388 | + goto free; | |
| 389 | + } | |
| 390 | + prandom_bytes(ip, 16); | |
| 391 | + if (lookup(t.root6, 128, ip) != horrible_allowedips_lookup_v6(&h, (struct in6_addr *)ip)) { | |
| 392 | + pr_err("allowedips random v6 self-test: FAIL\n"); | |
| 393 | + goto free; | |
| 394 | + } | |
| 405 | 395 | } |
| 396 | + if (j >= NUM_PEERS) | |
| 397 | + break; | |
| 398 | + mutex_lock(&mutex); | |
| 399 | + wg_allowedips_remove_by_peer(&t, peers[j], &mutex); | |
| 400 | + mutex_unlock(&mutex); | |
| 401 | + horrible_allowedips_remove_by_value(&h, peers[j]); | |
| 406 | 402 | } |
| 407 | 403 | |
| 408 | − for (i = 0; i < NUM_QUERIES; ++i) { | |
| 409 | − prandom_bytes(ip, 16); | |
| 410 | − if (lookup(t.root6, 128, ip) != | |
| 411 | − horrible_allowedips_lookup_v6(&h, (struct in6_addr *)ip)) { | |
| 412 | − pr_err("allowedips random self-test: FAIL\n"); | |
| 413 | − goto free; | |
| 414 | − } | |
| 404 | + if (t.root4 || t.root6) { | |
| 405 | + pr_err("allowedips random self-test removal: FAIL\n"); | |
| 406 | + goto free; | |
| 415 | 407 | } |
| 408 | + | |
| 416 | 409 | ret = true; |
| 417 | 410 | |
| 418 | 411 | free: |
| @@ -430,7 +430,7 @@ void wg_socket_reinit(struct wg_device *wg, struct sock *new4, · 429 unmodified lines | ||
| 430 | 430 | if (new4) |
| 431 | 431 | wg->incoming_port = ntohs(inet_sk(new4)->inet_sport); |
| 432 | 432 | mutex_unlock(&wg->socket_update_lock); |
| 433 | − synchronize_rcu(); | |
| 433 | + synchronize_net(); | |
| 434 | 434 | sock_free(old4); |
| 435 | 435 | sock_free(old6); |
| 436 | 436 | } |
| @@ -845,6 +845,7 @@ enum htt_security_types { · 844 unmodified lines | ||
| 845 | 845 | |
| 846 | 846 | #define ATH10K_HTT_TXRX_PEER_SECURITY_MAX 2 |
| 847 | 847 | #define ATH10K_TXRX_NUM_EXT_TIDS 19 |
| 848 | +#define ATH10K_TXRX_NON_QOS_TID 16 | |
| 848 | 849 | |
| 849 | 850 | enum htt_security_flags { |
| 850 | 851 | #define HTT_SECURITY_TYPE_MASK 0x7F |
| @@ -1746,16 +1746,97 @@ static void ath10k_htt_rx_h_csum_offload(struct sk_buff *msdu) · 1745 unmodified lines | ||
| 1746 | 1746 | msdu->ip_summed = ath10k_htt_rx_get_csum_state(msdu); |
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | +static u64 ath10k_htt_rx_h_get_pn(struct ath10k *ar, struct sk_buff *skb, | |
| 1750 | + u16 offset, | |
| 1751 | + enum htt_rx_mpdu_encrypt_type enctype) | |
| 1752 | +{ | |
| 1753 | + struct ieee80211_hdr *hdr; | |
| 1754 | + u64 pn = 0; | |
| 1755 | + u8 *ehdr; | |
| 1756 | + | |
| 1757 | + hdr = (struct ieee80211_hdr *)(skb->data + offset); | |
| 1758 | + ehdr = skb->data + offset + ieee80211_hdrlen(hdr->frame_control); | |
| 1759 | + | |
| 1760 | + if (enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2) { | |
| 1761 | + pn = ehdr[0]; | |
| 1762 | + pn |= (u64)ehdr[1] << 8; | |
| 1763 | + pn |= (u64)ehdr[4] << 16; | |
| 1764 | + pn |= (u64)ehdr[5] << 24; | |
| 1765 | + pn |= (u64)ehdr[6] << 32; | |
| 1766 | + pn |= (u64)ehdr[7] << 40; | |
| 1767 | + } | |
| 1768 | + return pn; | |
| 1769 | +} | |
| 1770 | + | |
| 1771 | +static bool ath10k_htt_rx_h_frag_multicast_check(struct ath10k *ar, | |
| 1772 | + struct sk_buff *skb, | |
| 1773 | + u16 offset) | |
| 1774 | +{ | |
| 1775 | + struct ieee80211_hdr *hdr; | |
| 1776 | + | |
| 1777 | + hdr = (struct ieee80211_hdr *)(skb->data + offset); | |
| 1778 | + return !is_multicast_ether_addr(hdr->addr1); | |
| 1779 | +} | |
| 1780 | + | |
| 1781 | +static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar, | |
| 1782 | + struct sk_buff *skb, | |
| 1783 | + u16 peer_id, | |
| 1784 | + u16 offset, | |
| 1785 | + enum htt_rx_mpdu_encrypt_type enctype) | |
| 1786 | +{ | |
| 1787 | + struct ath10k_peer *peer; | |
| 1788 | + union htt_rx_pn_t *last_pn, new_pn = {0}; | |
| 1789 | + struct ieee80211_hdr *hdr; | |
| 1790 | + bool more_frags; | |
| 1791 | + u8 tid, frag_number; | |
| 1792 | + u32 seq; | |
| 1793 | + | |
| 1794 | + peer = ath10k_peer_find_by_id(ar, peer_id); | |
| 1795 | + if (!peer) { | |
| 1796 | + ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid peer for frag pn check\n"); | |
| 1797 | + return false; | |
| 1798 | + } | |
| 1799 | + | |
| 1800 | + hdr = (struct ieee80211_hdr *)(skb->data + offset); | |
| 1801 | + if (ieee80211_is_data_qos(hdr->frame_control)) | |
| 1802 | + tid = ieee80211_get_tid(hdr); | |
| 1803 | + else | |
| 1804 | + tid = ATH10K_TXRX_NON_QOS_TID; | |
| 1805 | + | |
| 1806 | + last_pn = &peer->frag_tids_last_pn[tid]; | |
| 1807 | + new_pn.pn48 = ath10k_htt_rx_h_get_pn(ar, skb, offset, enctype); | |
| 1808 | + more_frags = ieee80211_has_morefrags(hdr->frame_control); | |
| 1809 | + frag_number = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; | |
| 1810 | + seq = (__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; | |
| 1811 | + | |
| 1812 | + if (frag_number == 0) { | |
| 1813 | + last_pn->pn48 = new_pn.pn48; | |
| 1814 | + peer->frag_tids_seq[tid] = seq; | |
| 1815 | + } else { | |
| 1816 | + if (seq != peer->frag_tids_seq[tid]) | |
| 1817 | + return false; | |
| 1818 | + | |
| 1819 | + if (new_pn.pn48 != last_pn->pn48 + 1) | |
| 1820 | + return false; | |
| 1821 | + | |
| 1822 | + last_pn->pn48 = new_pn.pn48; | |
| 1823 | + } | |
| 1824 | + | |
| 1825 | + return true; | |
| 1826 | +} | |
| 1827 | + | |
| 1749 | 1828 | static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, |
| 1750 | 1829 | struct sk_buff_head *amsdu, |
| 1751 | 1830 | struct ieee80211_rx_status *status, |
| 1752 | 1831 | bool fill_crypt_header, |
| 1753 | 1832 | u8 *rx_hdr, |
| 1754 | − enum ath10k_pkt_rx_err *err) | |
| 1833 | + enum ath10k_pkt_rx_err *err, | |
| 1834 | + u16 peer_id, | |
| 1835 | + bool frag) | |
| 1755 | 1836 | { |
| 1756 | 1837 | struct sk_buff *first; |
| 1757 | 1838 | struct sk_buff *last; |
| 1758 | − struct sk_buff *msdu; | |
| 1839 | + struct sk_buff *msdu, *temp; | |
| 1759 | 1840 | struct htt_rx_desc *rxd; |
| 1760 | 1841 | struct ieee80211_hdr *hdr; |
| 1761 | 1842 | enum htt_rx_mpdu_encrypt_type enctype; |
| @@ -1768,6 +1849,7 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, · 6 unmodified lines | ||
| 1768 | 1849 | bool is_decrypted; |
| 1769 | 1850 | bool is_mgmt; |
| 1770 | 1851 | u32 attention; |
| 1852 | + bool frag_pn_check = true, multicast_check = true; | |
| 1771 | 1853 | |
| 1772 | 1854 | if (skb_queue_empty(amsdu)) |
| 1773 | 1855 | return; |
| @@ -1866,7 +1948,37 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, · 92 unmodified lines | ||
| 1866 | 1948 | } |
| 1867 | 1949 | |
| 1868 | 1950 | skb_queue_walk(amsdu, msdu) { |
| 1951 | + if (frag && !fill_crypt_header && is_decrypted && | |
| 1952 | + enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2) | |
| 1953 | + frag_pn_check = ath10k_htt_rx_h_frag_pn_check(ar, | |
| 1954 | + msdu, | |
| 1955 | + peer_id, | |
| 1956 | + 0, | |
| 1957 | + enctype); | |
| 1958 | + | |
| 1959 | + if (frag) | |
| 1960 | + multicast_check = ath10k_htt_rx_h_frag_multicast_check(ar, | |
| 1961 | + msdu, | |
| 1962 | + 0); | |
| 1963 | + | |
| 1964 | + if (!frag_pn_check || !multicast_check) { | |
| 1965 | + /* Discard the fragment with invalid PN or multicast DA | |
| 1966 | + */ | |
| 1967 | + temp = msdu->prev; | |
| 1968 | + __skb_unlink(msdu, amsdu); | |
| 1969 | + dev_kfree_skb_any(msdu); | |
| 1970 | + msdu = temp; | |
| 1971 | + frag_pn_check = true; | |
| 1972 | + multicast_check = true; | |
| 1973 | + continue; | |
| 1974 | + } | |
| 1975 | + | |
| 1869 | 1976 | ath10k_htt_rx_h_csum_offload(msdu); |
| 1977 | + | |
| 1978 | + if (frag && !fill_crypt_header && | |
| 1979 | + enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA) | |
| 1980 | + status->flag &= ~RX_FLAG_MMIC_STRIPPED; | |
| 1981 | + | |
| 1870 | 1982 | ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype, |
| 1871 | 1983 | is_decrypted); |
| 1872 | 1984 | |
| @@ -1884,6 +1996,11 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, · 11 unmodified lines | ||
| 1884 | 1996 | |
| 1885 | 1997 | hdr = (void *)msdu->data; |
| 1886 | 1998 | hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
| 1999 | + | |
| 2000 | + if (frag && !fill_crypt_header && | |
| 2001 | + enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA) | |
| 2002 | + status->flag &= ~RX_FLAG_IV_STRIPPED & | |
| 2003 | + ~RX_FLAG_MMIC_STRIPPED; | |
| 1887 | 2004 | } |
| 1888 | 2005 | } |
| 1889 | 2006 | |
| @@ -1991,14 +2108,62 @@ static void ath10k_htt_rx_h_unchain(struct ath10k *ar, · 101 unmodified lines | ||
| 1991 | 2108 | ath10k_unchain_msdu(amsdu, unchain_cnt); |
| 1992 | 2109 | } |
| 1993 | 2110 | |
| 2111 | +static bool ath10k_htt_rx_validate_amsdu(struct ath10k *ar, | |
| 2112 | + struct sk_buff_head *amsdu) | |
| 2113 | +{ | |
| 2114 | + u8 *subframe_hdr; | |
| 2115 | + struct sk_buff *first; | |
| 2116 | + bool is_first, is_last; | |
| 2117 | + struct htt_rx_desc *rxd; | |
| 2118 | + struct ieee80211_hdr *hdr; | |
| 2119 | + size_t hdr_len, crypto_len; | |
| 2120 | + enum htt_rx_mpdu_encrypt_type enctype; | |
| 2121 | + int bytes_aligned = ar->hw_params.decap_align_bytes; | |
| 2122 | + | |
| 2123 | + first = skb_peek(amsdu); | |
| 2124 | + | |
| 2125 | + rxd = (void *)first->data - sizeof(*rxd); | |
| 2126 | + hdr = (void *)rxd->rx_hdr_status; | |
| 2127 | + | |
| 2128 | + is_first = !!(rxd->msdu_end.common.info0 & | |
| 2129 | + __cpu_to_le32(RX_MSDU_END_INFO0_FIRST_MSDU)); | |
| 2130 | + is_last = !!(rxd->msdu_end.common.info0 & | |
| 2131 | + __cpu_to_le32(RX_MSDU_END_INFO0_LAST_MSDU)); | |
| 2132 | + | |
| 2133 | + /* Return in case of non-aggregated msdu */ | |
| 2134 | + if (is_first && is_last) | |
| 2135 | + return true; | |
| 2136 | + | |
| 2137 | + /* First msdu flag is not set for the first msdu of the list */ | |
| 2138 | + if (!is_first) | |
| 2139 | + return false; | |
| 2140 | + | |
| 2141 | + enctype = MS(__le32_to_cpu(rxd->mpdu_start.info0), | |
| 2142 | + RX_MPDU_START_INFO0_ENCRYPT_TYPE); | |
| 2143 | + | |
| 2144 | + hdr_len = ieee80211_hdrlen(hdr->frame_control); | |
| 2145 | + crypto_len = ath10k_htt_rx_crypto_param_len(ar, enctype); | |
| 2146 | + | |
| 2147 | + subframe_hdr = (u8 *)hdr + round_up(hdr_len, bytes_aligned) + | |
| 2148 | + crypto_len; | |
| 2149 | + | |
| 2150 | + /* Validate if the amsdu has a proper first subframe. | |
| 2151 | + * There are chances a single msdu can be received as amsdu when | |
| 2152 | + * the unauthenticated amsdu flag of a QoS header | |
| 2153 | + * gets flipped in non-SPP AMSDU's, in such cases the first | |
| 2154 | + * subframe has llc/snap header in place of a valid da. | |
| 2155 | + * return false if the da matches rfc1042 pattern | |
| 2156 | + */ | |
| 2157 | + if (ether_addr_equal(subframe_hdr, rfc1042_header)) | |
| 2158 | + return false; | |
| 2159 | + | |
| 2160 | + return true; | |
| 2161 | +} | |
| 2162 | + | |
| 1994 | 2163 | static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar, |
| 1995 | 2164 | struct sk_buff_head *amsdu, |
| 1996 | 2165 | struct ieee80211_rx_status *rx_status) |
| 1997 | 2166 | { |
| 1998 | − /* FIXME: It might be a good idea to do some fuzzy-testing to drop | |
| 1999 | − * invalid/dangerous frames. | |
| 2000 | − */ | |
| 2001 | − | |
| 2002 | 2167 | if (!rx_status->freq) { |
| 2003 | 2168 | ath10k_dbg(ar, ATH10K_DBG_HTT, "no channel configured; ignoring frame(s)!\n"); |
| 2004 | 2169 | return false; |
| @@ -2009,6 +2174,11 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar, · 4 unmodified lines | ||
| 2009 | 2174 | return false; |
| 2010 | 2175 | } |
| 2011 | 2176 | |
| 2177 | + if (!ath10k_htt_rx_validate_amsdu(ar, amsdu)) { | |
| 2178 | + ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid amsdu received\n"); | |
| 2179 | + return false; | |
| 2180 | + } | |
| 2181 | + | |
| 2012 | 2182 | return true; |
| 2013 | 2183 | } |
| 2014 | 2184 | |
| @@ -2071,7 +2241,8 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) · 56 unmodified lines | ||
| 2071 | 2241 | ath10k_htt_rx_h_unchain(ar, &amsdu, &drop_cnt, &unchain_cnt); |
| 2072 | 2242 | |
| 2073 | 2243 | ath10k_htt_rx_h_filter(ar, &amsdu, rx_status, &drop_cnt_filter); |
| 2074 | − ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err); | |
| 2244 | + ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err, 0, | |
| 2245 | + false); | |
| 2075 | 2246 | msdus_to_queue = skb_queue_len(&amsdu); |
| 2076 | 2247 | ath10k_htt_rx_h_enqueue(ar, &amsdu, rx_status); |
| 2077 | 2248 | |
| @@ -2204,6 +2375,11 @@ static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt, · 126 unmodified lines | ||
| 2204 | 2375 | fw_desc = &rx->fw_desc; |
| 2205 | 2376 | rx_desc_len = fw_desc->len; |
| 2206 | 2377 | |
| 2378 | + if (fw_desc->u.bits.discard) { | |
| 2379 | + ath10k_dbg(ar, ATH10K_DBG_HTT, "htt discard mpdu\n"); | |
| 2380 | + goto err; | |
| 2381 | + } | |
| 2382 | + | |
| 2207 | 2383 | /* I have not yet seen any case where num_mpdu_ranges > 1. |
| 2208 | 2384 | * qcacld does not seem handle that case either, so we introduce the |
| 2209 | 2385 | * same limitiation here as well. |
| @@ -2509,6 +2685,13 @@ static bool ath10k_htt_rx_proc_rx_frag_ind_hl(struct ath10k_htt *htt, · 299 unmodified lines | ||
| 2509 | 2685 | rx_desc = (struct htt_hl_rx_desc *)(skb->data + tot_hdr_len); |
| 2510 | 2686 | rx_desc_info = __le32_to_cpu(rx_desc->info); |
| 2511 | 2687 | |
| 2688 | + hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len); | |
| 2689 | + | |
| 2690 | + if (is_multicast_ether_addr(hdr->addr1)) { | |
| 2691 | + /* Discard the fragment with multicast DA */ | |
| 2692 | + goto err; | |
| 2693 | + } | |
| 2694 | + | |
| 2512 | 2695 | if (!MS(rx_desc_info, HTT_RX_DESC_HL_INFO_ENCRYPTED)) { |
| 2513 | 2696 | spin_unlock_bh(&ar->data_lock); |
| 2514 | 2697 | return ath10k_htt_rx_proc_rx_ind_hl(htt, &resp->rx_ind_hl, skb, |
| @@ -2516,8 +2699,6 @@ static bool ath10k_htt_rx_proc_rx_frag_ind_hl(struct ath10k_htt *htt, · 1 unmodified line | ||
| 2516 | 2699 | HTT_RX_NON_TKIP_MIC); |
| 2517 | 2700 | } |
| 2518 | 2701 | |
| 2519 | − hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len); | |
| 2520 | − | |
| 2521 | 2702 | if (ieee80211_has_retry(hdr->frame_control)) |
| 2522 | 2703 | goto err; |
| 2523 | 2704 | |
| @@ -3027,7 +3208,7 @@ static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb) · 503 unmodified lines | ||
| 3027 | 3208 | ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id); |
| 3028 | 3209 | ath10k_htt_rx_h_filter(ar, &amsdu, status, NULL); |
| 3029 | 3210 | ath10k_htt_rx_h_mpdu(ar, &amsdu, status, false, NULL, |
| 3030 | − NULL); | |
| 3211 | + NULL, peer_id, frag); | |
| 3031 | 3212 | ath10k_htt_rx_h_enqueue(ar, &amsdu, status); |
| 3032 | 3213 | break; |
| 3033 | 3214 | case -EAGAIN: |
| @@ -1282,7 +1282,19 @@ struct fw_rx_desc_base { · 1281 unmodified lines | ||
| 1282 | 1282 | #define FW_RX_DESC_UDP (1 << 6) |
| 1283 | 1283 | |
| 1284 | 1284 | struct fw_rx_desc_hl { |
| 1285 | − u8 info0; | |
| 1285 | + union { | |
| 1286 | + struct { | |
| 1287 | + u8 discard:1, | |
| 1288 | + forward:1, | |
| 1289 | + any_err:1, | |
| 1290 | + dup_err:1, | |
| 1291 | + reserved:1, | |
| 1292 | + inspect:1, | |
| 1293 | + extension:2; | |
| 1294 | + } bits; | |
| 1295 | + u8 info0; | |
| 1296 | + } u; | |
| 1297 | + | |
| 1286 | 1298 | u8 version; |
| 1287 | 1299 | u8 len; |
| 1288 | 1300 | u8 flags; |
| @@ -260,6 +260,16 @@ static void ath11k_dp_rxdesc_set_msdu_len(struct ath11k_base *ab, · 259 unmodified lines | ||
| 260 | 260 | ab->hw_params.hw_ops->rx_desc_set_msdu_len(desc, len); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | +static bool ath11k_dp_rx_h_attn_is_mcbc(struct ath11k_base *ab, | |
| 264 | + struct hal_rx_desc *desc) | |
| 265 | +{ | |
| 266 | + struct rx_attention *attn = ath11k_dp_rx_get_attention(ab, desc); | |
| 267 | + | |
| 268 | + return ath11k_dp_rx_h_msdu_end_first_msdu(ab, desc) && | |
| 269 | + (!!FIELD_GET(RX_ATTENTION_INFO1_MCAST_BCAST, | |
| 270 | + __le32_to_cpu(attn->info1))); | |
| 271 | +} | |
| 272 | + | |
| 263 | 273 | static void ath11k_dp_service_mon_ring(struct timer_list *t) |
| 264 | 274 | { |
| 265 | 275 | struct ath11k_base *ab = from_timer(ab, t, mon_reap_timer); |
| @@ -852,6 +862,24 @@ static void ath11k_dp_rx_frags_cleanup(struct dp_rx_tid *rx_tid, bool rel_link_d · 586 unmodified lines | ||
| 852 | 862 | __skb_queue_purge(&rx_tid->rx_frags); |
| 853 | 863 | } |
| 854 | 864 | |
| 865 | +void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer) | |
| 866 | +{ | |
| 867 | + struct dp_rx_tid *rx_tid; | |
| 868 | + int i; | |
| 869 | + | |
| 870 | + lockdep_assert_held(&ar->ab->base_lock); | |
| 871 | + | |
| 872 | + for (i = 0; i <= IEEE80211_NUM_TIDS; i++) { | |
| 873 | + rx_tid = &peer->rx_tid[i]; | |
| 874 | + | |
| 875 | + spin_unlock_bh(&ar->ab->base_lock); | |
| 876 | + del_timer_sync(&rx_tid->frag_timer); | |
| 877 | + spin_lock_bh(&ar->ab->base_lock); | |
| 878 | + | |
| 879 | + ath11k_dp_rx_frags_cleanup(rx_tid, true); | |
| 880 | + } | |
| 881 | +} | |
| 882 | + | |
| 855 | 883 | void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer) |
| 856 | 884 | { |
| 857 | 885 | struct dp_rx_tid *rx_tid; |
| @@ -3450,6 +3478,7 @@ static int ath11k_dp_rx_frag_h_mpdu(struct ath11k *ar, · 2592 unmodified lines | ||
| 3450 | 3478 | u8 tid; |
| 3451 | 3479 | int ret = 0; |
| 3452 | 3480 | bool more_frags; |
| 3481 | + bool is_mcbc; | |
| 3453 | 3482 | |
| 3454 | 3483 | rx_desc = (struct hal_rx_desc *)msdu->data; |
| 3455 | 3484 | peer_id = ath11k_dp_rx_h_mpdu_start_peer_id(ar->ab, rx_desc); |
| @@ -3457,6 +3486,11 @@ static int ath11k_dp_rx_frag_h_mpdu(struct ath11k *ar, · 1 unmodified line | ||
| 3457 | 3486 | seqno = ath11k_dp_rx_h_mpdu_start_seq_no(ar->ab, rx_desc); |
| 3458 | 3487 | frag_no = ath11k_dp_rx_h_mpdu_start_frag_no(ar->ab, msdu); |
| 3459 | 3488 | more_frags = ath11k_dp_rx_h_mpdu_start_more_frags(ar->ab, msdu); |
| 3489 | + is_mcbc = ath11k_dp_rx_h_attn_is_mcbc(ar->ab, rx_desc); | |
| 3490 | + | |
| 3491 | + /* Multicast/Broadcast fragments are not expected */ | |
| 3492 | + if (is_mcbc) | |
| 3493 | + return -EINVAL; | |
| 3460 | 3494 | |
| 3461 | 3495 | if (!ath11k_dp_rx_h_mpdu_start_seq_ctrl_valid(ar->ab, rx_desc) || |
| 3462 | 3496 | !ath11k_dp_rx_h_mpdu_start_fc_valid(ar->ab, rx_desc) || |
| @@ -49,6 +49,7 @@ int ath11k_dp_peer_rx_pn_replay_config(struct ath11k_vif *arvif, · 48 unmodified lines | ||
| 49 | 49 | const u8 *peer_addr, |
| 50 | 50 | enum set_key_cmd key_cmd, |
| 51 | 51 | struct ieee80211_key_conf *key); |
| 52 | +void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer); | |
| 52 | 53 | void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer); |
| 53 | 54 | void ath11k_peer_rx_tid_delete(struct ath11k *ar, |
| 54 | 55 | struct ath11k_peer *peer, u8 tid); |
| @@ -2779,6 +2779,12 @@ static int ath11k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, · 2778 unmodified lines | ||
| 2779 | 2779 | */ |
| 2780 | 2780 | spin_lock_bh(&ab->base_lock); |
| 2781 | 2781 | peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); |
| 2782 | + | |
| 2783 | + /* flush the fragments cache during key (re)install to | |
| 2784 | + * ensure all frags in the new frag list belong to the same key. | |
| 2785 | + */ | |
| 2786 | + if (peer && cmd == SET_KEY) | |
| 2787 | + ath11k_peer_frags_flush(ar, peer); | |
| 2782 | 2788 | spin_unlock_bh(&ab->base_lock); |
| 2783 | 2789 | |
| 2784 | 2790 | if (!peer) { |
| @@ -1693,8 +1693,13 @@ static int mac80211_hwsim_start(struct ieee80211_hw *hw) · 1692 unmodified lines | ||
| 1693 | 1693 | static void mac80211_hwsim_stop(struct ieee80211_hw *hw) |
| 1694 | 1694 | { |
| 1695 | 1695 | struct mac80211_hwsim_data *data = hw->priv; |
| 1696 | + | |
| 1696 | 1697 | data->started = false; |
| 1697 | 1698 | hrtimer_cancel(&data->beacon_timer); |
| 1699 | + | |
| 1700 | + while (!skb_queue_empty(&data->pending)) | |
| 1701 | + ieee80211_free_txskb(hw, skb_dequeue(&data->pending)); | |
| 1702 | + | |
| 1698 | 1703 | wiphy_dbg(hw->wiphy, "%s\n", __func__); |
| 1699 | 1704 | } |
| 1700 | 1705 | |
| @@ -514,10 +514,36 @@ EXPORT_SYMBOL_GPL(mt76_free_device); · 513 unmodified lines | ||
| 514 | 514 | static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q) |
| 515 | 515 | { |
| 516 | 516 | struct sk_buff *skb = phy->rx_amsdu[q].head; |
| 517 | + struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb; | |
| 517 | 518 | struct mt76_dev *dev = phy->dev; |
| 518 | 519 | |
| 519 | 520 | phy->rx_amsdu[q].head = NULL; |
| 520 | 521 | phy->rx_amsdu[q].tail = NULL; |
| 522 | + | |
| 523 | + /* | |
| 524 | + * Validate if the amsdu has a proper first subframe. | |
| 525 | + * A single MSDU can be parsed as A-MSDU when the unauthenticated A-MSDU | |
| 526 | + * flag of the QoS header gets flipped. In such cases, the first | |
| 527 | + * subframe has a LLC/SNAP header in the location of the destination | |
| 528 | + * address. | |
| 529 | + */ | |
| 530 | + if (skb_shinfo(skb)->frag_list) { | |
| 531 | + int offset = 0; | |
| 532 | + | |
| 533 | + if (!(status->flag & RX_FLAG_8023)) { | |
| 534 | + offset = ieee80211_get_hdrlen_from_skb(skb); | |
| 535 | + | |
| 536 | + if ((status->flag & | |
| 537 | + (RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED)) == | |
| 538 | + RX_FLAG_DECRYPTED) | |
| 539 | + offset += 8; | |
| 540 | + } | |
| 541 | + | |
| 542 | + if (ether_addr_equal(skb->data + offset, rfc1042_header)) { | |
| 543 | + dev_kfree_skb(skb); | |
| 544 | + return; | |
| 545 | + } | |
| 546 | + } | |
| 521 | 547 | __skb_queue_tail(&dev->rx_skb[q], skb); |
| 522 | 548 | } |
| 523 | 549 | |
| @@ -510,7 +510,6 @@ void mt7615_init_device(struct mt7615_dev *dev) · 509 unmodified lines | ||
| 510 | 510 | mutex_init(&dev->pm.mutex); |
| 511 | 511 | init_waitqueue_head(&dev->pm.wait); |
| 512 | 512 | spin_lock_init(&dev->pm.txq_lock); |
| 513 | − set_bit(MT76_STATE_PM, &dev->mphy.state); | |
| 514 | 513 | INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7615_mac_work); |
| 515 | 514 | INIT_DELAYED_WORK(&dev->phy.scan_work, mt7615_scan_work); |
| 516 | 515 | INIT_DELAYED_WORK(&dev->coredump.work, mt7615_coredump_work); |
| @@ -1912,8 +1912,9 @@ void mt7615_pm_wake_work(struct work_struct *work) · 1911 unmodified lines | ||
| 1912 | 1912 | napi_schedule(&dev->mt76.napi[i]); |
| 1913 | 1913 | mt76_connac_pm_dequeue_skbs(mphy, &dev->pm); |
| 1914 | 1914 | mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false); |
| 1915 | − ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, | |
| 1916 | − MT7615_WATCHDOG_TIME); | |
| 1915 | + if (test_bit(MT76_STATE_RUNNING, &mphy->state)) | |
| 1916 | + ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, | |
| 1917 | + MT7615_WATCHDOG_TIME); | |
| 1917 | 1918 | } |
| 1918 | 1919 | |
| 1919 | 1920 | ieee80211_wake_queues(mphy->hw); |
| @@ -51,16 +51,13 @@ mt7663s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, · 50 unmodified lines | ||
| 51 | 51 | return ret; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | −static int mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev) | |
| 54 | +static int __mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev) | |
| 55 | 55 | { |
| 56 | 56 | struct sdio_func *func = dev->mt76.sdio.func; |
| 57 | 57 | struct mt76_phy *mphy = &dev->mt76.phy; |
| 58 | 58 | u32 status; |
| 59 | 59 | int ret; |
| 60 | 60 | |
| 61 | − if (!test_and_clear_bit(MT76_STATE_PM, &mphy->state)) | |
| 62 | − goto out; | |
| 63 | − | |
| 64 | 61 | sdio_claim_host(func); |
| 65 | 62 | |
| 66 | 63 | sdio_writel(func, WHLPCR_FW_OWN_REQ_CLR, MCR_WHLPCR, NULL); |
| @@ -76,13 +73,21 @@ static int mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev) · 9 unmodified lines | ||
| 76 | 73 | } |
| 77 | 74 | |
| 78 | 75 | sdio_release_host(func); |
| 79 | − | |
| 80 | −out: | |
| 81 | 76 | dev->pm.last_activity = jiffies; |
| 82 | 77 | |
| 83 | 78 | return 0; |
| 84 | 79 | } |
| 85 | 80 | |
| 81 | +static int mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev) | |
| 82 | +{ | |
| 83 | + struct mt76_phy *mphy = &dev->mt76.phy; | |
| 84 | + | |
| 85 | + if (test_and_clear_bit(MT76_STATE_PM, &mphy->state)) | |
| 86 | + return __mt7663s_mcu_drv_pmctrl(dev); | |
| 87 | + | |
| 88 | + return 0; | |
| 89 | +} | |
| 90 | + | |
| 86 | 91 | static int mt7663s_mcu_fw_pmctrl(struct mt7615_dev *dev) |
| 87 | 92 | { |
| 88 | 93 | struct sdio_func *func = dev->mt76.sdio.func; |
| @@ -123,7 +128,7 @@ int mt7663s_mcu_init(struct mt7615_dev *dev) · 34 unmodified lines | ||
| 123 | 128 | struct mt7615_mcu_ops *mcu_ops; |
| 124 | 129 | int ret; |
| 125 | 130 | |
| 126 | − ret = mt7663s_mcu_drv_pmctrl(dev); | |
| 131 | + ret = __mt7663s_mcu_drv_pmctrl(dev); | |
| 127 | 132 | if (ret) |
| 128 | 133 | return ret; |
| 129 | 134 | |
| @@ -55,10 +55,7 @@ int mt7663u_mcu_init(struct mt7615_dev *dev) · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | dev->mt76.mcu_ops = &mt7663u_mcu_ops, |
| 57 | 57 | |
| 58 | − /* usb does not support runtime-pm */ | |
| 59 | − clear_bit(MT76_STATE_PM, &dev->mphy.state); | |
| 60 | 58 | mt76_set(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN); |
| 61 | − | |
| 62 | 59 | if (test_and_clear_bit(MT76_STATE_POWER_OFF, &dev->mphy.state)) { |
| 63 | 60 | mt7615_mcu_restart(&dev->mt76); |
| 64 | 61 | if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, |
| @@ -721,6 +721,10 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, · 720 unmodified lines | ||
| 721 | 721 | phy->phy_type = mt76_connac_get_phy_mode_v2(mphy, vif, band, sta); |
| 722 | 722 | phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates); |
| 723 | 723 | phy->rcpi = rcpi; |
| 724 | + phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR, | |
| 725 | + sta->ht_cap.ampdu_factor) | | |
| 726 | + FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY, | |
| 727 | + sta->ht_cap.ampdu_density); | |
| 724 | 728 | |
| 725 | 729 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info)); |
| 726 | 730 | ra_info = (struct sta_rec_ra_info *)tlv; |
| @@ -87,7 +87,7 @@ static const struct ieee80211_ops mt76x0e_ops = { · 86 unmodified lines | ||
| 87 | 87 | .reconfig_complete = mt76x02_reconfig_complete, |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | −static int mt76x0e_register_device(struct mt76x02_dev *dev) | |
| 90 | +static int mt76x0e_init_hardware(struct mt76x02_dev *dev, bool resume) | |
| 91 | 91 | { |
| 92 | 92 | int err; |
| 93 | 93 | |
| @@ -100,9 +100,11 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev) · 6 unmodified lines | ||
| 100 | 100 | if (err < 0) |
| 101 | 101 | return err; |
| 102 | 102 | |
| 103 | − err = mt76x02_dma_init(dev); | |
| 104 | − if (err < 0) | |
| 105 | − return err; | |
| 103 | + if (!resume) { | |
| 104 | + err = mt76x02_dma_init(dev); | |
| 105 | + if (err < 0) | |
| 106 | + return err; | |
| 107 | + } | |
| 106 | 108 | |
| 107 | 109 | err = mt76x0_init_hardware(dev); |
| 108 | 110 | if (err < 0) |
| @@ -123,6 +125,17 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev) · 14 unmodified lines | ||
| 123 | 125 | mt76_clear(dev, 0x110, BIT(9)); |
| 124 | 126 | mt76_set(dev, MT_MAX_LEN_CFG, BIT(13)); |
| 125 | 127 | |
| 128 | + return 0; | |
| 129 | +} | |
| 130 | + | |
| 131 | +static int mt76x0e_register_device(struct mt76x02_dev *dev) | |
| 132 | +{ | |
| 133 | + int err; | |
| 134 | + | |
| 135 | + err = mt76x0e_init_hardware(dev, false); | |
| 136 | + if (err < 0) | |
| 137 | + return err; | |
| 138 | + | |
| 126 | 139 | err = mt76x0_register_device(dev); |
| 127 | 140 | if (err < 0) |
| 128 | 141 | return err; |
| @@ -167,6 +180,8 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 38 unmodified lines | ||
| 167 | 180 | if (ret) |
| 168 | 181 | return ret; |
| 169 | 182 | |
| 183 | + mt76_pci_disable_aspm(pdev); | |
| 184 | + | |
| 170 | 185 | mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x0e_ops, |
| 171 | 186 | &drv_ops); |
| 172 | 187 | if (!mdev) |
| @@ -220,6 +235,60 @@ mt76x0e_remove(struct pci_dev *pdev) · 47 unmodified lines | ||
| 220 | 235 | mt76_free_device(mdev); |
| 221 | 236 | } |
| 222 | 237 | |
| 238 | +#ifdef CONFIG_PM | |
| 239 | +static int mt76x0e_suspend(struct pci_dev *pdev, pm_message_t state) | |
| 240 | +{ | |
| 241 | + struct mt76_dev *mdev = pci_get_drvdata(pdev); | |
| 242 | + struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); | |
| 243 | + int i; | |
| 244 | + | |
| 245 | + mt76_worker_disable(&mdev->tx_worker); | |
| 246 | + for (i = 0; i < ARRAY_SIZE(mdev->phy.q_tx); i++) | |
| 247 | + mt76_queue_tx_cleanup(dev, mdev->phy.q_tx[i], true); | |
| 248 | + for (i = 0; i < ARRAY_SIZE(mdev->q_mcu); i++) | |
| 249 | + mt76_queue_tx_cleanup(dev, mdev->q_mcu[i], true); | |
| 250 | + napi_disable(&mdev->tx_napi); | |
| 251 | + | |
| 252 | + mt76_for_each_q_rx(mdev, i) | |
| 253 | + napi_disable(&mdev->napi[i]); | |
| 254 | + | |
| 255 | + mt76x02_dma_disable(dev); | |
| 256 | + mt76x02_mcu_cleanup(dev); | |
| 257 | + mt76x0_chip_onoff(dev, false, false); | |
| 258 | + | |
| 259 | + pci_enable_wake(pdev, pci_choose_state(pdev, state), true); | |
| 260 | + pci_save_state(pdev); | |
| 261 | + | |
| 262 | + return pci_set_power_state(pdev, pci_choose_state(pdev, state)); | |
| 263 | +} | |
| 264 | + | |
| 265 | +static int mt76x0e_resume(struct pci_dev *pdev) | |
| 266 | +{ | |
| 267 | + struct mt76_dev *mdev = pci_get_drvdata(pdev); | |
| 268 | + struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); | |
| 269 | + int err, i; | |
| 270 | + | |
| 271 | + err = pci_set_power_state(pdev, PCI_D0); | |
| 272 | + if (err) | |
| 273 | + return err; | |
| 274 | + | |
| 275 | + pci_restore_state(pdev); | |
| 276 | + | |
| 277 | + mt76_worker_enable(&mdev->tx_worker); | |
| 278 | + | |
| 279 | + mt76_for_each_q_rx(mdev, i) { | |
| 280 | + mt76_queue_rx_reset(dev, i); | |
| 281 | + napi_enable(&mdev->napi[i]); | |
| 282 | + napi_schedule(&mdev->napi[i]); | |
| 283 | + } | |
| 284 | + | |
| 285 | + napi_enable(&mdev->tx_napi); | |
| 286 | + napi_schedule(&mdev->tx_napi); | |
| 287 | + | |
| 288 | + return mt76x0e_init_hardware(dev, true); | |
| 289 | +} | |
| 290 | +#endif /* CONFIG_PM */ | |
| 291 | + | |
| 223 | 292 | static const struct pci_device_id mt76x0e_device_table[] = { |
| 224 | 293 | { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7610) }, |
| 225 | 294 | { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7630) }, |
| @@ -237,6 +306,10 @@ static struct pci_driver mt76x0e_driver = { · 11 unmodified lines | ||
| 237 | 306 | .id_table = mt76x0e_device_table, |
| 238 | 307 | .probe = mt76x0e_probe, |
| 239 | 308 | .remove = mt76x0e_remove, |
| 309 | +#ifdef CONFIG_PM | |
| 310 | + .suspend = mt76x0e_suspend, | |
| 311 | + .resume = mt76x0e_resume, | |
| 312 | +#endif /* CONFIG_PM */ | |
| 240 | 313 | }; |
| 241 | 314 | |
| 242 | 315 | module_pci_driver(mt76x0e_driver); |
| @@ -76,8 +76,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) · 75 unmodified lines | ||
| 76 | 76 | struct wiphy *wiphy = hw->wiphy; |
| 77 | 77 | |
| 78 | 78 | hw->queues = 4; |
| 79 | − hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; | |
| 80 | − hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; | |
| 79 | + hw->max_rx_aggregation_subframes = 64; | |
| 80 | + hw->max_tx_aggregation_subframes = 128; | |
| 81 | 81 | |
| 82 | 82 | hw->radiotap_timestamp.units_pos = |
| 83 | 83 | IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; |
| @@ -1404,8 +1404,9 @@ void mt7921_pm_wake_work(struct work_struct *work) · 1403 unmodified lines | ||
| 1404 | 1404 | napi_schedule(&dev->mt76.napi[i]); |
| 1405 | 1405 | mt76_connac_pm_dequeue_skbs(mphy, &dev->pm); |
| 1406 | 1406 | mt7921_tx_cleanup(dev); |
| 1407 | − ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, | |
| 1408 | − MT7921_WATCHDOG_TIME); | |
| 1407 | + if (test_bit(MT76_STATE_RUNNING, &mphy->state)) | |
| 1408 | + ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, | |
| 1409 | + MT7921_WATCHDOG_TIME); | |
| 1409 | 1410 | } |
| 1410 | 1411 | |
| 1411 | 1412 | ieee80211_wake_queues(mphy->hw); |
| @@ -74,8 +74,7 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band, · 73 unmodified lines | ||
| 74 | 74 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G; |
| 75 | 75 | else if (band == NL80211_BAND_5GHZ) |
| 76 | 76 | he_cap_elem->phy_cap_info[0] = |
| 77 | − IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | | |
| 78 | − IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G; | |
| 77 | + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G; | |
| 79 | 78 | |
| 80 | 79 | he_cap_elem->phy_cap_info[1] = |
| 81 | 80 | IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD; |
| @@ -402,20 +402,22 @@ static void · 401 unmodified lines | ||
| 402 | 402 | mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb, |
| 403 | 403 | u16 wlan_idx) |
| 404 | 404 | { |
| 405 | − struct mt7921_mcu_wlan_info_event *wtbl_info = | |
| 406 | − (struct mt7921_mcu_wlan_info_event *)(skb->data); | |
| 407 | − struct rate_info rate = {}; | |
| 408 | − u8 curr_idx = wtbl_info->rate_info.rate_idx; | |
| 409 | − u16 curr = le16_to_cpu(wtbl_info->rate_info.rate[curr_idx]); | |
| 410 | − struct mt7921_mcu_peer_cap peer = wtbl_info->peer_cap; | |
| 405 | + struct mt7921_mcu_wlan_info_event *wtbl_info; | |
| 411 | 406 | struct mt76_phy *mphy = &dev->mphy; |
| 412 | 407 | struct mt7921_sta_stats *stats; |
| 408 | + struct rate_info rate = {}; | |
| 413 | 409 | struct mt7921_sta *msta; |
| 414 | 410 | struct mt76_wcid *wcid; |
| 411 | + u8 idx; | |
| 415 | 412 | |
| 416 | 413 | if (wlan_idx >= MT76_N_WCIDS) |
| 417 | 414 | return; |
| 418 | 415 | |
| 416 | + wtbl_info = (struct mt7921_mcu_wlan_info_event *)skb->data; | |
| 417 | + idx = wtbl_info->rate_info.rate_idx; | |
| 418 | + if (idx >= ARRAY_SIZE(wtbl_info->rate_info.rate)) | |
| 419 | + return; | |
| 420 | + | |
| 419 | 421 | rcu_read_lock(); |
| 420 | 422 | |
| 421 | 423 | wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]); |
| @@ -426,7 +428,8 @@ mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb, · 4 unmodified lines | ||
| 426 | 428 | stats = &msta->stats; |
| 427 | 429 | |
| 428 | 430 | /* current rate */ |
| 429 | − mt7921_mcu_tx_rate_parse(mphy, &peer, &rate, curr); | |
| 431 | + mt7921_mcu_tx_rate_parse(mphy, &wtbl_info->peer_cap, &rate, | |
| 432 | + le16_to_cpu(wtbl_info->rate_info.rate[idx])); | |
| 430 | 433 | stats->tx_rate = rate; |
| 431 | 434 | out: |
| 432 | 435 | rcu_read_unlock(); |
| @@ -684,6 +684,7 @@ static void xenvif_disconnect_queue(struct xenvif_queue *queue) · 683 unmodified lines | ||
| 684 | 684 | { |
| 685 | 685 | if (queue->task) { |
| 686 | 686 | kthread_stop(queue->task); |
| 687 | + put_task_struct(queue->task); | |
| 687 | 688 | queue->task = NULL; |
| 688 | 689 | } |
| 689 | 690 | |
| @@ -745,6 +746,11 @@ int xenvif_connect_data(struct xenvif_queue *queue, · 55 unmodified lines | ||
| 745 | 746 | if (IS_ERR(task)) |
| 746 | 747 | goto kthread_err; |
| 747 | 748 | queue->task = task; |
| 749 | + /* | |
| 750 | + * Take a reference to the task in order to prevent it from being freed | |
| 751 | + * if the thread function returns before kthread_stop is called. | |
| 752 | + */ | |
| 753 | + get_task_struct(task); | |
| 748 | 754 | |
| 749 | 755 | task = kthread_run(xenvif_dealloc_kthread, queue, |
| 750 | 756 | "%s-dealloc", queue->name); |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/** | |
| 1 | +/* | |
| 2 | 2 | * Marvell NFC driver: Firmware downloader |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2015, Marvell International Ltd. |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/** | |
| 1 | +/* | |
| 2 | 2 | * Marvell NFC-over-I2C driver: I2C interface related functions |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2015, Marvell International Ltd. |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/** | |
| 1 | +/* | |
| 2 | 2 | * Marvell NFC driver |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2014-2015, Marvell International Ltd. |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/** | |
| 1 | +/* | |
| 2 | 2 | * Marvell NFC-over-SPI driver: SPI interface related functions |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2015, Marvell International Ltd. |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/** | |
| 1 | +/* | |
| 2 | 2 | * Marvell NFC-over-UART driver |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2015, Marvell International Ltd. |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/** | |
| 1 | +/* | |
| 2 | 2 | * Marvell NFC-over-USB driver: USB interface related functions |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2014, Marvell International Ltd. |
| @@ -71,7 +71,8 @@ config NVME_FC · 70 unmodified lines | ||
| 71 | 71 | config NVME_TCP |
| 72 | 72 | tristate "NVM Express over Fabrics TCP host driver" |
| 73 | 73 | depends on INET |
| 74 | − depends on BLK_DEV_NVME | |
| 74 | + depends on BLOCK | |
| 75 | + select NVME_CORE | |
| 75 | 76 | select NVME_FABRICS |
| 76 | 77 | select CRYPTO |
| 77 | 78 | select CRYPTO_CRC32C |
| @@ -3485,8 +3485,10 @@ int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device, · 3484 unmodified lines | ||
| 3485 | 3485 | cdev_init(cdev, fops); |
| 3486 | 3486 | cdev->owner = owner; |
| 3487 | 3487 | ret = cdev_device_add(cdev, cdev_device); |
| 3488 | − if (ret) | |
| 3488 | + if (ret) { | |
| 3489 | + put_device(cdev_device); | |
| 3489 | 3490 | ida_simple_remove(&nvme_ns_chr_minor_ida, minor); |
| 3491 | + } | |
| 3490 | 3492 | return ret; |
| 3491 | 3493 | } |
| 3492 | 3494 | |
| @@ -336,6 +336,11 @@ static void nvmf_log_connect_error(struct nvme_ctrl *ctrl, · 335 unmodified lines | ||
| 336 | 336 | cmd->connect.recfmt); |
| 337 | 337 | break; |
| 338 | 338 | |
| 339 | + case NVME_SC_HOST_PATH_ERROR: | |
| 340 | + dev_err(ctrl->device, | |
| 341 | + "Connect command failed: host path error\n"); | |
| 342 | + break; | |
| 343 | + | |
| 339 | 344 | default: |
| 340 | 345 | dev_err(ctrl->device, |
| 341 | 346 | "Connect command failed, error wo/DNR bit: %d\n", |
| @@ -3107,6 +3107,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 3106 unmodified lines | ||
| 3107 | 3107 | if (ctrl->ctrl.icdoff) { |
| 3108 | 3108 | dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n", |
| 3109 | 3109 | ctrl->ctrl.icdoff); |
| 3110 | + ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR; | |
| 3110 | 3111 | goto out_disconnect_admin_queue; |
| 3111 | 3112 | } |
| 3112 | 3113 | |
| @@ -3114,6 +3115,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 1 unmodified line | ||
| 3114 | 3115 | if (!(ctrl->ctrl.sgls & ((1 << 0) | (1 << 1)))) { |
| 3115 | 3116 | dev_err(ctrl->ctrl.device, |
| 3116 | 3117 | "Mandatory sgls are not supported!\n"); |
| 3118 | + ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR; | |
| 3117 | 3119 | goto out_disconnect_admin_queue; |
| 3118 | 3120 | } |
| 3119 | 3121 | |
| @@ -3280,11 +3282,13 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) · 160 unmodified lines | ||
| 3280 | 3282 | if (ctrl->ctrl.state != NVME_CTRL_CONNECTING) |
| 3281 | 3283 | return; |
| 3282 | 3284 | |
| 3283 | − if (portptr->port_state == FC_OBJSTATE_ONLINE) | |
| 3285 | + if (portptr->port_state == FC_OBJSTATE_ONLINE) { | |
| 3284 | 3286 | dev_info(ctrl->ctrl.device, |
| 3285 | 3287 | "NVME-FC{%d}: reset: Reconnect attempt failed (%d)\n", |
| 3286 | 3288 | ctrl->cnum, status); |
| 3287 | − else if (time_after_eq(jiffies, rport->dev_loss_end)) | |
| 3289 | + if (status > 0 && (status & NVME_SC_DNR)) | |
| 3290 | + recon = false; | |
| 3291 | + } else if (time_after_eq(jiffies, rport->dev_loss_end)) | |
| 3288 | 3292 | recon = false; |
| 3289 | 3293 | |
| 3290 | 3294 | if (recon && nvmf_should_reconnect(&ctrl->ctrl)) { |
| @@ -3298,12 +3302,17 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) · 7 unmodified lines | ||
| 3298 | 3302 | |
| 3299 | 3303 | queue_delayed_work(nvme_wq, &ctrl->connect_work, recon_delay); |
| 3300 | 3304 | } else { |
| 3301 | − if (portptr->port_state == FC_OBJSTATE_ONLINE) | |
| 3302 | − dev_warn(ctrl->ctrl.device, | |
| 3303 | − "NVME-FC{%d}: Max reconnect attempts (%d) " | |
| 3304 | − "reached.\n", | |
| 3305 | − ctrl->cnum, ctrl->ctrl.nr_reconnects); | |
| 3306 | − else | |
| 3305 | + if (portptr->port_state == FC_OBJSTATE_ONLINE) { | |
| 3306 | + if (status > 0 && (status & NVME_SC_DNR)) | |
| 3307 | + dev_warn(ctrl->ctrl.device, | |
| 3308 | + "NVME-FC{%d}: reconnect failure\n", | |
| 3309 | + ctrl->cnum); | |
| 3310 | + else | |
| 3311 | + dev_warn(ctrl->ctrl.device, | |
| 3312 | + "NVME-FC{%d}: Max reconnect attempts " | |
| 3313 | + "(%d) reached.\n", | |
| 3314 | + ctrl->cnum, ctrl->ctrl.nr_reconnects); | |
| 3315 | + } else | |
| 3307 | 3316 | dev_warn(ctrl->ctrl.device, |
| 3308 | 3317 | "NVME-FC{%d}: dev_loss_tmo (%d) expired " |
| 3309 | 3318 | "while waiting for remoteport connectivity.\n", |
| @@ -1320,16 +1320,17 @@ static int nvme_rdma_map_sg_inline(struct nvme_rdma_queue *queue, · 1319 unmodified lines | ||
| 1320 | 1320 | int count) |
| 1321 | 1321 | { |
| 1322 | 1322 | struct nvme_sgl_desc *sg = &c->common.dptr.sgl; |
| 1323 | − struct scatterlist *sgl = req->data_sgl.sg_table.sgl; | |
| 1324 | 1323 | struct ib_sge *sge = &req->sge[1]; |
| 1324 | + struct scatterlist *sgl; | |
| 1325 | 1325 | u32 len = 0; |
| 1326 | 1326 | int i; |
| 1327 | 1327 | |
| 1328 | − for (i = 0; i < count; i++, sgl++, sge++) { | |
| 1328 | + for_each_sg(req->data_sgl.sg_table.sgl, sgl, count, i) { | |
| 1329 | 1329 | sge->addr = sg_dma_address(sgl); |
| 1330 | 1330 | sge->length = sg_dma_len(sgl); |
| 1331 | 1331 | sge->lkey = queue->device->pd->local_dma_lkey; |
| 1332 | 1332 | len += sge->length; |
| 1333 | + sge++; | |
| 1333 | 1334 | } |
| 1334 | 1335 | |
| 1335 | 1336 | sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff); |
| @@ -388,10 +388,10 @@ static void nvmet_keep_alive_timer(struct work_struct *work) · 387 unmodified lines | ||
| 388 | 388 | { |
| 389 | 389 | struct nvmet_ctrl *ctrl = container_of(to_delayed_work(work), |
| 390 | 390 | struct nvmet_ctrl, ka_work); |
| 391 | − bool cmd_seen = ctrl->cmd_seen; | |
| 391 | + bool reset_tbkas = ctrl->reset_tbkas; | |
| 392 | 392 | |
| 393 | − ctrl->cmd_seen = false; | |
| 394 | − if (cmd_seen) { | |
| 393 | + ctrl->reset_tbkas = false; | |
| 394 | + if (reset_tbkas) { | |
| 395 | 395 | pr_debug("ctrl %d reschedule traffic based keep-alive timer\n", |
| 396 | 396 | ctrl->cntlid); |
| 397 | 397 | schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ); |
| @@ -804,6 +804,13 @@ void nvmet_sq_destroy(struct nvmet_sq *sq) · 406 unmodified lines | ||
| 804 | 804 | percpu_ref_exit(&sq->ref); |
| 805 | 805 | |
| 806 | 806 | if (ctrl) { |
| 807 | + /* | |
| 808 | + * The teardown flow may take some time, and the host may not | |
| 809 | + * send us keep-alive during this period, hence reset the | |
| 810 | + * traffic based keep-alive timer so we don't trigger a | |
| 811 | + * controller teardown as a result of a keep-alive expiration. | |
| 812 | + */ | |
| 813 | + ctrl->reset_tbkas = true; | |
| 807 | 814 | nvmet_ctrl_put(ctrl); |
| 808 | 815 | sq->ctrl = NULL; /* allows reusing the queue later */ |
| 809 | 816 | } |
| @@ -952,7 +959,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, · 142 unmodified lines | ||
| 952 | 959 | } |
| 953 | 960 | |
| 954 | 961 | if (sq->ctrl) |
| 955 | − sq->ctrl->cmd_seen = true; | |
| 962 | + sq->ctrl->reset_tbkas = true; | |
| 956 | 963 | |
| 957 | 964 | return true; |
| 958 | 965 | |
| @@ -998,19 +1005,23 @@ static unsigned int nvmet_data_transfer_len(struct nvmet_req *req) · 39 unmodified lines | ||
| 998 | 1005 | return req->transfer_len - req->metadata_len; |
| 999 | 1006 | } |
| 1000 | 1007 | |
| 1001 | −static int nvmet_req_alloc_p2pmem_sgls(struct nvmet_req *req) | |
| 1008 | +static int nvmet_req_alloc_p2pmem_sgls(struct pci_dev *p2p_dev, | |
| 1009 | + struct nvmet_req *req) | |
| 1002 | 1010 | { |
| 1003 | − req->sg = pci_p2pmem_alloc_sgl(req->p2p_dev, &req->sg_cnt, | |
| 1011 | + req->sg = pci_p2pmem_alloc_sgl(p2p_dev, &req->sg_cnt, | |
| 1004 | 1012 | nvmet_data_transfer_len(req)); |
| 1005 | 1013 | if (!req->sg) |
| 1006 | 1014 | goto out_err; |
| 1007 | 1015 | |
| 1008 | 1016 | if (req->metadata_len) { |
| 1009 | − req->metadata_sg = pci_p2pmem_alloc_sgl(req->p2p_dev, | |
| 1017 | + req->metadata_sg = pci_p2pmem_alloc_sgl(p2p_dev, | |
| 1010 | 1018 | &req->metadata_sg_cnt, req->metadata_len); |
| 1011 | 1019 | if (!req->metadata_sg) |
| 1012 | 1020 | goto out_free_sg; |
| 1013 | 1021 | } |
| 1022 | + | |
| 1023 | + req->p2p_dev = p2p_dev; | |
| 1024 | + | |
| 1014 | 1025 | return 0; |
| 1015 | 1026 | out_free_sg: |
| 1016 | 1027 | pci_p2pmem_free_sgl(req->p2p_dev, req->sg); |
| @@ -1018,25 +1029,19 @@ out_err: · 1 unmodified line | ||
| 1018 | 1029 | return -ENOMEM; |
| 1019 | 1030 | } |
| 1020 | 1031 | |
| 1021 | −static bool nvmet_req_find_p2p_dev(struct nvmet_req *req) | |
| 1032 | +static struct pci_dev *nvmet_req_find_p2p_dev(struct nvmet_req *req) | |
| 1022 | 1033 | { |
| 1023 | − if (!IS_ENABLED(CONFIG_PCI_P2PDMA)) | |
| 1024 | − return false; | |
| 1025 | − | |
| 1026 | − if (req->sq->ctrl && req->sq->qid && req->ns) { | |
| 1027 | − req->p2p_dev = radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, | |
| 1028 | − req->ns->nsid); | |
| 1029 | − if (req->p2p_dev) | |
| 1030 | − return true; | |
| 1031 | − } | |
| 1032 | − | |
| 1033 | − req->p2p_dev = NULL; | |
| 1034 | − return false; | |
| 1034 | + if (!IS_ENABLED(CONFIG_PCI_P2PDMA) || | |
| 1035 | + !req->sq->ctrl || !req->sq->qid || !req->ns) | |
| 1036 | + return NULL; | |
| 1037 | + return radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, req->ns->nsid); | |
| 1035 | 1038 | } |
| 1036 | 1039 | |
| 1037 | 1040 | int nvmet_req_alloc_sgls(struct nvmet_req *req) |
| 1038 | 1041 | { |
| 1039 | − if (nvmet_req_find_p2p_dev(req) && !nvmet_req_alloc_p2pmem_sgls(req)) | |
| 1042 | + struct pci_dev *p2p_dev = nvmet_req_find_p2p_dev(req); | |
| 1043 | + | |
| 1044 | + if (p2p_dev && !nvmet_req_alloc_p2pmem_sgls(p2p_dev, req)) | |
| 1040 | 1045 | return 0; |
| 1041 | 1046 | |
| 1042 | 1047 | req->sg = sgl_alloc(nvmet_data_transfer_len(req), GFP_KERNEL, |
| @@ -1065,6 +1070,7 @@ void nvmet_req_free_sgls(struct nvmet_req *req) · 22 unmodified lines | ||
| 1065 | 1070 | pci_p2pmem_free_sgl(req->p2p_dev, req->sg); |
| 1066 | 1071 | if (req->metadata_sg) |
| 1067 | 1072 | pci_p2pmem_free_sgl(req->p2p_dev, req->metadata_sg); |
| 1073 | + req->p2p_dev = NULL; | |
| 1068 | 1074 | } else { |
| 1069 | 1075 | sgl_free(req->sg); |
| 1070 | 1076 | if (req->metadata_sg) |
| @@ -263,7 +263,8 @@ static const struct blk_mq_ops nvme_loop_admin_mq_ops = { · 262 unmodified lines | ||
| 263 | 263 | |
| 264 | 264 | static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl) |
| 265 | 265 | { |
| 266 | − clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags); | |
| 266 | + if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags)) | |
| 267 | + return; | |
| 267 | 268 | nvmet_sq_destroy(&ctrl->queues[0].nvme_sq); |
| 268 | 269 | blk_cleanup_queue(ctrl->ctrl.admin_q); |
| 269 | 270 | blk_cleanup_queue(ctrl->ctrl.fabrics_q); |
| @@ -299,6 +300,7 @@ static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl) · 29 unmodified lines | ||
| 299 | 300 | clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[i].flags); |
| 300 | 301 | nvmet_sq_destroy(&ctrl->queues[i].nvme_sq); |
| 301 | 302 | } |
| 303 | + ctrl->ctrl.queue_count = 1; | |
| 302 | 304 | } |
| 303 | 305 | |
| 304 | 306 | static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl) |
| @@ -405,6 +407,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) · 100 unmodified lines | ||
| 405 | 407 | return 0; |
| 406 | 408 | |
| 407 | 409 | out_cleanup_queue: |
| 410 | + clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags); | |
| 408 | 411 | blk_cleanup_queue(ctrl->ctrl.admin_q); |
| 409 | 412 | out_cleanup_fabrics_q: |
| 410 | 413 | blk_cleanup_queue(ctrl->ctrl.fabrics_q); |
| @@ -462,8 +465,10 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work) · 51 unmodified lines | ||
| 462 | 465 | nvme_loop_shutdown_ctrl(ctrl); |
| 463 | 466 | |
| 464 | 467 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { |
| 465 | − /* state change failure should never happen */ | |
| 466 | − WARN_ON_ONCE(1); | |
| 468 | + if (ctrl->ctrl.state != NVME_CTRL_DELETING && | |
| 469 | + ctrl->ctrl.state != NVME_CTRL_DELETING_NOIO) | |
| 470 | + /* state change failure for non-deleted ctrl? */ | |
| 471 | + WARN_ON_ONCE(1); | |
| 467 | 472 | return; |
| 468 | 473 | } |
| 469 | 474 | |
| @@ -167,7 +167,7 @@ struct nvmet_ctrl { · 166 unmodified lines | ||
| 167 | 167 | struct nvmet_subsys *subsys; |
| 168 | 168 | struct nvmet_sq **sqs; |
| 169 | 169 | |
| 170 | − bool cmd_seen; | |
| 170 | + bool reset_tbkas; | |
| 171 | 171 | |
| 172 | 172 | struct mutex lock; |
| 173 | 173 | u64 cap; |
| @@ -550,7 +550,7 @@ static void nvmet_tcp_queue_response(struct nvmet_req *req) · 549 unmodified lines | ||
| 550 | 550 | * nvmet_req_init is completed. |
| 551 | 551 | */ |
| 552 | 552 | if (queue->rcv_state == NVMET_TCP_RECV_PDU && |
| 553 | − len && len < cmd->req.port->inline_data_size && | |
| 553 | + len && len <= cmd->req.port->inline_data_size && | |
| 554 | 554 | nvme_is_write(cmd->req.cmd)) |
| 555 | 555 | return; |
| 556 | 556 | } |
| @@ -18,6 +18,7 @@ obj-$(CONFIG_PCIE_INTEL_GW) += pcie-intel-gw.o · 17 unmodified lines | ||
| 18 | 18 | obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o |
| 19 | 19 | obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o |
| 20 | 20 | obj-$(CONFIG_PCI_MESON) += pci-meson.o |
| 21 | +obj-$(CONFIG_PCIE_TEGRA194) += pcie-tegra194.o | |
| 21 | 22 | obj-$(CONFIG_PCIE_UNIPHIER) += pcie-uniphier.o |
| 22 | 23 | obj-$(CONFIG_PCIE_UNIPHIER_EP) += pcie-uniphier-ep.o |
| 23 | 24 | |
| @@ -38,6 +39,6 @@ ifdef CONFIG_ACPI · 14 unmodified lines | ||
| 38 | 39 | ifdef CONFIG_PCI_QUIRKS |
| 39 | 40 | obj-$(CONFIG_ARM64) += pcie-al.o |
| 40 | 41 | obj-$(CONFIG_ARM64) += pcie-hisi.o |
| 41 | −obj-$(CONFIG_ARM64) += pcie-tegra194.o | |
| 42 | +obj-$(CONFIG_ARM64) += pcie-tegra194-acpi.o | |
| 42 | 43 | endif |
| 43 | 44 | endif |
| @@ -0,0 +1,108 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | +/* | |
| 3 | + * ACPI quirks for Tegra194 PCIe host controller | |
| 4 | + * | |
| 5 | + * Copyright (C) 2021 NVIDIA Corporation. | |
| 6 | + * | |
| 7 | + * Author: Vidya Sagar <vidyas@nvidia.com> | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#include <linux/pci.h> | |
| 11 | +#include <linux/pci-acpi.h> | |
| 12 | +#include <linux/pci-ecam.h> | |
| 13 | + | |
| 14 | +#include "pcie-designware.h" | |
| 15 | + | |
| 16 | +struct tegra194_pcie_ecam { | |
| 17 | + void __iomem *config_base; | |
| 18 | + void __iomem *iatu_base; | |
| 19 | + void __iomem *dbi_base; | |
| 20 | +}; | |
| 21 | + | |
| 22 | +static int tegra194_acpi_init(struct pci_config_window *cfg) | |
| 23 | +{ | |
| 24 | + struct device *dev = cfg->parent; | |
| 25 | + struct tegra194_pcie_ecam *pcie_ecam; | |
| 26 | + | |
| 27 | + pcie_ecam = devm_kzalloc(dev, sizeof(*pcie_ecam), GFP_KERNEL); | |
| 28 | + if (!pcie_ecam) | |
| 29 | + return -ENOMEM; | |
| 30 | + | |
| 31 | + pcie_ecam->config_base = cfg->win; | |
| 32 | + pcie_ecam->iatu_base = cfg->win + SZ_256K; | |
| 33 | + pcie_ecam->dbi_base = cfg->win + SZ_512K; | |
| 34 | + cfg->priv = pcie_ecam; | |
| 35 | + | |
| 36 | + return 0; | |
| 37 | +} | |
| 38 | + | |
| 39 | +static void atu_reg_write(struct tegra194_pcie_ecam *pcie_ecam, int index, | |
| 40 | + u32 val, u32 reg) | |
| 41 | +{ | |
| 42 | + u32 offset = PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(index); | |
| 43 | + | |
| 44 | + writel(val, pcie_ecam->iatu_base + offset + reg); | |
| 45 | +} | |
| 46 | + | |
| 47 | +static void program_outbound_atu(struct tegra194_pcie_ecam *pcie_ecam, | |
| 48 | + int index, int type, u64 cpu_addr, | |
| 49 | + u64 pci_addr, u64 size) | |
| 50 | +{ | |
| 51 | + atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr), | |
| 52 | + PCIE_ATU_LOWER_BASE); | |
| 53 | + atu_reg_write(pcie_ecam, index, upper_32_bits(cpu_addr), | |
| 54 | + PCIE_ATU_UPPER_BASE); | |
| 55 | + atu_reg_write(pcie_ecam, index, lower_32_bits(pci_addr), | |
| 56 | + PCIE_ATU_LOWER_TARGET); | |
| 57 | + atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr + size - 1), | |
| 58 | + PCIE_ATU_LIMIT); | |
| 59 | + atu_reg_write(pcie_ecam, index, upper_32_bits(pci_addr), | |
| 60 | + PCIE_ATU_UPPER_TARGET); | |
| 61 | + atu_reg_write(pcie_ecam, index, type, PCIE_ATU_CR1); | |
| 62 | + atu_reg_write(pcie_ecam, index, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | |
| 63 | +} | |
| 64 | + | |
| 65 | +static void __iomem *tegra194_map_bus(struct pci_bus *bus, | |
| 66 | + unsigned int devfn, int where) | |
| 67 | +{ | |
| 68 | + struct pci_config_window *cfg = bus->sysdata; | |
| 69 | + struct tegra194_pcie_ecam *pcie_ecam = cfg->priv; | |
| 70 | + u32 busdev; | |
| 71 | + int type; | |
| 72 | + | |
| 73 | + if (bus->number < cfg->busr.start || bus->number > cfg->busr.end) | |
| 74 | + return NULL; | |
| 75 | + | |
| 76 | + if (bus->number == cfg->busr.start) { | |
| 77 | + if (PCI_SLOT(devfn) == 0) | |
| 78 | + return pcie_ecam->dbi_base + where; | |
| 79 | + else | |
| 80 | + return NULL; | |
| 81 | + } | |
| 82 | + | |
| 83 | + busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) | | |
| 84 | + PCIE_ATU_FUNC(PCI_FUNC(devfn)); | |
| 85 | + | |
| 86 | + if (bus->parent->number == cfg->busr.start) { | |
| 87 | + if (PCI_SLOT(devfn) == 0) | |
| 88 | + type = PCIE_ATU_TYPE_CFG0; | |
| 89 | + else | |
| 90 | + return NULL; | |
| 91 | + } else { | |
| 92 | + type = PCIE_ATU_TYPE_CFG1; | |
| 93 | + } | |
| 94 | + | |
| 95 | + program_outbound_atu(pcie_ecam, 0, type, cfg->res.start, busdev, | |
| 96 | + SZ_256K); | |
| 97 | + | |
| 98 | + return pcie_ecam->config_base + where; | |
| 99 | +} | |
| 100 | + | |
| 101 | +const struct pci_ecam_ops tegra194_pcie_ops = { | |
| 102 | + .init = tegra194_acpi_init, | |
| 103 | + .pci_ops = { | |
| 104 | + .map_bus = tegra194_map_bus, | |
| 105 | + .read = pci_generic_config_read, | |
| 106 | + .write = pci_generic_config_write, | |
| 107 | + } | |
| 108 | +}; | |
| @@ -22,8 +22,6 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/of_irq.h> |
| 23 | 23 | #include <linux/of_pci.h> |
| 24 | 24 | #include <linux/pci.h> |
| 25 | −#include <linux/pci-acpi.h> | |
| 26 | −#include <linux/pci-ecam.h> | |
| 27 | 25 | #include <linux/phy/phy.h> |
| 28 | 26 | #include <linux/pinctrl/consumer.h> |
| 29 | 27 | #include <linux/platform_device.h> |
| @@ -247,24 +245,6 @@ static const unsigned int pcie_gen_freq[] = { · 217 unmodified lines | ||
| 247 | 245 | GEN4_CORE_CLK_FREQ |
| 248 | 246 | }; |
| 249 | 247 | |
| 250 | −static const u32 event_cntr_ctrl_offset[] = { | |
| 251 | − 0x1d8, | |
| 252 | − 0x1a8, | |
| 253 | − 0x1a8, | |
| 254 | − 0x1a8, | |
| 255 | − 0x1c4, | |
| 256 | − 0x1d8 | |
| 257 | −}; | |
| 258 | − | |
| 259 | −static const u32 event_cntr_data_offset[] = { | |
| 260 | − 0x1dc, | |
| 261 | − 0x1ac, | |
| 262 | − 0x1ac, | |
| 263 | − 0x1ac, | |
| 264 | − 0x1c8, | |
| 265 | − 0x1dc | |
| 266 | −}; | |
| 267 | − | |
| 268 | 248 | struct tegra_pcie_dw { |
| 269 | 249 | struct device *dev; |
| 270 | 250 | struct resource *appl_res; |
| @@ -313,104 +293,6 @@ struct tegra_pcie_dw_of_data { · 42 unmodified lines | ||
| 313 | 293 | enum dw_pcie_device_mode mode; |
| 314 | 294 | }; |
| 315 | 295 | |
| 316 | −#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) | |
| 317 | −struct tegra194_pcie_ecam { | |
| 318 | − void __iomem *config_base; | |
| 319 | − void __iomem *iatu_base; | |
| 320 | − void __iomem *dbi_base; | |
| 321 | −}; | |
| 322 | − | |
| 323 | −static int tegra194_acpi_init(struct pci_config_window *cfg) | |
| 324 | −{ | |
| 325 | − struct device *dev = cfg->parent; | |
| 326 | − struct tegra194_pcie_ecam *pcie_ecam; | |
| 327 | − | |
| 328 | − pcie_ecam = devm_kzalloc(dev, sizeof(*pcie_ecam), GFP_KERNEL); | |
| 329 | − if (!pcie_ecam) | |
| 330 | − return -ENOMEM; | |
| 331 | − | |
| 332 | − pcie_ecam->config_base = cfg->win; | |
| 333 | − pcie_ecam->iatu_base = cfg->win + SZ_256K; | |
| 334 | − pcie_ecam->dbi_base = cfg->win + SZ_512K; | |
| 335 | − cfg->priv = pcie_ecam; | |
| 336 | − | |
| 337 | − return 0; | |
| 338 | −} | |
| 339 | − | |
| 340 | −static void atu_reg_write(struct tegra194_pcie_ecam *pcie_ecam, int index, | |
| 341 | − u32 val, u32 reg) | |
| 342 | −{ | |
| 343 | − u32 offset = PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(index); | |
| 344 | − | |
| 345 | − writel(val, pcie_ecam->iatu_base + offset + reg); | |
| 346 | −} | |
| 347 | − | |
| 348 | −static void program_outbound_atu(struct tegra194_pcie_ecam *pcie_ecam, | |
| 349 | − int index, int type, u64 cpu_addr, | |
| 350 | − u64 pci_addr, u64 size) | |
| 351 | −{ | |
| 352 | − atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr), | |
| 353 | − PCIE_ATU_LOWER_BASE); | |
| 354 | − atu_reg_write(pcie_ecam, index, upper_32_bits(cpu_addr), | |
| 355 | − PCIE_ATU_UPPER_BASE); | |
| 356 | − atu_reg_write(pcie_ecam, index, lower_32_bits(pci_addr), | |
| 357 | − PCIE_ATU_LOWER_TARGET); | |
| 358 | − atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr + size - 1), | |
| 359 | − PCIE_ATU_LIMIT); | |
| 360 | − atu_reg_write(pcie_ecam, index, upper_32_bits(pci_addr), | |
| 361 | − PCIE_ATU_UPPER_TARGET); | |
| 362 | − atu_reg_write(pcie_ecam, index, type, PCIE_ATU_CR1); | |
| 363 | − atu_reg_write(pcie_ecam, index, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | |
| 364 | −} | |
| 365 | − | |
| 366 | −static void __iomem *tegra194_map_bus(struct pci_bus *bus, | |
| 367 | − unsigned int devfn, int where) | |
| 368 | −{ | |
| 369 | − struct pci_config_window *cfg = bus->sysdata; | |
| 370 | − struct tegra194_pcie_ecam *pcie_ecam = cfg->priv; | |
| 371 | − u32 busdev; | |
| 372 | − int type; | |
| 373 | − | |
| 374 | − if (bus->number < cfg->busr.start || bus->number > cfg->busr.end) | |
| 375 | − return NULL; | |
| 376 | − | |
| 377 | − if (bus->number == cfg->busr.start) { | |
| 378 | − if (PCI_SLOT(devfn) == 0) | |
| 379 | − return pcie_ecam->dbi_base + where; | |
| 380 | − else | |
| 381 | − return NULL; | |
| 382 | − } | |
| 383 | − | |
| 384 | − busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) | | |
| 385 | − PCIE_ATU_FUNC(PCI_FUNC(devfn)); | |
| 386 | − | |
| 387 | − if (bus->parent->number == cfg->busr.start) { | |
| 388 | − if (PCI_SLOT(devfn) == 0) | |
| 389 | − type = PCIE_ATU_TYPE_CFG0; | |
| 390 | − else | |
| 391 | − return NULL; | |
| 392 | − } else { | |
| 393 | − type = PCIE_ATU_TYPE_CFG1; | |
| 394 | − } | |
| 395 | − | |
| 396 | − program_outbound_atu(pcie_ecam, 0, type, cfg->res.start, busdev, | |
| 397 | − SZ_256K); | |
| 398 | − | |
| 399 | − return pcie_ecam->config_base + where; | |
| 400 | −} | |
| 401 | − | |
| 402 | −const struct pci_ecam_ops tegra194_pcie_ops = { | |
| 403 | − .init = tegra194_acpi_init, | |
| 404 | − .pci_ops = { | |
| 405 | − .map_bus = tegra194_map_bus, | |
| 406 | − .read = pci_generic_config_read, | |
| 407 | − .write = pci_generic_config_write, | |
| 408 | − } | |
| 409 | −}; | |
| 410 | −#endif /* defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) */ | |
| 411 | − | |
| 412 | −#ifdef CONFIG_PCIE_TEGRA194 | |
| 413 | − | |
| 414 | 296 | static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci) |
| 415 | 297 | { |
| 416 | 298 | return container_of(pci, struct tegra_pcie_dw, pci); |
| @@ -694,6 +576,24 @@ static struct pci_ops tegra_pci_ops = { · 277 unmodified lines | ||
| 694 | 576 | }; |
| 695 | 577 | |
| 696 | 578 | #if defined(CONFIG_PCIEASPM) |
| 579 | +static const u32 event_cntr_ctrl_offset[] = { | |
| 580 | + 0x1d8, | |
| 581 | + 0x1a8, | |
| 582 | + 0x1a8, | |
| 583 | + 0x1a8, | |
| 584 | + 0x1c4, | |
| 585 | + 0x1d8 | |
| 586 | +}; | |
| 587 | + | |
| 588 | +static const u32 event_cntr_data_offset[] = { | |
| 589 | + 0x1dc, | |
| 590 | + 0x1ac, | |
| 591 | + 0x1ac, | |
| 592 | + 0x1ac, | |
| 593 | + 0x1c8, | |
| 594 | + 0x1dc | |
| 595 | +}; | |
| 596 | + | |
| 697 | 597 | static void disable_aspm_l11(struct tegra_pcie_dw *pcie) |
| 698 | 598 | { |
| 699 | 599 | u32 val; |
| @@ -2411,5 +2311,3 @@ MODULE_DEVICE_TABLE(of, tegra_pcie_dw_of_match); · 1711 unmodified lines | ||
| 2411 | 2311 | MODULE_AUTHOR("Vidya Sagar <vidyas@nvidia.com>"); |
| 2412 | 2312 | MODULE_DESCRIPTION("NVIDIA PCIe host controller driver"); |
| 2413 | 2313 | MODULE_LICENSE("GPL v2"); |
| 2414 | − | |
| 2415 | −#endif /* CONFIG_PCIE_TEGRA194 */ | |
| @@ -514,7 +514,7 @@ static int advk_pcie_wait_pio(struct advk_pcie *pcie) · 513 unmodified lines | ||
| 514 | 514 | udelay(PIO_RETRY_DELAY); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | − dev_err(dev, "config read/write timed out\n"); | |
| 517 | + dev_err(dev, "PIO read/write transfer time out\n"); | |
| 518 | 518 | return -ETIMEDOUT; |
| 519 | 519 | } |
| 520 | 520 | |
| @@ -657,6 +657,35 @@ static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus, · 136 unmodified lines | ||
| 657 | 657 | return true; |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | +static bool advk_pcie_pio_is_running(struct advk_pcie *pcie) | |
| 661 | +{ | |
| 662 | + struct device *dev = &pcie->pdev->dev; | |
| 663 | + | |
| 664 | + /* | |
| 665 | + * Trying to start a new PIO transfer when previous has not completed | |
| 666 | + * cause External Abort on CPU which results in kernel panic: | |
| 667 | + * | |
| 668 | + * SError Interrupt on CPU0, code 0xbf000002 -- SError | |
| 669 | + * Kernel panic - not syncing: Asynchronous SError Interrupt | |
| 670 | + * | |
| 671 | + * Functions advk_pcie_rd_conf() and advk_pcie_wr_conf() are protected | |
| 672 | + * by raw_spin_lock_irqsave() at pci_lock_config() level to prevent | |
| 673 | + * concurrent calls at the same time. But because PIO transfer may take | |
| 674 | + * about 1.5s when link is down or card is disconnected, it means that | |
| 675 | + * advk_pcie_wait_pio() does not always have to wait for completion. | |
| 676 | + * | |
| 677 | + * Some versions of ARM Trusted Firmware handles this External Abort at | |
| 678 | + * EL3 level and mask it to prevent kernel panic. Relevant TF-A commit: | |
| 679 | + * https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=3c7dcdac5c50 | |
| 680 | + */ | |
| 681 | + if (advk_readl(pcie, PIO_START)) { | |
| 682 | + dev_err(dev, "Previous PIO read/write transfer is still running\n"); | |
| 683 | + return true; | |
| 684 | + } | |
| 685 | + | |
| 686 | + return false; | |
| 687 | +} | |
| 688 | + | |
| 660 | 689 | static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, |
| 661 | 690 | int where, int size, u32 *val) |
| 662 | 691 | { |
| @@ -673,9 +702,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, · 10 unmodified lines | ||
| 673 | 702 | return pci_bridge_emul_conf_read(&pcie->bridge, where, |
| 674 | 703 | size, val); |
| 675 | 704 | |
| 676 | − /* Start PIO */ | |
| 677 | − advk_writel(pcie, 0, PIO_START); | |
| 678 | − advk_writel(pcie, 1, PIO_ISR); | |
| 705 | + if (advk_pcie_pio_is_running(pcie)) { | |
| 706 | + *val = 0xffffffff; | |
| 707 | + return PCIBIOS_SET_FAILED; | |
| 708 | + } | |
| 679 | 709 | |
| 680 | 710 | /* Program the control register */ |
| 681 | 711 | reg = advk_readl(pcie, PIO_CTRL); |
| @@ -694,7 +724,8 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, · 12 unmodified lines | ||
| 694 | 724 | /* Program the data strobe */ |
| 695 | 725 | advk_writel(pcie, 0xf, PIO_WR_DATA_STRB); |
| 696 | 726 | |
| 697 | − /* Start the transfer */ | |
| 727 | + /* Clear PIO DONE ISR and start the transfer */ | |
| 728 | + advk_writel(pcie, 1, PIO_ISR); | |
| 698 | 729 | advk_writel(pcie, 1, PIO_START); |
| 699 | 730 | |
| 700 | 731 | ret = advk_pcie_wait_pio(pcie); |
| @@ -734,9 +765,8 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · 33 unmodified lines | ||
| 734 | 765 | if (where % size) |
| 735 | 766 | return PCIBIOS_SET_FAILED; |
| 736 | 767 | |
| 737 | − /* Start PIO */ | |
| 738 | − advk_writel(pcie, 0, PIO_START); | |
| 739 | − advk_writel(pcie, 1, PIO_ISR); | |
| 768 | + if (advk_pcie_pio_is_running(pcie)) | |
| 769 | + return PCIBIOS_SET_FAILED; | |
| 740 | 770 | |
| 741 | 771 | /* Program the control register */ |
| 742 | 772 | reg = advk_readl(pcie, PIO_CTRL); |
| @@ -763,7 +793,8 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · 20 unmodified lines | ||
| 763 | 793 | /* Program the data strobe */ |
| 764 | 794 | advk_writel(pcie, data_strobe, PIO_WR_DATA_STRB); |
| 765 | 795 | |
| 766 | − /* Start the transfer */ | |
| 796 | + /* Clear PIO DONE ISR and start the transfer */ | |
| 797 | + advk_writel(pcie, 1, PIO_ISR); | |
| 767 | 798 | advk_writel(pcie, 1, PIO_START); |
| 768 | 799 | |
| 769 | 800 | ret = advk_pcie_wait_pio(pcie); |
| @@ -103,6 +103,13 @@ struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus) · 102 unmodified lines | ||
| 103 | 103 | #endif |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | +bool pci_host_of_has_msi_map(struct device *dev) | |
| 107 | +{ | |
| 108 | + if (dev && dev->of_node) | |
| 109 | + return of_get_property(dev->of_node, "msi-map", NULL); | |
| 110 | + return false; | |
| 111 | +} | |
| 112 | + | |
| 106 | 113 | static inline int __of_pci_pci_compare(struct device_node *node, |
| 107 | 114 | unsigned int data) |
| 108 | 115 | { |
| @@ -346,6 +353,8 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, · 237 unmodified lines | ||
| 346 | 353 | dev_warn(dev, "More than one I/O resource converted for %pOF. CPU base address for old range lost!\n", |
| 347 | 354 | dev_node); |
| 348 | 355 | *io_base = range.cpu_addr; |
| 356 | + } else if (resource_type(res) == IORESOURCE_MEM) { | |
| 357 | + res->flags &= ~IORESOURCE_MEM_64; | |
| 349 | 358 | } |
| 350 | 359 | |
| 351 | 360 | pci_add_resource_offset(resources, res, res->start - range.pci_addr); |
| @@ -925,7 +925,8 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) · 924 unmodified lines | ||
| 925 | 925 | device_enable_async_suspend(bus->bridge); |
| 926 | 926 | pci_set_bus_of_node(bus); |
| 927 | 927 | pci_set_bus_msi_domain(bus); |
| 928 | − if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev)) | |
| 928 | + if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev) && | |
| 929 | + !pci_host_of_has_msi_map(parent)) | |
| 929 | 930 | bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI; |
| 930 | 931 | |
| 931 | 932 | if (!parent) |
| @@ -3546,6 +3546,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev) · 3545 unmodified lines | ||
| 3546 | 3546 | dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; |
| 3547 | 3547 | } |
| 3548 | 3548 | |
| 3549 | +/* | |
| 3550 | + * Some NVIDIA GPU devices do not work with bus reset, SBR needs to be | |
| 3551 | + * prevented for those affected devices. | |
| 3552 | + */ | |
| 3553 | +static void quirk_nvidia_no_bus_reset(struct pci_dev *dev) | |
| 3554 | +{ | |
| 3555 | + if ((dev->device & 0xffc0) == 0x2340) | |
| 3556 | + quirk_no_bus_reset(dev); | |
| 3557 | +} | |
| 3558 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, | |
| 3559 | + quirk_nvidia_no_bus_reset); | |
| 3560 | + | |
| 3549 | 3561 | /* |
| 3550 | 3562 | * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset. |
| 3551 | 3563 | * The device will throw a Link Down error on AER-capable systems and |
| @@ -3566,6 +3578,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset); · 14 unmodified lines | ||
| 3566 | 3578 | */ |
| 3567 | 3579 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CAVIUM, 0xa100, quirk_no_bus_reset); |
| 3568 | 3580 | |
| 3581 | +/* | |
| 3582 | + * Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS | |
| 3583 | + * automatically disables LTSSM when Secondary Bus Reset is received and | |
| 3584 | + * the device stops working. Prevent bus reset for these devices. With | |
| 3585 | + * this change, the device can be assigned to VMs with VFIO, but it will | |
| 3586 | + * leak state between VMs. Reference | |
| 3587 | + * https://e2e.ti.com/support/processors/f/791/t/954382 | |
| 3588 | + */ | |
| 3589 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0xb005, quirk_no_bus_reset); | |
| 3590 | + | |
| 3569 | 3591 | static void quirk_no_pm_reset(struct pci_dev *dev) |
| 3570 | 3592 | { |
| 3571 | 3593 | /* |
| @@ -3901,6 +3923,69 @@ static int delay_250ms_after_flr(struct pci_dev *dev, int probe) · 329 unmodified lines | ||
| 3901 | 3923 | return 0; |
| 3902 | 3924 | } |
| 3903 | 3925 | |
| 3926 | +#define PCI_DEVICE_ID_HINIC_VF 0x375E | |
| 3927 | +#define HINIC_VF_FLR_TYPE 0x1000 | |
| 3928 | +#define HINIC_VF_FLR_CAP_BIT (1UL << 30) | |
| 3929 | +#define HINIC_VF_OP 0xE80 | |
| 3930 | +#define HINIC_VF_FLR_PROC_BIT (1UL << 18) | |
| 3931 | +#define HINIC_OPERATION_TIMEOUT 15000 /* 15 seconds */ | |
| 3932 | + | |
| 3933 | +/* Device-specific reset method for Huawei Intelligent NIC virtual functions */ | |
| 3934 | +static int reset_hinic_vf_dev(struct pci_dev *pdev, int probe) | |
| 3935 | +{ | |
| 3936 | + unsigned long timeout; | |
| 3937 | + void __iomem *bar; | |
| 3938 | + u32 val; | |
| 3939 | + | |
| 3940 | + if (probe) | |
| 3941 | + return 0; | |
| 3942 | + | |
| 3943 | + bar = pci_iomap(pdev, 0, 0); | |
| 3944 | + if (!bar) | |
| 3945 | + return -ENOTTY; | |
| 3946 | + | |
| 3947 | + /* Get and check firmware capabilities */ | |
| 3948 | + val = ioread32be(bar + HINIC_VF_FLR_TYPE); | |
| 3949 | + if (!(val & HINIC_VF_FLR_CAP_BIT)) { | |
| 3950 | + pci_iounmap(pdev, bar); | |
| 3951 | + return -ENOTTY; | |
| 3952 | + } | |
| 3953 | + | |
| 3954 | + /* Set HINIC_VF_FLR_PROC_BIT for the start of FLR */ | |
| 3955 | + val = ioread32be(bar + HINIC_VF_OP); | |
| 3956 | + val = val | HINIC_VF_FLR_PROC_BIT; | |
| 3957 | + iowrite32be(val, bar + HINIC_VF_OP); | |
| 3958 | + | |
| 3959 | + pcie_flr(pdev); | |
| 3960 | + | |
| 3961 | + /* | |
| 3962 | + * The device must recapture its Bus and Device Numbers after FLR | |
| 3963 | + * in order generate Completions. Issue a config write to let the | |
| 3964 | + * device capture this information. | |
| 3965 | + */ | |
| 3966 | + pci_write_config_word(pdev, PCI_VENDOR_ID, 0); | |
| 3967 | + | |
| 3968 | + /* Firmware clears HINIC_VF_FLR_PROC_BIT when reset is complete */ | |
| 3969 | + timeout = jiffies + msecs_to_jiffies(HINIC_OPERATION_TIMEOUT); | |
| 3970 | + do { | |
| 3971 | + val = ioread32be(bar + HINIC_VF_OP); | |
| 3972 | + if (!(val & HINIC_VF_FLR_PROC_BIT)) | |
| 3973 | + goto reset_complete; | |
| 3974 | + msleep(20); | |
| 3975 | + } while (time_before(jiffies, timeout)); | |
| 3976 | + | |
| 3977 | + val = ioread32be(bar + HINIC_VF_OP); | |
| 3978 | + if (!(val & HINIC_VF_FLR_PROC_BIT)) | |
| 3979 | + goto reset_complete; | |
| 3980 | + | |
| 3981 | + pci_warn(pdev, "Reset dev timeout, FLR ack reg: %#010x\n", val); | |
| 3982 | + | |
| 3983 | +reset_complete: | |
| 3984 | + pci_iounmap(pdev, bar); | |
| 3985 | + | |
| 3986 | + return 0; | |
| 3987 | +} | |
| 3988 | + | |
| 3904 | 3989 | static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { |
| 3905 | 3990 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF, |
| 3906 | 3991 | reset_intel_82599_sfp_virtfn }, |
| @@ -3913,6 +3998,8 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { · 6 unmodified lines | ||
| 3913 | 3998 | { PCI_VENDOR_ID_INTEL, 0x0a54, delay_250ms_after_flr }, |
| 3914 | 3999 | { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID, |
| 3915 | 4000 | reset_chelsio_generic_dev }, |
| 4001 | + { PCI_VENDOR_ID_HUAWEI, PCI_DEVICE_ID_HINIC_VF, | |
| 4002 | + reset_hinic_vf_dev }, | |
| 3916 | 4003 | { 0 } |
| 3917 | 4004 | }; |
| 3918 | 4005 | |
| @@ -4753,6 +4840,8 @@ static const struct pci_dev_acs_enabled { · 834 unmodified lines | ||
| 4753 | 4840 | { PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs }, |
| 4754 | 4841 | { PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs }, |
| 4755 | 4842 | { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs }, |
| 4843 | + /* Broadcom multi-function device */ | |
| 4844 | + { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs }, | |
| 4756 | 4845 | { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, |
| 4757 | 4846 | /* Amazon Annapurna Labs */ |
| 4758 | 4847 | { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, |
| @@ -5154,7 +5243,8 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); · 395 unmodified lines | ||
| 5154 | 5243 | static void quirk_amd_harvest_no_ats(struct pci_dev *pdev) |
| 5155 | 5244 | { |
| 5156 | 5245 | if ((pdev->device == 0x7312 && pdev->revision != 0x00) || |
| 5157 | − (pdev->device == 0x7340 && pdev->revision != 0xc5)) | |
| 5246 | + (pdev->device == 0x7340 && pdev->revision != 0xc5) || | |
| 5247 | + (pdev->device == 0x7341 && pdev->revision != 0x00)) | |
| 5158 | 5248 | return; |
| 5159 | 5249 | |
| 5160 | 5250 | if (pdev->device == 0x15d8) { |
| @@ -5181,6 +5271,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats); · 20 unmodified lines | ||
| 5181 | 5271 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats); |
| 5182 | 5272 | /* AMD Navi14 dGPU */ |
| 5183 | 5273 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats); |
| 5274 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7341, quirk_amd_harvest_no_ats); | |
| 5184 | 5275 | /* AMD Raven platform iGPU */ |
| 5185 | 5276 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x15d8, quirk_amd_harvest_no_ats); |
| 5186 | 5277 | #endif /* CONFIG_PCI_ATS */ |
| @@ -78,7 +78,7 @@ static inline u32 brcm_usb_readl(void __iomem *addr) · 77 unmodified lines | ||
| 78 | 78 | * Other architectures (e.g., ARM) either do not support big endian, or |
| 79 | 79 | * else leave I/O in little endian mode. |
| 80 | 80 | */ |
| 81 | − if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) | |
| 81 | + if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) | |
| 82 | 82 | return __raw_readl(addr); |
| 83 | 83 | else |
| 84 | 84 | return readl_relaxed(addr); |
| @@ -87,7 +87,7 @@ static inline u32 brcm_usb_readl(void __iomem *addr) · 2 unmodified lines | ||
| 87 | 87 | static inline void brcm_usb_writel(u32 val, void __iomem *addr) |
| 88 | 88 | { |
| 89 | 89 | /* See brcmnand_readl() comments */ |
| 90 | − if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) | |
| 90 | + if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) | |
| 91 | 91 | __raw_writel(val, addr); |
| 92 | 92 | else |
| 93 | 93 | writel_relaxed(val, addr); |
| @@ -940,6 +940,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) · 939 unmodified lines | ||
| 940 | 940 | sp->nsubnodes = node; |
| 941 | 941 | |
| 942 | 942 | if (sp->num_lanes > SIERRA_MAX_LANES) { |
| 943 | + ret = -EINVAL; | |
| 943 | 944 | dev_err(dev, "Invalid lane configuration\n"); |
| 944 | 945 | goto put_child2; |
| 945 | 946 | } |
| @@ -949,6 +949,8 @@ static int mtk_phy_init(struct phy *phy) · 948 unmodified lines | ||
| 949 | 949 | break; |
| 950 | 950 | default: |
| 951 | 951 | dev_err(tphy->dev, "incompatible PHY type\n"); |
| 952 | + clk_disable_unprepare(instance->ref_clk); | |
| 953 | + clk_disable_unprepare(instance->da_ref_clk); | |
| 952 | 954 | return -EINVAL; |
| 953 | 955 | } |
| 954 | 956 | |
| @@ -2470,6 +2470,10 @@ static int sparx5_serdes_probe(struct platform_device *pdev) · 2469 unmodified lines | ||
| 2470 | 2470 | priv->coreclock = clock; |
| 2471 | 2471 | |
| 2472 | 2472 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 2473 | + if (!iores) { | |
| 2474 | + dev_err(priv->dev, "Invalid resource\n"); | |
| 2475 | + return -EINVAL; | |
| 2476 | + } | |
| 2473 | 2477 | iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores)); |
| 2474 | 2478 | if (IS_ERR(iomem)) { |
| 2475 | 2479 | dev_err(priv->dev, "Unable to get serdes registers: %s\n", |
| @@ -341,7 +341,7 @@ static struct platform_driver mt7621_pci_phy_driver = { · 340 unmodified lines | ||
| 341 | 341 | .probe = mt7621_pci_phy_probe, |
| 342 | 342 | .driver = { |
| 343 | 343 | .name = "mt7621-pci-phy", |
| 344 | − .of_match_table = of_match_ptr(mt7621_pci_phy_ids), | |
| 344 | + .of_match_table = mt7621_pci_phy_ids, | |
| 345 | 345 | }, |
| 346 | 346 | }; |
| 347 | 347 | |
| @@ -1212,6 +1212,7 @@ static int wiz_probe(struct platform_device *pdev) · 1211 unmodified lines | ||
| 1212 | 1212 | |
| 1213 | 1213 | if (wiz->typec_dir_delay < WIZ_TYPEC_DIR_DEBOUNCE_MIN || |
| 1214 | 1214 | wiz->typec_dir_delay > WIZ_TYPEC_DIR_DEBOUNCE_MAX) { |
| 1215 | + ret = -EINVAL; | |
| 1215 | 1216 | dev_err(dev, "Invalid typec-dir-debounce property\n"); |
| 1216 | 1217 | goto err_addr_to_resource; |
| 1217 | 1218 | } |
| @@ -2702,8 +2702,8 @@ static int aspeed_g5_sig_expr_eval(struct aspeed_pinmux_data *ctx, · 2701 unmodified lines | ||
| 2702 | 2702 | } |
| 2703 | 2703 | |
| 2704 | 2704 | /** |
| 2705 | − * Configure a pin's signal by applying an expression's descriptor state for | |
| 2706 | − * all descriptors in the expression. | |
| 2705 | + * aspeed_g5_sig_expr_set() - Configure a pin's signal by applying an | |
| 2706 | + * expression's descriptor state for all descriptors in the expression. | |
| 2707 | 2707 | * |
| 2708 | 2708 | * @ctx: The pinmux context |
| 2709 | 2709 | * @expr: The expression associated with the function whose signal is to be |
| @@ -2611,8 +2611,8 @@ static struct aspeed_pin_config aspeed_g6_configs[] = { · 2610 unmodified lines | ||
| 2611 | 2611 | }; |
| 2612 | 2612 | |
| 2613 | 2613 | /** |
| 2614 | − * Configure a pin's signal by applying an expression's descriptor state for | |
| 2615 | − * all descriptors in the expression. | |
| 2614 | + * aspeed_g6_sig_expr_set() - Configure a pin's signal by applying an | |
| 2615 | + * expression's descriptor state for all descriptors in the expression. | |
| 2616 | 2616 | * |
| 2617 | 2617 | * @ctx: The pinmux context |
| 2618 | 2618 | * @expr: The expression associated with the function whose signal is to be |
| @@ -108,7 +108,8 @@ static int aspeed_sig_expr_disable(struct aspeed_pinmux_data *ctx, · 107 unmodified lines | ||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | − * Disable a signal on a pin by disabling all provided signal expressions. | |
| 111 | + * aspeed_disable_sig() - Disable a signal on a pin by disabling all provided | |
| 112 | + * signal expressions. | |
| 112 | 113 | * |
| 113 | 114 | * @ctx: The pinmux context |
| 114 | 115 | * @exprs: The list of signal expressions (from a priority level on a pin) |
| @@ -21,7 +21,8 @@ static inline void aspeed_sig_desc_print_val( · 20 unmodified lines | ||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | − * Query the enabled or disabled state of a signal descriptor | |
| 24 | + * aspeed_sig_desc_eval() - Query the enabled or disabled state of a signal | |
| 25 | + * descriptor. | |
| 25 | 26 | * |
| 26 | 27 | * @desc: The signal descriptor of interest |
| 27 | 28 | * @enabled: True to query the enabled state, false to query disabled state |
| @@ -223,7 +223,7 @@ config PINCTRL_SC7280 · 222 unmodified lines | ||
| 223 | 223 | config PINCTRL_SC8180X |
| 224 | 224 | tristate "Qualcomm Technologies Inc SC8180x pin controller driver" |
| 225 | 225 | depends on GPIOLIB && (OF || ACPI) |
| 226 | − select PINCTRL_MSM | |
| 226 | + depends on PINCTRL_MSM | |
| 227 | 227 | help |
| 228 | 228 | This is the pinctrl, pinmux, pinconf and gpiolib driver for the |
| 229 | 229 | Qualcomm Technologies Inc TLMM block found on the Qualcomm |
| @@ -410,15 +410,15 @@ static const char * const gpio_groups[] = { · 409 unmodified lines | ||
| 410 | 410 | "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35", |
| 411 | 411 | "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42", |
| 412 | 412 | "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49", |
| 413 | − "gpio50", "gpio51", "gpio52", "gpio52", "gpio53", "gpio53", "gpio54", | |
| 414 | − "gpio55", "gpio56", "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", | |
| 415 | − "gpio62", "gpio63", "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", | |
| 416 | − "gpio69", "gpio70", "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", | |
| 417 | − "gpio76", "gpio77", "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", | |
| 418 | − "gpio83", "gpio84", "gpio85", "gpio86", "gpio87", "gpio88", "gpio89", | |
| 419 | − "gpio90", "gpio91", "gpio92", "gpio93", "gpio94", "gpio95", "gpio96", | |
| 420 | − "gpio97", "gpio98", "gpio99", "gpio100", "gpio101", "gpio102", | |
| 421 | − "gpio103", "gpio104", "gpio105", "gpio106", "gpio107", | |
| 413 | + "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56", | |
| 414 | + "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63", | |
| 415 | + "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70", | |
| 416 | + "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77", | |
| 417 | + "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84", | |
| 418 | + "gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91", | |
| 419 | + "gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98", | |
| 420 | + "gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104", | |
| 421 | + "gpio105", "gpio106", "gpio107", | |
| 422 | 422 | }; |
| 423 | 423 | |
| 424 | 424 | static const char * const qdss_stm_groups[] = { |
| @@ -127,7 +127,7 @@ static int rt2880_pmx_group_enable(struct pinctrl_dev *pctrldev, · 126 unmodified lines | ||
| 127 | 127 | if (p->groups[group].enabled) { |
| 128 | 128 | dev_err(p->dev, "%s is already enabled\n", |
| 129 | 129 | p->groups[group].name); |
| 130 | − return -EBUSY; | |
| 130 | + return 0; | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | p->groups[group].enabled = 1; |
| @@ -683,13 +683,13 @@ static int mlxreg_hotplug_probe(struct platform_device *pdev) · 682 unmodified lines | ||
| 683 | 683 | |
| 684 | 684 | err = devm_request_irq(&pdev->dev, priv->irq, |
| 685 | 685 | mlxreg_hotplug_irq_handler, IRQF_TRIGGER_FALLING |
| 686 | − | IRQF_SHARED | IRQF_NO_AUTOEN, | |
| 687 | − "mlxreg-hotplug", priv); | |
| 686 | + | IRQF_SHARED, "mlxreg-hotplug", priv); | |
| 688 | 687 | if (err) { |
| 689 | 688 | dev_err(&pdev->dev, "Failed to request irq: %d\n", err); |
| 690 | 689 | return err; |
| 691 | 690 | } |
| 692 | 691 | |
| 692 | + disable_irq(priv->irq); | |
| 693 | 693 | spin_lock_init(&priv->lock); |
| 694 | 694 | INIT_DELAYED_WORK(&priv->dwork_irq, mlxreg_hotplug_work_handler); |
| 695 | 695 | dev_set_drvdata(&pdev->dev, priv); |
| @@ -1907,7 +1907,7 @@ static int ssam_ssh_event_disable(struct ssam_controller *ctrl, · 1906 unmodified lines | ||
| 1907 | 1907 | { |
| 1908 | 1908 | int status; |
| 1909 | 1909 | |
| 1910 | − status = __ssam_ssh_event_request(ctrl, reg, reg.cid_enable, id, flags); | |
| 1910 | + status = __ssam_ssh_event_request(ctrl, reg, reg.cid_disable, id, flags); | |
| 1911 | 1911 | |
| 1912 | 1912 | if (status < 0 && status != -EINVAL) { |
| 1913 | 1913 | ssam_err(ctrl, |
| @@ -156,7 +156,7 @@ static const struct software_node *ssam_node_group_sl2[] = { · 155 unmodified lines | ||
| 156 | 156 | NULL, |
| 157 | 157 | }; |
| 158 | 158 | |
| 159 | −/* Devices for Surface Laptop 3. */ | |
| 159 | +/* Devices for Surface Laptop 3 and 4. */ | |
| 160 | 160 | static const struct software_node *ssam_node_group_sl3[] = { |
| 161 | 161 | &ssam_node_root, |
| 162 | 162 | &ssam_node_bat_ac, |
| @@ -521,9 +521,12 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { · 358 unmodified lines | ||
| 521 | 521 | /* Surface Laptop 3 (13", Intel) */ |
| 522 | 522 | { "MSHW0114", (unsigned long)ssam_node_group_sl3 }, |
| 523 | 523 | |
| 524 | − /* Surface Laptop 3 (15", AMD) */ | |
| 524 | + /* Surface Laptop 3 (15", AMD) and 4 (15", AMD) */ | |
| 525 | 525 | { "MSHW0110", (unsigned long)ssam_node_group_sl3 }, |
| 526 | 526 | |
| 527 | + /* Surface Laptop 4 (13", Intel) */ | |
| 528 | + { "MSHW0250", (unsigned long)ssam_node_group_sl3 }, | |
| 529 | + | |
| 527 | 530 | /* Surface Laptop Go 1 */ |
| 528 | 531 | { "MSHW0118", (unsigned long)ssam_node_group_slg1 }, |
| 529 | 532 | |
| @@ -427,6 +427,7 @@ static int surface_dtx_open(struct inode *inode, struct file *file) · 426 unmodified lines | ||
| 427 | 427 | */ |
| 428 | 428 | if (test_bit(SDTX_DEVICE_SHUTDOWN_BIT, &ddev->flags)) { |
| 429 | 429 | up_write(&ddev->client_lock); |
| 430 | + mutex_destroy(&client->read_lock); | |
| 430 | 431 | sdtx_device_put(client->ddev); |
| 431 | 432 | kfree(client); |
| 432 | 433 | return -ENODEV; |
| @@ -8853,6 +8853,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 8852 unmodified lines | ||
| 8853 | 8853 | TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd gen) */ |
| 8854 | 8854 | TPACPI_Q_LNV3('N', '2', 'V', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (3nd gen) */ |
| 8855 | 8855 | TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */ |
| 8856 | + TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */ | |
| 8856 | 8857 | }; |
| 8857 | 8858 | |
| 8858 | 8859 | static int __init fan_init(struct ibm_init_struct *iibm) |
| @@ -63,7 +63,7 @@ static void enqueue_external_timestamp(struct timestamp_event_queue *queue, · 62 unmodified lines | ||
| 63 | 63 | spin_unlock_irqrestore(&queue->lock, flags); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | −s32 scaled_ppm_to_ppb(long ppm) | |
| 66 | +long scaled_ppm_to_ppb(long ppm) | |
| 67 | 67 | { |
| 68 | 68 | /* |
| 69 | 69 | * The 'freq' field in the 'struct timex' is in parts per |
| @@ -80,7 +80,7 @@ s32 scaled_ppm_to_ppb(long ppm) · 10 unmodified lines | ||
| 80 | 80 | s64 ppb = 1 + ppm; |
| 81 | 81 | ppb *= 125; |
| 82 | 82 | ppb >>= 13; |
| 83 | − return (s32) ppb; | |
| 83 | + return (long) ppb; | |
| 84 | 84 | } |
| 85 | 85 | EXPORT_SYMBOL(scaled_ppm_to_ppb); |
| 86 | 86 | |
| @@ -138,7 +138,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) · 51 unmodified lines | ||
| 138 | 138 | delta = ktime_to_ns(kt); |
| 139 | 139 | err = ops->adjtime(ops, delta); |
| 140 | 140 | } else if (tx->modes & ADJ_FREQUENCY) { |
| 141 | − s32 ppb = scaled_ppm_to_ppb(tx->freq); | |
| 141 | + long ppb = scaled_ppm_to_ppb(tx->freq); | |
| 142 | 142 | if (ppb > ops->max_adj || ppb < -ops->max_adj) |
| 143 | 143 | return -ERANGE; |
| 144 | 144 | if (ops->adjfine) |
| @@ -324,7 +324,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 323 unmodified lines | ||
| 324 | 324 | if (!bp->base) { |
| 325 | 325 | dev_err(&pdev->dev, "io_remap bar0\n"); |
| 326 | 326 | err = -ENOMEM; |
| 327 | − goto out; | |
| 327 | + goto out_release_regions; | |
| 328 | 328 | } |
| 329 | 329 | bp->reg = bp->base + OCP_REGISTER_OFFSET; |
| 330 | 330 | bp->tod = bp->base + TOD_REGISTER_OFFSET; |
| @@ -347,6 +347,8 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 16 unmodified lines | ||
| 347 | 347 | return 0; |
| 348 | 348 | |
| 349 | 349 | out: |
| 350 | + pci_iounmap(pdev, bp->base); | |
| 351 | +out_release_regions: | |
| 350 | 352 | pci_release_regions(pdev); |
| 351 | 353 | out_disable: |
| 352 | 354 | pci_disable_device(pdev); |
| @@ -1031,7 +1031,7 @@ config REGULATOR_RT5033 · 1030 unmodified lines | ||
| 1031 | 1031 | current source, LDO and Buck. |
| 1032 | 1032 | |
| 1033 | 1033 | config REGULATOR_RTMV20 |
| 1034 | − tristate "RTMV20 Laser Diode Regulator" | |
| 1034 | + tristate "Richtek RTMV20 Laser Diode Regulator" | |
| 1035 | 1035 | depends on I2C |
| 1036 | 1036 | select REGMAP_I2C |
| 1037 | 1037 | help |
| @@ -28,16 +28,16 @@ static const struct linear_range atc2609a_dcdc_voltage_ranges[] = { · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | static const struct linear_range atc2609a_ldo_voltage_ranges0[] = { |
| 30 | 30 | REGULATOR_LINEAR_RANGE(700000, 0, 15, 100000), |
| 31 | − REGULATOR_LINEAR_RANGE(2100000, 16, 28, 100000), | |
| 31 | + REGULATOR_LINEAR_RANGE(2100000, 0, 12, 100000), | |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | static const struct linear_range atc2609a_ldo_voltage_ranges1[] = { |
| 35 | 35 | REGULATOR_LINEAR_RANGE(850000, 0, 15, 100000), |
| 36 | − REGULATOR_LINEAR_RANGE(2100000, 16, 27, 100000), | |
| 36 | + REGULATOR_LINEAR_RANGE(2100000, 0, 11, 100000), | |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | 39 | static const unsigned int atc260x_ldo_voltage_range_sel[] = { |
| 40 | − 0x0, 0x1, | |
| 40 | + 0x0, 0x20, | |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | 43 | static int atc260x_dcdc_set_voltage_time_sel(struct regulator_dev *rdev, |
| @@ -411,7 +411,7 @@ enum atc2609a_reg_ids { · 367 unmodified lines | ||
| 411 | 411 | .owner = THIS_MODULE, \ |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | −#define atc2609a_reg_desc_ldo_range_pick(num, n_range) { \ | |
| 414 | +#define atc2609a_reg_desc_ldo_range_pick(num, n_range, n_volt) { \ | |
| 415 | 415 | .name = "LDO"#num, \ |
| 416 | 416 | .supply_name = "ldo"#num, \ |
| 417 | 417 | .of_match = of_match_ptr("ldo"#num), \ |
| @@ -421,6 +421,7 @@ enum atc2609a_reg_ids { · 3 unmodified lines | ||
| 421 | 421 | .type = REGULATOR_VOLTAGE, \ |
| 422 | 422 | .linear_ranges = atc2609a_ldo_voltage_ranges##n_range, \ |
| 423 | 423 | .n_linear_ranges = ARRAY_SIZE(atc2609a_ldo_voltage_ranges##n_range), \ |
| 424 | + .n_voltages = n_volt, \ | |
| 424 | 425 | .vsel_reg = ATC2609A_PMU_LDO##num##_CTL0, \ |
| 425 | 426 | .vsel_mask = GENMASK(4, 1), \ |
| 426 | 427 | .vsel_range_reg = ATC2609A_PMU_LDO##num##_CTL0, \ |
| @@ -458,12 +459,12 @@ static const struct regulator_desc atc2609a_reg[] = { · 31 unmodified lines | ||
| 458 | 459 | atc2609a_reg_desc_ldo_bypass(0), |
| 459 | 460 | atc2609a_reg_desc_ldo_bypass(1), |
| 460 | 461 | atc2609a_reg_desc_ldo_bypass(2), |
| 461 | − atc2609a_reg_desc_ldo_range_pick(3, 0), | |
| 462 | − atc2609a_reg_desc_ldo_range_pick(4, 0), | |
| 462 | + atc2609a_reg_desc_ldo_range_pick(3, 0, 29), | |
| 463 | + atc2609a_reg_desc_ldo_range_pick(4, 0, 29), | |
| 463 | 464 | atc2609a_reg_desc_ldo(5), |
| 464 | − atc2609a_reg_desc_ldo_range_pick(6, 1), | |
| 465 | − atc2609a_reg_desc_ldo_range_pick(7, 0), | |
| 466 | − atc2609a_reg_desc_ldo_range_pick(8, 0), | |
| 465 | + atc2609a_reg_desc_ldo_range_pick(6, 1, 28), | |
| 466 | + atc2609a_reg_desc_ldo_range_pick(7, 0, 29), | |
| 467 | + atc2609a_reg_desc_ldo_range_pick(8, 0, 29), | |
| 467 | 468 | atc2609a_reg_desc_ldo_fixed(9), |
| 468 | 469 | }; |
| 469 | 470 | |
| @@ -334,7 +334,7 @@ BD718XX_OPS(bd71837_buck_regulator_ops, regulator_list_voltage_linear_range, · 333 unmodified lines | ||
| 334 | 334 | NULL); |
| 335 | 335 | |
| 336 | 336 | BD718XX_OPS(bd71837_buck_regulator_nolinear_ops, regulator_list_voltage_table, |
| 337 | − regulator_map_voltage_ascend, bd718xx_set_voltage_sel_restricted, | |
| 337 | + regulator_map_voltage_ascend, bd71837_set_voltage_sel_restricted, | |
| 338 | 338 | regulator_get_voltage_sel_regmap, regulator_set_voltage_time_sel, |
| 339 | 339 | NULL); |
| 340 | 340 | /* |
| @@ -1425,6 +1425,12 @@ static int set_machine_constraints(struct regulator_dev *rdev) · 1424 unmodified lines | ||
| 1425 | 1425 | * and we have control then make sure it is enabled. |
| 1426 | 1426 | */ |
| 1427 | 1427 | if (rdev->constraints->always_on || rdev->constraints->boot_on) { |
| 1428 | + /* If we want to enable this regulator, make sure that we know | |
| 1429 | + * the supplying regulator. | |
| 1430 | + */ | |
| 1431 | + if (rdev->supply_name && !rdev->supply) | |
| 1432 | + return -EPROBE_DEFER; | |
| 1433 | + | |
| 1428 | 1434 | if (rdev->supply) { |
| 1429 | 1435 | ret = regulator_enable(rdev->supply); |
| 1430 | 1436 | if (ret < 0) { |
| @@ -225,8 +225,9 @@ static int cros_ec_regulator_probe(struct platform_device *pdev) · 224 unmodified lines | ||
| 225 | 225 | |
| 226 | 226 | drvdata->dev = devm_regulator_register(dev, &drvdata->desc, &cfg); |
| 227 | 227 | if (IS_ERR(drvdata->dev)) { |
| 228 | + ret = PTR_ERR(drvdata->dev); | |
| 228 | 229 | dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); |
| 229 | − return PTR_ERR(drvdata->dev); | |
| 230 | + return ret; | |
| 230 | 231 | } |
| 231 | 232 | |
| 232 | 233 | platform_set_drvdata(pdev, drvdata); |
| @@ -280,7 +280,7 @@ static unsigned int da9121_map_mode(unsigned int mode) · 279 unmodified lines | ||
| 280 | 280 | case DA9121_BUCK_MODE_FORCE_PFM: |
| 281 | 281 | return REGULATOR_MODE_STANDBY; |
| 282 | 282 | default: |
| 283 | − return -EINVAL; | |
| 283 | + return REGULATOR_MODE_INVALID; | |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
| @@ -317,7 +317,7 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev) · 30 unmodified lines | ||
| 317 | 317 | { |
| 318 | 318 | struct da9121 *chip = rdev_get_drvdata(rdev); |
| 319 | 319 | int id = rdev_get_id(rdev); |
| 320 | − unsigned int val; | |
| 320 | + unsigned int val, mode; | |
| 321 | 321 | int ret = 0; |
| 322 | 322 | |
| 323 | 323 | ret = regmap_read(chip->regmap, da9121_mode_field[id].reg, &val); |
| @@ -326,7 +326,11 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev) · 2 unmodified lines | ||
| 326 | 326 | return -EINVAL; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | − return da9121_map_mode(val & da9121_mode_field[id].msk); | |
| 329 | + mode = da9121_map_mode(val & da9121_mode_field[id].msk); | |
| 330 | + if (mode == REGULATOR_MODE_INVALID) | |
| 331 | + return -EINVAL; | |
| 332 | + | |
| 333 | + return mode; | |
| 330 | 334 | } |
| 331 | 335 | |
| 332 | 336 | static const struct regulator_ops da9121_buck_ops = { |
| @@ -55,7 +55,6 @@ · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | #define FAN53555_NVOLTAGES 64 /* Numbers of voltages */ |
| 57 | 57 | #define FAN53526_NVOLTAGES 128 |
| 58 | −#define TCS4525_NVOLTAGES 127 /* Numbers of voltages */ | |
| 59 | 58 | |
| 60 | 59 | #define TCS_VSEL_NSEL_MASK 0x7f |
| 61 | 60 | #define TCS_VSEL0_MODE (1 << 7) |
| @@ -376,7 +375,7 @@ static int fan53555_voltages_setup_tcs(struct fan53555_device_info *di) · 314 unmodified lines | ||
| 376 | 375 | /* Init voltage range and step */ |
| 377 | 376 | di->vsel_min = 600000; |
| 378 | 377 | di->vsel_step = 6250; |
| 379 | − di->vsel_count = TCS4525_NVOLTAGES; | |
| 378 | + di->vsel_count = FAN53526_NVOLTAGES; | |
| 380 | 379 | |
| 381 | 380 | return 0; |
| 382 | 381 | } |
| @@ -51,6 +51,7 @@ static const struct regulator_ops fan53880_ops = { · 50 unmodified lines | ||
| 51 | 51 | REGULATOR_LINEAR_RANGE(800000, 0xf, 0x73, 25000), \ |
| 52 | 52 | }, \ |
| 53 | 53 | .n_linear_ranges = 2, \ |
| 54 | + .n_voltages = 0x74, \ | |
| 54 | 55 | .vsel_reg = FAN53880_LDO ## _num ## VOUT, \ |
| 55 | 56 | .vsel_mask = 0x7f, \ |
| 56 | 57 | .enable_reg = FAN53880_ENABLE, \ |
| @@ -76,6 +77,7 @@ static const struct regulator_desc fan53880_regulators[] = { · 19 unmodified lines | ||
| 76 | 77 | REGULATOR_LINEAR_RANGE(600000, 0x1f, 0xf7, 12500), |
| 77 | 78 | }, |
| 78 | 79 | .n_linear_ranges = 2, |
| 80 | + .n_voltages = 0xf8, | |
| 79 | 81 | .vsel_reg = FAN53880_BUCKVOUT, |
| 80 | 82 | .vsel_mask = 0x7f, |
| 81 | 83 | .enable_reg = FAN53880_ENABLE, |
| @@ -95,6 +97,7 @@ static const struct regulator_desc fan53880_regulators[] = { · 13 unmodified lines | ||
| 95 | 97 | REGULATOR_LINEAR_RANGE(3000000, 0x4, 0x70, 25000), |
| 96 | 98 | }, |
| 97 | 99 | .n_linear_ranges = 2, |
| 100 | + .n_voltages = 0x71, | |
| 98 | 101 | .vsel_reg = FAN53880_BOOSTVOUT, |
| 99 | 102 | .vsel_mask = 0x7f, |
| 100 | 103 | .enable_reg = FAN53880_ENABLE_BOOST, |
| @@ -88,10 +88,15 @@ static int reg_domain_disable(struct regulator_dev *rdev) · 87 unmodified lines | ||
| 88 | 88 | { |
| 89 | 89 | struct fixed_voltage_data *priv = rdev_get_drvdata(rdev); |
| 90 | 90 | struct device *dev = rdev->dev.parent; |
| 91 | + int ret; | |
| 92 | + | |
| 93 | + ret = dev_pm_genpd_set_performance_state(dev, 0); | |
| 94 | + if (ret) | |
| 95 | + return ret; | |
| 91 | 96 | |
| 92 | 97 | priv->enable_counter--; |
| 93 | 98 | |
| 94 | − return dev_pm_genpd_set_performance_state(dev, 0); | |
| 99 | + return 0; | |
| 95 | 100 | } |
| 96 | 101 | |
| 97 | 102 | static int reg_is_enabled(struct regulator_dev *rdev) |
| @@ -948,7 +948,7 @@ int regulator_set_ramp_delay_regmap(struct regulator_dev *rdev, int ramp_delay) · 947 unmodified lines | ||
| 948 | 948 | int ret; |
| 949 | 949 | unsigned int sel; |
| 950 | 950 | |
| 951 | − if (!rdev->desc->n_ramp_values) | |
| 951 | + if (WARN_ON(!rdev->desc->n_ramp_values || !rdev->desc->ramp_delay_table)) | |
| 952 | 952 | return -EINVAL; |
| 953 | 953 | |
| 954 | 954 | ret = find_closest_bigger(ramp_delay, rdev->desc->ramp_delay_table, |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | // Device driver for regulators in Hisi IC |
| 4 | 4 | // |
| 5 | 5 | // Copyright (c) 2013 Linaro Ltd. |
| 6 | −// Copyright (c) 2011 Hisilicon. | |
| 6 | +// Copyright (c) 2011 HiSilicon Ltd. | |
| 7 | 7 | // Copyright (c) 2020-2021 Huawei Technologies Co., Ltd |
| 8 | 8 | // |
| 9 | 9 | // Guodong Xu <guodong.xu@linaro.org> |
| @@ -83,7 +83,7 @@ static const unsigned int ldo34_voltages[] = { · 73 unmodified lines | ||
| 83 | 83 | .owner = THIS_MODULE, \ |
| 84 | 84 | .volt_table = vtable, \ |
| 85 | 85 | .n_voltages = ARRAY_SIZE(vtable), \ |
| 86 | − .vsel_mask = (1 << (ARRAY_SIZE(vtable) - 1)) - 1, \ | |
| 86 | + .vsel_mask = ARRAY_SIZE(vtable) - 1, \ | |
| 87 | 87 | .vsel_reg = vreg, \ |
| 88 | 88 | .enable_reg = ereg, \ |
| 89 | 89 | .enable_mask = emask, \ |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | // |
| 3 | 3 | // Device driver for regulators in Hi655x IC |
| 4 | 4 | // |
| 5 | −// Copyright (c) 2016 Hisilicon. | |
| 5 | +// Copyright (c) 2016 HiSilicon Ltd. | |
| 6 | 6 | // |
| 7 | 7 | // Authors: |
| 8 | 8 | // Chen Feng <puck.chen@hisilicon.com> |
| @@ -814,6 +814,13 @@ static int max77620_regulator_probe(struct platform_device *pdev) · 813 unmodified lines | ||
| 814 | 814 | config.dev = dev; |
| 815 | 815 | config.driver_data = pmic; |
| 816 | 816 | |
| 817 | + /* | |
| 818 | + * Set of_node_reuse flag to prevent driver core from attempting to | |
| 819 | + * claim any pinmux resources already claimed by the parent device. | |
| 820 | + * Otherwise PMIC driver will fail to re-probe. | |
| 821 | + */ | |
| 822 | + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); | |
| 823 | + | |
| 817 | 824 | for (id = 0; id < MAX77620_NUM_REGS; id++) { |
| 818 | 825 | struct regulator_dev *rdev; |
| 819 | 826 | struct regulator_desc *rdesc; |
| @@ -839,12 +846,10 @@ static int max77620_regulator_probe(struct platform_device *pdev) · 19 unmodified lines | ||
| 839 | 846 | return ret; |
| 840 | 847 | |
| 841 | 848 | rdev = devm_regulator_register(dev, rdesc, &config); |
| 842 | − if (IS_ERR(rdev)) { | |
| 843 | − ret = PTR_ERR(rdev); | |
| 844 | − dev_err(dev, "Regulator registration %s failed: %d\n", | |
| 845 | − rdesc->name, ret); | |
| 846 | − return ret; | |
| 847 | − } | |
| 849 | + if (IS_ERR(rdev)) | |
| 850 | + return dev_err_probe(dev, PTR_ERR(rdev), | |
| 851 | + "Regulator registration %s failed\n", | |
| 852 | + rdesc->name); | |
| 848 | 853 | } |
| 849 | 854 | |
| 850 | 855 | return 0; |
| @@ -59,7 +59,7 @@ static const struct linear_range mt_volt_range1[] = { · 58 unmodified lines | ||
| 59 | 59 | REGULATOR_LINEAR_RANGE(0, 0, 0xbf, 6250), |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | −static unsigned int mt6315_map_mode(u32 mode) | |
| 62 | +static unsigned int mt6315_map_mode(unsigned int mode) | |
| 63 | 63 | { |
| 64 | 64 | switch (mode) { |
| 65 | 65 | case MT6315_BUCK_MODE_AUTO: |
| @@ -66,7 +66,7 @@ static int rt4801_enable(struct regulator_dev *rdev) · 65 unmodified lines | ||
| 66 | 66 | struct gpio_descs *gpios = priv->enable_gpios; |
| 67 | 67 | int id = rdev_get_id(rdev), ret; |
| 68 | 68 | |
| 69 | − if (gpios->ndescs <= id) { | |
| 69 | + if (!gpios || gpios->ndescs <= id) { | |
| 70 | 70 | dev_warn(&rdev->dev, "no dedicated gpio can control\n"); |
| 71 | 71 | goto bypass_gpio; |
| 72 | 72 | } |
| @@ -88,7 +88,7 @@ static int rt4801_disable(struct regulator_dev *rdev) · 15 unmodified lines | ||
| 88 | 88 | struct gpio_descs *gpios = priv->enable_gpios; |
| 89 | 89 | int id = rdev_get_id(rdev); |
| 90 | 90 | |
| 91 | − if (gpios->ndescs <= id) { | |
| 91 | + if (!gpios || gpios->ndescs <= id) { | |
| 92 | 92 | dev_warn(&rdev->dev, "no dedicated gpio can control\n"); |
| 93 | 93 | goto bypass_gpio; |
| 94 | 94 | } |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #define RTMV20_REG_LDIRQ 0x30 |
| 28 | 28 | #define RTMV20_REG_LDSTAT 0x40 |
| 29 | 29 | #define RTMV20_REG_LDMASK 0x50 |
| 30 | +#define RTMV20_MAX_REGS (RTMV20_REG_LDMASK + 1) | |
| 30 | 31 | |
| 31 | 32 | #define RTMV20_VID_MASK GENMASK(7, 4) |
| 32 | 33 | #define RICHTEK_VID 0x80 |
| @@ -103,9 +104,47 @@ static int rtmv20_lsw_disable(struct regulator_dev *rdev) · 70 unmodified lines | ||
| 103 | 104 | return 0; |
| 104 | 105 | } |
| 105 | 106 | |
| 107 | +static int rtmv20_lsw_set_current_limit(struct regulator_dev *rdev, int min_uA, | |
| 108 | + int max_uA) | |
| 109 | +{ | |
| 110 | + int sel; | |
| 111 | + | |
| 112 | + if (min_uA > RTMV20_LSW_MAXUA || max_uA < RTMV20_LSW_MINUA) | |
| 113 | + return -EINVAL; | |
| 114 | + | |
| 115 | + if (max_uA > RTMV20_LSW_MAXUA) | |
| 116 | + max_uA = RTMV20_LSW_MAXUA; | |
| 117 | + | |
| 118 | + sel = (max_uA - RTMV20_LSW_MINUA) / RTMV20_LSW_STEPUA; | |
| 119 | + | |
| 120 | + /* Ensure the selected setting is still in range */ | |
| 121 | + if ((sel * RTMV20_LSW_STEPUA + RTMV20_LSW_MINUA) < min_uA) | |
| 122 | + return -EINVAL; | |
| 123 | + | |
| 124 | + sel <<= ffs(rdev->desc->csel_mask) - 1; | |
| 125 | + | |
| 126 | + return regmap_update_bits(rdev->regmap, rdev->desc->csel_reg, | |
| 127 | + rdev->desc->csel_mask, sel); | |
| 128 | +} | |
| 129 | + | |
| 130 | +static int rtmv20_lsw_get_current_limit(struct regulator_dev *rdev) | |
| 131 | +{ | |
| 132 | + unsigned int val; | |
| 133 | + int ret; | |
| 134 | + | |
| 135 | + ret = regmap_read(rdev->regmap, rdev->desc->csel_reg, &val); | |
| 136 | + if (ret) | |
| 137 | + return ret; | |
| 138 | + | |
| 139 | + val &= rdev->desc->csel_mask; | |
| 140 | + val >>= ffs(rdev->desc->csel_mask) - 1; | |
| 141 | + | |
| 142 | + return val * RTMV20_LSW_STEPUA + RTMV20_LSW_MINUA; | |
| 143 | +} | |
| 144 | + | |
| 106 | 145 | static const struct regulator_ops rtmv20_regulator_ops = { |
| 107 | − .set_current_limit = regulator_set_current_limit_regmap, | |
| 108 | − .get_current_limit = regulator_get_current_limit_regmap, | |
| 146 | + .set_current_limit = rtmv20_lsw_set_current_limit, | |
| 147 | + .get_current_limit = rtmv20_lsw_get_current_limit, | |
| 109 | 148 | .enable = rtmv20_lsw_enable, |
| 110 | 149 | .disable = rtmv20_lsw_disable, |
| 111 | 150 | .is_enabled = regulator_is_enabled_regmap, |
| @@ -275,6 +314,7 @@ static const struct regmap_config rtmv20_regmap_config = { · 163 unmodified lines | ||
| 275 | 314 | .val_bits = 8, |
| 276 | 315 | .cache_type = REGCACHE_RBTREE, |
| 277 | 316 | .max_register = RTMV20_REG_LDMASK, |
| 317 | + .num_reg_defaults_raw = RTMV20_MAX_REGS, | |
| 278 | 318 | |
| 279 | 319 | .writeable_reg = rtmv20_is_accessible_reg, |
| 280 | 320 | .readable_reg = rtmv20_is_accessible_reg, |
| @@ -173,7 +173,7 @@ scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg, · 172 unmodified lines | ||
| 173 | 173 | sreg->desc.uV_step = |
| 174 | 174 | vinfo->levels_uv[SCMI_VOLTAGE_SEGMENT_STEP]; |
| 175 | 175 | sreg->desc.linear_min_sel = 0; |
| 176 | − sreg->desc.n_voltages = delta_uV / sreg->desc.uV_step; | |
| 176 | + sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1; | |
| 177 | 177 | sreg->desc.ops = &scmi_reg_linear_ops; |
| 178 | 178 | } |
| 179 | 179 | |
| @@ -642,12 +642,18 @@ static void dasd_diag_setup_blk_queue(struct dasd_block *block) · 641 unmodified lines | ||
| 642 | 642 | blk_queue_segment_boundary(q, PAGE_SIZE - 1); |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | +static int dasd_diag_pe_handler(struct dasd_device *device, | |
| 646 | + __u8 tbvpm, __u8 fcsecpm) | |
| 647 | +{ | |
| 648 | + return dasd_generic_verify_path(device, tbvpm); | |
| 649 | +} | |
| 650 | + | |
| 645 | 651 | static struct dasd_discipline dasd_diag_discipline = { |
| 646 | 652 | .owner = THIS_MODULE, |
| 647 | 653 | .name = "DIAG", |
| 648 | 654 | .ebcname = "DIAG", |
| 649 | 655 | .check_device = dasd_diag_check_device, |
| 650 | − .verify_path = dasd_generic_verify_path, | |
| 656 | + .pe_handler = dasd_diag_pe_handler, | |
| 651 | 657 | .fill_geometry = dasd_diag_fill_geometry, |
| 652 | 658 | .setup_blk_queue = dasd_diag_setup_blk_queue, |
| 653 | 659 | .start_IO = dasd_start_diag, |
| @@ -794,13 +794,19 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block) · 793 unmodified lines | ||
| 794 | 794 | blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | +static int dasd_fba_pe_handler(struct dasd_device *device, | |
| 798 | + __u8 tbvpm, __u8 fcsecpm) | |
| 799 | +{ | |
| 800 | + return dasd_generic_verify_path(device, tbvpm); | |
| 801 | +} | |
| 802 | + | |
| 797 | 803 | static struct dasd_discipline dasd_fba_discipline = { |
| 798 | 804 | .owner = THIS_MODULE, |
| 799 | 805 | .name = "FBA ", |
| 800 | 806 | .ebcname = "FBA ", |
| 801 | 807 | .check_device = dasd_fba_check_characteristics, |
| 802 | 808 | .do_analysis = dasd_fba_do_analysis, |
| 803 | − .verify_path = dasd_generic_verify_path, | |
| 809 | + .pe_handler = dasd_fba_pe_handler, | |
| 804 | 810 | .setup_blk_queue = dasd_fba_setup_blk_queue, |
| 805 | 811 | .fill_geometry = dasd_fba_fill_geometry, |
| 806 | 812 | .start_IO = dasd_start_IO, |
| @@ -297,7 +297,6 @@ struct dasd_discipline { · 296 unmodified lines | ||
| 297 | 297 | * e.g. verify that new path is compatible with the current |
| 298 | 298 | * configuration. |
| 299 | 299 | */ |
| 300 | − int (*verify_path)(struct dasd_device *, __u8); | |
| 301 | 300 | int (*pe_handler)(struct dasd_device *, __u8, __u8); |
| 302 | 301 | |
| 303 | 302 | /* |
| @@ -638,6 +638,10 @@ int cp_init(struct channel_program *cp, struct device *mdev, union orb *orb) · 637 unmodified lines | ||
| 638 | 638 | static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 1); |
| 639 | 639 | int ret; |
| 640 | 640 | |
| 641 | + /* this is an error in the caller */ | |
| 642 | + if (cp->initialized) | |
| 643 | + return -EBUSY; | |
| 644 | + | |
| 641 | 645 | /* |
| 642 | 646 | * We only support prefetching the channel program. We assume all channel |
| 643 | 647 | * programs executed by supported guests likewise support prefetching. |
| @@ -86,6 +86,7 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) · 85 unmodified lines | ||
| 86 | 86 | struct vfio_ccw_private *private; |
| 87 | 87 | struct irb *irb; |
| 88 | 88 | bool is_final; |
| 89 | + bool cp_is_finished = false; | |
| 89 | 90 | |
| 90 | 91 | private = container_of(work, struct vfio_ccw_private, io_work); |
| 91 | 92 | irb = &private->irb; |
| @@ -94,14 +95,21 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) · 2 unmodified lines | ||
| 94 | 95 | (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)); |
| 95 | 96 | if (scsw_is_solicited(&irb->scsw)) { |
| 96 | 97 | cp_update_scsw(&private->cp, &irb->scsw); |
| 97 | − if (is_final && private->state == VFIO_CCW_STATE_CP_PENDING) | |
| 98 | + if (is_final && private->state == VFIO_CCW_STATE_CP_PENDING) { | |
| 98 | 99 | cp_free(&private->cp); |
| 100 | + cp_is_finished = true; | |
| 101 | + } | |
| 99 | 102 | } |
| 100 | 103 | mutex_lock(&private->io_mutex); |
| 101 | 104 | memcpy(private->io_region->irb_area, irb, sizeof(*irb)); |
| 102 | 105 | mutex_unlock(&private->io_mutex); |
| 103 | 106 | |
| 104 | − if (private->mdev && is_final) | |
| 107 | + /* | |
| 108 | + * Reset to IDLE only if processing of a channel program | |
| 109 | + * has finished. Do not overwrite a possible processing | |
| 110 | + * state if the final interrupt was for HSCH or CSCH. | |
| 111 | + */ | |
| 112 | + if (private->mdev && cp_is_finished) | |
| 105 | 113 | private->state = VFIO_CCW_STATE_IDLE; |
| 106 | 114 | |
| 107 | 115 | if (private->io_trigger) |
| @@ -318,6 +318,7 @@ static void fsm_io_request(struct vfio_ccw_private *private, · 317 unmodified lines | ||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | err_out: |
| 321 | + private->state = VFIO_CCW_STATE_IDLE; | |
| 321 | 322 | trace_vfio_ccw_fsm_io_request(scsw->cmd.fctl, schid, |
| 322 | 323 | io_region->ret_code, errstr); |
| 323 | 324 | } |
| @@ -279,8 +279,6 @@ static ssize_t vfio_ccw_mdev_write_io_region(struct vfio_ccw_private *private, · 278 unmodified lines | ||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_IO_REQ); |
| 282 | − if (region->ret_code != 0) | |
| 283 | − private->state = VFIO_CCW_STATE_IDLE; | |
| 284 | 282 | ret = (region->ret_code != 0) ? region->ret_code : count; |
| 285 | 283 | |
| 286 | 284 | out_unlock: |
| @@ -135,12 +135,13 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq) · 134 unmodified lines | ||
| 135 | 135 | { |
| 136 | 136 | struct ap_queue_status status; |
| 137 | 137 | struct ap_message *ap_msg; |
| 138 | + bool found = false; | |
| 138 | 139 | |
| 139 | 140 | status = ap_dqap(aq->qid, &aq->reply->psmid, |
| 140 | 141 | aq->reply->msg, aq->reply->len); |
| 141 | 142 | switch (status.response_code) { |
| 142 | 143 | case AP_RESPONSE_NORMAL: |
| 143 | − aq->queue_count--; | |
| 144 | + aq->queue_count = max_t(int, 0, aq->queue_count - 1); | |
| 144 | 145 | if (aq->queue_count > 0) |
| 145 | 146 | mod_timer(&aq->timeout, |
| 146 | 147 | jiffies + aq->request_timeout); |
| @@ -150,8 +151,14 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq) · 3 unmodified lines | ||
| 150 | 151 | list_del_init(&ap_msg->list); |
| 151 | 152 | aq->pendingq_count--; |
| 152 | 153 | ap_msg->receive(aq, ap_msg, aq->reply); |
| 154 | + found = true; | |
| 153 | 155 | break; |
| 154 | 156 | } |
| 157 | + if (!found) { | |
| 158 | + AP_DBF_WARN("%s unassociated reply psmid=0x%016llx on 0x%02x.%04x\n", | |
| 159 | + __func__, aq->reply->psmid, | |
| 160 | + AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); | |
| 161 | + } | |
| 155 | 162 | fallthrough; |
| 156 | 163 | case AP_RESPONSE_NO_PENDING_REPLY: |
| 157 | 164 | if (!status.queue_empty || aq->queue_count <= 0) |
| @@ -232,7 +239,7 @@ static enum ap_sm_wait ap_sm_write(struct ap_queue *aq) · 74 unmodified lines | ||
| 232 | 239 | ap_msg->flags & AP_MSG_FLAG_SPECIAL); |
| 233 | 240 | switch (status.response_code) { |
| 234 | 241 | case AP_RESPONSE_NORMAL: |
| 235 | − aq->queue_count++; | |
| 242 | + aq->queue_count = max_t(int, 1, aq->queue_count + 1); | |
| 236 | 243 | if (aq->queue_count == 1) |
| 237 | 244 | mod_timer(&aq->timeout, jiffies + aq->request_timeout); |
| 238 | 245 | list_move_tail(&ap_msg->list, &aq->pendingq); |
| @@ -58,7 +58,6 @@ · 57 unmodified lines | ||
| 58 | 58 | #include "aicasm_symbol.h" |
| 59 | 59 | #include "aicasm_insformat.h" |
| 60 | 60 | |
| 61 | −int yylineno; | |
| 62 | 61 | char *yyfilename; |
| 63 | 62 | char stock_prefix[] = "aic_"; |
| 64 | 63 | char *prefix = stock_prefix; |
| @@ -108,7 +108,7 @@ struct macro_arg { · 107 unmodified lines | ||
| 108 | 108 | regex_t arg_regex; |
| 109 | 109 | char *replacement_text; |
| 110 | 110 | }; |
| 111 | −STAILQ_HEAD(macro_arg_list, macro_arg) args; | |
| 111 | +STAILQ_HEAD(macro_arg_list, macro_arg); | |
| 112 | 112 | |
| 113 | 113 | struct macro_info { |
| 114 | 114 | struct macro_arg_list args; |
| @@ -3,6 +3,17 @@ · 2 unmodified lines | ||
| 3 | 3 | * $FreeBSD: src/sys/cam/scsi/scsi_message.h,v 1.2 2000/05/01 20:21:29 peter Exp $ |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +/* Messages (1 byte) */ /* I/T (M)andatory or (O)ptional */ | |
| 7 | +#define MSG_SAVEDATAPOINTER 0x02 /* O/O */ | |
| 8 | +#define MSG_RESTOREPOINTERS 0x03 /* O/O */ | |
| 9 | +#define MSG_DISCONNECT 0x04 /* O/O */ | |
| 10 | +#define MSG_MESSAGE_REJECT 0x07 /* M/M */ | |
| 11 | +#define MSG_NOOP 0x08 /* M/M */ | |
| 12 | + | |
| 13 | +/* Messages (2 byte) */ | |
| 14 | +#define MSG_SIMPLE_Q_TAG 0x20 /* O/O */ | |
| 15 | +#define MSG_IGN_WIDE_RESIDUE 0x23 /* O/O */ | |
| 16 | + | |
| 6 | 17 | /* Identify message */ /* M/M */ |
| 7 | 18 | #define MSG_IDENTIFYFLAG 0x80 |
| 8 | 19 | #define MSG_IDENTIFY_DISCFLAG 0x40 |
| @@ -1220,6 +1220,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd) · 1219 unmodified lines | ||
| 1220 | 1220 | was a result from the ABTS request rather than the CLEANUP |
| 1221 | 1221 | request */ |
| 1222 | 1222 | set_bit(BNX2FC_FLAG_IO_CLEANUP, &io_req->req_flags); |
| 1223 | + rc = FAILED; | |
| 1223 | 1224 | goto done; |
| 1224 | 1225 | } |
| 1225 | 1226 | |
| @@ -4811,14 +4811,14 @@ hisi_sas_v3_destroy_irqs(struct pci_dev *pdev, struct hisi_hba *hisi_hba) · 4810 unmodified lines | ||
| 4811 | 4811 | { |
| 4812 | 4812 | int i; |
| 4813 | 4813 | |
| 4814 | − free_irq(pci_irq_vector(pdev, 1), hisi_hba); | |
| 4815 | − free_irq(pci_irq_vector(pdev, 2), hisi_hba); | |
| 4816 | − free_irq(pci_irq_vector(pdev, 11), hisi_hba); | |
| 4814 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 1), hisi_hba); | |
| 4815 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 2), hisi_hba); | |
| 4816 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 11), hisi_hba); | |
| 4817 | 4817 | for (i = 0; i < hisi_hba->cq_nvecs; i++) { |
| 4818 | 4818 | struct hisi_sas_cq *cq = &hisi_hba->cq[i]; |
| 4819 | 4819 | int nr = hisi_sas_intr_conv ? 16 : 16 + i; |
| 4820 | 4820 | |
| 4821 | − free_irq(pci_irq_vector(pdev, nr), cq); | |
| 4821 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, nr), cq); | |
| 4822 | 4822 | } |
| 4823 | 4823 | pci_free_irq_vectors(pdev); |
| 4824 | 4824 | } |
| @@ -254,12 +254,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, · 253 unmodified lines | ||
| 254 | 254 | |
| 255 | 255 | device_enable_async_suspend(&shost->shost_dev); |
| 256 | 256 | |
| 257 | + get_device(&shost->shost_gendev); | |
| 257 | 258 | error = device_add(&shost->shost_dev); |
| 258 | 259 | if (error) |
| 259 | 260 | goto out_del_gendev; |
| 260 | 261 | |
| 261 | − get_device(&shost->shost_gendev); | |
| 262 | − | |
| 263 | 262 | if (shost->transportt->host_size) { |
| 264 | 263 | shost->shost_data = kzalloc(shost->transportt->host_size, |
| 265 | 264 | GFP_KERNEL); |
| @@ -278,33 +277,36 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, · 12 unmodified lines | ||
| 278 | 277 | |
| 279 | 278 | if (!shost->work_q) { |
| 280 | 279 | error = -EINVAL; |
| 281 | − goto out_free_shost_data; | |
| 280 | + goto out_del_dev; | |
| 282 | 281 | } |
| 283 | 282 | } |
| 284 | 283 | |
| 285 | 284 | error = scsi_sysfs_add_host(shost); |
| 286 | 285 | if (error) |
| 287 | − goto out_destroy_host; | |
| 286 | + goto out_del_dev; | |
| 288 | 287 | |
| 289 | 288 | scsi_proc_host_add(shost); |
| 290 | 289 | scsi_autopm_put_host(shost); |
| 291 | 290 | return error; |
| 292 | 291 | |
| 293 | − out_destroy_host: | |
| 294 | − if (shost->work_q) | |
| 295 | − destroy_workqueue(shost->work_q); | |
| 296 | − out_free_shost_data: | |
| 297 | − kfree(shost->shost_data); | |
| 292 | + /* | |
| 293 | + * Any host allocation in this function will be freed in | |
| 294 | + * scsi_host_dev_release(). | |
| 295 | + */ | |
| 298 | 296 | out_del_dev: |
| 299 | 297 | device_del(&shost->shost_dev); |
| 300 | 298 | out_del_gendev: |
| 299 | + /* | |
| 300 | + * Host state is SHOST_RUNNING so we have to explicitly release | |
| 301 | + * ->shost_dev. | |
| 302 | + */ | |
| 303 | + put_device(&shost->shost_dev); | |
| 301 | 304 | device_del(&shost->shost_gendev); |
| 302 | 305 | out_disable_runtime_pm: |
| 303 | 306 | device_disable_async_suspend(&shost->shost_gendev); |
| 304 | 307 | pm_runtime_disable(&shost->shost_gendev); |
| 305 | 308 | pm_runtime_set_suspended(&shost->shost_gendev); |
| 306 | 309 | pm_runtime_put_noidle(&shost->shost_gendev); |
| 307 | − scsi_mq_destroy_tags(shost); | |
| 308 | 310 | fail: |
| 309 | 311 | return error; |
| 310 | 312 | } |
| @@ -345,7 +347,7 @@ static void scsi_host_dev_release(struct device *dev) · 34 unmodified lines | ||
| 345 | 347 | |
| 346 | 348 | ida_simple_remove(&host_index_ida, shost->host_no); |
| 347 | 349 | |
| 348 | − if (parent) | |
| 350 | + if (shost->shost_state != SHOST_CREATED) | |
| 349 | 351 | put_device(parent); |
| 350 | 352 | kfree(shost); |
| 351 | 353 | } |
| @@ -388,8 +390,10 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · 36 unmodified lines | ||
| 388 | 390 | mutex_init(&shost->scan_mutex); |
| 389 | 391 | |
| 390 | 392 | index = ida_simple_get(&host_index_ida, 0, 0, GFP_KERNEL); |
| 391 | − if (index < 0) | |
| 392 | − goto fail_kfree; | |
| 393 | + if (index < 0) { | |
| 394 | + kfree(shost); | |
| 395 | + return NULL; | |
| 396 | + } | |
| 393 | 397 | shost->host_no = index; |
| 394 | 398 | |
| 395 | 399 | shost->dma_channel = 0xff; |
| @@ -481,7 +485,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · 85 unmodified lines | ||
| 481 | 485 | shost_printk(KERN_WARNING, shost, |
| 482 | 486 | "error handler thread failed to spawn, error = %ld\n", |
| 483 | 487 | PTR_ERR(shost->ehandler)); |
| 484 | − goto fail_index_remove; | |
| 488 | + goto fail; | |
| 485 | 489 | } |
| 486 | 490 | |
| 487 | 491 | shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d", |
| @@ -490,17 +494,18 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · 2 unmodified lines | ||
| 490 | 494 | if (!shost->tmf_work_q) { |
| 491 | 495 | shost_printk(KERN_WARNING, shost, |
| 492 | 496 | "failed to create tmf workq\n"); |
| 493 | − goto fail_kthread; | |
| 497 | + goto fail; | |
| 494 | 498 | } |
| 495 | 499 | scsi_proc_hostdir_add(shost->hostt); |
| 496 | 500 | return shost; |
| 501 | + fail: | |
| 502 | + /* | |
| 503 | + * Host state is still SHOST_CREATED and that is enough to release | |
| 504 | + * ->shost_gendev. scsi_host_dev_release() will free | |
| 505 | + * dev_name(&shost->shost_dev). | |
| 506 | + */ | |
| 507 | + put_device(&shost->shost_gendev); | |
| 497 | 508 | |
| 498 | − fail_kthread: | |
| 499 | − kthread_stop(shost->ehandler); | |
| 500 | − fail_index_remove: | |
| 501 | − ida_simple_remove(&host_index_ida, shost->host_no); | |
| 502 | − fail_kfree: | |
| 503 | − kfree(shost); | |
| 504 | 509 | return NULL; |
| 505 | 510 | } |
| 506 | 511 | EXPORT_SYMBOL(scsi_host_alloc); |
| @@ -25,7 +25,7 @@ static bool phy_is_wideport_member(struct asd_sas_port *port, struct asd_sas_phy · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | static void sas_resume_port(struct asd_sas_phy *phy) |
| 27 | 27 | { |
| 28 | − struct domain_device *dev; | |
| 28 | + struct domain_device *dev, *n; | |
| 29 | 29 | struct asd_sas_port *port = phy->port; |
| 30 | 30 | struct sas_ha_struct *sas_ha = phy->ha; |
| 31 | 31 | struct sas_internal *si = to_sas_internal(sas_ha->core.shost->transportt); |
| @@ -44,7 +44,7 @@ static void sas_resume_port(struct asd_sas_phy *phy) · 12 unmodified lines | ||
| 44 | 44 | * 1/ presume every device came back |
| 45 | 45 | * 2/ force the next revalidation to check all expander phys |
| 46 | 46 | */ |
| 47 | − list_for_each_entry(dev, &port->dev_list, dev_list_node) { | |
| 47 | + list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) { | |
| 48 | 48 | int i, rc; |
| 49 | 49 | |
| 50 | 50 | rc = sas_notify_lldd_dev_found(dev); |
| @@ -20589,10 +20589,8 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 20588 unmodified lines | ||
| 20589 | 20589 | abtswqe = &abtsiocb->wqe; |
| 20590 | 20590 | memset(abtswqe, 0, sizeof(*abtswqe)); |
| 20591 | 20591 | |
| 20592 | − if (lpfc_is_link_up(phba)) | |
| 20592 | + if (!lpfc_is_link_up(phba)) | |
| 20593 | 20593 | bf_set(abort_cmd_ia, &abtswqe->abort_cmd, 1); |
| 20594 | − else | |
| 20595 | − bf_set(abort_cmd_ia, &abtswqe->abort_cmd, 0); | |
| 20596 | 20594 | bf_set(abort_cmd_criteria, &abtswqe->abort_cmd, T_XRI_TAG); |
| 20597 | 20595 | abtswqe->abort_cmd.rsrvd5 = 0; |
| 20598 | 20596 | abtswqe->abort_cmd.wqe_com.abort_tag = xritag; |
| @@ -1827,22 +1827,20 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 1826 unmodified lines | ||
| 1827 | 1827 | fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf)); |
| 1828 | 1828 | QEDF_WARN(&(base_qedf->dbg_ctx), "Failed to create vport, " |
| 1829 | 1829 | "WWPN (0x%s) already exists.\n", buf); |
| 1830 | − goto err1; | |
| 1830 | + return rc; | |
| 1831 | 1831 | } |
| 1832 | 1832 | |
| 1833 | 1833 | if (atomic_read(&base_qedf->link_state) != QEDF_LINK_UP) { |
| 1834 | 1834 | QEDF_WARN(&(base_qedf->dbg_ctx), "Cannot create vport " |
| 1835 | 1835 | "because link is not up.\n"); |
| 1836 | − rc = -EIO; | |
| 1837 | − goto err1; | |
| 1836 | + return -EIO; | |
| 1838 | 1837 | } |
| 1839 | 1838 | |
| 1840 | 1839 | vn_port = libfc_vport_create(vport, sizeof(struct qedf_ctx)); |
| 1841 | 1840 | if (!vn_port) { |
| 1842 | 1841 | QEDF_WARN(&(base_qedf->dbg_ctx), "Could not create lport " |
| 1843 | 1842 | "for vport.\n"); |
| 1844 | − rc = -ENOMEM; | |
| 1845 | − goto err1; | |
| 1843 | + return -ENOMEM; | |
| 1846 | 1844 | } |
| 1847 | 1845 | |
| 1848 | 1846 | fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf)); |
| @@ -1866,7 +1864,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 17 unmodified lines | ||
| 1866 | 1864 | if (rc) { |
| 1867 | 1865 | QEDF_ERR(&(base_qedf->dbg_ctx), "Could not allocate memory " |
| 1868 | 1866 | "for lport stats.\n"); |
| 1869 | − goto err2; | |
| 1867 | + goto err; | |
| 1870 | 1868 | } |
| 1871 | 1869 | |
| 1872 | 1870 | fc_set_wwnn(vn_port, vport->node_name); |
| @@ -1884,7 +1882,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 11 unmodified lines | ||
| 1884 | 1882 | if (rc) { |
| 1885 | 1883 | QEDF_WARN(&base_qedf->dbg_ctx, |
| 1886 | 1884 | "Error adding Scsi_Host rc=0x%x.\n", rc); |
| 1887 | − goto err2; | |
| 1885 | + goto err; | |
| 1888 | 1886 | } |
| 1889 | 1887 | |
| 1890 | 1888 | /* Set default dev_loss_tmo based on module parameter */ |
| @@ -1925,9 +1923,10 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 34 unmodified lines | ||
| 1925 | 1923 | vport_qedf->dbg_ctx.host_no = vn_port->host->host_no; |
| 1926 | 1924 | vport_qedf->dbg_ctx.pdev = base_qedf->pdev; |
| 1927 | 1925 | |
| 1928 | −err2: | |
| 1926 | + return 0; | |
| 1927 | + | |
| 1928 | +err: | |
| 1929 | 1929 | scsi_host_put(vn_port->host); |
| 1930 | −err1: | |
| 1931 | 1930 | return rc; |
| 1932 | 1931 | } |
| 1933 | 1932 | |
| @@ -1968,8 +1967,7 @@ static int qedf_vport_destroy(struct fc_vport *vport) · 34 unmodified lines | ||
| 1968 | 1967 | fc_lport_free_stats(vn_port); |
| 1969 | 1968 | |
| 1970 | 1969 | /* Release Scsi_Host */ |
| 1971 | − if (vn_port->host) | |
| 1972 | − scsi_host_put(vn_port->host); | |
| 1970 | + scsi_host_put(vn_port->host); | |
| 1973 | 1971 | |
| 1974 | 1972 | out: |
| 1975 | 1973 | return 0; |
| @@ -1563,10 +1563,12 @@ void qlt_stop_phase2(struct qla_tgt *tgt) · 1562 unmodified lines | ||
| 1563 | 1563 | return; |
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | + mutex_lock(&tgt->ha->optrom_mutex); | |
| 1566 | 1567 | mutex_lock(&vha->vha_tgt.tgt_mutex); |
| 1567 | 1568 | tgt->tgt_stop = 0; |
| 1568 | 1569 | tgt->tgt_stopped = 1; |
| 1569 | 1570 | mutex_unlock(&vha->vha_tgt.tgt_mutex); |
| 1571 | + mutex_unlock(&tgt->ha->optrom_mutex); | |
| 1570 | 1572 | |
| 1571 | 1573 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00c, "Stop of tgt %p finished\n", |
| 1572 | 1574 | tgt); |
| @@ -184,6 +184,7 @@ static struct { · 183 unmodified lines | ||
| 184 | 184 | {"HP", "C3323-300", "4269", BLIST_NOTQ}, |
| 185 | 185 | {"HP", "C5713A", NULL, BLIST_NOREPORTLUN}, |
| 186 | 186 | {"HP", "DISK-SUBSYSTEM", "*", BLIST_REPORTLUN2}, |
| 187 | + {"HPE", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, | |
| 187 | 188 | {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, |
| 188 | 189 | {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, |
| 189 | 190 | {"IBM", "2105", NULL, BLIST_RETRY_HWERROR}, |
| @@ -603,11 +603,23 @@ static void ufs_mtk_get_controller_version(struct ufs_hba *hba) · 602 unmodified lines | ||
| 603 | 603 | |
| 604 | 604 | ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_LOCALVERINFO), &ver); |
| 605 | 605 | if (!ret) { |
| 606 | − if (ver >= UFS_UNIPRO_VER_1_8) | |
| 606 | + if (ver >= UFS_UNIPRO_VER_1_8) { | |
| 607 | 607 | host->hw_ver.major = 3; |
| 608 | + /* | |
| 609 | + * Fix HCI version for some platforms with | |
| 610 | + * incorrect version | |
| 611 | + */ | |
| 612 | + if (hba->ufs_version < ufshci_version(3, 0)) | |
| 613 | + hba->ufs_version = ufshci_version(3, 0); | |
| 614 | + } | |
| 608 | 615 | } |
| 609 | 616 | } |
| 610 | 617 | |
| 618 | +static u32 ufs_mtk_get_ufs_hci_version(struct ufs_hba *hba) | |
| 619 | +{ | |
| 620 | + return hba->ufs_version; | |
| 621 | +} | |
| 622 | + | |
| 611 | 623 | /** |
| 612 | 624 | * ufs_mtk_init - find other essential mmio bases |
| 613 | 625 | * @hba: host controller instance |
| @@ -1048,6 +1060,7 @@ static void ufs_mtk_event_notify(struct ufs_hba *hba, · 434 unmodified lines | ||
| 1048 | 1060 | static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = { |
| 1049 | 1061 | .name = "mediatek.ufshci", |
| 1050 | 1062 | .init = ufs_mtk_init, |
| 1063 | + .get_ufs_hci_version = ufs_mtk_get_ufs_hci_version, | |
| 1051 | 1064 | .setup_clocks = ufs_mtk_setup_clocks, |
| 1052 | 1065 | .hce_enable_notify = ufs_mtk_hce_enable_notify, |
| 1053 | 1066 | .link_startup_notify = ufs_mtk_link_startup_notify, |
| @@ -585,7 +585,13 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, · 584 unmodified lines | ||
| 585 | 585 | case BTSTAT_SUCCESS: |
| 586 | 586 | case BTSTAT_LINKED_COMMAND_COMPLETED: |
| 587 | 587 | case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG: |
| 588 | − /* If everything went fine, let's move on.. */ | |
| 588 | + /* | |
| 589 | + * Commands like INQUIRY may transfer less data than | |
| 590 | + * requested by the initiator via bufflen. Set residual | |
| 591 | + * count to make upper layer aware of the actual amount | |
| 592 | + * of data returned. | |
| 593 | + */ | |
| 594 | + scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); | |
| 589 | 595 | cmd->result = (DID_OK << 16); |
| 590 | 596 | break; |
| 591 | 597 | |
| @@ -626,10 +626,8 @@ static int meson_msr_probe(struct platform_device *pdev) · 625 unmodified lines | ||
| 626 | 626 | |
| 627 | 627 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 628 | 628 | base = devm_ioremap_resource(&pdev->dev, res); |
| 629 | − if (IS_ERR(base)) { | |
| 630 | − dev_err(&pdev->dev, "io resource mapping failed\n"); | |
| 629 | + if (IS_ERR(base)) | |
| 631 | 630 | return PTR_ERR(base); |
| 632 | − } | |
| 633 | 631 | |
| 634 | 632 | priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, |
| 635 | 633 | &meson_clk_msr_regmap_config); |
| @@ -1150,8 +1150,16 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl) · 1149 unmodified lines | ||
| 1150 | 1150 | |
| 1151 | 1151 | ret = of_property_read_u8_array(np, "qcom,ports-block-pack-mode", |
| 1152 | 1152 | bp_mode, nports); |
| 1153 | − if (ret) | |
| 1154 | − return ret; | |
| 1153 | + if (ret) { | |
| 1154 | + u32 version; | |
| 1155 | + | |
| 1156 | + ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &version); | |
| 1157 | + | |
| 1158 | + if (version <= 0x01030000) | |
| 1159 | + memset(bp_mode, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS); | |
| 1160 | + else | |
| 1161 | + return ret; | |
| 1162 | + } | |
| 1155 | 1163 | |
| 1156 | 1164 | memset(hstart, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS); |
| 1157 | 1165 | of_property_read_u8_array(np, "qcom,ports-hstart", hstart, nports); |
| @@ -65,7 +65,7 @@ config SPI_ALTERA · 64 unmodified lines | ||
| 65 | 65 | This is the driver for the Altera SPI Controller. |
| 66 | 66 | |
| 67 | 67 | config SPI_ALTERA_CORE |
| 68 | − tristate "Altera SPI Controller core code" | |
| 68 | + tristate "Altera SPI Controller core code" if COMPILE_TEST | |
| 69 | 69 | select REGMAP |
| 70 | 70 | help |
| 71 | 71 | "The core code for the Altera SPI Controller" |
| @@ -68,7 +68,7 @@ · 67 unmodified lines | ||
| 68 | 68 | #define BCM2835_SPI_FIFO_SIZE 64 |
| 69 | 69 | #define BCM2835_SPI_FIFO_SIZE_3_4 48 |
| 70 | 70 | #define BCM2835_SPI_DMA_MIN_LENGTH 96 |
| 71 | −#define BCM2835_SPI_NUM_CS 4 /* raise as necessary */ | |
| 71 | +#define BCM2835_SPI_NUM_CS 24 /* raise as necessary */ | |
| 72 | 72 | #define BCM2835_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \ |
| 73 | 73 | | SPI_NO_CS | SPI_3WIRE) |
| 74 | 74 | |
| @@ -1195,6 +1195,12 @@ static int bcm2835_spi_setup(struct spi_device *spi) · 1120 unmodified lines | ||
| 1195 | 1195 | struct gpio_chip *chip; |
| 1196 | 1196 | u32 cs; |
| 1197 | 1197 | |
| 1198 | + if (spi->chip_select >= BCM2835_SPI_NUM_CS) { | |
| 1199 | + dev_err(&spi->dev, "only %d chip-selects supported\n", | |
| 1200 | + BCM2835_SPI_NUM_CS - 1); | |
| 1201 | + return -EINVAL; | |
| 1202 | + } | |
| 1203 | + | |
| 1198 | 1204 | /* |
| 1199 | 1205 | * Precalculate SPI slave's CS register value for ->prepare_message(): |
| 1200 | 1206 | * The driver always uses software-controlled GPIO chip select, hence |
| @@ -1288,7 +1294,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) · 87 unmodified lines | ||
| 1288 | 1294 | ctlr->use_gpio_descriptors = true; |
| 1289 | 1295 | ctlr->mode_bits = BCM2835_SPI_MODE_BITS; |
| 1290 | 1296 | ctlr->bits_per_word_mask = SPI_BPW_MASK(8); |
| 1291 | − ctlr->num_chipselect = BCM2835_SPI_NUM_CS; | |
| 1297 | + ctlr->num_chipselect = 3; | |
| 1292 | 1298 | ctlr->setup = bcm2835_spi_setup; |
| 1293 | 1299 | ctlr->transfer_one = bcm2835_spi_transfer_one; |
| 1294 | 1300 | ctlr->handle_err = bcm2835_spi_handle_err; |
| @@ -184,6 +184,8 @@ int spi_bitbang_setup(struct spi_device *spi) · 183 unmodified lines | ||
| 184 | 184 | { |
| 185 | 185 | struct spi_bitbang_cs *cs = spi->controller_state; |
| 186 | 186 | struct spi_bitbang *bitbang; |
| 187 | + bool initial_setup = false; | |
| 188 | + int retval; | |
| 187 | 189 | |
| 188 | 190 | bitbang = spi_master_get_devdata(spi->master); |
| 189 | 191 | |
| @@ -192,22 +194,30 @@ int spi_bitbang_setup(struct spi_device *spi) · 2 unmodified lines | ||
| 192 | 194 | if (!cs) |
| 193 | 195 | return -ENOMEM; |
| 194 | 196 | spi->controller_state = cs; |
| 197 | + initial_setup = true; | |
| 195 | 198 | } |
| 196 | 199 | |
| 197 | 200 | /* per-word shift register access, in hardware or bitbanging */ |
| 198 | 201 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; |
| 199 | − if (!cs->txrx_word) | |
| 200 | − return -EINVAL; | |
| 202 | + if (!cs->txrx_word) { | |
| 203 | + retval = -EINVAL; | |
| 204 | + goto err_free; | |
| 205 | + } | |
| 201 | 206 | |
| 202 | 207 | if (bitbang->setup_transfer) { |
| 203 | − int retval = bitbang->setup_transfer(spi, NULL); | |
| 208 | + retval = bitbang->setup_transfer(spi, NULL); | |
| 204 | 209 | if (retval < 0) |
| 205 | − return retval; | |
| 210 | + goto err_free; | |
| 206 | 211 | } |
| 207 | 212 | |
| 208 | 213 | dev_dbg(&spi->dev, "%s, %u nsec/bit\n", __func__, 2 * cs->nsecs); |
| 209 | 214 | |
| 210 | 215 | return 0; |
| 216 | + | |
| 217 | +err_free: | |
| 218 | + if (initial_setup) | |
| 219 | + kfree(cs); | |
| 220 | + return retval; | |
| 211 | 221 | } |
| 212 | 222 | EXPORT_SYMBOL_GPL(spi_bitbang_setup); |
| 213 | 223 | |
| @@ -1375,11 +1375,13 @@ poll_mode: · 1374 unmodified lines | ||
| 1375 | 1375 | ret = spi_register_controller(ctlr); |
| 1376 | 1376 | if (ret != 0) { |
| 1377 | 1377 | dev_err(&pdev->dev, "Problem registering DSPI ctlr\n"); |
| 1378 | − goto out_free_irq; | |
| 1378 | + goto out_release_dma; | |
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | return ret; |
| 1382 | 1382 | |
| 1383 | +out_release_dma: | |
| 1384 | + dspi_release_dma(dspi); | |
| 1383 | 1385 | out_free_irq: |
| 1384 | 1386 | if (dspi->irq) |
| 1385 | 1387 | free_irq(dspi->irq, dspi); |
| @@ -440,6 +440,7 @@ static int fsl_spi_setup(struct spi_device *spi) · 439 unmodified lines | ||
| 440 | 440 | { |
| 441 | 441 | struct mpc8xxx_spi *mpc8xxx_spi; |
| 442 | 442 | struct fsl_spi_reg __iomem *reg_base; |
| 443 | + bool initial_setup = false; | |
| 443 | 444 | int retval; |
| 444 | 445 | u32 hw_mode; |
| 445 | 446 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
| @@ -452,6 +453,7 @@ static int fsl_spi_setup(struct spi_device *spi) · 6 unmodified lines | ||
| 452 | 453 | if (!cs) |
| 453 | 454 | return -ENOMEM; |
| 454 | 455 | spi_set_ctldata(spi, cs); |
| 456 | + initial_setup = true; | |
| 455 | 457 | } |
| 456 | 458 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
| 457 | 459 | |
| @@ -475,6 +477,8 @@ static int fsl_spi_setup(struct spi_device *spi) · 17 unmodified lines | ||
| 475 | 477 | retval = fsl_spi_setup_transfer(spi, NULL); |
| 476 | 478 | if (retval < 0) { |
| 477 | 479 | cs->hw_mode = hw_mode; /* Restore settings */ |
| 480 | + if (initial_setup) | |
| 481 | + kfree(cs); | |
| 478 | 482 | return retval; |
| 479 | 483 | } |
| 480 | 484 | |
| @@ -424,15 +424,22 @@ done: · 423 unmodified lines | ||
| 424 | 424 | static int uwire_setup(struct spi_device *spi) |
| 425 | 425 | { |
| 426 | 426 | struct uwire_state *ust = spi->controller_state; |
| 427 | + bool initial_setup = false; | |
| 428 | + int status; | |
| 427 | 429 | |
| 428 | 430 | if (ust == NULL) { |
| 429 | 431 | ust = kzalloc(sizeof(*ust), GFP_KERNEL); |
| 430 | 432 | if (ust == NULL) |
| 431 | 433 | return -ENOMEM; |
| 432 | 434 | spi->controller_state = ust; |
| 435 | + initial_setup = true; | |
| 433 | 436 | } |
| 434 | 437 | |
| 435 | − return uwire_setup_transfer(spi, NULL); | |
| 438 | + status = uwire_setup_transfer(spi, NULL); | |
| 439 | + if (status && initial_setup) | |
| 440 | + kfree(ust); | |
| 441 | + | |
| 442 | + return status; | |
| 436 | 443 | } |
| 437 | 444 | |
| 438 | 445 | static void uwire_cleanup(struct spi_device *spi) |
| @@ -1032,8 +1032,22 @@ static void omap2_mcspi_release_dma(struct spi_master *master) · 1031 unmodified lines | ||
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | +static void omap2_mcspi_cleanup(struct spi_device *spi) | |
| 1036 | +{ | |
| 1037 | + struct omap2_mcspi_cs *cs; | |
| 1038 | + | |
| 1039 | + if (spi->controller_state) { | |
| 1040 | + /* Unlink controller state from context save list */ | |
| 1041 | + cs = spi->controller_state; | |
| 1042 | + list_del(&cs->node); | |
| 1043 | + | |
| 1044 | + kfree(cs); | |
| 1045 | + } | |
| 1046 | +} | |
| 1047 | + | |
| 1035 | 1048 | static int omap2_mcspi_setup(struct spi_device *spi) |
| 1036 | 1049 | { |
| 1050 | + bool initial_setup = false; | |
| 1037 | 1051 | int ret; |
| 1038 | 1052 | struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); |
| 1039 | 1053 | struct omap2_mcspi_regs *ctx = &mcspi->ctx; |
| @@ -1051,35 +1065,28 @@ static int omap2_mcspi_setup(struct spi_device *spi) · 11 unmodified lines | ||
| 1051 | 1065 | spi->controller_state = cs; |
| 1052 | 1066 | /* Link this to context save list */ |
| 1053 | 1067 | list_add_tail(&cs->node, &ctx->cs); |
| 1068 | + initial_setup = true; | |
| 1054 | 1069 | } |
| 1055 | 1070 | |
| 1056 | 1071 | ret = pm_runtime_get_sync(mcspi->dev); |
| 1057 | 1072 | if (ret < 0) { |
| 1058 | 1073 | pm_runtime_put_noidle(mcspi->dev); |
| 1074 | + if (initial_setup) | |
| 1075 | + omap2_mcspi_cleanup(spi); | |
| 1059 | 1076 | |
| 1060 | 1077 | return ret; |
| 1061 | 1078 | } |
| 1062 | 1079 | |
| 1063 | 1080 | ret = omap2_mcspi_setup_transfer(spi, NULL); |
| 1081 | + if (ret && initial_setup) | |
| 1082 | + omap2_mcspi_cleanup(spi); | |
| 1083 | + | |
| 1064 | 1084 | pm_runtime_mark_last_busy(mcspi->dev); |
| 1065 | 1085 | pm_runtime_put_autosuspend(mcspi->dev); |
| 1066 | 1086 | |
| 1067 | 1087 | return ret; |
| 1068 | 1088 | } |
| 1069 | 1089 | |
| 1070 | −static void omap2_mcspi_cleanup(struct spi_device *spi) | |
| 1071 | −{ | |
| 1072 | − struct omap2_mcspi_cs *cs; | |
| 1073 | − | |
| 1074 | − if (spi->controller_state) { | |
| 1075 | − /* Unlink controller state from context save list */ | |
| 1076 | − cs = spi->controller_state; | |
| 1077 | − list_del(&cs->node); | |
| 1078 | − | |
| 1079 | − kfree(cs); | |
| 1080 | − } | |
| 1081 | −} | |
| 1082 | − | |
| 1083 | 1090 | static irqreturn_t omap2_mcspi_irq_handler(int irq, void *data) |
| 1084 | 1091 | { |
| 1085 | 1092 | struct omap2_mcspi *mcspi = data; |
| @@ -1254,6 +1254,8 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip, · 1253 unmodified lines | ||
| 1254 | 1254 | chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH; |
| 1255 | 1255 | |
| 1256 | 1256 | err = gpiod_direction_output(gpiod, !chip->gpio_cs_inverted); |
| 1257 | + if (err) | |
| 1258 | + gpiod_put(chip->gpiod_cs); | |
| 1257 | 1259 | } |
| 1258 | 1260 | |
| 1259 | 1261 | return err; |
| @@ -1267,6 +1269,7 @@ static int setup(struct spi_device *spi) · 7 unmodified lines | ||
| 1267 | 1269 | struct driver_data *drv_data = |
| 1268 | 1270 | spi_controller_get_devdata(spi->controller); |
| 1269 | 1271 | uint tx_thres, tx_hi_thres, rx_thres; |
| 1272 | + int err; | |
| 1270 | 1273 | |
| 1271 | 1274 | switch (drv_data->ssp_type) { |
| 1272 | 1275 | case QUARK_X1000_SSP: |
| @@ -1413,7 +1416,11 @@ static int setup(struct spi_device *spi) · 140 unmodified lines | ||
| 1413 | 1416 | if (drv_data->ssp_type == CE4100_SSP) |
| 1414 | 1417 | return 0; |
| 1415 | 1418 | |
| 1416 | − return setup_cs(spi, chip, chip_info); | |
| 1419 | + err = setup_cs(spi, chip, chip_info); | |
| 1420 | + if (err) | |
| 1421 | + kfree(chip); | |
| 1422 | + | |
| 1423 | + return err; | |
| 1417 | 1424 | } |
| 1418 | 1425 | |
| 1419 | 1426 | static void cleanup(struct spi_device *spi) |
| @@ -174,7 +174,7 @@ static int sc18is602_setup_transfer(struct sc18is602 *hw, u32 hz, u8 mode) · 173 unmodified lines | ||
| 174 | 174 | static int sc18is602_check_transfer(struct spi_device *spi, |
| 175 | 175 | struct spi_transfer *t, int tlen) |
| 176 | 176 | { |
| 177 | − if (t && t->len + tlen > SC18IS602_BUFSIZ) | |
| 177 | + if (t && t->len + tlen > SC18IS602_BUFSIZ + 1) | |
| 178 | 178 | return -EINVAL; |
| 179 | 179 | |
| 180 | 180 | return 0; |
| @@ -219,6 +219,11 @@ static int sc18is602_transfer_one(struct spi_master *master, · 38 unmodified lines | ||
| 219 | 219 | return status; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | +static size_t sc18is602_max_transfer_size(struct spi_device *spi) | |
| 223 | +{ | |
| 224 | + return SC18IS602_BUFSIZ; | |
| 225 | +} | |
| 226 | + | |
| 222 | 227 | static int sc18is602_setup(struct spi_device *spi) |
| 223 | 228 | { |
| 224 | 229 | struct sc18is602 *hw = spi_master_get_devdata(spi->master); |
| @@ -293,6 +298,8 @@ static int sc18is602_probe(struct i2c_client *client, · 68 unmodified lines | ||
| 293 | 298 | master->bits_per_word_mask = SPI_BPW_MASK(8); |
| 294 | 299 | master->setup = sc18is602_setup; |
| 295 | 300 | master->transfer_one_message = sc18is602_transfer_one; |
| 301 | + master->max_transfer_size = sc18is602_max_transfer_size; | |
| 302 | + master->max_message_size = sc18is602_max_transfer_size; | |
| 296 | 303 | master->dev.of_node = np; |
| 297 | 304 | master->min_speed_hz = hw->freq / 128; |
| 298 | 305 | master->max_speed_hz = hw->freq / 4; |
| @@ -1068,6 +1068,7 @@ static const struct of_device_id sprd_spi_of_match[] = { · 1067 unmodified lines | ||
| 1068 | 1068 | { .compatible = "sprd,sc9860-spi", }, |
| 1069 | 1069 | { /* sentinel */ } |
| 1070 | 1070 | }; |
| 1071 | +MODULE_DEVICE_TABLE(of, sprd_spi_of_match); | |
| 1071 | 1072 | |
| 1072 | 1073 | static struct platform_driver sprd_spi_driver = { |
| 1073 | 1074 | .driver = { |
| @@ -294,7 +294,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, · 293 unmodified lines | ||
| 294 | 294 | int err = 0; |
| 295 | 295 | |
| 296 | 296 | if (!op->data.nbytes) |
| 297 | − return stm32_qspi_wait_nobusy(qspi); | |
| 297 | + goto wait_nobusy; | |
| 298 | 298 | |
| 299 | 299 | if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) |
| 300 | 300 | goto out; |
| @@ -315,6 +315,9 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, · 14 unmodified lines | ||
| 315 | 315 | out: |
| 316 | 316 | /* clear flags */ |
| 317 | 317 | writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR); |
| 318 | +wait_nobusy: | |
| 319 | + if (!err) | |
| 320 | + err = stm32_qspi_wait_nobusy(qspi); | |
| 318 | 321 | |
| 319 | 322 | return err; |
| 320 | 323 | } |
| @@ -367,7 +367,7 @@ static int zynq_qspi_config_op(struct zynq_qspi *xqspi, struct spi_device *spi) · 366 unmodified lines | ||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
| 370 | − * zynq_qspi_setup - Configure the QSPI controller | |
| 370 | + * zynq_qspi_setup_op - Configure the QSPI controller | |
| 371 | 371 | * @spi: Pointer to the spi_device structure |
| 372 | 372 | * |
| 373 | 373 | * Sets the operational mode of QSPI controller for the next QSPI transfer, baud |
| @@ -528,18 +528,17 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, · 154 unmodified lines | ||
| 528 | 528 | struct zynq_qspi *xqspi = spi_controller_get_devdata(mem->spi->master); |
| 529 | 529 | int err = 0, i; |
| 530 | 530 | u8 *tmpbuf; |
| 531 | − u8 opcode = op->cmd.opcode; | |
| 532 | 531 | |
| 533 | 532 | dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n", |
| 534 | − opcode, op->cmd.buswidth, op->addr.buswidth, | |
| 533 | + op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth, | |
| 535 | 534 | op->dummy.buswidth, op->data.buswidth); |
| 536 | 535 | |
| 537 | 536 | zynq_qspi_chipselect(mem->spi, true); |
| 538 | 537 | zynq_qspi_config_op(xqspi, mem->spi); |
| 539 | 538 | |
| 540 | − if (op->cmd.nbytes) { | |
| 539 | + if (op->cmd.opcode) { | |
| 541 | 540 | reinit_completion(&xqspi->data_completion); |
| 542 | − xqspi->txbuf = &opcode; | |
| 541 | + xqspi->txbuf = (u8 *)&op->cmd.opcode; | |
| 543 | 542 | xqspi->rxbuf = NULL; |
| 544 | 543 | xqspi->tx_bytes = op->cmd.nbytes; |
| 545 | 544 | xqspi->rx_bytes = op->cmd.nbytes; |
| @@ -679,14 +678,14 @@ static int zynq_qspi_probe(struct platform_device *pdev) · 133 unmodified lines | ||
| 679 | 678 | xqspi->irq = platform_get_irq(pdev, 0); |
| 680 | 679 | if (xqspi->irq <= 0) { |
| 681 | 680 | ret = -ENXIO; |
| 682 | − goto remove_master; | |
| 681 | + goto clk_dis_all; | |
| 683 | 682 | } |
| 684 | 683 | ret = devm_request_irq(&pdev->dev, xqspi->irq, zynq_qspi_irq, |
| 685 | 684 | 0, pdev->name, xqspi); |
| 686 | 685 | if (ret != 0) { |
| 687 | 686 | ret = -ENXIO; |
| 688 | 687 | dev_err(&pdev->dev, "request_irq failed\n"); |
| 689 | − goto remove_master; | |
| 688 | + goto clk_dis_all; | |
| 690 | 689 | } |
| 691 | 690 | |
| 692 | 691 | ret = of_property_read_u32(np, "num-cs", |
| @@ -694,8 +693,9 @@ static int zynq_qspi_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 694 | 693 | if (ret < 0) { |
| 695 | 694 | ctlr->num_chipselect = 1; |
| 696 | 695 | } else if (num_cs > ZYNQ_QSPI_MAX_NUM_CS) { |
| 696 | + ret = -EINVAL; | |
| 697 | 697 | dev_err(&pdev->dev, "only 2 chip selects are available\n"); |
| 698 | − goto remove_master; | |
| 698 | + goto clk_dis_all; | |
| 699 | 699 | } else { |
| 700 | 700 | ctlr->num_chipselect = num_cs; |
| 701 | 701 | } |
| @@ -47,10 +47,6 @@ static void spidev_release(struct device *dev) · 46 unmodified lines | ||
| 47 | 47 | { |
| 48 | 48 | struct spi_device *spi = to_spi_device(dev); |
| 49 | 49 | |
| 50 | − /* spi controllers may cleanup for released devices */ | |
| 51 | − if (spi->controller->cleanup) | |
| 52 | − spi->controller->cleanup(spi); | |
| 53 | − | |
| 54 | 50 | spi_controller_put(spi->controller); |
| 55 | 51 | kfree(spi->driver_override); |
| 56 | 52 | kfree(spi); |
| @@ -558,6 +554,12 @@ static int spi_dev_check(struct device *dev, void *data) · 501 unmodified lines | ||
| 558 | 554 | return 0; |
| 559 | 555 | } |
| 560 | 556 | |
| 557 | +static void spi_cleanup(struct spi_device *spi) | |
| 558 | +{ | |
| 559 | + if (spi->controller->cleanup) | |
| 560 | + spi->controller->cleanup(spi); | |
| 561 | +} | |
| 562 | + | |
| 561 | 563 | /** |
| 562 | 564 | * spi_add_device - Add spi_device allocated with spi_alloc_device |
| 563 | 565 | * @spi: spi_device to register |
| @@ -622,11 +624,13 @@ int spi_add_device(struct spi_device *spi) · 58 unmodified lines | ||
| 622 | 624 | |
| 623 | 625 | /* Device may be bound to an active driver when this returns */ |
| 624 | 626 | status = device_add(&spi->dev); |
| 625 | − if (status < 0) | |
| 627 | + if (status < 0) { | |
| 626 | 628 | dev_err(dev, "can't add %s, status %d\n", |
| 627 | 629 | dev_name(&spi->dev), status); |
| 628 | − else | |
| 630 | + spi_cleanup(spi); | |
| 631 | + } else { | |
| 629 | 632 | dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev)); |
| 633 | + } | |
| 630 | 634 | |
| 631 | 635 | done: |
| 632 | 636 | mutex_unlock(&spi_add_lock); |
| @@ -717,7 +721,9 @@ void spi_unregister_device(struct spi_device *spi) · 84 unmodified lines | ||
| 717 | 721 | if (ACPI_COMPANION(&spi->dev)) |
| 718 | 722 | acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev)); |
| 719 | 723 | device_remove_software_node(&spi->dev); |
| 720 | − device_unregister(&spi->dev); | |
| 724 | + device_del(&spi->dev); | |
| 725 | + spi_cleanup(spi); | |
| 726 | + put_device(&spi->dev); | |
| 721 | 727 | } |
| 722 | 728 | EXPORT_SYMBOL_GPL(spi_unregister_device); |
| 723 | 729 | |
| @@ -814,15 +820,29 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force) · 90 unmodified lines | ||
| 814 | 820 | |
| 815 | 821 | if (spi->cs_gpiod || gpio_is_valid(spi->cs_gpio)) { |
| 816 | 822 | if (!(spi->mode & SPI_NO_CS)) { |
| 817 | − if (spi->cs_gpiod) | |
| 818 | − /* polarity handled by gpiolib */ | |
| 819 | − gpiod_set_value_cansleep(spi->cs_gpiod, activate); | |
| 820 | − else | |
| 823 | + if (spi->cs_gpiod) { | |
| 824 | + /* | |
| 825 | + * Historically ACPI has no means of the GPIO polarity and | |
| 826 | + * thus the SPISerialBus() resource defines it on the per-chip | |
| 827 | + * basis. In order to avoid a chain of negations, the GPIO | |
| 828 | + * polarity is considered being Active High. Even for the cases | |
| 829 | + * when _DSD() is involved (in the updated versions of ACPI) | |
| 830 | + * the GPIO CS polarity must be defined Active High to avoid | |
| 831 | + * ambiguity. That's why we use enable, that takes SPI_CS_HIGH | |
| 832 | + * into account. | |
| 833 | + */ | |
| 834 | + if (has_acpi_companion(&spi->dev)) | |
| 835 | + gpiod_set_value_cansleep(spi->cs_gpiod, !enable); | |
| 836 | + else | |
| 837 | + /* Polarity handled by GPIO library */ | |
| 838 | + gpiod_set_value_cansleep(spi->cs_gpiod, activate); | |
| 839 | + } else { | |
| 821 | 840 | /* |
| 822 | 841 | * invert the enable line, as active low is |
| 823 | 842 | * default for SPI. |
| 824 | 843 | */ |
| 825 | 844 | gpio_set_value_cansleep(spi->cs_gpio, !enable); |
| 845 | + } | |
| 826 | 846 | } |
| 827 | 847 | /* Some SPI masters need both GPIO CS & slave_select */ |
| 828 | 848 | if ((spi->controller->flags & SPI_MASTER_GPIO_SS) && |
| @@ -3451,9 +3471,12 @@ int spi_set_cs_timing(struct spi_device *spi, struct spi_delay *setup, · 2622 unmodified lines | ||
| 3451 | 3471 | |
| 3452 | 3472 | if (spi->controller->set_cs_timing && |
| 3453 | 3473 | !(spi->cs_gpiod || gpio_is_valid(spi->cs_gpio))) { |
| 3474 | + mutex_lock(&spi->controller->io_mutex); | |
| 3475 | + | |
| 3454 | 3476 | if (spi->controller->auto_runtime_pm) { |
| 3455 | 3477 | status = pm_runtime_get_sync(parent); |
| 3456 | 3478 | if (status < 0) { |
| 3479 | + mutex_unlock(&spi->controller->io_mutex); | |
| 3457 | 3480 | pm_runtime_put_noidle(parent); |
| 3458 | 3481 | dev_err(&spi->controller->dev, "Failed to power device: %d\n", |
| 3459 | 3482 | status); |
| @@ -3464,11 +3487,13 @@ int spi_set_cs_timing(struct spi_device *spi, struct spi_delay *setup, · 4 unmodified lines | ||
| 3464 | 3487 | hold, inactive); |
| 3465 | 3488 | pm_runtime_mark_last_busy(parent); |
| 3466 | 3489 | pm_runtime_put_autosuspend(parent); |
| 3467 | − return status; | |
| 3468 | 3490 | } else { |
| 3469 | − return spi->controller->set_cs_timing(spi, setup, hold, | |
| 3491 | + status = spi->controller->set_cs_timing(spi, setup, hold, | |
| 3470 | 3492 | inactive); |
| 3471 | 3493 | } |
| 3494 | + | |
| 3495 | + mutex_unlock(&spi->controller->io_mutex); | |
| 3496 | + return status; | |
| 3472 | 3497 | } |
| 3473 | 3498 | |
| 3474 | 3499 | if ((setup && setup->unit == SPI_DELAY_UNIT_SCK) || |
| @@ -2064,7 +2064,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, · 2063 unmodified lines | ||
| 2064 | 2064 | struct nbu2ss_ep *ep, |
| 2065 | 2065 | int status) |
| 2066 | 2066 | { |
| 2067 | − struct nbu2ss_req *req; | |
| 2067 | + struct nbu2ss_req *req, *n; | |
| 2068 | 2068 | |
| 2069 | 2069 | /* Endpoint Disable */ |
| 2070 | 2070 | _nbu2ss_epn_exit(udc, ep); |
| @@ -2076,7 +2076,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, · 5 unmodified lines | ||
| 2076 | 2076 | return 0; |
| 2077 | 2077 | |
| 2078 | 2078 | /* called with irqs blocked */ |
| 2079 | − list_for_each_entry(req, &ep->queue, queue) { | |
| 2079 | + list_for_each_entry_safe(req, n, &ep->queue, queue) { | |
| 2080 | 2080 | _nbu2ss_ep_done(ep, req, status); |
| 2081 | 2081 | } |
| 2082 | 2082 | |
| @@ -700,7 +700,6 @@ static int ad7746_probe(struct i2c_client *client, · 699 unmodified lines | ||
| 700 | 700 | indio_dev->num_channels = ARRAY_SIZE(ad7746_channels); |
| 701 | 701 | else |
| 702 | 702 | indio_dev->num_channels = ARRAY_SIZE(ad7746_channels) - 2; |
| 703 | − indio_dev->num_channels = ARRAY_SIZE(ad7746_channels); | |
| 704 | 703 | indio_dev->modes = INDIO_DIRECT_MODE; |
| 705 | 704 | |
| 706 | 705 | if (pdata) { |
| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | 2 | /* |
| 3 | − * Copyright (C) 2013, Lars-Peter Clausen <lars@metafoo.de> | |
| 4 | 3 | * GDMA4740 DMAC support |
| 5 | 4 | */ |
| 6 | 5 | |
| @@ -914,6 +913,5 @@ static struct platform_driver gdma_dma_driver = { · 907 unmodified lines | ||
| 914 | 913 | }; |
| 915 | 914 | module_platform_driver(gdma_dma_driver); |
| 916 | 915 | |
| 917 | −MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | |
| 918 | 916 | MODULE_DESCRIPTION("Ralink/MTK DMA driver"); |
| 919 | 917 | MODULE_LICENSE("GPL v2"); |
| @@ -2091,7 +2091,7 @@ void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, · 2090 unmodified lines | ||
| 2091 | 2091 | struct net_device *ndev = padapter->pnetdev; |
| 2092 | 2092 | |
| 2093 | 2093 | { |
| 2094 | − struct station_info sinfo; | |
| 2094 | + struct station_info sinfo = {}; | |
| 2095 | 2095 | u8 ie_offset; |
| 2096 | 2096 | if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ) |
| 2097 | 2097 | ie_offset = _ASOCREQ_IE_OFFSET_; |
| @@ -2284,7 +2284,7 @@ static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, str · 186 unmodified lines | ||
| 2284 | 2284 | mon_wdev->iftype = NL80211_IFTYPE_MONITOR; |
| 2285 | 2285 | mon_ndev->ieee80211_ptr = mon_wdev; |
| 2286 | 2286 | |
| 2287 | − ret = register_netdevice(mon_ndev); | |
| 2287 | + ret = cfg80211_register_netdevice(mon_ndev); | |
| 2288 | 2288 | if (ret) { |
| 2289 | 2289 | goto out; |
| 2290 | 2290 | } |
| @@ -2360,7 +2360,7 @@ static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy, · 69 unmodified lines | ||
| 2360 | 2360 | adapter = rtw_netdev_priv(ndev); |
| 2361 | 2361 | pwdev_priv = adapter_wdev_data(adapter); |
| 2362 | 2362 | |
| 2363 | − unregister_netdevice(ndev); | |
| 2363 | + cfg80211_unregister_netdevice(ndev); | |
| 2364 | 2364 | |
| 2365 | 2365 | if (ndev == pwdev_priv->pmon_ndev) { |
| 2366 | 2366 | pwdev_priv->pmon_ndev = NULL; |
| @@ -204,11 +204,11 @@ static struct se_dev_plug *iblock_plug_device(struct se_device *se_dev) · 203 unmodified lines | ||
| 204 | 204 | struct iblock_dev_plug *ib_dev_plug; |
| 205 | 205 | |
| 206 | 206 | /* |
| 207 | − * Each se_device has a per cpu work this can be run from. Wwe | |
| 207 | + * Each se_device has a per cpu work this can be run from. We | |
| 208 | 208 | * shouldn't have multiple threads on the same cpu calling this |
| 209 | 209 | * at the same time. |
| 210 | 210 | */ |
| 211 | − ib_dev_plug = &ib_dev->ibd_plug[smp_processor_id()]; | |
| 211 | + ib_dev_plug = &ib_dev->ibd_plug[raw_smp_processor_id()]; | |
| 212 | 212 | if (test_and_set_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags)) |
| 213 | 213 | return NULL; |
| 214 | 214 | |
| @@ -1416,7 +1416,7 @@ void __target_init_cmd( · 1415 unmodified lines | ||
| 1416 | 1416 | cmd->orig_fe_lun = unpacked_lun; |
| 1417 | 1417 | |
| 1418 | 1418 | if (!(cmd->se_cmd_flags & SCF_USE_CPUID)) |
| 1419 | − cmd->cpuid = smp_processor_id(); | |
| 1419 | + cmd->cpuid = raw_smp_processor_id(); | |
| 1420 | 1420 | |
| 1421 | 1421 | cmd->state_active = false; |
| 1422 | 1422 | } |
| @@ -3121,9 +3121,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, · 1698 unmodified lines | ||
| 3121 | 3121 | __releases(&cmd->t_state_lock) |
| 3122 | 3122 | __acquires(&cmd->t_state_lock) |
| 3123 | 3123 | { |
| 3124 | − | |
| 3125 | − assert_spin_locked(&cmd->t_state_lock); | |
| 3126 | − WARN_ON_ONCE(!irqs_disabled()); | |
| 3124 | + lockdep_assert_held(&cmd->t_state_lock); | |
| 3127 | 3125 | |
| 3128 | 3126 | if (fabric_stop) |
| 3129 | 3127 | cmd->transport_state |= CMD_T_FABRIC_STOP; |
| @@ -516,8 +516,10 @@ static inline int tcmu_get_empty_block(struct tcmu_dev *udev, · 515 unmodified lines | ||
| 516 | 516 | dpi = dbi * udev->data_pages_per_blk; |
| 517 | 517 | /* Count the number of already allocated pages */ |
| 518 | 518 | xas_set(&xas, dpi); |
| 519 | + rcu_read_lock(); | |
| 519 | 520 | for (cnt = 0; xas_next(&xas) && cnt < page_cnt;) |
| 520 | 521 | cnt++; |
| 522 | + rcu_read_unlock(); | |
| 521 | 523 | |
| 522 | 524 | for (i = cnt; i < page_cnt; i++) { |
| 523 | 525 | /* try to get new page from the mm */ |
| @@ -699,11 +701,10 @@ static inline void tcmu_copy_data(struct tcmu_dev *udev, · 175 unmodified lines | ||
| 699 | 701 | struct scatterlist *sg, unsigned int sg_nents, |
| 700 | 702 | struct iovec **iov, size_t data_len) |
| 701 | 703 | { |
| 702 | − XA_STATE(xas, &udev->data_pages, 0); | |
| 703 | 704 | /* start value of dbi + 1 must not be a valid dbi */ |
| 704 | 705 | int dbi = -2; |
| 705 | 706 | size_t page_remaining, cp_len; |
| 706 | − int page_cnt, page_inx; | |
| 707 | + int page_cnt, page_inx, dpi; | |
| 707 | 708 | struct sg_mapping_iter sg_iter; |
| 708 | 709 | unsigned int sg_flags; |
| 709 | 710 | struct page *page; |
| @@ -726,9 +727,10 @@ static inline void tcmu_copy_data(struct tcmu_dev *udev, · 16 unmodified lines | ||
| 726 | 727 | if (page_cnt > udev->data_pages_per_blk) |
| 727 | 728 | page_cnt = udev->data_pages_per_blk; |
| 728 | 729 | |
| 729 | − xas_set(&xas, dbi * udev->data_pages_per_blk); | |
| 730 | − for (page_inx = 0; page_inx < page_cnt && data_len; page_inx++) { | |
| 731 | − page = xas_next(&xas); | |
| 730 | + dpi = dbi * udev->data_pages_per_blk; | |
| 731 | + for (page_inx = 0; page_inx < page_cnt && data_len; | |
| 732 | + page_inx++, dpi++) { | |
| 733 | + page = xa_load(&udev->data_pages, dpi); | |
| 732 | 734 | |
| 733 | 735 | if (direction == TCMU_DATA_AREA_TO_SG) |
| 734 | 736 | flush_dcache_page(page); |
| @@ -220,6 +220,7 @@ int optee_open_session(struct tee_context *ctx, · 219 unmodified lines | ||
| 220 | 220 | struct optee_msg_arg *msg_arg; |
| 221 | 221 | phys_addr_t msg_parg; |
| 222 | 222 | struct optee_session *sess = NULL; |
| 223 | + uuid_t client_uuid; | |
| 223 | 224 | |
| 224 | 225 | /* +2 for the meta parameters added below */ |
| 225 | 226 | shm = get_msg_arg(ctx, arg->num_params + 2, &msg_arg, &msg_parg); |
| @@ -240,10 +241,11 @@ int optee_open_session(struct tee_context *ctx, · 14 unmodified lines | ||
| 240 | 241 | memcpy(&msg_arg->params[0].u.value, arg->uuid, sizeof(arg->uuid)); |
| 241 | 242 | msg_arg->params[1].u.value.c = arg->clnt_login; |
| 242 | 243 | |
| 243 | − rc = tee_session_calc_client_uuid((uuid_t *)&msg_arg->params[1].u.value, | |
| 244 | − arg->clnt_login, arg->clnt_uuid); | |
| 244 | + rc = tee_session_calc_client_uuid(&client_uuid, arg->clnt_login, | |
| 245 | + arg->clnt_uuid); | |
| 245 | 246 | if (rc) |
| 246 | 247 | goto out; |
| 248 | + export_uuid(msg_arg->params[1].u.octets, &client_uuid); | |
| 247 | 249 | |
| 248 | 250 | rc = optee_to_msg_param(msg_arg->params + 2, arg->num_params, param); |
| 249 | 251 | if (rc) |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/types.h> |
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | − * This file defines the OP-TEE message protocol used to communicate | |
| 12 | + * This file defines the OP-TEE message protocol (ABI) used to communicate | |
| 13 | 13 | * with an instance of OP-TEE running in secure world. |
| 14 | 14 | * |
| 15 | 15 | * This file is divided into two sections. |
| @@ -144,9 +144,10 @@ struct optee_msg_param_value { · 128 unmodified lines | ||
| 144 | 144 | * @tmem: parameter by temporary memory reference |
| 145 | 145 | * @rmem: parameter by registered memory reference |
| 146 | 146 | * @value: parameter by opaque value |
| 147 | + * @octets: parameter by octet string | |
| 147 | 148 | * |
| 148 | 149 | * @attr & OPTEE_MSG_ATTR_TYPE_MASK indicates if tmem, rmem or value is used in |
| 149 | − * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value, | |
| 150 | + * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value or octets, | |
| 150 | 151 | * OPTEE_MSG_ATTR_TYPE_TMEM_* indicates @tmem and |
| 151 | 152 | * OPTEE_MSG_ATTR_TYPE_RMEM_* indicates @rmem, |
| 152 | 153 | * OPTEE_MSG_ATTR_TYPE_NONE indicates that none of the members are used. |
| @@ -157,6 +158,7 @@ struct optee_msg_param { · 4 unmodified lines | ||
| 157 | 158 | struct optee_msg_param_tmem tmem; |
| 158 | 159 | struct optee_msg_param_rmem rmem; |
| 159 | 160 | struct optee_msg_param_value value; |
| 161 | + u8 octets[24]; | |
| 160 | 162 | } u; |
| 161 | 163 | }; |
| 162 | 164 | |
| @@ -237,6 +237,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, · 236 unmodified lines | ||
| 237 | 237 | if (ACPI_FAILURE(status)) |
| 238 | 238 | trip_cnt = 0; |
| 239 | 239 | else { |
| 240 | + int i; | |
| 241 | + | |
| 240 | 242 | int34x_thermal_zone->aux_trips = |
| 241 | 243 | kcalloc(trip_cnt, |
| 242 | 244 | sizeof(*int34x_thermal_zone->aux_trips), |
| @@ -247,6 +249,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, · 4 unmodified lines | ||
| 247 | 249 | } |
| 248 | 250 | trip_mask = BIT(trip_cnt) - 1; |
| 249 | 251 | int34x_thermal_zone->aux_trip_nr = trip_cnt; |
| 252 | + for (i = 0; i < trip_cnt; ++i) | |
| 253 | + int34x_thermal_zone->aux_trips[i] = THERMAL_TEMP_INVALID; | |
| 250 | 254 | } |
| 251 | 255 | |
| 252 | 256 | trip_cnt = int340x_thermal_read_trips(int34x_thermal_zone); |
| @@ -621,6 +621,17 @@ bool x86_thermal_enabled(void) · 620 unmodified lines | ||
| 621 | 621 | return atomic_read(&therm_throt_en); |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | +void __init therm_lvt_init(void) | |
| 625 | +{ | |
| 626 | + /* | |
| 627 | + * This function is only called on boot CPU. Save the init thermal | |
| 628 | + * LVT value on BSP and use that value to restore APs' thermal LVT | |
| 629 | + * entry BIOS programmed later | |
| 630 | + */ | |
| 631 | + if (intel_thermal_supported(&boot_cpu_data)) | |
| 632 | + lvtthmr_init = apic_read(APIC_LVTTHMR); | |
| 633 | +} | |
| 634 | + | |
| 624 | 635 | void intel_init_thermal(struct cpuinfo_x86 *c) |
| 625 | 636 | { |
| 626 | 637 | unsigned int cpu = smp_processor_id(); |
| @@ -630,10 +641,6 @@ void intel_init_thermal(struct cpuinfo_x86 *c) · 3 unmodified lines | ||
| 630 | 641 | if (!intel_thermal_supported(c)) |
| 631 | 642 | return; |
| 632 | 643 | |
| 633 | − /* On the BSP? */ | |
| 634 | − if (c == &boot_cpu_data) | |
| 635 | − lvtthmr_init = apic_read(APIC_LVTTHMR); | |
| 636 | − | |
| 637 | 644 | /* |
| 638 | 645 | * First check if its enabled already, in which case there might |
| 639 | 646 | * be some SMM goo which handles it, so we can't even put a handler |
| @@ -166,7 +166,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, · 165 unmodified lines | ||
| 166 | 166 | if (thres_reg_value) |
| 167 | 167 | *temp = zonedev->tj_max - thres_reg_value * 1000; |
| 168 | 168 | else |
| 169 | − *temp = 0; | |
| 169 | + *temp = THERMAL_TEMP_INVALID; | |
| 170 | 170 | pr_debug("sys_get_trip_temp %d\n", *temp); |
| 171 | 171 | |
| 172 | 172 | return 0; |
| @@ -441,7 +441,7 @@ static int adc_tm5_get_dt_channel_data(struct adc_tm5_chip *adc_tm, · 440 unmodified lines | ||
| 441 | 441 | |
| 442 | 442 | if (args.args_count != 1 || args.args[0] >= ADC5_MAX_CHANNEL) { |
| 443 | 443 | dev_err(dev, "%s: invalid ADC channel number %d\n", name, chan); |
| 444 | − return ret; | |
| 444 | + return -EINVAL; | |
| 445 | 445 | } |
| 446 | 446 | channel->adc_channel = args.args[0]; |
| 447 | 447 | |
| @@ -770,7 +770,7 @@ static int ti_bandgap_tshut_init(struct ti_bandgap *bgp, · 769 unmodified lines | ||
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | /** |
| 773 | − * ti_bandgap_alert_init() - setup and initialize talert handling | |
| 773 | + * ti_bandgap_talert_init() - setup and initialize talert handling | |
| 774 | 774 | * @bgp: pointer to struct ti_bandgap |
| 775 | 775 | * @pdev: pointer to device struct platform_device |
| 776 | 776 | * |
| @@ -366,15 +366,15 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address, · 365 unmodified lines | ||
| 366 | 366 | void *buf, size_t size) |
| 367 | 367 | { |
| 368 | 368 | unsigned int retries = DMA_PORT_RETRIES; |
| 369 | − unsigned int offset; | |
| 370 | − | |
| 371 | − offset = address & 3; | |
| 372 | − address = address & ~3; | |
| 373 | 369 | |
| 374 | 370 | do { |
| 375 | − u32 nbytes = min_t(u32, size, MAIL_DATA_DWORDS * 4); | |
| 371 | + unsigned int offset; | |
| 372 | + size_t nbytes; | |
| 376 | 373 | int ret; |
| 377 | 374 | |
| 375 | + offset = address & 3; | |
| 376 | + nbytes = min_t(size_t, size + offset, MAIL_DATA_DWORDS * 4); | |
| 377 | + | |
| 378 | 378 | ret = dma_port_flash_read_block(dma, address, dma->buf, |
| 379 | 379 | ALIGN(nbytes, 4)); |
| 380 | 380 | if (ret) { |
| @@ -386,6 +386,7 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address, · 5 unmodified lines | ||
| 386 | 386 | return ret; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | + nbytes -= offset; | |
| 389 | 390 | memcpy(buf, dma->buf + offset, nbytes); |
| 390 | 391 | |
| 391 | 392 | size -= nbytes; |
| @@ -68,15 +68,15 @@ static int usb4_do_read_data(u16 address, void *buf, size_t size, · 67 unmodified lines | ||
| 68 | 68 | unsigned int retries = USB4_DATA_RETRIES; |
| 69 | 69 | unsigned int offset; |
| 70 | 70 | |
| 71 | − offset = address & 3; | |
| 72 | − address = address & ~3; | |
| 73 | − | |
| 74 | 71 | do { |
| 75 | − size_t nbytes = min_t(size_t, size, USB4_DATA_DWORDS * 4); | |
| 76 | 72 | unsigned int dwaddress, dwords; |
| 77 | 73 | u8 data[USB4_DATA_DWORDS * 4]; |
| 74 | + size_t nbytes; | |
| 78 | 75 | int ret; |
| 79 | 76 | |
| 77 | + offset = address & 3; | |
| 78 | + nbytes = min_t(size_t, size + offset, USB4_DATA_DWORDS * 4); | |
| 79 | + | |
| 80 | 80 | dwaddress = address / 4; |
| 81 | 81 | dwords = ALIGN(nbytes, 4) / 4; |
| 82 | 82 | |
| @@ -87,6 +87,7 @@ static int usb4_do_read_data(u16 address, void *buf, size_t size, · 4 unmodified lines | ||
| 87 | 87 | return ret; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | + nbytes -= offset; | |
| 90 | 91 | memcpy(buf, data + offset, nbytes); |
| 91 | 92 | |
| 92 | 93 | size -= nbytes; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * Copyright (C) 2001 Russell King. |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +#include <linux/bits.h> | |
| 10 | 11 | #include <linux/serial_8250.h> |
| 11 | 12 | #include <linux/serial_reg.h> |
| 12 | 13 | #include <linux/dmaengine.h> |
| @@ -70,24 +71,25 @@ struct serial8250_config { · 57 unmodified lines | ||
| 70 | 71 | unsigned int flags; |
| 71 | 72 | }; |
| 72 | 73 | |
| 73 | −#define UART_CAP_FIFO (1 << 8) /* UART has FIFO */ | |
| 74 | −#define UART_CAP_EFR (1 << 9) /* UART has EFR */ | |
| 75 | −#define UART_CAP_SLEEP (1 << 10) /* UART has IER sleep */ | |
| 76 | −#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */ | |
| 77 | −#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */ | |
| 78 | −#define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */ | |
| 79 | −#define UART_CAP_HFIFO (1 << 14) /* UART has a "hidden" FIFO */ | |
| 80 | −#define UART_CAP_RPM (1 << 15) /* Runtime PM is active while idle */ | |
| 81 | −#define UART_CAP_IRDA (1 << 16) /* UART supports IrDA line discipline */ | |
| 82 | −#define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks: | |
| 74 | +#define UART_CAP_FIFO BIT(8) /* UART has FIFO */ | |
| 75 | +#define UART_CAP_EFR BIT(9) /* UART has EFR */ | |
| 76 | +#define UART_CAP_SLEEP BIT(10) /* UART has IER sleep */ | |
| 77 | +#define UART_CAP_AFE BIT(11) /* MCR-based hw flow control */ | |
| 78 | +#define UART_CAP_UUE BIT(12) /* UART needs IER bit 6 set (Xscale) */ | |
| 79 | +#define UART_CAP_RTOIE BIT(13) /* UART needs IER bit 4 set (Xscale, Tegra) */ | |
| 80 | +#define UART_CAP_HFIFO BIT(14) /* UART has a "hidden" FIFO */ | |
| 81 | +#define UART_CAP_RPM BIT(15) /* Runtime PM is active while idle */ | |
| 82 | +#define UART_CAP_IRDA BIT(16) /* UART supports IrDA line discipline */ | |
| 83 | +#define UART_CAP_MINI BIT(17) /* Mini UART on BCM283X family lacks: | |
| 83 | 84 | * STOP PARITY EPAR SPAR WLEN5 WLEN6 |
| 84 | 85 | */ |
| 85 | 86 | |
| 86 | −#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ | |
| 87 | −#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ | |
| 88 | −#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ | |
| 89 | −#define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */ | |
| 90 | −#define UART_BUG_PARITY (1 << 4) /* UART mishandles parity if FIFO enabled */ | |
| 87 | +#define UART_BUG_QUOT BIT(0) /* UART has buggy quot LSB */ | |
| 88 | +#define UART_BUG_TXEN BIT(1) /* UART has buggy TX IIR status */ | |
| 89 | +#define UART_BUG_NOMSR BIT(2) /* UART has buggy MSR status bits (Au1x00) */ | |
| 90 | +#define UART_BUG_THRE BIT(3) /* UART has buggy THRE reassertion */ | |
| 91 | +#define UART_BUG_PARITY BIT(4) /* UART mishandles parity if FIFO enabled */ | |
| 92 | +#define UART_BUG_TXRACE BIT(5) /* UART Tx fails to set remote DR */ | |
| 91 | 93 | |
| 92 | 94 | |
| 93 | 95 | #ifdef CONFIG_SERIAL_8250_SHARE_IRQ |
| @@ -437,6 +437,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) · 436 unmodified lines | ||
| 437 | 437 | port.port.status = UPSTAT_SYNC_FIFO; |
| 438 | 438 | port.port.dev = &pdev->dev; |
| 439 | 439 | port.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); |
| 440 | + port.bugs |= UART_BUG_TXRACE; | |
| 440 | 441 | |
| 441 | 442 | rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); |
| 442 | 443 | if (rc < 0) |
| @@ -714,6 +714,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = { · 713 unmodified lines | ||
| 714 | 714 | { "APMC0D08", 0}, |
| 715 | 715 | { "AMD0020", 0 }, |
| 716 | 716 | { "AMDI0020", 0 }, |
| 717 | + { "AMDI0022", 0 }, | |
| 717 | 718 | { "BRCM2032", 0 }, |
| 718 | 719 | { "HISI0031", 0 }, |
| 719 | 720 | { }, |
| @@ -553,7 +553,11 @@ static void pci_xr17v35x_exit(struct pci_dev *pcidev) · 552 unmodified lines | ||
| 553 | 553 | { |
| 554 | 554 | struct exar8250 *priv = pci_get_drvdata(pcidev); |
| 555 | 555 | struct uart_8250_port *port = serial8250_get_port(priv->line[0]); |
| 556 | − struct platform_device *pdev = port->port.private_data; | |
| 556 | + struct platform_device *pdev; | |
| 557 | + | |
| 558 | + pdev = port->port.private_data; | |
| 559 | + if (!pdev) | |
| 560 | + return; | |
| 557 | 561 | |
| 558 | 562 | device_remove_software_node(&pdev->dev); |
| 559 | 563 | platform_device_unregister(pdev); |
| @@ -56,6 +56,8 @@ struct serial_private { · 55 unmodified lines | ||
| 56 | 56 | int line[]; |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | +#define PCI_DEVICE_ID_HPE_PCI_SERIAL 0x37e | |
| 60 | + | |
| 59 | 61 | static const struct pci_device_id pci_use_msi[] = { |
| 60 | 62 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900, |
| 61 | 63 | 0xA000, 0x1000) }, |
| @@ -63,6 +65,8 @@ static const struct pci_device_id pci_use_msi[] = { · 1 unmodified line | ||
| 63 | 65 | 0xA000, 0x1000) }, |
| 64 | 66 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922, |
| 65 | 67 | 0xA000, 0x1000) }, |
| 68 | + { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL, | |
| 69 | + PCI_ANY_ID, PCI_ANY_ID) }, | |
| 66 | 70 | { } |
| 67 | 71 | }; |
| 68 | 72 | |
| @@ -1997,6 +2001,16 @@ static struct pci_serial_quirk pci_serial_quirks[] = { · 1928 unmodified lines | ||
| 1997 | 2001 | .init = pci_hp_diva_init, |
| 1998 | 2002 | .setup = pci_hp_diva_setup, |
| 1999 | 2003 | }, |
| 2004 | + /* | |
| 2005 | + * HPE PCI serial device | |
| 2006 | + */ | |
| 2007 | + { | |
| 2008 | + .vendor = PCI_VENDOR_ID_HP_3PAR, | |
| 2009 | + .device = PCI_DEVICE_ID_HPE_PCI_SERIAL, | |
| 2010 | + .subvendor = PCI_ANY_ID, | |
| 2011 | + .subdevice = PCI_ANY_ID, | |
| 2012 | + .setup = pci_hp_diva_setup, | |
| 2013 | + }, | |
| 2000 | 2014 | /* |
| 2001 | 2015 | * Intel |
| 2002 | 2016 | */ |
| @@ -3944,21 +3958,26 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) · 1941 unmodified lines | ||
| 3944 | 3958 | uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ; |
| 3945 | 3959 | uart.port.uartclk = board->base_baud * 16; |
| 3946 | 3960 | |
| 3947 | − if (pci_match_id(pci_use_msi, dev)) { | |
| 3948 | − dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); | |
| 3949 | − pci_set_master(dev); | |
| 3950 | − rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); | |
| 3961 | + if (board->flags & FL_NOIRQ) { | |
| 3962 | + uart.port.irq = 0; | |
| 3951 | 3963 | } else { |
| 3952 | − dev_dbg(&dev->dev, "Using legacy interrupts\n"); | |
| 3953 | − rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY); | |
| 3954 | − } | |
| 3955 | − if (rc < 0) { | |
| 3956 | − kfree(priv); | |
| 3957 | − priv = ERR_PTR(rc); | |
| 3958 | − goto err_deinit; | |
| 3964 | + if (pci_match_id(pci_use_msi, dev)) { | |
| 3965 | + dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); | |
| 3966 | + pci_set_master(dev); | |
| 3967 | + rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); | |
| 3968 | + } else { | |
| 3969 | + dev_dbg(&dev->dev, "Using legacy interrupts\n"); | |
| 3970 | + rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY); | |
| 3971 | + } | |
| 3972 | + if (rc < 0) { | |
| 3973 | + kfree(priv); | |
| 3974 | + priv = ERR_PTR(rc); | |
| 3975 | + goto err_deinit; | |
| 3976 | + } | |
| 3977 | + | |
| 3978 | + uart.port.irq = pci_irq_vector(dev, 0); | |
| 3959 | 3979 | } |
| 3960 | 3980 | |
| 3961 | − uart.port.irq = pci_irq_vector(dev, 0); | |
| 3962 | 3981 | uart.port.dev = &dev->dev; |
| 3963 | 3982 | |
| 3964 | 3983 | for (i = 0; i < nr_ports; i++) { |
| @@ -4973,6 +4992,10 @@ static const struct pci_device_id serial_pci_tbl[] = { · 1008 unmodified lines | ||
| 4973 | 4992 | { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX, |
| 4974 | 4993 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
| 4975 | 4994 | pbn_b2_1_115200 }, |
| 4995 | + /* HPE PCI serial device */ | |
| 4996 | + { PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL, | |
| 4997 | + PCI_ANY_ID, PCI_ANY_ID, 0, 0, | |
| 4998 | + pbn_b1_1_115200 }, | |
| 4976 | 4999 | |
| 4977 | 5000 | { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2, |
| 4978 | 5001 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
| @@ -1809,6 +1809,18 @@ void serial8250_tx_chars(struct uart_8250_port *up) · 1808 unmodified lines | ||
| 1809 | 1809 | count = up->tx_loadsz; |
| 1810 | 1810 | do { |
| 1811 | 1811 | serial_out(up, UART_TX, xmit->buf[xmit->tail]); |
| 1812 | + if (up->bugs & UART_BUG_TXRACE) { | |
| 1813 | + /* | |
| 1814 | + * The Aspeed BMC virtual UARTs have a bug where data | |
| 1815 | + * may get stuck in the BMC's Tx FIFO from bursts of | |
| 1816 | + * writes on the APB interface. | |
| 1817 | + * | |
| 1818 | + * Delay back-to-back writes by a read cycle to avoid | |
| 1819 | + * stalling the VUART. Read a register that won't have | |
| 1820 | + * side-effects and discard the result. | |
| 1821 | + */ | |
| 1822 | + serial_in(up, UART_SCR); | |
| 1823 | + } | |
| 1812 | 1824 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
| 1813 | 1825 | port->icount.tx++; |
| 1814 | 1826 | if (uart_circ_empty(xmit)) |
| @@ -195,7 +195,6 @@ struct rp2_card { · 194 unmodified lines | ||
| 195 | 195 | void __iomem *bar0; |
| 196 | 196 | void __iomem *bar1; |
| 197 | 197 | spinlock_t card_lock; |
| 198 | − struct completion fw_loaded; | |
| 199 | 198 | }; |
| 200 | 199 | |
| 201 | 200 | #define RP_ID(prod) PCI_VDEVICE(RP, (prod)) |
| @@ -662,17 +661,10 @@ static void rp2_remove_ports(struct rp2_card *card) · 460 unmodified lines | ||
| 662 | 661 | card->initialized_ports = 0; |
| 663 | 662 | } |
| 664 | 663 | |
| 665 | −static void rp2_fw_cb(const struct firmware *fw, void *context) | |
| 664 | +static int rp2_load_firmware(struct rp2_card *card, const struct firmware *fw) | |
| 666 | 665 | { |
| 667 | − struct rp2_card *card = context; | |
| 668 | 666 | resource_size_t phys_base; |
| 669 | − int i, rc = -ENOENT; | |
| 670 | − | |
| 671 | − if (!fw) { | |
| 672 | − dev_err(&card->pdev->dev, "cannot find '%s' firmware image\n", | |
| 673 | − RP2_FW_NAME); | |
| 674 | − goto no_fw; | |
| 675 | − } | |
| 667 | + int i, rc = 0; | |
| 676 | 668 | |
| 677 | 669 | phys_base = pci_resource_start(card->pdev, 1); |
| 678 | 670 | |
| @@ -718,23 +710,13 @@ static void rp2_fw_cb(const struct firmware *fw, void *context) · 39 unmodified lines | ||
| 718 | 710 | card->initialized_ports++; |
| 719 | 711 | } |
| 720 | 712 | |
| 721 | − release_firmware(fw); | |
| 722 | −no_fw: | |
| 723 | − /* | |
| 724 | − * rp2_fw_cb() is called from a workqueue long after rp2_probe() | |
| 725 | − * has already returned success. So if something failed here, | |
| 726 | − * we'll just leave the now-dormant device in place until somebody | |
| 727 | − * unbinds it. | |
| 728 | − */ | |
| 729 | − if (rc) | |
| 730 | − dev_warn(&card->pdev->dev, "driver initialization failed\n"); | |
| 731 | − | |
| 732 | − complete(&card->fw_loaded); | |
| 713 | + return rc; | |
| 733 | 714 | } |
| 734 | 715 | |
| 735 | 716 | static int rp2_probe(struct pci_dev *pdev, |
| 736 | 717 | const struct pci_device_id *id) |
| 737 | 718 | { |
| 719 | + const struct firmware *fw; | |
| 738 | 720 | struct rp2_card *card; |
| 739 | 721 | struct rp2_uart_port *ports; |
| 740 | 722 | void __iomem * const *bars; |
| @@ -745,7 +727,6 @@ static int rp2_probe(struct pci_dev *pdev, · 4 unmodified lines | ||
| 745 | 727 | return -ENOMEM; |
| 746 | 728 | pci_set_drvdata(pdev, card); |
| 747 | 729 | spin_lock_init(&card->card_lock); |
| 748 | − init_completion(&card->fw_loaded); | |
| 749 | 730 | |
| 750 | 731 | rc = pcim_enable_device(pdev); |
| 751 | 732 | if (rc) |
| @@ -778,21 +759,23 @@ static int rp2_probe(struct pci_dev *pdev, · 26 unmodified lines | ||
| 778 | 759 | return -ENOMEM; |
| 779 | 760 | card->ports = ports; |
| 780 | 761 | |
| 781 | − rc = devm_request_irq(&pdev->dev, pdev->irq, rp2_uart_interrupt, | |
| 782 | − IRQF_SHARED, DRV_NAME, card); | |
| 783 | − if (rc) | |
| 762 | + rc = request_firmware(&fw, RP2_FW_NAME, &pdev->dev); | |
| 763 | + if (rc < 0) { | |
| 764 | + dev_err(&pdev->dev, "cannot find '%s' firmware image\n", | |
| 765 | + RP2_FW_NAME); | |
| 784 | 766 | return rc; |
| 767 | + } | |
| 785 | 768 | |
| 786 | − /* | |
| 787 | − * Only catastrophic errors (e.g. ENOMEM) are reported here. | |
| 788 | − * If the FW image is missing, we'll find out in rp2_fw_cb() | |
| 789 | − * and print an error message. | |
| 790 | − */ | |
| 791 | − rc = request_firmware_nowait(THIS_MODULE, 1, RP2_FW_NAME, &pdev->dev, | |
| 792 | − GFP_KERNEL, card, rp2_fw_cb); | |
| 769 | + rc = rp2_load_firmware(card, fw); | |
| 770 | + | |
| 771 | + release_firmware(fw); | |
| 772 | + if (rc < 0) | |
| 773 | + return rc; | |
| 774 | + | |
| 775 | + rc = devm_request_irq(&pdev->dev, pdev->irq, rp2_uart_interrupt, | |
| 776 | + IRQF_SHARED, DRV_NAME, card); | |
| 793 | 777 | if (rc) |
| 794 | 778 | return rc; |
| 795 | − dev_dbg(&pdev->dev, "waiting for firmware blob...\n"); | |
| 796 | 779 | |
| 797 | 780 | return 0; |
| 798 | 781 | } |
| @@ -801,7 +784,6 @@ static void rp2_remove(struct pci_dev *pdev) · 2 unmodified lines | ||
| 801 | 784 | { |
| 802 | 785 | struct rp2_card *card = pci_get_drvdata(pdev); |
| 803 | 786 | |
| 804 | − wait_for_completion(&card->fw_loaded); | |
| 805 | 787 | rp2_remove_ports(card); |
| 806 | 788 | } |
| 807 | 789 | |
| @@ -338,7 +338,7 @@ static void tegra_uart_fifo_reset(struct tegra_uart_port *tup, u8 fcr_bits) · 337 unmodified lines | ||
| 338 | 338 | |
| 339 | 339 | do { |
| 340 | 340 | lsr = tegra_uart_read(tup, UART_LSR); |
| 341 | − if ((lsr | UART_LSR_TEMT) && !(lsr & UART_LSR_DR)) | |
| 341 | + if ((lsr & UART_LSR_TEMT) && !(lsr & UART_LSR_DR)) | |
| 342 | 342 | break; |
| 343 | 343 | udelay(1); |
| 344 | 344 | } while (--tmout); |
| @@ -863,9 +863,11 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, · 862 unmodified lines | ||
| 863 | 863 | goto check_and_exit; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | − retval = security_locked_down(LOCKDOWN_TIOCSSERIAL); | |
| 867 | − if (retval && (change_irq || change_port)) | |
| 868 | − goto exit; | |
| 866 | + if (change_irq || change_port) { | |
| 867 | + retval = security_locked_down(LOCKDOWN_TIOCSSERIAL); | |
| 868 | + if (retval) | |
| 869 | + goto exit; | |
| 870 | + } | |
| 869 | 871 | |
| 870 | 872 | /* |
| 871 | 873 | * Ask the low level driver to verify the settings. |
| @@ -1023,10 +1023,10 @@ static int scif_set_rtrg(struct uart_port *port, int rx_trig) · 1022 unmodified lines | ||
| 1023 | 1023 | { |
| 1024 | 1024 | unsigned int bits; |
| 1025 | 1025 | |
| 1026 | + if (rx_trig >= port->fifosize) | |
| 1027 | + rx_trig = port->fifosize - 1; | |
| 1026 | 1028 | if (rx_trig < 1) |
| 1027 | 1029 | rx_trig = 1; |
| 1028 | − if (rx_trig >= port->fifosize) | |
| 1029 | − rx_trig = port->fifosize; | |
| 1030 | 1030 | |
| 1031 | 1031 | /* HSCIF can be set to an arbitrary level. */ |
| 1032 | 1032 | if (sci_getreg(port, HSRTRGR)->size) { |
| @@ -2007,7 +2007,7 @@ static void cdns3_configure_dmult(struct cdns3_device *priv_dev, · 2006 unmodified lines | ||
| 2007 | 2007 | else |
| 2008 | 2008 | mask = BIT(priv_ep->num); |
| 2009 | 2009 | |
| 2010 | − if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) { | |
| 2010 | + if (priv_ep->type != USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) { | |
| 2011 | 2011 | cdns3_set_register_bit(®s->tdl_from_trb, mask); |
| 2012 | 2012 | cdns3_set_register_bit(®s->tdl_beh, mask); |
| 2013 | 2013 | cdns3_set_register_bit(®s->tdl_beh2, mask); |
| @@ -2046,15 +2046,13 @@ int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable) · 32 unmodified lines | ||
| 2046 | 2046 | case USB_ENDPOINT_XFER_INT: |
| 2047 | 2047 | ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT); |
| 2048 | 2048 | |
| 2049 | − if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) || | |
| 2050 | − priv_dev->dev_ver > DEV_VER_V2) | |
| 2049 | + if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) | |
| 2051 | 2050 | ep_cfg |= EP_CFG_TDL_CHK; |
| 2052 | 2051 | break; |
| 2053 | 2052 | case USB_ENDPOINT_XFER_BULK: |
| 2054 | 2053 | ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK); |
| 2055 | 2054 | |
| 2056 | − if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) || | |
| 2057 | − priv_dev->dev_ver > DEV_VER_V2) | |
| 2055 | + if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) | |
| 2058 | 2056 | ep_cfg |= EP_CFG_TDL_CHK; |
| 2059 | 2057 | break; |
| 2060 | 2058 | default: |
| @@ -3268,8 +3266,10 @@ static int __cdns3_gadget_init(struct cdns *cdns) · 1207 unmodified lines | ||
| 3268 | 3266 | pm_runtime_get_sync(cdns->dev); |
| 3269 | 3267 | |
| 3270 | 3268 | ret = cdns3_gadget_start(cdns); |
| 3271 | − if (ret) | |
| 3269 | + if (ret) { | |
| 3270 | + pm_runtime_put_sync(cdns->dev); | |
| 3272 | 3271 | return ret; |
| 3272 | + } | |
| 3273 | 3273 | |
| 3274 | 3274 | /* |
| 3275 | 3275 | * Because interrupt line can be shared with other components in |
| @@ -422,17 +422,17 @@ unmap: · 421 unmodified lines | ||
| 422 | 422 | int cdnsp_ep_dequeue(struct cdnsp_ep *pep, struct cdnsp_request *preq) |
| 423 | 423 | { |
| 424 | 424 | struct cdnsp_device *pdev = pep->pdev; |
| 425 | − int ret; | |
| 425 | + int ret_stop = 0; | |
| 426 | + int ret_rem; | |
| 426 | 427 | |
| 427 | 428 | trace_cdnsp_request_dequeue(preq); |
| 428 | 429 | |
| 429 | − if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING) { | |
| 430 | − ret = cdnsp_cmd_stop_ep(pdev, pep); | |
| 431 | − if (ret) | |
| 432 | − return ret; | |
| 433 | − } | |
| 430 | + if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING) | |
| 431 | + ret_stop = cdnsp_cmd_stop_ep(pdev, pep); | |
| 432 | + | |
| 433 | + ret_rem = cdnsp_remove_request(pdev, preq, pep); | |
| 434 | 434 | |
| 435 | − return cdnsp_remove_request(pdev, preq, pep); | |
| 435 | + return ret_rem ? ret_rem : ret_stop; | |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | static void cdnsp_zero_in_ctx(struct cdnsp_device *pdev) |
| @@ -1517,13 +1517,14 @@ irqreturn_t cdnsp_thread_irq_handler(int irq, void *data) · 1516 unmodified lines | ||
| 1517 | 1517 | { |
| 1518 | 1518 | struct cdnsp_device *pdev = (struct cdnsp_device *)data; |
| 1519 | 1519 | union cdnsp_trb *event_ring_deq; |
| 1520 | + unsigned long flags; | |
| 1520 | 1521 | int counter = 0; |
| 1521 | 1522 | |
| 1522 | − spin_lock(&pdev->lock); | |
| 1523 | + spin_lock_irqsave(&pdev->lock, flags); | |
| 1523 | 1524 | |
| 1524 | 1525 | if (pdev->cdnsp_state & (CDNSP_STATE_HALTED | CDNSP_STATE_DYING)) { |
| 1525 | 1526 | cdnsp_died(pdev); |
| 1526 | − spin_unlock(&pdev->lock); | |
| 1527 | + spin_unlock_irqrestore(&pdev->lock, flags); | |
| 1527 | 1528 | return IRQ_HANDLED; |
| 1528 | 1529 | } |
| 1529 | 1530 | |
| @@ -1539,7 +1540,7 @@ irqreturn_t cdnsp_thread_irq_handler(int irq, void *data) · 9 unmodified lines | ||
| 1539 | 1540 | |
| 1540 | 1541 | cdnsp_update_erst_dequeue(pdev, event_ring_deq, 1); |
| 1541 | 1542 | |
| 1542 | − spin_unlock(&pdev->lock); | |
| 1543 | + spin_unlock_irqrestore(&pdev->lock, flags); | |
| 1543 | 1544 | |
| 1544 | 1545 | return IRQ_HANDLED; |
| 1545 | 1546 | } |
| @@ -2061,6 +2061,7 @@ static int udc_start(struct ci_hdrc *ci) · 2060 unmodified lines | ||
| 2061 | 2061 | ci->gadget.name = ci->platdata->name; |
| 2062 | 2062 | ci->gadget.otg_caps = otg_caps; |
| 2063 | 2063 | ci->gadget.sg_supported = 1; |
| 2064 | + ci->gadget.irq = ci->irq; | |
| 2064 | 2065 | |
| 2065 | 2066 | if (ci->platdata->flags & CI_HDRC_REQUIRES_ALIGNED_DMA) |
| 2066 | 2067 | ci->gadget.quirk_avoids_skb_reserve = 1; |
| @@ -686,6 +686,16 @@ static int imx7d_charger_secondary_detection(struct imx_usbmisc_data *data) · 685 unmodified lines | ||
| 686 | 686 | int val; |
| 687 | 687 | unsigned long flags; |
| 688 | 688 | |
| 689 | + /* Clear VDATSRCENB0 to disable VDP_SRC and IDM_SNK required by BC 1.2 spec */ | |
| 690 | + spin_lock_irqsave(&usbmisc->lock, flags); | |
| 691 | + val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2); | |
| 692 | + val &= ~MX7D_USB_OTG_PHY_CFG2_CHRG_VDATSRCENB0; | |
| 693 | + writel(val, usbmisc->base + MX7D_USB_OTG_PHY_CFG2); | |
| 694 | + spin_unlock_irqrestore(&usbmisc->lock, flags); | |
| 695 | + | |
| 696 | + /* TVDMSRC_DIS */ | |
| 697 | + msleep(20); | |
| 698 | + | |
| 689 | 699 | /* VDM_SRC is connected to D- and IDP_SINK is connected to D+ */ |
| 690 | 700 | spin_lock_irqsave(&usbmisc->lock, flags); |
| 691 | 701 | val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2); |
| @@ -695,7 +705,8 @@ static int imx7d_charger_secondary_detection(struct imx_usbmisc_data *data) · 3 unmodified lines | ||
| 695 | 705 | usbmisc->base + MX7D_USB_OTG_PHY_CFG2); |
| 696 | 706 | spin_unlock_irqrestore(&usbmisc->lock, flags); |
| 697 | 707 | |
| 698 | − usleep_range(1000, 2000); | |
| 708 | + /* TVDMSRC_ON */ | |
| 709 | + msleep(40); | |
| 699 | 710 | |
| 700 | 711 | /* |
| 701 | 712 | * Per BC 1.2, check voltage of D+: |
| @@ -798,7 +809,8 @@ static int imx7d_charger_primary_detection(struct imx_usbmisc_data *data) · 96 unmodified lines | ||
| 798 | 809 | usbmisc->base + MX7D_USB_OTG_PHY_CFG2); |
| 799 | 810 | spin_unlock_irqrestore(&usbmisc->lock, flags); |
| 800 | 811 | |
| 801 | − usleep_range(1000, 2000); | |
| 812 | + /* TVDPSRC_ON */ | |
| 813 | + msleep(40); | |
| 802 | 814 | |
| 803 | 815 | /* Check if D- is less than VDAT_REF to determine an SDP per BC 1.2 */ |
| 804 | 816 | val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS); |
| @@ -1218,7 +1218,12 @@ static int do_proc_bulk(struct usb_dev_state *ps, · 1217 unmodified lines | ||
| 1218 | 1218 | ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb)); |
| 1219 | 1219 | if (ret) |
| 1220 | 1220 | return ret; |
| 1221 | − tbuf = kmalloc(len1, GFP_KERNEL); | |
| 1221 | + | |
| 1222 | + /* | |
| 1223 | + * len1 can be almost arbitrarily large. Don't WARN if it's | |
| 1224 | + * too big, just fail the request. | |
| 1225 | + */ | |
| 1226 | + tbuf = kmalloc(len1, GFP_KERNEL | __GFP_NOWARN); | |
| 1222 | 1227 | if (!tbuf) { |
| 1223 | 1228 | ret = -ENOMEM; |
| 1224 | 1229 | goto done; |
| @@ -1696,7 +1701,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 471 unmodified lines | ||
| 1696 | 1701 | if (num_sgs) { |
| 1697 | 1702 | as->urb->sg = kmalloc_array(num_sgs, |
| 1698 | 1703 | sizeof(struct scatterlist), |
| 1699 | − GFP_KERNEL); | |
| 1704 | + GFP_KERNEL | __GFP_NOWARN); | |
| 1700 | 1705 | if (!as->urb->sg) { |
| 1701 | 1706 | ret = -ENOMEM; |
| 1702 | 1707 | goto error; |
| @@ -1731,7 +1736,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 28 unmodified lines | ||
| 1731 | 1736 | (uurb_start - as->usbm->vm_start); |
| 1732 | 1737 | } else { |
| 1733 | 1738 | as->urb->transfer_buffer = kmalloc(uurb->buffer_length, |
| 1734 | − GFP_KERNEL); | |
| 1739 | + GFP_KERNEL | __GFP_NOWARN); | |
| 1735 | 1740 | if (!as->urb->transfer_buffer) { |
| 1736 | 1741 | ret = -ENOMEM; |
| 1737 | 1742 | goto error; |
| @@ -41,6 +41,8 @@ · 40 unmodified lines | ||
| 41 | 41 | #define USB_VENDOR_GENESYS_LOGIC 0x05e3 |
| 42 | 42 | #define USB_VENDOR_SMSC 0x0424 |
| 43 | 43 | #define USB_PRODUCT_USB5534B 0x5534 |
| 44 | +#define USB_VENDOR_CYPRESS 0x04b4 | |
| 45 | +#define USB_PRODUCT_CY7C65632 0x6570 | |
| 44 | 46 | #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 |
| 45 | 47 | #define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02 |
| 46 | 48 | |
| @@ -5697,6 +5699,11 @@ static const struct usb_device_id hub_id_table[] = { · 5650 unmodified lines | ||
| 5697 | 5699 | .idProduct = USB_PRODUCT_USB5534B, |
| 5698 | 5700 | .bInterfaceClass = USB_CLASS_HUB, |
| 5699 | 5701 | .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, |
| 5702 | + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR | |
| 5703 | + | USB_DEVICE_ID_MATCH_PRODUCT, | |
| 5704 | + .idVendor = USB_VENDOR_CYPRESS, | |
| 5705 | + .idProduct = USB_PRODUCT_CY7C65632, | |
| 5706 | + .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, | |
| 5700 | 5707 | { .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
| 5701 | 5708 | | USB_DEVICE_ID_MATCH_INT_CLASS, |
| 5702 | 5709 | .idVendor = USB_VENDOR_GENESYS_LOGIC, |
| @@ -1671,8 +1671,8 @@ static int dwc3_remove(struct platform_device *pdev) · 1670 unmodified lines | ||
| 1671 | 1671 | |
| 1672 | 1672 | pm_runtime_get_sync(&pdev->dev); |
| 1673 | 1673 | |
| 1674 | − dwc3_debugfs_exit(dwc); | |
| 1675 | 1674 | dwc3_core_exit_mode(dwc); |
| 1675 | + dwc3_debugfs_exit(dwc); | |
| 1676 | 1676 | |
| 1677 | 1677 | dwc3_core_exit(dwc); |
| 1678 | 1678 | dwc3_ulpi_exit(dwc); |
| @@ -1690,11 +1690,6 @@ static int dwc3_remove(struct platform_device *pdev) · 11 unmodified lines | ||
| 1690 | 1690 | return 0; |
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | −static void dwc3_shutdown(struct platform_device *pdev) | |
| 1694 | −{ | |
| 1695 | − dwc3_remove(pdev); | |
| 1696 | −} | |
| 1697 | − | |
| 1698 | 1693 | #ifdef CONFIG_PM |
| 1699 | 1694 | static int dwc3_core_init_for_resume(struct dwc3 *dwc) |
| 1700 | 1695 | { |
| @@ -2012,7 +2007,6 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match); · 311 unmodified lines | ||
| 2012 | 2007 | static struct platform_driver dwc3_driver = { |
| 2013 | 2008 | .probe = dwc3_probe, |
| 2014 | 2009 | .remove = dwc3_remove, |
| 2015 | − .shutdown = dwc3_shutdown, | |
| 2016 | 2010 | .driver = { |
| 2017 | 2011 | .name = "dwc3", |
| 2018 | 2012 | .of_match_table = of_match_ptr(of_dwc3_match), |
| @@ -413,9 +413,12 @@ static inline const char *dwc3_gadget_generic_cmd_status_string(int status) · 412 unmodified lines | ||
| 413 | 413 | |
| 414 | 414 | |
| 415 | 415 | #ifdef CONFIG_DEBUG_FS |
| 416 | +extern void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep); | |
| 416 | 417 | extern void dwc3_debugfs_init(struct dwc3 *d); |
| 417 | 418 | extern void dwc3_debugfs_exit(struct dwc3 *d); |
| 418 | 419 | #else |
| 420 | +static inline void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep) | |
| 421 | +{ } | |
| 419 | 422 | static inline void dwc3_debugfs_init(struct dwc3 *d) |
| 420 | 423 | { } |
| 421 | 424 | static inline void dwc3_debugfs_exit(struct dwc3 *d) |
| @@ -886,30 +886,14 @@ static void dwc3_debugfs_create_endpoint_files(struct dwc3_ep *dep, · 885 unmodified lines | ||
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | −static void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep, | |
| 890 | − struct dentry *parent) | |
| 889 | +void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep) | |
| 891 | 890 | { |
| 892 | 891 | struct dentry *dir; |
| 893 | 892 | |
| 894 | − dir = debugfs_create_dir(dep->name, parent); | |
| 893 | + dir = debugfs_create_dir(dep->name, dep->dwc->root); | |
| 895 | 894 | dwc3_debugfs_create_endpoint_files(dep, dir); |
| 896 | 895 | } |
| 897 | 896 | |
| 898 | −static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 *dwc, | |
| 899 | − struct dentry *parent) | |
| 900 | −{ | |
| 901 | − int i; | |
| 902 | − | |
| 903 | − for (i = 0; i < dwc->num_eps; i++) { | |
| 904 | − struct dwc3_ep *dep = dwc->eps[i]; | |
| 905 | − | |
| 906 | − if (!dep) | |
| 907 | − continue; | |
| 908 | − | |
| 909 | − dwc3_debugfs_create_endpoint_dir(dep, parent); | |
| 910 | − } | |
| 911 | −} | |
| 912 | − | |
| 913 | 897 | void dwc3_debugfs_init(struct dwc3 *dwc) |
| 914 | 898 | { |
| 915 | 899 | struct dentry *root; |
| @@ -940,7 +924,6 @@ void dwc3_debugfs_init(struct dwc3 *dwc) · 24 unmodified lines | ||
| 940 | 924 | &dwc3_testmode_fops); |
| 941 | 925 | debugfs_create_file("link_state", 0644, root, dwc, |
| 942 | 926 | &dwc3_link_state_fops); |
| 943 | − dwc3_debugfs_create_endpoint_dirs(dwc, root); | |
| 944 | 927 | } |
| 945 | 928 | } |
| 946 | 929 | |
| @@ -651,7 +651,7 @@ static int dwc3_meson_g12a_setup_regmaps(struct dwc3_meson_g12a *priv, · 650 unmodified lines | ||
| 651 | 651 | return PTR_ERR(priv->usb_glue_regmap); |
| 652 | 652 | |
| 653 | 653 | /* Create a regmap for each USB2 PHY control register set */ |
| 654 | − for (i = 0; i < priv->usb2_ports; i++) { | |
| 654 | + for (i = 0; i < priv->drvdata->num_phys; i++) { | |
| 655 | 655 | struct regmap_config u2p_regmap_config = { |
| 656 | 656 | .reg_bits = 8, |
| 657 | 657 | .val_bits = 32, |
| @@ -659,6 +659,9 @@ static int dwc3_meson_g12a_setup_regmaps(struct dwc3_meson_g12a *priv, · 1 unmodified line | ||
| 659 | 659 | .max_register = U2P_R1, |
| 660 | 660 | }; |
| 661 | 661 | |
| 662 | + if (!strstr(priv->drvdata->phy_names[i], "usb2")) | |
| 663 | + continue; | |
| 664 | + | |
| 662 | 665 | u2p_regmap_config.name = devm_kasprintf(priv->dev, GFP_KERNEL, |
| 663 | 666 | "u2p-%d", i); |
| 664 | 667 | if (!u2p_regmap_config.name) |
| @@ -772,13 +775,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 107 unmodified lines | ||
| 772 | 775 | |
| 773 | 776 | ret = priv->drvdata->usb_init(priv); |
| 774 | 777 | if (ret) |
| 775 | − goto err_disable_clks; | |
| 778 | + goto err_disable_regulator; | |
| 776 | 779 | |
| 777 | 780 | /* Init PHYs */ |
| 778 | 781 | for (i = 0 ; i < PHY_COUNT ; ++i) { |
| 779 | 782 | ret = phy_init(priv->phys[i]); |
| 780 | 783 | if (ret) |
| 781 | − goto err_disable_clks; | |
| 784 | + goto err_disable_regulator; | |
| 782 | 785 | } |
| 783 | 786 | |
| 784 | 787 | /* Set PHY Power */ |
| @@ -816,6 +819,10 @@ err_phys_exit: · 31 unmodified lines | ||
| 816 | 819 | for (i = 0 ; i < PHY_COUNT ; ++i) |
| 817 | 820 | phy_exit(priv->phys[i]); |
| 818 | 821 | |
| 822 | +err_disable_regulator: | |
| 823 | + if (priv->vbus) | |
| 824 | + regulator_disable(priv->vbus); | |
| 825 | + | |
| 819 | 826 | err_disable_clks: |
| 820 | 827 | clk_bulk_disable_unprepare(priv->drvdata->num_clks, |
| 821 | 828 | priv->drvdata->clks); |
| @@ -292,6 +292,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le) · 291 unmodified lines | ||
| 292 | 292 | epnum |= 1; |
| 293 | 293 | |
| 294 | 294 | dep = dwc->eps[epnum]; |
| 295 | + if (dep == NULL) | |
| 296 | + return NULL; | |
| 297 | + | |
| 295 | 298 | if (dep->flags & DWC3_EP_ENABLED) |
| 296 | 299 | return dep; |
| 297 | 300 | |
| @@ -1244,6 +1244,7 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep, · 1243 unmodified lines | ||
| 1244 | 1244 | req->start_sg = sg_next(s); |
| 1245 | 1245 | |
| 1246 | 1246 | req->num_queued_sgs++; |
| 1247 | + req->num_pending_sgs--; | |
| 1247 | 1248 | |
| 1248 | 1249 | /* |
| 1249 | 1250 | * The number of pending SG entries may not correspond to the |
| @@ -1251,7 +1252,7 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep, · 1 unmodified line | ||
| 1251 | 1252 | * don't include unused SG entries. |
| 1252 | 1253 | */ |
| 1253 | 1254 | if (length == 0) { |
| 1254 | − req->num_pending_sgs -= req->request.num_mapped_sgs - req->num_queued_sgs; | |
| 1255 | + req->num_pending_sgs = 0; | |
| 1255 | 1256 | break; |
| 1256 | 1257 | } |
| 1257 | 1258 | |
| @@ -2260,13 +2261,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 1002 unmodified lines | ||
| 2260 | 2261 | } |
| 2261 | 2262 | |
| 2262 | 2263 | /* |
| 2263 | − * Synchronize any pending event handling before executing the controller | |
| 2264 | − * halt routine. | |
| 2264 | + * Synchronize and disable any further event handling while controller | |
| 2265 | + * is being enabled/disabled. | |
| 2265 | 2266 | */ |
| 2266 | − if (!is_on) { | |
| 2267 | − dwc3_gadget_disable_irq(dwc); | |
| 2268 | − synchronize_irq(dwc->irq_gadget); | |
| 2269 | − } | |
| 2267 | + disable_irq(dwc->irq_gadget); | |
| 2270 | 2268 | |
| 2271 | 2269 | spin_lock_irqsave(&dwc->lock, flags); |
| 2272 | 2270 | |
| @@ -2304,6 +2302,8 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 31 unmodified lines | ||
| 2304 | 2302 | |
| 2305 | 2303 | ret = dwc3_gadget_run_stop(dwc, is_on, false); |
| 2306 | 2304 | spin_unlock_irqrestore(&dwc->lock, flags); |
| 2305 | + enable_irq(dwc->irq_gadget); | |
| 2306 | + | |
| 2307 | 2307 | pm_runtime_put(dwc->dev); |
| 2308 | 2308 | |
| 2309 | 2309 | return ret; |
| @@ -2753,6 +2753,8 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum) · 443 unmodified lines | ||
| 2753 | 2753 | INIT_LIST_HEAD(&dep->started_list); |
| 2754 | 2754 | INIT_LIST_HEAD(&dep->cancelled_list); |
| 2755 | 2755 | |
| 2756 | + dwc3_debugfs_create_endpoint_dir(dep); | |
| 2757 | + | |
| 2756 | 2758 | return 0; |
| 2757 | 2759 | } |
| 2758 | 2760 | |
| @@ -2796,6 +2798,7 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) · 37 unmodified lines | ||
| 2796 | 2798 | list_del(&dep->endpoint.ep_list); |
| 2797 | 2799 | } |
| 2798 | 2800 | |
| 2801 | + debugfs_remove_recursive(debugfs_lookup(dep->name, dwc->root)); | |
| 2799 | 2802 | kfree(dep); |
| 2800 | 2803 | } |
| 2801 | 2804 | } |
| @@ -2873,15 +2876,15 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep, · 71 unmodified lines | ||
| 2873 | 2876 | struct dwc3_trb *trb = &dep->trb_pool[dep->trb_dequeue]; |
| 2874 | 2877 | struct scatterlist *sg = req->sg; |
| 2875 | 2878 | struct scatterlist *s; |
| 2876 | − unsigned int pending = req->num_pending_sgs; | |
| 2879 | + unsigned int num_queued = req->num_queued_sgs; | |
| 2877 | 2880 | unsigned int i; |
| 2878 | 2881 | int ret = 0; |
| 2879 | 2882 | |
| 2880 | − for_each_sg(sg, s, pending, i) { | |
| 2883 | + for_each_sg(sg, s, num_queued, i) { | |
| 2881 | 2884 | trb = &dep->trb_pool[dep->trb_dequeue]; |
| 2882 | 2885 | |
| 2883 | 2886 | req->sg = sg_next(s); |
| 2884 | − req->num_pending_sgs--; | |
| 2887 | + req->num_queued_sgs--; | |
| 2885 | 2888 | |
| 2886 | 2889 | ret = dwc3_gadget_ep_reclaim_completed_trb(dep, req, |
| 2887 | 2890 | trb, event, status, true); |
| @@ -2904,7 +2907,7 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, · 16 unmodified lines | ||
| 2904 | 2907 | |
| 2905 | 2908 | static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) |
| 2906 | 2909 | { |
| 2907 | − return req->num_pending_sgs == 0; | |
| 2910 | + return req->num_pending_sgs == 0 && req->num_queued_sgs == 0; | |
| 2908 | 2911 | } |
| 2909 | 2912 | |
| 2910 | 2913 | static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, |
| @@ -2913,7 +2916,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, · 2 unmodified lines | ||
| 2913 | 2916 | { |
| 2914 | 2917 | int ret; |
| 2915 | 2918 | |
| 2916 | − if (req->num_pending_sgs) | |
| 2919 | + if (req->request.num_mapped_sgs) | |
| 2917 | 2920 | ret = dwc3_gadget_ep_reclaim_trb_sg(dep, req, event, |
| 2918 | 2921 | status); |
| 2919 | 2922 | else |
| @@ -4045,6 +4048,7 @@ err5: · 1125 unmodified lines | ||
| 4045 | 4048 | dwc3_gadget_free_endpoints(dwc); |
| 4046 | 4049 | err4: |
| 4047 | 4050 | usb_put_gadget(dwc->gadget); |
| 4051 | + dwc->gadget = NULL; | |
| 4048 | 4052 | err3: |
| 4049 | 4053 | dma_free_coherent(dwc->sysdev, DWC3_BOUNCE_SIZE, dwc->bounce, |
| 4050 | 4054 | dwc->bounce_addr); |
| @@ -4064,6 +4068,9 @@ err0: · 13 unmodified lines | ||
| 4064 | 4068 | |
| 4065 | 4069 | void dwc3_gadget_exit(struct dwc3 *dwc) |
| 4066 | 4070 | { |
| 4071 | + if (!dwc->gadget) | |
| 4072 | + return; | |
| 4073 | + | |
| 4067 | 4074 | usb_del_gadget(dwc->gadget); |
| 4068 | 4075 | dwc3_gadget_free_endpoints(dwc); |
| 4069 | 4076 | usb_put_gadget(dwc->gadget); |
| @@ -164,6 +164,14 @@ int usb_assign_descriptors(struct usb_function *f, · 163 unmodified lines | ||
| 164 | 164 | { |
| 165 | 165 | struct usb_gadget *g = f->config->cdev->gadget; |
| 166 | 166 | |
| 167 | + /* super-speed-plus descriptor falls back to super-speed one, | |
| 168 | + * if such a descriptor was provided, thus avoiding a NULL | |
| 169 | + * pointer dereference if a 5gbps capable gadget is used with | |
| 170 | + * a 10gbps capable config (device port + cable + host port) | |
| 171 | + */ | |
| 172 | + if (!ssp) | |
| 173 | + ssp = ss; | |
| 174 | + | |
| 167 | 175 | if (fs) { |
| 168 | 176 | f->fs_descriptors = usb_copy_descriptors(fs); |
| 169 | 177 | if (!f->fs_descriptors) |
| @@ -791,7 +791,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) · 790 unmodified lines | ||
| 791 | 791 | fs_ecm_notify_desc.bEndpointAddress; |
| 792 | 792 | |
| 793 | 793 | status = usb_assign_descriptors(f, ecm_fs_function, ecm_hs_function, |
| 794 | − ecm_ss_function, NULL); | |
| 794 | + ecm_ss_function, ecm_ss_function); | |
| 795 | 795 | if (status) |
| 796 | 796 | goto fail; |
| 797 | 797 | |
| @@ -302,7 +302,7 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) · 301 unmodified lines | ||
| 302 | 302 | eem_ss_out_desc.bEndpointAddress = eem_fs_out_desc.bEndpointAddress; |
| 303 | 303 | |
| 304 | 304 | status = usb_assign_descriptors(f, eem_fs_function, eem_hs_function, |
| 305 | − eem_ss_function, NULL); | |
| 305 | + eem_ss_function, eem_ss_function); | |
| 306 | 306 | if (status) |
| 307 | 307 | goto fail; |
| 308 | 308 | |
| @@ -495,7 +495,7 @@ static int eem_unwrap(struct gether *port, · 186 unmodified lines | ||
| 495 | 495 | skb2 = skb_clone(skb, GFP_ATOMIC); |
| 496 | 496 | if (unlikely(!skb2)) { |
| 497 | 497 | DBG(cdev, "unable to unframe EEM packet\n"); |
| 498 | − continue; | |
| 498 | + goto next; | |
| 499 | 499 | } |
| 500 | 500 | skb_trim(skb2, len - ETH_FCS_LEN); |
| 501 | 501 | |
| @@ -505,7 +505,7 @@ static int eem_unwrap(struct gether *port, · 3 unmodified lines | ||
| 505 | 505 | GFP_ATOMIC); |
| 506 | 506 | if (unlikely(!skb3)) { |
| 507 | 507 | dev_kfree_skb_any(skb2); |
| 508 | − continue; | |
| 508 | + goto next; | |
| 509 | 509 | } |
| 510 | 510 | dev_kfree_skb_any(skb2); |
| 511 | 511 | skb_queue_tail(list, skb3); |
| @@ -3567,6 +3567,9 @@ static void ffs_func_unbind(struct usb_configuration *c, · 3566 unmodified lines | ||
| 3567 | 3567 | ffs->func = NULL; |
| 3568 | 3568 | } |
| 3569 | 3569 | |
| 3570 | + /* Drain any pending AIO completions */ | |
| 3571 | + drain_workqueue(ffs->io_completion_wq); | |
| 3572 | + | |
| 3570 | 3573 | if (!--opts->refcnt) |
| 3571 | 3574 | functionfs_unbind(ffs); |
| 3572 | 3575 | |
| @@ -802,7 +802,8 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) · 801 unmodified lines | ||
| 802 | 802 | hidg_fs_out_ep_desc.bEndpointAddress; |
| 803 | 803 | |
| 804 | 804 | status = usb_assign_descriptors(f, hidg_fs_descriptors, |
| 805 | − hidg_hs_descriptors, hidg_ss_descriptors, NULL); | |
| 805 | + hidg_hs_descriptors, hidg_ss_descriptors, | |
| 806 | + hidg_ss_descriptors); | |
| 806 | 807 | if (status) |
| 807 | 808 | goto fail; |
| 808 | 809 | |
| @@ -207,7 +207,7 @@ autoconf_fail: · 206 unmodified lines | ||
| 207 | 207 | ss_loop_sink_desc.bEndpointAddress = fs_loop_sink_desc.bEndpointAddress; |
| 208 | 208 | |
| 209 | 209 | ret = usb_assign_descriptors(f, fs_loopback_descs, hs_loopback_descs, |
| 210 | − ss_loopback_descs, NULL); | |
| 210 | + ss_loopback_descs, ss_loopback_descs); | |
| 211 | 211 | if (ret) |
| 212 | 212 | return ret; |
| 213 | 213 | |
| @@ -583,7 +583,7 @@ static void ncm_do_notify(struct f_ncm *ncm) · 582 unmodified lines | ||
| 583 | 583 | data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget)); |
| 584 | 584 | data[1] = data[0]; |
| 585 | 585 | |
| 586 | − DBG(cdev, "notify speed %d\n", ncm_bitrate(cdev->gadget)); | |
| 586 | + DBG(cdev, "notify speed %u\n", ncm_bitrate(cdev->gadget)); | |
| 587 | 587 | ncm->notify_state = NCM_NOTIFY_CONNECT; |
| 588 | 588 | break; |
| 589 | 589 | } |
| @@ -1101,11 +1101,11 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, · 511 unmodified lines | ||
| 1101 | 1101 | ncm->ndp_dgram_count = 1; |
| 1102 | 1102 | |
| 1103 | 1103 | /* Note: we skip opts->next_ndp_index */ |
| 1104 | − } | |
| 1105 | 1104 | |
| 1106 | − /* Delay the timer. */ | |
| 1107 | − hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS, | |
| 1108 | − HRTIMER_MODE_REL_SOFT); | |
| 1105 | + /* Start the timer. */ | |
| 1106 | + hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS, | |
| 1107 | + HRTIMER_MODE_REL_SOFT); | |
| 1108 | + } | |
| 1109 | 1109 | |
| 1110 | 1110 | /* Add the datagram position entries */ |
| 1111 | 1111 | ntb_ndp = skb_put_zero(ncm->skb_tx_ndp, dgram_idx_len); |
| @@ -1101,7 +1101,8 @@ autoconf_fail: · 1100 unmodified lines | ||
| 1101 | 1101 | ss_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress; |
| 1102 | 1102 | |
| 1103 | 1103 | ret = usb_assign_descriptors(f, fs_printer_function, |
| 1104 | − hs_printer_function, ss_printer_function, NULL); | |
| 1104 | + hs_printer_function, ss_printer_function, | |
| 1105 | + ss_printer_function); | |
| 1105 | 1106 | if (ret) |
| 1106 | 1107 | return ret; |
| 1107 | 1108 | |
| @@ -789,7 +789,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) · 788 unmodified lines | ||
| 789 | 789 | ss_notify_desc.bEndpointAddress = fs_notify_desc.bEndpointAddress; |
| 790 | 790 | |
| 791 | 791 | status = usb_assign_descriptors(f, eth_fs_function, eth_hs_function, |
| 792 | − eth_ss_function, NULL); | |
| 792 | + eth_ss_function, eth_ss_function); | |
| 793 | 793 | if (status) |
| 794 | 794 | goto fail; |
| 795 | 795 | |
| @@ -233,7 +233,7 @@ static int gser_bind(struct usb_configuration *c, struct usb_function *f) · 232 unmodified lines | ||
| 233 | 233 | gser_ss_out_desc.bEndpointAddress = gser_fs_out_desc.bEndpointAddress; |
| 234 | 234 | |
| 235 | 235 | status = usb_assign_descriptors(f, gser_fs_function, gser_hs_function, |
| 236 | − gser_ss_function, NULL); | |
| 236 | + gser_ss_function, gser_ss_function); | |
| 237 | 237 | if (status) |
| 238 | 238 | goto fail; |
| 239 | 239 | dev_dbg(&cdev->gadget->dev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n", |
| @@ -431,7 +431,8 @@ no_iso: · 430 unmodified lines | ||
| 431 | 431 | ss_iso_sink_desc.bEndpointAddress = fs_iso_sink_desc.bEndpointAddress; |
| 432 | 432 | |
| 433 | 433 | ret = usb_assign_descriptors(f, fs_source_sink_descs, |
| 434 | − hs_source_sink_descs, ss_source_sink_descs, NULL); | |
| 434 | + hs_source_sink_descs, ss_source_sink_descs, | |
| 435 | + ss_source_sink_descs); | |
| 435 | 436 | if (ret) |
| 436 | 437 | return ret; |
| 437 | 438 | |
| @@ -358,7 +358,7 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) · 357 unmodified lines | ||
| 358 | 358 | fs_subset_out_desc.bEndpointAddress; |
| 359 | 359 | |
| 360 | 360 | status = usb_assign_descriptors(f, fs_eth_function, hs_eth_function, |
| 361 | − ss_eth_function, NULL); | |
| 361 | + ss_eth_function, ss_eth_function); | |
| 362 | 362 | if (status) |
| 363 | 363 | goto fail; |
| 364 | 364 | |
| @@ -2057,7 +2057,8 @@ static int tcm_bind(struct usb_configuration *c, struct usb_function *f) · 2056 unmodified lines | ||
| 2057 | 2057 | uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; |
| 2058 | 2058 | |
| 2059 | 2059 | ret = usb_assign_descriptors(f, uasp_fs_function_desc, |
| 2060 | − uasp_hs_function_desc, uasp_ss_function_desc, NULL); | |
| 2060 | + uasp_hs_function_desc, uasp_ss_function_desc, | |
| 2061 | + uasp_ss_function_desc); | |
| 2061 | 2062 | if (ret) |
| 2062 | 2063 | goto ep_fail; |
| 2063 | 2064 | |
| @@ -1488,7 +1488,7 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep, · 1487 unmodified lines | ||
| 1488 | 1488 | struct renesas_usb3_request *usb3_req) |
| 1489 | 1489 | { |
| 1490 | 1490 | struct renesas_usb3 *usb3 = usb3_ep_to_usb3(usb3_ep); |
| 1491 | − struct renesas_usb3_request *usb3_req_first = usb3_get_request(usb3_ep); | |
| 1491 | + struct renesas_usb3_request *usb3_req_first; | |
| 1492 | 1492 | unsigned long flags; |
| 1493 | 1493 | int ret = -EAGAIN; |
| 1494 | 1494 | u32 enable_bits = 0; |
| @@ -1496,7 +1496,8 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep, · 1 unmodified line | ||
| 1496 | 1496 | spin_lock_irqsave(&usb3->lock, flags); |
| 1497 | 1497 | if (usb3_ep->halt || usb3_ep->started) |
| 1498 | 1498 | goto out; |
| 1499 | − if (usb3_req != usb3_req_first) | |
| 1499 | + usb3_req_first = __usb3_get_request(usb3_ep); | |
| 1500 | + if (!usb3_req_first || usb3_req != usb3_req_first) | |
| 1500 | 1501 | goto out; |
| 1501 | 1502 | |
| 1502 | 1503 | if (usb3_pn_change(usb3, usb3_ep->num) < 0) |
| @@ -59,6 +59,7 @@ · 58 unmodified lines | ||
| 59 | 59 | #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138 |
| 60 | 60 | #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e |
| 61 | 61 | |
| 62 | +#define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639 | |
| 62 | 63 | #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 |
| 63 | 64 | #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba |
| 64 | 65 | #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb |
| @@ -182,6 +183,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 117 unmodified lines | ||
| 182 | 183 | (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) |
| 183 | 184 | xhci->quirks |= XHCI_U2_DISABLE_WAKE; |
| 184 | 185 | |
| 186 | + if (pdev->vendor == PCI_VENDOR_ID_AMD && | |
| 187 | + pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI) | |
| 188 | + xhci->quirks |= XHCI_BROKEN_D3COLD; | |
| 189 | + | |
| 185 | 190 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { |
| 186 | 191 | xhci->quirks |= XHCI_LPM_SUPPORT; |
| 187 | 192 | xhci->quirks |= XHCI_INTEL_HOST; |
| @@ -539,7 +544,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) · 351 unmodified lines | ||
| 539 | 544 | * Systems with the TI redriver that loses port status change events |
| 540 | 545 | * need to have the registers polled during D3, so avoid D3cold. |
| 541 | 546 | */ |
| 542 | − if (xhci->quirks & XHCI_COMP_MODE_QUIRK) | |
| 547 | + if (xhci->quirks & (XHCI_COMP_MODE_QUIRK | XHCI_BROKEN_D3COLD)) | |
| 543 | 548 | pci_d3cold_disable(pdev); |
| 544 | 549 | |
| 545 | 550 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) |
| @@ -828,14 +828,10 @@ static void xhci_giveback_invalidated_tds(struct xhci_virt_ep *ep) · 827 unmodified lines | ||
| 828 | 828 | list_for_each_entry_safe(td, tmp_td, &ep->cancelled_td_list, |
| 829 | 829 | cancelled_td_list) { |
| 830 | 830 | |
| 831 | − /* | |
| 832 | − * Doesn't matter what we pass for status, since the core will | |
| 833 | − * just overwrite it (because the URB has been unlinked). | |
| 834 | − */ | |
| 835 | 831 | ring = xhci_urb_to_transfer_ring(ep->xhci, td->urb); |
| 836 | 832 | |
| 837 | 833 | if (td->cancel_status == TD_CLEARED) |
| 838 | − xhci_td_cleanup(ep->xhci, td, ring, 0); | |
| 834 | + xhci_td_cleanup(ep->xhci, td, ring, td->status); | |
| 839 | 835 | |
| 840 | 836 | if (ep->xhci->xhc_state & XHCI_STATE_DYING) |
| 841 | 837 | return; |
| @@ -937,14 +933,18 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) · 95 unmodified lines | ||
| 937 | 933 | continue; |
| 938 | 934 | } |
| 939 | 935 | /* |
| 940 | − * If ring stopped on the TD we need to cancel, then we have to | |
| 936 | + * If a ring stopped on the TD we need to cancel then we have to | |
| 941 | 937 | * move the xHC endpoint ring dequeue pointer past this TD. |
| 938 | + * Rings halted due to STALL may show hw_deq is past the stalled | |
| 939 | + * TD, but still require a set TR Deq command to flush xHC cache. | |
| 942 | 940 | */ |
| 943 | 941 | hw_deq = xhci_get_hw_deq(xhci, ep->vdev, ep->ep_index, |
| 944 | 942 | td->urb->stream_id); |
| 945 | 943 | hw_deq &= ~0xf; |
| 946 | 944 | |
| 947 | − if (trb_in_td(xhci, td->start_seg, td->first_trb, | |
| 945 | + if (td->cancel_status == TD_HALTED) { | |
| 946 | + cached_td = td; | |
| 947 | + } else if (trb_in_td(xhci, td->start_seg, td->first_trb, | |
| 948 | 948 | td->last_trb, hw_deq, false)) { |
| 949 | 949 | switch (td->cancel_status) { |
| 950 | 950 | case TD_CLEARED: /* TD is already no-op */ |
| @@ -1892,6 +1892,7 @@ struct xhci_hcd { · 1891 unmodified lines | ||
| 1892 | 1892 | #define XHCI_DISABLE_SPARSE BIT_ULL(38) |
| 1893 | 1893 | #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) |
| 1894 | 1894 | #define XHCI_NO_SOFT_RETRY BIT_ULL(40) |
| 1895 | +#define XHCI_BROKEN_D3COLD BIT_ULL(41) | |
| 1895 | 1896 | |
| 1896 | 1897 | unsigned int num_active_eps; |
| 1897 | 1898 | unsigned int limit_active_eps; |
| @@ -263,6 +263,8 @@ static int __init brcmstb_usb_pinmap_probe(struct platform_device *pdev) · 262 unmodified lines | ||
| 263 | 263 | return -EINVAL; |
| 264 | 264 | |
| 265 | 265 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 266 | + if (!r) | |
| 267 | + return -EINVAL; | |
| 266 | 268 | |
| 267 | 269 | pdata = devm_kzalloc(&pdev->dev, |
| 268 | 270 | sizeof(*pdata) + |
| @@ -61,9 +61,9 @@ static ssize_t speed_store(struct device *dev, struct device_attribute *attr, · 60 unmodified lines | ||
| 61 | 61 | /* Set speed */ |
| 62 | 62 | retval = usb_control_msg(tv->udev, usb_sndctrlpipe(tv->udev, 0), |
| 63 | 63 | 0x01, /* vendor request: set speed */ |
| 64 | − USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, | |
| 64 | + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | |
| 65 | 65 | tv->speed, /* speed value */ |
| 66 | − 0, NULL, 0, USB_CTRL_GET_TIMEOUT); | |
| 66 | + 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | |
| 67 | 67 | if (retval) { |
| 68 | 68 | tv->speed = old; |
| 69 | 69 | dev_dbg(&tv->udev->dev, "retval = %d\n", retval); |
| @@ -736,6 +736,7 @@ static int uss720_probe(struct usb_interface *intf, · 735 unmodified lines | ||
| 736 | 736 | parport_announce_port(pp); |
| 737 | 737 | |
| 738 | 738 | usb_set_intfdata(intf, pp); |
| 739 | + usb_put_dev(usbdev); | |
| 739 | 740 | return 0; |
| 740 | 741 | |
| 741 | 742 | probe_abort: |
| @@ -2009,9 +2009,8 @@ static void musb_pm_runtime_check_session(struct musb *musb) · 2008 unmodified lines | ||
| 2009 | 2009 | schedule_delayed_work(&musb->irq_work, |
| 2010 | 2010 | msecs_to_jiffies(1000)); |
| 2011 | 2011 | musb->quirk_retries--; |
| 2012 | − break; | |
| 2013 | 2012 | } |
| 2014 | − fallthrough; | |
| 2013 | + break; | |
| 2015 | 2014 | case MUSB_QUIRK_B_INVALID_VBUS_91: |
| 2016 | 2015 | if (musb->quirk_retries && !musb->flush_irq_work) { |
| 2017 | 2016 | musb_dbg(musb, |
| @@ -252,9 +252,11 @@ struct cp210x_serial_private { · 251 unmodified lines | ||
| 252 | 252 | u8 gpio_input; |
| 253 | 253 | #endif |
| 254 | 254 | u8 partnum; |
| 255 | + u32 fw_version; | |
| 255 | 256 | speed_t min_speed; |
| 256 | 257 | speed_t max_speed; |
| 257 | 258 | bool use_actual_rate; |
| 259 | + bool no_flow_control; | |
| 258 | 260 | }; |
| 259 | 261 | |
| 260 | 262 | enum cp210x_event_state { |
| @@ -398,6 +400,7 @@ struct cp210x_special_chars { · 137 unmodified lines | ||
| 398 | 400 | |
| 399 | 401 | /* CP210X_VENDOR_SPECIFIC values */ |
| 400 | 402 | #define CP210X_READ_2NCONFIG 0x000E |
| 403 | +#define CP210X_GET_FW_VER_2N 0x0010 | |
| 401 | 404 | #define CP210X_READ_LATCH 0x00C2 |
| 402 | 405 | #define CP210X_GET_PARTNUM 0x370B |
| 403 | 406 | #define CP210X_GET_PORTCONFIG 0x370C |
| @@ -537,6 +540,12 @@ struct cp210x_single_port_config { · 133 unmodified lines | ||
| 537 | 540 | #define CP210X_2NCONFIG_GPIO_RSTLATCH_IDX 587 |
| 538 | 541 | #define CP210X_2NCONFIG_GPIO_CONTROL_IDX 600 |
| 539 | 542 | |
| 543 | +/* CP2102N QFN20 port configuration values */ | |
| 544 | +#define CP2102N_QFN20_GPIO2_TXLED_MODE BIT(2) | |
| 545 | +#define CP2102N_QFN20_GPIO3_RXLED_MODE BIT(3) | |
| 546 | +#define CP2102N_QFN20_GPIO1_RS485_MODE BIT(4) | |
| 547 | +#define CP2102N_QFN20_GPIO0_CLK_MODE BIT(6) | |
| 548 | + | |
| 540 | 549 | /* CP210X_VENDOR_SPECIFIC, CP210X_WRITE_LATCH call writes these 0x2 bytes. */ |
| 541 | 550 | struct cp210x_gpio_write { |
| 542 | 551 | u8 mask; |
| @@ -1122,6 +1131,7 @@ static bool cp210x_termios_change(const struct ktermios *a, const struct ktermio · 579 unmodified lines | ||
| 1122 | 1131 | static void cp210x_set_flow_control(struct tty_struct *tty, |
| 1123 | 1132 | struct usb_serial_port *port, struct ktermios *old_termios) |
| 1124 | 1133 | { |
| 1134 | + struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); | |
| 1125 | 1135 | struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); |
| 1126 | 1136 | struct cp210x_special_chars chars; |
| 1127 | 1137 | struct cp210x_flow_ctl flow_ctl; |
| @@ -1129,6 +1139,15 @@ static void cp210x_set_flow_control(struct tty_struct *tty, · 1 unmodified line | ||
| 1129 | 1139 | u32 ctl_hs; |
| 1130 | 1140 | int ret; |
| 1131 | 1141 | |
| 1142 | + /* | |
| 1143 | + * Some CP2102N interpret ulXonLimit as ulFlowReplace (erratum | |
| 1144 | + * CP2102N_E104). Report back that flow control is not supported. | |
| 1145 | + */ | |
| 1146 | + if (priv->no_flow_control) { | |
| 1147 | + tty->termios.c_cflag &= ~CRTSCTS; | |
| 1148 | + tty->termios.c_iflag &= ~(IXON | IXOFF); | |
| 1149 | + } | |
| 1150 | + | |
| 1132 | 1151 | if (old_termios && |
| 1133 | 1152 | C_CRTSCTS(tty) == (old_termios->c_cflag & CRTSCTS) && |
| 1134 | 1153 | I_IXON(tty) == (old_termios->c_iflag & IXON) && |
| @@ -1185,19 +1204,20 @@ static void cp210x_set_flow_control(struct tty_struct *tty, · 50 unmodified lines | ||
| 1185 | 1204 | port_priv->crtscts = false; |
| 1186 | 1205 | } |
| 1187 | 1206 | |
| 1188 | − if (I_IXOFF(tty)) | |
| 1207 | + if (I_IXOFF(tty)) { | |
| 1189 | 1208 | flow_repl |= CP210X_SERIAL_AUTO_RECEIVE; |
| 1190 | − else | |
| 1209 | + | |
| 1210 | + flow_ctl.ulXonLimit = cpu_to_le32(128); | |
| 1211 | + flow_ctl.ulXoffLimit = cpu_to_le32(128); | |
| 1212 | + } else { | |
| 1191 | 1213 | flow_repl &= ~CP210X_SERIAL_AUTO_RECEIVE; |
| 1214 | + } | |
| 1192 | 1215 | |
| 1193 | 1216 | if (I_IXON(tty)) |
| 1194 | 1217 | flow_repl |= CP210X_SERIAL_AUTO_TRANSMIT; |
| 1195 | 1218 | else |
| 1196 | 1219 | flow_repl &= ~CP210X_SERIAL_AUTO_TRANSMIT; |
| 1197 | 1220 | |
| 1198 | − flow_ctl.ulXonLimit = cpu_to_le32(128); | |
| 1199 | − flow_ctl.ulXoffLimit = cpu_to_le32(128); | |
| 1200 | − | |
| 1201 | 1221 | dev_dbg(&port->dev, "%s - ctrl = 0x%02x, flow = 0x%02x\n", __func__, |
| 1202 | 1222 | ctl_hs, flow_repl); |
| 1203 | 1223 | |
| @@ -1733,7 +1753,19 @@ static int cp2102n_gpioconf_init(struct usb_serial *serial) · 529 unmodified lines | ||
| 1733 | 1753 | priv->gpio_pushpull = (gpio_pushpull >> 3) & 0x0f; |
| 1734 | 1754 | |
| 1735 | 1755 | /* 0 indicates GPIO mode, 1 is alternate function */ |
| 1736 | − priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f; | |
| 1756 | + if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN20) { | |
| 1757 | + /* QFN20 is special... */ | |
| 1758 | + if (gpio_ctrl & CP2102N_QFN20_GPIO0_CLK_MODE) /* GPIO 0 */ | |
| 1759 | + priv->gpio_altfunc |= BIT(0); | |
| 1760 | + if (gpio_ctrl & CP2102N_QFN20_GPIO1_RS485_MODE) /* GPIO 1 */ | |
| 1761 | + priv->gpio_altfunc |= BIT(1); | |
| 1762 | + if (gpio_ctrl & CP2102N_QFN20_GPIO2_TXLED_MODE) /* GPIO 2 */ | |
| 1763 | + priv->gpio_altfunc |= BIT(2); | |
| 1764 | + if (gpio_ctrl & CP2102N_QFN20_GPIO3_RXLED_MODE) /* GPIO 3 */ | |
| 1765 | + priv->gpio_altfunc |= BIT(3); | |
| 1766 | + } else { | |
| 1767 | + priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f; | |
| 1768 | + } | |
| 1737 | 1769 | |
| 1738 | 1770 | if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN28) { |
| 1739 | 1771 | /* |
| @@ -1908,6 +1940,45 @@ static void cp210x_init_max_speed(struct usb_serial *serial) · 168 unmodified lines | ||
| 1908 | 1940 | priv->use_actual_rate = use_actual_rate; |
| 1909 | 1941 | } |
| 1910 | 1942 | |
| 1943 | +static int cp210x_get_fw_version(struct usb_serial *serial, u16 value) | |
| 1944 | +{ | |
| 1945 | + struct cp210x_serial_private *priv = usb_get_serial_data(serial); | |
| 1946 | + u8 ver[3]; | |
| 1947 | + int ret; | |
| 1948 | + | |
| 1949 | + ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, value, | |
| 1950 | + ver, sizeof(ver)); | |
| 1951 | + if (ret) | |
| 1952 | + return ret; | |
| 1953 | + | |
| 1954 | + dev_dbg(&serial->interface->dev, "%s - %d.%d.%d\n", __func__, | |
| 1955 | + ver[0], ver[1], ver[2]); | |
| 1956 | + | |
| 1957 | + priv->fw_version = ver[0] << 16 | ver[1] << 8 | ver[2]; | |
| 1958 | + | |
| 1959 | + return 0; | |
| 1960 | +} | |
| 1961 | + | |
| 1962 | +static void cp210x_determine_quirks(struct usb_serial *serial) | |
| 1963 | +{ | |
| 1964 | + struct cp210x_serial_private *priv = usb_get_serial_data(serial); | |
| 1965 | + int ret; | |
| 1966 | + | |
| 1967 | + switch (priv->partnum) { | |
| 1968 | + case CP210X_PARTNUM_CP2102N_QFN28: | |
| 1969 | + case CP210X_PARTNUM_CP2102N_QFN24: | |
| 1970 | + case CP210X_PARTNUM_CP2102N_QFN20: | |
| 1971 | + ret = cp210x_get_fw_version(serial, CP210X_GET_FW_VER_2N); | |
| 1972 | + if (ret) | |
| 1973 | + break; | |
| 1974 | + if (priv->fw_version <= 0x10004) | |
| 1975 | + priv->no_flow_control = true; | |
| 1976 | + break; | |
| 1977 | + default: | |
| 1978 | + break; | |
| 1979 | + } | |
| 1980 | +} | |
| 1981 | + | |
| 1911 | 1982 | static int cp210x_attach(struct usb_serial *serial) |
| 1912 | 1983 | { |
| 1913 | 1984 | int result; |
| @@ -1928,6 +1999,7 @@ static int cp210x_attach(struct usb_serial *serial) · 14 unmodified lines | ||
| 1928 | 1999 | |
| 1929 | 2000 | usb_set_serial_data(serial, priv); |
| 1930 | 2001 | |
| 2002 | + cp210x_determine_quirks(serial); | |
| 1931 | 2003 | cp210x_init_max_speed(serial); |
| 1932 | 2004 | |
| 1933 | 2005 | result = cp210x_gpio_init(serial); |
| @@ -611,6 +611,7 @@ static const struct usb_device_id id_table_combined[] = { · 610 unmodified lines | ||
| 611 | 611 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
| 612 | 612 | { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) }, |
| 613 | 613 | { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) }, |
| 614 | + { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONMX_PID) }, | |
| 614 | 615 | { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, |
| 615 | 616 | { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, |
| 616 | 617 | { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) }, |
| @@ -1034,6 +1035,9 @@ static const struct usb_device_id id_table_combined[] = { · 417 unmodified lines | ||
| 1034 | 1035 | /* Sienna devices */ |
| 1035 | 1036 | { USB_DEVICE(FTDI_VID, FTDI_SIENNA_PID) }, |
| 1036 | 1037 | { USB_DEVICE(ECHELON_VID, ECHELON_U20_PID) }, |
| 1038 | + /* IDS GmbH devices */ | |
| 1039 | + { USB_DEVICE(IDS_VID, IDS_SI31A_PID) }, | |
| 1040 | + { USB_DEVICE(IDS_VID, IDS_CM31A_PID) }, | |
| 1037 | 1041 | /* U-Blox devices */ |
| 1038 | 1042 | { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) }, |
| 1039 | 1043 | { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) }, |
| @@ -581,6 +581,7 @@ · 580 unmodified lines | ||
| 581 | 581 | #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ |
| 582 | 582 | #define FTDI_NT_ORIONLX_PLUS_PID 0x7c91 /* OrionLX+ Substation Automation Platform */ |
| 583 | 583 | #define FTDI_NT_ORION_IO_PID 0x7c92 /* Orion I/O */ |
| 584 | +#define FTDI_NT_ORIONMX_PID 0x7c93 /* OrionMX */ | |
| 584 | 585 | |
| 585 | 586 | /* |
| 586 | 587 | * Synapse Wireless product ids (FTDI_VID) |
| @@ -1567,6 +1568,13 @@ · 980 unmodified lines | ||
| 1567 | 1568 | #define UNJO_VID 0x22B7 |
| 1568 | 1569 | #define UNJO_ISODEBUG_V1_PID 0x150D |
| 1569 | 1570 | |
| 1571 | +/* | |
| 1572 | + * IDS GmbH | |
| 1573 | + */ | |
| 1574 | +#define IDS_VID 0x2CAF | |
| 1575 | +#define IDS_SI31A_PID 0x13A2 | |
| 1576 | +#define IDS_CM31A_PID 0x13A3 | |
| 1577 | + | |
| 1570 | 1578 | /* |
| 1571 | 1579 | * U-Blox products (http://www.u-blox.com). |
| 1572 | 1580 | */ |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | /* |
| 3 | − * USB ZyXEL omni.net LCD PLUS driver | |
| 3 | + * USB ZyXEL omni.net driver | |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2013,2017 Johan Hovold <johan@kernel.org> |
| 6 | 6 | * |
| @@ -22,10 +22,11 @@ · 15 unmodified lines | ||
| 22 | 22 | #include <linux/usb/serial.h> |
| 23 | 23 | |
| 24 | 24 | #define DRIVER_AUTHOR "Alessandro Zummo" |
| 25 | −#define DRIVER_DESC "USB ZyXEL omni.net LCD PLUS Driver" | |
| 25 | +#define DRIVER_DESC "USB ZyXEL omni.net Driver" | |
| 26 | 26 | |
| 27 | 27 | #define ZYXEL_VENDOR_ID 0x0586 |
| 28 | 28 | #define ZYXEL_OMNINET_ID 0x1000 |
| 29 | +#define ZYXEL_OMNI_56K_PLUS_ID 0x1500 | |
| 29 | 30 | /* This one seems to be a re-branded ZyXEL device */ |
| 30 | 31 | #define BT_IGNITIONPRO_ID 0x2000 |
| 31 | 32 | |
| @@ -40,6 +41,7 @@ static void omninet_port_remove(struct usb_serial_port *port); · 8 unmodified lines | ||
| 40 | 41 | |
| 41 | 42 | static const struct usb_device_id id_table[] = { |
| 42 | 43 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
| 44 | + { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNI_56K_PLUS_ID) }, | |
| 43 | 45 | { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) }, |
| 44 | 46 | { } /* Terminating entry */ |
| 45 | 47 | }; |
| @@ -50,7 +52,7 @@ static struct usb_serial_driver zyxel_omninet_device = { · 4 unmodified lines | ||
| 50 | 52 | .owner = THIS_MODULE, |
| 51 | 53 | .name = "omninet", |
| 52 | 54 | }, |
| 53 | − .description = "ZyXEL - omni.net lcd plus usb", | |
| 55 | + .description = "ZyXEL - omni.net usb", | |
| 54 | 56 | .id_table = id_table, |
| 55 | 57 | .num_bulk_out = 2, |
| 56 | 58 | .calc_num_ports = omninet_calc_num_ports, |
| @@ -1240,6 +1240,10 @@ static const struct usb_device_id option_ids[] = { · 1239 unmodified lines | ||
| 1240 | 1240 | .driver_info = NCTRL(0) | RSVD(1) }, |
| 1241 | 1241 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */ |
| 1242 | 1242 | .driver_info = NCTRL(0) }, |
| 1243 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7010, 0xff), /* Telit LE910-S1 (RNDIS) */ | |
| 1244 | + .driver_info = NCTRL(2) }, | |
| 1245 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */ | |
| 1246 | + .driver_info = NCTRL(2) }, | |
| 1243 | 1247 | { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ |
| 1244 | 1248 | .driver_info = NCTRL(0) | ZLP }, |
| 1245 | 1249 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
| @@ -113,6 +113,7 @@ static const struct usb_device_id id_table[] = { · 112 unmodified lines | ||
| 113 | 113 | { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, |
| 114 | 114 | { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, |
| 115 | 115 | { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, |
| 116 | + { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530GC_PRODUCT_ID) }, | |
| 116 | 117 | { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, |
| 117 | 118 | { USB_DEVICE(AT_VENDOR_ID, AT_VTKIT3_PRODUCT_ID) }, |
| 118 | 119 | { } /* Terminating entry */ |
| @@ -158,6 +158,7 @@ · 157 unmodified lines | ||
| 158 | 158 | /* ADLINK ND-6530 RS232,RS485 and RS422 adapter */ |
| 159 | 159 | #define ADLINK_VENDOR_ID 0x0b63 |
| 160 | 160 | #define ADLINK_ND6530_PRODUCT_ID 0x6530 |
| 161 | +#define ADLINK_ND6530GC_PRODUCT_ID 0x653a | |
| 161 | 162 | |
| 162 | 163 | /* SMART USB Serial Adapter */ |
| 163 | 164 | #define SMART_VENDOR_ID 0x0b8c |
| @@ -416,7 +416,7 @@ static void qt2_close(struct usb_serial_port *port) · 415 unmodified lines | ||
| 416 | 416 | |
| 417 | 417 | /* flush the port transmit buffer */ |
| 418 | 418 | i = usb_control_msg(serial->dev, |
| 419 | − usb_rcvctrlpipe(serial->dev, 0), | |
| 419 | + usb_sndctrlpipe(serial->dev, 0), | |
| 420 | 420 | QT2_FLUSH_DEVICE, 0x40, 1, |
| 421 | 421 | port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
| 422 | 422 | |
| @@ -426,7 +426,7 @@ static void qt2_close(struct usb_serial_port *port) · 3 unmodified lines | ||
| 426 | 426 | |
| 427 | 427 | /* flush the port receive buffer */ |
| 428 | 428 | i = usb_control_msg(serial->dev, |
| 429 | − usb_rcvctrlpipe(serial->dev, 0), | |
| 429 | + usb_sndctrlpipe(serial->dev, 0), | |
| 430 | 430 | QT2_FLUSH_DEVICE, 0x40, 0, |
| 431 | 431 | port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
| 432 | 432 | |
| @@ -639,7 +639,7 @@ static int qt2_attach(struct usb_serial *serial) · 206 unmodified lines | ||
| 639 | 639 | int status; |
| 640 | 640 | |
| 641 | 641 | /* power on unit */ |
| 642 | − status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | |
| 642 | + status = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | |
| 643 | 643 | 0xc2, 0x40, 0x8000, 0, NULL, 0, |
| 644 | 644 | QT2_USB_TIMEOUT); |
| 645 | 645 | if (status < 0) { |
| @@ -37,6 +37,7 @@ · 36 unmodified lines | ||
| 37 | 37 | /* Vendor and product ids */ |
| 38 | 38 | #define TI_VENDOR_ID 0x0451 |
| 39 | 39 | #define IBM_VENDOR_ID 0x04b3 |
| 40 | +#define STARTECH_VENDOR_ID 0x14b0 | |
| 40 | 41 | #define TI_3410_PRODUCT_ID 0x3410 |
| 41 | 42 | #define IBM_4543_PRODUCT_ID 0x4543 |
| 42 | 43 | #define IBM_454B_PRODUCT_ID 0x454b |
| @@ -370,6 +371,7 @@ static const struct usb_device_id ti_id_table_3410[] = { · 327 unmodified lines | ||
| 370 | 371 | { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) }, |
| 371 | 372 | { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) }, |
| 372 | 373 | { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) }, |
| 374 | + { USB_DEVICE(STARTECH_VENDOR_ID, TI_3410_PRODUCT_ID) }, | |
| 373 | 375 | { } /* terminator */ |
| 374 | 376 | }; |
| 375 | 377 | |
| @@ -408,6 +410,7 @@ static const struct usb_device_id ti_id_table_combined[] = { · 32 unmodified lines | ||
| 408 | 410 | { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) }, |
| 409 | 411 | { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) }, |
| 410 | 412 | { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) }, |
| 413 | + { USB_DEVICE(STARTECH_VENDOR_ID, TI_3410_PRODUCT_ID) }, | |
| 411 | 414 | { } /* terminator */ |
| 412 | 415 | }; |
| 413 | 416 | |
| @@ -191,6 +191,7 @@ static void *typec_mux_match(struct fwnode_handle *fwnode, const char *id, · 190 unmodified lines | ||
| 191 | 191 | bool match; |
| 192 | 192 | int nval; |
| 193 | 193 | u16 *val; |
| 194 | + int ret; | |
| 194 | 195 | int i; |
| 195 | 196 | |
| 196 | 197 | /* |
| @@ -218,10 +219,10 @@ static void *typec_mux_match(struct fwnode_handle *fwnode, const char *id, · 21 unmodified lines | ||
| 218 | 219 | if (!val) |
| 219 | 220 | return ERR_PTR(-ENOMEM); |
| 220 | 221 | |
| 221 | − nval = fwnode_property_read_u16_array(fwnode, "svid", val, nval); | |
| 222 | − if (nval < 0) { | |
| 222 | + ret = fwnode_property_read_u16_array(fwnode, "svid", val, nval); | |
| 223 | + if (ret < 0) { | |
| 223 | 224 | kfree(val); |
| 224 | − return ERR_PTR(nval); | |
| 225 | + return ERR_PTR(ret); | |
| 225 | 226 | } |
| 226 | 227 | |
| 227 | 228 | for (i = 0; i < nval; i++) { |
| @@ -238,7 +239,7 @@ find_mux: · 10 unmodified lines | ||
| 238 | 239 | dev = class_find_device(&typec_mux_class, NULL, fwnode, |
| 239 | 240 | mux_fwnode_match); |
| 240 | 241 | |
| 241 | − return dev ? to_typec_switch(dev) : ERR_PTR(-EPROBE_DEFER); | |
| 242 | + return dev ? to_typec_mux(dev) : ERR_PTR(-EPROBE_DEFER); | |
| 242 | 243 | } |
| 243 | 244 | |
| 244 | 245 | /** |
| @@ -582,10 +582,15 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc) · 581 unmodified lines | ||
| 582 | 582 | acpi_dev_free_resource_list(&resource_list); |
| 583 | 583 | |
| 584 | 584 | if (!pmc->iom_base) { |
| 585 | − put_device(&adev->dev); | |
| 585 | + acpi_dev_put(adev); | |
| 586 | 586 | return -ENOMEM; |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | + if (IS_ERR(pmc->iom_base)) { | |
| 590 | + acpi_dev_put(adev); | |
| 591 | + return PTR_ERR(pmc->iom_base); | |
| 592 | + } | |
| 593 | + | |
| 589 | 594 | pmc->iom_adev = adev; |
| 590 | 595 | |
| 591 | 596 | return 0; |
| @@ -636,8 +641,10 @@ static int pmc_usb_probe(struct platform_device *pdev) · 44 unmodified lines | ||
| 636 | 641 | break; |
| 637 | 642 | |
| 638 | 643 | ret = pmc_usb_register_port(pmc, i, fwnode); |
| 639 | − if (ret) | |
| 644 | + if (ret) { | |
| 645 | + fwnode_handle_put(fwnode); | |
| 640 | 646 | goto err_remove_ports; |
| 647 | + } | |
| 641 | 648 | } |
| 642 | 649 | |
| 643 | 650 | platform_set_drvdata(pdev, pmc); |
| @@ -651,7 +658,7 @@ err_remove_ports: · 7 unmodified lines | ||
| 651 | 658 | usb_role_switch_unregister(pmc->port[i].usb_sw); |
| 652 | 659 | } |
| 653 | 660 | |
| 654 | − put_device(&pmc->iom_adev->dev); | |
| 661 | + acpi_dev_put(pmc->iom_adev); | |
| 655 | 662 | |
| 656 | 663 | return ret; |
| 657 | 664 | } |
| @@ -667,7 +674,7 @@ static int pmc_usb_remove(struct platform_device *pdev) · 9 unmodified lines | ||
| 667 | 674 | usb_role_switch_unregister(pmc->port[i].usb_sw); |
| 668 | 675 | } |
| 669 | 676 | |
| 670 | − put_device(&pmc->iom_adev->dev); | |
| 677 | + acpi_dev_put(pmc->iom_adev); | |
| 671 | 678 | |
| 672 | 679 | return 0; |
| 673 | 680 | } |
| @@ -401,6 +401,8 @@ struct tcpm_port { · 400 unmodified lines | ||
| 401 | 401 | unsigned int nr_src_pdo; |
| 402 | 402 | u32 snk_pdo[PDO_MAX_OBJECTS]; |
| 403 | 403 | unsigned int nr_snk_pdo; |
| 404 | + u32 snk_vdo_v1[VDO_MAX_OBJECTS]; | |
| 405 | + unsigned int nr_snk_vdo_v1; | |
| 404 | 406 | u32 snk_vdo[VDO_MAX_OBJECTS]; |
| 405 | 407 | unsigned int nr_snk_vdo; |
| 406 | 408 | |
| @@ -1547,33 +1549,43 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev, · 1140 unmodified lines | ||
| 1547 | 1549 | if (PD_VDO_VID(p[0]) != USB_SID_PD) |
| 1548 | 1550 | break; |
| 1549 | 1551 | |
| 1550 | − if (PD_VDO_SVDM_VER(p[0]) < svdm_version) | |
| 1552 | + if (PD_VDO_SVDM_VER(p[0]) < svdm_version) { | |
| 1551 | 1553 | typec_partner_set_svdm_version(port->partner, |
| 1552 | 1554 | PD_VDO_SVDM_VER(p[0])); |
| 1553 | − /* 6.4.4.3.1: Only respond as UFP (device) */ | |
| 1554 | − if (port->data_role == TYPEC_DEVICE && | |
| 1555 | + svdm_version = PD_VDO_SVDM_VER(p[0]); | |
| 1556 | + } | |
| 1557 | + | |
| 1558 | + port->ams = DISCOVER_IDENTITY; | |
| 1559 | + /* | |
| 1560 | + * PD2.0 Spec 6.10.3: respond with NAK as DFP (data host) | |
| 1561 | + * PD3.1 Spec 6.4.4.2.5.1: respond with NAK if "invalid field" or | |
| 1562 | + * "wrong configuation" or "Unrecognized" | |
| 1563 | + */ | |
| 1564 | + if ((port->data_role == TYPEC_DEVICE || svdm_version >= SVDM_VER_2_0) && | |
| 1555 | 1565 | port->nr_snk_vdo) { |
| 1556 | − /* | |
| 1557 | − * Product Type DFP and Connector Type are not defined in SVDM | |
| 1558 | − * version 1.0 and shall be set to zero. | |
| 1559 | − */ | |
| 1560 | − if (typec_get_negotiated_svdm_version(typec) < SVDM_VER_2_0) | |
| 1561 | − response[1] = port->snk_vdo[0] & ~IDH_DFP_MASK | |
| 1562 | − & ~IDH_CONN_MASK; | |
| 1563 | − else | |
| 1564 | − response[1] = port->snk_vdo[0]; | |
| 1565 | − for (i = 1; i < port->nr_snk_vdo; i++) | |
| 1566 | − response[i + 1] = port->snk_vdo[i]; | |
| 1567 | − rlen = port->nr_snk_vdo + 1; | |
| 1566 | + if (svdm_version < SVDM_VER_2_0) { | |
| 1567 | + for (i = 0; i < port->nr_snk_vdo_v1; i++) | |
| 1568 | + response[i + 1] = port->snk_vdo_v1[i]; | |
| 1569 | + rlen = port->nr_snk_vdo_v1 + 1; | |
| 1570 | + | |
| 1571 | + } else { | |
| 1572 | + for (i = 0; i < port->nr_snk_vdo; i++) | |
| 1573 | + response[i + 1] = port->snk_vdo[i]; | |
| 1574 | + rlen = port->nr_snk_vdo + 1; | |
| 1575 | + } | |
| 1568 | 1576 | } |
| 1569 | 1577 | break; |
| 1570 | 1578 | case CMD_DISCOVER_SVID: |
| 1579 | + port->ams = DISCOVER_SVIDS; | |
| 1571 | 1580 | break; |
| 1572 | 1581 | case CMD_DISCOVER_MODES: |
| 1582 | + port->ams = DISCOVER_MODES; | |
| 1573 | 1583 | break; |
| 1574 | 1584 | case CMD_ENTER_MODE: |
| 1585 | + port->ams = DFP_TO_UFP_ENTER_MODE; | |
| 1575 | 1586 | break; |
| 1576 | 1587 | case CMD_EXIT_MODE: |
| 1588 | + port->ams = DFP_TO_UFP_EXIT_MODE; | |
| 1577 | 1589 | break; |
| 1578 | 1590 | case CMD_ATTENTION: |
| 1579 | 1591 | /* Attention command does not have response */ |
| @@ -1930,6 +1942,9 @@ static void vdm_run_state_machine(struct tcpm_port *port) · 350 unmodified lines | ||
| 1930 | 1942 | tcpm_log(port, "VDM Tx error, retry"); |
| 1931 | 1943 | port->vdm_retries++; |
| 1932 | 1944 | port->vdm_state = VDM_STATE_READY; |
| 1945 | + if (PD_VDO_SVDM(vdo_hdr) && PD_VDO_CMDT(vdo_hdr) == CMDT_INIT) | |
| 1946 | + tcpm_ams_finish(port); | |
| 1947 | + } else { | |
| 1933 | 1948 | tcpm_ams_finish(port); |
| 1934 | 1949 | } |
| 1935 | 1950 | break; |
| @@ -2176,20 +2191,25 @@ static void tcpm_handle_alert(struct tcpm_port *port, const __le32 *payload, · 240 unmodified lines | ||
| 2176 | 2191 | |
| 2177 | 2192 | if (!type) { |
| 2178 | 2193 | tcpm_log(port, "Alert message received with no type"); |
| 2194 | + tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP); | |
| 2179 | 2195 | return; |
| 2180 | 2196 | } |
| 2181 | 2197 | |
| 2182 | 2198 | /* Just handling non-battery alerts for now */ |
| 2183 | 2199 | if (!(type & USB_PD_ADO_TYPE_BATT_STATUS_CHANGE)) { |
| 2184 | − switch (port->state) { | |
| 2185 | − case SRC_READY: | |
| 2186 | − case SNK_READY: | |
| 2200 | + if (port->pwr_role == TYPEC_SOURCE) { | |
| 2201 | + port->upcoming_state = GET_STATUS_SEND; | |
| 2202 | + tcpm_ams_start(port, GETTING_SOURCE_SINK_STATUS); | |
| 2203 | + } else { | |
| 2204 | + /* | |
| 2205 | + * Do not check SinkTxOk here in case the Source doesn't set its Rp to | |
| 2206 | + * SinkTxOk in time. | |
| 2207 | + */ | |
| 2208 | + port->ams = GETTING_SOURCE_SINK_STATUS; | |
| 2187 | 2209 | tcpm_set_state(port, GET_STATUS_SEND, 0); |
| 2188 | − break; | |
| 2189 | − default: | |
| 2190 | − tcpm_queue_message(port, PD_MSG_CTRL_WAIT); | |
| 2191 | − break; | |
| 2192 | 2210 | } |
| 2211 | + } else { | |
| 2212 | + tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP); | |
| 2193 | 2213 | } |
| 2194 | 2214 | } |
| 2195 | 2215 | |
| @@ -2287,6 +2307,12 @@ static void tcpm_pd_data_request(struct tcpm_port *port, · 91 unmodified lines | ||
| 2287 | 2307 | bool frs_enable; |
| 2288 | 2308 | int ret; |
| 2289 | 2309 | |
| 2310 | + if (tcpm_vdm_ams(port) && type != PD_DATA_VENDOR_DEF) { | |
| 2311 | + port->vdm_state = VDM_STATE_ERR_BUSY; | |
| 2312 | + tcpm_ams_finish(port); | |
| 2313 | + mod_vdm_delayed_work(port, 0); | |
| 2314 | + } | |
| 2315 | + | |
| 2290 | 2316 | switch (type) { |
| 2291 | 2317 | case PD_DATA_SOURCE_CAP: |
| 2292 | 2318 | for (i = 0; i < cnt; i++) |
| @@ -2417,14 +2443,22 @@ static void tcpm_pd_data_request(struct tcpm_port *port, · 124 unmodified lines | ||
| 2417 | 2443 | NONE_AMS); |
| 2418 | 2444 | break; |
| 2419 | 2445 | case PD_DATA_VENDOR_DEF: |
| 2420 | − tcpm_handle_vdm_request(port, msg->payload, cnt); | |
| 2446 | + if (tcpm_vdm_ams(port) || port->nr_snk_vdo) | |
| 2447 | + tcpm_handle_vdm_request(port, msg->payload, cnt); | |
| 2448 | + else if (port->negotiated_rev > PD_REV20) | |
| 2449 | + tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS); | |
| 2421 | 2450 | break; |
| 2422 | 2451 | case PD_DATA_BIST: |
| 2423 | 2452 | port->bist_request = le32_to_cpu(msg->payload[0]); |
| 2424 | 2453 | tcpm_pd_handle_state(port, BIST_RX, BIST, 0); |
| 2425 | 2454 | break; |
| 2426 | 2455 | case PD_DATA_ALERT: |
| 2427 | − tcpm_handle_alert(port, msg->payload, cnt); | |
| 2456 | + if (port->state != SRC_READY && port->state != SNK_READY) | |
| 2457 | + tcpm_pd_handle_state(port, port->pwr_role == TYPEC_SOURCE ? | |
| 2458 | + SRC_SOFT_RESET_WAIT_SNK_TX : SNK_SOFT_RESET, | |
| 2459 | + NONE_AMS, 0); | |
| 2460 | + else | |
| 2461 | + tcpm_handle_alert(port, msg->payload, cnt); | |
| 2428 | 2462 | break; |
| 2429 | 2463 | case PD_DATA_BATT_STATUS: |
| 2430 | 2464 | case PD_DATA_GET_COUNTRY_INFO: |
111 more lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 170 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 189 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 378 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 145 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 142 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 158 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 347 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 136 lines aren’t shown here.
This diff is large: its 233 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 212 lines aren’t shown here.
This diff is large: its 171 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 316 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 218 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 286 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 329 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 158 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 290 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 294 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 229 lines aren’t shown here.
This diff is large: its 351 lines aren’t shown here.
This diff is large: its 362 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 786 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 217 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 362 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 573 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 1038 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 222 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.