We need the USB fixes in here, and it resolves a merge conflict in: drivers/usb/dwc3/dwc3-pci.c
Unified · Split
| @@ -333,6 +333,9 @@ Rémi Denis-Courmont <rdenis@simphalempin.com> · 332 unmodified lines | ||
| 333 | 333 | Ricardo Ribalda <ribalda@kernel.org> <ricardo@ribalda.com> |
| 334 | 334 | Ricardo Ribalda <ribalda@kernel.org> Ricardo Ribalda Delgado <ribalda@kernel.org> |
| 335 | 335 | Ricardo Ribalda <ribalda@kernel.org> <ricardo.ribalda@gmail.com> |
| 336 | +Roman Gushchin <roman.gushchin@linux.dev> <guro@fb.com> | |
| 337 | +Roman Gushchin <roman.gushchin@linux.dev> <guroan@gmail.com> | |
| 338 | +Roman Gushchin <roman.gushchin@linux.dev> <klamm@yandex-team.ru> | |
| 336 | 339 | Ross Zwisler <zwisler@kernel.org> <ross.zwisler@linux.intel.com> |
| 337 | 340 | Rudolf Marek <R.Marek@sh.cvut.cz> |
| 338 | 341 | Rui Saraiva <rmps@joel.ist.utl.pt> |
| @@ -468,6 +468,7 @@ Description: · 467 unmodified lines | ||
| 468 | 468 | auto: Charge normally, respect thresholds |
| 469 | 469 | inhibit-charge: Do not charge while AC is attached |
| 470 | 470 | force-discharge: Force discharge while AC is attached |
| 471 | + ================ ==================================== | |
| 471 | 472 | |
| 472 | 473 | What: /sys/class/power_supply/<supply_name>/technology |
| 473 | 474 | Date: May 2007 |
| @@ -130,3 +130,11 @@ accesses to DMA buffers in both privileged "supervisor" and unprivileged · 129 unmodified lines | ||
| 130 | 130 | subsystem that the buffer is fully accessible at the elevated privilege |
| 131 | 131 | level (and ideally inaccessible or at least read-only at the |
| 132 | 132 | lesser-privileged levels). |
| 133 | + | |
| 134 | +DMA_ATTR_OVERWRITE | |
| 135 | +------------------ | |
| 136 | + | |
| 137 | +This is a hint to the DMA-mapping subsystem that the device is expected to | |
| 138 | +overwrite the entire mapped size, thus the caller does not require any of the | |
| 139 | +previous buffer contents to be preserved. This allows bounce-buffering | |
| 140 | +implementations to optimise DMA_FROM_DEVICE transfers. | |
| @@ -75,6 +75,9 @@ And optionally · 74 unmodified lines | ||
| 75 | 75 | .resume - A pointer to a per-policy resume function which is called |
| 76 | 76 | with interrupts disabled and _before_ the governor is started again. |
| 77 | 77 | |
| 78 | + .ready - A pointer to a per-policy ready function which is called after | |
| 79 | + the policy is fully initialized. | |
| 80 | + | |
| 78 | 81 | .attr - A pointer to a NULL-terminated list of "struct freq_attr" which |
| 79 | 82 | allow to export values to sysfs. |
| 80 | 83 | |
| @@ -7,7 +7,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines | ||
| 7 | 7 | title: SiFive GPIO controller |
| 8 | 8 | |
| 9 | 9 | maintainers: |
| 10 | − - Yash Shah <yash.shah@sifive.com> | |
| 11 | 10 | - Paul Walmsley <paul.walmsley@sifive.com> |
| 12 | 11 | |
| 13 | 12 | properties: |
| @@ -20,7 +20,7 @@ description: | · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | maintainers: |
| 22 | 22 | - Kishon Vijay Abraham I <kishon@ti.com> |
| 23 | − - Roger Quadros <rogerq@ti.com | |
| 23 | + - Roger Quadros <rogerq@kernel.org> | |
| 24 | 24 | |
| 25 | 25 | properties: |
| 26 | 26 | compatible: |
| @@ -8,7 +8,7 @@ title: OMAP USB2 PHY · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | maintainers: |
| 10 | 10 | - Kishon Vijay Abraham I <kishon@ti.com> |
| 11 | − - Roger Quadros <rogerq@ti.com> | |
| 11 | + - Roger Quadros <rogerq@kernel.org> | |
| 12 | 12 | |
| 13 | 13 | properties: |
| 14 | 14 | compatible: |
| @@ -8,7 +8,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 7 unmodified lines | ||
| 8 | 8 | title: SiFive PWM controller |
| 9 | 9 | |
| 10 | 10 | maintainers: |
| 11 | − - Yash Shah <yash.shah@sifive.com> | |
| 12 | 11 | - Sagar Kadam <sagar.kadam@sifive.com> |
| 13 | 12 | - Paul Walmsley <paul.walmsley@sifive.com> |
| 14 | 13 | |
| @@ -9,7 +9,6 @@ title: SiFive L2 Cache Controller · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | maintainers: |
| 11 | 11 | - Sagar Kadam <sagar.kadam@sifive.com> |
| 12 | − - Yash Shah <yash.shah@sifive.com> | |
| 13 | 12 | - Paul Walmsley <paul.walmsley@sifive.com> |
| 14 | 13 | |
| 15 | 14 | description: |
| @@ -8,6 +8,7 @@ title: Audio codec controlled by ChromeOS EC · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | maintainers: |
| 10 | 10 | - Cheng-Yi Chiang <cychiang@chromium.org> |
| 11 | + - Tzung-Bi Shih <tzungbi@google.com> | |
| 11 | 12 | |
| 12 | 13 | description: | |
| 13 | 14 | Google's ChromeOS EC codec is a digital mic codec provided by the |
| @@ -7,7 +7,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#" · 6 unmodified lines | ||
| 7 | 7 | title: Bindings for the TI wrapper module for the Cadence USBSS-DRD controller |
| 8 | 8 | |
| 9 | 9 | maintainers: |
| 10 | − - Roger Quadros <rogerq@ti.com> | |
| 10 | + - Roger Quadros <rogerq@kernel.org> | |
| 11 | 11 | |
| 12 | 12 | properties: |
| 13 | 13 | compatible: |
| @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines | ||
| 7 | 7 | title: TI Keystone Soc USB Controller |
| 8 | 8 | |
| 9 | 9 | maintainers: |
| 10 | − - Roger Quadros <rogerq@ti.com> | |
| 10 | + - Roger Quadros <rogerq@kernel.org> | |
| 11 | 11 | |
| 12 | 12 | properties: |
| 13 | 13 | compatible: |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | Set the histogram bucket size (default *1*). |
| 4 | 4 | |
| 5 | −**-e**, **--entries** *N* | |
| 5 | +**-E**, **--entries** *N* | |
| 6 | 6 | |
| 7 | 7 | Set the number of entries of the histogram (default 256). |
| 8 | 8 | |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | The **rtla osnoise** tool is an interface for the *osnoise* tracer. The |
| 2 | 2 | *osnoise* tracer dispatches a kernel thread per-cpu. These threads read the |
| 3 | 3 | time in a loop while with preemption, softirq and IRQs enabled, thus |
| 4 | −allowing all the sources of operating systme noise during its execution. | |
| 4 | +allowing all the sources of operating system noise during its execution. | |
| 5 | 5 | The *osnoise*'s tracer threads take note of the delta between each time |
| 6 | 6 | read, along with an interference counter of all sources of interference. |
| 7 | 7 | At the end of each period, the *osnoise* tracer displays a summary of |
| @@ -36,7 +36,7 @@ default). The reason for reducing the runtime is to avoid starving the · 35 unmodified lines | ||
| 36 | 36 | **rtla** tool. The tool is also set to run for *one minute*. The output |
| 37 | 37 | histogram is set to group outputs in buckets of *10us* and *25* entries:: |
| 38 | 38 | |
| 39 | − [root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -e 25 | |
| 39 | + [root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -E 25 | |
| 40 | 40 | # RTLA osnoise histogram |
| 41 | 41 | # Time unit is microseconds (us) |
| 42 | 42 | # Duration: 0 00:01:00 |
| @@ -84,6 +84,8 @@ CPUfreq核心层注册一个cpufreq_driver结构体。 · 83 unmodified lines | ||
| 84 | 84 | .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次启动前被 |
| 85 | 85 | 调用。 |
| 86 | 86 | |
| 87 | + .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。 | |
| 88 | + | |
| 87 | 89 | .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该列表允许导出值到 |
| 88 | 90 | sysfs。 |
| 89 | 91 | |
| @@ -1394,7 +1394,7 @@ documentation when it pops into existence). · 1393 unmodified lines | ||
| 1394 | 1394 | ------------------- |
| 1395 | 1395 | |
| 1396 | 1396 | :Capability: KVM_CAP_ENABLE_CAP |
| 1397 | −:Architectures: mips, ppc, s390 | |
| 1397 | +:Architectures: mips, ppc, s390, x86 | |
| 1398 | 1398 | :Type: vcpu ioctl |
| 1399 | 1399 | :Parameters: struct kvm_enable_cap (in) |
| 1400 | 1400 | :Returns: 0 on success; -1 on error |
| @@ -6997,6 +6997,20 @@ indicated by the fd to the VM this is called on. · 5596 unmodified lines | ||
| 6997 | 6997 | This is intended to support intra-host migration of VMs between userspace VMMs, |
| 6998 | 6998 | upgrading the VMM process without interrupting the guest. |
| 6999 | 6999 | |
| 7000 | +7.30 KVM_CAP_PPC_AIL_MODE_3 | |
| 7001 | +------------------------------- | |
| 7002 | + | |
| 7003 | +:Capability: KVM_CAP_PPC_AIL_MODE_3 | |
| 7004 | +:Architectures: ppc | |
| 7005 | +:Type: vm | |
| 7006 | + | |
| 7007 | +This capability indicates that the kernel supports the mode 3 setting for the | |
| 7008 | +"Address Translation Mode on Interrupt" aka "Alternate Interrupt Location" | |
| 7009 | +resource that is controlled with the H_SET_MODE hypercall. | |
| 7010 | + | |
| 7011 | +This capability allows a guest kernel to use a better-performance mode for | |
| 7012 | +handling interrupts and system calls. | |
| 7013 | + | |
| 7000 | 7014 | 8. Other capabilities. |
| 7001 | 7015 | ====================== |
| 7002 | 7016 | |
| @@ -3139,11 +3139,9 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/ath5k · 3138 unmodified lines | ||
| 3139 | 3139 | F: drivers/net/wireless/ath/ath5k/ |
| 3140 | 3140 | |
| 3141 | 3141 | ATHEROS ATH6KL WIRELESS DRIVER |
| 3142 | −M: Kalle Valo <kvalo@kernel.org> | |
| 3143 | 3142 | L: linux-wireless@vger.kernel.org |
| 3144 | −S: Supported | |
| 3143 | +S: Orphan | |
| 3145 | 3144 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl |
| 3146 | −T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git | |
| 3147 | 3145 | F: drivers/net/wireless/ath/ath6kl/ |
| 3148 | 3146 | |
| 3149 | 3147 | ATI_REMOTE2 DRIVER |
| @@ -4549,6 +4547,7 @@ F: drivers/platform/chrome/ · 1399 unmodified lines | ||
| 4549 | 4547 | |
| 4550 | 4548 | CHROMEOS EC CODEC DRIVER |
| 4551 | 4549 | M: Cheng-Yi Chiang <cychiang@chromium.org> |
| 4550 | +M: Tzung-Bi Shih <tzungbi@google.com> | |
| 4552 | 4551 | R: Guenter Roeck <groeck@chromium.org> |
| 4553 | 4552 | S: Maintained |
| 4554 | 4553 | F: Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml |
| @@ -4914,7 +4913,8 @@ F: kernel/cgroup/cpuset.c · 359 unmodified lines | ||
| 4914 | 4913 | CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) |
| 4915 | 4914 | M: Johannes Weiner <hannes@cmpxchg.org> |
| 4916 | 4915 | M: Michal Hocko <mhocko@kernel.org> |
| 4917 | −M: Vladimir Davydov <vdavydov.dev@gmail.com> | |
| 4916 | +M: Roman Gushchin <roman.gushchin@linux.dev> | |
| 4917 | +M: Shakeel Butt <shakeelb@google.com> | |
| 4918 | 4918 | L: cgroups@vger.kernel.org |
| 4919 | 4919 | L: linux-mm@kvack.org |
| 4920 | 4920 | S: Maintained |
| @@ -7012,12 +7012,6 @@ L: linux-edac@vger.kernel.org · 2091 unmodified lines | ||
| 7012 | 7012 | S: Maintained |
| 7013 | 7013 | F: drivers/edac/sb_edac.c |
| 7014 | 7014 | |
| 7015 | −EDAC-SIFIVE | |
| 7016 | −M: Yash Shah <yash.shah@sifive.com> | |
| 7017 | −L: linux-edac@vger.kernel.org | |
| 7018 | −S: Supported | |
| 7019 | −F: drivers/edac/sifive_edac.c | |
| 7020 | − | |
| 7021 | 7015 | EDAC-SKYLAKE |
| 7022 | 7016 | M: Tony Luck <tony.luck@intel.com> |
| 7023 | 7017 | L: linux-edac@vger.kernel.org |
| @@ -7188,7 +7182,7 @@ F: drivers/net/can/usb/etas_es58x/ · 164 unmodified lines | ||
| 7188 | 7182 | |
| 7189 | 7183 | ETHERNET BRIDGE |
| 7190 | 7184 | M: Roopa Prabhu <roopa@nvidia.com> |
| 7191 | −M: Nikolay Aleksandrov <nikolay@nvidia.com> | |
| 7185 | +M: Nikolay Aleksandrov <razor@blackwall.org> | |
| 7192 | 7186 | L: bridge@lists.linux-foundation.org (moderated for non-subscribers) |
| 7193 | 7187 | L: netdev@vger.kernel.org |
| 7194 | 7188 | S: Maintained |
| @@ -9264,6 +9258,15 @@ S: Maintained · 2069 unmodified lines | ||
| 9264 | 9258 | W: https://github.com/o2genum/ideapad-slidebar |
| 9265 | 9259 | F: drivers/input/misc/ideapad_slidebar.c |
| 9266 | 9260 | |
| 9261 | +IDMAPPED MOUNTS | |
| 9262 | +M: Christian Brauner <brauner@kernel.org> | |
| 9263 | +L: linux-fsdevel@vger.kernel.org | |
| 9264 | +S: Maintained | |
| 9265 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git | |
| 9266 | +F: Documentation/filesystems/idmappings.rst | |
| 9267 | +F: tools/testing/selftests/mount_setattr/ | |
| 9268 | +F: include/linux/mnt_idmapping.h | |
| 9269 | + | |
| 9267 | 9270 | IDT VersaClock 5 CLOCK DRIVER |
| 9268 | 9271 | M: Luca Ceresoli <luca@lucaceresoli.net> |
| 9269 | 9272 | S: Maintained |
| @@ -15147,7 +15150,7 @@ M: Ingo Molnar <mingo@redhat.com> · 5877 unmodified lines | ||
| 15147 | 15150 | M: Arnaldo Carvalho de Melo <acme@kernel.org> |
| 15148 | 15151 | R: Mark Rutland <mark.rutland@arm.com> |
| 15149 | 15152 | R: Alexander Shishkin <alexander.shishkin@linux.intel.com> |
| 15150 | −R: Jiri Olsa <jolsa@redhat.com> | |
| 15153 | +R: Jiri Olsa <jolsa@kernel.org> | |
| 15151 | 15154 | R: Namhyung Kim <namhyung@kernel.org> |
| 15152 | 15155 | L: linux-perf-users@vger.kernel.org |
| 15153 | 15156 | L: linux-kernel@vger.kernel.org |
| @@ -15565,6 +15568,7 @@ M: Iurii Zaikin <yzaikin@google.com> · 411 unmodified lines | ||
| 15565 | 15568 | L: linux-kernel@vger.kernel.org |
| 15566 | 15569 | L: linux-fsdevel@vger.kernel.org |
| 15567 | 15570 | S: Maintained |
| 15571 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git sysctl-next | |
| 15568 | 15572 | F: fs/proc/proc_sysctl.c |
| 15569 | 15573 | F: include/linux/sysctl.h |
| 15570 | 15574 | F: kernel/sysctl-test.c |
| @@ -15920,6 +15924,7 @@ S: Supported · 349 unmodified lines | ||
| 15920 | 15924 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k |
| 15921 | 15925 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git |
| 15922 | 15926 | F: drivers/net/wireless/ath/ath10k/ |
| 15927 | +F: Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | |
| 15923 | 15928 | |
| 15924 | 15929 | QUALCOMM ATHEROS ATH11K WIRELESS DRIVER |
| 15925 | 15930 | M: Kalle Valo <kvalo@kernel.org> |
| @@ -15927,11 +15932,12 @@ L: ath11k@lists.infradead.org · 1 unmodified line | ||
| 15927 | 15932 | S: Supported |
| 15928 | 15933 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git |
| 15929 | 15934 | F: drivers/net/wireless/ath/ath11k/ |
| 15935 | +F: Documentation/devicetree/bindings/net/wireless/qcom,ath11k.txt | |
| 15930 | 15936 | |
| 15931 | 15937 | QUALCOMM ATHEROS ATH9K WIRELESS DRIVER |
| 15932 | −M: ath9k-devel@qca.qualcomm.com | |
| 15938 | +M: Toke Høiland-Jørgensen <toke@toke.dk> | |
| 15933 | 15939 | L: linux-wireless@vger.kernel.org |
| 15934 | −S: Supported | |
| 15940 | +S: Maintained | |
| 15935 | 15941 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath9k |
| 15936 | 15942 | F: Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml |
| 15937 | 15943 | F: drivers/net/wireless/ath/ath9k/ |
| @@ -16006,14 +16012,6 @@ F: Documentation/devicetree/bindings/misc/qcom,fastrpc.txt · 68 unmodified lines | ||
| 16006 | 16012 | F: drivers/misc/fastrpc.c |
| 16007 | 16013 | F: include/uapi/misc/fastrpc.h |
| 16008 | 16014 | |
| 16009 | −QUALCOMM GENERIC INTERFACE I2C DRIVER | |
| 16010 | −M: Akash Asthana <akashast@codeaurora.org> | |
| 16011 | −M: Mukesh Savaliya <msavaliy@codeaurora.org> | |
| 16012 | −L: linux-i2c@vger.kernel.org | |
| 16013 | −L: linux-arm-msm@vger.kernel.org | |
| 16014 | −S: Supported | |
| 16015 | −F: drivers/i2c/busses/i2c-qcom-geni.c | |
| 16016 | − | |
| 16017 | 16015 | QUALCOMM HEXAGON ARCHITECTURE |
| 16018 | 16016 | M: Brian Cain <bcain@codeaurora.org> |
| 16019 | 16017 | L: linux-hexagon@vger.kernel.org |
| @@ -16085,8 +16083,8 @@ F: Documentation/devicetree/bindings/mtd/qcom,nandc.yaml · 65 unmodified lines | ||
| 16085 | 16083 | F: drivers/mtd/nand/raw/qcom_nandc.c |
| 16086 | 16084 | |
| 16087 | 16085 | QUALCOMM RMNET DRIVER |
| 16088 | −M: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> | |
| 16089 | −M: Sean Tranchetti <stranche@codeaurora.org> | |
| 16086 | +M: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com> | |
| 16087 | +M: Sean Tranchetti <quic_stranche@quicinc.com> | |
| 16090 | 16088 | L: netdev@vger.kernel.org |
| 16091 | 16089 | S: Maintained |
| 16092 | 16090 | F: Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst |
| @@ -16112,11 +16110,10 @@ F: Documentation/devicetree/bindings/media/*venus* · 19 unmodified lines | ||
| 16112 | 16110 | F: drivers/media/platform/qcom/venus/ |
| 16113 | 16111 | |
| 16114 | 16112 | QUALCOMM WCN36XX WIRELESS DRIVER |
| 16115 | −M: Kalle Valo <kvalo@kernel.org> | |
| 16113 | +M: Loic Poulain <loic.poulain@linaro.org> | |
| 16116 | 16114 | L: wcn36xx@lists.infradead.org |
| 16117 | 16115 | S: Supported |
| 16118 | 16116 | W: https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx |
| 16119 | −T: git git://github.com/KrasnikovEugene/wcn36xx.git | |
| 16120 | 16117 | F: drivers/net/wireless/ath/wcn36xx/ |
| 16121 | 16118 | |
| 16122 | 16119 | QUANTENNA QTNFMAC WIRELESS DRIVER |
| @@ -16379,6 +16376,7 @@ F: drivers/watchdog/realtek_otto_wdt.c · 256 unmodified lines | ||
| 16379 | 16376 | |
| 16380 | 16377 | REALTEK RTL83xx SMI DSA ROUTER CHIPS |
| 16381 | 16378 | M: Linus Walleij <linus.walleij@linaro.org> |
| 16379 | +M: Alvin Šipraga <alsi@bang-olufsen.dk> | |
| 16382 | 16380 | S: Maintained |
| 16383 | 16381 | F: Documentation/devicetree/bindings/net/dsa/realtek-smi.txt |
| 16384 | 16382 | F: drivers/net/dsa/realtek-smi* |
| @@ -17772,8 +17770,10 @@ M: David Rientjes <rientjes@google.com> · 1387 unmodified lines | ||
| 17772 | 17770 | M: Joonsoo Kim <iamjoonsoo.kim@lge.com> |
| 17773 | 17771 | M: Andrew Morton <akpm@linux-foundation.org> |
| 17774 | 17772 | M: Vlastimil Babka <vbabka@suse.cz> |
| 17773 | +R: Roman Gushchin <roman.gushchin@linux.dev> | |
| 17775 | 17774 | L: linux-mm@kvack.org |
| 17776 | 17775 | S: Maintained |
| 17776 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git | |
| 17777 | 17777 | F: include/linux/sl?b*.h |
| 17778 | 17778 | F: mm/sl?b* |
| 17779 | 17779 | |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 17 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc4 | |
| 5 | +EXTRAVERSION = -rc6 | |
| 6 | 6 | NAME = Superb Owl |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| @@ -106,7 +106,7 @@ · 105 unmodified lines | ||
| 106 | 106 | msr_s SYS_ICC_SRE_EL2, x0 |
| 107 | 107 | isb // Make sure SRE is now set |
| 108 | 108 | mrs_s x0, SYS_ICC_SRE_EL2 // Read SRE back, |
| 109 | − tbz x0, #0, 1f // and check that it sticks | |
| 109 | + tbz x0, #0, .Lskip_gicv3_\@ // and check that it sticks | |
| 110 | 110 | msr_s SYS_ICH_HCR_EL2, xzr // Reset ICC_HCR_EL2 to defaults |
| 111 | 111 | .Lskip_gicv3_\@: |
| 112 | 112 | .endm |
| @@ -248,6 +248,8 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, · 247 unmodified lines | ||
| 248 | 248 | IRQCHIP_STATE_PENDING, |
| 249 | 249 | &val); |
| 250 | 250 | WARN_RATELIMIT(err, "IRQ %d", irq->host_irq); |
| 251 | + } else if (vgic_irq_is_mapped_level(irq)) { | |
| 252 | + val = vgic_get_phys_line_level(irq); | |
| 251 | 253 | } else { |
| 252 | 254 | val = irq_is_pending(irq); |
| 253 | 255 | } |
| @@ -12,6 +12,14 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <asm/barrier.h> |
| 13 | 13 | #include <linux/atomic.h> |
| 14 | 14 | |
| 15 | +/* compiler build environment sanity checks: */ | |
| 16 | +#if !defined(CONFIG_64BIT) && defined(__LP64__) | |
| 17 | +#error "Please use 'ARCH=parisc' to build the 32-bit kernel." | |
| 18 | +#endif | |
| 19 | +#if defined(CONFIG_64BIT) && !defined(__LP64__) | |
| 20 | +#error "Please use 'ARCH=parisc64' to build the 64-bit kernel." | |
| 21 | +#endif | |
| 22 | + | |
| 15 | 23 | /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion |
| 16 | 24 | * on use of volatile and __*_bit() (set/clear/change): |
| 17 | 25 | * *_bit() want use of volatile. |
| @@ -89,8 +89,8 @@ struct exception_table_entry { · 88 unmodified lines | ||
| 89 | 89 | __asm__("1: " ldx " 0(" sr "%2),%0\n" \ |
| 90 | 90 | "9:\n" \ |
| 91 | 91 | ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ |
| 92 | − : "=r"(__gu_val), "=r"(__gu_err) \ | |
| 93 | − : "r"(ptr), "1"(__gu_err)); \ | |
| 92 | + : "=r"(__gu_val), "+r"(__gu_err) \ | |
| 93 | + : "r"(ptr)); \ | |
| 94 | 94 | \ |
| 95 | 95 | (val) = (__force __typeof__(*(ptr))) __gu_val; \ |
| 96 | 96 | } |
| @@ -123,8 +123,8 @@ struct exception_table_entry { · 26 unmodified lines | ||
| 123 | 123 | "9:\n" \ |
| 124 | 124 | ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ |
| 125 | 125 | ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \ |
| 126 | − : "=&r"(__gu_tmp.l), "=r"(__gu_err) \ | |
| 127 | − : "r"(ptr), "1"(__gu_err)); \ | |
| 126 | + : "=&r"(__gu_tmp.l), "+r"(__gu_err) \ | |
| 127 | + : "r"(ptr)); \ | |
| 128 | 128 | \ |
| 129 | 129 | (val) = __gu_tmp.t; \ |
| 130 | 130 | } |
| @@ -135,13 +135,12 @@ struct exception_table_entry { · 4 unmodified lines | ||
| 135 | 135 | #define __put_user_internal(sr, x, ptr) \ |
| 136 | 136 | ({ \ |
| 137 | 137 | ASM_EXCEPTIONTABLE_VAR(__pu_err); \ |
| 138 | − __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \ | |
| 139 | 138 | \ |
| 140 | 139 | switch (sizeof(*(ptr))) { \ |
| 141 | − case 1: __put_user_asm(sr, "stb", __x, ptr); break; \ | |
| 142 | − case 2: __put_user_asm(sr, "sth", __x, ptr); break; \ | |
| 143 | − case 4: __put_user_asm(sr, "stw", __x, ptr); break; \ | |
| 144 | − case 8: STD_USER(sr, __x, ptr); break; \ | |
| 140 | + case 1: __put_user_asm(sr, "stb", x, ptr); break; \ | |
| 141 | + case 2: __put_user_asm(sr, "sth", x, ptr); break; \ | |
| 142 | + case 4: __put_user_asm(sr, "stw", x, ptr); break; \ | |
| 143 | + case 8: STD_USER(sr, x, ptr); break; \ | |
| 145 | 144 | default: BUILD_BUG(); \ |
| 146 | 145 | } \ |
| 147 | 146 | \ |
| @@ -150,7 +149,9 @@ struct exception_table_entry { · 2 unmodified lines | ||
| 150 | 149 | |
| 151 | 150 | #define __put_user(x, ptr) \ |
| 152 | 151 | ({ \ |
| 153 | − __put_user_internal("%%sr3,", x, ptr); \ | |
| 152 | + __typeof__(&*(ptr)) __ptr = ptr; \ | |
| 153 | + __typeof__(*(__ptr)) __x = (__typeof__(*(__ptr)))(x); \ | |
| 154 | + __put_user_internal("%%sr3,", __x, __ptr); \ | |
| 154 | 155 | }) |
| 155 | 156 | |
| 156 | 157 | #define __put_kernel_nofault(dst, src, type, err_label) \ |
| @@ -180,8 +181,8 @@ struct exception_table_entry { · 23 unmodified lines | ||
| 180 | 181 | "1: " stx " %2,0(" sr "%1)\n" \ |
| 181 | 182 | "9:\n" \ |
| 182 | 183 | ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ |
| 183 | − : "=r"(__pu_err) \ | |
| 184 | − : "r"(ptr), "r"(x), "0"(__pu_err)) | |
| 184 | + : "+r"(__pu_err) \ | |
| 185 | + : "r"(ptr), "r"(x)) | |
| 185 | 186 | |
| 186 | 187 | |
| 187 | 188 | #if !defined(CONFIG_64BIT) |
| @@ -193,8 +194,8 @@ struct exception_table_entry { · 5 unmodified lines | ||
| 193 | 194 | "9:\n" \ |
| 194 | 195 | ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ |
| 195 | 196 | ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \ |
| 196 | − : "=r"(__pu_err) \ | |
| 197 | − : "r"(ptr), "r"(__val), "0"(__pu_err)); \ | |
| 197 | + : "+r"(__pu_err) \ | |
| 198 | + : "r"(ptr), "r"(__val)); \ | |
| 198 | 199 | } while (0) |
| 199 | 200 | |
| 200 | 201 | #endif /* !defined(CONFIG_64BIT) */ |
| @@ -340,7 +340,7 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop) · 339 unmodified lines | ||
| 340 | 340 | : "r" (val), "r" (regs->ior), "r" (regs->isr) |
| 341 | 341 | : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); |
| 342 | 342 | |
| 343 | − return 0; | |
| 343 | + return ret; | |
| 344 | 344 | } |
| 345 | 345 | static int emulate_std(struct pt_regs *regs, int frreg, int flop) |
| 346 | 346 | { |
| @@ -397,7 +397,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 50 unmodified lines | ||
| 397 | 397 | __asm__ __volatile__ ( |
| 398 | 398 | " mtsp %4, %%sr1\n" |
| 399 | 399 | " zdep %2, 29, 2, %%r19\n" |
| 400 | −" dep %%r0, 31, 2, %2\n" | |
| 400 | +" dep %%r0, 31, 2, %3\n" | |
| 401 | 401 | " mtsar %%r19\n" |
| 402 | 402 | " zvdepi -2, 32, %%r19\n" |
| 403 | 403 | "1: ldw 0(%%sr1,%3),%%r20\n" |
| @@ -409,7 +409,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 5 unmodified lines | ||
| 409 | 409 | " andcm %%r21, %%r19, %%r21\n" |
| 410 | 410 | " or %1, %%r20, %1\n" |
| 411 | 411 | " or %2, %%r21, %2\n" |
| 412 | −"3: stw %1,0(%%sr1,%1)\n" | |
| 412 | +"3: stw %1,0(%%sr1,%3)\n" | |
| 413 | 413 | "4: stw %%r1,4(%%sr1,%3)\n" |
| 414 | 414 | "5: stw %2,8(%%sr1,%3)\n" |
| 415 | 415 | " copy %%r0, %0\n" |
| @@ -596,7 +596,6 @@ void handle_unaligned(struct pt_regs *regs) · 180 unmodified lines | ||
| 596 | 596 | ret = ERR_NOTHANDLED; /* "undefined", but lets kill them. */ |
| 597 | 597 | break; |
| 598 | 598 | } |
| 599 | −#ifdef CONFIG_PA20 | |
| 600 | 599 | switch (regs->iir & OPCODE2_MASK) |
| 601 | 600 | { |
| 602 | 601 | case OPCODE_FLDD_L: |
| @@ -607,22 +606,23 @@ void handle_unaligned(struct pt_regs *regs) · 4 unmodified lines | ||
| 607 | 606 | flop=1; |
| 608 | 607 | ret = emulate_std(regs, R2(regs->iir),1); |
| 609 | 608 | break; |
| 609 | +#ifdef CONFIG_PA20 | |
| 610 | 610 | case OPCODE_LDD_L: |
| 611 | 611 | ret = emulate_ldd(regs, R2(regs->iir),0); |
| 612 | 612 | break; |
| 613 | 613 | case OPCODE_STD_L: |
| 614 | 614 | ret = emulate_std(regs, R2(regs->iir),0); |
| 615 | 615 | break; |
| 616 | − } | |
| 617 | 616 | #endif |
| 617 | + } | |
| 618 | 618 | switch (regs->iir & OPCODE3_MASK) |
| 619 | 619 | { |
| 620 | 620 | case OPCODE_FLDW_L: |
| 621 | 621 | flop=1; |
| 622 | − ret = emulate_ldw(regs, R2(regs->iir),0); | |
| 622 | + ret = emulate_ldw(regs, R2(regs->iir), 1); | |
| 623 | 623 | break; |
| 624 | 624 | case OPCODE_LDW_M: |
| 625 | − ret = emulate_ldw(regs, R2(regs->iir),1); | |
| 625 | + ret = emulate_ldw(regs, R2(regs->iir), 0); | |
| 626 | 626 | break; |
| 627 | 627 | |
| 628 | 628 | case OPCODE_FSTW_L: |
| @@ -346,6 +346,16 @@ u64 ioread64be(const void __iomem *addr) · 345 unmodified lines | ||
| 346 | 346 | return *((u64 *)addr); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | +u64 ioread64_lo_hi(const void __iomem *addr) | |
| 350 | +{ | |
| 351 | + u32 low, high; | |
| 352 | + | |
| 353 | + low = ioread32(addr); | |
| 354 | + high = ioread32(addr + sizeof(u32)); | |
| 355 | + | |
| 356 | + return low + ((u64)high << 32); | |
| 357 | +} | |
| 358 | + | |
| 349 | 359 | u64 ioread64_hi_lo(const void __iomem *addr) |
| 350 | 360 | { |
| 351 | 361 | u32 low, high; |
| @@ -419,6 +429,12 @@ void iowrite64be(u64 datum, void __iomem *addr) · 67 unmodified lines | ||
| 419 | 429 | } |
| 420 | 430 | } |
| 421 | 431 | |
| 432 | +void iowrite64_lo_hi(u64 val, void __iomem *addr) | |
| 433 | +{ | |
| 434 | + iowrite32(val, addr); | |
| 435 | + iowrite32(val >> 32, addr + sizeof(u32)); | |
| 436 | +} | |
| 437 | + | |
| 422 | 438 | void iowrite64_hi_lo(u64 val, void __iomem *addr) |
| 423 | 439 | { |
| 424 | 440 | iowrite32(val >> 32, addr + sizeof(u32)); |
| @@ -530,6 +546,7 @@ EXPORT_SYMBOL(ioread32); · 105 unmodified lines | ||
| 530 | 546 | EXPORT_SYMBOL(ioread32be); |
| 531 | 547 | EXPORT_SYMBOL(ioread64); |
| 532 | 548 | EXPORT_SYMBOL(ioread64be); |
| 549 | +EXPORT_SYMBOL(ioread64_lo_hi); | |
| 533 | 550 | EXPORT_SYMBOL(ioread64_hi_lo); |
| 534 | 551 | EXPORT_SYMBOL(iowrite8); |
| 535 | 552 | EXPORT_SYMBOL(iowrite16); |
| @@ -538,6 +555,7 @@ EXPORT_SYMBOL(iowrite32); · 2 unmodified lines | ||
| 538 | 555 | EXPORT_SYMBOL(iowrite32be); |
| 539 | 556 | EXPORT_SYMBOL(iowrite64); |
| 540 | 557 | EXPORT_SYMBOL(iowrite64be); |
| 558 | +EXPORT_SYMBOL(iowrite64_lo_hi); | |
| 541 | 559 | EXPORT_SYMBOL(iowrite64_hi_lo); |
| 542 | 560 | EXPORT_SYMBOL(ioread8_rep); |
| 543 | 561 | EXPORT_SYMBOL(ioread16_rep); |
| @@ -337,9 +337,9 @@ static void __init setup_bootmem(void) · 336 unmodified lines | ||
| 337 | 337 | |
| 338 | 338 | static bool kernel_set_to_readonly; |
| 339 | 339 | |
| 340 | −static void __init map_pages(unsigned long start_vaddr, | |
| 341 | − unsigned long start_paddr, unsigned long size, | |
| 342 | − pgprot_t pgprot, int force) | |
| 340 | +static void __ref map_pages(unsigned long start_vaddr, | |
| 341 | + unsigned long start_paddr, unsigned long size, | |
| 342 | + pgprot_t pgprot, int force) | |
| 343 | 343 | { |
| 344 | 344 | pmd_t *pmd; |
| 345 | 345 | pte_t *pg_table; |
| @@ -449,7 +449,7 @@ void __init set_kernel_text_rw(int enable_read_write) · 103 unmodified lines | ||
| 449 | 449 | flush_tlb_all(); |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | −void __ref free_initmem(void) | |
| 452 | +void free_initmem(void) | |
| 453 | 453 | { |
| 454 | 454 | unsigned long init_begin = (unsigned long)__init_begin; |
| 455 | 455 | unsigned long init_end = (unsigned long)__init_end; |
| @@ -463,7 +463,6 @@ void __ref free_initmem(void) · 7 unmodified lines | ||
| 463 | 463 | /* The init text pages are marked R-X. We have to |
| 464 | 464 | * flush the icache and mark them RW- |
| 465 | 465 | * |
| 466 | − * This is tricky, because map_pages is in the init section. | |
| 467 | 466 | * Do a dummy remap of the data section first (the data |
| 468 | 467 | * section is already PAGE_KERNEL) to pull in the TLB entries |
| 469 | 468 | * for map_kernel */ |
| @@ -421,14 +421,14 @@ InstructionTLBMiss: · 420 unmodified lines | ||
| 421 | 421 | */ |
| 422 | 422 | /* Get PTE (linux-style) and check access */ |
| 423 | 423 | mfspr r3,SPRN_IMISS |
| 424 | −#ifdef CONFIG_MODULES | |
| 424 | +#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE) | |
| 425 | 425 | lis r1, TASK_SIZE@h /* check if kernel address */ |
| 426 | 426 | cmplw 0,r1,r3 |
| 427 | 427 | #endif |
| 428 | 428 | mfspr r2, SPRN_SDR1 |
| 429 | 429 | li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER |
| 430 | 430 | rlwinm r2, r2, 28, 0xfffff000 |
| 431 | −#ifdef CONFIG_MODULES | |
| 431 | +#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE) | |
| 432 | 432 | bgt- 112f |
| 433 | 433 | lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ |
| 434 | 434 | li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC |
| @@ -3264,12 +3264,14 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op) · 3263 unmodified lines | ||
| 3264 | 3264 | case BARRIER_EIEIO: |
| 3265 | 3265 | eieio(); |
| 3266 | 3266 | break; |
| 3267 | +#ifdef CONFIG_PPC64 | |
| 3267 | 3268 | case BARRIER_LWSYNC: |
| 3268 | 3269 | asm volatile("lwsync" : : : "memory"); |
| 3269 | 3270 | break; |
| 3270 | 3271 | case BARRIER_PTESYNC: |
| 3271 | 3272 | asm volatile("ptesync" : : : "memory"); |
| 3272 | 3273 | break; |
| 3274 | +#endif | |
| 3273 | 3275 | } |
| 3274 | 3276 | break; |
| 3275 | 3277 | |
| @@ -23,7 +23,7 @@ CONFIG_SLOB=y · 22 unmodified lines | ||
| 23 | 23 | CONFIG_SOC_CANAAN=y |
| 24 | 24 | CONFIG_SMP=y |
| 25 | 25 | CONFIG_NR_CPUS=2 |
| 26 | −CONFIG_CMDLINE="earlycon console=ttySIF0 rootdelay=2 root=/dev/mmcblk0p1 ro" | |
| 26 | +CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p1 rootwait ro" | |
| 27 | 27 | CONFIG_CMDLINE_FORCE=y |
| 28 | 28 | # CONFIG_SECCOMP is not set |
| 29 | 29 | # CONFIG_STACKPROTECTOR is not set |
| @@ -51,6 +51,8 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o · 50 unmodified lines | ||
| 51 | 51 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o |
| 52 | 52 | obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o |
| 53 | 53 | |
| 54 | +obj-$(CONFIG_TRACE_IRQFLAGS) += trace_irq.o | |
| 55 | + | |
| 54 | 56 | obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o |
| 55 | 57 | obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o |
| 56 | 58 | obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o |
| @@ -108,7 +108,7 @@ _save_context: · 107 unmodified lines | ||
| 108 | 108 | .option pop |
| 109 | 109 | |
| 110 | 110 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 111 | − call trace_hardirqs_off | |
| 111 | + call __trace_hardirqs_off | |
| 112 | 112 | #endif |
| 113 | 113 | |
| 114 | 114 | #ifdef CONFIG_CONTEXT_TRACKING |
| @@ -143,7 +143,7 @@ skip_context_tracking: · 28 unmodified lines | ||
| 143 | 143 | li t0, EXC_BREAKPOINT |
| 144 | 144 | beq s4, t0, 1f |
| 145 | 145 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 146 | − call trace_hardirqs_on | |
| 146 | + call __trace_hardirqs_on | |
| 147 | 147 | #endif |
| 148 | 148 | csrs CSR_STATUS, SR_IE |
| 149 | 149 | |
| @@ -234,7 +234,7 @@ ret_from_exception: · 84 unmodified lines | ||
| 234 | 234 | REG_L s0, PT_STATUS(sp) |
| 235 | 235 | csrc CSR_STATUS, SR_IE |
| 236 | 236 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 237 | − call trace_hardirqs_off | |
| 237 | + call __trace_hardirqs_off | |
| 238 | 238 | #endif |
| 239 | 239 | #ifdef CONFIG_RISCV_M_MODE |
| 240 | 240 | /* the MPP value is too large to be used as an immediate arg for addi */ |
| @@ -270,10 +270,10 @@ restore_all: · 29 unmodified lines | ||
| 270 | 270 | REG_L s1, PT_STATUS(sp) |
| 271 | 271 | andi t0, s1, SR_PIE |
| 272 | 272 | beqz t0, 1f |
| 273 | − call trace_hardirqs_on | |
| 273 | + call __trace_hardirqs_on | |
| 274 | 274 | j 2f |
| 275 | 275 | 1: |
| 276 | − call trace_hardirqs_off | |
| 276 | + call __trace_hardirqs_off | |
| 277 | 277 | 2: |
| 278 | 278 | #endif |
| 279 | 279 | REG_L a0, PT_STATUS(sp) |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | * Copyright (c) 2020 Western Digital Corporation or its affiliates. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +#include <linux/bits.h> | |
| 8 | 9 | #include <linux/init.h> |
| 9 | 10 | #include <linux/pm.h> |
| 10 | 11 | #include <linux/reboot.h> |
| @@ -85,7 +86,7 @@ static unsigned long __sbi_v01_cpumask_to_hartmask(const struct cpumask *cpu_mas · 74 unmodified lines | ||
| 85 | 86 | pr_warn("Unable to send any request to hartid > BITS_PER_LONG for SBI v0.1\n"); |
| 86 | 87 | break; |
| 87 | 88 | } |
| 88 | − hmask |= 1 << hartid; | |
| 89 | + hmask |= BIT(hartid); | |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | 92 | return hmask; |
| @@ -160,7 +161,7 @@ static int __sbi_send_ipi_v01(const struct cpumask *cpu_mask) · 68 unmodified lines | ||
| 160 | 161 | { |
| 161 | 162 | unsigned long hart_mask; |
| 162 | 163 | |
| 163 | − if (!cpu_mask) | |
| 164 | + if (!cpu_mask || cpumask_empty(cpu_mask)) | |
| 164 | 165 | cpu_mask = cpu_online_mask; |
| 165 | 166 | hart_mask = __sbi_v01_cpumask_to_hartmask(cpu_mask); |
| 166 | 167 | |
| @@ -176,7 +177,7 @@ static int __sbi_rfence_v01(int fid, const struct cpumask *cpu_mask, · 9 unmodified lines | ||
| 176 | 177 | int result = 0; |
| 177 | 178 | unsigned long hart_mask; |
| 178 | 179 | |
| 179 | − if (!cpu_mask) | |
| 180 | + if (!cpu_mask || cpumask_empty(cpu_mask)) | |
| 180 | 181 | cpu_mask = cpu_online_mask; |
| 181 | 182 | hart_mask = __sbi_v01_cpumask_to_hartmask(cpu_mask); |
| 182 | 183 | |
| @@ -249,26 +250,37 @@ static void __sbi_set_timer_v02(uint64_t stime_value) · 66 unmodified lines | ||
| 249 | 250 | |
| 250 | 251 | static int __sbi_send_ipi_v02(const struct cpumask *cpu_mask) |
| 251 | 252 | { |
| 252 | − unsigned long hartid, cpuid, hmask = 0, hbase = 0; | |
| 253 | + unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0; | |
| 253 | 254 | struct sbiret ret = {0}; |
| 254 | 255 | int result; |
| 255 | 256 | |
| 256 | − if (!cpu_mask) | |
| 257 | + if (!cpu_mask || cpumask_empty(cpu_mask)) | |
| 257 | 258 | cpu_mask = cpu_online_mask; |
| 258 | 259 | |
| 259 | 260 | for_each_cpu(cpuid, cpu_mask) { |
| 260 | 261 | hartid = cpuid_to_hartid_map(cpuid); |
| 261 | − if (hmask && ((hbase + BITS_PER_LONG) <= hartid)) { | |
| 262 | − ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI, | |
| 263 | − hmask, hbase, 0, 0, 0, 0); | |
| 264 | − if (ret.error) | |
| 265 | − goto ecall_failed; | |
| 266 | − hmask = 0; | |
| 267 | − hbase = 0; | |
| 262 | + if (hmask) { | |
| 263 | + if (hartid + BITS_PER_LONG <= htop || | |
| 264 | + hbase + BITS_PER_LONG <= hartid) { | |
| 265 | + ret = sbi_ecall(SBI_EXT_IPI, | |
| 266 | + SBI_EXT_IPI_SEND_IPI, hmask, | |
| 267 | + hbase, 0, 0, 0, 0); | |
| 268 | + if (ret.error) | |
| 269 | + goto ecall_failed; | |
| 270 | + hmask = 0; | |
| 271 | + } else if (hartid < hbase) { | |
| 272 | + /* shift the mask to fit lower hartid */ | |
| 273 | + hmask <<= hbase - hartid; | |
| 274 | + hbase = hartid; | |
| 275 | + } | |
| 268 | 276 | } |
| 269 | − if (!hmask) | |
| 277 | + if (!hmask) { | |
| 270 | 278 | hbase = hartid; |
| 271 | − hmask |= 1UL << (hartid - hbase); | |
| 279 | + htop = hartid; | |
| 280 | + } else if (hartid > htop) { | |
| 281 | + htop = hartid; | |
| 282 | + } | |
| 283 | + hmask |= BIT(hartid - hbase); | |
| 272 | 284 | } |
| 273 | 285 | |
| 274 | 286 | if (hmask) { |
| @@ -344,25 +356,35 @@ static int __sbi_rfence_v02(int fid, const struct cpumask *cpu_mask, · 69 unmodified lines | ||
| 344 | 356 | unsigned long start, unsigned long size, |
| 345 | 357 | unsigned long arg4, unsigned long arg5) |
| 346 | 358 | { |
| 347 | − unsigned long hartid, cpuid, hmask = 0, hbase = 0; | |
| 359 | + unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0; | |
| 348 | 360 | int result; |
| 349 | 361 | |
| 350 | − if (!cpu_mask) | |
| 362 | + if (!cpu_mask || cpumask_empty(cpu_mask)) | |
| 351 | 363 | cpu_mask = cpu_online_mask; |
| 352 | 364 | |
| 353 | 365 | for_each_cpu(cpuid, cpu_mask) { |
| 354 | 366 | hartid = cpuid_to_hartid_map(cpuid); |
| 355 | − if (hmask && ((hbase + BITS_PER_LONG) <= hartid)) { | |
| 356 | − result = __sbi_rfence_v02_call(fid, hmask, hbase, | |
| 357 | − start, size, arg4, arg5); | |
| 358 | − if (result) | |
| 359 | − return result; | |
| 360 | − hmask = 0; | |
| 361 | − hbase = 0; | |
| 367 | + if (hmask) { | |
| 368 | + if (hartid + BITS_PER_LONG <= htop || | |
| 369 | + hbase + BITS_PER_LONG <= hartid) { | |
| 370 | + result = __sbi_rfence_v02_call(fid, hmask, | |
| 371 | + hbase, start, size, arg4, arg5); | |
| 372 | + if (result) | |
| 373 | + return result; | |
| 374 | + hmask = 0; | |
| 375 | + } else if (hartid < hbase) { | |
| 376 | + /* shift the mask to fit lower hartid */ | |
| 377 | + hmask <<= hbase - hartid; | |
| 378 | + hbase = hartid; | |
| 379 | + } | |
| 362 | 380 | } |
| 363 | − if (!hmask) | |
| 381 | + if (!hmask) { | |
| 364 | 382 | hbase = hartid; |
| 365 | − hmask |= 1UL << (hartid - hbase); | |
| 383 | + htop = hartid; | |
| 384 | + } else if (hartid > htop) { | |
| 385 | + htop = hartid; | |
| 386 | + } | |
| 387 | + hmask |= BIT(hartid - hbase); | |
| 366 | 388 | } |
| 367 | 389 | |
| 368 | 390 | if (hmask) { |
| @@ -0,0 +1,27 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com> | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#include <linux/irqflags.h> | |
| 7 | +#include <linux/kprobes.h> | |
| 8 | +#include "trace_irq.h" | |
| 9 | + | |
| 10 | +/* | |
| 11 | + * trace_hardirqs_on/off require the caller to setup frame pointer properly. | |
| 12 | + * Otherwise, CALLER_ADDR1 might trigger an pagging exception in kernel. | |
| 13 | + * Here we add one extra level so they can be safely called by low | |
| 14 | + * level entry code which $fp is used for other purpose. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +void __trace_hardirqs_on(void) | |
| 18 | +{ | |
| 19 | + trace_hardirqs_on(); | |
| 20 | +} | |
| 21 | +NOKPROBE_SYMBOL(__trace_hardirqs_on); | |
| 22 | + | |
| 23 | +void __trace_hardirqs_off(void) | |
| 24 | +{ | |
| 25 | + trace_hardirqs_off(); | |
| 26 | +} | |
| 27 | +NOKPROBE_SYMBOL(__trace_hardirqs_off); | |
| @@ -0,0 +1,11 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com> | |
| 4 | + */ | |
| 5 | +#ifndef __TRACE_IRQ_H | |
| 6 | +#define __TRACE_IRQ_H | |
| 7 | + | |
| 8 | +void __trace_hardirqs_on(void); | |
| 9 | +void __trace_hardirqs_off(void); | |
| 10 | + | |
| 11 | +#endif /* __TRACE_IRQ_H */ | |
| @@ -703,7 +703,6 @@ struct kvm_vcpu_arch { · 702 unmodified lines | ||
| 703 | 703 | struct fpu_guest guest_fpu; |
| 704 | 704 | |
| 705 | 705 | u64 xcr0; |
| 706 | − u64 guest_supported_xcr0; | |
| 707 | 706 | |
| 708 | 707 | struct kvm_pio_request pio; |
| 709 | 708 | void *pio_data; |
| @@ -476,6 +476,7 @@ · 475 unmodified lines | ||
| 476 | 476 | #define MSR_AMD64_ICIBSEXTDCTL 0xc001103c |
| 477 | 477 | #define MSR_AMD64_IBSOPDATA4 0xc001103d |
| 478 | 478 | #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */ |
| 479 | +#define MSR_AMD64_SVM_AVIC_DOORBELL 0xc001011b | |
| 479 | 480 | #define MSR_AMD64_VM_PAGE_FLUSH 0xc001011e |
| 480 | 481 | #define MSR_AMD64_SEV_ES_GHCB 0xc0010130 |
| 481 | 482 | #define MSR_AMD64_SEV 0xc0010131 |
| @@ -220,6 +220,42 @@ struct __attribute__ ((__packed__)) vmcb_control_area { · 219 unmodified lines | ||
| 220 | 220 | #define SVM_NESTED_CTL_SEV_ENABLE BIT(1) |
| 221 | 221 | #define SVM_NESTED_CTL_SEV_ES_ENABLE BIT(2) |
| 222 | 222 | |
| 223 | + | |
| 224 | +/* AVIC */ | |
| 225 | +#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF) | |
| 226 | +#define AVIC_LOGICAL_ID_ENTRY_VALID_BIT 31 | |
| 227 | +#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31) | |
| 228 | + | |
| 229 | +#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL) | |
| 230 | +#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12) | |
| 231 | +#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62) | |
| 232 | +#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63) | |
| 233 | +#define AVIC_PHYSICAL_ID_TABLE_SIZE_MASK (0xFF) | |
| 234 | + | |
| 235 | +#define AVIC_DOORBELL_PHYSICAL_ID_MASK (0xFF) | |
| 236 | + | |
| 237 | +#define AVIC_UNACCEL_ACCESS_WRITE_MASK 1 | |
| 238 | +#define AVIC_UNACCEL_ACCESS_OFFSET_MASK 0xFF0 | |
| 239 | +#define AVIC_UNACCEL_ACCESS_VECTOR_MASK 0xFFFFFFFF | |
| 240 | + | |
| 241 | +enum avic_ipi_failure_cause { | |
| 242 | + AVIC_IPI_FAILURE_INVALID_INT_TYPE, | |
| 243 | + AVIC_IPI_FAILURE_TARGET_NOT_RUNNING, | |
| 244 | + AVIC_IPI_FAILURE_INVALID_TARGET, | |
| 245 | + AVIC_IPI_FAILURE_INVALID_BACKING_PAGE, | |
| 246 | +}; | |
| 247 | + | |
| 248 | + | |
| 249 | +/* | |
| 250 | + * 0xff is broadcast, so the max index allowed for physical APIC ID | |
| 251 | + * table is 0xfe. APIC IDs above 0xff are reserved. | |
| 252 | + */ | |
| 253 | +#define AVIC_MAX_PHYSICAL_ID_COUNT 0xff | |
| 254 | + | |
| 255 | +#define AVIC_HPA_MASK ~((0xFFFULL << 52) | 0xFFF) | |
| 256 | +#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL | |
| 257 | + | |
| 258 | + | |
| 223 | 259 | struct vmcb_seg { |
| 224 | 260 | u16 selector; |
| 225 | 261 | u16 attrib; |
| @@ -344,10 +344,8 @@ static void sgx_reclaim_pages(void) · 343 unmodified lines | ||
| 344 | 344 | { |
| 345 | 345 | struct sgx_epc_page *chunk[SGX_NR_TO_SCAN]; |
| 346 | 346 | struct sgx_backing backing[SGX_NR_TO_SCAN]; |
| 347 | − struct sgx_epc_section *section; | |
| 348 | 347 | struct sgx_encl_page *encl_page; |
| 349 | 348 | struct sgx_epc_page *epc_page; |
| 350 | − struct sgx_numa_node *node; | |
| 351 | 349 | pgoff_t page_index; |
| 352 | 350 | int cnt = 0; |
| 353 | 351 | int ret; |
| @@ -418,13 +416,7 @@ skip: · 64 unmodified lines | ||
| 418 | 416 | kref_put(&encl_page->encl->refcount, sgx_encl_release); |
| 419 | 417 | epc_page->flags &= ~SGX_EPC_PAGE_RECLAIMER_TRACKED; |
| 420 | 418 | |
| 421 | − section = &sgx_epc_sections[epc_page->section]; | |
| 422 | − node = section->node; | |
| 423 | − | |
| 424 | − spin_lock(&node->lock); | |
| 425 | − list_add_tail(&epc_page->list, &node->free_page_list); | |
| 426 | − spin_unlock(&node->lock); | |
| 427 | − atomic_long_inc(&sgx_nr_free_pages); | |
| 419 | + sgx_free_epc_page(epc_page); | |
| 428 | 420 | } |
| 429 | 421 | } |
| 430 | 422 | |
| @@ -91,11 +91,9 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, · 90 unmodified lines | ||
| 91 | 91 | const void *kbuf, const void __user *ubuf) |
| 92 | 92 | { |
| 93 | 93 | struct fpu *fpu = &target->thread.fpu; |
| 94 | − struct user32_fxsr_struct newstate; | |
| 94 | + struct fxregs_state newstate; | |
| 95 | 95 | int ret; |
| 96 | 96 | |
| 97 | − BUILD_BUG_ON(sizeof(newstate) != sizeof(struct fxregs_state)); | |
| 98 | − | |
| 99 | 97 | if (!cpu_feature_enabled(X86_FEATURE_FXSR)) |
| 100 | 98 | return -ENODEV; |
| 101 | 99 | |
| @@ -116,9 +114,10 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, · 14 unmodified lines | ||
| 116 | 114 | /* Copy the state */ |
| 117 | 115 | memcpy(&fpu->fpstate->regs.fxsave, &newstate, sizeof(newstate)); |
| 118 | 116 | |
| 119 | − /* Clear xmm8..15 */ | |
| 117 | + /* Clear xmm8..15 for 32-bit callers */ | |
| 120 | 118 | BUILD_BUG_ON(sizeof(fpu->__fpstate.regs.fxsave.xmm_space) != 16 * 16); |
| 121 | − memset(&fpu->fpstate->regs.fxsave.xmm_space[8], 0, 8 * 16); | |
| 119 | + if (in_ia32_syscall()) | |
| 120 | + memset(&fpu->fpstate->regs.fxsave.xmm_space[8*4], 0, 8 * 16); | |
| 122 | 121 | |
| 123 | 122 | /* Mark FP and SSE as in use when XSAVE is enabled */ |
| 124 | 123 | if (use_xsave()) |
| @@ -1558,7 +1558,10 @@ static int fpstate_realloc(u64 xfeatures, unsigned int ksize, · 1557 unmodified lines | ||
| 1558 | 1558 | fpregs_restore_userregs(); |
| 1559 | 1559 | |
| 1560 | 1560 | newfps->xfeatures = curfps->xfeatures | xfeatures; |
| 1561 | − newfps->user_xfeatures = curfps->user_xfeatures | xfeatures; | |
| 1561 | + | |
| 1562 | + if (!guest_fpu) | |
| 1563 | + newfps->user_xfeatures = curfps->user_xfeatures | xfeatures; | |
| 1564 | + | |
| 1562 | 1565 | newfps->xfd = curfps->xfd & ~xfeatures; |
| 1563 | 1566 | |
| 1564 | 1567 | /* Do the final updates within the locked region */ |
| @@ -462,19 +462,22 @@ static bool pv_tlb_flush_supported(void) · 461 unmodified lines | ||
| 462 | 462 | { |
| 463 | 463 | return (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && |
| 464 | 464 | !kvm_para_has_hint(KVM_HINTS_REALTIME) && |
| 465 | − kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)); | |
| 465 | + kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) && | |
| 466 | + (num_possible_cpus() != 1)); | |
| 466 | 467 | } |
| 467 | 468 | |
| 468 | 469 | static bool pv_ipi_supported(void) |
| 469 | 470 | { |
| 470 | − return kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI); | |
| 471 | + return (kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI) && | |
| 472 | + (num_possible_cpus() != 1)); | |
| 471 | 473 | } |
| 472 | 474 | |
| 473 | 475 | static bool pv_sched_yield_supported(void) |
| 474 | 476 | { |
| 475 | 477 | return (kvm_para_has_feature(KVM_FEATURE_PV_SCHED_YIELD) && |
| 476 | 478 | !kvm_para_has_hint(KVM_HINTS_REALTIME) && |
| 477 | − kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)); | |
| 479 | + kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) && | |
| 480 | + (num_possible_cpus() != 1)); | |
| 478 | 481 | } |
| 479 | 482 | |
| 480 | 483 | #define KVM_IPI_CLUSTER_SIZE (2 * BITS_PER_LONG) |
| @@ -1224,7 +1224,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = { · 1223 unmodified lines | ||
| 1224 | 1224 | }, |
| 1225 | 1225 | [REGSET_FP] = { |
| 1226 | 1226 | .core_note_type = NT_PRFPREG, |
| 1227 | − .n = sizeof(struct user_i387_struct) / sizeof(long), | |
| 1227 | + .n = sizeof(struct fxregs_state) / sizeof(long), | |
| 1228 | 1228 | .size = sizeof(long), .align = sizeof(long), |
| 1229 | 1229 | .active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set |
| 1230 | 1230 | }, |
| @@ -1271,7 +1271,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = { · 40 unmodified lines | ||
| 1271 | 1271 | }, |
| 1272 | 1272 | [REGSET_XFP] = { |
| 1273 | 1273 | .core_note_type = NT_PRXFPREG, |
| 1274 | − .n = sizeof(struct user32_fxsr_struct) / sizeof(u32), | |
| 1274 | + .n = sizeof(struct fxregs_state) / sizeof(u32), | |
| 1275 | 1275 | .size = sizeof(u32), .align = sizeof(u32), |
| 1276 | 1276 | .active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set |
| 1277 | 1277 | }, |
| @@ -282,6 +282,7 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 281 unmodified lines | ||
| 282 | 282 | { |
| 283 | 283 | struct kvm_lapic *apic = vcpu->arch.apic; |
| 284 | 284 | struct kvm_cpuid_entry2 *best; |
| 285 | + u64 guest_supported_xcr0; | |
| 285 | 286 | |
| 286 | 287 | best = kvm_find_cpuid_entry(vcpu, 1, 0); |
| 287 | 288 | if (best && apic) { |
| @@ -293,9 +294,11 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 5 unmodified lines | ||
| 293 | 294 | kvm_apic_set_version(vcpu); |
| 294 | 295 | } |
| 295 | 296 | |
| 296 | − vcpu->arch.guest_supported_xcr0 = | |
| 297 | + guest_supported_xcr0 = | |
| 297 | 298 | cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent); |
| 298 | 299 | |
| 300 | + vcpu->arch.guest_fpu.fpstate->user_xfeatures = guest_supported_xcr0; | |
| 301 | + | |
| 299 | 302 | kvm_update_pv_runtime(vcpu); |
| 300 | 303 | |
| 301 | 304 | vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu); |
| @@ -2306,7 +2306,12 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu) · 2305 unmodified lines | ||
| 2306 | 2306 | apic->irr_pending = true; |
| 2307 | 2307 | apic->isr_count = 1; |
| 2308 | 2308 | } else { |
| 2309 | − apic->irr_pending = (apic_search_irr(apic) != -1); | |
| 2309 | + /* | |
| 2310 | + * Don't clear irr_pending, searching the IRR can race with | |
| 2311 | + * updates from the CPU as APICv is still active from hardware's | |
| 2312 | + * perspective. The flag will be cleared as appropriate when | |
| 2313 | + * KVM injects the interrupt. | |
| 2314 | + */ | |
| 2310 | 2315 | apic->isr_count = count_vectors(apic->regs + APIC_ISR); |
| 2311 | 2316 | } |
| 2312 | 2317 | } |
| @@ -3889,12 +3889,23 @@ static void shadow_page_table_clear_flood(struct kvm_vcpu *vcpu, gva_t addr) · 3888 unmodified lines | ||
| 3889 | 3889 | walk_shadow_page_lockless_end(vcpu); |
| 3890 | 3890 | } |
| 3891 | 3891 | |
| 3892 | +static u32 alloc_apf_token(struct kvm_vcpu *vcpu) | |
| 3893 | +{ | |
| 3894 | + /* make sure the token value is not 0 */ | |
| 3895 | + u32 id = vcpu->arch.apf.id; | |
| 3896 | + | |
| 3897 | + if (id << 12 == 0) | |
| 3898 | + vcpu->arch.apf.id = 1; | |
| 3899 | + | |
| 3900 | + return (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id; | |
| 3901 | +} | |
| 3902 | + | |
| 3892 | 3903 | static bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, |
| 3893 | 3904 | gfn_t gfn) |
| 3894 | 3905 | { |
| 3895 | 3906 | struct kvm_arch_async_pf arch; |
| 3896 | 3907 | |
| 3897 | − arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id; | |
| 3908 | + arch.token = alloc_apf_token(vcpu); | |
| 3898 | 3909 | arch.gfn = gfn; |
| 3899 | 3910 | arch.direct_map = vcpu->arch.mmu->direct_map; |
| 3900 | 3911 | arch.cr3 = vcpu->arch.mmu->get_guest_pgd(vcpu); |
| @@ -95,7 +95,7 @@ static void kvm_perf_overflow(struct perf_event *perf_event, · 94 unmodified lines | ||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, |
| 98 | − unsigned config, bool exclude_user, | |
| 98 | + u64 config, bool exclude_user, | |
| 99 | 99 | bool exclude_kernel, bool intr, |
| 100 | 100 | bool in_tx, bool in_tx_cp) |
| 101 | 101 | { |
| @@ -181,7 +181,8 @@ static int cmp_u64(const void *a, const void *b) · 79 unmodified lines | ||
| 181 | 181 | |
| 182 | 182 | void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) |
| 183 | 183 | { |
| 184 | − unsigned config, type = PERF_TYPE_RAW; | |
| 184 | + u64 config; | |
| 185 | + u32 type = PERF_TYPE_RAW; | |
| 185 | 186 | struct kvm *kvm = pmc->vcpu->kvm; |
| 186 | 187 | struct kvm_pmu_event_filter *filter; |
| 187 | 188 | bool allow_event = true; |
| @@ -220,7 +221,7 @@ void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) · 32 unmodified lines | ||
| 220 | 221 | } |
| 221 | 222 | |
| 222 | 223 | if (type == PERF_TYPE_RAW) |
| 223 | − config = eventsel & X86_RAW_EVENT_MASK; | |
| 224 | + config = eventsel & AMD64_RAW_EVENT_MASK; | |
| 224 | 225 | |
| 225 | 226 | if (pmc->current_config == eventsel && pmc_resume_counter(pmc)) |
| 226 | 227 | return; |
| @@ -27,20 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | #include "irq.h" |
| 28 | 28 | #include "svm.h" |
| 29 | 29 | |
| 30 | −#define SVM_AVIC_DOORBELL 0xc001011b | |
| 31 | − | |
| 32 | −#define AVIC_HPA_MASK ~((0xFFFULL << 52) | 0xFFF) | |
| 33 | − | |
| 34 | −/* | |
| 35 | − * 0xff is broadcast, so the max index allowed for physical APIC ID | |
| 36 | − * table is 0xfe. APIC IDs above 0xff are reserved. | |
| 37 | − */ | |
| 38 | −#define AVIC_MAX_PHYSICAL_ID_COUNT 255 | |
| 39 | − | |
| 40 | −#define AVIC_UNACCEL_ACCESS_WRITE_MASK 1 | |
| 41 | −#define AVIC_UNACCEL_ACCESS_OFFSET_MASK 0xFF0 | |
| 42 | −#define AVIC_UNACCEL_ACCESS_VECTOR_MASK 0xFFFFFFFF | |
| 43 | − | |
| 44 | 30 | /* AVIC GATAG is encoded using VM and VCPU IDs */ |
| 45 | 31 | #define AVIC_VCPU_ID_BITS 8 |
| 46 | 32 | #define AVIC_VCPU_ID_MASK ((1 << AVIC_VCPU_ID_BITS) - 1) |
| @@ -73,12 +59,6 @@ struct amd_svm_iommu_ir { · 26 unmodified lines | ||
| 73 | 59 | void *data; /* Storing pointer to struct amd_ir_data */ |
| 74 | 60 | }; |
| 75 | 61 | |
| 76 | −enum avic_ipi_failure_cause { | |
| 77 | − AVIC_IPI_FAILURE_INVALID_INT_TYPE, | |
| 78 | − AVIC_IPI_FAILURE_TARGET_NOT_RUNNING, | |
| 79 | − AVIC_IPI_FAILURE_INVALID_TARGET, | |
| 80 | − AVIC_IPI_FAILURE_INVALID_BACKING_PAGE, | |
| 81 | −}; | |
| 82 | 62 | |
| 83 | 63 | /* Note: |
| 84 | 64 | * This function is called from IOMMU driver to notify |
| @@ -289,6 +269,22 @@ static int avic_init_backing_page(struct kvm_vcpu *vcpu) · 204 unmodified lines | ||
| 289 | 269 | return 0; |
| 290 | 270 | } |
| 291 | 271 | |
| 272 | +void avic_ring_doorbell(struct kvm_vcpu *vcpu) | |
| 273 | +{ | |
| 274 | + /* | |
| 275 | + * Note, the vCPU could get migrated to a different pCPU at any point, | |
| 276 | + * which could result in signalling the wrong/previous pCPU. But if | |
| 277 | + * that happens the vCPU is guaranteed to do a VMRUN (after being | |
| 278 | + * migrated) and thus will process pending interrupts, i.e. a doorbell | |
| 279 | + * is not needed (and the spurious one is harmless). | |
| 280 | + */ | |
| 281 | + int cpu = READ_ONCE(vcpu->cpu); | |
| 282 | + | |
| 283 | + if (cpu != get_cpu()) | |
| 284 | + wrmsrl(MSR_AMD64_SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu)); | |
| 285 | + put_cpu(); | |
| 286 | +} | |
| 287 | + | |
| 292 | 288 | static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source, |
| 293 | 289 | u32 icrl, u32 icrh) |
| 294 | 290 | { |
| @@ -304,8 +300,13 @@ static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source, · 9 unmodified lines | ||
| 304 | 300 | kvm_for_each_vcpu(i, vcpu, kvm) { |
| 305 | 301 | if (kvm_apic_match_dest(vcpu, source, icrl & APIC_SHORT_MASK, |
| 306 | 302 | GET_APIC_DEST_FIELD(icrh), |
| 307 | − icrl & APIC_DEST_MASK)) | |
| 308 | − kvm_vcpu_wake_up(vcpu); | |
| 303 | + icrl & APIC_DEST_MASK)) { | |
| 304 | + vcpu->arch.apic->irr_pending = true; | |
| 305 | + svm_complete_interrupt_delivery(vcpu, | |
| 306 | + icrl & APIC_MODE_MASK, | |
| 307 | + icrl & APIC_INT_LEVELTRIG, | |
| 308 | + icrl & APIC_VECTOR_MASK); | |
| 309 | + } | |
| 309 | 310 | } |
| 310 | 311 | } |
| 311 | 312 | |
| @@ -345,8 +346,6 @@ int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu) · 33 unmodified lines | ||
| 345 | 346 | avic_kick_target_vcpus(vcpu->kvm, apic, icrl, icrh); |
| 346 | 347 | break; |
| 347 | 348 | case AVIC_IPI_FAILURE_INVALID_TARGET: |
| 348 | − WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n", | |
| 349 | − index, vcpu->vcpu_id, icrh, icrl); | |
| 350 | 349 | break; |
| 351 | 350 | case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE: |
| 352 | 351 | WARN_ONCE(1, "Invalid backing page\n"); |
| @@ -669,52 +668,6 @@ void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) · 316 unmodified lines | ||
| 669 | 668 | return; |
| 670 | 669 | } |
| 671 | 670 | |
| 672 | −int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) | |
| 673 | −{ | |
| 674 | − if (!vcpu->arch.apicv_active) | |
| 675 | − return -1; | |
| 676 | − | |
| 677 | − kvm_lapic_set_irr(vec, vcpu->arch.apic); | |
| 678 | − | |
| 679 | − /* | |
| 680 | − * Pairs with the smp_mb_*() after setting vcpu->guest_mode in | |
| 681 | − * vcpu_enter_guest() to ensure the write to the vIRR is ordered before | |
| 682 | − * the read of guest_mode, which guarantees that either VMRUN will see | |
| 683 | − * and process the new vIRR entry, or that the below code will signal | |
| 684 | − * the doorbell if the vCPU is already running in the guest. | |
| 685 | − */ | |
| 686 | − smp_mb__after_atomic(); | |
| 687 | − | |
| 688 | − /* | |
| 689 | − * Signal the doorbell to tell hardware to inject the IRQ if the vCPU | |
| 690 | − * is in the guest. If the vCPU is not in the guest, hardware will | |
| 691 | − * automatically process AVIC interrupts at VMRUN. | |
| 692 | − */ | |
| 693 | − if (vcpu->mode == IN_GUEST_MODE) { | |
| 694 | − int cpu = READ_ONCE(vcpu->cpu); | |
| 695 | − | |
| 696 | − /* | |
| 697 | − * Note, the vCPU could get migrated to a different pCPU at any | |
| 698 | − * point, which could result in signalling the wrong/previous | |
| 699 | − * pCPU. But if that happens the vCPU is guaranteed to do a | |
| 700 | − * VMRUN (after being migrated) and thus will process pending | |
| 701 | − * interrupts, i.e. a doorbell is not needed (and the spurious | |
| 702 | − * one is harmless). | |
| 703 | − */ | |
| 704 | − if (cpu != get_cpu()) | |
| 705 | − wrmsrl(SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu)); | |
| 706 | − put_cpu(); | |
| 707 | − } else { | |
| 708 | − /* | |
| 709 | − * Wake the vCPU if it was blocking. KVM will then detect the | |
| 710 | − * pending IRQ when checking if the vCPU has a wake event. | |
| 711 | − */ | |
| 712 | − kvm_vcpu_wake_up(vcpu); | |
| 713 | − } | |
| 714 | − | |
| 715 | − return 0; | |
| 716 | −} | |
| 717 | − | |
| 718 | 671 | bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) |
| 719 | 672 | { |
| 720 | 673 | return false; |
| @@ -1457,18 +1457,6 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 1456 unmodified lines | ||
| 1457 | 1457 | !__nested_vmcb_check_save(vcpu, &save_cached)) |
| 1458 | 1458 | goto out_free; |
| 1459 | 1459 | |
| 1460 | − /* | |
| 1461 | − * While the nested guest CR3 is already checked and set by | |
| 1462 | − * KVM_SET_SREGS, it was set when nested state was yet loaded, | |
| 1463 | − * thus MMU might not be initialized correctly. | |
| 1464 | − * Set it again to fix this. | |
| 1465 | − */ | |
| 1466 | − | |
| 1467 | − ret = nested_svm_load_cr3(&svm->vcpu, vcpu->arch.cr3, | |
| 1468 | − nested_npt_enabled(svm), false); | |
| 1469 | − if (WARN_ON_ONCE(ret)) | |
| 1470 | − goto out_free; | |
| 1471 | − | |
| 1472 | 1460 | |
| 1473 | 1461 | /* |
| 1474 | 1462 | * All checks done, we can enter guest mode. Userspace provides |
| @@ -1494,6 +1482,20 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 19 unmodified lines | ||
| 1494 | 1482 | |
| 1495 | 1483 | svm_switch_vmcb(svm, &svm->nested.vmcb02); |
| 1496 | 1484 | nested_vmcb02_prepare_control(svm); |
| 1485 | + | |
| 1486 | + /* | |
| 1487 | + * While the nested guest CR3 is already checked and set by | |
| 1488 | + * KVM_SET_SREGS, it was set when nested state was yet loaded, | |
| 1489 | + * thus MMU might not be initialized correctly. | |
| 1490 | + * Set it again to fix this. | |
| 1491 | + */ | |
| 1492 | + | |
| 1493 | + ret = nested_svm_load_cr3(&svm->vcpu, vcpu->arch.cr3, | |
| 1494 | + nested_npt_enabled(svm), false); | |
| 1495 | + if (WARN_ON_ONCE(ret)) | |
| 1496 | + goto out_free; | |
| 1497 | + | |
| 1498 | + | |
| 1497 | 1499 | kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); |
| 1498 | 1500 | ret = 0; |
| 1499 | 1501 | out_free: |
| @@ -1585,6 +1585,7 @@ void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 1584 unmodified lines | ||
| 1585 | 1585 | { |
| 1586 | 1586 | struct vcpu_svm *svm = to_svm(vcpu); |
| 1587 | 1587 | u64 hcr0 = cr0; |
| 1588 | + bool old_paging = is_paging(vcpu); | |
| 1588 | 1589 | |
| 1589 | 1590 | #ifdef CONFIG_X86_64 |
| 1590 | 1591 | if (vcpu->arch.efer & EFER_LME && !vcpu->arch.guest_state_protected) { |
| @@ -1601,8 +1602,11 @@ void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 10 unmodified lines | ||
| 1601 | 1602 | #endif |
| 1602 | 1603 | vcpu->arch.cr0 = cr0; |
| 1603 | 1604 | |
| 1604 | − if (!npt_enabled) | |
| 1605 | + if (!npt_enabled) { | |
| 1605 | 1606 | hcr0 |= X86_CR0_PG | X86_CR0_WP; |
| 1607 | + if (old_paging != is_paging(vcpu)) | |
| 1608 | + svm_set_cr4(vcpu, kvm_read_cr4(vcpu)); | |
| 1609 | + } | |
| 1606 | 1610 | |
| 1607 | 1611 | /* |
| 1608 | 1612 | * re-enable caching here because the QEMU bios |
| @@ -1646,8 +1650,12 @@ void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) · 37 unmodified lines | ||
| 1646 | 1650 | svm_flush_tlb(vcpu); |
| 1647 | 1651 | |
| 1648 | 1652 | vcpu->arch.cr4 = cr4; |
| 1649 | − if (!npt_enabled) | |
| 1653 | + if (!npt_enabled) { | |
| 1650 | 1654 | cr4 |= X86_CR4_PAE; |
| 1655 | + | |
| 1656 | + if (!is_paging(vcpu)) | |
| 1657 | + cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE); | |
| 1658 | + } | |
| 1651 | 1659 | cr4 |= host_cr4_mce; |
| 1652 | 1660 | to_svm(vcpu)->vmcb->save.cr4 = cr4; |
| 1653 | 1661 | vmcb_mark_dirty(to_svm(vcpu)->vmcb, VMCB_CR); |
| @@ -2685,8 +2693,23 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 1031 unmodified lines | ||
| 2685 | 2693 | u64 data = msr->data; |
| 2686 | 2694 | switch (ecx) { |
| 2687 | 2695 | case MSR_AMD64_TSC_RATIO: |
| 2688 | − if (!msr->host_initiated && !svm->tsc_scaling_enabled) | |
| 2689 | − return 1; | |
| 2696 | + | |
| 2697 | + if (!svm->tsc_scaling_enabled) { | |
| 2698 | + | |
| 2699 | + if (!msr->host_initiated) | |
| 2700 | + return 1; | |
| 2701 | + /* | |
| 2702 | + * In case TSC scaling is not enabled, always | |
| 2703 | + * leave this MSR at the default value. | |
| 2704 | + * | |
| 2705 | + * Due to bug in qemu 6.2.0, it would try to set | |
| 2706 | + * this msr to 0 if tsc scaling is not enabled. | |
| 2707 | + * Ignore this value as well. | |
| 2708 | + */ | |
| 2709 | + if (data != 0 && data != svm->tsc_ratio_msr) | |
| 2710 | + return 1; | |
| 2711 | + break; | |
| 2712 | + } | |
| 2690 | 2713 | |
| 2691 | 2714 | if (data & TSC_RATIO_RSVD) |
| 2692 | 2715 | return 1; |
| @@ -3291,21 +3314,55 @@ static void svm_set_irq(struct kvm_vcpu *vcpu) · 598 unmodified lines | ||
| 3291 | 3314 | SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR; |
| 3292 | 3315 | } |
| 3293 | 3316 | |
| 3294 | −static void svm_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode, | |
| 3295 | − int trig_mode, int vector) | |
| 3317 | +void svm_complete_interrupt_delivery(struct kvm_vcpu *vcpu, int delivery_mode, | |
| 3318 | + int trig_mode, int vector) | |
| 3296 | 3319 | { |
| 3297 | − struct kvm_vcpu *vcpu = apic->vcpu; | |
| 3320 | + /* | |
| 3321 | + * vcpu->arch.apicv_active must be read after vcpu->mode. | |
| 3322 | + * Pairs with smp_store_release in vcpu_enter_guest. | |
| 3323 | + */ | |
| 3324 | + bool in_guest_mode = (smp_load_acquire(&vcpu->mode) == IN_GUEST_MODE); | |
| 3298 | 3325 | |
| 3299 | − if (svm_deliver_avic_intr(vcpu, vector)) { | |
| 3300 | − kvm_lapic_set_irr(vector, apic); | |
| 3326 | + if (!READ_ONCE(vcpu->arch.apicv_active)) { | |
| 3327 | + /* Process the interrupt via inject_pending_event */ | |
| 3301 | 3328 | kvm_make_request(KVM_REQ_EVENT, vcpu); |
| 3302 | 3329 | kvm_vcpu_kick(vcpu); |
| 3330 | + return; | |
| 3331 | + } | |
| 3332 | + | |
| 3333 | + trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode, trig_mode, vector); | |
| 3334 | + if (in_guest_mode) { | |
| 3335 | + /* | |
| 3336 | + * Signal the doorbell to tell hardware to inject the IRQ. If | |
| 3337 | + * the vCPU exits the guest before the doorbell chimes, hardware | |
| 3338 | + * will automatically process AVIC interrupts at the next VMRUN. | |
| 3339 | + */ | |
| 3340 | + avic_ring_doorbell(vcpu); | |
| 3303 | 3341 | } else { |
| 3304 | − trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode, | |
| 3305 | − trig_mode, vector); | |
| 3342 | + /* | |
| 3343 | + * Wake the vCPU if it was blocking. KVM will then detect the | |
| 3344 | + * pending IRQ when checking if the vCPU has a wake event. | |
| 3345 | + */ | |
| 3346 | + kvm_vcpu_wake_up(vcpu); | |
| 3306 | 3347 | } |
| 3307 | 3348 | } |
| 3308 | 3349 | |
| 3350 | +static void svm_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode, | |
| 3351 | + int trig_mode, int vector) | |
| 3352 | +{ | |
| 3353 | + kvm_lapic_set_irr(vector, apic); | |
| 3354 | + | |
| 3355 | + /* | |
| 3356 | + * Pairs with the smp_mb_*() after setting vcpu->guest_mode in | |
| 3357 | + * vcpu_enter_guest() to ensure the write to the vIRR is ordered before | |
| 3358 | + * the read of guest_mode. This guarantees that either VMRUN will see | |
| 3359 | + * and process the new vIRR entry, or that svm_complete_interrupt_delivery | |
| 3360 | + * will signal the doorbell if the CPU has already entered the guest. | |
| 3361 | + */ | |
| 3362 | + smp_mb__after_atomic(); | |
| 3363 | + svm_complete_interrupt_delivery(apic->vcpu, delivery_mode, trig_mode, vector); | |
| 3364 | +} | |
| 3365 | + | |
| 3309 | 3366 | static void svm_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) |
| 3310 | 3367 | { |
| 3311 | 3368 | struct vcpu_svm *svm = to_svm(vcpu); |
| @@ -3353,11 +3410,13 @@ static int svm_nmi_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 41 unmodified lines | ||
| 3353 | 3410 | if (svm->nested.nested_run_pending) |
| 3354 | 3411 | return -EBUSY; |
| 3355 | 3412 | |
| 3413 | + if (svm_nmi_blocked(vcpu)) | |
| 3414 | + return 0; | |
| 3415 | + | |
| 3356 | 3416 | /* An NMI must not be injected into L2 if it's supposed to VM-Exit. */ |
| 3357 | 3417 | if (for_injection && is_guest_mode(vcpu) && nested_exit_on_nmi(svm)) |
| 3358 | 3418 | return -EBUSY; |
| 3359 | − | |
| 3360 | − return !svm_nmi_blocked(vcpu); | |
| 3419 | + return 1; | |
| 3361 | 3420 | } |
| 3362 | 3421 | |
| 3363 | 3422 | static bool svm_get_nmi_mask(struct kvm_vcpu *vcpu) |
| @@ -3409,9 +3468,13 @@ bool svm_interrupt_blocked(struct kvm_vcpu *vcpu) · 45 unmodified lines | ||
| 3409 | 3468 | static int svm_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection) |
| 3410 | 3469 | { |
| 3411 | 3470 | struct vcpu_svm *svm = to_svm(vcpu); |
| 3471 | + | |
| 3412 | 3472 | if (svm->nested.nested_run_pending) |
| 3413 | 3473 | return -EBUSY; |
| 3414 | 3474 | |
| 3475 | + if (svm_interrupt_blocked(vcpu)) | |
| 3476 | + return 0; | |
| 3477 | + | |
| 3415 | 3478 | /* |
| 3416 | 3479 | * An IRQ must not be injected into L2 if it's supposed to VM-Exit, |
| 3417 | 3480 | * e.g. if the IRQ arrived asynchronously after checking nested events. |
| @@ -3419,7 +3482,7 @@ static int svm_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 1 unmodified line | ||
| 3419 | 3482 | if (for_injection && is_guest_mode(vcpu) && nested_exit_on_intr(svm)) |
| 3420 | 3483 | return -EBUSY; |
| 3421 | 3484 | |
| 3422 | − return !svm_interrupt_blocked(vcpu); | |
| 3485 | + return 1; | |
| 3423 | 3486 | } |
| 3424 | 3487 | |
| 3425 | 3488 | static void svm_enable_irq_window(struct kvm_vcpu *vcpu) |
| @@ -4150,11 +4213,14 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 724 unmodified lines | ||
| 4150 | 4213 | if (svm->nested.nested_run_pending) |
| 4151 | 4214 | return -EBUSY; |
| 4152 | 4215 | |
| 4216 | + if (svm_smi_blocked(vcpu)) | |
| 4217 | + return 0; | |
| 4218 | + | |
| 4153 | 4219 | /* An SMI must not be injected into L2 if it's supposed to VM-Exit. */ |
| 4154 | 4220 | if (for_injection && is_guest_mode(vcpu) && nested_exit_on_smi(svm)) |
| 4155 | 4221 | return -EBUSY; |
| 4156 | 4222 | |
| 4157 | − return !svm_smi_blocked(vcpu); | |
| 4223 | + return 1; | |
| 4158 | 4224 | } |
| 4159 | 4225 | |
| 4160 | 4226 | static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate) |
| @@ -4248,11 +4314,18 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) · 87 unmodified lines | ||
| 4248 | 4314 | * Enter the nested guest now |
| 4249 | 4315 | */ |
| 4250 | 4316 | |
| 4317 | + vmcb_mark_all_dirty(svm->vmcb01.ptr); | |
| 4318 | + | |
| 4251 | 4319 | vmcb12 = map.hva; |
| 4252 | 4320 | nested_copy_vmcb_control_to_cache(svm, &vmcb12->control); |
| 4253 | 4321 | nested_copy_vmcb_save_to_cache(svm, &vmcb12->save); |
| 4254 | 4322 | ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, false); |
| 4255 | 4323 | |
| 4324 | + if (ret) | |
| 4325 | + goto unmap_save; | |
| 4326 | + | |
| 4327 | + svm->nested.nested_run_pending = 1; | |
| 4328 | + | |
| 4256 | 4329 | unmap_save: |
| 4257 | 4330 | kvm_vcpu_unmap(vcpu, &map_save, true); |
| 4258 | 4331 | unmap_map: |
| @@ -4637,6 +4710,7 @@ static __init void svm_set_cpu_caps(void) · 378 unmodified lines | ||
| 4637 | 4710 | /* CPUID 0x80000001 and 0x8000000A (SVM features) */ |
| 4638 | 4711 | if (nested) { |
| 4639 | 4712 | kvm_cpu_cap_set(X86_FEATURE_SVM); |
| 4713 | + kvm_cpu_cap_set(X86_FEATURE_VMCBCLEAN); | |
| 4640 | 4714 | |
| 4641 | 4715 | if (nrips) |
| 4642 | 4716 | kvm_cpu_cap_set(X86_FEATURE_NRIPS); |
| @@ -489,6 +489,8 @@ void svm_set_gif(struct vcpu_svm *svm, bool value); · 488 unmodified lines | ||
| 489 | 489 | int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code); |
| 490 | 490 | void set_msr_interception(struct kvm_vcpu *vcpu, u32 *msrpm, u32 msr, |
| 491 | 491 | int read, int write); |
| 492 | +void svm_complete_interrupt_delivery(struct kvm_vcpu *vcpu, int delivery_mode, | |
| 493 | + int trig_mode, int vec); | |
| 492 | 494 | |
| 493 | 495 | /* nested.c */ |
| 494 | 496 | |
| @@ -556,17 +558,6 @@ extern struct kvm_x86_nested_ops svm_nested_ops; · 61 unmodified lines | ||
| 556 | 558 | |
| 557 | 559 | /* avic.c */ |
| 558 | 560 | |
| 559 | −#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF) | |
| 560 | −#define AVIC_LOGICAL_ID_ENTRY_VALID_BIT 31 | |
| 561 | −#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31) | |
| 562 | − | |
| 563 | −#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL) | |
| 564 | −#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12) | |
| 565 | −#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62) | |
| 566 | −#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63) | |
| 567 | − | |
| 568 | −#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL | |
| 569 | − | |
| 570 | 561 | int avic_ga_log_notifier(u32 ga_tag); |
| 571 | 562 | void avic_vm_destroy(struct kvm *kvm); |
| 572 | 563 | int avic_vm_init(struct kvm *kvm); |
| @@ -583,12 +574,12 @@ bool svm_check_apicv_inhibit_reasons(ulong bit); · 10 unmodified lines | ||
| 583 | 574 | void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); |
| 584 | 575 | void svm_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr); |
| 585 | 576 | void svm_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr); |
| 586 | −int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec); | |
| 587 | 577 | bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu); |
| 588 | 578 | int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq, |
| 589 | 579 | uint32_t guest_irq, bool set); |
| 590 | 580 | void avic_vcpu_blocking(struct kvm_vcpu *vcpu); |
| 591 | 581 | void avic_vcpu_unblocking(struct kvm_vcpu *vcpu); |
| 582 | +void avic_ring_doorbell(struct kvm_vcpu *vcpu); | |
| 592 | 583 | |
| 593 | 584 | /* sev.c */ |
| 594 | 585 | |
| @@ -7659,6 +7659,7 @@ static int vmx_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) · 7658 unmodified lines | ||
| 7659 | 7659 | if (ret) |
| 7660 | 7660 | return ret; |
| 7661 | 7661 | |
| 7662 | + vmx->nested.nested_run_pending = 1; | |
| 7662 | 7663 | vmx->nested.smm.guest_mode = false; |
| 7663 | 7664 | } |
| 7664 | 7665 | return 0; |
| @@ -984,6 +984,18 @@ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) · 983 unmodified lines | ||
| 984 | 984 | } |
| 985 | 985 | EXPORT_SYMBOL_GPL(kvm_load_host_xsave_state); |
| 986 | 986 | |
| 987 | +static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu) | |
| 988 | +{ | |
| 989 | + return vcpu->arch.guest_fpu.fpstate->user_xfeatures; | |
| 990 | +} | |
| 991 | + | |
| 992 | +#ifdef CONFIG_X86_64 | |
| 993 | +static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu) | |
| 994 | +{ | |
| 995 | + return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC; | |
| 996 | +} | |
| 997 | +#endif | |
| 998 | + | |
| 987 | 999 | static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) |
| 988 | 1000 | { |
| 989 | 1001 | u64 xcr0 = xcr; |
| @@ -1003,7 +1015,7 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) · 13 unmodified lines | ||
| 1003 | 1015 | * saving. However, xcr0 bit 0 is always set, even if the |
| 1004 | 1016 | * emulated CPU does not support XSAVE (see kvm_vcpu_reset()). |
| 1005 | 1017 | */ |
| 1006 | − valid_bits = vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FP; | |
| 1018 | + valid_bits = kvm_guest_supported_xcr0(vcpu) | XFEATURE_MASK_FP; | |
| 1007 | 1019 | if (xcr0 & ~valid_bits) |
| 1008 | 1020 | return 1; |
| 1009 | 1021 | |
| @@ -2351,10 +2363,12 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns) · 1341 unmodified lines | ||
| 2351 | 2363 | return tsc; |
| 2352 | 2364 | } |
| 2353 | 2365 | |
| 2366 | +#ifdef CONFIG_X86_64 | |
| 2354 | 2367 | static inline int gtod_is_based_on_tsc(int mode) |
| 2355 | 2368 | { |
| 2356 | 2369 | return mode == VDSO_CLOCKMODE_TSC || mode == VDSO_CLOCKMODE_HVCLOCK; |
| 2357 | 2370 | } |
| 2371 | +#endif | |
| 2358 | 2372 | |
| 2359 | 2373 | static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu) |
| 2360 | 2374 | { |
| @@ -3706,8 +3720,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1345 unmodified lines | ||
| 3706 | 3720 | !guest_cpuid_has(vcpu, X86_FEATURE_XFD)) |
| 3707 | 3721 | return 1; |
| 3708 | 3722 | |
| 3709 | − if (data & ~(XFEATURE_MASK_USER_DYNAMIC & | |
| 3710 | − vcpu->arch.guest_supported_xcr0)) | |
| 3723 | + if (data & ~kvm_guest_supported_xfd(vcpu)) | |
| 3711 | 3724 | return 1; |
| 3712 | 3725 | |
| 3713 | 3726 | fpu_update_guest_xfd(&vcpu->arch.guest_fpu, data); |
| @@ -3717,8 +3730,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 3 unmodified lines | ||
| 3717 | 3730 | !guest_cpuid_has(vcpu, X86_FEATURE_XFD)) |
| 3718 | 3731 | return 1; |
| 3719 | 3732 | |
| 3720 | − if (data & ~(XFEATURE_MASK_USER_DYNAMIC & | |
| 3721 | − vcpu->arch.guest_supported_xcr0)) | |
| 3733 | + if (data & ~kvm_guest_supported_xfd(vcpu)) | |
| 3722 | 3734 | return 1; |
| 3723 | 3735 | |
| 3724 | 3736 | vcpu->arch.guest_fpu.xfd_err = data; |
| @@ -4233,6 +4245,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 508 unmodified lines | ||
| 4233 | 4245 | case KVM_CAP_EXIT_ON_EMULATION_FAILURE: |
| 4234 | 4246 | case KVM_CAP_VCPU_ATTRIBUTES: |
| 4235 | 4247 | case KVM_CAP_SYS_ATTRIBUTES: |
| 4248 | + case KVM_CAP_ENABLE_CAP: | |
| 4236 | 4249 | r = 1; |
| 4237 | 4250 | break; |
| 4238 | 4251 | case KVM_CAP_EXIT_HYPERCALL: |
| @@ -8942,6 +8955,13 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr, · 4703 unmodified lines | ||
| 8942 | 8955 | if (clock_type != KVM_CLOCK_PAIRING_WALLCLOCK) |
| 8943 | 8956 | return -KVM_EOPNOTSUPP; |
| 8944 | 8957 | |
| 8958 | + /* | |
| 8959 | + * When tsc is in permanent catchup mode guests won't be able to use | |
| 8960 | + * pvclock_read_retry loop to get consistent view of pvclock | |
| 8961 | + */ | |
| 8962 | + if (vcpu->arch.tsc_always_catchup) | |
| 8963 | + return -KVM_EOPNOTSUPP; | |
| 8964 | + | |
| 8945 | 8965 | if (!kvm_get_walltime_and_clockread(&ts, &cycle)) |
| 8946 | 8966 | return -KVM_EOPNOTSUPP; |
| 8947 | 8967 | |
| @@ -9983,7 +10003,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 1035 unmodified lines | ||
| 9983 | 10003 | * result in virtual interrupt delivery. |
| 9984 | 10004 | */ |
| 9985 | 10005 | local_irq_disable(); |
| 9986 | − vcpu->mode = IN_GUEST_MODE; | |
| 10006 | + | |
| 10007 | + /* Store vcpu->apicv_active before vcpu->mode. */ | |
| 10008 | + smp_store_release(&vcpu->mode, IN_GUEST_MODE); | |
| 9987 | 10009 | |
| 9988 | 10010 | srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); |
| 9989 | 10011 | |
| @@ -133,32 +133,57 @@ static void kvm_xen_update_runstate(struct kvm_vcpu *v, int state) · 132 unmodified lines | ||
| 133 | 133 | void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) |
| 134 | 134 | { |
| 135 | 135 | struct kvm_vcpu_xen *vx = &v->arch.xen; |
| 136 | + struct gfn_to_hva_cache *ghc = &vx->runstate_cache; | |
| 137 | + struct kvm_memslots *slots = kvm_memslots(v->kvm); | |
| 138 | + bool atomic = (state == RUNSTATE_runnable); | |
| 136 | 139 | uint64_t state_entry_time; |
| 137 | − unsigned int offset; | |
| 140 | + int __user *user_state; | |
| 141 | + uint64_t __user *user_times; | |
| 138 | 142 | |
| 139 | 143 | kvm_xen_update_runstate(v, state); |
| 140 | 144 | |
| 141 | 145 | if (!vx->runstate_set) |
| 142 | 146 | return; |
| 143 | 147 | |
| 144 | − BUILD_BUG_ON(sizeof(struct compat_vcpu_runstate_info) != 0x2c); | |
| 148 | + if (unlikely(slots->generation != ghc->generation || kvm_is_error_hva(ghc->hva)) && | |
| 149 | + kvm_gfn_to_hva_cache_init(v->kvm, ghc, ghc->gpa, ghc->len)) | |
| 150 | + return; | |
| 151 | + | |
| 152 | + /* We made sure it fits in a single page */ | |
| 153 | + BUG_ON(!ghc->memslot); | |
| 154 | + | |
| 155 | + if (atomic) | |
| 156 | + pagefault_disable(); | |
| 145 | 157 | |
| 146 | − offset = offsetof(struct compat_vcpu_runstate_info, state_entry_time); | |
| 147 | −#ifdef CONFIG_X86_64 | |
| 148 | 158 | /* |
| 149 | − * The only difference is alignment of uint64_t in 32-bit. | |
| 150 | − * So the first field 'state' is accessed directly using | |
| 151 | − * offsetof() (where its offset happens to be zero), while the | |
| 152 | − * remaining fields which are all uint64_t, start at 'offset' | |
| 153 | − * which we tweak here by adding 4. | |
| 159 | + * The only difference between 32-bit and 64-bit versions of the | |
| 160 | + * runstate struct us the alignment of uint64_t in 32-bit, which | |
| 161 | + * means that the 64-bit version has an additional 4 bytes of | |
| 162 | + * padding after the first field 'state'. | |
| 163 | + * | |
| 164 | + * So we use 'int __user *user_state' to point to the state field, | |
| 165 | + * and 'uint64_t __user *user_times' for runstate_entry_time. So | |
| 166 | + * the actual array of time[] in each state starts at user_times[1]. | |
| 154 | 167 | */ |
| 168 | + BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, state) != 0); | |
| 169 | + BUILD_BUG_ON(offsetof(struct compat_vcpu_runstate_info, state) != 0); | |
| 170 | + user_state = (int __user *)ghc->hva; | |
| 171 | + | |
| 172 | + BUILD_BUG_ON(sizeof(struct compat_vcpu_runstate_info) != 0x2c); | |
| 173 | + | |
| 174 | + user_times = (uint64_t __user *)(ghc->hva + | |
| 175 | + offsetof(struct compat_vcpu_runstate_info, | |
| 176 | + state_entry_time)); | |
| 177 | +#ifdef CONFIG_X86_64 | |
| 155 | 178 | BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, state_entry_time) != |
| 156 | 179 | offsetof(struct compat_vcpu_runstate_info, state_entry_time) + 4); |
| 157 | 180 | BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, time) != |
| 158 | 181 | offsetof(struct compat_vcpu_runstate_info, time) + 4); |
| 159 | 182 | |
| 160 | 183 | if (v->kvm->arch.xen.long_mode) |
| 161 | − offset = offsetof(struct vcpu_runstate_info, state_entry_time); | |
| 184 | + user_times = (uint64_t __user *)(ghc->hva + | |
| 185 | + offsetof(struct vcpu_runstate_info, | |
| 186 | + state_entry_time)); | |
| 162 | 187 | #endif |
| 163 | 188 | /* |
| 164 | 189 | * First write the updated state_entry_time at the appropriate |
| @@ -172,10 +197,8 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 7 unmodified lines | ||
| 172 | 197 | BUILD_BUG_ON(sizeof_field(struct compat_vcpu_runstate_info, state_entry_time) != |
| 173 | 198 | sizeof(state_entry_time)); |
| 174 | 199 | |
| 175 | − if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache, | |
| 176 | − &state_entry_time, offset, | |
| 177 | − sizeof(state_entry_time))) | |
| 178 | − return; | |
| 200 | + if (__put_user(state_entry_time, user_times)) | |
| 201 | + goto out; | |
| 179 | 202 | smp_wmb(); |
| 180 | 203 | |
| 181 | 204 | /* |
| @@ -189,11 +212,8 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 7 unmodified lines | ||
| 189 | 212 | BUILD_BUG_ON(sizeof_field(struct compat_vcpu_runstate_info, state) != |
| 190 | 213 | sizeof(vx->current_runstate)); |
| 191 | 214 | |
| 192 | − if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache, | |
| 193 | − &vx->current_runstate, | |
| 194 | − offsetof(struct vcpu_runstate_info, state), | |
| 195 | − sizeof(vx->current_runstate))) | |
| 196 | − return; | |
| 215 | + if (__put_user(vx->current_runstate, user_state)) | |
| 216 | + goto out; | |
| 197 | 217 | |
| 198 | 218 | /* |
| 199 | 219 | * Write the actual runstate times immediately after the |
| @@ -208,24 +228,23 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 8 unmodified lines | ||
| 208 | 228 | BUILD_BUG_ON(sizeof_field(struct vcpu_runstate_info, time) != |
| 209 | 229 | sizeof(vx->runstate_times)); |
| 210 | 230 | |
| 211 | − if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache, | |
| 212 | − &vx->runstate_times[0], | |
| 213 | − offset + sizeof(u64), | |
| 214 | − sizeof(vx->runstate_times))) | |
| 215 | − return; | |
| 216 | − | |
| 231 | + if (__copy_to_user(user_times + 1, vx->runstate_times, sizeof(vx->runstate_times))) | |
| 232 | + goto out; | |
| 217 | 233 | smp_wmb(); |
| 218 | 234 | |
| 219 | 235 | /* |
| 220 | 236 | * Finally, clear the XEN_RUNSTATE_UPDATE bit in the guest's |
| 221 | 237 | * runstate_entry_time field. |
| 222 | 238 | */ |
| 223 | − | |
| 224 | 239 | state_entry_time &= ~XEN_RUNSTATE_UPDATE; |
| 225 | − if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache, | |
| 226 | − &state_entry_time, offset, | |
| 227 | − sizeof(state_entry_time))) | |
| 228 | − return; | |
| 240 | + __put_user(state_entry_time, user_times); | |
| 241 | + smp_wmb(); | |
| 242 | + | |
| 243 | + out: | |
| 244 | + mark_page_dirty_in_slot(v->kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT); | |
| 245 | + | |
| 246 | + if (atomic) | |
| 247 | + pagefault_enable(); | |
| 229 | 248 | } |
| 230 | 249 | |
| 231 | 250 | int __kvm_xen_has_interrupt(struct kvm_vcpu *v) |
| @@ -443,6 +462,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 211 unmodified lines | ||
| 443 | 462 | break; |
| 444 | 463 | } |
| 445 | 464 | |
| 465 | + /* It must fit within a single page */ | |
| 466 | + if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct vcpu_info) > PAGE_SIZE) { | |
| 467 | + r = -EINVAL; | |
| 468 | + break; | |
| 469 | + } | |
| 470 | + | |
| 446 | 471 | r = kvm_gfn_to_hva_cache_init(vcpu->kvm, |
| 447 | 472 | &vcpu->arch.xen.vcpu_info_cache, |
| 448 | 473 | data->u.gpa, |
| @@ -460,6 +485,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 11 unmodified lines | ||
| 460 | 485 | break; |
| 461 | 486 | } |
| 462 | 487 | |
| 488 | + /* It must fit within a single page */ | |
| 489 | + if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct pvclock_vcpu_time_info) > PAGE_SIZE) { | |
| 490 | + r = -EINVAL; | |
| 491 | + break; | |
| 492 | + } | |
| 493 | + | |
| 463 | 494 | r = kvm_gfn_to_hva_cache_init(vcpu->kvm, |
| 464 | 495 | &vcpu->arch.xen.vcpu_time_info_cache, |
| 465 | 496 | data->u.gpa, |
| @@ -481,6 +512,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 15 unmodified lines | ||
| 481 | 512 | break; |
| 482 | 513 | } |
| 483 | 514 | |
| 515 | + /* It must fit within a single page */ | |
| 516 | + if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct vcpu_runstate_info) > PAGE_SIZE) { | |
| 517 | + r = -EINVAL; | |
| 518 | + break; | |
| 519 | + } | |
| 520 | + | |
| 484 | 521 | r = kvm_gfn_to_hva_cache_init(vcpu->kvm, |
| 485 | 522 | &vcpu->arch.xen.runstate_cache, |
| 486 | 523 | data->u.gpa, |
| @@ -7018,6 +7018,8 @@ static void bfq_exit_queue(struct elevator_queue *e) · 7017 unmodified lines | ||
| 7018 | 7018 | spin_unlock_irq(&bfqd->lock); |
| 7019 | 7019 | #endif |
| 7020 | 7020 | |
| 7021 | + wbt_enable_default(bfqd->queue); | |
| 7022 | + | |
| 7021 | 7023 | kfree(bfqd); |
| 7022 | 7024 | } |
| 7023 | 7025 | |
| @@ -284,13 +284,6 @@ void blk_queue_start_drain(struct request_queue *q) · 283 unmodified lines | ||
| 284 | 284 | wake_up_all(&q->mq_freeze_wq); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | −void blk_set_queue_dying(struct request_queue *q) | |
| 288 | −{ | |
| 289 | − blk_queue_flag_set(QUEUE_FLAG_DYING, q); | |
| 290 | − blk_queue_start_drain(q); | |
| 291 | −} | |
| 292 | −EXPORT_SYMBOL_GPL(blk_set_queue_dying); | |
| 293 | − | |
| 294 | 287 | /** |
| 295 | 288 | * blk_cleanup_queue - shutdown a request queue |
| 296 | 289 | * @q: request queue to shutdown |
| @@ -308,7 +301,8 @@ void blk_cleanup_queue(struct request_queue *q) · 11 unmodified lines | ||
| 308 | 301 | WARN_ON_ONCE(blk_queue_registered(q)); |
| 309 | 302 | |
| 310 | 303 | /* mark @q DYING, no new request or merges will be allowed afterwards */ |
| 311 | − blk_set_queue_dying(q); | |
| 304 | + blk_queue_flag_set(QUEUE_FLAG_DYING, q); | |
| 305 | + blk_queue_start_drain(q); | |
| 312 | 306 | |
| 313 | 307 | blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q); |
| 314 | 308 | blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q); |
| @@ -446,7 +446,7 @@ static struct bio *bio_copy_kern(struct request_queue *q, void *data, · 445 unmodified lines | ||
| 446 | 446 | if (bytes > len) |
| 447 | 447 | bytes = len; |
| 448 | 448 | |
| 449 | − page = alloc_page(GFP_NOIO | gfp_mask); | |
| 449 | + page = alloc_page(GFP_NOIO | __GFP_ZERO | gfp_mask); | |
| 450 | 450 | if (!page) |
| 451 | 451 | goto cleanup; |
| 452 | 452 | |
| @@ -736,6 +736,10 @@ static void blk_complete_request(struct request *req) · 735 unmodified lines | ||
| 736 | 736 | |
| 737 | 737 | /* Completion has already been traced */ |
| 738 | 738 | bio_clear_flag(bio, BIO_TRACE_COMPLETION); |
| 739 | + | |
| 740 | + if (req_op(req) == REQ_OP_ZONE_APPEND) | |
| 741 | + bio->bi_iter.bi_sector = req->__sector; | |
| 742 | + | |
| 739 | 743 | if (!is_flush) |
| 740 | 744 | bio_endio(bio); |
| 741 | 745 | bio = next; |
| @@ -525,8 +525,6 @@ void elv_unregister_queue(struct request_queue *q) · 524 unmodified lines | ||
| 525 | 525 | kobject_del(&e->kobj); |
| 526 | 526 | |
| 527 | 527 | e->registered = 0; |
| 528 | − /* Re-enable throttling in case elevator disabled it */ | |
| 529 | − wbt_enable_default(q); | |
| 530 | 528 | } |
| 531 | 529 | } |
| 532 | 530 | |
| @@ -289,6 +289,8 @@ static void blkdev_bio_end_io_async(struct bio *bio) · 288 unmodified lines | ||
| 289 | 289 | struct kiocb *iocb = dio->iocb; |
| 290 | 290 | ssize_t ret; |
| 291 | 291 | |
| 292 | + WRITE_ONCE(iocb->private, NULL); | |
| 293 | + | |
| 292 | 294 | if (likely(!bio->bi_status)) { |
| 293 | 295 | ret = dio->size; |
| 294 | 296 | iocb->ki_pos += ret; |
| @@ -548,6 +548,20 @@ out_free_ext_minor: · 547 unmodified lines | ||
| 548 | 548 | } |
| 549 | 549 | EXPORT_SYMBOL(device_add_disk); |
| 550 | 550 | |
| 551 | +/** | |
| 552 | + * blk_mark_disk_dead - mark a disk as dead | |
| 553 | + * @disk: disk to mark as dead | |
| 554 | + * | |
| 555 | + * Mark as disk as dead (e.g. surprise removed) and don't accept any new I/O | |
| 556 | + * to this disk. | |
| 557 | + */ | |
| 558 | +void blk_mark_disk_dead(struct gendisk *disk) | |
| 559 | +{ | |
| 560 | + set_bit(GD_DEAD, &disk->state); | |
| 561 | + blk_queue_start_drain(disk->queue); | |
| 562 | +} | |
| 563 | +EXPORT_SYMBOL_GPL(blk_mark_disk_dead); | |
| 564 | + | |
| 551 | 565 | /** |
| 552 | 566 | * del_gendisk - remove the gendisk |
| 553 | 567 | * @disk: the struct gendisk to remove |
| @@ -25,12 +25,9 @@ struct alg_type_list { · 24 unmodified lines | ||
| 25 | 25 | struct list_head list; |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | −static atomic_long_t alg_memory_allocated; | |
| 29 | − | |
| 30 | 28 | static struct proto alg_proto = { |
| 31 | 29 | .name = "ALG", |
| 32 | 30 | .owner = THIS_MODULE, |
| 33 | − .memory_allocated = &alg_memory_allocated, | |
| 34 | 31 | .obj_size = sizeof(struct alg_sock), |
| 35 | 32 | }; |
| 36 | 33 | |
| @@ -96,6 +96,11 @@ static const struct dmi_system_id processor_power_dmi_table[] = { · 95 unmodified lines | ||
| 96 | 96 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), |
| 97 | 97 | DMI_MATCH(DMI_PRODUCT_NAME,"L8400B series Notebook PC")}, |
| 98 | 98 | (void *)1}, |
| 99 | + /* T40 can not handle C3 idle state */ | |
| 100 | + { set_max_cstate, "IBM ThinkPad T40", { | |
| 101 | + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | |
| 102 | + DMI_MATCH(DMI_PRODUCT_NAME, "23737CU")}, | |
| 103 | + (void *)2}, | |
| 99 | 104 | {}, |
| 100 | 105 | }; |
| 101 | 106 | |
| @@ -400,7 +400,7 @@ int __init_or_acpilib acpi_table_parse_entries_array( · 399 unmodified lines | ||
| 400 | 400 | |
| 401 | 401 | acpi_get_table(id, instance, &table_header); |
| 402 | 402 | if (!table_header) { |
| 403 | − pr_warn("%4.4s not present\n", id); | |
| 403 | + pr_debug("%4.4s not present\n", id); | |
| 404 | 404 | return -ENODEV; |
| 405 | 405 | } |
| 406 | 406 | |
| @@ -919,6 +919,20 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) · 918 unmodified lines | ||
| 919 | 919 | irqmask &= ~0x10; |
| 920 | 920 | pci_write_config_byte(dev, 0x5a, irqmask); |
| 921 | 921 | |
| 922 | + /* | |
| 923 | + * HPT371 chips physically have only one channel, the secondary one, | |
| 924 | + * but the primary channel registers do exist! Go figure... | |
| 925 | + * So, we manually disable the non-existing channel here | |
| 926 | + * (if the BIOS hasn't done this already). | |
| 927 | + */ | |
| 928 | + if (dev->device == PCI_DEVICE_ID_TTI_HPT371) { | |
| 929 | + u8 mcr1; | |
| 930 | + | |
| 931 | + pci_read_config_byte(dev, 0x50, &mcr1); | |
| 932 | + mcr1 &= ~0x04; | |
| 933 | + pci_write_config_byte(dev, 0x50, mcr1); | |
| 934 | + } | |
| 935 | + | |
| 922 | 936 | /* |
| 923 | 937 | * default to pci clock. make sure MA15/16 are set to output |
| 924 | 938 | * to prevent drives having problems with 40-pin cables. Needed |
| @@ -950,14 +964,14 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) · 25 unmodified lines | ||
| 950 | 964 | |
| 951 | 965 | if ((freq >> 12) != 0xABCDE) { |
| 952 | 966 | int i; |
| 953 | − u8 sr; | |
| 967 | + u16 sr; | |
| 954 | 968 | u32 total = 0; |
| 955 | 969 | |
| 956 | 970 | dev_warn(&dev->dev, "BIOS has not set timing clocks\n"); |
| 957 | 971 | |
| 958 | 972 | /* This is the process the HPT371 BIOS is reported to use */ |
| 959 | 973 | for (i = 0; i < 128; i++) { |
| 960 | − pci_read_config_byte(dev, 0x78, &sr); | |
| 974 | + pci_read_config_word(dev, 0x78, &sr); | |
| 961 | 975 | total += sr & 0x1FF; |
| 962 | 976 | udelay(15); |
| 963 | 977 | } |
| @@ -629,6 +629,9 @@ re_probe: · 628 unmodified lines | ||
| 629 | 629 | drv->remove(dev); |
| 630 | 630 | |
| 631 | 631 | devres_release_all(dev); |
| 632 | + arch_teardown_dma_ops(dev); | |
| 633 | + kfree(dev->dma_range_map); | |
| 634 | + dev->dma_range_map = NULL; | |
| 632 | 635 | driver_sysfs_remove(dev); |
| 633 | 636 | dev->driver = NULL; |
| 634 | 637 | dev_set_drvdata(dev, NULL); |
| @@ -1209,6 +1212,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) · 574 unmodified lines | ||
| 1209 | 1212 | |
| 1210 | 1213 | devres_release_all(dev); |
| 1211 | 1214 | arch_teardown_dma_ops(dev); |
| 1215 | + kfree(dev->dma_range_map); | |
| 1216 | + dev->dma_range_map = NULL; | |
| 1212 | 1217 | dev->driver = NULL; |
| 1213 | 1218 | dev_set_drvdata(dev, NULL); |
| 1214 | 1219 | if (dev->pm_domain && dev->pm_domain->dismiss) |
| @@ -189,11 +189,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data) · 188 unmodified lines | ||
| 189 | 189 | ret = regmap_write(map, reg, d->mask_buf[i]); |
| 190 | 190 | if (d->chip->clear_ack) { |
| 191 | 191 | if (d->chip->ack_invert && !ret) |
| 192 | − ret = regmap_write(map, reg, | |
| 193 | − d->mask_buf[i]); | |
| 192 | + ret = regmap_write(map, reg, UINT_MAX); | |
| 194 | 193 | else if (!ret) |
| 195 | − ret = regmap_write(map, reg, | |
| 196 | − ~d->mask_buf[i]); | |
| 194 | + ret = regmap_write(map, reg, 0); | |
| 197 | 195 | } |
| 198 | 196 | if (ret != 0) |
| 199 | 197 | dev_err(d->map->dev, "Failed to ack 0x%x: %d\n", |
| @@ -556,11 +554,9 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) · 356 unmodified lines | ||
| 556 | 554 | data->status_buf[i]); |
| 557 | 555 | if (chip->clear_ack) { |
| 558 | 556 | if (chip->ack_invert && !ret) |
| 559 | − ret = regmap_write(map, reg, | |
| 560 | − data->status_buf[i]); | |
| 557 | + ret = regmap_write(map, reg, UINT_MAX); | |
| 561 | 558 | else if (!ret) |
| 562 | − ret = regmap_write(map, reg, | |
| 563 | − ~data->status_buf[i]); | |
| 559 | + ret = regmap_write(map, reg, 0); | |
| 564 | 560 | } |
| 565 | 561 | if (ret != 0) |
| 566 | 562 | dev_err(map->dev, "Failed to ack 0x%x: %d\n", |
| @@ -817,13 +813,9 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, · 250 unmodified lines | ||
| 817 | 813 | d->status_buf[i] & d->mask_buf[i]); |
| 818 | 814 | if (chip->clear_ack) { |
| 819 | 815 | if (chip->ack_invert && !ret) |
| 820 | − ret = regmap_write(map, reg, | |
| 821 | − (d->status_buf[i] & | |
| 822 | − d->mask_buf[i])); | |
| 816 | + ret = regmap_write(map, reg, UINT_MAX); | |
| 823 | 817 | else if (!ret) |
| 824 | − ret = regmap_write(map, reg, | |
| 825 | − ~(d->status_buf[i] & | |
| 826 | − d->mask_buf[i])); | |
| 818 | + ret = regmap_write(map, reg, 0); | |
| 827 | 819 | } |
| 828 | 820 | if (ret != 0) { |
| 829 | 821 | dev_err(map->dev, "Failed to ack 0x%x: %d\n", |
| @@ -79,6 +79,7 @@ · 78 unmodified lines | ||
| 79 | 79 | #include <linux/ioprio.h> |
| 80 | 80 | #include <linux/blk-cgroup.h> |
| 81 | 81 | #include <linux/sched/mm.h> |
| 82 | +#include <linux/statfs.h> | |
| 82 | 83 | |
| 83 | 84 | #include "loop.h" |
| 84 | 85 | |
| @@ -774,8 +775,13 @@ static void loop_config_discard(struct loop_device *lo) · 689 unmodified lines | ||
| 774 | 775 | granularity = 0; |
| 775 | 776 | |
| 776 | 777 | } else { |
| 778 | + struct kstatfs sbuf; | |
| 779 | + | |
| 777 | 780 | max_discard_sectors = UINT_MAX >> 9; |
| 778 | − granularity = inode->i_sb->s_blocksize; | |
| 781 | + if (!vfs_statfs(&file->f_path, &sbuf)) | |
| 782 | + granularity = sbuf.f_bsize; | |
| 783 | + else | |
| 784 | + max_discard_sectors = 0; | |
| 779 | 785 | } |
| 780 | 786 | |
| 781 | 787 | if (max_discard_sectors) { |
| @@ -4112,7 +4112,7 @@ static void mtip_pci_remove(struct pci_dev *pdev) · 4111 unmodified lines | ||
| 4112 | 4112 | "Completion workers still active!\n"); |
| 4113 | 4113 | } |
| 4114 | 4114 | |
| 4115 | − blk_set_queue_dying(dd->queue); | |
| 4115 | + blk_mark_disk_dead(dd->disk); | |
| 4116 | 4116 | set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag); |
| 4117 | 4117 | |
| 4118 | 4118 | /* Clean up the block layer. */ |
| @@ -7185,7 +7185,7 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 7184 unmodified lines | ||
| 7185 | 7185 | * IO to complete/fail. |
| 7186 | 7186 | */ |
| 7187 | 7187 | blk_mq_freeze_queue(rbd_dev->disk->queue); |
| 7188 | − blk_set_queue_dying(rbd_dev->disk->queue); | |
| 7188 | + blk_mark_disk_dead(rbd_dev->disk); | |
| 7189 | 7189 | } |
| 7190 | 7190 | |
| 7191 | 7191 | del_gendisk(rbd_dev->disk); |
| @@ -2126,7 +2126,7 @@ static void blkfront_closing(struct blkfront_info *info) · 2125 unmodified lines | ||
| 2126 | 2126 | |
| 2127 | 2127 | /* No more blkif_request(). */ |
| 2128 | 2128 | blk_mq_stop_hw_queues(info->rq); |
| 2129 | − blk_set_queue_dying(info->rq); | |
| 2129 | + blk_mark_disk_dead(info->gd); | |
| 2130 | 2130 | set_capacity(info->gd, 0); |
| 2131 | 2131 | |
| 2132 | 2132 | for_each_rinfo(info, rinfo, i) { |
| @@ -139,11 +139,10 @@ static const struct ingenic_cgu_clk_info jz4725b_cgu_clocks[] = { · 138 unmodified lines | ||
| 139 | 139 | }, |
| 140 | 140 | |
| 141 | 141 | [JZ4725B_CLK_I2S] = { |
| 142 | − "i2s", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, | |
| 142 | + "i2s", CGU_CLK_MUX | CGU_CLK_DIV, | |
| 143 | 143 | .parents = { JZ4725B_CLK_EXT, JZ4725B_CLK_PLL_HALF, -1, -1 }, |
| 144 | 144 | .mux = { CGU_REG_CPCCR, 31, 1 }, |
| 145 | 145 | .div = { CGU_REG_I2SCDR, 0, 1, 9, -1, -1, -1 }, |
| 146 | − .gate = { CGU_REG_CLKGR, 6 }, | |
| 147 | 146 | }, |
| 148 | 147 | |
| 149 | 148 | [JZ4725B_CLK_SPI] = { |
| @@ -108,42 +108,6 @@ static const struct clk_parent_data gcc_xo_gpll0_gpll4[] = { · 107 unmodified lines | ||
| 108 | 108 | { .hw = &gpll4.clkr.hw }, |
| 109 | 109 | }; |
| 110 | 110 | |
| 111 | −static struct clk_rcg2 system_noc_clk_src = { | |
| 112 | − .cmd_rcgr = 0x0120, | |
| 113 | − .hid_width = 5, | |
| 114 | − .parent_map = gcc_xo_gpll0_map, | |
| 115 | − .clkr.hw.init = &(struct clk_init_data){ | |
| 116 | − .name = "system_noc_clk_src", | |
| 117 | − .parent_data = gcc_xo_gpll0, | |
| 118 | − .num_parents = ARRAY_SIZE(gcc_xo_gpll0), | |
| 119 | − .ops = &clk_rcg2_ops, | |
| 120 | − }, | |
| 121 | −}; | |
| 122 | − | |
| 123 | −static struct clk_rcg2 config_noc_clk_src = { | |
| 124 | − .cmd_rcgr = 0x0150, | |
| 125 | − .hid_width = 5, | |
| 126 | − .parent_map = gcc_xo_gpll0_map, | |
| 127 | − .clkr.hw.init = &(struct clk_init_data){ | |
| 128 | − .name = "config_noc_clk_src", | |
| 129 | − .parent_data = gcc_xo_gpll0, | |
| 130 | − .num_parents = ARRAY_SIZE(gcc_xo_gpll0), | |
| 131 | − .ops = &clk_rcg2_ops, | |
| 132 | − }, | |
| 133 | −}; | |
| 134 | − | |
| 135 | −static struct clk_rcg2 periph_noc_clk_src = { | |
| 136 | − .cmd_rcgr = 0x0190, | |
| 137 | − .hid_width = 5, | |
| 138 | − .parent_map = gcc_xo_gpll0_map, | |
| 139 | − .clkr.hw.init = &(struct clk_init_data){ | |
| 140 | − .name = "periph_noc_clk_src", | |
| 141 | − .parent_data = gcc_xo_gpll0, | |
| 142 | − .num_parents = ARRAY_SIZE(gcc_xo_gpll0), | |
| 143 | − .ops = &clk_rcg2_ops, | |
| 144 | − }, | |
| 145 | −}; | |
| 146 | − | |
| 147 | 111 | static struct freq_tbl ftbl_ufs_axi_clk_src[] = { |
| 148 | 112 | F(50000000, P_GPLL0, 12, 0, 0), |
| 149 | 113 | F(100000000, P_GPLL0, 6, 0, 0), |
| @@ -1150,8 +1114,6 @@ static struct clk_branch gcc_blsp1_ahb_clk = { · 1000 unmodified lines | ||
| 1150 | 1114 | .enable_mask = BIT(17), |
| 1151 | 1115 | .hw.init = &(struct clk_init_data){ |
| 1152 | 1116 | .name = "gcc_blsp1_ahb_clk", |
| 1153 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 1154 | − .num_parents = 1, | |
| 1155 | 1117 | .ops = &clk_branch2_ops, |
| 1156 | 1118 | }, |
| 1157 | 1119 | }, |
| @@ -1435,8 +1397,6 @@ static struct clk_branch gcc_blsp2_ahb_clk = { · 277 unmodified lines | ||
| 1435 | 1397 | .enable_mask = BIT(15), |
| 1436 | 1398 | .hw.init = &(struct clk_init_data){ |
| 1437 | 1399 | .name = "gcc_blsp2_ahb_clk", |
| 1438 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 1439 | − .num_parents = 1, | |
| 1440 | 1400 | .ops = &clk_branch2_ops, |
| 1441 | 1401 | }, |
| 1442 | 1402 | }, |
| @@ -1764,8 +1724,6 @@ static struct clk_branch gcc_lpass_q6_axi_clk = { · 321 unmodified lines | ||
| 1764 | 1724 | .enable_mask = BIT(0), |
| 1765 | 1725 | .hw.init = &(struct clk_init_data){ |
| 1766 | 1726 | .name = "gcc_lpass_q6_axi_clk", |
| 1767 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 1768 | − .num_parents = 1, | |
| 1769 | 1727 | .ops = &clk_branch2_ops, |
| 1770 | 1728 | }, |
| 1771 | 1729 | }, |
| @@ -1778,8 +1736,6 @@ static struct clk_branch gcc_mss_q6_bimc_axi_clk = { · 6 unmodified lines | ||
| 1778 | 1736 | .enable_mask = BIT(0), |
| 1779 | 1737 | .hw.init = &(struct clk_init_data){ |
| 1780 | 1738 | .name = "gcc_mss_q6_bimc_axi_clk", |
| 1781 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 1782 | − .num_parents = 1, | |
| 1783 | 1739 | .ops = &clk_branch2_ops, |
| 1784 | 1740 | }, |
| 1785 | 1741 | }, |
| @@ -1807,9 +1763,6 @@ static struct clk_branch gcc_pcie_0_cfg_ahb_clk = { · 21 unmodified lines | ||
| 1807 | 1763 | .enable_mask = BIT(0), |
| 1808 | 1764 | .hw.init = &(struct clk_init_data){ |
| 1809 | 1765 | .name = "gcc_pcie_0_cfg_ahb_clk", |
| 1810 | − .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw }, | |
| 1811 | − .num_parents = 1, | |
| 1812 | − .flags = CLK_SET_RATE_PARENT, | |
| 1813 | 1766 | .ops = &clk_branch2_ops, |
| 1814 | 1767 | }, |
| 1815 | 1768 | }, |
| @@ -1822,9 +1775,6 @@ static struct clk_branch gcc_pcie_0_mstr_axi_clk = { · 6 unmodified lines | ||
| 1822 | 1775 | .enable_mask = BIT(0), |
| 1823 | 1776 | .hw.init = &(struct clk_init_data){ |
| 1824 | 1777 | .name = "gcc_pcie_0_mstr_axi_clk", |
| 1825 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 1826 | − .num_parents = 1, | |
| 1827 | − .flags = CLK_SET_RATE_PARENT, | |
| 1828 | 1778 | .ops = &clk_branch2_ops, |
| 1829 | 1779 | }, |
| 1830 | 1780 | }, |
| @@ -1854,9 +1804,6 @@ static struct clk_branch gcc_pcie_0_slv_axi_clk = { · 23 unmodified lines | ||
| 1854 | 1804 | .enable_mask = BIT(0), |
| 1855 | 1805 | .hw.init = &(struct clk_init_data){ |
| 1856 | 1806 | .name = "gcc_pcie_0_slv_axi_clk", |
| 1857 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 1858 | − .num_parents = 1, | |
| 1859 | − .flags = CLK_SET_RATE_PARENT, | |
| 1860 | 1807 | .ops = &clk_branch2_ops, |
| 1861 | 1808 | }, |
| 1862 | 1809 | }, |
| @@ -1884,9 +1831,6 @@ static struct clk_branch gcc_pcie_1_cfg_ahb_clk = { · 21 unmodified lines | ||
| 1884 | 1831 | .enable_mask = BIT(0), |
| 1885 | 1832 | .hw.init = &(struct clk_init_data){ |
| 1886 | 1833 | .name = "gcc_pcie_1_cfg_ahb_clk", |
| 1887 | − .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw }, | |
| 1888 | − .num_parents = 1, | |
| 1889 | − .flags = CLK_SET_RATE_PARENT, | |
| 1890 | 1834 | .ops = &clk_branch2_ops, |
| 1891 | 1835 | }, |
| 1892 | 1836 | }, |
| @@ -1899,9 +1843,6 @@ static struct clk_branch gcc_pcie_1_mstr_axi_clk = { · 6 unmodified lines | ||
| 1899 | 1843 | .enable_mask = BIT(0), |
| 1900 | 1844 | .hw.init = &(struct clk_init_data){ |
| 1901 | 1845 | .name = "gcc_pcie_1_mstr_axi_clk", |
| 1902 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 1903 | − .num_parents = 1, | |
| 1904 | − .flags = CLK_SET_RATE_PARENT, | |
| 1905 | 1846 | .ops = &clk_branch2_ops, |
| 1906 | 1847 | }, |
| 1907 | 1848 | }, |
| @@ -1930,9 +1871,6 @@ static struct clk_branch gcc_pcie_1_slv_axi_clk = { · 22 unmodified lines | ||
| 1930 | 1871 | .enable_mask = BIT(0), |
| 1931 | 1872 | .hw.init = &(struct clk_init_data){ |
| 1932 | 1873 | .name = "gcc_pcie_1_slv_axi_clk", |
| 1933 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 1934 | − .num_parents = 1, | |
| 1935 | − .flags = CLK_SET_RATE_PARENT, | |
| 1936 | 1874 | .ops = &clk_branch2_ops, |
| 1937 | 1875 | }, |
| 1938 | 1876 | }, |
| @@ -1960,8 +1898,6 @@ static struct clk_branch gcc_pdm_ahb_clk = { · 21 unmodified lines | ||
| 1960 | 1898 | .enable_mask = BIT(0), |
| 1961 | 1899 | .hw.init = &(struct clk_init_data){ |
| 1962 | 1900 | .name = "gcc_pdm_ahb_clk", |
| 1963 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 1964 | − .num_parents = 1, | |
| 1965 | 1901 | .ops = &clk_branch2_ops, |
| 1966 | 1902 | }, |
| 1967 | 1903 | }, |
| @@ -1989,9 +1925,6 @@ static struct clk_branch gcc_sdcc1_ahb_clk = { · 21 unmodified lines | ||
| 1989 | 1925 | .enable_mask = BIT(0), |
| 1990 | 1926 | .hw.init = &(struct clk_init_data){ |
| 1991 | 1927 | .name = "gcc_sdcc1_ahb_clk", |
| 1992 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 1993 | − .num_parents = 1, | |
| 1994 | − .flags = CLK_SET_RATE_PARENT, | |
| 1995 | 1928 | .ops = &clk_branch2_ops, |
| 1996 | 1929 | }, |
| 1997 | 1930 | }, |
| @@ -2004,9 +1937,6 @@ static struct clk_branch gcc_sdcc2_ahb_clk = { · 6 unmodified lines | ||
| 2004 | 1937 | .enable_mask = BIT(0), |
| 2005 | 1938 | .hw.init = &(struct clk_init_data){ |
| 2006 | 1939 | .name = "gcc_sdcc2_ahb_clk", |
| 2007 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 2008 | − .num_parents = 1, | |
| 2009 | − .flags = CLK_SET_RATE_PARENT, | |
| 2010 | 1940 | .ops = &clk_branch2_ops, |
| 2011 | 1941 | }, |
| 2012 | 1942 | }, |
| @@ -2034,9 +1964,6 @@ static struct clk_branch gcc_sdcc3_ahb_clk = { · 21 unmodified lines | ||
| 2034 | 1964 | .enable_mask = BIT(0), |
| 2035 | 1965 | .hw.init = &(struct clk_init_data){ |
| 2036 | 1966 | .name = "gcc_sdcc3_ahb_clk", |
| 2037 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 2038 | − .num_parents = 1, | |
| 2039 | − .flags = CLK_SET_RATE_PARENT, | |
| 2040 | 1967 | .ops = &clk_branch2_ops, |
| 2041 | 1968 | }, |
| 2042 | 1969 | }, |
| @@ -2064,9 +1991,6 @@ static struct clk_branch gcc_sdcc4_ahb_clk = { · 21 unmodified lines | ||
| 2064 | 1991 | .enable_mask = BIT(0), |
| 2065 | 1992 | .hw.init = &(struct clk_init_data){ |
| 2066 | 1993 | .name = "gcc_sdcc4_ahb_clk", |
| 2067 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 2068 | − .num_parents = 1, | |
| 2069 | − .flags = CLK_SET_RATE_PARENT, | |
| 2070 | 1994 | .ops = &clk_branch2_ops, |
| 2071 | 1995 | }, |
| 2072 | 1996 | }, |
| @@ -2124,8 +2048,6 @@ static struct clk_branch gcc_tsif_ahb_clk = { · 51 unmodified lines | ||
| 2124 | 2048 | .enable_mask = BIT(0), |
| 2125 | 2049 | .hw.init = &(struct clk_init_data){ |
| 2126 | 2050 | .name = "gcc_tsif_ahb_clk", |
| 2127 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 2128 | − .num_parents = 1, | |
| 2129 | 2051 | .ops = &clk_branch2_ops, |
| 2130 | 2052 | }, |
| 2131 | 2053 | }, |
| @@ -2153,8 +2075,6 @@ static struct clk_branch gcc_ufs_ahb_clk = { · 21 unmodified lines | ||
| 2153 | 2075 | .enable_mask = BIT(0), |
| 2154 | 2076 | .hw.init = &(struct clk_init_data){ |
| 2155 | 2077 | .name = "gcc_ufs_ahb_clk", |
| 2156 | − .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw }, | |
| 2157 | − .num_parents = 1, | |
| 2158 | 2078 | .ops = &clk_branch2_ops, |
| 2159 | 2079 | }, |
| 2160 | 2080 | }, |
| @@ -2198,8 +2118,6 @@ static struct clk_branch gcc_ufs_rx_symbol_0_clk = { · 37 unmodified lines | ||
| 2198 | 2118 | .enable_mask = BIT(0), |
| 2199 | 2119 | .hw.init = &(struct clk_init_data){ |
| 2200 | 2120 | .name = "gcc_ufs_rx_symbol_0_clk", |
| 2201 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 2202 | − .num_parents = 1, | |
| 2203 | 2121 | .ops = &clk_branch2_ops, |
| 2204 | 2122 | }, |
| 2205 | 2123 | }, |
| @@ -2213,8 +2131,6 @@ static struct clk_branch gcc_ufs_rx_symbol_1_clk = { · 7 unmodified lines | ||
| 2213 | 2131 | .enable_mask = BIT(0), |
| 2214 | 2132 | .hw.init = &(struct clk_init_data){ |
| 2215 | 2133 | .name = "gcc_ufs_rx_symbol_1_clk", |
| 2216 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 2217 | − .num_parents = 1, | |
| 2218 | 2134 | .ops = &clk_branch2_ops, |
| 2219 | 2135 | }, |
| 2220 | 2136 | }, |
| @@ -2243,8 +2159,6 @@ static struct clk_branch gcc_ufs_tx_symbol_0_clk = { · 22 unmodified lines | ||
| 2243 | 2159 | .enable_mask = BIT(0), |
| 2244 | 2160 | .hw.init = &(struct clk_init_data){ |
| 2245 | 2161 | .name = "gcc_ufs_tx_symbol_0_clk", |
| 2246 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 2247 | − .num_parents = 1, | |
| 2248 | 2162 | .ops = &clk_branch2_ops, |
| 2249 | 2163 | }, |
| 2250 | 2164 | }, |
| @@ -2258,8 +2172,6 @@ static struct clk_branch gcc_ufs_tx_symbol_1_clk = { · 7 unmodified lines | ||
| 2258 | 2172 | .enable_mask = BIT(0), |
| 2259 | 2173 | .hw.init = &(struct clk_init_data){ |
| 2260 | 2174 | .name = "gcc_ufs_tx_symbol_1_clk", |
| 2261 | − .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw }, | |
| 2262 | − .num_parents = 1, | |
| 2263 | 2175 | .ops = &clk_branch2_ops, |
| 2264 | 2176 | }, |
| 2265 | 2177 | }, |
| @@ -2364,8 +2276,6 @@ static struct clk_branch gcc_usb_hs_ahb_clk = { · 98 unmodified lines | ||
| 2364 | 2276 | .enable_mask = BIT(0), |
| 2365 | 2277 | .hw.init = &(struct clk_init_data){ |
| 2366 | 2278 | .name = "gcc_usb_hs_ahb_clk", |
| 2367 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 2368 | − .num_parents = 1, | |
| 2369 | 2279 | .ops = &clk_branch2_ops, |
| 2370 | 2280 | }, |
| 2371 | 2281 | }, |
| @@ -2488,8 +2398,6 @@ static struct clk_branch gcc_boot_rom_ahb_clk = { · 116 unmodified lines | ||
| 2488 | 2398 | .enable_mask = BIT(10), |
| 2489 | 2399 | .hw.init = &(struct clk_init_data){ |
| 2490 | 2400 | .name = "gcc_boot_rom_ahb_clk", |
| 2491 | − .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw }, | |
| 2492 | − .num_parents = 1, | |
| 2493 | 2401 | .ops = &clk_branch2_ops, |
| 2494 | 2402 | }, |
| 2495 | 2403 | }, |
| @@ -2503,8 +2411,6 @@ static struct clk_branch gcc_prng_ahb_clk = { · 7 unmodified lines | ||
| 2503 | 2411 | .enable_mask = BIT(13), |
| 2504 | 2412 | .hw.init = &(struct clk_init_data){ |
| 2505 | 2413 | .name = "gcc_prng_ahb_clk", |
| 2506 | − .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw }, | |
| 2507 | − .num_parents = 1, | |
| 2508 | 2414 | .ops = &clk_branch2_ops, |
| 2509 | 2415 | }, |
| 2510 | 2416 | }, |
| @@ -2547,9 +2453,6 @@ static struct clk_regmap *gcc_msm8994_clocks[] = { · 36 unmodified lines | ||
| 2547 | 2453 | [GPLL0] = &gpll0.clkr, |
| 2548 | 2454 | [GPLL4_EARLY] = &gpll4_early.clkr, |
| 2549 | 2455 | [GPLL4] = &gpll4.clkr, |
| 2550 | − [CONFIG_NOC_CLK_SRC] = &config_noc_clk_src.clkr, | |
| 2551 | − [PERIPH_NOC_CLK_SRC] = &periph_noc_clk_src.clkr, | |
| 2552 | − [SYSTEM_NOC_CLK_SRC] = &system_noc_clk_src.clkr, | |
| 2553 | 2456 | [UFS_AXI_CLK_SRC] = &ufs_axi_clk_src.clkr, |
| 2554 | 2457 | [USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr, |
| 2555 | 2458 | [BLSP1_QUP1_I2C_APPS_CLK_SRC] = &blsp1_qup1_i2c_apps_clk_src.clkr, |
| @@ -2696,6 +2599,15 @@ static struct clk_regmap *gcc_msm8994_clocks[] = { · 140 unmodified lines | ||
| 2696 | 2599 | [USB_SS_PHY_LDO] = &usb_ss_phy_ldo.clkr, |
| 2697 | 2600 | [GCC_BOOT_ROM_AHB_CLK] = &gcc_boot_rom_ahb_clk.clkr, |
| 2698 | 2601 | [GCC_PRNG_AHB_CLK] = &gcc_prng_ahb_clk.clkr, |
| 2602 | + | |
| 2603 | + /* | |
| 2604 | + * The following clocks should NOT be managed by this driver, but they once were | |
| 2605 | + * mistakengly added. Now they are only here to indicate that they are not defined | |
| 2606 | + * on purpose, even though the names will stay in the header file (for ABI sanity). | |
| 2607 | + */ | |
| 2608 | + [CONFIG_NOC_CLK_SRC] = NULL, | |
| 2609 | + [PERIPH_NOC_CLK_SRC] = NULL, | |
| 2610 | + [SYSTEM_NOC_CLK_SRC] = NULL, | |
| 2699 | 2611 | }; |
| 2700 | 2612 | |
| 2701 | 2613 | static struct gdsc *gcc_msm8994_gdscs[] = { |
| @@ -1518,6 +1518,10 @@ static int cpufreq_online(unsigned int cpu) · 1517 unmodified lines | ||
| 1518 | 1518 | |
| 1519 | 1519 | kobject_uevent(&policy->kobj, KOBJ_ADD); |
| 1520 | 1520 | |
| 1521 | + /* Callback for handling stuff after policy is ready */ | |
| 1522 | + if (cpufreq_driver->ready) | |
| 1523 | + cpufreq_driver->ready(policy); | |
| 1524 | + | |
| 1521 | 1525 | if (cpufreq_thermal_control_enabled(cpufreq_driver)) |
| 1522 | 1526 | policy->cdev = of_cpufreq_cooling_register(policy); |
| 1523 | 1527 | |
| @@ -388,7 +388,7 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index) · 387 unmodified lines | ||
| 388 | 388 | |
| 389 | 389 | snprintf(data->irq_name, sizeof(data->irq_name), "dcvsh-irq-%u", policy->cpu); |
| 390 | 390 | ret = request_threaded_irq(data->throttle_irq, NULL, qcom_lmh_dcvs_handle_irq, |
| 391 | − IRQF_ONESHOT, data->irq_name, data); | |
| 391 | + IRQF_ONESHOT | IRQF_NO_AUTOEN, data->irq_name, data); | |
| 392 | 392 | if (ret) { |
| 393 | 393 | dev_err(&pdev->dev, "Error registering %s: %d\n", data->irq_name, ret); |
| 394 | 394 | return 0; |
| @@ -542,6 +542,14 @@ static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy) · 147 unmodified lines | ||
| 542 | 542 | return 0; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | +static void qcom_cpufreq_ready(struct cpufreq_policy *policy) | |
| 546 | +{ | |
| 547 | + struct qcom_cpufreq_data *data = policy->driver_data; | |
| 548 | + | |
| 549 | + if (data->throttle_irq >= 0) | |
| 550 | + enable_irq(data->throttle_irq); | |
| 551 | +} | |
| 552 | + | |
| 545 | 553 | static struct freq_attr *qcom_cpufreq_hw_attr[] = { |
| 546 | 554 | &cpufreq_freq_attr_scaling_available_freqs, |
| 547 | 555 | &cpufreq_freq_attr_scaling_boost_freqs, |
| @@ -561,6 +569,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = { · 13 unmodified lines | ||
| 561 | 569 | .fast_switch = qcom_cpufreq_hw_fast_switch, |
| 562 | 570 | .name = "qcom-cpufreq-hw", |
| 563 | 571 | .attr = qcom_cpufreq_hw_attr, |
| 572 | + .ready = qcom_cpufreq_ready, | |
| 564 | 573 | }; |
| 565 | 574 | |
| 566 | 575 | static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) |
| @@ -1681,8 +1681,10 @@ static void at_xdmac_tasklet(struct tasklet_struct *t) · 1680 unmodified lines | ||
| 1681 | 1681 | __func__, atchan->irq_status); |
| 1682 | 1682 | |
| 1683 | 1683 | if (!(atchan->irq_status & AT_XDMAC_CIS_LIS) && |
| 1684 | − !(atchan->irq_status & error_mask)) | |
| 1684 | + !(atchan->irq_status & error_mask)) { | |
| 1685 | + spin_unlock_irq(&atchan->lock); | |
| 1685 | 1686 | return; |
| 1687 | + } | |
| 1686 | 1688 | |
| 1687 | 1689 | if (atchan->irq_status & error_mask) |
| 1688 | 1690 | at_xdmac_handle_error(atchan); |
| @@ -207,7 +207,7 @@ int pt_core_init(struct pt_device *pt) · 206 unmodified lines | ||
| 207 | 207 | if (!cmd_q->qbase) { |
| 208 | 208 | dev_err(dev, "unable to allocate command queue\n"); |
| 209 | 209 | ret = -ENOMEM; |
| 210 | − goto e_dma_alloc; | |
| 210 | + goto e_destroy_pool; | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | cmd_q->qidx = 0; |
| @@ -229,8 +229,10 @@ int pt_core_init(struct pt_device *pt) · 15 unmodified lines | ||
| 229 | 229 | |
| 230 | 230 | /* Request an irq */ |
| 231 | 231 | ret = request_irq(pt->pt_irq, pt_core_irq_handler, 0, dev_name(pt->dev), pt); |
| 232 | − if (ret) | |
| 233 | − goto e_pool; | |
| 232 | + if (ret) { | |
| 233 | + dev_err(dev, "unable to allocate an IRQ\n"); | |
| 234 | + goto e_free_dma; | |
| 235 | + } | |
| 234 | 236 | |
| 235 | 237 | /* Update the device registers with queue information. */ |
| 236 | 238 | cmd_q->qcontrol &= ~CMD_Q_SIZE; |
| @@ -250,21 +252,20 @@ int pt_core_init(struct pt_device *pt) · 13 unmodified lines | ||
| 250 | 252 | /* Register the DMA engine support */ |
| 251 | 253 | ret = pt_dmaengine_register(pt); |
| 252 | 254 | if (ret) |
| 253 | − goto e_dmaengine; | |
| 255 | + goto e_free_irq; | |
| 254 | 256 | |
| 255 | 257 | /* Set up debugfs entries */ |
| 256 | 258 | ptdma_debugfs_setup(pt); |
| 257 | 259 | |
| 258 | 260 | return 0; |
| 259 | 261 | |
| 260 | −e_dmaengine: | |
| 262 | +e_free_irq: | |
| 261 | 263 | free_irq(pt->pt_irq, pt); |
| 262 | 264 | |
| 263 | −e_dma_alloc: | |
| 265 | +e_free_dma: | |
| 264 | 266 | dma_free_coherent(dev, cmd_q->qsize, cmd_q->qbase, cmd_q->qbase_dma); |
| 265 | 267 | |
| 266 | −e_pool: | |
| 267 | − dev_err(dev, "unable to allocate an IRQ\n"); | |
| 268 | +e_destroy_pool: | |
| 268 | 269 | dma_pool_destroy(pt->cmd_q.dma_pool); |
| 269 | 270 | |
| 270 | 271 | return ret; |
| @@ -1868,8 +1868,13 @@ static int rcar_dmac_probe(struct platform_device *pdev) · 1867 unmodified lines | ||
| 1868 | 1868 | |
| 1869 | 1869 | dmac->dev = &pdev->dev; |
| 1870 | 1870 | platform_set_drvdata(pdev, dmac); |
| 1871 | − dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); | |
| 1872 | − dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); | |
| 1871 | + ret = dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); | |
| 1872 | + if (ret) | |
| 1873 | + return ret; | |
| 1874 | + | |
| 1875 | + ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); | |
| 1876 | + if (ret) | |
| 1877 | + return ret; | |
| 1873 | 1878 | |
| 1874 | 1879 | ret = rcar_dmac_parse_of(&pdev->dev, dmac); |
| 1875 | 1880 | if (ret < 0) |
| @@ -115,8 +115,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) · 114 unmodified lines | ||
| 115 | 115 | ret = pm_runtime_get(schan->dev); |
| 116 | 116 | |
| 117 | 117 | spin_unlock_irq(&schan->chan_lock); |
| 118 | − if (ret < 0) | |
| 118 | + if (ret < 0) { | |
| 119 | 119 | dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret); |
| 120 | + pm_runtime_put(schan->dev); | |
| 121 | + } | |
| 120 | 122 | |
| 121 | 123 | pm_runtime_barrier(schan->dev); |
| 122 | 124 | |
| @@ -292,10 +292,12 @@ static int stm32_dmamux_probe(struct platform_device *pdev) · 291 unmodified lines | ||
| 292 | 292 | ret = of_dma_router_register(node, stm32_dmamux_route_allocate, |
| 293 | 293 | &stm32_dmamux->dmarouter); |
| 294 | 294 | if (ret) |
| 295 | − goto err_clk; | |
| 295 | + goto pm_disable; | |
| 296 | 296 | |
| 297 | 297 | return 0; |
| 298 | 298 | |
| 299 | +pm_disable: | |
| 300 | + pm_runtime_disable(&pdev->dev); | |
| 299 | 301 | err_clk: |
| 300 | 302 | clk_disable_unprepare(stm32_dmamux->clk); |
| 301 | 303 | |
| @@ -215,7 +215,7 @@ void *edac_align_ptr(void **p, unsigned int size, int n_elems) · 214 unmodified lines | ||
| 215 | 215 | else |
| 216 | 216 | return (char *)ptr; |
| 217 | 217 | |
| 218 | − r = (unsigned long)p % align; | |
| 218 | + r = (unsigned long)ptr % align; | |
| 219 | 219 | |
| 220 | 220 | if (r == 0) |
| 221 | 221 | return (char *)ptr; |
| @@ -410,10 +410,8 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) · 409 unmodified lines | ||
| 410 | 410 | level = rockchip_gpio_readl(bank, bank->gpio_regs->int_type); |
| 411 | 411 | polarity = rockchip_gpio_readl(bank, bank->gpio_regs->int_polarity); |
| 412 | 412 | |
| 413 | − switch (type) { | |
| 414 | − case IRQ_TYPE_EDGE_BOTH: | |
| 413 | + if (type == IRQ_TYPE_EDGE_BOTH) { | |
| 415 | 414 | if (bank->gpio_type == GPIO_TYPE_V2) { |
| 416 | − bank->toggle_edge_mode &= ~mask; | |
| 417 | 415 | rockchip_gpio_writel_bit(bank, d->hwirq, 1, |
| 418 | 416 | bank->gpio_regs->int_bothedge); |
| 419 | 417 | goto out; |
| @@ -431,30 +429,34 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) · 11 unmodified lines | ||
| 431 | 429 | else |
| 432 | 430 | polarity |= mask; |
| 433 | 431 | } |
| 434 | − break; | |
| 435 | − case IRQ_TYPE_EDGE_RISING: | |
| 436 | − bank->toggle_edge_mode &= ~mask; | |
| 437 | − level |= mask; | |
| 438 | − polarity |= mask; | |
| 439 | − break; | |
| 440 | − case IRQ_TYPE_EDGE_FALLING: | |
| 441 | − bank->toggle_edge_mode &= ~mask; | |
| 442 | − level |= mask; | |
| 443 | − polarity &= ~mask; | |
| 444 | − break; | |
| 445 | − case IRQ_TYPE_LEVEL_HIGH: | |
| 446 | − bank->toggle_edge_mode &= ~mask; | |
| 447 | − level &= ~mask; | |
| 448 | − polarity |= mask; | |
| 449 | − break; | |
| 450 | − case IRQ_TYPE_LEVEL_LOW: | |
| 451 | − bank->toggle_edge_mode &= ~mask; | |
| 452 | − level &= ~mask; | |
| 453 | − polarity &= ~mask; | |
| 454 | − break; | |
| 455 | − default: | |
| 456 | − ret = -EINVAL; | |
| 457 | − goto out; | |
| 432 | + } else { | |
| 433 | + if (bank->gpio_type == GPIO_TYPE_V2) { | |
| 434 | + rockchip_gpio_writel_bit(bank, d->hwirq, 0, | |
| 435 | + bank->gpio_regs->int_bothedge); | |
| 436 | + } else { | |
| 437 | + bank->toggle_edge_mode &= ~mask; | |
| 438 | + } | |
| 439 | + switch (type) { | |
| 440 | + case IRQ_TYPE_EDGE_RISING: | |
| 441 | + level |= mask; | |
| 442 | + polarity |= mask; | |
| 443 | + break; | |
| 444 | + case IRQ_TYPE_EDGE_FALLING: | |
| 445 | + level |= mask; | |
| 446 | + polarity &= ~mask; | |
| 447 | + break; | |
| 448 | + case IRQ_TYPE_LEVEL_HIGH: | |
| 449 | + level &= ~mask; | |
| 450 | + polarity |= mask; | |
| 451 | + break; | |
| 452 | + case IRQ_TYPE_LEVEL_LOW: | |
| 453 | + level &= ~mask; | |
| 454 | + polarity &= ~mask; | |
| 455 | + break; | |
| 456 | + default: | |
| 457 | + ret = -EINVAL; | |
| 458 | + goto out; | |
| 459 | + } | |
| 458 | 460 | } |
| 459 | 461 | |
| 460 | 462 | rockchip_gpio_writel(bank, level, bank->gpio_regs->int_type); |
| @@ -343,9 +343,12 @@ static int tegra186_gpio_of_xlate(struct gpio_chip *chip, · 342 unmodified lines | ||
| 343 | 343 | return offset + pin; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | +#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio) | |
| 347 | + | |
| 346 | 348 | static void tegra186_irq_ack(struct irq_data *data) |
| 347 | 349 | { |
| 348 | − struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); | |
| 350 | + struct gpio_chip *gc = irq_data_get_irq_chip_data(data); | |
| 351 | + struct tegra_gpio *gpio = to_tegra_gpio(gc); | |
| 349 | 352 | void __iomem *base; |
| 350 | 353 | |
| 351 | 354 | base = tegra186_gpio_get_base(gpio, data->hwirq); |
| @@ -357,7 +360,8 @@ static void tegra186_irq_ack(struct irq_data *data) · 5 unmodified lines | ||
| 357 | 360 | |
| 358 | 361 | static void tegra186_irq_mask(struct irq_data *data) |
| 359 | 362 | { |
| 360 | − struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); | |
| 363 | + struct gpio_chip *gc = irq_data_get_irq_chip_data(data); | |
| 364 | + struct tegra_gpio *gpio = to_tegra_gpio(gc); | |
| 361 | 365 | void __iomem *base; |
| 362 | 366 | u32 value; |
| 363 | 367 | |
| @@ -372,7 +376,8 @@ static void tegra186_irq_mask(struct irq_data *data) · 8 unmodified lines | ||
| 372 | 376 | |
| 373 | 377 | static void tegra186_irq_unmask(struct irq_data *data) |
| 374 | 378 | { |
| 375 | − struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); | |
| 379 | + struct gpio_chip *gc = irq_data_get_irq_chip_data(data); | |
| 380 | + struct tegra_gpio *gpio = to_tegra_gpio(gc); | |
| 376 | 381 | void __iomem *base; |
| 377 | 382 | u32 value; |
| 378 | 383 | |
| @@ -387,7 +392,8 @@ static void tegra186_irq_unmask(struct irq_data *data) · 8 unmodified lines | ||
| 387 | 392 | |
| 388 | 393 | static int tegra186_irq_set_type(struct irq_data *data, unsigned int type) |
| 389 | 394 | { |
| 390 | − struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); | |
| 395 | + struct gpio_chip *gc = irq_data_get_irq_chip_data(data); | |
| 396 | + struct tegra_gpio *gpio = to_tegra_gpio(gc); | |
| 391 | 397 | void __iomem *base; |
| 392 | 398 | u32 value; |
| 393 | 399 | |
| @@ -3147,6 +3147,16 @@ int gpiod_to_irq(const struct gpio_desc *desc) · 3146 unmodified lines | ||
| 3147 | 3147 | |
| 3148 | 3148 | return retirq; |
| 3149 | 3149 | } |
| 3150 | +#ifdef CONFIG_GPIOLIB_IRQCHIP | |
| 3151 | + if (gc->irq.chip) { | |
| 3152 | + /* | |
| 3153 | + * Avoid race condition with other code, which tries to lookup | |
| 3154 | + * an IRQ before the irqchip has been properly registered, | |
| 3155 | + * i.e. while gpiochip is still being brought up. | |
| 3156 | + */ | |
| 3157 | + return -EPROBE_DEFER; | |
| 3158 | + } | |
| 3159 | +#endif | |
| 3150 | 3160 | return -ENXIO; |
| 3151 | 3161 | } |
| 3152 | 3162 | EXPORT_SYMBOL_GPL(gpiod_to_irq); |
| @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, · 1140 unmodified lines | ||
| 1141 | 1141 | if (ret) |
| 1142 | 1142 | return ret; |
| 1143 | 1143 | |
| 1144 | − if (!dev->mode_config.allow_fb_modifiers) { | |
| 1144 | + if (!dev->mode_config.allow_fb_modifiers && !adev->enable_virtual_display) { | |
| 1145 | 1145 | drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI, |
| 1146 | 1146 | "GFX9+ requires FB check based on format modifier\n"); |
| 1147 | 1147 | ret = check_tiling_flags_gfx6(rfb); |
| @@ -2011,6 +2011,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 2010 unmodified lines | ||
| 2011 | 2011 | return -ENODEV; |
| 2012 | 2012 | } |
| 2013 | 2013 | |
| 2014 | + if (amdgpu_aspm == -1 && !pcie_aspm_enabled(pdev)) | |
| 2015 | + amdgpu_aspm = 0; | |
| 2016 | + | |
| 2014 | 2017 | if (amdgpu_virtual_display || |
| 2015 | 2018 | amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK)) |
| 2016 | 2019 | supports_atomic = true; |
| @@ -391,7 +391,6 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev, · 390 unmodified lines | ||
| 391 | 391 | int index) |
| 392 | 392 | { |
| 393 | 393 | struct drm_plane *plane; |
| 394 | − uint64_t modifiers[] = {DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID}; | |
| 395 | 394 | int ret; |
| 396 | 395 | |
| 397 | 396 | plane = kzalloc(sizeof(*plane), GFP_KERNEL); |
| @@ -402,7 +401,7 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev, · 4 unmodified lines | ||
| 402 | 401 | &amdgpu_vkms_plane_funcs, |
| 403 | 402 | amdgpu_vkms_formats, |
| 404 | 403 | ARRAY_SIZE(amdgpu_vkms_formats), |
| 405 | − modifiers, type, NULL); | |
| 404 | + NULL, type, NULL); | |
| 406 | 405 | if (ret) { |
| 407 | 406 | kfree(plane); |
| 408 | 407 | return ERR_PTR(ret); |
| @@ -768,11 +768,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 767 unmodified lines | ||
| 768 | 768 | * Check if all VM PDs/PTs are ready for updates |
| 769 | 769 | * |
| 770 | 770 | * Returns: |
| 771 | − * True if eviction list is empty. | |
| 771 | + * True if VM is not evicting. | |
| 772 | 772 | */ |
| 773 | 773 | bool amdgpu_vm_ready(struct amdgpu_vm *vm) |
| 774 | 774 | { |
| 775 | − return list_empty(&vm->evicted); | |
| 775 | + bool ret; | |
| 776 | + | |
| 777 | + amdgpu_vm_eviction_lock(vm); | |
| 778 | + ret = !vm->evicting; | |
| 779 | + amdgpu_vm_eviction_unlock(vm); | |
| 780 | + return ret; | |
| 776 | 781 | } |
| 777 | 782 | |
| 778 | 783 | /** |
| @@ -2057,6 +2057,10 @@ static int sdma_v4_0_suspend(void *handle) · 2056 unmodified lines | ||
| 2057 | 2057 | { |
| 2058 | 2058 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 2059 | 2059 | |
| 2060 | + /* SMU saves SDMA state for us */ | |
| 2061 | + if (adev->in_s0ix) | |
| 2062 | + return 0; | |
| 2063 | + | |
| 2060 | 2064 | return sdma_v4_0_hw_fini(adev); |
| 2061 | 2065 | } |
| 2062 | 2066 | |
| @@ -2064,6 +2068,10 @@ static int sdma_v4_0_resume(void *handle) · 1 unmodified line | ||
| 2064 | 2068 | { |
| 2065 | 2069 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 2066 | 2070 | |
| 2071 | + /* SMU restores SDMA state for us */ | |
| 2072 | + if (adev->in_s0ix) | |
| 2073 | + return 0; | |
| 2074 | + | |
| 2067 | 2075 | return sdma_v4_0_hw_init(adev); |
| 2068 | 2076 | } |
| 2069 | 2077 | |
| @@ -619,8 +619,8 @@ soc15_asic_reset_method(struct amdgpu_device *adev) · 618 unmodified lines | ||
| 619 | 619 | static int soc15_asic_reset(struct amdgpu_device *adev) |
| 620 | 620 | { |
| 621 | 621 | /* original raven doesn't have full asic reset */ |
| 622 | − if ((adev->apu_flags & AMD_APU_IS_RAVEN) && | |
| 623 | − !(adev->apu_flags & AMD_APU_IS_RAVEN2)) | |
| 622 | + if ((adev->apu_flags & AMD_APU_IS_RAVEN) || | |
| 623 | + (adev->apu_flags & AMD_APU_IS_RAVEN2)) | |
| 624 | 624 | return 0; |
| 625 | 625 | |
| 626 | 626 | switch (soc15_asic_reset_method(adev)) { |
| @@ -1114,8 +1114,11 @@ static int soc15_common_early_init(void *handle) · 487 unmodified lines | ||
| 1114 | 1114 | AMD_CG_SUPPORT_SDMA_LS | |
| 1115 | 1115 | AMD_CG_SUPPORT_VCN_MGCG; |
| 1116 | 1116 | |
| 1117 | + /* | |
| 1118 | + * MMHUB PG needs to be disabled for Picasso for | |
| 1119 | + * stability reasons. | |
| 1120 | + */ | |
| 1117 | 1121 | adev->pg_flags = AMD_PG_SUPPORT_SDMA | |
| 1118 | − AMD_PG_SUPPORT_MMHUB | | |
| 1119 | 1122 | AMD_PG_SUPPORT_VCN; |
| 1120 | 1123 | } else { |
| 1121 | 1124 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
| @@ -4256,6 +4256,9 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 4255 unmodified lines | ||
| 4256 | 4256 | } |
| 4257 | 4257 | #endif |
| 4258 | 4258 | |
| 4259 | + /* Disable vblank IRQs aggressively for power-saving. */ | |
| 4260 | + adev_to_drm(adev)->vblank_disable_immediate = true; | |
| 4261 | + | |
| 4259 | 4262 | /* loops over all connectors on the board */ |
| 4260 | 4263 | for (i = 0; i < link_cnt; i++) { |
| 4261 | 4264 | struct dc_link *link = NULL; |
| @@ -4301,19 +4304,17 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 39 unmodified lines | ||
| 4301 | 4304 | update_connector_ext_caps(aconnector); |
| 4302 | 4305 | if (psr_feature_enabled) |
| 4303 | 4306 | amdgpu_dm_set_psr_caps(link); |
| 4307 | + | |
| 4308 | + /* TODO: Fix vblank control helpers to delay PSR entry to allow this when | |
| 4309 | + * PSR is also supported. | |
| 4310 | + */ | |
| 4311 | + if (link->psr_settings.psr_feature_enabled) | |
| 4312 | + adev_to_drm(adev)->vblank_disable_immediate = false; | |
| 4304 | 4313 | } |
| 4305 | 4314 | |
| 4306 | 4315 | |
| 4307 | 4316 | } |
| 4308 | 4317 | |
| 4309 | − /* | |
| 4310 | − * Disable vblank IRQs aggressively for power-saving. | |
| 4311 | − * | |
| 4312 | − * TODO: Fix vblank control helpers to delay PSR entry to allow this when PSR | |
| 4313 | − * is also supported. | |
| 4314 | − */ | |
| 4315 | − adev_to_drm(adev)->vblank_disable_immediate = !psr_feature_enabled; | |
| 4316 | − | |
| 4317 | 4318 | /* Software is initialized. Now we can register interrupt handlers. */ |
| 4318 | 4319 | switch (adev->asic_type) { |
| 4319 | 4320 | #if defined(CONFIG_DRM_AMD_DC_SI) |
| @@ -473,8 +473,10 @@ static void dcn3_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base) · 472 unmodified lines | ||
| 473 | 473 | clk_mgr_base->bw_params->dc_mode_softmax_memclk = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_UCLK); |
| 474 | 474 | |
| 475 | 475 | /* Refresh bounding box */ |
| 476 | + DC_FP_START(); | |
| 476 | 477 | clk_mgr_base->ctx->dc->res_pool->funcs->update_bw_bounding_box( |
| 477 | 478 | clk_mgr->base.ctx->dc, clk_mgr_base->bw_params); |
| 479 | + DC_FP_END(); | |
| 478 | 480 | } |
| 479 | 481 | |
| 480 | 482 | static bool dcn3_is_smu_present(struct clk_mgr *clk_mgr_base) |
| @@ -985,10 +985,13 @@ static bool dc_construct(struct dc *dc, · 984 unmodified lines | ||
| 985 | 985 | goto fail; |
| 986 | 986 | #ifdef CONFIG_DRM_AMD_DC_DCN |
| 987 | 987 | dc->clk_mgr->force_smu_not_present = init_params->force_smu_not_present; |
| 988 | −#endif | |
| 989 | 988 | |
| 990 | − if (dc->res_pool->funcs->update_bw_bounding_box) | |
| 989 | + if (dc->res_pool->funcs->update_bw_bounding_box) { | |
| 990 | + DC_FP_START(); | |
| 991 | 991 | dc->res_pool->funcs->update_bw_bounding_box(dc, dc->clk_mgr->bw_params); |
| 992 | + DC_FP_END(); | |
| 993 | + } | |
| 994 | +#endif | |
| 992 | 995 | |
| 993 | 996 | /* Creation of current_state must occur after dc->dml |
| 994 | 997 | * is initialized in dc_create_resource_pool because |
| @@ -1964,10 +1964,6 @@ enum dc_status dc_remove_stream_from_ctx( · 1963 unmodified lines | ||
| 1964 | 1964 | dc->res_pool, |
| 1965 | 1965 | del_pipe->stream_res.stream_enc, |
| 1966 | 1966 | false); |
| 1967 | − /* Release link encoder from stream in new dc_state. */ | |
| 1968 | − if (dc->res_pool->funcs->link_enc_unassign) | |
| 1969 | − dc->res_pool->funcs->link_enc_unassign(new_ctx, del_pipe->stream); | |
| 1970 | − | |
| 1971 | 1967 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 1972 | 1968 | if (is_dp_128b_132b_signal(del_pipe)) { |
| 1973 | 1969 | update_hpo_dp_stream_engine_usage( |
| @@ -421,6 +421,36 @@ static int sienna_cichlid_store_powerplay_table(struct smu_context *smu) · 420 unmodified lines | ||
| 421 | 421 | return 0; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | +static int sienna_cichlid_patch_pptable_quirk(struct smu_context *smu) | |
| 425 | +{ | |
| 426 | + struct amdgpu_device *adev = smu->adev; | |
| 427 | + uint32_t *board_reserved; | |
| 428 | + uint16_t *freq_table_gfx; | |
| 429 | + uint32_t i; | |
| 430 | + | |
| 431 | + /* Fix some OEM SKU specific stability issues */ | |
| 432 | + GET_PPTABLE_MEMBER(BoardReserved, &board_reserved); | |
| 433 | + if ((adev->pdev->device == 0x73DF) && | |
| 434 | + (adev->pdev->revision == 0XC3) && | |
| 435 | + (adev->pdev->subsystem_device == 0x16C2) && | |
| 436 | + (adev->pdev->subsystem_vendor == 0x1043)) | |
| 437 | + board_reserved[0] = 1387; | |
| 438 | + | |
| 439 | + GET_PPTABLE_MEMBER(FreqTableGfx, &freq_table_gfx); | |
| 440 | + if ((adev->pdev->device == 0x73DF) && | |
| 441 | + (adev->pdev->revision == 0XC3) && | |
| 442 | + ((adev->pdev->subsystem_device == 0x16C2) || | |
| 443 | + (adev->pdev->subsystem_device == 0x133C)) && | |
| 444 | + (adev->pdev->subsystem_vendor == 0x1043)) { | |
| 445 | + for (i = 0; i < NUM_GFXCLK_DPM_LEVELS; i++) { | |
| 446 | + if (freq_table_gfx[i] > 2500) | |
| 447 | + freq_table_gfx[i] = 2500; | |
| 448 | + } | |
| 449 | + } | |
| 450 | + | |
| 451 | + return 0; | |
| 452 | +} | |
| 453 | + | |
| 424 | 454 | static int sienna_cichlid_setup_pptable(struct smu_context *smu) |
| 425 | 455 | { |
| 426 | 456 | int ret = 0; |
| @@ -441,7 +471,7 @@ static int sienna_cichlid_setup_pptable(struct smu_context *smu) · 14 unmodified lines | ||
| 441 | 471 | if (ret) |
| 442 | 472 | return ret; |
| 443 | 473 | |
| 444 | − return ret; | |
| 474 | + return sienna_cichlid_patch_pptable_quirk(smu); | |
| 445 | 475 | } |
| 446 | 476 | |
| 447 | 477 | static int sienna_cichlid_tables_init(struct smu_context *smu) |
| @@ -1238,21 +1268,37 @@ static int sienna_cichlid_populate_umd_state_clk(struct smu_context *smu) · 790 unmodified lines | ||
| 1238 | 1268 | &dpm_context->dpm_tables.soc_table; |
| 1239 | 1269 | struct smu_umd_pstate_table *pstate_table = |
| 1240 | 1270 | &smu->pstate_table; |
| 1271 | + struct amdgpu_device *adev = smu->adev; | |
| 1241 | 1272 | |
| 1242 | 1273 | pstate_table->gfxclk_pstate.min = gfx_table->min; |
| 1243 | 1274 | pstate_table->gfxclk_pstate.peak = gfx_table->max; |
| 1244 | − if (gfx_table->max >= SIENNA_CICHLID_UMD_PSTATE_PROFILING_GFXCLK) | |
| 1245 | − pstate_table->gfxclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_GFXCLK; | |
| 1246 | 1275 | |
| 1247 | 1276 | pstate_table->uclk_pstate.min = mem_table->min; |
| 1248 | 1277 | pstate_table->uclk_pstate.peak = mem_table->max; |
| 1249 | − if (mem_table->max >= SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK) | |
| 1250 | − pstate_table->uclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK; | |
| 1251 | 1278 | |
| 1252 | 1279 | pstate_table->socclk_pstate.min = soc_table->min; |
| 1253 | 1280 | pstate_table->socclk_pstate.peak = soc_table->max; |
| 1254 | − if (soc_table->max >= SIENNA_CICHLID_UMD_PSTATE_PROFILING_SOCCLK) | |
| 1281 | + | |
| 1282 | + switch (adev->asic_type) { | |
| 1283 | + case CHIP_SIENNA_CICHLID: | |
| 1284 | + case CHIP_NAVY_FLOUNDER: | |
| 1285 | + pstate_table->gfxclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_GFXCLK; | |
| 1286 | + pstate_table->uclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK; | |
| 1255 | 1287 | pstate_table->socclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_SOCCLK; |
| 1288 | + break; | |
| 1289 | + case CHIP_DIMGREY_CAVEFISH: | |
| 1290 | + pstate_table->gfxclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_GFXCLK; | |
| 1291 | + pstate_table->uclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_MEMCLK; | |
| 1292 | + pstate_table->socclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_SOCCLK; | |
| 1293 | + break; | |
| 1294 | + case CHIP_BEIGE_GOBY: | |
| 1295 | + pstate_table->gfxclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_GFXCLK; | |
| 1296 | + pstate_table->uclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_MEMCLK; | |
| 1297 | + pstate_table->socclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_SOCCLK; | |
| 1298 | + break; | |
| 1299 | + default: | |
| 1300 | + break; | |
| 1301 | + } | |
| 1256 | 1302 | |
| 1257 | 1303 | return 0; |
| 1258 | 1304 | } |
| @@ -33,6 +33,14 @@ typedef enum { · 32 unmodified lines | ||
| 33 | 33 | #define SIENNA_CICHLID_UMD_PSTATE_PROFILING_SOCCLK 960 |
| 34 | 34 | #define SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK 1000 |
| 35 | 35 | |
| 36 | +#define DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_GFXCLK 1950 | |
| 37 | +#define DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_SOCCLK 960 | |
| 38 | +#define DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_MEMCLK 676 | |
| 39 | + | |
| 40 | +#define BEIGE_GOBY_UMD_PSTATE_PROFILING_GFXCLK 2200 | |
| 41 | +#define BEIGE_GOBY_UMD_PSTATE_PROFILING_SOCCLK 960 | |
| 42 | +#define BEIGE_GOBY_UMD_PSTATE_PROFILING_MEMCLK 1000 | |
| 43 | + | |
| 36 | 44 | extern void sienna_cichlid_set_ppt_funcs(struct smu_context *smu); |
| 37 | 45 | |
| 38 | 46 | #endif |
| @@ -282,14 +282,9 @@ static int yellow_carp_post_smu_init(struct smu_context *smu) · 281 unmodified lines | ||
| 282 | 282 | |
| 283 | 283 | static int yellow_carp_mode_reset(struct smu_context *smu, int type) |
| 284 | 284 | { |
| 285 | − int ret = 0, index = 0; | |
| 286 | − | |
| 287 | − index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG, | |
| 288 | − SMU_MSG_GfxDeviceDriverReset); | |
| 289 | − if (index < 0) | |
| 290 | − return index == -EACCES ? 0 : index; | |
| 285 | + int ret = 0; | |
| 291 | 286 | |
| 292 | − ret = smu_cmn_send_smc_msg_with_param(smu, (uint16_t)index, type, NULL); | |
| 287 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset, type, NULL); | |
| 293 | 288 | if (ret) |
| 294 | 289 | dev_err(smu->adev->dev, "Failed to mode reset!\n"); |
| 295 | 290 | |
| @@ -76,15 +76,17 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, · 75 unmodified lines | ||
| 76 | 76 | state->mode_blob = NULL; |
| 77 | 77 | |
| 78 | 78 | if (mode) { |
| 79 | + struct drm_property_blob *blob; | |
| 80 | + | |
| 79 | 81 | drm_mode_convert_to_umode(&umode, mode); |
| 80 | − state->mode_blob = | |
| 81 | − drm_property_create_blob(state->crtc->dev, | |
| 82 | − sizeof(umode), | |
| 83 | − &umode); | |
| 84 | − if (IS_ERR(state->mode_blob)) | |
| 85 | − return PTR_ERR(state->mode_blob); | |
| 82 | + blob = drm_property_create_blob(crtc->dev, | |
| 83 | + sizeof(umode), &umode); | |
| 84 | + if (IS_ERR(blob)) | |
| 85 | + return PTR_ERR(blob); | |
| 86 | 86 | |
| 87 | 87 | drm_mode_copy(&state->mode, mode); |
| 88 | + | |
| 89 | + state->mode_blob = blob; | |
| 88 | 90 | state->enable = true; |
| 89 | 91 | drm_dbg_atomic(crtc->dev, |
| 90 | 92 | "Set [MODE:%s] for [CRTC:%d:%s] state %p\n", |
| @@ -5345,6 +5345,7 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi · 5344 unmodified lines | ||
| 5345 | 5345 | if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) |
| 5346 | 5346 | return quirks; |
| 5347 | 5347 | |
| 5348 | + info->color_formats |= DRM_COLOR_FORMAT_RGB444; | |
| 5348 | 5349 | drm_parse_cea_ext(connector, edid); |
| 5349 | 5350 | |
| 5350 | 5351 | /* |
| @@ -5393,7 +5394,6 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi · 42 unmodified lines | ||
| 5393 | 5394 | DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n", |
| 5394 | 5395 | connector->name, info->bpc); |
| 5395 | 5396 | |
| 5396 | − info->color_formats |= DRM_COLOR_FORMAT_RGB444; | |
| 5397 | 5397 | if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) |
| 5398 | 5398 | info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; |
| 5399 | 5399 | if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422) |
| @@ -512,6 +512,7 @@ int drm_gem_cma_mmap(struct drm_gem_cma_object *cma_obj, struct vm_area_struct * · 511 unmodified lines | ||
| 512 | 512 | */ |
| 513 | 513 | vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node); |
| 514 | 514 | vma->vm_flags &= ~VM_PFNMAP; |
| 515 | + vma->vm_flags |= VM_DONTEXPAND; | |
| 515 | 516 | |
| 516 | 517 | if (cma_obj->map_noncoherent) { |
| 517 | 518 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
| @@ -101,6 +101,7 @@ config DRM_I915_USERPTR · 100 unmodified lines | ||
| 101 | 101 | config DRM_I915_GVT |
| 102 | 102 | bool "Enable Intel GVT-g graphics virtualization host support" |
| 103 | 103 | depends on DRM_I915 |
| 104 | + depends on X86 | |
| 104 | 105 | depends on 64BIT |
| 105 | 106 | default n |
| 106 | 107 | help |
| @@ -825,6 +825,7 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 824 unmodified lines | ||
| 825 | 825 | unsigned int max_bw_point = 0, max_bw = 0; |
| 826 | 826 | unsigned int num_qgv_points = dev_priv->max_bw[0].num_qgv_points; |
| 827 | 827 | unsigned int num_psf_gv_points = dev_priv->max_bw[0].num_psf_gv_points; |
| 828 | + bool changed = false; | |
| 828 | 829 | u32 mask = 0; |
| 829 | 830 | |
| 830 | 831 | /* FIXME earlier gens need some checks too */ |
| @@ -868,6 +869,8 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 37 unmodified lines | ||
| 868 | 869 | new_bw_state->data_rate[crtc->pipe] = new_data_rate; |
| 869 | 870 | new_bw_state->num_active_planes[crtc->pipe] = new_active_planes; |
| 870 | 871 | |
| 872 | + changed = true; | |
| 873 | + | |
| 871 | 874 | drm_dbg_kms(&dev_priv->drm, |
| 872 | 875 | "pipe %c data rate %u num active planes %u\n", |
| 873 | 876 | pipe_name(crtc->pipe), |
| @@ -875,7 +878,19 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 1 unmodified line | ||
| 875 | 878 | new_bw_state->num_active_planes[crtc->pipe]); |
| 876 | 879 | } |
| 877 | 880 | |
| 878 | − if (!new_bw_state) | |
| 881 | + old_bw_state = intel_atomic_get_old_bw_state(state); | |
| 882 | + new_bw_state = intel_atomic_get_new_bw_state(state); | |
| 883 | + | |
| 884 | + if (new_bw_state && | |
| 885 | + intel_can_enable_sagv(dev_priv, old_bw_state) != | |
| 886 | + intel_can_enable_sagv(dev_priv, new_bw_state)) | |
| 887 | + changed = true; | |
| 888 | + | |
| 889 | + /* | |
| 890 | + * If none of our inputs (data rates, number of active | |
| 891 | + * planes, SAGV yes/no) changed then nothing to do here. | |
| 892 | + */ | |
| 893 | + if (!changed) | |
| 879 | 894 | return 0; |
| 880 | 895 | |
| 881 | 896 | ret = intel_atomic_lock_global_state(&new_bw_state->base); |
| @@ -961,7 +976,6 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 79 unmodified lines | ||
| 961 | 976 | */ |
| 962 | 977 | new_bw_state->qgv_points_mask = ~allowed_points & mask; |
| 963 | 978 | |
| 964 | − old_bw_state = intel_atomic_get_old_bw_state(state); | |
| 965 | 979 | /* |
| 966 | 980 | * If the actual mask had changed we need to make sure that |
| 967 | 981 | * the commits are serialized(in case this is a nomodeset, nonblocking) |
| @@ -30,19 +30,19 @@ struct intel_bw_state { · 29 unmodified lines | ||
| 30 | 30 | */ |
| 31 | 31 | u8 pipe_sagv_reject; |
| 32 | 32 | |
| 33 | + /* bitmask of active pipes */ | |
| 34 | + u8 active_pipes; | |
| 35 | + | |
| 33 | 36 | /* |
| 34 | 37 | * Current QGV points mask, which restricts |
| 35 | 38 | * some particular SAGV states, not to confuse |
| 36 | 39 | * with pipe_sagv_mask. |
| 37 | 40 | */ |
| 38 | − u8 qgv_points_mask; | |
| 41 | + u16 qgv_points_mask; | |
| 39 | 42 | |
| 40 | 43 | unsigned int data_rate[I915_MAX_PIPES]; |
| 41 | 44 | u8 num_active_planes[I915_MAX_PIPES]; |
| 42 | 45 | |
| 43 | − /* bitmask of active pipes */ | |
| 44 | − u8 active_pipes; | |
| 45 | − | |
| 46 | 46 | int min_cdclk; |
| 47 | 47 | }; |
| 48 | 48 | |
| @@ -1115,7 +1115,8 @@ static int intel_fbc_check_plane(struct intel_atomic_state *state, · 1114 unmodified lines | ||
| 1115 | 1115 | |
| 1116 | 1116 | /* Wa_22010751166: icl, ehl, tgl, dg1, rkl */ |
| 1117 | 1117 | if (DISPLAY_VER(i915) >= 11 && |
| 1118 | − (plane_state->view.color_plane[0].y + drm_rect_height(&plane_state->uapi.src)) & 3) { | |
| 1118 | + (plane_state->view.color_plane[0].y + | |
| 1119 | + (drm_rect_height(&plane_state->uapi.src) >> 16)) & 3) { | |
| 1119 | 1120 | plane_state->no_fbc_reason = "plane end Y offset misaligned"; |
| 1120 | 1121 | return false; |
| 1121 | 1122 | } |
| @@ -360,6 +360,21 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, · 359 unmodified lines | ||
| 360 | 360 | port++; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | + /* | |
| 364 | + * The port numbering and mapping here is bizarre. The now-obsolete | |
| 365 | + * swsci spec supports ports numbered [0..4]. Port E is handled as a | |
| 366 | + * special case, but port F and beyond are not. The functionality is | |
| 367 | + * supposed to be obsolete for new platforms. Just bail out if the port | |
| 368 | + * number is out of bounds after mapping. | |
| 369 | + */ | |
| 370 | + if (port > 4) { | |
| 371 | + drm_dbg_kms(&dev_priv->drm, | |
| 372 | + "[ENCODER:%d:%s] port %c (index %u) out of bounds for display power state notification\n", | |
| 373 | + intel_encoder->base.base.id, intel_encoder->base.name, | |
| 374 | + port_name(intel_encoder->port), port); | |
| 375 | + return -EINVAL; | |
| 376 | + } | |
| 377 | + | |
| 363 | 378 | if (!enable) |
| 364 | 379 | parm |= 4 << 8; |
| 365 | 380 | |
| @@ -34,7 +34,7 @@ void intel_snps_phy_wait_for_calibration(struct drm_i915_private *dev_priv) · 33 unmodified lines | ||
| 34 | 34 | if (intel_de_wait_for_clear(dev_priv, ICL_PHY_MISC(phy), |
| 35 | 35 | DG2_PHY_DP_TX_ACK_MASK, 25)) |
| 36 | 36 | DRM_ERROR("SNPS PHY %c failed to calibrate after 25ms.\n", |
| 37 | − phy); | |
| 37 | + phy_name(phy)); | |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| @@ -691,6 +691,8 @@ void intel_tc_port_sanitize(struct intel_digital_port *dig_port) · 690 unmodified lines | ||
| 691 | 691 | { |
| 692 | 692 | struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); |
| 693 | 693 | struct intel_encoder *encoder = &dig_port->base; |
| 694 | + intel_wakeref_t tc_cold_wref; | |
| 695 | + enum intel_display_power_domain domain; | |
| 694 | 696 | int active_links = 0; |
| 695 | 697 | |
| 696 | 698 | mutex_lock(&dig_port->tc_lock); |
| @@ -702,12 +704,11 @@ void intel_tc_port_sanitize(struct intel_digital_port *dig_port) · 5 unmodified lines | ||
| 702 | 704 | |
| 703 | 705 | drm_WARN_ON(&i915->drm, dig_port->tc_mode != TC_PORT_DISCONNECTED); |
| 704 | 706 | drm_WARN_ON(&i915->drm, dig_port->tc_lock_wakeref); |
| 705 | − if (active_links) { | |
| 706 | − enum intel_display_power_domain domain; | |
| 707 | − intel_wakeref_t tc_cold_wref = tc_cold_block(dig_port, &domain); | |
| 708 | 707 | |
| 709 | − dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port); | |
| 708 | + tc_cold_wref = tc_cold_block(dig_port, &domain); | |
| 710 | 709 | |
| 710 | + dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port); | |
| 711 | + if (active_links) { | |
| 711 | 712 | if (!icl_tc_phy_is_connected(dig_port)) |
| 712 | 713 | drm_dbg_kms(&i915->drm, |
| 713 | 714 | "Port %s: PHY disconnected with %d active link(s)\n", |
| @@ -716,10 +717,23 @@ void intel_tc_port_sanitize(struct intel_digital_port *dig_port) · 2 unmodified lines | ||
| 716 | 717 | |
| 717 | 718 | dig_port->tc_lock_wakeref = tc_cold_block(dig_port, |
| 718 | 719 | &dig_port->tc_lock_power_domain); |
| 719 | − | |
| 720 | − tc_cold_unblock(dig_port, domain, tc_cold_wref); | |
| 720 | + } else { | |
| 721 | + /* | |
| 722 | + * TBT-alt is the default mode in any case the PHY ownership is not | |
| 723 | + * held (regardless of the sink's connected live state), so | |
| 724 | + * we'll just switch to disconnected mode from it here without | |
| 725 | + * a note. | |
| 726 | + */ | |
| 727 | + if (dig_port->tc_mode != TC_PORT_TBT_ALT) | |
| 728 | + drm_dbg_kms(&i915->drm, | |
| 729 | + "Port %s: PHY left in %s mode on disabled port, disconnecting it\n", | |
| 730 | + dig_port->tc_port_name, | |
| 731 | + tc_port_mode_name(dig_port->tc_mode)); | |
| 732 | + icl_tc_phy_disconnect(dig_port); | |
| 721 | 733 | } |
| 722 | 734 | |
| 735 | + tc_cold_unblock(dig_port, domain, tc_cold_wref); | |
| 736 | + | |
| 723 | 737 | drm_dbg_kms(&i915->drm, "Port %s: sanitize mode (%s)\n", |
| 724 | 738 | dig_port->tc_port_name, |
| 725 | 739 | tc_port_mode_name(dig_port->tc_mode)); |
| @@ -842,11 +842,9 @@ void i915_ttm_adjust_lru(struct drm_i915_gem_object *obj) · 841 unmodified lines | ||
| 842 | 842 | } else if (obj->mm.madv != I915_MADV_WILLNEED) { |
| 843 | 843 | bo->priority = I915_TTM_PRIO_PURGE; |
| 844 | 844 | } else if (!i915_gem_object_has_pages(obj)) { |
| 845 | − if (bo->priority < I915_TTM_PRIO_HAS_PAGES) | |
| 846 | − bo->priority = I915_TTM_PRIO_HAS_PAGES; | |
| 845 | + bo->priority = I915_TTM_PRIO_NO_PAGES; | |
| 847 | 846 | } else { |
| 848 | − if (bo->priority > I915_TTM_PRIO_NO_PAGES) | |
| 849 | − bo->priority = I915_TTM_PRIO_NO_PAGES; | |
| 847 | + bo->priority = I915_TTM_PRIO_HAS_PAGES; | |
| 850 | 848 | } |
| 851 | 849 | |
| 852 | 850 | ttm_bo_move_to_lru_tail(bo, bo->resource, NULL); |
| @@ -1148,7 +1148,7 @@ static inline void ppgtt_generate_shadow_entry(struct intel_gvt_gtt_entry *se, · 1147 unmodified lines | ||
| 1148 | 1148 | ops->set_pfn(se, s->shadow_page.mfn); |
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | −/** | |
| 1151 | +/* | |
| 1152 | 1152 | * Check if can do 2M page |
| 1153 | 1153 | * @vgpu: target vgpu |
| 1154 | 1154 | * @entry: target pfn's gtt entry |
| @@ -2193,7 +2193,7 @@ static int emulate_ggtt_mmio_read(struct intel_vgpu *vgpu, · 1038 unmodified lines | ||
| 2193 | 2193 | } |
| 2194 | 2194 | |
| 2195 | 2195 | /** |
| 2196 | − * intel_vgpu_emulate_gtt_mmio_read - emulate GTT MMIO register read | |
| 2196 | + * intel_vgpu_emulate_ggtt_mmio_read - emulate GTT MMIO register read | |
| 2197 | 2197 | * @vgpu: a vGPU |
| 2198 | 2198 | * @off: register offset |
| 2199 | 2199 | * @p_data: data will be returned to guest |
| @@ -4029,6 +4029,17 @@ static int intel_compute_sagv_mask(struct intel_atomic_state *state) · 4028 unmodified lines | ||
| 4029 | 4029 | return ret; |
| 4030 | 4030 | } |
| 4031 | 4031 | |
| 4032 | + if (intel_can_enable_sagv(dev_priv, new_bw_state) != | |
| 4033 | + intel_can_enable_sagv(dev_priv, old_bw_state)) { | |
| 4034 | + ret = intel_atomic_serialize_global_state(&new_bw_state->base); | |
| 4035 | + if (ret) | |
| 4036 | + return ret; | |
| 4037 | + } else if (new_bw_state->pipe_sagv_reject != old_bw_state->pipe_sagv_reject) { | |
| 4038 | + ret = intel_atomic_lock_global_state(&new_bw_state->base); | |
| 4039 | + if (ret) | |
| 4040 | + return ret; | |
| 4041 | + } | |
| 4042 | + | |
| 4032 | 4043 | for_each_new_intel_crtc_in_state(state, crtc, |
| 4033 | 4044 | new_crtc_state, i) { |
| 4034 | 4045 | struct skl_pipe_wm *pipe_wm = &new_crtc_state->wm.skl.optimal; |
| @@ -4044,17 +4055,6 @@ static int intel_compute_sagv_mask(struct intel_atomic_state *state) · 9 unmodified lines | ||
| 4044 | 4055 | intel_can_enable_sagv(dev_priv, new_bw_state); |
| 4045 | 4056 | } |
| 4046 | 4057 | |
| 4047 | − if (intel_can_enable_sagv(dev_priv, new_bw_state) != | |
| 4048 | − intel_can_enable_sagv(dev_priv, old_bw_state)) { | |
| 4049 | − ret = intel_atomic_serialize_global_state(&new_bw_state->base); | |
| 4050 | − if (ret) | |
| 4051 | − return ret; | |
| 4052 | − } else if (new_bw_state->pipe_sagv_reject != old_bw_state->pipe_sagv_reject) { | |
| 4053 | − ret = intel_atomic_lock_global_state(&new_bw_state->base); | |
| 4054 | − if (ret) | |
| 4055 | − return ret; | |
| 4056 | − } | |
| 4057 | − | |
| 4058 | 4058 | return 0; |
| 4059 | 4059 | } |
| 4060 | 4060 | |
| @@ -4853,7 +4853,7 @@ static bool check_mbus_joined(u8 active_pipes, · 792 unmodified lines | ||
| 4853 | 4853 | { |
| 4854 | 4854 | int i; |
| 4855 | 4855 | |
| 4856 | − for (i = 0; i < dbuf_slices[i].active_pipes; i++) { | |
| 4856 | + for (i = 0; dbuf_slices[i].active_pipes != 0; i++) { | |
| 4857 | 4857 | if (dbuf_slices[i].active_pipes == active_pipes) |
| 4858 | 4858 | return dbuf_slices[i].join_mbus; |
| 4859 | 4859 | } |
| @@ -4870,7 +4870,7 @@ static u8 compute_dbuf_slices(enum pipe pipe, u8 active_pipes, bool join_mbus, · 10 unmodified lines | ||
| 4870 | 4870 | { |
| 4871 | 4871 | int i; |
| 4872 | 4872 | |
| 4873 | − for (i = 0; i < dbuf_slices[i].active_pipes; i++) { | |
| 4873 | + for (i = 0; dbuf_slices[i].active_pipes != 0; i++) { | |
| 4874 | 4874 | if (dbuf_slices[i].active_pipes == active_pipes && |
| 4875 | 4875 | dbuf_slices[i].join_mbus == join_mbus) |
| 4876 | 4876 | return dbuf_slices[i].dbuf_mask[pipe]; |
| @@ -2,6 +2,7 @@ config DRM_IMX_DCSS · 1 unmodified line | ||
| 2 | 2 | tristate "i.MX8MQ DCSS" |
| 3 | 3 | select IMX_IRQSTEER |
| 4 | 4 | select DRM_KMS_HELPER |
| 5 | + select DRM_GEM_CMA_HELPER | |
| 5 | 6 | select VIDEOMODE_HELPERS |
| 6 | 7 | depends on DRM && ARCH_MXC && ARM64 |
| 7 | 8 | help |
| @@ -786,18 +786,101 @@ void mtk_dsi_ddp_stop(struct device *dev) · 785 unmodified lines | ||
| 786 | 786 | mtk_dsi_poweroff(dsi); |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | +static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) | |
| 790 | +{ | |
| 791 | + int ret; | |
| 792 | + | |
| 793 | + ret = drm_simple_encoder_init(drm, &dsi->encoder, | |
| 794 | + DRM_MODE_ENCODER_DSI); | |
| 795 | + if (ret) { | |
| 796 | + DRM_ERROR("Failed to encoder init to drm\n"); | |
| 797 | + return ret; | |
| 798 | + } | |
| 799 | + | |
| 800 | + dsi->encoder.possible_crtcs = mtk_drm_find_possible_crtc_by_comp(drm, dsi->host.dev); | |
| 801 | + | |
| 802 | + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, | |
| 803 | + DRM_BRIDGE_ATTACH_NO_CONNECTOR); | |
| 804 | + if (ret) | |
| 805 | + goto err_cleanup_encoder; | |
| 806 | + | |
| 807 | + dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder); | |
| 808 | + if (IS_ERR(dsi->connector)) { | |
| 809 | + DRM_ERROR("Unable to create bridge connector\n"); | |
| 810 | + ret = PTR_ERR(dsi->connector); | |
| 811 | + goto err_cleanup_encoder; | |
| 812 | + } | |
| 813 | + drm_connector_attach_encoder(dsi->connector, &dsi->encoder); | |
| 814 | + | |
| 815 | + return 0; | |
| 816 | + | |
| 817 | +err_cleanup_encoder: | |
| 818 | + drm_encoder_cleanup(&dsi->encoder); | |
| 819 | + return ret; | |
| 820 | +} | |
| 821 | + | |
| 822 | +static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) | |
| 823 | +{ | |
| 824 | + int ret; | |
| 825 | + struct drm_device *drm = data; | |
| 826 | + struct mtk_dsi *dsi = dev_get_drvdata(dev); | |
| 827 | + | |
| 828 | + ret = mtk_dsi_encoder_init(drm, dsi); | |
| 829 | + if (ret) | |
| 830 | + return ret; | |
| 831 | + | |
| 832 | + return device_reset_optional(dev); | |
| 833 | +} | |
| 834 | + | |
| 835 | +static void mtk_dsi_unbind(struct device *dev, struct device *master, | |
| 836 | + void *data) | |
| 837 | +{ | |
| 838 | + struct mtk_dsi *dsi = dev_get_drvdata(dev); | |
| 839 | + | |
| 840 | + drm_encoder_cleanup(&dsi->encoder); | |
| 841 | +} | |
| 842 | + | |
| 843 | +static const struct component_ops mtk_dsi_component_ops = { | |
| 844 | + .bind = mtk_dsi_bind, | |
| 845 | + .unbind = mtk_dsi_unbind, | |
| 846 | +}; | |
| 847 | + | |
| 789 | 848 | static int mtk_dsi_host_attach(struct mipi_dsi_host *host, |
| 790 | 849 | struct mipi_dsi_device *device) |
| 791 | 850 | { |
| 792 | 851 | struct mtk_dsi *dsi = host_to_dsi(host); |
| 852 | + struct device *dev = host->dev; | |
| 853 | + int ret; | |
| 793 | 854 | |
| 794 | 855 | dsi->lanes = device->lanes; |
| 795 | 856 | dsi->format = device->format; |
| 796 | 857 | dsi->mode_flags = device->mode_flags; |
| 858 | + dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); | |
| 859 | + if (IS_ERR(dsi->next_bridge)) | |
| 860 | + return PTR_ERR(dsi->next_bridge); | |
| 861 | + | |
| 862 | + drm_bridge_add(&dsi->bridge); | |
| 863 | + | |
| 864 | + ret = component_add(host->dev, &mtk_dsi_component_ops); | |
| 865 | + if (ret) { | |
| 866 | + DRM_ERROR("failed to add dsi_host component: %d\n", ret); | |
| 867 | + drm_bridge_remove(&dsi->bridge); | |
| 868 | + return ret; | |
| 869 | + } | |
| 797 | 870 | |
| 798 | 871 | return 0; |
| 799 | 872 | } |
| 800 | 873 | |
| 874 | +static int mtk_dsi_host_detach(struct mipi_dsi_host *host, | |
| 875 | + struct mipi_dsi_device *device) | |
| 876 | +{ | |
| 877 | + struct mtk_dsi *dsi = host_to_dsi(host); | |
| 878 | + | |
| 879 | + component_del(host->dev, &mtk_dsi_component_ops); | |
| 880 | + drm_bridge_remove(&dsi->bridge); | |
| 881 | + return 0; | |
| 882 | +} | |
| 883 | + | |
| 801 | 884 | static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi) |
| 802 | 885 | { |
| 803 | 886 | int ret; |
| @@ -938,73 +1021,14 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, · 134 unmodified lines | ||
| 938 | 1021 | |
| 939 | 1022 | static const struct mipi_dsi_host_ops mtk_dsi_ops = { |
| 940 | 1023 | .attach = mtk_dsi_host_attach, |
| 1024 | + .detach = mtk_dsi_host_detach, | |
| 941 | 1025 | .transfer = mtk_dsi_host_transfer, |
| 942 | 1026 | }; |
| 943 | 1027 | |
| 944 | −static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) | |
| 945 | −{ | |
| 946 | − int ret; | |
| 947 | − | |
| 948 | − ret = drm_simple_encoder_init(drm, &dsi->encoder, | |
| 949 | − DRM_MODE_ENCODER_DSI); | |
| 950 | − if (ret) { | |
| 951 | − DRM_ERROR("Failed to encoder init to drm\n"); | |
| 952 | − return ret; | |
| 953 | − } | |
| 954 | − | |
| 955 | − dsi->encoder.possible_crtcs = mtk_drm_find_possible_crtc_by_comp(drm, dsi->host.dev); | |
| 956 | − | |
| 957 | − ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, | |
| 958 | − DRM_BRIDGE_ATTACH_NO_CONNECTOR); | |
| 959 | − if (ret) | |
| 960 | − goto err_cleanup_encoder; | |
| 961 | − | |
| 962 | − dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder); | |
| 963 | − if (IS_ERR(dsi->connector)) { | |
| 964 | − DRM_ERROR("Unable to create bridge connector\n"); | |
| 965 | − ret = PTR_ERR(dsi->connector); | |
| 966 | − goto err_cleanup_encoder; | |
| 967 | − } | |
| 968 | − drm_connector_attach_encoder(dsi->connector, &dsi->encoder); | |
| 969 | − | |
| 970 | − return 0; | |
| 971 | − | |
| 972 | −err_cleanup_encoder: | |
| 973 | − drm_encoder_cleanup(&dsi->encoder); | |
| 974 | − return ret; | |
| 975 | −} | |
| 976 | − | |
| 977 | −static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) | |
| 978 | −{ | |
| 979 | − int ret; | |
| 980 | − struct drm_device *drm = data; | |
| 981 | − struct mtk_dsi *dsi = dev_get_drvdata(dev); | |
| 982 | − | |
| 983 | − ret = mtk_dsi_encoder_init(drm, dsi); | |
| 984 | − if (ret) | |
| 985 | − return ret; | |
| 986 | − | |
| 987 | − return device_reset_optional(dev); | |
| 988 | −} | |
| 989 | − | |
| 990 | −static void mtk_dsi_unbind(struct device *dev, struct device *master, | |
| 991 | − void *data) | |
| 992 | −{ | |
| 993 | − struct mtk_dsi *dsi = dev_get_drvdata(dev); | |
| 994 | − | |
| 995 | − drm_encoder_cleanup(&dsi->encoder); | |
| 996 | −} | |
| 997 | − | |
| 998 | −static const struct component_ops mtk_dsi_component_ops = { | |
| 999 | − .bind = mtk_dsi_bind, | |
| 1000 | − .unbind = mtk_dsi_unbind, | |
| 1001 | −}; | |
| 1002 | − | |
| 1003 | 1028 | static int mtk_dsi_probe(struct platform_device *pdev) |
| 1004 | 1029 | { |
| 1005 | 1030 | struct mtk_dsi *dsi; |
| 1006 | 1031 | struct device *dev = &pdev->dev; |
| 1007 | − struct drm_panel *panel; | |
| 1008 | 1032 | struct resource *regs; |
| 1009 | 1033 | int irq_num; |
| 1010 | 1034 | int ret; |
| @@ -1021,19 +1045,6 @@ static int mtk_dsi_probe(struct platform_device *pdev) · 10 unmodified lines | ||
| 1021 | 1045 | return ret; |
| 1022 | 1046 | } |
| 1023 | 1047 | |
| 1024 | − ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, | |
| 1025 | − &panel, &dsi->next_bridge); | |
| 1026 | − if (ret) | |
| 1027 | − goto err_unregister_host; | |
| 1028 | − | |
| 1029 | − if (panel) { | |
| 1030 | − dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel); | |
| 1031 | − if (IS_ERR(dsi->next_bridge)) { | |
| 1032 | − ret = PTR_ERR(dsi->next_bridge); | |
| 1033 | − goto err_unregister_host; | |
| 1034 | − } | |
| 1035 | − } | |
| 1036 | − | |
| 1037 | 1048 | dsi->driver_data = of_device_get_match_data(dev); |
| 1038 | 1049 | |
| 1039 | 1050 | dsi->engine_clk = devm_clk_get(dev, "engine"); |
| @@ -1098,14 +1109,6 @@ static int mtk_dsi_probe(struct platform_device *pdev) · 58 unmodified lines | ||
| 1098 | 1109 | dsi->bridge.of_node = dev->of_node; |
| 1099 | 1110 | dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; |
| 1100 | 1111 | |
| 1101 | − drm_bridge_add(&dsi->bridge); | |
| 1102 | − | |
| 1103 | − ret = component_add(&pdev->dev, &mtk_dsi_component_ops); | |
| 1104 | − if (ret) { | |
| 1105 | − dev_err(&pdev->dev, "failed to add component: %d\n", ret); | |
| 1106 | − goto err_unregister_host; | |
| 1107 | − } | |
| 1108 | − | |
| 1109 | 1112 | return 0; |
| 1110 | 1113 | |
| 1111 | 1114 | err_unregister_host: |
| @@ -1118,8 +1121,6 @@ static int mtk_dsi_remove(struct platform_device *pdev) · 6 unmodified lines | ||
| 1118 | 1121 | struct mtk_dsi *dsi = platform_get_drvdata(pdev); |
| 1119 | 1122 | |
| 1120 | 1123 | mtk_output_dsi_disable(dsi); |
| 1121 | − drm_bridge_remove(&dsi->bridge); | |
| 1122 | − component_del(&pdev->dev, &mtk_dsi_component_ops); | |
| 1123 | 1124 | mipi_dsi_host_unregister(&dsi->host); |
| 1124 | 1125 | |
| 1125 | 1126 | return 0; |
| @@ -198,7 +198,8 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, · 197 unmodified lines | ||
| 198 | 198 | * so don't register a backlight device |
| 199 | 199 | */ |
| 200 | 200 | if ((rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && |
| 201 | − (rdev->pdev->device == 0x6741)) | |
| 201 | + (rdev->pdev->device == 0x6741) && | |
| 202 | + !dmi_match(DMI_PRODUCT_NAME, "iMac12,1")) | |
| 202 | 203 | return; |
| 203 | 204 | |
| 204 | 205 | if (!radeon_encoder->enc_priv) |
| @@ -470,8 +470,8 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, · 469 unmodified lines | ||
| 470 | 470 | int32_t *msg, msg_type, handle; |
| 471 | 471 | unsigned img_size = 0; |
| 472 | 472 | void *ptr; |
| 473 | − | |
| 474 | − int i, r; | |
| 473 | + long r; | |
| 474 | + int i; | |
| 475 | 475 | |
| 476 | 476 | if (offset & 0x3F) { |
| 477 | 477 | DRM_ERROR("UVD messages must be 64 byte aligned!\n"); |
| @@ -481,13 +481,13 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, · 3 unmodified lines | ||
| 481 | 481 | r = dma_resv_wait_timeout(bo->tbo.base.resv, false, false, |
| 482 | 482 | MAX_SCHEDULE_TIMEOUT); |
| 483 | 483 | if (r <= 0) { |
| 484 | − DRM_ERROR("Failed waiting for UVD message (%d)!\n", r); | |
| 484 | + DRM_ERROR("Failed waiting for UVD message (%ld)!\n", r); | |
| 485 | 485 | return r ? r : -ETIME; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | r = radeon_bo_kmap(bo, &ptr); |
| 489 | 489 | if (r) { |
| 490 | − DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); | |
| 490 | + DRM_ERROR("Failed mapping the UVD message (%ld)!\n", r); | |
| 491 | 491 | return r; |
| 492 | 492 | } |
| 493 | 493 | |
| @@ -5,6 +5,7 @@ config DRM_TEGRA · 4 unmodified lines | ||
| 5 | 5 | depends on COMMON_CLK |
| 6 | 6 | depends on DRM |
| 7 | 7 | depends on OF |
| 8 | + select DRM_DP_AUX_BUS | |
| 8 | 9 | select DRM_KMS_HELPER |
| 9 | 10 | select DRM_MIPI_DSI |
| 10 | 11 | select DRM_PANEL |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <linux/workqueue.h> |
| 20 | 20 | |
| 21 | 21 | #include <drm/drm_dp_helper.h> |
| 22 | +#include <drm/drm_dp_aux_bus.h> | |
| 22 | 23 | #include <drm/drm_panel.h> |
| 23 | 24 | |
| 24 | 25 | #include "dp.h" |
| @@ -570,6 +571,12 @@ static int tegra_dpaux_probe(struct platform_device *pdev) · 545 unmodified lines | ||
| 570 | 571 | list_add_tail(&dpaux->list, &dpaux_list); |
| 571 | 572 | mutex_unlock(&dpaux_lock); |
| 572 | 573 | |
| 574 | + err = devm_of_dp_aux_populate_ep_devices(&dpaux->aux); | |
| 575 | + if (err < 0) { | |
| 576 | + dev_err(dpaux->dev, "failed to populate AUX bus: %d\n", err); | |
| 577 | + return err; | |
| 578 | + } | |
| 579 | + | |
| 573 | 580 | return 0; |
| 574 | 581 | } |
| 575 | 582 | |
| @@ -63,7 +63,7 @@ static void falcon_copy_firmware_image(struct falcon *falcon, · 62 unmodified lines | ||
| 63 | 63 | |
| 64 | 64 | /* copy the whole thing taking into account endianness */ |
| 65 | 65 | for (i = 0; i < firmware->size / sizeof(u32); i++) |
| 66 | − virt[i] = le32_to_cpu(((u32 *)firmware->data)[i]); | |
| 66 | + virt[i] = le32_to_cpu(((__le32 *)firmware->data)[i]); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | static int falcon_parse_firmware_image(struct falcon *falcon) |
| @@ -525,9 +525,11 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) · 524 unmodified lines | ||
| 525 | 525 | if (ret) |
| 526 | 526 | return ret; |
| 527 | 527 | |
| 528 | − ret = pm_runtime_put(&vc4_hdmi->pdev->dev); | |
| 529 | − if (ret) | |
| 530 | − return ret; | |
| 528 | + /* | |
| 529 | + * post_crtc_powerdown will have called pm_runtime_put, so we | |
| 530 | + * don't need it here otherwise we'll get the reference counting | |
| 531 | + * wrong. | |
| 532 | + */ | |
| 531 | 533 | |
| 532 | 534 | return 0; |
| 533 | 535 | } |
| @@ -1749,6 +1749,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) · 1748 unmodified lines | ||
| 1749 | 1749 | dev_err(dev, "Couldn't register the HDMI codec: %ld\n", PTR_ERR(codec_pdev)); |
| 1750 | 1750 | return PTR_ERR(codec_pdev); |
| 1751 | 1751 | } |
| 1752 | + vc4_hdmi->audio.codec_pdev = codec_pdev; | |
| 1752 | 1753 | |
| 1753 | 1754 | dai_link->cpus = &vc4_hdmi->audio.cpu; |
| 1754 | 1755 | dai_link->codecs = &vc4_hdmi->audio.codec; |
| @@ -1788,6 +1789,12 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) · 33 unmodified lines | ||
| 1788 | 1789 | |
| 1789 | 1790 | } |
| 1790 | 1791 | |
| 1792 | +static void vc4_hdmi_audio_exit(struct vc4_hdmi *vc4_hdmi) | |
| 1793 | +{ | |
| 1794 | + platform_device_unregister(vc4_hdmi->audio.codec_pdev); | |
| 1795 | + vc4_hdmi->audio.codec_pdev = NULL; | |
| 1796 | +} | |
| 1797 | + | |
| 1791 | 1798 | static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv) |
| 1792 | 1799 | { |
| 1793 | 1800 | struct vc4_hdmi *vc4_hdmi = priv; |
| @@ -2660,6 +2667,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, · 866 unmodified lines | ||
| 2660 | 2667 | kfree(vc4_hdmi->hdmi_regset.regs); |
| 2661 | 2668 | kfree(vc4_hdmi->hd_regset.regs); |
| 2662 | 2669 | |
| 2670 | + vc4_hdmi_audio_exit(vc4_hdmi); | |
| 2663 | 2671 | vc4_hdmi_cec_exit(vc4_hdmi); |
| 2664 | 2672 | vc4_hdmi_hotplug_exit(vc4_hdmi); |
| 2665 | 2673 | vc4_hdmi_connector_destroy(&vc4_hdmi->connector); |
| @@ -116,6 +116,7 @@ struct vc4_hdmi_audio { · 115 unmodified lines | ||
| 116 | 116 | struct snd_soc_dai_link_component platform; |
| 117 | 117 | struct snd_dmaengine_dai_dma_data dma_data; |
| 118 | 118 | struct hdmi_audio_infoframe infoframe; |
| 119 | + struct platform_device *codec_pdev; | |
| 119 | 120 | bool streaming; |
| 120 | 121 | }; |
| 121 | 122 | |
| @@ -137,8 +137,15 @@ void host1x_syncpt_restore(struct host1x *host) · 136 unmodified lines | ||
| 137 | 137 | struct host1x_syncpt *sp_base = host->syncpt; |
| 138 | 138 | unsigned int i; |
| 139 | 139 | |
| 140 | − for (i = 0; i < host1x_syncpt_nb_pts(host); i++) | |
| 140 | + for (i = 0; i < host1x_syncpt_nb_pts(host); i++) { | |
| 141 | + /* | |
| 142 | + * Unassign syncpt from channels for purposes of Tegra186 | |
| 143 | + * syncpoint protection. This prevents any channel from | |
| 144 | + * accessing it until it is reassigned. | |
| 145 | + */ | |
| 146 | + host1x_hw_syncpt_assign_to_channel(host, sp_base + i, NULL); | |
| 141 | 147 | host1x_hw_syncpt_restore(host, sp_base + i); |
| 148 | + } | |
| 142 | 149 | |
| 143 | 150 | for (i = 0; i < host1x_syncpt_nb_bases(host); i++) |
| 144 | 151 | host1x_hw_syncpt_restore_wait_base(host, sp_base + i); |
| @@ -227,27 +234,12 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, · 82 unmodified lines | ||
| 227 | 234 | void *ref; |
| 228 | 235 | struct host1x_waitlist *waiter; |
| 229 | 236 | int err = 0, check_count = 0; |
| 230 | − u32 val; | |
| 231 | 237 | |
| 232 | 238 | if (value) |
| 233 | − *value = 0; | |
| 234 | − | |
| 235 | − /* first check cache */ | |
| 236 | − if (host1x_syncpt_is_expired(sp, thresh)) { | |
| 237 | − if (value) | |
| 238 | − *value = host1x_syncpt_load(sp); | |
| 239 | + *value = host1x_syncpt_load(sp); | |
| 239 | 240 | |
| 241 | + if (host1x_syncpt_is_expired(sp, thresh)) | |
| 240 | 242 | return 0; |
| 241 | − } | |
| 242 | − | |
| 243 | − /* try to read from register */ | |
| 244 | − val = host1x_hw_syncpt_load(sp->host, sp); | |
| 245 | − if (host1x_syncpt_is_expired(sp, thresh)) { | |
| 246 | − if (value) | |
| 247 | − *value = val; | |
| 248 | − | |
| 249 | − goto done; | |
| 250 | − } | |
| 251 | 243 | |
| 252 | 244 | if (!timeout) { |
| 253 | 245 | err = -EAGAIN; |
| @@ -352,13 +344,6 @@ int host1x_syncpt_init(struct host1x *host) · 98 unmodified lines | ||
| 352 | 344 | for (i = 0; i < host->info->nb_pts; i++) { |
| 353 | 345 | syncpt[i].id = i; |
| 354 | 346 | syncpt[i].host = host; |
| 355 | − | |
| 356 | − /* | |
| 357 | − * Unassign syncpt from channels for purposes of Tegra186 | |
| 358 | − * syncpoint protection. This prevents any channel from | |
| 359 | − * accessing it until it is reassigned. | |
| 360 | − */ | |
| 361 | − host1x_hw_syncpt_assign_to_channel(host, &syncpt[i], NULL); | |
| 362 | 347 | } |
| 363 | 348 | |
| 364 | 349 | for (i = 0; i < host->info->nb_bases; i++) |
| @@ -37,11 +37,11 @@ static int amd_sfh_wait_response_v2(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_ · 36 unmodified lines | ||
| 37 | 37 | { |
| 38 | 38 | union cmd_response cmd_resp; |
| 39 | 39 | |
| 40 | − /* Get response with status within a max of 800 ms timeout */ | |
| 40 | + /* Get response with status within a max of 1600 ms timeout */ | |
| 41 | 41 | if (!readl_poll_timeout(mp2->mmio + AMD_P2C_MSG(0), cmd_resp.resp, |
| 42 | 42 | (cmd_resp.response_v2.response == sensor_sts && |
| 43 | 43 | cmd_resp.response_v2.status == 0 && (sid == 0xff || |
| 44 | − cmd_resp.response_v2.sensor_id == sid)), 500, 800000)) | |
| 44 | + cmd_resp.response_v2.sensor_id == sid)), 500, 1600000)) | |
| 45 | 45 | return cmd_resp.response_v2.response; |
| 46 | 46 | |
| 47 | 47 | return SENSOR_DISABLED; |
| @@ -53,6 +53,7 @@ static void amd_start_sensor_v2(struct amd_mp2_dev *privdata, struct amd_mp2_sen · 5 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | cmd_base.ul = 0; |
| 55 | 55 | cmd_base.cmd_v2.cmd_id = ENABLE_SENSOR; |
| 56 | + cmd_base.cmd_v2.intr_disable = 1; | |
| 56 | 57 | cmd_base.cmd_v2.period = info.period; |
| 57 | 58 | cmd_base.cmd_v2.sensor_id = info.sensor_idx; |
| 58 | 59 | cmd_base.cmd_v2.length = 16; |
| @@ -70,6 +71,7 @@ static void amd_stop_sensor_v2(struct amd_mp2_dev *privdata, u16 sensor_idx) · 11 unmodified lines | ||
| 70 | 71 | |
| 71 | 72 | cmd_base.ul = 0; |
| 72 | 73 | cmd_base.cmd_v2.cmd_id = DISABLE_SENSOR; |
| 74 | + cmd_base.cmd_v2.intr_disable = 1; | |
| 73 | 75 | cmd_base.cmd_v2.period = 0; |
| 74 | 76 | cmd_base.cmd_v2.sensor_id = sensor_idx; |
| 75 | 77 | cmd_base.cmd_v2.length = 16; |
| @@ -83,12 +85,51 @@ static void amd_stop_all_sensor_v2(struct amd_mp2_dev *privdata) · 7 unmodified lines | ||
| 83 | 85 | union sfh_cmd_base cmd_base; |
| 84 | 86 | |
| 85 | 87 | cmd_base.cmd_v2.cmd_id = STOP_ALL_SENSORS; |
| 88 | + cmd_base.cmd_v2.intr_disable = 1; | |
| 86 | 89 | cmd_base.cmd_v2.period = 0; |
| 87 | 90 | cmd_base.cmd_v2.sensor_id = 0; |
| 88 | 91 | |
| 89 | 92 | writel(cmd_base.ul, privdata->mmio + AMD_C2P_MSG0); |
| 90 | 93 | } |
| 91 | 94 | |
| 95 | +static void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata) | |
| 96 | +{ | |
| 97 | + if (readl(privdata->mmio + AMD_P2C_MSG(4))) { | |
| 98 | + writel(0, privdata->mmio + AMD_P2C_MSG(4)); | |
| 99 | + writel(0xf, privdata->mmio + AMD_P2C_MSG(5)); | |
| 100 | + } | |
| 101 | +} | |
| 102 | + | |
| 103 | +static void amd_sfh_clear_intr(struct amd_mp2_dev *privdata) | |
| 104 | +{ | |
| 105 | + if (privdata->mp2_ops->clear_intr) | |
| 106 | + privdata->mp2_ops->clear_intr(privdata); | |
| 107 | +} | |
| 108 | + | |
| 109 | +static irqreturn_t amd_sfh_irq_handler(int irq, void *data) | |
| 110 | +{ | |
| 111 | + amd_sfh_clear_intr(data); | |
| 112 | + | |
| 113 | + return IRQ_HANDLED; | |
| 114 | +} | |
| 115 | + | |
| 116 | +static int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata) | |
| 117 | +{ | |
| 118 | + int rc; | |
| 119 | + | |
| 120 | + pci_intx(privdata->pdev, true); | |
| 121 | + | |
| 122 | + rc = devm_request_irq(&privdata->pdev->dev, privdata->pdev->irq, | |
| 123 | + amd_sfh_irq_handler, 0, DRIVER_NAME, privdata); | |
| 124 | + if (rc) { | |
| 125 | + dev_err(&privdata->pdev->dev, "failed to request irq %d err=%d\n", | |
| 126 | + privdata->pdev->irq, rc); | |
| 127 | + return rc; | |
| 128 | + } | |
| 129 | + | |
| 130 | + return 0; | |
| 131 | +} | |
| 132 | + | |
| 92 | 133 | void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info) |
| 93 | 134 | { |
| 94 | 135 | union sfh_cmd_param cmd_param; |
| @@ -193,6 +234,8 @@ static void amd_mp2_pci_remove(void *privdata) · 98 unmodified lines | ||
| 193 | 234 | struct amd_mp2_dev *mp2 = privdata; |
| 194 | 235 | amd_sfh_hid_client_deinit(privdata); |
| 195 | 236 | mp2->mp2_ops->stop_all(mp2); |
| 237 | + pci_intx(mp2->pdev, false); | |
| 238 | + amd_sfh_clear_intr(mp2); | |
| 196 | 239 | } |
| 197 | 240 | |
| 198 | 241 | static const struct amd_mp2_ops amd_sfh_ops_v2 = { |
| @@ -200,6 +243,8 @@ static const struct amd_mp2_ops amd_sfh_ops_v2 = { · 1 unmodified line | ||
| 200 | 243 | .stop = amd_stop_sensor_v2, |
| 201 | 244 | .stop_all = amd_stop_all_sensor_v2, |
| 202 | 245 | .response = amd_sfh_wait_response_v2, |
| 246 | + .clear_intr = amd_sfh_clear_intr_v2, | |
| 247 | + .init_intr = amd_sfh_irq_init_v2, | |
| 203 | 248 | }; |
| 204 | 249 | |
| 205 | 250 | static const struct amd_mp2_ops amd_sfh_ops = { |
| @@ -225,6 +270,14 @@ static void mp2_select_ops(struct amd_mp2_dev *privdata) · 19 unmodified lines | ||
| 225 | 270 | } |
| 226 | 271 | } |
| 227 | 272 | |
| 273 | +static int amd_sfh_irq_init(struct amd_mp2_dev *privdata) | |
| 274 | +{ | |
| 275 | + if (privdata->mp2_ops->init_intr) | |
| 276 | + return privdata->mp2_ops->init_intr(privdata); | |
| 277 | + | |
| 278 | + return 0; | |
| 279 | +} | |
| 280 | + | |
| 228 | 281 | static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
| 229 | 282 | { |
| 230 | 283 | struct amd_mp2_dev *privdata; |
| @@ -261,9 +314,20 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i · 30 unmodified lines | ||
| 261 | 314 | |
| 262 | 315 | mp2_select_ops(privdata); |
| 263 | 316 | |
| 317 | + rc = amd_sfh_irq_init(privdata); | |
| 318 | + if (rc) { | |
| 319 | + dev_err(&pdev->dev, "amd_sfh_irq_init failed\n"); | |
| 320 | + return rc; | |
| 321 | + } | |
| 322 | + | |
| 264 | 323 | rc = amd_sfh_hid_client_init(privdata); |
| 265 | − if (rc) | |
| 324 | + if (rc) { | |
| 325 | + amd_sfh_clear_intr(privdata); | |
| 326 | + dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n"); | |
| 266 | 327 | return rc; |
| 328 | + } | |
| 329 | + | |
| 330 | + amd_sfh_clear_intr(privdata); | |
| 267 | 331 | |
| 268 | 332 | return devm_add_action_or_reset(&pdev->dev, amd_mp2_pci_remove, privdata); |
| 269 | 333 | } |
| @@ -290,6 +354,9 @@ static int __maybe_unused amd_mp2_pci_resume(struct device *dev) · 20 unmodified lines | ||
| 290 | 354 | } |
| 291 | 355 | } |
| 292 | 356 | |
| 357 | + schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP)); | |
| 358 | + amd_sfh_clear_intr(mp2); | |
| 359 | + | |
| 293 | 360 | return 0; |
| 294 | 361 | } |
| 295 | 362 | |
| @@ -312,6 +379,9 @@ static int __maybe_unused amd_mp2_pci_suspend(struct device *dev) · 16 unmodified lines | ||
| 312 | 379 | } |
| 313 | 380 | } |
| 314 | 381 | |
| 382 | + cancel_delayed_work_sync(&cl_data->work_buffer); | |
| 383 | + amd_sfh_clear_intr(mp2); | |
| 384 | + | |
| 315 | 385 | return 0; |
| 316 | 386 | } |
| 317 | 387 | |
| @@ -49,7 +49,7 @@ union sfh_cmd_base { · 48 unmodified lines | ||
| 49 | 49 | } s; |
| 50 | 50 | struct { |
| 51 | 51 | u32 cmd_id : 4; |
| 52 | − u32 intr_enable : 1; | |
| 52 | + u32 intr_disable : 1; | |
| 53 | 53 | u32 rsvd1 : 3; |
| 54 | 54 | u32 length : 7; |
| 55 | 55 | u32 mem_type : 1; |
| @@ -141,5 +141,7 @@ struct amd_mp2_ops { · 85 unmodified lines | ||
| 141 | 141 | void (*stop)(struct amd_mp2_dev *privdata, u16 sensor_idx); |
| 142 | 142 | void (*stop_all)(struct amd_mp2_dev *privdata); |
| 143 | 143 | int (*response)(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_sts); |
| 144 | + void (*clear_intr)(struct amd_mp2_dev *privdata); | |
| 145 | + int (*init_intr)(struct amd_mp2_dev *privdata); | |
| 144 | 146 | }; |
| 145 | 147 | #endif |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #define HID_USAGE_SENSOR_STATE_READY_ENUM 0x02 |
| 28 | 28 | #define HID_USAGE_SENSOR_STATE_INITIALIZING_ENUM 0x05 |
| 29 | 29 | #define HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM 0x04 |
| 30 | +#define ILLUMINANCE_MASK GENMASK(14, 0) | |
| 30 | 31 | |
| 31 | 32 | int get_report_descriptor(int sensor_idx, u8 *rep_desc) |
| 32 | 33 | { |
| @@ -246,7 +247,8 @@ u8 get_input_report(u8 current_index, int sensor_idx, int report_id, struct amd_ · 213 unmodified lines | ||
| 246 | 247 | get_common_inputs(&als_input.common_property, report_id); |
| 247 | 248 | /* For ALS ,V2 Platforms uses C2P_MSG5 register instead of DRAM access method */ |
| 248 | 249 | if (supported_input == V2_STATUS) |
| 249 | − als_input.illuminance_value = (int)readl(privdata->mmio + AMD_C2P_MSG(5)); | |
| 250 | + als_input.illuminance_value = | |
| 251 | + readl(privdata->mmio + AMD_C2P_MSG(5)) & ILLUMINANCE_MASK; | |
| 250 | 252 | else |
| 251 | 253 | als_input.illuminance_value = |
| 252 | 254 | (int)sensor_virt_addr[0] / AMD_SFH_FW_MULTIPLIER; |
| @@ -691,49 +691,49 @@ static const struct hid_device_id apple_devices[] = { · 690 unmodified lines | ||
| 691 | 691 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI), |
| 692 | 692 | .driver_data = APPLE_HAS_FN }, |
| 693 | 693 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO), |
| 694 | − .driver_data = APPLE_HAS_FN }, | |
| 694 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 695 | 695 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS), |
| 696 | 696 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 697 | 697 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI), |
| 698 | 698 | .driver_data = APPLE_HAS_FN }, |
| 699 | 699 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO), |
| 700 | − .driver_data = APPLE_HAS_FN }, | |
| 700 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 701 | 701 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS), |
| 702 | 702 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 703 | 703 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI), |
| 704 | 704 | .driver_data = APPLE_HAS_FN }, |
| 705 | 705 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO), |
| 706 | − .driver_data = APPLE_HAS_FN }, | |
| 706 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 707 | 707 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), |
| 708 | 708 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 709 | 709 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), |
| 710 | 710 | .driver_data = APPLE_HAS_FN }, |
| 711 | 711 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), |
| 712 | − .driver_data = APPLE_HAS_FN }, | |
| 712 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 713 | 713 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), |
| 714 | 714 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 715 | 715 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), |
| 716 | 716 | .driver_data = APPLE_HAS_FN }, |
| 717 | 717 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), |
| 718 | − .driver_data = APPLE_HAS_FN }, | |
| 718 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 719 | 719 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
| 720 | 720 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 721 | 721 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), |
| 722 | 722 | .driver_data = APPLE_HAS_FN }, |
| 723 | 723 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), |
| 724 | − .driver_data = APPLE_HAS_FN }, | |
| 724 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 725 | 725 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), |
| 726 | 726 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 727 | 727 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI), |
| 728 | 728 | .driver_data = APPLE_HAS_FN }, |
| 729 | 729 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO), |
| 730 | − .driver_data = APPLE_HAS_FN }, | |
| 730 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 731 | 731 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), |
| 732 | 732 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 733 | 733 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI), |
| 734 | 734 | .driver_data = APPLE_HAS_FN }, |
| 735 | 735 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO), |
| 736 | − .driver_data = APPLE_HAS_FN }, | |
| 736 | + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, | |
| 737 | 737 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS), |
| 738 | 738 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 739 | 739 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
| @@ -262,6 +262,7 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id) · 261 unmodified lines | ||
| 262 | 262 | |
| 263 | 263 | return 0; |
| 264 | 264 | err_free: |
| 265 | + usb_put_dev(udev); | |
| 265 | 266 | kfree(priv); |
| 266 | 267 | return ret; |
| 267 | 268 | } |
| @@ -1370,6 +1370,7 @@ · 1369 unmodified lines | ||
| 1370 | 1370 | #define USB_VENDOR_ID_UGTIZER 0x2179 |
| 1371 | 1371 | #define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053 |
| 1372 | 1372 | #define USB_DEVICE_ID_UGTIZER_TABLET_GT5040 0x0077 |
| 1373 | +#define USB_DEVICE_ID_UGTIZER_TABLET_WP5540 0x0004 | |
| 1373 | 1374 | |
| 1374 | 1375 | #define USB_VENDOR_ID_VIEWSONIC 0x0543 |
| 1375 | 1376 | #define USB_DEVICE_ID_VIEWSONIC_PD1011 0xe621 |
| @@ -187,6 +187,7 @@ static const struct hid_device_id hid_quirks[] = { · 186 unmodified lines | ||
| 187 | 187 | { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET }, |
| 188 | 188 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT }, |
| 189 | 189 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT }, |
| 190 | + { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_WP5540), HID_QUIRK_MULTI_INPUT }, | |
| 190 | 191 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH), HID_QUIRK_MULTI_INPUT }, |
| 191 | 192 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH), HID_QUIRK_MULTI_INPUT }, |
| 192 | 193 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT }, |
| @@ -27,7 +27,6 @@ struct i2c_hid_of_goodix { · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | struct regulator *vdd; |
| 29 | 29 | struct notifier_block nb; |
| 30 | − struct mutex regulator_mutex; | |
| 31 | 30 | struct gpio_desc *reset_gpio; |
| 32 | 31 | const struct goodix_i2c_hid_timing_data *timings; |
| 33 | 32 | }; |
| @@ -67,8 +66,6 @@ static int ihid_goodix_vdd_notify(struct notifier_block *nb, · 33 unmodified lines | ||
| 67 | 66 | container_of(nb, struct i2c_hid_of_goodix, nb); |
| 68 | 67 | int ret = NOTIFY_OK; |
| 69 | 68 | |
| 70 | − mutex_lock(&ihid_goodix->regulator_mutex); | |
| 71 | − | |
| 72 | 69 | switch (event) { |
| 73 | 70 | case REGULATOR_EVENT_PRE_DISABLE: |
| 74 | 71 | gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); |
| @@ -87,8 +84,6 @@ static int ihid_goodix_vdd_notify(struct notifier_block *nb, · 12 unmodified lines | ||
| 87 | 84 | break; |
| 88 | 85 | } |
| 89 | 86 | |
| 90 | − mutex_unlock(&ihid_goodix->regulator_mutex); | |
| 91 | − | |
| 92 | 87 | return ret; |
| 93 | 88 | } |
| 94 | 89 | |
| @@ -102,8 +97,6 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client, · 7 unmodified lines | ||
| 102 | 97 | if (!ihid_goodix) |
| 103 | 98 | return -ENOMEM; |
| 104 | 99 | |
| 105 | − mutex_init(&ihid_goodix->regulator_mutex); | |
| 106 | − | |
| 107 | 100 | ihid_goodix->ops.power_up = goodix_i2c_hid_power_up; |
| 108 | 101 | ihid_goodix->ops.power_down = goodix_i2c_hid_power_down; |
| 109 | 102 | |
| @@ -130,25 +123,28 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client, · 20 unmodified lines | ||
| 130 | 123 | * long. Holding the controller in reset apparently draws extra |
| 131 | 124 | * power. |
| 132 | 125 | */ |
| 133 | − mutex_lock(&ihid_goodix->regulator_mutex); | |
| 134 | 126 | ihid_goodix->nb.notifier_call = ihid_goodix_vdd_notify; |
| 135 | 127 | ret = devm_regulator_register_notifier(ihid_goodix->vdd, &ihid_goodix->nb); |
| 136 | − if (ret) { | |
| 137 | − mutex_unlock(&ihid_goodix->regulator_mutex); | |
| 128 | + if (ret) | |
| 138 | 129 | return dev_err_probe(&client->dev, ret, |
| 139 | 130 | "regulator notifier request failed\n"); |
| 140 | − } | |
| 141 | 131 | |
| 142 | 132 | /* |
| 143 | 133 | * If someone else is holding the regulator on (or the regulator is |
| 144 | 134 | * an always-on one) we might never be told to deassert reset. Do it |
| 145 | − * now. Here we'll assume that someone else might have _just | |
| 146 | − * barely_ turned the regulator on so we'll do the full | |
| 147 | − * "post_power_delay" just in case. | |
| 135 | + * now... and temporarily bump the regulator reference count just to | |
| 136 | + * make sure it is impossible for this to race with our own notifier! | |
| 137 | + * We also assume that someone else might have _just barely_ turned | |
| 138 | + * the regulator on so we'll do the full "post_power_delay" just in | |
| 139 | + * case. | |
| 148 | 140 | */ |
| 149 | − if (ihid_goodix->reset_gpio && regulator_is_enabled(ihid_goodix->vdd)) | |
| 141 | + if (ihid_goodix->reset_gpio && regulator_is_enabled(ihid_goodix->vdd)) { | |
| 142 | + ret = regulator_enable(ihid_goodix->vdd); | |
| 143 | + if (ret) | |
| 144 | + return ret; | |
| 150 | 145 | goodix_i2c_hid_deassert_reset(ihid_goodix, true); |
| 151 | − mutex_unlock(&ihid_goodix->regulator_mutex); | |
| 146 | + regulator_disable(ihid_goodix->vdd); | |
| 147 | + } | |
| 152 | 148 | |
| 153 | 149 | return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0); |
| 154 | 150 | } |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include "hv_utils_transport.h" |
| 14 | 14 | |
| 15 | 15 | static DEFINE_SPINLOCK(hvt_list_lock); |
| 16 | −static struct list_head hvt_list = LIST_HEAD_INIT(hvt_list); | |
| 16 | +static LIST_HEAD(hvt_list); | |
| 17 | 17 | |
| 18 | 18 | static void hvt_reset(struct hvutil_transport *hvt) |
| 19 | 19 | { |
| @@ -2028,8 +2028,10 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel) · 2027 unmodified lines | ||
| 2028 | 2028 | kobj->kset = dev->channels_kset; |
| 2029 | 2029 | ret = kobject_init_and_add(kobj, &vmbus_chan_ktype, NULL, |
| 2030 | 2030 | "%u", relid); |
| 2031 | − if (ret) | |
| 2031 | + if (ret) { | |
| 2032 | + kobject_put(kobj); | |
| 2032 | 2033 | return ret; |
| 2034 | + } | |
| 2033 | 2035 | |
| 2034 | 2036 | ret = sysfs_create_group(kobj, &vmbus_chan_group); |
| 2035 | 2037 | |
| @@ -2038,6 +2040,7 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel) · 2 unmodified lines | ||
| 2038 | 2040 | * The calling functions' error handling paths will cleanup the |
| 2039 | 2041 | * empty channel directory. |
| 2040 | 2042 | */ |
| 2043 | + kobject_put(kobj); | |
| 2041 | 2044 | dev_err(device, "Unable to set up channel sysfs files\n"); |
| 2042 | 2045 | return ret; |
| 2043 | 2046 | } |
| @@ -2079,7 +2082,6 @@ struct hv_device *vmbus_device_create(const guid_t *type, · 35 unmodified lines | ||
| 2079 | 2082 | return child_device_obj; |
| 2080 | 2083 | } |
| 2081 | 2084 | |
| 2082 | −static u64 vmbus_dma_mask = DMA_BIT_MASK(64); | |
| 2083 | 2085 | /* |
| 2084 | 2086 | * vmbus_device_register - Register the child device |
| 2085 | 2087 | */ |
| @@ -2120,8 +2122,9 @@ int vmbus_device_register(struct hv_device *child_device_obj) · 34 unmodified lines | ||
| 2120 | 2122 | } |
| 2121 | 2123 | hv_debug_add_dev_dir(child_device_obj); |
| 2122 | 2124 | |
| 2123 | − child_device_obj->device.dma_mask = &vmbus_dma_mask; | |
| 2124 | 2125 | child_device_obj->device.dma_parms = &child_device_obj->dma_parms; |
| 2126 | + child_device_obj->device.dma_mask = &child_device_obj->dma_mask; | |
| 2127 | + dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64)); | |
| 2125 | 2128 | return 0; |
| 2126 | 2129 | |
| 2127 | 2130 | err_kset_unregister: |
| @@ -214,12 +214,14 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index) · 213 unmodified lines | ||
| 214 | 214 | |
| 215 | 215 | tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata, |
| 216 | 216 | &hwmon_thermal_ops); |
| 217 | − /* | |
| 218 | − * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV, | |
| 219 | − * so ignore that error but forward any other error. | |
| 220 | − */ | |
| 221 | − if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV)) | |
| 222 | − return PTR_ERR(tzd); | |
| 217 | + if (IS_ERR(tzd)) { | |
| 218 | + if (PTR_ERR(tzd) != -ENODEV) | |
| 219 | + return PTR_ERR(tzd); | |
| 220 | + dev_info(dev, "temp%d_input not attached to any thermal zone\n", | |
| 221 | + index + 1); | |
| 222 | + devm_kfree(dev, tdata); | |
| 223 | + return 0; | |
| 224 | + } | |
| 223 | 225 | |
| 224 | 226 | err = devm_add_action(dev, hwmon_thermal_remove_sensor, &tdata->node); |
| 225 | 227 | if (err) |
| @@ -59,7 +59,7 @@ static const struct platform_device_id ntc_thermistor_id[] = { · 58 unmodified lines | ||
| 59 | 59 | [NTC_NCP15XH103] = { "ncp15xh103", TYPE_NCPXXXH103 }, |
| 60 | 60 | [NTC_NCP18WB473] = { "ncp18wb473", TYPE_NCPXXWB473 }, |
| 61 | 61 | [NTC_NCP21WB473] = { "ncp21wb473", TYPE_NCPXXWB473 }, |
| 62 | − [NTC_SSG1404001221] = { "ssg1404-001221", TYPE_NCPXXWB473 }, | |
| 62 | + [NTC_SSG1404001221] = { "ssg1404_001221", TYPE_NCPXXWB473 }, | |
| 63 | 63 | [NTC_LAST] = { }, |
| 64 | 64 | }; |
| 65 | 65 | |
| @@ -911,6 +911,11 @@ static int pmbus_get_boolean(struct i2c_client *client, struct pmbus_boolean *b, · 910 unmodified lines | ||
| 911 | 911 | pmbus_update_sensor_data(client, s2); |
| 912 | 912 | |
| 913 | 913 | regval = status & mask; |
| 914 | + if (regval) { | |
| 915 | + ret = pmbus_write_byte_data(client, page, reg, regval); | |
| 916 | + if (ret) | |
| 917 | + goto unlock; | |
| 918 | + } | |
| 914 | 919 | if (s1 && s2) { |
| 915 | 920 | s64 v1, v2; |
| 916 | 921 | |
| @@ -488,7 +488,7 @@ config I2C_BRCMSTB · 487 unmodified lines | ||
| 488 | 488 | |
| 489 | 489 | config I2C_CADENCE |
| 490 | 490 | tristate "Cadence I2C Controller" |
| 491 | − depends on ARCH_ZYNQ || ARM64 || XTENSA | |
| 491 | + depends on ARCH_ZYNQ || ARM64 || XTENSA || COMPILE_TEST | |
| 492 | 492 | help |
| 493 | 493 | Say yes here to select Cadence I2C Host Controller. This controller is |
| 494 | 494 | e.g. used by Xilinx Zynq. |
| @@ -680,7 +680,7 @@ config I2C_IMG · 185 unmodified lines | ||
| 680 | 680 | |
| 681 | 681 | config I2C_IMX |
| 682 | 682 | tristate "IMX I2C interface" |
| 683 | − depends on ARCH_MXC || ARCH_LAYERSCAPE || COLDFIRE | |
| 683 | + depends on ARCH_MXC || ARCH_LAYERSCAPE || COLDFIRE || COMPILE_TEST | |
| 684 | 684 | select I2C_SLAVE |
| 685 | 685 | help |
| 686 | 686 | Say Y here if you want to use the IIC bus controller on |
| @@ -935,7 +935,7 @@ config I2C_QCOM_GENI · 248 unmodified lines | ||
| 935 | 935 | |
| 936 | 936 | config I2C_QUP |
| 937 | 937 | tristate "Qualcomm QUP based I2C controller" |
| 938 | − depends on ARCH_QCOM | |
| 938 | + depends on ARCH_QCOM || COMPILE_TEST | |
| 939 | 939 | help |
| 940 | 940 | If you say yes to this option, support will be included for the |
| 941 | 941 | built-in I2C interface on the Qualcomm SoCs. |
| @@ -23,6 +23,11 @@ · 22 unmodified lines | ||
| 23 | 23 | #define BCM2835_I2C_FIFO 0x10 |
| 24 | 24 | #define BCM2835_I2C_DIV 0x14 |
| 25 | 25 | #define BCM2835_I2C_DEL 0x18 |
| 26 | +/* | |
| 27 | + * 16-bit field for the number of SCL cycles to wait after rising SCL | |
| 28 | + * before deciding the slave is not responding. 0 disables the | |
| 29 | + * timeout detection. | |
| 30 | + */ | |
| 26 | 31 | #define BCM2835_I2C_CLKT 0x1c |
| 27 | 32 | |
| 28 | 33 | #define BCM2835_I2C_C_READ BIT(0) |
| @@ -474,6 +479,12 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) · 445 unmodified lines | ||
| 474 | 479 | adap->dev.of_node = pdev->dev.of_node; |
| 475 | 480 | adap->quirks = of_device_get_match_data(&pdev->dev); |
| 476 | 481 | |
| 482 | + /* | |
| 483 | + * Disable the hardware clock stretching timeout. SMBUS | |
| 484 | + * specifies a limit for how long the device can stretch the | |
| 485 | + * clock, but core I2C doesn't. | |
| 486 | + */ | |
| 487 | + bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_CLKT, 0); | |
| 477 | 488 | bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0); |
| 478 | 489 | |
| 479 | 490 | ret = i2c_add_adapter(adap); |
| @@ -673,7 +673,7 @@ static int brcmstb_i2c_probe(struct platform_device *pdev) · 672 unmodified lines | ||
| 673 | 673 | |
| 674 | 674 | /* set the data in/out register size for compatible SoCs */ |
| 675 | 675 | if (of_device_is_compatible(dev->device->of_node, |
| 676 | − "brcmstb,brcmper-i2c")) | |
| 676 | + "brcm,brcmper-i2c")) | |
| 677 | 677 | dev->data_regsz = sizeof(u8); |
| 678 | 678 | else |
| 679 | 679 | dev->data_regsz = sizeof(u32); |
| @@ -558,7 +558,7 @@ static int cci_probe(struct platform_device *pdev) · 557 unmodified lines | ||
| 558 | 558 | cci->master[idx].adap.quirks = &cci->data->quirks; |
| 559 | 559 | cci->master[idx].adap.algo = &cci_algo; |
| 560 | 560 | cci->master[idx].adap.dev.parent = dev; |
| 561 | − cci->master[idx].adap.dev.of_node = child; | |
| 561 | + cci->master[idx].adap.dev.of_node = of_node_get(child); | |
| 562 | 562 | cci->master[idx].master = idx; |
| 563 | 563 | cci->master[idx].cci = cci; |
| 564 | 564 | |
| @@ -643,8 +643,10 @@ static int cci_probe(struct platform_device *pdev) · 78 unmodified lines | ||
| 643 | 643 | continue; |
| 644 | 644 | |
| 645 | 645 | ret = i2c_add_adapter(&cci->master[i].adap); |
| 646 | − if (ret < 0) | |
| 646 | + if (ret < 0) { | |
| 647 | + of_node_put(cci->master[i].adap.dev.of_node); | |
| 647 | 648 | goto error_i2c; |
| 649 | + } | |
| 648 | 650 | } |
| 649 | 651 | |
| 650 | 652 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); |
| @@ -655,9 +657,11 @@ static int cci_probe(struct platform_device *pdev) · 4 unmodified lines | ||
| 655 | 657 | return 0; |
| 656 | 658 | |
| 657 | 659 | error_i2c: |
| 658 | − for (; i >= 0; i--) { | |
| 659 | − if (cci->master[i].cci) | |
| 660 | + for (--i ; i >= 0; i--) { | |
| 661 | + if (cci->master[i].cci) { | |
| 660 | 662 | i2c_del_adapter(&cci->master[i].adap); |
| 663 | + of_node_put(cci->master[i].adap.dev.of_node); | |
| 664 | + } | |
| 661 | 665 | } |
| 662 | 666 | error: |
| 663 | 667 | disable_irq(cci->irq); |
| @@ -673,8 +677,10 @@ static int cci_remove(struct platform_device *pdev) · 9 unmodified lines | ||
| 673 | 677 | int i; |
| 674 | 678 | |
| 675 | 679 | for (i = 0; i < cci->data->num_masters; i++) { |
| 676 | − if (cci->master[i].cci) | |
| 680 | + if (cci->master[i].cci) { | |
| 677 | 681 | i2c_del_adapter(&cci->master[i].adap); |
| 682 | + of_node_put(cci->master[i].adap.dev.of_node); | |
| 683 | + } | |
| 678 | 684 | cci_halt(cci, i); |
| 679 | 685 | } |
| 680 | 686 | |
| @@ -1783,11 +1783,14 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, · 1782 unmodified lines | ||
| 1783 | 1783 | ret = iio_device_register(indio_dev); |
| 1784 | 1784 | if (ret < 0) { |
| 1785 | 1785 | dev_err(dev, "Unable to register iio device\n"); |
| 1786 | − goto err_trigger_unregister; | |
| 1786 | + goto err_pm_cleanup; | |
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | 1789 | return 0; |
| 1790 | 1790 | |
| 1791 | +err_pm_cleanup: | |
| 1792 | + pm_runtime_dont_use_autosuspend(dev); | |
| 1793 | + pm_runtime_disable(dev); | |
| 1791 | 1794 | err_trigger_unregister: |
| 1792 | 1795 | bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1); |
| 1793 | 1796 | err_buffer_cleanup: |
| @@ -173,12 +173,20 @@ struct fxls8962af_data { · 172 unmodified lines | ||
| 173 | 173 | u16 upper_thres; |
| 174 | 174 | }; |
| 175 | 175 | |
| 176 | −const struct regmap_config fxls8962af_regmap_conf = { | |
| 176 | +const struct regmap_config fxls8962af_i2c_regmap_conf = { | |
| 177 | 177 | .reg_bits = 8, |
| 178 | 178 | .val_bits = 8, |
| 179 | 179 | .max_register = FXLS8962AF_MAX_REG, |
| 180 | 180 | }; |
| 181 | −EXPORT_SYMBOL_GPL(fxls8962af_regmap_conf); | |
| 181 | +EXPORT_SYMBOL_GPL(fxls8962af_i2c_regmap_conf); | |
| 182 | + | |
| 183 | +const struct regmap_config fxls8962af_spi_regmap_conf = { | |
| 184 | + .reg_bits = 8, | |
| 185 | + .pad_bits = 8, | |
| 186 | + .val_bits = 8, | |
| 187 | + .max_register = FXLS8962AF_MAX_REG, | |
| 188 | +}; | |
| 189 | +EXPORT_SYMBOL_GPL(fxls8962af_spi_regmap_conf); | |
| 182 | 190 | |
| 183 | 191 | enum { |
| 184 | 192 | fxls8962af_idx_x, |
| @@ -18,7 +18,7 @@ static int fxls8962af_probe(struct i2c_client *client) · 17 unmodified lines | ||
| 18 | 18 | { |
| 19 | 19 | struct regmap *regmap; |
| 20 | 20 | |
| 21 | − regmap = devm_regmap_init_i2c(client, &fxls8962af_regmap_conf); | |
| 21 | + regmap = devm_regmap_init_i2c(client, &fxls8962af_i2c_regmap_conf); | |
| 22 | 22 | if (IS_ERR(regmap)) { |
| 23 | 23 | dev_err(&client->dev, "Failed to initialize i2c regmap\n"); |
| 24 | 24 | return PTR_ERR(regmap); |
| @@ -18,7 +18,7 @@ static int fxls8962af_probe(struct spi_device *spi) · 17 unmodified lines | ||
| 18 | 18 | { |
| 19 | 19 | struct regmap *regmap; |
| 20 | 20 | |
| 21 | − regmap = devm_regmap_init_spi(spi, &fxls8962af_regmap_conf); | |
| 21 | + regmap = devm_regmap_init_spi(spi, &fxls8962af_spi_regmap_conf); | |
| 22 | 22 | if (IS_ERR(regmap)) { |
| 23 | 23 | dev_err(&spi->dev, "Failed to initialize spi regmap\n"); |
| 24 | 24 | return PTR_ERR(regmap); |
| @@ -17,6 +17,7 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq); · 16 unmodified lines | ||
| 17 | 17 | int fxls8962af_core_remove(struct device *dev); |
| 18 | 18 | |
| 19 | 19 | extern const struct dev_pm_ops fxls8962af_pm_ops; |
| 20 | −extern const struct regmap_config fxls8962af_regmap_conf; | |
| 20 | +extern const struct regmap_config fxls8962af_i2c_regmap_conf; | |
| 21 | +extern const struct regmap_config fxls8962af_spi_regmap_conf; | |
| 21 | 22 | |
| 22 | 23 | #endif /* _FXLS8962AF_H_ */ |
| @@ -1590,11 +1590,14 @@ static int kxcjk1013_probe(struct i2c_client *client, · 1589 unmodified lines | ||
| 1590 | 1590 | ret = iio_device_register(indio_dev); |
| 1591 | 1591 | if (ret < 0) { |
| 1592 | 1592 | dev_err(&client->dev, "unable to register iio device\n"); |
| 1593 | − goto err_buffer_cleanup; | |
| 1593 | + goto err_pm_cleanup; | |
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | 1596 | return 0; |
| 1597 | 1597 | |
| 1598 | +err_pm_cleanup: | |
| 1599 | + pm_runtime_dont_use_autosuspend(&client->dev); | |
| 1600 | + pm_runtime_disable(&client->dev); | |
| 1598 | 1601 | err_buffer_cleanup: |
| 1599 | 1602 | iio_triggered_buffer_cleanup(indio_dev); |
| 1600 | 1603 | err_trigger_unregister: |
| @@ -495,11 +495,14 @@ static int mma9551_probe(struct i2c_client *client, · 494 unmodified lines | ||
| 495 | 495 | ret = iio_device_register(indio_dev); |
| 496 | 496 | if (ret < 0) { |
| 497 | 497 | dev_err(&client->dev, "unable to register iio device\n"); |
| 498 | − goto out_poweroff; | |
| 498 | + goto err_pm_cleanup; | |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | return 0; |
| 502 | 502 | |
| 503 | +err_pm_cleanup: | |
| 504 | + pm_runtime_dont_use_autosuspend(&client->dev); | |
| 505 | + pm_runtime_disable(&client->dev); | |
| 503 | 506 | out_poweroff: |
| 504 | 507 | mma9551_set_device_state(client, false); |
| 505 | 508 | |
| @@ -1134,12 +1134,15 @@ static int mma9553_probe(struct i2c_client *client, · 1133 unmodified lines | ||
| 1134 | 1134 | ret = iio_device_register(indio_dev); |
| 1135 | 1135 | if (ret < 0) { |
| 1136 | 1136 | dev_err(&client->dev, "unable to register iio device\n"); |
| 1137 | − goto out_poweroff; | |
| 1137 | + goto err_pm_cleanup; | |
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | 1140 | dev_dbg(&indio_dev->dev, "Registered device %s\n", name); |
| 1141 | 1141 | return 0; |
| 1142 | 1142 | |
| 1143 | +err_pm_cleanup: | |
| 1144 | + pm_runtime_dont_use_autosuspend(&client->dev); | |
| 1145 | + pm_runtime_disable(&client->dev); | |
| 1143 | 1146 | out_poweroff: |
| 1144 | 1147 | mma9551_set_device_state(client, false); |
| 1145 | 1148 | return ret; |
| @@ -76,7 +76,7 @@ · 75 unmodified lines | ||
| 76 | 76 | #define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x) |
| 77 | 77 | #define AD7124_CONFIG_PGA_MSK GENMASK(2, 0) |
| 78 | 78 | #define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x) |
| 79 | −#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6) | |
| 79 | +#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(6, 5) | |
| 80 | 80 | #define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x) |
| 81 | 81 | |
| 82 | 82 | /* AD7124_FILTER_X */ |
| @@ -103,6 +103,7 @@ static int men_z188_probe(struct mcb_device *dev, · 102 unmodified lines | ||
| 103 | 103 | struct z188_adc *adc; |
| 104 | 104 | struct iio_dev *indio_dev; |
| 105 | 105 | struct resource *mem; |
| 106 | + int ret; | |
| 106 | 107 | |
| 107 | 108 | indio_dev = devm_iio_device_alloc(&dev->dev, sizeof(struct z188_adc)); |
| 108 | 109 | if (!indio_dev) |
| @@ -128,8 +129,14 @@ static int men_z188_probe(struct mcb_device *dev, · 19 unmodified lines | ||
| 128 | 129 | adc->mem = mem; |
| 129 | 130 | mcb_set_drvdata(dev, indio_dev); |
| 130 | 131 | |
| 131 | − return iio_device_register(indio_dev); | |
| 132 | + ret = iio_device_register(indio_dev); | |
| 133 | + if (ret) | |
| 134 | + goto err_unmap; | |
| 135 | + | |
| 136 | + return 0; | |
| 132 | 137 | |
| 138 | +err_unmap: | |
| 139 | + iounmap(adc->base); | |
| 133 | 140 | err: |
| 134 | 141 | mcb_release_mem(mem); |
| 135 | 142 | return -ENXIO; |
| @@ -388,7 +388,7 @@ static int tsc2046_adc_update_scan_mode(struct iio_dev *indio_dev, · 387 unmodified lines | ||
| 388 | 388 | mutex_lock(&priv->slock); |
| 389 | 389 | |
| 390 | 390 | size = 0; |
| 391 | − for_each_set_bit(ch_idx, active_scan_mask, indio_dev->num_channels) { | |
| 391 | + for_each_set_bit(ch_idx, active_scan_mask, ARRAY_SIZE(priv->l)) { | |
| 392 | 392 | size += tsc2046_adc_group_set_layout(priv, group, ch_idx); |
| 393 | 393 | tsc2046_adc_group_set_cmd(priv, group, ch_idx); |
| 394 | 394 | group++; |
| @@ -548,7 +548,7 @@ static int tsc2046_adc_setup_spi_msg(struct tsc2046_adc_priv *priv) · 153 unmodified lines | ||
| 548 | 548 | * enabled. |
| 549 | 549 | */ |
| 550 | 550 | size = 0; |
| 551 | − for (ch_idx = 0; ch_idx < priv->dcfg->num_channels; ch_idx++) | |
| 551 | + for (ch_idx = 0; ch_idx < ARRAY_SIZE(priv->l); ch_idx++) | |
| 552 | 552 | size += tsc2046_adc_group_set_layout(priv, ch_idx, ch_idx); |
| 553 | 553 | |
| 554 | 554 | priv->tx = devm_kzalloc(&priv->spi->dev, size, GFP_KERNEL); |
| @@ -134,7 +134,6 @@ struct ad74413r_state { · 133 unmodified lines | ||
| 134 | 134 | #define AD74413R_CH_EN_MASK(x) BIT(x) |
| 135 | 135 | |
| 136 | 136 | #define AD74413R_REG_DIN_COMP_OUT 0x25 |
| 137 | −#define AD74413R_DIN_COMP_OUT_SHIFT_X(x) x | |
| 138 | 137 | |
| 139 | 138 | #define AD74413R_REG_ADC_RESULT_X(x) (0x26 + (x)) |
| 140 | 139 | #define AD74413R_ADC_RESULT_MAX GENMASK(15, 0) |
| @@ -288,7 +287,7 @@ static void ad74413r_gpio_set_multiple(struct gpio_chip *chip, · 147 unmodified lines | ||
| 288 | 287 | unsigned int offset = 0; |
| 289 | 288 | int ret; |
| 290 | 289 | |
| 291 | − for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) { | |
| 290 | + for_each_set_bit_from(offset, mask, chip->ngpio) { | |
| 292 | 291 | unsigned int real_offset = st->gpo_gpio_offsets[offset]; |
| 293 | 292 | |
| 294 | 293 | ret = ad74413r_set_gpo_config(st, real_offset, |
| @@ -316,7 +315,7 @@ static int ad74413r_gpio_get(struct gpio_chip *chip, unsigned int offset) · 21 unmodified lines | ||
| 316 | 315 | if (ret) |
| 317 | 316 | return ret; |
| 318 | 317 | |
| 319 | − status &= AD74413R_DIN_COMP_OUT_SHIFT_X(real_offset); | |
| 318 | + status &= BIT(real_offset); | |
| 320 | 319 | |
| 321 | 320 | return status ? 1 : 0; |
| 322 | 321 | } |
| @@ -334,11 +333,10 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip, · 11 unmodified lines | ||
| 334 | 333 | if (ret) |
| 335 | 334 | return ret; |
| 336 | 335 | |
| 337 | − for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) { | |
| 336 | + for_each_set_bit_from(offset, mask, chip->ngpio) { | |
| 338 | 337 | unsigned int real_offset = st->comp_gpio_offsets[offset]; |
| 339 | 338 | |
| 340 | − if (val & BIT(real_offset)) | |
| 341 | − *bits |= offset; | |
| 339 | + __assign_bit(offset, bits, val & BIT(real_offset)); | |
| 342 | 340 | } |
| 343 | 341 | |
| 344 | 342 | return ret; |
| @@ -840,7 +838,7 @@ static int ad74413r_update_scan_mode(struct iio_dev *indio_dev, · 495 unmodified lines | ||
| 840 | 838 | { |
| 841 | 839 | struct ad74413r_state *st = iio_priv(indio_dev); |
| 842 | 840 | struct spi_transfer *xfer = st->adc_samples_xfer; |
| 843 | − u8 *rx_buf = &st->adc_samples_buf.rx_buf[-1 * AD74413R_FRAME_SIZE]; | |
| 841 | + u8 *rx_buf = st->adc_samples_buf.rx_buf; | |
| 844 | 842 | u8 *tx_buf = st->adc_samples_tx_buf; |
| 845 | 843 | unsigned int channel; |
| 846 | 844 | int ret = -EINVAL; |
| @@ -894,9 +892,10 @@ static int ad74413r_update_scan_mode(struct iio_dev *indio_dev, · 47 unmodified lines | ||
| 894 | 892 | |
| 895 | 893 | spi_message_add_tail(xfer, &st->adc_samples_msg); |
| 896 | 894 | |
| 897 | − xfer++; | |
| 898 | 895 | tx_buf += AD74413R_FRAME_SIZE; |
| 899 | − rx_buf += AD74413R_FRAME_SIZE; | |
| 896 | + if (xfer != st->adc_samples_xfer) | |
| 897 | + rx_buf += AD74413R_FRAME_SIZE; | |
| 898 | + xfer++; | |
| 900 | 899 | } |
| 901 | 900 | |
| 902 | 901 | xfer->rx_buf = rx_buf; |
| @@ -348,7 +348,7 @@ static int admv1013_update_mixer_vgate(struct admv1013_state *st) · 347 unmodified lines | ||
| 348 | 348 | |
| 349 | 349 | vcm = regulator_get_voltage(st->reg); |
| 350 | 350 | |
| 351 | − if (vcm >= 0 && vcm < 1800000) | |
| 351 | + if (vcm < 1800000) | |
| 352 | 352 | mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100; |
| 353 | 353 | else if (vcm > 1800000 && vcm < 2600000) |
| 354 | 354 | mixer_vgate = (2375 * vcm / 1000000 + 125) / 100; |
| @@ -1188,11 +1188,14 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq, · 1187 unmodified lines | ||
| 1188 | 1188 | ret = iio_device_register(indio_dev); |
| 1189 | 1189 | if (ret < 0) { |
| 1190 | 1190 | dev_err(dev, "unable to register iio device\n"); |
| 1191 | − goto err_buffer_cleanup; | |
| 1191 | + goto err_pm_cleanup; | |
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | return 0; |
| 1195 | 1195 | |
| 1196 | +err_pm_cleanup: | |
| 1197 | + pm_runtime_dont_use_autosuspend(dev); | |
| 1198 | + pm_runtime_disable(dev); | |
| 1196 | 1199 | err_buffer_cleanup: |
| 1197 | 1200 | iio_triggered_buffer_cleanup(indio_dev); |
| 1198 | 1201 | err_trigger_unregister: |
| @@ -1403,6 +1403,7 @@ static int adis16480_probe(struct spi_device *spi) · 1402 unmodified lines | ||
| 1403 | 1403 | { |
| 1404 | 1404 | const struct spi_device_id *id = spi_get_device_id(spi); |
| 1405 | 1405 | const struct adis_data *adis16480_data; |
| 1406 | + irq_handler_t trigger_handler = NULL; | |
| 1406 | 1407 | struct iio_dev *indio_dev; |
| 1407 | 1408 | struct adis16480 *st; |
| 1408 | 1409 | int ret; |
| @@ -1474,8 +1475,12 @@ static int adis16480_probe(struct spi_device *spi) · 65 unmodified lines | ||
| 1474 | 1475 | st->clk_freq = st->chip_info->int_clk; |
| 1475 | 1476 | } |
| 1476 | 1477 | |
| 1478 | + /* Only use our trigger handler if burst mode is supported */ | |
| 1479 | + if (adis16480_data->burst_len) | |
| 1480 | + trigger_handler = adis16480_trigger_handler; | |
| 1481 | + | |
| 1477 | 1482 | ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev, |
| 1478 | − adis16480_trigger_handler); | |
| 1483 | + trigger_handler); | |
| 1479 | 1484 | if (ret) |
| 1480 | 1485 | return ret; |
| 1481 | 1486 | |
| @@ -1385,7 +1385,7 @@ static int kmx61_probe(struct i2c_client *client, · 1384 unmodified lines | ||
| 1385 | 1385 | ret = iio_device_register(data->acc_indio_dev); |
| 1386 | 1386 | if (ret < 0) { |
| 1387 | 1387 | dev_err(&client->dev, "Failed to register acc iio device\n"); |
| 1388 | − goto err_buffer_cleanup_mag; | |
| 1388 | + goto err_pm_cleanup; | |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | ret = iio_device_register(data->mag_indio_dev); |
| @@ -1398,6 +1398,9 @@ static int kmx61_probe(struct i2c_client *client, · 6 unmodified lines | ||
| 1398 | 1398 | |
| 1399 | 1399 | err_iio_unregister_acc: |
| 1400 | 1400 | iio_device_unregister(data->acc_indio_dev); |
| 1401 | +err_pm_cleanup: | |
| 1402 | + pm_runtime_dont_use_autosuspend(&client->dev); | |
| 1403 | + pm_runtime_disable(&client->dev); | |
| 1401 | 1404 | err_buffer_cleanup_mag: |
| 1402 | 1405 | if (client->irq > 0) |
| 1403 | 1406 | iio_triggered_buffer_cleanup(data->mag_indio_dev); |
| @@ -1374,8 +1374,12 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor, · 1373 unmodified lines | ||
| 1374 | 1374 | if (err < 0) |
| 1375 | 1375 | return err; |
| 1376 | 1376 | |
| 1377 | + /* | |
| 1378 | + * we need to wait for sensor settling time before | |
| 1379 | + * reading data in order to avoid corrupted samples | |
| 1380 | + */ | |
| 1377 | 1381 | delay = 1000000000 / sensor->odr; |
| 1378 | − usleep_range(delay, 2 * delay); | |
| 1382 | + usleep_range(3 * delay, 4 * delay); | |
| 1379 | 1383 | |
| 1380 | 1384 | err = st_lsm6dsx_read_locked(hw, addr, &data, sizeof(data)); |
| 1381 | 1385 | if (err < 0) |
| @@ -962,13 +962,14 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap, · 961 unmodified lines | ||
| 962 | 962 | ret = iio_device_register(indio_dev); |
| 963 | 963 | if (ret < 0) { |
| 964 | 964 | dev_err(dev, "unable to register iio device\n"); |
| 965 | − goto err_disable_runtime_pm; | |
| 965 | + goto err_pm_cleanup; | |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | dev_dbg(dev, "Registered device %s\n", name); |
| 969 | 969 | return 0; |
| 970 | 970 | |
| 971 | −err_disable_runtime_pm: | |
| 971 | +err_pm_cleanup: | |
| 972 | + pm_runtime_dont_use_autosuspend(dev); | |
| 972 | 973 | pm_runtime_disable(dev); |
| 973 | 974 | err_buffer_cleanup: |
| 974 | 975 | iio_triggered_buffer_cleanup(indio_dev); |
| @@ -3370,22 +3370,30 @@ err: · 3369 unmodified lines | ||
| 3370 | 3370 | static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, |
| 3371 | 3371 | const struct sockaddr *dst_addr) |
| 3372 | 3372 | { |
| 3373 | − if (!src_addr || !src_addr->sa_family) { | |
| 3374 | − src_addr = (struct sockaddr *) &id->route.addr.src_addr; | |
| 3375 | − src_addr->sa_family = dst_addr->sa_family; | |
| 3376 | − if (IS_ENABLED(CONFIG_IPV6) && | |
| 3377 | − dst_addr->sa_family == AF_INET6) { | |
| 3378 | − struct sockaddr_in6 *src_addr6 = (struct sockaddr_in6 *) src_addr; | |
| 3379 | − struct sockaddr_in6 *dst_addr6 = (struct sockaddr_in6 *) dst_addr; | |
| 3380 | − src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id; | |
| 3381 | − if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL) | |
| 3382 | − id->route.addr.dev_addr.bound_dev_if = dst_addr6->sin6_scope_id; | |
| 3383 | − } else if (dst_addr->sa_family == AF_IB) { | |
| 3384 | − ((struct sockaddr_ib *) src_addr)->sib_pkey = | |
| 3385 | − ((struct sockaddr_ib *) dst_addr)->sib_pkey; | |
| 3386 | − } | |
| 3387 | − } | |
| 3388 | − return rdma_bind_addr(id, src_addr); | |
| 3373 | + struct sockaddr_storage zero_sock = {}; | |
| 3374 | + | |
| 3375 | + if (src_addr && src_addr->sa_family) | |
| 3376 | + return rdma_bind_addr(id, src_addr); | |
| 3377 | + | |
| 3378 | + /* | |
| 3379 | + * When the src_addr is not specified, automatically supply an any addr | |
| 3380 | + */ | |
| 3381 | + zero_sock.ss_family = dst_addr->sa_family; | |
| 3382 | + if (IS_ENABLED(CONFIG_IPV6) && dst_addr->sa_family == AF_INET6) { | |
| 3383 | + struct sockaddr_in6 *src_addr6 = | |
| 3384 | + (struct sockaddr_in6 *)&zero_sock; | |
| 3385 | + struct sockaddr_in6 *dst_addr6 = | |
| 3386 | + (struct sockaddr_in6 *)dst_addr; | |
| 3387 | + | |
| 3388 | + src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id; | |
| 3389 | + if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL) | |
| 3390 | + id->route.addr.dev_addr.bound_dev_if = | |
| 3391 | + dst_addr6->sin6_scope_id; | |
| 3392 | + } else if (dst_addr->sa_family == AF_IB) { | |
| 3393 | + ((struct sockaddr_ib *)&zero_sock)->sib_pkey = | |
| 3394 | + ((struct sockaddr_ib *)dst_addr)->sib_pkey; | |
| 3395 | + } | |
| 3396 | + return rdma_bind_addr(id, (struct sockaddr *)&zero_sock); | |
| 3389 | 3397 | } |
| 3390 | 3398 | |
| 3391 | 3399 | /* |
| @@ -541,7 +541,7 @@ static struct attribute *port_diagc_attributes[] = { · 540 unmodified lines | ||
| 541 | 541 | }; |
| 542 | 542 | |
| 543 | 543 | static const struct attribute_group port_diagc_group = { |
| 544 | − .name = "linkcontrol", | |
| 544 | + .name = "diag_counters", | |
| 545 | 545 | .attrs = port_diagc_attributes, |
| 546 | 546 | }; |
| 547 | 547 | |
| @@ -2682,6 +2682,8 @@ static void rtrs_clt_dev_release(struct device *dev) · 2681 unmodified lines | ||
| 2682 | 2682 | struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess, |
| 2683 | 2683 | dev); |
| 2684 | 2684 | |
| 2685 | + mutex_destroy(&clt->paths_ev_mutex); | |
| 2686 | + mutex_destroy(&clt->paths_mutex); | |
| 2685 | 2687 | kfree(clt); |
| 2686 | 2688 | } |
| 2687 | 2689 | |
| @@ -2711,6 +2713,8 @@ static struct rtrs_clt_sess *alloc_clt(const char *sessname, size_t paths_num, · 23 unmodified lines | ||
| 2711 | 2713 | return ERR_PTR(-ENOMEM); |
| 2712 | 2714 | } |
| 2713 | 2715 | |
| 2716 | + clt->dev.class = rtrs_clt_dev_class; | |
| 2717 | + clt->dev.release = rtrs_clt_dev_release; | |
| 2714 | 2718 | uuid_gen(&clt->paths_uuid); |
| 2715 | 2719 | INIT_LIST_HEAD_RCU(&clt->paths_list); |
| 2716 | 2720 | clt->paths_num = paths_num; |
| @@ -2727,53 +2731,51 @@ static struct rtrs_clt_sess *alloc_clt(const char *sessname, size_t paths_num, · 10 unmodified lines | ||
| 2727 | 2731 | init_waitqueue_head(&clt->permits_wait); |
| 2728 | 2732 | mutex_init(&clt->paths_ev_mutex); |
| 2729 | 2733 | mutex_init(&clt->paths_mutex); |
| 2734 | + device_initialize(&clt->dev); | |
| 2730 | 2735 | |
| 2731 | − clt->dev.class = rtrs_clt_dev_class; | |
| 2732 | − clt->dev.release = rtrs_clt_dev_release; | |
| 2733 | 2736 | err = dev_set_name(&clt->dev, "%s", sessname); |
| 2734 | 2737 | if (err) |
| 2735 | − goto err; | |
| 2738 | + goto err_put; | |
| 2739 | + | |
| 2736 | 2740 | /* |
| 2737 | 2741 | * Suppress user space notification until |
| 2738 | 2742 | * sysfs files are created |
| 2739 | 2743 | */ |
| 2740 | 2744 | dev_set_uevent_suppress(&clt->dev, true); |
| 2741 | − err = device_register(&clt->dev); | |
| 2742 | − if (err) { | |
| 2743 | − put_device(&clt->dev); | |
| 2744 | − goto err; | |
| 2745 | − } | |
| 2745 | + err = device_add(&clt->dev); | |
| 2746 | + if (err) | |
| 2747 | + goto err_put; | |
| 2746 | 2748 | |
| 2747 | 2749 | clt->kobj_paths = kobject_create_and_add("paths", &clt->dev.kobj); |
| 2748 | 2750 | if (!clt->kobj_paths) { |
| 2749 | 2751 | err = -ENOMEM; |
| 2750 | − goto err_dev; | |
| 2752 | + goto err_del; | |
| 2751 | 2753 | } |
| 2752 | 2754 | err = rtrs_clt_create_sysfs_root_files(clt); |
| 2753 | 2755 | if (err) { |
| 2754 | 2756 | kobject_del(clt->kobj_paths); |
| 2755 | 2757 | kobject_put(clt->kobj_paths); |
| 2756 | − goto err_dev; | |
| 2758 | + goto err_del; | |
| 2757 | 2759 | } |
| 2758 | 2760 | dev_set_uevent_suppress(&clt->dev, false); |
| 2759 | 2761 | kobject_uevent(&clt->dev.kobj, KOBJ_ADD); |
| 2760 | 2762 | |
| 2761 | 2763 | return clt; |
| 2762 | −err_dev: | |
| 2763 | − device_unregister(&clt->dev); | |
| 2764 | −err: | |
| 2764 | +err_del: | |
| 2765 | + device_del(&clt->dev); | |
| 2766 | +err_put: | |
| 2765 | 2767 | free_percpu(clt->pcpu_path); |
| 2766 | − kfree(clt); | |
| 2768 | + put_device(&clt->dev); | |
| 2767 | 2769 | return ERR_PTR(err); |
| 2768 | 2770 | } |
| 2769 | 2771 | |
| 2770 | 2772 | static void free_clt(struct rtrs_clt_sess *clt) |
| 2771 | 2773 | { |
| 2772 | − free_permits(clt); | |
| 2773 | 2774 | free_percpu(clt->pcpu_path); |
| 2774 | − mutex_destroy(&clt->paths_ev_mutex); | |
| 2775 | − mutex_destroy(&clt->paths_mutex); | |
| 2776 | − /* release callback will free clt in last put */ | |
| 2775 | + | |
| 2776 | + /* | |
| 2777 | + * release callback will free clt and destroy mutexes in last put | |
| 2778 | + */ | |
| 2777 | 2779 | device_unregister(&clt->dev); |
| 2778 | 2780 | } |
| 2779 | 2781 | |
| @@ -2890,6 +2892,7 @@ void rtrs_clt_close(struct rtrs_clt_sess *clt) · 110 unmodified lines | ||
| 2890 | 2892 | rtrs_clt_destroy_path_files(clt_path, NULL); |
| 2891 | 2893 | kobject_put(&clt_path->kobj); |
| 2892 | 2894 | } |
| 2895 | + free_permits(clt); | |
| 2893 | 2896 | free_clt(clt); |
| 2894 | 2897 | } |
| 2895 | 2898 | EXPORT_SYMBOL(rtrs_clt_close); |
| @@ -4047,9 +4047,11 @@ static void srp_remove_one(struct ib_device *device, void *client_data) · 4046 unmodified lines | ||
| 4047 | 4047 | spin_unlock(&host->target_lock); |
| 4048 | 4048 | |
| 4049 | 4049 | /* |
| 4050 | − * Wait for tl_err and target port removal tasks. | |
| 4050 | + * srp_queue_remove_work() queues a call to | |
| 4051 | + * srp_remove_target(). The latter function cancels | |
| 4052 | + * target->tl_err_work so waiting for the remove works to | |
| 4053 | + * finish is sufficient. | |
| 4051 | 4054 | */ |
| 4052 | − flush_workqueue(system_long_wq); | |
| 4053 | 4055 | flush_workqueue(srp_remove_wq); |
| 4054 | 4056 | |
| 4055 | 4057 | kfree(host); |
| @@ -2285,6 +2285,12 @@ int input_register_device(struct input_dev *dev) · 2284 unmodified lines | ||
| 2285 | 2285 | /* KEY_RESERVED is not supposed to be transmitted to userspace. */ |
| 2286 | 2286 | __clear_bit(KEY_RESERVED, dev->keybit); |
| 2287 | 2287 | |
| 2288 | + /* Buttonpads should not map BTN_RIGHT and/or BTN_MIDDLE. */ | |
| 2289 | + if (test_bit(INPUT_PROP_BUTTONPAD, dev->propbit)) { | |
| 2290 | + __clear_bit(BTN_RIGHT, dev->keybit); | |
| 2291 | + __clear_bit(BTN_MIDDLE, dev->keybit); | |
| 2292 | + } | |
| 2293 | + | |
| 2288 | 2294 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ |
| 2289 | 2295 | input_cleanse_bitmasks(dev); |
| 2290 | 2296 | |
| @@ -75,6 +75,8 @@ static void psmouse_smbus_detach_i2c_client(struct i2c_client *client) · 74 unmodified lines | ||
| 75 | 75 | "Marking SMBus companion %s as gone\n", |
| 76 | 76 | dev_name(&smbdev->client->dev)); |
| 77 | 77 | smbdev->dead = true; |
| 78 | + device_link_remove(&smbdev->client->dev, | |
| 79 | + &smbdev->psmouse->ps2dev.serio->dev); | |
| 78 | 80 | serio_rescan(smbdev->psmouse->ps2dev.serio); |
| 79 | 81 | } else { |
| 80 | 82 | list_del(&smbdev->node); |
| @@ -174,6 +176,8 @@ static void psmouse_smbus_disconnect(struct psmouse *psmouse) · 93 unmodified lines | ||
| 174 | 176 | kfree(smbdev); |
| 175 | 177 | } else { |
| 176 | 178 | smbdev->dead = true; |
| 179 | + device_link_remove(&smbdev->client->dev, | |
| 180 | + &psmouse->ps2dev.serio->dev); | |
| 177 | 181 | psmouse_dbg(smbdev->psmouse, |
| 178 | 182 | "posting removal request for SMBus companion %s\n", |
| 179 | 183 | dev_name(&smbdev->client->dev)); |
| @@ -270,6 +274,12 @@ int psmouse_smbus_init(struct psmouse *psmouse, · 90 unmodified lines | ||
| 270 | 274 | |
| 271 | 275 | if (smbdev->client) { |
| 272 | 276 | /* We have our companion device */ |
| 277 | + if (!device_link_add(&smbdev->client->dev, | |
| 278 | + &psmouse->ps2dev.serio->dev, | |
| 279 | + DL_FLAG_STATELESS)) | |
| 280 | + psmouse_warn(psmouse, | |
| 281 | + "failed to set up link with iSMBus companion %s\n", | |
| 282 | + dev_name(&smbdev->client->dev)); | |
| 273 | 283 | return 0; |
| 274 | 284 | } |
| 275 | 285 | |
| @@ -571,8 +571,20 @@ static SIMPLE_DEV_PM_OPS(zinitix_pm_ops, zinitix_suspend, zinitix_resume); · 570 unmodified lines | ||
| 571 | 571 | |
| 572 | 572 | #ifdef CONFIG_OF |
| 573 | 573 | static const struct of_device_id zinitix_of_match[] = { |
| 574 | + { .compatible = "zinitix,bt402" }, | |
| 575 | + { .compatible = "zinitix,bt403" }, | |
| 576 | + { .compatible = "zinitix,bt404" }, | |
| 577 | + { .compatible = "zinitix,bt412" }, | |
| 578 | + { .compatible = "zinitix,bt413" }, | |
| 579 | + { .compatible = "zinitix,bt431" }, | |
| 580 | + { .compatible = "zinitix,bt432" }, | |
| 581 | + { .compatible = "zinitix,bt531" }, | |
| 574 | 582 | { .compatible = "zinitix,bt532" }, |
| 583 | + { .compatible = "zinitix,bt538" }, | |
| 575 | 584 | { .compatible = "zinitix,bt541" }, |
| 585 | + { .compatible = "zinitix,bt548" }, | |
| 586 | + { .compatible = "zinitix,bt554" }, | |
| 587 | + { .compatible = "zinitix,at100" }, | |
| 576 | 588 | { } |
| 577 | 589 | }; |
| 578 | 590 | MODULE_DEVICE_TABLE(of, zinitix_of_match); |
| @@ -2077,7 +2077,7 @@ static void __dm_destroy(struct mapped_device *md, bool wait) · 2076 unmodified lines | ||
| 2077 | 2077 | set_bit(DMF_FREEING, &md->flags); |
| 2078 | 2078 | spin_unlock(&_minor_lock); |
| 2079 | 2079 | |
| 2080 | − blk_set_queue_dying(md->queue); | |
| 2080 | + blk_mark_disk_dead(md->disk); | |
| 2081 | 2081 | |
| 2082 | 2082 | /* |
| 2083 | 2083 | * Take suspend_lock so that presuspend and postsuspend methods |
| @@ -1682,31 +1682,31 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req) · 1681 unmodified lines | ||
| 1682 | 1682 | struct mmc_card *card = mq->card; |
| 1683 | 1683 | struct mmc_host *host = card->host; |
| 1684 | 1684 | blk_status_t error = BLK_STS_OK; |
| 1685 | − int retries = 0; | |
| 1686 | 1685 | |
| 1687 | 1686 | do { |
| 1688 | 1687 | u32 status; |
| 1689 | 1688 | int err; |
| 1689 | + int retries = 0; | |
| 1690 | 1690 | |
| 1691 | − mmc_blk_rw_rq_prep(mqrq, card, 1, mq); | |
| 1691 | + while (retries++ <= MMC_READ_SINGLE_RETRIES) { | |
| 1692 | + mmc_blk_rw_rq_prep(mqrq, card, 1, mq); | |
| 1692 | 1693 | |
| 1693 | − mmc_wait_for_req(host, mrq); | |
| 1694 | + mmc_wait_for_req(host, mrq); | |
| 1694 | 1695 | |
| 1695 | − err = mmc_send_status(card, &status); | |
| 1696 | − if (err) | |
| 1697 | − goto error_exit; | |
| 1698 | − | |
| 1699 | − if (!mmc_host_is_spi(host) && | |
| 1700 | − !mmc_ready_for_data(status)) { | |
| 1701 | − err = mmc_blk_fix_state(card, req); | |
| 1696 | + err = mmc_send_status(card, &status); | |
| 1702 | 1697 | if (err) |
| 1703 | 1698 | goto error_exit; |
| 1704 | − } | |
| 1705 | 1699 | |
| 1706 | − if (mrq->cmd->error && retries++ < MMC_READ_SINGLE_RETRIES) | |
| 1707 | − continue; | |
| 1700 | + if (!mmc_host_is_spi(host) && | |
| 1701 | + !mmc_ready_for_data(status)) { | |
| 1702 | + err = mmc_blk_fix_state(card, req); | |
| 1703 | + if (err) | |
| 1704 | + goto error_exit; | |
| 1705 | + } | |
| 1708 | 1706 | |
| 1709 | − retries = 0; | |
| 1707 | + if (!mrq->cmd->error) | |
| 1708 | + break; | |
| 1709 | + } | |
| 1710 | 1710 | |
| 1711 | 1711 | if (mrq->cmd->error || |
| 1712 | 1712 | mrq->data->error || |
| @@ -264,16 +264,20 @@ static int phram_setup(const char *val) · 263 unmodified lines | ||
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | − if (erasesize) | |
| 268 | − div_u64_rem(len, (uint32_t)erasesize, &rem); | |
| 269 | − | |
| 270 | 267 | if (len == 0 || erasesize == 0 || erasesize > len |
| 271 | − || erasesize > UINT_MAX || rem) { | |
| 268 | + || erasesize > UINT_MAX) { | |
| 272 | 269 | parse_err("illegal erasesize or len\n"); |
| 273 | 270 | ret = -EINVAL; |
| 274 | 271 | goto error; |
| 275 | 272 | } |
| 276 | 273 | |
| 274 | + div_u64_rem(len, (uint32_t)erasesize, &rem); | |
| 275 | + if (rem) { | |
| 276 | + parse_err("len is not multiple of erasesize\n"); | |
| 277 | + ret = -EINVAL; | |
| 278 | + goto error; | |
| 279 | + } | |
| 280 | + | |
| 277 | 281 | ret = register_device(name, start, len, (uint32_t)erasesize); |
| 278 | 282 | if (ret) |
| 279 | 283 | goto error; |
| @@ -546,6 +546,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd) · 545 unmodified lines | ||
| 546 | 546 | config.stride = 1; |
| 547 | 547 | config.read_only = true; |
| 548 | 548 | config.root_only = true; |
| 549 | + config.ignore_wp = true; | |
| 549 | 550 | config.no_of_node = !of_device_is_compatible(node, "nvmem-cells"); |
| 550 | 551 | config.priv = mtd; |
| 551 | 552 | |
| @@ -833,6 +834,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd, · 281 unmodified lines | ||
| 833 | 834 | config.owner = THIS_MODULE; |
| 834 | 835 | config.type = NVMEM_TYPE_OTP; |
| 835 | 836 | config.root_only = true; |
| 837 | + config.ignore_wp = true; | |
| 836 | 838 | config.reg_read = reg_read; |
| 837 | 839 | config.size = size; |
| 838 | 840 | config.of_node = np; |
| @@ -42,7 +42,8 @@ config MTD_NAND_OMAP2 · 41 unmodified lines | ||
| 42 | 42 | tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller" |
| 43 | 43 | depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST |
| 44 | 44 | depends on HAS_IOMEM |
| 45 | − select OMAP_GPMC if ARCH_K3 | |
| 45 | + select MEMORY | |
| 46 | + select OMAP_GPMC | |
| 46 | 47 | help |
| 47 | 48 | Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4 |
| 48 | 49 | and Keystone platforms. |
| @@ -2106,7 +2106,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip, · 2105 unmodified lines | ||
| 2106 | 2106 | mtd->oobsize / trans, |
| 2107 | 2107 | host->hwcfg.sector_size_1k); |
| 2108 | 2108 | |
| 2109 | − if (!ret) { | |
| 2109 | + if (ret != -EBADMSG) { | |
| 2110 | 2110 | *err_addr = brcmnand_get_uncorrecc_addr(ctrl); |
| 2111 | 2111 | |
| 2112 | 2112 | if (*err_addr) |
| @@ -2285,7 +2285,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, · 2284 unmodified lines | ||
| 2285 | 2285 | this->hw.must_apply_timings = false; |
| 2286 | 2286 | ret = gpmi_nfc_apply_timings(this); |
| 2287 | 2287 | if (ret) |
| 2288 | − return ret; | |
| 2288 | + goto out_pm; | |
| 2289 | 2289 | } |
| 2290 | 2290 | |
| 2291 | 2291 | dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs); |
| @@ -2414,6 +2414,7 @@ unmap: · 122 unmodified lines | ||
| 2414 | 2414 | |
| 2415 | 2415 | this->bch = false; |
| 2416 | 2416 | |
| 2417 | +out_pm: | |
| 2417 | 2418 | pm_runtime_mark_last_busy(this->dev); |
| 2418 | 2419 | pm_runtime_put_autosuspend(this->dev); |
| 2419 | 2420 | |
| @@ -68,9 +68,14 @@ static struct ingenic_ecc *ingenic_ecc_get(struct device_node *np) · 67 unmodified lines | ||
| 68 | 68 | struct ingenic_ecc *ecc; |
| 69 | 69 | |
| 70 | 70 | pdev = of_find_device_by_node(np); |
| 71 | − if (!pdev || !platform_get_drvdata(pdev)) | |
| 71 | + if (!pdev) | |
| 72 | 72 | return ERR_PTR(-EPROBE_DEFER); |
| 73 | 73 | |
| 74 | + if (!platform_get_drvdata(pdev)) { | |
| 75 | + put_device(&pdev->dev); | |
| 76 | + return ERR_PTR(-EPROBE_DEFER); | |
| 77 | + } | |
| 78 | + | |
| 74 | 79 | ecc = platform_get_drvdata(pdev); |
| 75 | 80 | clk_prepare_enable(ecc->clk); |
| 76 | 81 | |
| @@ -2,7 +2,6 @@ · 1 unmodified line | ||
| 2 | 2 | /* |
| 3 | 3 | * Copyright (c) 2016, The Linux Foundation. All rights reserved. |
| 4 | 4 | */ |
| 5 | − | |
| 6 | 5 | #include <linux/clk.h> |
| 7 | 6 | #include <linux/slab.h> |
| 8 | 7 | #include <linux/bitops.h> |
| @@ -3073,10 +3072,6 @@ static int qcom_nandc_probe(struct platform_device *pdev) · 3064 unmodified lines | ||
| 3073 | 3072 | if (dma_mapping_error(dev, nandc->base_dma)) |
| 3074 | 3073 | return -ENXIO; |
| 3075 | 3074 | |
| 3076 | − ret = qcom_nandc_alloc(nandc); | |
| 3077 | − if (ret) | |
| 3078 | − goto err_nandc_alloc; | |
| 3079 | − | |
| 3080 | 3075 | ret = clk_prepare_enable(nandc->core_clk); |
| 3081 | 3076 | if (ret) |
| 3082 | 3077 | goto err_core_clk; |
| @@ -3085,6 +3080,10 @@ static int qcom_nandc_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 3085 | 3080 | if (ret) |
| 3086 | 3081 | goto err_aon_clk; |
| 3087 | 3082 | |
| 3083 | + ret = qcom_nandc_alloc(nandc); | |
| 3084 | + if (ret) | |
| 3085 | + goto err_nandc_alloc; | |
| 3086 | + | |
| 3088 | 3087 | ret = qcom_nandc_setup(nandc); |
| 3089 | 3088 | if (ret) |
| 3090 | 3089 | goto err_setup; |
| @@ -3096,15 +3095,14 @@ static int qcom_nandc_probe(struct platform_device *pdev) · 5 unmodified lines | ||
| 3096 | 3095 | return 0; |
| 3097 | 3096 | |
| 3098 | 3097 | err_setup: |
| 3098 | + qcom_nandc_unalloc(nandc); | |
| 3099 | +err_nandc_alloc: | |
| 3099 | 3100 | clk_disable_unprepare(nandc->aon_clk); |
| 3100 | 3101 | err_aon_clk: |
| 3101 | 3102 | clk_disable_unprepare(nandc->core_clk); |
| 3102 | 3103 | err_core_clk: |
| 3103 | − qcom_nandc_unalloc(nandc); | |
| 3104 | −err_nandc_alloc: | |
| 3105 | 3104 | dma_unmap_resource(dev, res->start, resource_size(res), |
| 3106 | 3105 | DMA_BIDIRECTIONAL, 0); |
| 3107 | − | |
| 3108 | 3106 | return ret; |
| 3109 | 3107 | } |
| 3110 | 3108 | |
| @@ -58,11 +58,11 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 57 unmodified lines | ||
| 58 | 58 | const struct mtd_partition **pparts, |
| 59 | 59 | struct mtd_part_parser_data *data) |
| 60 | 60 | { |
| 61 | + size_t len = SMEM_FLASH_PTABLE_HDR_LEN; | |
| 62 | + int ret, i, j, tmpparts, numparts = 0; | |
| 61 | 63 | struct smem_flash_pentry *pentry; |
| 62 | 64 | struct smem_flash_ptable *ptable; |
| 63 | − size_t len = SMEM_FLASH_PTABLE_HDR_LEN; | |
| 64 | 65 | struct mtd_partition *parts; |
| 65 | − int ret, i, numparts; | |
| 66 | 66 | char *name, *c; |
| 67 | 67 | |
| 68 | 68 | if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS) |
| @@ -75,7 +75,8 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 6 unmodified lines | ||
| 75 | 75 | pr_debug("Parsing partition table info from SMEM\n"); |
| 76 | 76 | ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len); |
| 77 | 77 | if (IS_ERR(ptable)) { |
| 78 | − pr_err("Error reading partition table header\n"); | |
| 78 | + if (PTR_ERR(ptable) != -EPROBE_DEFER) | |
| 79 | + pr_err("Error reading partition table header\n"); | |
| 79 | 80 | return PTR_ERR(ptable); |
| 80 | 81 | } |
| 81 | 82 | |
| @@ -87,8 +88,8 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 5 unmodified lines | ||
| 87 | 88 | } |
| 88 | 89 | |
| 89 | 90 | /* Ensure that # of partitions is less than the max we have allocated */ |
| 90 | − numparts = le32_to_cpu(ptable->numparts); | |
| 91 | − if (numparts > SMEM_FLASH_PTABLE_MAX_PARTS_V4) { | |
| 91 | + tmpparts = le32_to_cpu(ptable->numparts); | |
| 92 | + if (tmpparts > SMEM_FLASH_PTABLE_MAX_PARTS_V4) { | |
| 92 | 93 | pr_err("Partition numbers exceed the max limit\n"); |
| 93 | 94 | return -EINVAL; |
| 94 | 95 | } |
| @@ -116,11 +117,17 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 21 unmodified lines | ||
| 116 | 117 | return PTR_ERR(ptable); |
| 117 | 118 | } |
| 118 | 119 | |
| 120 | + for (i = 0; i < tmpparts; i++) { | |
| 121 | + pentry = &ptable->pentry[i]; | |
| 122 | + if (pentry->name[0] != '\0') | |
| 123 | + numparts++; | |
| 124 | + } | |
| 125 | + | |
| 119 | 126 | parts = kcalloc(numparts, sizeof(*parts), GFP_KERNEL); |
| 120 | 127 | if (!parts) |
| 121 | 128 | return -ENOMEM; |
| 122 | 129 | |
| 123 | − for (i = 0; i < numparts; i++) { | |
| 130 | + for (i = 0, j = 0; i < tmpparts; i++) { | |
| 124 | 131 | pentry = &ptable->pentry[i]; |
| 125 | 132 | if (pentry->name[0] == '\0') |
| 126 | 133 | continue; |
| @@ -135,24 +142,25 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 8 unmodified lines | ||
| 135 | 142 | for (c = name; *c != '\0'; c++) |
| 136 | 143 | *c = tolower(*c); |
| 137 | 144 | |
| 138 | − parts[i].name = name; | |
| 139 | − parts[i].offset = le32_to_cpu(pentry->offset) * mtd->erasesize; | |
| 140 | − parts[i].mask_flags = pentry->attr; | |
| 141 | − parts[i].size = le32_to_cpu(pentry->length) * mtd->erasesize; | |
| 145 | + parts[j].name = name; | |
| 146 | + parts[j].offset = le32_to_cpu(pentry->offset) * mtd->erasesize; | |
| 147 | + parts[j].mask_flags = pentry->attr; | |
| 148 | + parts[j].size = le32_to_cpu(pentry->length) * mtd->erasesize; | |
| 142 | 149 | pr_debug("%d: %s offs=0x%08x size=0x%08x attr:0x%08x\n", |
| 143 | 150 | i, pentry->name, le32_to_cpu(pentry->offset), |
| 144 | 151 | le32_to_cpu(pentry->length), pentry->attr); |
| 152 | + j++; | |
| 145 | 153 | } |
| 146 | 154 | |
| 147 | 155 | pr_debug("SMEM partition table found: ver: %d len: %d\n", |
| 148 | − le32_to_cpu(ptable->version), numparts); | |
| 156 | + le32_to_cpu(ptable->version), tmpparts); | |
| 149 | 157 | *pparts = parts; |
| 150 | 158 | |
| 151 | 159 | return numparts; |
| 152 | 160 | |
| 153 | 161 | out_free_parts: |
| 154 | − while (--i >= 0) | |
| 155 | − kfree(parts[i].name); | |
| 162 | + while (--j >= 0) | |
| 163 | + kfree(parts[j].name); | |
| 156 | 164 | kfree(parts); |
| 157 | 165 | *pparts = NULL; |
| 158 | 166 | |
| @@ -166,6 +174,8 @@ static void parse_qcomsmem_cleanup(const struct mtd_partition *pparts, · 7 unmodified lines | ||
| 166 | 174 | |
| 167 | 175 | for (i = 0; i < nr_parts; i++) |
| 168 | 176 | kfree(pparts[i].name); |
| 177 | + | |
| 178 | + kfree(pparts); | |
| 169 | 179 | } |
| 170 | 180 | |
| 171 | 181 | static const struct of_device_id qcomsmem_of_match_table[] = { |
| @@ -225,7 +225,7 @@ static inline int __check_agg_selection_timer(struct port *port) · 224 unmodified lines | ||
| 225 | 225 | if (bond == NULL) |
| 226 | 226 | return 0; |
| 227 | 227 | |
| 228 | − return BOND_AD_INFO(bond).agg_select_timer ? 1 : 0; | |
| 228 | + return atomic_read(&BOND_AD_INFO(bond).agg_select_timer) ? 1 : 0; | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
| @@ -1995,7 +1995,7 @@ static void ad_marker_response_received(struct bond_marker *marker, · 1763 unmodified lines | ||
| 1995 | 1995 | */ |
| 1996 | 1996 | void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout) |
| 1997 | 1997 | { |
| 1998 | − BOND_AD_INFO(bond).agg_select_timer = timeout; | |
| 1998 | + atomic_set(&BOND_AD_INFO(bond).agg_select_timer, timeout); | |
| 1999 | 1999 | } |
| 2000 | 2000 | |
| 2001 | 2001 | /** |
| @@ -2278,6 +2278,28 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond) · 276 unmodified lines | ||
| 2278 | 2278 | spin_unlock_bh(&bond->mode_lock); |
| 2279 | 2279 | } |
| 2280 | 2280 | |
| 2281 | +/** | |
| 2282 | + * bond_agg_timer_advance - advance agg_select_timer | |
| 2283 | + * @bond: bonding structure | |
| 2284 | + * | |
| 2285 | + * Return true when agg_select_timer reaches 0. | |
| 2286 | + */ | |
| 2287 | +static bool bond_agg_timer_advance(struct bonding *bond) | |
| 2288 | +{ | |
| 2289 | + int val, nval; | |
| 2290 | + | |
| 2291 | + while (1) { | |
| 2292 | + val = atomic_read(&BOND_AD_INFO(bond).agg_select_timer); | |
| 2293 | + if (!val) | |
| 2294 | + return false; | |
| 2295 | + nval = val - 1; | |
| 2296 | + if (atomic_cmpxchg(&BOND_AD_INFO(bond).agg_select_timer, | |
| 2297 | + val, nval) == val) | |
| 2298 | + break; | |
| 2299 | + } | |
| 2300 | + return nval == 0; | |
| 2301 | +} | |
| 2302 | + | |
| 2281 | 2303 | /** |
| 2282 | 2304 | * bond_3ad_state_machine_handler - handle state machines timeout |
| 2283 | 2305 | * @work: work context to fetch bonding struct to work on from |
| @@ -2313,9 +2335,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) · 29 unmodified lines | ||
| 2313 | 2335 | if (!bond_has_slaves(bond)) |
| 2314 | 2336 | goto re_arm; |
| 2315 | 2337 | |
| 2316 | − /* check if agg_select_timer timer after initialize is timed out */ | |
| 2317 | − if (BOND_AD_INFO(bond).agg_select_timer && | |
| 2318 | − !(--BOND_AD_INFO(bond).agg_select_timer)) { | |
| 2338 | + if (bond_agg_timer_advance(bond)) { | |
| 2319 | 2339 | slave = bond_first_slave_rcu(bond); |
| 2320 | 2340 | port = slave ? &(SLAVE_AD_INFO(slave)->port) : NULL; |
| 2321 | 2341 | |
| @@ -2379,10 +2379,9 @@ static int __bond_release_one(struct net_device *bond_dev, · 2378 unmodified lines | ||
| 2379 | 2379 | bond_select_active_slave(bond); |
| 2380 | 2380 | } |
| 2381 | 2381 | |
| 2382 | − if (!bond_has_slaves(bond)) { | |
| 2383 | − bond_set_carrier(bond); | |
| 2382 | + bond_set_carrier(bond); | |
| 2383 | + if (!bond_has_slaves(bond)) | |
| 2384 | 2384 | eth_hw_addr_random(bond_dev); |
| 2385 | − } | |
| 2386 | 2385 | |
| 2387 | 2386 | unblock_netpoll_tx(); |
| 2388 | 2387 | synchronize_rcu(); |
| @@ -82,6 +82,7 @@ config NET_DSA_REALTEK_SMI · 81 unmodified lines | ||
| 82 | 82 | |
| 83 | 83 | config NET_DSA_SMSC_LAN9303 |
| 84 | 84 | tristate |
| 85 | + depends on VLAN_8021Q || VLAN_8021Q=n | |
| 85 | 86 | select NET_DSA_TAG_LAN9303 |
| 86 | 87 | select REGMAP |
| 87 | 88 | help |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <linux/mii.h> |
| 11 | 11 | #include <linux/phy.h> |
| 12 | 12 | #include <linux/if_bridge.h> |
| 13 | +#include <linux/if_vlan.h> | |
| 13 | 14 | #include <linux/etherdevice.h> |
| 14 | 15 | |
| 15 | 16 | #include "lan9303.h" |
| @@ -1083,21 +1084,27 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port, · 1067 unmodified lines | ||
| 1083 | 1084 | static int lan9303_port_enable(struct dsa_switch *ds, int port, |
| 1084 | 1085 | struct phy_device *phy) |
| 1085 | 1086 | { |
| 1087 | + struct dsa_port *dp = dsa_to_port(ds, port); | |
| 1086 | 1088 | struct lan9303 *chip = ds->priv; |
| 1087 | 1089 | |
| 1088 | − if (!dsa_is_user_port(ds, port)) | |
| 1090 | + if (!dsa_port_is_user(dp)) | |
| 1089 | 1091 | return 0; |
| 1090 | 1092 | |
| 1093 | + vlan_vid_add(dp->cpu_dp->master, htons(ETH_P_8021Q), port); | |
| 1094 | + | |
| 1091 | 1095 | return lan9303_enable_processing_port(chip, port); |
| 1092 | 1096 | } |
| 1093 | 1097 | |
| 1094 | 1098 | static void lan9303_port_disable(struct dsa_switch *ds, int port) |
| 1095 | 1099 | { |
| 1100 | + struct dsa_port *dp = dsa_to_port(ds, port); | |
| 1096 | 1101 | struct lan9303 *chip = ds->priv; |
| 1097 | 1102 | |
| 1098 | − if (!dsa_is_user_port(ds, port)) | |
| 1103 | + if (!dsa_port_is_user(dp)) | |
| 1099 | 1104 | return; |
| 1100 | 1105 | |
| 1106 | + vlan_vid_del(dp->cpu_dp->master, htons(ETH_P_8021Q), port); | |
| 1107 | + | |
| 1101 | 1108 | lan9303_disable_processing_port(chip, port); |
| 1102 | 1109 | lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN); |
| 1103 | 1110 | } |
| @@ -1310,7 +1317,7 @@ static int lan9303_probe_reset_gpio(struct lan9303 *chip, · 206 unmodified lines | ||
| 1310 | 1317 | struct device_node *np) |
| 1311 | 1318 | { |
| 1312 | 1319 | chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset", |
| 1313 | − GPIOD_OUT_LOW); | |
| 1320 | + GPIOD_OUT_HIGH); | |
| 1314 | 1321 | if (IS_ERR(chip->reset_gpio)) |
| 1315 | 1322 | return PTR_ERR(chip->reset_gpio); |
| 1316 | 1323 | |
| @@ -2176,8 +2176,8 @@ static int gswip_remove(struct platform_device *pdev) · 2175 unmodified lines | ||
| 2176 | 2176 | |
| 2177 | 2177 | if (priv->ds->slave_mii_bus) { |
| 2178 | 2178 | mdiobus_unregister(priv->ds->slave_mii_bus); |
| 2179 | − mdiobus_free(priv->ds->slave_mii_bus); | |
| 2180 | 2179 | of_node_put(priv->ds->slave_mii_bus->dev.of_node); |
| 2180 | + mdiobus_free(priv->ds->slave_mii_bus); | |
| 2181 | 2181 | } |
| 2182 | 2182 | |
| 2183 | 2183 | for (i = 0; i < priv->num_gphy_fw; i++) |
| @@ -26,7 +26,7 @@ void ksz_update_port_member(struct ksz_device *dev, int port) · 25 unmodified lines | ||
| 26 | 26 | struct dsa_switch *ds = dev->ds; |
| 27 | 27 | u8 port_member = 0, cpu_port; |
| 28 | 28 | const struct dsa_port *dp; |
| 29 | − int i; | |
| 29 | + int i, j; | |
| 30 | 30 | |
| 31 | 31 | if (!dsa_is_user_port(ds, port)) |
| 32 | 32 | return; |
| @@ -45,13 +45,33 @@ void ksz_update_port_member(struct ksz_device *dev, int port) · 12 unmodified lines | ||
| 45 | 45 | continue; |
| 46 | 46 | if (!dsa_port_bridge_same(dp, other_dp)) |
| 47 | 47 | continue; |
| 48 | + if (other_p->stp_state != BR_STATE_FORWARDING) | |
| 49 | + continue; | |
| 48 | 50 | |
| 49 | − if (other_p->stp_state == BR_STATE_FORWARDING && | |
| 50 | − p->stp_state == BR_STATE_FORWARDING) { | |
| 51 | + if (p->stp_state == BR_STATE_FORWARDING) { | |
| 51 | 52 | val |= BIT(port); |
| 52 | 53 | port_member |= BIT(i); |
| 53 | 54 | } |
| 54 | 55 | |
| 56 | + /* Retain port [i]'s relationship to other ports than [port] */ | |
| 57 | + for (j = 0; j < ds->num_ports; j++) { | |
| 58 | + const struct dsa_port *third_dp; | |
| 59 | + struct ksz_port *third_p; | |
| 60 | + | |
| 61 | + if (j == i) | |
| 62 | + continue; | |
| 63 | + if (j == port) | |
| 64 | + continue; | |
| 65 | + if (!dsa_is_user_port(ds, j)) | |
| 66 | + continue; | |
| 67 | + third_p = &dev->ports[j]; | |
| 68 | + if (third_p->stp_state != BR_STATE_FORWARDING) | |
| 69 | + continue; | |
| 70 | + third_dp = dsa_to_port(ds, j); | |
| 71 | + if (dsa_port_bridge_same(other_dp, third_dp)) | |
| 72 | + val |= BIT(j); | |
| 73 | + } | |
| 74 | + | |
| 55 | 75 | dev->dev_ops->cfg_port_member(dev, i, val | cpu_port); |
| 56 | 76 | } |
| 57 | 77 | |
| @@ -2284,6 +2284,13 @@ static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, · 2283 unmodified lines | ||
| 2284 | 2284 | if (!mv88e6xxx_max_vid(chip)) |
| 2285 | 2285 | return -EOPNOTSUPP; |
| 2286 | 2286 | |
| 2287 | + /* The ATU removal procedure needs the FID to be mapped in the VTU, | |
| 2288 | + * but FDB deletion runs concurrently with VLAN deletion. Flush the DSA | |
| 2289 | + * switchdev workqueue to ensure that all FDB entries are deleted | |
| 2290 | + * before we remove the VLAN. | |
| 2291 | + */ | |
| 2292 | + dsa_flush_workqueue(); | |
| 2293 | + | |
| 2287 | 2294 | mv88e6xxx_reg_lock(chip); |
| 2288 | 2295 | |
| 2289 | 2296 | err = mv88e6xxx_port_get_pvid(chip, port, &pvid); |
| @@ -900,7 +900,7 @@ static void atl1c_clean_tx_ring(struct atl1c_adapter *adapter, · 899 unmodified lines | ||
| 900 | 900 | atl1c_clean_buffer(pdev, buffer_info); |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | − netdev_reset_queue(adapter->netdev); | |
| 903 | + netdev_tx_reset_queue(netdev_get_tx_queue(adapter->netdev, queue)); | |
| 904 | 904 | |
| 905 | 905 | /* Zero out Tx-buffers */ |
| 906 | 906 | memset(tpd_ring->desc, 0, sizeof(struct atl1c_tpd_desc) * |
| @@ -172,6 +172,7 @@ static int bgmac_probe(struct platform_device *pdev) · 171 unmodified lines | ||
| 172 | 172 | { |
| 173 | 173 | struct device_node *np = pdev->dev.of_node; |
| 174 | 174 | struct bgmac *bgmac; |
| 175 | + struct resource *regs; | |
| 175 | 176 | int ret; |
| 176 | 177 | |
| 177 | 178 | bgmac = bgmac_alloc(&pdev->dev); |
| @@ -208,15 +209,23 @@ static int bgmac_probe(struct platform_device *pdev) · 30 unmodified lines | ||
| 208 | 209 | if (IS_ERR(bgmac->plat.base)) |
| 209 | 210 | return PTR_ERR(bgmac->plat.base); |
| 210 | 211 | |
| 211 | − bgmac->plat.idm_base = devm_platform_ioremap_resource_byname(pdev, "idm_base"); | |
| 212 | − if (IS_ERR(bgmac->plat.idm_base)) | |
| 213 | − return PTR_ERR(bgmac->plat.idm_base); | |
| 214 | − else | |
| 212 | + /* The idm_base resource is optional for some platforms */ | |
| 213 | + regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base"); | |
| 214 | + if (regs) { | |
| 215 | + bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs); | |
| 216 | + if (IS_ERR(bgmac->plat.idm_base)) | |
| 217 | + return PTR_ERR(bgmac->plat.idm_base); | |
| 215 | 218 | bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK; |
| 219 | + } | |
| 216 | 220 | |
| 217 | − bgmac->plat.nicpm_base = devm_platform_ioremap_resource_byname(pdev, "nicpm_base"); | |
| 218 | − if (IS_ERR(bgmac->plat.nicpm_base)) | |
| 219 | − return PTR_ERR(bgmac->plat.nicpm_base); | |
| 221 | + /* The nicpm_base resource is optional for some platforms */ | |
| 222 | + regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base"); | |
| 223 | + if (regs) { | |
| 224 | + bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev, | |
| 225 | + regs); | |
| 226 | + if (IS_ERR(bgmac->plat.nicpm_base)) | |
| 227 | + return PTR_ERR(bgmac->plat.nicpm_base); | |
| 228 | + } | |
| 220 | 229 | |
| 221 | 230 | bgmac->read = platform_bgmac_read; |
| 222 | 231 | bgmac->write = platform_bgmac_write; |
| @@ -100,6 +100,9 @@ MODULE_LICENSE("GPL"); · 99 unmodified lines | ||
| 100 | 100 | MODULE_FIRMWARE(FW_FILE_NAME_E1); |
| 101 | 101 | MODULE_FIRMWARE(FW_FILE_NAME_E1H); |
| 102 | 102 | MODULE_FIRMWARE(FW_FILE_NAME_E2); |
| 103 | +MODULE_FIRMWARE(FW_FILE_NAME_E1_V15); | |
| 104 | +MODULE_FIRMWARE(FW_FILE_NAME_E1H_V15); | |
| 105 | +MODULE_FIRMWARE(FW_FILE_NAME_E2_V15); | |
| 103 | 106 | |
| 104 | 107 | int bnx2x_num_queues; |
| 105 | 108 | module_param_named(num_queues, bnx2x_num_queues, int, 0444); |
| @@ -4747,8 +4747,10 @@ static int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, u16 vnic_id) · 4746 unmodified lines | ||
| 4747 | 4747 | return rc; |
| 4748 | 4748 | |
| 4749 | 4749 | req->vnic_id = cpu_to_le32(vnic->fw_vnic_id); |
| 4750 | − req->num_mc_entries = cpu_to_le32(vnic->mc_list_count); | |
| 4751 | − req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping); | |
| 4750 | + if (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST) { | |
| 4751 | + req->num_mc_entries = cpu_to_le32(vnic->mc_list_count); | |
| 4752 | + req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping); | |
| 4753 | + } | |
| 4752 | 4754 | req->mask = cpu_to_le32(vnic->rx_mask); |
| 4753 | 4755 | return hwrm_req_send_silent(bp, req); |
| 4754 | 4756 | } |
| @@ -7787,6 +7789,19 @@ static int bnxt_map_fw_health_regs(struct bnxt *bp) · 3032 unmodified lines | ||
| 7787 | 7789 | return 0; |
| 7788 | 7790 | } |
| 7789 | 7791 | |
| 7792 | +static void bnxt_remap_fw_health_regs(struct bnxt *bp) | |
| 7793 | +{ | |
| 7794 | + if (!bp->fw_health) | |
| 7795 | + return; | |
| 7796 | + | |
| 7797 | + if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) { | |
| 7798 | + bp->fw_health->status_reliable = true; | |
| 7799 | + bp->fw_health->resets_reliable = true; | |
| 7800 | + } else { | |
| 7801 | + bnxt_try_map_fw_health_reg(bp); | |
| 7802 | + } | |
| 7803 | +} | |
| 7804 | + | |
| 7790 | 7805 | static int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp) |
| 7791 | 7806 | { |
| 7792 | 7807 | struct bnxt_fw_health *fw_health = bp->fw_health; |
| @@ -8639,6 +8654,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) · 846 unmodified lines | ||
| 8639 | 8654 | vnic->uc_filter_count = 1; |
| 8640 | 8655 | |
| 8641 | 8656 | vnic->rx_mask = 0; |
| 8657 | + if (test_bit(BNXT_STATE_HALF_OPEN, &bp->state)) | |
| 8658 | + goto skip_rx_mask; | |
| 8659 | + | |
| 8642 | 8660 | if (bp->dev->flags & IFF_BROADCAST) |
| 8643 | 8661 | vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_BCAST; |
| 8644 | 8662 | |
| @@ -8648,7 +8666,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) · 3 unmodified lines | ||
| 8648 | 8666 | if (bp->dev->flags & IFF_ALLMULTI) { |
| 8649 | 8667 | vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; |
| 8650 | 8668 | vnic->mc_list_count = 0; |
| 8651 | − } else { | |
| 8669 | + } else if (bp->dev->flags & IFF_MULTICAST) { | |
| 8652 | 8670 | u32 mask = 0; |
| 8653 | 8671 | |
| 8654 | 8672 | bnxt_mc_list_updated(bp, &mask); |
| @@ -8659,6 +8677,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) · 4 unmodified lines | ||
| 8659 | 8677 | if (rc) |
| 8660 | 8678 | goto err_out; |
| 8661 | 8679 | |
| 8680 | +skip_rx_mask: | |
| 8662 | 8681 | rc = bnxt_hwrm_set_coal(bp); |
| 8663 | 8682 | if (rc) |
| 8664 | 8683 | netdev_warn(bp->dev, "HWRM set coalescing failure rc: %x\n", |
| @@ -9850,8 +9869,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) · 1185 unmodified lines | ||
| 9850 | 9869 | resc_reinit = true; |
| 9851 | 9870 | if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE) |
| 9852 | 9871 | fw_reset = true; |
| 9853 | − else if (bp->fw_health && !bp->fw_health->status_reliable) | |
| 9854 | − bnxt_try_map_fw_health_reg(bp); | |
| 9872 | + else | |
| 9873 | + bnxt_remap_fw_health_regs(bp); | |
| 9855 | 9874 | |
| 9856 | 9875 | if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) { |
| 9857 | 9876 | netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n"); |
| @@ -10330,13 +10349,15 @@ int bnxt_half_open_nic(struct bnxt *bp) · 472 unmodified lines | ||
| 10330 | 10349 | goto half_open_err; |
| 10331 | 10350 | } |
| 10332 | 10351 | |
| 10333 | − rc = bnxt_alloc_mem(bp, false); | |
| 10352 | + rc = bnxt_alloc_mem(bp, true); | |
| 10334 | 10353 | if (rc) { |
| 10335 | 10354 | netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); |
| 10336 | 10355 | goto half_open_err; |
| 10337 | 10356 | } |
| 10338 | − rc = bnxt_init_nic(bp, false); | |
| 10357 | + set_bit(BNXT_STATE_HALF_OPEN, &bp->state); | |
| 10358 | + rc = bnxt_init_nic(bp, true); | |
| 10339 | 10359 | if (rc) { |
| 10360 | + clear_bit(BNXT_STATE_HALF_OPEN, &bp->state); | |
| 10340 | 10361 | netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); |
| 10341 | 10362 | goto half_open_err; |
| 10342 | 10363 | } |
| @@ -10344,7 +10365,7 @@ int bnxt_half_open_nic(struct bnxt *bp) · 1 unmodified line | ||
| 10344 | 10365 | |
| 10345 | 10366 | half_open_err: |
| 10346 | 10367 | bnxt_free_skbs(bp); |
| 10347 | − bnxt_free_mem(bp, false); | |
| 10368 | + bnxt_free_mem(bp, true); | |
| 10348 | 10369 | dev_close(bp->dev); |
| 10349 | 10370 | return rc; |
| 10350 | 10371 | } |
| @@ -10354,9 +10375,10 @@ half_open_err: · 3 unmodified lines | ||
| 10354 | 10375 | */ |
| 10355 | 10376 | void bnxt_half_close_nic(struct bnxt *bp) |
| 10356 | 10377 | { |
| 10357 | − bnxt_hwrm_resource_free(bp, false, false); | |
| 10378 | + bnxt_hwrm_resource_free(bp, false, true); | |
| 10358 | 10379 | bnxt_free_skbs(bp); |
| 10359 | − bnxt_free_mem(bp, false); | |
| 10380 | + bnxt_free_mem(bp, true); | |
| 10381 | + clear_bit(BNXT_STATE_HALF_OPEN, &bp->state); | |
| 10360 | 10382 | } |
| 10361 | 10383 | |
| 10362 | 10384 | void bnxt_reenable_sriov(struct bnxt *bp) |
| @@ -10772,7 +10794,7 @@ static void bnxt_set_rx_mode(struct net_device *dev) · 409 unmodified lines | ||
| 10772 | 10794 | if (dev->flags & IFF_ALLMULTI) { |
| 10773 | 10795 | mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; |
| 10774 | 10796 | vnic->mc_list_count = 0; |
| 10775 | − } else { | |
| 10797 | + } else if (dev->flags & IFF_MULTICAST) { | |
| 10776 | 10798 | mc_update = bnxt_mc_list_updated(bp, &mask); |
| 10777 | 10799 | } |
| 10778 | 10800 | |
| @@ -10849,9 +10871,10 @@ skip_uc: · 70 unmodified lines | ||
| 10849 | 10871 | !bnxt_promisc_ok(bp)) |
| 10850 | 10872 | vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS; |
| 10851 | 10873 | rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); |
| 10852 | − if (rc && vnic->mc_list_count) { | |
| 10874 | + if (rc && (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST)) { | |
| 10853 | 10875 | netdev_info(bp->dev, "Failed setting MC filters rc: %d, turning on ALL_MCAST mode\n", |
| 10854 | 10876 | rc); |
| 10877 | + vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_MCAST; | |
| 10855 | 10878 | vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; |
| 10856 | 10879 | vnic->mc_list_count = 0; |
| 10857 | 10880 | rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); |
| @@ -1921,6 +1921,7 @@ struct bnxt { · 1920 unmodified lines | ||
| 1921 | 1921 | #define BNXT_STATE_RECOVER 12 |
| 1922 | 1922 | #define BNXT_STATE_FW_NON_FATAL_COND 13 |
| 1923 | 1923 | #define BNXT_STATE_FW_ACTIVATE_RESET 14 |
| 1924 | +#define BNXT_STATE_HALF_OPEN 15 /* For offline ethtool tests */ | |
| 1924 | 1925 | |
| 1925 | 1926 | #define BNXT_NO_FW_ACCESS(bp) \ |
| 1926 | 1927 | (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \ |
| @@ -367,6 +367,16 @@ bnxt_dl_livepatch_report_err(struct bnxt *bp, struct netlink_ext_ack *extack, · 366 unmodified lines | ||
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | +/* Live patch status in NVM */ | |
| 371 | +#define BNXT_LIVEPATCH_NOT_INSTALLED 0 | |
| 372 | +#define BNXT_LIVEPATCH_INSTALLED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL | |
| 373 | +#define BNXT_LIVEPATCH_REMOVED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE | |
| 374 | +#define BNXT_LIVEPATCH_MASK (FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL | \ | |
| 375 | + FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE) | |
| 376 | +#define BNXT_LIVEPATCH_ACTIVATED BNXT_LIVEPATCH_MASK | |
| 377 | + | |
| 378 | +#define BNXT_LIVEPATCH_STATE(flags) ((flags) & BNXT_LIVEPATCH_MASK) | |
| 379 | + | |
| 370 | 380 | static int |
| 371 | 381 | bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) |
| 372 | 382 | { |
| @@ -374,8 +384,9 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 1 unmodified line | ||
| 374 | 384 | struct hwrm_fw_livepatch_query_input *query_req; |
| 375 | 385 | struct hwrm_fw_livepatch_output *patch_resp; |
| 376 | 386 | struct hwrm_fw_livepatch_input *patch_req; |
| 387 | + u16 flags, live_patch_state; | |
| 388 | + bool activated = false; | |
| 377 | 389 | u32 installed = 0; |
| 378 | − u16 flags; | |
| 379 | 390 | u8 target; |
| 380 | 391 | int rc; |
| 381 | 392 | |
| @@ -394,7 +405,6 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 12 unmodified lines | ||
| 394 | 405 | hwrm_req_drop(bp, query_req); |
| 395 | 406 | return rc; |
| 396 | 407 | } |
| 397 | − patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE; | |
| 398 | 408 | patch_req->loadtype = FW_LIVEPATCH_REQ_LOADTYPE_NVM_INSTALL; |
| 399 | 409 | patch_resp = hwrm_req_hold(bp, patch_req); |
| 400 | 410 | |
| @@ -407,12 +417,20 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 6 unmodified lines | ||
| 407 | 417 | } |
| 408 | 418 | |
| 409 | 419 | flags = le16_to_cpu(query_resp->status_flags); |
| 410 | − if (~flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL) | |
| 420 | + live_patch_state = BNXT_LIVEPATCH_STATE(flags); | |
| 421 | + | |
| 422 | + if (live_patch_state == BNXT_LIVEPATCH_NOT_INSTALLED) | |
| 411 | 423 | continue; |
| 412 | − if ((flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE) && | |
| 413 | − !strncmp(query_resp->active_ver, query_resp->install_ver, | |
| 414 | − sizeof(query_resp->active_ver))) | |
| 424 | + | |
| 425 | + if (live_patch_state == BNXT_LIVEPATCH_ACTIVATED) { | |
| 426 | + activated = true; | |
| 415 | 427 | continue; |
| 428 | + } | |
| 429 | + | |
| 430 | + if (live_patch_state == BNXT_LIVEPATCH_INSTALLED) | |
| 431 | + patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE; | |
| 432 | + else if (live_patch_state == BNXT_LIVEPATCH_REMOVED) | |
| 433 | + patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_DEACTIVATE; | |
| 416 | 434 | |
| 417 | 435 | patch_req->fw_target = target; |
| 418 | 436 | rc = hwrm_req_send(bp, patch_req); |
| @@ -424,8 +442,13 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 5 unmodified lines | ||
| 424 | 442 | } |
| 425 | 443 | |
| 426 | 444 | if (!rc && !installed) { |
| 427 | − NL_SET_ERR_MSG_MOD(extack, "No live patches found"); | |
| 428 | − rc = -ENOENT; | |
| 445 | + if (activated) { | |
| 446 | + NL_SET_ERR_MSG_MOD(extack, "Live patch already activated"); | |
| 447 | + rc = -EEXIST; | |
| 448 | + } else { | |
| 449 | + NL_SET_ERR_MSG_MOD(extack, "No live patches found"); | |
| 450 | + rc = -ENOENT; | |
| 451 | + } | |
| 429 | 452 | } |
| 430 | 453 | hwrm_req_drop(bp, query_req); |
| 431 | 454 | hwrm_req_drop(bp, patch_req); |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "bnxt_hsi.h" |
| 26 | 26 | #include "bnxt.h" |
| 27 | 27 | #include "bnxt_hwrm.h" |
| 28 | +#include "bnxt_ulp.h" | |
| 28 | 29 | #include "bnxt_xdp.h" |
| 29 | 30 | #include "bnxt_ptp.h" |
| 30 | 31 | #include "bnxt_ethtool.h" |
| @@ -1969,6 +1970,9 @@ static int bnxt_get_fecparam(struct net_device *dev, · 1938 unmodified lines | ||
| 1969 | 1970 | case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_RS272_IEEE_ACTIVE: |
| 1970 | 1971 | fec->active_fec |= ETHTOOL_FEC_LLRS; |
| 1971 | 1972 | break; |
| 1973 | + case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_NONE_ACTIVE: | |
| 1974 | + fec->active_fec |= ETHTOOL_FEC_OFF; | |
| 1975 | + break; | |
| 1972 | 1976 | } |
| 1973 | 1977 | return 0; |
| 1974 | 1978 | } |
| @@ -3454,7 +3458,7 @@ static int bnxt_run_loopback(struct bnxt *bp) · 1479 unmodified lines | ||
| 3454 | 3458 | if (!skb) |
| 3455 | 3459 | return -ENOMEM; |
| 3456 | 3460 | data = skb_put(skb, pkt_size); |
| 3457 | − eth_broadcast_addr(data); | |
| 3461 | + ether_addr_copy(&data[i], bp->dev->dev_addr); | |
| 3458 | 3462 | i += ETH_ALEN; |
| 3459 | 3463 | ether_addr_copy(&data[i], bp->dev->dev_addr); |
| 3460 | 3464 | i += ETH_ALEN; |
| @@ -3548,9 +3552,12 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, · 87 unmodified lines | ||
| 3548 | 3552 | if (!offline) { |
| 3549 | 3553 | bnxt_run_fw_tests(bp, test_mask, &test_results); |
| 3550 | 3554 | } else { |
| 3551 | − rc = bnxt_close_nic(bp, false, false); | |
| 3552 | − if (rc) | |
| 3555 | + bnxt_ulp_stop(bp); | |
| 3556 | + rc = bnxt_close_nic(bp, true, false); | |
| 3557 | + if (rc) { | |
| 3558 | + bnxt_ulp_start(bp, rc); | |
| 3553 | 3559 | return; |
| 3560 | + } | |
| 3554 | 3561 | bnxt_run_fw_tests(bp, test_mask, &test_results); |
| 3555 | 3562 | |
| 3556 | 3563 | buf[BNXT_MACLPBK_TEST_IDX] = 1; |
| @@ -3560,6 +3567,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, · 3 unmodified lines | ||
| 3560 | 3567 | if (rc) { |
| 3561 | 3568 | bnxt_hwrm_mac_loopback(bp, false); |
| 3562 | 3569 | etest->flags |= ETH_TEST_FL_FAILED; |
| 3570 | + bnxt_ulp_start(bp, rc); | |
| 3563 | 3571 | return; |
| 3564 | 3572 | } |
| 3565 | 3573 | if (bnxt_run_loopback(bp)) |
| @@ -3585,7 +3593,8 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, · 19 unmodified lines | ||
| 3585 | 3593 | } |
| 3586 | 3594 | bnxt_hwrm_phy_loopback(bp, false, false); |
| 3587 | 3595 | bnxt_half_close_nic(bp); |
| 3588 | − rc = bnxt_open_nic(bp, false, true); | |
| 3596 | + rc = bnxt_open_nic(bp, true, true); | |
| 3597 | + bnxt_ulp_start(bp, rc); | |
| 3589 | 3598 | } |
| 3590 | 3599 | if (rc || bnxt_test_irq(bp)) { |
| 3591 | 3600 | buf[BNXT_IRQ_TEST_IDX] = 1; |
| @@ -644,17 +644,23 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) · 643 unmodified lines | ||
| 644 | 644 | |
| 645 | 645 | /* Last byte of resp contains valid bit */ |
| 646 | 646 | valid = ((u8 *)ctx->resp) + len - 1; |
| 647 | − for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) { | |
| 647 | + for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; ) { | |
| 648 | 648 | /* make sure we read from updated DMA memory */ |
| 649 | 649 | dma_rmb(); |
| 650 | 650 | if (*valid) |
| 651 | 651 | break; |
| 652 | − usleep_range(1, 5); | |
| 652 | + if (j < 10) { | |
| 653 | + udelay(1); | |
| 654 | + j++; | |
| 655 | + } else { | |
| 656 | + usleep_range(20, 30); | |
| 657 | + j += 20; | |
| 658 | + } | |
| 653 | 659 | } |
| 654 | 660 | |
| 655 | 661 | if (j >= HWRM_VALID_BIT_DELAY_USEC) { |
| 656 | 662 | hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n", |
| 657 | − hwrm_total_timeout(i), req_type, | |
| 663 | + hwrm_total_timeout(i) + j, req_type, | |
| 658 | 664 | le16_to_cpu(ctx->req->seq_id), len, *valid); |
| 659 | 665 | goto exit; |
| 660 | 666 | } |
| @@ -90,7 +90,7 @@ static inline unsigned int hwrm_total_timeout(unsigned int n) · 89 unmodified lines | ||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | −#define HWRM_VALID_BIT_DELAY_USEC 150 | |
| 93 | +#define HWRM_VALID_BIT_DELAY_USEC 50000 | |
| 94 | 94 | |
| 95 | 95 | static inline bool bnxt_cfa_hwrm_message(u16 req_type) |
| 96 | 96 | { |
| @@ -989,117 +989,6 @@ static int ftgmac100_alloc_rx_buffers(struct ftgmac100 *priv) · 988 unmodified lines | ||
| 989 | 989 | return 0; |
| 990 | 990 | } |
| 991 | 991 | |
| 992 | −static void ftgmac100_adjust_link(struct net_device *netdev) | |
| 993 | −{ | |
| 994 | − struct ftgmac100 *priv = netdev_priv(netdev); | |
| 995 | − struct phy_device *phydev = netdev->phydev; | |
| 996 | − bool tx_pause, rx_pause; | |
| 997 | − int new_speed; | |
| 998 | − | |
| 999 | − /* We store "no link" as speed 0 */ | |
| 1000 | − if (!phydev->link) | |
| 1001 | − new_speed = 0; | |
| 1002 | − else | |
| 1003 | − new_speed = phydev->speed; | |
| 1004 | − | |
| 1005 | − /* Grab pause settings from PHY if configured to do so */ | |
| 1006 | − if (priv->aneg_pause) { | |
| 1007 | − rx_pause = tx_pause = phydev->pause; | |
| 1008 | − if (phydev->asym_pause) | |
| 1009 | − tx_pause = !rx_pause; | |
| 1010 | − } else { | |
| 1011 | − rx_pause = priv->rx_pause; | |
| 1012 | − tx_pause = priv->tx_pause; | |
| 1013 | − } | |
| 1014 | − | |
| 1015 | − /* Link hasn't changed, do nothing */ | |
| 1016 | − if (phydev->speed == priv->cur_speed && | |
| 1017 | − phydev->duplex == priv->cur_duplex && | |
| 1018 | − rx_pause == priv->rx_pause && | |
| 1019 | − tx_pause == priv->tx_pause) | |
| 1020 | − return; | |
| 1021 | − | |
| 1022 | − /* Print status if we have a link or we had one and just lost it, | |
| 1023 | − * don't print otherwise. | |
| 1024 | − */ | |
| 1025 | − if (new_speed || priv->cur_speed) | |
| 1026 | − phy_print_status(phydev); | |
| 1027 | − | |
| 1028 | − priv->cur_speed = new_speed; | |
| 1029 | − priv->cur_duplex = phydev->duplex; | |
| 1030 | − priv->rx_pause = rx_pause; | |
| 1031 | − priv->tx_pause = tx_pause; | |
| 1032 | − | |
| 1033 | − /* Link is down, do nothing else */ | |
| 1034 | − if (!new_speed) | |
| 1035 | − return; | |
| 1036 | − | |
| 1037 | − /* Disable all interrupts */ | |
| 1038 | − iowrite32(0, priv->base + FTGMAC100_OFFSET_IER); | |
| 1039 | − | |
| 1040 | − /* Reset the adapter asynchronously */ | |
| 1041 | − schedule_work(&priv->reset_task); | |
| 1042 | −} | |
| 1043 | − | |
| 1044 | −static int ftgmac100_mii_probe(struct net_device *netdev) | |
| 1045 | −{ | |
| 1046 | − struct ftgmac100 *priv = netdev_priv(netdev); | |
| 1047 | − struct platform_device *pdev = to_platform_device(priv->dev); | |
| 1048 | − struct device_node *np = pdev->dev.of_node; | |
| 1049 | − struct phy_device *phydev; | |
| 1050 | − phy_interface_t phy_intf; | |
| 1051 | − int err; | |
| 1052 | − | |
| 1053 | − /* Default to RGMII. It's a gigabit part after all */ | |
| 1054 | − err = of_get_phy_mode(np, &phy_intf); | |
| 1055 | − if (err) | |
| 1056 | − phy_intf = PHY_INTERFACE_MODE_RGMII; | |
| 1057 | − | |
| 1058 | − /* Aspeed only supports these. I don't know about other IP | |
| 1059 | − * block vendors so I'm going to just let them through for | |
| 1060 | − * now. Note that this is only a warning if for some obscure | |
| 1061 | − * reason the DT really means to lie about it or it's a newer | |
| 1062 | − * part we don't know about. | |
| 1063 | − * | |
| 1064 | − * On the Aspeed SoC there are additionally straps and SCU | |
| 1065 | − * control bits that could tell us what the interface is | |
| 1066 | − * (or allow us to configure it while the IP block is held | |
| 1067 | − * in reset). For now I chose to keep this driver away from | |
| 1068 | − * those SoC specific bits and assume the device-tree is | |
| 1069 | − * right and the SCU has been configured properly by pinmux | |
| 1070 | − * or the firmware. | |
| 1071 | − */ | |
| 1072 | − if (priv->is_aspeed && !(phy_interface_mode_is_rgmii(phy_intf))) { | |
| 1073 | − netdev_warn(netdev, | |
| 1074 | − "Unsupported PHY mode %s !\n", | |
| 1075 | − phy_modes(phy_intf)); | |
| 1076 | − } | |
| 1077 | − | |
| 1078 | − phydev = phy_find_first(priv->mii_bus); | |
| 1079 | − if (!phydev) { | |
| 1080 | − netdev_info(netdev, "%s: no PHY found\n", netdev->name); | |
| 1081 | − return -ENODEV; | |
| 1082 | − } | |
| 1083 | − | |
| 1084 | − phydev = phy_connect(netdev, phydev_name(phydev), | |
| 1085 | − &ftgmac100_adjust_link, phy_intf); | |
| 1086 | − | |
| 1087 | − if (IS_ERR(phydev)) { | |
| 1088 | − netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name); | |
| 1089 | − return PTR_ERR(phydev); | |
| 1090 | − } | |
| 1091 | − | |
| 1092 | − /* Indicate that we support PAUSE frames (see comment in | |
| 1093 | − * Documentation/networking/phy.rst) | |
| 1094 | − */ | |
| 1095 | − phy_support_asym_pause(phydev); | |
| 1096 | − | |
| 1097 | − /* Display what we found */ | |
| 1098 | − phy_attached_info(phydev); | |
| 1099 | − | |
| 1100 | − return 0; | |
| 1101 | −} | |
| 1102 | − | |
| 1103 | 992 | static int ftgmac100_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) |
| 1104 | 993 | { |
| 1105 | 994 | struct net_device *netdev = bus->priv; |
| @@ -1410,10 +1299,8 @@ static int ftgmac100_init_all(struct ftgmac100 *priv, bool ignore_alloc_err) · 304 unmodified lines | ||
| 1410 | 1299 | return err; |
| 1411 | 1300 | } |
| 1412 | 1301 | |
| 1413 | −static void ftgmac100_reset_task(struct work_struct *work) | |
| 1302 | +static void ftgmac100_reset(struct ftgmac100 *priv) | |
| 1414 | 1303 | { |
| 1415 | − struct ftgmac100 *priv = container_of(work, struct ftgmac100, | |
| 1416 | − reset_task); | |
| 1417 | 1304 | struct net_device *netdev = priv->netdev; |
| 1418 | 1305 | int err; |
| 1419 | 1306 | |
| @@ -1459,6 +1346,134 @@ static void ftgmac100_reset_task(struct work_struct *work) · 39 unmodified lines | ||
| 1459 | 1346 | rtnl_unlock(); |
| 1460 | 1347 | } |
| 1461 | 1348 | |
| 1349 | +static void ftgmac100_reset_task(struct work_struct *work) | |
| 1350 | +{ | |
| 1351 | + struct ftgmac100 *priv = container_of(work, struct ftgmac100, | |
| 1352 | + reset_task); | |
| 1353 | + | |
| 1354 | + ftgmac100_reset(priv); | |
| 1355 | +} | |
| 1356 | + | |
| 1357 | +static void ftgmac100_adjust_link(struct net_device *netdev) | |
| 1358 | +{ | |
| 1359 | + struct ftgmac100 *priv = netdev_priv(netdev); | |
| 1360 | + struct phy_device *phydev = netdev->phydev; | |
| 1361 | + bool tx_pause, rx_pause; | |
| 1362 | + int new_speed; | |
| 1363 | + | |
| 1364 | + /* We store "no link" as speed 0 */ | |
| 1365 | + if (!phydev->link) | |
| 1366 | + new_speed = 0; | |
| 1367 | + else | |
| 1368 | + new_speed = phydev->speed; | |
| 1369 | + | |
| 1370 | + /* Grab pause settings from PHY if configured to do so */ | |
| 1371 | + if (priv->aneg_pause) { | |
| 1372 | + rx_pause = tx_pause = phydev->pause; | |
| 1373 | + if (phydev->asym_pause) | |
| 1374 | + tx_pause = !rx_pause; | |
| 1375 | + } else { | |
| 1376 | + rx_pause = priv->rx_pause; | |
| 1377 | + tx_pause = priv->tx_pause; | |
| 1378 | + } | |
| 1379 | + | |
| 1380 | + /* Link hasn't changed, do nothing */ | |
| 1381 | + if (phydev->speed == priv->cur_speed && | |
| 1382 | + phydev->duplex == priv->cur_duplex && | |
| 1383 | + rx_pause == priv->rx_pause && | |
| 1384 | + tx_pause == priv->tx_pause) | |
| 1385 | + return; | |
| 1386 | + | |
| 1387 | + /* Print status if we have a link or we had one and just lost it, | |
| 1388 | + * don't print otherwise. | |
| 1389 | + */ | |
| 1390 | + if (new_speed || priv->cur_speed) | |
| 1391 | + phy_print_status(phydev); | |
| 1392 | + | |
| 1393 | + priv->cur_speed = new_speed; | |
| 1394 | + priv->cur_duplex = phydev->duplex; | |
| 1395 | + priv->rx_pause = rx_pause; | |
| 1396 | + priv->tx_pause = tx_pause; | |
| 1397 | + | |
| 1398 | + /* Link is down, do nothing else */ | |
| 1399 | + if (!new_speed) | |
| 1400 | + return; | |
| 1401 | + | |
| 1402 | + /* Disable all interrupts */ | |
| 1403 | + iowrite32(0, priv->base + FTGMAC100_OFFSET_IER); | |
| 1404 | + | |
| 1405 | + /* Release phy lock to allow ftgmac100_reset to aquire it, keeping lock | |
| 1406 | + * order consistent to prevent dead lock. | |
| 1407 | + */ | |
| 1408 | + if (netdev->phydev) | |
| 1409 | + mutex_unlock(&netdev->phydev->lock); | |
| 1410 | + | |
| 1411 | + ftgmac100_reset(priv); | |
| 1412 | + | |
| 1413 | + if (netdev->phydev) | |
| 1414 | + mutex_lock(&netdev->phydev->lock); | |
| 1415 | + | |
| 1416 | +} | |
| 1417 | + | |
| 1418 | +static int ftgmac100_mii_probe(struct net_device *netdev) | |
| 1419 | +{ | |
| 1420 | + struct ftgmac100 *priv = netdev_priv(netdev); | |
| 1421 | + struct platform_device *pdev = to_platform_device(priv->dev); | |
| 1422 | + struct device_node *np = pdev->dev.of_node; | |
| 1423 | + struct phy_device *phydev; | |
| 1424 | + phy_interface_t phy_intf; | |
| 1425 | + int err; | |
| 1426 | + | |
| 1427 | + /* Default to RGMII. It's a gigabit part after all */ | |
| 1428 | + err = of_get_phy_mode(np, &phy_intf); | |
| 1429 | + if (err) | |
| 1430 | + phy_intf = PHY_INTERFACE_MODE_RGMII; | |
| 1431 | + | |
| 1432 | + /* Aspeed only supports these. I don't know about other IP | |
| 1433 | + * block vendors so I'm going to just let them through for | |
| 1434 | + * now. Note that this is only a warning if for some obscure | |
| 1435 | + * reason the DT really means to lie about it or it's a newer | |
| 1436 | + * part we don't know about. | |
| 1437 | + * | |
| 1438 | + * On the Aspeed SoC there are additionally straps and SCU | |
| 1439 | + * control bits that could tell us what the interface is | |
| 1440 | + * (or allow us to configure it while the IP block is held | |
| 1441 | + * in reset). For now I chose to keep this driver away from | |
| 1442 | + * those SoC specific bits and assume the device-tree is | |
| 1443 | + * right and the SCU has been configured properly by pinmux | |
| 1444 | + * or the firmware. | |
| 1445 | + */ | |
| 1446 | + if (priv->is_aspeed && !(phy_interface_mode_is_rgmii(phy_intf))) { | |
| 1447 | + netdev_warn(netdev, | |
| 1448 | + "Unsupported PHY mode %s !\n", | |
| 1449 | + phy_modes(phy_intf)); | |
| 1450 | + } | |
| 1451 | + | |
| 1452 | + phydev = phy_find_first(priv->mii_bus); | |
| 1453 | + if (!phydev) { | |
| 1454 | + netdev_info(netdev, "%s: no PHY found\n", netdev->name); | |
| 1455 | + return -ENODEV; | |
| 1456 | + } | |
| 1457 | + | |
| 1458 | + phydev = phy_connect(netdev, phydev_name(phydev), | |
| 1459 | + &ftgmac100_adjust_link, phy_intf); | |
| 1460 | + | |
| 1461 | + if (IS_ERR(phydev)) { | |
| 1462 | + netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name); | |
| 1463 | + return PTR_ERR(phydev); | |
| 1464 | + } | |
| 1465 | + | |
| 1466 | + /* Indicate that we support PAUSE frames (see comment in | |
| 1467 | + * Documentation/networking/phy.rst) | |
| 1468 | + */ | |
| 1469 | + phy_support_asym_pause(phydev); | |
| 1470 | + | |
| 1471 | + /* Display what we found */ | |
| 1472 | + phy_attached_info(phydev); | |
| 1473 | + | |
| 1474 | + return 0; | |
| 1475 | +} | |
| 1476 | + | |
| 1462 | 1477 | static int ftgmac100_open(struct net_device *netdev) |
| 1463 | 1478 | { |
| 1464 | 1479 | struct ftgmac100 *priv = netdev_priv(netdev); |
| @@ -4338,7 +4338,7 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) · 4337 unmodified lines | ||
| 4338 | 4338 | } |
| 4339 | 4339 | |
| 4340 | 4340 | INIT_WORK(&priv->tx_onestep_tstamp, dpaa2_eth_tx_onestep_tstamp); |
| 4341 | − | |
| 4341 | + mutex_init(&priv->onestep_tstamp_lock); | |
| 4342 | 4342 | skb_queue_head_init(&priv->tx_skbs); |
| 4343 | 4343 | |
| 4344 | 4344 | priv->rx_copybreak = DPAA2_ETH_DEFAULT_COPYBREAK; |
| @@ -532,6 +532,7 @@ static int dpaa2_switch_flower_parse_mirror_key(struct flow_cls_offload *cls, · 531 unmodified lines | ||
| 532 | 532 | struct flow_rule *rule = flow_cls_offload_flow_rule(cls); |
| 533 | 533 | struct flow_dissector *dissector = rule->match.dissector; |
| 534 | 534 | struct netlink_ext_ack *extack = cls->common.extack; |
| 535 | + int ret = -EOPNOTSUPP; | |
| 535 | 536 | |
| 536 | 537 | if (dissector->used_keys & |
| 537 | 538 | ~(BIT(FLOW_DISSECTOR_KEY_BASIC) | |
| @@ -561,9 +562,10 @@ static int dpaa2_switch_flower_parse_mirror_key(struct flow_cls_offload *cls, · 23 unmodified lines | ||
| 561 | 562 | } |
| 562 | 563 | |
| 563 | 564 | *vlan = (u16)match.key->vlan_id; |
| 565 | + ret = 0; | |
| 564 | 566 | } |
| 565 | 567 | |
| 566 | − return 0; | |
| 568 | + return ret; | |
| 567 | 569 | } |
| 568 | 570 | |
| 569 | 571 | static int |
| @@ -5917,10 +5917,14 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr, · 5916 unmodified lines | ||
| 5917 | 5917 | be64_to_cpu(session_token)); |
| 5918 | 5918 | rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address, |
| 5919 | 5919 | H_SESSION_ERR_DETECTED, session_token, 0, 0); |
| 5920 | − if (rc) | |
| 5920 | + if (rc) { | |
| 5921 | 5921 | netdev_err(netdev, |
| 5922 | 5922 | "H_VIOCTL initiated failover failed, rc %ld\n", |
| 5923 | 5923 | rc); |
| 5924 | + goto last_resort; | |
| 5925 | + } | |
| 5926 | + | |
| 5927 | + return count; | |
| 5924 | 5928 | |
| 5925 | 5929 | last_resort: |
| 5926 | 5930 | netdev_dbg(netdev, "Trying to send CRQ_CMD, the last resort\n"); |
| @@ -5372,15 +5372,7 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 5371 unmodified lines | ||
| 5372 | 5372 | /* There is no need to reset BW when mqprio mode is on. */ |
| 5373 | 5373 | if (pf->flags & I40E_FLAG_TC_MQPRIO) |
| 5374 | 5374 | return 0; |
| 5375 | − | |
| 5376 | − if (!vsi->mqprio_qopt.qopt.hw) { | |
| 5377 | − if (pf->flags & I40E_FLAG_DCB_ENABLED) | |
| 5378 | − goto skip_reset; | |
| 5379 | − | |
| 5380 | − if (IS_ENABLED(CONFIG_I40E_DCB) && | |
| 5381 | − i40e_dcb_hw_get_num_tc(&pf->hw) == 1) | |
| 5382 | − goto skip_reset; | |
| 5383 | − | |
| 5375 | + if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) { | |
| 5384 | 5376 | ret = i40e_set_bw_limit(vsi, vsi->seid, 0); |
| 5385 | 5377 | if (ret) |
| 5386 | 5378 | dev_info(&pf->pdev->dev, |
| @@ -5388,8 +5380,6 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 1 unmodified line | ||
| 5388 | 5380 | vsi->seid); |
| 5389 | 5381 | return ret; |
| 5390 | 5382 | } |
| 5391 | − | |
| 5392 | −skip_reset: | |
| 5393 | 5383 | memset(&bw_data, 0, sizeof(bw_data)); |
| 5394 | 5384 | bw_data.tc_valid_bits = enabled_tc; |
| 5395 | 5385 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) |
| @@ -280,7 +280,6 @@ enum ice_pf_state { · 279 unmodified lines | ||
| 280 | 280 | ICE_VFLR_EVENT_PENDING, |
| 281 | 281 | ICE_FLTR_OVERFLOW_PROMISC, |
| 282 | 282 | ICE_VF_DIS, |
| 283 | − ICE_VF_DEINIT_IN_PROGRESS, | |
| 284 | 283 | ICE_CFG_BUSY, |
| 285 | 284 | ICE_SERVICE_SCHED, |
| 286 | 285 | ICE_SERVICE_DIS, |
| @@ -3340,7 +3340,7 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, · 3339 unmodified lines | ||
| 3340 | 3340 | |
| 3341 | 3341 | if (fec == ICE_FEC_AUTO && ice_fw_supports_link_override(hw) && |
| 3342 | 3342 | !ice_fw_supports_report_dflt_cfg(hw)) { |
| 3343 | − struct ice_link_default_override_tlv tlv; | |
| 3343 | + struct ice_link_default_override_tlv tlv = { 0 }; | |
| 3344 | 3344 | |
| 3345 | 3345 | status = ice_get_link_default_override(&tlv, pi); |
| 3346 | 3346 | if (status) |
| @@ -44,6 +44,7 @@ ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf, const u8 *mac) · 43 unmodified lines | ||
| 44 | 44 | ctrl_vsi->rxq_map[vf->vf_id]; |
| 45 | 45 | rule_info.flags_info.act |= ICE_SINGLE_ACT_LB_ENABLE; |
| 46 | 46 | rule_info.flags_info.act_valid = true; |
| 47 | + rule_info.tun_type = ICE_SW_TUN_AND_NON_TUN; | |
| 47 | 48 | |
| 48 | 49 | err = ice_add_adv_rule(hw, list, lkups_cnt, &rule_info, |
| 49 | 50 | vf->repr->mac_rule); |
| @@ -1684,6 +1684,12 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) · 1683 unmodified lines | ||
| 1684 | 1684 | if (status) |
| 1685 | 1685 | dev_dbg(dev, "ice_add_rss_cfg failed for sctp6 flow, vsi = %d, error = %d\n", |
| 1686 | 1686 | vsi_num, status); |
| 1687 | + | |
| 1688 | + status = ice_add_rss_cfg(hw, vsi_handle, ICE_FLOW_HASH_ESP_SPI, | |
| 1689 | + ICE_FLOW_SEG_HDR_ESP); | |
| 1690 | + if (status) | |
| 1691 | + dev_dbg(dev, "ice_add_rss_cfg failed for esp/spi flow, vsi = %d, error = %d\n", | |
| 1692 | + vsi_num, status); | |
| 1687 | 1693 | } |
| 1688 | 1694 | |
| 1689 | 1695 | /** |
| @@ -1799,7 +1799,9 @@ static void ice_handle_mdd_event(struct ice_pf *pf) · 1798 unmodified lines | ||
| 1799 | 1799 | * reset, so print the event prior to reset. |
| 1800 | 1800 | */ |
| 1801 | 1801 | ice_print_vf_rx_mdd_event(vf); |
| 1802 | + mutex_lock(&pf->vf[i].cfg_lock); | |
| 1802 | 1803 | ice_reset_vf(&pf->vf[i], false); |
| 1804 | + mutex_unlock(&pf->vf[i].cfg_lock); | |
| 1803 | 1805 | } |
| 1804 | 1806 | } |
| 1805 | 1807 | } |
| @@ -47,6 +47,7 @@ enum ice_protocol_type { · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | enum ice_sw_tunnel_type { |
| 49 | 49 | ICE_NON_TUN = 0, |
| 50 | + ICE_SW_TUN_AND_NON_TUN, | |
| 50 | 51 | ICE_SW_TUN_VXLAN, |
| 51 | 52 | ICE_SW_TUN_GENEVE, |
| 52 | 53 | ICE_SW_TUN_NVGRE, |
| @@ -1533,9 +1533,12 @@ exit: · 1532 unmodified lines | ||
| 1533 | 1533 | static int ice_ptp_adjtime_nonatomic(struct ptp_clock_info *info, s64 delta) |
| 1534 | 1534 | { |
| 1535 | 1535 | struct timespec64 now, then; |
| 1536 | + int ret; | |
| 1536 | 1537 | |
| 1537 | 1538 | then = ns_to_timespec64(delta); |
| 1538 | − ice_ptp_gettimex64(info, &now, NULL); | |
| 1539 | + ret = ice_ptp_gettimex64(info, &now, NULL); | |
| 1540 | + if (ret) | |
| 1541 | + return ret; | |
| 1539 | 1542 | now = timespec64_add(now, then); |
| 1540 | 1543 | |
| 1541 | 1544 | return ice_ptp_settime64(info, (const struct timespec64 *)&now); |
| @@ -4537,6 +4537,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, · 4536 unmodified lines | ||
| 4537 | 4537 | case ICE_SW_TUN_NVGRE: |
| 4538 | 4538 | prof_type = ICE_PROF_TUN_GRE; |
| 4539 | 4539 | break; |
| 4540 | + case ICE_SW_TUN_AND_NON_TUN: | |
| 4540 | 4541 | default: |
| 4541 | 4542 | prof_type = ICE_PROF_ALL; |
| 4542 | 4543 | break; |
| @@ -5305,7 +5306,8 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 762 unmodified lines | ||
| 5305 | 5306 | if (status) |
| 5306 | 5307 | goto err_ice_add_adv_rule; |
| 5307 | 5308 | |
| 5308 | − if (rinfo->tun_type != ICE_NON_TUN) { | |
| 5309 | + if (rinfo->tun_type != ICE_NON_TUN && | |
| 5310 | + rinfo->tun_type != ICE_SW_TUN_AND_NON_TUN) { | |
| 5309 | 5311 | status = ice_fill_adv_packet_tun(hw, rinfo->tun_type, |
| 5310 | 5312 | s_rule->pdata.lkup_tx_rx.hdr, |
| 5311 | 5313 | pkt_offsets); |
| @@ -709,7 +709,7 @@ ice_tc_set_port(struct flow_match_ports match, · 708 unmodified lines | ||
| 709 | 709 | fltr->flags |= ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT; |
| 710 | 710 | else |
| 711 | 711 | fltr->flags |= ICE_TC_FLWR_FIELD_DEST_L4_PORT; |
| 712 | − fltr->flags |= ICE_TC_FLWR_FIELD_DEST_L4_PORT; | |
| 712 | + | |
| 713 | 713 | headers->l4_key.dst_port = match.key->dst; |
| 714 | 714 | headers->l4_mask.dst_port = match.mask->dst; |
| 715 | 715 | } |
| @@ -718,7 +718,7 @@ ice_tc_set_port(struct flow_match_ports match, · 2 unmodified lines | ||
| 718 | 718 | fltr->flags |= ICE_TC_FLWR_FIELD_ENC_SRC_L4_PORT; |
| 719 | 719 | else |
| 720 | 720 | fltr->flags |= ICE_TC_FLWR_FIELD_SRC_L4_PORT; |
| 721 | − fltr->flags |= ICE_TC_FLWR_FIELD_SRC_L4_PORT; | |
| 721 | + | |
| 722 | 722 | headers->l4_key.src_port = match.key->src; |
| 723 | 723 | headers->l4_mask.src_port = match.mask->src; |
| 724 | 724 | } |
| @@ -500,8 +500,6 @@ void ice_free_vfs(struct ice_pf *pf) · 499 unmodified lines | ||
| 500 | 500 | struct ice_hw *hw = &pf->hw; |
| 501 | 501 | unsigned int tmp, i; |
| 502 | 502 | |
| 503 | − set_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state); | |
| 504 | − | |
| 505 | 503 | if (!pf->vf) |
| 506 | 504 | return; |
| 507 | 505 | |
| @@ -519,22 +517,26 @@ void ice_free_vfs(struct ice_pf *pf) · 11 unmodified lines | ||
| 519 | 517 | else |
| 520 | 518 | dev_warn(dev, "VFs are assigned - not disabling SR-IOV\n"); |
| 521 | 519 | |
| 522 | − /* Avoid wait time by stopping all VFs at the same time */ | |
| 523 | − ice_for_each_vf(pf, i) | |
| 524 | − ice_dis_vf_qs(&pf->vf[i]); | |
| 525 | − | |
| 526 | 520 | tmp = pf->num_alloc_vfs; |
| 527 | 521 | pf->num_qps_per_vf = 0; |
| 528 | 522 | pf->num_alloc_vfs = 0; |
| 529 | 523 | for (i = 0; i < tmp; i++) { |
| 530 | − if (test_bit(ICE_VF_STATE_INIT, pf->vf[i].vf_states)) { | |
| 524 | + struct ice_vf *vf = &pf->vf[i]; | |
| 525 | + | |
| 526 | + mutex_lock(&vf->cfg_lock); | |
| 527 | + | |
| 528 | + ice_dis_vf_qs(vf); | |
| 529 | + | |
| 530 | + if (test_bit(ICE_VF_STATE_INIT, vf->vf_states)) { | |
| 531 | 531 | /* disable VF qp mappings and set VF disable state */ |
| 532 | − ice_dis_vf_mappings(&pf->vf[i]); | |
| 533 | − set_bit(ICE_VF_STATE_DIS, pf->vf[i].vf_states); | |
| 534 | − ice_free_vf_res(&pf->vf[i]); | |
| 532 | + ice_dis_vf_mappings(vf); | |
| 533 | + set_bit(ICE_VF_STATE_DIS, vf->vf_states); | |
| 534 | + ice_free_vf_res(vf); | |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | − mutex_destroy(&pf->vf[i].cfg_lock); | |
| 537 | + mutex_unlock(&vf->cfg_lock); | |
| 538 | + | |
| 539 | + mutex_destroy(&vf->cfg_lock); | |
| 538 | 540 | } |
| 539 | 541 | |
| 540 | 542 | if (ice_sriov_free_msix_res(pf)) |
| @@ -570,7 +572,6 @@ void ice_free_vfs(struct ice_pf *pf) · 29 unmodified lines | ||
| 570 | 572 | i); |
| 571 | 573 | |
| 572 | 574 | clear_bit(ICE_VF_DIS, pf->state); |
| 573 | − clear_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state); | |
| 574 | 575 | clear_bit(ICE_FLAG_SRIOV_ENA, pf->flags); |
| 575 | 576 | } |
| 576 | 577 | |
| @@ -1498,6 +1499,8 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr) · 921 unmodified lines | ||
| 1498 | 1499 | ice_for_each_vf(pf, v) { |
| 1499 | 1500 | vf = &pf->vf[v]; |
| 1500 | 1501 | |
| 1502 | + mutex_lock(&vf->cfg_lock); | |
| 1503 | + | |
| 1501 | 1504 | vf->driver_caps = 0; |
| 1502 | 1505 | ice_vc_set_default_allowlist(vf); |
| 1503 | 1506 | |
| @@ -1512,6 +1515,8 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr) · 8 unmodified lines | ||
| 1512 | 1515 | ice_vf_pre_vsi_rebuild(vf); |
| 1513 | 1516 | ice_vf_rebuild_vsi(vf); |
| 1514 | 1517 | ice_vf_post_vsi_rebuild(vf); |
| 1518 | + | |
| 1519 | + mutex_unlock(&vf->cfg_lock); | |
| 1515 | 1520 | } |
| 1516 | 1521 | |
| 1517 | 1522 | if (ice_is_eswitch_mode_switchdev(pf)) |
| @@ -1562,6 +1567,8 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) · 44 unmodified lines | ||
| 1562 | 1567 | u32 reg; |
| 1563 | 1568 | int i; |
| 1564 | 1569 | |
| 1570 | + lockdep_assert_held(&vf->cfg_lock); | |
| 1571 | + | |
| 1565 | 1572 | dev = ice_pf_to_dev(pf); |
| 1566 | 1573 | |
| 1567 | 1574 | if (test_bit(ICE_VF_RESETS_DISABLED, pf->state)) { |
| @@ -2061,9 +2068,12 @@ void ice_process_vflr_event(struct ice_pf *pf) · 493 unmodified lines | ||
| 2061 | 2068 | bit_idx = (hw->func_caps.vf_base_id + vf_id) % 32; |
| 2062 | 2069 | /* read GLGEN_VFLRSTAT register to find out the flr VFs */ |
| 2063 | 2070 | reg = rd32(hw, GLGEN_VFLRSTAT(reg_idx)); |
| 2064 | − if (reg & BIT(bit_idx)) | |
| 2071 | + if (reg & BIT(bit_idx)) { | |
| 2065 | 2072 | /* GLGEN_VFLRSTAT bit will be cleared in ice_reset_vf */ |
| 2073 | + mutex_lock(&vf->cfg_lock); | |
| 2066 | 2074 | ice_reset_vf(vf, true); |
| 2075 | + mutex_unlock(&vf->cfg_lock); | |
| 2076 | + } | |
| 2067 | 2077 | } |
| 2068 | 2078 | } |
| 2069 | 2079 | |
| @@ -2140,7 +2150,9 @@ ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event) · 70 unmodified lines | ||
| 2140 | 2150 | if (!vf) |
| 2141 | 2151 | return; |
| 2142 | 2152 | |
| 2153 | + mutex_lock(&vf->cfg_lock); | |
| 2143 | 2154 | ice_vc_reset_vf(vf); |
| 2155 | + mutex_unlock(&vf->cfg_lock); | |
| 2144 | 2156 | } |
| 2145 | 2157 | |
| 2146 | 2158 | /** |
| @@ -4625,10 +4637,6 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event) · 2478 unmodified lines | ||
| 4625 | 4637 | struct device *dev; |
| 4626 | 4638 | int err = 0; |
| 4627 | 4639 | |
| 4628 | − /* if de-init is underway, don't process messages from VF */ | |
| 4629 | − if (test_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state)) | |
| 4630 | − return; | |
| 4631 | − | |
| 4632 | 4640 | dev = ice_pf_to_dev(pf); |
| 4633 | 4641 | if (ice_validate_vf_id(pf, vf_id)) { |
| 4634 | 4642 | err = -EINVAL; |
| @@ -2704,6 +2704,16 @@ MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_ids); · 2703 unmodified lines | ||
| 2704 | 2704 | |
| 2705 | 2705 | static struct platform_device *port_platdev[3]; |
| 2706 | 2706 | |
| 2707 | +static void mv643xx_eth_shared_of_remove(void) | |
| 2708 | +{ | |
| 2709 | + int n; | |
| 2710 | + | |
| 2711 | + for (n = 0; n < 3; n++) { | |
| 2712 | + platform_device_del(port_platdev[n]); | |
| 2713 | + port_platdev[n] = NULL; | |
| 2714 | + } | |
| 2715 | +} | |
| 2716 | + | |
| 2707 | 2717 | static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, |
| 2708 | 2718 | struct device_node *pnp) |
| 2709 | 2719 | { |
| @@ -2740,7 +2750,9 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, · 30 unmodified lines | ||
| 2740 | 2750 | return -EINVAL; |
| 2741 | 2751 | } |
| 2742 | 2752 | |
| 2743 | − of_get_mac_address(pnp, ppd.mac_addr); | |
| 2753 | + ret = of_get_mac_address(pnp, ppd.mac_addr); | |
| 2754 | + if (ret) | |
| 2755 | + return ret; | |
| 2744 | 2756 | |
| 2745 | 2757 | mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size); |
| 2746 | 2758 | mv643xx_eth_property(pnp, "tx-sram-addr", ppd.tx_sram_addr); |
| @@ -2804,21 +2816,13 @@ static int mv643xx_eth_shared_of_probe(struct platform_device *pdev) · 57 unmodified lines | ||
| 2804 | 2816 | ret = mv643xx_eth_shared_of_add_port(pdev, pnp); |
| 2805 | 2817 | if (ret) { |
| 2806 | 2818 | of_node_put(pnp); |
| 2819 | + mv643xx_eth_shared_of_remove(); | |
| 2807 | 2820 | return ret; |
| 2808 | 2821 | } |
| 2809 | 2822 | } |
| 2810 | 2823 | return 0; |
| 2811 | 2824 | } |
| 2812 | 2825 | |
| 2813 | −static void mv643xx_eth_shared_of_remove(void) | |
| 2814 | −{ | |
| 2815 | − int n; | |
| 2816 | − | |
| 2817 | − for (n = 0; n < 3; n++) { | |
| 2818 | − platform_device_del(port_platdev[n]); | |
| 2819 | − port_platdev[n] = NULL; | |
| 2820 | − } | |
| 2821 | −} | |
| 2822 | 2826 | #else |
| 2823 | 2827 | static inline int mv643xx_eth_shared_of_probe(struct platform_device *pdev) |
| 2824 | 2828 | { |
| @@ -6870,6 +6870,9 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 6869 unmodified lines | ||
| 6870 | 6870 | dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE; |
| 6871 | 6871 | dev->dev.of_node = port_node; |
| 6872 | 6872 | |
| 6873 | + port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops; | |
| 6874 | + port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops; | |
| 6875 | + | |
| 6873 | 6876 | if (!mvpp2_use_acpi_compat_mode(port_fwnode)) { |
| 6874 | 6877 | port->phylink_config.dev = &dev->dev; |
| 6875 | 6878 | port->phylink_config.type = PHYLINK_NETDEV; |
| @@ -6940,9 +6943,6 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 64 unmodified lines | ||
| 6940 | 6943 | port->phylink_config.supported_interfaces); |
| 6941 | 6944 | } |
| 6942 | 6945 | |
| 6943 | − port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops; | |
| 6944 | − port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops; | |
| 6945 | − | |
| 6946 | 6946 | phylink = phylink_create(&port->phylink_config, port_fwnode, |
| 6947 | 6947 | phy_mode, &mvpp2_phylink_ops); |
| 6948 | 6948 | if (IS_ERR(phylink)) { |
| @@ -16,11 +16,13 @@ struct mlx5e_tc_act_parse_state { · 15 unmodified lines | ||
| 16 | 16 | unsigned int num_actions; |
| 17 | 17 | struct mlx5e_tc_flow *flow; |
| 18 | 18 | struct netlink_ext_ack *extack; |
| 19 | + bool ct_clear; | |
| 19 | 20 | bool encap; |
| 20 | 21 | bool decap; |
| 21 | 22 | bool mpls_push; |
| 22 | 23 | bool ptype_host; |
| 23 | 24 | const struct ip_tunnel_info *tun_info; |
| 25 | + struct mlx5e_mpls_info mpls_info; | |
| 24 | 26 | struct pedit_headers_action hdrs[__PEDIT_CMD_MAX]; |
| 25 | 27 | int ifindexes[MLX5_MAX_FLOW_FWD_VPORTS]; |
| 26 | 28 | int if_count; |
| @@ -27,8 +27,13 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state, · 26 unmodified lines | ||
| 27 | 27 | struct mlx5e_priv *priv, |
| 28 | 28 | struct mlx5_flow_attr *attr) |
| 29 | 29 | { |
| 30 | + bool clear_action = act->ct.action & TCA_CT_ACT_CLEAR; | |
| 30 | 31 | int err; |
| 31 | 32 | |
| 33 | + /* It's redundant to do ct clear more than once. */ | |
| 34 | + if (clear_action && parse_state->ct_clear) | |
| 35 | + return 0; | |
| 36 | + | |
| 32 | 37 | err = mlx5_tc_ct_parse_action(parse_state->ct_priv, attr, |
| 33 | 38 | &attr->parse_attr->mod_hdr_acts, |
| 34 | 39 | act, parse_state->extack); |
| @@ -40,6 +45,8 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state, · 5 unmodified lines | ||
| 40 | 45 | if (mlx5e_is_eswitch_flow(parse_state->flow)) |
| 41 | 46 | attr->esw_attr->split_count = attr->esw_attr->out_count; |
| 42 | 47 | |
| 48 | + parse_state->ct_clear = clear_action; | |
| 49 | + | |
| 43 | 50 | return 0; |
| 44 | 51 | } |
| 45 | 52 | |
| @@ -177,6 +177,12 @@ parse_mirred_encap(struct mlx5e_tc_act_parse_state *parse_state, · 176 unmodified lines | ||
| 177 | 177 | return -ENOMEM; |
| 178 | 178 | |
| 179 | 179 | parse_state->encap = false; |
| 180 | + | |
| 181 | + if (parse_state->mpls_push) { | |
| 182 | + memcpy(&parse_attr->mpls_info[esw_attr->out_count], | |
| 183 | + &parse_state->mpls_info, sizeof(parse_state->mpls_info)); | |
| 184 | + parse_state->mpls_push = false; | |
| 185 | + } | |
| 180 | 186 | esw_attr->dests[esw_attr->out_count].flags |= MLX5_ESW_DEST_ENCAP; |
| 181 | 187 | esw_attr->out_count++; |
| 182 | 188 | /* attr->dests[].rep is resolved when we handle encap */ |
| @@ -22,6 +22,16 @@ tc_act_can_offload_mpls_push(struct mlx5e_tc_act_parse_state *parse_state, · 21 unmodified lines | ||
| 22 | 22 | return true; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | +static void | |
| 26 | +copy_mpls_info(struct mlx5e_mpls_info *mpls_info, | |
| 27 | + const struct flow_action_entry *act) | |
| 28 | +{ | |
| 29 | + mpls_info->label = act->mpls_push.label; | |
| 30 | + mpls_info->tc = act->mpls_push.tc; | |
| 31 | + mpls_info->bos = act->mpls_push.bos; | |
| 32 | + mpls_info->ttl = act->mpls_push.ttl; | |
| 33 | +} | |
| 34 | + | |
| 25 | 35 | static int |
| 26 | 36 | tc_act_parse_mpls_push(struct mlx5e_tc_act_parse_state *parse_state, |
| 27 | 37 | const struct flow_action_entry *act, |
| @@ -29,6 +39,7 @@ tc_act_parse_mpls_push(struct mlx5e_tc_act_parse_state *parse_state, · 1 unmodified line | ||
| 29 | 39 | struct mlx5_flow_attr *attr) |
| 30 | 40 | { |
| 31 | 41 | parse_state->mpls_push = true; |
| 42 | + copy_mpls_info(&parse_state->mpls_info, act); | |
| 32 | 43 | |
| 33 | 44 | return 0; |
| 34 | 45 | } |
| @@ -35,6 +35,7 @@ enum { · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | struct mlx5e_tc_flow_parse_attr { |
| 37 | 37 | const struct ip_tunnel_info *tun_info[MLX5_MAX_FLOW_FWD_VPORTS]; |
| 38 | + struct mlx5e_mpls_info mpls_info[MLX5_MAX_FLOW_FWD_VPORTS]; | |
| 38 | 39 | struct net_device *filter_dev; |
| 39 | 40 | struct mlx5_flow_spec spec; |
| 40 | 41 | struct mlx5e_tc_mod_hdr_acts mod_hdr_acts; |
| @@ -750,6 +750,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv, · 749 unmodified lines | ||
| 750 | 750 | struct mlx5e_tc_flow_parse_attr *parse_attr; |
| 751 | 751 | struct mlx5_flow_attr *attr = flow->attr; |
| 752 | 752 | const struct ip_tunnel_info *tun_info; |
| 753 | + const struct mlx5e_mpls_info *mpls_info; | |
| 753 | 754 | unsigned long tbl_time_before = 0; |
| 754 | 755 | struct mlx5e_encap_entry *e; |
| 755 | 756 | struct mlx5e_encap_key key; |
| @@ -760,6 +761,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv, · 4 unmodified lines | ||
| 760 | 761 | |
| 761 | 762 | parse_attr = attr->parse_attr; |
| 762 | 763 | tun_info = parse_attr->tun_info[out_index]; |
| 764 | + mpls_info = &parse_attr->mpls_info[out_index]; | |
| 763 | 765 | family = ip_tunnel_info_af(tun_info); |
| 764 | 766 | key.ip_tun_key = &tun_info->key; |
| 765 | 767 | key.tc_tunnel = mlx5e_get_tc_tun(mirred_dev); |
| @@ -810,6 +812,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv, · 44 unmodified lines | ||
| 810 | 812 | goto out_err_init; |
| 811 | 813 | } |
| 812 | 814 | e->tun_info = tun_info; |
| 815 | + memcpy(&e->mpls_info, mpls_info, sizeof(*mpls_info)); | |
| 813 | 816 | err = mlx5e_tc_tun_init_encap_attr(mirred_dev, priv, e, extack); |
| 814 | 817 | if (err) |
| 815 | 818 | goto out_err_init; |
| @@ -30,16 +30,15 @@ static int generate_ip_tun_hdr(char buf[], · 29 unmodified lines | ||
| 30 | 30 | struct mlx5e_encap_entry *r) |
| 31 | 31 | { |
| 32 | 32 | const struct ip_tunnel_key *tun_key = &r->tun_info->key; |
| 33 | + const struct mlx5e_mpls_info *mpls_info = &r->mpls_info; | |
| 33 | 34 | struct udphdr *udp = (struct udphdr *)(buf); |
| 34 | 35 | struct mpls_shim_hdr *mpls; |
| 35 | − u32 tun_id; | |
| 36 | 36 | |
| 37 | − tun_id = be32_to_cpu(tunnel_id_to_key32(tun_key->tun_id)); | |
| 38 | 37 | mpls = (struct mpls_shim_hdr *)(udp + 1); |
| 39 | 38 | *ip_proto = IPPROTO_UDP; |
| 40 | 39 | |
| 41 | 40 | udp->dest = tun_key->tp_dst; |
| 42 | − *mpls = mpls_entry_encode(tun_id, tun_key->ttl, tun_key->tos, true); | |
| 41 | + *mpls = mpls_entry_encode(mpls_info->label, mpls_info->ttl, mpls_info->tc, mpls_info->bos); | |
| 43 | 42 | |
| 44 | 43 | return 0; |
| 45 | 44 | } |
| @@ -60,37 +59,31 @@ static int parse_tunnel(struct mlx5e_priv *priv, · 14 unmodified lines | ||
| 60 | 59 | void *headers_v) |
| 61 | 60 | { |
| 62 | 61 | struct flow_rule *rule = flow_cls_offload_flow_rule(f); |
| 63 | − struct flow_match_enc_keyid enc_keyid; | |
| 64 | 62 | struct flow_match_mpls match; |
| 65 | 63 | void *misc2_c; |
| 66 | 64 | void *misc2_v; |
| 67 | 65 | |
| 68 | − misc2_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | |
| 69 | − misc_parameters_2); | |
| 70 | − misc2_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, | |
| 71 | − misc_parameters_2); | |
| 72 | − | |
| 73 | − if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_MPLS)) | |
| 74 | − return 0; | |
| 75 | − | |
| 76 | − if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID)) | |
| 77 | − return 0; | |
| 78 | − | |
| 79 | − flow_rule_match_enc_keyid(rule, &enc_keyid); | |
| 80 | − | |
| 81 | − if (!enc_keyid.mask->keyid) | |
| 82 | − return 0; | |
| 83 | − | |
| 84 | 66 | if (!MLX5_CAP_ETH(priv->mdev, tunnel_stateless_mpls_over_udp) && |
| 85 | 67 | !(MLX5_CAP_GEN(priv->mdev, flex_parser_protocols) & MLX5_FLEX_PROTO_CW_MPLS_UDP)) |
| 86 | 68 | return -EOPNOTSUPP; |
| 87 | 69 | |
| 70 | + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID)) | |
| 71 | + return -EOPNOTSUPP; | |
| 72 | + | |
| 73 | + if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_MPLS)) | |
| 74 | + return 0; | |
| 75 | + | |
| 88 | 76 | flow_rule_match_mpls(rule, &match); |
| 89 | 77 | |
| 90 | 78 | /* Only support matching the first LSE */ |
| 91 | 79 | if (match.mask->used_lses != 1) |
| 92 | 80 | return -EOPNOTSUPP; |
| 93 | 81 | |
| 82 | + misc2_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | |
| 83 | + misc_parameters_2); | |
| 84 | + misc2_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, | |
| 85 | + misc_parameters_2); | |
| 86 | + | |
| 94 | 87 | MLX5_SET(fte_match_set_misc2, misc2_c, |
| 95 | 88 | outer_first_mpls_over_udp.mpls_label, |
| 96 | 89 | match.mask->ls[0].mpls_label); |
| @@ -1792,7 +1792,7 @@ static int mlx5e_get_module_eeprom(struct net_device *netdev, · 1791 unmodified lines | ||
| 1792 | 1792 | if (size_read < 0) { |
| 1793 | 1793 | netdev_err(priv->netdev, "%s: mlx5_query_eeprom failed:0x%x\n", |
| 1794 | 1794 | __func__, size_read); |
| 1795 | − return 0; | |
| 1795 | + return size_read; | |
| 1796 | 1796 | } |
| 1797 | 1797 | |
| 1798 | 1798 | i += size_read; |
| @@ -183,6 +183,13 @@ struct mlx5e_decap_entry { · 182 unmodified lines | ||
| 183 | 183 | struct rcu_head rcu; |
| 184 | 184 | }; |
| 185 | 185 | |
| 186 | +struct mlx5e_mpls_info { | |
| 187 | + u32 label; | |
| 188 | + u8 tc; | |
| 189 | + u8 bos; | |
| 190 | + u8 ttl; | |
| 191 | +}; | |
| 192 | + | |
| 186 | 193 | struct mlx5e_encap_entry { |
| 187 | 194 | /* attached neigh hash entry */ |
| 188 | 195 | struct mlx5e_neigh_hash_entry *nhe; |
| @@ -196,6 +203,7 @@ struct mlx5e_encap_entry { · 7 unmodified lines | ||
| 196 | 203 | struct list_head route_list; |
| 197 | 204 | struct mlx5_pkt_reformat *pkt_reformat; |
| 198 | 205 | const struct ip_tunnel_info *tun_info; |
| 206 | + struct mlx5e_mpls_info mpls_info; | |
| 199 | 207 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
| 200 | 208 | |
| 201 | 209 | struct net_device *out_dev; |
| @@ -1349,7 +1349,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, · 1348 unmodified lines | ||
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | /* True when explicitly set via priv flag, or XDP prog is loaded */ |
| 1352 | − if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)) | |
| 1352 | + if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state) || | |
| 1353 | + get_cqe_tls_offload(cqe)) | |
| 1353 | 1354 | goto csum_unnecessary; |
| 1354 | 1355 | |
| 1355 | 1356 | /* CQE csum doesn't cover padding octets in short ethernet |
| @@ -334,6 +334,7 @@ void mlx5e_self_test(struct net_device *ndev, struct ethtool_test *etest, · 333 unmodified lines | ||
| 334 | 334 | netdev_info(ndev, "\t[%d] %s start..\n", i, st.name); |
| 335 | 335 | buf[count] = st.st_func(priv); |
| 336 | 336 | netdev_info(ndev, "\t[%d] %s end: result(%lld)\n", i, st.name, buf[count]); |
| 337 | + count++; | |
| 337 | 338 | } |
| 338 | 339 | |
| 339 | 340 | mutex_unlock(&priv->state_lock); |
| @@ -1254,9 +1254,6 @@ static void fec_set_corrected_bits_total(struct mlx5e_priv *priv, · 1253 unmodified lines | ||
| 1254 | 1254 | u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {}; |
| 1255 | 1255 | int sz = MLX5_ST_SZ_BYTES(ppcnt_reg); |
| 1256 | 1256 | |
| 1257 | − if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group)) | |
| 1258 | − return; | |
| 1259 | − | |
| 1260 | 1257 | MLX5_SET(ppcnt_reg, in, local_port, 1); |
| 1261 | 1258 | MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP); |
| 1262 | 1259 | if (mlx5_core_access_reg(mdev, in, sz, ppcnt_phy_statistical, |
| @@ -1272,6 +1269,9 @@ static void fec_set_corrected_bits_total(struct mlx5e_priv *priv, · 9 unmodified lines | ||
| 1272 | 1269 | void mlx5e_stats_fec_get(struct mlx5e_priv *priv, |
| 1273 | 1270 | struct ethtool_fec_stats *fec_stats) |
| 1274 | 1271 | { |
| 1272 | + if (!MLX5_CAP_PCAM_FEATURE(priv->mdev, ppcnt_statistical_group)) | |
| 1273 | + return; | |
| 1274 | + | |
| 1275 | 1275 | fec_set_corrected_bits_total(priv, fec_stats); |
| 1276 | 1276 | fec_set_block_stats(priv, fec_stats); |
| 1277 | 1277 | } |
| @@ -3204,6 +3204,18 @@ actions_match_supported(struct mlx5e_priv *priv, · 3203 unmodified lines | ||
| 3204 | 3204 | return false; |
| 3205 | 3205 | } |
| 3206 | 3206 | |
| 3207 | + if (!(~actions & | |
| 3208 | + (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_DROP))) { | |
| 3209 | + NL_SET_ERR_MSG_MOD(extack, "Rule cannot support forward+drop action"); | |
| 3210 | + return false; | |
| 3211 | + } | |
| 3212 | + | |
| 3213 | + if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR && | |
| 3214 | + actions & MLX5_FLOW_CONTEXT_ACTION_DROP) { | |
| 3215 | + NL_SET_ERR_MSG_MOD(extack, "Drop with modify header action is not supported"); | |
| 3216 | + return false; | |
| 3217 | + } | |
| 3218 | + | |
| 3207 | 3219 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR && |
| 3208 | 3220 | !modify_header_match_supported(priv, &parse_attr->spec, flow_action, |
| 3209 | 3221 | actions, ct_flow, ct_clear, extack)) |
| @@ -697,7 +697,7 @@ void mlx5_esw_qos_vport_disable(struct mlx5_eswitch *esw, struct mlx5_vport *vpo · 696 unmodified lines | ||
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | int mlx5_esw_qos_set_vport_rate(struct mlx5_eswitch *esw, struct mlx5_vport *vport, |
| 700 | − u32 min_rate, u32 max_rate) | |
| 700 | + u32 max_rate, u32 min_rate) | |
| 701 | 701 | { |
| 702 | 702 | int err; |
| 703 | 703 | |
| @@ -2838,10 +2838,6 @@ bool mlx5_esw_vport_match_metadata_supported(const struct mlx5_eswitch *esw) · 2837 unmodified lines | ||
| 2838 | 2838 | if (!MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source)) |
| 2839 | 2839 | return false; |
| 2840 | 2840 | |
| 2841 | − if (mlx5_core_is_ecpf_esw_manager(esw->dev) || | |
| 2842 | − mlx5_ecpf_vport_exists(esw->dev)) | |
| 2843 | − return false; | |
| 2844 | − | |
| 2845 | 2841 | return true; |
| 2846 | 2842 | } |
| 2847 | 2843 | |
| @@ -2074,6 +2074,8 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) · 2073 unmodified lines | ||
| 2074 | 2074 | fte->node.del_hw_func = NULL; |
| 2075 | 2075 | up_write_ref_node(&fte->node, false); |
| 2076 | 2076 | tree_put_node(&fte->node, false); |
| 2077 | + } else { | |
| 2078 | + up_write_ref_node(&fte->node, false); | |
| 2077 | 2079 | } |
| 2078 | 2080 | kfree(handle); |
| 2079 | 2081 | } |
| @@ -121,6 +121,9 @@ u32 mlx5_chains_get_nf_ft_chain(struct mlx5_fs_chains *chains) · 120 unmodified lines | ||
| 121 | 121 | |
| 122 | 122 | u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains) |
| 123 | 123 | { |
| 124 | + if (!mlx5_chains_prios_supported(chains)) | |
| 125 | + return 1; | |
| 126 | + | |
| 124 | 127 | if (mlx5_chains_ignore_flow_level_supported(chains)) |
| 125 | 128 | return UINT_MAX; |
| 126 | 129 | |
| @@ -526,7 +526,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) · 525 unmodified lines | ||
| 526 | 526 | |
| 527 | 527 | /* Check log_max_qp from HCA caps to set in current profile */ |
| 528 | 528 | if (prof->log_max_qp == LOG_MAX_SUPPORTED_QPS) { |
| 529 | − prof->log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp); | |
| 529 | + prof->log_max_qp = min_t(u8, 17, MLX5_CAP_GEN_MAX(dev, log_max_qp)); | |
| 530 | 530 | } else if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { |
| 531 | 531 | mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n", |
| 532 | 532 | prof->log_max_qp, |
| @@ -1840,10 +1840,12 @@ static const struct pci_device_id mlx5_core_pci_table[] = { · 1307 unmodified lines | ||
| 1840 | 1840 | { PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF}, /* ConnectX Family mlx5Gen Virtual Function */ |
| 1841 | 1841 | { PCI_VDEVICE(MELLANOX, 0x101f) }, /* ConnectX-6 LX */ |
| 1842 | 1842 | { PCI_VDEVICE(MELLANOX, 0x1021) }, /* ConnectX-7 */ |
| 1843 | + { PCI_VDEVICE(MELLANOX, 0x1023) }, /* ConnectX-8 */ | |
| 1843 | 1844 | { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */ |
| 1844 | 1845 | { PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */ |
| 1845 | 1846 | { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */ |
| 1846 | 1847 | { PCI_VDEVICE(MELLANOX, 0xa2dc) }, /* BlueField-3 integrated ConnectX-7 network controller */ |
| 1848 | + { PCI_VDEVICE(MELLANOX, 0xa2df) }, /* BlueField-4 integrated ConnectX-8 network controller */ | |
| 1847 | 1849 | { 0, } |
| 1848 | 1850 | }; |
| 1849 | 1851 | |
| @@ -4,7 +4,6 @@ · 3 unmodified lines | ||
| 4 | 4 | #include "dr_types.h" |
| 5 | 5 | |
| 6 | 6 | #define DR_ICM_MODIFY_HDR_ALIGN_BASE 64 |
| 7 | −#define DR_ICM_SYNC_THRESHOLD_POOL (64 * 1024 * 1024) | |
| 8 | 7 | |
| 9 | 8 | struct mlx5dr_icm_pool { |
| 10 | 9 | enum mlx5dr_icm_type icm_type; |
| @@ -136,37 +135,35 @@ static void dr_icm_pool_mr_destroy(struct mlx5dr_icm_mr *icm_mr) · 125 unmodified lines | ||
| 136 | 135 | kvfree(icm_mr); |
| 137 | 136 | } |
| 138 | 137 | |
| 139 | −static int dr_icm_chunk_ste_init(struct mlx5dr_icm_chunk *chunk) | |
| 138 | +static int dr_icm_buddy_get_ste_size(struct mlx5dr_icm_buddy_mem *buddy) | |
| 140 | 139 | { |
| 141 | − chunk->ste_arr = kvzalloc(chunk->num_of_entries * | |
| 142 | − sizeof(chunk->ste_arr[0]), GFP_KERNEL); | |
| 143 | − if (!chunk->ste_arr) | |
| 144 | − return -ENOMEM; | |
| 145 | − | |
| 146 | − chunk->hw_ste_arr = kvzalloc(chunk->num_of_entries * | |
| 147 | − DR_STE_SIZE_REDUCED, GFP_KERNEL); | |
| 148 | − if (!chunk->hw_ste_arr) | |
| 149 | − goto out_free_ste_arr; | |
| 150 | − | |
| 151 | − chunk->miss_list = kvmalloc(chunk->num_of_entries * | |
| 152 | − sizeof(chunk->miss_list[0]), GFP_KERNEL); | |
| 153 | − if (!chunk->miss_list) | |
| 154 | − goto out_free_hw_ste_arr; | |
| 140 | + /* We support only one type of STE size, both for ConnectX-5 and later | |
| 141 | + * devices. Once the support for match STE which has a larger tag is | |
| 142 | + * added (32B instead of 16B), the STE size for devices later than | |
| 143 | + * ConnectX-5 needs to account for that. | |
| 144 | + */ | |
| 145 | + return DR_STE_SIZE_REDUCED; | |
| 146 | +} | |
| 155 | 147 | |
| 156 | − return 0; | |
| 148 | +static void dr_icm_chunk_ste_init(struct mlx5dr_icm_chunk *chunk, int offset) | |
| 149 | +{ | |
| 150 | + struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem; | |
| 151 | + int index = offset / DR_STE_SIZE; | |
| 157 | 152 | |
| 158 | −out_free_hw_ste_arr: | |
| 159 | − kvfree(chunk->hw_ste_arr); | |
| 160 | −out_free_ste_arr: | |
| 161 | − kvfree(chunk->ste_arr); | |
| 162 | − return -ENOMEM; | |
| 153 | + chunk->ste_arr = &buddy->ste_arr[index]; | |
| 154 | + chunk->miss_list = &buddy->miss_list[index]; | |
| 155 | + chunk->hw_ste_arr = buddy->hw_ste_arr + | |
| 156 | + index * dr_icm_buddy_get_ste_size(buddy); | |
| 163 | 157 | } |
| 164 | 158 | |
| 165 | 159 | static void dr_icm_chunk_ste_cleanup(struct mlx5dr_icm_chunk *chunk) |
| 166 | 160 | { |
| 167 | − kvfree(chunk->miss_list); | |
| 168 | − kvfree(chunk->hw_ste_arr); | |
| 169 | − kvfree(chunk->ste_arr); | |
| 161 | + struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem; | |
| 162 | + | |
| 163 | + memset(chunk->hw_ste_arr, 0, | |
| 164 | + chunk->num_of_entries * dr_icm_buddy_get_ste_size(buddy)); | |
| 165 | + memset(chunk->ste_arr, 0, | |
| 166 | + chunk->num_of_entries * sizeof(chunk->ste_arr[0])); | |
| 170 | 167 | } |
| 171 | 168 | |
| 172 | 169 | static enum mlx5dr_icm_type |
| @@ -189,6 +186,44 @@ static void dr_icm_chunk_destroy(struct mlx5dr_icm_chunk *chunk, · 16 unmodified lines | ||
| 189 | 186 | kvfree(chunk); |
| 190 | 187 | } |
| 191 | 188 | |
| 189 | +static int dr_icm_buddy_init_ste_cache(struct mlx5dr_icm_buddy_mem *buddy) | |
| 190 | +{ | |
| 191 | + int num_of_entries = | |
| 192 | + mlx5dr_icm_pool_chunk_size_to_entries(buddy->pool->max_log_chunk_sz); | |
| 193 | + | |
| 194 | + buddy->ste_arr = kvcalloc(num_of_entries, | |
| 195 | + sizeof(struct mlx5dr_ste), GFP_KERNEL); | |
| 196 | + if (!buddy->ste_arr) | |
| 197 | + return -ENOMEM; | |
| 198 | + | |
| 199 | + /* Preallocate full STE size on non-ConnectX-5 devices since | |
| 200 | + * we need to support both full and reduced with the same cache. | |
| 201 | + */ | |
| 202 | + buddy->hw_ste_arr = kvcalloc(num_of_entries, | |
| 203 | + dr_icm_buddy_get_ste_size(buddy), GFP_KERNEL); | |
| 204 | + if (!buddy->hw_ste_arr) | |
| 205 | + goto free_ste_arr; | |
| 206 | + | |
| 207 | + buddy->miss_list = kvmalloc(num_of_entries * sizeof(struct list_head), GFP_KERNEL); | |
| 208 | + if (!buddy->miss_list) | |
| 209 | + goto free_hw_ste_arr; | |
| 210 | + | |
| 211 | + return 0; | |
| 212 | + | |
| 213 | +free_hw_ste_arr: | |
| 214 | + kvfree(buddy->hw_ste_arr); | |
| 215 | +free_ste_arr: | |
| 216 | + kvfree(buddy->ste_arr); | |
| 217 | + return -ENOMEM; | |
| 218 | +} | |
| 219 | + | |
| 220 | +static void dr_icm_buddy_cleanup_ste_cache(struct mlx5dr_icm_buddy_mem *buddy) | |
| 221 | +{ | |
| 222 | + kvfree(buddy->ste_arr); | |
| 223 | + kvfree(buddy->hw_ste_arr); | |
| 224 | + kvfree(buddy->miss_list); | |
| 225 | +} | |
| 226 | + | |
| 192 | 227 | static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool) |
| 193 | 228 | { |
| 194 | 229 | struct mlx5dr_icm_buddy_mem *buddy; |
| @@ -208,11 +243,19 @@ static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool) · 13 unmodified lines | ||
| 208 | 243 | buddy->icm_mr = icm_mr; |
| 209 | 244 | buddy->pool = pool; |
| 210 | 245 | |
| 246 | + if (pool->icm_type == DR_ICM_TYPE_STE) { | |
| 247 | + /* Reduce allocations by preallocating and reusing the STE structures */ | |
| 248 | + if (dr_icm_buddy_init_ste_cache(buddy)) | |
| 249 | + goto err_cleanup_buddy; | |
| 250 | + } | |
| 251 | + | |
| 211 | 252 | /* add it to the -start- of the list in order to search in it first */ |
| 212 | 253 | list_add(&buddy->list_node, &pool->buddy_mem_list); |
| 213 | 254 | |
| 214 | 255 | return 0; |
| 215 | 256 | |
| 257 | +err_cleanup_buddy: | |
| 258 | + mlx5dr_buddy_cleanup(buddy); | |
| 216 | 259 | err_free_buddy: |
| 217 | 260 | kvfree(buddy); |
| 218 | 261 | free_mr: |
| @@ -234,6 +277,9 @@ static void dr_icm_buddy_destroy(struct mlx5dr_icm_buddy_mem *buddy) · 15 unmodified lines | ||
| 234 | 277 | |
| 235 | 278 | mlx5dr_buddy_cleanup(buddy); |
| 236 | 279 | |
| 280 | + if (buddy->pool->icm_type == DR_ICM_TYPE_STE) | |
| 281 | + dr_icm_buddy_cleanup_ste_cache(buddy); | |
| 282 | + | |
| 237 | 283 | kvfree(buddy); |
| 238 | 284 | } |
| 239 | 285 | |
| @@ -261,34 +307,30 @@ dr_icm_chunk_create(struct mlx5dr_icm_pool *pool, · 21 unmodified lines | ||
| 261 | 307 | chunk->byte_size = |
| 262 | 308 | mlx5dr_icm_pool_chunk_size_to_byte(chunk_size, pool->icm_type); |
| 263 | 309 | chunk->seg = seg; |
| 310 | + chunk->buddy_mem = buddy_mem_pool; | |
| 264 | 311 | |
| 265 | − if (pool->icm_type == DR_ICM_TYPE_STE && dr_icm_chunk_ste_init(chunk)) { | |
| 266 | − mlx5dr_err(pool->dmn, | |
| 267 | − "Failed to init ste arrays (order: %d)\n", | |
| 268 | − chunk_size); | |
| 269 | − goto out_free_chunk; | |
| 270 | − } | |
| 312 | + if (pool->icm_type == DR_ICM_TYPE_STE) | |
| 313 | + dr_icm_chunk_ste_init(chunk, offset); | |
| 271 | 314 | |
| 272 | 315 | buddy_mem_pool->used_memory += chunk->byte_size; |
| 273 | − chunk->buddy_mem = buddy_mem_pool; | |
| 274 | 316 | INIT_LIST_HEAD(&chunk->chunk_list); |
| 275 | 317 | |
| 276 | 318 | /* chunk now is part of the used_list */ |
| 277 | 319 | list_add_tail(&chunk->chunk_list, &buddy_mem_pool->used_list); |
| 278 | 320 | |
| 279 | 321 | return chunk; |
| 280 | − | |
| 281 | −out_free_chunk: | |
| 282 | − kvfree(chunk); | |
| 283 | − return NULL; | |
| 284 | 322 | } |
| 285 | 323 | |
| 286 | 324 | static bool dr_icm_pool_is_sync_required(struct mlx5dr_icm_pool *pool) |
| 287 | 325 | { |
| 288 | − if (pool->hot_memory_size > DR_ICM_SYNC_THRESHOLD_POOL) | |
| 289 | − return true; | |
| 326 | + int allow_hot_size; | |
| 327 | + | |
| 328 | + /* sync when hot memory reaches half of the pool size */ | |
| 329 | + allow_hot_size = | |
| 330 | + mlx5dr_icm_pool_chunk_size_to_byte(pool->max_log_chunk_sz, | |
| 331 | + pool->icm_type) / 2; | |
| 290 | 332 | |
| 291 | − return false; | |
| 333 | + return pool->hot_memory_size > allow_hot_size; | |
| 292 | 334 | } |
| 293 | 335 | |
| 294 | 336 | static int dr_icm_pool_sync_all_buddy_pools(struct mlx5dr_icm_pool *pool) |
| @@ -13,18 +13,6 @@ static bool dr_mask_is_dmac_set(struct mlx5dr_match_spec *spec) · 12 unmodified lines | ||
| 13 | 13 | return (spec->dmac_47_16 || spec->dmac_15_0); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | −static bool dr_mask_is_src_addr_set(struct mlx5dr_match_spec *spec) | |
| 17 | −{ | |
| 18 | − return (spec->src_ip_127_96 || spec->src_ip_95_64 || | |
| 19 | − spec->src_ip_63_32 || spec->src_ip_31_0); | |
| 20 | −} | |
| 21 | − | |
| 22 | −static bool dr_mask_is_dst_addr_set(struct mlx5dr_match_spec *spec) | |
| 23 | −{ | |
| 24 | − return (spec->dst_ip_127_96 || spec->dst_ip_95_64 || | |
| 25 | − spec->dst_ip_63_32 || spec->dst_ip_31_0); | |
| 26 | −} | |
| 27 | − | |
| 28 | 16 | static bool dr_mask_is_l3_base_set(struct mlx5dr_match_spec *spec) |
| 29 | 17 | { |
| 30 | 18 | return (spec->ip_protocol || spec->frag || spec->tcp_flags || |
| @@ -503,11 +491,11 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, · 472 unmodified lines | ||
| 503 | 491 | &mask, inner, rx); |
| 504 | 492 | |
| 505 | 493 | if (outer_ipv == DR_RULE_IPV6) { |
| 506 | − if (dr_mask_is_dst_addr_set(&mask.outer)) | |
| 494 | + if (DR_MASK_IS_DST_IP_SET(&mask.outer)) | |
| 507 | 495 | mlx5dr_ste_build_eth_l3_ipv6_dst(ste_ctx, &sb[idx++], |
| 508 | 496 | &mask, inner, rx); |
| 509 | 497 | |
| 510 | − if (dr_mask_is_src_addr_set(&mask.outer)) | |
| 498 | + if (DR_MASK_IS_SRC_IP_SET(&mask.outer)) | |
| 511 | 499 | mlx5dr_ste_build_eth_l3_ipv6_src(ste_ctx, &sb[idx++], |
| 512 | 500 | &mask, inner, rx); |
| 513 | 501 | |
| @@ -610,11 +598,11 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, · 96 unmodified lines | ||
| 610 | 598 | &mask, inner, rx); |
| 611 | 599 | |
| 612 | 600 | if (inner_ipv == DR_RULE_IPV6) { |
| 613 | − if (dr_mask_is_dst_addr_set(&mask.inner)) | |
| 601 | + if (DR_MASK_IS_DST_IP_SET(&mask.inner)) | |
| 614 | 602 | mlx5dr_ste_build_eth_l3_ipv6_dst(ste_ctx, &sb[idx++], |
| 615 | 603 | &mask, inner, rx); |
| 616 | 604 | |
| 617 | − if (dr_mask_is_src_addr_set(&mask.inner)) | |
| 605 | + if (DR_MASK_IS_SRC_IP_SET(&mask.inner)) | |
| 618 | 606 | mlx5dr_ste_build_eth_l3_ipv6_src(ste_ctx, &sb[idx++], |
| 619 | 607 | &mask, inner, rx); |
| 620 | 608 | |
| @@ -602,12 +602,34 @@ int mlx5dr_ste_set_action_decap_l3_list(struct mlx5dr_ste_ctx *ste_ctx, · 601 unmodified lines | ||
| 602 | 602 | used_hw_action_num); |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | +static int dr_ste_build_pre_check_spec(struct mlx5dr_domain *dmn, | |
| 606 | + struct mlx5dr_match_spec *spec) | |
| 607 | +{ | |
| 608 | + if (spec->ip_version) { | |
| 609 | + if (spec->ip_version != 0xf) { | |
| 610 | + mlx5dr_err(dmn, | |
| 611 | + "Partial ip_version mask with src/dst IP is not supported\n"); | |
| 612 | + return -EINVAL; | |
| 613 | + } | |
| 614 | + } else if (spec->ethertype != 0xffff && | |
| 615 | + (DR_MASK_IS_SRC_IP_SET(spec) || DR_MASK_IS_DST_IP_SET(spec))) { | |
| 616 | + mlx5dr_err(dmn, | |
| 617 | + "Partial/no ethertype mask with src/dst IP is not supported\n"); | |
| 618 | + return -EINVAL; | |
| 619 | + } | |
| 620 | + | |
| 621 | + return 0; | |
| 622 | +} | |
| 623 | + | |
| 605 | 624 | int mlx5dr_ste_build_pre_check(struct mlx5dr_domain *dmn, |
| 606 | 625 | u8 match_criteria, |
| 607 | 626 | struct mlx5dr_match_param *mask, |
| 608 | 627 | struct mlx5dr_match_param *value) |
| 609 | 628 | { |
| 610 | − if (!value && (match_criteria & DR_MATCHER_CRITERIA_MISC)) { | |
| 629 | + if (value) | |
| 630 | + return 0; | |
| 631 | + | |
| 632 | + if (match_criteria & DR_MATCHER_CRITERIA_MISC) { | |
| 611 | 633 | if (mask->misc.source_port && mask->misc.source_port != 0xffff) { |
| 612 | 634 | mlx5dr_err(dmn, |
| 613 | 635 | "Partial mask source_port is not supported\n"); |
| @@ -621,6 +643,14 @@ int mlx5dr_ste_build_pre_check(struct mlx5dr_domain *dmn, · 7 unmodified lines | ||
| 621 | 643 | } |
| 622 | 644 | } |
| 623 | 645 | |
| 646 | + if ((match_criteria & DR_MATCHER_CRITERIA_OUTER) && | |
| 647 | + dr_ste_build_pre_check_spec(dmn, &mask->outer)) | |
| 648 | + return -EINVAL; | |
| 649 | + | |
| 650 | + if ((match_criteria & DR_MATCHER_CRITERIA_INNER) && | |
| 651 | + dr_ste_build_pre_check_spec(dmn, &mask->inner)) | |
| 652 | + return -EINVAL; | |
| 653 | + | |
| 624 | 654 | return 0; |
| 625 | 655 | } |
| 626 | 656 | |
| @@ -798,6 +798,16 @@ struct mlx5dr_match_param { · 797 unmodified lines | ||
| 798 | 798 | (_misc3)->icmpv4_code || \ |
| 799 | 799 | (_misc3)->icmpv4_header_data) |
| 800 | 800 | |
| 801 | +#define DR_MASK_IS_SRC_IP_SET(_spec) ((_spec)->src_ip_127_96 || \ | |
| 802 | + (_spec)->src_ip_95_64 || \ | |
| 803 | + (_spec)->src_ip_63_32 || \ | |
| 804 | + (_spec)->src_ip_31_0) | |
| 805 | + | |
| 806 | +#define DR_MASK_IS_DST_IP_SET(_spec) ((_spec)->dst_ip_127_96 || \ | |
| 807 | + (_spec)->dst_ip_95_64 || \ | |
| 808 | + (_spec)->dst_ip_63_32 || \ | |
| 809 | + (_spec)->dst_ip_31_0) | |
| 810 | + | |
| 801 | 811 | struct mlx5dr_esw_caps { |
| 802 | 812 | u64 drop_icm_address_rx; |
| 803 | 813 | u64 drop_icm_address_tx; |
| @@ -233,7 +233,11 @@ static bool contain_vport_reformat_action(struct mlx5_flow_rule *dst) · 232 unmodified lines | ||
| 233 | 233 | dst->dest_attr.vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | −#define MLX5_FLOW_CONTEXT_ACTION_MAX 32 | |
| 236 | +/* We want to support a rule with 32 destinations, which means we need to | |
| 237 | + * account for 32 destinations plus usually a counter plus one more action | |
| 238 | + * for a multi-destination flow table. | |
| 239 | + */ | |
| 240 | +#define MLX5_FLOW_CONTEXT_ACTION_MAX 34 | |
| 237 | 241 | static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, |
| 238 | 242 | struct mlx5_flow_table *ft, |
| 239 | 243 | struct mlx5_flow_group *group, |
| @@ -403,9 +407,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, · 163 unmodified lines | ||
| 403 | 407 | enum mlx5_flow_destination_type type = dst->dest_attr.type; |
| 404 | 408 | u32 id; |
| 405 | 409 | |
| 406 | − if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX || | |
| 407 | − num_term_actions >= MLX5_FLOW_CONTEXT_ACTION_MAX) { | |
| 408 | − err = -ENOSPC; | |
| 410 | + if (fs_dr_num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX || | |
| 411 | + num_term_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { | |
| 412 | + err = -EOPNOTSUPP; | |
| 409 | 413 | goto free_actions; |
| 410 | 414 | } |
| 411 | 415 | |
| @@ -478,8 +482,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, · 66 unmodified lines | ||
| 478 | 482 | MLX5_FLOW_DESTINATION_TYPE_COUNTER) |
| 479 | 483 | continue; |
| 480 | 484 | |
| 481 | − if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { | |
| 482 | − err = -ENOSPC; | |
| 485 | + if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX || | |
| 486 | + fs_dr_num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { | |
| 487 | + err = -EOPNOTSUPP; | |
| 483 | 488 | goto free_actions; |
| 484 | 489 | } |
| 485 | 490 | |
| @@ -499,14 +504,28 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, · 13 unmodified lines | ||
| 499 | 504 | params.match_sz = match_sz; |
| 500 | 505 | params.match_buf = (u64 *)fte->val; |
| 501 | 506 | if (num_term_actions == 1) { |
| 502 | − if (term_actions->reformat) | |
| 507 | + if (term_actions->reformat) { | |
| 508 | + if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { | |
| 509 | + err = -EOPNOTSUPP; | |
| 510 | + goto free_actions; | |
| 511 | + } | |
| 503 | 512 | actions[num_actions++] = term_actions->reformat; |
| 513 | + } | |
| 504 | 514 | |
| 515 | + if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { | |
| 516 | + err = -EOPNOTSUPP; | |
| 517 | + goto free_actions; | |
| 518 | + } | |
| 505 | 519 | actions[num_actions++] = term_actions->dest; |
| 506 | 520 | } else if (num_term_actions > 1) { |
| 507 | 521 | bool ignore_flow_level = |
| 508 | 522 | !!(fte->action.flags & FLOW_ACT_IGNORE_FLOW_LEVEL); |
| 509 | 523 | |
| 524 | + if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX || | |
| 525 | + fs_dr_num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { | |
| 526 | + err = -EOPNOTSUPP; | |
| 527 | + goto free_actions; | |
| 528 | + } | |
| 510 | 529 | tmp_action = mlx5dr_action_create_mult_dest_tbl(domain, |
| 511 | 530 | term_actions, |
| 512 | 531 | num_term_actions, |
| @@ -160,6 +160,11 @@ struct mlx5dr_icm_buddy_mem { · 159 unmodified lines | ||
| 160 | 160 | * sync_ste command sets them free. |
| 161 | 161 | */ |
| 162 | 162 | struct list_head hot_list; |
| 163 | + | |
| 164 | + /* Memory optimisation */ | |
| 165 | + struct mlx5dr_ste *ste_arr; | |
| 166 | + struct list_head *miss_list; | |
| 167 | + u8 *hw_ste_arr; | |
| 163 | 168 | }; |
| 164 | 169 | |
| 165 | 170 | int mlx5dr_buddy_init(struct mlx5dr_icm_buddy_mem *buddy, |
| @@ -549,14 +549,18 @@ EXPORT_SYMBOL(ocelot_vlan_add); · 548 unmodified lines | ||
| 549 | 549 | int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid) |
| 550 | 550 | { |
| 551 | 551 | struct ocelot_port *ocelot_port = ocelot->ports[port]; |
| 552 | + bool del_pvid = false; | |
| 552 | 553 | int err; |
| 553 | 554 | |
| 555 | + if (ocelot_port->pvid_vlan && ocelot_port->pvid_vlan->vid == vid) | |
| 556 | + del_pvid = true; | |
| 557 | + | |
| 554 | 558 | err = ocelot_vlan_member_del(ocelot, port, vid); |
| 555 | 559 | if (err) |
| 556 | 560 | return err; |
| 557 | 561 | |
| 558 | 562 | /* Ingress */ |
| 559 | − if (ocelot_port->pvid_vlan && ocelot_port->pvid_vlan->vid == vid) | |
| 563 | + if (del_pvid) | |
| 560 | 564 | ocelot_port_set_pvid(ocelot, port, NULL); |
| 561 | 565 | |
| 562 | 566 | /* Egress */ |
| @@ -723,6 +723,8 @@ static inline bool nfp_fl_is_netdev_to_offload(struct net_device *netdev) · 722 unmodified lines | ||
| 723 | 723 | return true; |
| 724 | 724 | if (netif_is_gretap(netdev)) |
| 725 | 725 | return true; |
| 726 | + if (netif_is_ip6gretap(netdev)) | |
| 727 | + return true; | |
| 726 | 728 | |
| 727 | 729 | return false; |
| 728 | 730 | } |
| @@ -922,8 +922,8 @@ nfp_tunnel_add_shared_mac(struct nfp_app *app, struct net_device *netdev, · 921 unmodified lines | ||
| 922 | 922 | int port, bool mod) |
| 923 | 923 | { |
| 924 | 924 | struct nfp_flower_priv *priv = app->priv; |
| 925 | − int ida_idx = NFP_MAX_MAC_INDEX, err; | |
| 926 | 925 | struct nfp_tun_offloaded_mac *entry; |
| 926 | + int ida_idx = -1, err; | |
| 927 | 927 | u16 nfp_mac_idx = 0; |
| 928 | 928 | |
| 929 | 929 | entry = nfp_tunnel_lookup_offloaded_macs(app, netdev->dev_addr); |
| @@ -997,7 +997,7 @@ err_remove_hash: · 67 unmodified lines | ||
| 997 | 997 | err_free_entry: |
| 998 | 998 | kfree(entry); |
| 999 | 999 | err_free_ida: |
| 1000 | − if (ida_idx != NFP_MAX_MAC_INDEX) | |
| 1000 | + if (ida_idx != -1) | |
| 1001 | 1001 | ida_simple_remove(&priv->tun.mac_off_ids, ida_idx); |
| 1002 | 1002 | |
| 1003 | 1003 | return err; |
| @@ -1433,6 +1433,8 @@ static int temac_probe(struct platform_device *pdev) · 1432 unmodified lines | ||
| 1433 | 1433 | lp->indirect_lock = devm_kmalloc(&pdev->dev, |
| 1434 | 1434 | sizeof(*lp->indirect_lock), |
| 1435 | 1435 | GFP_KERNEL); |
| 1436 | + if (!lp->indirect_lock) | |
| 1437 | + return -ENOMEM; | |
| 1436 | 1438 | spin_lock_init(lp->indirect_lock); |
| 1437 | 1439 | } |
| 1438 | 1440 | |
| @@ -668,11 +668,11 @@ static void sixpack_close(struct tty_struct *tty) · 667 unmodified lines | ||
| 668 | 668 | */ |
| 669 | 669 | netif_stop_queue(sp->dev); |
| 670 | 670 | |
| 671 | + unregister_netdev(sp->dev); | |
| 672 | + | |
| 671 | 673 | del_timer_sync(&sp->tx_t); |
| 672 | 674 | del_timer_sync(&sp->resync_t); |
| 673 | 675 | |
| 674 | − unregister_netdev(sp->dev); | |
| 675 | − | |
| 676 | 676 | /* Free all 6pack frame buffers after unreg. */ |
| 677 | 677 | kfree(sp->rbuff); |
| 678 | 678 | kfree(sp->xbuff); |
| @@ -2975,8 +2975,8 @@ static void ca8210_hw_setup(struct ieee802154_hw *ca8210_hw) · 2974 unmodified lines | ||
| 2975 | 2975 | ca8210_hw->phy->cca.opt = NL802154_CCA_OPT_ENERGY_CARRIER_AND; |
| 2976 | 2976 | ca8210_hw->phy->cca_ed_level = -9800; |
| 2977 | 2977 | ca8210_hw->phy->symbol_duration = 16; |
| 2978 | − ca8210_hw->phy->lifs_period = 40; | |
| 2979 | − ca8210_hw->phy->sifs_period = 12; | |
| 2978 | + ca8210_hw->phy->lifs_period = 40 * ca8210_hw->phy->symbol_duration; | |
| 2979 | + ca8210_hw->phy->sifs_period = 12 * ca8210_hw->phy->symbol_duration; | |
| 2980 | 2980 | ca8210_hw->flags = |
| 2981 | 2981 | IEEE802154_HW_AFILT | |
| 2982 | 2982 | IEEE802154_HW_OMIT_CKSUM | |
| @@ -403,8 +403,16 @@ static void mctp_serial_tty_receive_buf(struct tty_struct *tty, · 402 unmodified lines | ||
| 403 | 403 | mctp_serial_push(dev, c[i]); |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | +static void mctp_serial_uninit(struct net_device *ndev) | |
| 407 | +{ | |
| 408 | + struct mctp_serial *dev = netdev_priv(ndev); | |
| 409 | + | |
| 410 | + cancel_work_sync(&dev->tx_work); | |
| 411 | +} | |
| 412 | + | |
| 406 | 413 | static const struct net_device_ops mctp_serial_netdev_ops = { |
| 407 | 414 | .ndo_start_xmit = mctp_serial_tx, |
| 415 | + .ndo_uninit = mctp_serial_uninit, | |
| 408 | 416 | }; |
| 409 | 417 | |
| 410 | 418 | static void mctp_serial_setup(struct net_device *ndev) |
| @@ -483,7 +491,6 @@ static void mctp_serial_close(struct tty_struct *tty) · 72 unmodified lines | ||
| 483 | 491 | int idx = dev->idx; |
| 484 | 492 | |
| 485 | 493 | unregister_netdev(dev->netdev); |
| 486 | − cancel_work_sync(&dev->tx_work); | |
| 487 | 494 | ida_free(&mctp_serial_ida, idx); |
| 488 | 495 | } |
| 489 | 496 | |
| @@ -200,7 +200,11 @@ static int ipq_mdio_reset(struct mii_bus *bus) · 199 unmodified lines | ||
| 200 | 200 | if (ret) |
| 201 | 201 | return ret; |
| 202 | 202 | |
| 203 | − return clk_prepare_enable(priv->mdio_clk); | |
| 203 | + ret = clk_prepare_enable(priv->mdio_clk); | |
| 204 | + if (ret == 0) | |
| 205 | + mdelay(10); | |
| 206 | + | |
| 207 | + return ret; | |
| 204 | 208 | } |
| 205 | 209 | |
| 206 | 210 | static int ipq4019_mdio_probe(struct platform_device *pdev) |
| @@ -623,14 +623,14 @@ static int nsim_fib6_rt_append(struct nsim_fib_data *data, · 622 unmodified lines | ||
| 623 | 623 | if (err) |
| 624 | 624 | goto err_fib6_rt_nh_del; |
| 625 | 625 | |
| 626 | − fib6_event->rt_arr[i]->trap = true; | |
| 626 | + WRITE_ONCE(fib6_event->rt_arr[i]->trap, true); | |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | return 0; |
| 630 | 630 | |
| 631 | 631 | err_fib6_rt_nh_del: |
| 632 | 632 | for (i--; i >= 0; i--) { |
| 633 | − fib6_event->rt_arr[i]->trap = false; | |
| 633 | + WRITE_ONCE(fib6_event->rt_arr[i]->trap, false); | |
| 634 | 634 | nsim_fib6_rt_nh_del(fib6_rt, fib6_event->rt_arr[i]); |
| 635 | 635 | } |
| 636 | 636 | return err; |
| @@ -55,9 +55,6 @@ static int mt7530_phy_config_init(struct phy_device *phydev) · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | static int mt7531_phy_config_init(struct phy_device *phydev) |
| 57 | 57 | { |
| 58 | − if (phydev->interface != PHY_INTERFACE_MODE_INTERNAL) | |
| 59 | − return -EINVAL; | |
| 60 | − | |
| 61 | 58 | mtk_gephy_config_init(phydev); |
| 62 | 59 | |
| 63 | 60 | /* PHY link down power saving enable */ |
| @@ -583,6 +583,11 @@ static const struct usb_device_id products[] = { · 582 unmodified lines | ||
| 583 | 583 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ |
| 584 | 584 | .bInterfaceProtocol = USB_CDC_PROTO_NONE |
| 585 | 585 | |
| 586 | +#define ZAURUS_FAKE_INTERFACE \ | |
| 587 | + .bInterfaceClass = USB_CLASS_COMM, \ | |
| 588 | + .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \ | |
| 589 | + .bInterfaceProtocol = USB_CDC_PROTO_NONE | |
| 590 | + | |
| 586 | 591 | /* SA-1100 based Sharp Zaurus ("collie"), or compatible; |
| 587 | 592 | * wire-incompatible with true CDC Ethernet implementations. |
| 588 | 593 | * (And, it seems, needlessly so...) |
| @@ -636,6 +641,13 @@ static const struct usb_device_id products[] = { · 47 unmodified lines | ||
| 636 | 641 | .idProduct = 0x9032, /* SL-6000 */ |
| 637 | 642 | ZAURUS_MASTER_INTERFACE, |
| 638 | 643 | .driver_info = 0, |
| 644 | +}, { | |
| 645 | + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | |
| 646 | + | USB_DEVICE_ID_MATCH_DEVICE, | |
| 647 | + .idVendor = 0x04DD, | |
| 648 | + .idProduct = 0x9032, /* SL-6000 */ | |
| 649 | + ZAURUS_FAKE_INTERFACE, | |
| 650 | + .driver_info = 0, | |
| 639 | 651 | }, { |
| 640 | 652 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
| 641 | 653 | | USB_DEVICE_ID_MATCH_DEVICE, |
| @@ -659,6 +659,11 @@ static const struct usb_device_id mbim_devs[] = { · 658 unmodified lines | ||
| 659 | 659 | .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, |
| 660 | 660 | }, |
| 661 | 661 | |
| 662 | + /* Telit FN990 */ | |
| 663 | + { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1071, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | |
| 664 | + .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, | |
| 665 | + }, | |
| 666 | + | |
| 662 | 667 | /* default entry */ |
| 663 | 668 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
| 664 | 669 | .driver_info = (unsigned long)&cdc_mbim_info_zlp, |
| @@ -1715,10 +1715,10 @@ int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in) · 1714 unmodified lines | ||
| 1715 | 1715 | { |
| 1716 | 1716 | struct sk_buff *skb; |
| 1717 | 1717 | struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; |
| 1718 | − int len; | |
| 1718 | + unsigned int len; | |
| 1719 | 1719 | int nframes; |
| 1720 | 1720 | int x; |
| 1721 | − int offset; | |
| 1721 | + unsigned int offset; | |
| 1722 | 1722 | union { |
| 1723 | 1723 | struct usb_cdc_ncm_ndp16 *ndp16; |
| 1724 | 1724 | struct usb_cdc_ncm_ndp32 *ndp32; |
| @@ -1790,8 +1790,8 @@ next_ndp: · 65 unmodified lines | ||
| 1790 | 1790 | break; |
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | − /* sanity checking */ | |
| 1794 | − if (((offset + len) > skb_in->len) || | |
| 1793 | + /* sanity checking - watch out for integer wrap*/ | |
| 1794 | + if ((offset > skb_in->len) || (len > skb_in->len - offset) || | |
| 1795 | 1795 | (len > ctx->rx_max) || (len < ETH_HLEN)) { |
| 1796 | 1796 | netif_dbg(dev, rx_err, dev->net, |
| 1797 | 1797 | "invalid frame detected (ignored) offset[%u]=%u, length=%u, skb=%p\n", |
| @@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 412 unmodified lines | ||
| 413 | 413 | /* ignore the CRC length */ |
| 414 | 414 | len = (skb->data[1] | (skb->data[2] << 8)) - 4; |
| 415 | 415 | |
| 416 | − if (len > ETH_FRAME_LEN) | |
| 416 | + if (len > ETH_FRAME_LEN || len > skb->len) | |
| 417 | 417 | return 0; |
| 418 | 418 | |
| 419 | 419 | /* the last packet of current skb */ |
| @@ -256,6 +256,11 @@ static const struct usb_device_id products [] = { · 255 unmodified lines | ||
| 256 | 256 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ |
| 257 | 257 | .bInterfaceProtocol = USB_CDC_PROTO_NONE |
| 258 | 258 | |
| 259 | +#define ZAURUS_FAKE_INTERFACE \ | |
| 260 | + .bInterfaceClass = USB_CLASS_COMM, \ | |
| 261 | + .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \ | |
| 262 | + .bInterfaceProtocol = USB_CDC_PROTO_NONE | |
| 263 | + | |
| 259 | 264 | /* SA-1100 based Sharp Zaurus ("collie"), or compatible. */ |
| 260 | 265 | { |
| 261 | 266 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
| @@ -313,6 +318,13 @@ static const struct usb_device_id products [] = { · 51 unmodified lines | ||
| 313 | 318 | .idProduct = 0x9032, /* SL-6000 */ |
| 314 | 319 | ZAURUS_MASTER_INTERFACE, |
| 315 | 320 | .driver_info = ZAURUS_PXA_INFO, |
| 321 | +}, { | |
| 322 | + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | |
| 323 | + | USB_DEVICE_ID_MATCH_DEVICE, | |
| 324 | + .idVendor = 0x04DD, | |
| 325 | + .idProduct = 0x9032, /* SL-6000 */ | |
| 326 | + ZAURUS_FAKE_INTERFACE, | |
| 327 | + .driver_info = (unsigned long)&bogus_mdlm_info, | |
| 316 | 328 | }, { |
| 317 | 329 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
| 318 | 330 | | USB_DEVICE_ID_MATCH_DEVICE, |
| @@ -693,7 +693,7 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, · 692 unmodified lines | ||
| 693 | 693 | { |
| 694 | 694 | struct brcmf_fw_item *first = &req->items[0]; |
| 695 | 695 | struct brcmf_fw *fwctx; |
| 696 | − char *alt_path; | |
| 696 | + char *alt_path = NULL; | |
| 697 | 697 | int ret; |
| 698 | 698 | |
| 699 | 699 | brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); |
| @@ -712,7 +712,9 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, · 12 unmodified lines | ||
| 712 | 712 | fwctx->done = fw_cb; |
| 713 | 713 | |
| 714 | 714 | /* First try alternative board-specific path if any */ |
| 715 | − alt_path = brcm_alt_fw_path(first->path, fwctx->req->board_type); | |
| 715 | + if (fwctx->req->board_type) | |
| 716 | + alt_path = brcm_alt_fw_path(first->path, | |
| 717 | + fwctx->req->board_type); | |
| 716 | 718 | if (alt_path) { |
| 717 | 719 | ret = request_firmware_nowait(THIS_MODULE, true, alt_path, |
| 718 | 720 | fwctx->dev, GFP_KERNEL, fwctx, |
| @@ -80,19 +80,6 @@ config IWLWIFI_OPMODE_MODULAR · 79 unmodified lines | ||
| 80 | 80 | comment "WARNING: iwlwifi is useless without IWLDVM or IWLMVM" |
| 81 | 81 | depends on IWLDVM=n && IWLMVM=n |
| 82 | 82 | |
| 83 | −config IWLWIFI_BCAST_FILTERING | |
| 84 | − bool "Enable broadcast filtering" | |
| 85 | − depends on IWLMVM | |
| 86 | − help | |
| 87 | − Say Y here to enable default bcast filtering configuration. | |
| 88 | − | |
| 89 | − Enabling broadcast filtering will drop any incoming wireless | |
| 90 | − broadcast frames, except some very specific predefined | |
| 91 | − patterns (e.g. incoming arp requests). | |
| 92 | − | |
| 93 | − If unsure, don't enable this option, as some programs might | |
| 94 | − expect incoming broadcasts for their normal operations. | |
| 95 | − | |
| 96 | 83 | menu "Debugging Options" |
| 97 | 84 | |
| 98 | 85 | config IWLWIFI_DEBUG |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2017 Intel Deutschland GmbH |
| 4 | − * Copyright (C) 2019-2021 Intel Corporation | |
| 4 | + * Copyright (C) 2019-2022 Intel Corporation | |
| 5 | 5 | */ |
| 6 | 6 | #include <linux/uuid.h> |
| 7 | 7 | #include "iwl-drv.h" |
| @@ -888,10 +888,11 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt) · 880 unmodified lines | ||
| 888 | 888 | * only one using version 36, so skip this version entirely. |
| 889 | 889 | */ |
| 890 | 890 | return IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) >= 38 || |
| 891 | − IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 17 || | |
| 892 | − (IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 29 && | |
| 893 | − ((fwrt->trans->hw_rev & CSR_HW_REV_TYPE_MSK) == | |
| 894 | − CSR_HW_REV_TYPE_7265D)); | |
| 891 | + (IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 17 && | |
| 892 | + fwrt->trans->hw_rev != CSR_HW_REV_TYPE_3160) || | |
| 893 | + (IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 29 && | |
| 894 | + ((fwrt->trans->hw_rev & CSR_HW_REV_TYPE_MSK) == | |
| 895 | + CSR_HW_REV_TYPE_7265D)); | |
| 895 | 896 | } |
| 896 | 897 | IWL_EXPORT_SYMBOL(iwl_sar_geo_support); |
| 897 | 898 | |
| @@ -501,11 +501,6 @@ enum iwl_legacy_cmds { · 500 unmodified lines | ||
| 501 | 501 | */ |
| 502 | 502 | DEBUG_LOG_MSG = 0xf7, |
| 503 | 503 | |
| 504 | − /** | |
| 505 | − * @BCAST_FILTER_CMD: &struct iwl_bcast_filter_cmd | |
| 506 | − */ | |
| 507 | − BCAST_FILTER_CMD = 0xcf, | |
| 508 | − | |
| 509 | 504 | /** |
| 510 | 505 | * @MCAST_FILTER_CMD: &struct iwl_mcast_filter_cmd |
| 511 | 506 | */ |
| @@ -36,92 +36,4 @@ struct iwl_mcast_filter_cmd { · 35 unmodified lines | ||
| 36 | 36 | u8 addr_list[0]; |
| 37 | 37 | } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */ |
| 38 | 38 | |
| 39 | −#define MAX_BCAST_FILTERS 8 | |
| 40 | −#define MAX_BCAST_FILTER_ATTRS 2 | |
| 41 | − | |
| 42 | −/** | |
| 43 | − * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet | |
| 44 | − * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start. | |
| 45 | − * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e. | |
| 46 | − * start of ip payload). | |
| 47 | − */ | |
| 48 | −enum iwl_mvm_bcast_filter_attr_offset { | |
| 49 | − BCAST_FILTER_OFFSET_PAYLOAD_START = 0, | |
| 50 | − BCAST_FILTER_OFFSET_IP_END = 1, | |
| 51 | −}; | |
| 52 | − | |
| 53 | −/** | |
| 54 | − * struct iwl_fw_bcast_filter_attr - broadcast filter attribute | |
| 55 | − * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset. | |
| 56 | − * @offset: starting offset of this pattern. | |
| 57 | − * @reserved1: reserved | |
| 58 | − * @val: value to match - big endian (MSB is the first | |
| 59 | − * byte to match from offset pos). | |
| 60 | − * @mask: mask to match (big endian). | |
| 61 | − */ | |
| 62 | −struct iwl_fw_bcast_filter_attr { | |
| 63 | − u8 offset_type; | |
| 64 | − u8 offset; | |
| 65 | − __le16 reserved1; | |
| 66 | − __be32 val; | |
| 67 | − __be32 mask; | |
| 68 | −} __packed; /* BCAST_FILTER_ATT_S_VER_1 */ | |
| 69 | − | |
| 70 | −/** | |
| 71 | − * enum iwl_mvm_bcast_filter_frame_type - filter frame type | |
| 72 | − * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames. | |
| 73 | − * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames | |
| 74 | − */ | |
| 75 | −enum iwl_mvm_bcast_filter_frame_type { | |
| 76 | − BCAST_FILTER_FRAME_TYPE_ALL = 0, | |
| 77 | − BCAST_FILTER_FRAME_TYPE_IPV4 = 1, | |
| 78 | −}; | |
| 79 | − | |
| 80 | −/** | |
| 81 | − * struct iwl_fw_bcast_filter - broadcast filter | |
| 82 | − * @discard: discard frame (1) or let it pass (0). | |
| 83 | − * @frame_type: &enum iwl_mvm_bcast_filter_frame_type. | |
| 84 | − * @reserved1: reserved | |
| 85 | − * @num_attrs: number of valid attributes in this filter. | |
| 86 | − * @attrs: attributes of this filter. a filter is considered matched | |
| 87 | − * only when all its attributes are matched (i.e. AND relationship) | |
| 88 | − */ | |
| 89 | −struct iwl_fw_bcast_filter { | |
| 90 | − u8 discard; | |
| 91 | − u8 frame_type; | |
| 92 | − u8 num_attrs; | |
| 93 | − u8 reserved1; | |
| 94 | − struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS]; | |
| 95 | −} __packed; /* BCAST_FILTER_S_VER_1 */ | |
| 96 | − | |
| 97 | −/** | |
| 98 | − * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration. | |
| 99 | − * @default_discard: default action for this mac (discard (1) / pass (0)). | |
| 100 | − * @reserved1: reserved | |
| 101 | − * @attached_filters: bitmap of relevant filters for this mac. | |
| 102 | − */ | |
| 103 | −struct iwl_fw_bcast_mac { | |
| 104 | − u8 default_discard; | |
| 105 | − u8 reserved1; | |
| 106 | − __le16 attached_filters; | |
| 107 | −} __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */ | |
| 108 | − | |
| 109 | −/** | |
| 110 | − * struct iwl_bcast_filter_cmd - broadcast filtering configuration | |
| 111 | − * @disable: enable (0) / disable (1) | |
| 112 | − * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS) | |
| 113 | − * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER) | |
| 114 | − * @reserved1: reserved | |
| 115 | − * @filters: broadcast filters | |
| 116 | − * @macs: broadcast filtering configuration per-mac | |
| 117 | − */ | |
| 118 | −struct iwl_bcast_filter_cmd { | |
| 119 | − u8 disable; | |
| 120 | − u8 max_bcast_filters; | |
| 121 | − u8 max_macs; | |
| 122 | − u8 reserved1; | |
| 123 | − struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS]; | |
| 124 | − struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER]; | |
| 125 | −} __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */ | |
| 126 | − | |
| 127 | 39 | #endif /* __iwl_fw_api_filter_h__ */ |
| @@ -752,7 +752,6 @@ struct iwl_lq_cmd { · 751 unmodified lines | ||
| 752 | 752 | |
| 753 | 753 | u8 iwl_fw_rate_idx_to_plcp(int idx); |
| 754 | 754 | u32 iwl_new_rate_from_v1(u32 rate_v1); |
| 755 | −u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags); | |
| 756 | 755 | const struct iwl_rate_mcs_info *iwl_rate_mcs(int idx); |
| 757 | 756 | const char *iwl_rs_pretty_ant(u8 ant); |
| 758 | 757 | const char *iwl_rs_pretty_bw(int bw); |
| @@ -181,7 +181,6 @@ struct iwl_ucode_capa { · 180 unmodified lines | ||
| 181 | 181 | * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version) |
| 182 | 182 | * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD |
| 183 | 183 | * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save |
| 184 | − * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. | |
| 185 | 184 | * @IWL_UCODE_TLV_FLAGS_EBS_SUPPORT: this uCode image supports EBS. |
| 186 | 185 | */ |
| 187 | 186 | enum iwl_ucode_tlv_flag { |
| @@ -196,7 +195,6 @@ enum iwl_ucode_tlv_flag { · 8 unmodified lines | ||
| 196 | 195 | IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT = BIT(24), |
| 197 | 196 | IWL_UCODE_TLV_FLAGS_EBS_SUPPORT = BIT(25), |
| 198 | 197 | IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26), |
| 199 | − IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29), | |
| 200 | 198 | }; |
| 201 | 199 | |
| 202 | 200 | typedef unsigned int __bitwise iwl_ucode_tlv_api_t; |
| @@ -91,6 +91,20 @@ const char *iwl_rs_pretty_bw(int bw) · 90 unmodified lines | ||
| 91 | 91 | } |
| 92 | 92 | IWL_EXPORT_SYMBOL(iwl_rs_pretty_bw); |
| 93 | 93 | |
| 94 | +static u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags) | |
| 95 | +{ | |
| 96 | + int rate = rate_n_flags & RATE_LEGACY_RATE_MSK_V1; | |
| 97 | + int idx; | |
| 98 | + bool ofdm = !(rate_n_flags & RATE_MCS_CCK_MSK_V1); | |
| 99 | + int offset = ofdm ? IWL_FIRST_OFDM_RATE : 0; | |
| 100 | + int last = ofdm ? IWL_RATE_COUNT_LEGACY : IWL_FIRST_OFDM_RATE; | |
| 101 | + | |
| 102 | + for (idx = offset; idx < last; idx++) | |
| 103 | + if (iwl_fw_rate_idx_to_plcp(idx) == rate) | |
| 104 | + return idx - offset; | |
| 105 | + return IWL_RATE_INVALID; | |
| 106 | +} | |
| 107 | + | |
| 94 | 108 | u32 iwl_new_rate_from_v1(u32 rate_v1) |
| 95 | 109 | { |
| 96 | 110 | u32 rate_v2 = 0; |
| @@ -144,7 +158,10 @@ u32 iwl_new_rate_from_v1(u32 rate_v1) · 47 unmodified lines | ||
| 144 | 158 | } else { |
| 145 | 159 | u32 legacy_rate = iwl_legacy_rate_to_fw_idx(rate_v1); |
| 146 | 160 | |
| 147 | − WARN_ON(legacy_rate < 0); | |
| 161 | + if (WARN_ON_ONCE(legacy_rate == IWL_RATE_INVALID)) | |
| 162 | + legacy_rate = (rate_v1 & RATE_MCS_CCK_MSK_V1) ? | |
| 163 | + IWL_FIRST_CCK_RATE : IWL_FIRST_OFDM_RATE; | |
| 164 | + | |
| 148 | 165 | rate_v2 |= legacy_rate; |
| 149 | 166 | if (!(rate_v1 & RATE_MCS_CCK_MSK_V1)) |
| 150 | 167 | rate_v2 |= RATE_MCS_LEGACY_OFDM_MSK; |
| @@ -172,20 +189,6 @@ u32 iwl_new_rate_from_v1(u32 rate_v1) · 21 unmodified lines | ||
| 172 | 189 | } |
| 173 | 190 | IWL_EXPORT_SYMBOL(iwl_new_rate_from_v1); |
| 174 | 191 | |
| 175 | −u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags) | |
| 176 | −{ | |
| 177 | − int rate = rate_n_flags & RATE_LEGACY_RATE_MSK_V1; | |
| 178 | − int idx; | |
| 179 | − bool ofdm = !(rate_n_flags & RATE_MCS_CCK_MSK_V1); | |
| 180 | − int offset = ofdm ? IWL_FIRST_OFDM_RATE : 0; | |
| 181 | − int last = ofdm ? IWL_RATE_COUNT_LEGACY : IWL_FIRST_OFDM_RATE; | |
| 182 | − | |
| 183 | − for (idx = offset; idx < last; idx++) | |
| 184 | − if (iwl_fw_rate_idx_to_plcp(idx) == rate) | |
| 185 | − return idx - offset; | |
| 186 | − return -1; | |
| 187 | −} | |
| 188 | − | |
| 189 | 192 | int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate) |
| 190 | 193 | { |
| 191 | 194 | char *type; |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ |
| 2 | 2 | /* |
| 3 | − * Copyright (C) 2005-2014, 2018-2021 Intel Corporation | |
| 3 | + * Copyright (C) 2005-2014, 2018-2022 Intel Corporation | |
| 4 | 4 | * Copyright (C) 2013-2014 Intel Mobile Communications GmbH |
| 5 | 5 | * Copyright (C) 2016 Intel Deutschland GmbH |
| 6 | 6 | */ |
| @@ -329,6 +329,7 @@ enum { · 322 unmodified lines | ||
| 329 | 329 | #define CSR_HW_REV_TYPE_2x00 (0x0000100) |
| 330 | 330 | #define CSR_HW_REV_TYPE_105 (0x0000110) |
| 331 | 331 | #define CSR_HW_REV_TYPE_135 (0x0000120) |
| 332 | +#define CSR_HW_REV_TYPE_3160 (0x0000164) | |
| 332 | 333 | #define CSR_HW_REV_TYPE_7265D (0x0000210) |
| 333 | 334 | #define CSR_HW_REV_TYPE_NONE (0x00001F0) |
| 334 | 335 | #define CSR_HW_REV_TYPE_QNJ (0x0000360) |
| @@ -1707,6 +1707,8 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) · 1706 unmodified lines | ||
| 1707 | 1707 | out_unbind: |
| 1708 | 1708 | complete(&drv->request_firmware_complete); |
| 1709 | 1709 | device_release_driver(drv->trans->dev); |
| 1710 | + /* drv has just been freed by the release */ | |
| 1711 | + failure = false; | |
| 1710 | 1712 | free: |
| 1711 | 1713 | if (failure) |
| 1712 | 1714 | iwl_dealloc_ucode(drv); |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | /* |
| 3 | − * Copyright (C) 2021 Intel Corporation | |
| 3 | + * Copyright (C) 2021-2022 Intel Corporation | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include <linux/etherdevice.h> |
| @@ -146,6 +146,7 @@ struct iwl_mei_filters { · 139 unmodified lines | ||
| 146 | 146 | * @csme_taking_ownership: true when CSME is taking ownership. Used to remember |
| 147 | 147 | * to send CSME_OWNERSHIP_CONFIRMED when the driver completes its down |
| 148 | 148 | * flow. |
| 149 | + * @link_prot_state: true when we are in link protection PASSIVE | |
| 149 | 150 | * @csa_throttle_end_wk: used when &csa_throttled is true |
| 150 | 151 | * @data_q_lock: protects the access to the data queues which are |
| 151 | 152 | * accessed without the mutex. |
| @@ -165,6 +166,7 @@ struct iwl_mei { · 13 unmodified lines | ||
| 165 | 166 | bool amt_enabled; |
| 166 | 167 | bool csa_throttled; |
| 167 | 168 | bool csme_taking_ownership; |
| 169 | + bool link_prot_state; | |
| 168 | 170 | struct delayed_work csa_throttle_end_wk; |
| 169 | 171 | spinlock_t data_q_lock; |
| 170 | 172 | |
| @@ -229,8 +231,6 @@ static int iwl_mei_alloc_shared_mem(struct mei_cl_device *cldev) · 58 unmodified lines | ||
| 229 | 231 | if (IS_ERR(mem->ctrl)) { |
| 230 | 232 | int ret = PTR_ERR(mem->ctrl); |
| 231 | 233 | |
| 232 | − dev_err(&cldev->dev, "Couldn't allocate the shared memory: %d\n", | |
| 233 | − ret); | |
| 234 | 234 | mem->ctrl = NULL; |
| 235 | 235 | |
| 236 | 236 | return ret; |
| @@ -669,6 +669,8 @@ iwl_mei_handle_conn_status(struct mei_cl_device *cldev, · 432 unmodified lines | ||
| 669 | 669 | |
| 670 | 670 | iwl_mei_cache.ops->me_conn_status(iwl_mei_cache.priv, &conn_info); |
| 671 | 671 | |
| 672 | + mei->link_prot_state = status->link_prot_state; | |
| 673 | + | |
| 672 | 674 | /* |
| 673 | 675 | * Update the Rfkill state in case the host does not own the device: |
| 674 | 676 | * if we are in Link Protection, ask to not touch the device, else, |
| @@ -1663,9 +1665,11 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops) · 988 unmodified lines | ||
| 1663 | 1665 | mei_cldev_get_drvdata(iwl_mei_global_cldev); |
| 1664 | 1666 | |
| 1665 | 1667 | /* we have already a SAP connection */ |
| 1666 | − if (iwl_mei_is_connected()) | |
| 1668 | + if (iwl_mei_is_connected()) { | |
| 1667 | 1669 | iwl_mei_send_sap_msg(mei->cldev, |
| 1668 | 1670 | SAP_MSG_NOTIF_WIFIDR_UP); |
| 1671 | + ops->rfkill(priv, mei->link_prot_state); | |
| 1672 | + } | |
| 1669 | 1673 | } |
| 1670 | 1674 | ret = 0; |
| 1671 | 1675 | |
| @@ -1784,6 +1788,8 @@ static void iwl_mei_dbgfs_unregister(struct iwl_mei *mei) {} · 112 unmodified lines | ||
| 1784 | 1788 | |
| 1785 | 1789 | #endif /* CONFIG_DEBUG_FS */ |
| 1786 | 1790 | |
| 1791 | +#define ALLOC_SHARED_MEM_RETRY_MAX_NUM 3 | |
| 1792 | + | |
| 1787 | 1793 | /* |
| 1788 | 1794 | * iwl_mei_probe - the probe function called by the mei bus enumeration |
| 1789 | 1795 | * |
| @@ -1795,6 +1801,7 @@ static void iwl_mei_dbgfs_unregister(struct iwl_mei *mei) {} · 5 unmodified lines | ||
| 1795 | 1801 | static int iwl_mei_probe(struct mei_cl_device *cldev, |
| 1796 | 1802 | const struct mei_cl_device_id *id) |
| 1797 | 1803 | { |
| 1804 | + int alloc_retry = ALLOC_SHARED_MEM_RETRY_MAX_NUM; | |
| 1798 | 1805 | struct iwl_mei *mei; |
| 1799 | 1806 | int ret; |
| 1800 | 1807 | |
| @@ -1812,15 +1819,31 @@ static int iwl_mei_probe(struct mei_cl_device *cldev, · 11 unmodified lines | ||
| 1812 | 1819 | mei_cldev_set_drvdata(cldev, mei); |
| 1813 | 1820 | mei->cldev = cldev; |
| 1814 | 1821 | |
| 1815 | − /* | |
| 1816 | − * The CSME firmware needs to boot the internal WLAN client. Wait here | |
| 1817 | − * so that the DMA map request will succeed. | |
| 1818 | − */ | |
| 1819 | − msleep(20); | |
| 1822 | + do { | |
| 1823 | + ret = iwl_mei_alloc_shared_mem(cldev); | |
| 1824 | + if (!ret) | |
| 1825 | + break; | |
| 1826 | + /* | |
| 1827 | + * The CSME firmware needs to boot the internal WLAN client. | |
| 1828 | + * This can take time in certain configurations (usually | |
| 1829 | + * upon resume and when the whole CSME firmware is shut down | |
| 1830 | + * during suspend). | |
| 1831 | + * | |
| 1832 | + * Wait a bit before retrying and hope we'll succeed next time. | |
| 1833 | + */ | |
| 1820 | 1834 | |
| 1821 | − ret = iwl_mei_alloc_shared_mem(cldev); | |
| 1822 | − if (ret) | |
| 1835 | + dev_dbg(&cldev->dev, | |
| 1836 | + "Couldn't allocate the shared memory: %d, attempt %d / %d\n", | |
| 1837 | + ret, alloc_retry, ALLOC_SHARED_MEM_RETRY_MAX_NUM); | |
| 1838 | + msleep(100); | |
| 1839 | + alloc_retry--; | |
| 1840 | + } while (alloc_retry); | |
| 1841 | + | |
| 1842 | + if (ret) { | |
| 1843 | + dev_err(&cldev->dev, "Couldn't allocate the shared memory: %d\n", | |
| 1844 | + ret); | |
| 1823 | 1845 | goto free; |
| 1846 | + } | |
| 1824 | 1847 | |
| 1825 | 1848 | iwl_mei_init_shared_mem(mei); |
| 1826 | 1849 | |
| @@ -195,8 +195,7 @@ static bool iwl_mei_rx_filter_ipv4(struct sk_buff *skb, · 194 unmodified lines | ||
| 195 | 195 | bool match; |
| 196 | 196 | |
| 197 | 197 | if (!pskb_may_pull(skb, skb_network_offset(skb) + sizeof(*iphdr)) || |
| 198 | − !pskb_may_pull(skb, skb_network_offset(skb) + | |
| 199 | − sizeof(ip_hdrlen(skb) - sizeof(*iphdr)))) | |
| 198 | + !pskb_may_pull(skb, skb_network_offset(skb) + ip_hdrlen(skb))) | |
| 200 | 199 | return false; |
| 201 | 200 | |
| 202 | 201 | iphdrlen = ip_hdrlen(skb); |
| @@ -1369,189 +1369,6 @@ static ssize_t iwl_dbgfs_dbg_time_point_write(struct iwl_mvm *mvm, · 1368 unmodified lines | ||
| 1369 | 1369 | return count; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | −#define ADD_TEXT(...) pos += scnprintf(buf + pos, bufsz - pos, __VA_ARGS__) | |
| 1373 | −#ifdef CONFIG_IWLWIFI_BCAST_FILTERING | |
| 1374 | −static ssize_t iwl_dbgfs_bcast_filters_read(struct file *file, | |
| 1375 | − char __user *user_buf, | |
| 1376 | − size_t count, loff_t *ppos) | |
| 1377 | −{ | |
| 1378 | − struct iwl_mvm *mvm = file->private_data; | |
| 1379 | − struct iwl_bcast_filter_cmd cmd; | |
| 1380 | − const struct iwl_fw_bcast_filter *filter; | |
| 1381 | − char *buf; | |
| 1382 | − int bufsz = 1024; | |
| 1383 | − int i, j, pos = 0; | |
| 1384 | − ssize_t ret; | |
| 1385 | − | |
| 1386 | − buf = kzalloc(bufsz, GFP_KERNEL); | |
| 1387 | − if (!buf) | |
| 1388 | − return -ENOMEM; | |
| 1389 | − | |
| 1390 | − mutex_lock(&mvm->mutex); | |
| 1391 | − if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) { | |
| 1392 | − ADD_TEXT("None\n"); | |
| 1393 | − mutex_unlock(&mvm->mutex); | |
| 1394 | − goto out; | |
| 1395 | − } | |
| 1396 | − mutex_unlock(&mvm->mutex); | |
| 1397 | − | |
| 1398 | − for (i = 0; cmd.filters[i].attrs[0].mask; i++) { | |
| 1399 | − filter = &cmd.filters[i]; | |
| 1400 | − | |
| 1401 | − ADD_TEXT("Filter [%d]:\n", i); | |
| 1402 | − ADD_TEXT("\tDiscard=%d\n", filter->discard); | |
| 1403 | − ADD_TEXT("\tFrame Type: %s\n", | |
| 1404 | − filter->frame_type ? "IPv4" : "Generic"); | |
| 1405 | − | |
| 1406 | − for (j = 0; j < ARRAY_SIZE(filter->attrs); j++) { | |
| 1407 | − const struct iwl_fw_bcast_filter_attr *attr; | |
| 1408 | − | |
| 1409 | − attr = &filter->attrs[j]; | |
| 1410 | − if (!attr->mask) | |
| 1411 | − break; | |
| 1412 | − | |
| 1413 | − ADD_TEXT("\tAttr [%d]: offset=%d (from %s), mask=0x%x, value=0x%x reserved=0x%x\n", | |
| 1414 | − j, attr->offset, | |
| 1415 | − attr->offset_type ? "IP End" : | |
| 1416 | − "Payload Start", | |
| 1417 | − be32_to_cpu(attr->mask), | |
| 1418 | − be32_to_cpu(attr->val), | |
| 1419 | − le16_to_cpu(attr->reserved1)); | |
| 1420 | − } | |
| 1421 | − } | |
| 1422 | −out: | |
| 1423 | − ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | |
| 1424 | − kfree(buf); | |
| 1425 | − return ret; | |
| 1426 | −} | |
| 1427 | − | |
| 1428 | −static ssize_t iwl_dbgfs_bcast_filters_write(struct iwl_mvm *mvm, char *buf, | |
| 1429 | − size_t count, loff_t *ppos) | |
| 1430 | −{ | |
| 1431 | − int pos, next_pos; | |
| 1432 | − struct iwl_fw_bcast_filter filter = {}; | |
| 1433 | − struct iwl_bcast_filter_cmd cmd; | |
| 1434 | − u32 filter_id, attr_id, mask, value; | |
| 1435 | − int err = 0; | |
| 1436 | − | |
| 1437 | − if (sscanf(buf, "%d %hhi %hhi %n", &filter_id, &filter.discard, | |
| 1438 | − &filter.frame_type, &pos) != 3) | |
| 1439 | − return -EINVAL; | |
| 1440 | − | |
| 1441 | − if (filter_id >= ARRAY_SIZE(mvm->dbgfs_bcast_filtering.cmd.filters) || | |
| 1442 | − filter.frame_type > BCAST_FILTER_FRAME_TYPE_IPV4) | |
| 1443 | − return -EINVAL; | |
| 1444 | − | |
| 1445 | − for (attr_id = 0; attr_id < ARRAY_SIZE(filter.attrs); | |
| 1446 | − attr_id++) { | |
| 1447 | − struct iwl_fw_bcast_filter_attr *attr = | |
| 1448 | − &filter.attrs[attr_id]; | |
| 1449 | − | |
| 1450 | − if (pos >= count) | |
| 1451 | − break; | |
| 1452 | − | |
| 1453 | − if (sscanf(&buf[pos], "%hhi %hhi %i %i %n", | |
| 1454 | − &attr->offset, &attr->offset_type, | |
| 1455 | − &mask, &value, &next_pos) != 4) | |
| 1456 | − return -EINVAL; | |
| 1457 | − | |
| 1458 | − attr->mask = cpu_to_be32(mask); | |
| 1459 | − attr->val = cpu_to_be32(value); | |
| 1460 | − if (mask) | |
| 1461 | − filter.num_attrs++; | |
| 1462 | − | |
| 1463 | − pos += next_pos; | |
| 1464 | − } | |
| 1465 | − | |
| 1466 | − mutex_lock(&mvm->mutex); | |
| 1467 | − memcpy(&mvm->dbgfs_bcast_filtering.cmd.filters[filter_id], | |
| 1468 | − &filter, sizeof(filter)); | |
| 1469 | − | |
| 1470 | − /* send updated bcast filtering configuration */ | |
| 1471 | − if (iwl_mvm_firmware_running(mvm) && | |
| 1472 | − mvm->dbgfs_bcast_filtering.override && | |
| 1473 | − iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | |
| 1474 | − err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, | |
| 1475 | − sizeof(cmd), &cmd); | |
| 1476 | − mutex_unlock(&mvm->mutex); | |
| 1477 | − | |
| 1478 | − return err ?: count; | |
| 1479 | −} | |
| 1480 | − | |
| 1481 | −static ssize_t iwl_dbgfs_bcast_filters_macs_read(struct file *file, | |
| 1482 | − char __user *user_buf, | |
| 1483 | − size_t count, loff_t *ppos) | |
| 1484 | −{ | |
| 1485 | − struct iwl_mvm *mvm = file->private_data; | |
| 1486 | − struct iwl_bcast_filter_cmd cmd; | |
| 1487 | − char *buf; | |
| 1488 | − int bufsz = 1024; | |
| 1489 | − int i, pos = 0; | |
| 1490 | − ssize_t ret; | |
| 1491 | − | |
| 1492 | − buf = kzalloc(bufsz, GFP_KERNEL); | |
| 1493 | − if (!buf) | |
| 1494 | − return -ENOMEM; | |
| 1495 | − | |
| 1496 | − mutex_lock(&mvm->mutex); | |
| 1497 | − if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) { | |
| 1498 | − ADD_TEXT("None\n"); | |
| 1499 | − mutex_unlock(&mvm->mutex); | |
| 1500 | − goto out; | |
| 1501 | − } | |
| 1502 | − mutex_unlock(&mvm->mutex); | |
| 1503 | − | |
| 1504 | − for (i = 0; i < ARRAY_SIZE(cmd.macs); i++) { | |
| 1505 | − const struct iwl_fw_bcast_mac *mac = &cmd.macs[i]; | |
| 1506 | − | |
| 1507 | − ADD_TEXT("Mac [%d]: discard=%d attached_filters=0x%x\n", | |
| 1508 | − i, mac->default_discard, mac->attached_filters); | |
| 1509 | − } | |
| 1510 | −out: | |
| 1511 | − ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | |
| 1512 | − kfree(buf); | |
| 1513 | − return ret; | |
| 1514 | −} | |
| 1515 | − | |
| 1516 | −static ssize_t iwl_dbgfs_bcast_filters_macs_write(struct iwl_mvm *mvm, | |
| 1517 | − char *buf, size_t count, | |
| 1518 | − loff_t *ppos) | |
| 1519 | −{ | |
| 1520 | − struct iwl_bcast_filter_cmd cmd; | |
| 1521 | − struct iwl_fw_bcast_mac mac = {}; | |
| 1522 | − u32 mac_id, attached_filters; | |
| 1523 | − int err = 0; | |
| 1524 | − | |
| 1525 | − if (!mvm->bcast_filters) | |
| 1526 | − return -ENOENT; | |
| 1527 | − | |
| 1528 | − if (sscanf(buf, "%d %hhi %i", &mac_id, &mac.default_discard, | |
| 1529 | − &attached_filters) != 3) | |
| 1530 | − return -EINVAL; | |
| 1531 | − | |
| 1532 | − if (mac_id >= ARRAY_SIZE(cmd.macs) || | |
| 1533 | − mac.default_discard > 1 || | |
| 1534 | − attached_filters >= BIT(ARRAY_SIZE(cmd.filters))) | |
| 1535 | − return -EINVAL; | |
| 1536 | − | |
| 1537 | − mac.attached_filters = cpu_to_le16(attached_filters); | |
| 1538 | − | |
| 1539 | − mutex_lock(&mvm->mutex); | |
| 1540 | − memcpy(&mvm->dbgfs_bcast_filtering.cmd.macs[mac_id], | |
| 1541 | − &mac, sizeof(mac)); | |
| 1542 | − | |
| 1543 | − /* send updated bcast filtering configuration */ | |
| 1544 | − if (iwl_mvm_firmware_running(mvm) && | |
| 1545 | − mvm->dbgfs_bcast_filtering.override && | |
| 1546 | − iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | |
| 1547 | − err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, | |
| 1548 | − sizeof(cmd), &cmd); | |
| 1549 | − mutex_unlock(&mvm->mutex); | |
| 1550 | − | |
| 1551 | − return err ?: count; | |
| 1552 | −} | |
| 1553 | −#endif | |
| 1554 | − | |
| 1555 | 1372 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ |
| 1556 | 1373 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct iwl_mvm) |
| 1557 | 1374 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ |
| @@ -1881,11 +1698,6 @@ MVM_DEBUGFS_WRITE_FILE_OPS(inject_beacon_ie_restore, 512); · 323 unmodified lines | ||
| 1881 | 1698 | |
| 1882 | 1699 | MVM_DEBUGFS_READ_FILE_OPS(uapsd_noagg_bssids); |
| 1883 | 1700 | |
| 1884 | −#ifdef CONFIG_IWLWIFI_BCAST_FILTERING | |
| 1885 | −MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters, 256); | |
| 1886 | −MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters_macs, 256); | |
| 1887 | −#endif | |
| 1888 | − | |
| 1889 | 1701 | #ifdef CONFIG_ACPI |
| 1890 | 1702 | MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile); |
| 1891 | 1703 | #endif |
| @@ -2097,21 +1909,6 @@ void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) · 205 unmodified lines | ||
| 2097 | 1909 | |
| 2098 | 1910 | MVM_DEBUGFS_ADD_FILE(uapsd_noagg_bssids, mvm->debugfs_dir, S_IRUSR); |
| 2099 | 1911 | |
| 2100 | −#ifdef CONFIG_IWLWIFI_BCAST_FILTERING | |
| 2101 | − if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING) { | |
| 2102 | − bcast_dir = debugfs_create_dir("bcast_filtering", | |
| 2103 | − mvm->debugfs_dir); | |
| 2104 | − | |
| 2105 | − debugfs_create_bool("override", 0600, bcast_dir, | |
| 2106 | − &mvm->dbgfs_bcast_filtering.override); | |
| 2107 | − | |
| 2108 | − MVM_DEBUGFS_ADD_FILE_ALIAS("filters", bcast_filters, | |
| 2109 | − bcast_dir, 0600); | |
| 2110 | − MVM_DEBUGFS_ADD_FILE_ALIAS("macs", bcast_filters_macs, | |
| 2111 | − bcast_dir, 0600); | |
| 2112 | − } | |
| 2113 | −#endif | |
| 2114 | − | |
| 2115 | 1912 | #ifdef CONFIG_PM_SLEEP |
| 2116 | 1913 | MVM_DEBUGFS_ADD_FILE(d3_test, mvm->debugfs_dir, 0400); |
| 2117 | 1914 | debugfs_create_bool("d3_wake_sysassert", 0600, mvm->debugfs_dir, |
| @@ -1741,7 +1741,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm) · 1740 unmodified lines | ||
| 1741 | 1741 | ret = iwl_mvm_sar_init(mvm); |
| 1742 | 1742 | if (ret == 0) |
| 1743 | 1743 | ret = iwl_mvm_sar_geo_init(mvm); |
| 1744 | − else if (ret < 0) | |
| 1744 | + if (ret < 0) | |
| 1745 | 1745 | goto error; |
| 1746 | 1746 | |
| 1747 | 1747 | ret = iwl_mvm_sgom_init(mvm); |
| @@ -55,79 +55,6 @@ static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = { · 54 unmodified lines | ||
| 55 | 55 | }, |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | −#ifdef CONFIG_IWLWIFI_BCAST_FILTERING | |
| 59 | −/* | |
| 60 | − * Use the reserved field to indicate magic values. | |
| 61 | − * these values will only be used internally by the driver, | |
| 62 | − * and won't make it to the fw (reserved will be 0). | |
| 63 | − * BC_FILTER_MAGIC_IP - configure the val of this attribute to | |
| 64 | − * be the vif's ip address. in case there is not a single | |
| 65 | − * ip address (0, or more than 1), this attribute will | |
| 66 | − * be skipped. | |
| 67 | − * BC_FILTER_MAGIC_MAC - set the val of this attribute to | |
| 68 | − * the LSB bytes of the vif's mac address | |
| 69 | − */ | |
| 70 | −enum { | |
| 71 | − BC_FILTER_MAGIC_NONE = 0, | |
| 72 | − BC_FILTER_MAGIC_IP, | |
| 73 | − BC_FILTER_MAGIC_MAC, | |
| 74 | −}; | |
| 75 | − | |
| 76 | −static const struct iwl_fw_bcast_filter iwl_mvm_default_bcast_filters[] = { | |
| 77 | − { | |
| 78 | − /* arp */ | |
| 79 | − .discard = 0, | |
| 80 | − .frame_type = BCAST_FILTER_FRAME_TYPE_ALL, | |
| 81 | − .attrs = { | |
| 82 | − { | |
| 83 | − /* frame type - arp, hw type - ethernet */ | |
| 84 | − .offset_type = | |
| 85 | − BCAST_FILTER_OFFSET_PAYLOAD_START, | |
| 86 | − .offset = sizeof(rfc1042_header), | |
| 87 | − .val = cpu_to_be32(0x08060001), | |
| 88 | − .mask = cpu_to_be32(0xffffffff), | |
| 89 | − }, | |
| 90 | − { | |
| 91 | − /* arp dest ip */ | |
| 92 | − .offset_type = | |
| 93 | − BCAST_FILTER_OFFSET_PAYLOAD_START, | |
| 94 | − .offset = sizeof(rfc1042_header) + 2 + | |
| 95 | − sizeof(struct arphdr) + | |
| 96 | − ETH_ALEN + sizeof(__be32) + | |
| 97 | − ETH_ALEN, | |
| 98 | − .mask = cpu_to_be32(0xffffffff), | |
| 99 | − /* mark it as special field */ | |
| 100 | − .reserved1 = cpu_to_le16(BC_FILTER_MAGIC_IP), | |
| 101 | − }, | |
| 102 | − }, | |
| 103 | − }, | |
| 104 | − { | |
| 105 | − /* dhcp offer bcast */ | |
| 106 | − .discard = 0, | |
| 107 | − .frame_type = BCAST_FILTER_FRAME_TYPE_IPV4, | |
| 108 | − .attrs = { | |
| 109 | − { | |
| 110 | − /* udp dest port - 68 (bootp client)*/ | |
| 111 | − .offset_type = BCAST_FILTER_OFFSET_IP_END, | |
| 112 | − .offset = offsetof(struct udphdr, dest), | |
| 113 | − .val = cpu_to_be32(0x00440000), | |
| 114 | − .mask = cpu_to_be32(0xffff0000), | |
| 115 | − }, | |
| 116 | − { | |
| 117 | − /* dhcp - lsb bytes of client hw address */ | |
| 118 | − .offset_type = BCAST_FILTER_OFFSET_IP_END, | |
| 119 | − .offset = 38, | |
| 120 | − .mask = cpu_to_be32(0xffffffff), | |
| 121 | − /* mark it as special field */ | |
| 122 | − .reserved1 = cpu_to_le16(BC_FILTER_MAGIC_MAC), | |
| 123 | − }, | |
| 124 | − }, | |
| 125 | − }, | |
| 126 | − /* last filter must be empty */ | |
| 127 | − {}, | |
| 128 | −}; | |
| 129 | −#endif | |
| 130 | − | |
| 131 | 58 | static const struct cfg80211_pmsr_capabilities iwl_mvm_pmsr_capa = { |
| 132 | 59 | .max_peers = IWL_MVM_TOF_MAX_APS, |
| 133 | 60 | .report_ap_tsf = 1, |
| @@ -693,11 +620,6 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) · 559 unmodified lines | ||
| 693 | 620 | } |
| 694 | 621 | #endif |
| 695 | 622 | |
| 696 | −#ifdef CONFIG_IWLWIFI_BCAST_FILTERING | |
| 697 | − /* assign default bcast filtering configuration */ | |
| 698 | − mvm->bcast_filters = iwl_mvm_default_bcast_filters; | |
| 699 | −#endif | |
| 700 | − | |
| 701 | 623 | ret = iwl_mvm_leds_init(mvm); |
| 702 | 624 | if (ret) |
| 703 | 625 | return ret; |
| @@ -1853,162 +1775,6 @@ static void iwl_mvm_config_iface_filter(struct ieee80211_hw *hw, · 1149 unmodified lines | ||
| 1853 | 1775 | mutex_unlock(&mvm->mutex); |
| 1854 | 1776 | } |
| 1855 | 1777 | |
| 1856 | −#ifdef CONFIG_IWLWIFI_BCAST_FILTERING | |
| 1857 | −struct iwl_bcast_iter_data { | |
| 1858 | − struct iwl_mvm *mvm; | |
| 1859 | − struct iwl_bcast_filter_cmd *cmd; | |
| 1860 | − u8 current_filter; | |
| 1861 | −}; | |
| 1862 | − | |
| 1863 | −static void | |
| 1864 | −iwl_mvm_set_bcast_filter(struct ieee80211_vif *vif, | |
| 1865 | − const struct iwl_fw_bcast_filter *in_filter, | |
| 1866 | − struct iwl_fw_bcast_filter *out_filter) | |
| 1867 | −{ | |
| 1868 | − struct iwl_fw_bcast_filter_attr *attr; | |
| 1869 | − int i; | |
| 1870 | − | |
| 1871 | − memcpy(out_filter, in_filter, sizeof(*out_filter)); | |
| 1872 | − | |
| 1873 | − for (i = 0; i < ARRAY_SIZE(out_filter->attrs); i++) { | |
| 1874 | − attr = &out_filter->attrs[i]; | |
| 1875 | − | |
| 1876 | − if (!attr->mask) | |
| 1877 | − break; | |
| 1878 | − | |
| 1879 | − switch (attr->reserved1) { | |
| 1880 | − case cpu_to_le16(BC_FILTER_MAGIC_IP): | |
| 1881 | − if (vif->bss_conf.arp_addr_cnt != 1) { | |
| 1882 | − attr->mask = 0; | |
| 1883 | − continue; | |
| 1884 | − } | |
| 1885 | − | |
| 1886 | − attr->val = vif->bss_conf.arp_addr_list[0]; | |
| 1887 | − break; | |
| 1888 | − case cpu_to_le16(BC_FILTER_MAGIC_MAC): | |
| 1889 | − attr->val = *(__be32 *)&vif->addr[2]; | |
| 1890 | − break; | |
| 1891 | − default: | |
| 1892 | − break; | |
| 1893 | − } | |
| 1894 | − attr->reserved1 = 0; | |
| 1895 | − out_filter->num_attrs++; | |
| 1896 | − } | |
| 1897 | −} | |
| 1898 | − | |
| 1899 | −static void iwl_mvm_bcast_filter_iterator(void *_data, u8 *mac, | |
| 1900 | − struct ieee80211_vif *vif) | |
| 1901 | −{ | |
| 1902 | − struct iwl_bcast_iter_data *data = _data; | |
| 1903 | − struct iwl_mvm *mvm = data->mvm; | |
| 1904 | − struct iwl_bcast_filter_cmd *cmd = data->cmd; | |
| 1905 | − struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
| 1906 | − struct iwl_fw_bcast_mac *bcast_mac; | |
| 1907 | − int i; | |
| 1908 | − | |
| 1909 | − if (WARN_ON(mvmvif->id >= ARRAY_SIZE(cmd->macs))) | |
| 1910 | − return; | |
| 1911 | − | |
| 1912 | − bcast_mac = &cmd->macs[mvmvif->id]; | |
| 1913 | − | |
| 1914 | − /* | |
| 1915 | − * enable filtering only for associated stations, but not for P2P | |
| 1916 | − * Clients | |
| 1917 | − */ | |
| 1918 | − if (vif->type != NL80211_IFTYPE_STATION || vif->p2p || | |
| 1919 | − !vif->bss_conf.assoc) | |
| 1920 | − return; | |
| 1921 | − | |
| 1922 | − bcast_mac->default_discard = 1; | |
| 1923 | − | |
| 1924 | − /* copy all configured filters */ | |
| 1925 | − for (i = 0; mvm->bcast_filters[i].attrs[0].mask; i++) { | |
| 1926 | − /* | |
| 1927 | − * Make sure we don't exceed our filters limit. | |
| 1928 | − * if there is still a valid filter to be configured, | |
| 1929 | − * be on the safe side and just allow bcast for this mac. | |
| 1930 | − */ | |
| 1931 | − if (WARN_ON_ONCE(data->current_filter >= | |
| 1932 | − ARRAY_SIZE(cmd->filters))) { | |
| 1933 | − bcast_mac->default_discard = 0; | |
| 1934 | − bcast_mac->attached_filters = 0; | |
| 1935 | − break; | |
| 1936 | − } | |
| 1937 | − | |
| 1938 | − iwl_mvm_set_bcast_filter(vif, | |
| 1939 | − &mvm->bcast_filters[i], | |
| 1940 | − &cmd->filters[data->current_filter]); | |
| 1941 | − | |
| 1942 | − /* skip current filter if it contains no attributes */ | |
| 1943 | − if (!cmd->filters[data->current_filter].num_attrs) | |
| 1944 | − continue; | |
| 1945 | − | |
| 1946 | − /* attach the filter to current mac */ | |
| 1947 | − bcast_mac->attached_filters |= | |
| 1948 | − cpu_to_le16(BIT(data->current_filter)); | |
| 1949 | − | |
| 1950 | − data->current_filter++; | |
| 1951 | − } | |
| 1952 | −} | |
| 1953 | − | |
| 1954 | −bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm, | |
| 1955 | − struct iwl_bcast_filter_cmd *cmd) | |
| 1956 | −{ | |
| 1957 | − struct iwl_bcast_iter_data iter_data = { | |
| 1958 | − .mvm = mvm, | |
| 1959 | − .cmd = cmd, | |
| 1960 | − }; | |
| 1961 | − | |
| 1962 | − if (IWL_MVM_FW_BCAST_FILTER_PASS_ALL) | |
| 1963 | − return false; | |
| 1964 | − | |
| 1965 | − memset(cmd, 0, sizeof(*cmd)); | |
| 1966 | − cmd->max_bcast_filters = ARRAY_SIZE(cmd->filters); | |
| 1967 | − cmd->max_macs = ARRAY_SIZE(cmd->macs); | |
| 1968 | − | |
| 1969 | −#ifdef CONFIG_IWLWIFI_DEBUGFS | |
| 1970 | − /* use debugfs filters/macs if override is configured */ | |
| 1971 | − if (mvm->dbgfs_bcast_filtering.override) { | |
| 1972 | − memcpy(cmd->filters, &mvm->dbgfs_bcast_filtering.cmd.filters, | |
| 1973 | − sizeof(cmd->filters)); | |
| 1974 | − memcpy(cmd->macs, &mvm->dbgfs_bcast_filtering.cmd.macs, | |
| 1975 | − sizeof(cmd->macs)); | |
| 1976 | − return true; | |
| 1977 | − } | |
| 1978 | −#endif | |
| 1979 | − | |
| 1980 | − /* if no filters are configured, do nothing */ | |
| 1981 | − if (!mvm->bcast_filters) | |
| 1982 | − return false; | |
| 1983 | − | |
| 1984 | − /* configure and attach these filters for each associated sta vif */ | |
| 1985 | − ieee80211_iterate_active_interfaces( | |
| 1986 | − mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | |
| 1987 | − iwl_mvm_bcast_filter_iterator, &iter_data); | |
| 1988 | − | |
| 1989 | − return true; | |
| 1990 | −} | |
| 1991 | − | |
| 1992 | −static int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm) | |
| 1993 | −{ | |
| 1994 | − struct iwl_bcast_filter_cmd cmd; | |
| 1995 | − | |
| 1996 | − if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING)) | |
| 1997 | − return 0; | |
| 1998 | − | |
| 1999 | − if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | |
| 2000 | − return 0; | |
| 2001 | − | |
| 2002 | − return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, | |
| 2003 | − sizeof(cmd), &cmd); | |
| 2004 | −} | |
| 2005 | −#else | |
| 2006 | −static inline int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm) | |
| 2007 | −{ | |
| 2008 | − return 0; | |
| 2009 | −} | |
| 2010 | −#endif | |
| 2011 | − | |
| 2012 | 1778 | static int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm, |
| 2013 | 1779 | struct ieee80211_vif *vif) |
| 2014 | 1780 | { |
| @@ -2520,7 +2286,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, · 505 unmodified lines | ||
| 2520 | 2286 | } |
| 2521 | 2287 | |
| 2522 | 2288 | iwl_mvm_recalc_multicast(mvm); |
| 2523 | − iwl_mvm_configure_bcast_filter(mvm); | |
| 2524 | 2289 | |
| 2525 | 2290 | /* reset rssi values */ |
| 2526 | 2291 | mvmvif->bf_data.ave_beacon_signal = 0; |
| @@ -2570,11 +2335,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, · 43 unmodified lines | ||
| 2570 | 2335 | } |
| 2571 | 2336 | } |
| 2572 | 2337 | |
| 2573 | − if (changes & BSS_CHANGED_ARP_FILTER) { | |
| 2574 | − IWL_DEBUG_MAC80211(mvm, "arp filter changed\n"); | |
| 2575 | − iwl_mvm_configure_bcast_filter(mvm); | |
| 2576 | − } | |
| 2577 | − | |
| 2578 | 2338 | if (changes & BSS_CHANGED_BANDWIDTH) |
| 2579 | 2339 | iwl_mvm_apply_fw_smps_request(vif); |
| 2580 | 2340 | } |
| @@ -884,17 +884,6 @@ struct iwl_mvm { · 883 unmodified lines | ||
| 884 | 884 | /* rx chain antennas set through debugfs for the scan command */ |
| 885 | 885 | u8 scan_rx_ant; |
| 886 | 886 | |
| 887 | −#ifdef CONFIG_IWLWIFI_BCAST_FILTERING | |
| 888 | − /* broadcast filters to configure for each associated station */ | |
| 889 | − const struct iwl_fw_bcast_filter *bcast_filters; | |
| 890 | −#ifdef CONFIG_IWLWIFI_DEBUGFS | |
| 891 | − struct { | |
| 892 | − bool override; | |
| 893 | − struct iwl_bcast_filter_cmd cmd; | |
| 894 | − } dbgfs_bcast_filtering; | |
| 895 | −#endif | |
| 896 | −#endif | |
| 897 | − | |
| 898 | 887 | /* Internal station */ |
| 899 | 888 | struct iwl_mvm_int_sta aux_sta; |
| 900 | 889 | struct iwl_mvm_int_sta snif_sta; |
| @@ -1593,8 +1582,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm); · 692 unmodified lines | ||
| 1593 | 1582 | int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm); |
| 1594 | 1583 | |
| 1595 | 1584 | int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm); |
| 1596 | −bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm, | |
| 1597 | − struct iwl_bcast_filter_cmd *cmd); | |
| 1598 | 1585 | |
| 1599 | 1586 | /* |
| 1600 | 1587 | * FW notifications / CMD responses handlers |
| @@ -2225,7 +2212,7 @@ static inline void iwl_mvm_mei_device_down(struct iwl_mvm *mvm) · 624 unmodified lines | ||
| 2225 | 2212 | static inline void iwl_mvm_mei_set_sw_rfkill_state(struct iwl_mvm *mvm) |
| 2226 | 2213 | { |
| 2227 | 2214 | bool sw_rfkill = |
| 2228 | − mvm->hw_registered ? rfkill_blocked(mvm->hw->wiphy->rfkill) : false; | |
| 2215 | + mvm->hw_registered ? rfkill_soft_blocked(mvm->hw->wiphy->rfkill) : false; | |
| 2229 | 2216 | |
| 2230 | 2217 | if (mvm->mei_registered) |
| 2231 | 2218 | iwl_mei_set_rfkill_state(iwl_mvm_is_radio_killed(mvm), |
| @@ -469,7 +469,6 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = { · 468 unmodified lines | ||
| 469 | 469 | HCMD_NAME(MCC_CHUB_UPDATE_CMD), |
| 470 | 470 | HCMD_NAME(MARKER_CMD), |
| 471 | 471 | HCMD_NAME(BT_PROFILE_NOTIFICATION), |
| 472 | − HCMD_NAME(BCAST_FILTER_CMD), | |
| 473 | 472 | HCMD_NAME(MCAST_FILTER_CMD), |
| 474 | 473 | HCMD_NAME(REPLY_SF_CFG_CMD), |
| 475 | 474 | HCMD_NAME(REPLY_BEACON_FILTERING_CMD), |
| @@ -1427,7 +1427,7 @@ static void iwl_mvm_hwrate_to_tx_status(const struct iwl_fw *fw, · 1426 unmodified lines | ||
| 1427 | 1427 | struct ieee80211_tx_rate *r = &info->status.rates[0]; |
| 1428 | 1428 | |
| 1429 | 1429 | if (iwl_fw_lookup_notif_ver(fw, LONG_GROUP, |
| 1430 | − TX_CMD, 0) > 6) | |
| 1430 | + TX_CMD, 0) <= 6) | |
| 1431 | 1431 | rate_n_flags = iwl_new_rate_from_v1(rate_n_flags); |
| 1432 | 1432 | |
| 1433 | 1433 | info->status.antenna = |
| @@ -385,8 +385,7 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, · 384 unmodified lines | ||
| 385 | 385 | /* This may fail if AMT took ownership of the device */ |
| 386 | 386 | if (iwl_pcie_prepare_card_hw(trans)) { |
| 387 | 387 | IWL_WARN(trans, "Exit HW not ready\n"); |
| 388 | − ret = -EIO; | |
| 389 | − goto out; | |
| 388 | + return -EIO; | |
| 390 | 389 | } |
| 391 | 390 | |
| 392 | 391 | iwl_enable_rfkill_int(trans); |
| @@ -1329,8 +1329,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, · 1328 unmodified lines | ||
| 1329 | 1329 | /* This may fail if AMT took ownership of the device */ |
| 1330 | 1330 | if (iwl_pcie_prepare_card_hw(trans)) { |
| 1331 | 1331 | IWL_WARN(trans, "Exit HW not ready\n"); |
| 1332 | − ret = -EIO; | |
| 1333 | − goto out; | |
| 1332 | + return -EIO; | |
| 1334 | 1333 | } |
| 1335 | 1334 | |
| 1336 | 1335 | iwl_enable_rfkill_int(trans); |
| @@ -2336,6 +2336,15 @@ static void hw_scan_work(struct work_struct *work) · 2335 unmodified lines | ||
| 2336 | 2336 | if (req->ie_len) |
| 2337 | 2337 | skb_put_data(probe, req->ie, req->ie_len); |
| 2338 | 2338 | |
| 2339 | + if (!ieee80211_tx_prepare_skb(hwsim->hw, | |
| 2340 | + hwsim->hw_scan_vif, | |
| 2341 | + probe, | |
| 2342 | + hwsim->tmp_chan->band, | |
| 2343 | + NULL)) { | |
| 2344 | + kfree_skb(probe); | |
| 2345 | + continue; | |
| 2346 | + } | |
| 2347 | + | |
| 2339 | 2348 | local_bh_disable(); |
| 2340 | 2349 | mac80211_hwsim_tx_frame(hwsim->hw, probe, |
| 2341 | 2350 | hwsim->tmp_chan); |
| @@ -3770,6 +3779,10 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, · 1428 unmodified lines | ||
| 3770 | 3779 | } |
| 3771 | 3780 | txi->flags |= IEEE80211_TX_STAT_ACK; |
| 3772 | 3781 | } |
| 3782 | + | |
| 3783 | + if (hwsim_flags & HWSIM_TX_CTL_NO_ACK) | |
| 3784 | + txi->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; | |
| 3785 | + | |
| 3773 | 3786 | ieee80211_tx_status_irqsafe(data2->hw, skb); |
| 3774 | 3787 | return 0; |
| 3775 | 3788 | out: |
| @@ -256,6 +256,7 @@ static void backend_disconnect(struct backend_info *be) · 255 unmodified lines | ||
| 256 | 256 | unsigned int queue_index; |
| 257 | 257 | |
| 258 | 258 | xen_unregister_watchers(vif); |
| 259 | + xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status"); | |
| 259 | 260 | #ifdef CONFIG_DEBUG_FS |
| 260 | 261 | xenvif_debugfs_delif(vif); |
| 261 | 262 | #endif /* CONFIG_DEBUG_FS */ |
| @@ -675,7 +676,6 @@ static void hotplug_status_changed(struct xenbus_watch *watch, · 413 unmodified lines | ||
| 675 | 676 | |
| 676 | 677 | /* Not interested in this watch anymore. */ |
| 677 | 678 | unregister_hotplug_status_watch(be); |
| 678 | − xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status"); | |
| 679 | 679 | } |
| 680 | 680 | kfree(str); |
| 681 | 681 | } |
| @@ -824,15 +824,11 @@ static void connect(struct backend_info *be) · 142 unmodified lines | ||
| 824 | 824 | xenvif_carrier_on(be->vif); |
| 825 | 825 | |
| 826 | 826 | unregister_hotplug_status_watch(be); |
| 827 | − if (xenbus_exists(XBT_NIL, dev->nodename, "hotplug-status")) { | |
| 828 | − err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, | |
| 829 | − NULL, hotplug_status_changed, | |
| 830 | − "%s/%s", dev->nodename, | |
| 831 | − "hotplug-status"); | |
| 832 | − if (err) | |
| 833 | − goto err; | |
| 827 | + err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL, | |
| 828 | + hotplug_status_changed, | |
| 829 | + "%s/%s", dev->nodename, "hotplug-status"); | |
| 830 | + if (!err) | |
| 834 | 831 | be->have_hotplug_status_watch = 1; |
| 835 | − } | |
| 836 | 832 | |
| 837 | 833 | netif_tx_wake_all_queues(be->vif->dev); |
| 838 | 834 | |
| @@ -1723,7 +1723,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 1722 unmodified lines | ||
| 1723 | 1723 | return 0; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | −static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) | |
| 1726 | +static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) | |
| 1727 | 1727 | { |
| 1728 | 1728 | struct nvme_ctrl *ctrl = ns->ctrl; |
| 1729 | 1729 | |
| @@ -1739,7 +1739,8 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 9 unmodified lines | ||
| 1739 | 1739 | |
| 1740 | 1740 | ns->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS); |
| 1741 | 1741 | if (!ns->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) |
| 1742 | − return 0; | |
| 1742 | + return; | |
| 1743 | + | |
| 1743 | 1744 | if (ctrl->ops->flags & NVME_F_FABRICS) { |
| 1744 | 1745 | /* |
| 1745 | 1746 | * The NVMe over Fabrics specification only supports metadata as |
| @@ -1747,7 +1748,7 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 1 unmodified line | ||
| 1747 | 1748 | * remap the separate metadata buffer from the block layer. |
| 1748 | 1749 | */ |
| 1749 | 1750 | if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT))) |
| 1750 | − return -EINVAL; | |
| 1751 | + return; | |
| 1751 | 1752 | |
| 1752 | 1753 | ns->features |= NVME_NS_EXT_LBAS; |
| 1753 | 1754 | |
| @@ -1774,8 +1775,6 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 20 unmodified lines | ||
| 1774 | 1775 | else |
| 1775 | 1776 | ns->features |= NVME_NS_METADATA_SUPPORTED; |
| 1776 | 1777 | } |
| 1777 | − | |
| 1778 | − return 0; | |
| 1779 | 1778 | } |
| 1780 | 1779 | |
| 1781 | 1780 | static void nvme_set_queue_limits(struct nvme_ctrl *ctrl, |
| @@ -1916,9 +1915,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · 134 unmodified lines | ||
| 1916 | 1915 | ns->lba_shift = id->lbaf[lbaf].ds; |
| 1917 | 1916 | nvme_set_queue_limits(ns->ctrl, ns->queue); |
| 1918 | 1917 | |
| 1919 | − ret = nvme_configure_metadata(ns, id); | |
| 1920 | − if (ret) | |
| 1921 | − goto out_unfreeze; | |
| 1918 | + nvme_configure_metadata(ns, id); | |
| 1922 | 1919 | nvme_set_chunk_sectors(ns, id); |
| 1923 | 1920 | nvme_update_disk_info(ns->disk, ns, id); |
| 1924 | 1921 | |
| @@ -1934,7 +1931,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · 9 unmodified lines | ||
| 1934 | 1931 | if (blk_queue_is_zoned(ns->queue)) { |
| 1935 | 1932 | ret = nvme_revalidate_zones(ns); |
| 1936 | 1933 | if (ret && !nvme_first_scan(ns->disk)) |
| 1937 | − goto out; | |
| 1934 | + return ret; | |
| 1938 | 1935 | } |
| 1939 | 1936 | |
| 1940 | 1937 | if (nvme_ns_head_multipath(ns->head)) { |
| @@ -1949,16 +1946,16 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · 8 unmodified lines | ||
| 1949 | 1946 | return 0; |
| 1950 | 1947 | |
| 1951 | 1948 | out_unfreeze: |
| 1952 | − blk_mq_unfreeze_queue(ns->disk->queue); | |
| 1953 | −out: | |
| 1954 | 1949 | /* |
| 1955 | 1950 | * If probing fails due an unsupported feature, hide the block device, |
| 1956 | 1951 | * but still allow other access. |
| 1957 | 1952 | */ |
| 1958 | 1953 | if (ret == -ENODEV) { |
| 1959 | 1954 | ns->disk->flags |= GENHD_FL_HIDDEN; |
| 1955 | + set_bit(NVME_NS_READY, &ns->flags); | |
| 1960 | 1956 | ret = 0; |
| 1961 | 1957 | } |
| 1958 | + blk_mq_unfreeze_queue(ns->disk->queue); | |
| 1962 | 1959 | return ret; |
| 1963 | 1960 | } |
| 1964 | 1961 | |
| @@ -4574,7 +4571,7 @@ static void nvme_set_queue_dying(struct nvme_ns *ns) · 2609 unmodified lines | ||
| 4574 | 4571 | if (test_and_set_bit(NVME_NS_DEAD, &ns->flags)) |
| 4575 | 4572 | return; |
| 4576 | 4573 | |
| 4577 | − blk_set_queue_dying(ns->queue); | |
| 4574 | + blk_mark_disk_dead(ns->disk); | |
| 4578 | 4575 | nvme_start_ns_queue(ns); |
| 4579 | 4576 | |
| 4580 | 4577 | set_capacity_and_notify(ns->disk, 0); |
| @@ -848,7 +848,7 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head) · 847 unmodified lines | ||
| 848 | 848 | { |
| 849 | 849 | if (!head->disk) |
| 850 | 850 | return; |
| 851 | − blk_set_queue_dying(head->disk->queue); | |
| 851 | + blk_mark_disk_dead(head->disk); | |
| 852 | 852 | /* make sure all pending bios are cleaned up */ |
| 853 | 853 | kblockd_schedule_work(&head->requeue_work); |
| 854 | 854 | flush_work(&head->requeue_work); |
| @@ -44,6 +44,8 @@ struct nvme_tcp_request { · 43 unmodified lines | ||
| 44 | 44 | u32 data_len; |
| 45 | 45 | u32 pdu_len; |
| 46 | 46 | u32 pdu_sent; |
| 47 | + u32 h2cdata_left; | |
| 48 | + u32 h2cdata_offset; | |
| 47 | 49 | u16 ttag; |
| 48 | 50 | __le16 status; |
| 49 | 51 | struct list_head entry; |
| @@ -95,6 +97,7 @@ struct nvme_tcp_queue { · 45 unmodified lines | ||
| 95 | 97 | struct nvme_tcp_request *request; |
| 96 | 98 | |
| 97 | 99 | int queue_size; |
| 100 | + u32 maxh2cdata; | |
| 98 | 101 | size_t cmnd_capsule_len; |
| 99 | 102 | struct nvme_tcp_ctrl *ctrl; |
| 100 | 103 | unsigned long flags; |
| @@ -572,23 +575,26 @@ static int nvme_tcp_handle_comp(struct nvme_tcp_queue *queue, · 471 unmodified lines | ||
| 572 | 575 | return ret; |
| 573 | 576 | } |
| 574 | 577 | |
| 575 | −static void nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, | |
| 576 | − struct nvme_tcp_r2t_pdu *pdu) | |
| 578 | +static void nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req) | |
| 577 | 579 | { |
| 578 | 580 | struct nvme_tcp_data_pdu *data = req->pdu; |
| 579 | 581 | struct nvme_tcp_queue *queue = req->queue; |
| 580 | 582 | struct request *rq = blk_mq_rq_from_pdu(req); |
| 583 | + u32 h2cdata_sent = req->pdu_len; | |
| 581 | 584 | u8 hdgst = nvme_tcp_hdgst_len(queue); |
| 582 | 585 | u8 ddgst = nvme_tcp_ddgst_len(queue); |
| 583 | 586 | |
| 584 | 587 | req->state = NVME_TCP_SEND_H2C_PDU; |
| 585 | 588 | req->offset = 0; |
| 586 | − req->pdu_len = le32_to_cpu(pdu->r2t_length); | |
| 589 | + req->pdu_len = min(req->h2cdata_left, queue->maxh2cdata); | |
| 587 | 590 | req->pdu_sent = 0; |
| 591 | + req->h2cdata_left -= req->pdu_len; | |
| 592 | + req->h2cdata_offset += h2cdata_sent; | |
| 588 | 593 | |
| 589 | 594 | memset(data, 0, sizeof(*data)); |
| 590 | 595 | data->hdr.type = nvme_tcp_h2c_data; |
| 591 | − data->hdr.flags = NVME_TCP_F_DATA_LAST; | |
| 596 | + if (!req->h2cdata_left) | |
| 597 | + data->hdr.flags = NVME_TCP_F_DATA_LAST; | |
| 592 | 598 | if (queue->hdr_digest) |
| 593 | 599 | data->hdr.flags |= NVME_TCP_F_HDGST; |
| 594 | 600 | if (queue->data_digest) |
| @@ -597,9 +603,9 @@ static void nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, · 2 unmodified lines | ||
| 597 | 603 | data->hdr.pdo = data->hdr.hlen + hdgst; |
| 598 | 604 | data->hdr.plen = |
| 599 | 605 | cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst); |
| 600 | − data->ttag = pdu->ttag; | |
| 606 | + data->ttag = req->ttag; | |
| 601 | 607 | data->command_id = nvme_cid(rq); |
| 602 | − data->data_offset = pdu->r2t_offset; | |
| 608 | + data->data_offset = cpu_to_le32(req->h2cdata_offset); | |
| 603 | 609 | data->data_length = cpu_to_le32(req->pdu_len); |
| 604 | 610 | } |
| 605 | 611 | |
| @@ -609,6 +615,7 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, · 3 unmodified lines | ||
| 609 | 615 | struct nvme_tcp_request *req; |
| 610 | 616 | struct request *rq; |
| 611 | 617 | u32 r2t_length = le32_to_cpu(pdu->r2t_length); |
| 618 | + u32 r2t_offset = le32_to_cpu(pdu->r2t_offset); | |
| 612 | 619 | |
| 613 | 620 | rq = nvme_find_rq(nvme_tcp_tagset(queue), pdu->command_id); |
| 614 | 621 | if (!rq) { |
| @@ -633,14 +640,19 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, · 18 unmodified lines | ||
| 633 | 640 | return -EPROTO; |
| 634 | 641 | } |
| 635 | 642 | |
| 636 | − if (unlikely(le32_to_cpu(pdu->r2t_offset) < req->data_sent)) { | |
| 643 | + if (unlikely(r2t_offset < req->data_sent)) { | |
| 637 | 644 | dev_err(queue->ctrl->ctrl.device, |
| 638 | 645 | "req %d unexpected r2t offset %u (expected %zu)\n", |
| 639 | − rq->tag, le32_to_cpu(pdu->r2t_offset), req->data_sent); | |
| 646 | + rq->tag, r2t_offset, req->data_sent); | |
| 640 | 647 | return -EPROTO; |
| 641 | 648 | } |
| 642 | 649 | |
| 643 | − nvme_tcp_setup_h2c_data_pdu(req, pdu); | |
| 650 | + req->pdu_len = 0; | |
| 651 | + req->h2cdata_left = r2t_length; | |
| 652 | + req->h2cdata_offset = r2t_offset; | |
| 653 | + req->ttag = pdu->ttag; | |
| 654 | + | |
| 655 | + nvme_tcp_setup_h2c_data_pdu(req); | |
| 644 | 656 | nvme_tcp_queue_request(req, false, true); |
| 645 | 657 | |
| 646 | 658 | return 0; |
| @@ -928,6 +940,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) · 281 unmodified lines | ||
| 928 | 940 | { |
| 929 | 941 | struct nvme_tcp_queue *queue = req->queue; |
| 930 | 942 | int req_data_len = req->data_len; |
| 943 | + u32 h2cdata_left = req->h2cdata_left; | |
| 931 | 944 | |
| 932 | 945 | while (true) { |
| 933 | 946 | struct page *page = nvme_tcp_req_cur_page(req); |
| @@ -972,7 +985,10 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) · 38 unmodified lines | ||
| 972 | 985 | req->state = NVME_TCP_SEND_DDGST; |
| 973 | 986 | req->offset = 0; |
| 974 | 987 | } else { |
| 975 | − nvme_tcp_done_send_req(queue); | |
| 988 | + if (h2cdata_left) | |
| 989 | + nvme_tcp_setup_h2c_data_pdu(req); | |
| 990 | + else | |
| 991 | + nvme_tcp_done_send_req(queue); | |
| 976 | 992 | } |
| 977 | 993 | return 1; |
| 978 | 994 | } |
| @@ -1030,9 +1046,14 @@ static int nvme_tcp_try_send_data_pdu(struct nvme_tcp_request *req) · 51 unmodified lines | ||
| 1030 | 1046 | if (queue->hdr_digest && !req->offset) |
| 1031 | 1047 | nvme_tcp_hdgst(queue->snd_hash, pdu, sizeof(*pdu)); |
| 1032 | 1048 | |
| 1033 | − ret = kernel_sendpage(queue->sock, virt_to_page(pdu), | |
| 1034 | − offset_in_page(pdu) + req->offset, len, | |
| 1035 | − MSG_DONTWAIT | MSG_MORE | MSG_SENDPAGE_NOTLAST); | |
| 1049 | + if (!req->h2cdata_left) | |
| 1050 | + ret = kernel_sendpage(queue->sock, virt_to_page(pdu), | |
| 1051 | + offset_in_page(pdu) + req->offset, len, | |
| 1052 | + MSG_DONTWAIT | MSG_MORE | MSG_SENDPAGE_NOTLAST); | |
| 1053 | + else | |
| 1054 | + ret = sock_no_sendpage(queue->sock, virt_to_page(pdu), | |
| 1055 | + offset_in_page(pdu) + req->offset, len, | |
| 1056 | + MSG_DONTWAIT | MSG_MORE); | |
| 1036 | 1057 | if (unlikely(ret <= 0)) |
| 1037 | 1058 | return ret; |
| 1038 | 1059 | |
| @@ -1052,6 +1073,7 @@ static int nvme_tcp_try_send_ddgst(struct nvme_tcp_request *req) · 13 unmodified lines | ||
| 1052 | 1073 | { |
| 1053 | 1074 | struct nvme_tcp_queue *queue = req->queue; |
| 1054 | 1075 | size_t offset = req->offset; |
| 1076 | + u32 h2cdata_left = req->h2cdata_left; | |
| 1055 | 1077 | int ret; |
| 1056 | 1078 | struct msghdr msg = { .msg_flags = MSG_DONTWAIT }; |
| 1057 | 1079 | struct kvec iov = { |
| @@ -1069,7 +1091,10 @@ static int nvme_tcp_try_send_ddgst(struct nvme_tcp_request *req) · 11 unmodified lines | ||
| 1069 | 1091 | return ret; |
| 1070 | 1092 | |
| 1071 | 1093 | if (offset + ret == NVME_TCP_DIGEST_LENGTH) { |
| 1072 | − nvme_tcp_done_send_req(queue); | |
| 1094 | + if (h2cdata_left) | |
| 1095 | + nvme_tcp_setup_h2c_data_pdu(req); | |
| 1096 | + else | |
| 1097 | + nvme_tcp_done_send_req(queue); | |
| 1073 | 1098 | return 1; |
| 1074 | 1099 | } |
| 1075 | 1100 | |
| @@ -1261,6 +1286,7 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) · 185 unmodified lines | ||
| 1261 | 1286 | struct msghdr msg = {}; |
| 1262 | 1287 | struct kvec iov; |
| 1263 | 1288 | bool ctrl_hdgst, ctrl_ddgst; |
| 1289 | + u32 maxh2cdata; | |
| 1264 | 1290 | int ret; |
| 1265 | 1291 | |
| 1266 | 1292 | icreq = kzalloc(sizeof(*icreq), GFP_KERNEL); |
| @@ -1344,6 +1370,14 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) · 77 unmodified lines | ||
| 1344 | 1370 | goto free_icresp; |
| 1345 | 1371 | } |
| 1346 | 1372 | |
| 1373 | + maxh2cdata = le32_to_cpu(icresp->maxdata); | |
| 1374 | + if ((maxh2cdata % 4) || (maxh2cdata < NVME_TCP_MIN_MAXH2CDATA)) { | |
| 1375 | + pr_err("queue %d: invalid maxh2cdata returned %u\n", | |
| 1376 | + nvme_tcp_queue_id(queue), maxh2cdata); | |
| 1377 | + goto free_icresp; | |
| 1378 | + } | |
| 1379 | + queue->maxh2cdata = maxh2cdata; | |
| 1380 | + | |
| 1347 | 1381 | ret = 0; |
| 1348 | 1382 | free_icresp: |
| 1349 | 1383 | kfree(icresp); |
| @@ -2329,6 +2363,7 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns, · 979 unmodified lines | ||
| 2329 | 2363 | req->data_sent = 0; |
| 2330 | 2364 | req->pdu_len = 0; |
| 2331 | 2365 | req->pdu_sent = 0; |
| 2366 | + req->h2cdata_left = 0; | |
| 2332 | 2367 | req->data_len = blk_rq_nr_phys_segments(rq) ? |
| 2333 | 2368 | blk_rq_payload_bytes(rq) : 0; |
| 2334 | 2369 | req->curr_bio = rq->bio; |
| @@ -771,7 +771,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) · 770 unmodified lines | ||
| 771 | 771 | |
| 772 | 772 | if (config->wp_gpio) |
| 773 | 773 | nvmem->wp_gpio = config->wp_gpio; |
| 774 | − else | |
| 774 | + else if (!config->ignore_wp) | |
| 775 | 775 | nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp", |
| 776 | 776 | GPIOD_OUT_HIGH); |
| 777 | 777 | if (IS_ERR(nvmem->wp_gpio)) { |
| @@ -648,8 +648,8 @@ void __init early_init_fdt_scan_reserved_mem(void) · 647 unmodified lines | ||
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | fdt_scan_reserved_mem(); |
| 651 | − fdt_init_reserved_mem(); | |
| 652 | 651 | fdt_reserve_elfcorehdr(); |
| 652 | + fdt_init_reserved_mem(); | |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | /** |
| @@ -513,24 +513,24 @@ static void __init of_unittest_parse_phandle_with_args(void) · 512 unmodified lines | ||
| 513 | 513 | memset(&args, 0, sizeof(args)); |
| 514 | 514 | |
| 515 | 515 | EXPECT_BEGIN(KERN_INFO, |
| 516 | − "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); | |
| 516 | + "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); | |
| 517 | 517 | |
| 518 | 518 | rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", |
| 519 | 519 | "#phandle-cells", 1, &args); |
| 520 | 520 | |
| 521 | 521 | EXPECT_END(KERN_INFO, |
| 522 | − "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); | |
| 522 | + "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); | |
| 523 | 523 | |
| 524 | 524 | unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); |
| 525 | 525 | |
| 526 | 526 | EXPECT_BEGIN(KERN_INFO, |
| 527 | − "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); | |
| 527 | + "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); | |
| 528 | 528 | |
| 529 | 529 | rc = of_count_phandle_with_args(np, "phandle-list-bad-args", |
| 530 | 530 | "#phandle-cells"); |
| 531 | 531 | |
| 532 | 532 | EXPECT_END(KERN_INFO, |
| 533 | − "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); | |
| 533 | + "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); | |
| 534 | 534 | |
| 535 | 535 | unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); |
| 536 | 536 | } |
| @@ -670,12 +670,12 @@ static void __init of_unittest_parse_phandle_with_args_map(void) · 133 unmodified lines | ||
| 670 | 670 | memset(&args, 0, sizeof(args)); |
| 671 | 671 | |
| 672 | 672 | EXPECT_BEGIN(KERN_INFO, |
| 673 | − "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1"); | |
| 673 | + "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); | |
| 674 | 674 | |
| 675 | 675 | rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", |
| 676 | 676 | "phandle", 1, &args); |
| 677 | 677 | EXPECT_END(KERN_INFO, |
| 678 | − "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1"); | |
| 678 | + "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); | |
| 679 | 679 | |
| 680 | 680 | unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); |
| 681 | 681 | } |
| @@ -1257,12 +1257,12 @@ static void __init of_unittest_platform_populate(void) · 575 unmodified lines | ||
| 1257 | 1257 | unittest(pdev, "device 2 creation failed\n"); |
| 1258 | 1258 | |
| 1259 | 1259 | EXPECT_BEGIN(KERN_INFO, |
| 1260 | − "platform testcase-data:testcase-device2: IRQ index 0 not found"); | |
| 1260 | + "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); | |
| 1261 | 1261 | |
| 1262 | 1262 | irq = platform_get_irq(pdev, 0); |
| 1263 | 1263 | |
| 1264 | 1264 | EXPECT_END(KERN_INFO, |
| 1265 | − "platform testcase-data:testcase-device2: IRQ index 0 not found"); | |
| 1265 | + "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); | |
| 1266 | 1266 | |
| 1267 | 1267 | unittest(irq < 0 && irq != -EPROBE_DEFER, |
| 1268 | 1268 | "device parsing error failed - %d\n", irq); |
| @@ -1003,7 +1003,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 1002 unmodified lines | ||
| 1003 | 1003 | ioc->usg_calls++; |
| 1004 | 1004 | #endif |
| 1005 | 1005 | |
| 1006 | − while(sg_dma_len(sglist) && nents--) { | |
| 1006 | + while (nents && sg_dma_len(sglist)) { | |
| 1007 | 1007 | |
| 1008 | 1008 | #ifdef CCIO_COLLECT_STATS |
| 1009 | 1009 | ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; |
| @@ -1011,6 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 1 unmodified line | ||
| 1011 | 1011 | ccio_unmap_page(dev, sg_dma_address(sglist), |
| 1012 | 1012 | sg_dma_len(sglist), direction, 0); |
| 1013 | 1013 | ++sglist; |
| 1014 | + nents--; | |
| 1014 | 1015 | } |
| 1015 | 1016 | |
| 1016 | 1017 | DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
| @@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 1046 unmodified lines | ||
| 1047 | 1047 | spin_unlock_irqrestore(&ioc->res_lock, flags); |
| 1048 | 1048 | #endif |
| 1049 | 1049 | |
| 1050 | − while (sg_dma_len(sglist) && nents--) { | |
| 1050 | + while (nents && sg_dma_len(sglist)) { | |
| 1051 | 1051 | |
| 1052 | 1052 | sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist), |
| 1053 | 1053 | direction, 0); |
| @@ -1056,6 +1056,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 2 unmodified lines | ||
| 1056 | 1056 | ioc->usingle_calls--; /* kluge since call is unmap_sg() */ |
| 1057 | 1057 | #endif |
| 1058 | 1058 | ++sglist; |
| 1059 | + nents--; | |
| 1059 | 1060 | } |
| 1060 | 1061 | |
| 1061 | 1062 | DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
| @@ -2155,8 +2155,17 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) · 2154 unmodified lines | ||
| 2155 | 2155 | if (!hv_dev) |
| 2156 | 2156 | continue; |
| 2157 | 2157 | |
| 2158 | − if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY) | |
| 2159 | − set_dev_node(&dev->dev, hv_dev->desc.virtual_numa_node); | |
| 2158 | + if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY && | |
| 2159 | + hv_dev->desc.virtual_numa_node < num_possible_nodes()) | |
| 2160 | + /* | |
| 2161 | + * The kernel may boot with some NUMA nodes offline | |
| 2162 | + * (e.g. in a KDUMP kernel) or with NUMA disabled via | |
| 2163 | + * "numa=off". In those cases, adjust the host provided | |
| 2164 | + * NUMA node to a valid NUMA node used by the kernel. | |
| 2165 | + */ | |
| 2166 | + set_dev_node(&dev->dev, | |
| 2167 | + numa_map_to_online_node( | |
| 2168 | + hv_dev->desc.virtual_numa_node)); | |
| 2160 | 2169 | |
| 2161 | 2170 | put_pcichild(hv_dev); |
| 2162 | 2171 | } |
| @@ -1329,7 +1329,8 @@ static int mvebu_pcie_probe(struct platform_device *pdev) · 1328 unmodified lines | ||
| 1329 | 1329 | * indirectly via kernel emulated PCI bridge driver. |
| 1330 | 1330 | */ |
| 1331 | 1331 | mvebu_pcie_setup_hw(port); |
| 1332 | − mvebu_pcie_set_local_dev_nr(port, 0); | |
| 1332 | + mvebu_pcie_set_local_dev_nr(port, 1); | |
| 1333 | + mvebu_pcie_set_local_bus_nr(port, 0); | |
| 1333 | 1334 | } |
| 1334 | 1335 | |
| 1335 | 1336 | pcie->nports = i; |
| @@ -99,11 +99,13 @@ struct vmd_irq { · 98 unmodified lines | ||
| 99 | 99 | * @srcu: SRCU struct for local synchronization. |
| 100 | 100 | * @count: number of child IRQs assigned to this vector; used to track |
| 101 | 101 | * sharing. |
| 102 | + * @virq: The underlying VMD Linux interrupt number | |
| 102 | 103 | */ |
| 103 | 104 | struct vmd_irq_list { |
| 104 | 105 | struct list_head irq_list; |
| 105 | 106 | struct srcu_struct srcu; |
| 106 | 107 | unsigned int count; |
| 108 | + unsigned int virq; | |
| 107 | 109 | }; |
| 108 | 110 | |
| 109 | 111 | struct vmd_dev { |
| @@ -253,7 +255,6 @@ static int vmd_msi_init(struct irq_domain *domain, struct msi_domain_info *info, · 143 unmodified lines | ||
| 253 | 255 | struct msi_desc *desc = arg->desc; |
| 254 | 256 | struct vmd_dev *vmd = vmd_from_bus(msi_desc_to_pci_dev(desc)->bus); |
| 255 | 257 | struct vmd_irq *vmdirq = kzalloc(sizeof(*vmdirq), GFP_KERNEL); |
| 256 | − unsigned int index, vector; | |
| 257 | 258 | |
| 258 | 259 | if (!vmdirq) |
| 259 | 260 | return -ENOMEM; |
| @@ -261,10 +262,8 @@ static int vmd_msi_init(struct irq_domain *domain, struct msi_domain_info *info, · 1 unmodified line | ||
| 261 | 262 | INIT_LIST_HEAD(&vmdirq->node); |
| 262 | 263 | vmdirq->irq = vmd_next_irq(vmd, desc); |
| 263 | 264 | vmdirq->virq = virq; |
| 264 | − index = index_from_irqs(vmd, vmdirq->irq); | |
| 265 | − vector = pci_irq_vector(vmd->dev, index); | |
| 266 | 265 | |
| 267 | − irq_domain_set_info(domain, virq, vector, info->chip, vmdirq, | |
| 266 | + irq_domain_set_info(domain, virq, vmdirq->irq->virq, info->chip, vmdirq, | |
| 268 | 267 | handle_untracked_irq, vmd, NULL); |
| 269 | 268 | return 0; |
| 270 | 269 | } |
| @@ -685,7 +684,8 @@ static int vmd_alloc_irqs(struct vmd_dev *vmd) · 414 unmodified lines | ||
| 685 | 684 | return err; |
| 686 | 685 | |
| 687 | 686 | INIT_LIST_HEAD(&vmd->irqs[i].irq_list); |
| 688 | − err = devm_request_irq(&dev->dev, pci_irq_vector(dev, i), | |
| 687 | + vmd->irqs[i].virq = pci_irq_vector(dev, i); | |
| 688 | + err = devm_request_irq(&dev->dev, vmd->irqs[i].virq, | |
| 689 | 689 | vmd_irq, IRQF_NO_THREAD, |
| 690 | 690 | vmd->name, &vmd->irqs[i]); |
| 691 | 691 | if (err) |
| @@ -969,7 +969,7 @@ static int vmd_suspend(struct device *dev) · 277 unmodified lines | ||
| 969 | 969 | int i; |
| 970 | 970 | |
| 971 | 971 | for (i = 0; i < vmd->msix_count; i++) |
| 972 | − devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]); | |
| 972 | + devm_free_irq(dev, vmd->irqs[i].virq, &vmd->irqs[i]); | |
| 973 | 973 | |
| 974 | 974 | return 0; |
| 975 | 975 | } |
| @@ -981,7 +981,7 @@ static int vmd_resume(struct device *dev) · 5 unmodified lines | ||
| 981 | 981 | int err, i; |
| 982 | 982 | |
| 983 | 983 | for (i = 0; i < vmd->msix_count; i++) { |
| 984 | − err = devm_request_irq(dev, pci_irq_vector(pdev, i), | |
| 984 | + err = devm_request_irq(dev, vmd->irqs[i].virq, | |
| 985 | 985 | vmd_irq, IRQF_NO_THREAD, |
| 986 | 986 | vmd->name, &vmd->irqs[i]); |
| 987 | 987 | if (err) |
| @@ -5344,11 +5344,6 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); · 5343 unmodified lines | ||
| 5344 | 5344 | */ |
| 5345 | 5345 | static void quirk_amd_harvest_no_ats(struct pci_dev *pdev) |
| 5346 | 5346 | { |
| 5347 | − if ((pdev->device == 0x7312 && pdev->revision != 0x00) || | |
| 5348 | − (pdev->device == 0x7340 && pdev->revision != 0xc5) || | |
| 5349 | − (pdev->device == 0x7341 && pdev->revision != 0x00)) | |
| 5350 | − return; | |
| 5351 | − | |
| 5352 | 5347 | if (pdev->device == 0x15d8) { |
| 5353 | 5348 | if (pdev->revision == 0xcf && |
| 5354 | 5349 | pdev->subsystem_vendor == 0xea50 && |
| @@ -5370,10 +5365,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_amd_harvest_no_ats); · 15 unmodified lines | ||
| 5370 | 5365 | /* AMD Iceland dGPU */ |
| 5371 | 5366 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats); |
| 5372 | 5367 | /* AMD Navi10 dGPU */ |
| 5368 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7310, quirk_amd_harvest_no_ats); | |
| 5373 | 5369 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats); |
| 5370 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7318, quirk_amd_harvest_no_ats); | |
| 5371 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7319, quirk_amd_harvest_no_ats); | |
| 5372 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731a, quirk_amd_harvest_no_ats); | |
| 5373 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731b, quirk_amd_harvest_no_ats); | |
| 5374 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731e, quirk_amd_harvest_no_ats); | |
| 5375 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731f, quirk_amd_harvest_no_ats); | |
| 5374 | 5376 | /* AMD Navi14 dGPU */ |
| 5375 | 5377 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats); |
| 5376 | 5378 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7341, quirk_amd_harvest_no_ats); |
| 5379 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7347, quirk_amd_harvest_no_ats); | |
| 5380 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x734f, quirk_amd_harvest_no_ats); | |
| 5377 | 5381 | /* AMD Raven platform iGPU */ |
| 5378 | 5382 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x15d8, quirk_amd_harvest_no_ats); |
| 5379 | 5383 | #endif /* CONFIG_PCI_ATS */ |
| @@ -749,7 +749,6 @@ static const struct acpi_device_id tgl_pinctrl_acpi_match[] = { · 748 unmodified lines | ||
| 749 | 749 | { "INT34C5", (kernel_ulong_t)&tgllp_soc_data }, |
| 750 | 750 | { "INT34C6", (kernel_ulong_t)&tglh_soc_data }, |
| 751 | 751 | { "INTC1055", (kernel_ulong_t)&tgllp_soc_data }, |
| 752 | − { "INTC1057", (kernel_ulong_t)&tgllp_soc_data }, | |
| 753 | 752 | { } |
| 754 | 753 | }; |
| 755 | 754 | MODULE_DEVICE_TABLE(acpi, tgl_pinctrl_acpi_match); |
| @@ -482,7 +482,7 @@ static int k210_pinconf_get_drive(unsigned int max_strength_ua) · 481 unmodified lines | ||
| 482 | 482 | { |
| 483 | 483 | int i; |
| 484 | 484 | |
| 485 | − for (i = K210_PC_DRIVE_MAX; i; i--) { | |
| 485 | + for (i = K210_PC_DRIVE_MAX; i >= 0; i--) { | |
| 486 | 486 | if (k210_pinconf_drive_strength[i] <= max_strength_ua) |
| 487 | 487 | return i; |
| 488 | 488 | } |
| @@ -527,7 +527,7 @@ static int k210_pinconf_set_param(struct pinctrl_dev *pctldev, · 38 unmodified lines | ||
| 527 | 527 | case PIN_CONFIG_BIAS_PULL_UP: |
| 528 | 528 | if (!arg) |
| 529 | 529 | return -EINVAL; |
| 530 | − val |= K210_PC_PD; | |
| 530 | + val |= K210_PC_PU; | |
| 531 | 531 | break; |
| 532 | 532 | case PIN_CONFIG_DRIVE_STRENGTH: |
| 533 | 533 | arg *= 1000; |
| @@ -1164,6 +1164,7 @@ static int starfive_irq_set_type(struct irq_data *d, unsigned int trigger) · 1163 unmodified lines | ||
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | 1166 | static struct irq_chip starfive_irq_chip = { |
| 1167 | + .name = "StarFive GPIO", | |
| 1167 | 1168 | .irq_ack = starfive_irq_ack, |
| 1168 | 1169 | .irq_mask = starfive_irq_mask, |
| 1169 | 1170 | .irq_mask_ack = starfive_irq_mask_ack, |
| @@ -1308,7 +1309,6 @@ static int starfive_probe(struct platform_device *pdev) · 138 unmodified lines | ||
| 1308 | 1309 | sfp->gc.ngpio = NR_GPIOS; |
| 1309 | 1310 | |
| 1310 | 1311 | starfive_irq_chip.parent_device = dev; |
| 1311 | − starfive_irq_chip.name = sfp->gc.label; | |
| 1312 | 1312 | |
| 1313 | 1313 | sfp->gc.irq.chip = &starfive_irq_chip; |
| 1314 | 1314 | sfp->gc.irq.parent_handler = starfive_gpio_irq_handler; |
| @@ -232,14 +232,21 @@ static int mshw0011_bix(struct mshw0011_data *cdata, struct bix *bix) · 231 unmodified lines | ||
| 232 | 232 | } |
| 233 | 233 | bix->last_full_charg_capacity = ret; |
| 234 | 234 | |
| 235 | − /* get serial number */ | |
| 235 | + /* | |
| 236 | + * Get serial number, on some devices (with unofficial replacement | |
| 237 | + * battery?) reading any of the serial number range addresses gets | |
| 238 | + * nacked in this case just leave the serial number empty. | |
| 239 | + */ | |
| 236 | 240 | ret = i2c_smbus_read_i2c_block_data(client, MSHW0011_BAT0_REG_SERIAL_NO, |
| 237 | 241 | sizeof(buf), buf); |
| 238 | − if (ret != sizeof(buf)) { | |
| 242 | + if (ret == -EREMOTEIO) { | |
| 243 | + /* no serial number available */ | |
| 244 | + } else if (ret != sizeof(buf)) { | |
| 239 | 245 | dev_err(&client->dev, "Error reading serial no: %d\n", ret); |
| 240 | 246 | return ret; |
| 247 | + } else { | |
| 248 | + snprintf(bix->serial, ARRAY_SIZE(bix->serial), "%3pE%6pE", buf + 7, buf); | |
| 241 | 249 | } |
| 242 | − snprintf(bix->serial, ARRAY_SIZE(bix->serial), "%3pE%6pE", buf + 7, buf); | |
| 243 | 250 | |
| 244 | 251 | /* get cycle count */ |
| 245 | 252 | ret = i2c_smbus_read_word_data(client, MSHW0011_BAT0_REG_CYCLE_CNT); |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <linux/module.h> |
| 22 | 22 | #include <linux/pci.h> |
| 23 | 23 | #include <linux/platform_device.h> |
| 24 | +#include <linux/pm_qos.h> | |
| 24 | 25 | #include <linux/rtc.h> |
| 25 | 26 | #include <linux/suspend.h> |
| 26 | 27 | #include <linux/seq_file.h> |
| @@ -85,6 +86,9 @@ · 58 unmodified lines | ||
| 85 | 86 | #define PMC_MSG_DELAY_MIN_US 50 |
| 86 | 87 | #define RESPONSE_REGISTER_LOOP_MAX 20000 |
| 87 | 88 | |
| 89 | +/* QoS request for letting CPUs in idle states, but not the deepest */ | |
| 90 | +#define AMD_PMC_MAX_IDLE_STATE_LATENCY 3 | |
| 91 | + | |
| 88 | 92 | #define SOC_SUBSYSTEM_IP_MAX 12 |
| 89 | 93 | #define DELAY_MIN_US 2000 |
| 90 | 94 | #define DELAY_MAX_US 3000 |
| @@ -131,6 +135,7 @@ struct amd_pmc_dev { · 40 unmodified lines | ||
| 131 | 135 | struct device *dev; |
| 132 | 136 | struct pci_dev *rdev; |
| 133 | 137 | struct mutex lock; /* generic mutex lock */ |
| 138 | + struct pm_qos_request amd_pmc_pm_qos_req; | |
| 134 | 139 | #if IS_ENABLED(CONFIG_DEBUG_FS) |
| 135 | 140 | struct dentry *dbgfs_dir; |
| 136 | 141 | #endif /* CONFIG_DEBUG_FS */ |
| @@ -521,6 +526,14 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg) · 384 unmodified lines | ||
| 521 | 526 | rc = rtc_alarm_irq_enable(rtc_device, 0); |
| 522 | 527 | dev_dbg(pdev->dev, "wakeup timer programmed for %lld seconds\n", duration); |
| 523 | 528 | |
| 529 | + /* | |
| 530 | + * Prevent CPUs from getting into deep idle states while sending OS_HINT | |
| 531 | + * which is otherwise generally safe to send when at least one of the CPUs | |
| 532 | + * is not in deep idle states. | |
| 533 | + */ | |
| 534 | + cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, AMD_PMC_MAX_IDLE_STATE_LATENCY); | |
| 535 | + wake_up_all_idle_cpus(); | |
| 536 | + | |
| 524 | 537 | return rc; |
| 525 | 538 | } |
| 526 | 539 | |
| @@ -538,24 +551,31 @@ static int __maybe_unused amd_pmc_suspend(struct device *dev) · 11 unmodified lines | ||
| 538 | 551 | /* Activate CZN specific RTC functionality */ |
| 539 | 552 | if (pdev->cpu_id == AMD_CPU_ID_CZN) { |
| 540 | 553 | rc = amd_pmc_verify_czn_rtc(pdev, &arg); |
| 541 | − if (rc < 0) | |
| 542 | − return rc; | |
| 554 | + if (rc) | |
| 555 | + goto fail; | |
| 543 | 556 | } |
| 544 | 557 | |
| 545 | 558 | /* Dump the IdleMask before we send hint to SMU */ |
| 546 | 559 | amd_pmc_idlemask_read(pdev, dev, NULL); |
| 547 | 560 | msg = amd_pmc_get_os_hint(pdev); |
| 548 | 561 | rc = amd_pmc_send_cmd(pdev, arg, NULL, msg, 0); |
| 549 | − if (rc) | |
| 562 | + if (rc) { | |
| 550 | 563 | dev_err(pdev->dev, "suspend failed\n"); |
| 564 | + goto fail; | |
| 565 | + } | |
| 551 | 566 | |
| 552 | 567 | if (enable_stb) |
| 553 | 568 | rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF); |
| 554 | − if (rc) { | |
| 569 | + if (rc) { | |
| 555 | 570 | dev_err(pdev->dev, "error writing to STB\n"); |
| 556 | − return rc; | |
| 571 | + goto fail; | |
| 557 | 572 | } |
| 558 | 573 | |
| 574 | + return 0; | |
| 575 | +fail: | |
| 576 | + if (pdev->cpu_id == AMD_CPU_ID_CZN) | |
| 577 | + cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, | |
| 578 | + PM_QOS_DEFAULT_VALUE); | |
| 559 | 579 | return rc; |
| 560 | 580 | } |
| 561 | 581 | |
| @@ -579,12 +599,15 @@ static int __maybe_unused amd_pmc_resume(struct device *dev) · 17 unmodified lines | ||
| 579 | 599 | /* Write data incremented by 1 to distinguish in stb_read */ |
| 580 | 600 | if (enable_stb) |
| 581 | 601 | rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF + 1); |
| 582 | − if (rc) { | |
| 602 | + if (rc) | |
| 583 | 603 | dev_err(pdev->dev, "error writing to STB\n"); |
| 584 | − return rc; | |
| 585 | − } | |
| 586 | 604 | |
| 587 | − return 0; | |
| 605 | + /* Restore the QoS request back to defaults if it was set */ | |
| 606 | + if (pdev->cpu_id == AMD_CPU_ID_CZN) | |
| 607 | + cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, | |
| 608 | + PM_QOS_DEFAULT_VALUE); | |
| 609 | + | |
| 610 | + return rc; | |
| 588 | 611 | } |
| 589 | 612 | |
| 590 | 613 | static const struct dev_pm_ops amd_pmc_pm_ops = { |
| @@ -722,6 +745,7 @@ static int amd_pmc_probe(struct platform_device *pdev) · 131 unmodified lines | ||
| 722 | 745 | amd_pmc_get_smu_version(dev); |
| 723 | 746 | platform_set_drvdata(pdev, dev); |
| 724 | 747 | amd_pmc_dbgfs_register(dev); |
| 748 | + cpu_latency_qos_add_request(&dev->amd_pmc_pm_qos_req, PM_QOS_DEFAULT_VALUE); | |
| 725 | 749 | return 0; |
| 726 | 750 | |
| 727 | 751 | err_pci_dev_put: |
| @@ -2223,7 +2223,7 @@ static int fan_curve_check_present(struct asus_wmi *asus, bool *available, · 2222 unmodified lines | ||
| 2223 | 2223 | |
| 2224 | 2224 | err = fan_curve_get_factory_default(asus, fan_dev); |
| 2225 | 2225 | if (err) { |
| 2226 | − if (err == -ENODEV) | |
| 2226 | + if (err == -ENODEV || err == -ENODATA) | |
| 2227 | 2227 | return 0; |
| 2228 | 2228 | return err; |
| 2229 | 2229 | } |
| @@ -100,7 +100,8 @@ static struct gpiod_lookup_table surface_go_tps68470_gpios = { · 99 unmodified lines | ||
| 100 | 100 | .dev_id = "i2c-INT347A:00", |
| 101 | 101 | .table = { |
| 102 | 102 | GPIO_LOOKUP("tps68470-gpio", 9, "reset", GPIO_ACTIVE_LOW), |
| 103 | − GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW) | |
| 103 | + GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW), | |
| 104 | + { } | |
| 104 | 105 | } |
| 105 | 106 | }; |
| 106 | 107 | |
| @@ -8703,6 +8703,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 8702 unmodified lines | ||
| 8703 | 8703 | TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */ |
| 8704 | 8704 | TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */ |
| 8705 | 8705 | TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */ |
| 8706 | + TPACPI_Q_LNV3('N', '3', '7', TPACPI_FAN_2CTL), /* T15g (2nd gen) */ | |
| 8706 | 8707 | TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */ |
| 8707 | 8708 | }; |
| 8708 | 8709 | |
| @@ -1523,6 +1523,9 @@ static int bq256xx_hw_init(struct bq256xx_device *bq) · 1522 unmodified lines | ||
| 1523 | 1523 | BQ256XX_WDT_BIT_SHIFT); |
| 1524 | 1524 | |
| 1525 | 1525 | ret = power_supply_get_battery_info(bq->charger, &bat_info); |
| 1526 | + if (ret == -ENOMEM) | |
| 1527 | + return ret; | |
| 1528 | + | |
| 1526 | 1529 | if (ret) { |
| 1527 | 1530 | dev_warn(bq->dev, "battery info missing, default values will be applied\n"); |
| 1528 | 1531 | |
| @@ -689,7 +689,7 @@ static int cw_bat_probe(struct i2c_client *client) · 688 unmodified lines | ||
| 689 | 689 | if (ret) { |
| 690 | 690 | /* Allocate an empty battery */ |
| 691 | 691 | cw_bat->battery = devm_kzalloc(&client->dev, |
| 692 | − sizeof(cw_bat->battery), | |
| 692 | + sizeof(*cw_bat->battery), | |
| 693 | 693 | GFP_KERNEL); |
| 694 | 694 | if (!cw_bat->battery) |
| 695 | 695 | return -ENOMEM; |
| @@ -6014,9 +6014,8 @@ core_initcall(regulator_init); · 6013 unmodified lines | ||
| 6014 | 6014 | static int regulator_late_cleanup(struct device *dev, void *data) |
| 6015 | 6015 | { |
| 6016 | 6016 | struct regulator_dev *rdev = dev_to_rdev(dev); |
| 6017 | − const struct regulator_ops *ops = rdev->desc->ops; | |
| 6018 | 6017 | struct regulation_constraints *c = rdev->constraints; |
| 6019 | − int enabled, ret; | |
| 6018 | + int ret; | |
| 6020 | 6019 | |
| 6021 | 6020 | if (c && c->always_on) |
| 6022 | 6021 | return 0; |
| @@ -6029,14 +6028,8 @@ static int regulator_late_cleanup(struct device *dev, void *data) · 6 unmodified lines | ||
| 6029 | 6028 | if (rdev->use_count) |
| 6030 | 6029 | goto unlock; |
| 6031 | 6030 | |
| 6032 | − /* If we can't read the status assume it's always on. */ | |
| 6033 | − if (ops->is_enabled) | |
| 6034 | − enabled = ops->is_enabled(rdev); | |
| 6035 | − else | |
| 6036 | − enabled = 1; | |
| 6037 | − | |
| 6038 | − /* But if reading the status failed, assume that it's off. */ | |
| 6039 | − if (enabled <= 0) | |
| 6031 | + /* If reading the status failed, assume that it's off. */ | |
| 6032 | + if (_regulator_is_enabled(rdev) <= 0) | |
| 6040 | 6033 | goto unlock; |
| 6041 | 6034 | |
| 6042 | 6035 | if (have_full_constraints()) { |
| @@ -87,16 +87,16 @@ static struct da9121_range da9121_3A_1phase_current = { · 86 unmodified lines | ||
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | 89 | static struct da9121_range da914x_40A_4phase_current = { |
| 90 | − .val_min = 14000000, | |
| 91 | − .val_max = 80000000, | |
| 92 | − .val_stp = 2000000, | |
| 90 | + .val_min = 26000000, | |
| 91 | + .val_max = 78000000, | |
| 92 | + .val_stp = 4000000, | |
| 93 | 93 | .reg_min = 1, |
| 94 | 94 | .reg_max = 14, |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | 97 | static struct da9121_range da914x_20A_2phase_current = { |
| 98 | − .val_min = 7000000, | |
| 99 | − .val_max = 40000000, | |
| 98 | + .val_min = 13000000, | |
| 99 | + .val_max = 39000000, | |
| 100 | 100 | .val_stp = 2000000, |
| 101 | 101 | .reg_min = 1, |
| 102 | 102 | .reg_max = 14, |
| @@ -561,7 +561,7 @@ static const struct regulator_desc da9217_reg = { · 458 unmodified lines | ||
| 561 | 561 | }; |
| 562 | 562 | |
| 563 | 563 | #define DA914X_MIN_MV 500 |
| 564 | −#define DA914X_MAX_MV 1000 | |
| 564 | +#define DA914X_MAX_MV 1300 | |
| 565 | 565 | #define DA914X_STEP_MV 10 |
| 566 | 566 | #define DA914X_MIN_SEL (DA914X_MIN_MV / DA914X_STEP_MV) |
| 567 | 567 | #define DA914X_N_VOLTAGES (((DA914X_MAX_MV - DA914X_MIN_MV) / DA914X_STEP_MV) \ |
| @@ -585,10 +585,6 @@ static const struct regulator_desc da9141_reg = { · 17 unmodified lines | ||
| 585 | 585 | .vsel_mask = DA9121_MASK_BUCK_BUCKx_5_CHx_A_VOUT, |
| 586 | 586 | .enable_reg = DA9121_REG_BUCK_BUCK1_0, |
| 587 | 587 | .enable_mask = DA9121_MASK_BUCK_BUCKx_0_CHx_EN, |
| 588 | − /* Default value of BUCK_BUCK1_0.CH1_SRC_DVC_UP */ | |
| 589 | − .ramp_delay = 20000, | |
| 590 | − /* tBUCK_EN */ | |
| 591 | − .enable_time = 20, | |
| 592 | 588 | }; |
| 593 | 589 | |
| 594 | 590 | static const struct regulator_desc da9142_reg = { |
| @@ -592,6 +592,7 @@ struct lpfc_vport { · 591 unmodified lines | ||
| 592 | 592 | #define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */ |
| 593 | 593 | #define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */ |
| 594 | 594 | #define FC_LOGO_RCVD_DID_CHNG 0x800 /* FDISC on phys port detect DID chng*/ |
| 595 | +#define FC_PT2PT_NO_NVME 0x1000 /* Don't send NVME PRLI */ | |
| 595 | 596 | #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */ |
| 596 | 597 | #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */ |
| 597 | 598 | #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */ |
| @@ -1315,6 +1315,9 @@ lpfc_issue_lip(struct Scsi_Host *shost) · 1314 unmodified lines | ||
| 1315 | 1315 | pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; |
| 1316 | 1316 | pmboxq->u.mb.mbxOwner = OWN_HOST; |
| 1317 | 1317 | |
| 1318 | + if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME)) | |
| 1319 | + vport->fc_flag &= ~FC_PT2PT_NO_NVME; | |
| 1320 | + | |
| 1318 | 1321 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2); |
| 1319 | 1322 | |
| 1320 | 1323 | if ((mbxstatus == MBX_SUCCESS) && |
| @@ -1072,7 +1072,8 @@ stop_rr_fcf_flogi: · 1071 unmodified lines | ||
| 1072 | 1072 | |
| 1073 | 1073 | /* FLOGI failed, so there is no fabric */ |
| 1074 | 1074 | spin_lock_irq(shost->host_lock); |
| 1075 | − vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); | |
| 1075 | + vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP | | |
| 1076 | + FC_PT2PT_NO_NVME); | |
| 1076 | 1077 | spin_unlock_irq(shost->host_lock); |
| 1077 | 1078 | |
| 1078 | 1079 | /* If private loop, then allow max outstanding els to be |
| @@ -4607,6 +4608,23 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 3528 unmodified lines | ||
| 4607 | 4608 | /* Added for Vendor specifc support |
| 4608 | 4609 | * Just keep retrying for these Rsn / Exp codes |
| 4609 | 4610 | */ |
| 4611 | + if ((vport->fc_flag & FC_PT2PT) && | |
| 4612 | + cmd == ELS_CMD_NVMEPRLI) { | |
| 4613 | + switch (stat.un.b.lsRjtRsnCode) { | |
| 4614 | + case LSRJT_UNABLE_TPC: | |
| 4615 | + case LSRJT_INVALID_CMD: | |
| 4616 | + case LSRJT_LOGICAL_ERR: | |
| 4617 | + case LSRJT_CMD_UNSUPPORTED: | |
| 4618 | + lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS, | |
| 4619 | + "0168 NVME PRLI LS_RJT " | |
| 4620 | + "reason %x port doesn't " | |
| 4621 | + "support NVME, disabling NVME\n", | |
| 4622 | + stat.un.b.lsRjtRsnCode); | |
| 4623 | + retry = 0; | |
| 4624 | + vport->fc_flag |= FC_PT2PT_NO_NVME; | |
| 4625 | + goto out_retry; | |
| 4626 | + } | |
| 4627 | + } | |
| 4610 | 4628 | switch (stat.un.b.lsRjtRsnCode) { |
| 4611 | 4629 | case LSRJT_UNABLE_TPC: |
| 4612 | 4630 | /* The driver has a VALID PLOGI but the rport has |
| @@ -1961,8 +1961,9 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, · 1960 unmodified lines | ||
| 1961 | 1961 | * is configured try it. |
| 1962 | 1962 | */ |
| 1963 | 1963 | ndlp->nlp_fc4_type |= NLP_FC4_FCP; |
| 1964 | − if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || | |
| 1965 | − (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) { | |
| 1964 | + if ((!(vport->fc_flag & FC_PT2PT_NO_NVME)) && | |
| 1965 | + (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH || | |
| 1966 | + vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) { | |
| 1966 | 1967 | ndlp->nlp_fc4_type |= NLP_FC4_NVME; |
| 1967 | 1968 | /* We need to update the localport also */ |
| 1968 | 1969 | lpfc_nvme_update_localport(vport); |
| @@ -771,11 +771,10 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 770 unmodified lines | ||
| 771 | 771 | qedi_cmd->list_tmf_work = NULL; |
| 772 | 772 | } |
| 773 | 773 | } |
| 774 | + spin_unlock_bh(&qedi_conn->tmf_work_lock); | |
| 774 | 775 | |
| 775 | − if (!found) { | |
| 776 | − spin_unlock_bh(&qedi_conn->tmf_work_lock); | |
| 776 | + if (!found) | |
| 777 | 777 | goto check_cleanup_reqs; |
| 778 | − } | |
| 779 | 778 | |
| 780 | 779 | QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, |
| 781 | 780 | "TMF work, cqe->tid=0x%x, tmf flags=0x%x, cid=0x%x\n", |
| @@ -806,7 +805,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 24 unmodified lines | ||
| 806 | 805 | qedi_cmd->state = CLEANUP_RECV; |
| 807 | 806 | unlock: |
| 808 | 807 | spin_unlock_bh(&conn->session->back_lock); |
| 809 | − spin_unlock_bh(&qedi_conn->tmf_work_lock); | |
| 810 | 808 | wake_up_interruptible(&qedi_conn->wait_queue); |
| 811 | 809 | return; |
| 812 | 810 | |
| @@ -2681,7 +2681,7 @@ static int ufshcd_map_queues(struct Scsi_Host *shost) · 2680 unmodified lines | ||
| 2681 | 2681 | break; |
| 2682 | 2682 | case HCTX_TYPE_READ: |
| 2683 | 2683 | map->nr_queues = 0; |
| 2684 | − break; | |
| 2684 | + continue; | |
| 2685 | 2685 | default: |
| 2686 | 2686 | WARN_ON_ONCE(true); |
| 2687 | 2687 | } |
| @@ -411,17 +411,12 @@ out: · 410 unmodified lines | ||
| 411 | 411 | return ret; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | −static int init_clks(struct platform_device *pdev, struct clk **clk) | |
| 414 | +static void init_clks(struct platform_device *pdev, struct clk **clk) | |
| 415 | 415 | { |
| 416 | 416 | int i; |
| 417 | 417 | |
| 418 | − for (i = CLK_NONE + 1; i < CLK_MAX; i++) { | |
| 418 | + for (i = CLK_NONE + 1; i < CLK_MAX; i++) | |
| 419 | 419 | clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); |
| 420 | − if (IS_ERR(clk[i])) | |
| 421 | − return PTR_ERR(clk[i]); | |
| 422 | − } | |
| 423 | − | |
| 424 | − return 0; | |
| 425 | 420 | } |
| 426 | 421 | |
| 427 | 422 | static struct scp *init_scp(struct platform_device *pdev, |
| @@ -431,7 +426,7 @@ static struct scp *init_scp(struct platform_device *pdev, · 3 unmodified lines | ||
| 431 | 426 | { |
| 432 | 427 | struct genpd_onecell_data *pd_data; |
| 433 | 428 | struct resource *res; |
| 434 | − int i, j, ret; | |
| 429 | + int i, j; | |
| 435 | 430 | struct scp *scp; |
| 436 | 431 | struct clk *clk[CLK_MAX]; |
| 437 | 432 | |
| @@ -486,9 +481,7 @@ static struct scp *init_scp(struct platform_device *pdev, · 48 unmodified lines | ||
| 486 | 481 | |
| 487 | 482 | pd_data->num_domains = num; |
| 488 | 483 | |
| 489 | − ret = init_clks(pdev, clk); | |
| 490 | − if (ret) | |
| 491 | − return ERR_PTR(ret); | |
| 484 | + init_clks(pdev, clk); | |
| 492 | 485 | |
| 493 | 486 | for (i = 0; i < num; i++) { |
| 494 | 487 | struct scp_domain *scpd = &scp->domains[i]; |
| @@ -585,6 +585,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr) · 584 unmodified lines | ||
| 585 | 585 | { |
| 586 | 586 | struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); |
| 587 | 587 | |
| 588 | + if (atomic_read(&rs->state) & RXDMA) | |
| 589 | + dmaengine_terminate_sync(ctlr->dma_rx); | |
| 590 | + if (atomic_read(&rs->state) & TXDMA) | |
| 591 | + dmaengine_terminate_sync(ctlr->dma_tx); | |
| 592 | + atomic_set(&rs->state, 0); | |
| 593 | + spi_enable_chip(rs, false); | |
| 588 | 594 | rs->slave_abort = true; |
| 589 | 595 | spi_finalize_current_transfer(ctlr); |
| 590 | 596 | |
| @@ -654,7 +660,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) · 63 unmodified lines | ||
| 654 | 660 | struct spi_controller *ctlr; |
| 655 | 661 | struct resource *mem; |
| 656 | 662 | struct device_node *np = pdev->dev.of_node; |
| 657 | − u32 rsd_nsecs; | |
| 663 | + u32 rsd_nsecs, num_cs; | |
| 658 | 664 | bool slave_mode; |
| 659 | 665 | |
| 660 | 666 | slave_mode = of_property_read_bool(np, "spi-slave"); |
| @@ -764,8 +770,9 @@ static int rockchip_spi_probe(struct platform_device *pdev) · 103 unmodified lines | ||
| 764 | 770 | * rk spi0 has two native cs, spi1..5 one cs only |
| 765 | 771 | * if num-cs is missing in the dts, default to 1 |
| 766 | 772 | */ |
| 767 | − if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect)) | |
| 768 | − ctlr->num_chipselect = 1; | |
| 773 | + if (of_property_read_u32(np, "num-cs", &num_cs)) | |
| 774 | + num_cs = 1; | |
| 775 | + ctlr->num_chipselect = num_cs; | |
| 769 | 776 | ctlr->use_gpio_descriptors = true; |
| 770 | 777 | } |
| 771 | 778 | ctlr->dev.of_node = pdev->dev.of_node; |
| @@ -570,6 +570,9 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, · 569 unmodified lines | ||
| 570 | 570 | |
| 571 | 571 | if (op->dummy.nbytes) { |
| 572 | 572 | tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL); |
| 573 | + if (!tmpbuf) | |
| 574 | + return -ENOMEM; | |
| 575 | + | |
| 573 | 576 | memset(tmpbuf, 0xff, op->dummy.nbytes); |
| 574 | 577 | reinit_completion(&xqspi->data_completion); |
| 575 | 578 | xqspi->txbuf = tmpbuf; |
| @@ -144,6 +144,8 @@ static int init_display(struct fbtft_par *par) · 143 unmodified lines | ||
| 144 | 144 | { |
| 145 | 145 | int rc; |
| 146 | 146 | |
| 147 | + par->fbtftops.reset(par); | |
| 148 | + | |
| 147 | 149 | rc = init_tearing_effect_line(par); |
| 148 | 150 | if (rc) |
| 149 | 151 | return rc; |
| @@ -404,6 +404,10 @@ static void int3400_notify(acpi_handle handle, · 403 unmodified lines | ||
| 404 | 404 | thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event); |
| 405 | 405 | thermal_prop[4] = NULL; |
| 406 | 406 | kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop); |
| 407 | + kfree(thermal_prop[0]); | |
| 408 | + kfree(thermal_prop[1]); | |
| 409 | + kfree(thermal_prop[2]); | |
| 410 | + kfree(thermal_prop[3]); | |
| 407 | 411 | } |
| 408 | 412 | |
| 409 | 413 | static int int3400_thermal_get_temp(struct thermal_zone_device *thermal, |
| @@ -439,7 +439,7 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) · 438 unmodified lines | ||
| 439 | 439 | modembits |= MDM_RTR; |
| 440 | 440 | if (dlci->modem_tx & TIOCM_RI) |
| 441 | 441 | modembits |= MDM_IC; |
| 442 | − if (dlci->modem_tx & TIOCM_CD) | |
| 442 | + if (dlci->modem_tx & TIOCM_CD || dlci->gsm->initiator) | |
| 443 | 443 | modembits |= MDM_DV; |
| 444 | 444 | return modembits; |
| 445 | 445 | } |
| @@ -448,7 +448,7 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) · 2 unmodified lines | ||
| 448 | 448 | * gsm_print_packet - display a frame for debug |
| 449 | 449 | * @hdr: header to print before decode |
| 450 | 450 | * @addr: address EA from the frame |
| 451 | − * @cr: C/R bit from the frame | |
| 451 | + * @cr: C/R bit seen as initiator | |
| 452 | 452 | * @control: control including PF bit |
| 453 | 453 | * @data: following data bytes |
| 454 | 454 | * @dlen: length of data |
| @@ -548,7 +548,7 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len) · 93 unmodified lines | ||
| 548 | 548 | * gsm_send - send a control frame |
| 549 | 549 | * @gsm: our GSM mux |
| 550 | 550 | * @addr: address for control frame |
| 551 | − * @cr: command/response bit | |
| 551 | + * @cr: command/response bit seen as initiator | |
| 552 | 552 | * @control: control byte including PF bit |
| 553 | 553 | * |
| 554 | 554 | * Format up and transmit a control frame. These do not go via the |
| @@ -563,11 +563,15 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) · 8 unmodified lines | ||
| 563 | 563 | int len; |
| 564 | 564 | u8 cbuf[10]; |
| 565 | 565 | u8 ibuf[3]; |
| 566 | + int ocr; | |
| 567 | + | |
| 568 | + /* toggle C/R coding if not initiator */ | |
| 569 | + ocr = cr ^ (gsm->initiator ? 0 : 1); | |
| 566 | 570 | |
| 567 | 571 | switch (gsm->encoding) { |
| 568 | 572 | case 0: |
| 569 | 573 | cbuf[0] = GSM0_SOF; |
| 570 | − cbuf[1] = (addr << 2) | (cr << 1) | EA; | |
| 574 | + cbuf[1] = (addr << 2) | (ocr << 1) | EA; | |
| 571 | 575 | cbuf[2] = control; |
| 572 | 576 | cbuf[3] = EA; /* Length of data = 0 */ |
| 573 | 577 | cbuf[4] = 0xFF - gsm_fcs_add_block(INIT_FCS, cbuf + 1, 3); |
| @@ -577,7 +581,7 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) · 3 unmodified lines | ||
| 577 | 581 | case 1: |
| 578 | 582 | case 2: |
| 579 | 583 | /* Control frame + packing (but not frame stuffing) in mode 1 */ |
| 580 | − ibuf[0] = (addr << 2) | (cr << 1) | EA; | |
| 584 | + ibuf[0] = (addr << 2) | (ocr << 1) | EA; | |
| 581 | 585 | ibuf[1] = control; |
| 582 | 586 | ibuf[2] = 0xFF - gsm_fcs_add_block(INIT_FCS, ibuf, 2); |
| 583 | 587 | /* Stuffing may double the size worst case */ |
| @@ -611,7 +615,7 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) · 27 unmodified lines | ||
| 611 | 615 | |
| 612 | 616 | static inline void gsm_response(struct gsm_mux *gsm, int addr, int control) |
| 613 | 617 | { |
| 614 | − gsm_send(gsm, addr, 1, control); | |
| 618 | + gsm_send(gsm, addr, 0, control); | |
| 615 | 619 | } |
| 616 | 620 | |
| 617 | 621 | /** |
| @@ -1017,25 +1021,25 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, const u8 *data, · 399 unmodified lines | ||
| 1017 | 1021 | * @tty: virtual tty bound to the DLCI |
| 1018 | 1022 | * @dlci: DLCI to affect |
| 1019 | 1023 | * @modem: modem bits (full EA) |
| 1020 | − * @clen: command length | |
| 1024 | + * @slen: number of signal octets | |
| 1021 | 1025 | * |
| 1022 | 1026 | * Used when a modem control message or line state inline in adaption |
| 1023 | 1027 | * layer 2 is processed. Sort out the local modem state and throttles |
| 1024 | 1028 | */ |
| 1025 | 1029 | |
| 1026 | 1030 | static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci, |
| 1027 | − u32 modem, int clen) | |
| 1031 | + u32 modem, int slen) | |
| 1028 | 1032 | { |
| 1029 | 1033 | int mlines = 0; |
| 1030 | 1034 | u8 brk = 0; |
| 1031 | 1035 | int fc; |
| 1032 | 1036 | |
| 1033 | − /* The modem status command can either contain one octet (v.24 signals) | |
| 1034 | − or two octets (v.24 signals + break signals). The length field will | |
| 1035 | − either be 2 or 3 respectively. This is specified in section | |
| 1036 | − 5.4.6.3.7 of the 27.010 mux spec. */ | |
| 1037 | + /* The modem status command can either contain one octet (V.24 signals) | |
| 1038 | + * or two octets (V.24 signals + break signals). This is specified in | |
| 1039 | + * section 5.4.6.3.7 of the 07.10 mux spec. | |
| 1040 | + */ | |
| 1037 | 1041 | |
| 1038 | − if (clen == 2) | |
| 1042 | + if (slen == 1) | |
| 1039 | 1043 | modem = modem & 0x7f; |
| 1040 | 1044 | else { |
| 1041 | 1045 | brk = modem & 0x7f; |
| @@ -1092,6 +1096,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, const u8 *data, int clen) · 50 unmodified lines | ||
| 1092 | 1096 | unsigned int brk = 0; |
| 1093 | 1097 | struct gsm_dlci *dlci; |
| 1094 | 1098 | int len = clen; |
| 1099 | + int slen; | |
| 1095 | 1100 | const u8 *dp = data; |
| 1096 | 1101 | struct tty_struct *tty; |
| 1097 | 1102 | |
| @@ -1111,6 +1116,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, const u8 *data, int clen) · 13 unmodified lines | ||
| 1111 | 1116 | return; |
| 1112 | 1117 | dlci = gsm->dlci[addr]; |
| 1113 | 1118 | |
| 1119 | + slen = len; | |
| 1114 | 1120 | while (gsm_read_ea(&modem, *dp++) == 0) { |
| 1115 | 1121 | len--; |
| 1116 | 1122 | if (len == 0) |
| @@ -1127,7 +1133,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, const u8 *data, int clen) · 10 unmodified lines | ||
| 1127 | 1133 | modem |= (brk & 0x7f); |
| 1128 | 1134 | } |
| 1129 | 1135 | tty = tty_port_tty_get(&dlci->port); |
| 1130 | − gsm_process_modem(tty, dlci, modem, clen); | |
| 1136 | + gsm_process_modem(tty, dlci, modem, slen); | |
| 1131 | 1137 | if (tty) { |
| 1132 | 1138 | tty_wakeup(tty); |
| 1133 | 1139 | tty_kref_put(tty); |
| @@ -1451,6 +1457,9 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) · 317 unmodified lines | ||
| 1451 | 1457 | if (dlci->addr != 0) { |
| 1452 | 1458 | tty_port_tty_hangup(&dlci->port, false); |
| 1453 | 1459 | kfifo_reset(&dlci->fifo); |
| 1460 | + /* Ensure that gsmtty_open() can return. */ | |
| 1461 | + tty_port_set_initialized(&dlci->port, 0); | |
| 1462 | + wake_up_interruptible(&dlci->port.open_wait); | |
| 1454 | 1463 | } else |
| 1455 | 1464 | dlci->gsm->dead = true; |
| 1456 | 1465 | /* Unregister gsmtty driver,report gsmtty dev remove uevent for user */ |
| @@ -1514,7 +1523,7 @@ static void gsm_dlci_t1(struct timer_list *t) · 57 unmodified lines | ||
| 1514 | 1523 | dlci->mode = DLCI_MODE_ADM; |
| 1515 | 1524 | gsm_dlci_open(dlci); |
| 1516 | 1525 | } else { |
| 1517 | − gsm_dlci_close(dlci); | |
| 1526 | + gsm_dlci_begin_close(dlci); /* prevent half open link */ | |
| 1518 | 1527 | } |
| 1519 | 1528 | |
| 1520 | 1529 | break; |
| @@ -1593,6 +1602,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen) · 72 unmodified lines | ||
| 1593 | 1602 | struct tty_struct *tty; |
| 1594 | 1603 | unsigned int modem = 0; |
| 1595 | 1604 | int len = clen; |
| 1605 | + int slen = 0; | |
| 1596 | 1606 | |
| 1597 | 1607 | if (debug & 16) |
| 1598 | 1608 | pr_debug("%d bytes for tty\n", len); |
| @@ -1605,12 +1615,14 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen) · 6 unmodified lines | ||
| 1605 | 1615 | case 2: /* Asynchronous serial with line state in each frame */ |
| 1606 | 1616 | while (gsm_read_ea(&modem, *data++) == 0) { |
| 1607 | 1617 | len--; |
| 1618 | + slen++; | |
| 1608 | 1619 | if (len == 0) |
| 1609 | 1620 | return; |
| 1610 | 1621 | } |
| 1622 | + slen++; | |
| 1611 | 1623 | tty = tty_port_tty_get(port); |
| 1612 | 1624 | if (tty) { |
| 1613 | − gsm_process_modem(tty, dlci, modem, clen); | |
| 1625 | + gsm_process_modem(tty, dlci, modem, slen); | |
| 1614 | 1626 | tty_kref_put(tty); |
| 1615 | 1627 | } |
| 1616 | 1628 | fallthrough; |
| @@ -1748,7 +1760,12 @@ static void gsm_dlci_release(struct gsm_dlci *dlci) · 131 unmodified lines | ||
| 1748 | 1760 | gsm_destroy_network(dlci); |
| 1749 | 1761 | mutex_unlock(&dlci->mutex); |
| 1750 | 1762 | |
| 1751 | − tty_hangup(tty); | |
| 1763 | + /* We cannot use tty_hangup() because in tty_kref_put() the tty | |
| 1764 | + * driver assumes that the hangup queue is free and reuses it to | |
| 1765 | + * queue release_one_tty() -> NULL pointer panic in | |
| 1766 | + * process_one_work(). | |
| 1767 | + */ | |
| 1768 | + tty_vhangup(tty); | |
| 1752 | 1769 | |
| 1753 | 1770 | tty_port_tty_set(&dlci->port, NULL); |
| 1754 | 1771 | tty_kref_put(tty); |
| @@ -1800,10 +1817,10 @@ static void gsm_queue(struct gsm_mux *gsm) · 45 unmodified lines | ||
| 1800 | 1817 | goto invalid; |
| 1801 | 1818 | |
| 1802 | 1819 | cr = gsm->address & 1; /* C/R bit */ |
| 1820 | + cr ^= gsm->initiator ? 0 : 1; /* Flip so 1 always means command */ | |
| 1803 | 1821 | |
| 1804 | 1822 | gsm_print_packet("<--", address, cr, gsm->control, gsm->buf, gsm->len); |
| 1805 | 1823 | |
| 1806 | − cr ^= 1 - gsm->initiator; /* Flip so 1 always means command */ | |
| 1807 | 1824 | dlci = gsm->dlci[address]; |
| 1808 | 1825 | |
| 1809 | 1826 | switch (gsm->control) { |
| @@ -3234,9 +3251,9 @@ static void gsmtty_throttle(struct tty_struct *tty) · 1424 unmodified lines | ||
| 3234 | 3251 | if (dlci->state == DLCI_CLOSED) |
| 3235 | 3252 | return; |
| 3236 | 3253 | if (C_CRTSCTS(tty)) |
| 3237 | − dlci->modem_tx &= ~TIOCM_DTR; | |
| 3254 | + dlci->modem_tx &= ~TIOCM_RTS; | |
| 3238 | 3255 | dlci->throttled = true; |
| 3239 | − /* Send an MSC with DTR cleared */ | |
| 3256 | + /* Send an MSC with RTS cleared */ | |
| 3240 | 3257 | gsmtty_modem_update(dlci, 0); |
| 3241 | 3258 | } |
| 3242 | 3259 | |
| @@ -3246,9 +3263,9 @@ static void gsmtty_unthrottle(struct tty_struct *tty) · 3 unmodified lines | ||
| 3246 | 3263 | if (dlci->state == DLCI_CLOSED) |
| 3247 | 3264 | return; |
| 3248 | 3265 | if (C_CRTSCTS(tty)) |
| 3249 | − dlci->modem_tx |= TIOCM_DTR; | |
| 3266 | + dlci->modem_tx |= TIOCM_RTS; | |
| 3250 | 3267 | dlci->throttled = false; |
| 3251 | − /* Send an MSC with DTR set */ | |
| 3268 | + /* Send an MSC with RTS set */ | |
| 3252 | 3269 | gsmtty_modem_update(dlci, 0); |
| 3253 | 3270 | } |
| 3254 | 3271 | |
| @@ -1926,7 +1926,7 @@ static bool canon_copy_from_read_buf(struct tty_struct *tty, · 1925 unmodified lines | ||
| 1926 | 1926 | return false; |
| 1927 | 1927 | |
| 1928 | 1928 | canon_head = smp_load_acquire(&ldata->canon_head); |
| 1929 | − n = min(*nr + 1, canon_head - ldata->read_tail); | |
| 1929 | + n = min(*nr, canon_head - ldata->read_tail); | |
| 1930 | 1930 | |
| 1931 | 1931 | tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); |
| 1932 | 1932 | size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); |
| @@ -1948,10 +1948,8 @@ static bool canon_copy_from_read_buf(struct tty_struct *tty, · 15 unmodified lines | ||
| 1948 | 1948 | n += N_TTY_BUF_SIZE; |
| 1949 | 1949 | c = n + found; |
| 1950 | 1950 | |
| 1951 | − if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) { | |
| 1952 | − c = min(*nr, c); | |
| 1951 | + if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) | |
| 1953 | 1952 | n = c; |
| 1954 | − } | |
| 1955 | 1953 | |
| 1956 | 1954 | n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu tail:%zu more:%zu\n", |
| 1957 | 1955 | __func__, eol, found, n, c, tail, more); |
| @@ -26,7 +26,7 @@ static int __init serial_init_chip(struct parisc_device *dev) · 25 unmodified lines | ||
| 26 | 26 | unsigned long address; |
| 27 | 27 | int err; |
| 28 | 28 | |
| 29 | −#ifdef CONFIG_64BIT | |
| 29 | +#if defined(CONFIG_64BIT) && defined(CONFIG_IOSAPIC) | |
| 30 | 30 | if (!dev->irq && (dev->id.sversion == 0xad)) |
| 31 | 31 | dev->irq = iosapic_serial_irq(dev); |
| 32 | 32 | #endif |
| @@ -734,12 +734,15 @@ static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) · 733 unmodified lines | ||
| 734 | 734 | static void sc16is7xx_tx_proc(struct kthread_work *ws) |
| 735 | 735 | { |
| 736 | 736 | struct uart_port *port = &(to_sc16is7xx_one(ws, tx_work)->port); |
| 737 | + struct sc16is7xx_port *s = dev_get_drvdata(port->dev); | |
| 737 | 738 | |
| 738 | 739 | if ((port->rs485.flags & SER_RS485_ENABLED) && |
| 739 | 740 | (port->rs485.delay_rts_before_send > 0)) |
| 740 | 741 | msleep(port->rs485.delay_rts_before_send); |
| 741 | 742 | |
| 743 | + mutex_lock(&s->efr_lock); | |
| 742 | 744 | sc16is7xx_handle_tx(port); |
| 745 | + mutex_unlock(&s->efr_lock); | |
| 743 | 746 | } |
| 744 | 747 | |
| 745 | 748 | static void sc16is7xx_reconf_rs485(struct uart_port *port) |
| @@ -1418,6 +1418,7 @@ void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg); · 1417 unmodified lines | ||
| 1418 | 1418 | void dwc2_hsotg_disconnect(struct dwc2_hsotg *dwc2); |
| 1419 | 1419 | int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode); |
| 1420 | 1420 | #define dwc2_is_device_connected(hsotg) (hsotg->connected) |
| 1421 | +#define dwc2_is_device_enabled(hsotg) (hsotg->enabled) | |
| 1421 | 1422 | int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg); |
| 1422 | 1423 | int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup); |
| 1423 | 1424 | int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg); |
| @@ -1454,6 +1455,7 @@ static inline int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, · 30 unmodified lines | ||
| 1454 | 1455 | int testmode) |
| 1455 | 1456 | { return 0; } |
| 1456 | 1457 | #define dwc2_is_device_connected(hsotg) (0) |
| 1458 | +#define dwc2_is_device_enabled(hsotg) (0) | |
| 1457 | 1459 | static inline int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) |
| 1458 | 1460 | { return 0; } |
| 1459 | 1461 | static inline int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, |
| @@ -130,8 +130,10 @@ static int dwc2_drd_role_sw_set(struct usb_role_switch *sw, enum usb_role role) · 129 unmodified lines | ||
| 130 | 130 | already = dwc2_ovr_avalid(hsotg, true); |
| 131 | 131 | } else if (role == USB_ROLE_DEVICE) { |
| 132 | 132 | already = dwc2_ovr_bvalid(hsotg, true); |
| 133 | − /* This clear DCTL.SFTDISCON bit */ | |
| 134 | − dwc2_hsotg_core_connect(hsotg); | |
| 133 | + if (dwc2_is_device_enabled(hsotg)) { | |
| 134 | + /* This clear DCTL.SFTDISCON bit */ | |
| 135 | + dwc2_hsotg_core_connect(hsotg); | |
| 136 | + } | |
| 135 | 137 | } else { |
| 136 | 138 | if (dwc2_is_device_mode(hsotg)) { |
| 137 | 139 | if (!dwc2_ovr_bvalid(hsotg, false)) |
| @@ -43,6 +43,7 @@ · 42 unmodified lines | ||
| 43 | 43 | #define PCI_DEVICE_ID_INTEL_ADLP 0x51ee |
| 44 | 44 | #define PCI_DEVICE_ID_INTEL_ADLM 0x54ee |
| 45 | 45 | #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1 |
| 46 | +#define PCI_DEVICE_ID_INTEL_RPLS 0x7a61 | |
| 46 | 47 | #define PCI_DEVICE_ID_INTEL_TGL 0x9a15 |
| 47 | 48 | #define PCI_DEVICE_ID_AMD_MR 0x163a |
| 48 | 49 | |
| @@ -85,8 +86,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = { · 36 unmodified lines | ||
| 85 | 86 | static struct gpiod_lookup_table platform_bytcr_gpios = { |
| 86 | 87 | .dev_id = "0000:00:16.0", |
| 87 | 88 | .table = { |
| 88 | − GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH), | |
| 89 | − GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH), | |
| 89 | + GPIO_LOOKUP("INT33FC:00", 54, "cs", GPIO_ACTIVE_HIGH), | |
| 90 | + GPIO_LOOKUP("INT33FC:02", 14, "reset", GPIO_ACTIVE_HIGH), | |
| 90 | 91 | {} |
| 91 | 92 | }, |
| 92 | 93 | }; |
| @@ -123,6 +124,12 @@ static const struct property_entry dwc3_pci_intel_phy_charger_detect_properties[ · 30 unmodified lines | ||
| 123 | 124 | PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), |
| 124 | 125 | PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), |
| 125 | 126 | PROPERTY_ENTRY_BOOL("linux,phy_charger_detect"), |
| 127 | + {} | |
| 128 | +}; | |
| 129 | + | |
| 130 | +static const struct property_entry dwc3_pci_intel_byt_properties[] = { | |
| 131 | + PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), | |
| 132 | + PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), | |
| 126 | 133 | PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), |
| 127 | 134 | {} |
| 128 | 135 | }; |
| @@ -173,6 +180,10 @@ static const struct software_node dwc3_pci_intel_phy_charger_detect_swnode = { · 44 unmodified lines | ||
| 173 | 180 | .properties = dwc3_pci_intel_phy_charger_detect_properties, |
| 174 | 181 | }; |
| 175 | 182 | |
| 183 | +static const struct software_node dwc3_pci_intel_byt_swnode = { | |
| 184 | + .properties = dwc3_pci_intel_byt_properties, | |
| 185 | +}; | |
| 186 | + | |
| 176 | 187 | static const struct software_node dwc3_pci_intel_mrfld_swnode = { |
| 177 | 188 | .properties = dwc3_pci_mrfld_properties, |
| 178 | 189 | }; |
| @@ -373,7 +384,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 194 unmodified lines | ||
| 373 | 384 | (kernel_ulong_t) &dwc3_pci_intel_swnode, }, |
| 374 | 385 | |
| 375 | 386 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BYT), |
| 376 | − (kernel_ulong_t) &dwc3_pci_intel_swnode, }, | |
| 387 | + (kernel_ulong_t) &dwc3_pci_intel_byt_swnode, }, | |
| 377 | 388 | |
| 378 | 389 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD), |
| 379 | 390 | (kernel_ulong_t) &dwc3_pci_intel_mrfld_swnode, }, |
| @@ -438,6 +449,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 58 unmodified lines | ||
| 438 | 449 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS), |
| 439 | 450 | (kernel_ulong_t) &dwc3_pci_intel_swnode, }, |
| 440 | 451 | |
| 452 | + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS), | |
| 453 | + (kernel_ulong_t) &dwc3_pci_intel_swnode, }, | |
| 454 | + | |
| 441 | 455 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL), |
| 442 | 456 | (kernel_ulong_t) &dwc3_pci_intel_swnode, }, |
| 443 | 457 | |
| @@ -4160,9 +4160,11 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt) · 4159 unmodified lines | ||
| 4160 | 4160 | unsigned long flags; |
| 4161 | 4161 | irqreturn_t ret = IRQ_NONE; |
| 4162 | 4162 | |
| 4163 | + local_bh_disable(); | |
| 4163 | 4164 | spin_lock_irqsave(&dwc->lock, flags); |
| 4164 | 4165 | ret = dwc3_process_event_buf(evt); |
| 4165 | 4166 | spin_unlock_irqrestore(&dwc->lock, flags); |
| 4167 | + local_bh_enable(); | |
| 4166 | 4168 | |
| 4167 | 4169 | return ret; |
| 4168 | 4170 | } |
| @@ -922,6 +922,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v) · 921 unmodified lines | ||
| 922 | 922 | params->resp_avail = resp_avail; |
| 923 | 923 | params->v = v; |
| 924 | 924 | INIT_LIST_HEAD(¶ms->resp_queue); |
| 925 | + spin_lock_init(¶ms->resp_lock); | |
| 925 | 926 | pr_debug("%s: configNr = %d\n", __func__, i); |
| 926 | 927 | |
| 927 | 928 | return params; |
| @@ -1015,12 +1016,14 @@ void rndis_free_response(struct rndis_params *params, u8 *buf) · 87 unmodified lines | ||
| 1015 | 1016 | { |
| 1016 | 1017 | rndis_resp_t *r, *n; |
| 1017 | 1018 | |
| 1019 | + spin_lock(¶ms->resp_lock); | |
| 1018 | 1020 | list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
| 1019 | 1021 | if (r->buf == buf) { |
| 1020 | 1022 | list_del(&r->list); |
| 1021 | 1023 | kfree(r); |
| 1022 | 1024 | } |
| 1023 | 1025 | } |
| 1026 | + spin_unlock(¶ms->resp_lock); | |
| 1024 | 1027 | } |
| 1025 | 1028 | EXPORT_SYMBOL_GPL(rndis_free_response); |
| 1026 | 1029 | |
| @@ -1030,14 +1033,17 @@ u8 *rndis_get_next_response(struct rndis_params *params, u32 *length) · 3 unmodified lines | ||
| 1030 | 1033 | |
| 1031 | 1034 | if (!length) return NULL; |
| 1032 | 1035 | |
| 1036 | + spin_lock(¶ms->resp_lock); | |
| 1033 | 1037 | list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
| 1034 | 1038 | if (!r->send) { |
| 1035 | 1039 | r->send = 1; |
| 1036 | 1040 | *length = r->length; |
| 1041 | + spin_unlock(¶ms->resp_lock); | |
| 1037 | 1042 | return r->buf; |
| 1038 | 1043 | } |
| 1039 | 1044 | } |
| 1040 | 1045 | |
| 1046 | + spin_unlock(¶ms->resp_lock); | |
| 1041 | 1047 | return NULL; |
| 1042 | 1048 | } |
| 1043 | 1049 | EXPORT_SYMBOL_GPL(rndis_get_next_response); |
| @@ -1054,7 +1060,9 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length) · 10 unmodified lines | ||
| 1054 | 1060 | r->length = length; |
| 1055 | 1061 | r->send = 0; |
| 1056 | 1062 | |
| 1063 | + spin_lock(¶ms->resp_lock); | |
| 1057 | 1064 | list_add_tail(&r->list, ¶ms->resp_queue); |
| 1065 | + spin_unlock(¶ms->resp_lock); | |
| 1058 | 1066 | return r; |
| 1059 | 1067 | } |
| 1060 | 1068 | |
| @@ -174,6 +174,7 @@ typedef struct rndis_params { · 173 unmodified lines | ||
| 174 | 174 | void (*resp_avail)(void *v); |
| 175 | 175 | void *v; |
| 176 | 176 | struct list_head resp_queue; |
| 177 | + spinlock_t resp_lock; | |
| 177 | 178 | } rndis_params; |
| 178 | 179 | |
| 179 | 180 | /* RNDIS Message parser and other useless functions */ |
| @@ -1615,6 +1615,8 @@ static void xudc_getstatus(struct xusb_udc *udc) · 1614 unmodified lines | ||
| 1615 | 1615 | break; |
| 1616 | 1616 | case USB_RECIP_ENDPOINT: |
| 1617 | 1617 | epnum = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; |
| 1618 | + if (epnum >= XUSB_MAX_ENDPOINTS) | |
| 1619 | + goto stall; | |
| 1618 | 1620 | target_ep = &udc->ep[epnum]; |
| 1619 | 1621 | epcfgreg = udc->read_fn(udc->addr + target_ep->offset); |
| 1620 | 1622 | halt = epcfgreg & XUSB_EP_CFG_STALL_MASK; |
| @@ -1682,6 +1684,10 @@ static void xudc_set_clear_feature(struct xusb_udc *udc) · 61 unmodified lines | ||
| 1682 | 1684 | case USB_RECIP_ENDPOINT: |
| 1683 | 1685 | if (!udc->setup.wValue) { |
| 1684 | 1686 | endpoint = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; |
| 1687 | + if (endpoint >= XUSB_MAX_ENDPOINTS) { | |
| 1688 | + xudc_ep0_stall(udc); | |
| 1689 | + return; | |
| 1690 | + } | |
| 1685 | 1691 | target_ep = &udc->ep[endpoint]; |
| 1686 | 1692 | outinbit = udc->setup.wIndex & USB_ENDPOINT_DIR_MASK; |
| 1687 | 1693 | outinbit = outinbit >> 7; |
| @@ -1091,6 +1091,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 1090 unmodified lines | ||
| 1091 | 1091 | int retval = 0; |
| 1092 | 1092 | bool comp_timer_running = false; |
| 1093 | 1093 | bool pending_portevent = false; |
| 1094 | + bool reinit_xhc = false; | |
| 1094 | 1095 | |
| 1095 | 1096 | if (!hcd->state) |
| 1096 | 1097 | return 0; |
| @@ -1107,10 +1108,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 10 unmodified lines | ||
| 1107 | 1108 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); |
| 1108 | 1109 | |
| 1109 | 1110 | spin_lock_irq(&xhci->lock); |
| 1110 | − if ((xhci->quirks & XHCI_RESET_ON_RESUME) || xhci->broken_suspend) | |
| 1111 | − hibernated = true; | |
| 1112 | 1111 | |
| 1113 | − if (!hibernated) { | |
| 1112 | + if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend) | |
| 1113 | + reinit_xhc = true; | |
| 1114 | + | |
| 1115 | + if (!reinit_xhc) { | |
| 1114 | 1116 | /* |
| 1115 | 1117 | * Some controllers might lose power during suspend, so wait |
| 1116 | 1118 | * for controller not ready bit to clear, just as in xHC init. |
| @@ -1143,12 +1145,17 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 26 unmodified lines | ||
| 1143 | 1145 | spin_unlock_irq(&xhci->lock); |
| 1144 | 1146 | return -ETIMEDOUT; |
| 1145 | 1147 | } |
| 1146 | − temp = readl(&xhci->op_regs->status); | |
| 1147 | 1148 | } |
| 1148 | 1149 | |
| 1149 | − /* If restore operation fails, re-initialize the HC during resume */ | |
| 1150 | − if ((temp & STS_SRE) || hibernated) { | |
| 1150 | + temp = readl(&xhci->op_regs->status); | |
| 1151 | 1151 | |
| 1152 | + /* re-initialize the HC on Restore Error, or Host Controller Error */ | |
| 1153 | + if (temp & (STS_SRE | STS_HCE)) { | |
| 1154 | + reinit_xhc = true; | |
| 1155 | + xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); | |
| 1156 | + } | |
| 1157 | + | |
| 1158 | + if (reinit_xhc) { | |
| 1152 | 1159 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
| 1153 | 1160 | !(xhci_all_ports_seen_u0(xhci))) { |
| 1154 | 1161 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
| @@ -1604,9 +1611,12 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag · 449 unmodified lines | ||
| 1604 | 1611 | struct urb_priv *urb_priv; |
| 1605 | 1612 | int num_tds; |
| 1606 | 1613 | |
| 1607 | − if (!urb || xhci_check_args(hcd, urb->dev, urb->ep, | |
| 1608 | − true, true, __func__) <= 0) | |
| 1614 | + if (!urb) | |
| 1609 | 1615 | return -EINVAL; |
| 1616 | + ret = xhci_check_args(hcd, urb->dev, urb->ep, | |
| 1617 | + true, true, __func__); | |
| 1618 | + if (ret <= 0) | |
| 1619 | + return ret ? ret : -EINVAL; | |
| 1610 | 1620 | |
| 1611 | 1621 | slot_id = urb->dev->slot_id; |
| 1612 | 1622 | ep_index = xhci_get_endpoint_index(&urb->ep->desc); |
| @@ -3319,7 +3329,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, · 1706 unmodified lines | ||
| 3319 | 3329 | return -EINVAL; |
| 3320 | 3330 | ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__); |
| 3321 | 3331 | if (ret <= 0) |
| 3322 | − return -EINVAL; | |
| 3332 | + return ret ? ret : -EINVAL; | |
| 3323 | 3333 | if (usb_ss_max_streams(&ep->ss_ep_comp) == 0) { |
| 3324 | 3334 | xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion" |
| 3325 | 3335 | " descriptor for ep 0x%x does not support streams\n", |
| @@ -81,7 +81,6 @@ · 80 unmodified lines | ||
| 81 | 81 | #define CH341_QUIRK_SIMULATE_BREAK BIT(1) |
| 82 | 82 | |
| 83 | 83 | static const struct usb_device_id id_table[] = { |
| 84 | − { USB_DEVICE(0x1a86, 0x5512) }, | |
| 85 | 84 | { USB_DEVICE(0x1a86, 0x5523) }, |
| 86 | 85 | { USB_DEVICE(0x1a86, 0x7522) }, |
| 87 | 86 | { USB_DEVICE(0x1a86, 0x7523) }, |
| @@ -198,6 +198,8 @@ static void option_instat_callback(struct urb *urb); · 197 unmodified lines | ||
| 198 | 198 | |
| 199 | 199 | #define DELL_PRODUCT_5821E 0x81d7 |
| 200 | 200 | #define DELL_PRODUCT_5821E_ESIM 0x81e0 |
| 201 | +#define DELL_PRODUCT_5829E_ESIM 0x81e4 | |
| 202 | +#define DELL_PRODUCT_5829E 0x81e6 | |
| 201 | 203 | |
| 202 | 204 | #define KYOCERA_VENDOR_ID 0x0c88 |
| 203 | 205 | #define KYOCERA_PRODUCT_KPC650 0x17da |
| @@ -1063,6 +1065,10 @@ static const struct usb_device_id option_ids[] = { · 859 unmodified lines | ||
| 1063 | 1065 | .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
| 1064 | 1066 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM), |
| 1065 | 1067 | .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
| 1068 | + { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E), | |
| 1069 | + .driver_info = RSVD(0) | RSVD(6) }, | |
| 1070 | + { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM), | |
| 1071 | + .driver_info = RSVD(0) | RSVD(6) }, | |
| 1066 | 1072 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ |
| 1067 | 1073 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
| 1068 | 1074 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, |
| @@ -1273,10 +1279,16 @@ static const struct usb_device_id option_ids[] = { · 204 unmodified lines | ||
| 1273 | 1279 | .driver_info = NCTRL(2) }, |
| 1274 | 1280 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */ |
| 1275 | 1281 | .driver_info = NCTRL(2) }, |
| 1282 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701a, 0xff), /* Telit LE910R1 (RNDIS) */ | |
| 1283 | + .driver_info = NCTRL(2) }, | |
| 1284 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE910R1 (ECM) */ | |
| 1285 | + .driver_info = NCTRL(2) }, | |
| 1276 | 1286 | { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ |
| 1277 | 1287 | .driver_info = NCTRL(0) | ZLP }, |
| 1278 | 1288 | { USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing device */ |
| 1279 | 1289 | .driver_info = NCTRL(0) | ZLP }, |
| 1290 | + { USB_DEVICE(TELIT_VENDOR_ID, 0x9201), /* Telit LE910R1 flashing device */ | |
| 1291 | + .driver_info = NCTRL(0) | ZLP }, | |
| 1280 | 1292 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
| 1281 | 1293 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), |
| 1282 | 1294 | .driver_info = RSVD(1) }, |
| @@ -761,12 +761,12 @@ static int tps6598x_probe(struct i2c_client *client) · 760 unmodified lines | ||
| 761 | 761 | |
| 762 | 762 | ret = tps6598x_read32(tps, TPS_REG_STATUS, &status); |
| 763 | 763 | if (ret < 0) |
| 764 | − return ret; | |
| 764 | + goto err_clear_mask; | |
| 765 | 765 | trace_tps6598x_status(status); |
| 766 | 766 | |
| 767 | 767 | ret = tps6598x_read32(tps, TPS_REG_SYSTEM_CONF, &conf); |
| 768 | 768 | if (ret < 0) |
| 769 | − return ret; | |
| 769 | + goto err_clear_mask; | |
| 770 | 770 | |
| 771 | 771 | /* |
| 772 | 772 | * This fwnode has a "compatible" property, but is never populated as a |
| @@ -855,7 +855,8 @@ err_role_put: · 82 unmodified lines | ||
| 855 | 855 | usb_role_switch_put(tps->role_sw); |
| 856 | 856 | err_fwnode_put: |
| 857 | 857 | fwnode_handle_put(fwnode); |
| 858 | − | |
| 858 | +err_clear_mask: | |
| 859 | + tps6598x_write64(tps, TPS_REG_INT_MASK1, 0); | |
| 859 | 860 | return ret; |
| 860 | 861 | } |
| 861 | 862 | |
| @@ -629,16 +629,18 @@ err: · 628 unmodified lines | ||
| 629 | 629 | return ret; |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | −static int vhost_vsock_stop(struct vhost_vsock *vsock) | |
| 632 | +static int vhost_vsock_stop(struct vhost_vsock *vsock, bool check_owner) | |
| 633 | 633 | { |
| 634 | 634 | size_t i; |
| 635 | − int ret; | |
| 635 | + int ret = 0; | |
| 636 | 636 | |
| 637 | 637 | mutex_lock(&vsock->dev.mutex); |
| 638 | 638 | |
| 639 | − ret = vhost_dev_check_owner(&vsock->dev); | |
| 640 | − if (ret) | |
| 641 | − goto err; | |
| 639 | + if (check_owner) { | |
| 640 | + ret = vhost_dev_check_owner(&vsock->dev); | |
| 641 | + if (ret) | |
| 642 | + goto err; | |
| 643 | + } | |
| 642 | 644 | |
| 643 | 645 | for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) { |
| 644 | 646 | struct vhost_virtqueue *vq = &vsock->vqs[i]; |
| @@ -753,7 +755,12 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file) · 108 unmodified lines | ||
| 753 | 755 | * inefficient. Room for improvement here. */ |
| 754 | 756 | vsock_for_each_connected_socket(vhost_vsock_reset_orphans); |
| 755 | 757 | |
| 756 | − vhost_vsock_stop(vsock); | |
| 758 | + /* Don't check the owner, because we are in the release path, so we | |
| 759 | + * need to stop the vsock device in any case. | |
| 760 | + * vhost_vsock_stop() can not fail in this case, so we don't need to | |
| 761 | + * check the return code. | |
| 762 | + */ | |
| 763 | + vhost_vsock_stop(vsock, false); | |
| 757 | 764 | vhost_vsock_flush(vsock); |
| 758 | 765 | vhost_dev_stop(&vsock->dev); |
| 759 | 766 | |
| @@ -868,7 +875,7 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl, · 108 unmodified lines | ||
| 868 | 875 | if (start) |
| 869 | 876 | return vhost_vsock_start(vsock); |
| 870 | 877 | else |
| 871 | − return vhost_vsock_stop(vsock); | |
| 878 | + return vhost_vsock_stop(vsock, true); | |
| 872 | 879 | case VHOST_GET_FEATURES: |
| 873 | 880 | features = VHOST_VSOCK_FEATURES; |
| 874 | 881 | if (copy_to_user(argp, &features, sizeof(features))) |
| @@ -3291,7 +3291,7 @@ void btrfs_exclop_balance(struct btrfs_fs_info *fs_info, · 3290 unmodified lines | ||
| 3291 | 3291 | int __init btrfs_auto_defrag_init(void); |
| 3292 | 3292 | void __cold btrfs_auto_defrag_exit(void); |
| 3293 | 3293 | int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, |
| 3294 | − struct btrfs_inode *inode); | |
| 3294 | + struct btrfs_inode *inode, u32 extent_thresh); | |
| 3295 | 3295 | int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info); |
| 3296 | 3296 | void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info); |
| 3297 | 3297 | int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync); |
| @@ -261,6 +261,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em) · 260 unmodified lines | ||
| 261 | 261 | em->mod_len = (em->mod_len + em->mod_start) - merge->mod_start; |
| 262 | 262 | em->mod_start = merge->mod_start; |
| 263 | 263 | em->generation = max(em->generation, merge->generation); |
| 264 | + set_bit(EXTENT_FLAG_MERGED, &em->flags); | |
| 264 | 265 | |
| 265 | 266 | rb_erase_cached(&merge->rb_node, &tree->map); |
| 266 | 267 | RB_CLEAR_NODE(&merge->rb_node); |
| @@ -278,6 +279,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em) · 11 unmodified lines | ||
| 278 | 279 | RB_CLEAR_NODE(&merge->rb_node); |
| 279 | 280 | em->mod_len = (merge->mod_start + merge->mod_len) - em->mod_start; |
| 280 | 281 | em->generation = max(em->generation, merge->generation); |
| 282 | + set_bit(EXTENT_FLAG_MERGED, &em->flags); | |
| 281 | 283 | free_extent_map(merge); |
| 282 | 284 | } |
| 283 | 285 | } |
| @@ -25,6 +25,8 @@ enum { · 24 unmodified lines | ||
| 25 | 25 | EXTENT_FLAG_FILLING, |
| 26 | 26 | /* filesystem extent mapping type */ |
| 27 | 27 | EXTENT_FLAG_FS_MAPPING, |
| 28 | + /* This em is merged from two or more physically adjacent ems */ | |
| 29 | + EXTENT_FLAG_MERGED, | |
| 28 | 30 | }; |
| 29 | 31 | |
| 30 | 32 | struct extent_map { |
| @@ -40,6 +42,12 @@ struct extent_map { · 9 unmodified lines | ||
| 40 | 42 | u64 ram_bytes; |
| 41 | 43 | u64 block_start; |
| 42 | 44 | u64 block_len; |
| 45 | + | |
| 46 | + /* | |
| 47 | + * Generation of the extent map, for merged em it's the highest | |
| 48 | + * generation of all merged ems. | |
| 49 | + * For non-merged extents, it's from btrfs_file_extent_item::generation. | |
| 50 | + */ | |
| 43 | 51 | u64 generation; |
| 44 | 52 | unsigned long flags; |
| 45 | 53 | /* Used for chunk mappings, flag EXTENT_FLAG_FS_MAPPING must be set */ |
| @@ -50,11 +50,14 @@ struct inode_defrag { · 49 unmodified lines | ||
| 50 | 50 | /* root objectid */ |
| 51 | 51 | u64 root; |
| 52 | 52 | |
| 53 | − /* last offset we were able to defrag */ | |
| 54 | − u64 last_offset; | |
| 55 | − | |
| 56 | − /* if we've wrapped around back to zero once already */ | |
| 57 | − int cycled; | |
| 53 | + /* | |
| 54 | + * The extent size threshold for autodefrag. | |
| 55 | + * | |
| 56 | + * This value is different for compressed/non-compressed extents, | |
| 57 | + * thus needs to be passed from higher layer. | |
| 58 | + * (aka, inode_should_defrag()) | |
| 59 | + */ | |
| 60 | + u32 extent_thresh; | |
| 58 | 61 | }; |
| 59 | 62 | |
| 60 | 63 | static int __compare_inode_defrag(struct inode_defrag *defrag1, |
| @@ -107,8 +110,8 @@ static int __btrfs_add_inode_defrag(struct btrfs_inode *inode, · 46 unmodified lines | ||
| 107 | 110 | */ |
| 108 | 111 | if (defrag->transid < entry->transid) |
| 109 | 112 | entry->transid = defrag->transid; |
| 110 | − if (defrag->last_offset > entry->last_offset) | |
| 111 | − entry->last_offset = defrag->last_offset; | |
| 113 | + entry->extent_thresh = min(defrag->extent_thresh, | |
| 114 | + entry->extent_thresh); | |
| 112 | 115 | return -EEXIST; |
| 113 | 116 | } |
| 114 | 117 | } |
| @@ -134,7 +137,7 @@ static inline int __need_auto_defrag(struct btrfs_fs_info *fs_info) · 19 unmodified lines | ||
| 134 | 137 | * enabled |
| 135 | 138 | */ |
| 136 | 139 | int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, |
| 137 | − struct btrfs_inode *inode) | |
| 140 | + struct btrfs_inode *inode, u32 extent_thresh) | |
| 138 | 141 | { |
| 139 | 142 | struct btrfs_root *root = inode->root; |
| 140 | 143 | struct btrfs_fs_info *fs_info = root->fs_info; |
| @@ -160,6 +163,7 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, · 19 unmodified lines | ||
| 160 | 163 | defrag->ino = btrfs_ino(inode); |
| 161 | 164 | defrag->transid = transid; |
| 162 | 165 | defrag->root = root->root_key.objectid; |
| 166 | + defrag->extent_thresh = extent_thresh; | |
| 163 | 167 | |
| 164 | 168 | spin_lock(&fs_info->defrag_inodes_lock); |
| 165 | 169 | if (!test_bit(BTRFS_INODE_IN_DEFRAG, &inode->runtime_flags)) { |
| @@ -178,34 +182,6 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, · 12 unmodified lines | ||
| 178 | 182 | return 0; |
| 179 | 183 | } |
| 180 | 184 | |
| 181 | −/* | |
| 182 | − * Requeue the defrag object. If there is a defrag object that points to | |
| 183 | − * the same inode in the tree, we will merge them together (by | |
| 184 | − * __btrfs_add_inode_defrag()) and free the one that we want to requeue. | |
| 185 | − */ | |
| 186 | −static void btrfs_requeue_inode_defrag(struct btrfs_inode *inode, | |
| 187 | − struct inode_defrag *defrag) | |
| 188 | −{ | |
| 189 | − struct btrfs_fs_info *fs_info = inode->root->fs_info; | |
| 190 | − int ret; | |
| 191 | − | |
| 192 | − if (!__need_auto_defrag(fs_info)) | |
| 193 | − goto out; | |
| 194 | − | |
| 195 | − /* | |
| 196 | − * Here we don't check the IN_DEFRAG flag, because we need merge | |
| 197 | − * them together. | |
| 198 | − */ | |
| 199 | − spin_lock(&fs_info->defrag_inodes_lock); | |
| 200 | − ret = __btrfs_add_inode_defrag(inode, defrag); | |
| 201 | − spin_unlock(&fs_info->defrag_inodes_lock); | |
| 202 | − if (ret) | |
| 203 | − goto out; | |
| 204 | − return; | |
| 205 | −out: | |
| 206 | − kmem_cache_free(btrfs_inode_defrag_cachep, defrag); | |
| 207 | −} | |
| 208 | − | |
| 209 | 185 | /* |
| 210 | 186 | * pick the defragable inode that we want, if it doesn't exist, we will get |
| 211 | 187 | * the next one. |
| @@ -278,8 +254,14 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info, · 66 unmodified lines | ||
| 278 | 254 | struct btrfs_root *inode_root; |
| 279 | 255 | struct inode *inode; |
| 280 | 256 | struct btrfs_ioctl_defrag_range_args range; |
| 281 | − int num_defrag; | |
| 282 | − int ret; | |
| 257 | + int ret = 0; | |
| 258 | + u64 cur = 0; | |
| 259 | + | |
| 260 | +again: | |
| 261 | + if (test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state)) | |
| 262 | + goto cleanup; | |
| 263 | + if (!__need_auto_defrag(fs_info)) | |
| 264 | + goto cleanup; | |
| 283 | 265 | |
| 284 | 266 | /* get the inode */ |
| 285 | 267 | inode_root = btrfs_get_fs_root(fs_info, defrag->root, true); |
| @@ -295,39 +277,30 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info, · 9 unmodified lines | ||
| 295 | 277 | goto cleanup; |
| 296 | 278 | } |
| 297 | 279 | |
| 280 | + if (cur >= i_size_read(inode)) { | |
| 281 | + iput(inode); | |
| 282 | + goto cleanup; | |
| 283 | + } | |
| 284 | + | |
| 298 | 285 | /* do a chunk of defrag */ |
| 299 | 286 | clear_bit(BTRFS_INODE_IN_DEFRAG, &BTRFS_I(inode)->runtime_flags); |
| 300 | 287 | memset(&range, 0, sizeof(range)); |
| 301 | 288 | range.len = (u64)-1; |
| 302 | − range.start = defrag->last_offset; | |
| 289 | + range.start = cur; | |
| 290 | + range.extent_thresh = defrag->extent_thresh; | |
| 303 | 291 | |
| 304 | 292 | sb_start_write(fs_info->sb); |
| 305 | − num_defrag = btrfs_defrag_file(inode, NULL, &range, defrag->transid, | |
| 293 | + ret = btrfs_defrag_file(inode, NULL, &range, defrag->transid, | |
| 306 | 294 | BTRFS_DEFRAG_BATCH); |
| 307 | 295 | sb_end_write(fs_info->sb); |
| 308 | − /* | |
| 309 | − * if we filled the whole defrag batch, there | |
| 310 | − * must be more work to do. Queue this defrag | |
| 311 | − * again | |
| 312 | − */ | |
| 313 | − if (num_defrag == BTRFS_DEFRAG_BATCH) { | |
| 314 | − defrag->last_offset = range.start; | |
| 315 | − btrfs_requeue_inode_defrag(BTRFS_I(inode), defrag); | |
| 316 | − } else if (defrag->last_offset && !defrag->cycled) { | |
| 317 | − /* | |
| 318 | − * we didn't fill our defrag batch, but | |
| 319 | − * we didn't start at zero. Make sure we loop | |
| 320 | − * around to the start of the file. | |
| 321 | − */ | |
| 322 | − defrag->last_offset = 0; | |
| 323 | − defrag->cycled = 1; | |
| 324 | − btrfs_requeue_inode_defrag(BTRFS_I(inode), defrag); | |
| 325 | − } else { | |
| 326 | − kmem_cache_free(btrfs_inode_defrag_cachep, defrag); | |
| 327 | − } | |
| 328 | − | |
| 329 | 296 | iput(inode); |
| 330 | − return 0; | |
| 297 | + | |
| 298 | + if (ret < 0) | |
| 299 | + goto cleanup; | |
| 300 | + | |
| 301 | + cur = max(cur + fs_info->sectorsize, range.start); | |
| 302 | + goto again; | |
| 303 | + | |
| 331 | 304 | cleanup: |
| 332 | 305 | kmem_cache_free(btrfs_inode_defrag_cachep, defrag); |
| 333 | 306 | return ret; |
| @@ -560,12 +560,12 @@ static inline int inode_need_compress(struct btrfs_inode *inode, u64 start, · 559 unmodified lines | ||
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | static inline void inode_should_defrag(struct btrfs_inode *inode, |
| 563 | − u64 start, u64 end, u64 num_bytes, u64 small_write) | |
| 563 | + u64 start, u64 end, u64 num_bytes, u32 small_write) | |
| 564 | 564 | { |
| 565 | 565 | /* If this is a small write inside eof, kick off a defrag */ |
| 566 | 566 | if (num_bytes < small_write && |
| 567 | 567 | (start > 0 || end + 1 < inode->disk_i_size)) |
| 568 | − btrfs_add_inode_defrag(NULL, inode); | |
| 568 | + btrfs_add_inode_defrag(NULL, inode, small_write); | |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | /* |
| @@ -1012,8 +1012,155 @@ out: · 1011 unmodified lines | ||
| 1012 | 1012 | return ret; |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | +/* | |
| 1016 | + * Defrag specific helper to get an extent map. | |
| 1017 | + * | |
| 1018 | + * Differences between this and btrfs_get_extent() are: | |
| 1019 | + * | |
| 1020 | + * - No extent_map will be added to inode->extent_tree | |
| 1021 | + * To reduce memory usage in the long run. | |
| 1022 | + * | |
| 1023 | + * - Extra optimization to skip file extents older than @newer_than | |
| 1024 | + * By using btrfs_search_forward() we can skip entire file ranges that | |
| 1025 | + * have extents created in past transactions, because btrfs_search_forward() | |
| 1026 | + * will not visit leaves and nodes with a generation smaller than given | |
| 1027 | + * minimal generation threshold (@newer_than). | |
| 1028 | + * | |
| 1029 | + * Return valid em if we find a file extent matching the requirement. | |
| 1030 | + * Return NULL if we can not find a file extent matching the requirement. | |
| 1031 | + * | |
| 1032 | + * Return ERR_PTR() for error. | |
| 1033 | + */ | |
| 1034 | +static struct extent_map *defrag_get_extent(struct btrfs_inode *inode, | |
| 1035 | + u64 start, u64 newer_than) | |
| 1036 | +{ | |
| 1037 | + struct btrfs_root *root = inode->root; | |
| 1038 | + struct btrfs_file_extent_item *fi; | |
| 1039 | + struct btrfs_path path = { 0 }; | |
| 1040 | + struct extent_map *em; | |
| 1041 | + struct btrfs_key key; | |
| 1042 | + u64 ino = btrfs_ino(inode); | |
| 1043 | + int ret; | |
| 1044 | + | |
| 1045 | + em = alloc_extent_map(); | |
| 1046 | + if (!em) { | |
| 1047 | + ret = -ENOMEM; | |
| 1048 | + goto err; | |
| 1049 | + } | |
| 1050 | + | |
| 1051 | + key.objectid = ino; | |
| 1052 | + key.type = BTRFS_EXTENT_DATA_KEY; | |
| 1053 | + key.offset = start; | |
| 1054 | + | |
| 1055 | + if (newer_than) { | |
| 1056 | + ret = btrfs_search_forward(root, &key, &path, newer_than); | |
| 1057 | + if (ret < 0) | |
| 1058 | + goto err; | |
| 1059 | + /* Can't find anything newer */ | |
| 1060 | + if (ret > 0) | |
| 1061 | + goto not_found; | |
| 1062 | + } else { | |
| 1063 | + ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0); | |
| 1064 | + if (ret < 0) | |
| 1065 | + goto err; | |
| 1066 | + } | |
| 1067 | + if (path.slots[0] >= btrfs_header_nritems(path.nodes[0])) { | |
| 1068 | + /* | |
| 1069 | + * If btrfs_search_slot() makes path to point beyond nritems, | |
| 1070 | + * we should not have an empty leaf, as this inode must at | |
| 1071 | + * least have its INODE_ITEM. | |
| 1072 | + */ | |
| 1073 | + ASSERT(btrfs_header_nritems(path.nodes[0])); | |
| 1074 | + path.slots[0] = btrfs_header_nritems(path.nodes[0]) - 1; | |
| 1075 | + } | |
| 1076 | + btrfs_item_key_to_cpu(path.nodes[0], &key, path.slots[0]); | |
| 1077 | + /* Perfect match, no need to go one slot back */ | |
| 1078 | + if (key.objectid == ino && key.type == BTRFS_EXTENT_DATA_KEY && | |
| 1079 | + key.offset == start) | |
| 1080 | + goto iterate; | |
| 1081 | + | |
| 1082 | + /* We didn't find a perfect match, needs to go one slot back */ | |
| 1083 | + if (path.slots[0] > 0) { | |
| 1084 | + btrfs_item_key_to_cpu(path.nodes[0], &key, path.slots[0]); | |
| 1085 | + if (key.objectid == ino && key.type == BTRFS_EXTENT_DATA_KEY) | |
| 1086 | + path.slots[0]--; | |
| 1087 | + } | |
| 1088 | + | |
| 1089 | +iterate: | |
| 1090 | + /* Iterate through the path to find a file extent covering @start */ | |
| 1091 | + while (true) { | |
| 1092 | + u64 extent_end; | |
| 1093 | + | |
| 1094 | + if (path.slots[0] >= btrfs_header_nritems(path.nodes[0])) | |
| 1095 | + goto next; | |
| 1096 | + | |
| 1097 | + btrfs_item_key_to_cpu(path.nodes[0], &key, path.slots[0]); | |
| 1098 | + | |
| 1099 | + /* | |
| 1100 | + * We may go one slot back to INODE_REF/XATTR item, then | |
| 1101 | + * need to go forward until we reach an EXTENT_DATA. | |
| 1102 | + * But we should still has the correct ino as key.objectid. | |
| 1103 | + */ | |
| 1104 | + if (WARN_ON(key.objectid < ino) || key.type < BTRFS_EXTENT_DATA_KEY) | |
| 1105 | + goto next; | |
| 1106 | + | |
| 1107 | + /* It's beyond our target range, definitely not extent found */ | |
| 1108 | + if (key.objectid > ino || key.type > BTRFS_EXTENT_DATA_KEY) | |
| 1109 | + goto not_found; | |
| 1110 | + | |
| 1111 | + /* | |
| 1112 | + * | |<- File extent ->| | |
| 1113 | + * \- start | |
| 1114 | + * | |
| 1115 | + * This means there is a hole between start and key.offset. | |
| 1116 | + */ | |
| 1117 | + if (key.offset > start) { | |
| 1118 | + em->start = start; | |
| 1119 | + em->orig_start = start; | |
| 1120 | + em->block_start = EXTENT_MAP_HOLE; | |
| 1121 | + em->len = key.offset - start; | |
| 1122 | + break; | |
| 1123 | + } | |
| 1124 | + | |
| 1125 | + fi = btrfs_item_ptr(path.nodes[0], path.slots[0], | |
| 1126 | + struct btrfs_file_extent_item); | |
| 1127 | + extent_end = btrfs_file_extent_end(&path); | |
| 1128 | + | |
| 1129 | + /* | |
| 1130 | + * |<- file extent ->| | | |
| 1131 | + * \- start | |
| 1132 | + * | |
| 1133 | + * We haven't reached start, search next slot. | |
| 1134 | + */ | |
| 1135 | + if (extent_end <= start) | |
| 1136 | + goto next; | |
| 1137 | + | |
| 1138 | + /* Now this extent covers @start, convert it to em */ | |
| 1139 | + btrfs_extent_item_to_extent_map(inode, &path, fi, false, em); | |
| 1140 | + break; | |
| 1141 | +next: | |
| 1142 | + ret = btrfs_next_item(root, &path); | |
| 1143 | + if (ret < 0) | |
| 1144 | + goto err; | |
| 1145 | + if (ret > 0) | |
| 1146 | + goto not_found; | |
| 1147 | + } | |
| 1148 | + btrfs_release_path(&path); | |
| 1149 | + return em; | |
| 1150 | + | |
| 1151 | +not_found: | |
| 1152 | + btrfs_release_path(&path); | |
| 1153 | + free_extent_map(em); | |
| 1154 | + return NULL; | |
| 1155 | + | |
| 1156 | +err: | |
| 1157 | + btrfs_release_path(&path); | |
| 1158 | + free_extent_map(em); | |
| 1159 | + return ERR_PTR(ret); | |
| 1160 | +} | |
| 1161 | + | |
| 1015 | 1162 | static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start, |
| 1016 | − bool locked) | |
| 1163 | + u64 newer_than, bool locked) | |
| 1017 | 1164 | { |
| 1018 | 1165 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; |
| 1019 | 1166 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
| @@ -1028,6 +1175,20 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start, · 8 unmodified lines | ||
| 1028 | 1175 | em = lookup_extent_mapping(em_tree, start, sectorsize); |
| 1029 | 1176 | read_unlock(&em_tree->lock); |
| 1030 | 1177 | |
| 1178 | + /* | |
| 1179 | + * We can get a merged extent, in that case, we need to re-search | |
| 1180 | + * tree to get the original em for defrag. | |
| 1181 | + * | |
| 1182 | + * If @newer_than is 0 or em::generation < newer_than, we can trust | |
| 1183 | + * this em, as either we don't care about the generation, or the | |
| 1184 | + * merged extent map will be rejected anyway. | |
| 1185 | + */ | |
| 1186 | + if (em && test_bit(EXTENT_FLAG_MERGED, &em->flags) && | |
| 1187 | + newer_than && em->generation >= newer_than) { | |
| 1188 | + free_extent_map(em); | |
| 1189 | + em = NULL; | |
| 1190 | + } | |
| 1191 | + | |
| 1031 | 1192 | if (!em) { |
| 1032 | 1193 | struct extent_state *cached = NULL; |
| 1033 | 1194 | u64 end = start + sectorsize - 1; |
| @@ -1035,7 +1196,7 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start, · 1 unmodified line | ||
| 1035 | 1196 | /* get the big lock and read metadata off disk */ |
| 1036 | 1197 | if (!locked) |
| 1037 | 1198 | lock_extent_bits(io_tree, start, end, &cached); |
| 1038 | − em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, sectorsize); | |
| 1199 | + em = defrag_get_extent(BTRFS_I(inode), start, newer_than); | |
| 1039 | 1200 | if (!locked) |
| 1040 | 1201 | unlock_extent_cached(io_tree, start, end, &cached); |
| 1041 | 1202 | |
| @@ -1046,23 +1207,42 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start, · 4 unmodified lines | ||
| 1046 | 1207 | return em; |
| 1047 | 1208 | } |
| 1048 | 1209 | |
| 1210 | +static u32 get_extent_max_capacity(const struct extent_map *em) | |
| 1211 | +{ | |
| 1212 | + if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) | |
| 1213 | + return BTRFS_MAX_COMPRESSED; | |
| 1214 | + return BTRFS_MAX_EXTENT_SIZE; | |
| 1215 | +} | |
| 1216 | + | |
| 1049 | 1217 | static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em, |
| 1050 | 1218 | bool locked) |
| 1051 | 1219 | { |
| 1052 | 1220 | struct extent_map *next; |
| 1053 | − bool ret = true; | |
| 1221 | + bool ret = false; | |
| 1054 | 1222 | |
| 1055 | 1223 | /* this is the last extent */ |
| 1056 | 1224 | if (em->start + em->len >= i_size_read(inode)) |
| 1057 | 1225 | return false; |
| 1058 | 1226 | |
| 1059 | − next = defrag_lookup_extent(inode, em->start + em->len, locked); | |
| 1227 | + /* | |
| 1228 | + * We want to check if the next extent can be merged with the current | |
| 1229 | + * one, which can be an extent created in a past generation, so we pass | |
| 1230 | + * a minimum generation of 0 to defrag_lookup_extent(). | |
| 1231 | + */ | |
| 1232 | + next = defrag_lookup_extent(inode, em->start + em->len, 0, locked); | |
| 1233 | + /* No more em or hole */ | |
| 1060 | 1234 | if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE) |
| 1061 | − ret = false; | |
| 1062 | − else if ((em->block_start + em->block_len == next->block_start) && | |
| 1063 | − (em->block_len > SZ_128K && next->block_len > SZ_128K)) | |
| 1064 | − ret = false; | |
| 1065 | − | |
| 1235 | + goto out; | |
| 1236 | + if (test_bit(EXTENT_FLAG_PREALLOC, &next->flags)) | |
| 1237 | + goto out; | |
| 1238 | + /* | |
| 1239 | + * If the next extent is at its max capacity, defragging current extent | |
| 1240 | + * makes no sense, as the total number of extents won't change. | |
| 1241 | + */ | |
| 1242 | + if (next->len >= get_extent_max_capacity(em)) | |
| 1243 | + goto out; | |
| 1244 | + ret = true; | |
| 1245 | +out: | |
| 1066 | 1246 | free_extent_map(next); |
| 1067 | 1247 | return ret; |
| 1068 | 1248 | } |
| @@ -1186,8 +1366,10 @@ struct defrag_target_range { · 117 unmodified lines | ||
| 1186 | 1366 | static int defrag_collect_targets(struct btrfs_inode *inode, |
| 1187 | 1367 | u64 start, u64 len, u32 extent_thresh, |
| 1188 | 1368 | u64 newer_than, bool do_compress, |
| 1189 | − bool locked, struct list_head *target_list) | |
| 1369 | + bool locked, struct list_head *target_list, | |
| 1370 | + u64 *last_scanned_ret) | |
| 1190 | 1371 | { |
| 1372 | + bool last_is_target = false; | |
| 1191 | 1373 | u64 cur = start; |
| 1192 | 1374 | int ret = 0; |
| 1193 | 1375 | |
| @@ -1197,7 +1379,9 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 3 unmodified lines | ||
| 1197 | 1379 | bool next_mergeable = true; |
| 1198 | 1380 | u64 range_len; |
| 1199 | 1381 | |
| 1200 | − em = defrag_lookup_extent(&inode->vfs_inode, cur, locked); | |
| 1382 | + last_is_target = false; | |
| 1383 | + em = defrag_lookup_extent(&inode->vfs_inode, cur, | |
| 1384 | + newer_than, locked); | |
| 1201 | 1385 | if (!em) |
| 1202 | 1386 | break; |
| 1203 | 1387 | |
| @@ -1210,6 +1394,10 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 6 unmodified lines | ||
| 1210 | 1394 | if (em->generation < newer_than) |
| 1211 | 1395 | goto next; |
| 1212 | 1396 | |
| 1397 | + /* This em is under writeback, no need to defrag */ | |
| 1398 | + if (em->generation == (u64)-1) | |
| 1399 | + goto next; | |
| 1400 | + | |
| 1213 | 1401 | /* |
| 1214 | 1402 | * Our start offset might be in the middle of an existing extent |
| 1215 | 1403 | * map, so take that into account. |
| @@ -1250,6 +1438,13 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 34 unmodified lines | ||
| 1250 | 1438 | if (range_len >= extent_thresh) |
| 1251 | 1439 | goto next; |
| 1252 | 1440 | |
| 1441 | + /* | |
| 1442 | + * Skip extents already at its max capacity, this is mostly for | |
| 1443 | + * compressed extents, which max cap is only 128K. | |
| 1444 | + */ | |
| 1445 | + if (em->len >= get_extent_max_capacity(em)) | |
| 1446 | + goto next; | |
| 1447 | + | |
| 1253 | 1448 | next_mergeable = defrag_check_next_extent(&inode->vfs_inode, em, |
| 1254 | 1449 | locked); |
| 1255 | 1450 | if (!next_mergeable) { |
| @@ -1268,6 +1463,7 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 12 unmodified lines | ||
| 1268 | 1463 | } |
| 1269 | 1464 | |
| 1270 | 1465 | add: |
| 1466 | + last_is_target = true; | |
| 1271 | 1467 | range_len = min(extent_map_end(em), start + len) - cur; |
| 1272 | 1468 | /* |
| 1273 | 1469 | * This one is a good target, check if it can be merged into |
| @@ -1311,6 +1507,17 @@ next: · 37 unmodified lines | ||
| 1311 | 1507 | kfree(entry); |
| 1312 | 1508 | } |
| 1313 | 1509 | } |
| 1510 | + if (!ret && last_scanned_ret) { | |
| 1511 | + /* | |
| 1512 | + * If the last extent is not a target, the caller can skip to | |
| 1513 | + * the end of that extent. | |
| 1514 | + * Otherwise, we can only go the end of the specified range. | |
| 1515 | + */ | |
| 1516 | + if (!last_is_target) | |
| 1517 | + *last_scanned_ret = max(cur, *last_scanned_ret); | |
| 1518 | + else | |
| 1519 | + *last_scanned_ret = max(start + len, *last_scanned_ret); | |
| 1520 | + } | |
| 1314 | 1521 | return ret; |
| 1315 | 1522 | } |
| 1316 | 1523 | |
| @@ -1369,7 +1576,8 @@ static int defrag_one_locked_target(struct btrfs_inode *inode, · 52 unmodified lines | ||
| 1369 | 1576 | } |
| 1370 | 1577 | |
| 1371 | 1578 | static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len, |
| 1372 | − u32 extent_thresh, u64 newer_than, bool do_compress) | |
| 1579 | + u32 extent_thresh, u64 newer_than, bool do_compress, | |
| 1580 | + u64 *last_scanned_ret) | |
| 1373 | 1581 | { |
| 1374 | 1582 | struct extent_state *cached_state = NULL; |
| 1375 | 1583 | struct defrag_target_range *entry; |
| @@ -1415,7 +1623,7 @@ static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len, · 39 unmodified lines | ||
| 1415 | 1623 | */ |
| 1416 | 1624 | ret = defrag_collect_targets(inode, start, len, extent_thresh, |
| 1417 | 1625 | newer_than, do_compress, true, |
| 1418 | − &target_list); | |
| 1626 | + &target_list, last_scanned_ret); | |
| 1419 | 1627 | if (ret < 0) |
| 1420 | 1628 | goto unlock_extent; |
| 1421 | 1629 | |
| @@ -1450,7 +1658,8 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 28 unmodified lines | ||
| 1450 | 1658 | u64 start, u32 len, u32 extent_thresh, |
| 1451 | 1659 | u64 newer_than, bool do_compress, |
| 1452 | 1660 | unsigned long *sectors_defragged, |
| 1453 | − unsigned long max_sectors) | |
| 1661 | + unsigned long max_sectors, | |
| 1662 | + u64 *last_scanned_ret) | |
| 1454 | 1663 | { |
| 1455 | 1664 | const u32 sectorsize = inode->root->fs_info->sectorsize; |
| 1456 | 1665 | struct defrag_target_range *entry; |
| @@ -1461,7 +1670,7 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 4 unmodified lines | ||
| 1461 | 1670 | BUILD_BUG_ON(!IS_ALIGNED(CLUSTER_SIZE, PAGE_SIZE)); |
| 1462 | 1671 | ret = defrag_collect_targets(inode, start, len, extent_thresh, |
| 1463 | 1672 | newer_than, do_compress, false, |
| 1464 | − &target_list); | |
| 1673 | + &target_list, NULL); | |
| 1465 | 1674 | if (ret < 0) |
| 1466 | 1675 | goto out; |
| 1467 | 1676 | |
| @@ -1478,6 +1687,15 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 10 unmodified lines | ||
| 1478 | 1687 | range_len = min_t(u32, range_len, |
| 1479 | 1688 | (max_sectors - *sectors_defragged) * sectorsize); |
| 1480 | 1689 | |
| 1690 | + /* | |
| 1691 | + * If defrag_one_range() has updated last_scanned_ret, | |
| 1692 | + * our range may already be invalid (e.g. hole punched). | |
| 1693 | + * Skip if our range is before last_scanned_ret, as there is | |
| 1694 | + * no need to defrag the range anymore. | |
| 1695 | + */ | |
| 1696 | + if (entry->start + range_len <= *last_scanned_ret) | |
| 1697 | + continue; | |
| 1698 | + | |
| 1481 | 1699 | if (ra) |
| 1482 | 1700 | page_cache_sync_readahead(inode->vfs_inode.i_mapping, |
| 1483 | 1701 | ra, NULL, entry->start >> PAGE_SHIFT, |
| @@ -1490,7 +1708,8 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 6 unmodified lines | ||
| 1490 | 1708 | * accounting. |
| 1491 | 1709 | */ |
| 1492 | 1710 | ret = defrag_one_range(inode, entry->start, range_len, |
| 1493 | − extent_thresh, newer_than, do_compress); | |
| 1711 | + extent_thresh, newer_than, do_compress, | |
| 1712 | + last_scanned_ret); | |
| 1494 | 1713 | if (ret < 0) |
| 1495 | 1714 | break; |
| 1496 | 1715 | *sectors_defragged += range_len >> |
| @@ -1501,6 +1720,8 @@ out: · 4 unmodified lines | ||
| 1501 | 1720 | list_del_init(&entry->list); |
| 1502 | 1721 | kfree(entry); |
| 1503 | 1722 | } |
| 1723 | + if (ret >= 0) | |
| 1724 | + *last_scanned_ret = max(*last_scanned_ret, start + len); | |
| 1504 | 1725 | return ret; |
| 1505 | 1726 | } |
| 1506 | 1727 | |
| @@ -1586,6 +1807,7 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, · 79 unmodified lines | ||
| 1586 | 1807 | |
| 1587 | 1808 | while (cur < last_byte) { |
| 1588 | 1809 | const unsigned long prev_sectors_defragged = sectors_defragged; |
| 1810 | + u64 last_scanned = cur; | |
| 1589 | 1811 | u64 cluster_end; |
| 1590 | 1812 | |
| 1591 | 1813 | /* The cluster size 256K should always be page aligned */ |
| @@ -1615,8 +1837,8 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, · 23 unmodified lines | ||
| 1615 | 1837 | BTRFS_I(inode)->defrag_compress = compress_type; |
| 1616 | 1838 | ret = defrag_one_cluster(BTRFS_I(inode), ra, cur, |
| 1617 | 1839 | cluster_end + 1 - cur, extent_thresh, |
| 1618 | − newer_than, do_compress, | |
| 1619 | − §ors_defragged, max_to_defrag); | |
| 1840 | + newer_than, do_compress, §ors_defragged, | |
| 1841 | + max_to_defrag, &last_scanned); | |
| 1620 | 1842 | |
| 1621 | 1843 | if (sectors_defragged > prev_sectors_defragged) |
| 1622 | 1844 | balance_dirty_pages_ratelimited(inode->i_mapping); |
| @@ -1624,11 +1846,12 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, · 1 unmodified line | ||
| 1624 | 1846 | btrfs_inode_unlock(inode, 0); |
| 1625 | 1847 | if (ret < 0) |
| 1626 | 1848 | break; |
| 1627 | − cur = cluster_end + 1; | |
| 1849 | + cur = max(cluster_end + 1, last_scanned); | |
| 1628 | 1850 | if (ret > 0) { |
| 1629 | 1851 | ret = 0; |
| 1630 | 1852 | break; |
| 1631 | 1853 | } |
| 1854 | + cond_resched(); | |
| 1632 | 1855 | } |
| 1633 | 1856 | |
| 1634 | 1857 | if (ra_allocated) |
| @@ -380,6 +380,17 @@ int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb) · 379 unmodified lines | ||
| 380 | 380 | kunmap(cur_page); |
| 381 | 381 | cur_in += LZO_LEN; |
| 382 | 382 | |
| 383 | + if (seg_len > lzo1x_worst_compress(PAGE_SIZE)) { | |
| 384 | + /* | |
| 385 | + * seg_len shouldn't be larger than we have allocated | |
| 386 | + * for workspace->cbuf | |
| 387 | + */ | |
| 388 | + btrfs_err(fs_info, "unexpectedly large lzo segment len %u", | |
| 389 | + seg_len); | |
| 390 | + ret = -EIO; | |
| 391 | + goto out; | |
| 392 | + } | |
| 393 | + | |
| 383 | 394 | /* Copy the compressed segment payload into workspace */ |
| 384 | 395 | copy_compressed_segment(cb, workspace->cbuf, seg_len, &cur_in); |
| 385 | 396 | |
| @@ -4999,6 +4999,10 @@ static int put_file_data(struct send_ctx *sctx, u64 offset, u32 len) · 4998 unmodified lines | ||
| 4999 | 4999 | lock_page(page); |
| 5000 | 5000 | if (!PageUptodate(page)) { |
| 5001 | 5001 | unlock_page(page); |
| 5002 | + btrfs_err(fs_info, | |
| 5003 | + "send: IO error at offset %llu for inode %llu root %llu", | |
| 5004 | + page_offset(page), sctx->cur_ino, | |
| 5005 | + sctx->send_root->root_key.objectid); | |
| 5002 | 5006 | put_page(page); |
| 5003 | 5007 | ret = -EIO; |
| 5004 | 5008 | break; |
| @@ -1981,16 +1981,24 @@ static void btrfs_cleanup_pending_block_groups(struct btrfs_trans_handle *trans) · 1980 unmodified lines | ||
| 1981 | 1981 | static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info) |
| 1982 | 1982 | { |
| 1983 | 1983 | /* |
| 1984 | − * We use writeback_inodes_sb here because if we used | |
| 1984 | + * We use try_to_writeback_inodes_sb() here because if we used | |
| 1985 | 1985 | * btrfs_start_delalloc_roots we would deadlock with fs freeze. |
| 1986 | 1986 | * Currently are holding the fs freeze lock, if we do an async flush |
| 1987 | 1987 | * we'll do btrfs_join_transaction() and deadlock because we need to |
| 1988 | 1988 | * wait for the fs freeze lock. Using the direct flushing we benefit |
| 1989 | 1989 | * from already being in a transaction and our join_transaction doesn't |
| 1990 | 1990 | * have to re-take the fs freeze lock. |
| 1991 | + * | |
| 1992 | + * Note that try_to_writeback_inodes_sb() will only trigger writeback | |
| 1993 | + * if it can read lock sb->s_umount. It will always be able to lock it, | |
| 1994 | + * except when the filesystem is being unmounted or being frozen, but in | |
| 1995 | + * those cases sync_filesystem() is called, which results in calling | |
| 1996 | + * writeback_inodes_sb() while holding a write lock on sb->s_umount. | |
| 1997 | + * Note that we don't call writeback_inodes_sb() directly, because it | |
| 1998 | + * will emit a warning if sb->s_umount is not locked. | |
| 1991 | 1999 | */ |
| 1992 | 2000 | if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) |
| 1993 | − writeback_inodes_sb(fs_info->sb, WB_REASON_SYNC); | |
| 2001 | + try_to_writeback_inodes_sb(fs_info->sb, WB_REASON_SYNC); | |
| 1994 | 2002 | return 0; |
| 1995 | 2003 | } |
| 1996 | 2004 | |
| @@ -949,6 +949,9 @@ static void populate_new_aces(char *nacl_base, · 948 unmodified lines | ||
| 949 | 949 | pnntace = (struct cifs_ace *) (nacl_base + nsize); |
| 950 | 950 | nsize += setup_special_mode_ACE(pnntace, nmode); |
| 951 | 951 | num_aces++; |
| 952 | + pnntace = (struct cifs_ace *) (nacl_base + nsize); | |
| 953 | + nsize += setup_authusers_ACE(pnntace); | |
| 954 | + num_aces++; | |
| 952 | 955 | goto set_size; |
| 953 | 956 | } |
| 954 | 957 | |
| @@ -1297,7 +1300,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, · 342 unmodified lines | ||
| 1297 | 1300 | |
| 1298 | 1301 | if (uid_valid(uid)) { /* chown */ |
| 1299 | 1302 | uid_t id; |
| 1300 | − nowner_sid_ptr = kmalloc(sizeof(struct cifs_sid), | |
| 1303 | + nowner_sid_ptr = kzalloc(sizeof(struct cifs_sid), | |
| 1301 | 1304 | GFP_KERNEL); |
| 1302 | 1305 | if (!nowner_sid_ptr) { |
| 1303 | 1306 | rc = -ENOMEM; |
| @@ -1326,7 +1329,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, · 22 unmodified lines | ||
| 1326 | 1329 | } |
| 1327 | 1330 | if (gid_valid(gid)) { /* chgrp */ |
| 1328 | 1331 | gid_t id; |
| 1329 | − ngroup_sid_ptr = kmalloc(sizeof(struct cifs_sid), | |
| 1332 | + ngroup_sid_ptr = kzalloc(sizeof(struct cifs_sid), | |
| 1330 | 1333 | GFP_KERNEL); |
| 1331 | 1334 | if (!ngroup_sid_ptr) { |
| 1332 | 1335 | rc = -ENOMEM; |
| @@ -1613,7 +1616,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode, · 280 unmodified lines | ||
| 1613 | 1616 | nsecdesclen = secdesclen; |
| 1614 | 1617 | if (pnmode && *pnmode != NO_CHANGE_64) { /* chmod */ |
| 1615 | 1618 | if (mode_from_sid) |
| 1616 | − nsecdesclen += sizeof(struct cifs_ace); | |
| 1619 | + nsecdesclen += 2 * sizeof(struct cifs_ace); | |
| 1617 | 1620 | else /* cifsacl */ |
| 1618 | 1621 | nsecdesclen += 5 * sizeof(struct cifs_ace); |
| 1619 | 1622 | } else { /* chown */ |
| @@ -919,6 +919,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, · 918 unmodified lines | ||
| 919 | 919 | |
| 920 | 920 | out_super: |
| 921 | 921 | deactivate_locked_super(sb); |
| 922 | + return root; | |
| 922 | 923 | out: |
| 923 | 924 | if (cifs_sb) { |
| 924 | 925 | kfree(cifs_sb->prepath); |
| @@ -149,7 +149,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = { · 148 unmodified lines | ||
| 149 | 149 | fsparam_u32("echo_interval", Opt_echo_interval), |
| 150 | 150 | fsparam_u32("max_credits", Opt_max_credits), |
| 151 | 151 | fsparam_u32("handletimeout", Opt_handletimeout), |
| 152 | − fsparam_u32("snapshot", Opt_snapshot), | |
| 152 | + fsparam_u64("snapshot", Opt_snapshot), | |
| 153 | 153 | fsparam_u32("max_channels", Opt_max_channels), |
| 154 | 154 | |
| 155 | 155 | /* Mount options which take string value */ |
| @@ -1078,7 +1078,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, · 922 unmodified lines | ||
| 1078 | 1078 | ctx->echo_interval = result.uint_32; |
| 1079 | 1079 | break; |
| 1080 | 1080 | case Opt_snapshot: |
| 1081 | − ctx->snapshot_time = result.uint_32; | |
| 1081 | + ctx->snapshot_time = result.uint_64; | |
| 1082 | 1082 | break; |
| 1083 | 1083 | case Opt_max_credits: |
| 1084 | 1084 | if (result.uint_32 < 20 || result.uint_32 > 60000) { |
| @@ -127,11 +127,6 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) · 126 unmodified lines | ||
| 127 | 127 | struct cifs_server_iface *ifaces = NULL; |
| 128 | 128 | size_t iface_count; |
| 129 | 129 | |
| 130 | − if (ses->server->dialect < SMB30_PROT_ID) { | |
| 131 | − cifs_dbg(VFS, "multichannel is not supported on this protocol version, use 3.0 or above\n"); | |
| 132 | − return 0; | |
| 133 | − } | |
| 134 | − | |
| 135 | 130 | spin_lock(&ses->chan_lock); |
| 136 | 131 | |
| 137 | 132 | new_chan_count = old_chan_count = ses->chan_count; |
| @@ -145,6 +140,12 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) · 7 unmodified lines | ||
| 145 | 140 | return 0; |
| 146 | 141 | } |
| 147 | 142 | |
| 143 | + if (ses->server->dialect < SMB30_PROT_ID) { | |
| 144 | + spin_unlock(&ses->chan_lock); | |
| 145 | + cifs_dbg(VFS, "multichannel is not supported on this protocol version, use 3.0 or above\n"); | |
| 146 | + return 0; | |
| 147 | + } | |
| 148 | + | |
| 148 | 149 | if (!(ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { |
| 149 | 150 | ses->chan_max = 1; |
| 150 | 151 | spin_unlock(&ses->chan_lock); |
| @@ -175,11 +175,13 @@ static int cifs_xattr_set(const struct xattr_handler *handler, · 174 unmodified lines | ||
| 175 | 175 | switch (handler->flags) { |
| 176 | 176 | case XATTR_CIFS_NTSD_FULL: |
| 177 | 177 | aclflags = (CIFS_ACL_OWNER | |
| 178 | + CIFS_ACL_GROUP | | |
| 178 | 179 | CIFS_ACL_DACL | |
| 179 | 180 | CIFS_ACL_SACL); |
| 180 | 181 | break; |
| 181 | 182 | case XATTR_CIFS_NTSD: |
| 182 | 183 | aclflags = (CIFS_ACL_OWNER | |
| 184 | + CIFS_ACL_GROUP | | |
| 183 | 185 | CIFS_ACL_DACL); |
| 184 | 186 | break; |
| 185 | 187 | case XATTR_CIFS_ACL: |
| @@ -34,6 +34,14 @@ · 33 unmodified lines | ||
| 34 | 34 | */ |
| 35 | 35 | DEFINE_SPINLOCK(configfs_dirent_lock); |
| 36 | 36 | |
| 37 | +/* | |
| 38 | + * All of link_obj/unlink_obj/link_group/unlink_group require that | |
| 39 | + * subsys->su_mutex is held. | |
| 40 | + * But parent configfs_subsystem is NULL when config_item is root. | |
| 41 | + * Use this mutex when config_item is root. | |
| 42 | + */ | |
| 43 | +static DEFINE_MUTEX(configfs_subsystem_mutex); | |
| 44 | + | |
| 37 | 45 | static void configfs_d_iput(struct dentry * dentry, |
| 38 | 46 | struct inode * inode) |
| 39 | 47 | { |
| @@ -1859,7 +1867,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) · 1819 unmodified lines | ||
| 1859 | 1867 | group->cg_item.ci_name = group->cg_item.ci_namebuf; |
| 1860 | 1868 | |
| 1861 | 1869 | sd = root->d_fsdata; |
| 1870 | + mutex_lock(&configfs_subsystem_mutex); | |
| 1862 | 1871 | link_group(to_config_group(sd->s_element), group); |
| 1872 | + mutex_unlock(&configfs_subsystem_mutex); | |
| 1863 | 1873 | |
| 1864 | 1874 | inode_lock_nested(d_inode(root), I_MUTEX_PARENT); |
| 1865 | 1875 | |
| @@ -1884,7 +1894,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) · 18 unmodified lines | ||
| 1884 | 1894 | inode_unlock(d_inode(root)); |
| 1885 | 1895 | |
| 1886 | 1896 | if (err) { |
| 1897 | + mutex_lock(&configfs_subsystem_mutex); | |
| 1887 | 1898 | unlink_group(group); |
| 1899 | + mutex_unlock(&configfs_subsystem_mutex); | |
| 1888 | 1900 | configfs_release_fs(); |
| 1889 | 1901 | } |
| 1890 | 1902 | put_fragment(frag); |
| @@ -1931,7 +1943,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) · 40 unmodified lines | ||
| 1931 | 1943 | |
| 1932 | 1944 | dput(dentry); |
| 1933 | 1945 | |
| 1946 | + mutex_lock(&configfs_subsystem_mutex); | |
| 1934 | 1947 | unlink_group(group); |
| 1948 | + mutex_unlock(&configfs_subsystem_mutex); | |
| 1935 | 1949 | configfs_release_fs(); |
| 1936 | 1950 | } |
| 1937 | 1951 | |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/task_work.h> |
| 28 | 28 | #include <linux/ima.h> |
| 29 | 29 | #include <linux/swap.h> |
| 30 | +#include <linux/kmemleak.h> | |
| 30 | 31 | |
| 31 | 32 | #include <linux/atomic.h> |
| 32 | 33 | |
| @@ -119,8 +120,11 @@ static struct ctl_table fs_stat_sysctls[] = { · 86 unmodified lines | ||
| 119 | 120 | static int __init init_fs_stat_sysctls(void) |
| 120 | 121 | { |
| 121 | 122 | register_sysctl_init("fs", fs_stat_sysctls); |
| 122 | − if (IS_ENABLED(CONFIG_BINFMT_MISC)) | |
| 123 | − register_sysctl_mount_point("fs/binfmt_misc"); | |
| 123 | + if (IS_ENABLED(CONFIG_BINFMT_MISC)) { | |
| 124 | + struct ctl_table_header *hdr; | |
| 125 | + hdr = register_sysctl_mount_point("fs/binfmt_misc"); | |
| 126 | + kmemleak_not_leak(hdr); | |
| 127 | + } | |
| 124 | 128 | return 0; |
| 125 | 129 | } |
| 126 | 130 | fs_initcall(init_fs_stat_sysctls); |
| @@ -4567,6 +4567,7 @@ static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head) · 4566 unmodified lines | ||
| 4567 | 4567 | } else { |
| 4568 | 4568 | list_add_tail(&buf->list, &(*head)->list); |
| 4569 | 4569 | } |
| 4570 | + cond_resched(); | |
| 4570 | 4571 | } |
| 4571 | 4572 | |
| 4572 | 4573 | return i ? i : -ENOMEM; |
| @@ -7693,7 +7694,7 @@ static int io_run_task_work_sig(void) · 3120 unmodified lines | ||
| 7693 | 7694 | /* when returns >0, the caller should retry */ |
| 7694 | 7695 | static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, |
| 7695 | 7696 | struct io_wait_queue *iowq, |
| 7696 | − signed long *timeout) | |
| 7697 | + ktime_t timeout) | |
| 7697 | 7698 | { |
| 7698 | 7699 | int ret; |
| 7699 | 7700 | |
| @@ -7705,8 +7706,9 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, · 5 unmodified lines | ||
| 7705 | 7706 | if (test_bit(0, &ctx->check_cq_overflow)) |
| 7706 | 7707 | return 1; |
| 7707 | 7708 | |
| 7708 | − *timeout = schedule_timeout(*timeout); | |
| 7709 | − return !*timeout ? -ETIME : 1; | |
| 7709 | + if (!schedule_hrtimeout(&timeout, HRTIMER_MODE_ABS)) | |
| 7710 | + return -ETIME; | |
| 7711 | + return 1; | |
| 7710 | 7712 | } |
| 7711 | 7713 | |
| 7712 | 7714 | /* |
| @@ -7719,7 +7721,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 6 unmodified lines | ||
| 7719 | 7721 | { |
| 7720 | 7722 | struct io_wait_queue iowq; |
| 7721 | 7723 | struct io_rings *rings = ctx->rings; |
| 7722 | − signed long timeout = MAX_SCHEDULE_TIMEOUT; | |
| 7724 | + ktime_t timeout = KTIME_MAX; | |
| 7723 | 7725 | int ret; |
| 7724 | 7726 | |
| 7725 | 7727 | do { |
| @@ -7735,7 +7737,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 9 unmodified lines | ||
| 7735 | 7737 | |
| 7736 | 7738 | if (get_timespec64(&ts, uts)) |
| 7737 | 7739 | return -EFAULT; |
| 7738 | − timeout = timespec64_to_jiffies(&ts); | |
| 7740 | + timeout = ktime_add_ns(timespec64_to_ktime(ts), ktime_get_ns()); | |
| 7739 | 7741 | } |
| 7740 | 7742 | |
| 7741 | 7743 | if (sig) { |
| @@ -7767,7 +7769,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 25 unmodified lines | ||
| 7767 | 7769 | } |
| 7768 | 7770 | prepare_to_wait_exclusive(&ctx->cq_wait, &iowq.wq, |
| 7769 | 7771 | TASK_INTERRUPTIBLE); |
| 7770 | − ret = io_cqring_wait_schedule(ctx, &iowq, &timeout); | |
| 7772 | + ret = io_cqring_wait_schedule(ctx, &iowq, timeout); | |
| 7771 | 7773 | finish_wait(&ctx->cq_wait, &iowq.wq); |
| 7772 | 7774 | cond_resched(); |
| 7773 | 7775 | } while (ret > 0); |
| @@ -7924,7 +7926,15 @@ static __cold int io_rsrc_ref_quiesce(struct io_rsrc_data *data, · 150 unmodified lines | ||
| 7924 | 7926 | ret = wait_for_completion_interruptible(&data->done); |
| 7925 | 7927 | if (!ret) { |
| 7926 | 7928 | mutex_lock(&ctx->uring_lock); |
| 7927 | − break; | |
| 7929 | + if (atomic_read(&data->refs) > 0) { | |
| 7930 | + /* | |
| 7931 | + * it has been revived by another thread while | |
| 7932 | + * we were unlocked | |
| 7933 | + */ | |
| 7934 | + mutex_unlock(&ctx->uring_lock); | |
| 7935 | + } else { | |
| 7936 | + break; | |
| 7937 | + } | |
| 7928 | 7938 | } |
| 7929 | 7939 | |
| 7930 | 7940 | atomic_inc(&data->refs); |
| @@ -469,6 +469,24 @@ void mnt_drop_write_file(struct file *file) · 468 unmodified lines | ||
| 469 | 469 | } |
| 470 | 470 | EXPORT_SYMBOL(mnt_drop_write_file); |
| 471 | 471 | |
| 472 | +/** | |
| 473 | + * mnt_hold_writers - prevent write access to the given mount | |
| 474 | + * @mnt: mnt to prevent write access to | |
| 475 | + * | |
| 476 | + * Prevents write access to @mnt if there are no active writers for @mnt. | |
| 477 | + * This function needs to be called and return successfully before changing | |
| 478 | + * properties of @mnt that need to remain stable for callers with write access | |
| 479 | + * to @mnt. | |
| 480 | + * | |
| 481 | + * After this functions has been called successfully callers must pair it with | |
| 482 | + * a call to mnt_unhold_writers() in order to stop preventing write access to | |
| 483 | + * @mnt. | |
| 484 | + * | |
| 485 | + * Context: This function expects lock_mount_hash() to be held serializing | |
| 486 | + * setting MNT_WRITE_HOLD. | |
| 487 | + * Return: On success 0 is returned. | |
| 488 | + * On error, -EBUSY is returned. | |
| 489 | + */ | |
| 472 | 490 | static inline int mnt_hold_writers(struct mount *mnt) |
| 473 | 491 | { |
| 474 | 492 | mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; |
| @@ -500,6 +518,18 @@ static inline int mnt_hold_writers(struct mount *mnt) · 25 unmodified lines | ||
| 500 | 518 | return 0; |
| 501 | 519 | } |
| 502 | 520 | |
| 521 | +/** | |
| 522 | + * mnt_unhold_writers - stop preventing write access to the given mount | |
| 523 | + * @mnt: mnt to stop preventing write access to | |
| 524 | + * | |
| 525 | + * Stop preventing write access to @mnt allowing callers to gain write access | |
| 526 | + * to @mnt again. | |
| 527 | + * | |
| 528 | + * This function can only be called after a successful call to | |
| 529 | + * mnt_hold_writers(). | |
| 530 | + * | |
| 531 | + * Context: This function expects lock_mount_hash() to be held. | |
| 532 | + */ | |
| 503 | 533 | static inline void mnt_unhold_writers(struct mount *mnt) |
| 504 | 534 | { |
| 505 | 535 | /* |
| @@ -2010,14 +2010,14 @@ no_open: · 2009 unmodified lines | ||
| 2010 | 2010 | if (!res) { |
| 2011 | 2011 | inode = d_inode(dentry); |
| 2012 | 2012 | if ((lookup_flags & LOOKUP_DIRECTORY) && inode && |
| 2013 | − !S_ISDIR(inode->i_mode)) | |
| 2013 | + !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) | |
| 2014 | 2014 | res = ERR_PTR(-ENOTDIR); |
| 2015 | 2015 | else if (inode && S_ISREG(inode->i_mode)) |
| 2016 | 2016 | res = ERR_PTR(-EOPENSTALE); |
| 2017 | 2017 | } else if (!IS_ERR(res)) { |
| 2018 | 2018 | inode = d_inode(res); |
| 2019 | 2019 | if ((lookup_flags & LOOKUP_DIRECTORY) && inode && |
| 2020 | − !S_ISDIR(inode->i_mode)) { | |
| 2020 | + !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) { | |
| 2021 | 2021 | dput(res); |
| 2022 | 2022 | res = ERR_PTR(-ENOTDIR); |
| 2023 | 2023 | } else if (inode && S_ISREG(inode->i_mode)) { |
| @@ -853,12 +853,9 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path, · 852 unmodified lines | ||
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | /* Flush out writes to the server in order to update c/mtime. */ |
| 856 | − if ((request_mask & (STATX_CTIME|STATX_MTIME)) && | |
| 857 | − S_ISREG(inode->i_mode)) { | |
| 858 | − err = filemap_write_and_wait(inode->i_mapping); | |
| 859 | − if (err) | |
| 860 | − goto out; | |
| 861 | − } | |
| 856 | + if ((request_mask & (STATX_CTIME | STATX_MTIME)) && | |
| 857 | + S_ISREG(inode->i_mode)) | |
| 858 | + filemap_write_and_wait(inode->i_mapping); | |
| 862 | 859 | |
| 863 | 860 | /* |
| 864 | 861 | * We may force a getattr if the user cares about atime. |
| @@ -1229,8 +1229,7 @@ nfs4_update_changeattr_locked(struct inode *inode, · 1228 unmodified lines | ||
| 1229 | 1229 | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL | |
| 1230 | 1230 | NFS_INO_INVALID_SIZE | NFS_INO_INVALID_OTHER | |
| 1231 | 1231 | NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_NLINK | |
| 1232 | − NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR | | |
| 1233 | − NFS_INO_REVAL_PAGECACHE; | |
| 1232 | + NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR; | |
| 1234 | 1233 | nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); |
| 1235 | 1234 | } |
| 1236 | 1235 | nfsi->attrtimeo_timestamp = jiffies; |
| @@ -264,7 +264,6 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) · 263 unmodified lines | ||
| 264 | 264 | if (!gid_valid(gid)) |
| 265 | 265 | return -EINVAL; |
| 266 | 266 | opts->gid = gid; |
| 267 | − set_gid(tracefs_mount->mnt_root, gid); | |
| 268 | 267 | break; |
| 269 | 268 | case Opt_mode: |
| 270 | 269 | if (match_octal(&args[0], &option)) |
| @@ -291,7 +290,9 @@ static int tracefs_apply_options(struct super_block *sb) · 20 unmodified lines | ||
| 291 | 290 | inode->i_mode |= opts->mode; |
| 292 | 291 | |
| 293 | 292 | inode->i_uid = opts->uid; |
| 294 | − inode->i_gid = opts->gid; | |
| 293 | + | |
| 294 | + /* Set all the group ids to the mount option */ | |
| 295 | + set_gid(sb->s_root, opts->gid); | |
| 295 | 296 | |
| 296 | 297 | return 0; |
| 297 | 298 | } |
| @@ -1753,6 +1753,11 @@ xfs_remount_ro( · 1752 unmodified lines | ||
| 1753 | 1753 | }; |
| 1754 | 1754 | int error; |
| 1755 | 1755 | |
| 1756 | + /* Flush all the dirty data to disk. */ | |
| 1757 | + error = sync_filesystem(mp->m_super); | |
| 1758 | + if (error) | |
| 1759 | + return error; | |
| 1760 | + | |
| 1756 | 1761 | /* |
| 1757 | 1762 | * Cancel background eofb scanning so it cannot race with the final |
| 1758 | 1763 | * log force+buftarg wait and deadlock the remount. |
| @@ -1831,8 +1836,6 @@ xfs_fs_reconfigure( · 72 unmodified lines | ||
| 1831 | 1836 | if (error) |
| 1832 | 1837 | return error; |
| 1833 | 1838 | |
| 1834 | − sync_filesystem(mp->m_super); | |
| 1835 | − | |
| 1836 | 1839 | /* inode32 -> inode64 */ |
| 1837 | 1840 | if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { |
| 1838 | 1841 | mp->m_features &= ~XFS_FEAT_SMALL_INUMS; |
| @@ -748,7 +748,8 @@ extern bool blk_queue_can_use_dma_map_merging(struct request_queue *q, · 747 unmodified lines | ||
| 748 | 748 | |
| 749 | 749 | bool __must_check blk_get_queue(struct request_queue *); |
| 750 | 750 | extern void blk_put_queue(struct request_queue *); |
| 751 | −extern void blk_set_queue_dying(struct request_queue *); | |
| 751 | + | |
| 752 | +void blk_mark_disk_dead(struct gendisk *disk); | |
| 752 | 753 | |
| 753 | 754 | #ifdef CONFIG_BLOCK |
| 754 | 755 | /* |
| @@ -209,11 +209,9 @@ static inline bool map_value_has_timer(const struct bpf_map *map) · 208 unmodified lines | ||
| 209 | 209 | static inline void check_and_init_map_value(struct bpf_map *map, void *dst) |
| 210 | 210 | { |
| 211 | 211 | if (unlikely(map_value_has_spin_lock(map))) |
| 212 | − *(struct bpf_spin_lock *)(dst + map->spin_lock_off) = | |
| 213 | − (struct bpf_spin_lock){}; | |
| 212 | + memset(dst + map->spin_lock_off, 0, sizeof(struct bpf_spin_lock)); | |
| 214 | 213 | if (unlikely(map_value_has_timer(map))) |
| 215 | − *(struct bpf_timer *)(dst + map->timer_off) = | |
| 216 | − (struct bpf_timer){}; | |
| 214 | + memset(dst + map->timer_off, 0, sizeof(struct bpf_timer)); | |
| 217 | 215 | } |
| 218 | 216 | |
| 219 | 217 | /* copy everything but bpf_spin_lock and bpf_timer. There could be one of each. */ |
| @@ -224,7 +222,8 @@ static inline void copy_map_value(struct bpf_map *map, void *dst, void *src) · 4 unmodified lines | ||
| 224 | 222 | if (unlikely(map_value_has_spin_lock(map))) { |
| 225 | 223 | s_off = map->spin_lock_off; |
| 226 | 224 | s_sz = sizeof(struct bpf_spin_lock); |
| 227 | − } else if (unlikely(map_value_has_timer(map))) { | |
| 225 | + } | |
| 226 | + if (unlikely(map_value_has_timer(map))) { | |
| 228 | 227 | t_off = map->timer_off; |
| 229 | 228 | t_sz = sizeof(struct bpf_timer); |
| 230 | 229 | } |
| @@ -382,6 +382,9 @@ struct cpufreq_driver { · 381 unmodified lines | ||
| 382 | 382 | int (*suspend)(struct cpufreq_policy *policy); |
| 383 | 383 | int (*resume)(struct cpufreq_policy *policy); |
| 384 | 384 | |
| 385 | + /* Will be called after the driver is fully initialized */ | |
| 386 | + void (*ready)(struct cpufreq_policy *policy); | |
| 387 | + | |
| 385 | 388 | struct freq_attr **attr; |
| 386 | 389 | |
| 387 | 390 | /* platform specific boost support code */ |
| @@ -61,6 +61,14 @@ · 60 unmodified lines | ||
| 61 | 61 | */ |
| 62 | 62 | #define DMA_ATTR_PRIVILEGED (1UL << 9) |
| 63 | 63 | |
| 64 | +/* | |
| 65 | + * This is a hint to the DMA-mapping subsystem that the device is expected | |
| 66 | + * to overwrite the entire mapped size, thus the caller does not require any | |
| 67 | + * of the previous buffer contents to be preserved. This allows | |
| 68 | + * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers. | |
| 69 | + */ | |
| 70 | +#define DMA_ATTR_OVERWRITE (1UL << 10) | |
| 71 | + | |
| 64 | 72 | /* |
| 65 | 73 | * A dma_addr_t can hold any valid DMA or bus address for the platform. It can |
| 66 | 74 | * be given to a device to use as a DMA source or target. It is specific to a |
| @@ -1262,6 +1262,7 @@ struct hv_device { · 1261 unmodified lines | ||
| 1262 | 1262 | struct vmbus_channel *channel; |
| 1263 | 1263 | struct kset *channels_kset; |
| 1264 | 1264 | struct device_dma_parameters dma_parms; |
| 1265 | + u64 dma_mask; | |
| 1265 | 1266 | |
| 1266 | 1267 | /* place holder to keep track of the dir for hv device in debugfs */ |
| 1267 | 1268 | struct dentry *debug_dir; |
| @@ -2158,7 +2158,7 @@ struct net_device { · 2157 unmodified lines | ||
| 2158 | 2158 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; |
| 2159 | 2159 | unsigned int num_tx_queues; |
| 2160 | 2160 | unsigned int real_num_tx_queues; |
| 2161 | − struct Qdisc *qdisc; | |
| 2161 | + struct Qdisc __rcu *qdisc; | |
| 2162 | 2162 | unsigned int tx_queue_len; |
| 2163 | 2163 | spinlock_t tx_global_lock; |
| 2164 | 2164 | |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #define NVME_TCP_DISC_PORT 8009 |
| 13 | 13 | #define NVME_TCP_ADMIN_CCSZ SZ_8K |
| 14 | 14 | #define NVME_TCP_DIGEST_LENGTH 4 |
| 15 | +#define NVME_TCP_MIN_MAXH2CDATA 4096 | |
| 15 | 16 | |
| 16 | 17 | enum nvme_tcp_pfv { |
| 17 | 18 | NVME_TCP_PFV_1_0 = 0x0, |
| @@ -70,7 +70,8 @@ struct nvmem_keepout { · 69 unmodified lines | ||
| 70 | 70 | * @word_size: Minimum read/write access granularity. |
| 71 | 71 | * @stride: Minimum read/write access stride. |
| 72 | 72 | * @priv: User context passed to read/write callbacks. |
| 73 | − * @wp-gpio: Write protect pin | |
| 73 | + * @wp-gpio: Write protect pin | |
| 74 | + * @ignore_wp: Write Protect pin is managed by the provider. | |
| 74 | 75 | * |
| 75 | 76 | * Note: A default "nvmem<id>" name will be assigned to the device if |
| 76 | 77 | * no name is specified in its configuration. In such case "<id>" is |
| @@ -92,6 +93,7 @@ struct nvmem_config { · 15 unmodified lines | ||
| 92 | 93 | enum nvmem_type type; |
| 93 | 94 | bool read_only; |
| 94 | 95 | bool root_only; |
| 96 | + bool ignore_wp; | |
| 95 | 97 | struct device_node *of_node; |
| 96 | 98 | bool no_of_node; |
| 97 | 99 | nvmem_reg_read_t reg_read; |
| @@ -54,8 +54,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev); · 53 unmodified lines | ||
| 54 | 54 | extern void init_idle(struct task_struct *idle, int cpu); |
| 55 | 55 | |
| 56 | 56 | extern int sched_fork(unsigned long clone_flags, struct task_struct *p); |
| 57 | −extern void sched_post_fork(struct task_struct *p, | |
| 58 | − struct kernel_clone_args *kargs); | |
| 57 | +extern void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs); | |
| 58 | +extern void sched_post_fork(struct task_struct *p); | |
| 59 | 59 | extern void sched_dead(struct task_struct *p); |
| 60 | 60 | |
| 61 | 61 | void __noreturn do_task_dead(void); |
| @@ -660,8 +660,7 @@ static inline __alloc_size(1, 2) void *kcalloc(size_t n, size_t size, gfp_t flag · 659 unmodified lines | ||
| 660 | 660 | * allocator where we care about the real place the memory allocation |
| 661 | 661 | * request comes from. |
| 662 | 662 | */ |
| 663 | −extern void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller) | |
| 664 | − __alloc_size(1); | |
| 663 | +extern void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller); | |
| 665 | 664 | #define kmalloc_track_caller(size, flags) \ |
| 666 | 665 | __kmalloc_track_caller(size, flags, _RET_IP_) |
| 667 | 666 | |
| @@ -699,6 +699,8 @@ event_triggers_post_call(struct trace_event_file *file, · 698 unmodified lines | ||
| 699 | 699 | |
| 700 | 700 | bool trace_event_ignore_this_pid(struct trace_event_file *trace_file); |
| 701 | 701 | |
| 702 | +bool __trace_trigger_soft_disabled(struct trace_event_file *file); | |
| 703 | + | |
| 702 | 704 | /** |
| 703 | 705 | * trace_trigger_soft_disabled - do triggers and test if soft disabled |
| 704 | 706 | * @file: The file pointer of the event to test |
| @@ -708,20 +710,20 @@ bool trace_event_ignore_this_pid(struct trace_event_file *trace_file); · 3 unmodified lines | ||
| 708 | 710 | * triggers that require testing the fields, it will return true, |
| 709 | 711 | * otherwise false. |
| 710 | 712 | */ |
| 711 | −static inline bool | |
| 713 | +static __always_inline bool | |
| 712 | 714 | trace_trigger_soft_disabled(struct trace_event_file *file) |
| 713 | 715 | { |
| 714 | 716 | unsigned long eflags = file->flags; |
| 715 | 717 | |
| 716 | − if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) { | |
| 717 | − if (eflags & EVENT_FILE_FL_TRIGGER_MODE) | |
| 718 | − event_triggers_call(file, NULL, NULL, NULL); | |
| 719 | − if (eflags & EVENT_FILE_FL_SOFT_DISABLED) | |
| 720 | − return true; | |
| 721 | − if (eflags & EVENT_FILE_FL_PID_FILTER) | |
| 722 | − return trace_event_ignore_this_pid(file); | |
| 723 | − } | |
| 724 | − return false; | |
| 718 | + if (likely(!(eflags & (EVENT_FILE_FL_TRIGGER_MODE | | |
| 719 | + EVENT_FILE_FL_SOFT_DISABLED | | |
| 720 | + EVENT_FILE_FL_PID_FILTER)))) | |
| 721 | + return false; | |
| 722 | + | |
| 723 | + if (likely(eflags & EVENT_FILE_FL_TRIGGER_COND)) | |
| 724 | + return false; | |
| 725 | + | |
| 726 | + return __trace_trigger_soft_disabled(file); | |
| 725 | 727 | } |
| 726 | 728 | |
| 727 | 729 | #ifdef CONFIG_BPF_EVENTS |
| @@ -109,8 +109,6 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, · 108 unmodified lines | ||
| 109 | 109 | int ipv6_dev_get_saddr(struct net *net, const struct net_device *dev, |
| 110 | 110 | const struct in6_addr *daddr, unsigned int srcprefs, |
| 111 | 111 | struct in6_addr *saddr); |
| 112 | −int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr, | |
| 113 | − u32 banned_flags); | |
| 114 | 112 | int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, |
| 115 | 113 | u32 banned_flags); |
| 116 | 114 | bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, |
| @@ -262,7 +262,7 @@ struct ad_system { · 261 unmodified lines | ||
| 262 | 262 | struct ad_bond_info { |
| 263 | 263 | struct ad_system system; /* 802.3ad system structure */ |
| 264 | 264 | struct bond_3ad_stats stats; |
| 265 | − u32 agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */ | |
| 265 | + atomic_t agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */ | |
| 266 | 266 | u16 aggregator_identifier; |
| 267 | 267 | }; |
| 268 | 268 | |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <asm/checksum.h> |
| 23 | 23 | |
| 24 | 24 | #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER |
| 25 | −static inline | |
| 25 | +static __always_inline | |
| 26 | 26 | __wsum csum_and_copy_from_user (const void __user *src, void *dst, |
| 27 | 27 | int len) |
| 28 | 28 | { |
| @@ -33,7 +33,7 @@ __wsum csum_and_copy_from_user (const void __user *src, void *dst, · 4 unmodified lines | ||
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | 35 | #ifndef HAVE_CSUM_COPY_USER |
| 36 | −static __inline__ __wsum csum_and_copy_to_user | |
| 36 | +static __always_inline __wsum csum_and_copy_to_user | |
| 37 | 37 | (const void *src, void __user *dst, int len) |
| 38 | 38 | { |
| 39 | 39 | __wsum sum = csum_partial(src, len, ~0U); |
| @@ -45,7 +45,7 @@ static __inline__ __wsum csum_and_copy_to_user · 5 unmodified lines | ||
| 45 | 45 | #endif |
| 46 | 46 | |
| 47 | 47 | #ifndef _HAVE_ARCH_CSUM_AND_COPY |
| 48 | −static inline __wsum | |
| 48 | +static __always_inline __wsum | |
| 49 | 49 | csum_partial_copy_nocheck(const void *src, void *dst, int len) |
| 50 | 50 | { |
| 51 | 51 | memcpy(dst, src, len); |
| @@ -54,7 +54,7 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len) · 2 unmodified lines | ||
| 54 | 54 | #endif |
| 55 | 55 | |
| 56 | 56 | #ifndef HAVE_ARCH_CSUM_ADD |
| 57 | −static inline __wsum csum_add(__wsum csum, __wsum addend) | |
| 57 | +static __always_inline __wsum csum_add(__wsum csum, __wsum addend) | |
| 58 | 58 | { |
| 59 | 59 | u32 res = (__force u32)csum; |
| 60 | 60 | res += (__force u32)addend; |
| @@ -62,12 +62,12 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) · 1 unmodified line | ||
| 62 | 62 | } |
| 63 | 63 | #endif |
| 64 | 64 | |
| 65 | −static inline __wsum csum_sub(__wsum csum, __wsum addend) | |
| 65 | +static __always_inline __wsum csum_sub(__wsum csum, __wsum addend) | |
| 66 | 66 | { |
| 67 | 67 | return csum_add(csum, ~addend); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | −static inline __sum16 csum16_add(__sum16 csum, __be16 addend) | |
| 70 | +static __always_inline __sum16 csum16_add(__sum16 csum, __be16 addend) | |
| 71 | 71 | { |
| 72 | 72 | u16 res = (__force u16)csum; |
| 73 | 73 | |
| @@ -75,12 +75,12 @@ static inline __sum16 csum16_add(__sum16 csum, __be16 addend) · 1 unmodified line | ||
| 75 | 75 | return (__force __sum16)(res + (res < (__force u16)addend)); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | −static inline __sum16 csum16_sub(__sum16 csum, __be16 addend) | |
| 78 | +static __always_inline __sum16 csum16_sub(__sum16 csum, __be16 addend) | |
| 79 | 79 | { |
| 80 | 80 | return csum16_add(csum, ~addend); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | −static inline __wsum csum_shift(__wsum sum, int offset) | |
| 83 | +static __always_inline __wsum csum_shift(__wsum sum, int offset) | |
| 84 | 84 | { |
| 85 | 85 | /* rotate sum to align it with a 16b boundary */ |
| 86 | 86 | if (offset & 1) |
| @@ -88,42 +88,43 @@ static inline __wsum csum_shift(__wsum sum, int offset) · 1 unmodified line | ||
| 88 | 88 | return sum; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | −static inline __wsum | |
| 91 | +static __always_inline __wsum | |
| 92 | 92 | csum_block_add(__wsum csum, __wsum csum2, int offset) |
| 93 | 93 | { |
| 94 | 94 | return csum_add(csum, csum_shift(csum2, offset)); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | −static inline __wsum | |
| 97 | +static __always_inline __wsum | |
| 98 | 98 | csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len) |
| 99 | 99 | { |
| 100 | 100 | return csum_block_add(csum, csum2, offset); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | −static inline __wsum | |
| 103 | +static __always_inline __wsum | |
| 104 | 104 | csum_block_sub(__wsum csum, __wsum csum2, int offset) |
| 105 | 105 | { |
| 106 | 106 | return csum_block_add(csum, ~csum2, offset); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | −static inline __wsum csum_unfold(__sum16 n) | |
| 109 | +static __always_inline __wsum csum_unfold(__sum16 n) | |
| 110 | 110 | { |
| 111 | 111 | return (__force __wsum)n; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | −static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum) | |
| 114 | +static __always_inline | |
| 115 | +__wsum csum_partial_ext(const void *buff, int len, __wsum sum) | |
| 115 | 116 | { |
| 116 | 117 | return csum_partial(buff, len, sum); |
| 117 | 118 | } |
| 118 | 119 | |
| 119 | 120 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) |
| 120 | 121 | |
| 121 | −static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff) | |
| 122 | +static __always_inline void csum_replace_by_diff(__sum16 *sum, __wsum diff) | |
| 122 | 123 | { |
| 123 | 124 | *sum = csum_fold(csum_add(diff, ~csum_unfold(*sum))); |
| 124 | 125 | } |
| 125 | 126 | |
| 126 | −static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) | |
| 127 | +static __always_inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) | |
| 127 | 128 | { |
| 128 | 129 | __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from); |
| 129 | 130 | |
| @@ -136,11 +137,16 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) · 6 unmodified lines | ||
| 136 | 137 | * m : old value of a 16bit field |
| 137 | 138 | * m' : new value of a 16bit field |
| 138 | 139 | */ |
| 139 | −static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new) | |
| 140 | +static __always_inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new) | |
| 140 | 141 | { |
| 141 | 142 | *sum = ~csum16_add(csum16_sub(~(*sum), old), new); |
| 142 | 143 | } |
| 143 | 144 | |
| 145 | +static inline void csum_replace(__wsum *csum, __wsum old, __wsum new) | |
| 146 | +{ | |
| 147 | + *csum = csum_add(csum_sub(*csum, old), new); | |
| 148 | +} | |
| 149 | + | |
| 144 | 150 | struct sk_buff; |
| 145 | 151 | void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, |
| 146 | 152 | __be32 from, __be32 to, bool pseudohdr); |
| @@ -150,16 +156,16 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, · 3 unmodified lines | ||
| 150 | 156 | void inet_proto_csum_replace_by_diff(__sum16 *sum, struct sk_buff *skb, |
| 151 | 157 | __wsum diff, bool pseudohdr); |
| 152 | 158 | |
| 153 | −static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | |
| 154 | − __be16 from, __be16 to, | |
| 155 | − bool pseudohdr) | |
| 159 | +static __always_inline | |
| 160 | +void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | |
| 161 | + __be16 from, __be16 to, bool pseudohdr) | |
| 156 | 162 | { |
| 157 | 163 | inet_proto_csum_replace4(sum, skb, (__force __be32)from, |
| 158 | 164 | (__force __be32)to, pseudohdr); |
| 159 | 165 | } |
| 160 | 166 | |
| 161 | −static inline __wsum remcsum_adjust(void *ptr, __wsum csum, | |
| 162 | − int start, int offset) | |
| 167 | +static __always_inline __wsum remcsum_adjust(void *ptr, __wsum csum, | |
| 168 | + int start, int offset) | |
| 163 | 169 | { |
| 164 | 170 | __sum16 *psum = (__sum16 *)(ptr + offset); |
| 165 | 171 | __wsum delta; |
| @@ -175,12 +181,12 @@ static inline __wsum remcsum_adjust(void *ptr, __wsum csum, · 9 unmodified lines | ||
| 175 | 181 | return delta; |
| 176 | 182 | } |
| 177 | 183 | |
| 178 | −static inline void remcsum_unadjust(__sum16 *psum, __wsum delta) | |
| 184 | +static __always_inline void remcsum_unadjust(__sum16 *psum, __wsum delta) | |
| 179 | 185 | { |
| 180 | 186 | *psum = csum_fold(csum_sub(delta, (__force __wsum)*psum)); |
| 181 | 187 | } |
| 182 | 188 | |
| 183 | −static inline __wsum wsum_negate(__wsum val) | |
| 189 | +static __always_inline __wsum wsum_negate(__wsum val) | |
| 184 | 190 | { |
| 185 | 191 | return (__force __wsum)-((__force u32)val); |
| 186 | 192 | } |
| @@ -1187,6 +1187,7 @@ void dsa_unregister_switch(struct dsa_switch *ds); · 1186 unmodified lines | ||
| 1187 | 1187 | int dsa_register_switch(struct dsa_switch *ds); |
| 1188 | 1188 | void dsa_switch_shutdown(struct dsa_switch *ds); |
| 1189 | 1189 | struct dsa_switch *dsa_switch_find(int tree_index, int sw_index); |
| 1190 | +void dsa_flush_workqueue(void); | |
| 1190 | 1191 | #ifdef CONFIG_PM_SLEEP |
| 1191 | 1192 | int dsa_switch_suspend(struct dsa_switch *ds); |
| 1192 | 1193 | int dsa_switch_resume(struct dsa_switch *ds); |
| @@ -190,14 +190,16 @@ struct fib6_info { · 189 unmodified lines | ||
| 190 | 190 | u32 fib6_metric; |
| 191 | 191 | u8 fib6_protocol; |
| 192 | 192 | u8 fib6_type; |
| 193 | + | |
| 194 | + u8 offload; | |
| 195 | + u8 trap; | |
| 196 | + u8 offload_failed; | |
| 197 | + | |
| 193 | 198 | u8 should_flush:1, |
| 194 | 199 | dst_nocount:1, |
| 195 | 200 | dst_nopolicy:1, |
| 196 | 201 | fib6_destroying:1, |
| 197 | − offload:1, | |
| 198 | − trap:1, | |
| 199 | − offload_failed:1, | |
| 200 | − unused:1; | |
| 202 | + unused:4; | |
| 201 | 203 | |
| 202 | 204 | struct rcu_head rcu; |
| 203 | 205 | struct nexthop *nh; |
| @@ -393,17 +393,20 @@ static inline void txopt_put(struct ipv6_txoptions *opt) · 392 unmodified lines | ||
| 393 | 393 | kfree_rcu(opt, rcu); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | +#if IS_ENABLED(CONFIG_IPV6) | |
| 396 | 397 | struct ip6_flowlabel *__fl6_sock_lookup(struct sock *sk, __be32 label); |
| 397 | 398 | |
| 398 | 399 | extern struct static_key_false_deferred ipv6_flowlabel_exclusive; |
| 399 | 400 | static inline struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, |
| 400 | 401 | __be32 label) |
| 401 | 402 | { |
| 402 | − if (static_branch_unlikely(&ipv6_flowlabel_exclusive.key)) | |
| 403 | + if (static_branch_unlikely(&ipv6_flowlabel_exclusive.key) && | |
| 404 | + READ_ONCE(sock_net(sk)->ipv6.flowlabel_has_excl)) | |
| 403 | 405 | return __fl6_sock_lookup(sk, label) ? : ERR_PTR(-ENOENT); |
| 404 | 406 | |
| 405 | 407 | return NULL; |
| 406 | 408 | } |
| 409 | +#endif | |
| 407 | 410 | |
| 408 | 411 | struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, |
| 409 | 412 | struct ip6_flowlabel *fl, |
| @@ -905,9 +905,9 @@ struct nft_expr_ops { · 904 unmodified lines | ||
| 905 | 905 | int (*offload)(struct nft_offload_ctx *ctx, |
| 906 | 906 | struct nft_flow_rule *flow, |
| 907 | 907 | const struct nft_expr *expr); |
| 908 | + bool (*offload_action)(const struct nft_expr *expr); | |
| 908 | 909 | void (*offload_stats)(struct nft_expr *expr, |
| 909 | 910 | const struct flow_stats *stats); |
| 910 | − u32 offload_flags; | |
| 911 | 911 | const struct nft_expr_type *type; |
| 912 | 912 | void *data; |
| 913 | 913 | }; |
| @@ -67,8 +67,6 @@ struct nft_flow_rule { · 66 unmodified lines | ||
| 67 | 67 | struct flow_rule *rule; |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | −#define NFT_OFFLOAD_F_ACTION (1 << 0) | |
| 71 | − | |
| 72 | 70 | void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow, |
| 73 | 71 | enum flow_dissector_key_id addr_type); |
| 74 | 72 | |
| @@ -77,9 +77,10 @@ struct netns_ipv6 { · 76 unmodified lines | ||
| 77 | 77 | spinlock_t fib6_gc_lock; |
| 78 | 78 | unsigned int ip6_rt_gc_expire; |
| 79 | 79 | unsigned long ip6_rt_last_gc; |
| 80 | + unsigned char flowlabel_has_excl; | |
| 80 | 81 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
| 81 | − unsigned int fib6_rules_require_fldissect; | |
| 82 | 82 | bool fib6_has_custom_rules; |
| 83 | + unsigned int fib6_rules_require_fldissect; | |
| 83 | 84 | #ifdef CONFIG_IPV6_SUBTREES |
| 84 | 85 | unsigned int fib6_routes_require_src; |
| 85 | 86 | #endif |
| @@ -507,7 +507,7 @@ struct sock { · 506 unmodified lines | ||
| 507 | 507 | #endif |
| 508 | 508 | u16 sk_tsflags; |
| 509 | 509 | u8 sk_shutdown; |
| 510 | − u32 sk_tskey; | |
| 510 | + atomic_t sk_tskey; | |
| 511 | 511 | atomic_t sk_zckey; |
| 512 | 512 | |
| 513 | 513 | u8 sk_clockid; |
| @@ -2667,7 +2667,7 @@ static inline void _sock_tx_timestamp(struct sock *sk, __u16 tsflags, · 2153 unmodified lines | ||
| 2667 | 2667 | __sock_tx_timestamp(tsflags, tx_flags); |
| 2668 | 2668 | if (tsflags & SOF_TIMESTAMPING_OPT_ID && tskey && |
| 2669 | 2669 | tsflags & SOF_TIMESTAMPING_TX_RECORD_MASK) |
| 2670 | − *tskey = sk->sk_tskey++; | |
| 2670 | + *tskey = atomic_inc_return(&sk->sk_tskey) - 1; | |
| 2671 | 2671 | } |
| 2672 | 2672 | if (unlikely(sock_flag(sk, SOCK_WIFI_STATUS))) |
| 2673 | 2673 | *tx_flags |= SKBTX_WIFI_STATUS; |
| @@ -1134,6 +1134,7 @@ struct kvm_ppc_resize_hpt { · 1133 unmodified lines | ||
| 1134 | 1134 | #define KVM_CAP_VM_GPA_BITS 207 |
| 1135 | 1135 | #define KVM_CAP_XSAVE2 208 |
| 1136 | 1136 | #define KVM_CAP_SYS_ATTRIBUTES 209 |
| 1137 | +#define KVM_CAP_PPC_AIL_MODE_3 210 | |
| 1137 | 1138 | |
| 1138 | 1139 | #ifdef KVM_CAP_IRQ_ROUTING |
| 1139 | 1140 | |
| @@ -5688,7 +5688,8 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, · 5687 unmodified lines | ||
| 5688 | 5688 | } |
| 5689 | 5689 | if (check_ptr_off_reg(env, reg, regno)) |
| 5690 | 5690 | return -EINVAL; |
| 5691 | − } else if (is_kfunc && (reg->type == PTR_TO_BTF_ID || reg2btf_ids[reg->type])) { | |
| 5691 | + } else if (is_kfunc && (reg->type == PTR_TO_BTF_ID || | |
| 5692 | + (reg2btf_ids[base_type(reg->type)] && !type_flag(reg->type)))) { | |
| 5692 | 5693 | const struct btf_type *reg_ref_t; |
| 5693 | 5694 | const struct btf *reg_btf; |
| 5694 | 5695 | const char *reg_ref_tname; |
| @@ -5706,7 +5707,7 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, · 11 unmodified lines | ||
| 5706 | 5707 | reg_ref_id = reg->btf_id; |
| 5707 | 5708 | } else { |
| 5708 | 5709 | reg_btf = btf_vmlinux; |
| 5709 | − reg_ref_id = *reg2btf_ids[reg->type]; | |
| 5710 | + reg_ref_id = *reg2btf_ids[base_type(reg->type)]; | |
| 5710 | 5711 | } |
| 5711 | 5712 | |
| 5712 | 5713 | reg_ref_t = btf_type_skip_modifiers(reg_btf, reg_ref_id, |
| @@ -2,6 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com |
| 3 | 3 | */ |
| 4 | 4 | #include <linux/bpf.h> |
| 5 | +#include <linux/btf.h> | |
| 5 | 6 | #include <linux/bpf-cgroup.h> |
| 6 | 7 | #include <linux/rcupdate.h> |
| 7 | 8 | #include <linux/random.h> |
| @@ -1075,6 +1076,7 @@ static enum hrtimer_restart bpf_timer_cb(struct hrtimer *hrtimer) · 1067 unmodified lines | ||
| 1075 | 1076 | void *key; |
| 1076 | 1077 | u32 idx; |
| 1077 | 1078 | |
| 1079 | + BTF_TYPE_EMIT(struct bpf_timer); | |
| 1078 | 1080 | callback_fn = rcu_dereference_check(t->callback_fn, rcu_read_lock_bh_held()); |
| 1079 | 1081 | if (!callback_fn) |
| 1080 | 1082 | goto out; |
| @@ -1355,6 +1355,7 @@ int generic_map_delete_batch(struct bpf_map *map, · 1354 unmodified lines | ||
| 1355 | 1355 | maybe_wait_bpf_programs(map); |
| 1356 | 1356 | if (err) |
| 1357 | 1357 | break; |
| 1358 | + cond_resched(); | |
| 1358 | 1359 | } |
| 1359 | 1360 | if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp))) |
| 1360 | 1361 | err = -EFAULT; |
| @@ -1412,6 +1413,7 @@ int generic_map_update_batch(struct bpf_map *map, · 51 unmodified lines | ||
| 1412 | 1413 | |
| 1413 | 1414 | if (err) |
| 1414 | 1415 | break; |
| 1416 | + cond_resched(); | |
| 1415 | 1417 | } |
| 1416 | 1418 | |
| 1417 | 1419 | if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp))) |
| @@ -1509,6 +1511,7 @@ int generic_map_lookup_batch(struct bpf_map *map, · 91 unmodified lines | ||
| 1509 | 1511 | swap(prev_key, key); |
| 1510 | 1512 | retry = MAP_LOOKUP_RETRIES; |
| 1511 | 1513 | cp++; |
| 1514 | + cond_resched(); | |
| 1512 | 1515 | } |
| 1513 | 1516 | |
| 1514 | 1517 | if (err == -EFAULT) |
| @@ -546,6 +546,7 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 545 unmodified lines | ||
| 546 | 546 | char *buf, size_t nbytes, loff_t off) |
| 547 | 547 | { |
| 548 | 548 | struct cgroup *cgrp; |
| 549 | + struct cgroup_file_ctx *ctx; | |
| 549 | 550 | |
| 550 | 551 | BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); |
| 551 | 552 | |
| @@ -553,8 +554,9 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 1 unmodified line | ||
| 553 | 554 | * Release agent gets called with all capabilities, |
| 554 | 555 | * require capabilities to set release agent. |
| 555 | 556 | */ |
| 556 | − if ((of->file->f_cred->user_ns != &init_user_ns) || | |
| 557 | − !capable(CAP_SYS_ADMIN)) | |
| 557 | + ctx = of->priv; | |
| 558 | + if ((ctx->ns->user_ns != &init_user_ns) || | |
| 559 | + !file_ns_capable(of->file, &init_user_ns, CAP_SYS_ADMIN)) | |
| 558 | 560 | return -EPERM; |
| 559 | 561 | |
| 560 | 562 | cgrp = cgroup_kn_lock_live(of->kn, false); |
| @@ -6166,6 +6166,20 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs) · 6165 unmodified lines | ||
| 6166 | 6166 | if (ret) |
| 6167 | 6167 | goto err; |
| 6168 | 6168 | |
| 6169 | + /* | |
| 6170 | + * Spawning a task directly into a cgroup works by passing a file | |
| 6171 | + * descriptor to the target cgroup directory. This can even be an O_PATH | |
| 6172 | + * file descriptor. But it can never be a cgroup.procs file descriptor. | |
| 6173 | + * This was done on purpose so spawning into a cgroup could be | |
| 6174 | + * conceptualized as an atomic | |
| 6175 | + * | |
| 6176 | + * fd = openat(dfd_cgroup, "cgroup.procs", ...); | |
| 6177 | + * write(fd, <child-pid>, ...); | |
| 6178 | + * | |
| 6179 | + * sequence, i.e. it's a shorthand for the caller opening and writing | |
| 6180 | + * cgroup.procs of the cgroup indicated by @dfd_cgroup. This allows us | |
| 6181 | + * to always use the caller's credentials. | |
| 6182 | + */ | |
| 6169 | 6183 | ret = cgroup_attach_permissions(cset->dfl_cgrp, dst_cgrp, sb, |
| 6170 | 6184 | !(kargs->flags & CLONE_THREAD), |
| 6171 | 6185 | current->nsproxy->cgroup_ns); |
| @@ -2289,6 +2289,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) · 2288 unmodified lines | ||
| 2289 | 2289 | cgroup_taskset_first(tset, &css); |
| 2290 | 2290 | cs = css_cs(css); |
| 2291 | 2291 | |
| 2292 | + cpus_read_lock(); | |
| 2292 | 2293 | percpu_down_write(&cpuset_rwsem); |
| 2293 | 2294 | |
| 2294 | 2295 | guarantee_online_mems(cs, &cpuset_attach_nodemask_to); |
| @@ -2342,6 +2343,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) · 47 unmodified lines | ||
| 2342 | 2343 | wake_up(&cpuset_attach_wq); |
| 2343 | 2344 | |
| 2344 | 2345 | percpu_up_write(&cpuset_rwsem); |
| 2346 | + cpus_read_unlock(); | |
| 2345 | 2347 | } |
| 2346 | 2348 | |
| 2347 | 2349 | /* The various types of files and directories in a cpuset file system */ |
| @@ -3522,8 +3524,8 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs) · 1174 unmodified lines | ||
| 3522 | 3524 | return cs; |
| 3523 | 3525 | } |
| 3524 | 3526 | |
| 3525 | −/** | |
| 3526 | − * cpuset_node_allowed - Can we allocate on a memory node? | |
| 3527 | +/* | |
| 3528 | + * __cpuset_node_allowed - Can we allocate on a memory node? | |
| 3527 | 3529 | * @node: is this an allowed node? |
| 3528 | 3530 | * @gfp_mask: memory allocation flags |
| 3529 | 3531 | * |
| @@ -3694,8 +3696,8 @@ void cpuset_print_current_mems_allowed(void) · 164 unmodified lines | ||
| 3694 | 3696 | |
| 3695 | 3697 | int cpuset_memory_pressure_enabled __read_mostly; |
| 3696 | 3698 | |
| 3697 | −/** | |
| 3698 | − * cpuset_memory_pressure_bump - keep stats of per-cpuset reclaims. | |
| 3699 | +/* | |
| 3700 | + * __cpuset_memory_pressure_bump - keep stats of per-cpuset reclaims. | |
| 3699 | 3701 | * |
| 3700 | 3702 | * Keep a running average of the rate of synchronous (direct) |
| 3701 | 3703 | * page reclaim efforts initiated by tasks in each cpuset. |
| @@ -3710,7 +3712,7 @@ int cpuset_memory_pressure_enabled __read_mostly; · 8 unmodified lines | ||
| 3710 | 3712 | * "memory_pressure". Value displayed is an integer |
| 3711 | 3713 | * representing the recent rate of entry into the synchronous |
| 3712 | 3714 | * (direct) page reclaim by any task attached to the cpuset. |
| 3713 | − **/ | |
| 3715 | + */ | |
| 3714 | 3716 | |
| 3715 | 3717 | void __cpuset_memory_pressure_bump(void) |
| 3716 | 3718 | { |
| @@ -665,21 +665,16 @@ EXPORT_SYMBOL(cred_fscmp); · 664 unmodified lines | ||
| 665 | 665 | |
| 666 | 666 | int set_cred_ucounts(struct cred *new) |
| 667 | 667 | { |
| 668 | − struct task_struct *task = current; | |
| 669 | − const struct cred *old = task->real_cred; | |
| 670 | 668 | struct ucounts *new_ucounts, *old_ucounts = new->ucounts; |
| 671 | 669 | |
| 672 | − if (new->user == old->user && new->user_ns == old->user_ns) | |
| 673 | − return 0; | |
| 674 | − | |
| 675 | 670 | /* |
| 676 | 671 | * This optimization is needed because alloc_ucounts() uses locks |
| 677 | 672 | * for table lookups. |
| 678 | 673 | */ |
| 679 | − if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->euid)) | |
| 674 | + if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->uid)) | |
| 680 | 675 | return 0; |
| 681 | 676 | |
| 682 | − if (!(new_ucounts = alloc_ucounts(new->user_ns, new->euid))) | |
| 677 | + if (!(new_ucounts = alloc_ucounts(new->user_ns, new->uid))) | |
| 683 | 678 | return -EAGAIN; |
| 684 | 679 | |
| 685 | 680 | new->ucounts = new_ucounts; |
| @@ -628,7 +628,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr, · 627 unmodified lines | ||
| 628 | 628 | mem->slots[index + i].orig_addr = slot_addr(orig_addr, i); |
| 629 | 629 | tlb_addr = slot_addr(mem->start, index) + offset; |
| 630 | 630 | if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) && |
| 631 | − (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)) | |
| 631 | + (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE || | |
| 632 | + dir == DMA_BIDIRECTIONAL)) | |
| 632 | 633 | swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_TO_DEVICE); |
| 633 | 634 | return tlb_addr; |
| 634 | 635 | } |
| @@ -2021,18 +2021,18 @@ static __latent_entropy struct task_struct *copy_process( · 2020 unmodified lines | ||
| 2021 | 2021 | #ifdef CONFIG_PROVE_LOCKING |
| 2022 | 2022 | DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled); |
| 2023 | 2023 | #endif |
| 2024 | + retval = copy_creds(p, clone_flags); | |
| 2025 | + if (retval < 0) | |
| 2026 | + goto bad_fork_free; | |
| 2027 | + | |
| 2024 | 2028 | retval = -EAGAIN; |
| 2025 | 2029 | if (is_ucounts_overlimit(task_ucounts(p), UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC))) { |
| 2026 | 2030 | if (p->real_cred->user != INIT_USER && |
| 2027 | 2031 | !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) |
| 2028 | − goto bad_fork_free; | |
| 2032 | + goto bad_fork_cleanup_count; | |
| 2029 | 2033 | } |
| 2030 | 2034 | current->flags &= ~PF_NPROC_EXCEEDED; |
| 2031 | 2035 | |
| 2032 | − retval = copy_creds(p, clone_flags); | |
| 2033 | − if (retval < 0) | |
| 2034 | − goto bad_fork_free; | |
| 2035 | − | |
| 2036 | 2036 | /* |
| 2037 | 2037 | * If multiple threads are within copy_process(), then this check |
| 2038 | 2038 | * triggers too late. This doesn't hurt, the check is only there |
| @@ -2266,6 +2266,17 @@ static __latent_entropy struct task_struct *copy_process( · 227 unmodified lines | ||
| 2266 | 2266 | if (retval) |
| 2267 | 2267 | goto bad_fork_put_pidfd; |
| 2268 | 2268 | |
| 2269 | + /* | |
| 2270 | + * Now that the cgroups are pinned, re-clone the parent cgroup and put | |
| 2271 | + * the new task on the correct runqueue. All this *before* the task | |
| 2272 | + * becomes visible. | |
| 2273 | + * | |
| 2274 | + * This isn't part of ->can_fork() because while the re-cloning is | |
| 2275 | + * cgroup specific, it unconditionally needs to place the task on a | |
| 2276 | + * runqueue. | |
| 2277 | + */ | |
| 2278 | + sched_cgroup_fork(p, args); | |
| 2279 | + | |
| 2269 | 2280 | /* |
| 2270 | 2281 | * From this point on we must avoid any synchronous user-space |
| 2271 | 2282 | * communication until we take the tasklist-lock. In particular, we do |
| @@ -2323,10 +2334,6 @@ static __latent_entropy struct task_struct *copy_process( · 51 unmodified lines | ||
| 2323 | 2334 | goto bad_fork_cancel_cgroup; |
| 2324 | 2335 | } |
| 2325 | 2336 | |
| 2326 | − /* past the last point of failure */ | |
| 2327 | − if (pidfile) | |
| 2328 | − fd_install(pidfd, pidfile); | |
| 2329 | − | |
| 2330 | 2337 | init_task_pid_links(p); |
| 2331 | 2338 | if (likely(p->pid)) { |
| 2332 | 2339 | ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); |
| @@ -2375,8 +2382,11 @@ static __latent_entropy struct task_struct *copy_process( · 42 unmodified lines | ||
| 2375 | 2382 | syscall_tracepoint_update(p); |
| 2376 | 2383 | write_unlock_irq(&tasklist_lock); |
| 2377 | 2384 | |
| 2385 | + if (pidfile) | |
| 2386 | + fd_install(pidfd, pidfile); | |
| 2387 | + | |
| 2378 | 2388 | proc_fork_connector(p); |
| 2379 | − sched_post_fork(p, args); | |
| 2389 | + sched_post_fork(p); | |
| 2380 | 2390 | cgroup_post_fork(p, args); |
| 2381 | 2391 | perf_event_fork(p); |
| 2382 | 2392 | |
| @@ -3462,7 +3462,7 @@ struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i) · 3461 unmodified lines | ||
| 3462 | 3462 | u16 chain_hlock = chain_hlocks[chain->base + i]; |
| 3463 | 3463 | unsigned int class_idx = chain_hlock_class_idx(chain_hlock); |
| 3464 | 3464 | |
| 3465 | − return lock_classes + class_idx - 1; | |
| 3465 | + return lock_classes + class_idx; | |
| 3466 | 3466 | } |
| 3467 | 3467 | |
| 3468 | 3468 | /* |
| @@ -3530,7 +3530,7 @@ static void print_chain_keys_chain(struct lock_chain *chain) · 61 unmodified lines | ||
| 3530 | 3530 | hlock_id = chain_hlocks[chain->base + i]; |
| 3531 | 3531 | chain_key = print_chain_key_iteration(hlock_id, chain_key); |
| 3532 | 3532 | |
| 3533 | − print_lock_name(lock_classes + chain_hlock_class_idx(hlock_id) - 1); | |
| 3533 | + print_lock_name(lock_classes + chain_hlock_class_idx(hlock_id)); | |
| 3534 | 3534 | printk("\n"); |
| 3535 | 3535 | } |
| 3536 | 3536 | } |
| @@ -250,6 +250,7 @@ void module_decompress_cleanup(struct load_info *info) · 249 unmodified lines | ||
| 250 | 250 | info->max_pages = info->used_pages = 0; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | +#ifdef CONFIG_SYSFS | |
| 253 | 254 | static ssize_t compression_show(struct kobject *kobj, |
| 254 | 255 | struct kobj_attribute *attr, char *buf) |
| 255 | 256 | { |
| @@ -269,3 +270,4 @@ static int __init module_decompress_sysfs_init(void) · 13 unmodified lines | ||
| 269 | 270 | return 0; |
| 270 | 271 | } |
| 271 | 272 | late_initcall(module_decompress_sysfs_init); |
| 273 | +#endif | |
| @@ -1214,9 +1214,8 @@ int tg_nop(struct task_group *tg, void *data) · 1213 unmodified lines | ||
| 1214 | 1214 | } |
| 1215 | 1215 | #endif |
| 1216 | 1216 | |
| 1217 | −static void set_load_weight(struct task_struct *p) | |
| 1217 | +static void set_load_weight(struct task_struct *p, bool update_load) | |
| 1218 | 1218 | { |
| 1219 | − bool update_load = !(READ_ONCE(p->__state) & TASK_NEW); | |
| 1220 | 1219 | int prio = p->static_prio - MAX_RT_PRIO; |
| 1221 | 1220 | struct load_weight *load = &p->se.load; |
| 1222 | 1221 | |
| @@ -4407,7 +4406,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) · 3184 unmodified lines | ||
| 4407 | 4406 | p->static_prio = NICE_TO_PRIO(0); |
| 4408 | 4407 | |
| 4409 | 4408 | p->prio = p->normal_prio = p->static_prio; |
| 4410 | − set_load_weight(p); | |
| 4409 | + set_load_weight(p, false); | |
| 4411 | 4410 | |
| 4412 | 4411 | /* |
| 4413 | 4412 | * We don't need the reset flag anymore after the fork. It has |
| @@ -4425,6 +4424,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) · 11 unmodified lines | ||
| 4425 | 4424 | |
| 4426 | 4425 | init_entity_runnable_average(&p->se); |
| 4427 | 4426 | |
| 4427 | + | |
| 4428 | 4428 | #ifdef CONFIG_SCHED_INFO |
| 4429 | 4429 | if (likely(sched_info_on())) |
| 4430 | 4430 | memset(&p->sched_info, 0, sizeof(p->sched_info)); |
| @@ -4440,18 +4440,23 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) · 9 unmodified lines | ||
| 4440 | 4440 | return 0; |
| 4441 | 4441 | } |
| 4442 | 4442 | |
| 4443 | −void sched_post_fork(struct task_struct *p, struct kernel_clone_args *kargs) | |
| 4443 | +void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs) | |
| 4444 | 4444 | { |
| 4445 | 4445 | unsigned long flags; |
| 4446 | −#ifdef CONFIG_CGROUP_SCHED | |
| 4447 | − struct task_group *tg; | |
| 4448 | −#endif | |
| 4449 | 4446 | |
| 4447 | + /* | |
| 4448 | + * Because we're not yet on the pid-hash, p->pi_lock isn't strictly | |
| 4449 | + * required yet, but lockdep gets upset if rules are violated. | |
| 4450 | + */ | |
| 4450 | 4451 | raw_spin_lock_irqsave(&p->pi_lock, flags); |
| 4451 | 4452 | #ifdef CONFIG_CGROUP_SCHED |
| 4452 | − tg = container_of(kargs->cset->subsys[cpu_cgrp_id], | |
| 4453 | − struct task_group, css); | |
| 4454 | − p->sched_task_group = autogroup_task_group(p, tg); | |
| 4453 | + if (1) { | |
| 4454 | + struct task_group *tg; | |
| 4455 | + tg = container_of(kargs->cset->subsys[cpu_cgrp_id], | |
| 4456 | + struct task_group, css); | |
| 4457 | + tg = autogroup_task_group(p, tg); | |
| 4458 | + p->sched_task_group = tg; | |
| 4459 | + } | |
| 4455 | 4460 | #endif |
| 4456 | 4461 | rseq_migrate(p); |
| 4457 | 4462 | /* |
| @@ -4462,7 +4467,10 @@ void sched_post_fork(struct task_struct *p, struct kernel_clone_args *kargs) · 4 unmodified lines | ||
| 4462 | 4467 | if (p->sched_class->task_fork) |
| 4463 | 4468 | p->sched_class->task_fork(p); |
| 4464 | 4469 | raw_spin_unlock_irqrestore(&p->pi_lock, flags); |
| 4470 | +} | |
| 4465 | 4471 | |
| 4472 | +void sched_post_fork(struct task_struct *p) | |
| 4473 | +{ | |
| 4466 | 4474 | uclamp_post_fork(p); |
| 4467 | 4475 | } |
| 4468 | 4476 | |
| @@ -6922,7 +6930,7 @@ void set_user_nice(struct task_struct *p, long nice) · 2453 unmodified lines | ||
| 6922 | 6930 | put_prev_task(rq, p); |
| 6923 | 6931 | |
| 6924 | 6932 | p->static_prio = NICE_TO_PRIO(nice); |
| 6925 | − set_load_weight(p); | |
| 6933 | + set_load_weight(p, true); | |
| 6926 | 6934 | old_prio = p->prio; |
| 6927 | 6935 | p->prio = effective_prio(p); |
| 6928 | 6936 | |
| @@ -7213,7 +7221,7 @@ static void __setscheduler_params(struct task_struct *p, · 284 unmodified lines | ||
| 7213 | 7221 | */ |
| 7214 | 7222 | p->rt_priority = attr->sched_priority; |
| 7215 | 7223 | p->normal_prio = normal_prio(p); |
| 7216 | − set_load_weight(p); | |
| 7224 | + set_load_weight(p, true); | |
| 7217 | 7225 | } |
| 7218 | 7226 | |
| 7219 | 7227 | /* |
| @@ -9446,7 +9454,7 @@ void __init sched_init(void) · 2226 unmodified lines | ||
| 9446 | 9454 | #endif |
| 9447 | 9455 | } |
| 9448 | 9456 | |
| 9449 | − set_load_weight(&init_task); | |
| 9457 | + set_load_weight(&init_task, false); | |
| 9450 | 9458 | |
| 9451 | 9459 | /* |
| 9452 | 9460 | * The boot idle thread does lazy MMU switching as well: |
| @@ -472,6 +472,16 @@ static int set_user(struct cred *new) · 471 unmodified lines | ||
| 472 | 472 | if (!new_user) |
| 473 | 473 | return -EAGAIN; |
| 474 | 474 | |
| 475 | + free_uid(new->user); | |
| 476 | + new->user = new_user; | |
| 477 | + return 0; | |
| 478 | +} | |
| 479 | + | |
| 480 | +static void flag_nproc_exceeded(struct cred *new) | |
| 481 | +{ | |
| 482 | + if (new->ucounts == current_ucounts()) | |
| 483 | + return; | |
| 484 | + | |
| 475 | 485 | /* |
| 476 | 486 | * We don't fail in case of NPROC limit excess here because too many |
| 477 | 487 | * poorly written programs don't check set*uid() return code, assuming |
| @@ -480,15 +490,10 @@ static int set_user(struct cred *new) · 2 unmodified lines | ||
| 480 | 490 | * failure to the execve() stage. |
| 481 | 491 | */ |
| 482 | 492 | if (is_ucounts_overlimit(new->ucounts, UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC)) && |
| 483 | − new_user != INIT_USER && | |
| 484 | − !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) | |
| 493 | + new->user != INIT_USER) | |
| 485 | 494 | current->flags |= PF_NPROC_EXCEEDED; |
| 486 | 495 | else |
| 487 | 496 | current->flags &= ~PF_NPROC_EXCEEDED; |
| 488 | − | |
| 489 | − free_uid(new->user); | |
| 490 | − new->user = new_user; | |
| 491 | − return 0; | |
| 492 | 497 | } |
| 493 | 498 | |
| 494 | 499 | /* |
| @@ -563,6 +568,7 @@ long __sys_setreuid(uid_t ruid, uid_t euid) · 68 unmodified lines | ||
| 563 | 568 | if (retval < 0) |
| 564 | 569 | goto error; |
| 565 | 570 | |
| 571 | + flag_nproc_exceeded(new); | |
| 566 | 572 | return commit_creds(new); |
| 567 | 573 | |
| 568 | 574 | error: |
| @@ -625,6 +631,7 @@ long __sys_setuid(uid_t uid) · 56 unmodified lines | ||
| 625 | 631 | if (retval < 0) |
| 626 | 632 | goto error; |
| 627 | 633 | |
| 634 | + flag_nproc_exceeded(new); | |
| 628 | 635 | return commit_creds(new); |
| 629 | 636 | |
| 630 | 637 | error: |
| @@ -704,6 +711,7 @@ long __sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) · 73 unmodified lines | ||
| 704 | 711 | if (retval < 0) |
| 705 | 712 | goto error; |
| 706 | 713 | |
| 714 | + flag_nproc_exceeded(new); | |
| 707 | 715 | return commit_creds(new); |
| 708 | 716 | |
| 709 | 717 | error: |
| @@ -7191,7 +7191,6 @@ static int __init ftrace_nodyn_init(void) · 7190 unmodified lines | ||
| 7191 | 7191 | core_initcall(ftrace_nodyn_init); |
| 7192 | 7192 | |
| 7193 | 7193 | static inline int ftrace_init_dyn_tracefs(struct dentry *d_tracer) { return 0; } |
| 7194 | −static inline void ftrace_startup_enable(int command) { } | |
| 7195 | 7194 | static inline void ftrace_startup_all(int command) { } |
| 7196 | 7195 | |
| 7197 | 7196 | # define ftrace_startup_sysctl() do { } while (0) |
| @@ -1474,10 +1474,12 @@ static int __init set_buf_size(char *str) · 1473 unmodified lines | ||
| 1474 | 1474 | if (!str) |
| 1475 | 1475 | return 0; |
| 1476 | 1476 | buf_size = memparse(str, &str); |
| 1477 | − /* nr_entries can not be zero */ | |
| 1478 | − if (buf_size == 0) | |
| 1479 | − return 0; | |
| 1480 | − trace_buf_size = buf_size; | |
| 1477 | + /* | |
| 1478 | + * nr_entries can not be zero and the startup | |
| 1479 | + * tests require some buffer space. Therefore | |
| 1480 | + * ensure we have at least 4096 bytes of buffer. | |
| 1481 | + */ | |
| 1482 | + trace_buf_size = max(4096UL, buf_size); | |
| 1481 | 1483 | return 1; |
| 1482 | 1484 | } |
| 1483 | 1485 | __setup("trace_buf_size=", set_buf_size); |
| @@ -136,7 +136,6 @@ struct kprobe_trace_entry_head { · 135 unmodified lines | ||
| 136 | 136 | |
| 137 | 137 | struct eprobe_trace_entry_head { |
| 138 | 138 | struct trace_entry ent; |
| 139 | − unsigned int type; | |
| 140 | 139 | }; |
| 141 | 140 | |
| 142 | 141 | struct kretprobe_trace_entry_head { |
| @@ -242,7 +242,6 @@ static int trace_eprobe_tp_arg_update(struct trace_eprobe *ep, int i) · 241 unmodified lines | ||
| 242 | 242 | |
| 243 | 243 | static int eprobe_event_define_fields(struct trace_event_call *event_call) |
| 244 | 244 | { |
| 245 | − int ret; | |
| 246 | 245 | struct eprobe_trace_entry_head field; |
| 247 | 246 | struct trace_probe *tp; |
| 248 | 247 | |
| @@ -250,8 +249,6 @@ static int eprobe_event_define_fields(struct trace_event_call *event_call) · 1 unmodified line | ||
| 250 | 249 | if (WARN_ON_ONCE(!tp)) |
| 251 | 250 | return -ENOENT; |
| 252 | 251 | |
| 253 | − DEFINE_FIELD(unsigned int, type, FIELD_STRING_TYPE, 0); | |
| 254 | − | |
| 255 | 252 | return traceprobe_define_arg_fields(event_call, sizeof(field), tp); |
| 256 | 253 | } |
| 257 | 254 | |
| @@ -270,7 +267,9 @@ print_eprobe_event(struct trace_iterator *iter, int flags, · 12 unmodified lines | ||
| 270 | 267 | struct trace_event_call *pevent; |
| 271 | 268 | struct trace_event *probed_event; |
| 272 | 269 | struct trace_seq *s = &iter->seq; |
| 270 | + struct trace_eprobe *ep; | |
| 273 | 271 | struct trace_probe *tp; |
| 272 | + unsigned int type; | |
| 274 | 273 | |
| 275 | 274 | field = (struct eprobe_trace_entry_head *)iter->ent; |
| 276 | 275 | tp = trace_probe_primary_from_call( |
| @@ -278,15 +277,18 @@ print_eprobe_event(struct trace_iterator *iter, int flags, · 1 unmodified line | ||
| 278 | 277 | if (WARN_ON_ONCE(!tp)) |
| 279 | 278 | goto out; |
| 280 | 279 | |
| 280 | + ep = container_of(tp, struct trace_eprobe, tp); | |
| 281 | + type = ep->event->event.type; | |
| 282 | + | |
| 281 | 283 | trace_seq_printf(s, "%s: (", trace_probe_name(tp)); |
| 282 | 284 | |
| 283 | − probed_event = ftrace_find_event(field->type); | |
| 285 | + probed_event = ftrace_find_event(type); | |
| 284 | 286 | if (probed_event) { |
| 285 | 287 | pevent = container_of(probed_event, struct trace_event_call, event); |
| 286 | 288 | trace_seq_printf(s, "%s.%s", pevent->class->system, |
| 287 | 289 | trace_event_name(pevent)); |
| 288 | 290 | } else { |
| 289 | − trace_seq_printf(s, "%u", field->type); | |
| 291 | + trace_seq_printf(s, "%u", type); | |
| 290 | 292 | } |
| 291 | 293 | |
| 292 | 294 | trace_seq_putc(s, ')'); |
| @@ -498,10 +500,6 @@ __eprobe_trace_func(struct eprobe_data *edata, void *rec) · 205 unmodified lines | ||
| 498 | 500 | return; |
| 499 | 501 | |
| 500 | 502 | entry = fbuffer.entry = ring_buffer_event_data(fbuffer.event); |
| 501 | − if (edata->ep->event) | |
| 502 | − entry->type = edata->ep->event->event.type; | |
| 503 | − else | |
| 504 | − entry->type = 0; | |
| 505 | 503 | store_trace_args(&entry[1], &edata->ep->tp, rec, sizeof(*entry), dsize); |
| 506 | 504 | |
| 507 | 505 | trace_event_buffer_commit(&fbuffer); |
| @@ -84,6 +84,20 @@ event_triggers_call(struct trace_event_file *file, · 83 unmodified lines | ||
| 84 | 84 | } |
| 85 | 85 | EXPORT_SYMBOL_GPL(event_triggers_call); |
| 86 | 86 | |
| 87 | +bool __trace_trigger_soft_disabled(struct trace_event_file *file) | |
| 88 | +{ | |
| 89 | + unsigned long eflags = file->flags; | |
| 90 | + | |
| 91 | + if (eflags & EVENT_FILE_FL_TRIGGER_MODE) | |
| 92 | + event_triggers_call(file, NULL, NULL, NULL); | |
| 93 | + if (eflags & EVENT_FILE_FL_SOFT_DISABLED) | |
| 94 | + return true; | |
| 95 | + if (eflags & EVENT_FILE_FL_PID_FILTER) | |
| 96 | + return trace_event_ignore_this_pid(file); | |
| 97 | + return false; | |
| 98 | +} | |
| 99 | +EXPORT_SYMBOL_GPL(__trace_trigger_soft_disabled); | |
| 100 | + | |
| 87 | 101 | /** |
| 88 | 102 | * event_triggers_post_call - Call 'post_triggers' for a trace event |
| 89 | 103 | * @file: The trace_event_file associated with the event |
| @@ -1295,6 +1309,16 @@ traceon_trigger(struct event_trigger_data *data, · 1205 unmodified lines | ||
| 1295 | 1309 | struct trace_buffer *buffer, void *rec, |
| 1296 | 1310 | struct ring_buffer_event *event) |
| 1297 | 1311 | { |
| 1312 | + struct trace_event_file *file = data->private_data; | |
| 1313 | + | |
| 1314 | + if (file) { | |
| 1315 | + if (tracer_tracing_is_on(file->tr)) | |
| 1316 | + return; | |
| 1317 | + | |
| 1318 | + tracer_tracing_on(file->tr); | |
| 1319 | + return; | |
| 1320 | + } | |
| 1321 | + | |
| 1298 | 1322 | if (tracing_is_on()) |
| 1299 | 1323 | return; |
| 1300 | 1324 | |
| @@ -1306,8 +1330,15 @@ traceon_count_trigger(struct event_trigger_data *data, · 5 unmodified lines | ||
| 1306 | 1330 | struct trace_buffer *buffer, void *rec, |
| 1307 | 1331 | struct ring_buffer_event *event) |
| 1308 | 1332 | { |
| 1309 | − if (tracing_is_on()) | |
| 1310 | − return; | |
| 1333 | + struct trace_event_file *file = data->private_data; | |
| 1334 | + | |
| 1335 | + if (file) { | |
| 1336 | + if (tracer_tracing_is_on(file->tr)) | |
| 1337 | + return; | |
| 1338 | + } else { | |
| 1339 | + if (tracing_is_on()) | |
| 1340 | + return; | |
| 1341 | + } | |
| 1311 | 1342 | |
| 1312 | 1343 | if (!data->count) |
| 1313 | 1344 | return; |
| @@ -1315,7 +1346,10 @@ traceon_count_trigger(struct event_trigger_data *data, · 1 unmodified line | ||
| 1315 | 1346 | if (data->count != -1) |
| 1316 | 1347 | (data->count)--; |
| 1317 | 1348 | |
| 1318 | − tracing_on(); | |
| 1349 | + if (file) | |
| 1350 | + tracer_tracing_on(file->tr); | |
| 1351 | + else | |
| 1352 | + tracing_on(); | |
| 1319 | 1353 | } |
| 1320 | 1354 | |
| 1321 | 1355 | static void |
| @@ -1323,6 +1357,16 @@ traceoff_trigger(struct event_trigger_data *data, · 1 unmodified line | ||
| 1323 | 1357 | struct trace_buffer *buffer, void *rec, |
| 1324 | 1358 | struct ring_buffer_event *event) |
| 1325 | 1359 | { |
| 1360 | + struct trace_event_file *file = data->private_data; | |
| 1361 | + | |
| 1362 | + if (file) { | |
| 1363 | + if (!tracer_tracing_is_on(file->tr)) | |
| 1364 | + return; | |
| 1365 | + | |
| 1366 | + tracer_tracing_off(file->tr); | |
| 1367 | + return; | |
| 1368 | + } | |
| 1369 | + | |
| 1326 | 1370 | if (!tracing_is_on()) |
| 1327 | 1371 | return; |
| 1328 | 1372 | |
| @@ -1334,8 +1378,15 @@ traceoff_count_trigger(struct event_trigger_data *data, · 5 unmodified lines | ||
| 1334 | 1378 | struct trace_buffer *buffer, void *rec, |
| 1335 | 1379 | struct ring_buffer_event *event) |
| 1336 | 1380 | { |
| 1337 | − if (!tracing_is_on()) | |
| 1338 | − return; | |
| 1381 | + struct trace_event_file *file = data->private_data; | |
| 1382 | + | |
| 1383 | + if (file) { | |
| 1384 | + if (!tracer_tracing_is_on(file->tr)) | |
| 1385 | + return; | |
| 1386 | + } else { | |
| 1387 | + if (!tracing_is_on()) | |
| 1388 | + return; | |
| 1389 | + } | |
| 1339 | 1390 | |
| 1340 | 1391 | if (!data->count) |
| 1341 | 1392 | return; |
| @@ -1343,7 +1394,10 @@ traceoff_count_trigger(struct event_trigger_data *data, · 1 unmodified line | ||
| 1343 | 1394 | if (data->count != -1) |
| 1344 | 1395 | (data->count)--; |
| 1345 | 1396 | |
| 1346 | − tracing_off(); | |
| 1397 | + if (file) | |
| 1398 | + tracer_tracing_off(file->tr); | |
| 1399 | + else | |
| 1400 | + tracing_off(); | |
| 1347 | 1401 | } |
| 1348 | 1402 | |
| 1349 | 1403 | static int |
| @@ -1540,7 +1594,12 @@ stacktrace_trigger(struct event_trigger_data *data, · 190 unmodified lines | ||
| 1540 | 1594 | struct trace_buffer *buffer, void *rec, |
| 1541 | 1595 | struct ring_buffer_event *event) |
| 1542 | 1596 | { |
| 1543 | − trace_dump_stack(STACK_SKIP); | |
| 1597 | + struct trace_event_file *file = data->private_data; | |
| 1598 | + | |
| 1599 | + if (file) | |
| 1600 | + __trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP); | |
| 1601 | + else | |
| 1602 | + trace_dump_stack(STACK_SKIP); | |
| 1544 | 1603 | } |
| 1545 | 1604 | |
| 1546 | 1605 | static void |
| @@ -1436,6 +1436,37 @@ out: · 1435 unmodified lines | ||
| 1436 | 1436 | static struct cpumask osnoise_cpumask; |
| 1437 | 1437 | static struct cpumask save_cpumask; |
| 1438 | 1438 | |
| 1439 | +/* | |
| 1440 | + * osnoise_sleep - sleep until the next period | |
| 1441 | + */ | |
| 1442 | +static void osnoise_sleep(void) | |
| 1443 | +{ | |
| 1444 | + u64 interval; | |
| 1445 | + ktime_t wake_time; | |
| 1446 | + | |
| 1447 | + mutex_lock(&interface_lock); | |
| 1448 | + interval = osnoise_data.sample_period - osnoise_data.sample_runtime; | |
| 1449 | + mutex_unlock(&interface_lock); | |
| 1450 | + | |
| 1451 | + /* | |
| 1452 | + * differently from hwlat_detector, the osnoise tracer can run | |
| 1453 | + * without a pause because preemption is on. | |
| 1454 | + */ | |
| 1455 | + if (!interval) { | |
| 1456 | + /* Let synchronize_rcu_tasks() make progress */ | |
| 1457 | + cond_resched_tasks_rcu_qs(); | |
| 1458 | + return; | |
| 1459 | + } | |
| 1460 | + | |
| 1461 | + wake_time = ktime_add_us(ktime_get(), interval); | |
| 1462 | + __set_current_state(TASK_INTERRUPTIBLE); | |
| 1463 | + | |
| 1464 | + while (schedule_hrtimeout_range(&wake_time, 0, HRTIMER_MODE_ABS)) { | |
| 1465 | + if (kthread_should_stop()) | |
| 1466 | + break; | |
| 1467 | + } | |
| 1468 | +} | |
| 1469 | + | |
| 1439 | 1470 | /* |
| 1440 | 1471 | * osnoise_main - The osnoise detection kernel thread |
| 1441 | 1472 | * |
| @@ -1444,30 +1475,10 @@ static struct cpumask save_cpumask; · 2 unmodified lines | ||
| 1444 | 1475 | */ |
| 1445 | 1476 | static int osnoise_main(void *data) |
| 1446 | 1477 | { |
| 1447 | − u64 interval; | |
| 1448 | 1478 | |
| 1449 | 1479 | while (!kthread_should_stop()) { |
| 1450 | − | |
| 1451 | 1480 | run_osnoise(); |
| 1452 | − | |
| 1453 | − mutex_lock(&interface_lock); | |
| 1454 | − interval = osnoise_data.sample_period - osnoise_data.sample_runtime; | |
| 1455 | − mutex_unlock(&interface_lock); | |
| 1456 | − | |
| 1457 | − do_div(interval, USEC_PER_MSEC); | |
| 1458 | − | |
| 1459 | − /* | |
| 1460 | − * differently from hwlat_detector, the osnoise tracer can run | |
| 1461 | − * without a pause because preemption is on. | |
| 1462 | − */ | |
| 1463 | − if (interval < 1) { | |
| 1464 | − /* Let synchronize_rcu_tasks() make progress */ | |
| 1465 | − cond_resched_tasks_rcu_qs(); | |
| 1466 | − continue; | |
| 1467 | − } | |
| 1468 | − | |
| 1469 | − if (msleep_interruptible(interval)) | |
| 1470 | − break; | |
| 1481 | + osnoise_sleep(); | |
| 1471 | 1482 | } |
| 1472 | 1483 | |
| 1473 | 1484 | return 0; |
| @@ -871,15 +871,15 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len, · 870 unmodified lines | ||
| 871 | 871 | switch (ptype) { |
| 872 | 872 | case PROBE_PRINT_NORMAL: |
| 873 | 873 | fmt = "(%lx)"; |
| 874 | − arg = "REC->" FIELD_STRING_IP; | |
| 874 | + arg = ", REC->" FIELD_STRING_IP; | |
| 875 | 875 | break; |
| 876 | 876 | case PROBE_PRINT_RETURN: |
| 877 | 877 | fmt = "(%lx <- %lx)"; |
| 878 | − arg = "REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP; | |
| 878 | + arg = ", REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP; | |
| 879 | 879 | break; |
| 880 | 880 | case PROBE_PRINT_EVENT: |
| 881 | − fmt = "(%u)"; | |
| 882 | − arg = "REC->" FIELD_STRING_TYPE; | |
| 881 | + fmt = ""; | |
| 882 | + arg = ""; | |
| 883 | 883 | break; |
| 884 | 884 | default: |
| 885 | 885 | WARN_ON_ONCE(1); |
| @@ -903,7 +903,7 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len, · 17 unmodified lines | ||
| 903 | 903 | parg->type->fmt); |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | − pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg); | |
| 906 | + pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", arg); | |
| 907 | 907 | |
| 908 | 908 | for (i = 0; i < tp->nr_args; i++) { |
| 909 | 909 | parg = tp->args + i; |
| @@ -38,7 +38,6 @@ · 37 unmodified lines | ||
| 38 | 38 | #define FIELD_STRING_IP "__probe_ip" |
| 39 | 39 | #define FIELD_STRING_RETIP "__probe_ret_ip" |
| 40 | 40 | #define FIELD_STRING_FUNC "__probe_func" |
| 41 | −#define FIELD_STRING_TYPE "__probe_type" | |
| 42 | 41 | |
| 43 | 42 | #undef DEFINE_FIELD |
| 44 | 43 | #define DEFINE_FIELD(type, item, name, is_signed) \ |
| @@ -784,9 +784,7 @@ static struct fgraph_ops fgraph_ops __initdata = { · 783 unmodified lines | ||
| 784 | 784 | .retfunc = &trace_graph_return, |
| 785 | 785 | }; |
| 786 | 786 | |
| 787 | −#if defined(CONFIG_DYNAMIC_FTRACE) && \ | |
| 788 | − defined(CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS) | |
| 789 | −#define TEST_DIRECT_TRAMP | |
| 787 | +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS | |
| 790 | 788 | noinline __noclone static void trace_direct_tramp(void) { } |
| 791 | 789 | #endif |
| 792 | 790 | |
| @@ -849,7 +847,7 @@ trace_selftest_startup_function_graph(struct tracer *trace, · 56 unmodified lines | ||
| 849 | 847 | goto out; |
| 850 | 848 | } |
| 851 | 849 | |
| 852 | −#ifdef TEST_DIRECT_TRAMP | |
| 850 | +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS | |
| 853 | 851 | tracing_reset_online_cpus(&tr->array_buffer); |
| 854 | 852 | set_graph_array(tr); |
| 855 | 853 | |
| @@ -350,7 +350,8 @@ bool is_ucounts_overlimit(struct ucounts *ucounts, enum ucount_type type, unsign · 349 unmodified lines | ||
| 350 | 350 | if (rlimit > LONG_MAX) |
| 351 | 351 | max = LONG_MAX; |
| 352 | 352 | for (iter = ucounts; iter; iter = iter->ns->ucounts) { |
| 353 | − if (get_ucounts_value(iter, type) > max) | |
| 353 | + long val = get_ucounts_value(iter, type); | |
| 354 | + if (val < 0 || val > max) | |
| 354 | 355 | return true; |
| 355 | 356 | max = READ_ONCE(iter->ns->ucount_max[type]); |
| 356 | 357 | } |
| @@ -414,6 +414,7 @@ static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t by · 413 unmodified lines | ||
| 414 | 414 | return 0; |
| 415 | 415 | |
| 416 | 416 | buf->ops = &page_cache_pipe_buf_ops; |
| 417 | + buf->flags = 0; | |
| 417 | 418 | get_page(page); |
| 418 | 419 | buf->page = page; |
| 419 | 420 | buf->offset = offset; |
| @@ -577,6 +578,7 @@ static size_t push_pipe(struct iov_iter *i, size_t size, · 157 unmodified lines | ||
| 577 | 578 | break; |
| 578 | 579 | |
| 579 | 580 | buf->ops = &default_pipe_buf_ops; |
| 581 | + buf->flags = 0; | |
| 580 | 582 | buf->page = page; |
| 581 | 583 | buf->offset = 0; |
| 582 | 584 | buf->len = min_t(ssize_t, left, PAGE_SIZE); |
| @@ -869,11 +869,14 @@ static void kmem_cache_invalid_free(struct kunit *test) · 868 unmodified lines | ||
| 869 | 869 | kmem_cache_destroy(cache); |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | +static void empty_cache_ctor(void *object) { } | |
| 873 | + | |
| 872 | 874 | static void kmem_cache_double_destroy(struct kunit *test) |
| 873 | 875 | { |
| 874 | 876 | struct kmem_cache *cache; |
| 875 | 877 | |
| 876 | − cache = kmem_cache_create("test_cache", 200, 0, 0, NULL); | |
| 878 | + /* Provide a constructor to prevent cache merging. */ | |
| 879 | + cache = kmem_cache_create("test_cache", 200, 0, 0, empty_cache_ctor); | |
| 877 | 880 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, cache); |
| 878 | 881 | kmem_cache_destroy(cache); |
| 879 | 882 | KUNIT_EXPECT_KASAN_FAIL(test, kmem_cache_destroy(cache)); |
| @@ -4159,10 +4159,10 @@ static int __init hugepages_setup(char *s) · 4158 unmodified lines | ||
| 4159 | 4159 | pr_warn("HugeTLB: architecture can't support node specific alloc, ignoring!\n"); |
| 4160 | 4160 | return 0; |
| 4161 | 4161 | } |
| 4162 | + if (tmp >= nr_online_nodes) | |
| 4163 | + goto invalid; | |
| 4162 | 4164 | node = tmp; |
| 4163 | 4165 | p += count + 1; |
| 4164 | − if (node < 0 || node >= nr_online_nodes) | |
| 4165 | − goto invalid; | |
| 4166 | 4166 | /* Parse hugepages */ |
| 4167 | 4167 | if (sscanf(p, "%lu%n", &tmp, &count) != 1) |
| 4168 | 4168 | goto invalid; |
| @@ -4851,14 +4851,13 @@ again: · 682 unmodified lines | ||
| 4851 | 4851 | } |
| 4852 | 4852 | |
| 4853 | 4853 | static void move_huge_pte(struct vm_area_struct *vma, unsigned long old_addr, |
| 4854 | − unsigned long new_addr, pte_t *src_pte) | |
| 4854 | + unsigned long new_addr, pte_t *src_pte, pte_t *dst_pte) | |
| 4855 | 4855 | { |
| 4856 | 4856 | struct hstate *h = hstate_vma(vma); |
| 4857 | 4857 | struct mm_struct *mm = vma->vm_mm; |
| 4858 | − pte_t *dst_pte, pte; | |
| 4859 | 4858 | spinlock_t *src_ptl, *dst_ptl; |
| 4859 | + pte_t pte; | |
| 4860 | 4860 | |
| 4861 | − dst_pte = huge_pte_offset(mm, new_addr, huge_page_size(h)); | |
| 4862 | 4861 | dst_ptl = huge_pte_lock(h, mm, dst_pte); |
| 4863 | 4862 | src_ptl = huge_pte_lockptr(h, mm, src_pte); |
| 4864 | 4863 | |
| @@ -4917,7 +4916,7 @@ int move_hugetlb_page_tables(struct vm_area_struct *vma, · 52 unmodified lines | ||
| 4917 | 4916 | if (!dst_pte) |
| 4918 | 4917 | break; |
| 4919 | 4918 | |
| 4920 | − move_huge_pte(vma, old_addr, new_addr, src_pte); | |
| 4919 | + move_huge_pte(vma, old_addr, new_addr, src_pte, dst_pte); | |
| 4921 | 4920 | } |
| 4922 | 4921 | flush_tlb_range(vma, old_end - len, old_end); |
| 4923 | 4922 | mmu_notifier_invalidate_range_end(&range); |
| @@ -366,14 +366,20 @@ void __init memblock_discard(void) · 365 unmodified lines | ||
| 366 | 366 | addr = __pa(memblock.reserved.regions); |
| 367 | 367 | size = PAGE_ALIGN(sizeof(struct memblock_region) * |
| 368 | 368 | memblock.reserved.max); |
| 369 | − memblock_free_late(addr, size); | |
| 369 | + if (memblock_reserved_in_slab) | |
| 370 | + kfree(memblock.reserved.regions); | |
| 371 | + else | |
| 372 | + memblock_free_late(addr, size); | |
| 370 | 373 | } |
| 371 | 374 | |
| 372 | 375 | if (memblock.memory.regions != memblock_memory_init_regions) { |
| 373 | 376 | addr = __pa(memblock.memory.regions); |
| 374 | 377 | size = PAGE_ALIGN(sizeof(struct memblock_region) * |
| 375 | 378 | memblock.memory.max); |
| 376 | − memblock_free_late(addr, size); | |
| 379 | + if (memblock_memory_in_slab) | |
| 380 | + kfree(memblock.memory.regions); | |
| 381 | + else | |
| 382 | + memblock_free_late(addr, size); | |
| 377 | 383 | } |
| 378 | 384 | |
| 379 | 385 | memblock_memory = NULL; |
| @@ -3186,6 +3186,7 @@ void exit_mmap(struct mm_struct *mm) · 3185 unmodified lines | ||
| 3186 | 3186 | vma = remove_vma(vma); |
| 3187 | 3187 | cond_resched(); |
| 3188 | 3188 | } |
| 3189 | + mm->mmap = NULL; | |
| 3189 | 3190 | mmap_write_unlock(mm); |
| 3190 | 3191 | vm_unacct_memory(nr_accounted); |
| 3191 | 3192 | } |
| @@ -94,7 +94,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 93 unmodified lines | ||
| 94 | 94 | |
| 95 | 95 | /* Also skip shared copy-on-write pages */ |
| 96 | 96 | if (is_cow_mapping(vma->vm_flags) && |
| 97 | − page_mapcount(page) != 1) | |
| 97 | + page_count(page) != 1) | |
| 98 | 98 | continue; |
| 99 | 99 | |
| 100 | 100 | /* |
| @@ -82,6 +82,9 @@ static void br_multicast_find_del_pg(struct net_bridge *br, · 81 unmodified lines | ||
| 82 | 82 | struct net_bridge_port_group *pg); |
| 83 | 83 | static void __br_multicast_stop(struct net_bridge_mcast *brmctx); |
| 84 | 84 | |
| 85 | +static int br_mc_disabled_update(struct net_device *dev, bool value, | |
| 86 | + struct netlink_ext_ack *extack); | |
| 87 | + | |
| 85 | 88 | static struct net_bridge_port_group * |
| 86 | 89 | br_sg_port_find(struct net_bridge *br, |
| 87 | 90 | struct net_bridge_port_group_sg_key *sg_p) |
| @@ -1156,6 +1159,7 @@ struct net_bridge_mdb_entry *br_multicast_new_group(struct net_bridge *br, · 1068 unmodified lines | ||
| 1156 | 1159 | return mp; |
| 1157 | 1160 | |
| 1158 | 1161 | if (atomic_read(&br->mdb_hash_tbl.nelems) >= br->hash_max) { |
| 1162 | + br_mc_disabled_update(br->dev, false, NULL); | |
| 1159 | 1163 | br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false); |
| 1160 | 1164 | return ERR_PTR(-E2BIG); |
| 1161 | 1165 | } |
| @@ -2006,7 +2006,7 @@ struct j1939_session *j1939_tp_send(struct j1939_priv *priv, · 2005 unmodified lines | ||
| 2006 | 2006 | /* set the end-packet for broadcast */ |
| 2007 | 2007 | session->pkt.last = session->pkt.total; |
| 2008 | 2008 | |
| 2009 | − skcb->tskey = session->sk->sk_tskey++; | |
| 2009 | + skcb->tskey = atomic_inc_return(&session->sk->sk_tskey) - 1; | |
| 2010 | 2010 | session->tskey = skcb->tskey; |
| 2011 | 2011 | |
| 2012 | 2012 | return session; |
| @@ -283,13 +283,17 @@ static void trace_napi_poll_hit(void *ignore, struct napi_struct *napi, · 282 unmodified lines | ||
| 283 | 283 | |
| 284 | 284 | rcu_read_lock(); |
| 285 | 285 | list_for_each_entry_rcu(new_stat, &hw_stats_list, list) { |
| 286 | + struct net_device *dev; | |
| 287 | + | |
| 286 | 288 | /* |
| 287 | 289 | * only add a note to our monitor buffer if: |
| 288 | 290 | * 1) this is the dev we received on |
| 289 | 291 | * 2) its after the last_rx delta |
| 290 | 292 | * 3) our rx_dropped count has gone up |
| 291 | 293 | */ |
| 292 | − if ((new_stat->dev == napi->dev) && | |
| 294 | + /* Paired with WRITE_ONCE() in dropmon_net_event() */ | |
| 295 | + dev = READ_ONCE(new_stat->dev); | |
| 296 | + if ((dev == napi->dev) && | |
| 293 | 297 | (time_after(jiffies, new_stat->last_rx + dm_hw_check_delta)) && |
| 294 | 298 | (napi->dev->stats.rx_dropped != new_stat->last_drop_val)) { |
| 295 | 299 | trace_drop_common(NULL, NULL); |
| @@ -1576,7 +1580,10 @@ static int dropmon_net_event(struct notifier_block *ev_block, · 1280 unmodified lines | ||
| 1576 | 1580 | mutex_lock(&net_dm_mutex); |
| 1577 | 1581 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { |
| 1578 | 1582 | if (new_stat->dev == dev) { |
| 1579 | − new_stat->dev = NULL; | |
| 1583 | + | |
| 1584 | + /* Paired with READ_ONCE() in trace_napi_poll_hit() */ | |
| 1585 | + WRITE_ONCE(new_stat->dev, NULL); | |
| 1586 | + | |
| 1580 | 1587 | if (trace_state == TRACE_OFF) { |
| 1581 | 1588 | list_del_rcu(&new_stat->list); |
| 1582 | 1589 | kfree_rcu(new_stat, rcu); |
| @@ -2710,6 +2710,9 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, · 2709 unmodified lines | ||
| 2710 | 2710 | if (unlikely(flags)) |
| 2711 | 2711 | return -EINVAL; |
| 2712 | 2712 | |
| 2713 | + if (unlikely(len == 0)) | |
| 2714 | + return 0; | |
| 2715 | + | |
| 2713 | 2716 | /* First find the starting scatterlist element */ |
| 2714 | 2717 | i = msg->sg.start; |
| 2715 | 2718 | do { |
| @@ -213,7 +213,7 @@ static ssize_t speed_show(struct device *dev, · 212 unmodified lines | ||
| 213 | 213 | if (!rtnl_trylock()) |
| 214 | 214 | return restart_syscall(); |
| 215 | 215 | |
| 216 | − if (netif_running(netdev)) { | |
| 216 | + if (netif_running(netdev) && netif_device_present(netdev)) { | |
| 217 | 217 | struct ethtool_link_ksettings cmd; |
| 218 | 218 | |
| 219 | 219 | if (!__ethtool_get_link_ksettings(netdev, &cmd)) |
| @@ -1699,6 +1699,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, · 1698 unmodified lines | ||
| 1699 | 1699 | { |
| 1700 | 1700 | struct ifinfomsg *ifm; |
| 1701 | 1701 | struct nlmsghdr *nlh; |
| 1702 | + struct Qdisc *qdisc; | |
| 1702 | 1703 | |
| 1703 | 1704 | ASSERT_RTNL(); |
| 1704 | 1705 | nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); |
| @@ -1716,6 +1717,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, · 11 unmodified lines | ||
| 1716 | 1717 | if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid)) |
| 1717 | 1718 | goto nla_put_failure; |
| 1718 | 1719 | |
| 1720 | + qdisc = rtnl_dereference(dev->qdisc); | |
| 1719 | 1721 | if (nla_put_string(skb, IFLA_IFNAME, dev->name) || |
| 1720 | 1722 | nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) || |
| 1721 | 1723 | nla_put_u8(skb, IFLA_OPERSTATE, |
| @@ -1735,8 +1737,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, · 13 unmodified lines | ||
| 1735 | 1737 | #endif |
| 1736 | 1738 | put_master_ifindex(skb, dev) || |
| 1737 | 1739 | nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) || |
| 1738 | − (dev->qdisc && | |
| 1739 | − nla_put_string(skb, IFLA_QDISC, dev->qdisc->ops->id)) || | |
| 1740 | + (qdisc && | |
| 1741 | + nla_put_string(skb, IFLA_QDISC, qdisc->ops->id)) || | |
| 1740 | 1742 | nla_put_ifalias(skb, dev) || |
| 1741 | 1743 | nla_put_u32(skb, IFLA_CARRIER_CHANGES, |
| 1742 | 1744 | atomic_read(&dev->carrier_up_count) + |
| @@ -2276,7 +2276,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) · 2275 unmodified lines | ||
| 2276 | 2276 | /* Free pulled out fragments. */ |
| 2277 | 2277 | while ((list = skb_shinfo(skb)->frag_list) != insp) { |
| 2278 | 2278 | skb_shinfo(skb)->frag_list = list->next; |
| 2279 | − kfree_skb(list); | |
| 2279 | + consume_skb(list); | |
| 2280 | 2280 | } |
| 2281 | 2281 | /* And insert new clone at head. */ |
| 2282 | 2282 | if (clone) { |
| @@ -4730,7 +4730,7 @@ static void __skb_complete_tx_timestamp(struct sk_buff *skb, · 2447 unmodified lines | ||
| 4730 | 4730 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { |
| 4731 | 4731 | serr->ee.ee_data = skb_shinfo(skb)->tskey; |
| 4732 | 4732 | if (sk_is_tcp(sk)) |
| 4733 | − serr->ee.ee_data -= sk->sk_tskey; | |
| 4733 | + serr->ee.ee_data -= atomic_read(&sk->sk_tskey); | |
| 4734 | 4734 | } |
| 4735 | 4735 | |
| 4736 | 4736 | err = sock_queue_err_skb(sk, skb); |
| @@ -6105,7 +6105,7 @@ static int pskb_carve_frag_list(struct sk_buff *skb, · 1368 unmodified lines | ||
| 6105 | 6105 | /* Free pulled out fragments. */ |
| 6106 | 6106 | while ((list = shinfo->frag_list) != insp) { |
| 6107 | 6107 | shinfo->frag_list = list->next; |
| 6108 | − kfree_skb(list); | |
| 6108 | + consume_skb(list); | |
| 6109 | 6109 | } |
| 6110 | 6110 | /* And insert new clone at head. */ |
| 6111 | 6111 | if (clone) { |
| @@ -879,9 +879,9 @@ int sock_set_timestamping(struct sock *sk, int optname, · 878 unmodified lines | ||
| 879 | 879 | if ((1 << sk->sk_state) & |
| 880 | 880 | (TCPF_CLOSE | TCPF_LISTEN)) |
| 881 | 881 | return -EINVAL; |
| 882 | − sk->sk_tskey = tcp_sk(sk)->snd_una; | |
| 882 | + atomic_set(&sk->sk_tskey, tcp_sk(sk)->snd_una); | |
| 883 | 883 | } else { |
| 884 | − sk->sk_tskey = 0; | |
| 884 | + atomic_set(&sk->sk_tskey, 0); | |
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | |
| @@ -349,6 +349,7 @@ void dsa_flush_workqueue(void) · 348 unmodified lines | ||
| 349 | 349 | { |
| 350 | 350 | flush_workqueue(dsa_owq); |
| 351 | 351 | } |
| 352 | +EXPORT_SYMBOL_GPL(dsa_flush_workqueue); | |
| 352 | 353 | |
| 353 | 354 | int dsa_devlink_param_get(struct devlink *dl, u32 id, |
| 354 | 355 | struct devlink_param_gset_ctx *ctx) |
| @@ -147,7 +147,6 @@ void dsa_tag_driver_put(const struct dsa_device_ops *ops); · 146 unmodified lines | ||
| 147 | 147 | const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf); |
| 148 | 148 | |
| 149 | 149 | bool dsa_schedule_work(struct work_struct *work); |
| 150 | −void dsa_flush_workqueue(void); | |
| 151 | 150 | const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops); |
| 152 | 151 | |
| 153 | 152 | static inline int dsa_tag_protocol_overhead(const struct dsa_device_ops *ops) |
| @@ -260,11 +260,16 @@ static void dsa_netdev_ops_set(struct net_device *dev, · 259 unmodified lines | ||
| 260 | 260 | dev->dsa_ptr->netdev_ops = ops; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | +/* Keep the master always promiscuous if the tagging protocol requires that | |
| 264 | + * (garbles MAC DA) or if it doesn't support unicast filtering, case in which | |
| 265 | + * it would revert to promiscuous mode as soon as we call dev_uc_add() on it | |
| 266 | + * anyway. | |
| 267 | + */ | |
| 263 | 268 | static void dsa_master_set_promiscuity(struct net_device *dev, int inc) |
| 264 | 269 | { |
| 265 | 270 | const struct dsa_device_ops *ops = dev->dsa_ptr->tag_ops; |
| 266 | 271 | |
| 267 | − if (!ops->promisc_on_master) | |
| 272 | + if ((dev->priv_flags & IFF_UNICAST_FLT) && !ops->promisc_on_master) | |
| 268 | 273 | return; |
| 269 | 274 | |
| 270 | 275 | ASSERT_RTNL(); |
| @@ -395,10 +395,17 @@ void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br) · 394 unmodified lines | ||
| 395 | 395 | .tree_index = dp->ds->dst->index, |
| 396 | 396 | .sw_index = dp->ds->index, |
| 397 | 397 | .port = dp->index, |
| 398 | − .bridge = *dp->bridge, | |
| 399 | 398 | }; |
| 400 | 399 | int err; |
| 401 | 400 | |
| 401 | + /* If the port could not be offloaded to begin with, then | |
| 402 | + * there is nothing to do. | |
| 403 | + */ | |
| 404 | + if (!dp->bridge) | |
| 405 | + return; | |
| 406 | + | |
| 407 | + info.bridge = *dp->bridge; | |
| 408 | + | |
| 402 | 409 | /* Here the port is already unbridged. Reflect the current configuration |
| 403 | 410 | * so that drivers can program their chips accordingly. |
| 404 | 411 | */ |
| @@ -781,9 +788,15 @@ int dsa_port_host_fdb_add(struct dsa_port *dp, const unsigned char *addr, · 376 unmodified lines | ||
| 781 | 788 | struct dsa_port *cpu_dp = dp->cpu_dp; |
| 782 | 789 | int err; |
| 783 | 790 | |
| 784 | − err = dev_uc_add(cpu_dp->master, addr); | |
| 785 | − if (err) | |
| 786 | − return err; | |
| 791 | + /* Avoid a call to __dev_set_promiscuity() on the master, which | |
| 792 | + * requires rtnl_lock(), since we can't guarantee that is held here, | |
| 793 | + * and we can't take it either. | |
| 794 | + */ | |
| 795 | + if (cpu_dp->master->priv_flags & IFF_UNICAST_FLT) { | |
| 796 | + err = dev_uc_add(cpu_dp->master, addr); | |
| 797 | + if (err) | |
| 798 | + return err; | |
| 799 | + } | |
| 787 | 800 | |
| 788 | 801 | return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_ADD, &info); |
| 789 | 802 | } |
| @@ -800,9 +813,11 @@ int dsa_port_host_fdb_del(struct dsa_port *dp, const unsigned char *addr, · 10 unmodified lines | ||
| 800 | 813 | struct dsa_port *cpu_dp = dp->cpu_dp; |
| 801 | 814 | int err; |
| 802 | 815 | |
| 803 | − err = dev_uc_del(cpu_dp->master, addr); | |
| 804 | − if (err) | |
| 805 | − return err; | |
| 816 | + if (cpu_dp->master->priv_flags & IFF_UNICAST_FLT) { | |
| 817 | + err = dev_uc_del(cpu_dp->master, addr); | |
| 818 | + if (err) | |
| 819 | + return err; | |
| 820 | + } | |
| 806 | 821 | |
| 807 | 822 | return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_DEL, &info); |
| 808 | 823 | } |
| @@ -77,7 +77,6 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev) · 76 unmodified lines | ||
| 77 | 77 | |
| 78 | 78 | static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev) |
| 79 | 79 | { |
| 80 | − __be16 *lan9303_tag; | |
| 81 | 80 | u16 lan9303_tag1; |
| 82 | 81 | unsigned int source_port; |
| 83 | 82 | |
| @@ -87,14 +86,15 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev) · 3 unmodified lines | ||
| 87 | 86 | return NULL; |
| 88 | 87 | } |
| 89 | 88 | |
| 90 | − lan9303_tag = dsa_etype_header_pos_rx(skb); | |
| 91 | − | |
| 92 | − if (lan9303_tag[0] != htons(ETH_P_8021Q)) { | |
| 93 | − dev_warn_ratelimited(&dev->dev, "Dropping packet due to invalid VLAN marker\n"); | |
| 94 | − return NULL; | |
| 89 | + if (skb_vlan_tag_present(skb)) { | |
| 90 | + lan9303_tag1 = skb_vlan_tag_get(skb); | |
| 91 | + __vlan_hwaccel_clear_tag(skb); | |
| 92 | + } else { | |
| 93 | + skb_push_rcsum(skb, ETH_HLEN); | |
| 94 | + __skb_vlan_pop(skb, &lan9303_tag1); | |
| 95 | + skb_pull_rcsum(skb, ETH_HLEN); | |
| 95 | 96 | } |
| 96 | 97 | |
| 97 | − lan9303_tag1 = ntohs(lan9303_tag[1]); | |
| 98 | 98 | source_port = lan9303_tag1 & 0x3; |
| 99 | 99 | |
| 100 | 100 | skb->dev = dsa_master_find_slave(dev, 0, source_port); |
| @@ -103,13 +103,6 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev) · 2 unmodified lines | ||
| 103 | 103 | return NULL; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | − /* remove the special VLAN tag between the MAC addresses | |
| 107 | − * and the current ethertype field. | |
| 108 | − */ | |
| 109 | − skb_pull_rcsum(skb, 2 + 2); | |
| 110 | − | |
| 111 | − dsa_strip_etype_header(skb, LAN9303_TAG_LEN); | |
| 112 | − | |
| 113 | 106 | if (!(lan9303_tag1 & LAN9303_TAG_RX_TRAPPED_TO_CPU)) |
| 114 | 107 | dsa_default_offload_fwd_mark(skb); |
| 115 | 108 | |
| @@ -1376,8 +1376,11 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb, · 1375 unmodified lines | ||
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | 1378 | ops = rcu_dereference(inet_offloads[proto]); |
| 1379 | − if (likely(ops && ops->callbacks.gso_segment)) | |
| 1379 | + if (likely(ops && ops->callbacks.gso_segment)) { | |
| 1380 | 1380 | segs = ops->callbacks.gso_segment(skb, features); |
| 1381 | + if (!segs) | |
| 1382 | + skb->network_header = skb_mac_header(skb) + nhoff - skb->head; | |
| 1383 | + } | |
| 1381 | 1384 | |
| 1382 | 1385 | if (IS_ERR_OR_NULL(segs)) |
| 1383 | 1386 | goto out; |
| @@ -436,6 +436,9 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, · 435 unmodified lines | ||
| 436 | 436 | if (net->ipv4.fib_has_custom_local_routes || |
| 437 | 437 | fib4_has_custom_rules(net)) |
| 438 | 438 | goto full_check; |
| 439 | + /* Within the same container, it is regarded as a martian source, | |
| 440 | + * and the same host but different containers are not. | |
| 441 | + */ | |
| 439 | 442 | if (inet_lookup_ifaddr_rcu(net, src)) |
| 440 | 443 | return -EINVAL; |
| 441 | 444 | |
| @@ -16,10 +16,9 @@ struct fib_alias { · 15 unmodified lines | ||
| 16 | 16 | u8 fa_slen; |
| 17 | 17 | u32 tb_id; |
| 18 | 18 | s16 fa_default; |
| 19 | − u8 offload:1, | |
| 20 | − trap:1, | |
| 21 | − offload_failed:1, | |
| 22 | − unused:5; | |
| 19 | + u8 offload; | |
| 20 | + u8 trap; | |
| 21 | + u8 offload_failed; | |
| 23 | 22 | struct rcu_head rcu; |
| 24 | 23 | }; |
| 25 | 24 | |
| @@ -525,9 +525,9 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, · 524 unmodified lines | ||
| 525 | 525 | fri.dst_len = dst_len; |
| 526 | 526 | fri.tos = fa->fa_tos; |
| 527 | 527 | fri.type = fa->fa_type; |
| 528 | − fri.offload = fa->offload; | |
| 529 | − fri.trap = fa->trap; | |
| 530 | − fri.offload_failed = fa->offload_failed; | |
| 528 | + fri.offload = READ_ONCE(fa->offload); | |
| 529 | + fri.trap = READ_ONCE(fa->trap); | |
| 530 | + fri.offload_failed = READ_ONCE(fa->offload_failed); | |
| 531 | 531 | err = fib_dump_info(skb, info->portid, seq, event, &fri, nlm_flags); |
| 532 | 532 | if (err < 0) { |
| 533 | 533 | /* -EMSGSIZE implies BUG in fib_nlmsg_size() */ |
| @@ -1047,19 +1047,23 @@ void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri) · 1046 unmodified lines | ||
| 1047 | 1047 | if (!fa_match) |
| 1048 | 1048 | goto out; |
| 1049 | 1049 | |
| 1050 | − if (fa_match->offload == fri->offload && fa_match->trap == fri->trap && | |
| 1051 | − fa_match->offload_failed == fri->offload_failed) | |
| 1050 | + /* These are paired with the WRITE_ONCE() happening in this function. | |
| 1051 | + * The reason is that we are only protected by RCU at this point. | |
| 1052 | + */ | |
| 1053 | + if (READ_ONCE(fa_match->offload) == fri->offload && | |
| 1054 | + READ_ONCE(fa_match->trap) == fri->trap && | |
| 1055 | + READ_ONCE(fa_match->offload_failed) == fri->offload_failed) | |
| 1052 | 1056 | goto out; |
| 1053 | 1057 | |
| 1054 | − fa_match->offload = fri->offload; | |
| 1055 | − fa_match->trap = fri->trap; | |
| 1058 | + WRITE_ONCE(fa_match->offload, fri->offload); | |
| 1059 | + WRITE_ONCE(fa_match->trap, fri->trap); | |
| 1056 | 1060 | |
| 1057 | 1061 | /* 2 means send notifications only if offload_failed was changed. */ |
| 1058 | 1062 | if (net->ipv4.sysctl_fib_notify_on_flag_change == 2 && |
| 1059 | − fa_match->offload_failed == fri->offload_failed) | |
| 1063 | + READ_ONCE(fa_match->offload_failed) == fri->offload_failed) | |
| 1060 | 1064 | goto out; |
| 1061 | 1065 | |
| 1062 | − fa_match->offload_failed = fri->offload_failed; | |
| 1066 | + WRITE_ONCE(fa_match->offload_failed, fri->offload_failed); | |
| 1063 | 1067 | |
| 1064 | 1068 | if (!net->ipv4.sysctl_fib_notify_on_flag_change) |
| 1065 | 1069 | goto out; |
| @@ -2297,9 +2301,9 @@ static int fn_trie_dump_leaf(struct key_vector *l, struct fib_table *tb, · 1231 unmodified lines | ||
| 2297 | 2301 | fri.dst_len = KEYLENGTH - fa->fa_slen; |
| 2298 | 2302 | fri.tos = fa->fa_tos; |
| 2299 | 2303 | fri.type = fa->fa_type; |
| 2300 | − fri.offload = fa->offload; | |
| 2301 | − fri.trap = fa->trap; | |
| 2302 | − fri.offload_failed = fa->offload_failed; | |
| 2304 | + fri.offload = READ_ONCE(fa->offload); | |
| 2305 | + fri.trap = READ_ONCE(fa->trap); | |
| 2306 | + fri.offload_failed = READ_ONCE(fa->offload_failed); | |
| 2303 | 2307 | err = fib_dump_info(skb, |
| 2304 | 2308 | NETLINK_CB(cb->skb).portid, |
| 2305 | 2309 | cb->nlh->nlmsg_seq, |
| @@ -991,7 +991,7 @@ static int __ip_append_data(struct sock *sk, · 990 unmodified lines | ||
| 991 | 991 | |
| 992 | 992 | if (cork->tx_flags & SKBTX_ANY_SW_TSTAMP && |
| 993 | 993 | sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) |
| 994 | − tskey = sk->sk_tskey++; | |
| 994 | + tskey = atomic_inc_return(&sk->sk_tskey) - 1; | |
| 995 | 995 | |
| 996 | 996 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); |
| 997 | 997 | |
| @@ -172,16 +172,22 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) · 171 unmodified lines | ||
| 172 | 172 | struct sock *sk = NULL; |
| 173 | 173 | struct inet_sock *isk; |
| 174 | 174 | struct hlist_nulls_node *hnode; |
| 175 | − int dif = skb->dev->ifindex; | |
| 175 | + int dif, sdif; | |
| 176 | 176 | |
| 177 | 177 | if (skb->protocol == htons(ETH_P_IP)) { |
| 178 | + dif = inet_iif(skb); | |
| 179 | + sdif = inet_sdif(skb); | |
| 178 | 180 | pr_debug("try to find: num = %d, daddr = %pI4, dif = %d\n", |
| 179 | 181 | (int)ident, &ip_hdr(skb)->daddr, dif); |
| 180 | 182 | #if IS_ENABLED(CONFIG_IPV6) |
| 181 | 183 | } else if (skb->protocol == htons(ETH_P_IPV6)) { |
| 184 | + dif = inet6_iif(skb); | |
| 185 | + sdif = inet6_sdif(skb); | |
| 182 | 186 | pr_debug("try to find: num = %d, daddr = %pI6c, dif = %d\n", |
| 183 | 187 | (int)ident, &ipv6_hdr(skb)->daddr, dif); |
| 184 | 188 | #endif |
| 189 | + } else { | |
| 190 | + return NULL; | |
| 185 | 191 | } |
| 186 | 192 | |
| 187 | 193 | read_lock_bh(&ping_table.lock); |
| @@ -221,7 +227,7 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) · 33 unmodified lines | ||
| 221 | 227 | } |
| 222 | 228 | |
| 223 | 229 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif && |
| 224 | − sk->sk_bound_dev_if != inet_sdif(skb)) | |
| 230 | + sk->sk_bound_dev_if != sdif) | |
| 225 | 231 | continue; |
| 226 | 232 | |
| 227 | 233 | sock_hold(sk); |
| @@ -3395,8 +3395,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, · 3394 unmodified lines | ||
| 3395 | 3395 | fa->fa_tos == fri.tos && |
| 3396 | 3396 | fa->fa_info == res.fi && |
| 3397 | 3397 | fa->fa_type == fri.type) { |
| 3398 | − fri.offload = fa->offload; | |
| 3399 | − fri.trap = fa->trap; | |
| 3398 | + fri.offload = READ_ONCE(fa->offload); | |
| 3399 | + fri.trap = READ_ONCE(fa->trap); | |
| 3400 | 3400 | break; |
| 3401 | 3401 | } |
| 3402 | 3402 | } |
| @@ -846,7 +846,7 @@ udp_tunnel_nic_unregister(struct net_device *dev, struct udp_tunnel_nic *utn) · 845 unmodified lines | ||
| 846 | 846 | list_for_each_entry(node, &info->shared->devices, list) |
| 847 | 847 | if (node->dev == dev) |
| 848 | 848 | break; |
| 849 | − if (node->dev != dev) | |
| 849 | + if (list_entry_is_head(node, &info->shared->devices, list)) | |
| 850 | 850 | return; |
| 851 | 851 | |
| 852 | 852 | list_del(&node->list); |
| @@ -1839,8 +1839,8 @@ out: · 1838 unmodified lines | ||
| 1839 | 1839 | } |
| 1840 | 1840 | EXPORT_SYMBOL(ipv6_dev_get_saddr); |
| 1841 | 1841 | |
| 1842 | −int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr, | |
| 1843 | − u32 banned_flags) | |
| 1842 | +static int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr, | |
| 1843 | + u32 banned_flags) | |
| 1844 | 1844 | { |
| 1845 | 1845 | struct inet6_ifaddr *ifp; |
| 1846 | 1846 | int err = -EADDRNOTAVAIL; |
| @@ -4998,6 +4998,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, · 3151 unmodified lines | ||
| 4998 | 4998 | nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) |
| 4999 | 4999 | goto error; |
| 5000 | 5000 | |
| 5001 | + spin_lock_bh(&ifa->lock); | |
| 5001 | 5002 | if (!((ifa->flags&IFA_F_PERMANENT) && |
| 5002 | 5003 | (ifa->prefered_lft == INFINITY_LIFE_TIME))) { |
| 5003 | 5004 | preferred = ifa->prefered_lft; |
| @@ -5019,6 +5020,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, · 15 unmodified lines | ||
| 5019 | 5020 | preferred = INFINITY_LIFE_TIME; |
| 5020 | 5021 | valid = INFINITY_LIFE_TIME; |
| 5021 | 5022 | } |
| 5023 | + spin_unlock_bh(&ifa->lock); | |
| 5022 | 5024 | |
| 5023 | 5025 | if (!ipv6_addr_any(&ifa->peer_addr)) { |
| 5024 | 5026 | if (nla_put_in6_addr(skb, IFA_LOCAL, &ifa->addr) < 0 || |
| @@ -450,8 +450,10 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, · 449 unmodified lines | ||
| 450 | 450 | err = -EINVAL; |
| 451 | 451 | goto done; |
| 452 | 452 | } |
| 453 | − if (fl_shared_exclusive(fl) || fl->opt) | |
| 453 | + if (fl_shared_exclusive(fl) || fl->opt) { | |
| 454 | + WRITE_ONCE(sock_net(sk)->ipv6.flowlabel_has_excl, 1); | |
| 454 | 455 | static_branch_deferred_inc(&ipv6_flowlabel_exclusive); |
| 456 | + } | |
| 455 | 457 | return fl; |
| 456 | 458 | |
| 457 | 459 | done: |
| @@ -114,6 +114,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, · 113 unmodified lines | ||
| 114 | 114 | if (likely(ops && ops->callbacks.gso_segment)) { |
| 115 | 115 | skb_reset_transport_header(skb); |
| 116 | 116 | segs = ops->callbacks.gso_segment(skb, features); |
| 117 | + if (!segs) | |
| 118 | + skb->network_header = skb_mac_header(skb) + nhoff - skb->head; | |
| 117 | 119 | } |
| 118 | 120 | |
| 119 | 121 | if (IS_ERR_OR_NULL(segs)) |
| @@ -1465,7 +1465,7 @@ static int __ip6_append_data(struct sock *sk, · 1464 unmodified lines | ||
| 1465 | 1465 | |
| 1466 | 1466 | if (cork->tx_flags & SKBTX_ANY_SW_TSTAMP && |
| 1467 | 1467 | sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) |
| 1468 | − tskey = sk->sk_tskey++; | |
| 1468 | + tskey = atomic_inc_return(&sk->sk_tskey) - 1; | |
| 1469 | 1469 | |
| 1470 | 1470 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); |
| 1471 | 1471 | |
| @@ -1759,7 +1759,7 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) · 1758 unmodified lines | ||
| 1759 | 1759 | skb_reserve(skb, hlen); |
| 1760 | 1760 | skb_tailroom_reserve(skb, mtu, tlen); |
| 1761 | 1761 | |
| 1762 | − if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { | |
| 1762 | + if (ipv6_get_lladdr(dev, &addr_buf, IFA_F_TENTATIVE)) { | |
| 1763 | 1763 | /* <draft-ietf-magma-mld-source-05.txt>: |
| 1764 | 1764 | * use unspecified address as the source address |
| 1765 | 1765 | * when a valid link-local address is not available. |
| @@ -5753,11 +5753,11 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, · 5752 unmodified lines | ||
| 5753 | 5753 | } |
| 5754 | 5754 | |
| 5755 | 5755 | if (!dst) { |
| 5756 | − if (rt->offload) | |
| 5756 | + if (READ_ONCE(rt->offload)) | |
| 5757 | 5757 | rtm->rtm_flags |= RTM_F_OFFLOAD; |
| 5758 | − if (rt->trap) | |
| 5758 | + if (READ_ONCE(rt->trap)) | |
| 5759 | 5759 | rtm->rtm_flags |= RTM_F_TRAP; |
| 5760 | − if (rt->offload_failed) | |
| 5760 | + if (READ_ONCE(rt->offload_failed)) | |
| 5761 | 5761 | rtm->rtm_flags |= RTM_F_OFFLOAD_FAILED; |
| 5762 | 5762 | } |
| 5763 | 5763 | |
| @@ -6215,19 +6215,20 @@ void fib6_info_hw_flags_set(struct net *net, struct fib6_info *f6i, · 451 unmodified lines | ||
| 6215 | 6215 | struct sk_buff *skb; |
| 6216 | 6216 | int err; |
| 6217 | 6217 | |
| 6218 | − if (f6i->offload == offload && f6i->trap == trap && | |
| 6219 | − f6i->offload_failed == offload_failed) | |
| 6218 | + if (READ_ONCE(f6i->offload) == offload && | |
| 6219 | + READ_ONCE(f6i->trap) == trap && | |
| 6220 | + READ_ONCE(f6i->offload_failed) == offload_failed) | |
| 6220 | 6221 | return; |
| 6221 | 6222 | |
| 6222 | − f6i->offload = offload; | |
| 6223 | − f6i->trap = trap; | |
| 6223 | + WRITE_ONCE(f6i->offload, offload); | |
| 6224 | + WRITE_ONCE(f6i->trap, trap); | |
| 6224 | 6225 | |
| 6225 | 6226 | /* 2 means send notifications only if offload_failed was changed. */ |
| 6226 | 6227 | if (net->ipv6.sysctl.fib_notify_on_flag_change == 2 && |
| 6227 | − f6i->offload_failed == offload_failed) | |
| 6228 | + READ_ONCE(f6i->offload_failed) == offload_failed) | |
| 6228 | 6229 | return; |
| 6229 | 6230 | |
| 6230 | − f6i->offload_failed = offload_failed; | |
| 6231 | + WRITE_ONCE(f6i->offload_failed, offload_failed); | |
| 6231 | 6232 | |
| 6232 | 6233 | if (!rcu_access_pointer(f6i->fib6_node)) |
| 6233 | 6234 | /* The route was removed from the tree, do not send |
| @@ -666,7 +666,7 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, · 665 unmodified lines | ||
| 666 | 666 | ieee80211_ie_build_he_6ghz_cap(sdata, skb); |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | −static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |
| 669 | +static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |
| 670 | 670 | { |
| 671 | 671 | struct ieee80211_local *local = sdata->local; |
| 672 | 672 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
| @@ -686,6 +686,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 13 unmodified lines | ||
| 686 | 686 | enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); |
| 687 | 687 | const struct ieee80211_sband_iftype_data *iftd; |
| 688 | 688 | struct ieee80211_prep_tx_info info = {}; |
| 689 | + int ret; | |
| 689 | 690 | |
| 690 | 691 | /* we know it's writable, cast away the const */ |
| 691 | 692 | if (assoc_data->ie_len) |
| @@ -699,7 +700,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 7 unmodified lines | ||
| 699 | 700 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
| 700 | 701 | if (WARN_ON(!chanctx_conf)) { |
| 701 | 702 | rcu_read_unlock(); |
| 702 | − return; | |
| 703 | + return -EINVAL; | |
| 703 | 704 | } |
| 704 | 705 | chan = chanctx_conf->def.chan; |
| 705 | 706 | rcu_read_unlock(); |
| @@ -750,7 +751,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 44 unmodified lines | ||
| 750 | 751 | (iftd ? iftd->vendor_elems.len : 0), |
| 751 | 752 | GFP_KERNEL); |
| 752 | 753 | if (!skb) |
| 753 | − return; | |
| 754 | + return -ENOMEM; | |
| 754 | 755 | |
| 755 | 756 | skb_reserve(skb, local->hw.extra_tx_headroom); |
| 756 | 757 | |
| @@ -1031,15 +1032,22 @@ skip_rates: · 274 unmodified lines | ||
| 1031 | 1032 | skb_put_data(skb, assoc_data->ie + offset, noffset - offset); |
| 1032 | 1033 | } |
| 1033 | 1034 | |
| 1034 | − if (assoc_data->fils_kek_len && | |
| 1035 | − fils_encrypt_assoc_req(skb, assoc_data) < 0) { | |
| 1036 | − dev_kfree_skb(skb); | |
| 1037 | − return; | |
| 1035 | + if (assoc_data->fils_kek_len) { | |
| 1036 | + ret = fils_encrypt_assoc_req(skb, assoc_data); | |
| 1037 | + if (ret < 0) { | |
| 1038 | + dev_kfree_skb(skb); | |
| 1039 | + return ret; | |
| 1040 | + } | |
| 1038 | 1041 | } |
| 1039 | 1042 | |
| 1040 | 1043 | pos = skb_tail_pointer(skb); |
| 1041 | 1044 | kfree(ifmgd->assoc_req_ies); |
| 1042 | 1045 | ifmgd->assoc_req_ies = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC); |
| 1046 | + if (!ifmgd->assoc_req_ies) { | |
| 1047 | + dev_kfree_skb(skb); | |
| 1048 | + return -ENOMEM; | |
| 1049 | + } | |
| 1050 | + | |
| 1043 | 1051 | ifmgd->assoc_req_ies_len = pos - ie_start; |
| 1044 | 1052 | |
| 1045 | 1053 | drv_mgd_prepare_tx(local, sdata, &info); |
| @@ -1049,6 +1057,8 @@ skip_rates: · 3 unmodified lines | ||
| 1049 | 1057 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | |
| 1050 | 1058 | IEEE80211_TX_INTFL_MLME_CONN_TX; |
| 1051 | 1059 | ieee80211_tx_skb(sdata, skb); |
| 1060 | + | |
| 1061 | + return 0; | |
| 1052 | 1062 | } |
| 1053 | 1063 | |
| 1054 | 1064 | void ieee80211_send_pspoll(struct ieee80211_local *local, |
| @@ -4497,6 +4507,7 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) · 3442 unmodified lines | ||
| 4497 | 4507 | { |
| 4498 | 4508 | struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; |
| 4499 | 4509 | struct ieee80211_local *local = sdata->local; |
| 4510 | + int ret; | |
| 4500 | 4511 | |
| 4501 | 4512 | sdata_assert_lock(sdata); |
| 4502 | 4513 | |
| @@ -4517,7 +4528,9 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) · 14 unmodified lines | ||
| 4517 | 4528 | sdata_info(sdata, "associate with %pM (try %d/%d)\n", |
| 4518 | 4529 | assoc_data->bss->bssid, assoc_data->tries, |
| 4519 | 4530 | IEEE80211_ASSOC_MAX_TRIES); |
| 4520 | − ieee80211_send_assoc(sdata); | |
| 4531 | + ret = ieee80211_send_assoc(sdata); | |
| 4532 | + if (ret) | |
| 4533 | + return ret; | |
| 4521 | 4534 | |
| 4522 | 4535 | if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { |
| 4523 | 4536 | assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; |
| @@ -412,13 +412,14 @@ static int mctp_route_input(struct mctp_route *route, struct sk_buff *skb) · 411 unmodified lines | ||
| 412 | 412 | * this function. |
| 413 | 413 | */ |
| 414 | 414 | rc = mctp_key_add(key, msk); |
| 415 | − if (rc) | |
| 415 | + if (rc) { | |
| 416 | 416 | kfree(key); |
| 417 | + } else { | |
| 418 | + trace_mctp_key_acquire(key); | |
| 417 | 419 | |
| 418 | − trace_mctp_key_acquire(key); | |
| 419 | − | |
| 420 | − /* we don't need to release key->lock on exit */ | |
| 421 | − mctp_key_unref(key); | |
| 420 | + /* we don't need to release key->lock on exit */ | |
| 421 | + mctp_key_unref(key); | |
| 422 | + } | |
| 422 | 423 | key = NULL; |
| 423 | 424 | |
| 424 | 425 | } else { |
| @@ -35,12 +35,14 @@ static const struct snmp_mib mptcp_snmp_list[] = { · 34 unmodified lines | ||
| 35 | 35 | SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR), |
| 36 | 36 | SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD), |
| 37 | 37 | SNMP_MIB_ITEM("PortAdd", MPTCP_MIB_PORTADD), |
| 38 | + SNMP_MIB_ITEM("AddAddrDrop", MPTCP_MIB_ADDADDRDROP), | |
| 38 | 39 | SNMP_MIB_ITEM("MPJoinPortSynRx", MPTCP_MIB_JOINPORTSYNRX), |
| 39 | 40 | SNMP_MIB_ITEM("MPJoinPortSynAckRx", MPTCP_MIB_JOINPORTSYNACKRX), |
| 40 | 41 | SNMP_MIB_ITEM("MPJoinPortAckRx", MPTCP_MIB_JOINPORTACKRX), |
| 41 | 42 | SNMP_MIB_ITEM("MismatchPortSynRx", MPTCP_MIB_MISMATCHPORTSYNRX), |
| 42 | 43 | SNMP_MIB_ITEM("MismatchPortAckRx", MPTCP_MIB_MISMATCHPORTACKRX), |
| 43 | 44 | SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR), |
| 45 | + SNMP_MIB_ITEM("RmAddrDrop", MPTCP_MIB_RMADDRDROP), | |
| 44 | 46 | SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW), |
| 45 | 47 | SNMP_MIB_ITEM("MPPrioTx", MPTCP_MIB_MPPRIOTX), |
| 46 | 48 | SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX), |
| @@ -28,12 +28,14 @@ enum linux_mptcp_mib_field { · 27 unmodified lines | ||
| 28 | 28 | MPTCP_MIB_ADDADDR, /* Received ADD_ADDR with echo-flag=0 */ |
| 29 | 29 | MPTCP_MIB_ECHOADD, /* Received ADD_ADDR with echo-flag=1 */ |
| 30 | 30 | MPTCP_MIB_PORTADD, /* Received ADD_ADDR with a port-number */ |
| 31 | + MPTCP_MIB_ADDADDRDROP, /* Dropped incoming ADD_ADDR */ | |
| 31 | 32 | MPTCP_MIB_JOINPORTSYNRX, /* Received a SYN MP_JOIN with a different port-number */ |
| 32 | 33 | MPTCP_MIB_JOINPORTSYNACKRX, /* Received a SYNACK MP_JOIN with a different port-number */ |
| 33 | 34 | MPTCP_MIB_JOINPORTACKRX, /* Received an ACK MP_JOIN with a different port-number */ |
| 34 | 35 | MPTCP_MIB_MISMATCHPORTSYNRX, /* Received a SYN MP_JOIN with a mismatched port-number */ |
| 35 | 36 | MPTCP_MIB_MISMATCHPORTACKRX, /* Received an ACK MP_JOIN with a mismatched port-number */ |
| 36 | 37 | MPTCP_MIB_RMADDR, /* Received RM_ADDR */ |
| 38 | + MPTCP_MIB_RMADDRDROP, /* Dropped incoming RM_ADDR */ | |
| 37 | 39 | MPTCP_MIB_RMSUBFLOW, /* Remove a subflow */ |
| 38 | 40 | MPTCP_MIB_MPPRIOTX, /* Transmit a MP_PRIO */ |
| 39 | 41 | MPTCP_MIB_MPPRIORX, /* Received a MP_PRIO */ |
| @@ -213,6 +213,8 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk, · 212 unmodified lines | ||
| 213 | 213 | mptcp_pm_add_addr_send_ack(msk); |
| 214 | 214 | } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { |
| 215 | 215 | pm->remote = *addr; |
| 216 | + } else { | |
| 217 | + __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); | |
| 216 | 218 | } |
| 217 | 219 | |
| 218 | 220 | spin_unlock_bh(&pm->lock); |
| @@ -253,8 +255,10 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, · 34 unmodified lines | ||
| 253 | 255 | mptcp_event_addr_removed(msk, rm_list->ids[i]); |
| 254 | 256 | |
| 255 | 257 | spin_lock_bh(&pm->lock); |
| 256 | − mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED); | |
| 257 | − pm->rm_list_rx = *rm_list; | |
| 258 | + if (mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED)) | |
| 259 | + pm->rm_list_rx = *rm_list; | |
| 260 | + else | |
| 261 | + __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_RMADDRDROP); | |
| 258 | 262 | spin_unlock_bh(&pm->lock); |
| 259 | 263 | } |
| 260 | 264 | |
| @@ -546,6 +546,16 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) · 545 unmodified lines | ||
| 546 | 546 | if (msk->pm.add_addr_signaled < add_addr_signal_max) { |
| 547 | 547 | local = select_signal_address(pernet, msk); |
| 548 | 548 | |
| 549 | + /* due to racing events on both ends we can reach here while | |
| 550 | + * previous add address is still running: if we invoke now | |
| 551 | + * mptcp_pm_announce_addr(), that will fail and the | |
| 552 | + * corresponding id will be marked as used. | |
| 553 | + * Instead let the PM machinery reschedule us when the | |
| 554 | + * current address announce will be completed. | |
| 555 | + */ | |
| 556 | + if (msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_SIGNAL)) | |
| 557 | + return; | |
| 558 | + | |
| 549 | 559 | if (local) { |
| 550 | 560 | if (mptcp_pm_alloc_anno_list(msk, local)) { |
| 551 | 561 | __clear_bit(local->addr.id, msk->pm.id_avail_bitmap); |
| @@ -650,6 +660,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · 98 unmodified lines | ||
| 650 | 660 | unsigned int add_addr_accept_max; |
| 651 | 661 | struct mptcp_addr_info remote; |
| 652 | 662 | unsigned int subflows_max; |
| 663 | + bool reset_port = false; | |
| 653 | 664 | int i, nr; |
| 654 | 665 | |
| 655 | 666 | add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); |
| @@ -659,15 +670,19 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · 3 unmodified lines | ||
| 659 | 670 | msk->pm.add_addr_accepted, add_addr_accept_max, |
| 660 | 671 | msk->pm.remote.family); |
| 661 | 672 | |
| 662 | − if (lookup_subflow_by_daddr(&msk->conn_list, &msk->pm.remote)) | |
| 673 | + remote = msk->pm.remote; | |
| 674 | + if (lookup_subflow_by_daddr(&msk->conn_list, &remote)) | |
| 663 | 675 | goto add_addr_echo; |
| 664 | 676 | |
| 677 | + /* pick id 0 port, if none is provided the remote address */ | |
| 678 | + if (!remote.port) { | |
| 679 | + reset_port = true; | |
| 680 | + remote.port = sk->sk_dport; | |
| 681 | + } | |
| 682 | + | |
| 665 | 683 | /* connect to the specified remote address, using whatever |
| 666 | 684 | * local address the routing configuration will pick. |
| 667 | 685 | */ |
| 668 | − remote = msk->pm.remote; | |
| 669 | − if (!remote.port) | |
| 670 | − remote.port = sk->sk_dport; | |
| 671 | 686 | nr = fill_local_addresses_vec(msk, addrs); |
| 672 | 687 | |
| 673 | 688 | msk->pm.add_addr_accepted++; |
| @@ -680,8 +695,12 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · 6 unmodified lines | ||
| 680 | 695 | __mptcp_subflow_connect(sk, &addrs[i], &remote); |
| 681 | 696 | spin_lock_bh(&msk->pm.lock); |
| 682 | 697 | |
| 698 | + /* be sure to echo exactly the received address */ | |
| 699 | + if (reset_port) | |
| 700 | + remote.port = 0; | |
| 701 | + | |
| 683 | 702 | add_addr_echo: |
| 684 | − mptcp_pm_announce_addr(msk, &msk->pm.remote, true); | |
| 703 | + mptcp_pm_announce_addr(msk, &remote, true); | |
| 685 | 704 | mptcp_pm_nl_addr_send_ack(msk); |
| 686 | 705 | } |
| 687 | 706 | |
| @@ -6551,12 +6551,15 @@ static int nf_tables_updobj(const struct nft_ctx *ctx, · 6550 unmodified lines | ||
| 6551 | 6551 | { |
| 6552 | 6552 | struct nft_object *newobj; |
| 6553 | 6553 | struct nft_trans *trans; |
| 6554 | − int err; | |
| 6554 | + int err = -ENOMEM; | |
| 6555 | + | |
| 6556 | + if (!try_module_get(type->owner)) | |
| 6557 | + return -ENOENT; | |
| 6555 | 6558 | |
| 6556 | 6559 | trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ, |
| 6557 | 6560 | sizeof(struct nft_trans_obj)); |
| 6558 | 6561 | if (!trans) |
| 6559 | − return -ENOMEM; | |
| 6562 | + goto err_trans; | |
| 6560 | 6563 | |
| 6561 | 6564 | newobj = nft_obj_init(ctx, type, attr); |
| 6562 | 6565 | if (IS_ERR(newobj)) { |
| @@ -6573,6 +6576,8 @@ static int nf_tables_updobj(const struct nft_ctx *ctx, · 10 unmodified lines | ||
| 6573 | 6576 | |
| 6574 | 6577 | err_free_trans: |
| 6575 | 6578 | kfree(trans); |
| 6579 | +err_trans: | |
| 6580 | + module_put(type->owner); | |
| 6576 | 6581 | return err; |
| 6577 | 6582 | } |
| 6578 | 6583 | |
| @@ -8185,7 +8190,7 @@ static void nft_obj_commit_update(struct nft_trans *trans) · 1606 unmodified lines | ||
| 8185 | 8190 | if (obj->ops->update) |
| 8186 | 8191 | obj->ops->update(obj, newobj); |
| 8187 | 8192 | |
| 8188 | − kfree(newobj); | |
| 8193 | + nft_obj_destroy(&trans->ctx, newobj); | |
| 8189 | 8194 | } |
| 8190 | 8195 | |
| 8191 | 8196 | static void nft_commit_release(struct nft_trans *trans) |
| @@ -8976,7 +8981,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) · 784 unmodified lines | ||
| 8976 | 8981 | break; |
| 8977 | 8982 | case NFT_MSG_NEWOBJ: |
| 8978 | 8983 | if (nft_trans_obj_update(trans)) { |
| 8979 | − kfree(nft_trans_obj_newobj(trans)); | |
| 8984 | + nft_obj_destroy(&trans->ctx, nft_trans_obj_newobj(trans)); | |
| 8980 | 8985 | nft_trans_destroy(trans); |
| 8981 | 8986 | } else { |
| 8982 | 8987 | trans->ctx.table->use--; |
| @@ -9636,10 +9641,13 @@ EXPORT_SYMBOL_GPL(__nft_release_basechain); · 653 unmodified lines | ||
| 9636 | 9641 | |
| 9637 | 9642 | static void __nft_release_hook(struct net *net, struct nft_table *table) |
| 9638 | 9643 | { |
| 9644 | + struct nft_flowtable *flowtable; | |
| 9639 | 9645 | struct nft_chain *chain; |
| 9640 | 9646 | |
| 9641 | 9647 | list_for_each_entry(chain, &table->chains, list) |
| 9642 | 9648 | nf_tables_unregister_hook(net, table, chain); |
| 9649 | + list_for_each_entry(flowtable, &table->flowtables, list) | |
| 9650 | + nft_unregister_flowtable_net_hooks(net, &flowtable->hook_list); | |
| 9643 | 9651 | } |
| 9644 | 9652 | |
| 9645 | 9653 | static void __nft_release_hooks(struct net *net) |
| @@ -94,7 +94,8 @@ struct nft_flow_rule *nft_flow_rule_create(struct net *net, · 93 unmodified lines | ||
| 94 | 94 | |
| 95 | 95 | expr = nft_expr_first(rule); |
| 96 | 96 | while (nft_expr_more(rule, expr)) { |
| 97 | − if (expr->ops->offload_flags & NFT_OFFLOAD_F_ACTION) | |
| 97 | + if (expr->ops->offload_action && | |
| 98 | + expr->ops->offload_action(expr)) | |
| 98 | 99 | num_actions++; |
| 99 | 100 | |
| 100 | 101 | expr = nft_expr_next(expr); |
| @@ -67,6 +67,11 @@ static int nft_dup_netdev_offload(struct nft_offload_ctx *ctx, · 66 unmodified lines | ||
| 67 | 67 | return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_MIRRED, oif); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | +static bool nft_dup_netdev_offload_action(const struct nft_expr *expr) | |
| 71 | +{ | |
| 72 | + return true; | |
| 73 | +} | |
| 74 | + | |
| 70 | 75 | static struct nft_expr_type nft_dup_netdev_type; |
| 71 | 76 | static const struct nft_expr_ops nft_dup_netdev_ops = { |
| 72 | 77 | .type = &nft_dup_netdev_type, |
| @@ -75,6 +80,7 @@ static const struct nft_expr_ops nft_dup_netdev_ops = { · 2 unmodified lines | ||
| 75 | 80 | .init = nft_dup_netdev_init, |
| 76 | 81 | .dump = nft_dup_netdev_dump, |
| 77 | 82 | .offload = nft_dup_netdev_offload, |
| 83 | + .offload_action = nft_dup_netdev_offload_action, | |
| 78 | 84 | }; |
| 79 | 85 | |
| 80 | 86 | static struct nft_expr_type nft_dup_netdev_type __read_mostly = { |
| @@ -79,6 +79,11 @@ static int nft_fwd_netdev_offload(struct nft_offload_ctx *ctx, · 78 unmodified lines | ||
| 79 | 79 | return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_REDIRECT, oif); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | +static bool nft_fwd_netdev_offload_action(const struct nft_expr *expr) | |
| 83 | +{ | |
| 84 | + return true; | |
| 85 | +} | |
| 86 | + | |
| 82 | 87 | struct nft_fwd_neigh { |
| 83 | 88 | u8 sreg_dev; |
| 84 | 89 | u8 sreg_addr; |
| @@ -222,6 +227,7 @@ static const struct nft_expr_ops nft_fwd_netdev_ops = { · 137 unmodified lines | ||
| 222 | 227 | .dump = nft_fwd_netdev_dump, |
| 223 | 228 | .validate = nft_fwd_validate, |
| 224 | 229 | .offload = nft_fwd_netdev_offload, |
| 230 | + .offload_action = nft_fwd_netdev_offload_action, | |
| 225 | 231 | }; |
| 226 | 232 | |
| 227 | 233 | static const struct nft_expr_ops * |
| @@ -213,6 +213,16 @@ static int nft_immediate_offload(struct nft_offload_ctx *ctx, · 212 unmodified lines | ||
| 213 | 213 | return 0; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | +static bool nft_immediate_offload_action(const struct nft_expr *expr) | |
| 217 | +{ | |
| 218 | + const struct nft_immediate_expr *priv = nft_expr_priv(expr); | |
| 219 | + | |
| 220 | + if (priv->dreg == NFT_REG_VERDICT) | |
| 221 | + return true; | |
| 222 | + | |
| 223 | + return false; | |
| 224 | +} | |
| 225 | + | |
| 216 | 226 | static const struct nft_expr_ops nft_imm_ops = { |
| 217 | 227 | .type = &nft_imm_type, |
| 218 | 228 | .size = NFT_EXPR_SIZE(sizeof(struct nft_immediate_expr)), |
| @@ -224,7 +234,7 @@ static const struct nft_expr_ops nft_imm_ops = { · 5 unmodified lines | ||
| 224 | 234 | .dump = nft_immediate_dump, |
| 225 | 235 | .validate = nft_immediate_validate, |
| 226 | 236 | .offload = nft_immediate_offload, |
| 227 | − .offload_flags = NFT_OFFLOAD_F_ACTION, | |
| 237 | + .offload_action = nft_immediate_offload_action, | |
| 228 | 238 | }; |
| 229 | 239 | |
| 230 | 240 | struct nft_expr_type nft_imm_type __read_mostly = { |
| @@ -340,11 +340,20 @@ static int nft_limit_obj_pkts_dump(struct sk_buff *skb, · 339 unmodified lines | ||
| 340 | 340 | return nft_limit_dump(skb, &priv->limit, NFT_LIMIT_PKTS); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | +static void nft_limit_obj_pkts_destroy(const struct nft_ctx *ctx, | |
| 344 | + struct nft_object *obj) | |
| 345 | +{ | |
| 346 | + struct nft_limit_priv_pkts *priv = nft_obj_data(obj); | |
| 347 | + | |
| 348 | + nft_limit_destroy(ctx, &priv->limit); | |
| 349 | +} | |
| 350 | + | |
| 343 | 351 | static struct nft_object_type nft_limit_obj_type; |
| 344 | 352 | static const struct nft_object_ops nft_limit_obj_pkts_ops = { |
| 345 | 353 | .type = &nft_limit_obj_type, |
| 346 | 354 | .size = NFT_EXPR_SIZE(sizeof(struct nft_limit_priv_pkts)), |
| 347 | 355 | .init = nft_limit_obj_pkts_init, |
| 356 | + .destroy = nft_limit_obj_pkts_destroy, | |
| 348 | 357 | .eval = nft_limit_obj_pkts_eval, |
| 349 | 358 | .dump = nft_limit_obj_pkts_dump, |
| 350 | 359 | }; |
| @@ -378,11 +387,20 @@ static int nft_limit_obj_bytes_dump(struct sk_buff *skb, · 27 unmodified lines | ||
| 378 | 387 | return nft_limit_dump(skb, priv, NFT_LIMIT_PKT_BYTES); |
| 379 | 388 | } |
| 380 | 389 | |
| 390 | +static void nft_limit_obj_bytes_destroy(const struct nft_ctx *ctx, | |
| 391 | + struct nft_object *obj) | |
| 392 | +{ | |
| 393 | + struct nft_limit_priv *priv = nft_obj_data(obj); | |
| 394 | + | |
| 395 | + nft_limit_destroy(ctx, priv); | |
| 396 | +} | |
| 397 | + | |
| 381 | 398 | static struct nft_object_type nft_limit_obj_type; |
| 382 | 399 | static const struct nft_object_ops nft_limit_obj_bytes_ops = { |
| 383 | 400 | .type = &nft_limit_obj_type, |
| 384 | 401 | .size = sizeof(struct nft_limit_priv), |
| 385 | 402 | .init = nft_limit_obj_bytes_init, |
| 403 | + .destroy = nft_limit_obj_bytes_destroy, | |
| 386 | 404 | .eval = nft_limit_obj_bytes_eval, |
| 387 | 405 | .dump = nft_limit_obj_bytes_dump, |
| 388 | 406 | }; |
| @@ -191,8 +191,10 @@ static int nft_synproxy_do_init(const struct nft_ctx *ctx, · 190 unmodified lines | ||
| 191 | 191 | if (err) |
| 192 | 192 | goto nf_ct_failure; |
| 193 | 193 | err = nf_synproxy_ipv6_init(snet, ctx->net); |
| 194 | − if (err) | |
| 194 | + if (err) { | |
| 195 | + nf_synproxy_ipv4_fini(snet, ctx->net); | |
| 195 | 196 | goto nf_ct_failure; |
| 197 | + } | |
| 196 | 198 | break; |
| 197 | 199 | } |
| 198 | 200 | |
| @@ -220,8 +220,10 @@ static void socket_mt_destroy(const struct xt_mtdtor_param *par) · 219 unmodified lines | ||
| 220 | 220 | { |
| 221 | 221 | if (par->family == NFPROTO_IPV4) |
| 222 | 222 | nf_defrag_ipv4_disable(par->net); |
| 223 | +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) | |
| 223 | 224 | else if (par->family == NFPROTO_IPV6) |
| 224 | − nf_defrag_ipv4_disable(par->net); | |
| 225 | + nf_defrag_ipv6_disable(par->net); | |
| 226 | +#endif | |
| 225 | 227 | } |
| 226 | 228 | |
| 227 | 229 | static struct xt_match socket_mt_reg[] __read_mostly = { |
| @@ -423,12 +423,43 @@ static void set_ipv6_addr(struct sk_buff *skb, u8 l4_proto, · 422 unmodified lines | ||
| 423 | 423 | memcpy(addr, new_addr, sizeof(__be32[4])); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | −static void set_ipv6_fl(struct ipv6hdr *nh, u32 fl, u32 mask) | |
| 426 | +static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask) | |
| 427 | 427 | { |
| 428 | + u8 old_ipv6_tclass = ipv6_get_dsfield(nh); | |
| 429 | + | |
| 430 | + ipv6_tclass = OVS_MASKED(old_ipv6_tclass, ipv6_tclass, mask); | |
| 431 | + | |
| 432 | + if (skb->ip_summed == CHECKSUM_COMPLETE) | |
| 433 | + csum_replace(&skb->csum, (__force __wsum)(old_ipv6_tclass << 12), | |
| 434 | + (__force __wsum)(ipv6_tclass << 12)); | |
| 435 | + | |
| 436 | + ipv6_change_dsfield(nh, ~mask, ipv6_tclass); | |
| 437 | +} | |
| 438 | + | |
| 439 | +static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask) | |
| 440 | +{ | |
| 441 | + u32 ofl; | |
| 442 | + | |
| 443 | + ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2]; | |
| 444 | + fl = OVS_MASKED(ofl, fl, mask); | |
| 445 | + | |
| 428 | 446 | /* Bits 21-24 are always unmasked, so this retains their values. */ |
| 429 | − OVS_SET_MASKED(nh->flow_lbl[0], (u8)(fl >> 16), (u8)(mask >> 16)); | |
| 430 | − OVS_SET_MASKED(nh->flow_lbl[1], (u8)(fl >> 8), (u8)(mask >> 8)); | |
| 431 | − OVS_SET_MASKED(nh->flow_lbl[2], (u8)fl, (u8)mask); | |
| 447 | + nh->flow_lbl[0] = (u8)(fl >> 16); | |
| 448 | + nh->flow_lbl[1] = (u8)(fl >> 8); | |
| 449 | + nh->flow_lbl[2] = (u8)fl; | |
| 450 | + | |
| 451 | + if (skb->ip_summed == CHECKSUM_COMPLETE) | |
| 452 | + csum_replace(&skb->csum, (__force __wsum)htonl(ofl), (__force __wsum)htonl(fl)); | |
| 453 | +} | |
| 454 | + | |
| 455 | +static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask) | |
| 456 | +{ | |
| 457 | + new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask); | |
| 458 | + | |
| 459 | + if (skb->ip_summed == CHECKSUM_COMPLETE) | |
| 460 | + csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8), | |
| 461 | + (__force __wsum)(new_ttl << 8)); | |
| 462 | + nh->hop_limit = new_ttl; | |
| 432 | 463 | } |
| 433 | 464 | |
| 434 | 465 | static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl, |
| @@ -546,18 +577,17 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key, · 111 unmodified lines | ||
| 546 | 577 | } |
| 547 | 578 | } |
| 548 | 579 | if (mask->ipv6_tclass) { |
| 549 | − ipv6_change_dsfield(nh, ~mask->ipv6_tclass, key->ipv6_tclass); | |
| 580 | + set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass); | |
| 550 | 581 | flow_key->ip.tos = ipv6_get_dsfield(nh); |
| 551 | 582 | } |
| 552 | 583 | if (mask->ipv6_label) { |
| 553 | − set_ipv6_fl(nh, ntohl(key->ipv6_label), | |
| 584 | + set_ipv6_fl(skb, nh, ntohl(key->ipv6_label), | |
| 554 | 585 | ntohl(mask->ipv6_label)); |
| 555 | 586 | flow_key->ipv6.label = |
| 556 | 587 | *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); |
| 557 | 588 | } |
| 558 | 589 | if (mask->ipv6_hlimit) { |
| 559 | − OVS_SET_MASKED(nh->hop_limit, key->ipv6_hlimit, | |
| 560 | − mask->ipv6_hlimit); | |
| 590 | + set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit); | |
| 561 | 591 | flow_key->ip.ttl = nh->hop_limit; |
| 562 | 592 | } |
| 563 | 593 | return 0; |
| @@ -274,7 +274,7 @@ static int tcf_action_offload_add_ex(struct tc_action *action, · 273 unmodified lines | ||
| 274 | 274 | err = tc_setup_action(&fl_action->action, actions); |
| 275 | 275 | if (err) { |
| 276 | 276 | NL_SET_ERR_MSG_MOD(extack, |
| 277 | − "Failed to setup tc actions for offload\n"); | |
| 277 | + "Failed to setup tc actions for offload"); | |
| 278 | 278 | goto fl_err; |
| 279 | 279 | } |
| 280 | 280 | |
| @@ -1037,6 +1037,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, · 756 unmodified lines | ||
| 1037 | 1037 | restart_act_graph: |
| 1038 | 1038 | for (i = 0; i < nr_actions; i++) { |
| 1039 | 1039 | const struct tc_action *a = actions[i]; |
| 1040 | + int repeat_ttl; | |
| 1040 | 1041 | |
| 1041 | 1042 | if (jmp_prgcnt > 0) { |
| 1042 | 1043 | jmp_prgcnt -= 1; |
| @@ -1045,11 +1046,17 @@ restart_act_graph: · 2 unmodified lines | ||
| 1045 | 1046 | |
| 1046 | 1047 | if (tc_act_skip_sw(a->tcfa_flags)) |
| 1047 | 1048 | continue; |
| 1049 | + | |
| 1050 | + repeat_ttl = 32; | |
| 1048 | 1051 | repeat: |
| 1049 | 1052 | ret = a->ops->act(skb, a, res); |
| 1050 | − if (ret == TC_ACT_REPEAT) | |
| 1051 | − goto repeat; /* we need a ttl - JHS */ | |
| 1052 | − | |
| 1053 | + if (unlikely(ret == TC_ACT_REPEAT)) { | |
| 1054 | + if (--repeat_ttl != 0) | |
| 1055 | + goto repeat; | |
| 1056 | + /* suspicious opcode, stop pipeline */ | |
| 1057 | + net_warn_ratelimited("TC_ACT_REPEAT abuse ?\n"); | |
| 1058 | + return TC_ACT_OK; | |
| 1059 | + } | |
| 1053 | 1060 | if (TC_ACT_EXT_CMP(ret, TC_ACT_JUMP)) { |
| 1054 | 1061 | jmp_prgcnt = ret & TCA_ACT_MAX_PRIO_MASK; |
| 1055 | 1062 | if (!jmp_prgcnt || (jmp_prgcnt > nr_actions)) { |
| @@ -533,11 +533,6 @@ static bool tcf_ct_flow_table_lookup(struct tcf_ct_params *p, · 532 unmodified lines | ||
| 533 | 533 | struct nf_conn *ct; |
| 534 | 534 | u8 dir; |
| 535 | 535 | |
| 536 | − /* Previously seen or loopback */ | |
| 537 | − ct = nf_ct_get(skb, &ctinfo); | |
| 538 | − if ((ct && !nf_ct_is_template(ct)) || ctinfo == IP_CT_UNTRACKED) | |
| 539 | − return false; | |
| 540 | − | |
| 541 | 536 | switch (family) { |
| 542 | 537 | case NFPROTO_IPV4: |
| 543 | 538 | if (!tcf_ct_flow_table_fill_tuple_ipv4(skb, &tuple, &tcph)) |
| @@ -1044,7 +1044,7 @@ static int __tcf_qdisc_find(struct net *net, struct Qdisc **q, · 1043 unmodified lines | ||
| 1044 | 1044 | |
| 1045 | 1045 | /* Find qdisc */ |
| 1046 | 1046 | if (!*parent) { |
| 1047 | − *q = dev->qdisc; | |
| 1047 | + *q = rcu_dereference(dev->qdisc); | |
| 1048 | 1048 | *parent = (*q)->handle; |
| 1049 | 1049 | } else { |
| 1050 | 1050 | *q = qdisc_lookup_rcu(dev, TC_H_MAJ(*parent)); |
| @@ -2587,7 +2587,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) · 1536 unmodified lines | ||
| 2587 | 2587 | |
| 2588 | 2588 | parent = tcm->tcm_parent; |
| 2589 | 2589 | if (!parent) |
| 2590 | − q = dev->qdisc; | |
| 2590 | + q = rtnl_dereference(dev->qdisc); | |
| 2591 | 2591 | else |
| 2592 | 2592 | q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent)); |
| 2593 | 2593 | if (!q) |
| @@ -2962,7 +2962,7 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb) · 368 unmodified lines | ||
| 2962 | 2962 | return skb->len; |
| 2963 | 2963 | |
| 2964 | 2964 | if (!tcm->tcm_parent) |
| 2965 | − q = dev->qdisc; | |
| 2965 | + q = rtnl_dereference(dev->qdisc); | |
| 2966 | 2966 | else |
| 2967 | 2967 | q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent)); |
| 2968 | 2968 | |
| @@ -301,7 +301,7 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) · 300 unmodified lines | ||
| 301 | 301 | |
| 302 | 302 | if (!handle) |
| 303 | 303 | return NULL; |
| 304 | − q = qdisc_match_from_root(dev->qdisc, handle); | |
| 304 | + q = qdisc_match_from_root(rtnl_dereference(dev->qdisc), handle); | |
| 305 | 305 | if (q) |
| 306 | 306 | goto out; |
| 307 | 307 | |
| @@ -320,7 +320,7 @@ struct Qdisc *qdisc_lookup_rcu(struct net_device *dev, u32 handle) · 12 unmodified lines | ||
| 320 | 320 | |
| 321 | 321 | if (!handle) |
| 322 | 322 | return NULL; |
| 323 | − q = qdisc_match_from_root(dev->qdisc, handle); | |
| 323 | + q = qdisc_match_from_root(rcu_dereference(dev->qdisc), handle); | |
| 324 | 324 | if (q) |
| 325 | 325 | goto out; |
| 326 | 326 | |
| @@ -1082,10 +1082,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, · 755 unmodified lines | ||
| 1082 | 1082 | skip: |
| 1083 | 1083 | if (!ingress) { |
| 1084 | 1084 | notify_and_destroy(net, skb, n, classid, |
| 1085 | − dev->qdisc, new); | |
| 1085 | + rtnl_dereference(dev->qdisc), new); | |
| 1086 | 1086 | if (new && !new->ops->attach) |
| 1087 | 1087 | qdisc_refcount_inc(new); |
| 1088 | − dev->qdisc = new ? : &noop_qdisc; | |
| 1088 | + rcu_assign_pointer(dev->qdisc, new ? : &noop_qdisc); | |
| 1089 | 1089 | |
| 1090 | 1090 | if (new && new->ops->attach) |
| 1091 | 1091 | new->ops->attach(new); |
| @@ -1451,7 +1451,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, · 359 unmodified lines | ||
| 1451 | 1451 | q = dev_ingress_queue(dev)->qdisc_sleeping; |
| 1452 | 1452 | } |
| 1453 | 1453 | } else { |
| 1454 | − q = dev->qdisc; | |
| 1454 | + q = rtnl_dereference(dev->qdisc); | |
| 1455 | 1455 | } |
| 1456 | 1456 | if (!q) { |
| 1457 | 1457 | NL_SET_ERR_MSG(extack, "Cannot find specified qdisc on specified device"); |
| @@ -1540,7 +1540,7 @@ replay: · 82 unmodified lines | ||
| 1540 | 1540 | q = dev_ingress_queue(dev)->qdisc_sleeping; |
| 1541 | 1541 | } |
| 1542 | 1542 | } else { |
| 1543 | − q = dev->qdisc; | |
| 1543 | + q = rtnl_dereference(dev->qdisc); | |
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | 1546 | /* It may be default qdisc, ignore it */ |
| @@ -1762,7 +1762,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) · 215 unmodified lines | ||
| 1762 | 1762 | s_q_idx = 0; |
| 1763 | 1763 | q_idx = 0; |
| 1764 | 1764 | |
| 1765 | − if (tc_dump_qdisc_root(dev->qdisc, skb, cb, &q_idx, s_q_idx, | |
| 1765 | + if (tc_dump_qdisc_root(rtnl_dereference(dev->qdisc), | |
| 1766 | + skb, cb, &q_idx, s_q_idx, | |
| 1766 | 1767 | true, tca[TCA_DUMP_INVISIBLE]) < 0) |
| 1767 | 1768 | goto done; |
| 1768 | 1769 | |
| @@ -2033,7 +2034,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, · 264 unmodified lines | ||
| 2033 | 2034 | } else if (qid1) { |
| 2034 | 2035 | qid = qid1; |
| 2035 | 2036 | } else if (qid == 0) |
| 2036 | − qid = dev->qdisc->handle; | |
| 2037 | + qid = rtnl_dereference(dev->qdisc)->handle; | |
| 2037 | 2038 | |
| 2038 | 2039 | /* Now qid is genuine qdisc handle consistent |
| 2039 | 2040 | * both with parent and child. |
| @@ -2044,7 +2045,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, · 4 unmodified lines | ||
| 2044 | 2045 | portid = TC_H_MAKE(qid, portid); |
| 2045 | 2046 | } else { |
| 2046 | 2047 | if (qid == 0) |
| 2047 | − qid = dev->qdisc->handle; | |
| 2048 | + qid = rtnl_dereference(dev->qdisc)->handle; | |
| 2048 | 2049 | } |
| 2049 | 2050 | |
| 2050 | 2051 | /* OK. Locate qdisc */ |
| @@ -2205,7 +2206,8 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) · 154 unmodified lines | ||
| 2205 | 2206 | s_t = cb->args[0]; |
| 2206 | 2207 | t = 0; |
| 2207 | 2208 | |
| 2208 | − if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t, true) < 0) | |
| 2209 | + if (tc_dump_tclass_root(rtnl_dereference(dev->qdisc), | |
| 2210 | + skb, tcm, cb, &t, s_t, true) < 0) | |
| 2209 | 2211 | goto done; |
| 2210 | 2212 | |
| 2211 | 2213 | dev_queue = dev_ingress_queue(dev); |
| @@ -1164,30 +1164,33 @@ static void attach_default_qdiscs(struct net_device *dev) · 1163 unmodified lines | ||
| 1164 | 1164 | if (!netif_is_multiqueue(dev) || |
| 1165 | 1165 | dev->priv_flags & IFF_NO_QUEUE) { |
| 1166 | 1166 | netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL); |
| 1167 | − dev->qdisc = txq->qdisc_sleeping; | |
| 1168 | − qdisc_refcount_inc(dev->qdisc); | |
| 1167 | + qdisc = txq->qdisc_sleeping; | |
| 1168 | + rcu_assign_pointer(dev->qdisc, qdisc); | |
| 1169 | + qdisc_refcount_inc(qdisc); | |
| 1169 | 1170 | } else { |
| 1170 | 1171 | qdisc = qdisc_create_dflt(txq, &mq_qdisc_ops, TC_H_ROOT, NULL); |
| 1171 | 1172 | if (qdisc) { |
| 1172 | − dev->qdisc = qdisc; | |
| 1173 | + rcu_assign_pointer(dev->qdisc, qdisc); | |
| 1173 | 1174 | qdisc->ops->attach(qdisc); |
| 1174 | 1175 | } |
| 1175 | 1176 | } |
| 1177 | + qdisc = rtnl_dereference(dev->qdisc); | |
| 1176 | 1178 | |
| 1177 | 1179 | /* Detect default qdisc setup/init failed and fallback to "noqueue" */ |
| 1178 | − if (dev->qdisc == &noop_qdisc) { | |
| 1180 | + if (qdisc == &noop_qdisc) { | |
| 1179 | 1181 | netdev_warn(dev, "default qdisc (%s) fail, fallback to %s\n", |
| 1180 | 1182 | default_qdisc_ops->id, noqueue_qdisc_ops.id); |
| 1181 | 1183 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1182 | 1184 | netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL); |
| 1183 | − dev->qdisc = txq->qdisc_sleeping; | |
| 1184 | − qdisc_refcount_inc(dev->qdisc); | |
| 1185 | + qdisc = txq->qdisc_sleeping; | |
| 1186 | + rcu_assign_pointer(dev->qdisc, qdisc); | |
| 1187 | + qdisc_refcount_inc(qdisc); | |
| 1185 | 1188 | dev->priv_flags ^= IFF_NO_QUEUE; |
| 1186 | 1189 | } |
| 1187 | 1190 | |
| 1188 | 1191 | #ifdef CONFIG_NET_SCHED |
| 1189 | − if (dev->qdisc != &noop_qdisc) | |
| 1190 | − qdisc_hash_add(dev->qdisc, false); | |
| 1192 | + if (qdisc != &noop_qdisc) | |
| 1193 | + qdisc_hash_add(qdisc, false); | |
| 1191 | 1194 | #endif |
| 1192 | 1195 | } |
| 1193 | 1196 | |
| @@ -1217,7 +1220,7 @@ void dev_activate(struct net_device *dev) · 23 unmodified lines | ||
| 1217 | 1220 | * and noqueue_qdisc for virtual interfaces |
| 1218 | 1221 | */ |
| 1219 | 1222 | |
| 1220 | − if (dev->qdisc == &noop_qdisc) | |
| 1223 | + if (rtnl_dereference(dev->qdisc) == &noop_qdisc) | |
| 1221 | 1224 | attach_default_qdiscs(dev); |
| 1222 | 1225 | |
| 1223 | 1226 | if (!netif_carrier_ok(dev)) |
| @@ -1383,7 +1386,7 @@ static int qdisc_change_tx_queue_len(struct net_device *dev, · 159 unmodified lines | ||
| 1383 | 1386 | void dev_qdisc_change_real_num_tx(struct net_device *dev, |
| 1384 | 1387 | unsigned int new_real_tx) |
| 1385 | 1388 | { |
| 1386 | − struct Qdisc *qdisc = dev->qdisc; | |
| 1389 | + struct Qdisc *qdisc = rtnl_dereference(dev->qdisc); | |
| 1387 | 1390 | |
| 1388 | 1391 | if (qdisc->ops->change_real_num_tx) |
| 1389 | 1392 | qdisc->ops->change_real_num_tx(qdisc, new_real_tx); |
| @@ -1447,7 +1450,7 @@ static void dev_init_scheduler_queue(struct net_device *dev, · 57 unmodified lines | ||
| 1447 | 1450 | |
| 1448 | 1451 | void dev_init_scheduler(struct net_device *dev) |
| 1449 | 1452 | { |
| 1450 | − dev->qdisc = &noop_qdisc; | |
| 1453 | + rcu_assign_pointer(dev->qdisc, &noop_qdisc); | |
| 1451 | 1454 | netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc); |
| 1452 | 1455 | if (dev_ingress_queue(dev)) |
| 1453 | 1456 | dev_init_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc); |
| @@ -1475,8 +1478,8 @@ void dev_shutdown(struct net_device *dev) · 21 unmodified lines | ||
| 1475 | 1478 | netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); |
| 1476 | 1479 | if (dev_ingress_queue(dev)) |
| 1477 | 1480 | shutdown_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc); |
| 1478 | − qdisc_put(dev->qdisc); | |
| 1479 | − dev->qdisc = &noop_qdisc; | |
| 1481 | + qdisc_put(rtnl_dereference(dev->qdisc)); | |
| 1482 | + rcu_assign_pointer(dev->qdisc, &noop_qdisc); | |
| 1480 | 1483 | |
| 1481 | 1484 | WARN_ON(timer_pending(&dev->watchdog_timer)); |
| 1482 | 1485 | } |
| @@ -667,14 +667,17 @@ static void smc_fback_error_report(struct sock *clcsk) · 666 unmodified lines | ||
| 667 | 667 | static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) |
| 668 | 668 | { |
| 669 | 669 | struct sock *clcsk; |
| 670 | + int rc = 0; | |
| 670 | 671 | |
| 671 | 672 | mutex_lock(&smc->clcsock_release_lock); |
| 672 | 673 | if (!smc->clcsock) { |
| 673 | − mutex_unlock(&smc->clcsock_release_lock); | |
| 674 | − return -EBADF; | |
| 674 | + rc = -EBADF; | |
| 675 | + goto out; | |
| 675 | 676 | } |
| 676 | 677 | clcsk = smc->clcsock->sk; |
| 677 | 678 | |
| 679 | + if (smc->use_fallback) | |
| 680 | + goto out; | |
| 678 | 681 | smc->use_fallback = true; |
| 679 | 682 | smc->fallback_rsn = reason_code; |
| 680 | 683 | smc_stat_fallback(smc); |
| @@ -702,8 +705,9 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) · 21 unmodified lines | ||
| 702 | 705 | smc->clcsock->sk->sk_user_data = |
| 703 | 706 | (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY); |
| 704 | 707 | } |
| 708 | +out: | |
| 705 | 709 | mutex_unlock(&smc->clcsock_release_lock); |
| 706 | − return 0; | |
| 710 | + return rc; | |
| 707 | 711 | } |
| 708 | 712 | |
| 709 | 713 | /* fall back during connect */ |
| @@ -113,7 +113,7 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name) · 112 unmodified lines | ||
| 113 | 113 | pnettable = &sn->pnettable; |
| 114 | 114 | |
| 115 | 115 | /* remove table entry */ |
| 116 | − write_lock(&pnettable->lock); | |
| 116 | + mutex_lock(&pnettable->lock); | |
| 117 | 117 | list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, |
| 118 | 118 | list) { |
| 119 | 119 | if (!pnet_name || |
| @@ -131,7 +131,7 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name) · 11 unmodified lines | ||
| 131 | 131 | rc = 0; |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | − write_unlock(&pnettable->lock); | |
| 134 | + mutex_unlock(&pnettable->lock); | |
| 135 | 135 | |
| 136 | 136 | /* if this is not the initial namespace, stop here */ |
| 137 | 137 | if (net != &init_net) |
| @@ -192,7 +192,7 @@ static int smc_pnet_add_by_ndev(struct net_device *ndev) · 54 unmodified lines | ||
| 192 | 192 | sn = net_generic(net, smc_net_id); |
| 193 | 193 | pnettable = &sn->pnettable; |
| 194 | 194 | |
| 195 | − write_lock(&pnettable->lock); | |
| 195 | + mutex_lock(&pnettable->lock); | |
| 196 | 196 | list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) { |
| 197 | 197 | if (pnetelem->type == SMC_PNET_ETH && !pnetelem->ndev && |
| 198 | 198 | !strncmp(pnetelem->eth_name, ndev->name, IFNAMSIZ)) { |
| @@ -206,7 +206,7 @@ static int smc_pnet_add_by_ndev(struct net_device *ndev) · 7 unmodified lines | ||
| 206 | 206 | break; |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | − write_unlock(&pnettable->lock); | |
| 209 | + mutex_unlock(&pnettable->lock); | |
| 210 | 210 | return rc; |
| 211 | 211 | } |
| 212 | 212 | |
| @@ -224,7 +224,7 @@ static int smc_pnet_remove_by_ndev(struct net_device *ndev) · 11 unmodified lines | ||
| 224 | 224 | sn = net_generic(net, smc_net_id); |
| 225 | 225 | pnettable = &sn->pnettable; |
| 226 | 226 | |
| 227 | − write_lock(&pnettable->lock); | |
| 227 | + mutex_lock(&pnettable->lock); | |
| 228 | 228 | list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) { |
| 229 | 229 | if (pnetelem->type == SMC_PNET_ETH && pnetelem->ndev == ndev) { |
| 230 | 230 | dev_put_track(pnetelem->ndev, &pnetelem->dev_tracker); |
| @@ -237,7 +237,7 @@ static int smc_pnet_remove_by_ndev(struct net_device *ndev) · 6 unmodified lines | ||
| 237 | 237 | break; |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | − write_unlock(&pnettable->lock); | |
| 240 | + mutex_unlock(&pnettable->lock); | |
| 241 | 241 | return rc; |
| 242 | 242 | } |
| 243 | 243 | |
| @@ -370,7 +370,7 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net, · 126 unmodified lines | ||
| 370 | 370 | strncpy(new_pe->eth_name, eth_name, IFNAMSIZ); |
| 371 | 371 | rc = -EEXIST; |
| 372 | 372 | new_netdev = true; |
| 373 | − write_lock(&pnettable->lock); | |
| 373 | + mutex_lock(&pnettable->lock); | |
| 374 | 374 | list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
| 375 | 375 | if (tmp_pe->type == SMC_PNET_ETH && |
| 376 | 376 | !strncmp(tmp_pe->eth_name, eth_name, IFNAMSIZ)) { |
| @@ -385,9 +385,9 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net, · 8 unmodified lines | ||
| 385 | 385 | GFP_ATOMIC); |
| 386 | 386 | } |
| 387 | 387 | list_add_tail(&new_pe->list, &pnettable->pnetlist); |
| 388 | − write_unlock(&pnettable->lock); | |
| 388 | + mutex_unlock(&pnettable->lock); | |
| 389 | 389 | } else { |
| 390 | − write_unlock(&pnettable->lock); | |
| 390 | + mutex_unlock(&pnettable->lock); | |
| 391 | 391 | kfree(new_pe); |
| 392 | 392 | goto out_put; |
| 393 | 393 | } |
| @@ -448,7 +448,7 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name, · 54 unmodified lines | ||
| 448 | 448 | new_pe->ib_port = ib_port; |
| 449 | 449 | |
| 450 | 450 | new_ibdev = true; |
| 451 | − write_lock(&pnettable->lock); | |
| 451 | + mutex_lock(&pnettable->lock); | |
| 452 | 452 | list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
| 453 | 453 | if (tmp_pe->type == SMC_PNET_IB && |
| 454 | 454 | !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX)) { |
| @@ -458,9 +458,9 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name, · 3 unmodified lines | ||
| 458 | 458 | } |
| 459 | 459 | if (new_ibdev) { |
| 460 | 460 | list_add_tail(&new_pe->list, &pnettable->pnetlist); |
| 461 | − write_unlock(&pnettable->lock); | |
| 461 | + mutex_unlock(&pnettable->lock); | |
| 462 | 462 | } else { |
| 463 | − write_unlock(&pnettable->lock); | |
| 463 | + mutex_unlock(&pnettable->lock); | |
| 464 | 464 | kfree(new_pe); |
| 465 | 465 | } |
| 466 | 466 | return (new_ibdev) ? 0 : -EEXIST; |
| @@ -605,7 +605,7 @@ static int _smc_pnet_dump(struct net *net, struct sk_buff *skb, u32 portid, · 138 unmodified lines | ||
| 605 | 605 | pnettable = &sn->pnettable; |
| 606 | 606 | |
| 607 | 607 | /* dump pnettable entries */ |
| 608 | − read_lock(&pnettable->lock); | |
| 608 | + mutex_lock(&pnettable->lock); | |
| 609 | 609 | list_for_each_entry(pnetelem, &pnettable->pnetlist, list) { |
| 610 | 610 | if (pnetid && !smc_pnet_match(pnetelem->pnet_name, pnetid)) |
| 611 | 611 | continue; |
| @@ -620,7 +620,7 @@ static int _smc_pnet_dump(struct net *net, struct sk_buff *skb, u32 portid, · 8 unmodified lines | ||
| 620 | 620 | break; |
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | − read_unlock(&pnettable->lock); | |
| 623 | + mutex_unlock(&pnettable->lock); | |
| 624 | 624 | return idx; |
| 625 | 625 | } |
| 626 | 626 | |
| @@ -864,7 +864,7 @@ int smc_pnet_net_init(struct net *net) · 237 unmodified lines | ||
| 864 | 864 | struct smc_pnetids_ndev *pnetids_ndev = &sn->pnetids_ndev; |
| 865 | 865 | |
| 866 | 866 | INIT_LIST_HEAD(&pnettable->pnetlist); |
| 867 | − rwlock_init(&pnettable->lock); | |
| 867 | + mutex_init(&pnettable->lock); | |
| 868 | 868 | INIT_LIST_HEAD(&pnetids_ndev->list); |
| 869 | 869 | rwlock_init(&pnetids_ndev->lock); |
| 870 | 870 | |
| @@ -944,7 +944,7 @@ static int smc_pnet_find_ndev_pnetid_by_table(struct net_device *ndev, · 73 unmodified lines | ||
| 944 | 944 | sn = net_generic(net, smc_net_id); |
| 945 | 945 | pnettable = &sn->pnettable; |
| 946 | 946 | |
| 947 | − read_lock(&pnettable->lock); | |
| 947 | + mutex_lock(&pnettable->lock); | |
| 948 | 948 | list_for_each_entry(pnetelem, &pnettable->pnetlist, list) { |
| 949 | 949 | if (pnetelem->type == SMC_PNET_ETH && ndev == pnetelem->ndev) { |
| 950 | 950 | /* get pnetid of netdev device */ |
| @@ -953,7 +953,7 @@ static int smc_pnet_find_ndev_pnetid_by_table(struct net_device *ndev, · 2 unmodified lines | ||
| 953 | 953 | break; |
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | − read_unlock(&pnettable->lock); | |
| 956 | + mutex_unlock(&pnettable->lock); | |
| 957 | 957 | return rc; |
| 958 | 958 | } |
| 959 | 959 | |
| @@ -1156,7 +1156,7 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port) · 196 unmodified lines | ||
| 1156 | 1156 | sn = net_generic(&init_net, smc_net_id); |
| 1157 | 1157 | pnettable = &sn->pnettable; |
| 1158 | 1158 | |
| 1159 | − read_lock(&pnettable->lock); | |
| 1159 | + mutex_lock(&pnettable->lock); | |
| 1160 | 1160 | list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
| 1161 | 1161 | if (tmp_pe->type == SMC_PNET_IB && |
| 1162 | 1162 | !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX) && |
| @@ -1166,7 +1166,7 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port) · 3 unmodified lines | ||
| 1166 | 1166 | break; |
| 1167 | 1167 | } |
| 1168 | 1168 | } |
| 1169 | − read_unlock(&pnettable->lock); | |
| 1169 | + mutex_unlock(&pnettable->lock); | |
| 1170 | 1170 | |
| 1171 | 1171 | return rc; |
| 1172 | 1172 | } |
| @@ -1185,7 +1185,7 @@ int smc_pnetid_by_table_smcd(struct smcd_dev *smcddev) · 12 unmodified lines | ||
| 1185 | 1185 | sn = net_generic(&init_net, smc_net_id); |
| 1186 | 1186 | pnettable = &sn->pnettable; |
| 1187 | 1187 | |
| 1188 | − read_lock(&pnettable->lock); | |
| 1188 | + mutex_lock(&pnettable->lock); | |
| 1189 | 1189 | list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
| 1190 | 1190 | if (tmp_pe->type == SMC_PNET_IB && |
| 1191 | 1191 | !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX)) { |
| @@ -1194,7 +1194,7 @@ int smc_pnetid_by_table_smcd(struct smcd_dev *smcddev) · 2 unmodified lines | ||
| 1194 | 1194 | break; |
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| 1197 | − read_unlock(&pnettable->lock); | |
| 1197 | + mutex_unlock(&pnettable->lock); | |
| 1198 | 1198 | |
| 1199 | 1199 | return rc; |
| 1200 | 1200 | } |
| @@ -29,7 +29,7 @@ struct smc_link_group; · 28 unmodified lines | ||
| 29 | 29 | * @pnetlist: List of PNETIDs |
| 30 | 30 | */ |
| 31 | 31 | struct smc_pnettable { |
| 32 | − rwlock_t lock; | |
| 32 | + struct mutex lock; | |
| 33 | 33 | struct list_head pnetlist; |
| 34 | 34 | }; |
| 35 | 35 | |
| @@ -3448,7 +3448,7 @@ EXPORT_SYMBOL(kernel_connect); · 3447 unmodified lines | ||
| 3448 | 3448 | * @addr: address holder |
| 3449 | 3449 | * |
| 3450 | 3450 | * Fills the @addr pointer with the address which the socket is bound. |
| 3451 | − * Returns 0 or an error code. | |
| 3451 | + * Returns the length of the address in bytes or an error code. | |
| 3452 | 3452 | */ |
| 3453 | 3453 | |
| 3454 | 3454 | int kernel_getsockname(struct socket *sock, struct sockaddr *addr) |
| @@ -3463,7 +3463,7 @@ EXPORT_SYMBOL(kernel_getsockname); · 8 unmodified lines | ||
| 3463 | 3463 | * @addr: address holder |
| 3464 | 3464 | * |
| 3465 | 3465 | * Fills the @addr pointer with the address which the socket is connected. |
| 3466 | − * Returns 0 or an error code. | |
| 3466 | + * Returns the length of the address in bytes or an error code. | |
| 3467 | 3467 | */ |
| 3468 | 3468 | |
| 3469 | 3469 | int kernel_getpeername(struct socket *sock, struct sockaddr *addr) |
| @@ -2276,7 +2276,7 @@ static bool tipc_crypto_key_rcv(struct tipc_crypto *rx, struct tipc_msg *hdr) · 2275 unmodified lines | ||
| 2276 | 2276 | struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx; |
| 2277 | 2277 | struct tipc_aead_key *skey = NULL; |
| 2278 | 2278 | u16 key_gen = msg_key_gen(hdr); |
| 2279 | − u16 size = msg_data_sz(hdr); | |
| 2279 | + u32 size = msg_data_sz(hdr); | |
| 2280 | 2280 | u8 *data = msg_data(hdr); |
| 2281 | 2281 | unsigned int keylen; |
| 2282 | 2282 | |
| @@ -967,7 +967,7 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg, · 966 unmodified lines | ||
| 967 | 967 | list_for_each_entry(p, &sr->all_publ, all_publ) |
| 968 | 968 | if (p->key == *last_key) |
| 969 | 969 | break; |
| 970 | − if (p->key != *last_key) | |
| 970 | + if (list_entry_is_head(p, &sr->all_publ, all_publ)) | |
| 971 | 971 | return -EPIPE; |
| 972 | 972 | } else { |
| 973 | 973 | p = list_first_entry(&sr->all_publ, |
| @@ -403,7 +403,7 @@ static void tipc_node_write_unlock(struct tipc_node *n) · 402 unmodified lines | ||
| 403 | 403 | u32 flags = n->action_flags; |
| 404 | 404 | struct list_head *publ_list; |
| 405 | 405 | struct tipc_uaddr ua; |
| 406 | − u32 bearer_id; | |
| 406 | + u32 bearer_id, node; | |
| 407 | 407 | |
| 408 | 408 | if (likely(!flags)) { |
| 409 | 409 | write_unlock_bh(&n->lock); |
| @@ -413,7 +413,8 @@ static void tipc_node_write_unlock(struct tipc_node *n) · 3 unmodified lines | ||
| 413 | 413 | tipc_uaddr(&ua, TIPC_SERVICE_RANGE, TIPC_NODE_SCOPE, |
| 414 | 414 | TIPC_LINK_STATE, n->addr, n->addr); |
| 415 | 415 | sk.ref = n->link_id; |
| 416 | − sk.node = n->addr; | |
| 416 | + sk.node = tipc_own_addr(net); | |
| 417 | + node = n->addr; | |
| 417 | 418 | bearer_id = n->link_id & 0xffff; |
| 418 | 419 | publ_list = &n->publ_list; |
| 419 | 420 | |
| @@ -423,17 +424,17 @@ static void tipc_node_write_unlock(struct tipc_node *n) · 3 unmodified lines | ||
| 423 | 424 | write_unlock_bh(&n->lock); |
| 424 | 425 | |
| 425 | 426 | if (flags & TIPC_NOTIFY_NODE_DOWN) |
| 426 | − tipc_publ_notify(net, publ_list, sk.node, n->capabilities); | |
| 427 | + tipc_publ_notify(net, publ_list, node, n->capabilities); | |
| 427 | 428 | |
| 428 | 429 | if (flags & TIPC_NOTIFY_NODE_UP) |
| 429 | − tipc_named_node_up(net, sk.node, n->capabilities); | |
| 430 | + tipc_named_node_up(net, node, n->capabilities); | |
| 430 | 431 | |
| 431 | 432 | if (flags & TIPC_NOTIFY_LINK_UP) { |
| 432 | − tipc_mon_peer_up(net, sk.node, bearer_id); | |
| 433 | + tipc_mon_peer_up(net, node, bearer_id); | |
| 433 | 434 | tipc_nametbl_publish(net, &ua, &sk, sk.ref); |
| 434 | 435 | } |
| 435 | 436 | if (flags & TIPC_NOTIFY_LINK_DOWN) { |
| 436 | − tipc_mon_peer_down(net, sk.node, bearer_id); | |
| 437 | + tipc_mon_peer_down(net, node, bearer_id); | |
| 437 | 438 | tipc_nametbl_withdraw(net, &ua, &sk, sk.ref); |
| 438 | 439 | } |
| 439 | 440 | } |
| @@ -3749,7 +3749,7 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb, · 3748 unmodified lines | ||
| 3749 | 3749 | if (p->key == *last_publ) |
| 3750 | 3750 | break; |
| 3751 | 3751 | } |
| 3752 | − if (p->key != *last_publ) { | |
| 3752 | + if (list_entry_is_head(p, &tsk->publications, binding_sock)) { | |
| 3753 | 3753 | /* We never set seq or call nl_dump_check_consistent() |
| 3754 | 3754 | * this means that setting prev_seq here will cause the |
| 3755 | 3755 | * consistence check to fail in the netlink callback |
| @@ -1401,6 +1401,7 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr, · 1400 unmodified lines | ||
| 1401 | 1401 | sk->sk_state = sk->sk_state == TCP_ESTABLISHED ? TCP_CLOSING : TCP_CLOSE; |
| 1402 | 1402 | sock->state = SS_UNCONNECTED; |
| 1403 | 1403 | vsock_transport_cancel_pkt(vsk); |
| 1404 | + vsock_remove_connected(vsk); | |
| 1404 | 1405 | goto out_wait; |
| 1405 | 1406 | } else if (timeout == 0) { |
| 1406 | 1407 | err = -ETIMEDOUT; |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> |
| 6 | 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
| 7 | 7 | * Copyright 2015-2017 Intel Deutschland GmbH |
| 8 | − * Copyright (C) 2018-2021 Intel Corporation | |
| 8 | + * Copyright (C) 2018-2022 Intel Corporation | |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| @@ -332,29 +332,20 @@ static void cfg80211_event_work(struct work_struct *work) · 320 unmodified lines | ||
| 332 | 332 | void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev) |
| 333 | 333 | { |
| 334 | 334 | struct wireless_dev *wdev, *tmp; |
| 335 | − bool found = false; | |
| 336 | 335 | |
| 337 | 336 | ASSERT_RTNL(); |
| 338 | 337 | |
| 339 | − list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { | |
| 338 | + list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) { | |
| 340 | 339 | if (wdev->nl_owner_dead) { |
| 341 | 340 | if (wdev->netdev) |
| 342 | 341 | dev_close(wdev->netdev); |
| 343 | − found = true; | |
| 344 | − } | |
| 345 | − } | |
| 346 | − | |
| 347 | − if (!found) | |
| 348 | − return; | |
| 349 | 342 | |
| 350 | − wiphy_lock(&rdev->wiphy); | |
| 351 | − list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) { | |
| 352 | − if (wdev->nl_owner_dead) { | |
| 343 | + wiphy_lock(&rdev->wiphy); | |
| 353 | 344 | cfg80211_leave(rdev, wdev); |
| 354 | 345 | rdev_del_virtual_intf(rdev, wdev); |
| 346 | + wiphy_unlock(&rdev->wiphy); | |
| 355 | 347 | } |
| 356 | 348 | } |
| 357 | − wiphy_unlock(&rdev->wiphy); | |
| 358 | 349 | } |
| 359 | 350 | |
| 360 | 351 | static void cfg80211_destroy_iface_wk(struct work_struct *work) |
| @@ -77,7 +77,7 @@ void selinux_ima_measure_state_locked(struct selinux_state *state) · 76 unmodified lines | ||
| 77 | 77 | size_t policy_len; |
| 78 | 78 | int rc = 0; |
| 79 | 79 | |
| 80 | − WARN_ON(!mutex_is_locked(&state->policy_mutex)); | |
| 80 | + lockdep_assert_held(&state->policy_mutex); | |
| 81 | 81 | |
| 82 | 82 | state_str = selinux_ima_collect_state(state); |
| 83 | 83 | if (!state_str) { |
| @@ -117,7 +117,7 @@ void selinux_ima_measure_state_locked(struct selinux_state *state) · 33 unmodified lines | ||
| 117 | 117 | */ |
| 118 | 118 | void selinux_ima_measure_state(struct selinux_state *state) |
| 119 | 119 | { |
| 120 | − WARN_ON(mutex_is_locked(&state->policy_mutex)); | |
| 120 | + lockdep_assert_not_held(&state->policy_mutex); | |
| 121 | 121 | |
| 122 | 122 | mutex_lock(&state->policy_mutex); |
| 123 | 123 | selinux_ima_measure_state_locked(state); |
| @@ -511,7 +511,8 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size) · 510 unmodified lines | ||
| 511 | 511 | DEFAULT_GFP, 0); |
| 512 | 512 | if (!sgt) |
| 513 | 513 | return NULL; |
| 514 | − dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir); | |
| 514 | + dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, | |
| 515 | + sg_dma_address(sgt->sgl)); | |
| 515 | 516 | p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt); |
| 516 | 517 | if (p) |
| 517 | 518 | dmab->private_data = sgt; |
| @@ -540,9 +541,9 @@ static void snd_dma_noncontig_sync(struct snd_dma_buffer *dmab, · 22 unmodified lines | ||
| 540 | 541 | if (mode == SNDRV_DMA_SYNC_CPU) { |
| 541 | 542 | if (dmab->dev.dir == DMA_TO_DEVICE) |
| 542 | 543 | return; |
| 544 | + invalidate_kernel_vmap_range(dmab->area, dmab->bytes); | |
| 543 | 545 | dma_sync_sgtable_for_cpu(dmab->dev.dev, dmab->private_data, |
| 544 | 546 | dmab->dev.dir); |
| 545 | − invalidate_kernel_vmap_range(dmab->area, dmab->bytes); | |
| 546 | 547 | } else { |
| 547 | 548 | if (dmab->dev.dir == DMA_FROM_DEVICE) |
| 548 | 549 | return; |
| @@ -671,9 +672,13 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = { · 122 unmodified lines | ||
| 671 | 672 | */ |
| 672 | 673 | static void *snd_dma_noncoherent_alloc(struct snd_dma_buffer *dmab, size_t size) |
| 673 | 674 | { |
| 674 | − dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir); | |
| 675 | − return dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr, | |
| 676 | − dmab->dev.dir, DEFAULT_GFP); | |
| 675 | + void *p; | |
| 676 | + | |
| 677 | + p = dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr, | |
| 678 | + dmab->dev.dir, DEFAULT_GFP); | |
| 679 | + if (p) | |
| 680 | + dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->addr); | |
| 681 | + return p; | |
| 677 | 682 | } |
| 678 | 683 | |
| 679 | 684 | static void snd_dma_noncoherent_free(struct snd_dma_buffer *dmab) |
| @@ -1615,6 +1615,7 @@ static const struct snd_pci_quirk probe_mask_list[] = { · 1614 unmodified lines | ||
| 1615 | 1615 | /* forced codec slots */ |
| 1616 | 1616 | SND_PCI_QUIRK(0x1043, 0x1262, "ASUS W5Fm", 0x103), |
| 1617 | 1617 | SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), |
| 1618 | + SND_PCI_QUIRK(0x1558, 0x0351, "Schenker Dock 15", 0x105), | |
| 1618 | 1619 | /* WinFast VP200 H (Teradici) user reported broken communication */ |
| 1619 | 1620 | SND_PCI_QUIRK(0x3a21, 0x040d, "WinFast VP200 H", 0x101), |
| 1620 | 1621 | {} |
| @@ -1798,8 +1799,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, · 177 unmodified lines | ||
| 1798 | 1799 | |
| 1799 | 1800 | assign_position_fix(chip, check_position_fix(chip, position_fix[dev])); |
| 1800 | 1801 | |
| 1801 | − check_probe_mask(chip, dev); | |
| 1802 | − | |
| 1803 | 1802 | if (single_cmd < 0) /* allow fallback to single_cmd at errors */ |
| 1804 | 1803 | chip->fallback_to_single_cmd = 1; |
| 1805 | 1804 | else /* explicitly set to single_cmd or not */ |
| @@ -1825,6 +1824,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, · 19 unmodified lines | ||
| 1825 | 1824 | chip->bus.core.needs_damn_long_delay = 1; |
| 1826 | 1825 | } |
| 1827 | 1826 | |
| 1827 | + check_probe_mask(chip, dev); | |
| 1828 | + | |
| 1828 | 1829 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
| 1829 | 1830 | if (err < 0) { |
| 1830 | 1831 | dev_err(card->dev, "Error creating device [card]!\n"); |
| @@ -1940,6 +1941,7 @@ static int azx_first_init(struct azx *chip) · 109 unmodified lines | ||
| 1940 | 1941 | dma_bits = 32; |
| 1941 | 1942 | if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(dma_bits))) |
| 1942 | 1943 | dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32)); |
| 1944 | + dma_set_max_seg_size(&pci->dev, UINT_MAX); | |
| 1943 | 1945 | |
| 1944 | 1946 | /* read number of streams from GCAP register instead of using |
| 1945 | 1947 | * hardcoded value |
| @@ -138,6 +138,22 @@ struct alc_spec { · 137 unmodified lines | ||
| 138 | 138 | * COEF access helper functions |
| 139 | 139 | */ |
| 140 | 140 | |
| 141 | +static void coef_mutex_lock(struct hda_codec *codec) | |
| 142 | +{ | |
| 143 | + struct alc_spec *spec = codec->spec; | |
| 144 | + | |
| 145 | + snd_hda_power_up_pm(codec); | |
| 146 | + mutex_lock(&spec->coef_mutex); | |
| 147 | +} | |
| 148 | + | |
| 149 | +static void coef_mutex_unlock(struct hda_codec *codec) | |
| 150 | +{ | |
| 151 | + struct alc_spec *spec = codec->spec; | |
| 152 | + | |
| 153 | + mutex_unlock(&spec->coef_mutex); | |
| 154 | + snd_hda_power_down_pm(codec); | |
| 155 | +} | |
| 156 | + | |
| 141 | 157 | static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
| 142 | 158 | unsigned int coef_idx) |
| 143 | 159 | { |
| @@ -151,12 +167,11 @@ static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, · 7 unmodified lines | ||
| 151 | 167 | static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
| 152 | 168 | unsigned int coef_idx) |
| 153 | 169 | { |
| 154 | − struct alc_spec *spec = codec->spec; | |
| 155 | 170 | unsigned int val; |
| 156 | 171 | |
| 157 | − mutex_lock(&spec->coef_mutex); | |
| 172 | + coef_mutex_lock(codec); | |
| 158 | 173 | val = __alc_read_coefex_idx(codec, nid, coef_idx); |
| 159 | − mutex_unlock(&spec->coef_mutex); | |
| 174 | + coef_mutex_unlock(codec); | |
| 160 | 175 | return val; |
| 161 | 176 | } |
| 162 | 177 | |
| @@ -173,11 +188,9 @@ static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, · 10 unmodified lines | ||
| 173 | 188 | static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
| 174 | 189 | unsigned int coef_idx, unsigned int coef_val) |
| 175 | 190 | { |
| 176 | − struct alc_spec *spec = codec->spec; | |
| 177 | − | |
| 178 | − mutex_lock(&spec->coef_mutex); | |
| 191 | + coef_mutex_lock(codec); | |
| 179 | 192 | __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); |
| 180 | − mutex_unlock(&spec->coef_mutex); | |
| 193 | + coef_mutex_unlock(codec); | |
| 181 | 194 | } |
| 182 | 195 | |
| 183 | 196 | #define alc_write_coef_idx(codec, coef_idx, coef_val) \ |
| @@ -198,11 +211,9 @@ static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, · 14 unmodified lines | ||
| 198 | 211 | unsigned int coef_idx, unsigned int mask, |
| 199 | 212 | unsigned int bits_set) |
| 200 | 213 | { |
| 201 | − struct alc_spec *spec = codec->spec; | |
| 202 | − | |
| 203 | − mutex_lock(&spec->coef_mutex); | |
| 214 | + coef_mutex_lock(codec); | |
| 204 | 215 | __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); |
| 205 | − mutex_unlock(&spec->coef_mutex); | |
| 216 | + coef_mutex_unlock(codec); | |
| 206 | 217 | } |
| 207 | 218 | |
| 208 | 219 | #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ |
| @@ -235,9 +246,7 @@ struct coef_fw { · 26 unmodified lines | ||
| 235 | 246 | static void alc_process_coef_fw(struct hda_codec *codec, |
| 236 | 247 | const struct coef_fw *fw) |
| 237 | 248 | { |
| 238 | − struct alc_spec *spec = codec->spec; | |
| 239 | − | |
| 240 | − mutex_lock(&spec->coef_mutex); | |
| 249 | + coef_mutex_lock(codec); | |
| 241 | 250 | for (; fw->nid; fw++) { |
| 242 | 251 | if (fw->mask == (unsigned short)-1) |
| 243 | 252 | __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); |
| @@ -245,7 +254,7 @@ static void alc_process_coef_fw(struct hda_codec *codec, · 1 unmodified line | ||
| 245 | 254 | __alc_update_coefex_idx(codec, fw->nid, fw->idx, |
| 246 | 255 | fw->mask, fw->val); |
| 247 | 256 | } |
| 248 | − mutex_unlock(&spec->coef_mutex); | |
| 257 | + coef_mutex_unlock(codec); | |
| 249 | 258 | } |
| 250 | 259 | |
| 251 | 260 | /* |
| @@ -9170,6 +9179,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 8918 unmodified lines | ||
| 9170 | 9179 | SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), |
| 9171 | 9180 | SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), |
| 9172 | 9181 | SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), |
| 9182 | + SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), | |
| 9173 | 9183 | SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP), |
| 9174 | 9184 | SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6), |
| 9175 | 9185 | SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <linux/gpio/consumer.h> |
| 22 | 22 | |
| 23 | 23 | #define EN_SPKR_GPIO_GB 0x11F |
| 24 | −#define EN_SPKR_GPIO_NK 0x146 | |
| 25 | 24 | #define EN_SPKR_GPIO_NONE -EINVAL |
| 26 | 25 | |
| 27 | 26 | enum be_id { |
| @@ -37,7 +37,7 @@ static struct acp_card_drvdata sof_rt5682_max_data = { · 36 unmodified lines | ||
| 37 | 37 | .hs_codec_id = RT5682, |
| 38 | 38 | .amp_codec_id = MAX98360A, |
| 39 | 39 | .dmic_codec_id = DMIC, |
| 40 | − .gpio_spkr_en = EN_SPKR_GPIO_NK, | |
| 40 | + .gpio_spkr_en = EN_SPKR_GPIO_NONE, | |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | 43 | static struct acp_card_drvdata sof_rt5682s_max_data = { |
| @@ -47,7 +47,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { · 3 unmodified lines | ||
| 47 | 47 | .hs_codec_id = RT5682S, |
| 48 | 48 | .amp_codec_id = MAX98360A, |
| 49 | 49 | .dmic_codec_id = DMIC, |
| 50 | − .gpio_spkr_en = EN_SPKR_GPIO_NK, | |
| 50 | + .gpio_spkr_en = EN_SPKR_GPIO_NONE, | |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | 53 | static const struct snd_kcontrol_new acp_controls[] = { |
| @@ -1022,11 +1022,13 @@ static void rt5668_jack_detect_handler(struct work_struct *work) · 1021 unmodified lines | ||
| 1022 | 1022 | container_of(work, struct rt5668_priv, jack_detect_work.work); |
| 1023 | 1023 | int val, btn_type; |
| 1024 | 1024 | |
| 1025 | − while (!rt5668->component) | |
| 1026 | − usleep_range(10000, 15000); | |
| 1027 | − | |
| 1028 | − while (!rt5668->component->card->instantiated) | |
| 1029 | − usleep_range(10000, 15000); | |
| 1025 | + if (!rt5668->component || !rt5668->component->card || | |
| 1026 | + !rt5668->component->card->instantiated) { | |
| 1027 | + /* card not yet ready, try later */ | |
| 1028 | + mod_delayed_work(system_power_efficient_wq, | |
| 1029 | + &rt5668->jack_detect_work, msecs_to_jiffies(15)); | |
| 1030 | + return; | |
| 1031 | + } | |
| 1030 | 1032 | |
| 1031 | 1033 | mutex_lock(&rt5668->calibrate_mutex); |
| 1032 | 1034 | |
| @@ -1092,11 +1092,13 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 1091 unmodified lines | ||
| 1092 | 1092 | struct snd_soc_dapm_context *dapm; |
| 1093 | 1093 | int val, btn_type; |
| 1094 | 1094 | |
| 1095 | − while (!rt5682->component) | |
| 1096 | − usleep_range(10000, 15000); | |
| 1097 | − | |
| 1098 | − while (!rt5682->component->card->instantiated) | |
| 1099 | − usleep_range(10000, 15000); | |
| 1095 | + if (!rt5682->component || !rt5682->component->card || | |
| 1096 | + !rt5682->component->card->instantiated) { | |
| 1097 | + /* card not yet ready, try later */ | |
| 1098 | + mod_delayed_work(system_power_efficient_wq, | |
| 1099 | + &rt5682->jack_detect_work, msecs_to_jiffies(15)); | |
| 1100 | + return; | |
| 1101 | + } | |
| 1100 | 1102 | |
| 1101 | 1103 | dapm = snd_soc_component_get_dapm(rt5682->component); |
| 1102 | 1104 | |
| @@ -824,11 +824,13 @@ static void rt5682s_jack_detect_handler(struct work_struct *work) · 823 unmodified lines | ||
| 824 | 824 | container_of(work, struct rt5682s_priv, jack_detect_work.work); |
| 825 | 825 | int val, btn_type; |
| 826 | 826 | |
| 827 | − while (!rt5682s->component) | |
| 828 | − usleep_range(10000, 15000); | |
| 829 | − | |
| 830 | − while (!rt5682s->component->card->instantiated) | |
| 831 | − usleep_range(10000, 15000); | |
| 827 | + if (!rt5682s->component || !rt5682s->component->card || | |
| 828 | + !rt5682s->component->card->instantiated) { | |
| 829 | + /* card not yet ready, try later */ | |
| 830 | + mod_delayed_work(system_power_efficient_wq, | |
| 831 | + &rt5682s->jack_detect_work, msecs_to_jiffies(15)); | |
| 832 | + return; | |
| 833 | + } | |
| 832 | 834 | |
| 833 | 835 | mutex_lock(&rt5682s->jdet_mutex); |
| 834 | 836 | mutex_lock(&rt5682s->calibrate_mutex); |
| @@ -38,10 +38,12 @@ static void tas2770_reset(struct tas2770_priv *tas2770) · 37 unmodified lines | ||
| 38 | 38 | gpiod_set_value_cansleep(tas2770->reset_gpio, 0); |
| 39 | 39 | msleep(20); |
| 40 | 40 | gpiod_set_value_cansleep(tas2770->reset_gpio, 1); |
| 41 | + usleep_range(1000, 2000); | |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | snd_soc_component_write(tas2770->component, TAS2770_SW_RST, |
| 44 | 45 | TAS2770_RST); |
| 46 | + usleep_range(1000, 2000); | |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | static int tas2770_set_bias_level(struct snd_soc_component *component, |
| @@ -110,6 +112,7 @@ static int tas2770_codec_resume(struct snd_soc_component *component) · 62 unmodified lines | ||
| 110 | 112 | |
| 111 | 113 | if (tas2770->sdz_gpio) { |
| 112 | 114 | gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); |
| 115 | + usleep_range(1000, 2000); | |
| 113 | 116 | } else { |
| 114 | 117 | ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, |
| 115 | 118 | TAS2770_PWR_CTRL_MASK, |
| @@ -510,8 +513,10 @@ static int tas2770_codec_probe(struct snd_soc_component *component) · 394 unmodified lines | ||
| 510 | 513 | |
| 511 | 514 | tas2770->component = component; |
| 512 | 515 | |
| 513 | − if (tas2770->sdz_gpio) | |
| 516 | + if (tas2770->sdz_gpio) { | |
| 514 | 517 | gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); |
| 518 | + usleep_range(1000, 2000); | |
| 519 | + } | |
| 515 | 520 | |
| 516 | 521 | tas2770_reset(tas2770); |
| 517 | 522 | |
| @@ -1441,7 +1441,8 @@ static int wm_adsp_buffer_parse_coeff(struct cs_dsp_coeff_ctl *cs_ctl) · 1440 unmodified lines | ||
| 1441 | 1441 | int ret, i; |
| 1442 | 1442 | |
| 1443 | 1443 | for (i = 0; i < 5; ++i) { |
| 1444 | − ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1, sizeof(coeff_v1)); | |
| 1444 | + ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1, | |
| 1445 | + min(cs_ctl->len, sizeof(coeff_v1))); | |
| 1445 | 1446 | if (ret < 0) |
| 1446 | 1447 | return ret; |
| 1447 | 1448 | |
| @@ -952,6 +952,7 @@ static int skl_first_init(struct hdac_bus *bus) · 951 unmodified lines | ||
| 952 | 952 | /* allow 64bit DMA address if supported by H/W */ |
| 953 | 953 | if (dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(64))) |
| 954 | 954 | dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(32)); |
| 955 | + dma_set_max_seg_size(bus->dev, UINT_MAX); | |
| 955 | 956 | |
| 956 | 957 | /* initialize streams */ |
| 957 | 958 | snd_hdac_ext_stream_init_all |
| @@ -524,7 +524,7 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component, · 523 unmodified lines | ||
| 524 | 524 | return -EINVAL; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | − ret = regmap_update_bits(map, reg_irqclr, val_irqclr, val_irqclr); | |
| 527 | + ret = regmap_write_bits(map, reg_irqclr, val_irqclr, val_irqclr); | |
| 528 | 528 | if (ret) { |
| 529 | 529 | dev_err(soc_runtime->dev, "error writing to irqclear reg: %d\n", ret); |
| 530 | 530 | return ret; |
| @@ -665,7 +665,7 @@ static irqreturn_t lpass_dma_interrupt_handler( · 134 unmodified lines | ||
| 665 | 665 | return -EINVAL; |
| 666 | 666 | } |
| 667 | 667 | if (interrupts & LPAIF_IRQ_PER(chan)) { |
| 668 | − rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_PER(chan) | val)); | |
| 668 | + rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_PER(chan) | val)); | |
| 669 | 669 | if (rv) { |
| 670 | 670 | dev_err(soc_runtime->dev, |
| 671 | 671 | "error writing to irqclear reg: %d\n", rv); |
| @@ -676,7 +676,7 @@ static irqreturn_t lpass_dma_interrupt_handler( · 4 unmodified lines | ||
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | if (interrupts & LPAIF_IRQ_XRUN(chan)) { |
| 679 | − rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_XRUN(chan) | val)); | |
| 679 | + rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_XRUN(chan) | val)); | |
| 680 | 680 | if (rv) { |
| 681 | 681 | dev_err(soc_runtime->dev, |
| 682 | 682 | "error writing to irqclear reg: %d\n", rv); |
| @@ -688,7 +688,7 @@ static irqreturn_t lpass_dma_interrupt_handler( · 5 unmodified lines | ||
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | if (interrupts & LPAIF_IRQ_ERR(chan)) { |
| 691 | − rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_ERR(chan) | val)); | |
| 691 | + rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_ERR(chan) | val)); | |
| 692 | 692 | if (rv) { |
| 693 | 693 | dev_err(soc_runtime->dev, |
| 694 | 694 | "error writing to irqclear reg: %d\n", rv); |
| @@ -308,7 +308,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, · 307 unmodified lines | ||
| 308 | 308 | unsigned int sign_bit = mc->sign_bit; |
| 309 | 309 | unsigned int mask = (1 << fls(max)) - 1; |
| 310 | 310 | unsigned int invert = mc->invert; |
| 311 | − int err; | |
| 311 | + int err, ret; | |
| 312 | 312 | bool type_2r = false; |
| 313 | 313 | unsigned int val2 = 0; |
| 314 | 314 | unsigned int val, val_mask; |
| @@ -350,12 +350,18 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, · 35 unmodified lines | ||
| 350 | 350 | err = snd_soc_component_update_bits(component, reg, val_mask, val); |
| 351 | 351 | if (err < 0) |
| 352 | 352 | return err; |
| 353 | + ret = err; | |
| 353 | 354 | |
| 354 | − if (type_2r) | |
| 355 | + if (type_2r) { | |
| 355 | 356 | err = snd_soc_component_update_bits(component, reg2, val_mask, |
| 356 | − val2); | |
| 357 | + val2); | |
| 358 | + /* Don't discard any error code or drop change flag */ | |
| 359 | + if (ret == 0 || err < 0) { | |
| 360 | + ret = err; | |
| 361 | + } | |
| 362 | + } | |
| 357 | 363 | |
| 358 | − return err; | |
| 364 | + return ret; | |
| 359 | 365 | } |
| 360 | 366 | EXPORT_SYMBOL_GPL(snd_soc_put_volsw); |
| 361 | 367 | |
| @@ -421,6 +427,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 59 unmodified lines | ||
| 421 | 427 | int min = mc->min; |
| 422 | 428 | unsigned int mask = (1U << (fls(min + max) - 1)) - 1; |
| 423 | 429 | int err = 0; |
| 430 | + int ret; | |
| 424 | 431 | unsigned int val, val_mask; |
| 425 | 432 | |
| 426 | 433 | if (ucontrol->value.integer.value[0] < 0) |
| @@ -437,6 +444,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 10 unmodified lines | ||
| 437 | 444 | err = snd_soc_component_update_bits(component, reg, val_mask, val); |
| 438 | 445 | if (err < 0) |
| 439 | 446 | return err; |
| 447 | + ret = err; | |
| 440 | 448 | |
| 441 | 449 | if (snd_soc_volsw_is_stereo(mc)) { |
| 442 | 450 | unsigned int val2; |
| @@ -447,6 +455,11 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 4 unmodified lines | ||
| 447 | 455 | |
| 448 | 456 | err = snd_soc_component_update_bits(component, reg2, val_mask, |
| 449 | 457 | val2); |
| 458 | + | |
| 459 | + /* Don't discard any error code or drop change flag */ | |
| 460 | + if (ret == 0 || err < 0) { | |
| 461 | + ret = err; | |
| 462 | + } | |
| 450 | 463 | } |
| 451 | 464 | return err; |
| 452 | 465 | } |
| @@ -506,7 +519,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 53 unmodified lines | ||
| 506 | 519 | unsigned int mask = (1 << fls(max)) - 1; |
| 507 | 520 | unsigned int invert = mc->invert; |
| 508 | 521 | unsigned int val, val_mask; |
| 509 | − int ret; | |
| 522 | + int err, ret; | |
| 510 | 523 | |
| 511 | 524 | if (invert) |
| 512 | 525 | val = (max - ucontrol->value.integer.value[0]) & mask; |
| @@ -515,9 +528,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 2 unmodified lines | ||
| 515 | 528 | val_mask = mask << shift; |
| 516 | 529 | val = val << shift; |
| 517 | 530 | |
| 518 | − ret = snd_soc_component_update_bits(component, reg, val_mask, val); | |
| 519 | − if (ret < 0) | |
| 520 | − return ret; | |
| 531 | + err = snd_soc_component_update_bits(component, reg, val_mask, val); | |
| 532 | + if (err < 0) | |
| 533 | + return err; | |
| 534 | + ret = err; | |
| 521 | 535 | |
| 522 | 536 | if (snd_soc_volsw_is_stereo(mc)) { |
| 523 | 537 | if (invert) |
| @@ -527,8 +541,12 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 3 unmodified lines | ||
| 527 | 541 | val_mask = mask << shift; |
| 528 | 542 | val = val << shift; |
| 529 | 543 | |
| 530 | − ret = snd_soc_component_update_bits(component, rreg, val_mask, | |
| 544 | + err = snd_soc_component_update_bits(component, rreg, val_mask, | |
| 531 | 545 | val); |
| 546 | + /* Don't discard any error code or drop change flag */ | |
| 547 | + if (ret == 0 || err < 0) { | |
| 548 | + ret = err; | |
| 549 | + } | |
| 532 | 550 | } |
| 533 | 551 | |
| 534 | 552 | return ret; |
| @@ -877,6 +895,7 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, · 342 unmodified lines | ||
| 877 | 895 | unsigned long mask = (1UL<<mc->nbits)-1; |
| 878 | 896 | long max = mc->max; |
| 879 | 897 | long val = ucontrol->value.integer.value[0]; |
| 898 | + int ret = 0; | |
| 880 | 899 | unsigned int i; |
| 881 | 900 | |
| 882 | 901 | if (val < mc->min || val > mc->max) |
| @@ -891,9 +910,11 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, · 8 unmodified lines | ||
| 891 | 910 | regmask, regval); |
| 892 | 911 | if (err < 0) |
| 893 | 912 | return err; |
| 913 | + if (err > 0) | |
| 914 | + ret = err; | |
| 894 | 915 | } |
| 895 | 916 | |
| 896 | − return 0; | |
| 917 | + return ret; | |
| 897 | 918 | } |
| 898 | 919 | EXPORT_SYMBOL_GPL(snd_soc_put_xr_sx); |
| 899 | 920 | |
| @@ -956,6 +956,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) · 955 unmodified lines | ||
| 956 | 956 | dev_dbg(sdev->dev, "DMA mask is 32 bit\n"); |
| 957 | 957 | dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32)); |
| 958 | 958 | } |
| 959 | + dma_set_max_seg_size(&pci->dev, UINT_MAX); | |
| 959 | 960 | |
| 960 | 961 | /* init streams */ |
| 961 | 962 | ret = hda_dsp_stream_init(sdev); |
| @@ -47,13 +47,13 @@ struct snd_usb_implicit_fb_match { · 46 unmodified lines | ||
| 47 | 47 | static const struct snd_usb_implicit_fb_match playback_implicit_fb_quirks[] = { |
| 48 | 48 | /* Generic matching */ |
| 49 | 49 | IMPLICIT_FB_GENERIC_DEV(0x0499, 0x1509), /* Steinberg UR22 */ |
| 50 | − IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2080), /* M-Audio FastTrack Ultra */ | |
| 51 | − IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2081), /* M-Audio FastTrack Ultra */ | |
| 52 | 50 | IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2030), /* M-Audio Fast Track C400 */ |
| 53 | 51 | IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2031), /* M-Audio Fast Track C600 */ |
| 54 | 52 | |
| 55 | 53 | /* Fixed EP */ |
| 56 | 54 | /* FIXME: check the availability of generic matching */ |
| 55 | + IMPLICIT_FB_FIXED_DEV(0x0763, 0x2080, 0x81, 2), /* M-Audio FastTrack Ultra */ | |
| 56 | + IMPLICIT_FB_FIXED_DEV(0x0763, 0x2081, 0x81, 2), /* M-Audio FastTrack Ultra */ | |
| 57 | 57 | IMPLICIT_FB_FIXED_DEV(0x2466, 0x8010, 0x81, 2), /* Fractal Audio Axe-Fx III */ |
| 58 | 58 | IMPLICIT_FB_FIXED_DEV(0x31e9, 0x0001, 0x81, 2), /* Solid State Logic SSL2 */ |
| 59 | 59 | IMPLICIT_FB_FIXED_DEV(0x31e9, 0x0002, 0x81, 2), /* Solid State Logic SSL2+ */ |
| @@ -3678,17 +3678,14 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list) · 3677 unmodified lines | ||
| 3678 | 3678 | err = snd_usb_set_cur_mix_value(cval, c + 1, idx, |
| 3679 | 3679 | cval->cache_val[idx]); |
| 3680 | 3680 | if (err < 0) |
| 3681 | − return err; | |
| 3681 | + break; | |
| 3682 | 3682 | } |
| 3683 | 3683 | idx++; |
| 3684 | 3684 | } |
| 3685 | 3685 | } else { |
| 3686 | 3686 | /* master */ |
| 3687 | − if (cval->cached) { | |
| 3688 | − err = snd_usb_set_cur_mix_value(cval, 0, 0, *cval->cache_val); | |
| 3689 | − if (err < 0) | |
| 3690 | − return err; | |
| 3691 | − } | |
| 3687 | + if (cval->cached) | |
| 3688 | + snd_usb_set_cur_mix_value(cval, 0, 0, *cval->cache_val); | |
| 3692 | 3689 | } |
| 3693 | 3690 | |
| 3694 | 3691 | return 0; |
| @@ -476,6 +476,7 @@ · 475 unmodified lines | ||
| 476 | 476 | #define MSR_AMD64_ICIBSEXTDCTL 0xc001103c |
| 477 | 477 | #define MSR_AMD64_IBSOPDATA4 0xc001103d |
| 478 | 478 | #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */ |
| 479 | +#define MSR_AMD64_SVM_AVIC_DOORBELL 0xc001011b | |
| 479 | 480 | #define MSR_AMD64_VM_PAGE_FLUSH 0xc001011e |
| 480 | 481 | #define MSR_AMD64_SEV_ES_GHCB 0xc0010130 |
| 481 | 482 | #define MSR_AMD64_SEV 0xc0010131 |
| @@ -11,7 +11,7 @@ from drgn.helpers.linux import list_for_each_entry, list_empty · 10 unmodified lines | ||
| 11 | 11 | from drgn.helpers.linux import for_each_page |
| 12 | 12 | from drgn.helpers.linux.cpumask import for_each_online_cpu |
| 13 | 13 | from drgn.helpers.linux.percpu import per_cpu_ptr |
| 14 | −from drgn import container_of, FaultError, Object | |
| 14 | +from drgn import container_of, FaultError, Object, cast | |
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | DESC = """ |
| @@ -69,15 +69,15 @@ def oo_objects(s): · 51 unmodified lines | ||
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | def count_partial(n, fn): |
| 72 | − nr_pages = 0 | |
| 73 | − for page in list_for_each_entry('struct page', n.partial.address_of_(), | |
| 74 | − 'lru'): | |
| 75 | − nr_pages += fn(page) | |
| 76 | − return nr_pages | |
| 72 | + nr_objs = 0 | |
| 73 | + for slab in list_for_each_entry('struct slab', n.partial.address_of_(), | |
| 74 | + 'slab_list'): | |
| 75 | + nr_objs += fn(slab) | |
| 76 | + return nr_objs | |
| 77 | 77 | |
| 78 | 78 | |
| 79 | −def count_free(page): | |
| 80 | − return page.objects - page.inuse | |
| 79 | +def count_free(slab): | |
| 80 | + return slab.objects - slab.inuse | |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | def slub_get_slabinfo(s, cfg): |
| @@ -145,14 +145,14 @@ def detect_kernel_config(): · 61 unmodified lines | ||
| 145 | 145 | return cfg |
| 146 | 146 | |
| 147 | 147 | |
| 148 | −def for_each_slab_page(prog): | |
| 148 | +def for_each_slab(prog): | |
| 149 | 149 | PGSlab = 1 << prog.constant('PG_slab') |
| 150 | 150 | PGHead = 1 << prog.constant('PG_head') |
| 151 | 151 | |
| 152 | 152 | for page in for_each_page(prog): |
| 153 | 153 | try: |
| 154 | 154 | if page.flags.value_() & PGSlab: |
| 155 | − yield page | |
| 155 | + yield cast('struct slab *', page) | |
| 156 | 156 | except FaultError: |
| 157 | 157 | pass |
| 158 | 158 | |
| @@ -190,13 +190,13 @@ def main(): · 31 unmodified lines | ||
| 190 | 190 | 'list'): |
| 191 | 191 | obj_cgroups.add(ptr.value_()) |
| 192 | 192 | |
| 193 | − # look over all slab pages, belonging to non-root memcgs | |
| 194 | − # and look for objects belonging to the given memory cgroup | |
| 195 | − for page in for_each_slab_page(prog): | |
| 196 | − objcg_vec_raw = page.memcg_data.value_() | |
| 193 | + # look over all slab folios and look for objects belonging | |
| 194 | + # to the given memory cgroup | |
| 195 | + for slab in for_each_slab(prog): | |
| 196 | + objcg_vec_raw = slab.memcg_data.value_() | |
| 197 | 197 | if objcg_vec_raw == 0: |
| 198 | 198 | continue |
| 199 | − cache = page.slab_cache | |
| 199 | + cache = slab.slab_cache | |
| 200 | 200 | if not cache: |
| 201 | 201 | continue |
| 202 | 202 | addr = cache.value_() |
| @@ -1134,6 +1134,7 @@ struct kvm_ppc_resize_hpt { · 1133 unmodified lines | ||
| 1134 | 1134 | #define KVM_CAP_VM_GPA_BITS 207 |
| 1135 | 1135 | #define KVM_CAP_XSAVE2 208 |
| 1136 | 1136 | #define KVM_CAP_SYS_ATTRIBUTES 209 |
| 1137 | +#define KVM_CAP_PPC_AIL_MODE_3 210 | |
| 1137 | 1138 | |
| 1138 | 1139 | #ifdef KVM_CAP_IRQ_ROUTING |
| 1139 | 1140 | |
| @@ -465,6 +465,8 @@ struct perf_event_attr { · 464 unmodified lines | ||
| 465 | 465 | /* |
| 466 | 466 | * User provided data if sigtrap=1, passed back to user via |
| 467 | 467 | * siginfo_t::si_perf_data, e.g. to permit user to identify the event. |
| 468 | + * Note, siginfo_t::si_perf_data is long-sized, and sig_data will be | |
| 469 | + * truncated accordingly on 32 bit architectures. | |
| 468 | 470 | */ |
| 469 | 471 | __u64 sig_data; |
| 470 | 472 | }; |
| @@ -3,11 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #define __LIBPERF_INTERNAL_CPUMAP_H |
| 4 | 4 | |
| 5 | 5 | #include <linux/refcount.h> |
| 6 | − | |
| 7 | −/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */ | |
| 8 | −struct perf_cpu { | |
| 9 | − int cpu; | |
| 10 | −}; | |
| 6 | +#include <perf/cpumap.h> | |
| 11 | 7 | |
| 12 | 8 | /** |
| 13 | 9 | * A sized, reference counted, sorted array of integers representing CPU |
| @@ -7,6 +7,11 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <stdio.h> |
| 8 | 8 | #include <stdbool.h> |
| 9 | 9 | |
| 10 | +/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */ | |
| 11 | +struct perf_cpu { | |
| 12 | + int cpu; | |
| 13 | +}; | |
| 14 | + | |
| 10 | 15 | LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); |
| 11 | 16 | LIBPERF_API struct perf_cpu_map *perf_cpu_map__default_new(void); |
| 12 | 17 | LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list); |
| @@ -2,6 +2,7 @@ LIBPERF_0.0.1 { · 1 unmodified line | ||
| 2 | 2 | global: |
| 3 | 3 | libperf_init; |
| 4 | 4 | perf_cpu_map__dummy_new; |
| 5 | + perf_cpu_map__default_new; | |
| 5 | 6 | perf_cpu_map__get; |
| 6 | 7 | perf_cpu_map__put; |
| 7 | 8 | perf_cpu_map__new; |
| @@ -14,6 +14,8 @@ static int libperf_print(enum libperf_print_level level, · 13 unmodified lines | ||
| 14 | 14 | int test_cpumap(int argc, char **argv) |
| 15 | 15 | { |
| 16 | 16 | struct perf_cpu_map *cpus; |
| 17 | + struct perf_cpu cpu; | |
| 18 | + int idx; | |
| 17 | 19 | |
| 18 | 20 | __T_START; |
| 19 | 21 | |
| @@ -27,6 +29,15 @@ int test_cpumap(int argc, char **argv) · 7 unmodified lines | ||
| 27 | 29 | perf_cpu_map__put(cpus); |
| 28 | 30 | perf_cpu_map__put(cpus); |
| 29 | 31 | |
| 32 | + cpus = perf_cpu_map__default_new(); | |
| 33 | + if (!cpus) | |
| 34 | + return -1; | |
| 35 | + | |
| 36 | + perf_cpu_map__for_each_cpu(cpu, idx, cpus) | |
| 37 | + __T("wrong cpu number", cpu.cpu != -1); | |
| 38 | + | |
| 39 | + perf_cpu_map__put(cpus); | |
| 40 | + | |
| 30 | 41 | __T_END; |
| 31 | 42 | return tests_failed == 0 ? 0 : -1; |
| 32 | 43 | } |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | #define _GNU_SOURCE // needed for sched.h to get sched_[gs]etaffinity and CPU_(ZERO,SET) |
| 3 | +#include <inttypes.h> | |
| 3 | 4 | #include <sched.h> |
| 4 | 5 | #include <stdio.h> |
| 5 | 6 | #include <stdarg.h> |
| @@ -526,12 +527,12 @@ static int test_stat_multiplexing(void) · 520 unmodified lines | ||
| 526 | 527 | |
| 527 | 528 | min = counts[0].val; |
| 528 | 529 | for (i = 0; i < EVENT_NUM; i++) { |
| 529 | − __T_VERBOSE("Event %2d -- Raw count = %lu, run = %lu, enable = %lu\n", | |
| 530 | + __T_VERBOSE("Event %2d -- Raw count = %" PRIu64 ", run = %" PRIu64 ", enable = %" PRIu64 "\n", | |
| 530 | 531 | i, counts[i].val, counts[i].run, counts[i].ena); |
| 531 | 532 | |
| 532 | 533 | perf_counts_values__scale(&counts[i], true, &scaled); |
| 533 | 534 | if (scaled == 1) { |
| 534 | − __T_VERBOSE("\t Scaled count = %lu (%.2lf%%, %lu/%lu)\n", | |
| 535 | + __T_VERBOSE("\t Scaled count = %" PRIu64 " (%.2lf%%, %" PRIu64 "/%" PRIu64 ")\n", | |
| 535 | 536 | counts[i].val, |
| 536 | 537 | (double)counts[i].run / (double)counts[i].ena * 100.0, |
| 537 | 538 | counts[i].run, counts[i].ena); |
| @@ -50,15 +50,8 @@ static NORETURN inline void die(const char *err, ...) · 49 unmodified lines | ||
| 50 | 50 | static inline void *xrealloc(void *ptr, size_t size) |
| 51 | 51 | { |
| 52 | 52 | void *ret = realloc(ptr, size); |
| 53 | − if (!ret && !size) | |
| 54 | − ret = realloc(ptr, 1); | |
| 55 | − if (!ret) { | |
| 56 | − ret = realloc(ptr, size); | |
| 57 | − if (!ret && !size) | |
| 58 | − ret = realloc(ptr, 1); | |
| 59 | − if (!ret) | |
| 60 | − die("Out of memory, realloc failed"); | |
| 61 | − } | |
| 53 | + if (!ret) | |
| 54 | + die("Out of memory, realloc failed"); | |
| 62 | 55 | return ret; |
| 63 | 56 | } |
| 64 | 57 | |
| @@ -463,7 +463,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) · 462 unmodified lines | ||
| 463 | 463 | return -EINVAL; |
| 464 | 464 | |
| 465 | 465 | if (PRINT_FIELD(WEIGHT) && |
| 466 | − evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT)) | |
| 466 | + evsel__do_check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT, allow_user_set)) | |
| 467 | 467 | return -EINVAL; |
| 468 | 468 | |
| 469 | 469 | if (PRINT_FIELD(SYM) && |
| @@ -1536,13 +1536,20 @@ static size_t trace__fprintf_tstamp(struct trace *trace, u64 tstamp, FILE *fp) · 1535 unmodified lines | ||
| 1536 | 1536 | return fprintf(fp, " ? "); |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | +static pid_t workload_pid = -1; | |
| 1539 | 1540 | static bool done = false; |
| 1540 | 1541 | static bool interrupted = false; |
| 1541 | 1542 | |
| 1542 | −static void sig_handler(int sig) | |
| 1543 | +static void sighandler_interrupt(int sig __maybe_unused) | |
| 1543 | 1544 | { |
| 1544 | − done = true; | |
| 1545 | − interrupted = sig == SIGINT; | |
| 1545 | + done = interrupted = true; | |
| 1546 | +} | |
| 1547 | + | |
| 1548 | +static void sighandler_chld(int sig __maybe_unused, siginfo_t *info, | |
| 1549 | + void *context __maybe_unused) | |
| 1550 | +{ | |
| 1551 | + if (info->si_pid == workload_pid) | |
| 1552 | + done = true; | |
| 1546 | 1553 | } |
| 1547 | 1554 | |
| 1548 | 1555 | static size_t trace__fprintf_comm_tid(struct trace *trace, struct thread *thread, FILE *fp) |
| @@ -3938,7 +3945,6 @@ static int trace__run(struct trace *trace, int argc, const char **argv) · 2389 unmodified lines | ||
| 3938 | 3945 | bool draining = false; |
| 3939 | 3946 | |
| 3940 | 3947 | trace->live = true; |
| 3941 | − signal(SIGCHLD, sig_handler); | |
| 3942 | 3948 | |
| 3943 | 3949 | if (!trace->raw_augmented_syscalls) { |
| 3944 | 3950 | if (trace->trace_syscalls && trace__add_syscall_newtp(trace)) |
| @@ -4018,6 +4024,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) · 73 unmodified lines | ||
| 4018 | 4024 | fprintf(trace->output, "Couldn't run the workload!\n"); |
| 4019 | 4025 | goto out_delete_evlist; |
| 4020 | 4026 | } |
| 4027 | + workload_pid = evlist->workload.pid; | |
| 4021 | 4028 | } |
| 4022 | 4029 | |
| 4023 | 4030 | err = evlist__open(evlist); |
| @@ -4887,10 +4894,16 @@ int cmd_trace(int argc, const char **argv) · 863 unmodified lines | ||
| 4887 | 4894 | const char * const trace_subcommands[] = { "record", NULL }; |
| 4888 | 4895 | int err = -1; |
| 4889 | 4896 | char bf[BUFSIZ]; |
| 4897 | + struct sigaction sigchld_act; | |
| 4890 | 4898 | |
| 4891 | 4899 | signal(SIGSEGV, sighandler_dump_stack); |
| 4892 | 4900 | signal(SIGFPE, sighandler_dump_stack); |
| 4893 | − signal(SIGINT, sig_handler); | |
| 4901 | + signal(SIGINT, sighandler_interrupt); | |
| 4902 | + | |
| 4903 | + memset(&sigchld_act, 0, sizeof(sigchld_act)); | |
| 4904 | + sigchld_act.sa_flags = SA_SIGINFO; | |
| 4905 | + sigchld_act.sa_sigaction = sighandler_chld; | |
| 4906 | + sigaction(SIGCHLD, &sigchld_act, NULL); | |
| 4894 | 4907 | |
| 4895 | 4908 | trace.evlist = evlist__new(); |
| 4896 | 4909 | trace.sctbl = syscalltbl__new(); |
| @@ -45,8 +45,10 @@ Following tests are defined (with perf commands): · 44 unmodified lines | ||
| 45 | 45 | perf record -d kill (test-record-data) |
| 46 | 46 | perf record -F 100 kill (test-record-freq) |
| 47 | 47 | perf record -g kill (test-record-graph-default) |
| 48 | + perf record -g kill (test-record-graph-default-aarch64) | |
| 48 | 49 | perf record --call-graph dwarf kill (test-record-graph-dwarf) |
| 49 | 50 | perf record --call-graph fp kill (test-record-graph-fp) |
| 51 | + perf record --call-graph fp kill (test-record-graph-fp-aarch64) | |
| 50 | 52 | perf record --group -e cycles,instructions kill (test-record-group) |
| 51 | 53 | perf record -e '{cycles,instructions}' kill (test-record-group1) |
| 52 | 54 | perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2) |
| @@ -2,6 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | command = record |
| 3 | 3 | args = --no-bpf-event -g kill >/dev/null 2>&1 |
| 4 | 4 | ret = 1 |
| 5 | +# arm64 enables registers in the default mode (fp) | |
| 6 | +arch = !aarch64 | |
| 5 | 7 | |
| 6 | 8 | [event:base-record] |
| 7 | 9 | sample_type=295 |
| @@ -0,0 +1,9 @@ | ||
| 1 | +[config] | |
| 2 | +command = record | |
| 3 | +args = --no-bpf-event -g kill >/dev/null 2>&1 | |
| 4 | +ret = 1 | |
| 5 | +arch = aarch64 | |
| 6 | + | |
| 7 | +[event:base-record] | |
| 8 | +sample_type=4391 | |
| 9 | +sample_regs_user=1073741824 | |
| @@ -2,6 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | command = record |
| 3 | 3 | args = --no-bpf-event --call-graph fp kill >/dev/null 2>&1 |
| 4 | 4 | ret = 1 |
| 5 | +# arm64 enables registers in fp mode | |
| 6 | +arch = !aarch64 | |
| 5 | 7 | |
| 6 | 8 | [event:base-record] |
| 7 | 9 | sample_type=295 |
| @@ -0,0 +1,9 @@ | ||
| 1 | +[config] | |
| 2 | +command = record | |
| 3 | +args = --no-bpf-event --call-graph fp kill >/dev/null 2>&1 | |
| 4 | +ret = 1 | |
| 5 | +arch = aarch64 | |
| 6 | + | |
| 7 | +[event:base-record] | |
| 8 | +sample_type=4391 | |
| 9 | +sample_regs_user=1073741824 | |
| @@ -22,19 +22,6 @@ · 21 unmodified lines | ||
| 22 | 22 | #include "tests.h" |
| 23 | 23 | #include "../perf-sys.h" |
| 24 | 24 | |
| 25 | −/* | |
| 26 | − * PowerPC and S390 do not support creation of instruction breakpoints using the | |
| 27 | − * perf_event interface. | |
| 28 | − * | |
| 29 | − * Just disable the test for these architectures until these issues are | |
| 30 | − * resolved. | |
| 31 | − */ | |
| 32 | −#if defined(__powerpc__) || defined(__s390x__) | |
| 33 | −#define BP_ACCOUNT_IS_SUPPORTED 0 | |
| 34 | −#else | |
| 35 | −#define BP_ACCOUNT_IS_SUPPORTED 1 | |
| 36 | −#endif | |
| 37 | − | |
| 38 | 25 | #define NUM_THREADS 5 |
| 39 | 26 | |
| 40 | 27 | static struct { |
| @@ -135,7 +122,7 @@ static int test__sigtrap(struct test_suite *test __maybe_unused, int subtest __m · 94 unmodified lines | ||
| 135 | 122 | char sbuf[STRERR_BUFSIZE]; |
| 136 | 123 | int i, fd, ret = TEST_FAIL; |
| 137 | 124 | |
| 138 | − if (!BP_ACCOUNT_IS_SUPPORTED) { | |
| 125 | + if (!BP_SIGNAL_IS_SUPPORTED) { | |
| 139 | 126 | pr_debug("Test not supported on this architecture"); |
| 140 | 127 | return TEST_SKIP; |
| 141 | 128 | } |
| @@ -1220,9 +1220,10 @@ bpf__obj_config_map(struct bpf_object *obj, · 1219 unmodified lines | ||
| 1220 | 1220 | pr_debug("ERROR: Invalid map config option '%s'\n", map_opt); |
| 1221 | 1221 | err = -BPF_LOADER_ERRNO__OBJCONF_MAP_OPT; |
| 1222 | 1222 | out: |
| 1223 | − free(map_name); | |
| 1224 | 1223 | if (!err) |
| 1225 | 1224 | *key_scan_pos += strlen(map_opt); |
| 1225 | + | |
| 1226 | + free(map_name); | |
| 1226 | 1227 | return err; |
| 1227 | 1228 | } |
| 1228 | 1229 | |
| @@ -50,8 +50,6 @@ struct cs_etm_auxtrace { · 49 unmodified lines | ||
| 50 | 50 | u8 timeless_decoding; |
| 51 | 51 | u8 snapshot_mode; |
| 52 | 52 | u8 data_queued; |
| 53 | − u8 sample_branches; | |
| 54 | − u8 sample_instructions; | |
| 55 | 53 | |
| 56 | 54 | int num_cpu; |
| 57 | 55 | u64 latest_kernel_timestamp; |
| @@ -410,8 +408,8 @@ static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm, · 352 unmodified lines | ||
| 410 | 408 | { |
| 411 | 409 | struct cs_etm_packet *tmp; |
| 412 | 410 | |
| 413 | − if (etm->sample_branches || etm->synth_opts.last_branch || | |
| 414 | − etm->sample_instructions) { | |
| 411 | + if (etm->synth_opts.branches || etm->synth_opts.last_branch || | |
| 412 | + etm->synth_opts.instructions) { | |
| 415 | 413 | /* |
| 416 | 414 | * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for |
| 417 | 415 | * the next incoming packet. |
| @@ -1365,7 +1363,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · 947 unmodified lines | ||
| 1365 | 1363 | err = cs_etm__synth_event(session, &attr, id); |
| 1366 | 1364 | if (err) |
| 1367 | 1365 | return err; |
| 1368 | − etm->sample_branches = true; | |
| 1369 | 1366 | etm->branches_sample_type = attr.sample_type; |
| 1370 | 1367 | etm->branches_id = id; |
| 1371 | 1368 | id += 1; |
| @@ -1389,7 +1386,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · 17 unmodified lines | ||
| 1389 | 1386 | err = cs_etm__synth_event(session, &attr, id); |
| 1390 | 1387 | if (err) |
| 1391 | 1388 | return err; |
| 1392 | − etm->sample_instructions = true; | |
| 1393 | 1389 | etm->instructions_sample_type = attr.sample_type; |
| 1394 | 1390 | etm->instructions_id = id; |
| 1395 | 1391 | id += 1; |
| @@ -1420,7 +1416,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, · 24 unmodified lines | ||
| 1420 | 1416 | tidq->prev_packet->last_instr_taken_branch) |
| 1421 | 1417 | cs_etm__update_last_branch_rb(etmq, tidq); |
| 1422 | 1418 | |
| 1423 | − if (etm->sample_instructions && | |
| 1419 | + if (etm->synth_opts.instructions && | |
| 1424 | 1420 | tidq->period_instructions >= etm->instructions_sample_period) { |
| 1425 | 1421 | /* |
| 1426 | 1422 | * Emit instruction sample periodically |
| @@ -1503,7 +1499,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, · 76 unmodified lines | ||
| 1503 | 1499 | } |
| 1504 | 1500 | } |
| 1505 | 1501 | |
| 1506 | − if (etm->sample_branches) { | |
| 1502 | + if (etm->synth_opts.branches) { | |
| 1507 | 1503 | bool generate_sample = false; |
| 1508 | 1504 | |
| 1509 | 1505 | /* Generate sample for tracing on packet */ |
| @@ -1557,6 +1553,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, · 47 unmodified lines | ||
| 1557 | 1553 | goto swap_packet; |
| 1558 | 1554 | |
| 1559 | 1555 | if (etmq->etm->synth_opts.last_branch && |
| 1556 | + etmq->etm->synth_opts.instructions && | |
| 1560 | 1557 | tidq->prev_packet->sample_type == CS_ETM_RANGE) { |
| 1561 | 1558 | u64 addr; |
| 1562 | 1559 | |
| @@ -1582,7 +1579,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, · 19 unmodified lines | ||
| 1582 | 1579 | |
| 1583 | 1580 | } |
| 1584 | 1581 | |
| 1585 | − if (etm->sample_branches && | |
| 1582 | + if (etm->synth_opts.branches && | |
| 1586 | 1583 | tidq->prev_packet->sample_type == CS_ETM_RANGE) { |
| 1587 | 1584 | err = cs_etm__synth_branch_sample(etmq, tidq); |
| 1588 | 1585 | if (err) |
| @@ -1614,6 +1611,7 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq, · 25 unmodified lines | ||
| 1614 | 1611 | * the trace. |
| 1615 | 1612 | */ |
| 1616 | 1613 | if (etmq->etm->synth_opts.last_branch && |
| 1614 | + etmq->etm->synth_opts.instructions && | |
| 1617 | 1615 | tidq->prev_packet->sample_type == CS_ETM_RANGE) { |
| 1618 | 1616 | u64 addr; |
| 1619 | 1617 | |
| @@ -44,10 +44,6 @@ int perf_data__create_dir(struct perf_data *data, int nr) · 43 unmodified lines | ||
| 44 | 44 | if (!files) |
| 45 | 45 | return -ENOMEM; |
| 46 | 46 | |
| 47 | − data->dir.version = PERF_DIR_VERSION; | |
| 48 | − data->dir.files = files; | |
| 49 | − data->dir.nr = nr; | |
| 50 | − | |
| 51 | 47 | for (i = 0; i < nr; i++) { |
| 52 | 48 | struct perf_data_file *file = &files[i]; |
| 53 | 49 | |
| @@ -62,6 +58,9 @@ int perf_data__create_dir(struct perf_data *data, int nr) · 8 unmodified lines | ||
| 62 | 58 | file->fd = ret; |
| 63 | 59 | } |
| 64 | 60 | |
| 61 | + data->dir.version = PERF_DIR_VERSION; | |
| 62 | + data->dir.files = files; | |
| 63 | + data->dir.nr = nr; | |
| 65 | 64 | return 0; |
| 66 | 65 | |
| 67 | 66 | out_err: |
| @@ -154,8 +154,8 @@ int evlist__fix_hybrid_cpus(struct evlist *evlist, const char *cpu_list) · 153 unmodified lines | ||
| 154 | 154 | perf_cpu_map__put(matched_cpus); |
| 155 | 155 | perf_cpu_map__put(unmatched_cpus); |
| 156 | 156 | } |
| 157 | − | |
| 158 | − ret = (unmatched_count == events_nr) ? -1 : 0; | |
| 157 | + if (events_nr) | |
| 158 | + ret = (unmatched_count == events_nr) ? -1 : 0; | |
| 159 | 159 | out: |
| 160 | 160 | perf_cpu_map__put(cpus); |
| 161 | 161 | return ret; |
| @@ -0,0 +1,32 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +#include <test_progs.h> | |
| 3 | +#include "timer_crash.skel.h" | |
| 4 | + | |
| 5 | +enum { | |
| 6 | + MODE_ARRAY, | |
| 7 | + MODE_HASH, | |
| 8 | +}; | |
| 9 | + | |
| 10 | +static void test_timer_crash_mode(int mode) | |
| 11 | +{ | |
| 12 | + struct timer_crash *skel; | |
| 13 | + | |
| 14 | + skel = timer_crash__open_and_load(); | |
| 15 | + if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load")) | |
| 16 | + return; | |
| 17 | + skel->bss->pid = getpid(); | |
| 18 | + skel->bss->crash_map = mode; | |
| 19 | + if (!ASSERT_OK(timer_crash__attach(skel), "timer_crash__attach")) | |
| 20 | + goto end; | |
| 21 | + usleep(1); | |
| 22 | +end: | |
| 23 | + timer_crash__destroy(skel); | |
| 24 | +} | |
| 25 | + | |
| 26 | +void test_timer_crash(void) | |
| 27 | +{ | |
| 28 | + if (test__start_subtest("array")) | |
| 29 | + test_timer_crash_mode(MODE_ARRAY); | |
| 30 | + if (test__start_subtest("hash")) | |
| 31 | + test_timer_crash_mode(MODE_HASH); | |
| 32 | +} | |
| @@ -235,7 +235,7 @@ SEC("sk_msg1") · 234 unmodified lines | ||
| 235 | 235 | int bpf_prog4(struct sk_msg_md *msg) |
| 236 | 236 | { |
| 237 | 237 | int *bytes, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5; |
| 238 | − int *start, *end, *start_push, *end_push, *start_pop, *pop; | |
| 238 | + int *start, *end, *start_push, *end_push, *start_pop, *pop, err = 0; | |
| 239 | 239 | |
| 240 | 240 | bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero); |
| 241 | 241 | if (bytes) |
| @@ -249,8 +249,11 @@ int bpf_prog4(struct sk_msg_md *msg) · 7 unmodified lines | ||
| 249 | 249 | bpf_msg_pull_data(msg, *start, *end, 0); |
| 250 | 250 | start_push = bpf_map_lookup_elem(&sock_bytes, &two); |
| 251 | 251 | end_push = bpf_map_lookup_elem(&sock_bytes, &three); |
| 252 | − if (start_push && end_push) | |
| 253 | − bpf_msg_push_data(msg, *start_push, *end_push, 0); | |
| 252 | + if (start_push && end_push) { | |
| 253 | + err = bpf_msg_push_data(msg, *start_push, *end_push, 0); | |
| 254 | + if (err) | |
| 255 | + return SK_DROP; | |
| 256 | + } | |
| 254 | 257 | start_pop = bpf_map_lookup_elem(&sock_bytes, &four); |
| 255 | 258 | pop = bpf_map_lookup_elem(&sock_bytes, &five); |
| 256 | 259 | if (start_pop && pop) |
| @@ -263,6 +266,7 @@ int bpf_prog6(struct sk_msg_md *msg) · 6 unmodified lines | ||
| 263 | 266 | { |
| 264 | 267 | int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, key = 0; |
| 265 | 268 | int *bytes, *start, *end, *start_push, *end_push, *start_pop, *pop, *f; |
| 269 | + int err = 0; | |
| 266 | 270 | __u64 flags = 0; |
| 267 | 271 | |
| 268 | 272 | bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero); |
| @@ -279,8 +283,11 @@ int bpf_prog6(struct sk_msg_md *msg) · 10 unmodified lines | ||
| 279 | 283 | |
| 280 | 284 | start_push = bpf_map_lookup_elem(&sock_bytes, &two); |
| 281 | 285 | end_push = bpf_map_lookup_elem(&sock_bytes, &three); |
| 282 | − if (start_push && end_push) | |
| 283 | − bpf_msg_push_data(msg, *start_push, *end_push, 0); | |
| 286 | + if (start_push && end_push) { | |
| 287 | + err = bpf_msg_push_data(msg, *start_push, *end_push, 0); | |
| 288 | + if (err) | |
| 289 | + return SK_DROP; | |
| 290 | + } | |
| 284 | 291 | |
| 285 | 292 | start_pop = bpf_map_lookup_elem(&sock_bytes, &four); |
| 286 | 293 | pop = bpf_map_lookup_elem(&sock_bytes, &five); |
| @@ -338,7 +345,7 @@ SEC("sk_msg5") · 51 unmodified lines | ||
| 338 | 345 | int bpf_prog10(struct sk_msg_md *msg) |
| 339 | 346 | { |
| 340 | 347 | int *bytes, *start, *end, *start_push, *end_push, *start_pop, *pop; |
| 341 | − int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5; | |
| 348 | + int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, err = 0; | |
| 342 | 349 | |
| 343 | 350 | bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero); |
| 344 | 351 | if (bytes) |
| @@ -352,8 +359,11 @@ int bpf_prog10(struct sk_msg_md *msg) · 7 unmodified lines | ||
| 352 | 359 | bpf_msg_pull_data(msg, *start, *end, 0); |
| 353 | 360 | start_push = bpf_map_lookup_elem(&sock_bytes, &two); |
| 354 | 361 | end_push = bpf_map_lookup_elem(&sock_bytes, &three); |
| 355 | − if (start_push && end_push) | |
| 356 | − bpf_msg_push_data(msg, *start_push, *end_push, 0); | |
| 362 | + if (start_push && end_push) { | |
| 363 | + err = bpf_msg_push_data(msg, *start_push, *end_push, 0); | |
| 364 | + if (err) | |
| 365 | + return SK_PASS; | |
| 366 | + } | |
| 357 | 367 | start_pop = bpf_map_lookup_elem(&sock_bytes, &four); |
| 358 | 368 | pop = bpf_map_lookup_elem(&sock_bytes, &five); |
| 359 | 369 | if (start_pop && pop) |
| @@ -0,0 +1,54 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | + | |
| 3 | +#include <vmlinux.h> | |
| 4 | +#include <bpf/bpf_tracing.h> | |
| 5 | +#include <bpf/bpf_helpers.h> | |
| 6 | + | |
| 7 | +struct map_elem { | |
| 8 | + struct bpf_timer timer; | |
| 9 | + struct bpf_spin_lock lock; | |
| 10 | +}; | |
| 11 | + | |
| 12 | +struct { | |
| 13 | + __uint(type, BPF_MAP_TYPE_ARRAY); | |
| 14 | + __uint(max_entries, 1); | |
| 15 | + __type(key, int); | |
| 16 | + __type(value, struct map_elem); | |
| 17 | +} amap SEC(".maps"); | |
| 18 | + | |
| 19 | +struct { | |
| 20 | + __uint(type, BPF_MAP_TYPE_HASH); | |
| 21 | + __uint(max_entries, 1); | |
| 22 | + __type(key, int); | |
| 23 | + __type(value, struct map_elem); | |
| 24 | +} hmap SEC(".maps"); | |
| 25 | + | |
| 26 | +int pid = 0; | |
| 27 | +int crash_map = 0; /* 0 for amap, 1 for hmap */ | |
| 28 | + | |
| 29 | +SEC("fentry/do_nanosleep") | |
| 30 | +int sys_enter(void *ctx) | |
| 31 | +{ | |
| 32 | + struct map_elem *e, value = {}; | |
| 33 | + void *map = crash_map ? (void *)&hmap : (void *)&amap; | |
| 34 | + | |
| 35 | + if (bpf_get_current_task_btf()->tgid != pid) | |
| 36 | + return 0; | |
| 37 | + | |
| 38 | + *(void **)&value = (void *)0xdeadcaf3; | |
| 39 | + | |
| 40 | + bpf_map_update_elem(map, &(int){0}, &value, 0); | |
| 41 | + /* For array map, doing bpf_map_update_elem will do a | |
| 42 | + * check_and_free_timer_in_array, which will trigger the crash if timer | |
| 43 | + * pointer was overwritten, for hmap we need to use bpf_timer_cancel. | |
| 44 | + */ | |
| 45 | + if (crash_map == 1) { | |
| 46 | + e = bpf_map_lookup_elem(map, &(int){0}); | |
| 47 | + if (!e) | |
| 48 | + return 0; | |
| 49 | + bpf_timer_cancel(&e->timer); | |
| 50 | + } | |
| 51 | + return 0; | |
| 52 | +} | |
| 53 | + | |
| 54 | +char _license[] SEC("license") = "GPL"; | |
| @@ -3,8 +3,8 @@ CFLAGS = -Wall · 2 unmodified lines | ||
| 3 | 3 | CFLAGS += -Wno-nonnull |
| 4 | 4 | CFLAGS += -D_GNU_SOURCE |
| 5 | 5 | |
| 6 | −TEST_PROGS := binfmt_script non-regular | |
| 7 | −TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 | |
| 6 | +TEST_PROGS := binfmt_script | |
| 7 | +TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular | |
| 8 | 8 | TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir |
| 9 | 9 | # Makefile is a run-time dependency, since it's accessed by the execveat test |
| 10 | 10 | TEST_FILES := Makefile |
| @@ -19,7 +19,7 @@ fail() { # mesg · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | FILTER=set_ftrace_filter |
| 21 | 21 | FUNC1="schedule" |
| 22 | −FUNC2="do_softirq" | |
| 22 | +FUNC2="scheduler_tick" | |
| 23 | 23 | |
| 24 | 24 | ALL_FUNCS="#### all functions enabled ####" |
| 25 | 25 | |
| @@ -82,7 +82,6 @@ TEST_GEN_PROGS_x86_64 += x86_64/tsc_msrs_test · 81 unmodified lines | ||
| 82 | 82 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_msrs_test |
| 83 | 83 | TEST_GEN_PROGS_x86_64 += x86_64/xen_shinfo_test |
| 84 | 84 | TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test |
| 85 | −TEST_GEN_PROGS_x86_64 += x86_64/vmx_pi_mmio_test | |
| 86 | 85 | TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests |
| 87 | 86 | TEST_GEN_PROGS_x86_64 += x86_64/amx_test |
| 88 | 87 | TEST_GEN_PROGS_x86_64 += access_tracking_perf_test |
| @@ -455,6 +455,7 @@ static void mfd_fail_write(int fd) · 454 unmodified lines | ||
| 455 | 455 | printf("mmap()+mprotect() didn't fail as expected\n"); |
| 456 | 456 | abort(); |
| 457 | 457 | } |
| 458 | + munmap(p, mfd_def_size); | |
| 458 | 459 | } |
| 459 | 460 | |
| 460 | 461 | /* verify PUNCH_HOLE fails */ |
| @@ -1236,7 +1236,7 @@ static int get_userns_fd(unsigned long nsid, unsigned long hostid, unsigned long · 1235 unmodified lines | ||
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | /** |
| 1239 | − * Validate that an attached mount in our mount namespace can be idmapped. | |
| 1239 | + * Validate that an attached mount in our mount namespace cannot be idmapped. | |
| 1240 | 1240 | * (The kernel enforces that the mount's mount namespace and the caller's mount |
| 1241 | 1241 | * namespace match.) |
| 1242 | 1242 | */ |
| @@ -1259,7 +1259,7 @@ TEST_F(mount_setattr_idmapped, attached_mount_inside_current_mount_namespace) · 16 unmodified lines | ||
| 1259 | 1259 | |
| 1260 | 1260 | attr.userns_fd = get_userns_fd(0, 10000, 10000); |
| 1261 | 1261 | ASSERT_GE(attr.userns_fd, 0); |
| 1262 | − ASSERT_EQ(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0); | |
| 1262 | + ASSERT_NE(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0); | |
| 1263 | 1263 | ASSERT_EQ(close(attr.userns_fd), 0); |
| 1264 | 1264 | ASSERT_EQ(close(open_tree_fd), 0); |
| 1265 | 1265 | } |
| @@ -71,6 +71,36 @@ chk_msk_remote_key_nr() · 70 unmodified lines | ||
| 71 | 71 | __chk_nr "grep -c remote_key" $* |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | +# $1: ns, $2: port | |
| 75 | +wait_local_port_listen() | |
| 76 | +{ | |
| 77 | + local listener_ns="${1}" | |
| 78 | + local port="${2}" | |
| 79 | + | |
| 80 | + local port_hex i | |
| 81 | + | |
| 82 | + port_hex="$(printf "%04X" "${port}")" | |
| 83 | + for i in $(seq 10); do | |
| 84 | + ip netns exec "${listener_ns}" cat /proc/net/tcp | \ | |
| 85 | + awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" && | |
| 86 | + break | |
| 87 | + sleep 0.1 | |
| 88 | + done | |
| 89 | +} | |
| 90 | + | |
| 91 | +wait_connected() | |
| 92 | +{ | |
| 93 | + local listener_ns="${1}" | |
| 94 | + local port="${2}" | |
| 95 | + | |
| 96 | + local port_hex i | |
| 97 | + | |
| 98 | + port_hex="$(printf "%04X" "${port}")" | |
| 99 | + for i in $(seq 10); do | |
| 100 | + ip netns exec ${listener_ns} grep -q " 0100007F:${port_hex} " /proc/net/tcp && break | |
| 101 | + sleep 0.1 | |
| 102 | + done | |
| 103 | +} | |
| 74 | 104 | |
| 75 | 105 | trap cleanup EXIT |
| 76 | 106 | ip netns add $ns |
| @@ -81,15 +111,15 @@ echo "a" | \ · 4 unmodified lines | ||
| 81 | 111 | ip netns exec $ns \ |
| 82 | 112 | ./mptcp_connect -p 10000 -l -t ${timeout_poll} \ |
| 83 | 113 | 0.0.0.0 >/dev/null & |
| 84 | −sleep 0.1 | |
| 114 | +wait_local_port_listen $ns 10000 | |
| 85 | 115 | chk_msk_nr 0 "no msk on netns creation" |
| 86 | 116 | |
| 87 | 117 | echo "b" | \ |
| 88 | 118 | timeout ${timeout_test} \ |
| 89 | 119 | ip netns exec $ns \ |
| 90 | − ./mptcp_connect -p 10000 -j -t ${timeout_poll} \ | |
| 120 | + ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} \ | |
| 91 | 121 | 127.0.0.1 >/dev/null & |
| 92 | −sleep 0.1 | |
| 122 | +wait_connected $ns 10000 | |
| 93 | 123 | chk_msk_nr 2 "after MPC handshake " |
| 94 | 124 | chk_msk_remote_key_nr 2 "....chk remote_key" |
| 95 | 125 | chk_msk_fallback_nr 0 "....chk no fallback" |
| @@ -101,13 +131,13 @@ echo "a" | \ · 5 unmodified lines | ||
| 101 | 131 | ip netns exec $ns \ |
| 102 | 132 | ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \ |
| 103 | 133 | 0.0.0.0 >/dev/null & |
| 104 | −sleep 0.1 | |
| 134 | +wait_local_port_listen $ns 10001 | |
| 105 | 135 | echo "b" | \ |
| 106 | 136 | timeout ${timeout_test} \ |
| 107 | 137 | ip netns exec $ns \ |
| 108 | − ./mptcp_connect -p 10001 -j -t ${timeout_poll} \ | |
| 138 | + ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} \ | |
| 109 | 139 | 127.0.0.1 >/dev/null & |
| 110 | −sleep 0.1 | |
| 140 | +wait_connected $ns 10001 | |
| 111 | 141 | chk_msk_fallback_nr 1 "check fallback" |
| 112 | 142 | flush_pids |
| 113 | 143 | |
| @@ -119,7 +149,7 @@ for I in `seq 1 $NR_CLIENTS`; do · 5 unmodified lines | ||
| 119 | 149 | ./mptcp_connect -p $((I+10001)) -l -w 10 \ |
| 120 | 150 | -t ${timeout_poll} 0.0.0.0 >/dev/null & |
| 121 | 151 | done |
| 122 | −sleep 0.1 | |
| 152 | +wait_local_port_listen $ns $((NR_CLIENTS + 10001)) | |
| 123 | 153 | |
| 124 | 154 | for I in `seq 1 $NR_CLIENTS`; do |
| 125 | 155 | echo "b" | \ |
| @@ -660,6 +660,7 @@ chk_join_nr() · 659 unmodified lines | ||
| 660 | 660 | local ack_nr=$4 |
| 661 | 661 | local count |
| 662 | 662 | local dump_stats |
| 663 | + local with_cookie | |
| 663 | 664 | |
| 664 | 665 | printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn" |
| 665 | 666 | count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'` |
| @@ -673,12 +674,20 @@ chk_join_nr() · 7 unmodified lines | ||
| 673 | 674 | fi |
| 674 | 675 | |
| 675 | 676 | echo -n " - synack" |
| 677 | + with_cookie=`ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies` | |
| 676 | 678 | count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | awk '{print $2}'` |
| 677 | 679 | [ -z "$count" ] && count=0 |
| 678 | 680 | if [ "$count" != "$syn_ack_nr" ]; then |
| 679 | − echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr" | |
| 680 | − ret=1 | |
| 681 | − dump_stats=1 | |
| 681 | + # simult connections exceeding the limit with cookie enabled could go up to | |
| 682 | + # synack validation as the conn limit can be enforced reliably only after | |
| 683 | + # the subflow creation | |
| 684 | + if [ "$with_cookie" = 2 ] && [ "$count" -gt "$syn_ack_nr" ] && [ "$count" -le "$syn_nr" ]; then | |
| 685 | + echo -n "[ ok ]" | |
| 686 | + else | |
| 687 | + echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr" | |
| 688 | + ret=1 | |
| 689 | + dump_stats=1 | |
| 690 | + fi | |
| 682 | 691 | else |
| 683 | 692 | echo -n "[ ok ]" |
| 684 | 693 | fi |
| @@ -752,11 +761,17 @@ chk_add_nr() · 67 unmodified lines | ||
| 752 | 761 | local mis_ack_nr=${8:-0} |
| 753 | 762 | local count |
| 754 | 763 | local dump_stats |
| 764 | + local timeout | |
| 765 | + | |
| 766 | + timeout=`ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout` | |
| 755 | 767 | |
| 756 | 768 | printf "%-39s %s" " " "add" |
| 757 | − count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'` | |
| 769 | + count=`ip netns exec $ns2 nstat -as MPTcpExtAddAddr | grep MPTcpExtAddAddr | awk '{print $2}'` | |
| 758 | 770 | [ -z "$count" ] && count=0 |
| 759 | − if [ "$count" != "$add_nr" ]; then | |
| 771 | + | |
| 772 | + # if the test configured a short timeout tolerate greater then expected | |
| 773 | + # add addrs options, due to retransmissions | |
| 774 | + if [ "$count" != "$add_nr" ] && [ "$timeout" -gt 1 -o "$count" -lt "$add_nr" ]; then | |
| 760 | 775 | echo "[fail] got $count ADD_ADDR[s] expected $add_nr" |
| 761 | 776 | ret=1 |
| 762 | 777 | dump_stats=1 |
| @@ -961,7 +976,7 @@ wait_for_tw() · 198 unmodified lines | ||
| 961 | 976 | local ns=$1 |
| 962 | 977 | |
| 963 | 978 | while [ $time -lt $timeout_ms ]; do |
| 964 | − local cnt=$(ip netns exec $ns ss -t state time-wait |wc -l) | |
| 979 | + local cnt=$(ip netns exec $ns nstat -as TcpAttemptFails | grep TcpAttemptFails | awk '{print $2}') | |
| 965 | 980 | |
| 966 | 981 | [ "$cnt" = 1 ] && return 1 |
| 967 | 982 | time=$((time + 100)) |
| @@ -1158,7 +1173,10 @@ signal_address_tests() · 190 unmodified lines | ||
| 1158 | 1173 | ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags signal |
| 1159 | 1174 | ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags signal |
| 1160 | 1175 | ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags signal |
| 1161 | − run_tests $ns1 $ns2 10.0.1.1 | |
| 1176 | + | |
| 1177 | + # the peer could possibly miss some addr notification, allow retransmission | |
| 1178 | + ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1 | |
| 1179 | + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow | |
| 1162 | 1180 | chk_join_nr "signal addresses race test" 3 3 3 |
| 1163 | 1181 | |
| 1164 | 1182 | # the server will not signal the address terminating |
| @@ -6,7 +6,7 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \ · 5 unmodified lines | ||
| 6 | 6 | nft_concat_range.sh nft_conntrack_helper.sh \ |
| 7 | 7 | nft_queue.sh nft_meta.sh nf_nat_edemux.sh \ |
| 8 | 8 | ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \ |
| 9 | − conntrack_vrf.sh | |
| 9 | + conntrack_vrf.sh nft_synproxy.sh | |
| 10 | 10 | |
| 11 | 11 | LDLIBS = -lmnl |
| 12 | 12 | TEST_GEN_FILES = nf-queue |
| @@ -1601,4 +1601,4 @@ for name in ${TESTS}; do · 1600 unmodified lines | ||
| 1601 | 1601 | done |
| 1602 | 1602 | done |
| 1603 | 1603 | |
| 1604 | −[ ${passed} -eq 0 ] && exit ${KSELFTEST_SKIP} | |
| 1604 | +[ ${passed} -eq 0 ] && exit ${KSELFTEST_SKIP} || exit 0 | |
| @@ -174,6 +174,7 @@ test_ping() { · 173 unmodified lines | ||
| 174 | 174 | ip netns exec ${nsrouter} sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
| 175 | 175 | ip netns exec ${nsrouter} sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
| 176 | 176 | ip netns exec ${nsrouter} sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
| 177 | +ip netns exec ${nsrouter} sysctl net.ipv4.conf.veth0.rp_filter=0 > /dev/null | |
| 177 | 178 | |
| 178 | 179 | sleep 3 |
| 179 | 180 | |
| @@ -0,0 +1,117 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | +# | |
| 4 | + | |
| 5 | +# Kselftest framework requirement - SKIP code is 4. | |
| 6 | +ksft_skip=4 | |
| 7 | +ret=0 | |
| 8 | + | |
| 9 | +rnd=$(mktemp -u XXXXXXXX) | |
| 10 | +nsr="nsr-$rnd" # synproxy machine | |
| 11 | +ns1="ns1-$rnd" # iperf client | |
| 12 | +ns2="ns2-$rnd" # iperf server | |
| 13 | + | |
| 14 | +checktool (){ | |
| 15 | + if ! $1 > /dev/null 2>&1; then | |
| 16 | + echo "SKIP: Could not $2" | |
| 17 | + exit $ksft_skip | |
| 18 | + fi | |
| 19 | +} | |
| 20 | + | |
| 21 | +checktool "nft --version" "run test without nft tool" | |
| 22 | +checktool "ip -Version" "run test without ip tool" | |
| 23 | +checktool "iperf3 --version" "run test without iperf3" | |
| 24 | +checktool "ip netns add $nsr" "create net namespace" | |
| 25 | + | |
| 26 | +modprobe -q nf_conntrack | |
| 27 | + | |
| 28 | +ip netns add $ns1 | |
| 29 | +ip netns add $ns2 | |
| 30 | + | |
| 31 | +cleanup() { | |
| 32 | + ip netns pids $ns1 | xargs kill 2>/dev/null | |
| 33 | + ip netns pids $ns2 | xargs kill 2>/dev/null | |
| 34 | + ip netns del $ns1 | |
| 35 | + ip netns del $ns2 | |
| 36 | + | |
| 37 | + ip netns del $nsr | |
| 38 | +} | |
| 39 | + | |
| 40 | +trap cleanup EXIT | |
| 41 | + | |
| 42 | +ip link add veth0 netns $nsr type veth peer name eth0 netns $ns1 | |
| 43 | +ip link add veth1 netns $nsr type veth peer name eth0 netns $ns2 | |
| 44 | + | |
| 45 | +for dev in lo veth0 veth1; do | |
| 46 | +ip -net $nsr link set $dev up | |
| 47 | +done | |
| 48 | + | |
| 49 | +ip -net $nsr addr add 10.0.1.1/24 dev veth0 | |
| 50 | +ip -net $nsr addr add 10.0.2.1/24 dev veth1 | |
| 51 | + | |
| 52 | +ip netns exec $nsr sysctl -q net.ipv4.conf.veth0.forwarding=1 | |
| 53 | +ip netns exec $nsr sysctl -q net.ipv4.conf.veth1.forwarding=1 | |
| 54 | +ip netns exec $nsr sysctl -q net.netfilter.nf_conntrack_tcp_loose=0 | |
| 55 | + | |
| 56 | +for n in $ns1 $ns2; do | |
| 57 | + ip -net $n link set lo up | |
| 58 | + ip -net $n link set eth0 up | |
| 59 | +done | |
| 60 | +ip -net $ns1 addr add 10.0.1.99/24 dev eth0 | |
| 61 | +ip -net $ns2 addr add 10.0.2.99/24 dev eth0 | |
| 62 | +ip -net $ns1 route add default via 10.0.1.1 | |
| 63 | +ip -net $ns2 route add default via 10.0.2.1 | |
| 64 | + | |
| 65 | +# test basic connectivity | |
| 66 | +if ! ip netns exec $ns1 ping -c 1 -q 10.0.2.99 > /dev/null; then | |
| 67 | + echo "ERROR: $ns1 cannot reach $ns2" 1>&2 | |
| 68 | + exit 1 | |
| 69 | +fi | |
| 70 | + | |
| 71 | +if ! ip netns exec $ns2 ping -c 1 -q 10.0.1.99 > /dev/null; then | |
| 72 | + echo "ERROR: $ns2 cannot reach $ns1" 1>&2 | |
| 73 | + exit 1 | |
| 74 | +fi | |
| 75 | + | |
| 76 | +ip netns exec $ns2 iperf3 -s > /dev/null 2>&1 & | |
| 77 | +# ip netns exec $nsr tcpdump -vvv -n -i veth1 tcp | head -n 10 & | |
| 78 | + | |
| 79 | +sleep 1 | |
| 80 | + | |
| 81 | +ip netns exec $nsr nft -f - <<EOF | |
| 82 | +table inet filter { | |
| 83 | + chain prerouting { | |
| 84 | + type filter hook prerouting priority -300; policy accept; | |
| 85 | + meta iif veth0 tcp flags syn counter notrack | |
| 86 | + } | |
| 87 | + | |
| 88 | + chain forward { | |
| 89 | + type filter hook forward priority 0; policy accept; | |
| 90 | + | |
| 91 | + ct state new,established counter accept | |
| 92 | + | |
| 93 | + meta iif veth0 meta l4proto tcp ct state untracked,invalid synproxy mss 1460 sack-perm timestamp | |
| 94 | + | |
| 95 | + ct state invalid counter drop | |
| 96 | + | |
| 97 | + # make ns2 unreachable w.o. tcp synproxy | |
| 98 | + tcp flags syn counter drop | |
| 99 | + } | |
| 100 | +} | |
| 101 | +EOF | |
| 102 | +if [ $? -ne 0 ]; then | |
| 103 | + echo "SKIP: Cannot add nft synproxy" | |
| 104 | + exit $ksft_skip | |
| 105 | +fi | |
| 106 | + | |
| 107 | +ip netns exec $ns1 timeout 5 iperf3 -c 10.0.2.99 -n $((1 * 1024 * 1024)) > /dev/null | |
| 108 | + | |
| 109 | +if [ $? -ne 0 ]; then | |
| 110 | + echo "FAIL: iperf3 returned an error" 1>&2 | |
| 111 | + ret=$? | |
| 112 | + ip netns exec $nsr nft list ruleset | |
| 113 | +else | |
| 114 | + echo "PASS: synproxy connection successful" | |
| 115 | +fi | |
| 116 | + | |
| 117 | +exit $ret | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | −CFLAGS += -Wl,-no-as-needed -Wall | |
| 2 | +CFLAGS += -Wl,-no-as-needed -Wall -isystem ../../../../usr/include/ | |
| 3 | 3 | LDFLAGS += -lpthread |
| 4 | 4 | |
| 5 | 5 | TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark |
| @@ -17,9 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #define MAP_FIXED_NOREPLACE 0x100000 |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | −#define BASE_ADDRESS (256ul * 1024 * 1024) | |
| 21 | − | |
| 22 | − | |
| 23 | 20 | static void dump_maps(void) |
| 24 | 21 | { |
| 25 | 22 | char cmd[32]; |
| @@ -28,18 +25,46 @@ static void dump_maps(void) · 2 unmodified lines | ||
| 28 | 25 | system(cmd); |
| 29 | 26 | } |
| 30 | 27 | |
| 28 | +static unsigned long find_base_addr(unsigned long size) | |
| 29 | +{ | |
| 30 | + void *addr; | |
| 31 | + unsigned long flags; | |
| 32 | + | |
| 33 | + flags = MAP_PRIVATE | MAP_ANONYMOUS; | |
| 34 | + addr = mmap(NULL, size, PROT_NONE, flags, -1, 0); | |
| 35 | + if (addr == MAP_FAILED) { | |
| 36 | + printf("Error: couldn't map the space we need for the test\n"); | |
| 37 | + return 0; | |
| 38 | + } | |
| 39 | + | |
| 40 | + if (munmap(addr, size) != 0) { | |
| 41 | + printf("Error: couldn't map the space we need for the test\n"); | |
| 42 | + return 0; | |
| 43 | + } | |
| 44 | + return (unsigned long)addr; | |
| 45 | +} | |
| 46 | + | |
| 31 | 47 | int main(void) |
| 32 | 48 | { |
| 49 | + unsigned long base_addr; | |
| 33 | 50 | unsigned long flags, addr, size, page_size; |
| 34 | 51 | char *p; |
| 35 | 52 | |
| 36 | 53 | page_size = sysconf(_SC_PAGE_SIZE); |
| 37 | 54 | |
| 55 | + //let's find a base addr that is free before we start the tests | |
| 56 | + size = 5 * page_size; | |
| 57 | + base_addr = find_base_addr(size); | |
| 58 | + if (!base_addr) { | |
| 59 | + printf("Error: couldn't map the space we need for the test\n"); | |
| 60 | + return 1; | |
| 61 | + } | |
| 62 | + | |
| 38 | 63 | flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE; |
| 39 | 64 | |
| 40 | 65 | // Check we can map all the areas we need below |
| 41 | 66 | errno = 0; |
| 42 | − addr = BASE_ADDRESS; | |
| 67 | + addr = base_addr; | |
| 43 | 68 | size = 5 * page_size; |
| 44 | 69 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 45 | 70 | |
| @@ -60,7 +85,7 @@ int main(void) · 14 unmodified lines | ||
| 60 | 85 | printf("unmap() successful\n"); |
| 61 | 86 | |
| 62 | 87 | errno = 0; |
| 63 | − addr = BASE_ADDRESS + page_size; | |
| 88 | + addr = base_addr + page_size; | |
| 64 | 89 | size = 3 * page_size; |
| 65 | 90 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 66 | 91 | printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); |
| @@ -80,7 +105,7 @@ int main(void) · 13 unmodified lines | ||
| 80 | 105 | * +4 | free | new |
| 81 | 106 | */ |
| 82 | 107 | errno = 0; |
| 83 | − addr = BASE_ADDRESS; | |
| 108 | + addr = base_addr; | |
| 84 | 109 | size = 5 * page_size; |
| 85 | 110 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 86 | 111 | printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); |
| @@ -101,7 +126,7 @@ int main(void) · 14 unmodified lines | ||
| 101 | 126 | * +4 | free | |
| 102 | 127 | */ |
| 103 | 128 | errno = 0; |
| 104 | − addr = BASE_ADDRESS + (2 * page_size); | |
| 129 | + addr = base_addr + (2 * page_size); | |
| 105 | 130 | size = page_size; |
| 106 | 131 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 107 | 132 | printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); |
| @@ -121,7 +146,7 @@ int main(void) · 13 unmodified lines | ||
| 121 | 146 | * +4 | free | new |
| 122 | 147 | */ |
| 123 | 148 | errno = 0; |
| 124 | − addr = BASE_ADDRESS + (3 * page_size); | |
| 149 | + addr = base_addr + (3 * page_size); | |
| 125 | 150 | size = 2 * page_size; |
| 126 | 151 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 127 | 152 | printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); |
| @@ -141,7 +166,7 @@ int main(void) · 13 unmodified lines | ||
| 141 | 166 | * +4 | free | |
| 142 | 167 | */ |
| 143 | 168 | errno = 0; |
| 144 | − addr = BASE_ADDRESS; | |
| 169 | + addr = base_addr; | |
| 145 | 170 | size = 2 * page_size; |
| 146 | 171 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 147 | 172 | printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); |
| @@ -161,7 +186,7 @@ int main(void) · 13 unmodified lines | ||
| 161 | 186 | * +4 | free | |
| 162 | 187 | */ |
| 163 | 188 | errno = 0; |
| 164 | − addr = BASE_ADDRESS; | |
| 189 | + addr = base_addr; | |
| 165 | 190 | size = page_size; |
| 166 | 191 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 167 | 192 | printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); |
| @@ -181,7 +206,7 @@ int main(void) · 13 unmodified lines | ||
| 181 | 206 | * +4 | free | new |
| 182 | 207 | */ |
| 183 | 208 | errno = 0; |
| 184 | − addr = BASE_ADDRESS + (4 * page_size); | |
| 209 | + addr = base_addr + (4 * page_size); | |
| 185 | 210 | size = page_size; |
| 186 | 211 | p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); |
| 187 | 212 | printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); |
| @@ -192,7 +217,7 @@ int main(void) · 4 unmodified lines | ||
| 192 | 217 | return 1; |
| 193 | 218 | } |
| 194 | 219 | |
| 195 | − addr = BASE_ADDRESS; | |
| 220 | + addr = base_addr; | |
| 196 | 221 | size = 5 * page_size; |
| 197 | 222 | if (munmap((void *)addr, size) != 0) { |
| 198 | 223 | dump_maps(); |
| @@ -810,7 +810,7 @@ struct osnoise_tool *osnoise_init_trace_tool(char *tracer) · 809 unmodified lines | ||
| 810 | 810 | |
| 811 | 811 | retval = enable_tracer_by_name(trace->trace.inst, tracer); |
| 812 | 812 | if (retval) { |
| 813 | − err_msg("Could not enable osnoiser tracer for tracing\n"); | |
| 813 | + err_msg("Could not enable %s tracer for tracing\n", tracer); | |
| 814 | 814 | goto out_err; |
| 815 | 815 | } |
| 816 | 816 | |
| @@ -426,7 +426,7 @@ static void osnoise_hist_usage(char *usage) · 425 unmodified lines | ||
| 426 | 426 | static const char * const msg[] = { |
| 427 | 427 | "", |
| 428 | 428 | " usage: rtla osnoise hist [-h] [-D] [-d s] [-p us] [-r us] [-s us] [-S us] [-t[=file]] \\", |
| 429 | − " [-c cpu-list] [-P priority] [-b N] [-e N] [--no-header] [--no-summary] \\", | |
| 429 | + " [-c cpu-list] [-P priority] [-b N] [-E N] [--no-header] [--no-summary] \\", | |
| 430 | 430 | " [--no-index] [--with-zeros]", |
| 431 | 431 | "", |
| 432 | 432 | " -h/--help: print this menu", |
| @@ -439,7 +439,7 @@ static void osnoise_hist_usage(char *usage) · 6 unmodified lines | ||
| 439 | 439 | " -D/--debug: print debug info", |
| 440 | 440 | " -t/--trace[=file]: save the stopped trace to [file|osnoise_trace.txt]", |
| 441 | 441 | " -b/--bucket-size N: set the histogram bucket size (default 1)", |
| 442 | − " -e/--entries N: set the number of entries of the histogram (default 256)", | |
| 442 | + " -E/--entries N: set the number of entries of the histogram (default 256)", | |
| 443 | 443 | " --no-header: do not print header", |
| 444 | 444 | " --no-summary: do not print summary", |
| 445 | 445 | " --no-index: do not print index", |
| @@ -486,7 +486,7 @@ static struct osnoise_hist_params · 40 unmodified lines | ||
| 486 | 486 | while (1) { |
| 487 | 487 | static struct option long_options[] = { |
| 488 | 488 | {"bucket-size", required_argument, 0, 'b'}, |
| 489 | − {"entries", required_argument, 0, 'e'}, | |
| 489 | + {"entries", required_argument, 0, 'E'}, | |
| 490 | 490 | {"cpus", required_argument, 0, 'c'}, |
| 491 | 491 | {"debug", no_argument, 0, 'D'}, |
| 492 | 492 | {"duration", required_argument, 0, 'd'}, |
| @@ -507,7 +507,7 @@ static struct osnoise_hist_params · 14 unmodified lines | ||
| 507 | 507 | /* getopt_long stores the option index here. */ |
| 508 | 508 | int option_index = 0; |
| 509 | 509 | |
| 510 | − c = getopt_long(argc, argv, "c:b:d:e:Dhp:P:r:s:S:t::0123", | |
| 510 | + c = getopt_long(argc, argv, "c:b:d:E:Dhp:P:r:s:S:t::0123", | |
| 511 | 511 | long_options, &option_index); |
| 512 | 512 | |
| 513 | 513 | /* detect the end of the options. */ |
| @@ -534,7 +534,7 @@ static struct osnoise_hist_params · 20 unmodified lines | ||
| 534 | 534 | if (!params->duration) |
| 535 | 535 | osnoise_hist_usage("Invalid -D duration\n"); |
| 536 | 536 | break; |
| 537 | − case 'e': | |
| 537 | + case 'E': | |
| 538 | 538 | params->entries = get_llong_from_str(optarg); |
| 539 | 539 | if ((params->entries < 10) || (params->entries > 9999999)) |
| 540 | 540 | osnoise_hist_usage("Entries must be > 10 and < 9999999\n"); |
| @@ -573,6 +573,7 @@ out_top: · 572 unmodified lines | ||
| 573 | 573 | osnoise_free_top(tool->data); |
| 574 | 574 | osnoise_destroy_tool(record); |
| 575 | 575 | osnoise_destroy_tool(tool); |
| 576 | + free(params); | |
| 576 | 577 | out_exit: |
| 577 | 578 | exit(return_value); |
| 578 | 579 | } |
| @@ -429,7 +429,7 @@ static void timerlat_hist_usage(char *usage) · 428 unmodified lines | ||
| 429 | 429 | char *msg[] = { |
| 430 | 430 | "", |
| 431 | 431 | " usage: [rtla] timerlat hist [-h] [-q] [-d s] [-D] [-n] [-p us] [-i us] [-T us] [-s us] [-t[=file]] \\", |
| 432 | − " [-c cpu-list] [-P priority] [-e N] [-b N] [--no-irq] [--no-thread] [--no-header] [--no-summary] \\", | |
| 432 | + " [-c cpu-list] [-P priority] [-E N] [-b N] [--no-irq] [--no-thread] [--no-header] [--no-summary] \\", | |
| 433 | 433 | " [--no-index] [--with-zeros]", |
| 434 | 434 | "", |
| 435 | 435 | " -h/--help: print this menu", |
| @@ -443,7 +443,7 @@ static void timerlat_hist_usage(char *usage) · 7 unmodified lines | ||
| 443 | 443 | " -T/--trace[=file]: save the stopped trace to [file|timerlat_trace.txt]", |
| 444 | 444 | " -n/--nano: display data in nanoseconds", |
| 445 | 445 | " -b/--bucket-size N: set the histogram bucket size (default 1)", |
| 446 | − " -e/--entries N: set the number of entries of the histogram (default 256)", | |
| 446 | + " -E/--entries N: set the number of entries of the histogram (default 256)", | |
| 447 | 447 | " --no-irq: ignore IRQ latencies", |
| 448 | 448 | " --no-thread: ignore thread latencies", |
| 449 | 449 | " --no-header: do not print header", |
| @@ -494,7 +494,7 @@ static struct timerlat_hist_params · 44 unmodified lines | ||
| 494 | 494 | {"cpus", required_argument, 0, 'c'}, |
| 495 | 495 | {"bucket-size", required_argument, 0, 'b'}, |
| 496 | 496 | {"debug", no_argument, 0, 'D'}, |
| 497 | − {"entries", required_argument, 0, 'e'}, | |
| 497 | + {"entries", required_argument, 0, 'E'}, | |
| 498 | 498 | {"duration", required_argument, 0, 'd'}, |
| 499 | 499 | {"help", no_argument, 0, 'h'}, |
| 500 | 500 | {"irq", required_argument, 0, 'i'}, |
| @@ -516,7 +516,7 @@ static struct timerlat_hist_params · 15 unmodified lines | ||
| 516 | 516 | /* getopt_long stores the option index here. */ |
| 517 | 517 | int option_index = 0; |
| 518 | 518 | |
| 519 | − c = getopt_long(argc, argv, "c:b:d:e:Dhi:np:P:s:t::T:012345", | |
| 519 | + c = getopt_long(argc, argv, "c:b:d:E:Dhi:np:P:s:t::T:012345", | |
| 520 | 520 | long_options, &option_index); |
| 521 | 521 | |
| 522 | 522 | /* detect the end of the options. */ |
| @@ -543,7 +543,7 @@ static struct timerlat_hist_params · 20 unmodified lines | ||
| 543 | 543 | if (!params->duration) |
| 544 | 544 | timerlat_hist_usage("Invalid -D duration\n"); |
| 545 | 545 | break; |
| 546 | − case 'e': | |
| 546 | + case 'E': | |
| 547 | 547 | params->entries = get_llong_from_str(optarg); |
| 548 | 548 | if ((params->entries < 10) || (params->entries > 9999999)) |
| 549 | 549 | timerlat_hist_usage("Entries must be > 10 and < 9999999\n"); |
| @@ -5528,9 +5528,7 @@ static int kvm_suspend(void) · 5527 unmodified lines | ||
| 5528 | 5528 | static void kvm_resume(void) |
| 5529 | 5529 | { |
| 5530 | 5530 | if (kvm_usage_count) { |
| 5531 | −#ifdef CONFIG_LOCKDEP | |
| 5532 | − WARN_ON(lockdep_is_held(&kvm_count_lock)); | |
| 5533 | −#endif | |
| 5531 | + lockdep_assert_not_held(&kvm_count_lock); | |
| 5534 | 5532 | hardware_enable_nolock(NULL); |
| 5535 | 5533 | } |
| 5536 | 5534 | } |