Linux 6.9-rc2 This is needed to pull in commit 11763a8598f88 ("fs/9p: fix uaf in in v9fs_stat2inode_dotl"), which fixes the broken virtme. With this fix the media regression tests can be run again without crashing.
Unified · Split
| @@ -340,7 +340,8 @@ Lee Jones <lee@kernel.org> <joneslee@google.com> · 339 unmodified lines | |||
| 340 | Lee Jones <lee@kernel.org> <lee.jones@canonical.com> | 340 | Lee Jones <lee@kernel.org> <lee.jones@canonical.com> |
| 341 | Lee Jones <lee@kernel.org> <lee.jones@linaro.org> | 341 | Lee Jones <lee@kernel.org> <lee.jones@linaro.org> |
| 342 | Lee Jones <lee@kernel.org> <lee@ubuntu.com> | 342 | Lee Jones <lee@kernel.org> <lee@ubuntu.com> |
| 343 | Leonard Crestez <leonard.crestez@nxp.com> Leonard Crestez <cdleonard@gmail.com> | 343 | Leonard Crestez <cdleonard@gmail.com> <leonard.crestez@nxp.com> |
| 344 | Leonard Crestez <cdleonard@gmail.com> <leonard.crestez@intel.com> | ||
| 344 | Leonardo Bras <leobras.c@gmail.com> <leonardo@linux.ibm.com> | 345 | Leonardo Bras <leobras.c@gmail.com> <leonardo@linux.ibm.com> |
| 345 | Leonard Göhrs <l.goehrs@pengutronix.de> | 346 | Leonard Göhrs <l.goehrs@pengutronix.de> |
| 346 | Leonid I Ananiev <leonid.i.ananiev@intel.com> | 347 | Leonid I Ananiev <leonid.i.ananiev@intel.com> |
| @@ -497,7 +498,8 @@ Prasad Sodagudi <quic_psodagud@quicinc.com> <psodagud@codeaurora.org> · 150 unmodified lines | |||
| 497 | Punit Agrawal <punitagrawal@gmail.com> <punit.agrawal@arm.com> | 498 | Punit Agrawal <punitagrawal@gmail.com> <punit.agrawal@arm.com> |
| 498 | Qais Yousef <qyousef@layalina.io> <qais.yousef@imgtec.com> | 499 | Qais Yousef <qyousef@layalina.io> <qais.yousef@imgtec.com> |
| 499 | Qais Yousef <qyousef@layalina.io> <qais.yousef@arm.com> | 500 | Qais Yousef <qyousef@layalina.io> <qais.yousef@arm.com> |
| 500 | Quentin Monnet <quentin@isovalent.com> <quentin.monnet@netronome.com> | 501 | Quentin Monnet <qmo@kernel.org> <quentin.monnet@netronome.com> |
| 502 | Quentin Monnet <qmo@kernel.org> <quentin@isovalent.com> | ||
| 501 | Quentin Perret <qperret@qperret.net> <quentin.perret@arm.com> | 503 | Quentin Perret <qperret@qperret.net> <quentin.perret@arm.com> |
| 502 | Rafael J. Wysocki <rjw@rjwysocki.net> <rjw@sisk.pl> | 504 | Rafael J. Wysocki <rjw@rjwysocki.net> <rjw@sisk.pl> |
| 503 | Rajeev Nandan <quic_rajeevny@quicinc.com> <rajeevny@codeaurora.org> | 505 | Rajeev Nandan <quic_rajeevny@quicinc.com> <rajeevny@codeaurora.org> |
| @@ -574,7 +574,7 @@ Memory b/w domain is L3 cache. · 573 unmodified lines | |||
| 574 | MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;... | 574 | MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;... |
| 575 | 575 | ||
| 576 | Memory bandwidth Allocation specified in MiBps | 576 | Memory bandwidth Allocation specified in MiBps |
| 577 | --------------------------------------------- | 577 | ---------------------------------------------- |
| 578 | 578 | ||
| 579 | Memory bandwidth domain is L3 cache. | 579 | Memory bandwidth domain is L3 cache. |
| 580 | :: | 580 | :: |
| @@ -178,7 +178,7 @@ yet. Bug reports are always welcome at the issue tracker below! · 177 unmodified lines | |||
| 178 | - ``LLVM=1`` | 178 | - ``LLVM=1`` |
| 179 | * - s390 | 179 | * - s390 |
| 180 | - Maintained | 180 | - Maintained |
| 181 | - ``CC=clang`` | 181 | - ``LLVM=1`` (LLVM >= 18.1.0), ``CC=clang`` (LLVM < 18.1.0) |
| 182 | * - um (User Mode) | 182 | * - um (User Mode) |
| 183 | - Maintained | 183 | - Maintained |
| 184 | - ``LLVM=1`` | 184 | - ``LLVM=1`` |
| @@ -3942,8 +3942,7 @@ F: kernel/bpf/ringbuf.c · 3941 unmodified lines | |||
| 3942 | 3942 | ||
| 3943 | BPF [SECURITY & LSM] (Security Audit and Enforcement using BPF) | 3943 | BPF [SECURITY & LSM] (Security Audit and Enforcement using BPF) |
| 3944 | M: KP Singh <kpsingh@kernel.org> | 3944 | M: KP Singh <kpsingh@kernel.org> |
| 3945 | R: Florent Revest <revest@chromium.org> | 3945 | R: Matt Bobrowski <mattbobrowski@google.com> |
| 3946 | R: Brendan Jackman <jackmanb@chromium.org> | ||
| 3947 | L: bpf@vger.kernel.org | 3946 | L: bpf@vger.kernel.org |
| 3948 | S: Maintained | 3947 | S: Maintained |
| 3949 | F: Documentation/bpf/prog_lsm.rst | 3948 | F: Documentation/bpf/prog_lsm.rst |
| @@ -3968,7 +3967,7 @@ F: kernel/bpf/bpf_lru* · 18 unmodified lines | |||
| 3968 | F: kernel/bpf/cgroup.c | 3967 | F: kernel/bpf/cgroup.c |
| 3969 | 3968 | ||
| 3970 | BPF [TOOLING] (bpftool) | 3969 | BPF [TOOLING] (bpftool) |
| 3971 | M: Quentin Monnet <quentin@isovalent.com> | 3970 | M: Quentin Monnet <qmo@kernel.org> |
| 3972 | L: bpf@vger.kernel.org | 3971 | L: bpf@vger.kernel.org |
| 3973 | S: Maintained | 3972 | S: Maintained |
| 3974 | F: kernel/bpf/disasm.* | 3973 | F: kernel/bpf/disasm.* |
| @@ -6157,7 +6156,6 @@ DEVICE-MAPPER (LVM) · 2182 unmodified lines | |||
| 6157 | M: Alasdair Kergon <agk@redhat.com> | 6156 | M: Alasdair Kergon <agk@redhat.com> |
| 6158 | M: Mike Snitzer <snitzer@kernel.org> | 6157 | M: Mike Snitzer <snitzer@kernel.org> |
| 6159 | M: Mikulas Patocka <mpatocka@redhat.com> | 6158 | M: Mikulas Patocka <mpatocka@redhat.com> |
| 6160 | M: dm-devel@lists.linux.dev | ||
| 6161 | L: dm-devel@lists.linux.dev | 6159 | L: dm-devel@lists.linux.dev |
| 6162 | S: Maintained | 6160 | S: Maintained |
| 6163 | Q: http://patchwork.kernel.org/project/dm-devel/list/ | 6161 | Q: http://patchwork.kernel.org/project/dm-devel/list/ |
| @@ -6173,7 +6171,6 @@ F: include/uapi/linux/dm-*.h · 9 unmodified lines | |||
| 6173 | 6171 | ||
| 6174 | DEVICE-MAPPER VDO TARGET | 6172 | DEVICE-MAPPER VDO TARGET |
| 6175 | M: Matthew Sakai <msakai@redhat.com> | 6173 | M: Matthew Sakai <msakai@redhat.com> |
| 6176 | M: dm-devel@lists.linux.dev | ||
| 6177 | L: dm-devel@lists.linux.dev | 6174 | L: dm-devel@lists.linux.dev |
| 6178 | S: Maintained | 6175 | S: Maintained |
| 6179 | F: Documentation/admin-guide/device-mapper/vdo*.rst | 6176 | F: Documentation/admin-guide/device-mapper/vdo*.rst |
| @@ -7941,6 +7938,7 @@ M: Gao Xiang <xiang@kernel.org> · 1761 unmodified lines | |||
| 7941 | M: Chao Yu <chao@kernel.org> | 7938 | M: Chao Yu <chao@kernel.org> |
| 7942 | R: Yue Hu <huyue2@coolpad.com> | 7939 | R: Yue Hu <huyue2@coolpad.com> |
| 7943 | R: Jeffle Xu <jefflexu@linux.alibaba.com> | 7940 | R: Jeffle Xu <jefflexu@linux.alibaba.com> |
| 7941 | R: Sandeep Dhavale <dhavale@google.com> | ||
| 7944 | L: linux-erofs@lists.ozlabs.org | 7942 | L: linux-erofs@lists.ozlabs.org |
| 7945 | S: Maintained | 7943 | S: Maintained |
| 7946 | W: https://erofs.docs.kernel.org | 7944 | W: https://erofs.docs.kernel.org |
| @@ -9653,7 +9651,9 @@ L: linux-input@vger.kernel.org · 1706 unmodified lines | |||
| 9653 | S: Maintained | 9651 | S: Maintained |
| 9654 | F: drivers/hid/hid-logitech-hidpp.c | 9652 | F: drivers/hid/hid-logitech-hidpp.c |
| 9655 | 9653 | ||
| 9656 | HIGH-RESOLUTION TIMERS, CLOCKEVENTS | 9654 | HIGH-RESOLUTION TIMERS, TIMER WHEEL, CLOCKEVENTS |
| 9655 | M: Anna-Maria Behnsen <anna-maria@linutronix.de> | ||
| 9656 | M: Frederic Weisbecker <frederic@kernel.org> | ||
| 9657 | M: Thomas Gleixner <tglx@linutronix.de> | 9657 | M: Thomas Gleixner <tglx@linutronix.de> |
| 9658 | L: linux-kernel@vger.kernel.org | 9658 | L: linux-kernel@vger.kernel.org |
| 9659 | S: Maintained | 9659 | S: Maintained |
| @@ -9661,9 +9661,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core · 1 unmodified line | |||
| 9661 | F: Documentation/timers/ | 9661 | F: Documentation/timers/ |
| 9662 | F: include/linux/clockchips.h | 9662 | F: include/linux/clockchips.h |
| 9663 | F: include/linux/hrtimer.h | 9663 | F: include/linux/hrtimer.h |
| 9664 | F: include/linux/timer.h | ||
| 9664 | F: kernel/time/clockevents.c | 9665 | F: kernel/time/clockevents.c |
| 9665 | F: kernel/time/hrtimer.c | 9666 | F: kernel/time/hrtimer.c |
| 9666 | F: kernel/time/timer_*.c | 9667 | F: kernel/time/timer.c |
| 9668 | F: kernel/time/timer_list.c | ||
| 9669 | F: kernel/time/timer_migration.* | ||
| 9670 | F: tools/testing/selftests/timers/ | ||
| 9667 | 9671 | ||
| 9668 | HIGH-SPEED SCC DRIVER FOR AX.25 | 9672 | HIGH-SPEED SCC DRIVER FOR AX.25 |
| 9669 | L: linux-hams@vger.kernel.org | 9673 | L: linux-hams@vger.kernel.org |
| @@ -13134,6 +13138,7 @@ F: drivers/net/ethernet/marvell/mvpp2/ · 3464 unmodified lines | |||
| 13134 | 13138 | ||
| 13135 | MARVELL MWIFIEX WIRELESS DRIVER | 13139 | MARVELL MWIFIEX WIRELESS DRIVER |
| 13136 | M: Brian Norris <briannorris@chromium.org> | 13140 | M: Brian Norris <briannorris@chromium.org> |
| 13141 | R: Francesco Dolcini <francesco@dolcini.it> | ||
| 13137 | L: linux-wireless@vger.kernel.org | 13142 | L: linux-wireless@vger.kernel.org |
| 13138 | S: Odd Fixes | 13143 | S: Odd Fixes |
| 13139 | F: drivers/net/wireless/marvell/mwifiex/ | 13144 | F: drivers/net/wireless/marvell/mwifiex/ |
| @@ -15627,9 +15632,10 @@ F: drivers/misc/nsm.c · 2487 unmodified lines | |||
| 15627 | F: include/uapi/linux/nsm.h | 15632 | F: include/uapi/linux/nsm.h |
| 15628 | 15633 | ||
| 15629 | NOHZ, DYNTICKS SUPPORT | 15634 | NOHZ, DYNTICKS SUPPORT |
| 15635 | M: Anna-Maria Behnsen <anna-maria@linutronix.de> | ||
| 15630 | M: Frederic Weisbecker <frederic@kernel.org> | 15636 | M: Frederic Weisbecker <frederic@kernel.org> |
| 15631 | M: Thomas Gleixner <tglx@linutronix.de> | ||
| 15632 | M: Ingo Molnar <mingo@kernel.org> | 15637 | M: Ingo Molnar <mingo@kernel.org> |
| 15638 | M: Thomas Gleixner <tglx@linutronix.de> | ||
| 15633 | L: linux-kernel@vger.kernel.org | 15639 | L: linux-kernel@vger.kernel.org |
| 15634 | S: Maintained | 15640 | S: Maintained |
| 15635 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/nohz | 15641 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/nohz |
| @@ -17590,15 +17596,20 @@ F: drivers/pnp/ · 1954 unmodified lines | |||
| 17590 | F: include/linux/pnp.h | 17596 | F: include/linux/pnp.h |
| 17591 | 17597 | ||
| 17592 | POSIX CLOCKS and TIMERS | 17598 | POSIX CLOCKS and TIMERS |
| 17599 | M: Anna-Maria Behnsen <anna-maria@linutronix.de> | ||
| 17600 | M: Frederic Weisbecker <frederic@kernel.org> | ||
| 17593 | M: Thomas Gleixner <tglx@linutronix.de> | 17601 | M: Thomas Gleixner <tglx@linutronix.de> |
| 17594 | L: linux-kernel@vger.kernel.org | 17602 | L: linux-kernel@vger.kernel.org |
| 17595 | S: Maintained | 17603 | S: Maintained |
| 17596 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core | 17604 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core |
| 17597 | F: fs/timerfd.c | 17605 | F: fs/timerfd.c |
| 17598 | F: include/linux/time_namespace.h | 17606 | F: include/linux/time_namespace.h |
| 17599 | F: include/linux/timer* | 17607 | F: include/linux/timerfd.h |
| 17608 | F: include/uapi/linux/time.h | ||
| 17609 | F: include/uapi/linux/timerfd.h | ||
| 17600 | F: include/trace/events/timer* | 17610 | F: include/trace/events/timer* |
| 17601 | F: kernel/time/*timer* | 17611 | F: kernel/time/itimer.c |
| 17612 | F: kernel/time/posix-* | ||
| 17602 | F: kernel/time/namespace.c | 17613 | F: kernel/time/namespace.c |
| 17603 | 17614 | ||
| 17604 | POWER MANAGEMENT CORE | 17615 | POWER MANAGEMENT CORE |
| @@ -18645,18 +18656,21 @@ REALTEK WIRELESS DRIVER (rtlwifi family) · 1040 unmodified lines | |||
| 18645 | M: Ping-Ke Shih <pkshih@realtek.com> | 18656 | M: Ping-Ke Shih <pkshih@realtek.com> |
| 18646 | L: linux-wireless@vger.kernel.org | 18657 | L: linux-wireless@vger.kernel.org |
| 18647 | S: Maintained | 18658 | S: Maintained |
| 18659 | T: git https://github.com/pkshih/rtw.git | ||
| 18648 | F: drivers/net/wireless/realtek/rtlwifi/ | 18660 | F: drivers/net/wireless/realtek/rtlwifi/ |
| 18649 | 18661 | ||
| 18650 | REALTEK WIRELESS DRIVER (rtw88) | 18662 | REALTEK WIRELESS DRIVER (rtw88) |
| 18651 | M: Ping-Ke Shih <pkshih@realtek.com> | 18663 | M: Ping-Ke Shih <pkshih@realtek.com> |
| 18652 | L: linux-wireless@vger.kernel.org | 18664 | L: linux-wireless@vger.kernel.org |
| 18653 | S: Maintained | 18665 | S: Maintained |
| 18666 | T: git https://github.com/pkshih/rtw.git | ||
| 18654 | F: drivers/net/wireless/realtek/rtw88/ | 18667 | F: drivers/net/wireless/realtek/rtw88/ |
| 18655 | 18668 | ||
| 18656 | REALTEK WIRELESS DRIVER (rtw89) | 18669 | REALTEK WIRELESS DRIVER (rtw89) |
| 18657 | M: Ping-Ke Shih <pkshih@realtek.com> | 18670 | M: Ping-Ke Shih <pkshih@realtek.com> |
| 18658 | L: linux-wireless@vger.kernel.org | 18671 | L: linux-wireless@vger.kernel.org |
| 18659 | S: Maintained | 18672 | S: Maintained |
| 18673 | T: git https://github.com/pkshih/rtw.git | ||
| 18660 | F: drivers/net/wireless/realtek/rtw89/ | 18674 | F: drivers/net/wireless/realtek/rtw89/ |
| 18661 | 18675 | ||
| 18662 | REDPINE WIRELESS DRIVER | 18676 | REDPINE WIRELESS DRIVER |
| @@ -18727,13 +18741,24 @@ S: Supported · 64 unmodified lines | |||
| 18727 | F: Documentation/devicetree/bindings/i2c/renesas,iic-emev2.yaml | 18741 | F: Documentation/devicetree/bindings/i2c/renesas,iic-emev2.yaml |
| 18728 | F: drivers/i2c/busses/i2c-emev2.c | 18742 | F: drivers/i2c/busses/i2c-emev2.c |
| 18729 | 18743 | ||
| 18730 | RENESAS ETHERNET DRIVERS | 18744 | RENESAS ETHERNET AVB DRIVER |
| 18731 | R: Sergey Shtylyov <s.shtylyov@omp.ru> | 18745 | R: Sergey Shtylyov <s.shtylyov@omp.ru> |
| 18732 | L: netdev@vger.kernel.org | 18746 | L: netdev@vger.kernel.org |
| 18733 | L: linux-renesas-soc@vger.kernel.org | 18747 | L: linux-renesas-soc@vger.kernel.org |
| 18734 | F: Documentation/devicetree/bindings/net/renesas,*.yaml | 18748 | F: Documentation/devicetree/bindings/net/renesas,etheravb.yaml |
| 18735 | F: drivers/net/ethernet/renesas/ | 18749 | F: drivers/net/ethernet/renesas/Kconfig |
| 18736 | F: include/linux/sh_eth.h | 18750 | F: drivers/net/ethernet/renesas/Makefile |
| 18751 | F: drivers/net/ethernet/renesas/ravb* | ||
| 18752 | |||
| 18753 | RENESAS ETHERNET SWITCH DRIVER | ||
| 18754 | R: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | ||
| 18755 | L: netdev@vger.kernel.org | ||
| 18756 | L: linux-renesas-soc@vger.kernel.org | ||
| 18757 | F: Documentation/devicetree/bindings/net/renesas,*ether-switch.yaml | ||
| 18758 | F: drivers/net/ethernet/renesas/Kconfig | ||
| 18759 | F: drivers/net/ethernet/renesas/Makefile | ||
| 18760 | F: drivers/net/ethernet/renesas/rcar_gen4* | ||
| 18761 | F: drivers/net/ethernet/renesas/rswitch* | ||
| 18737 | 18762 | ||
| 18738 | RENESAS IDT821034 ASoC CODEC | 18763 | RENESAS IDT821034 ASoC CODEC |
| 18739 | M: Herve Codina <herve.codina@bootlin.com> | 18764 | M: Herve Codina <herve.codina@bootlin.com> |
| @@ -18843,6 +18868,16 @@ S: Supported · 103 unmodified lines | |||
| 18843 | F: Documentation/devicetree/bindings/i2c/renesas,rzv2m.yaml | 18868 | F: Documentation/devicetree/bindings/i2c/renesas,rzv2m.yaml |
| 18844 | F: drivers/i2c/busses/i2c-rzv2m.c | 18869 | F: drivers/i2c/busses/i2c-rzv2m.c |
| 18845 | 18870 | ||
| 18871 | RENESAS SUPERH ETHERNET DRIVER | ||
| 18872 | R: Sergey Shtylyov <s.shtylyov@omp.ru> | ||
| 18873 | L: netdev@vger.kernel.org | ||
| 18874 | L: linux-renesas-soc@vger.kernel.org | ||
| 18875 | F: Documentation/devicetree/bindings/net/renesas,ether.yaml | ||
| 18876 | F: drivers/net/ethernet/renesas/Kconfig | ||
| 18877 | F: drivers/net/ethernet/renesas/Makefile | ||
| 18878 | F: drivers/net/ethernet/renesas/sh_eth* | ||
| 18879 | F: include/linux/sh_eth.h | ||
| 18880 | |||
| 18846 | RENESAS USB PHY DRIVER | 18881 | RENESAS USB PHY DRIVER |
| 18847 | M: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 18882 | M: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> |
| 18848 | L: linux-renesas-soc@vger.kernel.org | 18883 | L: linux-renesas-soc@vger.kernel.org |
| @@ -19179,12 +19214,14 @@ M: Hin-Tak Leung <hintak.leung@gmail.com> · 330 unmodified lines | |||
| 19179 | M: Larry Finger <Larry.Finger@lwfinger.net> | 19214 | M: Larry Finger <Larry.Finger@lwfinger.net> |
| 19180 | L: linux-wireless@vger.kernel.org | 19215 | L: linux-wireless@vger.kernel.org |
| 19181 | S: Maintained | 19216 | S: Maintained |
| 19217 | T: git https://github.com/pkshih/rtw.git | ||
| 19182 | F: drivers/net/wireless/realtek/rtl818x/rtl8187/ | 19218 | F: drivers/net/wireless/realtek/rtl818x/rtl8187/ |
| 19183 | 19219 | ||
| 19184 | RTL8XXXU WIRELESS DRIVER (rtl8xxxu) | 19220 | RTL8XXXU WIRELESS DRIVER (rtl8xxxu) |
| 19185 | M: Jes Sorensen <Jes.Sorensen@gmail.com> | 19221 | M: Jes Sorensen <Jes.Sorensen@gmail.com> |
| 19186 | L: linux-wireless@vger.kernel.org | 19222 | L: linux-wireless@vger.kernel.org |
| 19187 | S: Maintained | 19223 | S: Maintained |
| 19224 | T: git https://github.com/pkshih/rtw.git | ||
| 19188 | F: drivers/net/wireless/realtek/rtl8xxxu/ | 19225 | F: drivers/net/wireless/realtek/rtl8xxxu/ |
| 19189 | 19226 | ||
| 19190 | RTRS TRANSPORT DRIVERS | 19227 | RTRS TRANSPORT DRIVERS |
| @@ -22254,13 +22291,20 @@ S: Supported · 3063 unmodified lines | |||
| 22254 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core | 22291 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core |
| 22255 | F: include/linux/clocksource.h | 22292 | F: include/linux/clocksource.h |
| 22256 | F: include/linux/time.h | 22293 | F: include/linux/time.h |
| 22294 | F: include/linux/timekeeper_internal.h | ||
| 22295 | F: include/linux/timekeeping.h | ||
| 22257 | F: include/linux/timex.h | 22296 | F: include/linux/timex.h |
| 22258 | F: include/uapi/linux/time.h | 22297 | F: include/uapi/linux/time.h |
| 22259 | F: include/uapi/linux/timex.h | 22298 | F: include/uapi/linux/timex.h |
| 22260 | F: kernel/time/alarmtimer.c | 22299 | F: kernel/time/alarmtimer.c |
| 22261 | F: kernel/time/clocksource.c | 22300 | F: kernel/time/clocksource* |
| 22262 | F: kernel/time/ntp.c | 22301 | F: kernel/time/ntp* |
| 22263 | F: kernel/time/time*.c | 22302 | F: kernel/time/time.c |
| 22303 | F: kernel/time/timeconst.bc | ||
| 22304 | F: kernel/time/timeconv.c | ||
| 22305 | F: kernel/time/timecounter.c | ||
| 22306 | F: kernel/time/timekeeping* | ||
| 22307 | F: kernel/time/time_test.c | ||
| 22264 | F: tools/testing/selftests/timers/ | 22308 | F: tools/testing/selftests/timers/ |
| 22265 | 22309 | ||
| 22266 | TIPC NETWORK LAYER | 22310 | TIPC NETWORK LAYER |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 6 | 2 | VERSION = 6 |
| 3 | PATCHLEVEL = 9 | 3 | PATCHLEVEL = 9 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc1 | 5 | EXTRAVERSION = -rc2 |
| 6 | NAME = Hurr durr I'ma ninja sloth | 6 | NAME = Hurr durr I'ma ninja sloth |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -0,0 +1,14 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __ASM_MMAN_H__ | ||
| 3 | #define __ASM_MMAN_H__ | ||
| 4 | |||
| 5 | #include <asm/system_info.h> | ||
| 6 | #include <uapi/asm/mman.h> | ||
| 7 | |||
| 8 | static inline bool arch_memory_deny_write_exec_supported(void) | ||
| 9 | { | ||
| 10 | return cpu_architecture() >= CPU_ARCH_ARMv6; | ||
| 11 | } | ||
| 12 | #define arch_memory_deny_write_exec_supported arch_memory_deny_write_exec_supported | ||
| 13 | |||
| 14 | #endif /* __ASM_MMAN_H__ */ | ||
| @@ -943,7 +943,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, · 942 unmodified lines | |||
| 943 | emit(A64_UXTH(is64, dst, dst), ctx); | 943 | emit(A64_UXTH(is64, dst, dst), ctx); |
| 944 | break; | 944 | break; |
| 945 | case 32: | 945 | case 32: |
| 946 | emit(A64_REV32(is64, dst, dst), ctx); | 946 | emit(A64_REV32(0, dst, dst), ctx); |
| 947 | /* upper 32 bits already cleared */ | 947 | /* upper 32 bits already cleared */ |
| 948 | break; | 948 | break; |
| 949 | case 64: | 949 | case 64: |
| @@ -1256,7 +1256,7 @@ emit_cond_jmp: · 306 unmodified lines | |||
| 1256 | } else { | 1256 | } else { |
| 1257 | emit_a64_mov_i(1, tmp, off, ctx); | 1257 | emit_a64_mov_i(1, tmp, off, ctx); |
| 1258 | if (sign_extend) | 1258 | if (sign_extend) |
| 1259 | emit(A64_LDRSW(dst, src_adj, off_adj), ctx); | 1259 | emit(A64_LDRSW(dst, src, tmp), ctx); |
| 1260 | else | 1260 | else |
| 1261 | emit(A64_LDR32(dst, src, tmp), ctx); | 1261 | emit(A64_LDR32(dst, src, tmp), ctx); |
| 1262 | } | 1262 | } |
| @@ -63,6 +63,7 @@ SECTIONS · 62 unmodified lines | |||
| 63 | STABS_DEBUG | 63 | STABS_DEBUG |
| 64 | DWARF_DEBUG | 64 | DWARF_DEBUG |
| 65 | ELF_DETAILS | 65 | ELF_DETAILS |
| 66 | .hexagon.attributes 0 : { *(.hexagon.attributes) } | ||
| 66 | 67 | ||
| 67 | DISCARDS | 68 | DISCARDS |
| 68 | } | 69 | } |
| @@ -619,15 +619,6 @@ config MACH_EYEQ5 · 618 unmodified lines | |||
| 619 | 619 | ||
| 620 | bool | 620 | bool |
| 621 | 621 | ||
| 622 | config FIT_IMAGE_FDT_EPM5 | ||
| 623 | bool "Include FDT for Mobileye EyeQ5 development platforms" | ||
| 624 | depends on MACH_EYEQ5 | ||
| 625 | default n | ||
| 626 | help | ||
| 627 | Enable this to include the FDT for the EyeQ5 development platforms | ||
| 628 | from Mobileye in the FIT kernel image. | ||
| 629 | This requires u-boot on the platform. | ||
| 630 | |||
| 631 | config MACH_NINTENDO64 | 622 | config MACH_NINTENDO64 |
| 632 | bool "Nintendo 64 console" | 623 | bool "Nintendo 64 console" |
| 633 | select CEVT_R4K | 624 | select CEVT_R4K |
| @@ -1011,6 +1002,15 @@ config CAVIUM_OCTEON_SOC · 377 unmodified lines | |||
| 1011 | 1002 | ||
| 1012 | endchoice | 1003 | endchoice |
| 1013 | 1004 | ||
| 1005 | config FIT_IMAGE_FDT_EPM5 | ||
| 1006 | bool "Include FDT for Mobileye EyeQ5 development platforms" | ||
| 1007 | depends on MACH_EYEQ5 | ||
| 1008 | default n | ||
| 1009 | help | ||
| 1010 | Enable this to include the FDT for the EyeQ5 development platforms | ||
| 1011 | from Mobileye in the FIT kernel image. | ||
| 1012 | This requires u-boot on the platform. | ||
| 1013 | |||
| 1014 | source "arch/mips/alchemy/Kconfig" | 1014 | source "arch/mips/alchemy/Kconfig" |
| 1015 | source "arch/mips/ath25/Kconfig" | 1015 | source "arch/mips/ath25/Kconfig" |
| 1016 | source "arch/mips/ath79/Kconfig" | 1016 | source "arch/mips/ath79/Kconfig" |
| @@ -0,0 +1,14 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __ASM_MMAN_H__ | ||
| 3 | #define __ASM_MMAN_H__ | ||
| 4 | |||
| 5 | #include <uapi/asm/mman.h> | ||
| 6 | |||
| 7 | /* PARISC cannot allow mdwe as it needs writable stacks */ | ||
| 8 | static inline bool arch_memory_deny_write_exec_supported(void) | ||
| 9 | { | ||
| 10 | return false; | ||
| 11 | } | ||
| 12 | #define arch_memory_deny_write_exec_supported arch_memory_deny_write_exec_supported | ||
| 13 | |||
| 14 | #endif /* __ASM_MMAN_H__ */ | ||
| @@ -1463,6 +1463,22 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx, · 1462 unmodified lines | |||
| 1463 | if (ret < 0) | 1463 | if (ret < 0) |
| 1464 | return ret; | 1464 | return ret; |
| 1465 | 1465 | ||
| 1466 | if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL) { | ||
| 1467 | const struct btf_func_model *fm; | ||
| 1468 | int idx; | ||
| 1469 | |||
| 1470 | fm = bpf_jit_find_kfunc_model(ctx->prog, insn); | ||
| 1471 | if (!fm) | ||
| 1472 | return -EINVAL; | ||
| 1473 | |||
| 1474 | for (idx = 0; idx < fm->nr_args; idx++) { | ||
| 1475 | u8 reg = bpf_to_rv_reg(BPF_REG_1 + idx, ctx); | ||
| 1476 | |||
| 1477 | if (fm->arg_size[idx] == sizeof(int)) | ||
| 1478 | emit_sextw(reg, reg, ctx); | ||
| 1479 | } | ||
| 1480 | } | ||
| 1481 | |||
| 1466 | ret = emit_call(addr, fixed_addr, ctx); | 1482 | ret = emit_call(addr, fixed_addr, ctx); |
| 1467 | if (ret) | 1483 | if (ret) |
| 1468 | return ret; | 1484 | return ret; |
| @@ -516,11 +516,12 @@ static void bpf_skip(struct bpf_jit *jit, int size) · 515 unmodified lines | |||
| 516 | * PLT for hotpatchable calls. The calling convention is the same as for the | 516 | * PLT for hotpatchable calls. The calling convention is the same as for the |
| 517 | * ftrace hotpatch trampolines: %r0 is return address, %r1 is clobbered. | 517 | * ftrace hotpatch trampolines: %r0 is return address, %r1 is clobbered. |
| 518 | */ | 518 | */ |
| 519 | extern const char bpf_plt[]; | 519 | struct bpf_plt { |
| 520 | extern const char bpf_plt_ret[]; | 520 | char code[16]; |
| 521 | extern const char bpf_plt_target[]; | 521 | void *ret; |
| 522 | extern const char bpf_plt_end[]; | 522 | void *target; |
| 523 | #define BPF_PLT_SIZE 32 | 523 | } __packed; |
| 524 | extern const struct bpf_plt bpf_plt; | ||
| 524 | asm( | 525 | asm( |
| 525 | ".pushsection .rodata\n" | 526 | ".pushsection .rodata\n" |
| 526 | " .balign 8\n" | 527 | " .balign 8\n" |
| @@ -531,15 +532,14 @@ asm( · 4 unmodified lines | |||
| 531 | " .balign 8\n" | 532 | " .balign 8\n" |
| 532 | "bpf_plt_ret: .quad 0\n" | 533 | "bpf_plt_ret: .quad 0\n" |
| 533 | "bpf_plt_target: .quad 0\n" | 534 | "bpf_plt_target: .quad 0\n" |
| 534 | "bpf_plt_end:\n" | ||
| 535 | " .popsection\n" | 535 | " .popsection\n" |
| 536 | ); | 536 | ); |
| 537 | 537 | ||
| 538 | static void bpf_jit_plt(void *plt, void *ret, void *target) | 538 | static void bpf_jit_plt(struct bpf_plt *plt, void *ret, void *target) |
| 539 | { | 539 | { |
| 540 | memcpy(plt, bpf_plt, BPF_PLT_SIZE); | 540 | memcpy(plt, &bpf_plt, sizeof(*plt)); |
| 541 | *(void **)((char *)plt + (bpf_plt_ret - bpf_plt)) = ret; | 541 | plt->ret = ret; |
| 542 | *(void **)((char *)plt + (bpf_plt_target - bpf_plt)) = target ?: ret; | 542 | plt->target = target; |
| 543 | } | 543 | } |
| 544 | 544 | ||
| 545 | /* | 545 | /* |
| @@ -662,9 +662,9 @@ static void bpf_jit_epilogue(struct bpf_jit *jit, u32 stack_depth) · 116 unmodified lines | |||
| 662 | jit->prg = ALIGN(jit->prg, 8); | 662 | jit->prg = ALIGN(jit->prg, 8); |
| 663 | jit->prologue_plt = jit->prg; | 663 | jit->prologue_plt = jit->prg; |
| 664 | if (jit->prg_buf) | 664 | if (jit->prg_buf) |
| 665 | bpf_jit_plt(jit->prg_buf + jit->prg, | 665 | bpf_jit_plt((struct bpf_plt *)(jit->prg_buf + jit->prg), |
| 666 | jit->prg_buf + jit->prologue_plt_ret, NULL); | 666 | jit->prg_buf + jit->prologue_plt_ret, NULL); |
| 667 | jit->prg += BPF_PLT_SIZE; | 667 | jit->prg += sizeof(struct bpf_plt); |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | static int get_probe_mem_regno(const u8 *insn) | 670 | static int get_probe_mem_regno(const u8 *insn) |
| @@ -2040,9 +2040,6 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) · 1369 unmodified lines | |||
| 2040 | struct bpf_jit jit; | 2040 | struct bpf_jit jit; |
| 2041 | int pass; | 2041 | int pass; |
| 2042 | 2042 | ||
| 2043 | if (WARN_ON_ONCE(bpf_plt_end - bpf_plt != BPF_PLT_SIZE)) | ||
| 2044 | return orig_fp; | ||
| 2045 | |||
| 2046 | if (!fp->jit_requested) | 2043 | if (!fp->jit_requested) |
| 2047 | return orig_fp; | 2044 | return orig_fp; |
| 2048 | 2045 | ||
| @@ -2148,14 +2145,11 @@ bool bpf_jit_supports_far_kfunc_call(void) · 99 unmodified lines | |||
| 2148 | int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t, | 2145 | int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t, |
| 2149 | void *old_addr, void *new_addr) | 2146 | void *old_addr, void *new_addr) |
| 2150 | { | 2147 | { |
| 2148 | struct bpf_plt expected_plt, current_plt, new_plt, *plt; | ||
| 2151 | struct { | 2149 | struct { |
| 2152 | u16 opc; | 2150 | u16 opc; |
| 2153 | s32 disp; | 2151 | s32 disp; |
| 2154 | } __packed insn; | 2152 | } __packed insn; |
| 2155 | char expected_plt[BPF_PLT_SIZE]; | ||
| 2156 | char current_plt[BPF_PLT_SIZE]; | ||
| 2157 | char new_plt[BPF_PLT_SIZE]; | ||
| 2158 | char *plt; | ||
| 2159 | char *ret; | 2153 | char *ret; |
| 2160 | int err; | 2154 | int err; |
| 2161 | 2155 | ||
| @@ -2174,18 +2168,18 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t, · 12 unmodified lines | |||
| 2174 | */ | 2168 | */ |
| 2175 | } else { | 2169 | } else { |
| 2176 | /* Verify the PLT. */ | 2170 | /* Verify the PLT. */ |
| 2177 | plt = (char *)ip + (insn.disp << 1); | 2171 | plt = ip + (insn.disp << 1); |
| 2178 | err = copy_from_kernel_nofault(current_plt, plt, BPF_PLT_SIZE); | 2172 | err = copy_from_kernel_nofault(¤t_plt, plt, |
| 2173 | sizeof(current_plt)); | ||
| 2179 | if (err < 0) | 2174 | if (err < 0) |
| 2180 | return err; | 2175 | return err; |
| 2181 | ret = (char *)ip + 6; | 2176 | ret = (char *)ip + 6; |
| 2182 | bpf_jit_plt(expected_plt, ret, old_addr); | 2177 | bpf_jit_plt(&expected_plt, ret, old_addr); |
| 2183 | if (memcmp(current_plt, expected_plt, BPF_PLT_SIZE)) | 2178 | if (memcmp(¤t_plt, &expected_plt, sizeof(current_plt))) |
| 2184 | return -EINVAL; | 2179 | return -EINVAL; |
| 2185 | /* Adjust the call address. */ | 2180 | /* Adjust the call address. */ |
| 2186 | bpf_jit_plt(new_plt, ret, new_addr); | 2181 | bpf_jit_plt(&new_plt, ret, new_addr); |
| 2187 | s390_kernel_write(plt + (bpf_plt_target - bpf_plt), | 2182 | s390_kernel_write(&plt->target, &new_plt.target, |
| 2188 | new_plt + (bpf_plt_target - bpf_plt), | ||
| 2189 | sizeof(void *)); | 2183 | sizeof(void *)); |
| 2190 | } | 2184 | } |
| 2191 | 2185 | ||
| @@ -28,7 +28,7 @@ obj-y += net/ · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | obj-$(CONFIG_KEXEC_FILE) += purgatory/ | 29 | obj-$(CONFIG_KEXEC_FILE) += purgatory/ |
| 30 | 30 | ||
| 31 | obj-y += virt/svm/ | 31 | obj-y += virt/ |
| 32 | 32 | ||
| 33 | # for cleaning | 33 | # for cleaning |
| 34 | subdir- += boot tools | 34 | subdir- += boot tools |
| @@ -2439,6 +2439,8 @@ config USE_X86_SEG_SUPPORT · 2438 unmodified lines | |||
| 2439 | # with named address spaces - see GCC PR sanitizer/111736. | 2439 | # with named address spaces - see GCC PR sanitizer/111736. |
| 2440 | # | 2440 | # |
| 2441 | depends on !KASAN | 2441 | depends on !KASAN |
| 2442 | # -fsanitize=thread (KCSAN) is also incompatible. | ||
| 2443 | depends on !KCSAN | ||
| 2442 | 2444 | ||
| 2443 | config CC_HAS_SLS | 2445 | config CC_HAS_SLS |
| 2444 | def_bool $(cc-option,-mharden-sls=all) | 2446 | def_bool $(cc-option,-mharden-sls=all) |
| @@ -251,8 +251,6 @@ archheaders: · 250 unmodified lines | |||
| 251 | 251 | ||
| 252 | libs-y += arch/x86/lib/ | 252 | libs-y += arch/x86/lib/ |
| 253 | 253 | ||
| 254 | core-y += arch/x86/virt/ | ||
| 255 | |||
| 256 | # drivers-y are linked after core-y | 254 | # drivers-y are linked after core-y |
| 257 | drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/ | 255 | drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/ |
| 258 | drivers-$(CONFIG_PCI) += arch/x86/pci/ | 256 | drivers-$(CONFIG_PCI) += arch/x86/pci/ |
| @@ -15,10 +15,12 @@ · 14 unmodified lines | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/linkage.h> | 17 | #include <linux/linkage.h> |
| 18 | #include <asm/asm-offsets.h> | ||
| 18 | #include <asm/msr.h> | 19 | #include <asm/msr.h> |
| 19 | #include <asm/page_types.h> | 20 | #include <asm/page_types.h> |
| 20 | #include <asm/processor-flags.h> | 21 | #include <asm/processor-flags.h> |
| 21 | #include <asm/segment.h> | 22 | #include <asm/segment.h> |
| 23 | #include <asm/setup.h> | ||
| 22 | 24 | ||
| 23 | .code64 | 25 | .code64 |
| 24 | .text | 26 | .text |
| @@ -149,6 +151,7 @@ SYM_FUNC_END(__efi64_thunk) · 124 unmodified lines | |||
| 149 | SYM_FUNC_START(efi32_stub_entry) | 151 | SYM_FUNC_START(efi32_stub_entry) |
| 150 | call 1f | 152 | call 1f |
| 151 | 1: popl %ecx | 153 | 1: popl %ecx |
| 154 | leal (efi32_boot_args - 1b)(%ecx), %ebx | ||
| 152 | 155 | ||
| 153 | /* Clear BSS */ | 156 | /* Clear BSS */ |
| 154 | xorl %eax, %eax | 157 | xorl %eax, %eax |
| @@ -163,6 +166,7 @@ SYM_FUNC_START(efi32_stub_entry) · 8 unmodified lines | |||
| 163 | popl %ecx | 166 | popl %ecx |
| 164 | popl %edx | 167 | popl %edx |
| 165 | popl %esi | 168 | popl %esi |
| 169 | movl %esi, 8(%ebx) | ||
| 166 | jmp efi32_entry | 170 | jmp efi32_entry |
| 167 | SYM_FUNC_END(efi32_stub_entry) | 171 | SYM_FUNC_END(efi32_stub_entry) |
| 168 | #endif | 172 | #endif |
| @@ -239,8 +243,6 @@ SYM_FUNC_END(efi_enter32) · 70 unmodified lines | |||
| 239 | * | 243 | * |
| 240 | * Arguments: %ecx image handle | 244 | * Arguments: %ecx image handle |
| 241 | * %edx EFI system table pointer | 245 | * %edx EFI system table pointer |
| 242 | * %esi struct bootparams pointer (or NULL when not using | ||
| 243 | * the EFI handover protocol) | ||
| 244 | * | 246 | * |
| 245 | * Since this is the point of no return for ordinary execution, no registers | 247 | * Since this is the point of no return for ordinary execution, no registers |
| 246 | * are considered live except for the function parameters. [Note that the EFI | 248 | * are considered live except for the function parameters. [Note that the EFI |
| @@ -266,9 +268,18 @@ SYM_FUNC_START_LOCAL(efi32_entry) · 19 unmodified lines | |||
| 266 | leal (efi32_boot_args - 1b)(%ebx), %ebx | 268 | leal (efi32_boot_args - 1b)(%ebx), %ebx |
| 267 | movl %ecx, 0(%ebx) | 269 | movl %ecx, 0(%ebx) |
| 268 | movl %edx, 4(%ebx) | 270 | movl %edx, 4(%ebx) |
| 269 | movl %esi, 8(%ebx) | ||
| 270 | movb $0x0, 12(%ebx) // efi_is64 | 271 | movb $0x0, 12(%ebx) // efi_is64 |
| 271 | 272 | ||
| 273 | /* | ||
| 274 | * Allocate some memory for a temporary struct boot_params, which only | ||
| 275 | * needs the minimal pieces that startup_32() relies on. | ||
| 276 | */ | ||
| 277 | subl $PARAM_SIZE, %esp | ||
| 278 | movl %esp, %esi | ||
| 279 | movl $PAGE_SIZE, BP_kernel_alignment(%esi) | ||
| 280 | movl $_end - 1b, BP_init_size(%esi) | ||
| 281 | subl $startup_32 - 1b, BP_init_size(%esi) | ||
| 282 | |||
| 272 | /* Disable paging */ | 283 | /* Disable paging */ |
| 273 | movl %cr0, %eax | 284 | movl %cr0, %eax |
| 274 | btrl $X86_CR0_PG_BIT, %eax | 285 | btrl $X86_CR0_PG_BIT, %eax |
| @@ -294,8 +305,7 @@ SYM_FUNC_START(efi32_pe_entry) · 19 unmodified lines | |||
| 294 | 305 | ||
| 295 | movl 8(%ebp), %ecx // image_handle | 306 | movl 8(%ebp), %ecx // image_handle |
| 296 | movl 12(%ebp), %edx // sys_table | 307 | movl 12(%ebp), %edx // sys_table |
| 297 | xorl %esi, %esi | 308 | jmp efi32_entry // pass %ecx, %edx |
| 298 | jmp efi32_entry // pass %ecx, %edx, %esi | ||
| 299 | // no other registers remain live | 309 | // no other registers remain live |
| 300 | 310 | ||
| 301 | 2: popl %edi // restore callee-save registers | 311 | 2: popl %edi // restore callee-save registers |
| @@ -41,6 +41,7 @@ obj-$(CONFIG_X86_X32_ABI) += vdso-image-x32.o · 40 unmodified lines | |||
| 41 | obj-$(CONFIG_COMPAT_32) += vdso-image-32.o vdso32-setup.o | 41 | obj-$(CONFIG_COMPAT_32) += vdso-image-32.o vdso32-setup.o |
| 42 | 42 | ||
| 43 | OBJECT_FILES_NON_STANDARD_vdso-image-32.o := n | 43 | OBJECT_FILES_NON_STANDARD_vdso-image-32.o := n |
| 44 | OBJECT_FILES_NON_STANDARD_vdso-image-x32.o := n | ||
| 44 | OBJECT_FILES_NON_STANDARD_vdso-image-64.o := n | 45 | OBJECT_FILES_NON_STANDARD_vdso-image-64.o := n |
| 45 | OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n | 46 | OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n |
| 46 | 47 | ||
| @@ -250,7 +250,7 @@ static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = · 249 unmodified lines | |||
| 250 | /* | 250 | /* |
| 251 | * AMD Performance Monitor Family 17h and later: | 251 | * AMD Performance Monitor Family 17h and later: |
| 252 | */ | 252 | */ |
| 253 | static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] = | 253 | static const u64 amd_zen1_perfmon_event_map[PERF_COUNT_HW_MAX] = |
| 254 | { | 254 | { |
| 255 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | 255 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
| 256 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 256 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
| @@ -262,10 +262,39 @@ static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] = · 5 unmodified lines | |||
| 262 | [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x0187, | 262 | [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x0187, |
| 263 | }; | 263 | }; |
| 264 | 264 | ||
| 265 | static const u64 amd_zen2_perfmon_event_map[PERF_COUNT_HW_MAX] = | ||
| 266 | { | ||
| 267 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | ||
| 268 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | ||
| 269 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, | ||
| 270 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0964, | ||
| 271 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | ||
| 272 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | ||
| 273 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00a9, | ||
| 274 | }; | ||
| 275 | |||
| 276 | static const u64 amd_zen4_perfmon_event_map[PERF_COUNT_HW_MAX] = | ||
| 277 | { | ||
| 278 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | ||
| 279 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | ||
| 280 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, | ||
| 281 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0964, | ||
| 282 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | ||
| 283 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | ||
| 284 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00a9, | ||
| 285 | [PERF_COUNT_HW_REF_CPU_CYCLES] = 0x100000120, | ||
| 286 | }; | ||
| 287 | |||
| 265 | static u64 amd_pmu_event_map(int hw_event) | 288 | static u64 amd_pmu_event_map(int hw_event) |
| 266 | { | 289 | { |
| 267 | if (boot_cpu_data.x86 >= 0x17) | 290 | if (cpu_feature_enabled(X86_FEATURE_ZEN4) || boot_cpu_data.x86 >= 0x1a) |
| 268 | return amd_f17h_perfmon_event_map[hw_event]; | 291 | return amd_zen4_perfmon_event_map[hw_event]; |
| 292 | |||
| 293 | if (cpu_feature_enabled(X86_FEATURE_ZEN2) || boot_cpu_data.x86 >= 0x19) | ||
| 294 | return amd_zen2_perfmon_event_map[hw_event]; | ||
| 295 | |||
| 296 | if (cpu_feature_enabled(X86_FEATURE_ZEN1)) | ||
| 297 | return amd_zen1_perfmon_event_map[hw_event]; | ||
| 269 | 298 | ||
| 270 | return amd_perfmon_event_map[hw_event]; | 299 | return amd_perfmon_event_map[hw_event]; |
| 271 | } | 300 | } |
| @@ -904,8 +933,8 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs) · 632 unmodified lines | |||
| 904 | if (!status) | 933 | if (!status) |
| 905 | goto done; | 934 | goto done; |
| 906 | 935 | ||
| 907 | /* Read branch records before unfreezing */ | 936 | /* Read branch records */ |
| 908 | if (status & GLOBAL_STATUS_LBRS_FROZEN) { | 937 | if (x86_pmu.lbr_nr) { |
| 909 | amd_pmu_lbr_read(); | 938 | amd_pmu_lbr_read(); |
| 910 | status &= ~GLOBAL_STATUS_LBRS_FROZEN; | 939 | status &= ~GLOBAL_STATUS_LBRS_FROZEN; |
| 911 | } | 940 | } |
| @@ -402,10 +402,12 @@ void amd_pmu_lbr_enable_all(void) · 401 unmodified lines | |||
| 402 | wrmsrl(MSR_AMD64_LBR_SELECT, lbr_select); | 402 | wrmsrl(MSR_AMD64_LBR_SELECT, lbr_select); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | rdmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl); | 405 | if (cpu_feature_enabled(X86_FEATURE_AMD_LBR_PMC_FREEZE)) { |
| 406 | rdmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg); | 406 | rdmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl); |
| 407 | wrmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI); | ||
| 408 | } | ||
| 407 | 409 | ||
| 408 | wrmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI); | 410 | rdmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg); |
| 409 | wrmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg | DBG_EXTN_CFG_LBRV2EN); | 411 | wrmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg | DBG_EXTN_CFG_LBRV2EN); |
| 410 | } | 412 | } |
| 411 | 413 | ||
| @@ -418,10 +420,12 @@ void amd_pmu_lbr_disable_all(void) · 6 unmodified lines | |||
| 418 | return; | 420 | return; |
| 419 | 421 | ||
| 420 | rdmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg); | 422 | rdmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg); |
| 421 | rdmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl); | ||
| 422 | |||
| 423 | wrmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg & ~DBG_EXTN_CFG_LBRV2EN); | 423 | wrmsrl(MSR_AMD_DBG_EXTN_CFG, dbg_extn_cfg & ~DBG_EXTN_CFG_LBRV2EN); |
| 424 | wrmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl & ~DEBUGCTLMSR_FREEZE_LBRS_ON_PMI); | 424 | |
| 425 | if (cpu_feature_enabled(X86_FEATURE_AMD_LBR_PMC_FREEZE)) { | ||
| 426 | rdmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl); | ||
| 427 | wrmsrl(MSR_IA32_DEBUGCTLMSR, dbg_ctl & ~DEBUGCTLMSR_FREEZE_LBRS_ON_PMI); | ||
| 428 | } | ||
| 425 | } | 429 | } |
| 426 | 430 | ||
| 427 | __init int amd_pmu_lbr_init(void) | 431 | __init int amd_pmu_lbr_init(void) |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <asm/asm.h> | 14 | #include <asm/asm.h> |
| 15 | #include <asm/fred.h> | 15 | #include <asm/fred.h> |
| 16 | #include <asm/gsseg.h> | 16 | #include <asm/gsseg.h> |
| 17 | #include <asm/nospec-branch.h> | ||
| 17 | 18 | ||
| 18 | #ifndef CONFIG_X86_CMPXCHG64 | 19 | #ifndef CONFIG_X86_CMPXCHG64 |
| 19 | extern void cmpxchg8b_emu(void); | 20 | extern void cmpxchg8b_emu(void); |
| @@ -91,8 +91,9 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; · 90 unmodified lines | |||
| 91 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \ | 91 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \ |
| 92 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 19, feature_bit) || \ | 92 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 19, feature_bit) || \ |
| 93 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 20, feature_bit) || \ | 93 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 20, feature_bit) || \ |
| 94 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 21, feature_bit) || \ | ||
| 94 | REQUIRED_MASK_CHECK || \ | 95 | REQUIRED_MASK_CHECK || \ |
| 95 | BUILD_BUG_ON_ZERO(NCAPINTS != 21)) | 96 | BUILD_BUG_ON_ZERO(NCAPINTS != 22)) |
| 96 | 97 | ||
| 97 | #define DISABLED_MASK_BIT_SET(feature_bit) \ | 98 | #define DISABLED_MASK_BIT_SET(feature_bit) \ |
| 98 | ( CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 0, feature_bit) || \ | 99 | ( CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 0, feature_bit) || \ |
| @@ -116,8 +117,9 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; · 17 unmodified lines | |||
| 116 | CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 18, feature_bit) || \ | 117 | CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 18, feature_bit) || \ |
| 117 | CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 19, feature_bit) || \ | 118 | CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 19, feature_bit) || \ |
| 118 | CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 20, feature_bit) || \ | 119 | CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 20, feature_bit) || \ |
| 120 | CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 21, feature_bit) || \ | ||
| 119 | DISABLED_MASK_CHECK || \ | 121 | DISABLED_MASK_CHECK || \ |
| 120 | BUILD_BUG_ON_ZERO(NCAPINTS != 21)) | 122 | BUILD_BUG_ON_ZERO(NCAPINTS != 22)) |
| 121 | 123 | ||
| 122 | #define cpu_has(c, bit) \ | 124 | #define cpu_has(c, bit) \ |
| 123 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ | 125 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | |||
| 13 | /* | 13 | /* |
| 14 | * Defines x86 CPU feature bits | 14 | * Defines x86 CPU feature bits |
| 15 | */ | 15 | */ |
| 16 | #define NCAPINTS 21 /* N 32-bit words worth of info */ | 16 | #define NCAPINTS 22 /* N 32-bit words worth of info */ |
| 17 | #define NBUGINTS 2 /* N 32-bit bug flags */ | 17 | #define NBUGINTS 2 /* N 32-bit bug flags */ |
| 18 | 18 | ||
| 19 | /* | 19 | /* |
| @@ -459,6 +459,14 @@ · 439 unmodified lines | |||
| 459 | #define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* "" MSR_PRED_CMD[IBPB] flushes all branch type predictions */ | 459 | #define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* "" MSR_PRED_CMD[IBPB] flushes all branch type predictions */ |
| 460 | #define X86_FEATURE_SRSO_NO (20*32+29) /* "" CPU is not affected by SRSO */ | 460 | #define X86_FEATURE_SRSO_NO (20*32+29) /* "" CPU is not affected by SRSO */ |
| 461 | 461 | ||
| 462 | /* | ||
| 463 | * Extended auxiliary flags: Linux defined - for features scattered in various | ||
| 464 | * CPUID levels like 0x80000022, etc. | ||
| 465 | * | ||
| 466 | * Reuse free bits when adding new feature flags! | ||
| 467 | */ | ||
| 468 | #define X86_FEATURE_AMD_LBR_PMC_FREEZE (21*32+ 0) /* AMD LBR and PMC Freeze */ | ||
| 469 | |||
| 462 | /* | 470 | /* |
| 463 | * BUG word(s) | 471 | * BUG word(s) |
| 464 | */ | 472 | */ |
| @@ -39,4 +39,6 @@ static inline unsigned long crash_low_size_default(void) · 38 unmodified lines | |||
| 39 | #endif | 39 | #endif |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | #define HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY | ||
| 43 | |||
| 42 | #endif /* _X86_CRASH_RESERVE_H */ | 44 | #endif /* _X86_CRASH_RESERVE_H */ |
| @@ -155,6 +155,7 @@ · 154 unmodified lines | |||
| 155 | #define DISABLED_MASK18 (DISABLE_IBT) | 155 | #define DISABLED_MASK18 (DISABLE_IBT) |
| 156 | #define DISABLED_MASK19 (DISABLE_SEV_SNP) | 156 | #define DISABLED_MASK19 (DISABLE_SEV_SNP) |
| 157 | #define DISABLED_MASK20 0 | 157 | #define DISABLED_MASK20 0 |
| 158 | #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 21) | 158 | #define DISABLED_MASK21 0 |
| 159 | #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 22) | ||
| 159 | 160 | ||
| 160 | #endif /* _ASM_X86_DISABLED_FEATURES_H */ | 161 | #endif /* _ASM_X86_DISABLED_FEATURES_H */ |
| @@ -262,11 +262,20 @@ · 261 unmodified lines | |||
| 262 | .Lskip_rsb_\@: | 262 | .Lskip_rsb_\@: |
| 263 | .endm | 263 | .endm |
| 264 | 264 | ||
| 265 | /* | ||
| 266 | * The CALL to srso_alias_untrain_ret() must be patched in directly at | ||
| 267 | * the spot where untraining must be done, ie., srso_alias_untrain_ret() | ||
| 268 | * must be the target of a CALL instruction instead of indirectly | ||
| 269 | * jumping to a wrapper which then calls it. Therefore, this macro is | ||
| 270 | * called outside of __UNTRAIN_RET below, for the time being, before the | ||
| 271 | * kernel can support nested alternatives with arbitrary nesting. | ||
| 272 | */ | ||
| 273 | .macro CALL_UNTRAIN_RET | ||
| 265 | #if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO) | 274 | #if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO) |
| 266 | #define CALL_UNTRAIN_RET "call entry_untrain_ret" | 275 | ALTERNATIVE_2 "", "call entry_untrain_ret", X86_FEATURE_UNRET, \ |
| 267 | #else | 276 | "call srso_alias_untrain_ret", X86_FEATURE_SRSO_ALIAS |
| 268 | #define CALL_UNTRAIN_RET "" | ||
| 269 | #endif | 277 | #endif |
| 278 | .endm | ||
| 270 | 279 | ||
| 271 | /* | 280 | /* |
| 272 | * Mitigate RETBleed for AMD/Hygon Zen uarch. Requires KERNEL CR3 because the | 281 | * Mitigate RETBleed for AMD/Hygon Zen uarch. Requires KERNEL CR3 because the |
| @@ -282,8 +291,8 @@ · 9 unmodified lines | |||
| 282 | .macro __UNTRAIN_RET ibpb_feature, call_depth_insns | 291 | .macro __UNTRAIN_RET ibpb_feature, call_depth_insns |
| 283 | #if defined(CONFIG_MITIGATION_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY) | 292 | #if defined(CONFIG_MITIGATION_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY) |
| 284 | VALIDATE_UNRET_END | 293 | VALIDATE_UNRET_END |
| 285 | ALTERNATIVE_3 "", \ | 294 | CALL_UNTRAIN_RET |
| 286 | CALL_UNTRAIN_RET, X86_FEATURE_UNRET, \ | 295 | ALTERNATIVE_2 "", \ |
| 287 | "call entry_ibpb", \ibpb_feature, \ | 296 | "call entry_ibpb", \ibpb_feature, \ |
| 288 | __stringify(\call_depth_insns), X86_FEATURE_CALL_DEPTH | 297 | __stringify(\call_depth_insns), X86_FEATURE_CALL_DEPTH |
| 289 | #endif | 298 | #endif |
| @@ -342,6 +351,8 @@ extern void retbleed_return_thunk(void); · 52 unmodified lines | |||
| 342 | static inline void retbleed_return_thunk(void) {} | 351 | static inline void retbleed_return_thunk(void) {} |
| 343 | #endif | 352 | #endif |
| 344 | 353 | ||
| 354 | extern void srso_alias_untrain_ret(void); | ||
| 355 | |||
| 345 | #ifdef CONFIG_MITIGATION_SRSO | 356 | #ifdef CONFIG_MITIGATION_SRSO |
| 346 | extern void srso_return_thunk(void); | 357 | extern void srso_return_thunk(void); |
| 347 | extern void srso_alias_return_thunk(void); | 358 | extern void srso_alias_return_thunk(void); |
| @@ -99,6 +99,7 @@ · 98 unmodified lines | |||
| 99 | #define REQUIRED_MASK18 0 | 99 | #define REQUIRED_MASK18 0 |
| 100 | #define REQUIRED_MASK19 0 | 100 | #define REQUIRED_MASK19 0 |
| 101 | #define REQUIRED_MASK20 0 | 101 | #define REQUIRED_MASK20 0 |
| 102 | #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 21) | 102 | #define REQUIRED_MASK21 0 |
| 103 | #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 22) | ||
| 103 | 104 | ||
| 104 | #endif /* _ASM_X86_REQUIRED_FEATURES_H */ | 105 | #endif /* _ASM_X86_REQUIRED_FEATURES_H */ |
| @@ -218,12 +218,12 @@ void early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr, · 217 unmodified lines | |||
| 218 | unsigned long npages); | 218 | unsigned long npages); |
| 219 | void early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, | 219 | void early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, |
| 220 | unsigned long npages); | 220 | unsigned long npages); |
| 221 | void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op); | ||
| 222 | void snp_set_memory_shared(unsigned long vaddr, unsigned long npages); | 221 | void snp_set_memory_shared(unsigned long vaddr, unsigned long npages); |
| 223 | void snp_set_memory_private(unsigned long vaddr, unsigned long npages); | 222 | void snp_set_memory_private(unsigned long vaddr, unsigned long npages); |
| 224 | void snp_set_wakeup_secondary_cpu(void); | 223 | void snp_set_wakeup_secondary_cpu(void); |
| 225 | bool snp_init(struct boot_params *bp); | 224 | bool snp_init(struct boot_params *bp); |
| 226 | void __noreturn snp_abort(void); | 225 | void __noreturn snp_abort(void); |
| 226 | void snp_dmi_setup(void); | ||
| 227 | int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio); | 227 | int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio); |
| 228 | void snp_accept_memory(phys_addr_t start, phys_addr_t end); | 228 | void snp_accept_memory(phys_addr_t start, phys_addr_t end); |
| 229 | u64 snp_get_unsupported_features(u64 status); | 229 | u64 snp_get_unsupported_features(u64 status); |
| @@ -244,12 +244,12 @@ static inline void __init · 14 unmodified lines | |||
| 244 | early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr, unsigned long npages) { } | 244 | early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr, unsigned long npages) { } |
| 245 | static inline void __init | 245 | static inline void __init |
| 246 | early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, unsigned long npages) { } | 246 | early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr, unsigned long npages) { } |
| 247 | static inline void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op) { } | ||
| 248 | static inline void snp_set_memory_shared(unsigned long vaddr, unsigned long npages) { } | 247 | static inline void snp_set_memory_shared(unsigned long vaddr, unsigned long npages) { } |
| 249 | static inline void snp_set_memory_private(unsigned long vaddr, unsigned long npages) { } | 248 | static inline void snp_set_memory_private(unsigned long vaddr, unsigned long npages) { } |
| 250 | static inline void snp_set_wakeup_secondary_cpu(void) { } | 249 | static inline void snp_set_wakeup_secondary_cpu(void) { } |
| 251 | static inline bool snp_init(struct boot_params *bp) { return false; } | 250 | static inline bool snp_init(struct boot_params *bp) { return false; } |
| 252 | static inline void snp_abort(void) { } | 251 | static inline void snp_abort(void) { } |
| 252 | static inline void snp_dmi_setup(void) { } | ||
| 253 | static inline int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio) | 253 | static inline int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio) |
| 254 | { | 254 | { |
| 255 | return -ENOTTY; | 255 | return -ENOTTY; |
| @@ -30,12 +30,13 @@ struct x86_init_mpparse { · 29 unmodified lines | |||
| 30 | * @reserve_resources: reserve the standard resources for the | 30 | * @reserve_resources: reserve the standard resources for the |
| 31 | * platform | 31 | * platform |
| 32 | * @memory_setup: platform specific memory setup | 32 | * @memory_setup: platform specific memory setup |
| 33 | * | 33 | * @dmi_setup: platform specific DMI setup |
| 34 | */ | 34 | */ |
| 35 | struct x86_init_resources { | 35 | struct x86_init_resources { |
| 36 | void (*probe_roms)(void); | 36 | void (*probe_roms)(void); |
| 37 | void (*reserve_resources)(void); | 37 | void (*reserve_resources)(void); |
| 38 | char *(*memory_setup)(void); | 38 | char *(*memory_setup)(void); |
| 39 | void (*dmi_setup)(void); | ||
| 39 | }; | 40 | }; |
| 40 | 41 | ||
| 41 | /** | 42 | /** |
| @@ -49,6 +49,7 @@ static const struct cpuid_bit cpuid_bits[] = { · 48 unmodified lines | |||
| 49 | { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, | 49 | { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, |
| 50 | { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, | 50 | { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, |
| 51 | { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, | 51 | { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, |
| 52 | { X86_FEATURE_AMD_LBR_PMC_FREEZE, CPUID_EAX, 2, 0x80000022, 0 }, | ||
| 52 | { 0, 0, 0, 0, 0 } | 53 | { 0, 0, 0, 0, 0 } |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | /* | 2 | /* |
| 3 | * EISA specific code | 3 | * EISA specific code |
| 4 | */ | 4 | */ |
| 5 | #include <linux/cc_platform.h> | ||
| 5 | #include <linux/ioport.h> | 6 | #include <linux/ioport.h> |
| 6 | #include <linux/eisa.h> | 7 | #include <linux/eisa.h> |
| 7 | #include <linux/io.h> | 8 | #include <linux/io.h> |
| @@ -12,7 +13,7 @@ static __init int eisa_bus_probe(void) · 4 unmodified lines | |||
| 12 | { | 13 | { |
| 13 | void __iomem *p; | 14 | void __iomem *p; |
| 14 | 15 | ||
| 15 | if (xen_pv_domain() && !xen_initial_domain()) | 16 | if ((xen_pv_domain() && !xen_initial_domain()) || cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) |
| 16 | return 0; | 17 | return 0; |
| 17 | 18 | ||
| 18 | p = ioremap(0x0FFFD9, 4); | 19 | p = ioremap(0x0FFFD9, 4); |
| @@ -580,7 +580,7 @@ EXPORT_SYMBOL_GPL(asm_exc_nmi_kvm_vmx); · 579 unmodified lines | |||
| 580 | 580 | ||
| 581 | static char *nmi_check_stall_msg[] = { | 581 | static char *nmi_check_stall_msg[] = { |
| 582 | /* */ | 582 | /* */ |
| 583 | /* +--------- nsp->idt_seq_snap & 0x1: CPU is in NMI handler. */ | 583 | /* +--------- nmi_seq & 0x1: CPU is currently in NMI handler. */ |
| 584 | /* | +------ cpu_is_offline(cpu) */ | 584 | /* | +------ cpu_is_offline(cpu) */ |
| 585 | /* | | +--- nsp->idt_calls_snap != atomic_long_read(&nsp->idt_calls): */ | 585 | /* | | +--- nsp->idt_calls_snap != atomic_long_read(&nsp->idt_calls): */ |
| 586 | /* | | | NMI handler has been invoked. */ | 586 | /* | | | NMI handler has been invoked. */ |
| @@ -628,22 +628,26 @@ void nmi_backtrace_stall_check(const struct cpumask *btp) · 41 unmodified lines | |||
| 628 | nmi_seq = READ_ONCE(nsp->idt_nmi_seq); | 628 | nmi_seq = READ_ONCE(nsp->idt_nmi_seq); |
| 629 | if (nsp->idt_nmi_seq_snap + 1 == nmi_seq && (nmi_seq & 0x1)) { | 629 | if (nsp->idt_nmi_seq_snap + 1 == nmi_seq && (nmi_seq & 0x1)) { |
| 630 | msgp = "CPU entered NMI handler function, but has not exited"; | 630 | msgp = "CPU entered NMI handler function, but has not exited"; |
| 631 | } else if ((nsp->idt_nmi_seq_snap & 0x1) != (nmi_seq & 0x1)) { | 631 | } else if (nsp->idt_nmi_seq_snap == nmi_seq || |
| 632 | msgp = "CPU is handling NMIs"; | 632 | nsp->idt_nmi_seq_snap + 1 == nmi_seq) { |
| 633 | } else { | 633 | idx = ((nmi_seq & 0x1) << 2) | |
| 634 | idx = ((nsp->idt_seq_snap & 0x1) << 2) | | ||
| 635 | (cpu_is_offline(cpu) << 1) | | 634 | (cpu_is_offline(cpu) << 1) | |
| 636 | (nsp->idt_calls_snap != atomic_long_read(&nsp->idt_calls)); | 635 | (nsp->idt_calls_snap != atomic_long_read(&nsp->idt_calls)); |
| 637 | msgp = nmi_check_stall_msg[idx]; | 636 | msgp = nmi_check_stall_msg[idx]; |
| 638 | if (nsp->idt_ignored_snap != READ_ONCE(nsp->idt_ignored) && (idx & 0x1)) | 637 | if (nsp->idt_ignored_snap != READ_ONCE(nsp->idt_ignored) && (idx & 0x1)) |
| 639 | modp = ", but OK because ignore_nmis was set"; | 638 | modp = ", but OK because ignore_nmis was set"; |
| 640 | if (nmi_seq & 0x1) | 639 | if (nsp->idt_nmi_seq_snap + 1 == nmi_seq) |
| 641 | msghp = " (CPU currently in NMI handler function)"; | ||
| 642 | else if (nsp->idt_nmi_seq_snap + 1 == nmi_seq) | ||
| 643 | msghp = " (CPU exited one NMI handler function)"; | 640 | msghp = " (CPU exited one NMI handler function)"; |
| 641 | else if (nmi_seq & 0x1) | ||
| 642 | msghp = " (CPU currently in NMI handler function)"; | ||
| 643 | else | ||
| 644 | msghp = " (CPU was never in an NMI handler function)"; | ||
| 645 | } else { | ||
| 646 | msgp = "CPU is handling NMIs"; | ||
| 644 | } | 647 | } |
| 645 | pr_alert("%s: CPU %d: %s%s%s, last activity: %lu jiffies ago.\n", | 648 | pr_alert("%s: CPU %d: %s%s%s\n", __func__, cpu, msgp, modp, msghp); |
| 646 | __func__, cpu, msgp, modp, msghp, j - READ_ONCE(nsp->recv_jiffies)); | 649 | pr_alert("%s: last activity: %lu jiffies ago.\n", |
| 650 | __func__, j - READ_ONCE(nsp->recv_jiffies)); | ||
| 647 | } | 651 | } |
| 648 | } | 652 | } |
| 649 | 653 | ||
| @@ -203,16 +203,6 @@ void __init probe_roms(void) · 202 unmodified lines | |||
| 203 | unsigned char c; | 203 | unsigned char c; |
| 204 | int i; | 204 | int i; |
| 205 | 205 | ||
| 206 | /* | ||
| 207 | * The ROM memory range is not part of the e820 table and is therefore not | ||
| 208 | * pre-validated by BIOS. The kernel page table maps the ROM region as encrypted | ||
| 209 | * memory, and SNP requires encrypted memory to be validated before access. | ||
| 210 | * Do that here. | ||
| 211 | */ | ||
| 212 | snp_prep_memory(video_rom_resource.start, | ||
| 213 | ((system_rom_resource.end + 1) - video_rom_resource.start), | ||
| 214 | SNP_PAGE_STATE_PRIVATE); | ||
| 215 | |||
| 216 | /* video rom */ | 206 | /* video rom */ |
| 217 | upper = adapter_rom_resources[0].start; | 207 | upper = adapter_rom_resources[0].start; |
| 218 | for (start = video_rom_resource.start; start < upper; start += 2048) { | 208 | for (start = video_rom_resource.start; start < upper; start += 2048) { |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | |||
| 9 | #include <linux/console.h> | 9 | #include <linux/console.h> |
| 10 | #include <linux/crash_dump.h> | 10 | #include <linux/crash_dump.h> |
| 11 | #include <linux/dma-map-ops.h> | 11 | #include <linux/dma-map-ops.h> |
| 12 | #include <linux/dmi.h> | ||
| 13 | #include <linux/efi.h> | 12 | #include <linux/efi.h> |
| 14 | #include <linux/ima.h> | 13 | #include <linux/ima.h> |
| 15 | #include <linux/init_ohci1394_dma.h> | 14 | #include <linux/init_ohci1394_dma.h> |
| @@ -902,7 +901,7 @@ void __init setup_arch(char **cmdline_p) · 886 unmodified lines | |||
| 902 | efi_init(); | 901 | efi_init(); |
| 903 | 902 | ||
| 904 | reserve_ibft_region(); | 903 | reserve_ibft_region(); |
| 905 | dmi_setup(); | 904 | x86_init.resources.dmi_setup(); |
| 906 | 905 | ||
| 907 | /* | 906 | /* |
| 908 | * VMware detection requires dmi to be available, so this | 907 | * VMware detection requires dmi to be available, so this |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | |||
| 23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
| 25 | #include <linux/psp-sev.h> | 25 | #include <linux/psp-sev.h> |
| 26 | #include <linux/dmi.h> | ||
| 26 | #include <uapi/linux/sev-guest.h> | 27 | #include <uapi/linux/sev-guest.h> |
| 27 | 28 | ||
| 28 | #include <asm/init.h> | 29 | #include <asm/init.h> |
| @@ -795,21 +796,6 @@ void __init early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr · 766 unmodified lines | |||
| 795 | early_set_pages_state(vaddr, paddr, npages, SNP_PAGE_STATE_SHARED); | 796 | early_set_pages_state(vaddr, paddr, npages, SNP_PAGE_STATE_SHARED); |
| 796 | } | 797 | } |
| 797 | 798 | ||
| 798 | void __init snp_prep_memory(unsigned long paddr, unsigned int sz, enum psc_op op) | ||
| 799 | { | ||
| 800 | unsigned long vaddr, npages; | ||
| 801 | |||
| 802 | vaddr = (unsigned long)__va(paddr); | ||
| 803 | npages = PAGE_ALIGN(sz) >> PAGE_SHIFT; | ||
| 804 | |||
| 805 | if (op == SNP_PAGE_STATE_PRIVATE) | ||
| 806 | early_snp_set_memory_private(vaddr, paddr, npages); | ||
| 807 | else if (op == SNP_PAGE_STATE_SHARED) | ||
| 808 | early_snp_set_memory_shared(vaddr, paddr, npages); | ||
| 809 | else | ||
| 810 | WARN(1, "invalid memory op %d\n", op); | ||
| 811 | } | ||
| 812 | |||
| 813 | static unsigned long __set_pages_state(struct snp_psc_desc *data, unsigned long vaddr, | 799 | static unsigned long __set_pages_state(struct snp_psc_desc *data, unsigned long vaddr, |
| 814 | unsigned long vaddr_end, int op) | 800 | unsigned long vaddr_end, int op) |
| 815 | { | 801 | { |
| @@ -2136,6 +2122,17 @@ void __head __noreturn snp_abort(void) · 1320 unmodified lines | |||
| 2136 | sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED); | 2122 | sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED); |
| 2137 | } | 2123 | } |
| 2138 | 2124 | ||
| 2125 | /* | ||
| 2126 | * SEV-SNP guests should only execute dmi_setup() if EFI_CONFIG_TABLES are | ||
| 2127 | * enabled, as the alternative (fallback) logic for DMI probing in the legacy | ||
| 2128 | * ROM region can cause a crash since this region is not pre-validated. | ||
| 2129 | */ | ||
| 2130 | void __init snp_dmi_setup(void) | ||
| 2131 | { | ||
| 2132 | if (efi_enabled(EFI_CONFIG_TABLES)) | ||
| 2133 | dmi_setup(); | ||
| 2134 | } | ||
| 2135 | |||
| 2139 | static void dump_cpuid_table(void) | 2136 | static void dump_cpuid_table(void) |
| 2140 | { | 2137 | { |
| 2141 | const struct snp_cpuid_table *cpuid_table = snp_cpuid_get_table(); | 2138 | const struct snp_cpuid_table *cpuid_table = snp_cpuid_get_table(); |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | * | 3 | * |
| 4 | * For licencing details see kernel-base/COPYING | 4 | * For licencing details see kernel-base/COPYING |
| 5 | */ | 5 | */ |
| 6 | #include <linux/dmi.h> | ||
| 6 | #include <linux/init.h> | 7 | #include <linux/init.h> |
| 7 | #include <linux/ioport.h> | 8 | #include <linux/ioport.h> |
| 8 | #include <linux/export.h> | 9 | #include <linux/export.h> |
| @@ -66,6 +67,7 @@ struct x86_init_ops x86_init __initdata = { · 57 unmodified lines | |||
| 66 | .probe_roms = probe_roms, | 67 | .probe_roms = probe_roms, |
| 67 | .reserve_resources = reserve_standard_io_resources, | 68 | .reserve_resources = reserve_standard_io_resources, |
| 68 | .memory_setup = e820__memory_setup_default, | 69 | .memory_setup = e820__memory_setup_default, |
| 70 | .dmi_setup = dmi_setup, | ||
| 69 | }, | 71 | }, |
| 70 | 72 | ||
| 71 | .mpparse = { | 73 | .mpparse = { |
| @@ -163,6 +163,7 @@ SYM_CODE_START_NOALIGN(srso_alias_untrain_ret) · 162 unmodified lines | |||
| 163 | lfence | 163 | lfence |
| 164 | jmp srso_alias_return_thunk | 164 | jmp srso_alias_return_thunk |
| 165 | SYM_FUNC_END(srso_alias_untrain_ret) | 165 | SYM_FUNC_END(srso_alias_untrain_ret) |
| 166 | __EXPORT_THUNK(srso_alias_untrain_ret) | ||
| 166 | .popsection | 167 | .popsection |
| 167 | 168 | ||
| 168 | .pushsection .text..__x86.rethunk_safe | 169 | .pushsection .text..__x86.rethunk_safe |
| @@ -224,10 +225,12 @@ SYM_CODE_START(srso_return_thunk) · 55 unmodified lines | |||
| 224 | SYM_CODE_END(srso_return_thunk) | 225 | SYM_CODE_END(srso_return_thunk) |
| 225 | 226 | ||
| 226 | #define JMP_SRSO_UNTRAIN_RET "jmp srso_untrain_ret" | 227 | #define JMP_SRSO_UNTRAIN_RET "jmp srso_untrain_ret" |
| 227 | #define JMP_SRSO_ALIAS_UNTRAIN_RET "jmp srso_alias_untrain_ret" | ||
| 228 | #else /* !CONFIG_MITIGATION_SRSO */ | 228 | #else /* !CONFIG_MITIGATION_SRSO */ |
| 229 | /* Dummy for the alternative in CALL_UNTRAIN_RET. */ | ||
| 230 | SYM_CODE_START(srso_alias_untrain_ret) | ||
| 231 | RET | ||
| 232 | SYM_FUNC_END(srso_alias_untrain_ret) | ||
| 229 | #define JMP_SRSO_UNTRAIN_RET "ud2" | 233 | #define JMP_SRSO_UNTRAIN_RET "ud2" |
| 230 | #define JMP_SRSO_ALIAS_UNTRAIN_RET "ud2" | ||
| 231 | #endif /* CONFIG_MITIGATION_SRSO */ | 234 | #endif /* CONFIG_MITIGATION_SRSO */ |
| 232 | 235 | ||
| 233 | #ifdef CONFIG_MITIGATION_UNRET_ENTRY | 236 | #ifdef CONFIG_MITIGATION_UNRET_ENTRY |
| @@ -319,9 +322,7 @@ SYM_FUNC_END(retbleed_untrain_ret) · 85 unmodified lines | |||
| 319 | #if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO) | 322 | #if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO) |
| 320 | 323 | ||
| 321 | SYM_FUNC_START(entry_untrain_ret) | 324 | SYM_FUNC_START(entry_untrain_ret) |
| 322 | ALTERNATIVE_2 JMP_RETBLEED_UNTRAIN_RET, \ | 325 | ALTERNATIVE JMP_RETBLEED_UNTRAIN_RET, JMP_SRSO_UNTRAIN_RET, X86_FEATURE_SRSO |
| 323 | JMP_SRSO_UNTRAIN_RET, X86_FEATURE_SRSO, \ | ||
| 324 | JMP_SRSO_ALIAS_UNTRAIN_RET, X86_FEATURE_SRSO_ALIAS | ||
| 325 | SYM_FUNC_END(entry_untrain_ret) | 326 | SYM_FUNC_END(entry_untrain_ret) |
| 326 | __EXPORT_THUNK(entry_untrain_ret) | 327 | __EXPORT_THUNK(entry_untrain_ret) |
| 327 | 328 | ||
| @@ -26,31 +26,18 @@ static int ident_pud_init(struct x86_mapping_info *info, pud_t *pud_page, · 25 unmodified lines | |||
| 26 | for (; addr < end; addr = next) { | 26 | for (; addr < end; addr = next) { |
| 27 | pud_t *pud = pud_page + pud_index(addr); | 27 | pud_t *pud = pud_page + pud_index(addr); |
| 28 | pmd_t *pmd; | 28 | pmd_t *pmd; |
| 29 | bool use_gbpage; | ||
| 30 | 29 | ||
| 31 | next = (addr & PUD_MASK) + PUD_SIZE; | 30 | next = (addr & PUD_MASK) + PUD_SIZE; |
| 32 | if (next > end) | 31 | if (next > end) |
| 33 | next = end; | 32 | next = end; |
| 34 | 33 | ||
| 35 | /* if this is already a gbpage, this portion is already mapped */ | 34 | if (info->direct_gbpages) { |
| 36 | if (pud_leaf(*pud)) | ||
| 37 | continue; | ||
| 38 | |||
| 39 | /* Is using a gbpage allowed? */ | ||
| 40 | use_gbpage = info->direct_gbpages; | ||
| 41 | |||
| 42 | /* Don't use gbpage if it maps more than the requested region. */ | ||
| 43 | /* at the begining: */ | ||
| 44 | use_gbpage &= ((addr & ~PUD_MASK) == 0); | ||
| 45 | /* ... or at the end: */ | ||
| 46 | use_gbpage &= ((next & ~PUD_MASK) == 0); | ||
| 47 | |||
| 48 | /* Never overwrite existing mappings */ | ||
| 49 | use_gbpage &= !pud_present(*pud); | ||
| 50 | |||
| 51 | if (use_gbpage) { | ||
| 52 | pud_t pudval; | 35 | pud_t pudval; |
| 53 | 36 | ||
| 37 | if (pud_present(*pud)) | ||
| 38 | continue; | ||
| 39 | |||
| 40 | addr &= PUD_MASK; | ||
| 54 | pudval = __pud((addr - info->offset) | info->page_flag); | 41 | pudval = __pud((addr - info->offset) | info->page_flag); |
| 55 | set_pud(pud, pudval); | 42 | set_pud(pud, pudval); |
| 56 | continue; | 43 | continue; |
| @@ -492,6 +492,24 @@ void __init sme_early_init(void) · 491 unmodified lines | |||
| 492 | */ | 492 | */ |
| 493 | if (sev_status & MSR_AMD64_SEV_ENABLED) | 493 | if (sev_status & MSR_AMD64_SEV_ENABLED) |
| 494 | ia32_disable(); | 494 | ia32_disable(); |
| 495 | |||
| 496 | /* | ||
| 497 | * Override init functions that scan the ROM region in SEV-SNP guests, | ||
| 498 | * as this memory is not pre-validated and would thus cause a crash. | ||
| 499 | */ | ||
| 500 | if (sev_status & MSR_AMD64_SEV_SNP_ENABLED) { | ||
| 501 | x86_init.mpparse.find_mptable = x86_init_noop; | ||
| 502 | x86_init.pci.init_irq = x86_init_noop; | ||
| 503 | x86_init.resources.probe_roms = x86_init_noop; | ||
| 504 | |||
| 505 | /* | ||
| 506 | * DMI setup behavior for SEV-SNP guests depends on | ||
| 507 | * efi_enabled(EFI_CONFIG_TABLES), which hasn't been | ||
| 508 | * parsed yet. snp_dmi_setup() will run after that | ||
| 509 | * parsing has happened. | ||
| 510 | */ | ||
| 511 | x86_init.resources.dmi_setup = snp_dmi_setup; | ||
| 512 | } | ||
| 495 | } | 513 | } |
| 496 | 514 | ||
| 497 | void __init mem_encrypt_free_decrypted_mem(void) | 515 | void __init mem_encrypt_free_decrypted_mem(void) |
| @@ -1,2 +1,2 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | obj-y += vmx/ | 2 | obj-y += svm/ vmx/ |
| @@ -726,7 +726,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, · 725 unmodified lines | |||
| 726 | * which can be mixed are set in each bio and mark @rq as mixed | 726 | * which can be mixed are set in each bio and mark @rq as mixed |
| 727 | * merged. | 727 | * merged. |
| 728 | */ | 728 | */ |
| 729 | void blk_rq_set_mixed_merge(struct request *rq) | 729 | static void blk_rq_set_mixed_merge(struct request *rq) |
| 730 | { | 730 | { |
| 731 | blk_opf_t ff = rq->cmd_flags & REQ_FAILFAST_MASK; | 731 | blk_opf_t ff = rq->cmd_flags & REQ_FAILFAST_MASK; |
| 732 | struct bio *bio; | 732 | struct bio *bio; |
| @@ -770,16 +770,11 @@ static void req_bio_endio(struct request *rq, struct bio *bio, · 769 unmodified lines | |||
| 770 | /* | 770 | /* |
| 771 | * Partial zone append completions cannot be supported as the | 771 | * Partial zone append completions cannot be supported as the |
| 772 | * BIO fragments may end up not being written sequentially. | 772 | * BIO fragments may end up not being written sequentially. |
| 773 | * For such case, force the completed nbytes to be equal to | ||
| 774 | * the BIO size so that bio_advance() sets the BIO remaining | ||
| 775 | * size to 0 and we end up calling bio_endio() before returning. | ||
| 776 | */ | 773 | */ |
| 777 | if (bio->bi_iter.bi_size != nbytes) { | 774 | if (bio->bi_iter.bi_size != nbytes) |
| 778 | bio->bi_status = BLK_STS_IOERR; | 775 | bio->bi_status = BLK_STS_IOERR; |
| 779 | nbytes = bio->bi_iter.bi_size; | 776 | else |
| 780 | } else { | ||
| 781 | bio->bi_iter.bi_sector = rq->__sector; | 777 | bio->bi_iter.bi_sector = rq->__sector; |
| 782 | } | ||
| 783 | } | 778 | } |
| 784 | 779 | ||
| 785 | bio_advance(bio, nbytes); | 780 | bio_advance(bio, nbytes); |
| @@ -146,8 +146,7 @@ static int blk_validate_limits(struct queue_limits *lim) · 145 unmodified lines | |||
| 146 | max_hw_sectors = min_not_zero(lim->max_hw_sectors, | 146 | max_hw_sectors = min_not_zero(lim->max_hw_sectors, |
| 147 | lim->max_dev_sectors); | 147 | lim->max_dev_sectors); |
| 148 | if (lim->max_user_sectors) { | 148 | if (lim->max_user_sectors) { |
| 149 | if (lim->max_user_sectors > max_hw_sectors || | 149 | if (lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE) |
| 150 | lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE) | ||
| 151 | return -EINVAL; | 150 | return -EINVAL; |
| 152 | lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors); | 151 | lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors); |
| 153 | } else { | 152 | } else { |
| @@ -339,7 +339,6 @@ int ll_back_merge_fn(struct request *req, struct bio *bio, · 338 unmodified lines | |||
| 339 | bool blk_attempt_req_merge(struct request_queue *q, struct request *rq, | 339 | bool blk_attempt_req_merge(struct request_queue *q, struct request *rq, |
| 340 | struct request *next); | 340 | struct request *next); |
| 341 | unsigned int blk_recalc_rq_segments(struct request *rq); | 341 | unsigned int blk_recalc_rq_segments(struct request *rq); |
| 342 | void blk_rq_set_mixed_merge(struct request *rq); | ||
| 343 | bool blk_rq_merge_ok(struct request *rq, struct bio *bio); | 342 | bool blk_rq_merge_ok(struct request *rq, struct bio *bio); |
| 344 | enum elv_merge blk_try_merge(struct request *rq, struct bio *bio); | 343 | enum elv_merge blk_try_merge(struct request *rq, struct bio *bio); |
| 345 | 344 | ||
| @@ -75,6 +75,9 @@ int mscode_note_digest_algo(void *context, size_t hdrlen, · 74 unmodified lines | |||
| 75 | 75 | ||
| 76 | oid = look_up_OID(value, vlen); | 76 | oid = look_up_OID(value, vlen); |
| 77 | switch (oid) { | 77 | switch (oid) { |
| 78 | case OID_sha1: | ||
| 79 | ctx->digest_algo = "sha1"; | ||
| 80 | break; | ||
| 78 | case OID_sha256: | 81 | case OID_sha256: |
| 79 | ctx->digest_algo = "sha256"; | 82 | ctx->digest_algo = "sha256"; |
| 80 | break; | 83 | break; |
| @@ -227,6 +227,9 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen, · 226 unmodified lines | |||
| 227 | struct pkcs7_parse_context *ctx = context; | 227 | struct pkcs7_parse_context *ctx = context; |
| 228 | 228 | ||
| 229 | switch (ctx->last_oid) { | 229 | switch (ctx->last_oid) { |
| 230 | case OID_sha1: | ||
| 231 | ctx->sinfo->sig->hash_algo = "sha1"; | ||
| 232 | break; | ||
| 230 | case OID_sha256: | 233 | case OID_sha256: |
| 231 | ctx->sinfo->sig->hash_algo = "sha256"; | 234 | ctx->sinfo->sig->hash_algo = "sha256"; |
| 232 | break; | 235 | break; |
| @@ -278,6 +281,7 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen, · 45 unmodified lines | |||
| 278 | ctx->sinfo->sig->pkey_algo = "rsa"; | 281 | ctx->sinfo->sig->pkey_algo = "rsa"; |
| 279 | ctx->sinfo->sig->encoding = "pkcs1"; | 282 | ctx->sinfo->sig->encoding = "pkcs1"; |
| 280 | break; | 283 | break; |
| 284 | case OID_id_ecdsa_with_sha1: | ||
| 281 | case OID_id_ecdsa_with_sha224: | 285 | case OID_id_ecdsa_with_sha224: |
| 282 | case OID_id_ecdsa_with_sha256: | 286 | case OID_id_ecdsa_with_sha256: |
| 283 | case OID_id_ecdsa_with_sha384: | 287 | case OID_id_ecdsa_with_sha384: |
| @@ -115,7 +115,8 @@ software_key_determine_akcipher(const struct public_key *pkey, · 114 unmodified lines | |||
| 115 | */ | 115 | */ |
| 116 | if (!hash_algo) | 116 | if (!hash_algo) |
| 117 | return -EINVAL; | 117 | return -EINVAL; |
| 118 | if (strcmp(hash_algo, "sha224") != 0 && | 118 | if (strcmp(hash_algo, "sha1") != 0 && |
| 119 | strcmp(hash_algo, "sha224") != 0 && | ||
| 119 | strcmp(hash_algo, "sha256") != 0 && | 120 | strcmp(hash_algo, "sha256") != 0 && |
| 120 | strcmp(hash_algo, "sha384") != 0 && | 121 | strcmp(hash_algo, "sha384") != 0 && |
| 121 | strcmp(hash_algo, "sha512") != 0 && | 122 | strcmp(hash_algo, "sha512") != 0 && |
| @@ -115,7 +115,7 @@ EXPORT_SYMBOL_GPL(decrypt_blob); · 114 unmodified lines | |||
| 115 | * Sign the specified data blob using the private key specified by params->key. | 115 | * Sign the specified data blob using the private key specified by params->key. |
| 116 | * The signature is wrapped in an encoding if params->encoding is specified | 116 | * The signature is wrapped in an encoding if params->encoding is specified |
| 117 | * (eg. "pkcs1"). If the encoding needs to know the digest type, this can be | 117 | * (eg. "pkcs1"). If the encoding needs to know the digest type, this can be |
| 118 | * passed through params->hash_algo (eg. "sha512"). | 118 | * passed through params->hash_algo (eg. "sha1"). |
| 119 | * | 119 | * |
| 120 | * Returns the length of the data placed in the signature buffer or an error. | 120 | * Returns the length of the data placed in the signature buffer or an error. |
| 121 | */ | 121 | */ |
| @@ -198,6 +198,10 @@ int x509_note_sig_algo(void *context, size_t hdrlen, unsigned char tag, · 197 unmodified lines | |||
| 198 | default: | 198 | default: |
| 199 | return -ENOPKG; /* Unsupported combination */ | 199 | return -ENOPKG; /* Unsupported combination */ |
| 200 | 200 | ||
| 201 | case OID_sha1WithRSAEncryption: | ||
| 202 | ctx->cert->sig->hash_algo = "sha1"; | ||
| 203 | goto rsa_pkcs1; | ||
| 204 | |||
| 201 | case OID_sha256WithRSAEncryption: | 205 | case OID_sha256WithRSAEncryption: |
| 202 | ctx->cert->sig->hash_algo = "sha256"; | 206 | ctx->cert->sig->hash_algo = "sha256"; |
| 203 | goto rsa_pkcs1; | 207 | goto rsa_pkcs1; |
| @@ -214,6 +218,10 @@ int x509_note_sig_algo(void *context, size_t hdrlen, unsigned char tag, · 10 unmodified lines | |||
| 214 | ctx->cert->sig->hash_algo = "sha224"; | 218 | ctx->cert->sig->hash_algo = "sha224"; |
| 215 | goto rsa_pkcs1; | 219 | goto rsa_pkcs1; |
| 216 | 220 | ||
| 221 | case OID_id_ecdsa_with_sha1: | ||
| 222 | ctx->cert->sig->hash_algo = "sha1"; | ||
| 223 | goto ecdsa; | ||
| 224 | |||
| 217 | case OID_id_rsassa_pkcs1_v1_5_with_sha3_256: | 225 | case OID_id_rsassa_pkcs1_v1_5_with_sha3_256: |
| 218 | ctx->cert->sig->hash_algo = "sha3-256"; | 226 | ctx->cert->sig->hash_algo = "sha3-256"; |
| 219 | goto rsa_pkcs1; | 227 | goto rsa_pkcs1; |
| @@ -653,6 +653,30 @@ static const struct akcipher_testvec rsa_tv_template[] = { · 652 unmodified lines | |||
| 653 | static const struct akcipher_testvec ecdsa_nist_p192_tv_template[] = { | 653 | static const struct akcipher_testvec ecdsa_nist_p192_tv_template[] = { |
| 654 | { | 654 | { |
| 655 | .key = | 655 | .key = |
| 656 | "\x04\xf7\x46\xf8\x2f\x15\xf6\x22\x8e\xd7\x57\x4f\xcc\xe7\xbb\xc1" | ||
| 657 | "\xd4\x09\x73\xcf\xea\xd0\x15\x07\x3d\xa5\x8a\x8a\x95\x43\xe4\x68" | ||
| 658 | "\xea\xc6\x25\xc1\xc1\x01\x25\x4c\x7e\xc3\x3c\xa6\x04\x0a\xe7\x08" | ||
| 659 | "\x98", | ||
| 660 | .key_len = 49, | ||
| 661 | .params = | ||
| 662 | "\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48" | ||
| 663 | "\xce\x3d\x03\x01\x01", | ||
| 664 | .param_len = 21, | ||
| 665 | .m = | ||
| 666 | "\xcd\xb9\xd2\x1c\xb7\x6f\xcd\x44\xb3\xfd\x63\xea\xa3\x66\x7f\xae" | ||
| 667 | "\x63\x85\xe7\x82", | ||
| 668 | .m_size = 20, | ||
| 669 | .algo = OID_id_ecdsa_with_sha1, | ||
| 670 | .c = | ||
| 671 | "\x30\x35\x02\x19\x00\xba\xe5\x93\x83\x6e\xb6\x3b\x63\xa0\x27\x91" | ||
| 672 | "\xc6\xf6\x7f\xc3\x09\xad\x59\xad\x88\x27\xd6\x92\x6b\x02\x18\x10" | ||
| 673 | "\x68\x01\x9d\xba\xce\x83\x08\xef\x95\x52\x7b\xa0\x0f\xe4\x18\x86" | ||
| 674 | "\x80\x6f\xa5\x79\x77\xda\xd0", | ||
| 675 | .c_size = 55, | ||
| 676 | .public_key_vec = true, | ||
| 677 | .siggen_sigver_test = true, | ||
| 678 | }, { | ||
| 679 | .key = | ||
| 656 | "\x04\xb6\x4b\xb1\xd1\xac\xba\x24\x8f\x65\xb2\x60\x00\x90\xbf\xbd" | 680 | "\x04\xb6\x4b\xb1\xd1\xac\xba\x24\x8f\x65\xb2\x60\x00\x90\xbf\xbd" |
| 657 | "\x78\x05\x73\xe9\x79\x1d\x6f\x7c\x0b\xd2\xc3\x93\xa7\x28\xe1\x75" | 681 | "\x78\x05\x73\xe9\x79\x1d\x6f\x7c\x0b\xd2\xc3\x93\xa7\x28\xe1\x75" |
| 658 | "\xf7\xd5\x95\x1d\x28\x10\xc0\x75\x50\x5c\x1a\x4f\x3f\x8f\xa5\xee" | 682 | "\xf7\xd5\x95\x1d\x28\x10\xc0\x75\x50\x5c\x1a\x4f\x3f\x8f\xa5\xee" |
| @@ -756,6 +780,32 @@ static const struct akcipher_testvec ecdsa_nist_p192_tv_template[] = { · 97 unmodified lines | |||
| 756 | static const struct akcipher_testvec ecdsa_nist_p256_tv_template[] = { | 780 | static const struct akcipher_testvec ecdsa_nist_p256_tv_template[] = { |
| 757 | { | 781 | { |
| 758 | .key = | 782 | .key = |
| 783 | "\x04\xb9\x7b\xbb\xd7\x17\x64\xd2\x7e\xfc\x81\x5d\x87\x06\x83\x41" | ||
| 784 | "\x22\xd6\x9a\xaa\x87\x17\xec\x4f\x63\x55\x2f\x94\xba\xdd\x83\xe9" | ||
| 785 | "\x34\x4b\xf3\xe9\x91\x13\x50\xb6\xcb\xca\x62\x08\xe7\x3b\x09\xdc" | ||
| 786 | "\xc3\x63\x4b\x2d\xb9\x73\x53\xe4\x45\xe6\x7c\xad\xe7\x6b\xb0\xe8" | ||
| 787 | "\xaf", | ||
| 788 | .key_len = 65, | ||
| 789 | .params = | ||
| 790 | "\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48" | ||
| 791 | "\xce\x3d\x03\x01\x07", | ||
| 792 | .param_len = 21, | ||
| 793 | .m = | ||
| 794 | "\xc2\x2b\x5f\x91\x78\x34\x26\x09\x42\x8d\x6f\x51\xb2\xc5\xaf\x4c" | ||
| 795 | "\x0b\xde\x6a\x42", | ||
| 796 | .m_size = 20, | ||
| 797 | .algo = OID_id_ecdsa_with_sha1, | ||
| 798 | .c = | ||
| 799 | "\x30\x46\x02\x21\x00\xf9\x25\xce\x9f\x3a\xa6\x35\x81\xcf\xd4\xe7" | ||
| 800 | "\xb7\xf0\x82\x56\x41\xf7\xd4\xad\x8d\x94\x5a\x69\x89\xee\xca\x6a" | ||
| 801 | "\x52\x0e\x48\x4d\xcc\x02\x21\x00\xd7\xe4\xef\x52\x66\xd3\x5b\x9d" | ||
| 802 | "\x8a\xfa\x54\x93\x29\xa7\x70\x86\xf1\x03\x03\xf3\x3b\xe2\x73\xf7" | ||
| 803 | "\xfb\x9d\x8b\xde\xd4\x8d\x6f\xad", | ||
| 804 | .c_size = 72, | ||
| 805 | .public_key_vec = true, | ||
| 806 | .siggen_sigver_test = true, | ||
| 807 | }, { | ||
| 808 | .key = | ||
| 759 | "\x04\x8b\x6d\xc0\x33\x8e\x2d\x8b\x67\xf5\xeb\xc4\x7f\xa0\xf5\xd9" | 809 | "\x04\x8b\x6d\xc0\x33\x8e\x2d\x8b\x67\xf5\xeb\xc4\x7f\xa0\xf5\xd9" |
| 760 | "\x7b\x03\xa5\x78\x9a\xb5\xea\x14\xe4\x23\xd0\xaf\xd7\x0e\x2e\xa0" | 810 | "\x7b\x03\xa5\x78\x9a\xb5\xea\x14\xe4\x23\xd0\xaf\xd7\x0e\x2e\xa0" |
| 761 | "\xc9\x8b\xdb\x95\xf8\xb3\xaf\xac\x00\x2c\x2c\x1f\x7a\xfd\x95\x88" | 811 | "\xc9\x8b\xdb\x95\xf8\xb3\xaf\xac\x00\x2c\x2c\x1f\x7a\xfd\x95\x88" |
| @@ -866,6 +916,36 @@ static const struct akcipher_testvec ecdsa_nist_p256_tv_template[] = { · 104 unmodified lines | |||
| 866 | 916 | ||
| 867 | static const struct akcipher_testvec ecdsa_nist_p384_tv_template[] = { | 917 | static const struct akcipher_testvec ecdsa_nist_p384_tv_template[] = { |
| 868 | { | 918 | { |
| 919 | .key = /* secp384r1(sha1) */ | ||
| 920 | "\x04\x89\x25\xf3\x97\x88\xcb\xb0\x78\xc5\x72\x9a\x14\x6e\x7a\xb1" | ||
| 921 | "\x5a\xa5\x24\xf1\x95\x06\x9e\x28\xfb\xc4\xb9\xbe\x5a\x0d\xd9\x9f" | ||
| 922 | "\xf3\xd1\x4d\x2d\x07\x99\xbd\xda\xa7\x66\xec\xbb\xea\xba\x79\x42" | ||
| 923 | "\xc9\x34\x89\x6a\xe7\x0b\xc3\xf2\xfe\x32\x30\xbe\xba\xf9\xdf\x7e" | ||
| 924 | "\x4b\x6a\x07\x8e\x26\x66\x3f\x1d\xec\xa2\x57\x91\x51\xdd\x17\x0e" | ||
| 925 | "\x0b\x25\xd6\x80\x5c\x3b\xe6\x1a\x98\x48\x91\x45\x7a\x73\xb0\xc3" | ||
| 926 | "\xf1", | ||
| 927 | .key_len = 97, | ||
| 928 | .params = | ||
| 929 | "\x30\x10\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x05\x2b\x81\x04" | ||
| 930 | "\x00\x22", | ||
| 931 | .param_len = 18, | ||
| 932 | .m = | ||
| 933 | "\x12\x55\x28\xf0\x77\xd5\xb6\x21\x71\x32\x48\xcd\x28\xa8\x25\x22" | ||
| 934 | "\x3a\x69\xc1\x93", | ||
| 935 | .m_size = 20, | ||
| 936 | .algo = OID_id_ecdsa_with_sha1, | ||
| 937 | .c = | ||
| 938 | "\x30\x66\x02\x31\x00\xf5\x0f\x24\x4c\x07\x93\x6f\x21\x57\x55\x07" | ||
| 939 | "\x20\x43\x30\xde\xa0\x8d\x26\x8e\xae\x63\x3f\xbc\x20\x3a\xc6\xf1" | ||
| 940 | "\x32\x3c\xce\x70\x2b\x78\xf1\x4c\x26\xe6\x5b\x86\xcf\xec\x7c\x7e" | ||
| 941 | "\xd0\x87\xd7\xd7\x6e\x02\x31\x00\xcd\xbb\x7e\x81\x5d\x8f\x63\xc0" | ||
| 942 | "\x5f\x63\xb1\xbe\x5e\x4c\x0e\xa1\xdf\x28\x8c\x1b\xfa\xf9\x95\x88" | ||
| 943 | "\x74\xa0\x0f\xbf\xaf\xc3\x36\x76\x4a\xa1\x59\xf1\x1c\xa4\x58\x26" | ||
| 944 | "\x79\x12\x2a\xb7\xc5\x15\x92\xc5", | ||
| 945 | .c_size = 104, | ||
| 946 | .public_key_vec = true, | ||
| 947 | .siggen_sigver_test = true, | ||
| 948 | }, { | ||
| 869 | .key = /* secp384r1(sha224) */ | 949 | .key = /* secp384r1(sha224) */ |
| 870 | "\x04\x69\x6c\xcf\x62\xee\xd0\x0d\xe5\xb5\x2f\x70\x54\xcf\x26\xa0" | 950 | "\x04\x69\x6c\xcf\x62\xee\xd0\x0d\xe5\xb5\x2f\x70\x54\xcf\x26\xa0" |
| 871 | "\xd9\x98\x8d\x92\x2a\xab\x9b\x11\xcb\x48\x18\xa1\xa9\x0d\xd5\x18" | 951 | "\xd9\x98\x8d\x92\x2a\xab\x9b\x11\xcb\x48\x18\xa1\xa9\x0d\xd5\x18" |
| @@ -550,8 +550,12 @@ acpi_db_walk_for_fields(acpi_handle obj_handle, · 549 unmodified lines | |||
| 550 | ACPI_FREE(buffer.pointer); | 550 | ACPI_FREE(buffer.pointer); |
| 551 | 551 | ||
| 552 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 552 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
| 553 | acpi_evaluate_object(obj_handle, NULL, NULL, &buffer); | 553 | status = acpi_evaluate_object(obj_handle, NULL, NULL, &buffer); |
| 554 | 554 | if (ACPI_FAILURE(status)) { | |
| 555 | acpi_os_printf("Could Not evaluate object %p\n", | ||
| 556 | obj_handle); | ||
| 557 | return (AE_OK); | ||
| 558 | } | ||
| 555 | /* | 559 | /* |
| 556 | * Since this is a field unit, surround the output in braces | 560 | * Since this is a field unit, surround the output in braces |
| 557 | */ | 561 | */ |
| @@ -851,7 +851,7 @@ err_put_table: · 850 unmodified lines | |||
| 851 | return rc; | 851 | return rc; |
| 852 | } | 852 | } |
| 853 | 853 | ||
| 854 | static void __exit einj_remove(struct platform_device *pdev) | 854 | static void einj_remove(struct platform_device *pdev) |
| 855 | { | 855 | { |
| 856 | struct apei_exec_context ctx; | 856 | struct apei_exec_context ctx; |
| 857 | 857 | ||
| @@ -712,8 +712,10 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) · 711 unmodified lines | |||
| 712 | ehc->saved_ncq_enabled |= 1 << devno; | 712 | ehc->saved_ncq_enabled |= 1 << devno; |
| 713 | 713 | ||
| 714 | /* If we are resuming, wake up the device */ | 714 | /* If we are resuming, wake up the device */ |
| 715 | if (ap->pflags & ATA_PFLAG_RESUMING) | 715 | if (ap->pflags & ATA_PFLAG_RESUMING) { |
| 716 | dev->flags |= ATA_DFLAG_RESUMING; | ||
| 716 | ehc->i.dev_action[devno] |= ATA_EH_SET_ACTIVE; | 717 | ehc->i.dev_action[devno] |= ATA_EH_SET_ACTIVE; |
| 718 | } | ||
| 717 | } | 719 | } |
| 718 | } | 720 | } |
| 719 | 721 | ||
| @@ -3169,6 +3171,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, · 2449 unmodified lines | |||
| 3169 | return 0; | 3171 | return 0; |
| 3170 | 3172 | ||
| 3171 | err: | 3173 | err: |
| 3174 | dev->flags &= ~ATA_DFLAG_RESUMING; | ||
| 3172 | *r_failed_dev = dev; | 3175 | *r_failed_dev = dev; |
| 3173 | return rc; | 3176 | return rc; |
| 3174 | } | 3177 | } |
| @@ -4730,6 +4730,7 @@ void ata_scsi_dev_rescan(struct work_struct *work) · 4729 unmodified lines | |||
| 4730 | struct ata_link *link; | 4730 | struct ata_link *link; |
| 4731 | struct ata_device *dev; | 4731 | struct ata_device *dev; |
| 4732 | unsigned long flags; | 4732 | unsigned long flags; |
| 4733 | bool do_resume; | ||
| 4733 | int ret = 0; | 4734 | int ret = 0; |
| 4734 | 4735 | ||
| 4735 | mutex_lock(&ap->scsi_scan_mutex); | 4736 | mutex_lock(&ap->scsi_scan_mutex); |
| @@ -4751,7 +4752,15 @@ void ata_scsi_dev_rescan(struct work_struct *work) · 15 unmodified lines | |||
| 4751 | if (scsi_device_get(sdev)) | 4752 | if (scsi_device_get(sdev)) |
| 4752 | continue; | 4753 | continue; |
| 4753 | 4754 | ||
| 4755 | do_resume = dev->flags & ATA_DFLAG_RESUMING; | ||
| 4756 | |||
| 4754 | spin_unlock_irqrestore(ap->lock, flags); | 4757 | spin_unlock_irqrestore(ap->lock, flags); |
| 4758 | if (do_resume) { | ||
| 4759 | ret = scsi_resume_device(sdev); | ||
| 4760 | if (ret == -EWOULDBLOCK) | ||
| 4761 | goto unlock; | ||
| 4762 | dev->flags &= ~ATA_DFLAG_RESUMING; | ||
| 4763 | } | ||
| 4755 | ret = scsi_rescan_device(sdev); | 4764 | ret = scsi_rescan_device(sdev); |
| 4756 | scsi_device_put(sdev); | 4765 | scsi_device_put(sdev); |
| 4757 | spin_lock_irqsave(ap->lock, flags); | 4766 | spin_lock_irqsave(ap->lock, flags); |
| @@ -806,6 +806,8 @@ static int save_iaa_wq(struct idxd_wq *wq) · 805 unmodified lines | |||
| 806 | return -EINVAL; | 806 | return -EINVAL; |
| 807 | 807 | ||
| 808 | cpus_per_iaa = (nr_nodes * nr_cpus_per_node) / nr_iaa; | 808 | cpus_per_iaa = (nr_nodes * nr_cpus_per_node) / nr_iaa; |
| 809 | if (!cpus_per_iaa) | ||
| 810 | cpus_per_iaa = 1; | ||
| 809 | out: | 811 | out: |
| 810 | return 0; | 812 | return 0; |
| 811 | } | 813 | } |
| @@ -821,10 +823,12 @@ static void remove_iaa_wq(struct idxd_wq *wq) · 9 unmodified lines | |||
| 821 | } | 823 | } |
| 822 | } | 824 | } |
| 823 | 825 | ||
| 824 | if (nr_iaa) | 826 | if (nr_iaa) { |
| 825 | cpus_per_iaa = (nr_nodes * nr_cpus_per_node) / nr_iaa; | 827 | cpus_per_iaa = (nr_nodes * nr_cpus_per_node) / nr_iaa; |
| 826 | else | 828 | if (!cpus_per_iaa) |
| 827 | cpus_per_iaa = 0; | 829 | cpus_per_iaa = 1; |
| 830 | } else | ||
| 831 | cpus_per_iaa = 1; | ||
| 828 | } | 832 | } |
| 829 | 833 | ||
| 830 | static int wq_table_add_wqs(int iaa, int cpu) | 834 | static int wq_table_add_wqs(int iaa, int cpu) |
| @@ -144,17 +144,4 @@ config CXL_REGION_INVALIDATION_TEST · 143 unmodified lines | |||
| 144 | If unsure, or if this kernel is meant for production environments, | 144 | If unsure, or if this kernel is meant for production environments, |
| 145 | say N. | 145 | say N. |
| 146 | 146 | ||
| 147 | config CXL_PMU | ||
| 148 | tristate "CXL Performance Monitoring Unit" | ||
| 149 | default CXL_BUS | ||
| 150 | depends on PERF_EVENTS | ||
| 151 | help | ||
| 152 | Support performance monitoring as defined in CXL rev 3.0 | ||
| 153 | section 13.2: Performance Monitoring. CXL components may have | ||
| 154 | one or more CXL Performance Monitoring Units (CPMUs). | ||
| 155 | |||
| 156 | Say 'y/m' to enable a driver that will attach to performance | ||
| 157 | monitoring units and provide standard perf based interfaces. | ||
| 158 | |||
| 159 | If unsure say 'm'. | ||
| 160 | endif | 147 | endif |
| @@ -84,11 +84,11 @@ static int sanitycheck(void *arg) · 83 unmodified lines | |||
| 84 | return -ENOMEM; | 84 | return -ENOMEM; |
| 85 | 85 | ||
| 86 | chain = mock_chain(NULL, f, 1); | 86 | chain = mock_chain(NULL, f, 1); |
| 87 | if (!chain) | 87 | if (chain) |
| 88 | dma_fence_enable_sw_signaling(chain); | ||
| 89 | else | ||
| 88 | err = -ENOMEM; | 90 | err = -ENOMEM; |
| 89 | 91 | ||
| 90 | dma_fence_enable_sw_signaling(chain); | ||
| 91 | |||
| 92 | dma_fence_signal(f); | 92 | dma_fence_signal(f); |
| 93 | dma_fence_put(f); | 93 | dma_fence_put(f); |
| 94 | 94 | ||
| @@ -4,4 +4,4 @@ · 3 unmodified lines | |||
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | config DPLL | 6 | config DPLL |
| 7 | bool | 7 | bool |
| @@ -120,7 +120,7 @@ efi_status_t efi_random_alloc(unsigned long size, · 119 unmodified lines | |||
| 120 | continue; | 120 | continue; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | target = round_up(max(md->phys_addr, alloc_min), align) + target_slot * align; | 123 | target = round_up(max_t(u64, md->phys_addr, alloc_min), align) + target_slot * align; |
| 124 | pages = size / EFI_PAGE_SIZE; | 124 | pages = size / EFI_PAGE_SIZE; |
| 125 | 125 | ||
| 126 | status = efi_bs_call(allocate_pages, EFI_ALLOCATE_ADDRESS, | 126 | status = efi_bs_call(allocate_pages, EFI_ALLOCATE_ADDRESS, |
| @@ -496,6 +496,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, · 495 unmodified lines | |||
| 496 | hdr->vid_mode = 0xffff; | 496 | hdr->vid_mode = 0xffff; |
| 497 | 497 | ||
| 498 | hdr->type_of_loader = 0x21; | 498 | hdr->type_of_loader = 0x21; |
| 499 | hdr->initrd_addr_max = INT_MAX; | ||
| 499 | 500 | ||
| 500 | /* Convert unicode cmdline to ascii */ | 501 | /* Convert unicode cmdline to ascii */ |
| 501 | cmdline_ptr = efi_convert_cmdline(image, &options_size); | 502 | cmdline_ptr = efi_convert_cmdline(image, &options_size); |
| @@ -1083,10 +1083,20 @@ static u32 gpio_v2_line_config_debounce_period(struct gpio_v2_line_config *lc, · 1082 unmodified lines | |||
| 1083 | return 0; | 1083 | return 0; |
| 1084 | } | 1084 | } |
| 1085 | 1085 | ||
| 1086 | static inline char *make_irq_label(const char *orig) | ||
| 1087 | { | ||
| 1088 | return kstrdup_and_replace(orig, '/', ':', GFP_KERNEL); | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | static inline void free_irq_label(const char *label) | ||
| 1092 | { | ||
| 1093 | kfree(label); | ||
| 1094 | } | ||
| 1095 | |||
| 1086 | static void edge_detector_stop(struct line *line) | 1096 | static void edge_detector_stop(struct line *line) |
| 1087 | { | 1097 | { |
| 1088 | if (line->irq) { | 1098 | if (line->irq) { |
| 1089 | free_irq(line->irq, line); | 1099 | free_irq_label(free_irq(line->irq, line)); |
| 1090 | line->irq = 0; | 1100 | line->irq = 0; |
| 1091 | } | 1101 | } |
| 1092 | 1102 | ||
| @@ -1110,6 +1120,7 @@ static int edge_detector_setup(struct line *line, · 17 unmodified lines | |||
| 1110 | unsigned long irqflags = 0; | 1120 | unsigned long irqflags = 0; |
| 1111 | u64 eflags; | 1121 | u64 eflags; |
| 1112 | int irq, ret; | 1122 | int irq, ret; |
| 1123 | char *label; | ||
| 1113 | 1124 | ||
| 1114 | eflags = edflags & GPIO_V2_LINE_EDGE_FLAGS; | 1125 | eflags = edflags & GPIO_V2_LINE_EDGE_FLAGS; |
| 1115 | if (eflags && !kfifo_initialized(&line->req->events)) { | 1126 | if (eflags && !kfifo_initialized(&line->req->events)) { |
| @@ -1146,11 +1157,17 @@ static int edge_detector_setup(struct line *line, · 30 unmodified lines | |||
| 1146 | IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING; | 1157 | IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING; |
| 1147 | irqflags |= IRQF_ONESHOT; | 1158 | irqflags |= IRQF_ONESHOT; |
| 1148 | 1159 | ||
| 1160 | label = make_irq_label(line->req->label); | ||
| 1161 | if (!label) | ||
| 1162 | return -ENOMEM; | ||
| 1163 | |||
| 1149 | /* Request a thread to read the events */ | 1164 | /* Request a thread to read the events */ |
| 1150 | ret = request_threaded_irq(irq, edge_irq_handler, edge_irq_thread, | 1165 | ret = request_threaded_irq(irq, edge_irq_handler, edge_irq_thread, |
| 1151 | irqflags, line->req->label, line); | 1166 | irqflags, label, line); |
| 1152 | if (ret) | 1167 | if (ret) { |
| 1168 | free_irq_label(label); | ||
| 1153 | return ret; | 1169 | return ret; |
| 1170 | } | ||
| 1154 | 1171 | ||
| 1155 | line->irq = irq; | 1172 | line->irq = irq; |
| 1156 | return 0; | 1173 | return 0; |
| @@ -1973,7 +1990,7 @@ static void lineevent_free(struct lineevent_state *le) · 816 unmodified lines | |||
| 1973 | blocking_notifier_chain_unregister(&le->gdev->device_notifier, | 1990 | blocking_notifier_chain_unregister(&le->gdev->device_notifier, |
| 1974 | &le->device_unregistered_nb); | 1991 | &le->device_unregistered_nb); |
| 1975 | if (le->irq) | 1992 | if (le->irq) |
| 1976 | free_irq(le->irq, le); | 1993 | free_irq_label(free_irq(le->irq, le)); |
| 1977 | if (le->desc) | 1994 | if (le->desc) |
| 1978 | gpiod_free(le->desc); | 1995 | gpiod_free(le->desc); |
| 1979 | kfree(le->label); | 1996 | kfree(le->label); |
| @@ -2114,6 +2131,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) · 134 unmodified lines | |||
| 2114 | int fd; | 2131 | int fd; |
| 2115 | int ret; | 2132 | int ret; |
| 2116 | int irq, irqflags = 0; | 2133 | int irq, irqflags = 0; |
| 2134 | char *label; | ||
| 2117 | 2135 | ||
| 2118 | if (copy_from_user(&eventreq, ip, sizeof(eventreq))) | 2136 | if (copy_from_user(&eventreq, ip, sizeof(eventreq))) |
| 2119 | return -EFAULT; | 2137 | return -EFAULT; |
| @@ -2198,15 +2216,23 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) · 78 unmodified lines | |||
| 2198 | if (ret) | 2216 | if (ret) |
| 2199 | goto out_free_le; | 2217 | goto out_free_le; |
| 2200 | 2218 | ||
| 2219 | label = make_irq_label(le->label); | ||
| 2220 | if (!label) { | ||
| 2221 | ret = -ENOMEM; | ||
| 2222 | goto out_free_le; | ||
| 2223 | } | ||
| 2224 | |||
| 2201 | /* Request a thread to read the events */ | 2225 | /* Request a thread to read the events */ |
| 2202 | ret = request_threaded_irq(irq, | 2226 | ret = request_threaded_irq(irq, |
| 2203 | lineevent_irq_handler, | 2227 | lineevent_irq_handler, |
| 2204 | lineevent_irq_thread, | 2228 | lineevent_irq_thread, |
| 2205 | irqflags, | 2229 | irqflags, |
| 2206 | le->label, | 2230 | label, |
| 2207 | le); | 2231 | le); |
| 2208 | if (ret) | 2232 | if (ret) { |
| 2233 | free_irq_label(label); | ||
| 2209 | goto out_free_le; | 2234 | goto out_free_le; |
| 2235 | } | ||
| 2210 | 2236 | ||
| 2211 | le->irq = irq; | 2237 | le->irq = irq; |
| 2212 | 2238 | ||
| @@ -2397,6 +2397,11 @@ char *gpiochip_dup_line_label(struct gpio_chip *gc, unsigned int offset) · 2396 unmodified lines | |||
| 2397 | } | 2397 | } |
| 2398 | EXPORT_SYMBOL_GPL(gpiochip_dup_line_label); | 2398 | EXPORT_SYMBOL_GPL(gpiochip_dup_line_label); |
| 2399 | 2399 | ||
| 2400 | static inline const char *function_name_or_default(const char *con_id) | ||
| 2401 | { | ||
| 2402 | return con_id ?: "(default)"; | ||
| 2403 | } | ||
| 2404 | |||
| 2400 | /** | 2405 | /** |
| 2401 | * gpiochip_request_own_desc - Allow GPIO chip to request its own descriptor | 2406 | * gpiochip_request_own_desc - Allow GPIO chip to request its own descriptor |
| 2402 | * @gc: GPIO chip | 2407 | * @gc: GPIO chip |
| @@ -2425,10 +2430,11 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc, · 22 unmodified lines | |||
| 2425 | enum gpiod_flags dflags) | 2430 | enum gpiod_flags dflags) |
| 2426 | { | 2431 | { |
| 2427 | struct gpio_desc *desc = gpiochip_get_desc(gc, hwnum); | 2432 | struct gpio_desc *desc = gpiochip_get_desc(gc, hwnum); |
| 2433 | const char *name = function_name_or_default(label); | ||
| 2428 | int ret; | 2434 | int ret; |
| 2429 | 2435 | ||
| 2430 | if (IS_ERR(desc)) { | 2436 | if (IS_ERR(desc)) { |
| 2431 | chip_err(gc, "failed to get GPIO descriptor\n"); | 2437 | chip_err(gc, "failed to get GPIO %s descriptor\n", name); |
| 2432 | return desc; | 2438 | return desc; |
| 2433 | } | 2439 | } |
| 2434 | 2440 | ||
| @@ -2438,8 +2444,8 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc, · 3 unmodified lines | |||
| 2438 | 2444 | ||
| 2439 | ret = gpiod_configure_flags(desc, label, lflags, dflags); | 2445 | ret = gpiod_configure_flags(desc, label, lflags, dflags); |
| 2440 | if (ret) { | 2446 | if (ret) { |
| 2441 | chip_err(gc, "setup of own GPIO %s failed\n", label); | ||
| 2442 | gpiod_free_commit(desc); | 2447 | gpiod_free_commit(desc); |
| 2448 | chip_err(gc, "setup of own GPIO %s failed\n", name); | ||
| 2443 | return ERR_PTR(ret); | 2449 | return ERR_PTR(ret); |
| 2444 | } | 2450 | } |
| 2445 | 2451 | ||
| @@ -4153,19 +4159,17 @@ static struct gpio_desc *gpiod_find_by_fwnode(struct fwnode_handle *fwnode, · 1707 unmodified lines | |||
| 4153 | enum gpiod_flags *flags, | 4159 | enum gpiod_flags *flags, |
| 4154 | unsigned long *lookupflags) | 4160 | unsigned long *lookupflags) |
| 4155 | { | 4161 | { |
| 4162 | const char *name = function_name_or_default(con_id); | ||
| 4156 | struct gpio_desc *desc = ERR_PTR(-ENOENT); | 4163 | struct gpio_desc *desc = ERR_PTR(-ENOENT); |
| 4157 | 4164 | ||
| 4158 | if (is_of_node(fwnode)) { | 4165 | if (is_of_node(fwnode)) { |
| 4159 | dev_dbg(consumer, "using DT '%pfw' for '%s' GPIO lookup\n", | 4166 | dev_dbg(consumer, "using DT '%pfw' for '%s' GPIO lookup\n", fwnode, name); |
| 4160 | fwnode, con_id); | ||
| 4161 | desc = of_find_gpio(to_of_node(fwnode), con_id, idx, lookupflags); | 4167 | desc = of_find_gpio(to_of_node(fwnode), con_id, idx, lookupflags); |
| 4162 | } else if (is_acpi_node(fwnode)) { | 4168 | } else if (is_acpi_node(fwnode)) { |
| 4163 | dev_dbg(consumer, "using ACPI '%pfw' for '%s' GPIO lookup\n", | 4169 | dev_dbg(consumer, "using ACPI '%pfw' for '%s' GPIO lookup\n", fwnode, name); |
| 4164 | fwnode, con_id); | ||
| 4165 | desc = acpi_find_gpio(fwnode, con_id, idx, flags, lookupflags); | 4170 | desc = acpi_find_gpio(fwnode, con_id, idx, flags, lookupflags); |
| 4166 | } else if (is_software_node(fwnode)) { | 4171 | } else if (is_software_node(fwnode)) { |
| 4167 | dev_dbg(consumer, "using swnode '%pfw' for '%s' GPIO lookup\n", | 4172 | dev_dbg(consumer, "using swnode '%pfw' for '%s' GPIO lookup\n", fwnode, name); |
| 4168 | fwnode, con_id); | ||
| 4169 | desc = swnode_find_gpio(fwnode, con_id, idx, lookupflags); | 4173 | desc = swnode_find_gpio(fwnode, con_id, idx, lookupflags); |
| 4170 | } | 4174 | } |
| 4171 | 4175 | ||
| @@ -4181,6 +4185,7 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 9 unmodified lines | |||
| 4181 | bool platform_lookup_allowed) | 4185 | bool platform_lookup_allowed) |
| 4182 | { | 4186 | { |
| 4183 | unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT; | 4187 | unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT; |
| 4188 | const char *name = function_name_or_default(con_id); | ||
| 4184 | /* | 4189 | /* |
| 4185 | * scoped_guard() is implemented as a for loop, meaning static | 4190 | * scoped_guard() is implemented as a for loop, meaning static |
| 4186 | * analyzers will complain about these two not being initialized. | 4191 | * analyzers will complain about these two not being initialized. |
| @@ -4203,8 +4208,7 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 16 unmodified lines | |||
| 4203 | } | 4208 | } |
| 4204 | 4209 | ||
| 4205 | if (IS_ERR(desc)) { | 4210 | if (IS_ERR(desc)) { |
| 4206 | dev_dbg(consumer, "No GPIO consumer %s found\n", | 4211 | dev_dbg(consumer, "No GPIO consumer %s found\n", name); |
| 4207 | con_id); | ||
| 4208 | return desc; | 4212 | return desc; |
| 4209 | } | 4213 | } |
| 4210 | 4214 | ||
| @@ -4226,15 +4230,14 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 15 unmodified lines | |||
| 4226 | * | 4230 | * |
| 4227 | * FIXME: Make this more sane and safe. | 4231 | * FIXME: Make this more sane and safe. |
| 4228 | */ | 4232 | */ |
| 4229 | dev_info(consumer, | 4233 | dev_info(consumer, "nonexclusive access to GPIO for %s\n", name); |
| 4230 | "nonexclusive access to GPIO for %s\n", con_id); | ||
| 4231 | return desc; | 4234 | return desc; |
| 4232 | } | 4235 | } |
| 4233 | 4236 | ||
| 4234 | ret = gpiod_configure_flags(desc, con_id, lookupflags, flags); | 4237 | ret = gpiod_configure_flags(desc, con_id, lookupflags, flags); |
| 4235 | if (ret < 0) { | 4238 | if (ret < 0) { |
| 4236 | dev_dbg(consumer, "setup of GPIO %s failed\n", con_id); | ||
| 4237 | gpiod_put(desc); | 4239 | gpiod_put(desc); |
| 4240 | dev_dbg(consumer, "setup of GPIO %s failed\n", name); | ||
| 4238 | return ERR_PTR(ret); | 4241 | return ERR_PTR(ret); |
| 4239 | } | 4242 | } |
| 4240 | 4243 | ||
| @@ -4350,6 +4353,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_optional); · 109 unmodified lines | |||
| 4350 | int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, | 4353 | int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, |
| 4351 | unsigned long lflags, enum gpiod_flags dflags) | 4354 | unsigned long lflags, enum gpiod_flags dflags) |
| 4352 | { | 4355 | { |
| 4356 | const char *name = function_name_or_default(con_id); | ||
| 4353 | int ret; | 4357 | int ret; |
| 4354 | 4358 | ||
| 4355 | if (lflags & GPIO_ACTIVE_LOW) | 4359 | if (lflags & GPIO_ACTIVE_LOW) |
| @@ -4393,7 +4397,7 @@ int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, · 37 unmodified lines | |||
| 4393 | 4397 | ||
| 4394 | /* No particular flag request, return here... */ | 4398 | /* No particular flag request, return here... */ |
| 4395 | if (!(dflags & GPIOD_FLAGS_BIT_DIR_SET)) { | 4399 | if (!(dflags & GPIOD_FLAGS_BIT_DIR_SET)) { |
| 4396 | gpiod_dbg(desc, "no flags found for %s\n", con_id); | 4400 | gpiod_dbg(desc, "no flags found for GPIO %s\n", name); |
| 4397 | return 0; | 4401 | return 0; |
| 4398 | } | 4402 | } |
| 4399 | 4403 | ||
| @@ -4539,6 +4539,8 @@ int amdgpu_device_prepare(struct drm_device *dev) · 4538 unmodified lines | |||
| 4539 | if (r) | 4539 | if (r) |
| 4540 | goto unprepare; | 4540 | goto unprepare; |
| 4541 | 4541 | ||
| 4542 | flush_delayed_work(&adev->gfx.gfx_off_delay_work); | ||
| 4543 | |||
| 4542 | for (i = 0; i < adev->num_ip_blocks; i++) { | 4544 | for (i = 0; i < adev->num_ip_blocks; i++) { |
| 4543 | if (!adev->ip_blocks[i].status.valid) | 4545 | if (!adev->ip_blocks[i].status.valid) |
| 4544 | continue; | 4546 | continue; |
| @@ -2237,6 +2237,7 @@ static int amdgpu_discovery_set_umsch_mm_ip_blocks(struct amdgpu_device *adev) · 2236 unmodified lines | |||
| 2237 | { | 2237 | { |
| 2238 | switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) { | 2238 | switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) { |
| 2239 | case IP_VERSION(4, 0, 5): | 2239 | case IP_VERSION(4, 0, 5): |
| 2240 | case IP_VERSION(4, 0, 6): | ||
| 2240 | if (amdgpu_umsch_mm & 0x1) { | 2241 | if (amdgpu_umsch_mm & 0x1) { |
| 2241 | amdgpu_device_ip_block_add(adev, &umsch_mm_v4_0_ip_block); | 2242 | amdgpu_device_ip_block_add(adev, &umsch_mm_v4_0_ip_block); |
| 2242 | adev->enable_umsch_mm = true; | 2243 | adev->enable_umsch_mm = true; |
| @@ -524,46 +524,58 @@ static ssize_t amdgpu_debugfs_mqd_read(struct file *f, char __user *buf, · 523 unmodified lines | |||
| 524 | { | 524 | { |
| 525 | struct amdgpu_ring *ring = file_inode(f)->i_private; | 525 | struct amdgpu_ring *ring = file_inode(f)->i_private; |
| 526 | volatile u32 *mqd; | 526 | volatile u32 *mqd; |
| 527 | int r; | 527 | u32 *kbuf; |
| 528 | int r, i; | ||
| 528 | uint32_t value, result; | 529 | uint32_t value, result; |
| 529 | 530 | ||
| 530 | if (*pos & 3 || size & 3) | 531 | if (*pos & 3 || size & 3) |
| 531 | return -EINVAL; | 532 | return -EINVAL; |
| 532 | 533 | ||
| 533 | result = 0; | 534 | kbuf = kmalloc(ring->mqd_size, GFP_KERNEL); |
| 535 | if (!kbuf) | ||
| 536 | return -ENOMEM; | ||
| 534 | 537 | ||
| 535 | r = amdgpu_bo_reserve(ring->mqd_obj, false); | 538 | r = amdgpu_bo_reserve(ring->mqd_obj, false); |
| 536 | if (unlikely(r != 0)) | 539 | if (unlikely(r != 0)) |
| 537 | return r; | 540 | goto err_free; |
| 538 | 541 | ||
| 539 | r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&mqd); | 542 | r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&mqd); |
| 540 | if (r) { | 543 | if (r) |
| 541 | amdgpu_bo_unreserve(ring->mqd_obj); | 544 | goto err_unreserve; |
| 542 | return r; | ||
| 543 | } | ||
| 544 | 545 | ||
| 546 | /* | ||
| 547 | * Copy to local buffer to avoid put_user(), which might fault | ||
| 548 | * and acquire mmap_sem, under reservation_ww_class_mutex. | ||
| 549 | */ | ||
| 550 | for (i = 0; i < ring->mqd_size/sizeof(u32); i++) | ||
| 551 | kbuf[i] = mqd[i]; | ||
| 552 | |||
| 553 | amdgpu_bo_kunmap(ring->mqd_obj); | ||
| 554 | amdgpu_bo_unreserve(ring->mqd_obj); | ||
| 555 | |||
| 556 | result = 0; | ||
| 545 | while (size) { | 557 | while (size) { |
| 546 | if (*pos >= ring->mqd_size) | 558 | if (*pos >= ring->mqd_size) |
| 547 | goto done; | 559 | break; |
| 548 | 560 | ||
| 549 | value = mqd[*pos/4]; | 561 | value = kbuf[*pos/4]; |
| 550 | r = put_user(value, (uint32_t *)buf); | 562 | r = put_user(value, (uint32_t *)buf); |
| 551 | if (r) | 563 | if (r) |
| 552 | goto done; | 564 | goto err_free; |
| 553 | buf += 4; | 565 | buf += 4; |
| 554 | result += 4; | 566 | result += 4; |
| 555 | size -= 4; | 567 | size -= 4; |
| 556 | *pos += 4; | 568 | *pos += 4; |
| 557 | } | 569 | } |
| 558 | 570 | ||
| 559 | done: | 571 | kfree(kbuf); |
| 560 | amdgpu_bo_kunmap(ring->mqd_obj); | ||
| 561 | mqd = NULL; | ||
| 562 | amdgpu_bo_unreserve(ring->mqd_obj); | ||
| 563 | if (r) | ||
| 564 | return r; | ||
| 565 | |||
| 566 | return result; | 572 | return result; |
| 573 | |||
| 574 | err_unreserve: | ||
| 575 | amdgpu_bo_unreserve(ring->mqd_obj); | ||
| 576 | err_free: | ||
| 577 | kfree(kbuf); | ||
| 578 | return r; | ||
| 567 | } | 579 | } |
| 568 | 580 | ||
| 569 | static const struct file_operations amdgpu_debugfs_mqd_fops = { | 581 | static const struct file_operations amdgpu_debugfs_mqd_fops = { |
| @@ -189,10 +189,13 @@ static void setup_vpe_queue(struct amdgpu_device *adev, · 188 unmodified lines | |||
| 189 | mqd->rptr_val = 0; | 189 | mqd->rptr_val = 0; |
| 190 | mqd->unmapped = 1; | 190 | mqd->unmapped = 1; |
| 191 | 191 | ||
| 192 | if (adev->vpe.collaborate_mode) | ||
| 193 | memcpy(++mqd, test->mqd_data_cpu_addr, sizeof(struct MQD_INFO)); | ||
| 194 | |||
| 192 | qinfo->mqd_addr = test->mqd_data_gpu_addr; | 195 | qinfo->mqd_addr = test->mqd_data_gpu_addr; |
| 193 | qinfo->csa_addr = test->ctx_data_gpu_addr + | 196 | qinfo->csa_addr = test->ctx_data_gpu_addr + |
| 194 | offsetof(struct umsch_mm_test_ctx_data, vpe_ctx_csa); | 197 | offsetof(struct umsch_mm_test_ctx_data, vpe_ctx_csa); |
| 195 | qinfo->doorbell_offset_0 = (adev->doorbell_index.vpe_ring + 1) << 1; | 198 | qinfo->doorbell_offset_0 = 0; |
| 196 | qinfo->doorbell_offset_1 = 0; | 199 | qinfo->doorbell_offset_1 = 0; |
| 197 | } | 200 | } |
| 198 | 201 | ||
| @@ -287,7 +290,10 @@ static int submit_vpe_queue(struct amdgpu_device *adev, struct umsch_mm_test *te · 88 unmodified lines | |||
| 287 | ring[5] = 0; | 290 | ring[5] = 0; |
| 288 | 291 | ||
| 289 | mqd->wptr_val = (6 << 2); | 292 | mqd->wptr_val = (6 << 2); |
| 290 | // WDOORBELL32(adev->umsch_mm.agdb_index[CONTEXT_PRIORITY_LEVEL_NORMAL], mqd->wptr_val); | 293 | if (adev->vpe.collaborate_mode) |
| 294 | (++mqd)->wptr_val = (6 << 2); | ||
| 295 | |||
| 296 | WDOORBELL32(adev->umsch_mm.agdb_index[CONTEXT_PRIORITY_LEVEL_NORMAL], mqd->wptr_val); | ||
| 291 | 297 | ||
| 292 | for (i = 0; i < adev->usec_timeout; i++) { | 298 | for (i = 0; i < adev->usec_timeout; i++) { |
| 293 | if (*fence == test_pattern) | 299 | if (*fence == test_pattern) |
| @@ -571,6 +577,7 @@ int amdgpu_umsch_mm_init_microcode(struct amdgpu_umsch_mm *umsch) · 277 unmodified lines | |||
| 571 | 577 | ||
| 572 | switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) { | 578 | switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) { |
| 573 | case IP_VERSION(4, 0, 5): | 579 | case IP_VERSION(4, 0, 5): |
| 580 | case IP_VERSION(4, 0, 6): | ||
| 574 | fw_name = "amdgpu/umsch_mm_4_0_0.bin"; | 581 | fw_name = "amdgpu/umsch_mm_4_0_0.bin"; |
| 575 | break; | 582 | break; |
| 576 | default: | 583 | default: |
| @@ -750,6 +757,7 @@ static int umsch_mm_early_init(void *handle) · 173 unmodified lines | |||
| 750 | 757 | ||
| 751 | switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) { | 758 | switch (amdgpu_ip_version(adev, VCN_HWIP, 0)) { |
| 752 | case IP_VERSION(4, 0, 5): | 759 | case IP_VERSION(4, 0, 5): |
| 760 | case IP_VERSION(4, 0, 6): | ||
| 753 | umsch_mm_v4_0_set_funcs(&adev->umsch_mm); | 761 | umsch_mm_v4_0_set_funcs(&adev->umsch_mm); |
| 754 | break; | 762 | break; |
| 755 | default: | 763 | default: |
| @@ -33,13 +33,6 @@ enum UMSCH_SWIP_ENGINE_TYPE { · 32 unmodified lines | |||
| 33 | UMSCH_SWIP_ENGINE_TYPE_MAX | 33 | UMSCH_SWIP_ENGINE_TYPE_MAX |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | enum UMSCH_SWIP_AFFINITY_TYPE { | ||
| 37 | UMSCH_SWIP_AFFINITY_TYPE_ANY = 0, | ||
| 38 | UMSCH_SWIP_AFFINITY_TYPE_VCN0 = 1, | ||
| 39 | UMSCH_SWIP_AFFINITY_TYPE_VCN1 = 2, | ||
| 40 | UMSCH_SWIP_AFFINITY_TYPE_MAX | ||
| 41 | }; | ||
| 42 | |||
| 43 | enum UMSCH_CONTEXT_PRIORITY_LEVEL { | 36 | enum UMSCH_CONTEXT_PRIORITY_LEVEL { |
| 44 | CONTEXT_PRIORITY_LEVEL_IDLE = 0, | 37 | CONTEXT_PRIORITY_LEVEL_IDLE = 0, |
| 45 | CONTEXT_PRIORITY_LEVEL_NORMAL = 1, | 38 | CONTEXT_PRIORITY_LEVEL_NORMAL = 1, |
| @@ -51,13 +44,15 @@ enum UMSCH_CONTEXT_PRIORITY_LEVEL { · 5 unmodified lines | |||
| 51 | struct umsch_mm_set_resource_input { | 44 | struct umsch_mm_set_resource_input { |
| 52 | uint32_t vmid_mask_mm_vcn; | 45 | uint32_t vmid_mask_mm_vcn; |
| 53 | uint32_t vmid_mask_mm_vpe; | 46 | uint32_t vmid_mask_mm_vpe; |
| 47 | uint32_t collaboration_mask_vpe; | ||
| 54 | uint32_t logging_vmid; | 48 | uint32_t logging_vmid; |
| 55 | uint32_t engine_mask; | 49 | uint32_t engine_mask; |
| 56 | union { | 50 | union { |
| 57 | struct { | 51 | struct { |
| 58 | uint32_t disable_reset : 1; | 52 | uint32_t disable_reset : 1; |
| 59 | uint32_t disable_umsch_mm_log : 1; | 53 | uint32_t disable_umsch_mm_log : 1; |
| 60 | uint32_t reserved : 30; | 54 | uint32_t use_rs64mem_for_proc_ctx_csa : 1; |
| 55 | uint32_t reserved : 29; | ||
| 61 | }; | 56 | }; |
| 62 | uint32_t uint32_all; | 57 | uint32_t uint32_all; |
| 63 | }; | 58 | }; |
| @@ -78,15 +73,18 @@ struct umsch_mm_add_queue_input { · 14 unmodified lines | |||
| 78 | uint32_t doorbell_offset_1; | 73 | uint32_t doorbell_offset_1; |
| 79 | enum UMSCH_SWIP_ENGINE_TYPE engine_type; | 74 | enum UMSCH_SWIP_ENGINE_TYPE engine_type; |
| 80 | uint32_t affinity; | 75 | uint32_t affinity; |
| 81 | enum UMSCH_SWIP_AFFINITY_TYPE affinity_type; | ||
| 82 | uint64_t mqd_addr; | 76 | uint64_t mqd_addr; |
| 83 | uint64_t h_context; | 77 | uint64_t h_context; |
| 84 | uint64_t h_queue; | 78 | uint64_t h_queue; |
| 85 | uint32_t vm_context_cntl; | 79 | uint32_t vm_context_cntl; |
| 86 | 80 | ||
| 81 | uint32_t process_csa_array_index; | ||
| 82 | uint32_t context_csa_array_index; | ||
| 83 | |||
| 87 | struct { | 84 | struct { |
| 88 | uint32_t is_context_suspended : 1; | 85 | uint32_t is_context_suspended : 1; |
| 89 | uint32_t reserved : 31; | 86 | uint32_t collaboration_mode : 1; |
| 87 | uint32_t reserved : 30; | ||
| 90 | }; | 88 | }; |
| 91 | }; | 89 | }; |
| 92 | 90 | ||
| @@ -94,6 +92,7 @@ struct umsch_mm_remove_queue_input { · 1 unmodified line | |||
| 94 | uint32_t doorbell_offset_0; | 92 | uint32_t doorbell_offset_0; |
| 95 | uint32_t doorbell_offset_1; | 93 | uint32_t doorbell_offset_1; |
| 96 | uint64_t context_csa_addr; | 94 | uint64_t context_csa_addr; |
| 95 | uint32_t context_csa_array_index; | ||
| 97 | }; | 96 | }; |
| 98 | 97 | ||
| 99 | struct MQD_INFO { | 98 | struct MQD_INFO { |
| @@ -103,6 +102,7 @@ struct MQD_INFO { · 3 unmodified lines | |||
| 103 | uint32_t wptr_val; | 102 | uint32_t wptr_val; |
| 104 | uint32_t rptr_val; | 103 | uint32_t rptr_val; |
| 105 | uint32_t unmapped; | 104 | uint32_t unmapped; |
| 105 | uint32_t vmid; | ||
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | struct amdgpu_umsch_mm; | 108 | struct amdgpu_umsch_mm; |
| @@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle) · 395 unmodified lines | |||
| 396 | struct amdgpu_vpe *vpe = &adev->vpe; | 396 | struct amdgpu_vpe *vpe = &adev->vpe; |
| 397 | int ret; | 397 | int ret; |
| 398 | 398 | ||
| 399 | /* Power on VPE */ | ||
| 400 | ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE, | ||
| 401 | AMD_PG_STATE_UNGATE); | ||
| 402 | if (ret) | ||
| 403 | return ret; | ||
| 404 | |||
| 399 | ret = vpe_load_microcode(vpe); | 405 | ret = vpe_load_microcode(vpe); |
| 400 | if (ret) | 406 | if (ret) |
| 401 | return ret; | 407 | return ret; |
| @@ -60,7 +60,7 @@ static int umsch_mm_v4_0_load_microcode(struct amdgpu_umsch_mm *umsch) · 59 unmodified lines | |||
| 60 | 60 | ||
| 61 | umsch->cmd_buf_curr_ptr = umsch->cmd_buf_ptr; | 61 | umsch->cmd_buf_curr_ptr = umsch->cmd_buf_ptr; |
| 62 | 62 | ||
| 63 | if (amdgpu_ip_version(adev, VCN_HWIP, 0) == IP_VERSION(4, 0, 5)) { | 63 | if (amdgpu_ip_version(adev, VCN_HWIP, 0) >= IP_VERSION(4, 0, 5)) { |
| 64 | WREG32_SOC15(VCN, 0, regUVD_IPX_DLDO_CONFIG, | 64 | WREG32_SOC15(VCN, 0, regUVD_IPX_DLDO_CONFIG, |
| 65 | 1 << UVD_IPX_DLDO_CONFIG__ONO0_PWR_CONFIG__SHIFT); | 65 | 1 << UVD_IPX_DLDO_CONFIG__ONO0_PWR_CONFIG__SHIFT); |
| 66 | SOC15_WAIT_ON_RREG(VCN, 0, regUVD_IPX_DLDO_STATUS, | 66 | SOC15_WAIT_ON_RREG(VCN, 0, regUVD_IPX_DLDO_STATUS, |
| @@ -248,7 +248,7 @@ static int umsch_mm_v4_0_ring_stop(struct amdgpu_umsch_mm *umsch) · 181 unmodified lines | |||
| 248 | data = REG_SET_FIELD(data, VCN_UMSCH_RB_DB_CTRL, EN, 0); | 248 | data = REG_SET_FIELD(data, VCN_UMSCH_RB_DB_CTRL, EN, 0); |
| 249 | WREG32_SOC15(VCN, 0, regVCN_UMSCH_RB_DB_CTRL, data); | 249 | WREG32_SOC15(VCN, 0, regVCN_UMSCH_RB_DB_CTRL, data); |
| 250 | 250 | ||
| 251 | if (amdgpu_ip_version(adev, VCN_HWIP, 0) == IP_VERSION(4, 0, 5)) { | 251 | if (amdgpu_ip_version(adev, VCN_HWIP, 0) >= IP_VERSION(4, 0, 5)) { |
| 252 | WREG32_SOC15(VCN, 0, regUVD_IPX_DLDO_CONFIG, | 252 | WREG32_SOC15(VCN, 0, regUVD_IPX_DLDO_CONFIG, |
| 253 | 2 << UVD_IPX_DLDO_CONFIG__ONO0_PWR_CONFIG__SHIFT); | 253 | 2 << UVD_IPX_DLDO_CONFIG__ONO0_PWR_CONFIG__SHIFT); |
| 254 | SOC15_WAIT_ON_RREG(VCN, 0, regUVD_IPX_DLDO_STATUS, | 254 | SOC15_WAIT_ON_RREG(VCN, 0, regUVD_IPX_DLDO_STATUS, |
| @@ -271,6 +271,8 @@ static int umsch_mm_v4_0_set_hw_resources(struct amdgpu_umsch_mm *umsch) · 16 unmodified lines | |||
| 271 | 271 | ||
| 272 | set_hw_resources.vmid_mask_mm_vcn = umsch->vmid_mask_mm_vcn; | 272 | set_hw_resources.vmid_mask_mm_vcn = umsch->vmid_mask_mm_vcn; |
| 273 | set_hw_resources.vmid_mask_mm_vpe = umsch->vmid_mask_mm_vpe; | 273 | set_hw_resources.vmid_mask_mm_vpe = umsch->vmid_mask_mm_vpe; |
| 274 | set_hw_resources.collaboration_mask_vpe = | ||
| 275 | adev->vpe.collaborate_mode ? 0x3 : 0x0; | ||
| 274 | set_hw_resources.engine_mask = umsch->engine_mask; | 276 | set_hw_resources.engine_mask = umsch->engine_mask; |
| 275 | 277 | ||
| 276 | set_hw_resources.vcn0_hqd_mask[0] = umsch->vcn0_hqd_mask; | 278 | set_hw_resources.vcn0_hqd_mask[0] = umsch->vcn0_hqd_mask; |
| @@ -346,6 +348,7 @@ static int umsch_mm_v4_0_add_queue(struct amdgpu_umsch_mm *umsch, · 69 unmodified lines | |||
| 346 | add_queue.h_queue = input_ptr->h_queue; | 348 | add_queue.h_queue = input_ptr->h_queue; |
| 347 | add_queue.vm_context_cntl = input_ptr->vm_context_cntl; | 349 | add_queue.vm_context_cntl = input_ptr->vm_context_cntl; |
| 348 | add_queue.is_context_suspended = input_ptr->is_context_suspended; | 350 | add_queue.is_context_suspended = input_ptr->is_context_suspended; |
| 351 | add_queue.collaboration_mode = adev->vpe.collaborate_mode ? 1 : 0; | ||
| 349 | 352 | ||
| 350 | add_queue.api_status.api_completion_fence_addr = umsch->ring.fence_drv.gpu_addr; | 353 | add_queue.api_status.api_completion_fence_addr = umsch->ring.fence_drv.gpu_addr; |
| 351 | add_queue.api_status.api_completion_fence_value = ++umsch->ring.fence_drv.sync_seq; | 354 | add_queue.api_status.api_completion_fence_value = ++umsch->ring.fence_drv.sync_seq; |
| @@ -1523,7 +1523,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, · 1522 unmodified lines | |||
| 1523 | 1523 | ||
| 1524 | /* Find a KFD GPU device that supports the get_dmabuf_info query */ | 1524 | /* Find a KFD GPU device that supports the get_dmabuf_info query */ |
| 1525 | for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++) | 1525 | for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++) |
| 1526 | if (dev) | 1526 | if (dev && !kfd_devcgroup_check_permission(dev)) |
| 1527 | break; | 1527 | break; |
| 1528 | if (!dev) | 1528 | if (!dev) |
| 1529 | return -EINVAL; | 1529 | return -EINVAL; |
| @@ -1545,7 +1545,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, · 15 unmodified lines | |||
| 1545 | if (xcp_id >= 0) | 1545 | if (xcp_id >= 0) |
| 1546 | args->gpu_id = dmabuf_adev->kfd.dev->nodes[xcp_id]->id; | 1546 | args->gpu_id = dmabuf_adev->kfd.dev->nodes[xcp_id]->id; |
| 1547 | else | 1547 | else |
| 1548 | args->gpu_id = dmabuf_adev->kfd.dev->nodes[0]->id; | 1548 | args->gpu_id = dev->id; |
| 1549 | args->flags = flags; | 1549 | args->flags = flags; |
| 1550 | 1550 | ||
| 1551 | /* Copy metadata buffer to user mode */ | 1551 | /* Copy metadata buffer to user mode */ |
| @@ -339,7 +339,8 @@ static void event_interrupt_wq_v10(struct kfd_node *dev, · 338 unmodified lines | |||
| 339 | break; | 339 | break; |
| 340 | } | 340 | } |
| 341 | kfd_signal_event_interrupt(pasid, context_id0 & 0x7fffff, 23); | 341 | kfd_signal_event_interrupt(pasid, context_id0 & 0x7fffff, 23); |
| 342 | } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) { | 342 | } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && |
| 343 | KFD_DBG_EC_TYPE_IS_PACKET(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0))) { | ||
| 343 | kfd_set_dbg_ev_from_interrupt(dev, pasid, | 344 | kfd_set_dbg_ev_from_interrupt(dev, pasid, |
| 344 | KFD_DEBUG_DOORBELL_ID(context_id0), | 345 | KFD_DEBUG_DOORBELL_ID(context_id0), |
| 345 | KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), | 346 | KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), |
| @@ -328,7 +328,8 @@ static void event_interrupt_wq_v11(struct kfd_node *dev, · 327 unmodified lines | |||
| 328 | /* CP */ | 328 | /* CP */ |
| 329 | if (source_id == SOC15_INTSRC_CP_END_OF_PIPE) | 329 | if (source_id == SOC15_INTSRC_CP_END_OF_PIPE) |
| 330 | kfd_signal_event_interrupt(pasid, context_id0, 32); | 330 | kfd_signal_event_interrupt(pasid, context_id0, 32); |
| 331 | else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) | 331 | else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && |
| 332 | KFD_DBG_EC_TYPE_IS_PACKET(KFD_CTXID0_CP_BAD_OP_ECODE(context_id0))) | ||
| 332 | kfd_set_dbg_ev_from_interrupt(dev, pasid, | 333 | kfd_set_dbg_ev_from_interrupt(dev, pasid, |
| 333 | KFD_CTXID0_DOORBELL_ID(context_id0), | 334 | KFD_CTXID0_DOORBELL_ID(context_id0), |
| 334 | KFD_EC_MASK(KFD_CTXID0_CP_BAD_OP_ECODE(context_id0)), | 335 | KFD_EC_MASK(KFD_CTXID0_CP_BAD_OP_ECODE(context_id0)), |
| @@ -388,7 +388,8 @@ static void event_interrupt_wq_v9(struct kfd_node *dev, · 387 unmodified lines | |||
| 388 | break; | 388 | break; |
| 389 | } | 389 | } |
| 390 | kfd_signal_event_interrupt(pasid, sq_int_data, 24); | 390 | kfd_signal_event_interrupt(pasid, sq_int_data, 24); |
| 391 | } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) { | 391 | } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && |
| 392 | KFD_DBG_EC_TYPE_IS_PACKET(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0))) { | ||
| 392 | kfd_set_dbg_ev_from_interrupt(dev, pasid, | 393 | kfd_set_dbg_ev_from_interrupt(dev, pasid, |
| 393 | KFD_DEBUG_DOORBELL_ID(context_id0), | 394 | KFD_DEBUG_DOORBELL_ID(context_id0), |
| 394 | KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), | 395 | KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), |
| @@ -1473,7 +1473,7 @@ static inline void kfd_flush_tlb(struct kfd_process_device *pdd, · 1472 unmodified lines | |||
| 1473 | 1473 | ||
| 1474 | static inline bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev) | 1474 | static inline bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev) |
| 1475 | { | 1475 | { |
| 1476 | return KFD_GC_VERSION(dev) > IP_VERSION(9, 4, 2) || | 1476 | return KFD_GC_VERSION(dev) >= IP_VERSION(9, 4, 2) || |
| 1477 | (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) && dev->sdma_fw_version >= 18) || | 1477 | (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) && dev->sdma_fw_version >= 18) || |
| 1478 | KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0); | 1478 | KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0); |
| 1479 | } | 1479 | } |
| @@ -6305,9 +6305,8 @@ create_stream_for_sink(struct drm_connector *connector, · 6304 unmodified lines | |||
| 6305 | 6305 | ||
| 6306 | if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) | 6306 | if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) |
| 6307 | mod_build_hf_vsif_infopacket(stream, &stream->vsp_infopacket); | 6307 | mod_build_hf_vsif_infopacket(stream, &stream->vsp_infopacket); |
| 6308 | else if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT || | 6308 | |
| 6309 | stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST || | 6309 | if (stream->link->psr_settings.psr_feature_enabled || stream->link->replay_settings.replay_feature_enabled) { |
| 6310 | stream->signal == SIGNAL_TYPE_EDP) { | ||
| 6311 | // | 6310 | // |
| 6312 | // should decide stream support vsc sdp colorimetry capability | 6311 | // should decide stream support vsc sdp colorimetry capability |
| 6313 | // before building vsc info packet | 6312 | // before building vsc info packet |
| @@ -6323,9 +6322,8 @@ create_stream_for_sink(struct drm_connector *connector, · 9 unmodified lines | |||
| 6323 | if (stream->out_transfer_func->tf == TRANSFER_FUNCTION_GAMMA22) | 6322 | if (stream->out_transfer_func->tf == TRANSFER_FUNCTION_GAMMA22) |
| 6324 | tf = TRANSFER_FUNC_GAMMA_22; | 6323 | tf = TRANSFER_FUNC_GAMMA_22; |
| 6325 | mod_build_vsc_infopacket(stream, &stream->vsc_infopacket, stream->output_color_space, tf); | 6324 | mod_build_vsc_infopacket(stream, &stream->vsc_infopacket, stream->output_color_space, tf); |
| 6325 | aconnector->psr_skip_count = AMDGPU_DM_PSR_ENTRY_DELAY; | ||
| 6326 | 6326 | ||
| 6327 | if (stream->link->psr_settings.psr_feature_enabled) | ||
| 6328 | aconnector->psr_skip_count = AMDGPU_DM_PSR_ENTRY_DELAY; | ||
| 6329 | } | 6327 | } |
| 6330 | finish: | 6328 | finish: |
| 6331 | dc_sink_release(sink); | 6329 | dc_sink_release(sink); |
| @@ -141,9 +141,8 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) · 140 unmodified lines | |||
| 141 | * amdgpu_dm_psr_enable() - enable psr f/w | 141 | * amdgpu_dm_psr_enable() - enable psr f/w |
| 142 | * @stream: stream state | 142 | * @stream: stream state |
| 143 | * | 143 | * |
| 144 | * Return: true if success | ||
| 145 | */ | 144 | */ |
| 146 | bool amdgpu_dm_psr_enable(struct dc_stream_state *stream) | 145 | void amdgpu_dm_psr_enable(struct dc_stream_state *stream) |
| 147 | { | 146 | { |
| 148 | struct dc_link *link = stream->link; | 147 | struct dc_link *link = stream->link; |
| 149 | unsigned int vsync_rate_hz = 0; | 148 | unsigned int vsync_rate_hz = 0; |
| @@ -190,7 +189,10 @@ bool amdgpu_dm_psr_enable(struct dc_stream_state *stream) · 40 unmodified lines | |||
| 190 | if (link->psr_settings.psr_version < DC_PSR_VERSION_SU_1) | 189 | if (link->psr_settings.psr_version < DC_PSR_VERSION_SU_1) |
| 191 | power_opt |= psr_power_opt_z10_static_screen; | 190 | power_opt |= psr_power_opt_z10_static_screen; |
| 192 | 191 | ||
| 193 | return dc_link_set_psr_allow_active(link, &psr_enable, false, false, &power_opt); | 192 | dc_link_set_psr_allow_active(link, &psr_enable, false, false, &power_opt); |
| 193 | |||
| 194 | if (link->ctx->dc->caps.ips_support) | ||
| 195 | dc_allow_idle_optimizations(link->ctx->dc, true); | ||
| 194 | } | 196 | } |
| 195 | 197 | ||
| 196 | /* | 198 | /* |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | |||
| 32 | #define AMDGPU_DM_PSR_ENTRY_DELAY 5 | 32 | #define AMDGPU_DM_PSR_ENTRY_DELAY 5 |
| 33 | 33 | ||
| 34 | void amdgpu_dm_set_psr_caps(struct dc_link *link); | 34 | void amdgpu_dm_set_psr_caps(struct dc_link *link); |
| 35 | bool amdgpu_dm_psr_enable(struct dc_stream_state *stream); | 35 | void amdgpu_dm_psr_enable(struct dc_stream_state *stream); |
| 36 | bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream); | 36 | bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream); |
| 37 | bool amdgpu_dm_psr_disable(struct dc_stream_state *stream); | 37 | bool amdgpu_dm_psr_disable(struct dc_stream_state *stream); |
| 38 | bool amdgpu_dm_psr_disable_all(struct amdgpu_display_manager *dm); | 38 | bool amdgpu_dm_psr_disable_all(struct amdgpu_display_manager *dm); |
| @@ -73,6 +73,8 @@ · 72 unmodified lines | |||
| 73 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL_MASK 0x00000007L | 73 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL_MASK 0x00000007L |
| 74 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV_MASK 0x000F0000L | 74 | #define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV_MASK 0x000F0000L |
| 75 | 75 | ||
| 76 | #define SMU_VER_THRESHOLD 0x5D4A00 //93.74.0 | ||
| 77 | |||
| 76 | #define REG(reg_name) \ | 78 | #define REG(reg_name) \ |
| 77 | (ctx->clk_reg_offsets[reg ## reg_name ## _BASE_IDX] + reg ## reg_name) | 79 | (ctx->clk_reg_offsets[reg ## reg_name ## _BASE_IDX] + reg ## reg_name) |
| 78 | 80 | ||
| @@ -411,9 +413,12 @@ static void dcn35_dump_clk_registers(struct clk_state_registers_and_bypass *regs · 332 unmodified lines | |||
| 411 | 413 | ||
| 412 | static void init_clk_states(struct clk_mgr *clk_mgr) | 414 | static void init_clk_states(struct clk_mgr *clk_mgr) |
| 413 | { | 415 | { |
| 416 | struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr); | ||
| 414 | uint32_t ref_dtbclk = clk_mgr->clks.ref_dtbclk_khz; | 417 | uint32_t ref_dtbclk = clk_mgr->clks.ref_dtbclk_khz; |
| 415 | memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks)); | 418 | memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks)); |
| 416 | 419 | ||
| 420 | if (clk_mgr_int->smu_ver >= SMU_VER_THRESHOLD) | ||
| 421 | clk_mgr->clks.dtbclk_en = true; // request DTBCLK disable on first commit | ||
| 417 | clk_mgr->clks.ref_dtbclk_khz = ref_dtbclk; // restore ref_dtbclk | 422 | clk_mgr->clks.ref_dtbclk_khz = ref_dtbclk; // restore ref_dtbclk |
| 418 | clk_mgr->clks.p_state_change_support = true; | 423 | clk_mgr->clks.p_state_change_support = true; |
| 419 | clk_mgr->clks.prev_p_state_change_support = true; | 424 | clk_mgr->clks.prev_p_state_change_support = true; |
| @@ -709,7 +714,7 @@ static void dcn35_clk_mgr_helper_populate_bw_params(struct clk_mgr_internal *clk · 289 unmodified lines | |||
| 709 | clock_table->NumFclkLevelsEnabled; | 714 | clock_table->NumFclkLevelsEnabled; |
| 710 | max_fclk = find_max_clk_value(clock_table->FclkClocks_Freq, num_fclk); | 715 | max_fclk = find_max_clk_value(clock_table->FclkClocks_Freq, num_fclk); |
| 711 | 716 | ||
| 712 | num_dcfclk = (clock_table->NumFclkLevelsEnabled > NUM_DCFCLK_DPM_LEVELS) ? NUM_DCFCLK_DPM_LEVELS : | 717 | num_dcfclk = (clock_table->NumDcfClkLevelsEnabled > NUM_DCFCLK_DPM_LEVELS) ? NUM_DCFCLK_DPM_LEVELS : |
| 713 | clock_table->NumDcfClkLevelsEnabled; | 718 | clock_table->NumDcfClkLevelsEnabled; |
| 714 | for (i = 0; i < num_dcfclk; i++) { | 719 | for (i = 0; i < num_dcfclk; i++) { |
| 715 | int j; | 720 | int j; |
| @@ -3024,7 +3024,8 @@ static void backup_planes_and_stream_state( · 3023 unmodified lines | |||
| 3024 | scratch->blend_tf[i] = *status->plane_states[i]->blend_tf; | 3024 | scratch->blend_tf[i] = *status->plane_states[i]->blend_tf; |
| 3025 | } | 3025 | } |
| 3026 | scratch->stream_state = *stream; | 3026 | scratch->stream_state = *stream; |
| 3027 | scratch->out_transfer_func = *stream->out_transfer_func; | 3027 | if (stream->out_transfer_func) |
| 3028 | scratch->out_transfer_func = *stream->out_transfer_func; | ||
| 3028 | } | 3029 | } |
| 3029 | 3030 | ||
| 3030 | static void restore_planes_and_stream_state( | 3031 | static void restore_planes_and_stream_state( |
| @@ -3046,7 +3047,8 @@ static void restore_planes_and_stream_state( · 15 unmodified lines | |||
| 3046 | *status->plane_states[i]->blend_tf = scratch->blend_tf[i]; | 3047 | *status->plane_states[i]->blend_tf = scratch->blend_tf[i]; |
| 3047 | } | 3048 | } |
| 3048 | *stream = scratch->stream_state; | 3049 | *stream = scratch->stream_state; |
| 3049 | *stream->out_transfer_func = scratch->out_transfer_func; | 3050 | if (stream->out_transfer_func) |
| 3051 | *stream->out_transfer_func = scratch->out_transfer_func; | ||
| 3050 | } | 3052 | } |
| 3051 | 3053 | ||
| 3052 | static bool update_planes_and_stream_state(struct dc *dc, | 3054 | static bool update_planes_and_stream_state(struct dc *dc, |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | # Makefile for the 'controller' sub-component of DAL. | 23 | # Makefile for the 'controller' sub-component of DAL. |
| 24 | # It provides the control and status of HW CRTC block. | 24 | # It provides the control and status of HW CRTC block. |
| 25 | 25 | ||
| 26 | CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = $(call cc-disable-warning, override-init) | 26 | CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = -Wno-override-init |
| 27 | 27 | ||
| 28 | DCE110 = dce110_timing_generator.o \ | 28 | DCE110 = dce110_timing_generator.o \ |
| 29 | dce110_compressor.o dce110_opp_regamma_v.o \ | 29 | dce110_compressor.o dce110_opp_regamma_v.o \ |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | # Makefile for the 'controller' sub-component of DAL. | 23 | # Makefile for the 'controller' sub-component of DAL. |
| 24 | # It provides the control and status of HW CRTC block. | 24 | # It provides the control and status of HW CRTC block. |
| 25 | 25 | ||
| 26 | CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = $(call cc-disable-warning, override-init) | 26 | CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = -Wno-override-init |
| 27 | 27 | ||
| 28 | DCE112 = dce112_compressor.o | 28 | DCE112 = dce112_compressor.o |
| 29 | 29 | ||
| @@ -24,7 +24,7 @@ · 23 unmodified lines | |||
| 24 | # It provides the control and status of HW CRTC block. | 24 | # It provides the control and status of HW CRTC block. |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = $(call cc-disable-warning, override-init) | 27 | CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = -Wno-override-init |
| 28 | 28 | ||
| 29 | DCE120 = dce120_timing_generator.o | 29 | DCE120 = dce120_timing_generator.o |
| 30 | 30 | ||
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | # Makefile for the 'controller' sub-component of DAL. | 23 | # Makefile for the 'controller' sub-component of DAL. |
| 24 | # It provides the control and status of HW CRTC block. | 24 | # It provides the control and status of HW CRTC block. |
| 25 | 25 | ||
| 26 | CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init) | 26 | CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = -Wno-override-init |
| 27 | 27 | ||
| 28 | DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \ | 28 | DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \ |
| 29 | dce60_resource.o | 29 | dce60_resource.o |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | # Makefile for the 'controller' sub-component of DAL. | 23 | # Makefile for the 'controller' sub-component of DAL. |
| 24 | # It provides the control and status of HW CRTC block. | 24 | # It provides the control and status of HW CRTC block. |
| 25 | 25 | ||
| 26 | CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = $(call cc-disable-warning, override-init) | 26 | CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = -Wno-override-init |
| 27 | 27 | ||
| 28 | DCE80 = dce80_timing_generator.o | 28 | DCE80 = dce80_timing_generator.o |
| 29 | 29 | ||
| @@ -44,6 +44,36 @@ · 43 unmodified lines | |||
| 44 | #define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0])) | 44 | #define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0])) |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | void mpc3_mpc_init(struct mpc *mpc) | ||
| 48 | { | ||
| 49 | struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc); | ||
| 50 | int opp_id; | ||
| 51 | |||
| 52 | mpc1_mpc_init(mpc); | ||
| 53 | |||
| 54 | for (opp_id = 0; opp_id < MAX_OPP; opp_id++) { | ||
| 55 | if (REG(MUX[opp_id])) | ||
| 56 | /* disable mpc out rate and flow control */ | ||
| 57 | REG_UPDATE_2(MUX[opp_id], MPC_OUT_RATE_CONTROL_DISABLE, | ||
| 58 | 1, MPC_OUT_FLOW_CONTROL_COUNT, 0); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | void mpc3_mpc_init_single_inst(struct mpc *mpc, unsigned int mpcc_id) | ||
| 63 | { | ||
| 64 | struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc); | ||
| 65 | |||
| 66 | mpc1_mpc_init_single_inst(mpc, mpcc_id); | ||
| 67 | |||
| 68 | /* assuming mpc out mux is connected to opp with the same index at this | ||
| 69 | * point in time (e.g. transitioning from vbios to driver) | ||
| 70 | */ | ||
| 71 | if (mpcc_id < MAX_OPP && REG(MUX[mpcc_id])) | ||
| 72 | /* disable mpc out rate and flow control */ | ||
| 73 | REG_UPDATE_2(MUX[mpcc_id], MPC_OUT_RATE_CONTROL_DISABLE, | ||
| 74 | 1, MPC_OUT_FLOW_CONTROL_COUNT, 0); | ||
| 75 | } | ||
| 76 | |||
| 47 | bool mpc3_is_dwb_idle( | 77 | bool mpc3_is_dwb_idle( |
| 48 | struct mpc *mpc, | 78 | struct mpc *mpc, |
| 49 | int dwb_id) | 79 | int dwb_id) |
| @@ -80,25 +110,6 @@ void mpc3_disable_dwb_mux( · 30 unmodified lines | |||
| 80 | MPC_DWB0_MUX, 0xf); | 110 | MPC_DWB0_MUX, 0xf); |
| 81 | } | 111 | } |
| 82 | 112 | ||
| 83 | void mpc3_set_out_rate_control( | ||
| 84 | struct mpc *mpc, | ||
| 85 | int opp_id, | ||
| 86 | bool enable, | ||
| 87 | bool rate_2x_mode, | ||
| 88 | struct mpc_dwb_flow_control *flow_control) | ||
| 89 | { | ||
| 90 | struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc); | ||
| 91 | |||
| 92 | REG_UPDATE_2(MUX[opp_id], | ||
| 93 | MPC_OUT_RATE_CONTROL_DISABLE, !enable, | ||
| 94 | MPC_OUT_RATE_CONTROL, rate_2x_mode); | ||
| 95 | |||
| 96 | if (flow_control) | ||
| 97 | REG_UPDATE_2(MUX[opp_id], | ||
| 98 | MPC_OUT_FLOW_CONTROL_MODE, flow_control->flow_ctrl_mode, | ||
| 99 | MPC_OUT_FLOW_CONTROL_COUNT, flow_control->flow_ctrl_cnt1); | ||
| 100 | } | ||
| 101 | |||
| 102 | enum dc_lut_mode mpc3_get_ogam_current(struct mpc *mpc, int mpcc_id) | 113 | enum dc_lut_mode mpc3_get_ogam_current(struct mpc *mpc, int mpcc_id) |
| 103 | { | 114 | { |
| 104 | /*Contrary to DCN2 and DCN1 wherein a single status register field holds this info; | 115 | /*Contrary to DCN2 and DCN1 wherein a single status register field holds this info; |
| @@ -1490,8 +1501,8 @@ static const struct mpc_funcs dcn30_mpc_funcs = { · 1385 unmodified lines | |||
| 1490 | .read_mpcc_state = mpc3_read_mpcc_state, | 1501 | .read_mpcc_state = mpc3_read_mpcc_state, |
| 1491 | .insert_plane = mpc1_insert_plane, | 1502 | .insert_plane = mpc1_insert_plane, |
| 1492 | .remove_mpcc = mpc1_remove_mpcc, | 1503 | .remove_mpcc = mpc1_remove_mpcc, |
| 1493 | .mpc_init = mpc1_mpc_init, | 1504 | .mpc_init = mpc3_mpc_init, |
| 1494 | .mpc_init_single_inst = mpc1_mpc_init_single_inst, | 1505 | .mpc_init_single_inst = mpc3_mpc_init_single_inst, |
| 1495 | .update_blending = mpc2_update_blending, | 1506 | .update_blending = mpc2_update_blending, |
| 1496 | .cursor_lock = mpc1_cursor_lock, | 1507 | .cursor_lock = mpc1_cursor_lock, |
| 1497 | .get_mpcc_for_dpp = mpc1_get_mpcc_for_dpp, | 1508 | .get_mpcc_for_dpp = mpc1_get_mpcc_for_dpp, |
| @@ -1508,7 +1519,6 @@ static const struct mpc_funcs dcn30_mpc_funcs = { · 10 unmodified lines | |||
| 1508 | .set_dwb_mux = mpc3_set_dwb_mux, | 1519 | .set_dwb_mux = mpc3_set_dwb_mux, |
| 1509 | .disable_dwb_mux = mpc3_disable_dwb_mux, | 1520 | .disable_dwb_mux = mpc3_disable_dwb_mux, |
| 1510 | .is_dwb_idle = mpc3_is_dwb_idle, | 1521 | .is_dwb_idle = mpc3_is_dwb_idle, |
| 1511 | .set_out_rate_control = mpc3_set_out_rate_control, | ||
| 1512 | .set_gamut_remap = mpc3_set_gamut_remap, | 1522 | .set_gamut_remap = mpc3_set_gamut_remap, |
| 1513 | .program_shaper = mpc3_program_shaper, | 1523 | .program_shaper = mpc3_program_shaper, |
| 1514 | .acquire_rmu = mpcc3_acquire_rmu, | 1524 | .acquire_rmu = mpcc3_acquire_rmu, |
| @@ -1007,6 +1007,13 @@ void dcn30_mpc_construct(struct dcn30_mpc *mpc30, · 1006 unmodified lines | |||
| 1007 | int num_mpcc, | 1007 | int num_mpcc, |
| 1008 | int num_rmu); | 1008 | int num_rmu); |
| 1009 | 1009 | ||
| 1010 | void mpc3_mpc_init( | ||
| 1011 | struct mpc *mpc); | ||
| 1012 | |||
| 1013 | void mpc3_mpc_init_single_inst( | ||
| 1014 | struct mpc *mpc, | ||
| 1015 | unsigned int mpcc_id); | ||
| 1016 | |||
| 1010 | bool mpc3_program_shaper( | 1017 | bool mpc3_program_shaper( |
| 1011 | struct mpc *mpc, | 1018 | struct mpc *mpc, |
| 1012 | const struct pwl_params *params, | 1019 | const struct pwl_params *params, |
| @@ -1078,13 +1085,6 @@ bool mpc3_is_dwb_idle( · 65 unmodified lines | |||
| 1078 | struct mpc *mpc, | 1085 | struct mpc *mpc, |
| 1079 | int dwb_id); | 1086 | int dwb_id); |
| 1080 | 1087 | ||
| 1081 | void mpc3_set_out_rate_control( | ||
| 1082 | struct mpc *mpc, | ||
| 1083 | int opp_id, | ||
| 1084 | bool enable, | ||
| 1085 | bool rate_2x_mode, | ||
| 1086 | struct mpc_dwb_flow_control *flow_control); | ||
| 1087 | |||
| 1088 | void mpc3_power_on_ogam_lut( | 1088 | void mpc3_power_on_ogam_lut( |
| 1089 | struct mpc *mpc, int mpcc_id, | 1089 | struct mpc *mpc, int mpcc_id, |
| 1090 | bool power_on); | 1090 | bool power_on); |
| @@ -47,7 +47,7 @@ void mpc32_mpc_init(struct mpc *mpc) · 46 unmodified lines | |||
| 47 | struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc); | 47 | struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc); |
| 48 | int mpcc_id; | 48 | int mpcc_id; |
| 49 | 49 | ||
| 50 | mpc1_mpc_init(mpc); | 50 | mpc3_mpc_init(mpc); |
| 51 | 51 | ||
| 52 | if (mpc->ctx->dc->debug.enable_mem_low_power.bits.mpc) { | 52 | if (mpc->ctx->dc->debug.enable_mem_low_power.bits.mpc) { |
| 53 | if (mpc30->mpc_mask->MPCC_MCM_SHAPER_MEM_LOW_PWR_MODE && mpc30->mpc_mask->MPCC_MCM_3DLUT_MEM_LOW_PWR_MODE) { | 53 | if (mpc30->mpc_mask->MPCC_MCM_SHAPER_MEM_LOW_PWR_MODE && mpc30->mpc_mask->MPCC_MCM_3DLUT_MEM_LOW_PWR_MODE) { |
| @@ -991,7 +991,7 @@ static const struct mpc_funcs dcn32_mpc_funcs = { · 937 unmodified lines | |||
| 991 | .insert_plane = mpc1_insert_plane, | 991 | .insert_plane = mpc1_insert_plane, |
| 992 | .remove_mpcc = mpc1_remove_mpcc, | 992 | .remove_mpcc = mpc1_remove_mpcc, |
| 993 | .mpc_init = mpc32_mpc_init, | 993 | .mpc_init = mpc32_mpc_init, |
| 994 | .mpc_init_single_inst = mpc1_mpc_init_single_inst, | 994 | .mpc_init_single_inst = mpc3_mpc_init_single_inst, |
| 995 | .update_blending = mpc2_update_blending, | 995 | .update_blending = mpc2_update_blending, |
| 996 | .cursor_lock = mpc1_cursor_lock, | 996 | .cursor_lock = mpc1_cursor_lock, |
| 997 | .get_mpcc_for_dpp = mpc1_get_mpcc_for_dpp, | 997 | .get_mpcc_for_dpp = mpc1_get_mpcc_for_dpp, |
| @@ -1008,7 +1008,6 @@ static const struct mpc_funcs dcn32_mpc_funcs = { · 10 unmodified lines | |||
| 1008 | .set_dwb_mux = mpc3_set_dwb_mux, | 1008 | .set_dwb_mux = mpc3_set_dwb_mux, |
| 1009 | .disable_dwb_mux = mpc3_disable_dwb_mux, | 1009 | .disable_dwb_mux = mpc3_disable_dwb_mux, |
| 1010 | .is_dwb_idle = mpc3_is_dwb_idle, | 1010 | .is_dwb_idle = mpc3_is_dwb_idle, |
| 1011 | .set_out_rate_control = mpc3_set_out_rate_control, | ||
| 1012 | .set_gamut_remap = mpc3_set_gamut_remap, | 1011 | .set_gamut_remap = mpc3_set_gamut_remap, |
| 1013 | .program_shaper = mpc32_program_shaper, | 1012 | .program_shaper = mpc32_program_shaper, |
| 1014 | .program_3dlut = mpc32_program_3dlut, | 1013 | .program_3dlut = mpc32_program_3dlut, |
| @@ -166,8 +166,8 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_5_soc = { · 165 unmodified lines | |||
| 166 | .num_states = 5, | 166 | .num_states = 5, |
| 167 | .sr_exit_time_us = 28.0, | 167 | .sr_exit_time_us = 28.0, |
| 168 | .sr_enter_plus_exit_time_us = 30.0, | 168 | .sr_enter_plus_exit_time_us = 30.0, |
| 169 | .sr_exit_z8_time_us = 210.0, | 169 | .sr_exit_z8_time_us = 250.0, |
| 170 | .sr_enter_plus_exit_z8_time_us = 320.0, | 170 | .sr_enter_plus_exit_z8_time_us = 350.0, |
| 171 | .fclk_change_latency_us = 24.0, | 171 | .fclk_change_latency_us = 24.0, |
| 172 | .usr_retraining_latency_us = 2, | 172 | .usr_retraining_latency_us = 2, |
| 173 | .writeback_latency_us = 12.0, | 173 | .writeback_latency_us = 12.0, |
| @@ -98,55 +98,114 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_51_soc = { · 97 unmodified lines | |||
| 98 | .clock_limits = { | 98 | .clock_limits = { |
| 99 | { | 99 | { |
| 100 | .state = 0, | 100 | .state = 0, |
| 101 | .dispclk_mhz = 1200.0, | 101 | .dcfclk_mhz = 400.0, |
| 102 | .dppclk_mhz = 1200.0, | 102 | .fabricclk_mhz = 400.0, |
| 103 | .socclk_mhz = 600.0, | ||
| 104 | .dram_speed_mts = 3200.0, | ||
| 105 | .dispclk_mhz = 600.0, | ||
| 106 | .dppclk_mhz = 600.0, | ||
| 103 | .phyclk_mhz = 600.0, | 107 | .phyclk_mhz = 600.0, |
| 104 | .phyclk_d18_mhz = 667.0, | 108 | .phyclk_d18_mhz = 667.0, |
| 105 | .dscclk_mhz = 186.0, | 109 | .dscclk_mhz = 200.0, |
| 106 | .dtbclk_mhz = 600.0, | 110 | .dtbclk_mhz = 600.0, |
| 107 | }, | 111 | }, |
| 108 | { | 112 | { |
| 109 | .state = 1, | 113 | .state = 1, |
| 110 | .dispclk_mhz = 1200.0, | 114 | .dcfclk_mhz = 600.0, |
| 111 | .dppclk_mhz = 1200.0, | 115 | .fabricclk_mhz = 1000.0, |
| 116 | .socclk_mhz = 733.0, | ||
| 117 | .dram_speed_mts = 6400.0, | ||
| 118 | .dispclk_mhz = 800.0, | ||
| 119 | .dppclk_mhz = 800.0, | ||
| 112 | .phyclk_mhz = 810.0, | 120 | .phyclk_mhz = 810.0, |
| 113 | .phyclk_d18_mhz = 667.0, | 121 | .phyclk_d18_mhz = 667.0, |
| 114 | .dscclk_mhz = 209.0, | 122 | .dscclk_mhz = 266.7, |
| 115 | .dtbclk_mhz = 600.0, | 123 | .dtbclk_mhz = 600.0, |
| 116 | }, | 124 | }, |
| 117 | { | 125 | { |
| 118 | .state = 2, | 126 | .state = 2, |
| 119 | .dispclk_mhz = 1200.0, | 127 | .dcfclk_mhz = 738.0, |
| 120 | .dppclk_mhz = 1200.0, | 128 | .fabricclk_mhz = 1200.0, |
| 129 | .socclk_mhz = 880.0, | ||
| 130 | .dram_speed_mts = 7500.0, | ||
| 131 | .dispclk_mhz = 800.0, | ||
| 132 | .dppclk_mhz = 800.0, | ||
| 121 | .phyclk_mhz = 810.0, | 133 | .phyclk_mhz = 810.0, |
| 122 | .phyclk_d18_mhz = 667.0, | 134 | .phyclk_d18_mhz = 667.0, |
| 123 | .dscclk_mhz = 209.0, | 135 | .dscclk_mhz = 266.7, |
| 124 | .dtbclk_mhz = 600.0, | 136 | .dtbclk_mhz = 600.0, |
| 125 | }, | 137 | }, |
| 126 | { | 138 | { |
| 127 | .state = 3, | 139 | .state = 3, |
| 128 | .dispclk_mhz = 1200.0, | 140 | .dcfclk_mhz = 800.0, |
| 129 | .dppclk_mhz = 1200.0, | 141 | .fabricclk_mhz = 1400.0, |
| 142 | .socclk_mhz = 978.0, | ||
| 143 | .dram_speed_mts = 7500.0, | ||
| 144 | .dispclk_mhz = 960.0, | ||
| 145 | .dppclk_mhz = 960.0, | ||
| 130 | .phyclk_mhz = 810.0, | 146 | .phyclk_mhz = 810.0, |
| 131 | .phyclk_d18_mhz = 667.0, | 147 | .phyclk_d18_mhz = 667.0, |
| 132 | .dscclk_mhz = 371.0, | 148 | .dscclk_mhz = 320.0, |
| 133 | .dtbclk_mhz = 600.0, | 149 | .dtbclk_mhz = 600.0, |
| 134 | }, | 150 | }, |
| 135 | { | 151 | { |
| 136 | .state = 4, | 152 | .state = 4, |
| 153 | .dcfclk_mhz = 873.0, | ||
| 154 | .fabricclk_mhz = 1600.0, | ||
| 155 | .socclk_mhz = 1100.0, | ||
| 156 | .dram_speed_mts = 8533.0, | ||
| 157 | .dispclk_mhz = 1066.7, | ||
| 158 | .dppclk_mhz = 1066.7, | ||
| 159 | .phyclk_mhz = 810.0, | ||
| 160 | .phyclk_d18_mhz = 667.0, | ||
| 161 | .dscclk_mhz = 355.6, | ||
| 162 | .dtbclk_mhz = 600.0, | ||
| 163 | }, | ||
| 164 | { | ||
| 165 | .state = 5, | ||
| 166 | .dcfclk_mhz = 960.0, | ||
| 167 | .fabricclk_mhz = 1700.0, | ||
| 168 | .socclk_mhz = 1257.0, | ||
| 169 | .dram_speed_mts = 8533.0, | ||
| 137 | .dispclk_mhz = 1200.0, | 170 | .dispclk_mhz = 1200.0, |
| 138 | .dppclk_mhz = 1200.0, | 171 | .dppclk_mhz = 1200.0, |
| 139 | .phyclk_mhz = 810.0, | 172 | .phyclk_mhz = 810.0, |
| 140 | .phyclk_d18_mhz = 667.0, | 173 | .phyclk_d18_mhz = 667.0, |
| 141 | .dscclk_mhz = 417.0, | 174 | .dscclk_mhz = 400.0, |
| 175 | .dtbclk_mhz = 600.0, | ||
| 176 | }, | ||
| 177 | { | ||
| 178 | .state = 6, | ||
| 179 | .dcfclk_mhz = 1067.0, | ||
| 180 | .fabricclk_mhz = 1850.0, | ||
| 181 | .socclk_mhz = 1257.0, | ||
| 182 | .dram_speed_mts = 8533.0, | ||
| 183 | .dispclk_mhz = 1371.4, | ||
| 184 | .dppclk_mhz = 1371.4, | ||
| 185 | .phyclk_mhz = 810.0, | ||
| 186 | .phyclk_d18_mhz = 667.0, | ||
| 187 | .dscclk_mhz = 457.1, | ||
| 188 | .dtbclk_mhz = 600.0, | ||
| 189 | }, | ||
| 190 | { | ||
| 191 | .state = 7, | ||
| 192 | .dcfclk_mhz = 1200.0, | ||
| 193 | .fabricclk_mhz = 2000.0, | ||
| 194 | .socclk_mhz = 1467.0, | ||
| 195 | .dram_speed_mts = 8533.0, | ||
| 196 | .dispclk_mhz = 1600.0, | ||
| 197 | .dppclk_mhz = 1600.0, | ||
| 198 | .phyclk_mhz = 810.0, | ||
| 199 | .phyclk_d18_mhz = 667.0, | ||
| 200 | .dscclk_mhz = 533.3, | ||
| 142 | .dtbclk_mhz = 600.0, | 201 | .dtbclk_mhz = 600.0, |
| 143 | }, | 202 | }, |
| 144 | }, | 203 | }, |
| 145 | .num_states = 5, | 204 | .num_states = 8, |
| 146 | .sr_exit_time_us = 28.0, | 205 | .sr_exit_time_us = 28.0, |
| 147 | .sr_enter_plus_exit_time_us = 30.0, | 206 | .sr_enter_plus_exit_time_us = 30.0, |
| 148 | .sr_exit_z8_time_us = 210.0, | 207 | .sr_exit_z8_time_us = 250.0, |
| 149 | .sr_enter_plus_exit_z8_time_us = 320.0, | 208 | .sr_enter_plus_exit_z8_time_us = 350.0, |
| 150 | .fclk_change_latency_us = 24.0, | 209 | .fclk_change_latency_us = 24.0, |
| 151 | .usr_retraining_latency_us = 2, | 210 | .usr_retraining_latency_us = 2, |
| 152 | .writeback_latency_us = 12.0, | 211 | .writeback_latency_us = 12.0, |
| @@ -177,6 +236,9 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_51_soc = { · 24 unmodified lines | |||
| 177 | .do_urgent_latency_adjustment = 0, | 236 | .do_urgent_latency_adjustment = 0, |
| 178 | .urgent_latency_adjustment_fabric_clock_component_us = 0, | 237 | .urgent_latency_adjustment_fabric_clock_component_us = 0, |
| 179 | .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, | 238 | .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, |
| 239 | .num_chans = 4, | ||
| 240 | .dram_clock_change_latency_us = 11.72, | ||
| 241 | .dispclk_dppclk_vco_speed_mhz = 2400.0, | ||
| 180 | }; | 242 | }; |
| 181 | 243 | ||
| 182 | /* | 244 | /* |
| @@ -340,6 +402,8 @@ void dcn351_update_bw_bounding_box_fpu(struct dc *dc, · 157 unmodified lines | |||
| 340 | clock_limits[i].socclk_mhz; | 402 | clock_limits[i].socclk_mhz; |
| 341 | dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].memclk_mhz = | 403 | dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].memclk_mhz = |
| 342 | clk_table->entries[i].memclk_mhz * clk_table->entries[i].wck_ratio; | 404 | clk_table->entries[i].memclk_mhz * clk_table->entries[i].wck_ratio; |
| 405 | dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz = | ||
| 406 | clock_limits[i].dtbclk_mhz; | ||
| 343 | dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels = | 407 | dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels = |
| 344 | clk_table->num_entries; | 408 | clk_table->num_entries; |
| 345 | dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels = | 409 | dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels = |
| @@ -352,6 +416,8 @@ void dcn351_update_bw_bounding_box_fpu(struct dc *dc, · 6 unmodified lines | |||
| 352 | clk_table->num_entries; | 416 | clk_table->num_entries; |
| 353 | dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels = | 417 | dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels = |
| 354 | clk_table->num_entries; | 418 | clk_table->num_entries; |
| 419 | dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels = | ||
| 420 | clk_table->num_entries; | ||
| 355 | } | 421 | } |
| 356 | } | 422 | } |
| 357 | 423 | ||
| @@ -551,6 +617,7 @@ void dcn351_decide_zstate_support(struct dc *dc, struct dc_state *context) · 193 unmodified lines | |||
| 551 | if (context->res_ctx.pipe_ctx[i].plane_state) | 617 | if (context->res_ctx.pipe_ctx[i].plane_state) |
| 552 | plane_count++; | 618 | plane_count++; |
| 553 | } | 619 | } |
| 620 | |||
| 554 | /*dcn351 does not support z9/z10*/ | 621 | /*dcn351 does not support z9/z10*/ |
| 555 | if (context->stream_count == 0 || plane_count == 0) { | 622 | if (context->stream_count == 0 || plane_count == 0) { |
| 556 | support = DCN_ZSTATE_SUPPORT_ALLOW_Z8_ONLY; | 623 | support = DCN_ZSTATE_SUPPORT_ALLOW_Z8_ONLY; |
| @@ -564,11 +631,9 @@ void dcn351_decide_zstate_support(struct dc *dc, struct dc_state *context) · 7 unmodified lines | |||
| 564 | dc->debug.minimum_z8_residency_time > 0 ? dc->debug.minimum_z8_residency_time : 1000; | 631 | dc->debug.minimum_z8_residency_time > 0 ? dc->debug.minimum_z8_residency_time : 1000; |
| 565 | bool allow_z8 = context->bw_ctx.dml.vba.StutterPeriod > (double)minmum_z8_residency; | 632 | bool allow_z8 = context->bw_ctx.dml.vba.StutterPeriod > (double)minmum_z8_residency; |
| 566 | 633 | ||
| 567 | |||
| 568 | /*for psr1/psr-su, we allow z8 and z10 based on latency, for replay with IPS enabled, it will enter ips2*/ | 634 | /*for psr1/psr-su, we allow z8 and z10 based on latency, for replay with IPS enabled, it will enter ips2*/ |
| 569 | if (is_pwrseq0 && (is_psr || is_replay)) | 635 | if (is_pwrseq0 && (is_psr || is_replay)) |
| 570 | support = allow_z8 ? allow_z8 : DCN_ZSTATE_SUPPORT_DISALLOW; | 636 | support = allow_z8 ? allow_z8 : DCN_ZSTATE_SUPPORT_DISALLOW; |
| 571 | |||
| 572 | } | 637 | } |
| 573 | context->bw_ctx.bw.dcn.clk.zstate_support = support; | 638 | context->bw_ctx.bw.dcn.clk.zstate_support = support; |
| 574 | } | 639 | } |
| @@ -228,17 +228,13 @@ void dml2_init_socbb_params(struct dml2_context *dml2, const struct dc *in_dc, s · 227 unmodified lines | |||
| 228 | break; | 228 | break; |
| 229 | 229 | ||
| 230 | case dml_project_dcn35: | 230 | case dml_project_dcn35: |
| 231 | case dml_project_dcn351: | ||
| 231 | out->num_chans = 4; | 232 | out->num_chans = 4; |
| 232 | out->round_trip_ping_latency_dcfclk_cycles = 106; | 233 | out->round_trip_ping_latency_dcfclk_cycles = 106; |
| 233 | out->smn_latency_us = 2; | 234 | out->smn_latency_us = 2; |
| 234 | out->dispclk_dppclk_vco_speed_mhz = 3600; | 235 | out->dispclk_dppclk_vco_speed_mhz = 3600; |
| 235 | break; | 236 | break; |
| 236 | 237 | ||
| 237 | case dml_project_dcn351: | ||
| 238 | out->num_chans = 16; | ||
| 239 | out->round_trip_ping_latency_dcfclk_cycles = 1100; | ||
| 240 | out->smn_latency_us = 2; | ||
| 241 | break; | ||
| 242 | } | 238 | } |
| 243 | /* ---Overrides if available--- */ | 239 | /* ---Overrides if available--- */ |
| 244 | if (dml2->config.bbox_overrides.dram_num_chan) | 240 | if (dml2->config.bbox_overrides.dram_num_chan) |
| @@ -1185,7 +1185,8 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) · 1184 unmodified lines | |||
| 1185 | if (dccg) { | 1185 | if (dccg) { |
| 1186 | dccg->funcs->disable_symclk32_se(dccg, dp_hpo_inst); | 1186 | dccg->funcs->disable_symclk32_se(dccg, dp_hpo_inst); |
| 1187 | dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst); | 1187 | dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst); |
| 1188 | dccg->funcs->set_dtbclk_dto(dccg, &dto_params); | 1188 | if (dccg && dccg->funcs->set_dtbclk_dto) |
| 1189 | dccg->funcs->set_dtbclk_dto(dccg, &dto_params); | ||
| 1189 | } | 1190 | } |
| 1190 | } else if (dccg && dccg->funcs->disable_symclk_se) { | 1191 | } else if (dccg && dccg->funcs->disable_symclk_se) { |
| 1191 | dccg->funcs->disable_symclk_se(dccg, stream_enc->stream_enc_inst, | 1192 | dccg->funcs->disable_symclk_se(dccg, stream_enc->stream_enc_inst, |
| @@ -69,29 +69,6 @@ · 68 unmodified lines | |||
| 69 | #define FN(reg_name, field_name) \ | 69 | #define FN(reg_name, field_name) \ |
| 70 | hws->shifts->field_name, hws->masks->field_name | 70 | hws->shifts->field_name, hws->masks->field_name |
| 71 | 71 | ||
| 72 | static int calc_mpc_flow_ctrl_cnt(const struct dc_stream_state *stream, | ||
| 73 | int opp_cnt) | ||
| 74 | { | ||
| 75 | bool hblank_halved = optc2_is_two_pixels_per_containter(&stream->timing); | ||
| 76 | int flow_ctrl_cnt; | ||
| 77 | |||
| 78 | if (opp_cnt >= 2) | ||
| 79 | hblank_halved = true; | ||
| 80 | |||
| 81 | flow_ctrl_cnt = stream->timing.h_total - stream->timing.h_addressable - | ||
| 82 | stream->timing.h_border_left - | ||
| 83 | stream->timing.h_border_right; | ||
| 84 | |||
| 85 | if (hblank_halved) | ||
| 86 | flow_ctrl_cnt /= 2; | ||
| 87 | |||
| 88 | /* ODM combine 4:1 case */ | ||
| 89 | if (opp_cnt == 4) | ||
| 90 | flow_ctrl_cnt /= 2; | ||
| 91 | |||
| 92 | return flow_ctrl_cnt; | ||
| 93 | } | ||
| 94 | |||
| 95 | static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) | 72 | static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) |
| 96 | { | 73 | { |
| 97 | struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; | 74 | struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; |
| @@ -183,10 +160,6 @@ void dcn314_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx · 85 unmodified lines | |||
| 183 | struct pipe_ctx *odm_pipe; | 160 | struct pipe_ctx *odm_pipe; |
| 184 | int opp_cnt = 0; | 161 | int opp_cnt = 0; |
| 185 | int opp_inst[MAX_PIPES] = {0}; | 162 | int opp_inst[MAX_PIPES] = {0}; |
| 186 | bool rate_control_2x_pclk = (pipe_ctx->stream->timing.flags.INTERLACE || optc2_is_two_pixels_per_containter(&pipe_ctx->stream->timing)); | ||
| 187 | struct mpc_dwb_flow_control flow_control; | ||
| 188 | struct mpc *mpc = dc->res_pool->mpc; | ||
| 189 | int i; | ||
| 190 | 163 | ||
| 191 | opp_cnt = get_odm_config(pipe_ctx, opp_inst); | 164 | opp_cnt = get_odm_config(pipe_ctx, opp_inst); |
| 192 | 165 | ||
| @@ -199,20 +172,6 @@ void dcn314_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx · 6 unmodified lines | |||
| 199 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( | 172 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( |
| 200 | pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); | 173 | pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); |
| 201 | 174 | ||
| 202 | rate_control_2x_pclk = rate_control_2x_pclk || opp_cnt > 1; | ||
| 203 | flow_control.flow_ctrl_mode = 0; | ||
| 204 | flow_control.flow_ctrl_cnt0 = 0x80; | ||
| 205 | flow_control.flow_ctrl_cnt1 = calc_mpc_flow_ctrl_cnt(pipe_ctx->stream, opp_cnt); | ||
| 206 | if (mpc->funcs->set_out_rate_control) { | ||
| 207 | for (i = 0; i < opp_cnt; ++i) { | ||
| 208 | mpc->funcs->set_out_rate_control( | ||
| 209 | mpc, opp_inst[i], | ||
| 210 | true, | ||
| 211 | rate_control_2x_pclk, | ||
| 212 | &flow_control); | ||
| 213 | } | ||
| 214 | } | ||
| 215 | |||
| 216 | for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { | 175 | for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { |
| 217 | odm_pipe->stream_res.opp->funcs->opp_pipe_clock_control( | 176 | odm_pipe->stream_res.opp->funcs->opp_pipe_clock_control( |
| 218 | odm_pipe->stream_res.opp, | 177 | odm_pipe->stream_res.opp, |
| @@ -966,29 +966,6 @@ void dcn32_init_hw(struct dc *dc) · 965 unmodified lines | |||
| 966 | } | 966 | } |
| 967 | } | 967 | } |
| 968 | 968 | ||
| 969 | static int calc_mpc_flow_ctrl_cnt(const struct dc_stream_state *stream, | ||
| 970 | int opp_cnt) | ||
| 971 | { | ||
| 972 | bool hblank_halved = optc2_is_two_pixels_per_containter(&stream->timing); | ||
| 973 | int flow_ctrl_cnt; | ||
| 974 | |||
| 975 | if (opp_cnt >= 2) | ||
| 976 | hblank_halved = true; | ||
| 977 | |||
| 978 | flow_ctrl_cnt = stream->timing.h_total - stream->timing.h_addressable - | ||
| 979 | stream->timing.h_border_left - | ||
| 980 | stream->timing.h_border_right; | ||
| 981 | |||
| 982 | if (hblank_halved) | ||
| 983 | flow_ctrl_cnt /= 2; | ||
| 984 | |||
| 985 | /* ODM combine 4:1 case */ | ||
| 986 | if (opp_cnt == 4) | ||
| 987 | flow_ctrl_cnt /= 2; | ||
| 988 | |||
| 989 | return flow_ctrl_cnt; | ||
| 990 | } | ||
| 991 | |||
| 992 | static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) | 969 | static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) |
| 993 | { | 970 | { |
| 994 | struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; | 971 | struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; |
| @@ -1103,10 +1080,6 @@ void dcn32_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx * · 108 unmodified lines | |||
| 1103 | struct pipe_ctx *odm_pipe; | 1080 | struct pipe_ctx *odm_pipe; |
| 1104 | int opp_cnt = 0; | 1081 | int opp_cnt = 0; |
| 1105 | int opp_inst[MAX_PIPES] = {0}; | 1082 | int opp_inst[MAX_PIPES] = {0}; |
| 1106 | bool rate_control_2x_pclk = (pipe_ctx->stream->timing.flags.INTERLACE || optc2_is_two_pixels_per_containter(&pipe_ctx->stream->timing)); | ||
| 1107 | struct mpc_dwb_flow_control flow_control; | ||
| 1108 | struct mpc *mpc = dc->res_pool->mpc; | ||
| 1109 | int i; | ||
| 1110 | 1083 | ||
| 1111 | opp_cnt = get_odm_config(pipe_ctx, opp_inst); | 1084 | opp_cnt = get_odm_config(pipe_ctx, opp_inst); |
| 1112 | 1085 | ||
| @@ -1119,20 +1092,6 @@ void dcn32_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx * · 6 unmodified lines | |||
| 1119 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( | 1092 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( |
| 1120 | pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); | 1093 | pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); |
| 1121 | 1094 | ||
| 1122 | rate_control_2x_pclk = rate_control_2x_pclk || opp_cnt > 1; | ||
| 1123 | flow_control.flow_ctrl_mode = 0; | ||
| 1124 | flow_control.flow_ctrl_cnt0 = 0x80; | ||
| 1125 | flow_control.flow_ctrl_cnt1 = calc_mpc_flow_ctrl_cnt(pipe_ctx->stream, opp_cnt); | ||
| 1126 | if (mpc->funcs->set_out_rate_control) { | ||
| 1127 | for (i = 0; i < opp_cnt; ++i) { | ||
| 1128 | mpc->funcs->set_out_rate_control( | ||
| 1129 | mpc, opp_inst[i], | ||
| 1130 | true, | ||
| 1131 | rate_control_2x_pclk, | ||
| 1132 | &flow_control); | ||
| 1133 | } | ||
| 1134 | } | ||
| 1135 | |||
| 1136 | for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { | 1095 | for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { |
| 1137 | odm_pipe->stream_res.opp->funcs->opp_pipe_clock_control( | 1096 | odm_pipe->stream_res.opp->funcs->opp_pipe_clock_control( |
| 1138 | odm_pipe->stream_res.opp, | 1097 | odm_pipe->stream_res.opp, |
| @@ -358,29 +358,6 @@ void dcn35_init_hw(struct dc *dc) · 357 unmodified lines | |||
| 358 | } | 358 | } |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | static int calc_mpc_flow_ctrl_cnt(const struct dc_stream_state *stream, | ||
| 362 | int opp_cnt) | ||
| 363 | { | ||
| 364 | bool hblank_halved = optc2_is_two_pixels_per_containter(&stream->timing); | ||
| 365 | int flow_ctrl_cnt; | ||
| 366 | |||
| 367 | if (opp_cnt >= 2) | ||
| 368 | hblank_halved = true; | ||
| 369 | |||
| 370 | flow_ctrl_cnt = stream->timing.h_total - stream->timing.h_addressable - | ||
| 371 | stream->timing.h_border_left - | ||
| 372 | stream->timing.h_border_right; | ||
| 373 | |||
| 374 | if (hblank_halved) | ||
| 375 | flow_ctrl_cnt /= 2; | ||
| 376 | |||
| 377 | /* ODM combine 4:1 case */ | ||
| 378 | if (opp_cnt == 4) | ||
| 379 | flow_ctrl_cnt /= 2; | ||
| 380 | |||
| 381 | return flow_ctrl_cnt; | ||
| 382 | } | ||
| 383 | |||
| 384 | static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) | 361 | static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) |
| 385 | { | 362 | { |
| 386 | struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; | 363 | struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; |
| @@ -474,10 +451,6 @@ void dcn35_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx * · 87 unmodified lines | |||
| 474 | struct pipe_ctx *odm_pipe; | 451 | struct pipe_ctx *odm_pipe; |
| 475 | int opp_cnt = 0; | 452 | int opp_cnt = 0; |
| 476 | int opp_inst[MAX_PIPES] = {0}; | 453 | int opp_inst[MAX_PIPES] = {0}; |
| 477 | bool rate_control_2x_pclk = (pipe_ctx->stream->timing.flags.INTERLACE || optc2_is_two_pixels_per_containter(&pipe_ctx->stream->timing)); | ||
| 478 | struct mpc_dwb_flow_control flow_control; | ||
| 479 | struct mpc *mpc = dc->res_pool->mpc; | ||
| 480 | int i; | ||
| 481 | 454 | ||
| 482 | opp_cnt = get_odm_config(pipe_ctx, opp_inst); | 455 | opp_cnt = get_odm_config(pipe_ctx, opp_inst); |
| 483 | 456 | ||
| @@ -490,20 +463,6 @@ void dcn35_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx * · 6 unmodified lines | |||
| 490 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( | 463 | pipe_ctx->stream_res.tg->funcs->set_odm_bypass( |
| 491 | pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); | 464 | pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); |
| 492 | 465 | ||
| 493 | rate_control_2x_pclk = rate_control_2x_pclk || opp_cnt > 1; | ||
| 494 | flow_control.flow_ctrl_mode = 0; | ||
| 495 | flow_control.flow_ctrl_cnt0 = 0x80; | ||
| 496 | flow_control.flow_ctrl_cnt1 = calc_mpc_flow_ctrl_cnt(pipe_ctx->stream, opp_cnt); | ||
| 497 | if (mpc->funcs->set_out_rate_control) { | ||
| 498 | for (i = 0; i < opp_cnt; ++i) { | ||
| 499 | mpc->funcs->set_out_rate_control( | ||
| 500 | mpc, opp_inst[i], | ||
| 501 | true, | ||
| 502 | rate_control_2x_pclk, | ||
| 503 | &flow_control); | ||
| 504 | } | ||
| 505 | } | ||
| 506 | |||
| 507 | for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { | 466 | for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { |
| 508 | odm_pipe->stream_res.opp->funcs->opp_pipe_clock_control( | 467 | odm_pipe->stream_res.opp->funcs->opp_pipe_clock_control( |
| 509 | odm_pipe->stream_res.opp, | 468 | odm_pipe->stream_res.opp, |
| @@ -67,7 +67,7 @@ static const struct hw_sequencer_funcs dcn351_funcs = { · 66 unmodified lines | |||
| 67 | .prepare_bandwidth = dcn35_prepare_bandwidth, | 67 | .prepare_bandwidth = dcn35_prepare_bandwidth, |
| 68 | .optimize_bandwidth = dcn35_optimize_bandwidth, | 68 | .optimize_bandwidth = dcn35_optimize_bandwidth, |
| 69 | .update_bandwidth = dcn20_update_bandwidth, | 69 | .update_bandwidth = dcn20_update_bandwidth, |
| 70 | .set_drr = dcn10_set_drr, | 70 | .set_drr = dcn35_set_drr, |
| 71 | .get_position = dcn10_get_position, | 71 | .get_position = dcn10_get_position, |
| 72 | .set_static_screen_control = dcn35_set_static_screen_control, | 72 | .set_static_screen_control = dcn35_set_static_screen_control, |
| 73 | .setup_stereo = dcn10_setup_stereo, | 73 | .setup_stereo = dcn10_setup_stereo, |
| @@ -700,6 +700,8 @@ static const struct dc_debug_options debug_defaults_drv = { · 699 unmodified lines | |||
| 700 | .disable_dcc = DCC_ENABLE, | 700 | .disable_dcc = DCC_ENABLE, |
| 701 | .disable_dpp_power_gate = true, | 701 | .disable_dpp_power_gate = true, |
| 702 | .disable_hubp_power_gate = true, | 702 | .disable_hubp_power_gate = true, |
| 703 | .disable_optc_power_gate = true, /*should the same as above two*/ | ||
| 704 | .disable_hpo_power_gate = true, /*dmubfw force domain25 on*/ | ||
| 703 | .disable_clock_gate = false, | 705 | .disable_clock_gate = false, |
| 704 | .disable_dsc_power_gate = true, | 706 | .disable_dsc_power_gate = true, |
| 705 | .vsr_support = true, | 707 | .vsr_support = true, |
| @@ -742,12 +744,13 @@ static const struct dc_debug_options debug_defaults_drv = { · 36 unmodified lines | |||
| 742 | }, | 744 | }, |
| 743 | .seamless_boot_odm_combine = DML_FAIL_SOURCE_PIXEL_FORMAT, | 745 | .seamless_boot_odm_combine = DML_FAIL_SOURCE_PIXEL_FORMAT, |
| 744 | .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ | 746 | .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ |
| 747 | .minimum_z8_residency_time = 2100, | ||
| 745 | .using_dml2 = true, | 748 | .using_dml2 = true, |
| 746 | .support_eDP1_5 = true, | 749 | .support_eDP1_5 = true, |
| 747 | .enable_hpo_pg_support = false, | 750 | .enable_hpo_pg_support = false, |
| 748 | .enable_legacy_fast_update = true, | 751 | .enable_legacy_fast_update = true, |
| 749 | .enable_single_display_2to1_odm_policy = true, | 752 | .enable_single_display_2to1_odm_policy = true, |
| 750 | .disable_idle_power_optimizations = true, | 753 | .disable_idle_power_optimizations = false, |
| 751 | .dmcub_emulation = false, | 754 | .dmcub_emulation = false, |
| 752 | .disable_boot_optimizations = false, | 755 | .disable_boot_optimizations = false, |
| 753 | .disable_unbounded_requesting = false, | 756 | .disable_unbounded_requesting = false, |
| @@ -758,8 +761,10 @@ static const struct dc_debug_options debug_defaults_drv = { · 4 unmodified lines | |||
| 758 | .disable_z10 = true, | 761 | .disable_z10 = true, |
| 759 | .ignore_pg = true, | 762 | .ignore_pg = true, |
| 760 | .psp_disabled_wa = true, | 763 | .psp_disabled_wa = true, |
| 761 | .ips2_eval_delay_us = 200, | 764 | .ips2_eval_delay_us = 2000, |
| 762 | .ips2_entry_delay_us = 400 | 765 | .ips2_entry_delay_us = 800, |
| 766 | .disable_dmub_reallow_idle = true, | ||
| 767 | .static_screen_wait_frames = 2, | ||
| 763 | }; | 768 | }; |
| 764 | 769 | ||
| 765 | static const struct dc_panel_config panel_config_defaults = { | 770 | static const struct dc_panel_config panel_config_defaults = { |
| @@ -147,15 +147,12 @@ void mod_build_vsc_infopacket(const struct dc_stream_state *stream, · 146 unmodified lines | |||
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /* VSC packet set to 4 for PSR-SU, or 2 for PSR1 */ | 149 | /* VSC packet set to 4 for PSR-SU, or 2 for PSR1 */ |
| 150 | if (stream->link->psr_settings.psr_feature_enabled) { | 150 | if (stream->link->psr_settings.psr_version == DC_PSR_VERSION_SU_1) |
| 151 | if (stream->link->psr_settings.psr_version == DC_PSR_VERSION_SU_1) | 151 | vsc_packet_revision = vsc_packet_rev4; |
| 152 | vsc_packet_revision = vsc_packet_rev4; | 152 | else if (stream->link->replay_settings.config.replay_supported) |
| 153 | else if (stream->link->psr_settings.psr_version == DC_PSR_VERSION_1) | ||
| 154 | vsc_packet_revision = vsc_packet_rev2; | ||
| 155 | } | ||
| 156 | |||
| 157 | if (stream->link->replay_settings.config.replay_supported) | ||
| 158 | vsc_packet_revision = vsc_packet_rev4; | 153 | vsc_packet_revision = vsc_packet_rev4; |
| 154 | else if (stream->link->psr_settings.psr_version == DC_PSR_VERSION_1) | ||
| 155 | vsc_packet_revision = vsc_packet_rev2; | ||
| 159 | 156 | ||
| 160 | /* Update to revision 5 for extended colorimetry support */ | 157 | /* Update to revision 5 for extended colorimetry support */ |
| 161 | if (stream->use_vsc_sdp_for_colorimetry) | 158 | if (stream->use_vsc_sdp_for_colorimetry) |
| @@ -234,7 +234,8 @@ union UMSCHAPI__SET_HW_RESOURCES { · 233 unmodified lines | |||
| 234 | uint32_t enable_level_process_quantum_check : 1; | 234 | uint32_t enable_level_process_quantum_check : 1; |
| 235 | uint32_t is_vcn0_enabled : 1; | 235 | uint32_t is_vcn0_enabled : 1; |
| 236 | uint32_t is_vcn1_enabled : 1; | 236 | uint32_t is_vcn1_enabled : 1; |
| 237 | uint32_t reserved : 27; | 237 | uint32_t use_rs64mem_for_proc_ctx_csa : 1; |
| 238 | uint32_t reserved : 26; | ||
| 238 | }; | 239 | }; |
| 239 | uint32_t uint32_all; | 240 | uint32_t uint32_all; |
| 240 | }; | 241 | }; |
| @@ -297,9 +298,12 @@ union UMSCHAPI__ADD_QUEUE { · 56 unmodified lines | |||
| 297 | 298 | ||
| 298 | struct { | 299 | struct { |
| 299 | uint32_t is_context_suspended : 1; | 300 | uint32_t is_context_suspended : 1; |
| 300 | uint32_t reserved : 31; | 301 | uint32_t collaboration_mode : 1; |
| 302 | uint32_t reserved : 30; | ||
| 301 | }; | 303 | }; |
| 302 | struct UMSCH_API_STATUS api_status; | 304 | struct UMSCH_API_STATUS api_status; |
| 305 | uint32_t process_csa_array_index; | ||
| 306 | uint32_t context_csa_array_index; | ||
| 303 | }; | 307 | }; |
| 304 | 308 | ||
| 305 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; | 309 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; |
| @@ -314,6 +318,7 @@ union UMSCHAPI__REMOVE_QUEUE { · 8 unmodified lines | |||
| 314 | uint64_t context_csa_addr; | 318 | uint64_t context_csa_addr; |
| 315 | 319 | ||
| 316 | struct UMSCH_API_STATUS api_status; | 320 | struct UMSCH_API_STATUS api_status; |
| 321 | uint32_t context_csa_array_index; | ||
| 317 | }; | 322 | }; |
| 318 | 323 | ||
| 319 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; | 324 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; |
| @@ -337,6 +342,7 @@ union UMSCHAPI__SUSPEND { · 17 unmodified lines | |||
| 337 | uint32_t suspend_fence_value; | 342 | uint32_t suspend_fence_value; |
| 338 | 343 | ||
| 339 | struct UMSCH_API_STATUS api_status; | 344 | struct UMSCH_API_STATUS api_status; |
| 345 | uint32_t context_csa_array_index; | ||
| 340 | }; | 346 | }; |
| 341 | 347 | ||
| 342 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; | 348 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; |
| @@ -356,6 +362,7 @@ union UMSCHAPI__RESUME { · 13 unmodified lines | |||
| 356 | enum UMSCH_ENGINE_TYPE engine_type; | 362 | enum UMSCH_ENGINE_TYPE engine_type; |
| 357 | 363 | ||
| 358 | struct UMSCH_API_STATUS api_status; | 364 | struct UMSCH_API_STATUS api_status; |
| 365 | uint32_t context_csa_array_index; | ||
| 359 | }; | 366 | }; |
| 360 | 367 | ||
| 361 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; | 368 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; |
| @@ -404,6 +411,7 @@ union UMSCHAPI__UPDATE_AFFINITY { · 42 unmodified lines | |||
| 404 | union UMSCH_AFFINITY affinity; | 411 | union UMSCH_AFFINITY affinity; |
| 405 | uint64_t context_csa_addr; | 412 | uint64_t context_csa_addr; |
| 406 | struct UMSCH_API_STATUS api_status; | 413 | struct UMSCH_API_STATUS api_status; |
| 414 | uint32_t context_csa_array_index; | ||
| 407 | }; | 415 | }; |
| 408 | 416 | ||
| 409 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; | 417 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; |
| @@ -417,6 +425,7 @@ union UMSCHAPI__CHANGE_CONTEXT_PRIORITY_LEVEL { · 7 unmodified lines | |||
| 417 | uint64_t context_quantum; | 425 | uint64_t context_quantum; |
| 418 | uint64_t context_csa_addr; | 426 | uint64_t context_csa_addr; |
| 419 | struct UMSCH_API_STATUS api_status; | 427 | struct UMSCH_API_STATUS api_status; |
| 428 | uint32_t context_csa_array_index; | ||
| 420 | }; | 429 | }; |
| 421 | 430 | ||
| 422 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; | 431 | uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; |
| @@ -54,14 +54,14 @@ · 53 unmodified lines | |||
| 54 | #define PPSMC_MSG_TestMessage 0x01 ///< To check if PMFW is alive and responding. Requirement specified by PMFW team | 54 | #define PPSMC_MSG_TestMessage 0x01 ///< To check if PMFW is alive and responding. Requirement specified by PMFW team |
| 55 | #define PPSMC_MSG_GetPmfwVersion 0x02 ///< Get PMFW version | 55 | #define PPSMC_MSG_GetPmfwVersion 0x02 ///< Get PMFW version |
| 56 | #define PPSMC_MSG_GetDriverIfVersion 0x03 ///< Get PMFW_DRIVER_IF version | 56 | #define PPSMC_MSG_GetDriverIfVersion 0x03 ///< Get PMFW_DRIVER_IF version |
| 57 | #define PPSMC_MSG_SPARE0 0x04 ///< SPARE | 57 | #define PPSMC_MSG_PowerDownVcn1 0x04 ///< Power down VCN1 |
| 58 | #define PPSMC_MSG_SPARE1 0x05 ///< SPARE | 58 | #define PPSMC_MSG_PowerUpVcn1 0x05 ///< Power up VCN1; VCN1 is power gated by default |
| 59 | #define PPSMC_MSG_PowerDownVcn 0x06 ///< Power down VCN | 59 | #define PPSMC_MSG_PowerDownVcn0 0x06 ///< Power down VCN0 |
| 60 | #define PPSMC_MSG_PowerUpVcn 0x07 ///< Power up VCN; VCN is power gated by default | 60 | #define PPSMC_MSG_PowerUpVcn0 0x07 ///< Power up VCN0; VCN0 is power gated by default |
| 61 | #define PPSMC_MSG_SetHardMinVcn 0x08 ///< For wireless display | 61 | #define PPSMC_MSG_SetHardMinVcn0 0x08 ///< For wireless display |
| 62 | #define PPSMC_MSG_SetSoftMinGfxclk 0x09 ///< Set SoftMin for GFXCLK, argument is frequency in MHz | 62 | #define PPSMC_MSG_SetSoftMinGfxclk 0x09 ///< Set SoftMin for GFXCLK, argument is frequency in MHz |
| 63 | #define PPSMC_MSG_SPARE2 0x0A ///< SPARE | 63 | #define PPSMC_MSG_SetHardMinVcn1 0x0A ///< For wireless display |
| 64 | #define PPSMC_MSG_SPARE3 0x0B ///< SPARE | 64 | #define PPSMC_MSG_SetSoftMinVcn1 0x0B ///< Set soft min for VCN1 clocks (VCLK1 and DCLK1) |
| 65 | #define PPSMC_MSG_PrepareMp1ForUnload 0x0C ///< Prepare PMFW for GFX driver unload | 65 | #define PPSMC_MSG_PrepareMp1ForUnload 0x0C ///< Prepare PMFW for GFX driver unload |
| 66 | #define PPSMC_MSG_SetDriverDramAddrHigh 0x0D ///< Set high 32 bits of DRAM address for Driver table transfer | 66 | #define PPSMC_MSG_SetDriverDramAddrHigh 0x0D ///< Set high 32 bits of DRAM address for Driver table transfer |
| 67 | #define PPSMC_MSG_SetDriverDramAddrLow 0x0E ///< Set low 32 bits of DRAM address for Driver table transfer | 67 | #define PPSMC_MSG_SetDriverDramAddrLow 0x0E ///< Set low 32 bits of DRAM address for Driver table transfer |
| @@ -71,7 +71,7 @@ · 3 unmodified lines | |||
| 71 | #define PPSMC_MSG_GetEnabledSmuFeatures 0x12 ///< Get enabled features in PMFW | 71 | #define PPSMC_MSG_GetEnabledSmuFeatures 0x12 ///< Get enabled features in PMFW |
| 72 | #define PPSMC_MSG_SetHardMinSocclkByFreq 0x13 ///< Set hard min for SOC CLK | 72 | #define PPSMC_MSG_SetHardMinSocclkByFreq 0x13 ///< Set hard min for SOC CLK |
| 73 | #define PPSMC_MSG_SetSoftMinFclk 0x14 ///< Set hard min for FCLK | 73 | #define PPSMC_MSG_SetSoftMinFclk 0x14 ///< Set hard min for FCLK |
| 74 | #define PPSMC_MSG_SetSoftMinVcn 0x15 ///< Set soft min for VCN clocks (VCLK and DCLK) | 74 | #define PPSMC_MSG_SetSoftMinVcn0 0x15 ///< Set soft min for VCN0 clocks (VCLK0 and DCLK0) |
| 75 | 75 | ||
| 76 | #define PPSMC_MSG_EnableGfxImu 0x16 ///< Enable GFX IMU | 76 | #define PPSMC_MSG_EnableGfxImu 0x16 ///< Enable GFX IMU |
| 77 | 77 | ||
| @@ -84,17 +84,17 @@ · 6 unmodified lines | |||
| 84 | 84 | ||
| 85 | #define PPSMC_MSG_SetSoftMaxSocclkByFreq 0x1D ///< Set soft max for SOC CLK | 85 | #define PPSMC_MSG_SetSoftMaxSocclkByFreq 0x1D ///< Set soft max for SOC CLK |
| 86 | #define PPSMC_MSG_SetSoftMaxFclkByFreq 0x1E ///< Set soft max for FCLK | 86 | #define PPSMC_MSG_SetSoftMaxFclkByFreq 0x1E ///< Set soft max for FCLK |
| 87 | #define PPSMC_MSG_SetSoftMaxVcn 0x1F ///< Set soft max for VCN clocks (VCLK and DCLK) | 87 | #define PPSMC_MSG_SetSoftMaxVcn0 0x1F ///< Set soft max for VCN0 clocks (VCLK0 and DCLK0) |
| 88 | #define PPSMC_MSG_spare_0x20 0x20 | 88 | #define PPSMC_MSG_spare_0x20 0x20 |
| 89 | #define PPSMC_MSG_PowerDownJpeg 0x21 ///< Power down Jpeg | 89 | #define PPSMC_MSG_PowerDownJpeg0 0x21 ///< Power down Jpeg of VCN0 |
| 90 | #define PPSMC_MSG_PowerUpJpeg 0x22 ///< Power up Jpeg; VCN is power gated by default | 90 | #define PPSMC_MSG_PowerUpJpeg0 0x22 ///< Power up Jpeg of VCN0; VCN0 is power gated by default |
| 91 | 91 | ||
| 92 | #define PPSMC_MSG_SetHardMinFclkByFreq 0x23 ///< Set hard min for FCLK | 92 | #define PPSMC_MSG_SetHardMinFclkByFreq 0x23 ///< Set hard min for FCLK |
| 93 | #define PPSMC_MSG_SetSoftMinSocclkByFreq 0x24 ///< Set soft min for SOC CLK | 93 | #define PPSMC_MSG_SetSoftMinSocclkByFreq 0x24 ///< Set soft min for SOC CLK |
| 94 | #define PPSMC_MSG_AllowZstates 0x25 ///< Inform PMFM of allowing Zstate entry, i.e. no Miracast activity | 94 | #define PPSMC_MSG_AllowZstates 0x25 ///< Inform PMFM of allowing Zstate entry, i.e. no Miracast activity |
| 95 | #define PPSMC_MSG_Reserved 0x26 ///< Not used | 95 | #define PPSMC_MSG_PowerDownJpeg1 0x26 ///< Power down Jpeg of VCN1 |
| 96 | #define PPSMC_MSG_Reserved1 0x27 ///< Not used, previously PPSMC_MSG_RequestActiveWgp | 96 | #define PPSMC_MSG_PowerUpJpeg1 0x27 ///< Power up Jpeg of VCN1; VCN1 is power gated by default |
| 97 | #define PPSMC_MSG_Reserved2 0x28 ///< Not used, previously PPSMC_MSG_QueryActiveWgp | 97 | #define PPSMC_MSG_SetSoftMaxVcn1 0x28 ///< Set soft max for VCN1 clocks (VCLK1 and DCLK1) |
| 98 | #define PPSMC_MSG_PowerDownIspByTile 0x29 ///< ISP is power gated by default | 98 | #define PPSMC_MSG_PowerDownIspByTile 0x29 ///< ISP is power gated by default |
| 99 | #define PPSMC_MSG_PowerUpIspByTile 0x2A ///< This message is used to power up ISP tiles and enable the ISP DPM | 99 | #define PPSMC_MSG_PowerUpIspByTile 0x2A ///< This message is used to power up ISP tiles and enable the ISP DPM |
| 100 | #define PPSMC_MSG_SetHardMinIspiclkByFreq 0x2B ///< Set HardMin by frequency for ISPICLK | 100 | #define PPSMC_MSG_SetHardMinIspiclkByFreq 0x2B ///< Set HardMin by frequency for ISPICLK |
| @@ -115,6 +115,10 @@ · 114 unmodified lines | |||
| 115 | __SMU_DUMMY_MAP(PowerDownVcn), \ | 115 | __SMU_DUMMY_MAP(PowerDownVcn), \ |
| 116 | __SMU_DUMMY_MAP(PowerUpJpeg), \ | 116 | __SMU_DUMMY_MAP(PowerUpJpeg), \ |
| 117 | __SMU_DUMMY_MAP(PowerDownJpeg), \ | 117 | __SMU_DUMMY_MAP(PowerDownJpeg), \ |
| 118 | __SMU_DUMMY_MAP(PowerUpJpeg0), \ | ||
| 119 | __SMU_DUMMY_MAP(PowerDownJpeg0), \ | ||
| 120 | __SMU_DUMMY_MAP(PowerUpJpeg1), \ | ||
| 121 | __SMU_DUMMY_MAP(PowerDownJpeg1), \ | ||
| 118 | __SMU_DUMMY_MAP(BacoAudioD3PME), \ | 122 | __SMU_DUMMY_MAP(BacoAudioD3PME), \ |
| 119 | __SMU_DUMMY_MAP(ArmD3), \ | 123 | __SMU_DUMMY_MAP(ArmD3), \ |
| 120 | __SMU_DUMMY_MAP(RunDcBtc), \ | 124 | __SMU_DUMMY_MAP(RunDcBtc), \ |
| @@ -135,6 +139,8 @@ · 14 unmodified lines | |||
| 135 | __SMU_DUMMY_MAP(PowerUpSdma), \ | 139 | __SMU_DUMMY_MAP(PowerUpSdma), \ |
| 136 | __SMU_DUMMY_MAP(SetHardMinIspclkByFreq), \ | 140 | __SMU_DUMMY_MAP(SetHardMinIspclkByFreq), \ |
| 137 | __SMU_DUMMY_MAP(SetHardMinVcn), \ | 141 | __SMU_DUMMY_MAP(SetHardMinVcn), \ |
| 142 | __SMU_DUMMY_MAP(SetHardMinVcn0), \ | ||
| 143 | __SMU_DUMMY_MAP(SetHardMinVcn1), \ | ||
| 138 | __SMU_DUMMY_MAP(SetAllowFclkSwitch), \ | 144 | __SMU_DUMMY_MAP(SetAllowFclkSwitch), \ |
| 139 | __SMU_DUMMY_MAP(SetMinVideoGfxclkFreq), \ | 145 | __SMU_DUMMY_MAP(SetMinVideoGfxclkFreq), \ |
| 140 | __SMU_DUMMY_MAP(ActiveProcessNotify), \ | 146 | __SMU_DUMMY_MAP(ActiveProcessNotify), \ |
| @@ -150,6 +156,8 @@ · 9 unmodified lines | |||
| 150 | __SMU_DUMMY_MAP(SetPhyclkVoltageByFreq), \ | 156 | __SMU_DUMMY_MAP(SetPhyclkVoltageByFreq), \ |
| 151 | __SMU_DUMMY_MAP(SetDppclkVoltageByFreq), \ | 157 | __SMU_DUMMY_MAP(SetDppclkVoltageByFreq), \ |
| 152 | __SMU_DUMMY_MAP(SetSoftMinVcn), \ | 158 | __SMU_DUMMY_MAP(SetSoftMinVcn), \ |
| 159 | __SMU_DUMMY_MAP(SetSoftMinVcn0), \ | ||
| 160 | __SMU_DUMMY_MAP(SetSoftMinVcn1), \ | ||
| 153 | __SMU_DUMMY_MAP(EnablePostCode), \ | 161 | __SMU_DUMMY_MAP(EnablePostCode), \ |
| 154 | __SMU_DUMMY_MAP(GetGfxclkFrequency), \ | 162 | __SMU_DUMMY_MAP(GetGfxclkFrequency), \ |
| 155 | __SMU_DUMMY_MAP(GetFclkFrequency), \ | 163 | __SMU_DUMMY_MAP(GetFclkFrequency), \ |
| @@ -161,6 +169,8 @@ · 5 unmodified lines | |||
| 161 | __SMU_DUMMY_MAP(SetSoftMaxSocclkByFreq), \ | 169 | __SMU_DUMMY_MAP(SetSoftMaxSocclkByFreq), \ |
| 162 | __SMU_DUMMY_MAP(SetSoftMaxFclkByFreq), \ | 170 | __SMU_DUMMY_MAP(SetSoftMaxFclkByFreq), \ |
| 163 | __SMU_DUMMY_MAP(SetSoftMaxVcn), \ | 171 | __SMU_DUMMY_MAP(SetSoftMaxVcn), \ |
| 172 | __SMU_DUMMY_MAP(SetSoftMaxVcn0), \ | ||
| 173 | __SMU_DUMMY_MAP(SetSoftMaxVcn1), \ | ||
| 164 | __SMU_DUMMY_MAP(PowerGateMmHub), \ | 174 | __SMU_DUMMY_MAP(PowerGateMmHub), \ |
| 165 | __SMU_DUMMY_MAP(UpdatePmeRestore), \ | 175 | __SMU_DUMMY_MAP(UpdatePmeRestore), \ |
| 166 | __SMU_DUMMY_MAP(GpuChangeState), \ | 176 | __SMU_DUMMY_MAP(GpuChangeState), \ |
| @@ -1402,9 +1402,22 @@ int smu_v14_0_set_vcn_enable(struct smu_context *smu, · 1401 unmodified lines | |||
| 1402 | if (adev->vcn.harvest_config & (1 << i)) | 1402 | if (adev->vcn.harvest_config & (1 << i)) |
| 1403 | continue; | 1403 | continue; |
| 1404 | 1404 | ||
| 1405 | ret = smu_cmn_send_smc_msg_with_param(smu, enable ? | 1405 | if (amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 0) || |
| 1406 | SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, | 1406 | amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 1)) { |
| 1407 | i << 16U, NULL); | 1407 | if (i == 0) |
| 1408 | ret = smu_cmn_send_smc_msg_with_param(smu, enable ? | ||
| 1409 | SMU_MSG_PowerUpVcn0 : SMU_MSG_PowerDownVcn0, | ||
| 1410 | i << 16U, NULL); | ||
| 1411 | else if (i == 1) | ||
| 1412 | ret = smu_cmn_send_smc_msg_with_param(smu, enable ? | ||
| 1413 | SMU_MSG_PowerUpVcn1 : SMU_MSG_PowerDownVcn1, | ||
| 1414 | i << 16U, NULL); | ||
| 1415 | } else { | ||
| 1416 | ret = smu_cmn_send_smc_msg_with_param(smu, enable ? | ||
| 1417 | SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, | ||
| 1418 | i << 16U, NULL); | ||
| 1419 | } | ||
| 1420 | |||
| 1408 | if (ret) | 1421 | if (ret) |
| 1409 | return ret; | 1422 | return ret; |
| 1410 | } | 1423 | } |
| @@ -1415,9 +1428,34 @@ int smu_v14_0_set_vcn_enable(struct smu_context *smu, · 4 unmodified lines | |||
| 1415 | int smu_v14_0_set_jpeg_enable(struct smu_context *smu, | 1428 | int smu_v14_0_set_jpeg_enable(struct smu_context *smu, |
| 1416 | bool enable) | 1429 | bool enable) |
| 1417 | { | 1430 | { |
| 1418 | return smu_cmn_send_smc_msg_with_param(smu, enable ? | 1431 | struct amdgpu_device *adev = smu->adev; |
| 1419 | SMU_MSG_PowerUpJpeg : SMU_MSG_PowerDownJpeg, | 1432 | int i, ret = 0; |
| 1420 | 0, NULL); | 1433 | |
| 1434 | for (i = 0; i < adev->jpeg.num_jpeg_inst; i++) { | ||
| 1435 | if (adev->jpeg.harvest_config & (1 << i)) | ||
| 1436 | continue; | ||
| 1437 | |||
| 1438 | if (amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 0) || | ||
| 1439 | amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 1)) { | ||
| 1440 | if (i == 0) | ||
| 1441 | ret = smu_cmn_send_smc_msg_with_param(smu, enable ? | ||
| 1442 | SMU_MSG_PowerUpJpeg0 : SMU_MSG_PowerDownJpeg0, | ||
| 1443 | i << 16U, NULL); | ||
| 1444 | else if (i == 1 && amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 1)) | ||
| 1445 | ret = smu_cmn_send_smc_msg_with_param(smu, enable ? | ||
| 1446 | SMU_MSG_PowerUpJpeg1 : SMU_MSG_PowerDownJpeg1, | ||
| 1447 | i << 16U, NULL); | ||
| 1448 | } else { | ||
| 1449 | ret = smu_cmn_send_smc_msg_with_param(smu, enable ? | ||
| 1450 | SMU_MSG_PowerUpJpeg : SMU_MSG_PowerDownJpeg, | ||
| 1451 | i << 16U, NULL); | ||
| 1452 | } | ||
| 1453 | |||
| 1454 | if (ret) | ||
| 1455 | return ret; | ||
| 1456 | } | ||
| 1457 | |||
| 1458 | return ret; | ||
| 1421 | } | 1459 | } |
| 1422 | 1460 | ||
| 1423 | int smu_v14_0_run_btc(struct smu_context *smu) | 1461 | int smu_v14_0_run_btc(struct smu_context *smu) |
| @@ -70,9 +70,12 @@ static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] = · 69 unmodified lines | |||
| 70 | MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 1), | 70 | MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 1), |
| 71 | MSG_MAP(GetSmuVersion, PPSMC_MSG_GetPmfwVersion, 1), | 71 | MSG_MAP(GetSmuVersion, PPSMC_MSG_GetPmfwVersion, 1), |
| 72 | MSG_MAP(GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion, 1), | 72 | MSG_MAP(GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion, 1), |
| 73 | MSG_MAP(PowerDownVcn, PPSMC_MSG_PowerDownVcn, 1), | 73 | MSG_MAP(PowerDownVcn0, PPSMC_MSG_PowerDownVcn0, 1), |
| 74 | MSG_MAP(PowerUpVcn, PPSMC_MSG_PowerUpVcn, 1), | 74 | MSG_MAP(PowerUpVcn0, PPSMC_MSG_PowerUpVcn0, 1), |
| 75 | MSG_MAP(SetHardMinVcn, PPSMC_MSG_SetHardMinVcn, 1), | 75 | MSG_MAP(SetHardMinVcn0, PPSMC_MSG_SetHardMinVcn0, 1), |
| 76 | MSG_MAP(PowerDownVcn1, PPSMC_MSG_PowerDownVcn1, 1), | ||
| 77 | MSG_MAP(PowerUpVcn1, PPSMC_MSG_PowerUpVcn1, 1), | ||
| 78 | MSG_MAP(SetHardMinVcn1, PPSMC_MSG_SetHardMinVcn1, 1), | ||
| 76 | MSG_MAP(SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxclk, 1), | 79 | MSG_MAP(SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxclk, 1), |
| 77 | MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload, 1), | 80 | MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload, 1), |
| 78 | MSG_MAP(SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh, 1), | 81 | MSG_MAP(SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh, 1), |
| @@ -83,7 +86,8 @@ static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] = · 4 unmodified lines | |||
| 83 | MSG_MAP(GetEnabledSmuFeatures, PPSMC_MSG_GetEnabledSmuFeatures, 1), | 86 | MSG_MAP(GetEnabledSmuFeatures, PPSMC_MSG_GetEnabledSmuFeatures, 1), |
| 84 | MSG_MAP(SetHardMinSocclkByFreq, PPSMC_MSG_SetHardMinSocclkByFreq, 1), | 87 | MSG_MAP(SetHardMinSocclkByFreq, PPSMC_MSG_SetHardMinSocclkByFreq, 1), |
| 85 | MSG_MAP(SetSoftMinFclk, PPSMC_MSG_SetSoftMinFclk, 1), | 88 | MSG_MAP(SetSoftMinFclk, PPSMC_MSG_SetSoftMinFclk, 1), |
| 86 | MSG_MAP(SetSoftMinVcn, PPSMC_MSG_SetSoftMinVcn, 1), | 89 | MSG_MAP(SetSoftMinVcn0, PPSMC_MSG_SetSoftMinVcn0, 1), |
| 90 | MSG_MAP(SetSoftMinVcn1, PPSMC_MSG_SetSoftMinVcn1, 1), | ||
| 87 | MSG_MAP(EnableGfxImu, PPSMC_MSG_EnableGfxImu, 1), | 91 | MSG_MAP(EnableGfxImu, PPSMC_MSG_EnableGfxImu, 1), |
| 88 | MSG_MAP(AllowGfxOff, PPSMC_MSG_AllowGfxOff, 1), | 92 | MSG_MAP(AllowGfxOff, PPSMC_MSG_AllowGfxOff, 1), |
| 89 | MSG_MAP(DisallowGfxOff, PPSMC_MSG_DisallowGfxOff, 1), | 93 | MSG_MAP(DisallowGfxOff, PPSMC_MSG_DisallowGfxOff, 1), |
| @@ -91,9 +95,12 @@ static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] = · 1 unmodified line | |||
| 91 | MSG_MAP(SetHardMinGfxClk, PPSMC_MSG_SetHardMinGfxClk, 1), | 95 | MSG_MAP(SetHardMinGfxClk, PPSMC_MSG_SetHardMinGfxClk, 1), |
| 92 | MSG_MAP(SetSoftMaxSocclkByFreq, PPSMC_MSG_SetSoftMaxSocclkByFreq, 1), | 96 | MSG_MAP(SetSoftMaxSocclkByFreq, PPSMC_MSG_SetSoftMaxSocclkByFreq, 1), |
| 93 | MSG_MAP(SetSoftMaxFclkByFreq, PPSMC_MSG_SetSoftMaxFclkByFreq, 1), | 97 | MSG_MAP(SetSoftMaxFclkByFreq, PPSMC_MSG_SetSoftMaxFclkByFreq, 1), |
| 94 | MSG_MAP(SetSoftMaxVcn, PPSMC_MSG_SetSoftMaxVcn, 1), | 98 | MSG_MAP(SetSoftMaxVcn0, PPSMC_MSG_SetSoftMaxVcn0, 1), |
| 95 | MSG_MAP(PowerDownJpeg, PPSMC_MSG_PowerDownJpeg, 1), | 99 | MSG_MAP(SetSoftMaxVcn1, PPSMC_MSG_SetSoftMaxVcn1, 1), |
| 96 | MSG_MAP(PowerUpJpeg, PPSMC_MSG_PowerUpJpeg, 1), | 100 | MSG_MAP(PowerDownJpeg0, PPSMC_MSG_PowerDownJpeg0, 1), |
| 101 | MSG_MAP(PowerUpJpeg0, PPSMC_MSG_PowerUpJpeg0, 1), | ||
| 102 | MSG_MAP(PowerDownJpeg1, PPSMC_MSG_PowerDownJpeg1, 1), | ||
| 103 | MSG_MAP(PowerUpJpeg1, PPSMC_MSG_PowerUpJpeg1, 1), | ||
| 97 | MSG_MAP(SetHardMinFclkByFreq, PPSMC_MSG_SetHardMinFclkByFreq, 1), | 104 | MSG_MAP(SetHardMinFclkByFreq, PPSMC_MSG_SetHardMinFclkByFreq, 1), |
| 98 | MSG_MAP(SetSoftMinSocclkByFreq, PPSMC_MSG_SetSoftMinSocclkByFreq, 1), | 105 | MSG_MAP(SetSoftMinSocclkByFreq, PPSMC_MSG_SetSoftMinSocclkByFreq, 1), |
| 99 | MSG_MAP(PowerDownIspByTile, PPSMC_MSG_PowerDownIspByTile, 1), | 106 | MSG_MAP(PowerDownIspByTile, PPSMC_MSG_PowerDownIspByTile, 1), |
| @@ -4111,6 +4111,13 @@ int drm_dp_bw_overhead(int lane_count, int hactive, · 4110 unmodified lines | |||
| 4111 | u32 overhead = 1000000; | 4111 | u32 overhead = 1000000; |
| 4112 | int symbol_cycles; | 4112 | int symbol_cycles; |
| 4113 | 4113 | ||
| 4114 | if (lane_count == 0 || hactive == 0 || bpp_x16 == 0) { | ||
| 4115 | DRM_DEBUG_KMS("Invalid BW overhead params: lane_count %d, hactive %d, bpp_x16 %d.%04d\n", | ||
| 4116 | lane_count, hactive, | ||
| 4117 | bpp_x16 >> 4, (bpp_x16 & 0xf) * 625); | ||
| 4118 | return 0; | ||
| 4119 | } | ||
| 4120 | |||
| 4114 | /* | 4121 | /* |
| 4115 | * DP Standard v2.1 2.6.4.1 | 4122 | * DP Standard v2.1 2.6.4.1 |
| 4116 | * SSC downspread and ref clock variation margin: | 4123 | * SSC downspread and ref clock variation margin: |
| @@ -33,9 +33,9 @@ endif · 32 unmodified lines | |||
| 33 | subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror | 33 | subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror |
| 34 | 34 | ||
| 35 | # Fine grained warnings disable | 35 | # Fine grained warnings disable |
| 36 | CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init) | 36 | CFLAGS_i915_pci.o = -Wno-override-init |
| 37 | CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init) | 37 | CFLAGS_display/intel_display_device.o = -Wno-override-init |
| 38 | CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init) | 38 | CFLAGS_display/intel_fbdev.o = -Wno-override-init |
| 39 | 39 | ||
| 40 | # Support compiling the display code separately for both i915 and xe | 40 | # Support compiling the display code separately for both i915 and xe |
| 41 | # drivers. Define I915 when building i915. | 41 | # drivers. Define I915 when building i915. |
| @@ -717,7 +717,6 @@ static void g4x_enable_dp(struct intel_atomic_state *state, · 716 unmodified lines | |||
| 717 | { | 717 | { |
| 718 | intel_enable_dp(state, encoder, pipe_config, conn_state); | 718 | intel_enable_dp(state, encoder, pipe_config, conn_state); |
| 719 | intel_edp_backlight_on(pipe_config, conn_state); | 719 | intel_edp_backlight_on(pipe_config, conn_state); |
| 720 | encoder->audio_enable(encoder, pipe_config, conn_state); | ||
| 721 | } | 720 | } |
| 722 | 721 | ||
| 723 | static void vlv_enable_dp(struct intel_atomic_state *state, | 722 | static void vlv_enable_dp(struct intel_atomic_state *state, |
| @@ -726,7 +725,6 @@ static void vlv_enable_dp(struct intel_atomic_state *state, · 2 unmodified lines | |||
| 726 | const struct drm_connector_state *conn_state) | 725 | const struct drm_connector_state *conn_state) |
| 727 | { | 726 | { |
| 728 | intel_edp_backlight_on(pipe_config, conn_state); | 727 | intel_edp_backlight_on(pipe_config, conn_state); |
| 729 | encoder->audio_enable(encoder, pipe_config, conn_state); | ||
| 730 | } | 728 | } |
| 731 | 729 | ||
| 732 | static void g4x_pre_enable_dp(struct intel_atomic_state *state, | 730 | static void g4x_pre_enable_dp(struct intel_atomic_state *state, |
| @@ -1155,7 +1155,6 @@ static void gen11_dsi_powerup_panel(struct intel_encoder *encoder) · 1154 unmodified lines | |||
| 1155 | } | 1155 | } |
| 1156 | 1156 | ||
| 1157 | intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_INIT_OTP); | 1157 | intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_INIT_OTP); |
| 1158 | intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DISPLAY_ON); | ||
| 1159 | 1158 | ||
| 1160 | /* ensure all panel commands dispatched before enabling transcoder */ | 1159 | /* ensure all panel commands dispatched before enabling transcoder */ |
| 1161 | wait_for_cmds_dispatched_to_panel(encoder); | 1160 | wait_for_cmds_dispatched_to_panel(encoder); |
| @@ -1256,6 +1255,8 @@ static void gen11_dsi_enable(struct intel_atomic_state *state, · 94 unmodified lines | |||
| 1256 | /* step6d: enable dsi transcoder */ | 1255 | /* step6d: enable dsi transcoder */ |
| 1257 | gen11_dsi_enable_transcoder(encoder); | 1256 | gen11_dsi_enable_transcoder(encoder); |
| 1258 | 1257 | ||
| 1258 | intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DISPLAY_ON); | ||
| 1259 | |||
| 1259 | /* step7: enable backlight */ | 1260 | /* step7: enable backlight */ |
| 1260 | intel_backlight_enable(crtc_state, conn_state); | 1261 | intel_backlight_enable(crtc_state, conn_state); |
| 1261 | intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_BACKLIGHT_ON); | 1262 | intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_BACKLIGHT_ON); |
| @@ -1955,16 +1955,12 @@ static int get_init_otp_deassert_fragment_len(struct drm_i915_private *i915, · 1954 unmodified lines | |||
| 1955 | * these devices we split the init OTP sequence into a deassert sequence and | 1955 | * these devices we split the init OTP sequence into a deassert sequence and |
| 1956 | * the actual init OTP part. | 1956 | * the actual init OTP part. |
| 1957 | */ | 1957 | */ |
| 1958 | static void fixup_mipi_sequences(struct drm_i915_private *i915, | 1958 | static void vlv_fixup_mipi_sequences(struct drm_i915_private *i915, |
| 1959 | struct intel_panel *panel) | 1959 | struct intel_panel *panel) |
| 1960 | { | 1960 | { |
| 1961 | u8 *init_otp; | 1961 | u8 *init_otp; |
| 1962 | int len; | 1962 | int len; |
| 1963 | 1963 | ||
| 1964 | /* Limit this to VLV for now. */ | ||
| 1965 | if (!IS_VALLEYVIEW(i915)) | ||
| 1966 | return; | ||
| 1967 | |||
| 1968 | /* Limit this to v1 vid-mode sequences */ | 1964 | /* Limit this to v1 vid-mode sequences */ |
| 1969 | if (panel->vbt.dsi.config->is_cmd_mode || | 1965 | if (panel->vbt.dsi.config->is_cmd_mode || |
| 1970 | panel->vbt.dsi.seq_version != 1) | 1966 | panel->vbt.dsi.seq_version != 1) |
| @@ -2000,6 +1996,41 @@ static void fixup_mipi_sequences(struct drm_i915_private *i915, · 29 unmodified lines | |||
| 2000 | panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] = init_otp + len - 1; | 1996 | panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] = init_otp + len - 1; |
| 2001 | } | 1997 | } |
| 2002 | 1998 | ||
| 1999 | /* | ||
| 2000 | * Some machines (eg. Lenovo 82TQ) appear to have broken | ||
| 2001 | * VBT sequences: | ||
| 2002 | * - INIT_OTP is not present at all | ||
| 2003 | * - what should be in INIT_OTP is in DISPLAY_ON | ||
| 2004 | * - what should be in DISPLAY_ON is in BACKLIGHT_ON | ||
| 2005 | * (along with the actual backlight stuff) | ||
| 2006 | * | ||
| 2007 | * To make those work we simply swap DISPLAY_ON and INIT_OTP. | ||
| 2008 | * | ||
| 2009 | * TODO: Do we need to limit this to specific machines, | ||
| 2010 | * or examine the contents of the sequences to | ||
| 2011 | * avoid false positives? | ||
| 2012 | */ | ||
| 2013 | static void icl_fixup_mipi_sequences(struct drm_i915_private *i915, | ||
| 2014 | struct intel_panel *panel) | ||
| 2015 | { | ||
| 2016 | if (!panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] && | ||
| 2017 | panel->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON]) { | ||
| 2018 | drm_dbg_kms(&i915->drm, "Broken VBT: Swapping INIT_OTP and DISPLAY_ON sequences\n"); | ||
| 2019 | |||
| 2020 | swap(panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP], | ||
| 2021 | panel->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON]); | ||
| 2022 | } | ||
| 2023 | } | ||
| 2024 | |||
| 2025 | static void fixup_mipi_sequences(struct drm_i915_private *i915, | ||
| 2026 | struct intel_panel *panel) | ||
| 2027 | { | ||
| 2028 | if (DISPLAY_VER(i915) >= 11) | ||
| 2029 | icl_fixup_mipi_sequences(i915, panel); | ||
| 2030 | else if (IS_VALLEYVIEW(i915)) | ||
| 2031 | vlv_fixup_mipi_sequences(i915, panel); | ||
| 2032 | } | ||
| 2033 | |||
| 2003 | static void | 2034 | static void |
| 2004 | parse_mipi_sequence(struct drm_i915_private *i915, | 2035 | parse_mipi_sequence(struct drm_i915_private *i915, |
| 2005 | struct intel_panel *panel) | 2036 | struct intel_panel *panel) |
| @@ -3351,6 +3382,9 @@ bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_da · 1345 unmodified lines | |||
| 3351 | { | 3382 | { |
| 3352 | const struct child_device_config *child = &devdata->child; | 3383 | const struct child_device_config *child = &devdata->child; |
| 3353 | 3384 | ||
| 3385 | if (!devdata) | ||
| 3386 | return false; | ||
| 3387 | |||
| 3354 | if (!intel_bios_encoder_supports_dp(devdata) || | 3388 | if (!intel_bios_encoder_supports_dp(devdata) || |
| 3355 | !intel_bios_encoder_supports_hdmi(devdata)) | 3389 | !intel_bios_encoder_supports_hdmi(devdata)) |
| 3356 | return false; | 3390 | return false; |
| @@ -36,12 +36,10 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state) · 35 unmodified lines | |||
| 36 | { | 36 | { |
| 37 | struct drm_i915_private *dev_priv = | 37 | struct drm_i915_private *dev_priv = |
| 38 | to_i915(plane_state->uapi.plane->dev); | 38 | to_i915(plane_state->uapi.plane->dev); |
| 39 | const struct drm_framebuffer *fb = plane_state->hw.fb; | ||
| 40 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | ||
| 41 | u32 base; | 39 | u32 base; |
| 42 | 40 | ||
| 43 | if (DISPLAY_INFO(dev_priv)->cursor_needs_physical) | 41 | if (DISPLAY_INFO(dev_priv)->cursor_needs_physical) |
| 44 | base = i915_gem_object_get_dma_address(obj, 0); | 42 | base = plane_state->phys_dma_addr; |
| 45 | else | 43 | else |
| 46 | base = intel_plane_ggtt_offset(plane_state); | 44 | base = intel_plane_ggtt_offset(plane_state); |
| 47 | 45 | ||
| @@ -727,6 +727,7 @@ struct intel_plane_state { · 726 unmodified lines | |||
| 727 | #define PLANE_HAS_FENCE BIT(0) | 727 | #define PLANE_HAS_FENCE BIT(0) |
| 728 | 728 | ||
| 729 | struct intel_fb_view view; | 729 | struct intel_fb_view view; |
| 730 | u32 phys_dma_addr; /* for cursor_needs_physical */ | ||
| 730 | 731 | ||
| 731 | /* Plane pxp decryption state */ | 732 | /* Plane pxp decryption state */ |
| 732 | bool decrypt; | 733 | bool decrypt; |
| @@ -67,6 +67,7 @@ · 66 unmodified lines | |||
| 67 | #include "intel_dp_tunnel.h" | 67 | #include "intel_dp_tunnel.h" |
| 68 | #include "intel_dpio_phy.h" | 68 | #include "intel_dpio_phy.h" |
| 69 | #include "intel_dpll.h" | 69 | #include "intel_dpll.h" |
| 70 | #include "intel_drrs.h" | ||
| 70 | #include "intel_fifo_underrun.h" | 71 | #include "intel_fifo_underrun.h" |
| 71 | #include "intel_hdcp.h" | 72 | #include "intel_hdcp.h" |
| 72 | #include "intel_hdmi.h" | 73 | #include "intel_hdmi.h" |
| @@ -2683,15 +2684,6 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp, · 2610 unmodified lines | |||
| 2683 | intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA); | 2684 | intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA); |
| 2684 | } | 2685 | } |
| 2685 | 2686 | ||
| 2686 | static bool cpu_transcoder_has_drrs(struct drm_i915_private *i915, | ||
| 2687 | enum transcoder cpu_transcoder) | ||
| 2688 | { | ||
| 2689 | if (HAS_DOUBLE_BUFFERED_M_N(i915)) | ||
| 2690 | return true; | ||
| 2691 | |||
| 2692 | return intel_cpu_transcoder_has_m2_n2(i915, cpu_transcoder); | ||
| 2693 | } | ||
| 2694 | |||
| 2695 | static bool can_enable_drrs(struct intel_connector *connector, | 2687 | static bool can_enable_drrs(struct intel_connector *connector, |
| 2696 | const struct intel_crtc_state *pipe_config, | 2688 | const struct intel_crtc_state *pipe_config, |
| 2697 | const struct drm_display_mode *downclock_mode) | 2689 | const struct drm_display_mode *downclock_mode) |
| @@ -2714,7 +2706,7 @@ static bool can_enable_drrs(struct intel_connector *connector, · 16 unmodified lines | |||
| 2714 | if (pipe_config->has_pch_encoder) | 2706 | if (pipe_config->has_pch_encoder) |
| 2715 | return false; | 2707 | return false; |
| 2716 | 2708 | ||
| 2717 | if (!cpu_transcoder_has_drrs(i915, pipe_config->cpu_transcoder)) | 2709 | if (!intel_cpu_transcoder_has_drrs(i915, pipe_config->cpu_transcoder)) |
| 2718 | return false; | 2710 | return false; |
| 2719 | 2711 | ||
| 2720 | return downclock_mode && | 2712 | return downclock_mode && |
| @@ -2554,7 +2554,7 @@ static void icl_wrpll_params_populate(struct skl_wrpll_params *params, · 2553 unmodified lines | |||
| 2554 | static bool | 2554 | static bool |
| 2555 | ehl_combo_pll_div_frac_wa_needed(struct drm_i915_private *i915) | 2555 | ehl_combo_pll_div_frac_wa_needed(struct drm_i915_private *i915) |
| 2556 | { | 2556 | { |
| 2557 | return (((IS_ELKHARTLAKE(i915) || IS_JASPERLAKE(i915)) && | 2557 | return ((IS_ELKHARTLAKE(i915) && |
| 2558 | IS_DISPLAY_STEP(i915, STEP_B0, STEP_FOREVER)) || | 2558 | IS_DISPLAY_STEP(i915, STEP_B0, STEP_FOREVER)) || |
| 2559 | IS_TIGERLAKE(i915) || IS_ALDERLAKE_S(i915) || IS_ALDERLAKE_P(i915)) && | 2559 | IS_TIGERLAKE(i915) || IS_ALDERLAKE_S(i915) || IS_ALDERLAKE_P(i915)) && |
| 2560 | i915->display.dpll.ref_clks.nssc == 38400; | 2560 | i915->display.dpll.ref_clks.nssc == 38400; |
| @@ -63,6 +63,15 @@ const char *intel_drrs_type_str(enum drrs_type drrs_type) · 62 unmodified lines | |||
| 63 | return str[drrs_type]; | 63 | return str[drrs_type]; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | bool intel_cpu_transcoder_has_drrs(struct drm_i915_private *i915, | ||
| 67 | enum transcoder cpu_transcoder) | ||
| 68 | { | ||
| 69 | if (HAS_DOUBLE_BUFFERED_M_N(i915)) | ||
| 70 | return true; | ||
| 71 | |||
| 72 | return intel_cpu_transcoder_has_m2_n2(i915, cpu_transcoder); | ||
| 73 | } | ||
| 74 | |||
| 66 | static void | 75 | static void |
| 67 | intel_drrs_set_refresh_rate_pipeconf(struct intel_crtc *crtc, | 76 | intel_drrs_set_refresh_rate_pipeconf(struct intel_crtc *crtc, |
| 68 | enum drrs_refresh_rate refresh_rate) | 77 | enum drrs_refresh_rate refresh_rate) |
| @@ -312,9 +321,8 @@ static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused) · 243 unmodified lines | |||
| 312 | mutex_lock(&crtc->drrs.mutex); | 321 | mutex_lock(&crtc->drrs.mutex); |
| 313 | 322 | ||
| 314 | seq_printf(m, "DRRS capable: %s\n", | 323 | seq_printf(m, "DRRS capable: %s\n", |
| 315 | str_yes_no(crtc_state->has_drrs || | 324 | str_yes_no(intel_cpu_transcoder_has_drrs(i915, |
| 316 | HAS_DOUBLE_BUFFERED_M_N(i915) || | 325 | crtc_state->cpu_transcoder))); |
| 317 | intel_cpu_transcoder_has_m2_n2(i915, crtc_state->cpu_transcoder))); | ||
| 318 | 326 | ||
| 319 | seq_printf(m, "DRRS enabled: %s\n", | 327 | seq_printf(m, "DRRS enabled: %s\n", |
| 320 | str_yes_no(crtc_state->has_drrs)); | 328 | str_yes_no(crtc_state->has_drrs)); |
| @@ -9,12 +9,15 @@ · 8 unmodified lines | |||
| 9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 10 | 10 | ||
| 11 | enum drrs_type; | 11 | enum drrs_type; |
| 12 | enum transcoder; | ||
| 12 | struct drm_i915_private; | 13 | struct drm_i915_private; |
| 13 | struct intel_atomic_state; | 14 | struct intel_atomic_state; |
| 14 | struct intel_crtc; | 15 | struct intel_crtc; |
| 15 | struct intel_crtc_state; | 16 | struct intel_crtc_state; |
| 16 | struct intel_connector; | 17 | struct intel_connector; |
| 17 | 18 | ||
| 19 | bool intel_cpu_transcoder_has_drrs(struct drm_i915_private *i915, | ||
| 20 | enum transcoder cpu_transcoder); | ||
| 18 | const char *intel_drrs_type_str(enum drrs_type drrs_type); | 21 | const char *intel_drrs_type_str(enum drrs_type drrs_type); |
| 19 | bool intel_drrs_is_active(struct intel_crtc *crtc); | 22 | bool intel_drrs_is_active(struct intel_crtc *crtc); |
| 20 | void intel_drrs_activate(const struct intel_crtc_state *crtc_state); | 23 | void intel_drrs_activate(const struct intel_crtc_state *crtc_state); |
| @@ -340,6 +340,17 @@ static int intel_dsb_dewake_scanline(const struct intel_crtc_state *crtc_state) · 339 unmodified lines | |||
| 340 | return max(0, vblank_start - intel_usecs_to_scanlines(adjusted_mode, latency)); | 340 | return max(0, vblank_start - intel_usecs_to_scanlines(adjusted_mode, latency)); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | static u32 dsb_chicken(struct intel_crtc *crtc) | ||
| 344 | { | ||
| 345 | if (crtc->mode_flags & I915_MODE_FLAG_VRR) | ||
| 346 | return DSB_CTRL_WAIT_SAFE_WINDOW | | ||
| 347 | DSB_CTRL_NO_WAIT_VBLANK | | ||
| 348 | DSB_INST_WAIT_SAFE_WINDOW | | ||
| 349 | DSB_INST_NO_WAIT_VBLANK; | ||
| 350 | else | ||
| 351 | return 0; | ||
| 352 | } | ||
| 353 | |||
| 343 | static void _intel_dsb_commit(struct intel_dsb *dsb, u32 ctrl, | 354 | static void _intel_dsb_commit(struct intel_dsb *dsb, u32 ctrl, |
| 344 | int dewake_scanline) | 355 | int dewake_scanline) |
| 345 | { | 356 | { |
| @@ -361,6 +372,9 @@ static void _intel_dsb_commit(struct intel_dsb *dsb, u32 ctrl, · 15 unmodified lines | |||
| 361 | intel_de_write_fw(dev_priv, DSB_CTRL(pipe, dsb->id), | 372 | intel_de_write_fw(dev_priv, DSB_CTRL(pipe, dsb->id), |
| 362 | ctrl | DSB_ENABLE); | 373 | ctrl | DSB_ENABLE); |
| 363 | 374 | ||
| 375 | intel_de_write_fw(dev_priv, DSB_CHICKEN(pipe, dsb->id), | ||
| 376 | dsb_chicken(crtc)); | ||
| 377 | |||
| 364 | intel_de_write_fw(dev_priv, DSB_HEAD(pipe, dsb->id), | 378 | intel_de_write_fw(dev_priv, DSB_HEAD(pipe, dsb->id), |
| 365 | intel_dsb_buffer_ggtt_offset(&dsb->dsb_buf)); | 379 | intel_dsb_buffer_ggtt_offset(&dsb->dsb_buf)); |
| 366 | 380 | ||
| @@ -255,6 +255,16 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state) · 254 unmodified lines | |||
| 255 | return PTR_ERR(vma); | 255 | return PTR_ERR(vma); |
| 256 | 256 | ||
| 257 | plane_state->ggtt_vma = vma; | 257 | plane_state->ggtt_vma = vma; |
| 258 | |||
| 259 | /* | ||
| 260 | * Pre-populate the dma address before we enter the vblank | ||
| 261 | * evade critical section as i915_gem_object_get_dma_address() | ||
| 262 | * will trigger might_sleep() even if it won't actually sleep, | ||
| 263 | * which is the case when the fb has already been pinned. | ||
| 264 | */ | ||
| 265 | if (phys_cursor) | ||
| 266 | plane_state->phys_dma_addr = | ||
| 267 | i915_gem_object_get_dma_address(intel_fb_obj(fb), 0); | ||
| 258 | } else { | 268 | } else { |
| 259 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); | 269 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); |
| 260 | 270 | ||
| @@ -1842,8 +1842,6 @@ static void intel_disable_sdvo(struct intel_atomic_state *state, · 1841 unmodified lines | |||
| 1842 | struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); | 1842 | struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); |
| 1843 | u32 temp; | 1843 | u32 temp; |
| 1844 | 1844 | ||
| 1845 | encoder->audio_disable(encoder, old_crtc_state, conn_state); | ||
| 1846 | |||
| 1847 | intel_sdvo_set_active_outputs(intel_sdvo, 0); | 1845 | intel_sdvo_set_active_outputs(intel_sdvo, 0); |
| 1848 | if (0) | 1846 | if (0) |
| 1849 | intel_sdvo_set_encoder_power_state(intel_sdvo, | 1847 | intel_sdvo_set_encoder_power_state(intel_sdvo, |
| @@ -1935,8 +1933,6 @@ static void intel_enable_sdvo(struct intel_atomic_state *state, · 85 unmodified lines | |||
| 1935 | intel_sdvo_set_encoder_power_state(intel_sdvo, | 1933 | intel_sdvo_set_encoder_power_state(intel_sdvo, |
| 1936 | DRM_MODE_DPMS_ON); | 1934 | DRM_MODE_DPMS_ON); |
| 1937 | intel_sdvo_set_active_outputs(intel_sdvo, intel_sdvo_connector->output_flag); | 1935 | intel_sdvo_set_active_outputs(intel_sdvo, intel_sdvo_connector->output_flag); |
| 1938 | |||
| 1939 | encoder->audio_enable(encoder, pipe_config, conn_state); | ||
| 1940 | } | 1936 | } |
| 1941 | 1937 | ||
| 1942 | static enum drm_mode_status | 1938 | static enum drm_mode_status |
| @@ -187,10 +187,11 @@ void intel_vrr_set_transcoder_timings(const struct intel_crtc_state *crtc_state) · 186 unmodified lines | |||
| 187 | enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; | 187 | enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; |
| 188 | 188 | ||
| 189 | /* | 189 | /* |
| 190 | * TRANS_SET_CONTEXT_LATENCY with VRR enabled | 190 | * This bit seems to have two meanings depending on the platform: |
| 191 | * requires this chicken bit on ADL/DG2. | 191 | * TGL: generate VRR "safe window" for DSB vblank waits |
| 192 | * ADL/DG2: make TRANS_SET_CONTEXT_LATENCY effective with VRR | ||
| 192 | */ | 193 | */ |
| 193 | if (DISPLAY_VER(dev_priv) == 13) | 194 | if (IS_DISPLAY_VER(dev_priv, 12, 13)) |
| 194 | intel_de_rmw(dev_priv, CHICKEN_TRANS(cpu_transcoder), | 195 | intel_de_rmw(dev_priv, CHICKEN_TRANS(cpu_transcoder), |
| 195 | 0, PIPE_VBLANK_WITH_DELAY); | 196 | 0, PIPE_VBLANK_WITH_DELAY); |
| 196 | 197 | ||
| @@ -2295,6 +2295,9 @@ static u8 skl_get_plane_caps(struct drm_i915_private *i915, · 2294 unmodified lines | |||
| 2295 | if (HAS_4TILE(i915)) | 2295 | if (HAS_4TILE(i915)) |
| 2296 | caps |= INTEL_PLANE_CAP_TILING_4; | 2296 | caps |= INTEL_PLANE_CAP_TILING_4; |
| 2297 | 2297 | ||
| 2298 | if (!IS_ENABLED(I915) && !HAS_FLAT_CCS(i915)) | ||
| 2299 | return caps; | ||
| 2300 | |||
| 2298 | if (skl_plane_has_rc_ccs(i915, pipe, plane_id)) { | 2301 | if (skl_plane_has_rc_ccs(i915, pipe, plane_id)) { |
| 2299 | caps |= INTEL_PLANE_CAP_CCS_RC; | 2302 | caps |= INTEL_PLANE_CAP_CCS_RC; |
| 2300 | if (DISPLAY_VER(i915) >= 12) | 2303 | if (DISPLAY_VER(i915) >= 12) |
| @@ -279,9 +279,6 @@ static int __engine_park(struct intel_wakeref *wf) · 278 unmodified lines | |||
| 279 | intel_engine_park_heartbeat(engine); | 279 | intel_engine_park_heartbeat(engine); |
| 280 | intel_breadcrumbs_park(engine->breadcrumbs); | 280 | intel_breadcrumbs_park(engine->breadcrumbs); |
| 281 | 281 | ||
| 282 | /* Must be reset upon idling, or we may miss the busy wakeup. */ | ||
| 283 | GEM_BUG_ON(engine->sched_engine->queue_priority_hint != INT_MIN); | ||
| 284 | |||
| 285 | if (engine->park) | 282 | if (engine->park) |
| 286 | engine->park(engine); | 283 | engine->park(engine); |
| 287 | 284 | ||
| @@ -3272,6 +3272,9 @@ static void execlists_park(struct intel_engine_cs *engine) · 3271 unmodified lines | |||
| 3272 | { | 3272 | { |
| 3273 | cancel_timer(&engine->execlists.timer); | 3273 | cancel_timer(&engine->execlists.timer); |
| 3274 | cancel_timer(&engine->execlists.preempt); | 3274 | cancel_timer(&engine->execlists.preempt); |
| 3275 | |||
| 3276 | /* Reset upon idling, or we may delay the busy wakeup. */ | ||
| 3277 | WRITE_ONCE(engine->sched_engine->queue_priority_hint, INT_MIN); | ||
| 3275 | } | 3278 | } |
| 3276 | 3279 | ||
| 3277 | static void add_to_engine(struct i915_request *rq) | 3280 | static void add_to_engine(struct i915_request *rq) |
| @@ -1653,6 +1653,7 @@ static void · 1652 unmodified lines | |||
| 1653 | xelpg_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal) | 1653 | xelpg_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal) |
| 1654 | { | 1654 | { |
| 1655 | /* Wa_14018575942 / Wa_18018781329 */ | 1655 | /* Wa_14018575942 / Wa_18018781329 */ |
| 1656 | wa_mcr_write_or(wal, RENDER_MOD_CTRL, FORCE_MISS_FTLB); | ||
| 1656 | wa_mcr_write_or(wal, COMP_MOD_CTRL, FORCE_MISS_FTLB); | 1657 | wa_mcr_write_or(wal, COMP_MOD_CTRL, FORCE_MISS_FTLB); |
| 1657 | 1658 | ||
| 1658 | /* Wa_22016670082 */ | 1659 | /* Wa_22016670082 */ |
| @@ -800,7 +800,7 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 799 unmodified lines | |||
| 800 | goto out_cleanup_modeset2; | 800 | goto out_cleanup_modeset2; |
| 801 | 801 | ||
| 802 | ret = intel_pxp_init(i915); | 802 | ret = intel_pxp_init(i915); |
| 803 | if (ret != -ENODEV) | 803 | if (ret && ret != -ENODEV) |
| 804 | drm_dbg(&i915->drm, "pxp init failed with %d\n", ret); | 804 | drm_dbg(&i915->drm, "pxp init failed with %d\n", ret); |
| 805 | 805 | ||
| 806 | ret = intel_display_driver_probe(i915); | 806 | ret = intel_display_driver_probe(i915); |
| @@ -72,12 +72,13 @@ hwm_locked_with_pm_intel_uncore_rmw(struct hwm_drvdata *ddat, · 71 unmodified lines | |||
| 72 | struct intel_uncore *uncore = ddat->uncore; | 72 | struct intel_uncore *uncore = ddat->uncore; |
| 73 | intel_wakeref_t wakeref; | 73 | intel_wakeref_t wakeref; |
| 74 | 74 | ||
| 75 | mutex_lock(&hwmon->hwmon_lock); | 75 | with_intel_runtime_pm(uncore->rpm, wakeref) { |
| 76 | mutex_lock(&hwmon->hwmon_lock); | ||
| 76 | 77 | ||
| 77 | with_intel_runtime_pm(uncore->rpm, wakeref) | ||
| 78 | intel_uncore_rmw(uncore, reg, clear, set); | 78 | intel_uncore_rmw(uncore, reg, clear, set); |
| 79 | 79 | ||
| 80 | mutex_unlock(&hwmon->hwmon_lock); | 80 | mutex_unlock(&hwmon->hwmon_lock); |
| 81 | } | ||
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | /* | 84 | /* |
| @@ -136,20 +137,21 @@ hwm_energy(struct hwm_drvdata *ddat, long *energy) · 52 unmodified lines | |||
| 136 | else | 137 | else |
| 137 | rgaddr = hwmon->rg.energy_status_all; | 138 | rgaddr = hwmon->rg.energy_status_all; |
| 138 | 139 | ||
| 139 | mutex_lock(&hwmon->hwmon_lock); | 140 | with_intel_runtime_pm(uncore->rpm, wakeref) { |
| 141 | mutex_lock(&hwmon->hwmon_lock); | ||
| 140 | 142 | ||
| 141 | with_intel_runtime_pm(uncore->rpm, wakeref) | ||
| 142 | reg_val = intel_uncore_read(uncore, rgaddr); | 143 | reg_val = intel_uncore_read(uncore, rgaddr); |
| 143 | 144 | ||
| 144 | if (reg_val >= ei->reg_val_prev) | 145 | if (reg_val >= ei->reg_val_prev) |
| 145 | ei->accum_energy += reg_val - ei->reg_val_prev; | 146 | ei->accum_energy += reg_val - ei->reg_val_prev; |
| 146 | else | 147 | else |
| 147 | ei->accum_energy += UINT_MAX - ei->reg_val_prev + reg_val; | 148 | ei->accum_energy += UINT_MAX - ei->reg_val_prev + reg_val; |
| 148 | ei->reg_val_prev = reg_val; | 149 | ei->reg_val_prev = reg_val; |
| 149 | 150 | ||
| 150 | *energy = mul_u64_u32_shr(ei->accum_energy, SF_ENERGY, | 151 | *energy = mul_u64_u32_shr(ei->accum_energy, SF_ENERGY, |
| 151 | hwmon->scl_shift_energy); | 152 | hwmon->scl_shift_energy); |
| 152 | mutex_unlock(&hwmon->hwmon_lock); | 153 | mutex_unlock(&hwmon->hwmon_lock); |
| 154 | } | ||
| 153 | } | 155 | } |
| 154 | 156 | ||
| 155 | static ssize_t | 157 | static ssize_t |
| @@ -404,6 +406,7 @@ hwm_power_max_write(struct hwm_drvdata *ddat, long val) · 248 unmodified lines | |||
| 404 | 406 | ||
| 405 | /* Block waiting for GuC reset to complete when needed */ | 407 | /* Block waiting for GuC reset to complete when needed */ |
| 406 | for (;;) { | 408 | for (;;) { |
| 409 | wakeref = intel_runtime_pm_get(ddat->uncore->rpm); | ||
| 407 | mutex_lock(&hwmon->hwmon_lock); | 410 | mutex_lock(&hwmon->hwmon_lock); |
| 408 | 411 | ||
| 409 | prepare_to_wait(&ddat->waitq, &wait, TASK_INTERRUPTIBLE); | 412 | prepare_to_wait(&ddat->waitq, &wait, TASK_INTERRUPTIBLE); |
| @@ -417,14 +420,13 @@ hwm_power_max_write(struct hwm_drvdata *ddat, long val) · 7 unmodified lines | |||
| 417 | } | 420 | } |
| 418 | 421 | ||
| 419 | mutex_unlock(&hwmon->hwmon_lock); | 422 | mutex_unlock(&hwmon->hwmon_lock); |
| 423 | intel_runtime_pm_put(ddat->uncore->rpm, wakeref); | ||
| 420 | 424 | ||
| 421 | schedule(); | 425 | schedule(); |
| 422 | } | 426 | } |
| 423 | finish_wait(&ddat->waitq, &wait); | 427 | finish_wait(&ddat->waitq, &wait); |
| 424 | if (ret) | 428 | if (ret) |
| 425 | goto unlock; | 429 | goto exit; |
| 426 | |||
| 427 | wakeref = intel_runtime_pm_get(ddat->uncore->rpm); | ||
| 428 | 430 | ||
| 429 | /* Disable PL1 limit and verify, because the limit cannot be disabled on all platforms */ | 431 | /* Disable PL1 limit and verify, because the limit cannot be disabled on all platforms */ |
| 430 | if (val == PL1_DISABLE) { | 432 | if (val == PL1_DISABLE) { |
| @@ -444,9 +446,8 @@ hwm_power_max_write(struct hwm_drvdata *ddat, long val) · 13 unmodified lines | |||
| 444 | intel_uncore_rmw(ddat->uncore, hwmon->rg.pkg_rapl_limit, | 446 | intel_uncore_rmw(ddat->uncore, hwmon->rg.pkg_rapl_limit, |
| 445 | PKG_PWR_LIM_1_EN | PKG_PWR_LIM_1, nval); | 447 | PKG_PWR_LIM_1_EN | PKG_PWR_LIM_1, nval); |
| 446 | exit: | 448 | exit: |
| 447 | intel_runtime_pm_put(ddat->uncore->rpm, wakeref); | ||
| 448 | unlock: | ||
| 449 | mutex_unlock(&hwmon->hwmon_lock); | 449 | mutex_unlock(&hwmon->hwmon_lock); |
| 450 | intel_runtime_pm_put(ddat->uncore->rpm, wakeref); | ||
| 450 | return ret; | 451 | return ret; |
| 451 | } | 452 | } |
| 452 | 453 | ||
| @@ -25,6 +25,8 @@ · 24 unmodified lines | |||
| 25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| 26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 27 | #include <linux/cpufeature.h> | 27 | #include <linux/cpufeature.h> |
| 28 | #include <linux/bug.h> | ||
| 29 | #include <linux/build_bug.h> | ||
| 28 | #include <asm/fpu/api.h> | 30 | #include <asm/fpu/api.h> |
| 29 | 31 | ||
| 30 | #include "i915_memcpy.h" | 32 | #include "i915_memcpy.h" |
| @@ -4599,7 +4599,7 @@ · 4598 unmodified lines | |||
| 4599 | #define MTL_CHICKEN_TRANS(trans) _MMIO_TRANS((trans), \ | 4599 | #define MTL_CHICKEN_TRANS(trans) _MMIO_TRANS((trans), \ |
| 4600 | _MTL_CHICKEN_TRANS_A, \ | 4600 | _MTL_CHICKEN_TRANS_A, \ |
| 4601 | _MTL_CHICKEN_TRANS_B) | 4601 | _MTL_CHICKEN_TRANS_B) |
| 4602 | #define PIPE_VBLANK_WITH_DELAY REG_BIT(31) /* ADL/DG2 */ | 4602 | #define PIPE_VBLANK_WITH_DELAY REG_BIT(31) /* tgl+ */ |
| 4603 | #define SKL_UNMASK_VBL_TO_PIPE_IN_SRD REG_BIT(30) /* skl+ */ | 4603 | #define SKL_UNMASK_VBL_TO_PIPE_IN_SRD REG_BIT(30) /* skl+ */ |
| 4604 | #define HSW_FRAME_START_DELAY_MASK REG_GENMASK(28, 27) | 4604 | #define HSW_FRAME_START_DELAY_MASK REG_GENMASK(28, 27) |
| 4605 | #define HSW_FRAME_START_DELAY(x) REG_FIELD_PREP(HSW_FRAME_START_DELAY_MASK, x) | 4605 | #define HSW_FRAME_START_DELAY(x) REG_FIELD_PREP(HSW_FRAME_START_DELAY_MASK, x) |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | #include "gt/intel_engine.h" | 34 | #include "gt/intel_engine.h" |
| 35 | #include "gt/intel_engine_heartbeat.h" | 35 | #include "gt/intel_engine_heartbeat.h" |
| 36 | #include "gt/intel_gt.h" | 36 | #include "gt/intel_gt.h" |
| 37 | #include "gt/intel_gt_pm.h" | ||
| 37 | #include "gt/intel_gt_requests.h" | 38 | #include "gt/intel_gt_requests.h" |
| 38 | #include "gt/intel_tlb.h" | 39 | #include "gt/intel_tlb.h" |
| 39 | 40 | ||
| @@ -103,12 +104,42 @@ static inline struct i915_vma *active_to_vma(struct i915_active *ref) · 63 unmodified lines | |||
| 103 | 104 | ||
| 104 | static int __i915_vma_active(struct i915_active *ref) | 105 | static int __i915_vma_active(struct i915_active *ref) |
| 105 | { | 106 | { |
| 106 | return i915_vma_tryget(active_to_vma(ref)) ? 0 : -ENOENT; | 107 | struct i915_vma *vma = active_to_vma(ref); |
| 108 | |||
| 109 | if (!i915_vma_tryget(vma)) | ||
| 110 | return -ENOENT; | ||
| 111 | |||
| 112 | /* | ||
| 113 | * Exclude global GTT VMA from holding a GT wakeref | ||
| 114 | * while active, otherwise GPU never goes idle. | ||
| 115 | */ | ||
| 116 | if (!i915_vma_is_ggtt(vma)) { | ||
| 117 | /* | ||
| 118 | * Since we and our _retire() counterpart can be | ||
| 119 | * called asynchronously, storing a wakeref tracking | ||
| 120 | * handle inside struct i915_vma is not safe, and | ||
| 121 | * there is no other good place for that. Hence, | ||
| 122 | * use untracked variants of intel_gt_pm_get/put(). | ||
| 123 | */ | ||
| 124 | intel_gt_pm_get_untracked(vma->vm->gt); | ||
| 125 | } | ||
| 126 | |||
| 127 | return 0; | ||
| 107 | } | 128 | } |
| 108 | 129 | ||
| 109 | static void __i915_vma_retire(struct i915_active *ref) | 130 | static void __i915_vma_retire(struct i915_active *ref) |
| 110 | { | 131 | { |
| 111 | i915_vma_put(active_to_vma(ref)); | 132 | struct i915_vma *vma = active_to_vma(ref); |
| 133 | |||
| 134 | if (!i915_vma_is_ggtt(vma)) { | ||
| 135 | /* | ||
| 136 | * Since we can be called from atomic contexts, | ||
| 137 | * use an async variant of intel_gt_pm_put(). | ||
| 138 | */ | ||
| 139 | intel_gt_pm_put_async_untracked(vma->vm->gt); | ||
| 140 | } | ||
| 141 | |||
| 142 | i915_vma_put(vma); | ||
| 112 | } | 143 | } |
| 113 | 144 | ||
| 114 | static struct i915_vma * | 145 | static struct i915_vma * |
| @@ -1404,7 +1435,7 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww, · 1289 unmodified lines | |||
| 1404 | struct i915_vma_work *work = NULL; | 1435 | struct i915_vma_work *work = NULL; |
| 1405 | struct dma_fence *moving = NULL; | 1436 | struct dma_fence *moving = NULL; |
| 1406 | struct i915_vma_resource *vma_res = NULL; | 1437 | struct i915_vma_resource *vma_res = NULL; |
| 1407 | intel_wakeref_t wakeref = 0; | 1438 | intel_wakeref_t wakeref; |
| 1408 | unsigned int bound; | 1439 | unsigned int bound; |
| 1409 | int err; | 1440 | int err; |
| 1410 | 1441 | ||
| @@ -1424,8 +1455,14 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww, · 13 unmodified lines | |||
| 1424 | if (err) | 1455 | if (err) |
| 1425 | return err; | 1456 | return err; |
| 1426 | 1457 | ||
| 1427 | if (flags & PIN_GLOBAL) | 1458 | /* |
| 1428 | wakeref = intel_runtime_pm_get(&vma->vm->i915->runtime_pm); | 1459 | * In case of a global GTT, we must hold a runtime-pm wakeref |
| 1460 | * while global PTEs are updated. In other cases, we hold | ||
| 1461 | * the rpm reference while the VMA is active. Since runtime | ||
| 1462 | * resume may require allocations, which are forbidden inside | ||
| 1463 | * vm->mutex, get the first rpm wakeref outside of the mutex. | ||
| 1464 | */ | ||
| 1465 | wakeref = intel_runtime_pm_get(&vma->vm->i915->runtime_pm); | ||
| 1429 | 1466 | ||
| 1430 | if (flags & vma->vm->bind_async_flags) { | 1467 | if (flags & vma->vm->bind_async_flags) { |
| 1431 | /* lock VM */ | 1468 | /* lock VM */ |
| @@ -1561,8 +1598,7 @@ err_fence: · 129 unmodified lines | |||
| 1561 | if (work) | 1598 | if (work) |
| 1562 | dma_fence_work_commit_imm(&work->base); | 1599 | dma_fence_work_commit_imm(&work->base); |
| 1563 | err_rpm: | 1600 | err_rpm: |
| 1564 | if (wakeref) | 1601 | intel_runtime_pm_put(&vma->vm->i915->runtime_pm, wakeref); |
| 1565 | intel_runtime_pm_put(&vma->vm->i915->runtime_pm, wakeref); | ||
| 1566 | 1602 | ||
| 1567 | if (moving) | 1603 | if (moving) |
| 1568 | dma_fence_put(moving); | 1604 | dma_fence_put(moving); |
| @@ -378,9 +378,9 @@ nouveau_dmem_evict_chunk(struct nouveau_dmem_chunk *chunk) · 377 unmodified lines | |||
| 378 | dma_addr_t *dma_addrs; | 378 | dma_addr_t *dma_addrs; |
| 379 | struct nouveau_fence *fence; | 379 | struct nouveau_fence *fence; |
| 380 | 380 | ||
| 381 | src_pfns = kcalloc(npages, sizeof(*src_pfns), GFP_KERNEL); | 381 | src_pfns = kvcalloc(npages, sizeof(*src_pfns), GFP_KERNEL | __GFP_NOFAIL); |
| 382 | dst_pfns = kcalloc(npages, sizeof(*dst_pfns), GFP_KERNEL); | 382 | dst_pfns = kvcalloc(npages, sizeof(*dst_pfns), GFP_KERNEL | __GFP_NOFAIL); |
| 383 | dma_addrs = kcalloc(npages, sizeof(*dma_addrs), GFP_KERNEL); | 383 | dma_addrs = kvcalloc(npages, sizeof(*dma_addrs), GFP_KERNEL | __GFP_NOFAIL); |
| 384 | 384 | ||
| 385 | migrate_device_range(src_pfns, chunk->pagemap.range.start >> PAGE_SHIFT, | 385 | migrate_device_range(src_pfns, chunk->pagemap.range.start >> PAGE_SHIFT, |
| 386 | npages); | 386 | npages); |
| @@ -406,11 +406,11 @@ nouveau_dmem_evict_chunk(struct nouveau_dmem_chunk *chunk) · 19 unmodified lines | |||
| 406 | migrate_device_pages(src_pfns, dst_pfns, npages); | 406 | migrate_device_pages(src_pfns, dst_pfns, npages); |
| 407 | nouveau_dmem_fence_done(&fence); | 407 | nouveau_dmem_fence_done(&fence); |
| 408 | migrate_device_finalize(src_pfns, dst_pfns, npages); | 408 | migrate_device_finalize(src_pfns, dst_pfns, npages); |
| 409 | kfree(src_pfns); | 409 | kvfree(src_pfns); |
| 410 | kfree(dst_pfns); | 410 | kvfree(dst_pfns); |
| 411 | for (i = 0; i < npages; i++) | 411 | for (i = 0; i < npages; i++) |
| 412 | dma_unmap_page(chunk->drm->dev->dev, dma_addrs[i], PAGE_SIZE, DMA_BIDIRECTIONAL); | 412 | dma_unmap_page(chunk->drm->dev->dev, dma_addrs[i], PAGE_SIZE, DMA_BIDIRECTIONAL); |
| 413 | kfree(dma_addrs); | 413 | kvfree(dma_addrs); |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | void | 416 | void |
| @@ -421,7 +421,6 @@ int qxl_surface_id_alloc(struct qxl_device *qdev, · 420 unmodified lines | |||
| 421 | { | 421 | { |
| 422 | uint32_t handle; | 422 | uint32_t handle; |
| 423 | int idr_ret; | 423 | int idr_ret; |
| 424 | int count = 0; | ||
| 425 | again: | 424 | again: |
| 426 | idr_preload(GFP_ATOMIC); | 425 | idr_preload(GFP_ATOMIC); |
| 427 | spin_lock(&qdev->surf_id_idr_lock); | 426 | spin_lock(&qdev->surf_id_idr_lock); |
| @@ -433,7 +432,6 @@ again: · 5 unmodified lines | |||
| 433 | handle = idr_ret; | 432 | handle = idr_ret; |
| 434 | 433 | ||
| 435 | if (handle >= qdev->rom->n_surfaces) { | 434 | if (handle >= qdev->rom->n_surfaces) { |
| 436 | count++; | ||
| 437 | spin_lock(&qdev->surf_id_idr_lock); | 435 | spin_lock(&qdev->surf_id_idr_lock); |
| 438 | idr_remove(&qdev->surf_id_idr, handle); | 436 | idr_remove(&qdev->surf_id_idr, handle); |
| 439 | spin_unlock(&qdev->surf_id_idr_lock); | 437 | spin_unlock(&qdev->surf_id_idr_lock); |
| @@ -145,7 +145,7 @@ static int qxl_process_single_command(struct qxl_device *qdev, · 144 unmodified lines | |||
| 145 | struct qxl_release *release; | 145 | struct qxl_release *release; |
| 146 | struct qxl_bo *cmd_bo; | 146 | struct qxl_bo *cmd_bo; |
| 147 | void *fb_cmd; | 147 | void *fb_cmd; |
| 148 | int i, ret, num_relocs; | 148 | int i, ret; |
| 149 | int unwritten; | 149 | int unwritten; |
| 150 | 150 | ||
| 151 | switch (cmd->type) { | 151 | switch (cmd->type) { |
| @@ -200,7 +200,6 @@ static int qxl_process_single_command(struct qxl_device *qdev, · 48 unmodified lines | |||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | /* fill out reloc info structs */ | 202 | /* fill out reloc info structs */ |
| 203 | num_relocs = 0; | ||
| 204 | for (i = 0; i < cmd->relocs_num; ++i) { | 203 | for (i = 0; i < cmd->relocs_num; ++i) { |
| 205 | struct drm_qxl_reloc reloc; | 204 | struct drm_qxl_reloc reloc; |
| 206 | struct drm_qxl_reloc __user *u = u64_to_user_ptr(cmd->relocs); | 205 | struct drm_qxl_reloc __user *u = u64_to_user_ptr(cmd->relocs); |
| @@ -230,7 +229,6 @@ static int qxl_process_single_command(struct qxl_device *qdev, · 23 unmodified lines | |||
| 230 | reloc_info[i].dst_bo = cmd_bo; | 229 | reloc_info[i].dst_bo = cmd_bo; |
| 231 | reloc_info[i].dst_offset = reloc.dst_offset + release->release_offset; | 230 | reloc_info[i].dst_offset = reloc.dst_offset + release->release_offset; |
| 232 | } | 231 | } |
| 233 | num_relocs++; | ||
| 234 | 232 | ||
| 235 | /* reserve and validate the reloc dst bo */ | 233 | /* reserve and validate the reloc dst bo */ |
| 236 | if (reloc.reloc_type == QXL_RELOC_TYPE_BO || reloc.src_handle) { | 234 | if (reloc.reloc_type == QXL_RELOC_TYPE_BO || reloc.src_handle) { |
| @@ -17,9 +17,7 @@ · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | static const uint32_t formats_cluster[] = { | 18 | static const uint32_t formats_cluster[] = { |
| 19 | DRM_FORMAT_XRGB2101010, | 19 | DRM_FORMAT_XRGB2101010, |
| 20 | DRM_FORMAT_ARGB2101010, | ||
| 21 | DRM_FORMAT_XBGR2101010, | 20 | DRM_FORMAT_XBGR2101010, |
| 22 | DRM_FORMAT_ABGR2101010, | ||
| 23 | DRM_FORMAT_XRGB8888, | 21 | DRM_FORMAT_XRGB8888, |
| 24 | DRM_FORMAT_ARGB8888, | 22 | DRM_FORMAT_ARGB8888, |
| 25 | DRM_FORMAT_XBGR8888, | 23 | DRM_FORMAT_XBGR8888, |
| @@ -71,13 +71,19 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, · 70 unmodified lines | |||
| 71 | entity->guilty = guilty; | 71 | entity->guilty = guilty; |
| 72 | entity->num_sched_list = num_sched_list; | 72 | entity->num_sched_list = num_sched_list; |
| 73 | entity->priority = priority; | 73 | entity->priority = priority; |
| 74 | /* | ||
| 75 | * It's perfectly valid to initialize an entity without having a valid | ||
| 76 | * scheduler attached. It's just not valid to use the scheduler before it | ||
| 77 | * is initialized itself. | ||
| 78 | */ | ||
| 74 | entity->sched_list = num_sched_list > 1 ? sched_list : NULL; | 79 | entity->sched_list = num_sched_list > 1 ? sched_list : NULL; |
| 75 | RCU_INIT_POINTER(entity->last_scheduled, NULL); | 80 | RCU_INIT_POINTER(entity->last_scheduled, NULL); |
| 76 | RB_CLEAR_NODE(&entity->rb_tree_node); | 81 | RB_CLEAR_NODE(&entity->rb_tree_node); |
| 77 | 82 | ||
| 78 | if (!sched_list[0]->sched_rq) { | 83 | if (num_sched_list && !sched_list[0]->sched_rq) { |
| 79 | /* Warn drivers not to do this and to fix their DRM | 84 | /* Since every entry covered by num_sched_list |
| 80 | * calling order. | 85 | * should be non-NULL and therefore we warn drivers |
| 86 | * not to do this and to fix their DRM calling order. | ||
| 81 | */ | 87 | */ |
| 82 | pr_warn("%s: called with uninitialized scheduler\n", __func__); | 88 | pr_warn("%s: called with uninitialized scheduler\n", __func__); |
| 83 | } else if (num_sched_list) { | 89 | } else if (num_sched_list) { |
| @@ -1444,12 +1444,15 @@ static void vmw_debugfs_resource_managers_init(struct vmw_private *vmw) · 1443 unmodified lines | |||
| 1444 | root, "system_ttm"); | 1444 | root, "system_ttm"); |
| 1445 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, TTM_PL_VRAM), | 1445 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, TTM_PL_VRAM), |
| 1446 | root, "vram_ttm"); | 1446 | root, "vram_ttm"); |
| 1447 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, VMW_PL_GMR), | 1447 | if (vmw->has_gmr) |
| 1448 | root, "gmr_ttm"); | 1448 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, VMW_PL_GMR), |
| 1449 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, VMW_PL_MOB), | 1449 | root, "gmr_ttm"); |
| 1450 | root, "mob_ttm"); | 1450 | if (vmw->has_mob) { |
| 1451 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, VMW_PL_SYSTEM), | 1451 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, VMW_PL_MOB), |
| 1452 | root, "system_mob_ttm"); | 1452 | root, "mob_ttm"); |
| 1453 | ttm_resource_manager_create_debugfs(ttm_manager_type(&vmw->bdev, VMW_PL_SYSTEM), | ||
| 1454 | root, "system_mob_ttm"); | ||
| 1455 | } | ||
| 1453 | } | 1456 | } |
| 1454 | 1457 | ||
| 1455 | static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, | 1458 | static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, |
| @@ -172,8 +172,8 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \ · 171 unmodified lines | |||
| 172 | -Ddrm_i915_gem_object=xe_bo \ | 172 | -Ddrm_i915_gem_object=xe_bo \ |
| 173 | -Ddrm_i915_private=xe_device | 173 | -Ddrm_i915_private=xe_device |
| 174 | 174 | ||
| 175 | CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init) | 175 | CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init |
| 176 | CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init) | 176 | CFLAGS_i915-display/intel_display_device.o = -Wno-override-init |
| 177 | 177 | ||
| 178 | # Rule to build SOC code shared with i915 | 178 | # Rule to build SOC code shared with i915 |
| 179 | $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE | 179 | $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE |
| @@ -144,9 +144,6 @@ static void try_add_system(struct xe_device *xe, struct xe_bo *bo, · 143 unmodified lines | |||
| 144 | .mem_type = XE_PL_TT, | 144 | .mem_type = XE_PL_TT, |
| 145 | }; | 145 | }; |
| 146 | *c += 1; | 146 | *c += 1; |
| 147 | |||
| 148 | if (bo->props.preferred_mem_type == XE_BO_PROPS_INVALID) | ||
| 149 | bo->props.preferred_mem_type = XE_PL_TT; | ||
| 150 | } | 147 | } |
| 151 | } | 148 | } |
| 152 | 149 | ||
| @@ -181,25 +178,15 @@ static void add_vram(struct xe_device *xe, struct xe_bo *bo, · 28 unmodified lines | |||
| 181 | } | 178 | } |
| 182 | places[*c] = place; | 179 | places[*c] = place; |
| 183 | *c += 1; | 180 | *c += 1; |
| 184 | |||
| 185 | if (bo->props.preferred_mem_type == XE_BO_PROPS_INVALID) | ||
| 186 | bo->props.preferred_mem_type = mem_type; | ||
| 187 | } | 181 | } |
| 188 | 182 | ||
| 189 | static void try_add_vram(struct xe_device *xe, struct xe_bo *bo, | 183 | static void try_add_vram(struct xe_device *xe, struct xe_bo *bo, |
| 190 | u32 bo_flags, u32 *c) | 184 | u32 bo_flags, u32 *c) |
| 191 | { | 185 | { |
| 192 | if (bo->props.preferred_gt == XE_GT1) { | 186 | if (bo_flags & XE_BO_CREATE_VRAM0_BIT) |
| 193 | if (bo_flags & XE_BO_CREATE_VRAM1_BIT) | 187 | add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM0, c); |
| 194 | add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM1, c); | 188 | if (bo_flags & XE_BO_CREATE_VRAM1_BIT) |
| 195 | if (bo_flags & XE_BO_CREATE_VRAM0_BIT) | 189 | add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM1, c); |
| 196 | add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM0, c); | ||
| 197 | } else { | ||
| 198 | if (bo_flags & XE_BO_CREATE_VRAM0_BIT) | ||
| 199 | add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM0, c); | ||
| 200 | if (bo_flags & XE_BO_CREATE_VRAM1_BIT) | ||
| 201 | add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM1, c); | ||
| 202 | } | ||
| 203 | } | 190 | } |
| 204 | 191 | ||
| 205 | static void try_add_stolen(struct xe_device *xe, struct xe_bo *bo, | 192 | static void try_add_stolen(struct xe_device *xe, struct xe_bo *bo, |
| @@ -223,17 +210,8 @@ static int __xe_bo_placement_for_flags(struct xe_device *xe, struct xe_bo *bo, · 17 unmodified lines | |||
| 223 | { | 210 | { |
| 224 | u32 c = 0; | 211 | u32 c = 0; |
| 225 | 212 | ||
| 226 | bo->props.preferred_mem_type = XE_BO_PROPS_INVALID; | 213 | try_add_vram(xe, bo, bo_flags, &c); |
| 227 | 214 | try_add_system(xe, bo, bo_flags, &c); | |
| 228 | /* The order of placements should indicate preferred location */ | ||
| 229 | |||
| 230 | if (bo->props.preferred_mem_class == DRM_XE_MEM_REGION_CLASS_SYSMEM) { | ||
| 231 | try_add_system(xe, bo, bo_flags, &c); | ||
| 232 | try_add_vram(xe, bo, bo_flags, &c); | ||
| 233 | } else { | ||
| 234 | try_add_vram(xe, bo, bo_flags, &c); | ||
| 235 | try_add_system(xe, bo, bo_flags, &c); | ||
| 236 | } | ||
| 237 | try_add_stolen(xe, bo, bo_flags, &c); | 215 | try_add_stolen(xe, bo, bo_flags, &c); |
| 238 | 216 | ||
| 239 | if (!c) | 217 | if (!c) |
| @@ -1126,13 +1104,6 @@ static void xe_gem_object_close(struct drm_gem_object *obj, · 886 unmodified lines | |||
| 1126 | } | 1104 | } |
| 1127 | } | 1105 | } |
| 1128 | 1106 | ||
| 1129 | static bool should_migrate_to_system(struct xe_bo *bo) | ||
| 1130 | { | ||
| 1131 | struct xe_device *xe = xe_bo_device(bo); | ||
| 1132 | |||
| 1133 | return xe_device_in_fault_mode(xe) && bo->props.cpu_atomic; | ||
| 1134 | } | ||
| 1135 | |||
| 1136 | static vm_fault_t xe_gem_fault(struct vm_fault *vmf) | 1107 | static vm_fault_t xe_gem_fault(struct vm_fault *vmf) |
| 1137 | { | 1108 | { |
| 1138 | struct ttm_buffer_object *tbo = vmf->vma->vm_private_data; | 1109 | struct ttm_buffer_object *tbo = vmf->vma->vm_private_data; |
| @@ -1141,7 +1112,7 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf) · 2 unmodified lines | |||
| 1141 | struct xe_bo *bo = ttm_to_xe_bo(tbo); | 1112 | struct xe_bo *bo = ttm_to_xe_bo(tbo); |
| 1142 | bool needs_rpm = bo->flags & XE_BO_CREATE_VRAM_MASK; | 1113 | bool needs_rpm = bo->flags & XE_BO_CREATE_VRAM_MASK; |
| 1143 | vm_fault_t ret; | 1114 | vm_fault_t ret; |
| 1144 | int idx, r = 0; | 1115 | int idx; |
| 1145 | 1116 | ||
| 1146 | if (needs_rpm) | 1117 | if (needs_rpm) |
| 1147 | xe_device_mem_access_get(xe); | 1118 | xe_device_mem_access_get(xe); |
| @@ -1153,17 +1124,8 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf) · 5 unmodified lines | |||
| 1153 | if (drm_dev_enter(ddev, &idx)) { | 1124 | if (drm_dev_enter(ddev, &idx)) { |
| 1154 | trace_xe_bo_cpu_fault(bo); | 1125 | trace_xe_bo_cpu_fault(bo); |
| 1155 | 1126 | ||
| 1156 | if (should_migrate_to_system(bo)) { | 1127 | ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot, |
| 1157 | r = xe_bo_migrate(bo, XE_PL_TT); | 1128 | TTM_BO_VM_NUM_PREFAULT); |
| 1158 | if (r == -EBUSY || r == -ERESTARTSYS || r == -EINTR) | ||
| 1159 | ret = VM_FAULT_NOPAGE; | ||
| 1160 | else if (r) | ||
| 1161 | ret = VM_FAULT_SIGBUS; | ||
| 1162 | } | ||
| 1163 | if (!ret) | ||
| 1164 | ret = ttm_bo_vm_fault_reserved(vmf, | ||
| 1165 | vmf->vma->vm_page_prot, | ||
| 1166 | TTM_BO_VM_NUM_PREFAULT); | ||
| 1167 | drm_dev_exit(idx); | 1129 | drm_dev_exit(idx); |
| 1168 | } else { | 1130 | } else { |
| 1169 | ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot); | 1131 | ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot); |
| @@ -1291,9 +1253,6 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo, · 121 unmodified lines | |||
| 1291 | bo->flags = flags; | 1253 | bo->flags = flags; |
| 1292 | bo->cpu_caching = cpu_caching; | 1254 | bo->cpu_caching = cpu_caching; |
| 1293 | bo->ttm.base.funcs = &xe_gem_object_funcs; | 1255 | bo->ttm.base.funcs = &xe_gem_object_funcs; |
| 1294 | bo->props.preferred_mem_class = XE_BO_PROPS_INVALID; | ||
| 1295 | bo->props.preferred_gt = XE_BO_PROPS_INVALID; | ||
| 1296 | bo->props.preferred_mem_type = XE_BO_PROPS_INVALID; | ||
| 1297 | bo->ttm.priority = XE_BO_PRIORITY_NORMAL; | 1256 | bo->ttm.priority = XE_BO_PRIORITY_NORMAL; |
| 1298 | INIT_LIST_HEAD(&bo->pinned_link); | 1257 | INIT_LIST_HEAD(&bo->pinned_link); |
| 1299 | #ifdef CONFIG_PROC_FS | 1258 | #ifdef CONFIG_PROC_FS |
| @@ -56,25 +56,6 @@ struct xe_bo { · 55 unmodified lines | |||
| 56 | */ | 56 | */ |
| 57 | struct list_head client_link; | 57 | struct list_head client_link; |
| 58 | #endif | 58 | #endif |
| 59 | /** @props: BO user controlled properties */ | ||
| 60 | struct { | ||
| 61 | /** @preferred_mem: preferred memory class for this BO */ | ||
| 62 | s16 preferred_mem_class; | ||
| 63 | /** @prefered_gt: preferred GT for this BO */ | ||
| 64 | s16 preferred_gt; | ||
| 65 | /** @preferred_mem_type: preferred memory type */ | ||
| 66 | s32 preferred_mem_type; | ||
| 67 | /** | ||
| 68 | * @cpu_atomic: the CPU expects to do atomics operations to | ||
| 69 | * this BO | ||
| 70 | */ | ||
| 71 | bool cpu_atomic; | ||
| 72 | /** | ||
| 73 | * @device_atomic: the device expects to do atomics operations | ||
| 74 | * to this BO | ||
| 75 | */ | ||
| 76 | bool device_atomic; | ||
| 77 | } props; | ||
| 78 | /** @freed: List node for delayed put. */ | 59 | /** @freed: List node for delayed put. */ |
| 79 | struct llist_node freed; | 60 | struct llist_node freed; |
| 80 | /** @created: Whether the bo has passed initial creation */ | 61 | /** @created: Whether the bo has passed initial creation */ |
| @@ -58,7 +58,7 @@ static inline struct xe_tile *xe_device_get_root_tile(struct xe_device *xe) · 57 unmodified lines | |||
| 58 | 58 | ||
| 59 | static inline struct xe_gt *xe_tile_get_gt(struct xe_tile *tile, u8 gt_id) | 59 | static inline struct xe_gt *xe_tile_get_gt(struct xe_tile *tile, u8 gt_id) |
| 60 | { | 60 | { |
| 61 | if (drm_WARN_ON(&tile_to_xe(tile)->drm, gt_id > XE_MAX_GT_PER_TILE)) | 61 | if (drm_WARN_ON(&tile_to_xe(tile)->drm, gt_id >= XE_MAX_GT_PER_TILE)) |
| 62 | gt_id = 0; | 62 | gt_id = 0; |
| 63 | 63 | ||
| 64 | return gt_id ? tile->media_gt : tile->primary_gt; | 64 | return gt_id ? tile->media_gt : tile->primary_gt; |
| @@ -79,7 +79,7 @@ static inline struct xe_gt *xe_device_get_gt(struct xe_device *xe, u8 gt_id) · 14 unmodified lines | |||
| 79 | if (MEDIA_VER(xe) >= 13) { | 79 | if (MEDIA_VER(xe) >= 13) { |
| 80 | gt = xe_tile_get_gt(root_tile, gt_id); | 80 | gt = xe_tile_get_gt(root_tile, gt_id); |
| 81 | } else { | 81 | } else { |
| 82 | if (drm_WARN_ON(&xe->drm, gt_id > XE_MAX_TILES_PER_DEVICE)) | 82 | if (drm_WARN_ON(&xe->drm, gt_id >= XE_MAX_TILES_PER_DEVICE)) |
| 83 | gt_id = 0; | 83 | gt_id = 0; |
| 84 | 84 | ||
| 85 | gt = xe->tiles[gt_id].primary_gt; | 85 | gt = xe->tiles[gt_id].primary_gt; |
| @@ -448,7 +448,7 @@ find_hw_engine(struct xe_device *xe, · 447 unmodified lines | |||
| 448 | { | 448 | { |
| 449 | u32 idx; | 449 | u32 idx; |
| 450 | 450 | ||
| 451 | if (eci.engine_class > ARRAY_SIZE(user_to_xe_engine_class)) | 451 | if (eci.engine_class >= ARRAY_SIZE(user_to_xe_engine_class)) |
| 452 | return NULL; | 452 | return NULL; |
| 453 | 453 | ||
| 454 | if (eci.gt_id >= xe->info.gt_count) | 454 | if (eci.gt_id >= xe->info.gt_count) |
| @@ -1220,7 +1220,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q) · 1219 unmodified lines | |||
| 1220 | init_waitqueue_head(&ge->suspend_wait); | 1220 | init_waitqueue_head(&ge->suspend_wait); |
| 1221 | 1221 | ||
| 1222 | timeout = (q->vm && xe_vm_in_lr_mode(q->vm)) ? MAX_SCHEDULE_TIMEOUT : | 1222 | timeout = (q->vm && xe_vm_in_lr_mode(q->vm)) ? MAX_SCHEDULE_TIMEOUT : |
| 1223 | q->sched_props.job_timeout_ms; | 1223 | msecs_to_jiffies(q->sched_props.job_timeout_ms); |
| 1224 | err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops, | 1224 | err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops, |
| 1225 | get_submit_wq(guc), | 1225 | get_submit_wq(guc), |
| 1226 | q->lrc[0].ring.size / MAX_JOB_SIZE_BYTES, 64, | 1226 | q->lrc[0].ring.size / MAX_JOB_SIZE_BYTES, 64, |
| @@ -97,7 +97,6 @@ static void set_offsets(u32 *regs, · 96 unmodified lines | |||
| 97 | #define REG16(x) \ | 97 | #define REG16(x) \ |
| 98 | (((x) >> 9) | BIT(7) | BUILD_BUG_ON_ZERO(x >= 0x10000)), \ | 98 | (((x) >> 9) | BIT(7) | BUILD_BUG_ON_ZERO(x >= 0x10000)), \ |
| 99 | (((x) >> 2) & 0x7f) | 99 | (((x) >> 2) & 0x7f) |
| 100 | #define END 0 | ||
| 101 | { | 100 | { |
| 102 | const u32 base = hwe->mmio_base; | 101 | const u32 base = hwe->mmio_base; |
| 103 | 102 | ||
| @@ -168,7 +167,7 @@ static const u8 gen12_xcs_offsets[] = { · 64 unmodified lines | |||
| 168 | REG16(0x274), | 167 | REG16(0x274), |
| 169 | REG16(0x270), | 168 | REG16(0x270), |
| 170 | 169 | ||
| 171 | END | 170 | 0 |
| 172 | }; | 171 | }; |
| 173 | 172 | ||
| 174 | static const u8 dg2_xcs_offsets[] = { | 173 | static const u8 dg2_xcs_offsets[] = { |
| @@ -202,7 +201,7 @@ static const u8 dg2_xcs_offsets[] = { · 27 unmodified lines | |||
| 202 | REG16(0x274), | 201 | REG16(0x274), |
| 203 | REG16(0x270), | 202 | REG16(0x270), |
| 204 | 203 | ||
| 205 | END | 204 | 0 |
| 206 | }; | 205 | }; |
| 207 | 206 | ||
| 208 | static const u8 gen12_rcs_offsets[] = { | 207 | static const u8 gen12_rcs_offsets[] = { |
| @@ -298,7 +297,7 @@ static const u8 gen12_rcs_offsets[] = { · 89 unmodified lines | |||
| 298 | REG(0x084), | 297 | REG(0x084), |
| 299 | NOP(1), | 298 | NOP(1), |
| 300 | 299 | ||
| 301 | END | 300 | 0 |
| 302 | }; | 301 | }; |
| 303 | 302 | ||
| 304 | static const u8 xehp_rcs_offsets[] = { | 303 | static const u8 xehp_rcs_offsets[] = { |
| @@ -339,7 +338,7 @@ static const u8 xehp_rcs_offsets[] = { · 34 unmodified lines | |||
| 339 | LRI(1, 0), | 338 | LRI(1, 0), |
| 340 | REG(0x0c8), | 339 | REG(0x0c8), |
| 341 | 340 | ||
| 342 | END | 341 | 0 |
| 343 | }; | 342 | }; |
| 344 | 343 | ||
| 345 | static const u8 dg2_rcs_offsets[] = { | 344 | static const u8 dg2_rcs_offsets[] = { |
| @@ -382,7 +381,7 @@ static const u8 dg2_rcs_offsets[] = { · 36 unmodified lines | |||
| 382 | LRI(1, 0), | 381 | LRI(1, 0), |
| 383 | REG(0x0c8), | 382 | REG(0x0c8), |
| 384 | 383 | ||
| 385 | END | 384 | 0 |
| 386 | }; | 385 | }; |
| 387 | 386 | ||
| 388 | static const u8 mtl_rcs_offsets[] = { | 387 | static const u8 mtl_rcs_offsets[] = { |
| @@ -425,7 +424,7 @@ static const u8 mtl_rcs_offsets[] = { · 36 unmodified lines | |||
| 425 | LRI(1, 0), | 424 | LRI(1, 0), |
| 426 | REG(0x0c8), | 425 | REG(0x0c8), |
| 427 | 426 | ||
| 428 | END | 427 | 0 |
| 429 | }; | 428 | }; |
| 430 | 429 | ||
| 431 | #define XE2_CTX_COMMON \ | 430 | #define XE2_CTX_COMMON \ |
| @@ -471,7 +470,7 @@ static const u8 xe2_rcs_offsets[] = { · 39 unmodified lines | |||
| 471 | LRI(1, 0), /* [0x47] */ | 470 | LRI(1, 0), /* [0x47] */ |
| 472 | REG(0x0c8), /* [0x48] R_PWR_CLK_STATE */ | 471 | REG(0x0c8), /* [0x48] R_PWR_CLK_STATE */ |
| 473 | 472 | ||
| 474 | END | 473 | 0 |
| 475 | }; | 474 | }; |
| 476 | 475 | ||
| 477 | static const u8 xe2_bcs_offsets[] = { | 476 | static const u8 xe2_bcs_offsets[] = { |
| @@ -482,16 +481,15 @@ static const u8 xe2_bcs_offsets[] = { · 4 unmodified lines | |||
| 482 | REG16(0x200), /* [0x42] BCS_SWCTRL */ | 481 | REG16(0x200), /* [0x42] BCS_SWCTRL */ |
| 483 | REG16(0x204), /* [0x44] BLIT_CCTL */ | 482 | REG16(0x204), /* [0x44] BLIT_CCTL */ |
| 484 | 483 | ||
| 485 | END | 484 | 0 |
| 486 | }; | 485 | }; |
| 487 | 486 | ||
| 488 | static const u8 xe2_xcs_offsets[] = { | 487 | static const u8 xe2_xcs_offsets[] = { |
| 489 | XE2_CTX_COMMON, | 488 | XE2_CTX_COMMON, |
| 490 | 489 | ||
| 491 | END | 490 | 0 |
| 492 | }; | 491 | }; |
| 493 | 492 | ||
| 494 | #undef END | ||
| 495 | #undef REG16 | 493 | #undef REG16 |
| 496 | #undef REG | 494 | #undef REG |
| 497 | #undef LRI | 495 | #undef LRI |
| @@ -132,7 +132,7 @@ query_engine_cycles(struct xe_device *xe, · 131 unmodified lines | |||
| 132 | return -EINVAL; | 132 | return -EINVAL; |
| 133 | 133 | ||
| 134 | eci = &resp.eci; | 134 | eci = &resp.eci; |
| 135 | if (eci->gt_id > XE_MAX_GT_PER_TILE) | 135 | if (eci->gt_id >= XE_MAX_GT_PER_TILE) |
| 136 | return -EINVAL; | 136 | return -EINVAL; |
| 137 | 137 | ||
| 138 | gt = xe_device_get_gt(xe, eci->gt_id); | 138 | gt = xe_device_get_gt(xe, eci->gt_id); |
| @@ -536,11 +536,12 @@ static int i801_block_transaction_by_block(struct i801_priv *priv, · 535 unmodified lines | |||
| 536 | 536 | ||
| 537 | if (read_write == I2C_SMBUS_READ || | 537 | if (read_write == I2C_SMBUS_READ || |
| 538 | command == I2C_SMBUS_BLOCK_PROC_CALL) { | 538 | command == I2C_SMBUS_BLOCK_PROC_CALL) { |
| 539 | status = i801_get_block_len(priv); | 539 | len = i801_get_block_len(priv); |
| 540 | if (status < 0) | 540 | if (len < 0) { |
| 541 | status = len; | ||
| 541 | goto out; | 542 | goto out; |
| 543 | } | ||
| 542 | 544 | ||
| 543 | len = status; | ||
| 544 | data->block[0] = len; | 545 | data->block[0] = len; |
| 545 | inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */ | 546 | inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */ |
| 546 | for (i = 0; i < len; i++) | 547 | for (i = 0; i < len; i++) |
| @@ -1139,7 +1139,8 @@ static void arm_smmu_write_ste(struct arm_smmu_master *master, u32 sid, · 1138 unmodified lines | |||
| 1139 | * requires a breaking update, zero the V bit, write all qwords | 1139 | * requires a breaking update, zero the V bit, write all qwords |
| 1140 | * but 0, then set qword 0 | 1140 | * but 0, then set qword 0 |
| 1141 | */ | 1141 | */ |
| 1142 | unused_update.data[0] = entry->data[0] & (~STRTAB_STE_0_V); | 1142 | unused_update.data[0] = entry->data[0] & |
| 1143 | cpu_to_le64(~STRTAB_STE_0_V); | ||
| 1143 | entry_set(smmu, sid, entry, &unused_update, 0, 1); | 1144 | entry_set(smmu, sid, entry, &unused_update, 0, 1); |
| 1144 | entry_set(smmu, sid, entry, target, 1, num_entry_qwords - 1); | 1145 | entry_set(smmu, sid, entry, target, 1, num_entry_qwords - 1); |
| 1145 | entry_set(smmu, sid, entry, target, 0, 1); | 1146 | entry_set(smmu, sid, entry, target, 0, 1); |
| @@ -1453,14 +1454,17 @@ static void arm_smmu_make_abort_ste(struct arm_smmu_ste *target) · 307 unmodified lines | |||
| 1453 | FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_ABORT)); | 1454 | FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_ABORT)); |
| 1454 | } | 1455 | } |
| 1455 | 1456 | ||
| 1456 | static void arm_smmu_make_bypass_ste(struct arm_smmu_ste *target) | 1457 | static void arm_smmu_make_bypass_ste(struct arm_smmu_device *smmu, |
| 1458 | struct arm_smmu_ste *target) | ||
| 1457 | { | 1459 | { |
| 1458 | memset(target, 0, sizeof(*target)); | 1460 | memset(target, 0, sizeof(*target)); |
| 1459 | target->data[0] = cpu_to_le64( | 1461 | target->data[0] = cpu_to_le64( |
| 1460 | STRTAB_STE_0_V | | 1462 | STRTAB_STE_0_V | |
| 1461 | FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_BYPASS)); | 1463 | FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_BYPASS)); |
| 1462 | target->data[1] = cpu_to_le64( | 1464 | |
| 1463 | FIELD_PREP(STRTAB_STE_1_SHCFG, STRTAB_STE_1_SHCFG_INCOMING)); | 1465 | if (smmu->features & ARM_SMMU_FEAT_ATTR_TYPES_OVR) |
| 1466 | target->data[1] = cpu_to_le64(FIELD_PREP(STRTAB_STE_1_SHCFG, | ||
| 1467 | STRTAB_STE_1_SHCFG_INCOMING)); | ||
| 1464 | } | 1468 | } |
| 1465 | 1469 | ||
| 1466 | static void arm_smmu_make_cdtable_ste(struct arm_smmu_ste *target, | 1470 | static void arm_smmu_make_cdtable_ste(struct arm_smmu_ste *target, |
| @@ -1523,6 +1527,7 @@ static void arm_smmu_make_s2_domain_ste(struct arm_smmu_ste *target, · 56 unmodified lines | |||
| 1523 | typeof(&pgtbl_cfg->arm_lpae_s2_cfg.vtcr) vtcr = | 1527 | typeof(&pgtbl_cfg->arm_lpae_s2_cfg.vtcr) vtcr = |
| 1524 | &pgtbl_cfg->arm_lpae_s2_cfg.vtcr; | 1528 | &pgtbl_cfg->arm_lpae_s2_cfg.vtcr; |
| 1525 | u64 vtcr_val; | 1529 | u64 vtcr_val; |
| 1530 | struct arm_smmu_device *smmu = master->smmu; | ||
| 1526 | 1531 | ||
| 1527 | memset(target, 0, sizeof(*target)); | 1532 | memset(target, 0, sizeof(*target)); |
| 1528 | target->data[0] = cpu_to_le64( | 1533 | target->data[0] = cpu_to_le64( |
| @@ -1531,9 +1536,11 @@ static void arm_smmu_make_s2_domain_ste(struct arm_smmu_ste *target, · 2 unmodified lines | |||
| 1531 | 1536 | ||
| 1532 | target->data[1] = cpu_to_le64( | 1537 | target->data[1] = cpu_to_le64( |
| 1533 | FIELD_PREP(STRTAB_STE_1_EATS, | 1538 | FIELD_PREP(STRTAB_STE_1_EATS, |
| 1534 | master->ats_enabled ? STRTAB_STE_1_EATS_TRANS : 0) | | 1539 | master->ats_enabled ? STRTAB_STE_1_EATS_TRANS : 0)); |
| 1535 | FIELD_PREP(STRTAB_STE_1_SHCFG, | 1540 | |
| 1536 | STRTAB_STE_1_SHCFG_INCOMING)); | 1541 | if (smmu->features & ARM_SMMU_FEAT_ATTR_TYPES_OVR) |
| 1542 | target->data[1] |= cpu_to_le64(FIELD_PREP(STRTAB_STE_1_SHCFG, | ||
| 1543 | STRTAB_STE_1_SHCFG_INCOMING)); | ||
| 1537 | 1544 | ||
| 1538 | vtcr_val = FIELD_PREP(STRTAB_STE_2_VTCR_S2T0SZ, vtcr->tsz) | | 1545 | vtcr_val = FIELD_PREP(STRTAB_STE_2_VTCR_S2T0SZ, vtcr->tsz) | |
| 1539 | FIELD_PREP(STRTAB_STE_2_VTCR_S2SL0, vtcr->sl) | | 1546 | FIELD_PREP(STRTAB_STE_2_VTCR_S2SL0, vtcr->sl) | |
| @@ -1560,7 +1567,8 @@ static void arm_smmu_make_s2_domain_ste(struct arm_smmu_ste *target, · 20 unmodified lines | |||
| 1560 | * This can safely directly manipulate the STE memory without a sync sequence | 1567 | * This can safely directly manipulate the STE memory without a sync sequence |
| 1561 | * because the STE table has not been installed in the SMMU yet. | 1568 | * because the STE table has not been installed in the SMMU yet. |
| 1562 | */ | 1569 | */ |
| 1563 | static void arm_smmu_init_initial_stes(struct arm_smmu_ste *strtab, | 1570 | static void arm_smmu_init_initial_stes(struct arm_smmu_device *smmu, |
| 1571 | struct arm_smmu_ste *strtab, | ||
| 1564 | unsigned int nent) | 1572 | unsigned int nent) |
| 1565 | { | 1573 | { |
| 1566 | unsigned int i; | 1574 | unsigned int i; |
| @@ -1569,7 +1577,7 @@ static void arm_smmu_init_initial_stes(struct arm_smmu_ste *strtab, · 2 unmodified lines | |||
| 1569 | if (disable_bypass) | 1577 | if (disable_bypass) |
| 1570 | arm_smmu_make_abort_ste(strtab); | 1578 | arm_smmu_make_abort_ste(strtab); |
| 1571 | else | 1579 | else |
| 1572 | arm_smmu_make_bypass_ste(strtab); | 1580 | arm_smmu_make_bypass_ste(smmu, strtab); |
| 1573 | strtab++; | 1581 | strtab++; |
| 1574 | } | 1582 | } |
| 1575 | } | 1583 | } |
| @@ -1597,7 +1605,7 @@ static int arm_smmu_init_l2_strtab(struct arm_smmu_device *smmu, u32 sid) · 21 unmodified lines | |||
| 1597 | return -ENOMEM; | 1605 | return -ENOMEM; |
| 1598 | } | 1606 | } |
| 1599 | 1607 | ||
| 1600 | arm_smmu_init_initial_stes(desc->l2ptr, 1 << STRTAB_SPLIT); | 1608 | arm_smmu_init_initial_stes(smmu, desc->l2ptr, 1 << STRTAB_SPLIT); |
| 1601 | arm_smmu_write_strtab_l1_desc(strtab, desc); | 1609 | arm_smmu_write_strtab_l1_desc(strtab, desc); |
| 1602 | return 0; | 1610 | return 0; |
| 1603 | } | 1611 | } |
| @@ -2637,8 +2645,9 @@ static int arm_smmu_attach_dev_identity(struct iommu_domain *domain, · 1033 unmodified lines | |||
| 2637 | struct device *dev) | 2645 | struct device *dev) |
| 2638 | { | 2646 | { |
| 2639 | struct arm_smmu_ste ste; | 2647 | struct arm_smmu_ste ste; |
| 2648 | struct arm_smmu_master *master = dev_iommu_priv_get(dev); | ||
| 2640 | 2649 | ||
| 2641 | arm_smmu_make_bypass_ste(&ste); | 2650 | arm_smmu_make_bypass_ste(master->smmu, &ste); |
| 2642 | return arm_smmu_attach_dev_ste(dev, &ste); | 2651 | return arm_smmu_attach_dev_ste(dev, &ste); |
| 2643 | } | 2652 | } |
| 2644 | 2653 | ||
| @@ -3264,7 +3273,7 @@ static int arm_smmu_init_strtab_linear(struct arm_smmu_device *smmu) · 619 unmodified lines | |||
| 3264 | reg |= FIELD_PREP(STRTAB_BASE_CFG_LOG2SIZE, smmu->sid_bits); | 3273 | reg |= FIELD_PREP(STRTAB_BASE_CFG_LOG2SIZE, smmu->sid_bits); |
| 3265 | cfg->strtab_base_cfg = reg; | 3274 | cfg->strtab_base_cfg = reg; |
| 3266 | 3275 | ||
| 3267 | arm_smmu_init_initial_stes(strtab, cfg->num_l1_ents); | 3276 | arm_smmu_init_initial_stes(smmu, strtab, cfg->num_l1_ents); |
| 3268 | return 0; | 3277 | return 0; |
| 3269 | } | 3278 | } |
| 3270 | 3279 | ||
| @@ -3777,6 +3786,9 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) · 506 unmodified lines | |||
| 3777 | return -ENXIO; | 3786 | return -ENXIO; |
| 3778 | } | 3787 | } |
| 3779 | 3788 | ||
| 3789 | if (reg & IDR1_ATTR_TYPES_OVR) | ||
| 3790 | smmu->features |= ARM_SMMU_FEAT_ATTR_TYPES_OVR; | ||
| 3791 | |||
| 3780 | /* Queue sizes, capped to ensure natural alignment */ | 3792 | /* Queue sizes, capped to ensure natural alignment */ |
| 3781 | smmu->cmdq.q.llq.max_n_shift = min_t(u32, CMDQ_MAX_SZ_SHIFT, | 3793 | smmu->cmdq.q.llq.max_n_shift = min_t(u32, CMDQ_MAX_SZ_SHIFT, |
| 3782 | FIELD_GET(IDR1_CMDQS, reg)); | 3794 | FIELD_GET(IDR1_CMDQS, reg)); |
| @@ -3992,7 +4004,7 @@ static void arm_smmu_rmr_install_bypass_ste(struct arm_smmu_device *smmu) · 209 unmodified lines | |||
| 3992 | * STE table is not programmed to HW, see | 4004 | * STE table is not programmed to HW, see |
| 3993 | * arm_smmu_initial_bypass_stes() | 4005 | * arm_smmu_initial_bypass_stes() |
| 3994 | */ | 4006 | */ |
| 3995 | arm_smmu_make_bypass_ste( | 4007 | arm_smmu_make_bypass_ste(smmu, |
| 3996 | arm_smmu_get_step_for_sid(smmu, rmr->sids[i])); | 4008 | arm_smmu_get_step_for_sid(smmu, rmr->sids[i])); |
| 3997 | } | 4009 | } |
| 3998 | } | 4010 | } |
| @@ -44,6 +44,7 @@ · 43 unmodified lines | |||
| 44 | #define IDR1_TABLES_PRESET (1 << 30) | 44 | #define IDR1_TABLES_PRESET (1 << 30) |
| 45 | #define IDR1_QUEUES_PRESET (1 << 29) | 45 | #define IDR1_QUEUES_PRESET (1 << 29) |
| 46 | #define IDR1_REL (1 << 28) | 46 | #define IDR1_REL (1 << 28) |
| 47 | #define IDR1_ATTR_TYPES_OVR (1 << 27) | ||
| 47 | #define IDR1_CMDQS GENMASK(25, 21) | 48 | #define IDR1_CMDQS GENMASK(25, 21) |
| 48 | #define IDR1_EVTQS GENMASK(20, 16) | 49 | #define IDR1_EVTQS GENMASK(20, 16) |
| 49 | #define IDR1_PRIQS GENMASK(15, 11) | 50 | #define IDR1_PRIQS GENMASK(15, 11) |
| @@ -647,6 +648,7 @@ struct arm_smmu_device { · 597 unmodified lines | |||
| 647 | #define ARM_SMMU_FEAT_SVA (1 << 17) | 648 | #define ARM_SMMU_FEAT_SVA (1 << 17) |
| 648 | #define ARM_SMMU_FEAT_E2H (1 << 18) | 649 | #define ARM_SMMU_FEAT_E2H (1 << 18) |
| 649 | #define ARM_SMMU_FEAT_NESTING (1 << 19) | 650 | #define ARM_SMMU_FEAT_NESTING (1 << 19) |
| 651 | #define ARM_SMMU_FEAT_ATTR_TYPES_OVR (1 << 20) | ||
| 650 | u32 features; | 652 | u32 features; |
| 651 | 653 | ||
| 652 | #define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0) | 654 | #define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0) |
| @@ -3354,6 +3354,7 @@ int iommu_attach_device_pasid(struct iommu_domain *domain, · 3353 unmodified lines | |||
| 3354 | { | 3354 | { |
| 3355 | /* Caller must be a probed driver on dev */ | 3355 | /* Caller must be a probed driver on dev */ |
| 3356 | struct iommu_group *group = dev->iommu_group; | 3356 | struct iommu_group *group = dev->iommu_group; |
| 3357 | struct group_device *device; | ||
| 3357 | void *curr; | 3358 | void *curr; |
| 3358 | int ret; | 3359 | int ret; |
| 3359 | 3360 | ||
| @@ -3363,10 +3364,18 @@ int iommu_attach_device_pasid(struct iommu_domain *domain, · 3 unmodified lines | |||
| 3363 | if (!group) | 3364 | if (!group) |
| 3364 | return -ENODEV; | 3365 | return -ENODEV; |
| 3365 | 3366 | ||
| 3366 | if (!dev_has_iommu(dev) || dev_iommu_ops(dev) != domain->owner) | 3367 | if (!dev_has_iommu(dev) || dev_iommu_ops(dev) != domain->owner || |
| 3368 | pasid == IOMMU_NO_PASID) | ||
| 3367 | return -EINVAL; | 3369 | return -EINVAL; |
| 3368 | 3370 | ||
| 3369 | mutex_lock(&group->mutex); | 3371 | mutex_lock(&group->mutex); |
| 3372 | for_each_group_device(group, device) { | ||
| 3373 | if (pasid >= device->dev->iommu->max_pasids) { | ||
| 3374 | ret = -EINVAL; | ||
| 3375 | goto out_unlock; | ||
| 3376 | } | ||
| 3377 | } | ||
| 3378 | |||
| 3370 | curr = xa_cmpxchg(&group->pasid_array, pasid, NULL, domain, GFP_KERNEL); | 3379 | curr = xa_cmpxchg(&group->pasid_array, pasid, NULL, domain, GFP_KERNEL); |
| 3371 | if (curr) { | 3380 | if (curr) { |
| 3372 | ret = xa_err(curr) ? : -EBUSY; | 3381 | ret = xa_err(curr) ? : -EBUSY; |
| @@ -316,7 +316,7 @@ static int armada_370_xp_msi_init(struct device_node *node, · 315 unmodified lines | |||
| 316 | return 0; | 316 | return 0; |
| 317 | } | 317 | } |
| 318 | #else | 318 | #else |
| 319 | static void armada_370_xp_msi_reenable_percpu(void) {} | 319 | static __maybe_unused void armada_370_xp_msi_reenable_percpu(void) {} |
| 320 | 320 | ||
| 321 | static inline int armada_370_xp_msi_init(struct device_node *node, | 321 | static inline int armada_370_xp_msi_init(struct device_node *node, |
| 322 | phys_addr_t main_int_phys_base) | 322 | phys_addr_t main_int_phys_base) |
| @@ -4221,7 +4221,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv · 4220 unmodified lines | |||
| 4221 | } else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) == 1) { | 4221 | } else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) == 1) { |
| 4222 | log2_sectors_per_bitmap_bit = !llval ? 0 : __ilog2_u64(llval); | 4222 | log2_sectors_per_bitmap_bit = !llval ? 0 : __ilog2_u64(llval); |
| 4223 | } else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy) == 1) { | 4223 | } else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy) == 1) { |
| 4224 | if (val >= (uint64_t)UINT_MAX * 1000 / HZ) { | 4224 | if ((uint64_t)val >= (uint64_t)UINT_MAX * 1000 / HZ) { |
| 4225 | r = -EINVAL; | 4225 | r = -EINVAL; |
| 4226 | ti->error = "Invalid bitmap_flush_interval argument"; | 4226 | ti->error = "Invalid bitmap_flush_interval argument"; |
| 4227 | goto bad; | 4227 | goto bad; |
| @@ -8,33 +8,14 @@ · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | #include "murmurhash3.h" | 9 | #include "murmurhash3.h" |
| 10 | 10 | ||
| 11 | #include <asm/unaligned.h> | ||
| 12 | |||
| 11 | static inline u64 rotl64(u64 x, s8 r) | 13 | static inline u64 rotl64(u64 x, s8 r) |
| 12 | { | 14 | { |
| 13 | return (x << r) | (x >> (64 - r)); | 15 | return (x << r) | (x >> (64 - r)); |
| 14 | } | 16 | } |
| 15 | 17 | ||
| 16 | #define ROTL64(x, y) rotl64(x, y) | 18 | #define ROTL64(x, y) rotl64(x, y) |
| 17 | static __always_inline u64 getblock64(const u64 *p, int i) | ||
| 18 | { | ||
| 19 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | ||
| 20 | return p[i]; | ||
| 21 | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | ||
| 22 | return __builtin_bswap64(p[i]); | ||
| 23 | #else | ||
| 24 | #error "can't figure out byte order" | ||
| 25 | #endif | ||
| 26 | } | ||
| 27 | |||
| 28 | static __always_inline void putblock64(u64 *p, int i, u64 value) | ||
| 29 | { | ||
| 30 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | ||
| 31 | p[i] = value; | ||
| 32 | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | ||
| 33 | p[i] = __builtin_bswap64(value); | ||
| 34 | #else | ||
| 35 | #error "can't figure out byte order" | ||
| 36 | #endif | ||
| 37 | } | ||
| 38 | 19 | ||
| 39 | /* Finalization mix - force all bits of a hash block to avalanche */ | 20 | /* Finalization mix - force all bits of a hash block to avalanche */ |
| 40 | 21 | ||
| @@ -60,6 +41,8 @@ void murmurhash3_128(const void *key, const int len, const u32 seed, void *out) · 19 unmodified lines | |||
| 60 | const u64 c1 = 0x87c37b91114253d5LLU; | 41 | const u64 c1 = 0x87c37b91114253d5LLU; |
| 61 | const u64 c2 = 0x4cf5ad432745937fLLU; | 42 | const u64 c2 = 0x4cf5ad432745937fLLU; |
| 62 | 43 | ||
| 44 | u64 *hash_out = out; | ||
| 45 | |||
| 63 | /* body */ | 46 | /* body */ |
| 64 | 47 | ||
| 65 | const u64 *blocks = (const u64 *)(data); | 48 | const u64 *blocks = (const u64 *)(data); |
| @@ -67,8 +50,8 @@ void murmurhash3_128(const void *key, const int len, const u32 seed, void *out) · 1 unmodified line | |||
| 67 | int i; | 50 | int i; |
| 68 | 51 | ||
| 69 | for (i = 0; i < nblocks; i++) { | 52 | for (i = 0; i < nblocks; i++) { |
| 70 | u64 k1 = getblock64(blocks, i * 2 + 0); | 53 | u64 k1 = get_unaligned_le64(&blocks[i * 2]); |
| 71 | u64 k2 = getblock64(blocks, i * 2 + 1); | 54 | u64 k2 = get_unaligned_le64(&blocks[i * 2 + 1]); |
| 72 | 55 | ||
| 73 | k1 *= c1; | 56 | k1 *= c1; |
| 74 | k1 = ROTL64(k1, 31); | 57 | k1 = ROTL64(k1, 31); |
| @@ -170,6 +153,6 @@ void murmurhash3_128(const void *key, const int len, const u32 seed, void *out) · 95 unmodified lines | |||
| 170 | h1 += h2; | 153 | h1 += h2; |
| 171 | h2 += h1; | 154 | h2 += h1; |
| 172 | 155 | ||
| 173 | putblock64((u64 *)out, 0, h1); | 156 | put_unaligned_le64(h1, &hash_out[0]); |
| 174 | putblock64((u64 *)out, 1, h2); | 157 | put_unaligned_le64(h2, &hash_out[1]); |
| 175 | } | 158 | } |
| @@ -413,7 +413,7 @@ static struct mmc_blk_ioc_data *mmc_blk_ioctl_copy_from_user( · 412 unmodified lines | |||
| 413 | struct mmc_blk_ioc_data *idata; | 413 | struct mmc_blk_ioc_data *idata; |
| 414 | int err; | 414 | int err; |
| 415 | 415 | ||
| 416 | idata = kmalloc(sizeof(*idata), GFP_KERNEL); | 416 | idata = kzalloc(sizeof(*idata), GFP_KERNEL); |
| 417 | if (!idata) { | 417 | if (!idata) { |
| 418 | err = -ENOMEM; | 418 | err = -ENOMEM; |
| 419 | goto out; | 419 | goto out; |
| @@ -488,7 +488,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, · 68 unmodified lines | |||
| 488 | if (idata->flags & MMC_BLK_IOC_DROP) | 488 | if (idata->flags & MMC_BLK_IOC_DROP) |
| 489 | return 0; | 489 | return 0; |
| 490 | 490 | ||
| 491 | if (idata->flags & MMC_BLK_IOC_SBC) | 491 | if (idata->flags & MMC_BLK_IOC_SBC && i > 0) |
| 492 | prev_idata = idatas[i - 1]; | 492 | prev_idata = idatas[i - 1]; |
| 493 | 493 | ||
| 494 | /* | 494 | /* |
| @@ -999,6 +999,17 @@ free_pltfm: · 998 unmodified lines | |||
| 999 | return err; | 999 | return err; |
| 1000 | } | 1000 | } |
| 1001 | 1001 | ||
| 1002 | static void dwcmshc_disable_card_clk(struct sdhci_host *host) | ||
| 1003 | { | ||
| 1004 | u16 ctrl; | ||
| 1005 | |||
| 1006 | ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); | ||
| 1007 | if (ctrl & SDHCI_CLOCK_CARD_EN) { | ||
| 1008 | ctrl &= ~SDHCI_CLOCK_CARD_EN; | ||
| 1009 | sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); | ||
| 1010 | } | ||
| 1011 | } | ||
| 1012 | |||
| 1002 | static void dwcmshc_remove(struct platform_device *pdev) | 1013 | static void dwcmshc_remove(struct platform_device *pdev) |
| 1003 | { | 1014 | { |
| 1004 | struct sdhci_host *host = platform_get_drvdata(pdev); | 1015 | struct sdhci_host *host = platform_get_drvdata(pdev); |
| @@ -1006,8 +1017,14 @@ static void dwcmshc_remove(struct platform_device *pdev) · 1 unmodified line | |||
| 1006 | struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host); | 1017 | struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host); |
| 1007 | struct rk35xx_priv *rk_priv = priv->priv; | 1018 | struct rk35xx_priv *rk_priv = priv->priv; |
| 1008 | 1019 | ||
| 1020 | pm_runtime_get_sync(&pdev->dev); | ||
| 1021 | pm_runtime_disable(&pdev->dev); | ||
| 1022 | pm_runtime_put_noidle(&pdev->dev); | ||
| 1023 | |||
| 1009 | sdhci_remove_host(host, 0); | 1024 | sdhci_remove_host(host, 0); |
| 1010 | 1025 | ||
| 1026 | dwcmshc_disable_card_clk(host); | ||
| 1027 | |||
| 1011 | clk_disable_unprepare(pltfm_host->clk); | 1028 | clk_disable_unprepare(pltfm_host->clk); |
| 1012 | clk_disable_unprepare(priv->bus_clk); | 1029 | clk_disable_unprepare(priv->bus_clk); |
| 1013 | if (rk_priv) | 1030 | if (rk_priv) |
| @@ -1099,17 +1116,6 @@ static void dwcmshc_enable_card_clk(struct sdhci_host *host) · 85 unmodified lines | |||
| 1099 | } | 1116 | } |
| 1100 | } | 1117 | } |
| 1101 | 1118 | ||
| 1102 | static void dwcmshc_disable_card_clk(struct sdhci_host *host) | ||
| 1103 | { | ||
| 1104 | u16 ctrl; | ||
| 1105 | |||
| 1106 | ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); | ||
| 1107 | if (ctrl & SDHCI_CLOCK_CARD_EN) { | ||
| 1108 | ctrl &= ~SDHCI_CLOCK_CARD_EN; | ||
| 1109 | sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); | ||
| 1110 | } | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | static int dwcmshc_runtime_suspend(struct device *dev) | 1119 | static int dwcmshc_runtime_suspend(struct device *dev) |
| 1114 | { | 1120 | { |
| 1115 | struct sdhci_host *host = dev_get_drvdata(dev); | 1121 | struct sdhci_host *host = dev_get_drvdata(dev); |
| @@ -1439,6 +1439,9 @@ static int __maybe_unused sdhci_omap_runtime_suspend(struct device *dev) · 1438 unmodified lines | |||
| 1439 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | 1439 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
| 1440 | struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); | 1440 | struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); |
| 1441 | 1441 | ||
| 1442 | if (host->tuning_mode != SDHCI_TUNING_MODE_3) | ||
| 1443 | mmc_retune_needed(host->mmc); | ||
| 1444 | |||
| 1442 | if (omap_host->con != -EINVAL) | 1445 | if (omap_host->con != -EINVAL) |
| 1443 | sdhci_runtime_suspend_host(host); | 1446 | sdhci_runtime_suspend_host(host); |
| 1444 | 1447 | ||
| @@ -2268,8 +2268,6 @@ mt7530_setup(struct dsa_switch *ds) · 2267 unmodified lines | |||
| 2268 | SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | | 2268 | SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | |
| 2269 | SYS_CTRL_REG_RST); | 2269 | SYS_CTRL_REG_RST); |
| 2270 | 2270 | ||
| 2271 | mt7530_pll_setup(priv); | ||
| 2272 | |||
| 2273 | /* Lower Tx driving for TRGMII path */ | 2271 | /* Lower Tx driving for TRGMII path */ |
| 2274 | for (i = 0; i < NUM_TRGMII_CTRL; i++) | 2272 | for (i = 0; i < NUM_TRGMII_CTRL; i++) |
| 2275 | mt7530_write(priv, MT7530_TRGMII_TD_ODT(i), | 2273 | mt7530_write(priv, MT7530_TRGMII_TD_ODT(i), |
| @@ -2285,6 +2283,9 @@ mt7530_setup(struct dsa_switch *ds) · 9 unmodified lines | |||
| 2285 | val |= MHWTRAP_MANUAL; | 2283 | val |= MHWTRAP_MANUAL; |
| 2286 | mt7530_write(priv, MT7530_MHWTRAP, val); | 2284 | mt7530_write(priv, MT7530_MHWTRAP, val); |
| 2287 | 2285 | ||
| 2286 | if ((val & HWTRAP_XTAL_MASK) == HWTRAP_XTAL_40MHZ) | ||
| 2287 | mt7530_pll_setup(priv); | ||
| 2288 | |||
| 2288 | mt753x_trap_frames(priv); | 2289 | mt753x_trap_frames(priv); |
| 2289 | 2290 | ||
| 2290 | /* Enable and reset MIB counters */ | 2291 | /* Enable and reset MIB counters */ |
| @@ -392,7 +392,9 @@ static void umac_reset(struct bcmasp_intf *intf) · 391 unmodified lines | |||
| 392 | umac_wl(intf, 0x0, UMC_CMD); | 392 | umac_wl(intf, 0x0, UMC_CMD); |
| 393 | umac_wl(intf, UMC_CMD_SW_RESET, UMC_CMD); | 393 | umac_wl(intf, UMC_CMD_SW_RESET, UMC_CMD); |
| 394 | usleep_range(10, 100); | 394 | usleep_range(10, 100); |
| 395 | umac_wl(intf, 0x0, UMC_CMD); | 395 | /* We hold the umac in reset and bring it out of |
| 396 | * reset when phy link is up. | ||
| 397 | */ | ||
| 396 | } | 398 | } |
| 397 | 399 | ||
| 398 | static void umac_set_hw_addr(struct bcmasp_intf *intf, | 400 | static void umac_set_hw_addr(struct bcmasp_intf *intf, |
| @@ -412,6 +414,8 @@ static void umac_enable_set(struct bcmasp_intf *intf, u32 mask, · 13 unmodified lines | |||
| 412 | u32 reg; | 414 | u32 reg; |
| 413 | 415 | ||
| 414 | reg = umac_rl(intf, UMC_CMD); | 416 | reg = umac_rl(intf, UMC_CMD); |
| 417 | if (reg & UMC_CMD_SW_RESET) | ||
| 418 | return; | ||
| 415 | if (enable) | 419 | if (enable) |
| 416 | reg |= mask; | 420 | reg |= mask; |
| 417 | else | 421 | else |
| @@ -430,7 +434,6 @@ static void umac_init(struct bcmasp_intf *intf) · 12 unmodified lines | |||
| 430 | umac_wl(intf, 0x800, UMC_FRM_LEN); | 434 | umac_wl(intf, 0x800, UMC_FRM_LEN); |
| 431 | umac_wl(intf, 0xffff, UMC_PAUSE_CNTRL); | 435 | umac_wl(intf, 0xffff, UMC_PAUSE_CNTRL); |
| 432 | umac_wl(intf, 0x800, UMC_RX_MAX_PKT_SZ); | 436 | umac_wl(intf, 0x800, UMC_RX_MAX_PKT_SZ); |
| 433 | umac_enable_set(intf, UMC_CMD_PROMISC, 1); | ||
| 434 | } | 437 | } |
| 435 | 438 | ||
| 436 | static int bcmasp_tx_poll(struct napi_struct *napi, int budget) | 439 | static int bcmasp_tx_poll(struct napi_struct *napi, int budget) |
| @@ -658,6 +661,12 @@ static void bcmasp_adj_link(struct net_device *dev) · 221 unmodified lines | |||
| 658 | UMC_CMD_HD_EN | UMC_CMD_RX_PAUSE_IGNORE | | 661 | UMC_CMD_HD_EN | UMC_CMD_RX_PAUSE_IGNORE | |
| 659 | UMC_CMD_TX_PAUSE_IGNORE); | 662 | UMC_CMD_TX_PAUSE_IGNORE); |
| 660 | reg |= cmd_bits; | 663 | reg |= cmd_bits; |
| 664 | if (reg & UMC_CMD_SW_RESET) { | ||
| 665 | reg &= ~UMC_CMD_SW_RESET; | ||
| 666 | umac_wl(intf, reg, UMC_CMD); | ||
| 667 | udelay(2); | ||
| 668 | reg |= UMC_CMD_TX_EN | UMC_CMD_RX_EN | UMC_CMD_PROMISC; | ||
| 669 | } | ||
| 661 | umac_wl(intf, reg, UMC_CMD); | 670 | umac_wl(intf, reg, UMC_CMD); |
| 662 | 671 | ||
| 663 | active = phy_init_eee(phydev, 0) >= 0; | 672 | active = phy_init_eee(phydev, 0) >= 0; |
| @@ -1035,19 +1044,12 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect) · 371 unmodified lines | |||
| 1035 | 1044 | ||
| 1036 | /* Indicate that the MAC is responsible for PHY PM */ | 1045 | /* Indicate that the MAC is responsible for PHY PM */ |
| 1037 | phydev->mac_managed_pm = true; | 1046 | phydev->mac_managed_pm = true; |
| 1038 | } else if (!intf->wolopts) { | ||
| 1039 | ret = phy_resume(dev->phydev); | ||
| 1040 | if (ret) | ||
| 1041 | goto err_phy_disable; | ||
| 1042 | } | 1047 | } |
| 1043 | 1048 | ||
| 1044 | umac_reset(intf); | 1049 | umac_reset(intf); |
| 1045 | 1050 | ||
| 1046 | umac_init(intf); | 1051 | umac_init(intf); |
| 1047 | 1052 | ||
| 1048 | /* Disable the UniMAC RX/TX */ | ||
| 1049 | umac_enable_set(intf, (UMC_CMD_RX_EN | UMC_CMD_TX_EN), 0); | ||
| 1050 | |||
| 1051 | umac_set_hw_addr(intf, dev->dev_addr); | 1053 | umac_set_hw_addr(intf, dev->dev_addr); |
| 1052 | 1054 | ||
| 1053 | intf->old_duplex = -1; | 1055 | intf->old_duplex = -1; |
| @@ -1062,9 +1064,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect) · 8 unmodified lines | |||
| 1062 | netif_napi_add(intf->ndev, &intf->rx_napi, bcmasp_rx_poll); | 1064 | netif_napi_add(intf->ndev, &intf->rx_napi, bcmasp_rx_poll); |
| 1063 | bcmasp_enable_rx(intf, 1); | 1065 | bcmasp_enable_rx(intf, 1); |
| 1064 | 1066 | ||
| 1065 | /* Turn on UniMAC TX/RX */ | ||
| 1066 | umac_enable_set(intf, (UMC_CMD_RX_EN | UMC_CMD_TX_EN), 1); | ||
| 1067 | |||
| 1068 | intf->crc_fwd = !!(umac_rl(intf, UMC_CMD) & UMC_CMD_CRC_FWD); | 1067 | intf->crc_fwd = !!(umac_rl(intf, UMC_CMD) & UMC_CMD_CRC_FWD); |
| 1069 | 1068 | ||
| 1070 | bcmasp_netif_start(dev); | 1069 | bcmasp_netif_start(dev); |
| @@ -1306,7 +1305,14 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf) · 235 unmodified lines | |||
| 1306 | if (intf->wolopts & WAKE_FILTER) | 1305 | if (intf->wolopts & WAKE_FILTER) |
| 1307 | bcmasp_netfilt_suspend(intf); | 1306 | bcmasp_netfilt_suspend(intf); |
| 1308 | 1307 | ||
| 1309 | /* UniMAC receive needs to be turned on */ | 1308 | /* Bring UniMAC out of reset if needed and enable RX */ |
| 1309 | reg = umac_rl(intf, UMC_CMD); | ||
| 1310 | if (reg & UMC_CMD_SW_RESET) | ||
| 1311 | reg &= ~UMC_CMD_SW_RESET; | ||
| 1312 | |||
| 1313 | reg |= UMC_CMD_RX_EN | UMC_CMD_PROMISC; | ||
| 1314 | umac_wl(intf, reg, UMC_CMD); | ||
| 1315 | |||
| 1310 | umac_enable_set(intf, UMC_CMD_RX_EN, 1); | 1316 | umac_enable_set(intf, UMC_CMD_RX_EN, 1); |
| 1311 | 1317 | ||
| 1312 | if (intf->parent->wol_irq > 0) { | 1318 | if (intf->parent->wol_irq > 0) { |
| @@ -1324,7 +1330,6 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf) · 11 unmodified lines | |||
| 1324 | { | 1330 | { |
| 1325 | struct device *kdev = &intf->parent->pdev->dev; | 1331 | struct device *kdev = &intf->parent->pdev->dev; |
| 1326 | struct net_device *dev = intf->ndev; | 1332 | struct net_device *dev = intf->ndev; |
| 1327 | int ret = 0; | ||
| 1328 | 1333 | ||
| 1329 | if (!netif_running(dev)) | 1334 | if (!netif_running(dev)) |
| 1330 | return 0; | 1335 | return 0; |
| @@ -1334,10 +1339,6 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf) · 3 unmodified lines | |||
| 1334 | bcmasp_netif_deinit(dev); | 1339 | bcmasp_netif_deinit(dev); |
| 1335 | 1340 | ||
| 1336 | if (!intf->wolopts) { | 1341 | if (!intf->wolopts) { |
| 1337 | ret = phy_suspend(dev->phydev); | ||
| 1338 | if (ret) | ||
| 1339 | goto out; | ||
| 1340 | |||
| 1341 | if (intf->internal_phy) | 1342 | if (intf->internal_phy) |
| 1342 | bcmasp_ephy_enable_set(intf, false); | 1343 | bcmasp_ephy_enable_set(intf, false); |
| 1343 | else | 1344 | else |
| @@ -1354,11 +1355,7 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf) · 10 unmodified lines | |||
| 1354 | 1355 | ||
| 1355 | clk_disable_unprepare(intf->parent->clk); | 1356 | clk_disable_unprepare(intf->parent->clk); |
| 1356 | 1357 | ||
| 1357 | return ret; | 1358 | return 0; |
| 1358 | |||
| 1359 | out: | ||
| 1360 | bcmasp_netif_init(dev, false); | ||
| 1361 | return ret; | ||
| 1362 | } | 1359 | } |
| 1363 | 1360 | ||
| 1364 | static void bcmasp_resume_from_wol(struct bcmasp_intf *intf) | 1361 | static void bcmasp_resume_from_wol(struct bcmasp_intf *intf) |
| @@ -85,7 +85,7 @@ int hclge_comm_tqps_update_stats(struct hnae3_handle *handle, · 84 unmodified lines | |||
| 85 | hclge_comm_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_TX_STATS, | 85 | hclge_comm_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_TX_STATS, |
| 86 | true); | 86 | true); |
| 87 | 87 | ||
| 88 | desc.data[0] = cpu_to_le32(tqp->index & 0x1ff); | 88 | desc.data[0] = cpu_to_le32(tqp->index); |
| 89 | ret = hclge_comm_cmd_send(hw, &desc, 1); | 89 | ret = hclge_comm_cmd_send(hw, &desc, 1); |
| 90 | if (ret) { | 90 | if (ret) { |
| 91 | dev_err(&hw->cmq.csq.pdev->dev, | 91 | dev_err(&hw->cmq.csq.pdev->dev, |
| @@ -78,6 +78,9 @@ static const struct hns3_stats hns3_rxq_stats[] = { · 77 unmodified lines | |||
| 78 | #define HNS3_NIC_LB_TEST_NO_MEM_ERR 1 | 78 | #define HNS3_NIC_LB_TEST_NO_MEM_ERR 1 |
| 79 | #define HNS3_NIC_LB_TEST_TX_CNT_ERR 2 | 79 | #define HNS3_NIC_LB_TEST_TX_CNT_ERR 2 |
| 80 | #define HNS3_NIC_LB_TEST_RX_CNT_ERR 3 | 80 | #define HNS3_NIC_LB_TEST_RX_CNT_ERR 3 |
| 81 | #define HNS3_NIC_LB_TEST_UNEXECUTED 4 | ||
| 82 | |||
| 83 | static int hns3_get_sset_count(struct net_device *netdev, int stringset); | ||
| 81 | 84 | ||
| 82 | static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) | 85 | static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) |
| 83 | { | 86 | { |
| @@ -418,18 +421,26 @@ static void hns3_do_external_lb(struct net_device *ndev, · 334 unmodified lines | |||
| 418 | static void hns3_self_test(struct net_device *ndev, | 421 | static void hns3_self_test(struct net_device *ndev, |
| 419 | struct ethtool_test *eth_test, u64 *data) | 422 | struct ethtool_test *eth_test, u64 *data) |
| 420 | { | 423 | { |
| 424 | int cnt = hns3_get_sset_count(ndev, ETH_SS_TEST); | ||
| 421 | struct hns3_nic_priv *priv = netdev_priv(ndev); | 425 | struct hns3_nic_priv *priv = netdev_priv(ndev); |
| 422 | struct hnae3_handle *h = priv->ae_handle; | 426 | struct hnae3_handle *h = priv->ae_handle; |
| 423 | int st_param[HNAE3_LOOP_NONE][2]; | 427 | int st_param[HNAE3_LOOP_NONE][2]; |
| 424 | bool if_running = netif_running(ndev); | 428 | bool if_running = netif_running(ndev); |
| 429 | int i; | ||
| 430 | |||
| 431 | /* initialize the loopback test result, avoid marking an unexcuted | ||
| 432 | * loopback test as PASS. | ||
| 433 | */ | ||
| 434 | for (i = 0; i < cnt; i++) | ||
| 435 | data[i] = HNS3_NIC_LB_TEST_UNEXECUTED; | ||
| 425 | 436 | ||
| 426 | if (hns3_nic_resetting(ndev)) { | 437 | if (hns3_nic_resetting(ndev)) { |
| 427 | netdev_err(ndev, "dev resetting!"); | 438 | netdev_err(ndev, "dev resetting!"); |
| 428 | return; | 439 | goto failure; |
| 429 | } | 440 | } |
| 430 | 441 | ||
| 431 | if (!(eth_test->flags & ETH_TEST_FL_OFFLINE)) | 442 | if (!(eth_test->flags & ETH_TEST_FL_OFFLINE)) |
| 432 | return; | 443 | goto failure; |
| 433 | 444 | ||
| 434 | if (netif_msg_ifdown(h)) | 445 | if (netif_msg_ifdown(h)) |
| 435 | netdev_info(ndev, "self test start\n"); | 446 | netdev_info(ndev, "self test start\n"); |
| @@ -451,6 +462,10 @@ static void hns3_self_test(struct net_device *ndev, · 15 unmodified lines | |||
| 451 | 462 | ||
| 452 | if (netif_msg_ifdown(h)) | 463 | if (netif_msg_ifdown(h)) |
| 453 | netdev_info(ndev, "self test end\n"); | 464 | netdev_info(ndev, "self test end\n"); |
| 465 | return; | ||
| 466 | |||
| 467 | failure: | ||
| 468 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
| 454 | } | 469 | } |
| 455 | 470 | ||
| 456 | static void hns3_update_limit_promisc_mode(struct net_device *netdev, | 471 | static void hns3_update_limit_promisc_mode(struct net_device *netdev, |
| @@ -11626,6 +11626,8 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) · 11625 unmodified lines | |||
| 11626 | if (ret) | 11626 | if (ret) |
| 11627 | goto err_pci_uninit; | 11627 | goto err_pci_uninit; |
| 11628 | 11628 | ||
| 11629 | devl_lock(hdev->devlink); | ||
| 11630 | |||
| 11629 | /* Firmware command queue initialize */ | 11631 | /* Firmware command queue initialize */ |
| 11630 | ret = hclge_comm_cmd_queue_init(hdev->pdev, &hdev->hw.hw); | 11632 | ret = hclge_comm_cmd_queue_init(hdev->pdev, &hdev->hw.hw); |
| 11631 | if (ret) | 11633 | if (ret) |
| @@ -11805,6 +11807,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) · 173 unmodified lines | |||
| 11805 | 11807 | ||
| 11806 | hclge_task_schedule(hdev, round_jiffies_relative(HZ)); | 11808 | hclge_task_schedule(hdev, round_jiffies_relative(HZ)); |
| 11807 | 11809 | ||
| 11810 | devl_unlock(hdev->devlink); | ||
| 11808 | return 0; | 11811 | return 0; |
| 11809 | 11812 | ||
| 11810 | err_mdiobus_unreg: | 11813 | err_mdiobus_unreg: |
| @@ -11817,6 +11820,7 @@ err_msi_uninit: · 6 unmodified lines | |||
| 11817 | err_cmd_uninit: | 11820 | err_cmd_uninit: |
| 11818 | hclge_comm_cmd_uninit(hdev->ae_dev, &hdev->hw.hw); | 11821 | hclge_comm_cmd_uninit(hdev->ae_dev, &hdev->hw.hw); |
| 11819 | err_devlink_uninit: | 11822 | err_devlink_uninit: |
| 11823 | devl_unlock(hdev->devlink); | ||
| 11820 | hclge_devlink_uninit(hdev); | 11824 | hclge_devlink_uninit(hdev); |
| 11821 | err_pci_uninit: | 11825 | err_pci_uninit: |
| 11822 | pcim_iounmap(pdev, hdev->hw.hw.io_base); | 11826 | pcim_iounmap(pdev, hdev->hw.hw.io_base); |
| @@ -593,8 +593,9 @@ struct ice_aqc_recipe_data_elem { · 592 unmodified lines | |||
| 593 | struct ice_aqc_recipe_to_profile { | 593 | struct ice_aqc_recipe_to_profile { |
| 594 | __le16 profile_id; | 594 | __le16 profile_id; |
| 595 | u8 rsvd[6]; | 595 | u8 rsvd[6]; |
| 596 | DECLARE_BITMAP(recipe_assoc, ICE_MAX_NUM_RECIPES); | 596 | __le64 recipe_assoc; |
| 597 | }; | 597 | }; |
| 598 | static_assert(sizeof(struct ice_aqc_recipe_to_profile) == 16); | ||
| 598 | 599 | ||
| 599 | /* Add/Update/Remove/Get switch rules (indirect 0x02A0, 0x02A1, 0x02A2, 0x02A3) | 600 | /* Add/Update/Remove/Get switch rules (indirect 0x02A0, 0x02A1, 0x02A2, 0x02A3) |
| 600 | */ | 601 | */ |
| @@ -2041,7 +2041,7 @@ int ice_init_lag(struct ice_pf *pf) · 2040 unmodified lines | |||
| 2041 | /* associate recipes to profiles */ | 2041 | /* associate recipes to profiles */ |
| 2042 | for (n = 0; n < ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER; n++) { | 2042 | for (n = 0; n < ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER; n++) { |
| 2043 | err = ice_aq_get_recipe_to_profile(&pf->hw, n, | 2043 | err = ice_aq_get_recipe_to_profile(&pf->hw, n, |
| 2044 | (u8 *)&recipe_bits, NULL); | 2044 | &recipe_bits, NULL); |
| 2045 | if (err) | 2045 | if (err) |
| 2046 | continue; | 2046 | continue; |
| 2047 | 2047 | ||
| @@ -2049,7 +2049,7 @@ int ice_init_lag(struct ice_pf *pf) · 1 unmodified line | |||
| 2049 | recipe_bits |= BIT(lag->pf_recipe) | | 2049 | recipe_bits |= BIT(lag->pf_recipe) | |
| 2050 | BIT(lag->lport_recipe); | 2050 | BIT(lag->lport_recipe); |
| 2051 | ice_aq_map_recipe_to_profile(&pf->hw, n, | 2051 | ice_aq_map_recipe_to_profile(&pf->hw, n, |
| 2052 | (u8 *)&recipe_bits, NULL); | 2052 | recipe_bits, NULL); |
| 2053 | } | 2053 | } |
| 2054 | } | 2054 | } |
| 2055 | 2055 | ||
| @@ -3091,7 +3091,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) · 3090 unmodified lines | |||
| 3091 | { | 3091 | { |
| 3092 | struct ice_vsi_cfg_params params = {}; | 3092 | struct ice_vsi_cfg_params params = {}; |
| 3093 | struct ice_coalesce_stored *coalesce; | 3093 | struct ice_coalesce_stored *coalesce; |
| 3094 | int prev_num_q_vectors = 0; | 3094 | int prev_num_q_vectors; |
| 3095 | struct ice_pf *pf; | 3095 | struct ice_pf *pf; |
| 3096 | int ret; | 3096 | int ret; |
| 3097 | 3097 | ||
| @@ -3105,13 +3105,6 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) · 7 unmodified lines | |||
| 3105 | if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf)) | 3105 | if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf)) |
| 3106 | return -EINVAL; | 3106 | return -EINVAL; |
| 3107 | 3107 | ||
| 3108 | coalesce = kcalloc(vsi->num_q_vectors, | ||
| 3109 | sizeof(struct ice_coalesce_stored), GFP_KERNEL); | ||
| 3110 | if (!coalesce) | ||
| 3111 | return -ENOMEM; | ||
| 3112 | |||
| 3113 | prev_num_q_vectors = ice_vsi_rebuild_get_coalesce(vsi, coalesce); | ||
| 3114 | |||
| 3115 | ret = ice_vsi_realloc_stat_arrays(vsi); | 3108 | ret = ice_vsi_realloc_stat_arrays(vsi); |
| 3116 | if (ret) | 3109 | if (ret) |
| 3117 | goto err_vsi_cfg; | 3110 | goto err_vsi_cfg; |
| @@ -3121,6 +3114,13 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) · 3 unmodified lines | |||
| 3121 | if (ret) | 3114 | if (ret) |
| 3122 | goto err_vsi_cfg; | 3115 | goto err_vsi_cfg; |
| 3123 | 3116 | ||
| 3117 | coalesce = kcalloc(vsi->num_q_vectors, | ||
| 3118 | sizeof(struct ice_coalesce_stored), GFP_KERNEL); | ||
| 3119 | if (!coalesce) | ||
| 3120 | return -ENOMEM; | ||
| 3121 | |||
| 3122 | prev_num_q_vectors = ice_vsi_rebuild_get_coalesce(vsi, coalesce); | ||
| 3123 | |||
| 3124 | ret = ice_vsi_cfg_tc_lan(pf, vsi); | 3124 | ret = ice_vsi_cfg_tc_lan(pf, vsi); |
| 3125 | if (ret) { | 3125 | if (ret) { |
| 3126 | if (vsi_flags & ICE_VSI_FLAG_INIT) { | 3126 | if (vsi_flags & ICE_VSI_FLAG_INIT) { |
| @@ -3139,8 +3139,8 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) · 12 unmodified lines | |||
| 3139 | 3139 | ||
| 3140 | err_vsi_cfg_tc_lan: | 3140 | err_vsi_cfg_tc_lan: |
| 3141 | ice_vsi_decfg(vsi); | 3141 | ice_vsi_decfg(vsi); |
| 3142 | err_vsi_cfg: | ||
| 3143 | kfree(coalesce); | 3142 | kfree(coalesce); |
| 3143 | err_vsi_cfg: | ||
| 3144 | return ret; | 3144 | return ret; |
| 3145 | } | 3145 | } |
| 3146 | 3146 | ||
| @@ -2025,12 +2025,12 @@ error_out: · 2024 unmodified lines | |||
| 2025 | * ice_aq_map_recipe_to_profile - Map recipe to packet profile | 2025 | * ice_aq_map_recipe_to_profile - Map recipe to packet profile |
| 2026 | * @hw: pointer to the HW struct | 2026 | * @hw: pointer to the HW struct |
| 2027 | * @profile_id: package profile ID to associate the recipe with | 2027 | * @profile_id: package profile ID to associate the recipe with |
| 2028 | * @r_bitmap: Recipe bitmap filled in and need to be returned as response | 2028 | * @r_assoc: Recipe bitmap filled in and need to be returned as response |
| 2029 | * @cd: pointer to command details structure or NULL | 2029 | * @cd: pointer to command details structure or NULL |
| 2030 | * Recipe to profile association (0x0291) | 2030 | * Recipe to profile association (0x0291) |
| 2031 | */ | 2031 | */ |
| 2032 | int | 2032 | int |
| 2033 | ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, | 2033 | ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 r_assoc, |
| 2034 | struct ice_sq_cd *cd) | 2034 | struct ice_sq_cd *cd) |
| 2035 | { | 2035 | { |
| 2036 | struct ice_aqc_recipe_to_profile *cmd; | 2036 | struct ice_aqc_recipe_to_profile *cmd; |
| @@ -2042,7 +2042,7 @@ ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, · 5 unmodified lines | |||
| 2042 | /* Set the recipe ID bit in the bitmask to let the device know which | 2042 | /* Set the recipe ID bit in the bitmask to let the device know which |
| 2043 | * profile we are associating the recipe to | 2043 | * profile we are associating the recipe to |
| 2044 | */ | 2044 | */ |
| 2045 | memcpy(cmd->recipe_assoc, r_bitmap, sizeof(cmd->recipe_assoc)); | 2045 | cmd->recipe_assoc = cpu_to_le64(r_assoc); |
| 2046 | 2046 | ||
| 2047 | return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); | 2047 | return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); |
| 2048 | } | 2048 | } |
| @@ -2051,12 +2051,12 @@ ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, · 2 unmodified lines | |||
| 2051 | * ice_aq_get_recipe_to_profile - Map recipe to packet profile | 2051 | * ice_aq_get_recipe_to_profile - Map recipe to packet profile |
| 2052 | * @hw: pointer to the HW struct | 2052 | * @hw: pointer to the HW struct |
| 2053 | * @profile_id: package profile ID to associate the recipe with | 2053 | * @profile_id: package profile ID to associate the recipe with |
| 2054 | * @r_bitmap: Recipe bitmap filled in and need to be returned as response | 2054 | * @r_assoc: Recipe bitmap filled in and need to be returned as response |
| 2055 | * @cd: pointer to command details structure or NULL | 2055 | * @cd: pointer to command details structure or NULL |
| 2056 | * Associate profile ID with given recipe (0x0293) | 2056 | * Associate profile ID with given recipe (0x0293) |
| 2057 | */ | 2057 | */ |
| 2058 | int | 2058 | int |
| 2059 | ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, | 2059 | ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 *r_assoc, |
| 2060 | struct ice_sq_cd *cd) | 2060 | struct ice_sq_cd *cd) |
| 2061 | { | 2061 | { |
| 2062 | struct ice_aqc_recipe_to_profile *cmd; | 2062 | struct ice_aqc_recipe_to_profile *cmd; |
| @@ -2069,7 +2069,7 @@ ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, · 6 unmodified lines | |||
| 2069 | 2069 | ||
| 2070 | status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd); | 2070 | status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd); |
| 2071 | if (!status) | 2071 | if (!status) |
| 2072 | memcpy(r_bitmap, cmd->recipe_assoc, sizeof(cmd->recipe_assoc)); | 2072 | *r_assoc = le64_to_cpu(cmd->recipe_assoc); |
| 2073 | 2073 | ||
| 2074 | return status; | 2074 | return status; |
| 2075 | } | 2075 | } |
| @@ -2108,6 +2108,7 @@ int ice_alloc_recipe(struct ice_hw *hw, u16 *rid) · 32 unmodified lines | |||
| 2108 | static void ice_get_recp_to_prof_map(struct ice_hw *hw) | 2108 | static void ice_get_recp_to_prof_map(struct ice_hw *hw) |
| 2109 | { | 2109 | { |
| 2110 | DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); | 2110 | DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); |
| 2111 | u64 recp_assoc; | ||
| 2111 | u16 i; | 2112 | u16 i; |
| 2112 | 2113 | ||
| 2113 | for (i = 0; i < hw->switch_info->max_used_prof_index + 1; i++) { | 2114 | for (i = 0; i < hw->switch_info->max_used_prof_index + 1; i++) { |
| @@ -2115,8 +2116,9 @@ static void ice_get_recp_to_prof_map(struct ice_hw *hw) · 1 unmodified line | |||
| 2115 | 2116 | ||
| 2116 | bitmap_zero(profile_to_recipe[i], ICE_MAX_NUM_RECIPES); | 2117 | bitmap_zero(profile_to_recipe[i], ICE_MAX_NUM_RECIPES); |
| 2117 | bitmap_zero(r_bitmap, ICE_MAX_NUM_RECIPES); | 2118 | bitmap_zero(r_bitmap, ICE_MAX_NUM_RECIPES); |
| 2118 | if (ice_aq_get_recipe_to_profile(hw, i, (u8 *)r_bitmap, NULL)) | 2119 | if (ice_aq_get_recipe_to_profile(hw, i, &recp_assoc, NULL)) |
| 2119 | continue; | 2120 | continue; |
| 2121 | bitmap_from_arr64(r_bitmap, &recp_assoc, ICE_MAX_NUM_RECIPES); | ||
| 2120 | bitmap_copy(profile_to_recipe[i], r_bitmap, | 2122 | bitmap_copy(profile_to_recipe[i], r_bitmap, |
| 2121 | ICE_MAX_NUM_RECIPES); | 2123 | ICE_MAX_NUM_RECIPES); |
| 2122 | for_each_set_bit(j, r_bitmap, ICE_MAX_NUM_RECIPES) | 2124 | for_each_set_bit(j, r_bitmap, ICE_MAX_NUM_RECIPES) |
| @@ -5390,22 +5392,24 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 3267 unmodified lines | |||
| 5390 | */ | 5392 | */ |
| 5391 | list_for_each_entry(fvit, &rm->fv_list, list_entry) { | 5393 | list_for_each_entry(fvit, &rm->fv_list, list_entry) { |
| 5392 | DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); | 5394 | DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); |
| 5395 | u64 recp_assoc; | ||
| 5393 | u16 j; | 5396 | u16 j; |
| 5394 | 5397 | ||
| 5395 | status = ice_aq_get_recipe_to_profile(hw, fvit->profile_id, | 5398 | status = ice_aq_get_recipe_to_profile(hw, fvit->profile_id, |
| 5396 | (u8 *)r_bitmap, NULL); | 5399 | &recp_assoc, NULL); |
| 5397 | if (status) | 5400 | if (status) |
| 5398 | goto err_unroll; | 5401 | goto err_unroll; |
| 5399 | 5402 | ||
| 5403 | bitmap_from_arr64(r_bitmap, &recp_assoc, ICE_MAX_NUM_RECIPES); | ||
| 5400 | bitmap_or(r_bitmap, r_bitmap, rm->r_bitmap, | 5404 | bitmap_or(r_bitmap, r_bitmap, rm->r_bitmap, |
| 5401 | ICE_MAX_NUM_RECIPES); | 5405 | ICE_MAX_NUM_RECIPES); |
| 5402 | status = ice_acquire_change_lock(hw, ICE_RES_WRITE); | 5406 | status = ice_acquire_change_lock(hw, ICE_RES_WRITE); |
| 5403 | if (status) | 5407 | if (status) |
| 5404 | goto err_unroll; | 5408 | goto err_unroll; |
| 5405 | 5409 | ||
| 5410 | bitmap_to_arr64(&recp_assoc, r_bitmap, ICE_MAX_NUM_RECIPES); | ||
| 5406 | status = ice_aq_map_recipe_to_profile(hw, fvit->profile_id, | 5411 | status = ice_aq_map_recipe_to_profile(hw, fvit->profile_id, |
| 5407 | (u8 *)r_bitmap, | 5412 | recp_assoc, NULL); |
| 5408 | NULL); | ||
| 5409 | ice_release_change_lock(hw); | 5413 | ice_release_change_lock(hw); |
| 5410 | 5414 | ||
| 5411 | if (status) | 5415 | if (status) |
| @@ -424,10 +424,10 @@ int ice_aq_add_recipe(struct ice_hw *hw, · 423 unmodified lines | |||
| 424 | struct ice_aqc_recipe_data_elem *s_recipe_list, | 424 | struct ice_aqc_recipe_data_elem *s_recipe_list, |
| 425 | u16 num_recipes, struct ice_sq_cd *cd); | 425 | u16 num_recipes, struct ice_sq_cd *cd); |
| 426 | int | 426 | int |
| 427 | ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, | 427 | ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 *r_assoc, |
| 428 | struct ice_sq_cd *cd); | 428 | struct ice_sq_cd *cd); |
| 429 | int | 429 | int |
| 430 | ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, | 430 | ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 r_assoc, |
| 431 | struct ice_sq_cd *cd); | 431 | struct ice_sq_cd *cd); |
| 432 | 432 | ||
| 433 | #endif /* _ICE_SWITCH_H_ */ | 433 | #endif /* _ICE_SWITCH_H_ */ |
| @@ -1642,10 +1642,6 @@ done: · 1641 unmodified lines | |||
| 1642 | 1642 | ||
| 1643 | if (unlikely(test_bit(IGC_RING_FLAG_TX_HWTSTAMP, &tx_ring->flags) && | 1643 | if (unlikely(test_bit(IGC_RING_FLAG_TX_HWTSTAMP, &tx_ring->flags) && |
| 1644 | skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { | 1644 | skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { |
| 1645 | /* FIXME: add support for retrieving timestamps from | ||
| 1646 | * the other timer registers before skipping the | ||
| 1647 | * timestamping request. | ||
| 1648 | */ | ||
| 1649 | unsigned long flags; | 1645 | unsigned long flags; |
| 1650 | u32 tstamp_flags; | 1646 | u32 tstamp_flags; |
| 1651 | 1647 | ||
| @@ -914,7 +914,13 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) · 913 unmodified lines | |||
| 914 | goto err_out; | 914 | goto err_out; |
| 915 | } | 915 | } |
| 916 | 916 | ||
| 917 | xs = kzalloc(sizeof(*xs), GFP_KERNEL); | 917 | algo = xfrm_aead_get_byname(aes_gcm_name, IXGBE_IPSEC_AUTH_BITS, 1); |
| 918 | if (unlikely(!algo)) { | ||
| 919 | err = -ENOENT; | ||
| 920 | goto err_out; | ||
| 921 | } | ||
| 922 | |||
| 923 | xs = kzalloc(sizeof(*xs), GFP_ATOMIC); | ||
| 918 | if (unlikely(!xs)) { | 924 | if (unlikely(!xs)) { |
| 919 | err = -ENOMEM; | 925 | err = -ENOMEM; |
| 920 | goto err_out; | 926 | goto err_out; |
| @@ -930,14 +936,8 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) · 9 unmodified lines | |||
| 930 | memcpy(&xs->id.daddr.a4, sam->addr, sizeof(xs->id.daddr.a4)); | 936 | memcpy(&xs->id.daddr.a4, sam->addr, sizeof(xs->id.daddr.a4)); |
| 931 | xs->xso.dev = adapter->netdev; | 937 | xs->xso.dev = adapter->netdev; |
| 932 | 938 | ||
| 933 | algo = xfrm_aead_get_byname(aes_gcm_name, IXGBE_IPSEC_AUTH_BITS, 1); | ||
| 934 | if (unlikely(!algo)) { | ||
| 935 | err = -ENOENT; | ||
| 936 | goto err_xs; | ||
| 937 | } | ||
| 938 | |||
| 939 | aead_len = sizeof(*xs->aead) + IXGBE_IPSEC_KEY_BITS / 8; | 939 | aead_len = sizeof(*xs->aead) + IXGBE_IPSEC_KEY_BITS / 8; |
| 940 | xs->aead = kzalloc(aead_len, GFP_KERNEL); | 940 | xs->aead = kzalloc(aead_len, GFP_ATOMIC); |
| 941 | if (unlikely(!xs->aead)) { | 941 | if (unlikely(!xs->aead)) { |
| 942 | err = -ENOMEM; | 942 | err = -ENOMEM; |
| 943 | goto err_xs; | 943 | goto err_xs; |
| @@ -808,6 +808,11 @@ static int cgx_lmac_enadis_pause_frm(void *cgxd, int lmac_id, · 807 unmodified lines | |||
| 808 | if (!is_lmac_valid(cgx, lmac_id)) | 808 | if (!is_lmac_valid(cgx, lmac_id)) |
| 809 | return -ENODEV; | 809 | return -ENODEV; |
| 810 | 810 | ||
| 811 | cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL); | ||
| 812 | cfg &= ~CGX_GMP_GMI_RXX_FRM_CTL_CTL_BCK; | ||
| 813 | cfg |= rx_pause ? CGX_GMP_GMI_RXX_FRM_CTL_CTL_BCK : 0x0; | ||
| 814 | cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg); | ||
| 815 | |||
| 811 | cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); | 816 | cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL); |
| 812 | cfg &= ~CGX_SMUX_RX_FRM_CTL_CTL_BCK; | 817 | cfg &= ~CGX_SMUX_RX_FRM_CTL_CTL_BCK; |
| 813 | cfg |= rx_pause ? CGX_SMUX_RX_FRM_CTL_CTL_BCK : 0x0; | 818 | cfg |= rx_pause ? CGX_SMUX_RX_FRM_CTL_CTL_BCK : 0x0; |
| @@ -139,13 +139,10 @@ static int mlxbf_gige_open(struct net_device *netdev) · 138 unmodified lines | |||
| 139 | control |= MLXBF_GIGE_CONTROL_PORT_EN; | 139 | control |= MLXBF_GIGE_CONTROL_PORT_EN; |
| 140 | writeq(control, priv->base + MLXBF_GIGE_CONTROL); | 140 | writeq(control, priv->base + MLXBF_GIGE_CONTROL); |
| 141 | 141 | ||
| 142 | err = mlxbf_gige_request_irqs(priv); | ||
| 143 | if (err) | ||
| 144 | return err; | ||
| 145 | mlxbf_gige_cache_stats(priv); | 142 | mlxbf_gige_cache_stats(priv); |
| 146 | err = mlxbf_gige_clean_port(priv); | 143 | err = mlxbf_gige_clean_port(priv); |
| 147 | if (err) | 144 | if (err) |
| 148 | goto free_irqs; | 145 | return err; |
| 149 | 146 | ||
| 150 | /* Clear driver's valid_polarity to match hardware, | 147 | /* Clear driver's valid_polarity to match hardware, |
| 151 | * since the above call to clean_port() resets the | 148 | * since the above call to clean_port() resets the |
| @@ -157,7 +154,7 @@ static int mlxbf_gige_open(struct net_device *netdev) · 5 unmodified lines | |||
| 157 | 154 | ||
| 158 | err = mlxbf_gige_tx_init(priv); | 155 | err = mlxbf_gige_tx_init(priv); |
| 159 | if (err) | 156 | if (err) |
| 160 | goto free_irqs; | 157 | goto phy_deinit; |
| 161 | err = mlxbf_gige_rx_init(priv); | 158 | err = mlxbf_gige_rx_init(priv); |
| 162 | if (err) | 159 | if (err) |
| 163 | goto tx_deinit; | 160 | goto tx_deinit; |
| @@ -166,6 +163,10 @@ static int mlxbf_gige_open(struct net_device *netdev) · 2 unmodified lines | |||
| 166 | napi_enable(&priv->napi); | 163 | napi_enable(&priv->napi); |
| 167 | netif_start_queue(netdev); | 164 | netif_start_queue(netdev); |
| 168 | 165 | ||
| 166 | err = mlxbf_gige_request_irqs(priv); | ||
| 167 | if (err) | ||
| 168 | goto napi_deinit; | ||
| 169 | |||
| 169 | /* Set bits in INT_EN that we care about */ | 170 | /* Set bits in INT_EN that we care about */ |
| 170 | int_en = MLXBF_GIGE_INT_EN_HW_ACCESS_ERROR | | 171 | int_en = MLXBF_GIGE_INT_EN_HW_ACCESS_ERROR | |
| 171 | MLXBF_GIGE_INT_EN_TX_CHECKSUM_INPUTS | | 172 | MLXBF_GIGE_INT_EN_TX_CHECKSUM_INPUTS | |
| @@ -182,11 +183,17 @@ static int mlxbf_gige_open(struct net_device *netdev) · 10 unmodified lines | |||
| 182 | 183 | ||
| 183 | return 0; | 184 | return 0; |
| 184 | 185 | ||
| 186 | napi_deinit: | ||
| 187 | netif_stop_queue(netdev); | ||
| 188 | napi_disable(&priv->napi); | ||
| 189 | netif_napi_del(&priv->napi); | ||
| 190 | mlxbf_gige_rx_deinit(priv); | ||
| 191 | |||
| 185 | tx_deinit: | 192 | tx_deinit: |
| 186 | mlxbf_gige_tx_deinit(priv); | 193 | mlxbf_gige_tx_deinit(priv); |
| 187 | 194 | ||
| 188 | free_irqs: | 195 | phy_deinit: |
| 189 | mlxbf_gige_free_irqs(priv); | 196 | phy_stop(phydev); |
| 190 | return err; | 197 | return err; |
| 191 | } | 198 | } |
| 192 | 199 | ||
| @@ -25,6 +25,8 @@ · 24 unmodified lines | |||
| 25 | #define PCS_POWER_STATE_DOWN 0x6 | 25 | #define PCS_POWER_STATE_DOWN 0x6 |
| 26 | #define PCS_POWER_STATE_UP 0x4 | 26 | #define PCS_POWER_STATE_UP 0x4 |
| 27 | 27 | ||
| 28 | #define RFE_RD_FIFO_TH_3_DWORDS 0x3 | ||
| 29 | |||
| 28 | static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter) | 30 | static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter) |
| 29 | { | 31 | { |
| 30 | u32 chip_rev; | 32 | u32 chip_rev; |
| @@ -3272,6 +3274,21 @@ static void lan743x_full_cleanup(struct lan743x_adapter *adapter) · 3241 unmodified lines | |||
| 3272 | lan743x_pci_cleanup(adapter); | 3274 | lan743x_pci_cleanup(adapter); |
| 3273 | } | 3275 | } |
| 3274 | 3276 | ||
| 3277 | static void pci11x1x_set_rfe_rd_fifo_threshold(struct lan743x_adapter *adapter) | ||
| 3278 | { | ||
| 3279 | u16 rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_; | ||
| 3280 | |||
| 3281 | if (rev == ID_REV_CHIP_REV_PCI11X1X_B0_) { | ||
| 3282 | u32 misc_ctl; | ||
| 3283 | |||
| 3284 | misc_ctl = lan743x_csr_read(adapter, MISC_CTL_0); | ||
| 3285 | misc_ctl &= ~MISC_CTL_0_RFE_READ_FIFO_MASK_; | ||
| 3286 | misc_ctl |= FIELD_PREP(MISC_CTL_0_RFE_READ_FIFO_MASK_, | ||
| 3287 | RFE_RD_FIFO_TH_3_DWORDS); | ||
| 3288 | lan743x_csr_write(adapter, MISC_CTL_0, misc_ctl); | ||
| 3289 | } | ||
| 3290 | } | ||
| 3291 | |||
| 3275 | static int lan743x_hardware_init(struct lan743x_adapter *adapter, | 3292 | static int lan743x_hardware_init(struct lan743x_adapter *adapter, |
| 3276 | struct pci_dev *pdev) | 3293 | struct pci_dev *pdev) |
| 3277 | { | 3294 | { |
| @@ -3287,6 +3304,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter, · 9 unmodified lines | |||
| 3287 | pci11x1x_strap_get_status(adapter); | 3304 | pci11x1x_strap_get_status(adapter); |
| 3288 | spin_lock_init(&adapter->eth_syslock_spinlock); | 3305 | spin_lock_init(&adapter->eth_syslock_spinlock); |
| 3289 | mutex_init(&adapter->sgmii_rw_lock); | 3306 | mutex_init(&adapter->sgmii_rw_lock); |
| 3307 | pci11x1x_set_rfe_rd_fifo_threshold(adapter); | ||
| 3290 | } else { | 3308 | } else { |
| 3291 | adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS; | 3309 | adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS; |
| 3292 | adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS; | 3310 | adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS; |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | |||
| 26 | #define ID_REV_CHIP_REV_MASK_ (0x0000FFFF) | 26 | #define ID_REV_CHIP_REV_MASK_ (0x0000FFFF) |
| 27 | #define ID_REV_CHIP_REV_A0_ (0x00000000) | 27 | #define ID_REV_CHIP_REV_A0_ (0x00000000) |
| 28 | #define ID_REV_CHIP_REV_B0_ (0x00000010) | 28 | #define ID_REV_CHIP_REV_B0_ (0x00000010) |
| 29 | #define ID_REV_CHIP_REV_PCI11X1X_B0_ (0x000000B0) | ||
| 29 | 30 | ||
| 30 | #define FPGA_REV (0x04) | 31 | #define FPGA_REV (0x04) |
| 31 | #define FPGA_REV_GET_MINOR_(fpga_rev) (((fpga_rev) >> 8) & 0x000000FF) | 32 | #define FPGA_REV_GET_MINOR_(fpga_rev) (((fpga_rev) >> 8) & 0x000000FF) |
| @@ -311,6 +312,9 @@ · 279 unmodified lines | |||
| 311 | #define SGMII_CTL_LINK_STATUS_SOURCE_ BIT(8) | 312 | #define SGMII_CTL_LINK_STATUS_SOURCE_ BIT(8) |
| 312 | #define SGMII_CTL_SGMII_POWER_DN_ BIT(1) | 313 | #define SGMII_CTL_SGMII_POWER_DN_ BIT(1) |
| 313 | 314 | ||
| 315 | #define MISC_CTL_0 (0x920) | ||
| 316 | #define MISC_CTL_0_RFE_READ_FIFO_MASK_ GENMASK(6, 4) | ||
| 317 | |||
| 314 | /* Vendor Specific SGMII MMD details */ | 318 | /* Vendor Specific SGMII MMD details */ |
| 315 | #define SR_VSMMD_PCS_ID1 0x0004 | 319 | #define SR_VSMMD_PCS_ID1 0x0004 |
| 316 | #define SR_VSMMD_PCS_ID2 0x0005 | 320 | #define SR_VSMMD_PCS_ID2 0x0005 |
| @@ -50,7 +50,7 @@ · 49 unmodified lines | |||
| 50 | * the macros available to do this only define GCC 8. | 50 | * the macros available to do this only define GCC 8. |
| 51 | */ | 51 | */ |
| 52 | __diag_push(); | 52 | __diag_push(); |
| 53 | __diag_ignore(GCC, 8, "-Woverride-init", | 53 | __diag_ignore_all("-Woverride-init", |
| 54 | "logic to initialize all and then override some is OK"); | 54 | "logic to initialize all and then override some is OK"); |
| 55 | static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = { | 55 | static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = { |
| 56 | SH_ETH_OFFSET_DEFAULTS, | 56 | SH_ETH_OFFSET_DEFAULTS, |
| @@ -1443,7 +1443,7 @@ static int temac_probe(struct platform_device *pdev) · 1442 unmodified lines | |||
| 1443 | } | 1443 | } |
| 1444 | 1444 | ||
| 1445 | /* map device registers */ | 1445 | /* map device registers */ |
| 1446 | lp->regs = devm_platform_ioremap_resource_byname(pdev, 0); | 1446 | lp->regs = devm_platform_ioremap_resource(pdev, 0); |
| 1447 | if (IS_ERR(lp->regs)) { | 1447 | if (IS_ERR(lp->regs)) { |
| 1448 | dev_err(&pdev->dev, "could not map TEMAC registers\n"); | 1448 | dev_err(&pdev->dev, "could not map TEMAC registers\n"); |
| 1449 | return -ENOMEM; | 1449 | return -ENOMEM; |
| @@ -797,7 +797,7 @@ static int at8031_parse_dt(struct phy_device *phydev) · 796 unmodified lines | |||
| 797 | 797 | ||
| 798 | static int at8031_probe(struct phy_device *phydev) | 798 | static int at8031_probe(struct phy_device *phydev) |
| 799 | { | 799 | { |
| 800 | struct at803x_priv *priv = phydev->priv; | 800 | struct at803x_priv *priv; |
| 801 | int mode_cfg; | 801 | int mode_cfg; |
| 802 | int ccr; | 802 | int ccr; |
| 803 | int ret; | 803 | int ret; |
| @@ -806,6 +806,8 @@ static int at8031_probe(struct phy_device *phydev) · 2 unmodified lines | |||
| 806 | if (ret) | 806 | if (ret) |
| 807 | return ret; | 807 | return ret; |
| 808 | 808 | ||
| 809 | priv = phydev->priv; | ||
| 810 | |||
| 809 | /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping | 811 | /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping |
| 810 | * options. | 812 | * options. |
| 811 | */ | 813 | */ |
| @@ -3081,8 +3081,6 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx) · 3080 unmodified lines | |||
| 3081 | struct iwl_fw_dbg_params params = {0}; | 3081 | struct iwl_fw_dbg_params params = {0}; |
| 3082 | struct iwl_fwrt_dump_data *dump_data = | 3082 | struct iwl_fwrt_dump_data *dump_data = |
| 3083 | &fwrt->dump.wks[wk_idx].dump_data; | 3083 | &fwrt->dump.wks[wk_idx].dump_data; |
| 3084 | u32 policy; | ||
| 3085 | u32 time_point; | ||
| 3086 | if (!test_bit(wk_idx, &fwrt->dump.active_wks)) | 3084 | if (!test_bit(wk_idx, &fwrt->dump.active_wks)) |
| 3087 | return; | 3085 | return; |
| 3088 | 3086 | ||
| @@ -3113,13 +3111,16 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx) · 24 unmodified lines | |||
| 3113 | 3111 | ||
| 3114 | iwl_fw_dbg_stop_restart_recording(fwrt, ¶ms, false); | 3112 | iwl_fw_dbg_stop_restart_recording(fwrt, ¶ms, false); |
| 3115 | 3113 | ||
| 3116 | policy = le32_to_cpu(dump_data->trig->apply_policy); | 3114 | if (iwl_trans_dbg_ini_valid(fwrt->trans)) { |
| 3117 | time_point = le32_to_cpu(dump_data->trig->time_point); | 3115 | u32 policy = le32_to_cpu(dump_data->trig->apply_policy); |
| 3116 | u32 time_point = le32_to_cpu(dump_data->trig->time_point); | ||
| 3118 | 3117 | ||
| 3119 | if (policy & IWL_FW_INI_APPLY_POLICY_DUMP_COMPLETE_CMD) { | 3118 | if (policy & IWL_FW_INI_APPLY_POLICY_DUMP_COMPLETE_CMD) { |
| 3120 | IWL_DEBUG_FW_INFO(fwrt, "WRT: sending dump complete\n"); | 3119 | IWL_DEBUG_FW_INFO(fwrt, "WRT: sending dump complete\n"); |
| 3121 | iwl_send_dbg_dump_complete_cmd(fwrt, time_point, 0); | 3120 | iwl_send_dbg_dump_complete_cmd(fwrt, time_point, 0); |
| 3121 | } | ||
| 3122 | } | 3122 | } |
| 3123 | |||
| 3123 | if (fwrt->trans->dbg.last_tp_resetfw == IWL_FW_INI_RESET_FW_MODE_STOP_FW_ONLY) | 3124 | if (fwrt->trans->dbg.last_tp_resetfw == IWL_FW_INI_RESET_FW_MODE_STOP_FW_ONLY) |
| 3124 | iwl_force_nmi(fwrt->trans); | 3125 | iwl_force_nmi(fwrt->trans); |
| 3125 | 3126 | ||
| @@ -1260,15 +1260,15 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 1259 unmodified lines | |||
| 1260 | if (IS_ERR_OR_NULL(vif)) | 1260 | if (IS_ERR_OR_NULL(vif)) |
| 1261 | return 1; | 1261 | return 1; |
| 1262 | 1262 | ||
| 1263 | if (ieee80211_vif_is_mld(vif) && vif->cfg.assoc) { | 1263 | if (hweight16(vif->active_links) > 1) { |
| 1264 | /* | 1264 | /* |
| 1265 | * Select the 'best' link. May need to revisit, it seems | 1265 | * Select the 'best' link. |
| 1266 | * better to not optimize for throughput but rather range, | 1266 | * May need to revisit, it seems better to not optimize |
| 1267 | * reliability and power here - and select 2.4 GHz ... | 1267 | * for throughput but rather range, reliability and |
| 1268 | * power here - and select 2.4 GHz ... | ||
| 1268 | */ | 1269 | */ |
| 1269 | primary_link = | 1270 | primary_link = iwl_mvm_mld_get_primary_link(mvm, vif, |
| 1270 | iwl_mvm_mld_get_primary_link(mvm, vif, | 1271 | vif->active_links); |
| 1271 | vif->active_links); | ||
| 1272 | 1272 | ||
| 1273 | if (WARN_ONCE(primary_link < 0, "no primary link in 0x%x\n", | 1273 | if (WARN_ONCE(primary_link < 0, "no primary link in 0x%x\n", |
| 1274 | vif->active_links)) | 1274 | vif->active_links)) |
| @@ -1277,6 +1277,8 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 2 unmodified lines | |||
| 1277 | ret = ieee80211_set_active_links(vif, BIT(primary_link)); | 1277 | ret = ieee80211_set_active_links(vif, BIT(primary_link)); |
| 1278 | if (ret) | 1278 | if (ret) |
| 1279 | return ret; | 1279 | return ret; |
| 1280 | } else if (vif->active_links) { | ||
| 1281 | primary_link = __ffs(vif->active_links); | ||
| 1280 | } else { | 1282 | } else { |
| 1281 | primary_link = 0; | 1283 | primary_link = 0; |
| 1282 | } | 1284 | } |
| @@ -748,7 +748,9 @@ void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 747 unmodified lines | |||
| 748 | { | 748 | { |
| 749 | struct dentry *dbgfs_dir = vif->debugfs_dir; | 749 | struct dentry *dbgfs_dir = vif->debugfs_dir; |
| 750 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 750 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 751 | char buf[100]; | 751 | char buf[3 * 3 + 11 + (NL80211_WIPHY_NAME_MAXLEN + 1) + |
| 752 | (7 + IFNAMSIZ + 1) + 6 + 1]; | ||
| 753 | char name[7 + IFNAMSIZ + 1]; | ||
| 752 | 754 | ||
| 753 | /* this will happen in monitor mode */ | 755 | /* this will happen in monitor mode */ |
| 754 | if (!dbgfs_dir) | 756 | if (!dbgfs_dir) |
| @@ -761,10 +763,11 @@ void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 6 unmodified lines | |||
| 761 | * find | 763 | * find |
| 762 | * netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/ | 764 | * netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/ |
| 763 | */ | 765 | */ |
| 764 | snprintf(buf, 100, "../../../%pd3/iwlmvm", dbgfs_dir); | 766 | snprintf(name, sizeof(name), "%pd", dbgfs_dir); |
| 767 | snprintf(buf, sizeof(buf), "../../../%pd3/iwlmvm", dbgfs_dir); | ||
| 765 | 768 | ||
| 766 | mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name, | 769 | mvmvif->dbgfs_slink = |
| 767 | mvm->debugfs_dir, buf); | 770 | debugfs_create_symlink(name, mvm->debugfs_dir, buf); |
| 768 | } | 771 | } |
| 769 | 772 | ||
| 770 | void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | 773 | void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
| @@ -46,6 +46,27 @@ static int iwl_mvm_link_cmd_send(struct iwl_mvm *mvm, · 45 unmodified lines | |||
| 46 | return ret; | 46 | return ret; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | int iwl_mvm_set_link_mapping(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
| 50 | struct ieee80211_bss_conf *link_conf) | ||
| 51 | { | ||
| 52 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
| 53 | struct iwl_mvm_vif_link_info *link_info = | ||
| 54 | mvmvif->link[link_conf->link_id]; | ||
| 55 | |||
| 56 | if (link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID) { | ||
| 57 | link_info->fw_link_id = iwl_mvm_get_free_fw_link_id(mvm, | ||
| 58 | mvmvif); | ||
| 59 | if (link_info->fw_link_id >= | ||
| 60 | ARRAY_SIZE(mvm->link_id_to_link_conf)) | ||
| 61 | return -EINVAL; | ||
| 62 | |||
| 63 | rcu_assign_pointer(mvm->link_id_to_link_conf[link_info->fw_link_id], | ||
| 64 | link_conf); | ||
| 65 | } | ||
| 66 | |||
| 67 | return 0; | ||
| 68 | } | ||
| 69 | |||
| 49 | int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 70 | int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 50 | struct ieee80211_bss_conf *link_conf) | 71 | struct ieee80211_bss_conf *link_conf) |
| 51 | { | 72 | { |
| @@ -55,19 +76,14 @@ int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 3 unmodified lines | |||
| 55 | struct iwl_link_config_cmd cmd = {}; | 76 | struct iwl_link_config_cmd cmd = {}; |
| 56 | unsigned int cmd_id = WIDE_ID(MAC_CONF_GROUP, LINK_CONFIG_CMD); | 77 | unsigned int cmd_id = WIDE_ID(MAC_CONF_GROUP, LINK_CONFIG_CMD); |
| 57 | u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1); | 78 | u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1); |
| 79 | int ret; | ||
| 58 | 80 | ||
| 59 | if (WARN_ON_ONCE(!link_info)) | 81 | if (WARN_ON_ONCE(!link_info)) |
| 60 | return -EINVAL; | 82 | return -EINVAL; |
| 61 | 83 | ||
| 62 | if (link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID) { | 84 | ret = iwl_mvm_set_link_mapping(mvm, vif, link_conf); |
| 63 | link_info->fw_link_id = iwl_mvm_get_free_fw_link_id(mvm, | 85 | if (ret) |
| 64 | mvmvif); | 86 | return ret; |
| 65 | if (link_info->fw_link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf)) | ||
| 66 | return -EINVAL; | ||
| 67 | |||
| 68 | rcu_assign_pointer(mvm->link_id_to_link_conf[link_info->fw_link_id], | ||
| 69 | link_conf); | ||
| 70 | } | ||
| 71 | 87 | ||
| 72 | /* Update SF - Disable if needed. if this fails, SF might still be on | 88 | /* Update SF - Disable if needed. if this fails, SF might still be on |
| 73 | * while many macs are bound, which is forbidden - so fail the binding. | 89 | * while many macs are bound, which is forbidden - so fail the binding. |
| @@ -248,6 +264,24 @@ send_cmd: · 174 unmodified lines | |||
| 248 | return ret; | 264 | return ret; |
| 249 | } | 265 | } |
| 250 | 266 | ||
| 267 | int iwl_mvm_unset_link_mapping(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
| 268 | struct ieee80211_bss_conf *link_conf) | ||
| 269 | { | ||
| 270 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
| 271 | struct iwl_mvm_vif_link_info *link_info = | ||
| 272 | mvmvif->link[link_conf->link_id]; | ||
| 273 | |||
| 274 | /* mac80211 thought we have the link, but it was never configured */ | ||
| 275 | if (WARN_ON(!link_info || | ||
| 276 | link_info->fw_link_id >= | ||
| 277 | ARRAY_SIZE(mvm->link_id_to_link_conf))) | ||
| 278 | return -EINVAL; | ||
| 279 | |||
| 280 | RCU_INIT_POINTER(mvm->link_id_to_link_conf[link_info->fw_link_id], | ||
| 281 | NULL); | ||
| 282 | return 0; | ||
| 283 | } | ||
| 284 | |||
| 251 | int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 285 | int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 252 | struct ieee80211_bss_conf *link_conf) | 286 | struct ieee80211_bss_conf *link_conf) |
| 253 | { | 287 | { |
| @@ -257,13 +291,10 @@ int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 3 unmodified lines | |||
| 257 | struct iwl_link_config_cmd cmd = {}; | 291 | struct iwl_link_config_cmd cmd = {}; |
| 258 | int ret; | 292 | int ret; |
| 259 | 293 | ||
| 260 | /* mac80211 thought we have the link, but it was never configured */ | 294 | ret = iwl_mvm_unset_link_mapping(mvm, vif, link_conf); |
| 261 | if (WARN_ON(!link_info || | 295 | if (ret) |
| 262 | link_info->fw_link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf))) | ||
| 263 | return 0; | 296 | return 0; |
| 264 | 297 | ||
| 265 | RCU_INIT_POINTER(mvm->link_id_to_link_conf[link_info->fw_link_id], | ||
| 266 | NULL); | ||
| 267 | cmd.link_id = cpu_to_le32(link_info->fw_link_id); | 298 | cmd.link_id = cpu_to_le32(link_info->fw_link_id); |
| 268 | iwl_mvm_release_fw_link_id(mvm, link_info->fw_link_id); | 299 | iwl_mvm_release_fw_link_id(mvm, link_info->fw_link_id); |
| 269 | link_info->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; | 300 | link_info->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; |
| @@ -360,7 +360,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) · 359 unmodified lines | |||
| 360 | if (mvm->mld_api_is_used && mvm->nvm_data->sku_cap_11be_enable && | 360 | if (mvm->mld_api_is_used && mvm->nvm_data->sku_cap_11be_enable && |
| 361 | !iwlwifi_mod_params.disable_11ax && | 361 | !iwlwifi_mod_params.disable_11ax && |
| 362 | !iwlwifi_mod_params.disable_11be) | 362 | !iwlwifi_mod_params.disable_11be) |
| 363 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; | 363 | hw->wiphy->flags |= WIPHY_FLAG_DISABLE_WEXT; |
| 364 | 364 | ||
| 365 | /* With MLD FW API, it tracks timing by itself, | 365 | /* With MLD FW API, it tracks timing by itself, |
| 366 | * no need for any timing from the host | 366 | * no need for any timing from the host |
| @@ -1577,8 +1577,14 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, · 1210 unmodified lines | |||
| 1577 | mvmvif->mvm = mvm; | 1577 | mvmvif->mvm = mvm; |
| 1578 | 1578 | ||
| 1579 | /* the first link always points to the default one */ | 1579 | /* the first link always points to the default one */ |
| 1580 | mvmvif->deflink.fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; | ||
| 1581 | mvmvif->deflink.active = 0; | ||
| 1580 | mvmvif->link[0] = &mvmvif->deflink; | 1582 | mvmvif->link[0] = &mvmvif->deflink; |
| 1581 | 1583 | ||
| 1584 | ret = iwl_mvm_set_link_mapping(mvm, vif, &vif->bss_conf); | ||
| 1585 | if (ret) | ||
| 1586 | goto out; | ||
| 1587 | |||
| 1582 | /* | 1588 | /* |
| 1583 | * Not much to do here. The stack will not allow interface | 1589 | * Not much to do here. The stack will not allow interface |
| 1584 | * types or combinations that we didn't advertise, so we | 1590 | * types or combinations that we didn't advertise, so we |
| @@ -1783,6 +1789,7 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw, · 198 unmodified lines | |||
| 1783 | mvm->p2p_device_vif = NULL; | 1789 | mvm->p2p_device_vif = NULL; |
| 1784 | } | 1790 | } |
| 1785 | 1791 | ||
| 1792 | iwl_mvm_unset_link_mapping(mvm, vif, &vif->bss_conf); | ||
| 1786 | iwl_mvm_mac_ctxt_remove(mvm, vif); | 1793 | iwl_mvm_mac_ctxt_remove(mvm, vif); |
| 1787 | 1794 | ||
| 1788 | RCU_INIT_POINTER(mvm->vif_id_to_mac[mvmvif->id], NULL); | 1795 | RCU_INIT_POINTER(mvm->vif_id_to_mac[mvmvif->id], NULL); |
| @@ -855,10 +855,15 @@ int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 854 unmodified lines | |||
| 855 | 855 | ||
| 856 | int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id) | 856 | int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id) |
| 857 | { | 857 | { |
| 858 | int ret = iwl_mvm_mld_rm_sta_from_fw(mvm, sta_id); | 858 | int ret; |
| 859 | 859 | ||
| 860 | lockdep_assert_held(&mvm->mutex); | 860 | lockdep_assert_held(&mvm->mutex); |
| 861 | 861 | ||
| 862 | if (WARN_ON(sta_id == IWL_MVM_INVALID_STA)) | ||
| 863 | return 0; | ||
| 864 | |||
| 865 | ret = iwl_mvm_mld_rm_sta_from_fw(mvm, sta_id); | ||
| 866 | |||
| 862 | RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); | 867 | RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); |
| 863 | RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL); | 868 | RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL); |
| 864 | return ret; | 869 | return ret; |
| @@ -1916,11 +1916,15 @@ int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); · 1915 unmodified lines | |||
| 1916 | u32 iwl_mvm_get_lmac_id(struct iwl_mvm *mvm, enum nl80211_band band); | 1916 | u32 iwl_mvm_get_lmac_id(struct iwl_mvm *mvm, enum nl80211_band band); |
| 1917 | 1917 | ||
| 1918 | /* Links */ | 1918 | /* Links */ |
| 1919 | int iwl_mvm_set_link_mapping(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
| 1920 | struct ieee80211_bss_conf *link_conf); | ||
| 1919 | int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1921 | int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 1920 | struct ieee80211_bss_conf *link_conf); | 1922 | struct ieee80211_bss_conf *link_conf); |
| 1921 | int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1923 | int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 1922 | struct ieee80211_bss_conf *link_conf, | 1924 | struct ieee80211_bss_conf *link_conf, |
| 1923 | u32 changes, bool active); | 1925 | u32 changes, bool active); |
| 1926 | int iwl_mvm_unset_link_mapping(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
| 1927 | struct ieee80211_bss_conf *link_conf); | ||
| 1924 | int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1928 | int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| 1925 | struct ieee80211_bss_conf *link_conf); | 1929 | struct ieee80211_bss_conf *link_conf); |
| 1926 | int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1930 | int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
| @@ -132,14 +132,18 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm) · 131 unmodified lines | |||
| 132 | if (ret) | 132 | if (ret) |
| 133 | return ERR_PTR(ret); | 133 | return ERR_PTR(ret); |
| 134 | 134 | ||
| 135 | if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size)) | 135 | if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != |
| 136 | resp_size)) { | ||
| 137 | iwl_free_resp(&cmd); | ||
| 136 | return ERR_PTR(-EIO); | 138 | return ERR_PTR(-EIO); |
| 139 | } | ||
| 137 | 140 | ||
| 138 | resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL); | 141 | resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL); |
| 142 | iwl_free_resp(&cmd); | ||
| 143 | |||
| 139 | if (!resp) | 144 | if (!resp) |
| 140 | return ERR_PTR(-ENOMEM); | 145 | return ERR_PTR(-ENOMEM); |
| 141 | 146 | ||
| 142 | iwl_free_resp(&cmd); | ||
| 143 | return resp; | 147 | return resp; |
| 144 | } | 148 | } |
| 145 | 149 | ||
| @@ -236,21 +236,13 @@ static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm, · 235 unmodified lines | |||
| 236 | static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, | 236 | static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, |
| 237 | struct napi_struct *napi, | 237 | struct napi_struct *napi, |
| 238 | struct sk_buff *skb, int queue, | 238 | struct sk_buff *skb, int queue, |
| 239 | struct ieee80211_sta *sta, | 239 | struct ieee80211_sta *sta) |
| 240 | struct ieee80211_link_sta *link_sta) | ||
| 241 | { | 240 | { |
| 242 | if (unlikely(iwl_mvm_check_pn(mvm, skb, queue, sta))) { | 241 | if (unlikely(iwl_mvm_check_pn(mvm, skb, queue, sta))) { |
| 243 | kfree_skb(skb); | 242 | kfree_skb(skb); |
| 244 | return; | 243 | return; |
| 245 | } | 244 | } |
| 246 | 245 | ||
| 247 | if (sta && sta->valid_links && link_sta) { | ||
| 248 | struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); | ||
| 249 | |||
| 250 | rx_status->link_valid = 1; | ||
| 251 | rx_status->link_id = link_sta->link_id; | ||
| 252 | } | ||
| 253 | |||
| 254 | ieee80211_rx_napi(mvm->hw, sta, skb, napi); | 246 | ieee80211_rx_napi(mvm->hw, sta, skb, napi); |
| 255 | } | 247 | } |
| 256 | 248 | ||
| @@ -588,7 +580,7 @@ static void iwl_mvm_release_frames(struct iwl_mvm *mvm, · 331 unmodified lines | |||
| 588 | while ((skb = __skb_dequeue(skb_list))) { | 580 | while ((skb = __skb_dequeue(skb_list))) { |
| 589 | iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, | 581 | iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, |
| 590 | reorder_buf->queue, | 582 | reorder_buf->queue, |
| 591 | sta, NULL /* FIXME */); | 583 | sta); |
| 592 | reorder_buf->num_stored--; | 584 | reorder_buf->num_stored--; |
| 593 | } | 585 | } |
| 594 | } | 586 | } |
| @@ -2213,6 +2205,11 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 1618 unmodified lines | |||
| 2213 | if (IS_ERR(sta)) | 2205 | if (IS_ERR(sta)) |
| 2214 | sta = NULL; | 2206 | sta = NULL; |
| 2215 | link_sta = rcu_dereference(mvm->fw_id_to_link_sta[id]); | 2207 | link_sta = rcu_dereference(mvm->fw_id_to_link_sta[id]); |
| 2208 | |||
| 2209 | if (sta && sta->valid_links && link_sta) { | ||
| 2210 | rx_status->link_valid = 1; | ||
| 2211 | rx_status->link_id = link_sta->link_id; | ||
| 2212 | } | ||
| 2216 | } | 2213 | } |
| 2217 | } else if (!is_multicast_ether_addr(hdr->addr2)) { | 2214 | } else if (!is_multicast_ether_addr(hdr->addr2)) { |
| 2218 | /* | 2215 | /* |
| @@ -2356,8 +2353,7 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 137 unmodified lines | |||
| 2356 | !(desc->amsdu_info & IWL_RX_MPDU_AMSDU_LAST_SUBFRAME)) | 2353 | !(desc->amsdu_info & IWL_RX_MPDU_AMSDU_LAST_SUBFRAME)) |
| 2357 | rx_status->flag |= RX_FLAG_AMSDU_MORE; | 2354 | rx_status->flag |= RX_FLAG_AMSDU_MORE; |
| 2358 | 2355 | ||
| 2359 | iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta, | 2356 | iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta); |
| 2360 | link_sta); | ||
| 2361 | } | 2357 | } |
| 2362 | out: | 2358 | out: |
| 2363 | rcu_read_unlock(); | 2359 | rcu_read_unlock(); |
| @@ -879,9 +879,8 @@ void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm, · 878 unmodified lines | |||
| 879 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 879 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
| 880 | struct iwl_mvm_session_prot_notif *notif = (void *)pkt->data; | 880 | struct iwl_mvm_session_prot_notif *notif = (void *)pkt->data; |
| 881 | unsigned int ver = | 881 | unsigned int ver = |
| 882 | iwl_fw_lookup_cmd_ver(mvm->fw, | 882 | iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, |
| 883 | WIDE_ID(MAC_CONF_GROUP, | 883 | SESSION_PROTECTION_NOTIF, 2); |
| 884 | SESSION_PROTECTION_CMD), 2); | ||
| 885 | int id = le32_to_cpu(notif->mac_link_id); | 884 | int id = le32_to_cpu(notif->mac_link_id); |
| 886 | struct ieee80211_vif *vif; | 885 | struct ieee80211_vif *vif; |
| 887 | struct iwl_mvm_vif *mvmvif; | 886 | struct iwl_mvm_vif *mvmvif; |
| @@ -1589,9 +1589,9 @@ void iwl_txq_reclaim(struct iwl_trans *trans, int txq_id, int ssn, · 1588 unmodified lines | |||
| 1589 | return; | 1589 | return; |
| 1590 | 1590 | ||
| 1591 | tfd_num = iwl_txq_get_cmd_index(txq, ssn); | 1591 | tfd_num = iwl_txq_get_cmd_index(txq, ssn); |
| 1592 | read_ptr = iwl_txq_get_cmd_index(txq, txq->read_ptr); | ||
| 1593 | 1592 | ||
| 1594 | spin_lock_bh(&txq->lock); | 1593 | spin_lock_bh(&txq->lock); |
| 1594 | read_ptr = iwl_txq_get_cmd_index(txq, txq->read_ptr); | ||
| 1595 | 1595 | ||
| 1596 | if (!test_bit(txq_id, trans->txqs.queue_used)) { | 1596 | if (!test_bit(txq_id, trans->txqs.queue_used)) { |
| 1597 | IWL_DEBUG_TX_QUEUES(trans, "Q %d inactive - ignoring idx %d\n", | 1597 | IWL_DEBUG_TX_QUEUES(trans, "Q %d inactive - ignoring idx %d\n", |
| @@ -2233,7 +2233,7 @@ static void rtw8922a_btc_init_cfg(struct rtw89_dev *rtwdev) · 2232 unmodified lines | |||
| 2233 | * Shared-Ant && BTG-path:WL mask(0x55f), others:WL THRU(0x5ff) | 2233 | * Shared-Ant && BTG-path:WL mask(0x55f), others:WL THRU(0x5ff) |
| 2234 | */ | 2234 | */ |
| 2235 | if (btc->ant_type == BTC_ANT_SHARED && btc->btg_pos == path) | 2235 | if (btc->ant_type == BTC_ANT_SHARED && btc->btg_pos == path) |
| 2236 | rtw8922a_set_trx_mask(rtwdev, path, BTC_BT_TX_GROUP, 0x5ff); | 2236 | rtw8922a_set_trx_mask(rtwdev, path, BTC_BT_TX_GROUP, 0x55f); |
| 2237 | else | 2237 | else |
| 2238 | rtw8922a_set_trx_mask(rtwdev, path, BTC_BT_TX_GROUP, 0x5ff); | 2238 | rtw8922a_set_trx_mask(rtwdev, path, BTC_BT_TX_GROUP, 0x5ff); |
| 2239 | 2239 | ||
| @@ -106,7 +106,7 @@ bool t7xx_cldma_tx_addr_is_set(struct t7xx_cldma_hw *hw_info, unsigned int qno) · 105 unmodified lines | |||
| 106 | { | 106 | { |
| 107 | u32 offset = REG_CLDMA_UL_START_ADDRL_0 + qno * ADDR_SIZE; | 107 | u32 offset = REG_CLDMA_UL_START_ADDRL_0 + qno * ADDR_SIZE; |
| 108 | 108 | ||
| 109 | return ioread64(hw_info->ap_pdn_base + offset); | 109 | return ioread64_lo_hi(hw_info->ap_pdn_base + offset); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | void t7xx_cldma_hw_set_start_addr(struct t7xx_cldma_hw *hw_info, unsigned int qno, u64 address, | 112 | void t7xx_cldma_hw_set_start_addr(struct t7xx_cldma_hw *hw_info, unsigned int qno, u64 address, |
| @@ -117,7 +117,7 @@ void t7xx_cldma_hw_set_start_addr(struct t7xx_cldma_hw *hw_info, unsigned int qn · 4 unmodified lines | |||
| 117 | 117 | ||
| 118 | reg = tx_rx == MTK_RX ? hw_info->ap_ao_base + REG_CLDMA_DL_START_ADDRL_0 : | 118 | reg = tx_rx == MTK_RX ? hw_info->ap_ao_base + REG_CLDMA_DL_START_ADDRL_0 : |
| 119 | hw_info->ap_pdn_base + REG_CLDMA_UL_START_ADDRL_0; | 119 | hw_info->ap_pdn_base + REG_CLDMA_UL_START_ADDRL_0; |
| 120 | iowrite64(address, reg + offset); | 120 | iowrite64_lo_hi(address, reg + offset); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | void t7xx_cldma_hw_resume_queue(struct t7xx_cldma_hw *hw_info, unsigned int qno, | 123 | void t7xx_cldma_hw_resume_queue(struct t7xx_cldma_hw *hw_info, unsigned int qno, |
| @@ -137,8 +137,9 @@ static int t7xx_cldma_gpd_rx_from_q(struct cldma_queue *queue, int budget, bool · 136 unmodified lines | |||
| 137 | return -ENODEV; | 137 | return -ENODEV; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | gpd_addr = ioread64(hw_info->ap_pdn_base + REG_CLDMA_DL_CURRENT_ADDRL_0 + | 140 | gpd_addr = ioread64_lo_hi(hw_info->ap_pdn_base + |
| 141 | queue->index * sizeof(u64)); | 141 | REG_CLDMA_DL_CURRENT_ADDRL_0 + |
| 142 | queue->index * sizeof(u64)); | ||
| 142 | if (req->gpd_addr == gpd_addr || hwo_polling_count++ >= 100) | 143 | if (req->gpd_addr == gpd_addr || hwo_polling_count++ >= 100) |
| 143 | return 0; | 144 | return 0; |
| 144 | 145 | ||
| @@ -316,8 +317,8 @@ static void t7xx_cldma_txq_empty_hndl(struct cldma_queue *queue) · 171 unmodified lines | |||
| 316 | struct t7xx_cldma_hw *hw_info = &md_ctrl->hw_info; | 317 | struct t7xx_cldma_hw *hw_info = &md_ctrl->hw_info; |
| 317 | 318 | ||
| 318 | /* Check current processing TGPD, 64-bit address is in a table by Q index */ | 319 | /* Check current processing TGPD, 64-bit address is in a table by Q index */ |
| 319 | ul_curr_addr = ioread64(hw_info->ap_pdn_base + REG_CLDMA_UL_CURRENT_ADDRL_0 + | 320 | ul_curr_addr = ioread64_lo_hi(hw_info->ap_pdn_base + REG_CLDMA_UL_CURRENT_ADDRL_0 + |
| 320 | queue->index * sizeof(u64)); | 321 | queue->index * sizeof(u64)); |
| 321 | if (req->gpd_addr != ul_curr_addr) { | 322 | if (req->gpd_addr != ul_curr_addr) { |
| 322 | spin_unlock_irqrestore(&md_ctrl->cldma_lock, flags); | 323 | spin_unlock_irqrestore(&md_ctrl->cldma_lock, flags); |
| 323 | dev_err(md_ctrl->dev, "CLDMA%d queue %d is not empty\n", | 324 | dev_err(md_ctrl->dev, "CLDMA%d queue %d is not empty\n", |
| @@ -75,7 +75,7 @@ static void t7xx_pcie_mac_atr_tables_dis(void __iomem *pbase, enum t7xx_atr_src_ · 74 unmodified lines | |||
| 75 | for (i = 0; i < ATR_TABLE_NUM_PER_ATR; i++) { | 75 | for (i = 0; i < ATR_TABLE_NUM_PER_ATR; i++) { |
| 76 | offset = ATR_PORT_OFFSET * port + ATR_TABLE_OFFSET * i; | 76 | offset = ATR_PORT_OFFSET * port + ATR_TABLE_OFFSET * i; |
| 77 | reg = pbase + ATR_PCIE_WIN0_T0_ATR_PARAM_SRC_ADDR + offset; | 77 | reg = pbase + ATR_PCIE_WIN0_T0_ATR_PARAM_SRC_ADDR + offset; |
| 78 | iowrite64(0, reg); | 78 | iowrite64_lo_hi(0, reg); |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -112,17 +112,17 @@ static int t7xx_pcie_mac_atr_cfg(struct t7xx_pci_dev *t7xx_dev, struct t7xx_atr_ · 30 unmodified lines | |||
| 112 | 112 | ||
| 113 | reg = pbase + ATR_PCIE_WIN0_T0_TRSL_ADDR + offset; | 113 | reg = pbase + ATR_PCIE_WIN0_T0_TRSL_ADDR + offset; |
| 114 | value = cfg->trsl_addr & ATR_PCIE_WIN0_ADDR_ALGMT; | 114 | value = cfg->trsl_addr & ATR_PCIE_WIN0_ADDR_ALGMT; |
| 115 | iowrite64(value, reg); | 115 | iowrite64_lo_hi(value, reg); |
| 116 | 116 | ||
| 117 | reg = pbase + ATR_PCIE_WIN0_T0_TRSL_PARAM + offset; | 117 | reg = pbase + ATR_PCIE_WIN0_T0_TRSL_PARAM + offset; |
| 118 | iowrite32(cfg->trsl_id, reg); | 118 | iowrite32(cfg->trsl_id, reg); |
| 119 | 119 | ||
| 120 | reg = pbase + ATR_PCIE_WIN0_T0_ATR_PARAM_SRC_ADDR + offset; | 120 | reg = pbase + ATR_PCIE_WIN0_T0_ATR_PARAM_SRC_ADDR + offset; |
| 121 | value = (cfg->src_addr & ATR_PCIE_WIN0_ADDR_ALGMT) | (atr_size << 1) | BIT(0); | 121 | value = (cfg->src_addr & ATR_PCIE_WIN0_ADDR_ALGMT) | (atr_size << 1) | BIT(0); |
| 122 | iowrite64(value, reg); | 122 | iowrite64_lo_hi(value, reg); |
| 123 | 123 | ||
| 124 | /* Ensure ATR is set */ | 124 | /* Ensure ATR is set */ |
| 125 | ioread64(reg); | 125 | ioread64_lo_hi(reg); |
| 126 | return 0; | 126 | return 0; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | # Aspeed pinctrl support | 2 | # Aspeed pinctrl support |
| 3 | 3 | ||
| 4 | ccflags-y += $(call cc-option,-Woverride-init) | 4 | ccflags-y += -Woverride-init |
| 5 | obj-$(CONFIG_PINCTRL_ASPEED) += pinctrl-aspeed.o pinmux-aspeed.o | 5 | obj-$(CONFIG_PINCTRL_ASPEED) += pinctrl-aspeed.o pinmux-aspeed.o |
| 6 | obj-$(CONFIG_PINCTRL_ASPEED_G4) += pinctrl-aspeed-g4.o | 6 | obj-$(CONFIG_PINCTRL_ASPEED_G4) += pinctrl-aspeed-g4.o |
| 7 | obj-$(CONFIG_PINCTRL_ASPEED_G5) += pinctrl-aspeed-g5.o | 7 | obj-$(CONFIG_PINCTRL_ASPEED_G5) += pinctrl-aspeed-g5.o |
| @@ -1159,7 +1159,7 @@ static int amd_gpio_probe(struct platform_device *pdev) · 1158 unmodified lines | |||
| 1159 | } | 1159 | } |
| 1160 | 1160 | ||
| 1161 | ret = devm_request_irq(&pdev->dev, gpio_dev->irq, amd_gpio_irq_handler, | 1161 | ret = devm_request_irq(&pdev->dev, gpio_dev->irq, amd_gpio_irq_handler, |
| 1162 | IRQF_SHARED | IRQF_ONESHOT, KBUILD_MODNAME, gpio_dev); | 1162 | IRQF_SHARED | IRQF_COND_ONESHOT, KBUILD_MODNAME, gpio_dev); |
| 1163 | if (ret) | 1163 | if (ret) |
| 1164 | goto out2; | 1164 | goto out2; |
| 1165 | 1165 | ||
| @@ -284,9 +284,9 @@ static int img_pwm_probe(struct platform_device *pdev) · 283 unmodified lines | |||
| 284 | return PTR_ERR(imgchip->sys_clk); | 284 | return PTR_ERR(imgchip->sys_clk); |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | imgchip->pwm_clk = devm_clk_get(&pdev->dev, "imgchip"); | 287 | imgchip->pwm_clk = devm_clk_get(&pdev->dev, "pwm"); |
| 288 | if (IS_ERR(imgchip->pwm_clk)) { | 288 | if (IS_ERR(imgchip->pwm_clk)) { |
| 289 | dev_err(&pdev->dev, "failed to get imgchip clock\n"); | 289 | dev_err(&pdev->dev, "failed to get pwm clock\n"); |
| 290 | return PTR_ERR(imgchip->pwm_clk); | 290 | return PTR_ERR(imgchip->pwm_clk); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| @@ -150,6 +150,8 @@ static unsigned int max_nr_fru; · 149 unmodified lines | |||
| 150 | /* Total length of record including headers and list of descriptor entries. */ | 150 | /* Total length of record including headers and list of descriptor entries. */ |
| 151 | static size_t max_rec_len; | 151 | static size_t max_rec_len; |
| 152 | 152 | ||
| 153 | #define FMPM_MAX_REC_LEN (sizeof(struct fru_rec) + (sizeof(struct cper_fru_poison_desc) * 255)) | ||
| 154 | |||
| 153 | /* Total number of SPA entries across all FRUs. */ | 155 | /* Total number of SPA entries across all FRUs. */ |
| 154 | static unsigned int spa_nr_entries; | 156 | static unsigned int spa_nr_entries; |
| 155 | 157 | ||
| @@ -475,6 +477,16 @@ static void set_rec_fields(struct fru_rec *rec) · 319 unmodified lines | |||
| 475 | struct cper_section_descriptor *sec_desc = &rec->sec_desc; | 477 | struct cper_section_descriptor *sec_desc = &rec->sec_desc; |
| 476 | struct cper_record_header *hdr = &rec->hdr; | 478 | struct cper_record_header *hdr = &rec->hdr; |
| 477 | 479 | ||
| 480 | /* | ||
| 481 | * This is a saved record created with fewer max_nr_entries. | ||
| 482 | * Update the record lengths and keep everything else as-is. | ||
| 483 | */ | ||
| 484 | if (hdr->record_length && hdr->record_length < max_rec_len) { | ||
| 485 | pr_debug("Growing record 0x%016llx from %u to %zu bytes\n", | ||
| 486 | hdr->record_id, hdr->record_length, max_rec_len); | ||
| 487 | goto update_lengths; | ||
| 488 | } | ||
| 489 | |||
| 478 | memcpy(hdr->signature, CPER_SIG_RECORD, CPER_SIG_SIZE); | 490 | memcpy(hdr->signature, CPER_SIG_RECORD, CPER_SIG_SIZE); |
| 479 | hdr->revision = CPER_RECORD_REV; | 491 | hdr->revision = CPER_RECORD_REV; |
| 480 | hdr->signature_end = CPER_SIG_END; | 492 | hdr->signature_end = CPER_SIG_END; |
| @@ -489,19 +501,21 @@ static void set_rec_fields(struct fru_rec *rec) · 8 unmodified lines | |||
| 489 | hdr->error_severity = CPER_SEV_RECOVERABLE; | 501 | hdr->error_severity = CPER_SEV_RECOVERABLE; |
| 490 | 502 | ||
| 491 | hdr->validation_bits = 0; | 503 | hdr->validation_bits = 0; |
| 492 | hdr->record_length = max_rec_len; | ||
| 493 | hdr->creator_id = CPER_CREATOR_FMP; | 504 | hdr->creator_id = CPER_CREATOR_FMP; |
| 494 | hdr->notification_type = CPER_NOTIFY_MCE; | 505 | hdr->notification_type = CPER_NOTIFY_MCE; |
| 495 | hdr->record_id = cper_next_record_id(); | 506 | hdr->record_id = cper_next_record_id(); |
| 496 | hdr->flags = CPER_HW_ERROR_FLAGS_PREVERR; | 507 | hdr->flags = CPER_HW_ERROR_FLAGS_PREVERR; |
| 497 | 508 | ||
| 498 | sec_desc->section_offset = sizeof(struct cper_record_header); | 509 | sec_desc->section_offset = sizeof(struct cper_record_header); |
| 499 | sec_desc->section_length = max_rec_len - sizeof(struct cper_record_header); | ||
| 500 | sec_desc->revision = CPER_SEC_REV; | 510 | sec_desc->revision = CPER_SEC_REV; |
| 501 | sec_desc->validation_bits = 0; | 511 | sec_desc->validation_bits = 0; |
| 502 | sec_desc->flags = CPER_SEC_PRIMARY; | 512 | sec_desc->flags = CPER_SEC_PRIMARY; |
| 503 | sec_desc->section_type = CPER_SECTION_TYPE_FMP; | 513 | sec_desc->section_type = CPER_SECTION_TYPE_FMP; |
| 504 | sec_desc->section_severity = CPER_SEV_RECOVERABLE; | 514 | sec_desc->section_severity = CPER_SEV_RECOVERABLE; |
| 515 | |||
| 516 | update_lengths: | ||
| 517 | hdr->record_length = max_rec_len; | ||
| 518 | sec_desc->section_length = max_rec_len - sizeof(struct cper_record_header); | ||
| 505 | } | 519 | } |
| 506 | 520 | ||
| 507 | static int save_new_records(void) | 521 | static int save_new_records(void) |
| @@ -512,16 +526,18 @@ static int save_new_records(void) · 4 unmodified lines | |||
| 512 | int ret = 0; | 526 | int ret = 0; |
| 513 | 527 | ||
| 514 | for_each_fru(i, rec) { | 528 | for_each_fru(i, rec) { |
| 515 | if (rec->hdr.record_length) | 529 | /* No need to update saved records that match the current record size. */ |
| 530 | if (rec->hdr.record_length == max_rec_len) | ||
| 516 | continue; | 531 | continue; |
| 517 | 532 | ||
| 533 | if (!rec->hdr.record_length) | ||
| 534 | set_bit(i, new_records); | ||
| 535 | |||
| 518 | set_rec_fields(rec); | 536 | set_rec_fields(rec); |
| 519 | 537 | ||
| 520 | ret = update_record_on_storage(rec); | 538 | ret = update_record_on_storage(rec); |
| 521 | if (ret) | 539 | if (ret) |
| 522 | goto out_clear; | 540 | goto out_clear; |
| 523 | |||
| 524 | set_bit(i, new_records); | ||
| 525 | } | 541 | } |
| 526 | 542 | ||
| 527 | return ret; | 543 | return ret; |
| @@ -641,12 +657,7 @@ static int get_saved_records(void) · 113 unmodified lines | |||
| 641 | int ret, pos; | 657 | int ret, pos; |
| 642 | ssize_t len; | 658 | ssize_t len; |
| 643 | 659 | ||
| 644 | /* | 660 | old = kmalloc(FMPM_MAX_REC_LEN, GFP_KERNEL); |
| 645 | * Assume saved records match current max size. | ||
| 646 | * | ||
| 647 | * However, this may not be true depending on module parameters. | ||
| 648 | */ | ||
| 649 | old = kmalloc(max_rec_len, GFP_KERNEL); | ||
| 650 | if (!old) { | 661 | if (!old) { |
| 651 | ret = -ENOMEM; | 662 | ret = -ENOMEM; |
| 652 | goto out; | 663 | goto out; |
| @@ -663,21 +674,31 @@ static int get_saved_records(void) · 10 unmodified lines | |||
| 663 | * Make sure to clear temporary buffer between reads to avoid | 674 | * Make sure to clear temporary buffer between reads to avoid |
| 664 | * leftover data from records of various sizes. | 675 | * leftover data from records of various sizes. |
| 665 | */ | 676 | */ |
| 666 | memset(old, 0, max_rec_len); | 677 | memset(old, 0, FMPM_MAX_REC_LEN); |
| 667 | 678 | ||
| 668 | len = erst_read_record(record_id, &old->hdr, max_rec_len, | 679 | len = erst_read_record(record_id, &old->hdr, FMPM_MAX_REC_LEN, |
| 669 | sizeof(struct fru_rec), &CPER_CREATOR_FMP); | 680 | sizeof(struct fru_rec), &CPER_CREATOR_FMP); |
| 670 | if (len < 0) | 681 | if (len < 0) |
| 671 | continue; | 682 | continue; |
| 672 | 683 | ||
| 673 | if (len > max_rec_len) { | 684 | new = get_valid_record(old); |
| 674 | pr_debug("Found record larger than max_rec_len\n"); | 685 | if (!new) { |
| 686 | erst_clear(record_id); | ||
| 675 | continue; | 687 | continue; |
| 676 | } | 688 | } |
| 677 | 689 | ||
| 678 | new = get_valid_record(old); | 690 | if (len > max_rec_len) { |
| 679 | if (!new) | 691 | unsigned int saved_nr_entries; |
| 680 | erst_clear(record_id); | 692 | |
| 693 | saved_nr_entries = len - sizeof(struct fru_rec); | ||
| 694 | saved_nr_entries /= sizeof(struct cper_fru_poison_desc); | ||
| 695 | |||
| 696 | pr_warn("Saved record found with %u entries.\n", saved_nr_entries); | ||
| 697 | pr_warn("Please increase max_nr_entries to %u.\n", saved_nr_entries); | ||
| 698 | |||
| 699 | ret = -EINVAL; | ||
| 700 | goto out_end; | ||
| 701 | } | ||
| 681 | 702 | ||
| 682 | /* Restore the record */ | 703 | /* Restore the record */ |
| 683 | memcpy(new, old, len); | 704 | memcpy(new, old, len); |
| @@ -4,6 +4,10 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | #include <linux/debugfs.h> | 5 | #include <linux/debugfs.h> |
| 6 | 6 | ||
| 7 | #if IS_ENABLED(CONFIG_DEBUG_FS) | ||
| 7 | struct dentry *ras_get_debugfs_root(void); | 8 | struct dentry *ras_get_debugfs_root(void); |
| 9 | #else | ||
| 10 | static inline struct dentry *ras_get_debugfs_root(void) { return NULL; } | ||
| 11 | #endif /* DEBUG_FS */ | ||
| 8 | 12 | ||
| 9 | #endif /* __RAS_DEBUGFS_H__ */ | 13 | #endif /* __RAS_DEBUGFS_H__ */ |
| @@ -1179,6 +1179,20 @@ static int qeth_check_irb_error(struct qeth_card *card, struct ccw_device *cdev, · 1178 unmodified lines | |||
| 1179 | } | 1179 | } |
| 1180 | } | 1180 | } |
| 1181 | 1181 | ||
| 1182 | /** | ||
| 1183 | * qeth_irq() - qeth interrupt handler | ||
| 1184 | * @cdev: ccw device | ||
| 1185 | * @intparm: expect pointer to iob | ||
| 1186 | * @irb: Interruption Response Block | ||
| 1187 | * | ||
| 1188 | * In the good path: | ||
| 1189 | * corresponding qeth channel is locked with last used iob as active_cmd. | ||
| 1190 | * But this function is also called for error interrupts. | ||
| 1191 | * | ||
| 1192 | * Caller ensures that: | ||
| 1193 | * Interrupts are disabled; ccw device lock is held; | ||
| 1194 | * | ||
| 1195 | */ | ||
| 1182 | static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, | 1196 | static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, |
| 1183 | struct irb *irb) | 1197 | struct irb *irb) |
| 1184 | { | 1198 | { |
| @@ -1220,11 +1234,10 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, · 35 unmodified lines | |||
| 1220 | iob = (struct qeth_cmd_buffer *) (addr_t)intparm; | 1234 | iob = (struct qeth_cmd_buffer *) (addr_t)intparm; |
| 1221 | } | 1235 | } |
| 1222 | 1236 | ||
| 1223 | qeth_unlock_channel(card, channel); | ||
| 1224 | |||
| 1225 | rc = qeth_check_irb_error(card, cdev, irb); | 1237 | rc = qeth_check_irb_error(card, cdev, irb); |
| 1226 | if (rc) { | 1238 | if (rc) { |
| 1227 | /* IO was terminated, free its resources. */ | 1239 | /* IO was terminated, free its resources. */ |
| 1240 | qeth_unlock_channel(card, channel); | ||
| 1228 | if (iob) | 1241 | if (iob) |
| 1229 | qeth_cancel_cmd(iob, rc); | 1242 | qeth_cancel_cmd(iob, rc); |
| 1230 | return; | 1243 | return; |
| @@ -1268,6 +1281,7 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, · 37 unmodified lines | |||
| 1268 | rc = qeth_get_problem(card, cdev, irb); | 1281 | rc = qeth_get_problem(card, cdev, irb); |
| 1269 | if (rc) { | 1282 | if (rc) { |
| 1270 | card->read_or_write_problem = 1; | 1283 | card->read_or_write_problem = 1; |
| 1284 | qeth_unlock_channel(card, channel); | ||
| 1271 | if (iob) | 1285 | if (iob) |
| 1272 | qeth_cancel_cmd(iob, rc); | 1286 | qeth_cancel_cmd(iob, rc); |
| 1273 | qeth_clear_ipacmd_list(card); | 1287 | qeth_clear_ipacmd_list(card); |
| @@ -1276,6 +1290,26 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, · 2 unmodified lines | |||
| 1276 | } | 1290 | } |
| 1277 | } | 1291 | } |
| 1278 | 1292 | ||
| 1293 | if (scsw_cmd_is_valid_cc(&irb->scsw) && irb->scsw.cmd.cc == 1 && iob) { | ||
| 1294 | /* channel command hasn't started: retry. | ||
| 1295 | * active_cmd is still set to last iob | ||
| 1296 | */ | ||
| 1297 | QETH_CARD_TEXT(card, 2, "irqcc1"); | ||
| 1298 | rc = ccw_device_start_timeout(cdev, __ccw_from_cmd(iob), | ||
| 1299 | (addr_t)iob, 0, 0, iob->timeout); | ||
| 1300 | if (rc) { | ||
| 1301 | QETH_DBF_MESSAGE(2, | ||
| 1302 | "ccw retry on %x failed, rc = %i\n", | ||
| 1303 | CARD_DEVID(card), rc); | ||
| 1304 | QETH_CARD_TEXT_(card, 2, " err%d", rc); | ||
| 1305 | qeth_unlock_channel(card, channel); | ||
| 1306 | qeth_cancel_cmd(iob, rc); | ||
| 1307 | } | ||
| 1308 | return; | ||
| 1309 | } | ||
| 1310 | |||
| 1311 | qeth_unlock_channel(card, channel); | ||
| 1312 | |||
| 1279 | if (iob) { | 1313 | if (iob) { |
| 1280 | /* sanity check: */ | 1314 | /* sanity check: */ |
| 1281 | if (irb->scsw.cmd.count > iob->length) { | 1315 | if (irb->scsw.cmd.count > iob->length) { |
| @@ -833,7 +833,6 @@ static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba, · 832 unmodified lines | |||
| 833 | 833 | ||
| 834 | BNX2FC_TGT_DBG(tgt, "Freeing up session resources\n"); | 834 | BNX2FC_TGT_DBG(tgt, "Freeing up session resources\n"); |
| 835 | 835 | ||
| 836 | spin_lock_bh(&tgt->cq_lock); | ||
| 837 | ctx_base_ptr = tgt->ctx_base; | 836 | ctx_base_ptr = tgt->ctx_base; |
| 838 | tgt->ctx_base = NULL; | 837 | tgt->ctx_base = NULL; |
| 839 | 838 | ||
| @@ -889,7 +888,6 @@ static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba, · 49 unmodified lines | |||
| 889 | tgt->sq, tgt->sq_dma); | 888 | tgt->sq, tgt->sq_dma); |
| 890 | tgt->sq = NULL; | 889 | tgt->sq = NULL; |
| 891 | } | 890 | } |
| 892 | spin_unlock_bh(&tgt->cq_lock); | ||
| 893 | 891 | ||
| 894 | if (ctx_base_ptr) | 892 | if (ctx_base_ptr) |
| 895 | iounmap(ctx_base_ptr); | 893 | iounmap(ctx_base_ptr); |
| @@ -102,7 +102,9 @@ do { \ · 101 unmodified lines | |||
| 102 | 102 | ||
| 103 | #define MAX_RETRIES 1 | 103 | #define MAX_RETRIES 1 |
| 104 | 104 | ||
| 105 | static struct class * ch_sysfs_class; | 105 | static const struct class ch_sysfs_class = { |
| 106 | .name = "scsi_changer", | ||
| 107 | }; | ||
| 106 | 108 | ||
| 107 | typedef struct { | 109 | typedef struct { |
| 108 | struct kref ref; | 110 | struct kref ref; |
| @@ -930,7 +932,7 @@ static int ch_probe(struct device *dev) · 821 unmodified lines | |||
| 930 | mutex_init(&ch->lock); | 932 | mutex_init(&ch->lock); |
| 931 | kref_init(&ch->ref); | 933 | kref_init(&ch->ref); |
| 932 | ch->device = sd; | 934 | ch->device = sd; |
| 933 | class_dev = device_create(ch_sysfs_class, dev, | 935 | class_dev = device_create(&ch_sysfs_class, dev, |
| 934 | MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch, | 936 | MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch, |
| 935 | "s%s", ch->name); | 937 | "s%s", ch->name); |
| 936 | if (IS_ERR(class_dev)) { | 938 | if (IS_ERR(class_dev)) { |
| @@ -955,7 +957,7 @@ static int ch_probe(struct device *dev) · 18 unmodified lines | |||
| 955 | 957 | ||
| 956 | return 0; | 958 | return 0; |
| 957 | destroy_dev: | 959 | destroy_dev: |
| 958 | device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor)); | 960 | device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor)); |
| 959 | put_device: | 961 | put_device: |
| 960 | scsi_device_put(sd); | 962 | scsi_device_put(sd); |
| 961 | remove_idr: | 963 | remove_idr: |
| @@ -974,7 +976,7 @@ static int ch_remove(struct device *dev) · 12 unmodified lines | |||
| 974 | dev_set_drvdata(dev, NULL); | 976 | dev_set_drvdata(dev, NULL); |
| 975 | spin_unlock(&ch_index_lock); | 977 | spin_unlock(&ch_index_lock); |
| 976 | 978 | ||
| 977 | device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor)); | 979 | device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor)); |
| 978 | scsi_device_put(ch->device); | 980 | scsi_device_put(ch->device); |
| 979 | kref_put(&ch->ref, ch_destroy); | 981 | kref_put(&ch->ref, ch_destroy); |
| 980 | return 0; | 982 | return 0; |
| @@ -1003,11 +1005,9 @@ static int __init init_ch_module(void) · 22 unmodified lines | |||
| 1003 | int rc; | 1005 | int rc; |
| 1004 | 1006 | ||
| 1005 | printk(KERN_INFO "SCSI Media Changer driver v" VERSION " \n"); | 1007 | printk(KERN_INFO "SCSI Media Changer driver v" VERSION " \n"); |
| 1006 | ch_sysfs_class = class_create("scsi_changer"); | 1008 | rc = class_register(&ch_sysfs_class); |
| 1007 | if (IS_ERR(ch_sysfs_class)) { | 1009 | if (rc) |
| 1008 | rc = PTR_ERR(ch_sysfs_class); | ||
| 1009 | return rc; | 1010 | return rc; |
| 1010 | } | ||
| 1011 | rc = register_chrdev(SCSI_CHANGER_MAJOR,"ch",&changer_fops); | 1011 | rc = register_chrdev(SCSI_CHANGER_MAJOR,"ch",&changer_fops); |
| 1012 | if (rc < 0) { | 1012 | if (rc < 0) { |
| 1013 | printk("Unable to get major %d for SCSI-Changer\n", | 1013 | printk("Unable to get major %d for SCSI-Changer\n", |
| @@ -1022,7 +1022,7 @@ static int __init init_ch_module(void) · 8 unmodified lines | |||
| 1022 | fail2: | 1022 | fail2: |
| 1023 | unregister_chrdev(SCSI_CHANGER_MAJOR, "ch"); | 1023 | unregister_chrdev(SCSI_CHANGER_MAJOR, "ch"); |
| 1024 | fail1: | 1024 | fail1: |
| 1025 | class_destroy(ch_sysfs_class); | 1025 | class_unregister(&ch_sysfs_class); |
| 1026 | return rc; | 1026 | return rc; |
| 1027 | } | 1027 | } |
| 1028 | 1028 | ||
| @@ -1030,7 +1030,7 @@ static void __exit exit_ch_module(void) · 1 unmodified line | |||
| 1030 | { | 1030 | { |
| 1031 | scsi_unregister_driver(&ch_template.gendrv); | 1031 | scsi_unregister_driver(&ch_template.gendrv); |
| 1032 | unregister_chrdev(SCSI_CHANGER_MAJOR, "ch"); | 1032 | unregister_chrdev(SCSI_CHANGER_MAJOR, "ch"); |
| 1033 | class_destroy(ch_sysfs_class); | 1033 | class_unregister(&ch_sysfs_class); |
| 1034 | idr_destroy(&ch_index_idr); | 1034 | idr_destroy(&ch_index_idr); |
| 1035 | } | 1035 | } |
| 1036 | 1036 | ||
| @@ -28,7 +28,12 @@ MODULE_AUTHOR("Manoj N. Kumar <manoj@linux.vnet.ibm.com>"); · 27 unmodified lines | |||
| 28 | MODULE_AUTHOR("Matthew R. Ochs <mrochs@linux.vnet.ibm.com>"); | 28 | MODULE_AUTHOR("Matthew R. Ochs <mrochs@linux.vnet.ibm.com>"); |
| 29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
| 30 | 30 | ||
| 31 | static struct class *cxlflash_class; | 31 | static char *cxlflash_devnode(const struct device *dev, umode_t *mode); |
| 32 | static const struct class cxlflash_class = { | ||
| 33 | .name = "cxlflash", | ||
| 34 | .devnode = cxlflash_devnode, | ||
| 35 | }; | ||
| 36 | |||
| 32 | static u32 cxlflash_major; | 37 | static u32 cxlflash_major; |
| 33 | static DECLARE_BITMAP(cxlflash_minor, CXLFLASH_MAX_ADAPTERS); | 38 | static DECLARE_BITMAP(cxlflash_minor, CXLFLASH_MAX_ADAPTERS); |
| 34 | 39 | ||
| @@ -3602,7 +3607,7 @@ static int init_chrdev(struct cxlflash_cfg *cfg) · 3567 unmodified lines | |||
| 3602 | goto err1; | 3607 | goto err1; |
| 3603 | } | 3608 | } |
| 3604 | 3609 | ||
| 3605 | char_dev = device_create(cxlflash_class, NULL, devno, | 3610 | char_dev = device_create(&cxlflash_class, NULL, devno, |
| 3606 | NULL, "cxlflash%d", minor); | 3611 | NULL, "cxlflash%d", minor); |
| 3607 | if (IS_ERR(char_dev)) { | 3612 | if (IS_ERR(char_dev)) { |
| 3608 | rc = PTR_ERR(char_dev); | 3613 | rc = PTR_ERR(char_dev); |
| @@ -3880,14 +3885,12 @@ static int cxlflash_class_init(void) · 271 unmodified lines | |||
| 3880 | 3885 | ||
| 3881 | cxlflash_major = MAJOR(devno); | 3886 | cxlflash_major = MAJOR(devno); |
| 3882 | 3887 | ||
| 3883 | cxlflash_class = class_create("cxlflash"); | 3888 | rc = class_register(&cxlflash_class); |
| 3884 | if (IS_ERR(cxlflash_class)) { | 3889 | if (rc) { |
| 3885 | rc = PTR_ERR(cxlflash_class); | ||
| 3886 | pr_err("%s: class_create failed rc=%d\n", __func__, rc); | 3890 | pr_err("%s: class_create failed rc=%d\n", __func__, rc); |
| 3887 | goto err; | 3891 | goto err; |
| 3888 | } | 3892 | } |
| 3889 | 3893 | ||
| 3890 | cxlflash_class->devnode = cxlflash_devnode; | ||
| 3891 | out: | 3894 | out: |
| 3892 | pr_debug("%s: returning rc=%d\n", __func__, rc); | 3895 | pr_debug("%s: returning rc=%d\n", __func__, rc); |
| 3893 | return rc; | 3896 | return rc; |
| @@ -3903,7 +3906,7 @@ static void cxlflash_class_exit(void) · 9 unmodified lines | |||
| 3903 | { | 3906 | { |
| 3904 | dev_t devno = MKDEV(cxlflash_major, 0); | 3907 | dev_t devno = MKDEV(cxlflash_major, 0); |
| 3905 | 3908 | ||
| 3906 | class_destroy(cxlflash_class); | 3909 | class_unregister(&cxlflash_class); |
| 3907 | unregister_chrdev_region(devno, CXLFLASH_MAX_ADAPTERS); | 3910 | unregister_chrdev_region(devno, CXLFLASH_MAX_ADAPTERS); |
| 3908 | } | 3911 | } |
| 3909 | 3912 | ||
| @@ -353,12 +353,13 @@ static void scsi_host_dev_release(struct device *dev) · 352 unmodified lines | |||
| 353 | 353 | ||
| 354 | if (shost->shost_state == SHOST_CREATED) { | 354 | if (shost->shost_state == SHOST_CREATED) { |
| 355 | /* | 355 | /* |
| 356 | * Free the shost_dev device name here if scsi_host_alloc() | 356 | * Free the shost_dev device name and remove the proc host dir |
| 357 | * and scsi_host_put() have been called but neither | 357 | * here if scsi_host_{alloc,put}() have been called but neither |
| 358 | * scsi_host_add() nor scsi_remove_host() has been called. | 358 | * scsi_host_add() nor scsi_remove_host() has been called. |
| 359 | * This avoids that the memory allocated for the shost_dev | 359 | * This avoids that the memory allocated for the shost_dev |
| 360 | * name is leaked. | 360 | * name as well as the proc dir structure are leaked. |
| 361 | */ | 361 | */ |
| 362 | scsi_proc_hostdir_rm(shost->hostt); | ||
| 362 | kfree(dev_name(&shost->shost_dev)); | 363 | kfree(dev_name(&shost->shost_dev)); |
| 363 | } | 364 | } |
| 364 | 365 | ||
| @@ -1621,6 +1621,16 @@ out_err: · 1620 unmodified lines | |||
| 1621 | 1621 | ||
| 1622 | /* ---------- Domain revalidation ---------- */ | 1622 | /* ---------- Domain revalidation ---------- */ |
| 1623 | 1623 | ||
| 1624 | static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp, | ||
| 1625 | u8 *sas_addr, | ||
| 1626 | enum sas_device_type *type) | ||
| 1627 | { | ||
| 1628 | memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE); | ||
| 1629 | *type = to_dev_type(&disc_resp->disc); | ||
| 1630 | if (*type == SAS_PHY_UNUSED) | ||
| 1631 | memset(sas_addr, 0, SAS_ADDR_SIZE); | ||
| 1632 | } | ||
| 1633 | |||
| 1624 | static int sas_get_phy_discover(struct domain_device *dev, | 1634 | static int sas_get_phy_discover(struct domain_device *dev, |
| 1625 | int phy_id, struct smp_disc_resp *disc_resp) | 1635 | int phy_id, struct smp_disc_resp *disc_resp) |
| 1626 | { | 1636 | { |
| @@ -1674,13 +1684,8 @@ int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id, · 47 unmodified lines | |||
| 1674 | return -ENOMEM; | 1684 | return -ENOMEM; |
| 1675 | 1685 | ||
| 1676 | res = sas_get_phy_discover(dev, phy_id, disc_resp); | 1686 | res = sas_get_phy_discover(dev, phy_id, disc_resp); |
| 1677 | if (res == 0) { | 1687 | if (res == 0) |
| 1678 | memcpy(sas_addr, disc_resp->disc.attached_sas_addr, | 1688 | sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type); |
| 1679 | SAS_ADDR_SIZE); | ||
| 1680 | *type = to_dev_type(&disc_resp->disc); | ||
| 1681 | if (*type == 0) | ||
| 1682 | memset(sas_addr, 0, SAS_ADDR_SIZE); | ||
| 1683 | } | ||
| 1684 | kfree(disc_resp); | 1689 | kfree(disc_resp); |
| 1685 | return res; | 1690 | return res; |
| 1686 | } | 1691 | } |
| @@ -1940,6 +1945,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, · 253 unmodified lines | |||
| 1940 | struct expander_device *ex = &dev->ex_dev; | 1945 | struct expander_device *ex = &dev->ex_dev; |
| 1941 | struct ex_phy *phy = &ex->ex_phy[phy_id]; | 1946 | struct ex_phy *phy = &ex->ex_phy[phy_id]; |
| 1942 | enum sas_device_type type = SAS_PHY_UNUSED; | 1947 | enum sas_device_type type = SAS_PHY_UNUSED; |
| 1948 | struct smp_disc_resp *disc_resp; | ||
| 1943 | u8 sas_addr[SAS_ADDR_SIZE]; | 1949 | u8 sas_addr[SAS_ADDR_SIZE]; |
| 1944 | char msg[80] = ""; | 1950 | char msg[80] = ""; |
| 1945 | int res; | 1951 | int res; |
| @@ -1951,33 +1957,41 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, · 5 unmodified lines | |||
| 1951 | SAS_ADDR(dev->sas_addr), phy_id, msg); | 1957 | SAS_ADDR(dev->sas_addr), phy_id, msg); |
| 1952 | 1958 | ||
| 1953 | memset(sas_addr, 0, SAS_ADDR_SIZE); | 1959 | memset(sas_addr, 0, SAS_ADDR_SIZE); |
| 1954 | res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); | 1960 | disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE); |
| 1961 | if (!disc_resp) | ||
| 1962 | return -ENOMEM; | ||
| 1963 | |||
| 1964 | res = sas_get_phy_discover(dev, phy_id, disc_resp); | ||
| 1955 | switch (res) { | 1965 | switch (res) { |
| 1956 | case SMP_RESP_NO_PHY: | 1966 | case SMP_RESP_NO_PHY: |
| 1957 | phy->phy_state = PHY_NOT_PRESENT; | 1967 | phy->phy_state = PHY_NOT_PRESENT; |
| 1958 | sas_unregister_devs_sas_addr(dev, phy_id, last); | 1968 | sas_unregister_devs_sas_addr(dev, phy_id, last); |
| 1959 | return res; | 1969 | goto out_free_resp; |
| 1960 | case SMP_RESP_PHY_VACANT: | 1970 | case SMP_RESP_PHY_VACANT: |
| 1961 | phy->phy_state = PHY_VACANT; | 1971 | phy->phy_state = PHY_VACANT; |
| 1962 | sas_unregister_devs_sas_addr(dev, phy_id, last); | 1972 | sas_unregister_devs_sas_addr(dev, phy_id, last); |
| 1963 | return res; | 1973 | goto out_free_resp; |
| 1964 | case SMP_RESP_FUNC_ACC: | 1974 | case SMP_RESP_FUNC_ACC: |
| 1965 | break; | 1975 | break; |
| 1966 | case -ECOMM: | 1976 | case -ECOMM: |
| 1967 | break; | 1977 | break; |
| 1968 | default: | 1978 | default: |
| 1969 | return res; | 1979 | goto out_free_resp; |
| 1970 | } | 1980 | } |
| 1971 | 1981 | ||
| 1982 | if (res == 0) | ||
| 1983 | sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type); | ||
| 1984 | |||
| 1972 | if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { | 1985 | if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { |
| 1973 | phy->phy_state = PHY_EMPTY; | 1986 | phy->phy_state = PHY_EMPTY; |
| 1974 | sas_unregister_devs_sas_addr(dev, phy_id, last); | 1987 | sas_unregister_devs_sas_addr(dev, phy_id, last); |
| 1975 | /* | 1988 | /* |
| 1976 | * Even though the PHY is empty, for convenience we discover | 1989 | * Even though the PHY is empty, for convenience we update |
| 1977 | * the PHY to update the PHY info, like negotiated linkrate. | 1990 | * the PHY info, like negotiated linkrate. |
| 1978 | */ | 1991 | */ |
| 1979 | sas_ex_phy_discover(dev, phy_id); | 1992 | if (res == 0) |
| 1980 | return res; | 1993 | sas_set_ex_phy(dev, phy_id, disc_resp); |
| 1994 | goto out_free_resp; | ||
| 1981 | } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && | 1995 | } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && |
| 1982 | dev_type_flutter(type, phy->attached_dev_type)) { | 1996 | dev_type_flutter(type, phy->attached_dev_type)) { |
| 1983 | struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id); | 1997 | struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id); |
| @@ -1989,7 +2003,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, · 5 unmodified lines | |||
| 1989 | action = ", needs recovery"; | 2003 | action = ", needs recovery"; |
| 1990 | pr_debug("ex %016llx phy%02d broadcast flutter%s\n", | 2004 | pr_debug("ex %016llx phy%02d broadcast flutter%s\n", |
| 1991 | SAS_ADDR(dev->sas_addr), phy_id, action); | 2005 | SAS_ADDR(dev->sas_addr), phy_id, action); |
| 1992 | return res; | 2006 | goto out_free_resp; |
| 1993 | } | 2007 | } |
| 1994 | 2008 | ||
| 1995 | /* we always have to delete the old device when we went here */ | 2009 | /* we always have to delete the old device when we went here */ |
| @@ -1998,7 +2012,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, · 2 unmodified lines | |||
| 1998 | SAS_ADDR(phy->attached_sas_addr)); | 2012 | SAS_ADDR(phy->attached_sas_addr)); |
| 1999 | sas_unregister_devs_sas_addr(dev, phy_id, last); | 2013 | sas_unregister_devs_sas_addr(dev, phy_id, last); |
| 2000 | 2014 | ||
| 2001 | return sas_discover_new(dev, phy_id); | 2015 | res = sas_discover_new(dev, phy_id); |
| 2016 | out_free_resp: | ||
| 2017 | kfree(disc_resp); | ||
| 2018 | return res; | ||
| 2002 | } | 2019 | } |
| 2003 | 2020 | ||
| 2004 | /** | 2021 | /** |
| @@ -1333,7 +1333,6 @@ struct lpfc_hba { · 1332 unmodified lines | |||
| 1333 | struct timer_list fabric_block_timer; | 1333 | struct timer_list fabric_block_timer; |
| 1334 | unsigned long bit_flags; | 1334 | unsigned long bit_flags; |
| 1335 | atomic_t num_rsrc_err; | 1335 | atomic_t num_rsrc_err; |
| 1336 | atomic_t num_cmd_success; | ||
| 1337 | unsigned long last_rsrc_error_time; | 1336 | unsigned long last_rsrc_error_time; |
| 1338 | unsigned long last_ramp_down_time; | 1337 | unsigned long last_ramp_down_time; |
| 1339 | #ifdef CONFIG_SCSI_LPFC_DEBUG_FS | 1338 | #ifdef CONFIG_SCSI_LPFC_DEBUG_FS |
| @@ -1438,6 +1437,7 @@ struct lpfc_hba { · 98 unmodified lines | |||
| 1438 | struct timer_list inactive_vmid_poll; | 1437 | struct timer_list inactive_vmid_poll; |
| 1439 | 1438 | ||
| 1440 | /* RAS Support */ | 1439 | /* RAS Support */ |
| 1440 | spinlock_t ras_fwlog_lock; /* do not take while holding another lock */ | ||
| 1441 | struct lpfc_ras_fwlog ras_fwlog; | 1441 | struct lpfc_ras_fwlog ras_fwlog; |
| 1442 | 1442 | ||
| 1443 | uint32_t iocb_cnt; | 1443 | uint32_t iocb_cnt; |
| @@ -5865,9 +5865,9 @@ lpfc_ras_fwlog_buffsize_set(struct lpfc_hba *phba, uint val) · 5864 unmodified lines | |||
| 5865 | if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) | 5865 | if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) |
| 5866 | return -EINVAL; | 5866 | return -EINVAL; |
| 5867 | 5867 | ||
| 5868 | spin_lock_irq(&phba->hbalock); | 5868 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 5869 | state = phba->ras_fwlog.state; | 5869 | state = phba->ras_fwlog.state; |
| 5870 | spin_unlock_irq(&phba->hbalock); | 5870 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 5871 | 5871 | ||
| 5872 | if (state == REG_INPROGRESS) { | 5872 | if (state == REG_INPROGRESS) { |
| 5873 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "6147 RAS Logging " | 5873 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "6147 RAS Logging " |
| @@ -2513,7 +2513,7 @@ static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t *rpi) · 2512 unmodified lines | |||
| 2513 | return -ENOMEM; | 2513 | return -ENOMEM; |
| 2514 | } | 2514 | } |
| 2515 | 2515 | ||
| 2516 | dmabuff = (struct lpfc_dmabuf *)mbox->ctx_buf; | 2516 | dmabuff = mbox->ctx_buf; |
| 2517 | mbox->ctx_buf = NULL; | 2517 | mbox->ctx_buf = NULL; |
| 2518 | mbox->ctx_ndlp = NULL; | 2518 | mbox->ctx_ndlp = NULL; |
| 2519 | status = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO); | 2519 | status = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO); |
| @@ -3169,10 +3169,10 @@ lpfc_bsg_diag_loopback_run(struct bsg_job *job) · 649 unmodified lines | |||
| 3169 | } | 3169 | } |
| 3170 | 3170 | ||
| 3171 | cmdwqe = &cmdiocbq->wqe; | 3171 | cmdwqe = &cmdiocbq->wqe; |
| 3172 | memset(cmdwqe, 0, sizeof(union lpfc_wqe)); | 3172 | memset(cmdwqe, 0, sizeof(*cmdwqe)); |
| 3173 | if (phba->sli_rev < LPFC_SLI_REV4) { | 3173 | if (phba->sli_rev < LPFC_SLI_REV4) { |
| 3174 | rspwqe = &rspiocbq->wqe; | 3174 | rspwqe = &rspiocbq->wqe; |
| 3175 | memset(rspwqe, 0, sizeof(union lpfc_wqe)); | 3175 | memset(rspwqe, 0, sizeof(*rspwqe)); |
| 3176 | } | 3176 | } |
| 3177 | 3177 | ||
| 3178 | INIT_LIST_HEAD(&head); | 3178 | INIT_LIST_HEAD(&head); |
| @@ -3376,7 +3376,7 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) · 197 unmodified lines | |||
| 3376 | unsigned long flags; | 3376 | unsigned long flags; |
| 3377 | uint8_t *pmb, *pmb_buf; | 3377 | uint8_t *pmb, *pmb_buf; |
| 3378 | 3378 | ||
| 3379 | dd_data = pmboxq->ctx_ndlp; | 3379 | dd_data = pmboxq->ctx_u.dd_data; |
| 3380 | 3380 | ||
| 3381 | /* | 3381 | /* |
| 3382 | * The outgoing buffer is readily referred from the dma buffer, | 3382 | * The outgoing buffer is readily referred from the dma buffer, |
| @@ -3553,7 +3553,7 @@ lpfc_bsg_issue_mbox_ext_handle_job(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) · 170 unmodified lines | |||
| 3553 | struct lpfc_sli_config_mbox *sli_cfg_mbx; | 3553 | struct lpfc_sli_config_mbox *sli_cfg_mbx; |
| 3554 | uint8_t *pmbx; | 3554 | uint8_t *pmbx; |
| 3555 | 3555 | ||
| 3556 | dd_data = pmboxq->ctx_buf; | 3556 | dd_data = pmboxq->ctx_u.dd_data; |
| 3557 | 3557 | ||
| 3558 | /* Determine if job has been aborted */ | 3558 | /* Determine if job has been aborted */ |
| 3559 | spin_lock_irqsave(&phba->ct_ev_lock, flags); | 3559 | spin_lock_irqsave(&phba->ct_ev_lock, flags); |
| @@ -3940,7 +3940,7 @@ lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, · 380 unmodified lines | |||
| 3940 | pmboxq->mbox_cmpl = lpfc_bsg_issue_read_mbox_ext_cmpl; | 3940 | pmboxq->mbox_cmpl = lpfc_bsg_issue_read_mbox_ext_cmpl; |
| 3941 | 3941 | ||
| 3942 | /* context fields to callback function */ | 3942 | /* context fields to callback function */ |
| 3943 | pmboxq->ctx_buf = dd_data; | 3943 | pmboxq->ctx_u.dd_data = dd_data; |
| 3944 | dd_data->type = TYPE_MBOX; | 3944 | dd_data->type = TYPE_MBOX; |
| 3945 | dd_data->set_job = job; | 3945 | dd_data->set_job = job; |
| 3946 | dd_data->context_un.mbox.pmboxq = pmboxq; | 3946 | dd_data->context_un.mbox.pmboxq = pmboxq; |
| @@ -4112,7 +4112,7 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, · 165 unmodified lines | |||
| 4112 | pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; | 4112 | pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; |
| 4113 | 4113 | ||
| 4114 | /* context fields to callback function */ | 4114 | /* context fields to callback function */ |
| 4115 | pmboxq->ctx_buf = dd_data; | 4115 | pmboxq->ctx_u.dd_data = dd_data; |
| 4116 | dd_data->type = TYPE_MBOX; | 4116 | dd_data->type = TYPE_MBOX; |
| 4117 | dd_data->set_job = job; | 4117 | dd_data->set_job = job; |
| 4118 | dd_data->context_un.mbox.pmboxq = pmboxq; | 4118 | dd_data->context_un.mbox.pmboxq = pmboxq; |
| @@ -4460,7 +4460,7 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, · 341 unmodified lines | |||
| 4460 | pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; | 4460 | pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; |
| 4461 | 4461 | ||
| 4462 | /* context fields to callback function */ | 4462 | /* context fields to callback function */ |
| 4463 | pmboxq->ctx_buf = dd_data; | 4463 | pmboxq->ctx_u.dd_data = dd_data; |
| 4464 | dd_data->type = TYPE_MBOX; | 4464 | dd_data->type = TYPE_MBOX; |
| 4465 | dd_data->set_job = job; | 4465 | dd_data->set_job = job; |
| 4466 | dd_data->context_un.mbox.pmboxq = pmboxq; | 4466 | dd_data->context_un.mbox.pmboxq = pmboxq; |
| @@ -4747,7 +4747,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct bsg_job *job, · 280 unmodified lines | |||
| 4747 | if (mbox_req->inExtWLen || mbox_req->outExtWLen) { | 4747 | if (mbox_req->inExtWLen || mbox_req->outExtWLen) { |
| 4748 | from = pmbx; | 4748 | from = pmbx; |
| 4749 | ext = from + sizeof(MAILBOX_t); | 4749 | ext = from + sizeof(MAILBOX_t); |
| 4750 | pmboxq->ctx_buf = ext; | 4750 | pmboxq->ext_buf = ext; |
| 4751 | pmboxq->in_ext_byte_len = | 4751 | pmboxq->in_ext_byte_len = |
| 4752 | mbox_req->inExtWLen * sizeof(uint32_t); | 4752 | mbox_req->inExtWLen * sizeof(uint32_t); |
| 4753 | pmboxq->out_ext_byte_len = | 4753 | pmboxq->out_ext_byte_len = |
| @@ -4875,7 +4875,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct bsg_job *job, · 121 unmodified lines | |||
| 4875 | pmboxq->mbox_cmpl = lpfc_bsg_issue_mbox_cmpl; | 4875 | pmboxq->mbox_cmpl = lpfc_bsg_issue_mbox_cmpl; |
| 4876 | 4876 | ||
| 4877 | /* setup context field to pass wait_queue pointer to wake function */ | 4877 | /* setup context field to pass wait_queue pointer to wake function */ |
| 4878 | pmboxq->ctx_ndlp = dd_data; | 4878 | pmboxq->ctx_u.dd_data = dd_data; |
| 4879 | dd_data->type = TYPE_MBOX; | 4879 | dd_data->type = TYPE_MBOX; |
| 4880 | dd_data->set_job = job; | 4880 | dd_data->set_job = job; |
| 4881 | dd_data->context_un.mbox.pmboxq = pmboxq; | 4881 | dd_data->context_un.mbox.pmboxq = pmboxq; |
| @@ -5070,12 +5070,12 @@ lpfc_bsg_get_ras_config(struct bsg_job *job) · 188 unmodified lines | |||
| 5070 | bsg_reply->reply_data.vendor_reply.vendor_rsp; | 5070 | bsg_reply->reply_data.vendor_reply.vendor_rsp; |
| 5071 | 5071 | ||
| 5072 | /* Current logging state */ | 5072 | /* Current logging state */ |
| 5073 | spin_lock_irq(&phba->hbalock); | 5073 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 5074 | if (ras_fwlog->state == ACTIVE) | 5074 | if (ras_fwlog->state == ACTIVE) |
| 5075 | ras_reply->state = LPFC_RASLOG_STATE_RUNNING; | 5075 | ras_reply->state = LPFC_RASLOG_STATE_RUNNING; |
| 5076 | else | 5076 | else |
| 5077 | ras_reply->state = LPFC_RASLOG_STATE_STOPPED; | 5077 | ras_reply->state = LPFC_RASLOG_STATE_STOPPED; |
| 5078 | spin_unlock_irq(&phba->hbalock); | 5078 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 5079 | 5079 | ||
| 5080 | ras_reply->log_level = phba->ras_fwlog.fw_loglevel; | 5080 | ras_reply->log_level = phba->ras_fwlog.fw_loglevel; |
| 5081 | ras_reply->log_buff_sz = phba->cfg_ras_fwlog_buffsize; | 5081 | ras_reply->log_buff_sz = phba->cfg_ras_fwlog_buffsize; |
| @@ -5132,13 +5132,13 @@ lpfc_bsg_set_ras_config(struct bsg_job *job) · 50 unmodified lines | |||
| 5132 | 5132 | ||
| 5133 | if (action == LPFC_RASACTION_STOP_LOGGING) { | 5133 | if (action == LPFC_RASACTION_STOP_LOGGING) { |
| 5134 | /* Check if already disabled */ | 5134 | /* Check if already disabled */ |
| 5135 | spin_lock_irq(&phba->hbalock); | 5135 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 5136 | if (ras_fwlog->state != ACTIVE) { | 5136 | if (ras_fwlog->state != ACTIVE) { |
| 5137 | spin_unlock_irq(&phba->hbalock); | 5137 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 5138 | rc = -ESRCH; | 5138 | rc = -ESRCH; |
| 5139 | goto ras_job_error; | 5139 | goto ras_job_error; |
| 5140 | } | 5140 | } |
| 5141 | spin_unlock_irq(&phba->hbalock); | 5141 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 5142 | 5142 | ||
| 5143 | /* Disable logging */ | 5143 | /* Disable logging */ |
| 5144 | lpfc_ras_stop_fwlog(phba); | 5144 | lpfc_ras_stop_fwlog(phba); |
| @@ -5149,10 +5149,10 @@ lpfc_bsg_set_ras_config(struct bsg_job *job) · 4 unmodified lines | |||
| 5149 | * FW-logging with new log-level. Return status | 5149 | * FW-logging with new log-level. Return status |
| 5150 | * "Logging already Running" to caller. | 5150 | * "Logging already Running" to caller. |
| 5151 | **/ | 5151 | **/ |
| 5152 | spin_lock_irq(&phba->hbalock); | 5152 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 5153 | if (ras_fwlog->state != INACTIVE) | 5153 | if (ras_fwlog->state != INACTIVE) |
| 5154 | action_status = -EINPROGRESS; | 5154 | action_status = -EINPROGRESS; |
| 5155 | spin_unlock_irq(&phba->hbalock); | 5155 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 5156 | 5156 | ||
| 5157 | /* Enable logging */ | 5157 | /* Enable logging */ |
| 5158 | rc = lpfc_sli4_ras_fwlog_init(phba, log_level, | 5158 | rc = lpfc_sli4_ras_fwlog_init(phba, log_level, |
| @@ -5268,13 +5268,13 @@ lpfc_bsg_get_ras_fwlog(struct bsg_job *job) · 109 unmodified lines | |||
| 5268 | goto ras_job_error; | 5268 | goto ras_job_error; |
| 5269 | 5269 | ||
| 5270 | /* Logging to be stopped before reading */ | 5270 | /* Logging to be stopped before reading */ |
| 5271 | spin_lock_irq(&phba->hbalock); | 5271 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 5272 | if (ras_fwlog->state == ACTIVE) { | 5272 | if (ras_fwlog->state == ACTIVE) { |
| 5273 | spin_unlock_irq(&phba->hbalock); | 5273 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 5274 | rc = -EINPROGRESS; | 5274 | rc = -EINPROGRESS; |
| 5275 | goto ras_job_error; | 5275 | goto ras_job_error; |
| 5276 | } | 5276 | } |
| 5277 | spin_unlock_irq(&phba->hbalock); | 5277 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 5278 | 5278 | ||
| 5279 | if (job->request_len < | 5279 | if (job->request_len < |
| 5280 | sizeof(struct fc_bsg_request) + | 5280 | sizeof(struct fc_bsg_request) + |
| @@ -2194,12 +2194,12 @@ static int lpfc_debugfs_ras_log_data(struct lpfc_hba *phba, · 2193 unmodified lines | |||
| 2194 | 2194 | ||
| 2195 | memset(buffer, 0, size); | 2195 | memset(buffer, 0, size); |
| 2196 | 2196 | ||
| 2197 | spin_lock_irq(&phba->hbalock); | 2197 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 2198 | if (phba->ras_fwlog.state != ACTIVE) { | 2198 | if (phba->ras_fwlog.state != ACTIVE) { |
| 2199 | spin_unlock_irq(&phba->hbalock); | 2199 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 2200 | return -EINVAL; | 2200 | return -EINVAL; |
| 2201 | } | 2201 | } |
| 2202 | spin_unlock_irq(&phba->hbalock); | 2202 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 2203 | 2203 | ||
| 2204 | list_for_each_entry_safe(dmabuf, next, | 2204 | list_for_each_entry_safe(dmabuf, next, |
| 2205 | &phba->ras_fwlog.fwlog_buff_list, list) { | 2205 | &phba->ras_fwlog.fwlog_buff_list, list) { |
| @@ -2250,13 +2250,13 @@ lpfc_debugfs_ras_log_open(struct inode *inode, struct file *file) · 44 unmodified lines | |||
| 2250 | int size; | 2250 | int size; |
| 2251 | int rc = -ENOMEM; | 2251 | int rc = -ENOMEM; |
| 2252 | 2252 | ||
| 2253 | spin_lock_irq(&phba->hbalock); | 2253 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 2254 | if (phba->ras_fwlog.state != ACTIVE) { | 2254 | if (phba->ras_fwlog.state != ACTIVE) { |
| 2255 | spin_unlock_irq(&phba->hbalock); | 2255 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 2256 | rc = -EINVAL; | 2256 | rc = -EINVAL; |
| 2257 | goto out; | 2257 | goto out; |
| 2258 | } | 2258 | } |
| 2259 | spin_unlock_irq(&phba->hbalock); | 2259 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 2260 | 2260 | ||
| 2261 | if (check_mul_overflow(LPFC_RAS_MIN_BUFF_POST_SIZE, | 2261 | if (check_mul_overflow(LPFC_RAS_MIN_BUFF_POST_SIZE, |
| 2262 | phba->cfg_ras_fwlog_buffsize, &size)) | 2262 | phba->cfg_ras_fwlog_buffsize, &size)) |
| @@ -4437,23 +4437,23 @@ lpfc_els_retry_delay(struct timer_list *t) · 4436 unmodified lines | |||
| 4437 | unsigned long flags; | 4437 | unsigned long flags; |
| 4438 | struct lpfc_work_evt *evtp = &ndlp->els_retry_evt; | 4438 | struct lpfc_work_evt *evtp = &ndlp->els_retry_evt; |
| 4439 | 4439 | ||
| 4440 | /* Hold a node reference for outstanding queued work */ | ||
| 4441 | if (!lpfc_nlp_get(ndlp)) | ||
| 4442 | return; | ||
| 4443 | |||
| 4440 | spin_lock_irqsave(&phba->hbalock, flags); | 4444 | spin_lock_irqsave(&phba->hbalock, flags); |
| 4441 | if (!list_empty(&evtp->evt_listp)) { | 4445 | if (!list_empty(&evtp->evt_listp)) { |
| 4442 | spin_unlock_irqrestore(&phba->hbalock, flags); | 4446 | spin_unlock_irqrestore(&phba->hbalock, flags); |
| 4447 | lpfc_nlp_put(ndlp); | ||
| 4443 | return; | 4448 | return; |
| 4444 | } | 4449 | } |
| 4445 | 4450 | ||
| 4446 | /* We need to hold the node by incrementing the reference | 4451 | evtp->evt_arg1 = ndlp; |
| 4447 | * count until the queued work is done | 4452 | evtp->evt = LPFC_EVT_ELS_RETRY; |
| 4448 | */ | 4453 | list_add_tail(&evtp->evt_listp, &phba->work_list); |
| 4449 | evtp->evt_arg1 = lpfc_nlp_get(ndlp); | ||
| 4450 | if (evtp->evt_arg1) { | ||
| 4451 | evtp->evt = LPFC_EVT_ELS_RETRY; | ||
| 4452 | list_add_tail(&evtp->evt_listp, &phba->work_list); | ||
| 4453 | lpfc_worker_wake_up(phba); | ||
| 4454 | } | ||
| 4455 | spin_unlock_irqrestore(&phba->hbalock, flags); | 4454 | spin_unlock_irqrestore(&phba->hbalock, flags); |
| 4456 | return; | 4455 | |
| 4456 | lpfc_worker_wake_up(phba); | ||
| 4457 | } | 4457 | } |
| 4458 | 4458 | ||
| 4459 | /** | 4459 | /** |
| @@ -7238,7 +7238,7 @@ lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context) · 2778 unmodified lines | |||
| 7238 | goto rdp_fail; | 7238 | goto rdp_fail; |
| 7239 | mbox->vport = rdp_context->ndlp->vport; | 7239 | mbox->vport = rdp_context->ndlp->vport; |
| 7240 | mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a0; | 7240 | mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a0; |
| 7241 | mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; | 7241 | mbox->ctx_u.rdp = rdp_context; |
| 7242 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); | 7242 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); |
| 7243 | if (rc == MBX_NOT_FINISHED) { | 7243 | if (rc == MBX_NOT_FINISHED) { |
| 7244 | lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); | 7244 | lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); |
| @@ -7290,7 +7290,7 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba, · 45 unmodified lines | |||
| 7290 | mbox->in_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; | 7290 | mbox->in_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; |
| 7291 | mbox->out_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; | 7291 | mbox->out_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; |
| 7292 | mbox->mbox_offset_word = 5; | 7292 | mbox->mbox_offset_word = 5; |
| 7293 | mbox->ctx_buf = virt; | 7293 | mbox->ext_buf = virt; |
| 7294 | } else { | 7294 | } else { |
| 7295 | bf_set(lpfc_mbx_memory_dump_type3_length, | 7295 | bf_set(lpfc_mbx_memory_dump_type3_length, |
| 7296 | &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A0_SIZE); | 7296 | &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A0_SIZE); |
| @@ -7298,7 +7298,6 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba, · 1 unmodified line | |||
| 7298 | mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); | 7298 | mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); |
| 7299 | } | 7299 | } |
| 7300 | mbox->vport = phba->pport; | 7300 | mbox->vport = phba->pport; |
| 7301 | mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; | ||
| 7302 | 7301 | ||
| 7303 | rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); | 7302 | rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); |
| 7304 | if (rc == MBX_NOT_FINISHED) { | 7303 | if (rc == MBX_NOT_FINISHED) { |
| @@ -7307,7 +7306,7 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba, · 2 unmodified lines | |||
| 7307 | } | 7306 | } |
| 7308 | 7307 | ||
| 7309 | if (phba->sli_rev == LPFC_SLI_REV4) | 7308 | if (phba->sli_rev == LPFC_SLI_REV4) |
| 7310 | mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); | 7309 | mp = mbox->ctx_buf; |
| 7311 | else | 7310 | else |
| 7312 | mp = mpsave; | 7311 | mp = mpsave; |
| 7313 | 7312 | ||
| @@ -7350,7 +7349,7 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba, · 36 unmodified lines | |||
| 7350 | mbox->in_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; | 7349 | mbox->in_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; |
| 7351 | mbox->out_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; | 7350 | mbox->out_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; |
| 7352 | mbox->mbox_offset_word = 5; | 7351 | mbox->mbox_offset_word = 5; |
| 7353 | mbox->ctx_buf = virt; | 7352 | mbox->ext_buf = virt; |
| 7354 | } else { | 7353 | } else { |
| 7355 | bf_set(lpfc_mbx_memory_dump_type3_length, | 7354 | bf_set(lpfc_mbx_memory_dump_type3_length, |
| 7356 | &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A2_SIZE); | 7355 | &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A2_SIZE); |
| @@ -7358,7 +7357,6 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba, · 1 unmodified line | |||
| 7358 | mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); | 7357 | mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); |
| 7359 | } | 7358 | } |
| 7360 | 7359 | ||
| 7361 | mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; | ||
| 7362 | rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); | 7360 | rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); |
| 7363 | if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) { | 7361 | if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) { |
| 7364 | rc = 1; | 7362 | rc = 1; |
| @@ -7500,9 +7498,9 @@ lpfc_els_lcb_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 135 unmodified lines | |||
| 7500 | int rc; | 7498 | int rc; |
| 7501 | 7499 | ||
| 7502 | mb = &pmb->u.mb; | 7500 | mb = &pmb->u.mb; |
| 7503 | lcb_context = (struct lpfc_lcb_context *)pmb->ctx_ndlp; | 7501 | lcb_context = pmb->ctx_u.lcb; |
| 7504 | ndlp = lcb_context->ndlp; | 7502 | ndlp = lcb_context->ndlp; |
| 7505 | pmb->ctx_ndlp = NULL; | 7503 | memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u)); |
| 7506 | pmb->ctx_buf = NULL; | 7504 | pmb->ctx_buf = NULL; |
| 7507 | 7505 | ||
| 7508 | shdr = (union lpfc_sli4_cfg_shdr *) | 7506 | shdr = (union lpfc_sli4_cfg_shdr *) |
| @@ -7642,7 +7640,7 @@ lpfc_sli4_set_beacon(struct lpfc_vport *vport, · 133 unmodified lines | |||
| 7642 | lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, | 7640 | lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, |
| 7643 | LPFC_MBOX_OPCODE_SET_BEACON_CONFIG, len, | 7641 | LPFC_MBOX_OPCODE_SET_BEACON_CONFIG, len, |
| 7644 | LPFC_SLI4_MBX_EMBED); | 7642 | LPFC_SLI4_MBX_EMBED); |
| 7645 | mbox->ctx_ndlp = (void *)lcb_context; | 7643 | mbox->ctx_u.lcb = lcb_context; |
| 7646 | mbox->vport = phba->pport; | 7644 | mbox->vport = phba->pport; |
| 7647 | mbox->mbox_cmpl = lpfc_els_lcb_rsp; | 7645 | mbox->mbox_cmpl = lpfc_els_lcb_rsp; |
| 7648 | bf_set(lpfc_mbx_set_beacon_port_num, &mbox->u.mqe.un.beacon_config, | 7646 | bf_set(lpfc_mbx_set_beacon_port_num, &mbox->u.mqe.un.beacon_config, |
| @@ -8639,9 +8637,9 @@ lpfc_els_rsp_rls_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 990 unmodified lines | |||
| 8639 | mb = &pmb->u.mb; | 8637 | mb = &pmb->u.mb; |
| 8640 | 8638 | ||
| 8641 | ndlp = pmb->ctx_ndlp; | 8639 | ndlp = pmb->ctx_ndlp; |
| 8642 | rxid = (uint16_t)((unsigned long)(pmb->ctx_buf) & 0xffff); | 8640 | rxid = (uint16_t)(pmb->ctx_u.ox_rx_id & 0xffff); |
| 8643 | oxid = (uint16_t)(((unsigned long)(pmb->ctx_buf) >> 16) & 0xffff); | 8641 | oxid = (uint16_t)((pmb->ctx_u.ox_rx_id >> 16) & 0xffff); |
| 8644 | pmb->ctx_buf = NULL; | 8642 | memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u)); |
| 8645 | pmb->ctx_ndlp = NULL; | 8643 | pmb->ctx_ndlp = NULL; |
| 8646 | 8644 | ||
| 8647 | if (mb->mbxStatus) { | 8645 | if (mb->mbxStatus) { |
| @@ -8745,8 +8743,7 @@ lpfc_els_rcv_rls(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, · 97 unmodified lines | |||
| 8745 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC); | 8743 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC); |
| 8746 | if (mbox) { | 8744 | if (mbox) { |
| 8747 | lpfc_read_lnk_stat(phba, mbox); | 8745 | lpfc_read_lnk_stat(phba, mbox); |
| 8748 | mbox->ctx_buf = (void *)((unsigned long) | 8746 | mbox->ctx_u.ox_rx_id = ox_id << 16 | ctx; |
| 8749 | (ox_id << 16 | ctx)); | ||
| 8750 | mbox->ctx_ndlp = lpfc_nlp_get(ndlp); | 8747 | mbox->ctx_ndlp = lpfc_nlp_get(ndlp); |
| 8751 | if (!mbox->ctx_ndlp) | 8748 | if (!mbox->ctx_ndlp) |
| 8752 | goto node_err; | 8749 | goto node_err; |
| @@ -257,7 +257,9 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 256 unmodified lines | |||
| 257 | if (evtp->evt_arg1) { | 257 | if (evtp->evt_arg1) { |
| 258 | evtp->evt = LPFC_EVT_DEV_LOSS; | 258 | evtp->evt = LPFC_EVT_DEV_LOSS; |
| 259 | list_add_tail(&evtp->evt_listp, &phba->work_list); | 259 | list_add_tail(&evtp->evt_listp, &phba->work_list); |
| 260 | spin_unlock_irqrestore(&phba->hbalock, iflags); | ||
| 260 | lpfc_worker_wake_up(phba); | 261 | lpfc_worker_wake_up(phba); |
| 262 | return; | ||
| 261 | } | 263 | } |
| 262 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 264 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
| 263 | } else { | 265 | } else { |
| @@ -275,10 +277,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 11 unmodified lines | |||
| 275 | lpfc_disc_state_machine(vport, ndlp, NULL, | 277 | lpfc_disc_state_machine(vport, ndlp, NULL, |
| 276 | NLP_EVT_DEVICE_RM); | 278 | NLP_EVT_DEVICE_RM); |
| 277 | } | 279 | } |
| 278 | |||
| 279 | } | 280 | } |
| 280 | |||
| 281 | return; | ||
| 282 | } | 281 | } |
| 283 | 282 | ||
| 284 | /** | 283 | /** |
| @@ -3429,7 +3428,7 @@ static void · 3144 unmodified lines | |||
| 3429 | lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 3428 | lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
| 3430 | { | 3429 | { |
| 3431 | MAILBOX_t *mb = &pmb->u.mb; | 3430 | MAILBOX_t *mb = &pmb->u.mb; |
| 3432 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf; | 3431 | struct lpfc_dmabuf *mp = pmb->ctx_buf; |
| 3433 | struct lpfc_vport *vport = pmb->vport; | 3432 | struct lpfc_vport *vport = pmb->vport; |
| 3434 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 3433 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
| 3435 | struct serv_parm *sp = &vport->fc_sparam; | 3434 | struct serv_parm *sp = &vport->fc_sparam; |
| @@ -3737,7 +3736,7 @@ lpfc_mbx_cmpl_read_topology(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 301 unmodified lines | |||
| 3737 | struct lpfc_mbx_read_top *la; | 3736 | struct lpfc_mbx_read_top *la; |
| 3738 | struct lpfc_sli_ring *pring; | 3737 | struct lpfc_sli_ring *pring; |
| 3739 | MAILBOX_t *mb = &pmb->u.mb; | 3738 | MAILBOX_t *mb = &pmb->u.mb; |
| 3740 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); | 3739 | struct lpfc_dmabuf *mp = pmb->ctx_buf; |
| 3741 | uint8_t attn_type; | 3740 | uint8_t attn_type; |
| 3742 | 3741 | ||
| 3743 | /* Unblock ELS traffic */ | 3742 | /* Unblock ELS traffic */ |
| @@ -3851,8 +3850,8 @@ void · 107 unmodified lines | |||
| 3851 | lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 3850 | lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
| 3852 | { | 3851 | { |
| 3853 | struct lpfc_vport *vport = pmb->vport; | 3852 | struct lpfc_vport *vport = pmb->vport; |
| 3854 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf; | 3853 | struct lpfc_dmabuf *mp = pmb->ctx_buf; |
| 3855 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 3854 | struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; |
| 3856 | 3855 | ||
| 3857 | /* The driver calls the state machine with the pmb pointer | 3856 | /* The driver calls the state machine with the pmb pointer |
| 3858 | * but wants to make sure a stale ctx_buf isn't acted on. | 3857 | * but wants to make sure a stale ctx_buf isn't acted on. |
| @@ -4066,7 +4065,7 @@ lpfc_create_static_vport(struct lpfc_hba *phba) · 207 unmodified lines | |||
| 4066 | * the dump routine is a single-use construct. | 4065 | * the dump routine is a single-use construct. |
| 4067 | */ | 4066 | */ |
| 4068 | if (pmb->ctx_buf) { | 4067 | if (pmb->ctx_buf) { |
| 4069 | mp = (struct lpfc_dmabuf *)pmb->ctx_buf; | 4068 | mp = pmb->ctx_buf; |
| 4070 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 4069 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
| 4071 | kfree(mp); | 4070 | kfree(mp); |
| 4072 | pmb->ctx_buf = NULL; | 4071 | pmb->ctx_buf = NULL; |
| @@ -4089,7 +4088,7 @@ lpfc_create_static_vport(struct lpfc_hba *phba) · 16 unmodified lines | |||
| 4089 | 4088 | ||
| 4090 | if (phba->sli_rev == LPFC_SLI_REV4) { | 4089 | if (phba->sli_rev == LPFC_SLI_REV4) { |
| 4091 | byte_count = pmb->u.mqe.un.mb_words[5]; | 4090 | byte_count = pmb->u.mqe.un.mb_words[5]; |
| 4092 | mp = (struct lpfc_dmabuf *)pmb->ctx_buf; | 4091 | mp = pmb->ctx_buf; |
| 4093 | if (byte_count > sizeof(struct static_vport_info) - | 4092 | if (byte_count > sizeof(struct static_vport_info) - |
| 4094 | offset) | 4093 | offset) |
| 4095 | byte_count = sizeof(struct static_vport_info) | 4094 | byte_count = sizeof(struct static_vport_info) |
| @@ -4169,7 +4168,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 73 unmodified lines | |||
| 4169 | { | 4168 | { |
| 4170 | struct lpfc_vport *vport = pmb->vport; | 4169 | struct lpfc_vport *vport = pmb->vport; |
| 4171 | MAILBOX_t *mb = &pmb->u.mb; | 4170 | MAILBOX_t *mb = &pmb->u.mb; |
| 4172 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 4171 | struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; |
| 4173 | 4172 | ||
| 4174 | pmb->ctx_ndlp = NULL; | 4173 | pmb->ctx_ndlp = NULL; |
| 4175 | 4174 | ||
| @@ -4307,7 +4306,7 @@ void · 131 unmodified lines | |||
| 4307 | lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 4306 | lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
| 4308 | { | 4307 | { |
| 4309 | MAILBOX_t *mb = &pmb->u.mb; | 4308 | MAILBOX_t *mb = &pmb->u.mb; |
| 4310 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 4309 | struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; |
| 4311 | struct lpfc_vport *vport = pmb->vport; | 4310 | struct lpfc_vport *vport = pmb->vport; |
| 4312 | int rc; | 4311 | int rc; |
| 4313 | 4312 | ||
| @@ -4431,7 +4430,7 @@ lpfc_mbx_cmpl_fc_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 117 unmodified lines | |||
| 4431 | { | 4430 | { |
| 4432 | struct lpfc_vport *vport = pmb->vport; | 4431 | struct lpfc_vport *vport = pmb->vport; |
| 4433 | MAILBOX_t *mb = &pmb->u.mb; | 4432 | MAILBOX_t *mb = &pmb->u.mb; |
| 4434 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 4433 | struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; |
| 4435 | 4434 | ||
| 4436 | pmb->ctx_ndlp = NULL; | 4435 | pmb->ctx_ndlp = NULL; |
| 4437 | if (mb->mbxStatus) { | 4436 | if (mb->mbxStatus) { |
| @@ -5174,7 +5173,7 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 736 unmodified lines | |||
| 5174 | struct lpfc_vport *vport = pmb->vport; | 5173 | struct lpfc_vport *vport = pmb->vport; |
| 5175 | struct lpfc_nodelist *ndlp; | 5174 | struct lpfc_nodelist *ndlp; |
| 5176 | 5175 | ||
| 5177 | ndlp = (struct lpfc_nodelist *)(pmb->ctx_ndlp); | 5176 | ndlp = pmb->ctx_ndlp; |
| 5178 | if (!ndlp) | 5177 | if (!ndlp) |
| 5179 | return; | 5178 | return; |
| 5180 | lpfc_issue_els_logo(vport, ndlp, 0); | 5179 | lpfc_issue_els_logo(vport, ndlp, 0); |
| @@ -5496,7 +5495,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 315 unmodified lines | |||
| 5496 | if ((mb = phba->sli.mbox_active)) { | 5495 | if ((mb = phba->sli.mbox_active)) { |
| 5497 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && | 5496 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && |
| 5498 | !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && | 5497 | !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && |
| 5499 | (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { | 5498 | (ndlp == mb->ctx_ndlp)) { |
| 5500 | mb->ctx_ndlp = NULL; | 5499 | mb->ctx_ndlp = NULL; |
| 5501 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 5500 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
| 5502 | } | 5501 | } |
| @@ -5507,7 +5506,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 4 unmodified lines | |||
| 5507 | list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { | 5506 | list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { |
| 5508 | if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) || | 5507 | if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) || |
| 5509 | (mb->mbox_flag & LPFC_MBX_IMED_UNREG) || | 5508 | (mb->mbox_flag & LPFC_MBX_IMED_UNREG) || |
| 5510 | (ndlp != (struct lpfc_nodelist *)mb->ctx_ndlp)) | 5509 | (ndlp != mb->ctx_ndlp)) |
| 5511 | continue; | 5510 | continue; |
| 5512 | 5511 | ||
| 5513 | mb->ctx_ndlp = NULL; | 5512 | mb->ctx_ndlp = NULL; |
| @@ -5517,7 +5516,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 3 unmodified lines | |||
| 5517 | list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { | 5516 | list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { |
| 5518 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && | 5517 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && |
| 5519 | !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && | 5518 | !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && |
| 5520 | (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { | 5519 | (ndlp == mb->ctx_ndlp)) { |
| 5521 | list_del(&mb->list); | 5520 | list_del(&mb->list); |
| 5522 | lpfc_mbox_rsrc_cleanup(phba, mb, MBOX_THD_LOCKED); | 5521 | lpfc_mbox_rsrc_cleanup(phba, mb, MBOX_THD_LOCKED); |
| 5523 | 5522 | ||
| @@ -6357,7 +6356,7 @@ void · 833 unmodified lines | |||
| 6357 | lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 6356 | lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
| 6358 | { | 6357 | { |
| 6359 | MAILBOX_t *mb = &pmb->u.mb; | 6358 | MAILBOX_t *mb = &pmb->u.mb; |
| 6360 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 6359 | struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; |
| 6361 | struct lpfc_vport *vport = pmb->vport; | 6360 | struct lpfc_vport *vport = pmb->vport; |
| 6362 | 6361 | ||
| 6363 | pmb->ctx_ndlp = NULL; | 6362 | pmb->ctx_ndlp = NULL; |
| @@ -460,7 +460,7 @@ lpfc_config_port_post(struct lpfc_hba *phba) · 459 unmodified lines | |||
| 460 | return -EIO; | 460 | return -EIO; |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | mp = (struct lpfc_dmabuf *)pmb->ctx_buf; | 463 | mp = pmb->ctx_buf; |
| 464 | 464 | ||
| 465 | /* This dmabuf was allocated by lpfc_read_sparam. The dmabuf is no | 465 | /* This dmabuf was allocated by lpfc_read_sparam. The dmabuf is no |
| 466 | * longer needed. Prevent unintended ctx_buf access as the mbox is | 466 | * longer needed. Prevent unintended ctx_buf access as the mbox is |
| @@ -2217,7 +2217,7 @@ lpfc_handle_latt(struct lpfc_hba *phba) · 1750 unmodified lines | |||
| 2217 | /* Cleanup any outstanding ELS commands */ | 2217 | /* Cleanup any outstanding ELS commands */ |
| 2218 | lpfc_els_flush_all_cmd(phba); | 2218 | lpfc_els_flush_all_cmd(phba); |
| 2219 | psli->slistat.link_event++; | 2219 | psli->slistat.link_event++; |
| 2220 | lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); | 2220 | lpfc_read_topology(phba, pmb, pmb->ctx_buf); |
| 2221 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; | 2221 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; |
| 2222 | pmb->vport = vport; | 2222 | pmb->vport = vport; |
| 2223 | /* Block ELS IOCBs until we have processed this mbox command */ | 2223 | /* Block ELS IOCBs until we have processed this mbox command */ |
| @@ -5454,7 +5454,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, · 3230 unmodified lines | |||
| 5454 | phba->sli.slistat.link_event++; | 5454 | phba->sli.slistat.link_event++; |
| 5455 | 5455 | ||
| 5456 | /* Create lpfc_handle_latt mailbox command from link ACQE */ | 5456 | /* Create lpfc_handle_latt mailbox command from link ACQE */ |
| 5457 | lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); | 5457 | lpfc_read_topology(phba, pmb, pmb->ctx_buf); |
| 5458 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; | 5458 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; |
| 5459 | pmb->vport = phba->pport; | 5459 | pmb->vport = phba->pport; |
| 5460 | 5460 | ||
| @@ -6347,7 +6347,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) · 886 unmodified lines | |||
| 6347 | phba->sli.slistat.link_event++; | 6347 | phba->sli.slistat.link_event++; |
| 6348 | 6348 | ||
| 6349 | /* Create lpfc_handle_latt mailbox command from link ACQE */ | 6349 | /* Create lpfc_handle_latt mailbox command from link ACQE */ |
| 6350 | lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); | 6350 | lpfc_read_topology(phba, pmb, pmb->ctx_buf); |
| 6351 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; | 6351 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; |
| 6352 | pmb->vport = phba->pport; | 6352 | pmb->vport = phba->pport; |
| 6353 | 6353 | ||
| @@ -7705,6 +7705,9 @@ lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) · 1351 unmodified lines | |||
| 7705 | "NVME" : " "), | 7705 | "NVME" : " "), |
| 7706 | (phba->nvmet_support ? "NVMET" : " ")); | 7706 | (phba->nvmet_support ? "NVMET" : " ")); |
| 7707 | 7707 | ||
| 7708 | /* ras_fwlog state */ | ||
| 7709 | spin_lock_init(&phba->ras_fwlog_lock); | ||
| 7710 | |||
| 7708 | /* Initialize the IO buffer list used by driver for SLI3 SCSI */ | 7711 | /* Initialize the IO buffer list used by driver for SLI3 SCSI */ |
| 7709 | spin_lock_init(&phba->scsi_buf_list_get_lock); | 7712 | spin_lock_init(&phba->scsi_buf_list_get_lock); |
| 7710 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); | 7713 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); |
| @@ -13055,7 +13058,7 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) · 5344 unmodified lines | |||
| 13055 | rc = request_threaded_irq(eqhdl->irq, | 13058 | rc = request_threaded_irq(eqhdl->irq, |
| 13056 | &lpfc_sli4_hba_intr_handler, | 13059 | &lpfc_sli4_hba_intr_handler, |
| 13057 | &lpfc_sli4_hba_intr_handler_th, | 13060 | &lpfc_sli4_hba_intr_handler_th, |
| 13058 | IRQF_ONESHOT, name, eqhdl); | 13061 | 0, name, eqhdl); |
| 13059 | if (rc) { | 13062 | if (rc) { |
| 13060 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 13063 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, |
| 13061 | "0486 MSI-X fast-path (%d) " | 13064 | "0486 MSI-X fast-path (%d) " |
| @@ -102,7 +102,7 @@ lpfc_mbox_rsrc_cleanup(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox, · 101 unmodified lines | |||
| 102 | { | 102 | { |
| 103 | struct lpfc_dmabuf *mp; | 103 | struct lpfc_dmabuf *mp; |
| 104 | 104 | ||
| 105 | mp = (struct lpfc_dmabuf *)mbox->ctx_buf; | 105 | mp = mbox->ctx_buf; |
| 106 | mbox->ctx_buf = NULL; | 106 | mbox->ctx_buf = NULL; |
| 107 | 107 | ||
| 108 | /* Release the generic BPL buffer memory. */ | 108 | /* Release the generic BPL buffer memory. */ |
| @@ -204,10 +204,8 @@ lpfc_dump_mem(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, uint16_t offset, · 95 unmodified lines | |||
| 204 | uint16_t region_id) | 204 | uint16_t region_id) |
| 205 | { | 205 | { |
| 206 | MAILBOX_t *mb; | 206 | MAILBOX_t *mb; |
| 207 | void *ctx; | ||
| 208 | 207 | ||
| 209 | mb = &pmb->u.mb; | 208 | mb = &pmb->u.mb; |
| 210 | ctx = pmb->ctx_buf; | ||
| 211 | 209 | ||
| 212 | /* Setup to dump VPD region */ | 210 | /* Setup to dump VPD region */ |
| 213 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); | 211 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); |
| @@ -219,7 +217,6 @@ lpfc_dump_mem(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, uint16_t offset, · 5 unmodified lines | |||
| 219 | mb->un.varDmp.word_cnt = (DMP_RSP_SIZE / sizeof (uint32_t)); | 217 | mb->un.varDmp.word_cnt = (DMP_RSP_SIZE / sizeof (uint32_t)); |
| 220 | mb->un.varDmp.co = 0; | 218 | mb->un.varDmp.co = 0; |
| 221 | mb->un.varDmp.resp_offset = 0; | 219 | mb->un.varDmp.resp_offset = 0; |
| 222 | pmb->ctx_buf = ctx; | ||
| 223 | mb->mbxOwner = OWN_HOST; | 220 | mb->mbxOwner = OWN_HOST; |
| 224 | return; | 221 | return; |
| 225 | } | 222 | } |
| @@ -236,11 +233,8 @@ void · 10 unmodified lines | |||
| 236 | lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 233 | lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
| 237 | { | 234 | { |
| 238 | MAILBOX_t *mb; | 235 | MAILBOX_t *mb; |
| 239 | void *ctx; | ||
| 240 | 236 | ||
| 241 | mb = &pmb->u.mb; | 237 | mb = &pmb->u.mb; |
| 242 | /* Save context so that we can restore after memset */ | ||
| 243 | ctx = pmb->ctx_buf; | ||
| 244 | 238 | ||
| 245 | /* Setup to dump VPD region */ | 239 | /* Setup to dump VPD region */ |
| 246 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); | 240 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); |
| @@ -254,7 +248,6 @@ lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 7 unmodified lines | |||
| 254 | mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE; | 248 | mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE; |
| 255 | mb->un.varDmp.co = 0; | 249 | mb->un.varDmp.co = 0; |
| 256 | mb->un.varDmp.resp_offset = 0; | 250 | mb->un.varDmp.resp_offset = 0; |
| 257 | pmb->ctx_buf = ctx; | ||
| 258 | return; | 251 | return; |
| 259 | } | 252 | } |
| 260 | 253 | ||
| @@ -372,7 +365,7 @@ lpfc_read_topology(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, · 111 unmodified lines | |||
| 372 | /* Save address for later completion and set the owner to host so that | 365 | /* Save address for later completion and set the owner to host so that |
| 373 | * the FW knows this mailbox is available for processing. | 366 | * the FW knows this mailbox is available for processing. |
| 374 | */ | 367 | */ |
| 375 | pmb->ctx_buf = (uint8_t *)mp; | 368 | pmb->ctx_buf = mp; |
| 376 | mb->mbxOwner = OWN_HOST; | 369 | mb->mbxOwner = OWN_HOST; |
| 377 | return (0); | 370 | return (0); |
| 378 | } | 371 | } |
| @@ -1816,7 +1809,7 @@ lpfc_sli4_mbox_cmd_free(struct lpfc_hba *phba, struct lpfcMboxq *mbox) · 1437 unmodified lines | |||
| 1816 | } | 1809 | } |
| 1817 | /* Reinitialize the context pointers to avoid stale usage. */ | 1810 | /* Reinitialize the context pointers to avoid stale usage. */ |
| 1818 | mbox->ctx_buf = NULL; | 1811 | mbox->ctx_buf = NULL; |
| 1819 | mbox->context3 = NULL; | 1812 | memset(&mbox->ctx_u, 0, sizeof(mbox->ctx_u)); |
| 1820 | kfree(mbox->sge_array); | 1813 | kfree(mbox->sge_array); |
| 1821 | /* Finally, free the mailbox command itself */ | 1814 | /* Finally, free the mailbox command itself */ |
| 1822 | mempool_free(mbox, phba->mbox_mem_pool); | 1815 | mempool_free(mbox, phba->mbox_mem_pool); |
| @@ -2366,8 +2359,7 @@ lpfc_mbx_cmpl_rdp_link_stat(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) · 543 unmodified lines | |||
| 2366 | { | 2359 | { |
| 2367 | MAILBOX_t *mb; | 2360 | MAILBOX_t *mb; |
| 2368 | int rc = FAILURE; | 2361 | int rc = FAILURE; |
| 2369 | struct lpfc_rdp_context *rdp_context = | 2362 | struct lpfc_rdp_context *rdp_context = mboxq->ctx_u.rdp; |
| 2370 | (struct lpfc_rdp_context *)(mboxq->ctx_ndlp); | ||
| 2371 | 2363 | ||
| 2372 | mb = &mboxq->u.mb; | 2364 | mb = &mboxq->u.mb; |
| 2373 | if (mb->mbxStatus) | 2365 | if (mb->mbxStatus) |
| @@ -2385,9 +2377,8 @@ mbx_failed: · 11 unmodified lines | |||
| 2385 | static void | 2377 | static void |
| 2386 | lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) | 2378 | lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) |
| 2387 | { | 2379 | { |
| 2388 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)mbox->ctx_buf; | 2380 | struct lpfc_dmabuf *mp = mbox->ctx_buf; |
| 2389 | struct lpfc_rdp_context *rdp_context = | 2381 | struct lpfc_rdp_context *rdp_context = mbox->ctx_u.rdp; |
| 2390 | (struct lpfc_rdp_context *)(mbox->ctx_ndlp); | ||
| 2391 | 2382 | ||
| 2392 | if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) | 2383 | if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) |
| 2393 | goto error_mbox_free; | 2384 | goto error_mbox_free; |
| @@ -2401,7 +2392,7 @@ lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) · 7 unmodified lines | |||
| 2401 | /* Save the dma buffer for cleanup in the final completion. */ | 2392 | /* Save the dma buffer for cleanup in the final completion. */ |
| 2402 | mbox->ctx_buf = mp; | 2393 | mbox->ctx_buf = mp; |
| 2403 | mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat; | 2394 | mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat; |
| 2404 | mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; | 2395 | mbox->ctx_u.rdp = rdp_context; |
| 2405 | if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED) | 2396 | if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED) |
| 2406 | goto error_mbox_free; | 2397 | goto error_mbox_free; |
| 2407 | 2398 | ||
| @@ -2416,9 +2407,8 @@ void · 8 unmodified lines | |||
| 2416 | lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) | 2407 | lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) |
| 2417 | { | 2408 | { |
| 2418 | int rc; | 2409 | int rc; |
| 2419 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); | 2410 | struct lpfc_dmabuf *mp = mbox->ctx_buf; |
| 2420 | struct lpfc_rdp_context *rdp_context = | 2411 | struct lpfc_rdp_context *rdp_context = mbox->ctx_u.rdp; |
| 2421 | (struct lpfc_rdp_context *)(mbox->ctx_ndlp); | ||
| 2422 | 2412 | ||
| 2423 | if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) | 2413 | if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) |
| 2424 | goto error; | 2414 | goto error; |
| @@ -2448,7 +2438,7 @@ lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) · 23 unmodified lines | |||
| 2448 | mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); | 2438 | mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); |
| 2449 | 2439 | ||
| 2450 | mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a2; | 2440 | mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a2; |
| 2451 | mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; | 2441 | mbox->ctx_u.rdp = rdp_context; |
| 2452 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); | 2442 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); |
| 2453 | if (rc == MBX_NOT_FINISHED) | 2443 | if (rc == MBX_NOT_FINISHED) |
| 2454 | goto error; | 2444 | goto error; |
| @@ -300,7 +300,7 @@ lpfc_defer_plogi_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *login_mbox) · 299 unmodified lines | |||
| 300 | int rc; | 300 | int rc; |
| 301 | 301 | ||
| 302 | ndlp = login_mbox->ctx_ndlp; | 302 | ndlp = login_mbox->ctx_ndlp; |
| 303 | save_iocb = login_mbox->context3; | 303 | save_iocb = login_mbox->ctx_u.save_iocb; |
| 304 | 304 | ||
| 305 | if (mb->mbxStatus == MBX_SUCCESS) { | 305 | if (mb->mbxStatus == MBX_SUCCESS) { |
| 306 | /* Now that REG_RPI completed successfully, | 306 | /* Now that REG_RPI completed successfully, |
| @@ -640,7 +640,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 333 unmodified lines | |||
| 640 | if (!login_mbox->ctx_ndlp) | 640 | if (!login_mbox->ctx_ndlp) |
| 641 | goto out; | 641 | goto out; |
| 642 | 642 | ||
| 643 | login_mbox->context3 = save_iocb; /* For PLOGI ACC */ | 643 | login_mbox->ctx_u.save_iocb = save_iocb; /* For PLOGI ACC */ |
| 644 | 644 | ||
| 645 | spin_lock_irq(&ndlp->lock); | 645 | spin_lock_irq(&ndlp->lock); |
| 646 | ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); | 646 | ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); |
| @@ -682,8 +682,8 @@ lpfc_mbx_cmpl_resume_rpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) · 35 unmodified lines | |||
| 682 | struct lpfc_nodelist *ndlp; | 682 | struct lpfc_nodelist *ndlp; |
| 683 | uint32_t cmd; | 683 | uint32_t cmd; |
| 684 | 684 | ||
| 685 | elsiocb = (struct lpfc_iocbq *)mboxq->ctx_buf; | 685 | elsiocb = mboxq->ctx_u.save_iocb; |
| 686 | ndlp = (struct lpfc_nodelist *)mboxq->ctx_ndlp; | 686 | ndlp = mboxq->ctx_ndlp; |
| 687 | vport = mboxq->vport; | 687 | vport = mboxq->vport; |
| 688 | cmd = elsiocb->drvrTimeout; | 688 | cmd = elsiocb->drvrTimeout; |
| 689 | 689 | ||
| @@ -1875,7 +1875,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport, · 1185 unmodified lines | |||
| 1875 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ | 1875 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ |
| 1876 | if ((mb = phba->sli.mbox_active)) { | 1876 | if ((mb = phba->sli.mbox_active)) { |
| 1877 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && | 1877 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && |
| 1878 | (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { | 1878 | (ndlp == mb->ctx_ndlp)) { |
| 1879 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; | 1879 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; |
| 1880 | lpfc_nlp_put(ndlp); | 1880 | lpfc_nlp_put(ndlp); |
| 1881 | mb->ctx_ndlp = NULL; | 1881 | mb->ctx_ndlp = NULL; |
| @@ -1886,7 +1886,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport, · 4 unmodified lines | |||
| 1886 | spin_lock_irq(&phba->hbalock); | 1886 | spin_lock_irq(&phba->hbalock); |
| 1887 | list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { | 1887 | list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { |
| 1888 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && | 1888 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && |
| 1889 | (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { | 1889 | (ndlp == mb->ctx_ndlp)) { |
| 1890 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; | 1890 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; |
| 1891 | lpfc_nlp_put(ndlp); | 1891 | lpfc_nlp_put(ndlp); |
| 1892 | list_del(&mb->list); | 1892 | list_del(&mb->list); |
| @@ -2616,9 +2616,9 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 2615 unmodified lines | |||
| 2616 | /* No concern about the role change on the nvme remoteport. | 2616 | /* No concern about the role change on the nvme remoteport. |
| 2617 | * The transport will update it. | 2617 | * The transport will update it. |
| 2618 | */ | 2618 | */ |
| 2619 | spin_lock_irq(&vport->phba->hbalock); | 2619 | spin_lock_irq(&ndlp->lock); |
| 2620 | ndlp->fc4_xpt_flags |= NVME_XPT_UNREG_WAIT; | 2620 | ndlp->fc4_xpt_flags |= NVME_XPT_UNREG_WAIT; |
| 2621 | spin_unlock_irq(&vport->phba->hbalock); | 2621 | spin_unlock_irq(&ndlp->lock); |
| 2622 | 2622 | ||
| 2623 | /* Don't let the host nvme transport keep sending keep-alives | 2623 | /* Don't let the host nvme transport keep sending keep-alives |
| 2624 | * on this remoteport. Vport is unloading, no recovery. The | 2624 | * on this remoteport. Vport is unloading, no recovery. The |
| @@ -1586,7 +1586,7 @@ lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) · 1585 unmodified lines | |||
| 1586 | wqe = &nvmewqe->wqe; | 1586 | wqe = &nvmewqe->wqe; |
| 1587 | 1587 | ||
| 1588 | /* Initialize WQE */ | 1588 | /* Initialize WQE */ |
| 1589 | memset(wqe, 0, sizeof(union lpfc_wqe)); | 1589 | memset(wqe, 0, sizeof(*wqe)); |
| 1590 | 1590 | ||
| 1591 | ctx_buf->iocbq->cmd_dmabuf = NULL; | 1591 | ctx_buf->iocbq->cmd_dmabuf = NULL; |
| 1592 | spin_lock(&phba->sli4_hba.sgl_list_lock); | 1592 | spin_lock(&phba->sli4_hba.sgl_list_lock); |
| @@ -167,11 +167,10 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) · 166 unmodified lines | |||
| 167 | struct Scsi_Host *shost; | 167 | struct Scsi_Host *shost; |
| 168 | struct scsi_device *sdev; | 168 | struct scsi_device *sdev; |
| 169 | unsigned long new_queue_depth; | 169 | unsigned long new_queue_depth; |
| 170 | unsigned long num_rsrc_err, num_cmd_success; | 170 | unsigned long num_rsrc_err; |
| 171 | int i; | 171 | int i; |
| 172 | 172 | ||
| 173 | num_rsrc_err = atomic_read(&phba->num_rsrc_err); | 173 | num_rsrc_err = atomic_read(&phba->num_rsrc_err); |
| 174 | num_cmd_success = atomic_read(&phba->num_cmd_success); | ||
| 175 | 174 | ||
| 176 | /* | 175 | /* |
| 177 | * The error and success command counters are global per | 176 | * The error and success command counters are global per |
| @@ -186,20 +185,16 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) · 8 unmodified lines | |||
| 186 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { | 185 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { |
| 187 | shost = lpfc_shost_from_vport(vports[i]); | 186 | shost = lpfc_shost_from_vport(vports[i]); |
| 188 | shost_for_each_device(sdev, shost) { | 187 | shost_for_each_device(sdev, shost) { |
| 189 | new_queue_depth = | 188 | if (num_rsrc_err >= sdev->queue_depth) |
| 190 | sdev->queue_depth * num_rsrc_err / | 189 | new_queue_depth = 1; |
| 191 | (num_rsrc_err + num_cmd_success); | ||
| 192 | if (!new_queue_depth) | ||
| 193 | new_queue_depth = sdev->queue_depth - 1; | ||
| 194 | else | 190 | else |
| 195 | new_queue_depth = sdev->queue_depth - | 191 | new_queue_depth = sdev->queue_depth - |
| 196 | new_queue_depth; | 192 | num_rsrc_err; |
| 197 | scsi_change_queue_depth(sdev, new_queue_depth); | 193 | scsi_change_queue_depth(sdev, new_queue_depth); |
| 198 | } | 194 | } |
| 199 | } | 195 | } |
| 200 | lpfc_destroy_vport_work_array(phba, vports); | 196 | lpfc_destroy_vport_work_array(phba, vports); |
| 201 | atomic_set(&phba->num_rsrc_err, 0); | 197 | atomic_set(&phba->num_rsrc_err, 0); |
| 202 | atomic_set(&phba->num_cmd_success, 0); | ||
| 203 | } | 198 | } |
| 204 | 199 | ||
| 205 | /** | 200 | /** |
| @@ -5336,16 +5331,6 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) · 5130 unmodified lines | |||
| 5336 | } | 5331 | } |
| 5337 | err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); | 5332 | err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); |
| 5338 | } else { | 5333 | } else { |
| 5339 | if (vport->phba->cfg_enable_bg) { | ||
| 5340 | lpfc_printf_vlog(vport, | ||
| 5341 | KERN_INFO, LOG_SCSI_CMD, | ||
| 5342 | "9038 BLKGRD: rcvd PROT_NORMAL cmd: " | ||
| 5343 | "x%x reftag x%x cnt %u pt %x\n", | ||
| 5344 | cmnd->cmnd[0], | ||
| 5345 | scsi_prot_ref_tag(cmnd), | ||
| 5346 | scsi_logical_block_count(cmnd), | ||
| 5347 | (cmnd->cmnd[1]>>5)); | ||
| 5348 | } | ||
| 5349 | err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); | 5334 | err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); |
| 5350 | } | 5335 | } |
| 5351 | 5336 | ||
| @@ -1217,9 +1217,9 @@ lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, · 1216 unmodified lines | |||
| 1217 | empty = list_empty(&phba->active_rrq_list); | 1217 | empty = list_empty(&phba->active_rrq_list); |
| 1218 | list_add_tail(&rrq->list, &phba->active_rrq_list); | 1218 | list_add_tail(&rrq->list, &phba->active_rrq_list); |
| 1219 | phba->hba_flag |= HBA_RRQ_ACTIVE; | 1219 | phba->hba_flag |= HBA_RRQ_ACTIVE; |
| 1220 | spin_unlock_irqrestore(&phba->hbalock, iflags); | ||
| 1220 | if (empty) | 1221 | if (empty) |
| 1221 | lpfc_worker_wake_up(phba); | 1222 | lpfc_worker_wake_up(phba); |
| 1222 | spin_unlock_irqrestore(&phba->hbalock, iflags); | ||
| 1223 | return 0; | 1223 | return 0; |
| 1224 | out: | 1224 | out: |
| 1225 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 1225 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
| @@ -2830,7 +2830,7 @@ lpfc_sli_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) · 1604 unmodified lines | |||
| 2830 | */ | 2830 | */ |
| 2831 | pmboxq->mbox_flag |= LPFC_MBX_WAKE; | 2831 | pmboxq->mbox_flag |= LPFC_MBX_WAKE; |
| 2832 | spin_lock_irqsave(&phba->hbalock, drvr_flag); | 2832 | spin_lock_irqsave(&phba->hbalock, drvr_flag); |
| 2833 | pmbox_done = (struct completion *)pmboxq->context3; | 2833 | pmbox_done = pmboxq->ctx_u.mbox_wait; |
| 2834 | if (pmbox_done) | 2834 | if (pmbox_done) |
| 2835 | complete(pmbox_done); | 2835 | complete(pmbox_done); |
| 2836 | spin_unlock_irqrestore(&phba->hbalock, drvr_flag); | 2836 | spin_unlock_irqrestore(&phba->hbalock, drvr_flag); |
| @@ -2885,7 +2885,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 48 unmodified lines | |||
| 2885 | if (!test_bit(FC_UNLOADING, &phba->pport->load_flag) && | 2885 | if (!test_bit(FC_UNLOADING, &phba->pport->load_flag) && |
| 2886 | pmb->u.mb.mbxCommand == MBX_REG_LOGIN64 && | 2886 | pmb->u.mb.mbxCommand == MBX_REG_LOGIN64 && |
| 2887 | !pmb->u.mb.mbxStatus) { | 2887 | !pmb->u.mb.mbxStatus) { |
| 2888 | mp = (struct lpfc_dmabuf *)pmb->ctx_buf; | 2888 | mp = pmb->ctx_buf; |
| 2889 | if (mp) { | 2889 | if (mp) { |
| 2890 | pmb->ctx_buf = NULL; | 2890 | pmb->ctx_buf = NULL; |
| 2891 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 2891 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
| @@ -2914,12 +2914,12 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 22 unmodified lines | |||
| 2914 | } | 2914 | } |
| 2915 | 2915 | ||
| 2916 | if (pmb->u.mb.mbxCommand == MBX_REG_LOGIN64) { | 2916 | if (pmb->u.mb.mbxCommand == MBX_REG_LOGIN64) { |
| 2917 | ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 2917 | ndlp = pmb->ctx_ndlp; |
| 2918 | lpfc_nlp_put(ndlp); | 2918 | lpfc_nlp_put(ndlp); |
| 2919 | } | 2919 | } |
| 2920 | 2920 | ||
| 2921 | if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) { | 2921 | if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) { |
| 2922 | ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 2922 | ndlp = pmb->ctx_ndlp; |
| 2923 | 2923 | ||
| 2924 | /* Check to see if there are any deferred events to process */ | 2924 | /* Check to see if there are any deferred events to process */ |
| 2925 | if (ndlp) { | 2925 | if (ndlp) { |
| @@ -2952,7 +2952,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 26 unmodified lines | |||
| 2952 | 2952 | ||
| 2953 | /* This nlp_put pairs with lpfc_sli4_resume_rpi */ | 2953 | /* This nlp_put pairs with lpfc_sli4_resume_rpi */ |
| 2954 | if (pmb->u.mb.mbxCommand == MBX_RESUME_RPI) { | 2954 | if (pmb->u.mb.mbxCommand == MBX_RESUME_RPI) { |
| 2955 | ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 2955 | ndlp = pmb->ctx_ndlp; |
| 2956 | lpfc_nlp_put(ndlp); | 2956 | lpfc_nlp_put(ndlp); |
| 2957 | } | 2957 | } |
| 2958 | 2958 | ||
| @@ -5819,7 +5819,7 @@ lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba) · 2860 unmodified lines | |||
| 5819 | goto out_free_mboxq; | 5819 | goto out_free_mboxq; |
| 5820 | } | 5820 | } |
| 5821 | 5821 | ||
| 5822 | mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; | 5822 | mp = mboxq->ctx_buf; |
| 5823 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | 5823 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); |
| 5824 | 5824 | ||
| 5825 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | 5825 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
| @@ -6849,9 +6849,9 @@ lpfc_ras_stop_fwlog(struct lpfc_hba *phba) · 1023 unmodified lines | |||
| 6849 | { | 6849 | { |
| 6850 | struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | 6850 | struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; |
| 6851 | 6851 | ||
| 6852 | spin_lock_irq(&phba->hbalock); | 6852 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 6853 | ras_fwlog->state = INACTIVE; | 6853 | ras_fwlog->state = INACTIVE; |
| 6854 | spin_unlock_irq(&phba->hbalock); | 6854 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 6855 | 6855 | ||
| 6856 | /* Disable FW logging to host memory */ | 6856 | /* Disable FW logging to host memory */ |
| 6857 | writel(LPFC_CTL_PDEV_CTL_DDL_RAS, | 6857 | writel(LPFC_CTL_PDEV_CTL_DDL_RAS, |
| @@ -6894,9 +6894,9 @@ lpfc_sli4_ras_dma_free(struct lpfc_hba *phba) · 36 unmodified lines | |||
| 6894 | ras_fwlog->lwpd.virt = NULL; | 6894 | ras_fwlog->lwpd.virt = NULL; |
| 6895 | } | 6895 | } |
| 6896 | 6896 | ||
| 6897 | spin_lock_irq(&phba->hbalock); | 6897 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 6898 | ras_fwlog->state = INACTIVE; | 6898 | ras_fwlog->state = INACTIVE; |
| 6899 | spin_unlock_irq(&phba->hbalock); | 6899 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 6900 | } | 6900 | } |
| 6901 | 6901 | ||
| 6902 | /** | 6902 | /** |
| @@ -6998,9 +6998,9 @@ lpfc_sli4_ras_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 95 unmodified lines | |||
| 6998 | goto disable_ras; | 6998 | goto disable_ras; |
| 6999 | } | 6999 | } |
| 7000 | 7000 | ||
| 7001 | spin_lock_irq(&phba->hbalock); | 7001 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 7002 | ras_fwlog->state = ACTIVE; | 7002 | ras_fwlog->state = ACTIVE; |
| 7003 | spin_unlock_irq(&phba->hbalock); | 7003 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 7004 | mempool_free(pmb, phba->mbox_mem_pool); | 7004 | mempool_free(pmb, phba->mbox_mem_pool); |
| 7005 | 7005 | ||
| 7006 | return; | 7006 | return; |
| @@ -7032,9 +7032,9 @@ lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba, · 25 unmodified lines | |||
| 7032 | uint32_t len = 0, fwlog_buffsize, fwlog_entry_count; | 7032 | uint32_t len = 0, fwlog_buffsize, fwlog_entry_count; |
| 7033 | int rc = 0; | 7033 | int rc = 0; |
| 7034 | 7034 | ||
| 7035 | spin_lock_irq(&phba->hbalock); | 7035 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 7036 | ras_fwlog->state = INACTIVE; | 7036 | ras_fwlog->state = INACTIVE; |
| 7037 | spin_unlock_irq(&phba->hbalock); | 7037 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 7038 | 7038 | ||
| 7039 | fwlog_buffsize = (LPFC_RAS_MIN_BUFF_POST_SIZE * | 7039 | fwlog_buffsize = (LPFC_RAS_MIN_BUFF_POST_SIZE * |
| 7040 | phba->cfg_ras_fwlog_buffsize); | 7040 | phba->cfg_ras_fwlog_buffsize); |
| @@ -7095,9 +7095,9 @@ lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba, · 54 unmodified lines | |||
| 7095 | mbx_fwlog->u.request.lwpd.addr_lo = putPaddrLow(ras_fwlog->lwpd.phys); | 7095 | mbx_fwlog->u.request.lwpd.addr_lo = putPaddrLow(ras_fwlog->lwpd.phys); |
| 7096 | mbx_fwlog->u.request.lwpd.addr_hi = putPaddrHigh(ras_fwlog->lwpd.phys); | 7096 | mbx_fwlog->u.request.lwpd.addr_hi = putPaddrHigh(ras_fwlog->lwpd.phys); |
| 7097 | 7097 | ||
| 7098 | spin_lock_irq(&phba->hbalock); | 7098 | spin_lock_irq(&phba->ras_fwlog_lock); |
| 7099 | ras_fwlog->state = REG_INPROGRESS; | 7099 | ras_fwlog->state = REG_INPROGRESS; |
| 7100 | spin_unlock_irq(&phba->hbalock); | 7100 | spin_unlock_irq(&phba->ras_fwlog_lock); |
| 7101 | mbox->vport = phba->pport; | 7101 | mbox->vport = phba->pport; |
| 7102 | mbox->mbox_cmpl = lpfc_sli4_ras_mbox_cmpl; | 7102 | mbox->mbox_cmpl = lpfc_sli4_ras_mbox_cmpl; |
| 7103 | 7103 | ||
| @@ -8766,7 +8766,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) · 1662 unmodified lines | |||
| 8766 | 8766 | ||
| 8767 | mboxq->vport = vport; | 8767 | mboxq->vport = vport; |
| 8768 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | 8768 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); |
| 8769 | mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; | 8769 | mp = mboxq->ctx_buf; |
| 8770 | if (rc == MBX_SUCCESS) { | 8770 | if (rc == MBX_SUCCESS) { |
| 8771 | memcpy(&vport->fc_sparam, mp->virt, sizeof(struct serv_parm)); | 8771 | memcpy(&vport->fc_sparam, mp->virt, sizeof(struct serv_parm)); |
| 8772 | rc = 0; | 8772 | rc = 0; |
| @@ -9548,8 +9548,8 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, · 775 unmodified lines | |||
| 9548 | } | 9548 | } |
| 9549 | 9549 | ||
| 9550 | /* Copy the mailbox extension data */ | 9550 | /* Copy the mailbox extension data */ |
| 9551 | if (pmbox->in_ext_byte_len && pmbox->ctx_buf) { | 9551 | if (pmbox->in_ext_byte_len && pmbox->ext_buf) { |
| 9552 | lpfc_sli_pcimem_bcopy(pmbox->ctx_buf, | 9552 | lpfc_sli_pcimem_bcopy(pmbox->ext_buf, |
| 9553 | (uint8_t *)phba->mbox_ext, | 9553 | (uint8_t *)phba->mbox_ext, |
| 9554 | pmbox->in_ext_byte_len); | 9554 | pmbox->in_ext_byte_len); |
| 9555 | } | 9555 | } |
| @@ -9562,10 +9562,10 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, · 6 unmodified lines | |||
| 9562 | = MAILBOX_HBA_EXT_OFFSET; | 9562 | = MAILBOX_HBA_EXT_OFFSET; |
| 9563 | 9563 | ||
| 9564 | /* Copy the mailbox extension data */ | 9564 | /* Copy the mailbox extension data */ |
| 9565 | if (pmbox->in_ext_byte_len && pmbox->ctx_buf) | 9565 | if (pmbox->in_ext_byte_len && pmbox->ext_buf) |
| 9566 | lpfc_memcpy_to_slim(phba->MBslimaddr + | 9566 | lpfc_memcpy_to_slim(phba->MBslimaddr + |
| 9567 | MAILBOX_HBA_EXT_OFFSET, | 9567 | MAILBOX_HBA_EXT_OFFSET, |
| 9568 | pmbox->ctx_buf, pmbox->in_ext_byte_len); | 9568 | pmbox->ext_buf, pmbox->in_ext_byte_len); |
| 9569 | 9569 | ||
| 9570 | if (mbx->mbxCommand == MBX_CONFIG_PORT) | 9570 | if (mbx->mbxCommand == MBX_CONFIG_PORT) |
| 9571 | /* copy command data into host mbox for cmpl */ | 9571 | /* copy command data into host mbox for cmpl */ |
| @@ -9688,9 +9688,9 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, · 116 unmodified lines | |||
| 9688 | lpfc_sli_pcimem_bcopy(phba->mbox, mbx, | 9688 | lpfc_sli_pcimem_bcopy(phba->mbox, mbx, |
| 9689 | MAILBOX_CMD_SIZE); | 9689 | MAILBOX_CMD_SIZE); |
| 9690 | /* Copy the mailbox extension data */ | 9690 | /* Copy the mailbox extension data */ |
| 9691 | if (pmbox->out_ext_byte_len && pmbox->ctx_buf) { | 9691 | if (pmbox->out_ext_byte_len && pmbox->ext_buf) { |
| 9692 | lpfc_sli_pcimem_bcopy(phba->mbox_ext, | 9692 | lpfc_sli_pcimem_bcopy(phba->mbox_ext, |
| 9693 | pmbox->ctx_buf, | 9693 | pmbox->ext_buf, |
| 9694 | pmbox->out_ext_byte_len); | 9694 | pmbox->out_ext_byte_len); |
| 9695 | } | 9695 | } |
| 9696 | } else { | 9696 | } else { |
| @@ -9698,9 +9698,9 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, · 1 unmodified line | |||
| 9698 | lpfc_memcpy_from_slim(mbx, phba->MBslimaddr, | 9698 | lpfc_memcpy_from_slim(mbx, phba->MBslimaddr, |
| 9699 | MAILBOX_CMD_SIZE); | 9699 | MAILBOX_CMD_SIZE); |
| 9700 | /* Copy the mailbox extension data */ | 9700 | /* Copy the mailbox extension data */ |
| 9701 | if (pmbox->out_ext_byte_len && pmbox->ctx_buf) { | 9701 | if (pmbox->out_ext_byte_len && pmbox->ext_buf) { |
| 9702 | lpfc_memcpy_from_slim( | 9702 | lpfc_memcpy_from_slim( |
| 9703 | pmbox->ctx_buf, | 9703 | pmbox->ext_buf, |
| 9704 | phba->MBslimaddr + | 9704 | phba->MBslimaddr + |
| 9705 | MAILBOX_HBA_EXT_OFFSET, | 9705 | MAILBOX_HBA_EXT_OFFSET, |
| 9706 | pmbox->out_ext_byte_len); | 9706 | pmbox->out_ext_byte_len); |
| @@ -11373,18 +11373,18 @@ lpfc_sli_post_recovery_event(struct lpfc_hba *phba, · 1666 unmodified lines | |||
| 11373 | unsigned long iflags; | 11373 | unsigned long iflags; |
| 11374 | struct lpfc_work_evt *evtp = &ndlp->recovery_evt; | 11374 | struct lpfc_work_evt *evtp = &ndlp->recovery_evt; |
| 11375 | 11375 | ||
| 11376 | /* Hold a node reference for outstanding queued work */ | ||
| 11377 | if (!lpfc_nlp_get(ndlp)) | ||
| 11378 | return; | ||
| 11379 | |||
| 11376 | spin_lock_irqsave(&phba->hbalock, iflags); | 11380 | spin_lock_irqsave(&phba->hbalock, iflags); |
| 11377 | if (!list_empty(&evtp->evt_listp)) { | 11381 | if (!list_empty(&evtp->evt_listp)) { |
| 11378 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 11382 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
| 11383 | lpfc_nlp_put(ndlp); | ||
| 11379 | return; | 11384 | return; |
| 11380 | } | 11385 | } |
| 11381 | 11386 | ||
| 11382 | /* Incrementing the reference count until the queued work is done. */ | 11387 | evtp->evt_arg1 = ndlp; |
| 11383 | evtp->evt_arg1 = lpfc_nlp_get(ndlp); | ||
| 11384 | if (!evtp->evt_arg1) { | ||
| 11385 | spin_unlock_irqrestore(&phba->hbalock, iflags); | ||
| 11386 | return; | ||
| 11387 | } | ||
| 11388 | evtp->evt = LPFC_EVT_RECOVER_PORT; | 11388 | evtp->evt = LPFC_EVT_RECOVER_PORT; |
| 11389 | list_add_tail(&evtp->evt_listp, &phba->work_list); | 11389 | list_add_tail(&evtp->evt_listp, &phba->work_list); |
| 11390 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 11390 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
| @@ -13262,9 +13262,9 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, · 1871 unmodified lines | |||
| 13262 | /* setup wake call as IOCB callback */ | 13262 | /* setup wake call as IOCB callback */ |
| 13263 | pmboxq->mbox_cmpl = lpfc_sli_wake_mbox_wait; | 13263 | pmboxq->mbox_cmpl = lpfc_sli_wake_mbox_wait; |
| 13264 | 13264 | ||
| 13265 | /* setup context3 field to pass wait_queue pointer to wake function */ | 13265 | /* setup ctx_u field to pass wait_queue pointer to wake function */ |
| 13266 | init_completion(&mbox_done); | 13266 | init_completion(&mbox_done); |
| 13267 | pmboxq->context3 = &mbox_done; | 13267 | pmboxq->ctx_u.mbox_wait = &mbox_done; |
| 13268 | /* now issue the command */ | 13268 | /* now issue the command */ |
| 13269 | retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); | 13269 | retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); |
| 13270 | if (retval == MBX_BUSY || retval == MBX_SUCCESS) { | 13270 | if (retval == MBX_BUSY || retval == MBX_SUCCESS) { |
| @@ -13272,7 +13272,7 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, · 1 unmodified line | |||
| 13272 | msecs_to_jiffies(timeout * 1000)); | 13272 | msecs_to_jiffies(timeout * 1000)); |
| 13273 | 13273 | ||
| 13274 | spin_lock_irqsave(&phba->hbalock, flag); | 13274 | spin_lock_irqsave(&phba->hbalock, flag); |
| 13275 | pmboxq->context3 = NULL; | 13275 | pmboxq->ctx_u.mbox_wait = NULL; |
| 13276 | /* | 13276 | /* |
| 13277 | * if LPFC_MBX_WAKE flag is set the mailbox is completed | 13277 | * if LPFC_MBX_WAKE flag is set the mailbox is completed |
| 13278 | * else do not free the resources. | 13278 | * else do not free the resources. |
| @@ -13813,10 +13813,10 @@ lpfc_sli_sp_intr_handler(int irq, void *dev_id) · 534 unmodified lines | |||
| 13813 | lpfc_sli_pcimem_bcopy(mbox, pmbox, | 13813 | lpfc_sli_pcimem_bcopy(mbox, pmbox, |
| 13814 | MAILBOX_CMD_SIZE); | 13814 | MAILBOX_CMD_SIZE); |
| 13815 | if (pmb->out_ext_byte_len && | 13815 | if (pmb->out_ext_byte_len && |
| 13816 | pmb->ctx_buf) | 13816 | pmb->ext_buf) |
| 13817 | lpfc_sli_pcimem_bcopy( | 13817 | lpfc_sli_pcimem_bcopy( |
| 13818 | phba->mbox_ext, | 13818 | phba->mbox_ext, |
| 13819 | pmb->ctx_buf, | 13819 | pmb->ext_buf, |
| 13820 | pmb->out_ext_byte_len); | 13820 | pmb->out_ext_byte_len); |
| 13821 | } | 13821 | } |
| 13822 | if (pmb->mbox_flag & LPFC_MBX_IMED_UNREG) { | 13822 | if (pmb->mbox_flag & LPFC_MBX_IMED_UNREG) { |
| @@ -13830,10 +13830,8 @@ lpfc_sli_sp_intr_handler(int irq, void *dev_id) · 7 unmodified lines | |||
| 13830 | pmbox->un.varWords[0], 0); | 13830 | pmbox->un.varWords[0], 0); |
| 13831 | 13831 | ||
| 13832 | if (!pmbox->mbxStatus) { | 13832 | if (!pmbox->mbxStatus) { |
| 13833 | mp = (struct lpfc_dmabuf *) | 13833 | mp = pmb->ctx_buf; |
| 13834 | (pmb->ctx_buf); | 13834 | ndlp = pmb->ctx_ndlp; |
| 13835 | ndlp = (struct lpfc_nodelist *) | ||
| 13836 | pmb->ctx_ndlp; | ||
| 13837 | 13835 | ||
| 13838 | /* Reg_LOGIN of dflt RPI was | 13836 | /* Reg_LOGIN of dflt RPI was |
| 13839 | * successful. new lets get | 13837 | * successful. new lets get |
| @@ -14340,8 +14338,8 @@ lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) · 500 unmodified lines | |||
| 14340 | mcqe_status, | 14338 | mcqe_status, |
| 14341 | pmbox->un.varWords[0], 0); | 14339 | pmbox->un.varWords[0], 0); |
| 14342 | if (mcqe_status == MB_CQE_STATUS_SUCCESS) { | 14340 | if (mcqe_status == MB_CQE_STATUS_SUCCESS) { |
| 14343 | mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); | 14341 | mp = pmb->ctx_buf; |
| 14344 | ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; | 14342 | ndlp = pmb->ctx_ndlp; |
| 14345 | 14343 | ||
| 14346 | /* Reg_LOGIN of dflt RPI was successful. Mark the | 14344 | /* Reg_LOGIN of dflt RPI was successful. Mark the |
| 14347 | * node as having an UNREG_LOGIN in progress to stop | 14345 | * node as having an UNREG_LOGIN in progress to stop |
| @@ -19823,14 +19821,15 @@ lpfc_sli4_remove_rpis(struct lpfc_hba *phba) · 5475 unmodified lines | |||
| 19823 | * lpfc_sli4_resume_rpi - Remove the rpi bitmask region | 19821 | * lpfc_sli4_resume_rpi - Remove the rpi bitmask region |
| 19824 | * @ndlp: pointer to lpfc nodelist data structure. | 19822 | * @ndlp: pointer to lpfc nodelist data structure. |
| 19825 | * @cmpl: completion call-back. | 19823 | * @cmpl: completion call-back. |
| 19826 | * @arg: data to load as MBox 'caller buffer information' | 19824 | * @iocbq: data to load as mbox ctx_u information |
| 19827 | * | 19825 | * |
| 19828 | * This routine is invoked to remove the memory region that | 19826 | * This routine is invoked to remove the memory region that |
| 19829 | * provided rpi via a bitmask. | 19827 | * provided rpi via a bitmask. |
| 19830 | **/ | 19828 | **/ |
| 19831 | int | 19829 | int |
| 19832 | lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, | 19830 | lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, |
| 19833 | void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *arg) | 19831 | void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), |
| 19832 | struct lpfc_iocbq *iocbq) | ||
| 19834 | { | 19833 | { |
| 19835 | LPFC_MBOXQ_t *mboxq; | 19834 | LPFC_MBOXQ_t *mboxq; |
| 19836 | struct lpfc_hba *phba = ndlp->phba; | 19835 | struct lpfc_hba *phba = ndlp->phba; |
| @@ -19859,7 +19858,7 @@ lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, · 22 unmodified lines | |||
| 19859 | lpfc_resume_rpi(mboxq, ndlp); | 19858 | lpfc_resume_rpi(mboxq, ndlp); |
| 19860 | if (cmpl) { | 19859 | if (cmpl) { |
| 19861 | mboxq->mbox_cmpl = cmpl; | 19860 | mboxq->mbox_cmpl = cmpl; |
| 19862 | mboxq->ctx_buf = arg; | 19861 | mboxq->ctx_u.save_iocb = iocbq; |
| 19863 | } else | 19862 | } else |
| 19864 | mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 19863 | mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
| 19865 | mboxq->ctx_ndlp = ndlp; | 19864 | mboxq->ctx_ndlp = ndlp; |
| @@ -20676,7 +20675,7 @@ lpfc_sli4_get_config_region23(struct lpfc_hba *phba, char *rgn23_data) · 810 unmodified lines | |||
| 20676 | if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) | 20675 | if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) |
| 20677 | goto out; | 20676 | goto out; |
| 20678 | mqe = &mboxq->u.mqe; | 20677 | mqe = &mboxq->u.mqe; |
| 20679 | mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; | 20678 | mp = mboxq->ctx_buf; |
| 20680 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | 20679 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); |
| 20681 | if (rc) | 20680 | if (rc) |
| 20682 | goto out; | 20681 | goto out; |
| @@ -21035,7 +21034,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) · 352 unmodified lines | |||
| 21035 | (mb->u.mb.mbxCommand == MBX_REG_VPI)) | 21034 | (mb->u.mb.mbxCommand == MBX_REG_VPI)) |
| 21036 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 21035 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
| 21037 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { | 21036 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { |
| 21038 | act_mbx_ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; | 21037 | act_mbx_ndlp = mb->ctx_ndlp; |
| 21039 | 21038 | ||
| 21040 | /* This reference is local to this routine. The | 21039 | /* This reference is local to this routine. The |
| 21041 | * reference is removed at routine exit. | 21040 | * reference is removed at routine exit. |
| @@ -21064,7 +21063,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) · 22 unmodified lines | |||
| 21064 | 21063 | ||
| 21065 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 21064 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
| 21066 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { | 21065 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { |
| 21067 | ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; | 21066 | ndlp = mb->ctx_ndlp; |
| 21068 | /* Unregister the RPI when mailbox complete */ | 21067 | /* Unregister the RPI when mailbox complete */ |
| 21069 | mb->mbox_flag |= LPFC_MBX_IMED_UNREG; | 21068 | mb->mbox_flag |= LPFC_MBX_IMED_UNREG; |
| 21070 | restart_loop = 1; | 21069 | restart_loop = 1; |
| @@ -21084,7 +21083,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) · 13 unmodified lines | |||
| 21084 | while (!list_empty(&mbox_cmd_list)) { | 21083 | while (!list_empty(&mbox_cmd_list)) { |
| 21085 | list_remove_head(&mbox_cmd_list, mb, LPFC_MBOXQ_t, list); | 21084 | list_remove_head(&mbox_cmd_list, mb, LPFC_MBOXQ_t, list); |
| 21086 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { | 21085 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { |
| 21087 | ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; | 21086 | ndlp = mb->ctx_ndlp; |
| 21088 | mb->ctx_ndlp = NULL; | 21087 | mb->ctx_ndlp = NULL; |
| 21089 | if (ndlp) { | 21088 | if (ndlp) { |
| 21090 | spin_lock(&ndlp->lock); | 21089 | spin_lock(&ndlp->lock); |
| @@ -1,7 +1,7 @@ | |||
| 1 | /******************************************************************* | 1 | /******************************************************************* |
| 2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
| 3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
| 4 | * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * | 4 | * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * |
| 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * | 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * |
| 6 | * Copyright (C) 2004-2016 Emulex. All rights reserved. * | 6 | * Copyright (C) 2004-2016 Emulex. All rights reserved. * |
| 7 | * EMULEX and SLI are trademarks of Emulex. * | 7 | * EMULEX and SLI are trademarks of Emulex. * |
| @@ -182,11 +182,29 @@ typedef struct lpfcMboxq { · 174 unmodified lines | |||
| 182 | struct lpfc_mqe mqe; | 182 | struct lpfc_mqe mqe; |
| 183 | } u; | 183 | } u; |
| 184 | struct lpfc_vport *vport; /* virtual port pointer */ | 184 | struct lpfc_vport *vport; /* virtual port pointer */ |
| 185 | void *ctx_ndlp; /* an lpfc_nodelist pointer */ | 185 | struct lpfc_nodelist *ctx_ndlp; /* caller ndlp pointer */ |
| 186 | void *ctx_buf; /* an lpfc_dmabuf pointer */ | 186 | struct lpfc_dmabuf *ctx_buf; /* caller buffer information */ |
| 187 | void *context3; /* a generic pointer. Code must | 187 | void *ext_buf; /* extended buffer for extended mbox |
| 188 | * accommodate the actual datatype. | 188 | * cmds. Not a generic pointer. |
| 189 | */ | 189 | * Use for storing virtual address. |
| 190 | */ | ||
| 191 | |||
| 192 | /* Pointers that are seldom used during mbox execution, but require | ||
| 193 | * a saved context. | ||
| 194 | */ | ||
| 195 | union { | ||
| 196 | unsigned long ox_rx_id; /* Used in els_rsp_rls_acc */ | ||
| 197 | struct lpfc_rdp_context *rdp; /* Used in get_rdp_info */ | ||
| 198 | struct lpfc_lcb_context *lcb; /* Used in set_beacon */ | ||
| 199 | struct completion *mbox_wait; /* Used in issue_mbox_wait */ | ||
| 200 | struct bsg_job_data *dd_data; /* Used in bsg_issue_mbox_cmpl | ||
| 201 | * and | ||
| 202 | * bsg_issue_mbox_ext_handle_job | ||
| 203 | */ | ||
| 204 | struct lpfc_iocbq *save_iocb; /* Used in defer_plogi_acc and | ||
| 205 | * lpfc_mbx_cmpl_resume_rpi | ||
| 206 | */ | ||
| 207 | } ctx_u; | ||
| 190 | 208 | ||
| 191 | void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); | 209 | void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); |
| 192 | uint8_t mbox_flag; | 210 | uint8_t mbox_flag; |
| @@ -1,7 +1,7 @@ | |||
| 1 | /******************************************************************* | 1 | /******************************************************************* |
| 2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
| 3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
| 4 | * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * | 4 | * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * |
| 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * | 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * |
| 6 | * Copyright (C) 2009-2016 Emulex. All rights reserved. * | 6 | * Copyright (C) 2009-2016 Emulex. All rights reserved. * |
| 7 | * EMULEX and SLI are trademarks of Emulex. * | 7 | * EMULEX and SLI are trademarks of Emulex. * |
| @@ -1118,8 +1118,9 @@ void lpfc_sli4_free_rpi(struct lpfc_hba *, int); · 1110 unmodified lines | |||
| 1118 | void lpfc_sli4_remove_rpis(struct lpfc_hba *); | 1118 | void lpfc_sli4_remove_rpis(struct lpfc_hba *); |
| 1119 | void lpfc_sli4_async_event_proc(struct lpfc_hba *); | 1119 | void lpfc_sli4_async_event_proc(struct lpfc_hba *); |
| 1120 | void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *); | 1120 | void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *); |
| 1121 | int lpfc_sli4_resume_rpi(struct lpfc_nodelist *, | 1121 | int lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, |
| 1122 | void (*)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *); | 1122 | void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), |
| 1123 | struct lpfc_iocbq *iocbq); | ||
| 1123 | void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba); | 1124 | void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba); |
| 1124 | void lpfc_sli4_nvme_pci_offline_aborted(struct lpfc_hba *phba, | 1125 | void lpfc_sli4_nvme_pci_offline_aborted(struct lpfc_hba *phba, |
| 1125 | struct lpfc_io_buf *lpfc_ncmd); | 1126 | struct lpfc_io_buf *lpfc_ncmd); |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | * included with this package. * | 20 | * included with this package. * |
| 21 | *******************************************************************/ | 21 | *******************************************************************/ |
| 22 | 22 | ||
| 23 | #define LPFC_DRIVER_VERSION "14.4.0.0" | 23 | #define LPFC_DRIVER_VERSION "14.4.0.1" |
| 24 | #define LPFC_DRIVER_NAME "lpfc" | 24 | #define LPFC_DRIVER_NAME "lpfc" |
| 25 | 25 | ||
| 26 | /* Used for SLI 2/3 */ | 26 | /* Used for SLI 2/3 */ |
| @@ -166,7 +166,7 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport) · 165 unmodified lines | |||
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | mp = (struct lpfc_dmabuf *)pmb->ctx_buf; | 169 | mp = pmb->ctx_buf; |
| 170 | memcpy(&vport->fc_sparam, mp->virt, sizeof (struct serv_parm)); | 170 | memcpy(&vport->fc_sparam, mp->virt, sizeof (struct serv_parm)); |
| 171 | memcpy(&vport->fc_nodename, &vport->fc_sparam.nodeName, | 171 | memcpy(&vport->fc_nodename, &vport->fc_sparam.nodeName, |
| 172 | sizeof (struct lpfc_name)); | 172 | sizeof (struct lpfc_name)); |
| @@ -674,10 +674,6 @@ lpfc_vport_delete(struct fc_vport *fc_vport) · 501 unmodified lines | |||
| 674 | lpfc_free_sysfs_attr(vport); | 674 | lpfc_free_sysfs_attr(vport); |
| 675 | lpfc_debugfs_terminate(vport); | 675 | lpfc_debugfs_terminate(vport); |
| 676 | 676 | ||
| 677 | /* Remove FC host to break driver binding. */ | ||
| 678 | fc_remove_host(shost); | ||
| 679 | scsi_remove_host(shost); | ||
| 680 | |||
| 681 | /* Send the DA_ID and Fabric LOGO to cleanup Nameserver entries. */ | 677 | /* Send the DA_ID and Fabric LOGO to cleanup Nameserver entries. */ |
| 682 | ndlp = lpfc_findnode_did(vport, Fabric_DID); | 678 | ndlp = lpfc_findnode_did(vport, Fabric_DID); |
| 683 | if (!ndlp) | 679 | if (!ndlp) |
| @@ -721,6 +717,10 @@ lpfc_vport_delete(struct fc_vport *fc_vport) · 37 unmodified lines | |||
| 721 | 717 | ||
| 722 | skip_logo: | 718 | skip_logo: |
| 723 | 719 | ||
| 720 | /* Remove FC host to break driver binding. */ | ||
| 721 | fc_remove_host(shost); | ||
| 722 | scsi_remove_host(shost); | ||
| 723 | |||
| 724 | lpfc_cleanup(vport); | 724 | lpfc_cleanup(vport); |
| 725 | 725 | ||
| 726 | /* Remove scsi host now. The nodes are cleaned up. */ | 726 | /* Remove scsi host now. The nodes are cleaned up. */ |
| @@ -1644,7 +1644,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job) · 1643 unmodified lines | |||
| 1644 | if ((mpirep_offset != 0xFF) && | 1644 | if ((mpirep_offset != 0xFF) && |
| 1645 | drv_bufs[mpirep_offset].bsg_buf_len) { | 1645 | drv_bufs[mpirep_offset].bsg_buf_len) { |
| 1646 | drv_buf_iter = &drv_bufs[mpirep_offset]; | 1646 | drv_buf_iter = &drv_bufs[mpirep_offset]; |
| 1647 | drv_buf_iter->kern_buf_len = (sizeof(*bsg_reply_buf) - 1 + | 1647 | drv_buf_iter->kern_buf_len = (sizeof(*bsg_reply_buf) + |
| 1648 | mrioc->reply_sz); | 1648 | mrioc->reply_sz); |
| 1649 | bsg_reply_buf = kzalloc(drv_buf_iter->kern_buf_len, GFP_KERNEL); | 1649 | bsg_reply_buf = kzalloc(drv_buf_iter->kern_buf_len, GFP_KERNEL); |
| 1650 | 1650 | ||
| @@ -61,7 +61,9 @@ static atomic_t pmcraid_adapter_count = ATOMIC_INIT(0); · 60 unmodified lines | |||
| 61 | * pmcraid_minor - minor number(s) to use | 61 | * pmcraid_minor - minor number(s) to use |
| 62 | */ | 62 | */ |
| 63 | static unsigned int pmcraid_major; | 63 | static unsigned int pmcraid_major; |
| 64 | static struct class *pmcraid_class; | 64 | static const struct class pmcraid_class = { |
| 65 | .name = PMCRAID_DEVFILE, | ||
| 66 | }; | ||
| 65 | static DECLARE_BITMAP(pmcraid_minor, PMCRAID_MAX_ADAPTERS); | 67 | static DECLARE_BITMAP(pmcraid_minor, PMCRAID_MAX_ADAPTERS); |
| 66 | 68 | ||
| 67 | /* | 69 | /* |
| @@ -4723,7 +4725,7 @@ static int pmcraid_setup_chrdev(struct pmcraid_instance *pinstance) · 4655 unmodified lines | |||
| 4723 | if (error) | 4725 | if (error) |
| 4724 | pmcraid_release_minor(minor); | 4726 | pmcraid_release_minor(minor); |
| 4725 | else | 4727 | else |
| 4726 | device_create(pmcraid_class, NULL, MKDEV(pmcraid_major, minor), | 4728 | device_create(&pmcraid_class, NULL, MKDEV(pmcraid_major, minor), |
| 4727 | NULL, "%s%u", PMCRAID_DEVFILE, minor); | 4729 | NULL, "%s%u", PMCRAID_DEVFILE, minor); |
| 4728 | return error; | 4730 | return error; |
| 4729 | } | 4731 | } |
| @@ -4739,7 +4741,7 @@ static int pmcraid_setup_chrdev(struct pmcraid_instance *pinstance) · 9 unmodified lines | |||
| 4739 | static void pmcraid_release_chrdev(struct pmcraid_instance *pinstance) | 4741 | static void pmcraid_release_chrdev(struct pmcraid_instance *pinstance) |
| 4740 | { | 4742 | { |
| 4741 | pmcraid_release_minor(MINOR(pinstance->cdev.dev)); | 4743 | pmcraid_release_minor(MINOR(pinstance->cdev.dev)); |
| 4742 | device_destroy(pmcraid_class, | 4744 | device_destroy(&pmcraid_class, |
| 4743 | MKDEV(pmcraid_major, MINOR(pinstance->cdev.dev))); | 4745 | MKDEV(pmcraid_major, MINOR(pinstance->cdev.dev))); |
| 4744 | cdev_del(&pinstance->cdev); | 4746 | cdev_del(&pinstance->cdev); |
| 4745 | } | 4747 | } |
| @@ -5390,10 +5392,10 @@ static int __init pmcraid_init(void) · 644 unmodified lines | |||
| 5390 | } | 5392 | } |
| 5391 | 5393 | ||
| 5392 | pmcraid_major = MAJOR(dev); | 5394 | pmcraid_major = MAJOR(dev); |
| 5393 | pmcraid_class = class_create(PMCRAID_DEVFILE); | ||
| 5394 | 5395 | ||
| 5395 | if (IS_ERR(pmcraid_class)) { | 5396 | error = class_register(&pmcraid_class); |
| 5396 | error = PTR_ERR(pmcraid_class); | 5397 | |
| 5398 | if (error) { | ||
| 5397 | pmcraid_err("failed to register with sysfs, error = %x\n", | 5399 | pmcraid_err("failed to register with sysfs, error = %x\n", |
| 5398 | error); | 5400 | error); |
| 5399 | goto out_unreg_chrdev; | 5401 | goto out_unreg_chrdev; |
| @@ -5402,7 +5404,7 @@ static int __init pmcraid_init(void) · 2 unmodified lines | |||
| 5402 | error = pmcraid_netlink_init(); | 5404 | error = pmcraid_netlink_init(); |
| 5403 | 5405 | ||
| 5404 | if (error) { | 5406 | if (error) { |
| 5405 | class_destroy(pmcraid_class); | 5407 | class_unregister(&pmcraid_class); |
| 5406 | goto out_unreg_chrdev; | 5408 | goto out_unreg_chrdev; |
| 5407 | } | 5409 | } |
| 5408 | 5410 | ||
| @@ -5413,7 +5415,7 @@ static int __init pmcraid_init(void) · 4 unmodified lines | |||
| 5413 | 5415 | ||
| 5414 | pmcraid_err("failed to register pmcraid driver, error = %x\n", | 5416 | pmcraid_err("failed to register pmcraid driver, error = %x\n", |
| 5415 | error); | 5417 | error); |
| 5416 | class_destroy(pmcraid_class); | 5418 | class_unregister(&pmcraid_class); |
| 5417 | pmcraid_netlink_release(); | 5419 | pmcraid_netlink_release(); |
| 5418 | 5420 | ||
| 5419 | out_unreg_chrdev: | 5421 | out_unreg_chrdev: |
| @@ -5432,7 +5434,7 @@ static void __exit pmcraid_exit(void) · 12 unmodified lines | |||
| 5432 | unregister_chrdev_region(MKDEV(pmcraid_major, 0), | 5434 | unregister_chrdev_region(MKDEV(pmcraid_major, 0), |
| 5433 | PMCRAID_MAX_ADAPTERS); | 5435 | PMCRAID_MAX_ADAPTERS); |
| 5434 | pci_unregister_driver(&pmcraid_driver); | 5436 | pci_unregister_driver(&pmcraid_driver); |
| 5435 | class_destroy(pmcraid_class); | 5437 | class_unregister(&pmcraid_class); |
| 5436 | } | 5438 | } |
| 5437 | 5439 | ||
| 5438 | module_init(pmcraid_init); | 5440 | module_init(pmcraid_init); |
| @@ -2741,7 +2741,13 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) · 2740 unmodified lines | |||
| 2741 | return; | 2741 | return; |
| 2742 | 2742 | ||
| 2743 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { | 2743 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { |
| 2744 | qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); | 2744 | /* Will wait for wind down of adapter */ |
| 2745 | ql_dbg(ql_dbg_aer, fcport->vha, 0x900c, | ||
| 2746 | "%s pci offline detected (id %06x)\n", __func__, | ||
| 2747 | fcport->d_id.b24); | ||
| 2748 | qla_pci_set_eeh_busy(fcport->vha); | ||
| 2749 | qla2x00_eh_wait_for_pending_commands(fcport->vha, fcport->d_id.b24, | ||
| 2750 | 0, WAIT_TARGET); | ||
| 2745 | return; | 2751 | return; |
| 2746 | } | 2752 | } |
| 2747 | } | 2753 | } |
| @@ -2763,7 +2769,11 @@ qla2x00_terminate_rport_io(struct fc_rport *rport) · 15 unmodified lines | |||
| 2763 | vha = fcport->vha; | 2769 | vha = fcport->vha; |
| 2764 | 2770 | ||
| 2765 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { | 2771 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { |
| 2766 | qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); | 2772 | /* Will wait for wind down of adapter */ |
| 2773 | ql_dbg(ql_dbg_aer, fcport->vha, 0x900b, | ||
| 2774 | "%s pci offline detected (id %06x)\n", __func__, | ||
| 2775 | fcport->d_id.b24); | ||
| 2776 | qla_pci_set_eeh_busy(vha); | ||
| 2767 | qla2x00_eh_wait_for_pending_commands(fcport->vha, fcport->d_id.b24, | 2777 | qla2x00_eh_wait_for_pending_commands(fcport->vha, fcport->d_id.b24, |
| 2768 | 0, WAIT_TARGET); | 2778 | 0, WAIT_TARGET); |
| 2769 | return; | 2779 | return; |
| @@ -82,7 +82,7 @@ typedef union { · 81 unmodified lines | |||
| 82 | #include "qla_nvme.h" | 82 | #include "qla_nvme.h" |
| 83 | #define QLA2XXX_DRIVER_NAME "qla2xxx" | 83 | #define QLA2XXX_DRIVER_NAME "qla2xxx" |
| 84 | #define QLA2XXX_APIDEV "ql2xapidev" | 84 | #define QLA2XXX_APIDEV "ql2xapidev" |
| 85 | #define QLA2XXX_MANUFACTURER "Marvell Semiconductor, Inc." | 85 | #define QLA2XXX_MANUFACTURER "Marvell" |
| 86 | 86 | ||
| 87 | /* | 87 | /* |
| 88 | * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, | 88 | * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, |
| @@ -44,7 +44,7 @@ extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *); · 43 unmodified lines | |||
| 44 | extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *); | 44 | extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *); |
| 45 | 45 | ||
| 46 | extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t); | 46 | extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t); |
| 47 | extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool); | 47 | extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *); |
| 48 | extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, | 48 | extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, |
| 49 | struct els_plogi *els_plogi); | 49 | struct els_plogi *els_plogi); |
| 50 | 50 | ||
| @@ -1193,8 +1193,12 @@ int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport) · 1192 unmodified lines | |||
| 1193 | return rval; | 1193 | return rval; |
| 1194 | 1194 | ||
| 1195 | done_free_sp: | 1195 | done_free_sp: |
| 1196 | /* ref: INIT */ | 1196 | /* |
| 1197 | kref_put(&sp->cmd_kref, qla2x00_sp_release); | 1197 | * use qla24xx_async_gnl_sp_done to purge all pending gnl request. |
| 1198 | * kref_put is call behind the scene. | ||
| 1199 | */ | ||
| 1200 | sp->u.iocb_cmd.u.mbx.in_mb[0] = MBS_COMMAND_ERROR; | ||
| 1201 | qla24xx_async_gnl_sp_done(sp, QLA_COMMAND_ERROR); | ||
| 1198 | fcport->flags &= ~(FCF_ASYNC_SENT); | 1202 | fcport->flags &= ~(FCF_ASYNC_SENT); |
| 1199 | done: | 1203 | done: |
| 1200 | fcport->flags &= ~(FCF_ASYNC_ACTIVE); | 1204 | fcport->flags &= ~(FCF_ASYNC_ACTIVE); |
| @@ -2665,6 +2669,40 @@ exit: · 1464 unmodified lines | |||
| 2665 | return rval; | 2669 | return rval; |
| 2666 | } | 2670 | } |
| 2667 | 2671 | ||
| 2672 | static void qla_enable_fce_trace(scsi_qla_host_t *vha) | ||
| 2673 | { | ||
| 2674 | int rval; | ||
| 2675 | struct qla_hw_data *ha = vha->hw; | ||
| 2676 | |||
| 2677 | if (ha->fce) { | ||
| 2678 | ha->flags.fce_enabled = 1; | ||
| 2679 | memset(ha->fce, 0, fce_calc_size(ha->fce_bufs)); | ||
| 2680 | rval = qla2x00_enable_fce_trace(vha, | ||
| 2681 | ha->fce_dma, ha->fce_bufs, ha->fce_mb, &ha->fce_bufs); | ||
| 2682 | |||
| 2683 | if (rval) { | ||
| 2684 | ql_log(ql_log_warn, vha, 0x8033, | ||
| 2685 | "Unable to reinitialize FCE (%d).\n", rval); | ||
| 2686 | ha->flags.fce_enabled = 0; | ||
| 2687 | } | ||
| 2688 | } | ||
| 2689 | } | ||
| 2690 | |||
| 2691 | static void qla_enable_eft_trace(scsi_qla_host_t *vha) | ||
| 2692 | { | ||
| 2693 | int rval; | ||
| 2694 | struct qla_hw_data *ha = vha->hw; | ||
| 2695 | |||
| 2696 | if (ha->eft) { | ||
| 2697 | memset(ha->eft, 0, EFT_SIZE); | ||
| 2698 | rval = qla2x00_enable_eft_trace(vha, ha->eft_dma, EFT_NUM_BUFFERS); | ||
| 2699 | |||
| 2700 | if (rval) { | ||
| 2701 | ql_log(ql_log_warn, vha, 0x8034, | ||
| 2702 | "Unable to reinitialize EFT (%d).\n", rval); | ||
| 2703 | } | ||
| 2704 | } | ||
| 2705 | } | ||
| 2668 | /* | 2706 | /* |
| 2669 | * qla2x00_initialize_adapter | 2707 | * qla2x00_initialize_adapter |
| 2670 | * Initialize board. | 2708 | * Initialize board. |
| @@ -3668,9 +3706,8 @@ qla24xx_chip_diag(scsi_qla_host_t *vha) · 997 unmodified lines | |||
| 3668 | } | 3706 | } |
| 3669 | 3707 | ||
| 3670 | static void | 3708 | static void |
| 3671 | qla2x00_init_fce_trace(scsi_qla_host_t *vha) | 3709 | qla2x00_alloc_fce_trace(scsi_qla_host_t *vha) |
| 3672 | { | 3710 | { |
| 3673 | int rval; | ||
| 3674 | dma_addr_t tc_dma; | 3711 | dma_addr_t tc_dma; |
| 3675 | void *tc; | 3712 | void *tc; |
| 3676 | struct qla_hw_data *ha = vha->hw; | 3713 | struct qla_hw_data *ha = vha->hw; |
| @@ -3699,27 +3736,17 @@ qla2x00_init_fce_trace(scsi_qla_host_t *vha) · 22 unmodified lines | |||
| 3699 | return; | 3736 | return; |
| 3700 | } | 3737 | } |
| 3701 | 3738 | ||
| 3702 | rval = qla2x00_enable_fce_trace(vha, tc_dma, FCE_NUM_BUFFERS, | ||
| 3703 | ha->fce_mb, &ha->fce_bufs); | ||
| 3704 | if (rval) { | ||
| 3705 | ql_log(ql_log_warn, vha, 0x00bf, | ||
| 3706 | "Unable to initialize FCE (%d).\n", rval); | ||
| 3707 | dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, tc_dma); | ||
| 3708 | return; | ||
| 3709 | } | ||
| 3710 | |||
| 3711 | ql_dbg(ql_dbg_init, vha, 0x00c0, | 3739 | ql_dbg(ql_dbg_init, vha, 0x00c0, |
| 3712 | "Allocated (%d KB) for FCE...\n", FCE_SIZE / 1024); | 3740 | "Allocated (%d KB) for FCE...\n", FCE_SIZE / 1024); |
| 3713 | 3741 | ||
| 3714 | ha->flags.fce_enabled = 1; | ||
| 3715 | ha->fce_dma = tc_dma; | 3742 | ha->fce_dma = tc_dma; |
| 3716 | ha->fce = tc; | 3743 | ha->fce = tc; |
| 3744 | ha->fce_bufs = FCE_NUM_BUFFERS; | ||
| 3717 | } | 3745 | } |
| 3718 | 3746 | ||
| 3719 | static void | 3747 | static void |
| 3720 | qla2x00_init_eft_trace(scsi_qla_host_t *vha) | 3748 | qla2x00_alloc_eft_trace(scsi_qla_host_t *vha) |
| 3721 | { | 3749 | { |
| 3722 | int rval; | ||
| 3723 | dma_addr_t tc_dma; | 3750 | dma_addr_t tc_dma; |
| 3724 | void *tc; | 3751 | void *tc; |
| 3725 | struct qla_hw_data *ha = vha->hw; | 3752 | struct qla_hw_data *ha = vha->hw; |
| @@ -3744,14 +3771,6 @@ qla2x00_init_eft_trace(scsi_qla_host_t *vha) · 18 unmodified lines | |||
| 3744 | return; | 3771 | return; |
| 3745 | } | 3772 | } |
| 3746 | 3773 | ||
| 3747 | rval = qla2x00_enable_eft_trace(vha, tc_dma, EFT_NUM_BUFFERS); | ||
| 3748 | if (rval) { | ||
| 3749 | ql_log(ql_log_warn, vha, 0x00c2, | ||
| 3750 | "Unable to initialize EFT (%d).\n", rval); | ||
| 3751 | dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, tc_dma); | ||
| 3752 | return; | ||
| 3753 | } | ||
| 3754 | |||
| 3755 | ql_dbg(ql_dbg_init, vha, 0x00c3, | 3774 | ql_dbg(ql_dbg_init, vha, 0x00c3, |
| 3756 | "Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024); | 3775 | "Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024); |
| 3757 | 3776 | ||
| @@ -3759,13 +3778,6 @@ qla2x00_init_eft_trace(scsi_qla_host_t *vha) · 1 unmodified line | |||
| 3759 | ha->eft = tc; | 3778 | ha->eft = tc; |
| 3760 | } | 3779 | } |
| 3761 | 3780 | ||
| 3762 | static void | ||
| 3763 | qla2x00_alloc_offload_mem(scsi_qla_host_t *vha) | ||
| 3764 | { | ||
| 3765 | qla2x00_init_fce_trace(vha); | ||
| 3766 | qla2x00_init_eft_trace(vha); | ||
| 3767 | } | ||
| 3768 | |||
| 3769 | void | 3781 | void |
| 3770 | qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) | 3782 | qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) |
| 3771 | { | 3783 | { |
| @@ -3820,10 +3832,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) · 48 unmodified lines | |||
| 3820 | if (ha->tgt.atio_ring) | 3832 | if (ha->tgt.atio_ring) |
| 3821 | mq_size += ha->tgt.atio_q_length * sizeof(request_t); | 3833 | mq_size += ha->tgt.atio_q_length * sizeof(request_t); |
| 3822 | 3834 | ||
| 3823 | qla2x00_init_fce_trace(vha); | 3835 | qla2x00_alloc_fce_trace(vha); |
| 3824 | if (ha->fce) | 3836 | if (ha->fce) |
| 3825 | fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE; | 3837 | fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE; |
| 3826 | qla2x00_init_eft_trace(vha); | 3838 | qla2x00_alloc_eft_trace(vha); |
| 3827 | if (ha->eft) | 3839 | if (ha->eft) |
| 3828 | eft_size = EFT_SIZE; | 3840 | eft_size = EFT_SIZE; |
| 3829 | } | 3841 | } |
| @@ -4253,7 +4265,6 @@ qla2x00_setup_chip(scsi_qla_host_t *vha) · 423 unmodified lines | |||
| 4253 | struct qla_hw_data *ha = vha->hw; | 4265 | struct qla_hw_data *ha = vha->hw; |
| 4254 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 4266 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
| 4255 | unsigned long flags; | 4267 | unsigned long flags; |
| 4256 | uint16_t fw_major_version; | ||
| 4257 | int done_once = 0; | 4268 | int done_once = 0; |
| 4258 | 4269 | ||
| 4259 | if (IS_P3P_TYPE(ha)) { | 4270 | if (IS_P3P_TYPE(ha)) { |
| @@ -4320,7 +4331,6 @@ execute_fw_with_lr: · 60 unmodified lines | |||
| 4320 | goto failed; | 4331 | goto failed; |
| 4321 | 4332 | ||
| 4322 | enable_82xx_npiv: | 4333 | enable_82xx_npiv: |
| 4323 | fw_major_version = ha->fw_major_version; | ||
| 4324 | if (IS_P3P_TYPE(ha)) | 4334 | if (IS_P3P_TYPE(ha)) |
| 4325 | qla82xx_check_md_needed(vha); | 4335 | qla82xx_check_md_needed(vha); |
| 4326 | else | 4336 | else |
| @@ -4349,12 +4359,11 @@ enable_82xx_npiv: · 22 unmodified lines | |||
| 4349 | if (rval != QLA_SUCCESS) | 4359 | if (rval != QLA_SUCCESS) |
| 4350 | goto failed; | 4360 | goto failed; |
| 4351 | 4361 | ||
| 4352 | if (!fw_major_version && !(IS_P3P_TYPE(ha))) | ||
| 4353 | qla2x00_alloc_offload_mem(vha); | ||
| 4354 | |||
| 4355 | if (ql2xallocfwdump && !(IS_P3P_TYPE(ha))) | 4362 | if (ql2xallocfwdump && !(IS_P3P_TYPE(ha))) |
| 4356 | qla2x00_alloc_fw_dump(vha); | 4363 | qla2x00_alloc_fw_dump(vha); |
| 4357 | 4364 | ||
| 4365 | qla_enable_fce_trace(vha); | ||
| 4366 | qla_enable_eft_trace(vha); | ||
| 4358 | } else { | 4367 | } else { |
| 4359 | goto failed; | 4368 | goto failed; |
| 4360 | } | 4369 | } |
| @@ -7487,12 +7496,12 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) · 3126 unmodified lines | |||
| 7487 | int | 7496 | int |
| 7488 | qla2x00_abort_isp(scsi_qla_host_t *vha) | 7497 | qla2x00_abort_isp(scsi_qla_host_t *vha) |
| 7489 | { | 7498 | { |
| 7490 | int rval; | ||
| 7491 | uint8_t status = 0; | 7499 | uint8_t status = 0; |
| 7492 | struct qla_hw_data *ha = vha->hw; | 7500 | struct qla_hw_data *ha = vha->hw; |
| 7493 | struct scsi_qla_host *vp, *tvp; | 7501 | struct scsi_qla_host *vp, *tvp; |
| 7494 | struct req_que *req = ha->req_q_map[0]; | 7502 | struct req_que *req = ha->req_q_map[0]; |
| 7495 | unsigned long flags; | 7503 | unsigned long flags; |
| 7504 | fc_port_t *fcport; | ||
| 7496 | 7505 | ||
| 7497 | if (vha->flags.online) { | 7506 | if (vha->flags.online) { |
| 7498 | qla2x00_abort_isp_cleanup(vha); | 7507 | qla2x00_abort_isp_cleanup(vha); |
| @@ -7561,6 +7570,15 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) · 62 unmodified lines | |||
| 7561 | "ISP Abort - ISP reg disconnect post nvmram config, exiting.\n"); | 7570 | "ISP Abort - ISP reg disconnect post nvmram config, exiting.\n"); |
| 7562 | return status; | 7571 | return status; |
| 7563 | } | 7572 | } |
| 7573 | |||
| 7574 | /* User may have updated [fcp|nvme] prefer in flash */ | ||
| 7575 | list_for_each_entry(fcport, &vha->vp_fcports, list) { | ||
| 7576 | if (NVME_PRIORITY(ha, fcport)) | ||
| 7577 | fcport->do_prli_nvme = 1; | ||
| 7578 | else | ||
| 7579 | fcport->do_prli_nvme = 0; | ||
| 7580 | } | ||
| 7581 | |||
| 7564 | if (!qla2x00_restart_isp(vha)) { | 7582 | if (!qla2x00_restart_isp(vha)) { |
| 7565 | clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); | 7583 | clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); |
| 7566 | 7584 | ||
| @@ -7581,31 +7599,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) · 14 unmodified lines | |||
| 7581 | 7599 | ||
| 7582 | if (IS_QLA81XX(ha) || IS_QLA8031(ha)) | 7600 | if (IS_QLA81XX(ha) || IS_QLA8031(ha)) |
| 7583 | qla2x00_get_fw_version(vha); | 7601 | qla2x00_get_fw_version(vha); |
| 7584 | if (ha->fce) { | ||
| 7585 | ha->flags.fce_enabled = 1; | ||
| 7586 | memset(ha->fce, 0, | ||
| 7587 | fce_calc_size(ha->fce_bufs)); | ||
| 7588 | rval = qla2x00_enable_fce_trace(vha, | ||
| 7589 | ha->fce_dma, ha->fce_bufs, ha->fce_mb, | ||
| 7590 | &ha->fce_bufs); | ||
| 7591 | if (rval) { | ||
| 7592 | ql_log(ql_log_warn, vha, 0x8033, | ||
| 7593 | "Unable to reinitialize FCE " | ||
| 7594 | "(%d).\n", rval); | ||
| 7595 | ha->flags.fce_enabled = 0; | ||
| 7596 | } | ||
| 7597 | } | ||
| 7598 | 7602 | ||
| 7599 | if (ha->eft) { | ||
| 7600 | memset(ha->eft, 0, EFT_SIZE); | ||
| 7601 | rval = qla2x00_enable_eft_trace(vha, | ||
| 7602 | ha->eft_dma, EFT_NUM_BUFFERS); | ||
| 7603 | if (rval) { | ||
| 7604 | ql_log(ql_log_warn, vha, 0x8034, | ||
| 7605 | "Unable to reinitialize EFT " | ||
| 7606 | "(%d).\n", rval); | ||
| 7607 | } | ||
| 7608 | } | ||
| 7609 | } else { /* failed the ISP abort */ | 7603 | } else { /* failed the ISP abort */ |
| 7610 | vha->flags.online = 1; | 7604 | vha->flags.online = 1; |
| 7611 | if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | 7605 | if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { |
| @@ -7655,6 +7649,14 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) · 43 unmodified lines | |||
| 7655 | atomic_inc(&vp->vref_count); | 7649 | atomic_inc(&vp->vref_count); |
| 7656 | spin_unlock_irqrestore(&ha->vport_slock, flags); | 7650 | spin_unlock_irqrestore(&ha->vport_slock, flags); |
| 7657 | 7651 | ||
| 7652 | /* User may have updated [fcp|nvme] prefer in flash */ | ||
| 7653 | list_for_each_entry(fcport, &vp->vp_fcports, list) { | ||
| 7654 | if (NVME_PRIORITY(ha, fcport)) | ||
| 7655 | fcport->do_prli_nvme = 1; | ||
| 7656 | else | ||
| 7657 | fcport->do_prli_nvme = 0; | ||
| 7658 | } | ||
| 7659 | |||
| 7658 | qla2x00_vp_abort_isp(vp); | 7660 | qla2x00_vp_abort_isp(vp); |
| 7659 | 7661 | ||
| 7660 | spin_lock_irqsave(&ha->vport_slock, flags); | 7662 | spin_lock_irqsave(&ha->vport_slock, flags); |
| @@ -2587,6 +2587,33 @@ void · 2586 unmodified lines | |||
| 2587 | qla2x00_sp_release(struct kref *kref) | 2587 | qla2x00_sp_release(struct kref *kref) |
| 2588 | { | 2588 | { |
| 2589 | struct srb *sp = container_of(kref, struct srb, cmd_kref); | 2589 | struct srb *sp = container_of(kref, struct srb, cmd_kref); |
| 2590 | struct scsi_qla_host *vha = sp->vha; | ||
| 2591 | |||
| 2592 | switch (sp->type) { | ||
| 2593 | case SRB_CT_PTHRU_CMD: | ||
| 2594 | /* GPSC & GFPNID use fcport->ct_desc.ct_sns for both req & rsp */ | ||
| 2595 | if (sp->u.iocb_cmd.u.ctarg.req && | ||
| 2596 | (!sp->fcport || | ||
| 2597 | sp->u.iocb_cmd.u.ctarg.req != sp->fcport->ct_desc.ct_sns)) { | ||
| 2598 | dma_free_coherent(&vha->hw->pdev->dev, | ||
| 2599 | sp->u.iocb_cmd.u.ctarg.req_allocated_size, | ||
| 2600 | sp->u.iocb_cmd.u.ctarg.req, | ||
| 2601 | sp->u.iocb_cmd.u.ctarg.req_dma); | ||
| 2602 | sp->u.iocb_cmd.u.ctarg.req = NULL; | ||
| 2603 | } | ||
| 2604 | if (sp->u.iocb_cmd.u.ctarg.rsp && | ||
| 2605 | (!sp->fcport || | ||
| 2606 | sp->u.iocb_cmd.u.ctarg.rsp != sp->fcport->ct_desc.ct_sns)) { | ||
| 2607 | dma_free_coherent(&vha->hw->pdev->dev, | ||
| 2608 | sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, | ||
| 2609 | sp->u.iocb_cmd.u.ctarg.rsp, | ||
| 2610 | sp->u.iocb_cmd.u.ctarg.rsp_dma); | ||
| 2611 | sp->u.iocb_cmd.u.ctarg.rsp = NULL; | ||
| 2612 | } | ||
| 2613 | break; | ||
| 2614 | default: | ||
| 2615 | break; | ||
| 2616 | } | ||
| 2590 | 2617 | ||
| 2591 | sp->free(sp); | 2618 | sp->free(sp); |
| 2592 | } | 2619 | } |
| @@ -2610,7 +2637,8 @@ static void qla2x00_els_dcmd_sp_free(srb_t *sp) · 17 unmodified lines | |||
| 2610 | { | 2637 | { |
| 2611 | struct srb_iocb *elsio = &sp->u.iocb_cmd; | 2638 | struct srb_iocb *elsio = &sp->u.iocb_cmd; |
| 2612 | 2639 | ||
| 2613 | kfree(sp->fcport); | 2640 | if (sp->fcport) |
| 2641 | qla2x00_free_fcport(sp->fcport); | ||
| 2614 | 2642 | ||
| 2615 | if (elsio->u.els_logo.els_logo_pyld) | 2643 | if (elsio->u.els_logo.els_logo_pyld) |
| 2616 | dma_free_coherent(&sp->vha->hw->pdev->dev, DMA_POOL_SIZE, | 2644 | dma_free_coherent(&sp->vha->hw->pdev->dev, DMA_POOL_SIZE, |
| @@ -2692,7 +2720,7 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, · 75 unmodified lines | |||
| 2692 | */ | 2720 | */ |
| 2693 | sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); | 2721 | sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); |
| 2694 | if (!sp) { | 2722 | if (!sp) { |
| 2695 | kfree(fcport); | 2723 | qla2x00_free_fcport(fcport); |
| 2696 | ql_log(ql_log_info, vha, 0x70e6, | 2724 | ql_log(ql_log_info, vha, 0x70e6, |
| 2697 | "SRB allocation failed\n"); | 2725 | "SRB allocation failed\n"); |
| 2698 | return -ENOMEM; | 2726 | return -ENOMEM; |
| @@ -2723,6 +2751,7 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, · 24 unmodified lines | |||
| 2723 | if (!elsio->u.els_logo.els_logo_pyld) { | 2751 | if (!elsio->u.els_logo.els_logo_pyld) { |
| 2724 | /* ref: INIT */ | 2752 | /* ref: INIT */ |
| 2725 | kref_put(&sp->cmd_kref, qla2x00_sp_release); | 2753 | kref_put(&sp->cmd_kref, qla2x00_sp_release); |
| 2754 | qla2x00_free_fcport(fcport); | ||
| 2726 | return QLA_FUNCTION_FAILED; | 2755 | return QLA_FUNCTION_FAILED; |
| 2727 | } | 2756 | } |
| 2728 | 2757 | ||
| @@ -2747,6 +2776,7 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, · 18 unmodified lines | |||
| 2747 | if (rval != QLA_SUCCESS) { | 2776 | if (rval != QLA_SUCCESS) { |
| 2748 | /* ref: INIT */ | 2777 | /* ref: INIT */ |
| 2749 | kref_put(&sp->cmd_kref, qla2x00_sp_release); | 2778 | kref_put(&sp->cmd_kref, qla2x00_sp_release); |
| 2779 | qla2x00_free_fcport(fcport); | ||
| 2750 | return QLA_FUNCTION_FAILED; | 2780 | return QLA_FUNCTION_FAILED; |
| 2751 | } | 2781 | } |
| 2752 | 2782 | ||
| @@ -3012,7 +3042,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) · 259 unmodified lines | |||
| 3012 | 3042 | ||
| 3013 | int | 3043 | int |
| 3014 | qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, | 3044 | qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, |
| 3015 | fc_port_t *fcport, bool wait) | 3045 | fc_port_t *fcport) |
| 3016 | { | 3046 | { |
| 3017 | srb_t *sp; | 3047 | srb_t *sp; |
| 3018 | struct srb_iocb *elsio = NULL; | 3048 | struct srb_iocb *elsio = NULL; |
| @@ -3027,8 +3057,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, · 8 unmodified lines | |||
| 3027 | if (!sp) { | 3057 | if (!sp) { |
| 3028 | ql_log(ql_log_info, vha, 0x70e6, | 3058 | ql_log(ql_log_info, vha, 0x70e6, |
| 3029 | "SRB allocation failed\n"); | 3059 | "SRB allocation failed\n"); |
| 3030 | fcport->flags &= ~FCF_ASYNC_ACTIVE; | 3060 | goto done; |
| 3031 | return -ENOMEM; | ||
| 3032 | } | 3061 | } |
| 3033 | 3062 | ||
| 3034 | fcport->flags |= FCF_ASYNC_SENT; | 3063 | fcport->flags |= FCF_ASYNC_SENT; |
| @@ -3037,9 +3066,6 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, · 2 unmodified lines | |||
| 3037 | ql_dbg(ql_dbg_io, vha, 0x3073, | 3066 | ql_dbg(ql_dbg_io, vha, 0x3073, |
| 3038 | "%s Enter: PLOGI portid=%06x\n", __func__, fcport->d_id.b24); | 3067 | "%s Enter: PLOGI portid=%06x\n", __func__, fcport->d_id.b24); |
| 3039 | 3068 | ||
| 3040 | if (wait) | ||
| 3041 | sp->flags = SRB_WAKEUP_ON_COMP; | ||
| 3042 | |||
| 3043 | sp->type = SRB_ELS_DCMD; | 3069 | sp->type = SRB_ELS_DCMD; |
| 3044 | sp->name = "ELS_DCMD"; | 3070 | sp->name = "ELS_DCMD"; |
| 3045 | sp->fcport = fcport; | 3071 | sp->fcport = fcport; |
| @@ -3055,7 +3081,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, · 9 unmodified lines | |||
| 3055 | 3081 | ||
| 3056 | if (!elsio->u.els_plogi.els_plogi_pyld) { | 3082 | if (!elsio->u.els_plogi.els_plogi_pyld) { |
| 3057 | rval = QLA_FUNCTION_FAILED; | 3083 | rval = QLA_FUNCTION_FAILED; |
| 3058 | goto out; | 3084 | goto done_free_sp; |
| 3059 | } | 3085 | } |
| 3060 | 3086 | ||
| 3061 | resp_ptr = elsio->u.els_plogi.els_resp_pyld = | 3087 | resp_ptr = elsio->u.els_plogi.els_resp_pyld = |
| @@ -3064,7 +3090,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, · 2 unmodified lines | |||
| 3064 | 3090 | ||
| 3065 | if (!elsio->u.els_plogi.els_resp_pyld) { | 3091 | if (!elsio->u.els_plogi.els_resp_pyld) { |
| 3066 | rval = QLA_FUNCTION_FAILED; | 3092 | rval = QLA_FUNCTION_FAILED; |
| 3067 | goto out; | 3093 | goto done_free_sp; |
| 3068 | } | 3094 | } |
| 3069 | 3095 | ||
| 3070 | ql_dbg(ql_dbg_io, vha, 0x3073, "PLOGI %p %p\n", ptr, resp_ptr); | 3096 | ql_dbg(ql_dbg_io, vha, 0x3073, "PLOGI %p %p\n", ptr, resp_ptr); |
| @@ -3080,7 +3106,6 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, · 9 unmodified lines | |||
| 3080 | 3106 | ||
| 3081 | if (els_opcode == ELS_DCMD_PLOGI && DBELL_ACTIVE(vha)) { | 3107 | if (els_opcode == ELS_DCMD_PLOGI && DBELL_ACTIVE(vha)) { |
| 3082 | struct fc_els_flogi *p = ptr; | 3108 | struct fc_els_flogi *p = ptr; |
| 3083 | |||
| 3084 | p->fl_csp.sp_features |= cpu_to_be16(FC_SP_FT_SEC); | 3109 | p->fl_csp.sp_features |= cpu_to_be16(FC_SP_FT_SEC); |
| 3085 | } | 3110 | } |
| 3086 | 3111 | ||
| @@ -3089,10 +3114,11 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, · 2 unmodified lines | |||
| 3089 | (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, | 3114 | (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, |
| 3090 | sizeof(*elsio->u.els_plogi.els_plogi_pyld)); | 3115 | sizeof(*elsio->u.els_plogi.els_plogi_pyld)); |
| 3091 | 3116 | ||
| 3092 | init_completion(&elsio->u.els_plogi.comp); | ||
| 3093 | rval = qla2x00_start_sp(sp); | 3117 | rval = qla2x00_start_sp(sp); |
| 3094 | if (rval != QLA_SUCCESS) { | 3118 | if (rval != QLA_SUCCESS) { |
| 3095 | rval = QLA_FUNCTION_FAILED; | 3119 | fcport->flags |= FCF_LOGIN_NEEDED; |
| 3120 | set_bit(RELOGIN_NEEDED, &vha->dpc_flags); | ||
| 3121 | goto done_free_sp; | ||
| 3096 | } else { | 3122 | } else { |
| 3097 | ql_dbg(ql_dbg_disc, vha, 0x3074, | 3123 | ql_dbg(ql_dbg_disc, vha, 0x3074, |
| 3098 | "%s PLOGI sent, hdl=%x, loopid=%x, to port_id %06x from port_id %06x\n", | 3124 | "%s PLOGI sent, hdl=%x, loopid=%x, to port_id %06x from port_id %06x\n", |
| @@ -3100,21 +3126,15 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, · 1 unmodified line | |||
| 3100 | fcport->d_id.b24, vha->d_id.b24); | 3126 | fcport->d_id.b24, vha->d_id.b24); |
| 3101 | } | 3127 | } |
| 3102 | 3128 | ||
| 3103 | if (wait) { | 3129 | return rval; |
| 3104 | wait_for_completion(&elsio->u.els_plogi.comp); | ||
| 3105 | |||
| 3106 | if (elsio->u.els_plogi.comp_status != CS_COMPLETE) | ||
| 3107 | rval = QLA_FUNCTION_FAILED; | ||
| 3108 | } else { | ||
| 3109 | goto done; | ||
| 3110 | } | ||
| 3111 | 3130 | ||
| 3112 | out: | 3131 | done_free_sp: |
| 3113 | fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); | ||
| 3114 | qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi); | 3132 | qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi); |
| 3115 | /* ref: INIT */ | 3133 | /* ref: INIT */ |
| 3116 | kref_put(&sp->cmd_kref, qla2x00_sp_release); | 3134 | kref_put(&sp->cmd_kref, qla2x00_sp_release); |
| 3117 | done: | 3135 | done: |
| 3136 | fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); | ||
| 3137 | qla2x00_set_fcport_disc_state(fcport, DSC_DELETED); | ||
| 3118 | return rval; | 3138 | return rval; |
| 3119 | } | 3139 | } |
| 3120 | 3140 | ||
| @@ -3918,7 +3938,7 @@ qla2x00_start_sp(srb_t *sp) · 797 unmodified lines | |||
| 3918 | return -EAGAIN; | 3938 | return -EAGAIN; |
| 3919 | } | 3939 | } |
| 3920 | 3940 | ||
| 3921 | pkt = __qla2x00_alloc_iocbs(sp->qpair, sp); | 3941 | pkt = qla2x00_alloc_iocbs_ready(sp->qpair, sp); |
| 3922 | if (!pkt) { | 3942 | if (!pkt) { |
| 3923 | rval = -EAGAIN; | 3943 | rval = -EAGAIN; |
| 3924 | ql_log(ql_log_warn, vha, 0x700c, | 3944 | ql_log(ql_log_warn, vha, 0x700c, |
| @@ -194,7 +194,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) · 193 unmodified lines | |||
| 194 | if (ha->flags.purge_mbox || chip_reset != ha->chip_reset || | 194 | if (ha->flags.purge_mbox || chip_reset != ha->chip_reset || |
| 195 | ha->flags.eeh_busy) { | 195 | ha->flags.eeh_busy) { |
| 196 | ql_log(ql_log_warn, vha, 0xd035, | 196 | ql_log(ql_log_warn, vha, 0xd035, |
| 197 | "Error detected: purge[%d] eeh[%d] cmd=0x%x, Exiting.\n", | 197 | "Purge mbox: purge[%d] eeh[%d] cmd=0x%x, Exiting.\n", |
| 198 | ha->flags.purge_mbox, ha->flags.eeh_busy, mcp->mb[0]); | 198 | ha->flags.purge_mbox, ha->flags.eeh_busy, mcp->mb[0]); |
| 199 | rval = QLA_ABORTED; | 199 | rval = QLA_ABORTED; |
| 200 | goto premature_exit; | 200 | goto premature_exit; |
| @@ -4602,6 +4602,7 @@ fail_free_init_cb: · 4601 unmodified lines | |||
| 4602 | ha->init_cb_dma = 0; | 4602 | ha->init_cb_dma = 0; |
| 4603 | fail_free_vp_map: | 4603 | fail_free_vp_map: |
| 4604 | kfree(ha->vp_map); | 4604 | kfree(ha->vp_map); |
| 4605 | ha->vp_map = NULL; | ||
| 4605 | fail: | 4606 | fail: |
| 4606 | ql_log(ql_log_fatal, NULL, 0x0030, | 4607 | ql_log(ql_log_fatal, NULL, 0x0030, |
| 4607 | "Memory allocation failure.\n"); | 4608 | "Memory allocation failure.\n"); |
| @@ -5583,7 +5584,7 @@ qla2x00_do_work(struct scsi_qla_host *vha) · 975 unmodified lines | |||
| 5583 | break; | 5584 | break; |
| 5584 | case QLA_EVT_ELS_PLOGI: | 5585 | case QLA_EVT_ELS_PLOGI: |
| 5585 | qla24xx_els_dcmd2_iocb(vha, ELS_DCMD_PLOGI, | 5586 | qla24xx_els_dcmd2_iocb(vha, ELS_DCMD_PLOGI, |
| 5586 | e->u.fcport.fcport, false); | 5587 | e->u.fcport.fcport); |
| 5587 | break; | 5588 | break; |
| 5588 | case QLA_EVT_SA_REPLACE: | 5589 | case QLA_EVT_SA_REPLACE: |
| 5589 | rc = qla24xx_issue_sa_replace_iocb(vha, e); | 5590 | rc = qla24xx_issue_sa_replace_iocb(vha, e); |
| @@ -1062,6 +1062,16 @@ void qlt_free_session_done(struct work_struct *work) · 1061 unmodified lines | |||
| 1062 | "%s: sess %p logout completed\n", __func__, sess); | 1062 | "%s: sess %p logout completed\n", __func__, sess); |
| 1063 | } | 1063 | } |
| 1064 | 1064 | ||
| 1065 | /* check for any straggling io left behind */ | ||
| 1066 | if (!(sess->flags & FCF_FCP2_DEVICE) && | ||
| 1067 | qla2x00_eh_wait_for_pending_commands(sess->vha, sess->d_id.b24, 0, WAIT_TARGET)) { | ||
| 1068 | ql_log(ql_log_warn, vha, 0x3027, | ||
| 1069 | "IO not return. Resetting.\n"); | ||
| 1070 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); | ||
| 1071 | qla2xxx_wake_dpc(vha); | ||
| 1072 | qla2x00_wait_for_chip_reset(vha); | ||
| 1073 | } | ||
| 1074 | |||
| 1065 | if (sess->logo_ack_needed) { | 1075 | if (sess->logo_ack_needed) { |
| 1066 | sess->logo_ack_needed = 0; | 1076 | sess->logo_ack_needed = 0; |
| 1067 | qla24xx_async_notify_ack(vha, sess, | 1077 | qla24xx_async_notify_ack(vha, sess, |
| @@ -6,9 +6,9 @@ · 5 unmodified lines | |||
| 6 | /* | 6 | /* |
| 7 | * Driver version | 7 | * Driver version |
| 8 | */ | 8 | */ |
| 9 | #define QLA2XXX_VERSION "10.02.09.100-k" | 9 | #define QLA2XXX_VERSION "10.02.09.200-k" |
| 10 | 10 | ||
| 11 | #define QLA_DRIVER_MAJOR_VER 10 | 11 | #define QLA_DRIVER_MAJOR_VER 10 |
| 12 | #define QLA_DRIVER_MINOR_VER 2 | 12 | #define QLA_DRIVER_MINOR_VER 2 |
| 13 | #define QLA_DRIVER_PATCH_VER 9 | 13 | #define QLA_DRIVER_PATCH_VER 9 |
| 14 | #define QLA_DRIVER_BETA_VER 100 | 14 | #define QLA_DRIVER_BETA_VER 200 |
| @@ -1642,6 +1642,40 @@ int scsi_add_device(struct Scsi_Host *host, uint channel, · 1641 unmodified lines | |||
| 1642 | } | 1642 | } |
| 1643 | EXPORT_SYMBOL(scsi_add_device); | 1643 | EXPORT_SYMBOL(scsi_add_device); |
| 1644 | 1644 | ||
| 1645 | int scsi_resume_device(struct scsi_device *sdev) | ||
| 1646 | { | ||
| 1647 | struct device *dev = &sdev->sdev_gendev; | ||
| 1648 | int ret = 0; | ||
| 1649 | |||
| 1650 | device_lock(dev); | ||
| 1651 | |||
| 1652 | /* | ||
| 1653 | * Bail out if the device or its queue are not running. Otherwise, | ||
| 1654 | * the rescan may block waiting for commands to be executed, with us | ||
| 1655 | * holding the device lock. This can result in a potential deadlock | ||
| 1656 | * in the power management core code when system resume is on-going. | ||
| 1657 | */ | ||
| 1658 | if (sdev->sdev_state != SDEV_RUNNING || | ||
| 1659 | blk_queue_pm_only(sdev->request_queue)) { | ||
| 1660 | ret = -EWOULDBLOCK; | ||
| 1661 | goto unlock; | ||
| 1662 | } | ||
| 1663 | |||
| 1664 | if (dev->driver && try_module_get(dev->driver->owner)) { | ||
| 1665 | struct scsi_driver *drv = to_scsi_driver(dev->driver); | ||
| 1666 | |||
| 1667 | if (drv->resume) | ||
| 1668 | ret = drv->resume(dev); | ||
| 1669 | module_put(dev->driver->owner); | ||
| 1670 | } | ||
| 1671 | |||
| 1672 | unlock: | ||
| 1673 | device_unlock(dev); | ||
| 1674 | |||
| 1675 | return ret; | ||
| 1676 | } | ||
| 1677 | EXPORT_SYMBOL(scsi_resume_device); | ||
| 1678 | |||
| 1645 | int scsi_rescan_device(struct scsi_device *sdev) | 1679 | int scsi_rescan_device(struct scsi_device *sdev) |
| 1646 | { | 1680 | { |
| 1647 | struct device *dev = &sdev->sdev_gendev; | 1681 | struct device *dev = &sdev->sdev_gendev; |
| @@ -4108,7 +4108,21 @@ static int sd_suspend_runtime(struct device *dev) · 4107 unmodified lines | |||
| 4108 | return sd_suspend_common(dev, true); | 4108 | return sd_suspend_common(dev, true); |
| 4109 | } | 4109 | } |
| 4110 | 4110 | ||
| 4111 | static int sd_resume(struct device *dev, bool runtime) | 4111 | static int sd_resume(struct device *dev) |
| 4112 | { | ||
| 4113 | struct scsi_disk *sdkp = dev_get_drvdata(dev); | ||
| 4114 | |||
| 4115 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); | ||
| 4116 | |||
| 4117 | if (opal_unlock_from_suspend(sdkp->opal_dev)) { | ||
| 4118 | sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n"); | ||
| 4119 | return -EIO; | ||
| 4120 | } | ||
| 4121 | |||
| 4122 | return 0; | ||
| 4123 | } | ||
| 4124 | |||
| 4125 | static int sd_resume_common(struct device *dev, bool runtime) | ||
| 4112 | { | 4126 | { |
| 4113 | struct scsi_disk *sdkp = dev_get_drvdata(dev); | 4127 | struct scsi_disk *sdkp = dev_get_drvdata(dev); |
| 4114 | int ret; | 4128 | int ret; |
| @@ -4124,7 +4138,7 @@ static int sd_resume(struct device *dev, bool runtime) · 9 unmodified lines | |||
| 4124 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); | 4138 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); |
| 4125 | ret = sd_start_stop_device(sdkp, 1); | 4139 | ret = sd_start_stop_device(sdkp, 1); |
| 4126 | if (!ret) { | 4140 | if (!ret) { |
| 4127 | opal_unlock_from_suspend(sdkp->opal_dev); | 4141 | sd_resume(dev); |
| 4128 | sdkp->suspended = false; | 4142 | sdkp->suspended = false; |
| 4129 | } | 4143 | } |
| 4130 | 4144 | ||
| @@ -4143,7 +4157,7 @@ static int sd_resume_system(struct device *dev) · 12 unmodified lines | |||
| 4143 | return 0; | 4157 | return 0; |
| 4144 | } | 4158 | } |
| 4145 | 4159 | ||
| 4146 | return sd_resume(dev, false); | 4160 | return sd_resume_common(dev, false); |
| 4147 | } | 4161 | } |
| 4148 | 4162 | ||
| 4149 | static int sd_resume_runtime(struct device *dev) | 4163 | static int sd_resume_runtime(struct device *dev) |
| @@ -4170,7 +4184,7 @@ static int sd_resume_runtime(struct device *dev) · 20 unmodified lines | |||
| 4170 | "Failed to clear sense data\n"); | 4184 | "Failed to clear sense data\n"); |
| 4171 | } | 4185 | } |
| 4172 | 4186 | ||
| 4173 | return sd_resume(dev, true); | 4187 | return sd_resume_common(dev, true); |
| 4174 | } | 4188 | } |
| 4175 | 4189 | ||
| 4176 | static const struct dev_pm_ops sd_pm_ops = { | 4190 | static const struct dev_pm_ops sd_pm_ops = { |
| @@ -4193,6 +4207,7 @@ static struct scsi_driver sd_template = { · 16 unmodified lines | |||
| 4193 | .pm = &sd_pm_ops, | 4207 | .pm = &sd_pm_ops, |
| 4194 | }, | 4208 | }, |
| 4195 | .rescan = sd_rescan, | 4209 | .rescan = sd_rescan, |
| 4210 | .resume = sd_resume, | ||
| 4196 | .init_command = sd_init_command, | 4211 | .init_command = sd_init_command, |
| 4197 | .uninit_command = sd_uninit_command, | 4212 | .uninit_command = sd_uninit_command, |
| 4198 | .done = sd_done, | 4213 | .done = sd_done, |
| @@ -1424,7 +1424,9 @@ static const struct file_operations sg_fops = { · 1423 unmodified lines | |||
| 1424 | .llseek = no_llseek, | 1424 | .llseek = no_llseek, |
| 1425 | }; | 1425 | }; |
| 1426 | 1426 | ||
| 1427 | static struct class *sg_sysfs_class; | 1427 | static const struct class sg_sysfs_class = { |
| 1428 | .name = "scsi_generic" | ||
| 1429 | }; | ||
| 1428 | 1430 | ||
| 1429 | static int sg_sysfs_valid = 0; | 1431 | static int sg_sysfs_valid = 0; |
| 1430 | 1432 | ||
| @@ -1526,7 +1528,7 @@ sg_add_device(struct device *cl_dev) · 95 unmodified lines | |||
| 1526 | if (sg_sysfs_valid) { | 1528 | if (sg_sysfs_valid) { |
| 1527 | struct device *sg_class_member; | 1529 | struct device *sg_class_member; |
| 1528 | 1530 | ||
| 1529 | sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, | 1531 | sg_class_member = device_create(&sg_sysfs_class, cl_dev->parent, |
| 1530 | MKDEV(SCSI_GENERIC_MAJOR, | 1532 | MKDEV(SCSI_GENERIC_MAJOR, |
| 1531 | sdp->index), | 1533 | sdp->index), |
| 1532 | sdp, "%s", sdp->name); | 1534 | sdp, "%s", sdp->name); |
| @@ -1616,7 +1618,7 @@ sg_remove_device(struct device *cl_dev) · 83 unmodified lines | |||
| 1616 | read_unlock_irqrestore(&sdp->sfd_lock, iflags); | 1618 | read_unlock_irqrestore(&sdp->sfd_lock, iflags); |
| 1617 | 1619 | ||
| 1618 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); | 1620 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); |
| 1619 | device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); | 1621 | device_destroy(&sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); |
| 1620 | cdev_del(sdp->cdev); | 1622 | cdev_del(sdp->cdev); |
| 1621 | sdp->cdev = NULL; | 1623 | sdp->cdev = NULL; |
| 1622 | 1624 | ||
| @@ -1687,11 +1689,9 @@ init_sg(void) · 64 unmodified lines | |||
| 1687 | SG_MAX_DEVS, "sg"); | 1689 | SG_MAX_DEVS, "sg"); |
| 1688 | if (rc) | 1690 | if (rc) |
| 1689 | return rc; | 1691 | return rc; |
| 1690 | sg_sysfs_class = class_create("scsi_generic"); | 1692 | rc = class_register(&sg_sysfs_class); |
| 1691 | if ( IS_ERR(sg_sysfs_class) ) { | 1693 | if (rc) |
| 1692 | rc = PTR_ERR(sg_sysfs_class); | ||
| 1693 | goto err_out; | 1694 | goto err_out; |
| 1694 | } | ||
| 1695 | sg_sysfs_valid = 1; | 1695 | sg_sysfs_valid = 1; |
| 1696 | rc = scsi_register_interface(&sg_interface); | 1696 | rc = scsi_register_interface(&sg_interface); |
| 1697 | if (0 == rc) { | 1697 | if (0 == rc) { |
| @@ -1700,7 +1700,7 @@ init_sg(void) · 2 unmodified lines | |||
| 1700 | #endif /* CONFIG_SCSI_PROC_FS */ | 1700 | #endif /* CONFIG_SCSI_PROC_FS */ |
| 1701 | return 0; | 1701 | return 0; |
| 1702 | } | 1702 | } |
| 1703 | class_destroy(sg_sysfs_class); | 1703 | class_unregister(&sg_sysfs_class); |
| 1704 | register_sg_sysctls(); | 1704 | register_sg_sysctls(); |
| 1705 | err_out: | 1705 | err_out: |
| 1706 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); | 1706 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); |
| @@ -1715,7 +1715,7 @@ exit_sg(void) · 8 unmodified lines | |||
| 1715 | remove_proc_subtree("scsi/sg", NULL); | 1715 | remove_proc_subtree("scsi/sg", NULL); |
| 1716 | #endif /* CONFIG_SCSI_PROC_FS */ | 1716 | #endif /* CONFIG_SCSI_PROC_FS */ |
| 1717 | scsi_unregister_interface(&sg_interface); | 1717 | scsi_unregister_interface(&sg_interface); |
| 1718 | class_destroy(sg_sysfs_class); | 1718 | class_unregister(&sg_sysfs_class); |
| 1719 | sg_sysfs_valid = 0; | 1719 | sg_sysfs_valid = 0; |
| 1720 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), | 1720 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), |
| 1721 | SG_MAX_DEVS); | 1721 | SG_MAX_DEVS); |
| @@ -2207,6 +2207,7 @@ sg_remove_sfp_usercontext(struct work_struct *work) · 485 unmodified lines | |||
| 2207 | { | 2207 | { |
| 2208 | struct sg_fd *sfp = container_of(work, struct sg_fd, ew.work); | 2208 | struct sg_fd *sfp = container_of(work, struct sg_fd, ew.work); |
| 2209 | struct sg_device *sdp = sfp->parentdp; | 2209 | struct sg_device *sdp = sfp->parentdp; |
| 2210 | struct scsi_device *device = sdp->device; | ||
| 2210 | Sg_request *srp; | 2211 | Sg_request *srp; |
| 2211 | unsigned long iflags; | 2212 | unsigned long iflags; |
| 2212 | 2213 | ||
| @@ -2232,8 +2233,9 @@ sg_remove_sfp_usercontext(struct work_struct *work) · 19 unmodified lines | |||
| 2232 | "sg_remove_sfp: sfp=0x%p\n", sfp)); | 2233 | "sg_remove_sfp: sfp=0x%p\n", sfp)); |
| 2233 | kfree(sfp); | 2234 | kfree(sfp); |
| 2234 | 2235 | ||
| 2235 | scsi_device_put(sdp->device); | 2236 | WARN_ON_ONCE(kref_read(&sdp->d_ref) != 1); |
| 2236 | kref_put(&sdp->d_ref, sg_device_destroy); | 2237 | kref_put(&sdp->d_ref, sg_device_destroy); |
| 2238 | scsi_device_put(device); | ||
| 2237 | module_put(THIS_MODULE); | 2239 | module_put(THIS_MODULE); |
| 2238 | } | 2240 | } |
| 2239 | 2241 | ||
| @@ -87,7 +87,7 @@ static int try_rdio = 1; · 86 unmodified lines | |||
| 87 | static int try_wdio = 1; | 87 | static int try_wdio = 1; |
| 88 | static int debug_flag; | 88 | static int debug_flag; |
| 89 | 89 | ||
| 90 | static struct class st_sysfs_class; | 90 | static const struct class st_sysfs_class; |
| 91 | static const struct attribute_group *st_dev_groups[]; | 91 | static const struct attribute_group *st_dev_groups[]; |
| 92 | static const struct attribute_group *st_drv_groups[]; | 92 | static const struct attribute_group *st_drv_groups[]; |
| 93 | 93 | ||
| @@ -4438,7 +4438,7 @@ static void scsi_tape_release(struct kref *kref) · 4344 unmodified lines | |||
| 4438 | return; | 4438 | return; |
| 4439 | } | 4439 | } |
| 4440 | 4440 | ||
| 4441 | static struct class st_sysfs_class = { | 4441 | static const struct class st_sysfs_class = { |
| 4442 | .name = "scsi_tape", | 4442 | .name = "scsi_tape", |
| 4443 | .dev_groups = st_dev_groups, | 4443 | .dev_groups = st_dev_groups, |
| 4444 | }; | 4444 | }; |
| @@ -937,8 +937,9 @@ static int create_component(struct vchiq_mmal_instance *instance, · 936 unmodified lines | |||
| 937 | /* build component create message */ | 937 | /* build component create message */ |
| 938 | m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; | 938 | m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; |
| 939 | m.u.component_create.client_component = component->client_component; | 939 | m.u.component_create.client_component = component->client_component; |
| 940 | strncpy(m.u.component_create.name, name, | 940 | strscpy_pad(m.u.component_create.name, name, |
| 941 | sizeof(m.u.component_create.name)); | 941 | sizeof(m.u.component_create.name)); |
| 942 | m.u.component_create.pid = 0; | ||
| 942 | 943 | ||
| 943 | ret = send_synchronous_mmal_msg(instance, &m, | 944 | ret = send_synchronous_mmal_msg(instance, &m, |
| 944 | sizeof(m.u.component_create), | 945 | sizeof(m.u.component_create), |
| @@ -583,7 +583,7 @@ int iscsit_dataout_datapduinorder_no_fbit( · 582 unmodified lines | |||
| 583 | struct iscsi_pdu *pdu) | 583 | struct iscsi_pdu *pdu) |
| 584 | { | 584 | { |
| 585 | int i, send_recovery_r2t = 0, recovery = 0; | 585 | int i, send_recovery_r2t = 0, recovery = 0; |
| 586 | u32 length = 0, offset = 0, pdu_count = 0, xfer_len = 0; | 586 | u32 length = 0, offset = 0, pdu_count = 0; |
| 587 | struct iscsit_conn *conn = cmd->conn; | 587 | struct iscsit_conn *conn = cmd->conn; |
| 588 | struct iscsi_pdu *first_pdu = NULL; | 588 | struct iscsi_pdu *first_pdu = NULL; |
| 589 | 589 | ||
| @@ -596,7 +596,6 @@ int iscsit_dataout_datapduinorder_no_fbit( · 6 unmodified lines | |||
| 596 | if (cmd->pdu_list[i].seq_no == pdu->seq_no) { | 596 | if (cmd->pdu_list[i].seq_no == pdu->seq_no) { |
| 597 | if (!first_pdu) | 597 | if (!first_pdu) |
| 598 | first_pdu = &cmd->pdu_list[i]; | 598 | first_pdu = &cmd->pdu_list[i]; |
| 599 | xfer_len += cmd->pdu_list[i].length; | ||
| 600 | pdu_count++; | 599 | pdu_count++; |
| 601 | } else if (pdu_count) | 600 | } else if (pdu_count) |
| 602 | break; | 601 | break; |
| @@ -214,7 +214,7 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd · 213 unmodified lines | |||
| 214 | 214 | ||
| 215 | res = dfc->power_ops->get_real_power(df, power, freq, voltage); | 215 | res = dfc->power_ops->get_real_power(df, power, freq, voltage); |
| 216 | if (!res) { | 216 | if (!res) { |
| 217 | state = dfc->capped_state; | 217 | state = dfc->max_state - dfc->capped_state; |
| 218 | 218 | ||
| 219 | /* Convert EM power into milli-Watts first */ | 219 | /* Convert EM power into milli-Watts first */ |
| 220 | rcu_read_lock(); | 220 | rcu_read_lock(); |
| @@ -65,7 +65,6 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) · 64 unmodified lines | |||
| 65 | { | 65 | { |
| 66 | const struct thermal_trip *trip; | 66 | const struct thermal_trip *trip; |
| 67 | int low = -INT_MAX, high = INT_MAX; | 67 | int low = -INT_MAX, high = INT_MAX; |
| 68 | bool same_trip = false; | ||
| 69 | int ret; | 68 | int ret; |
| 70 | 69 | ||
| 71 | lockdep_assert_held(&tz->lock); | 70 | lockdep_assert_held(&tz->lock); |
| @@ -74,36 +73,22 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) · 2 unmodified lines | |||
| 74 | return; | 73 | return; |
| 75 | 74 | ||
| 76 | for_each_trip(tz, trip) { | 75 | for_each_trip(tz, trip) { |
| 77 | bool low_set = false; | ||
| 78 | int trip_low; | 76 | int trip_low; |
| 79 | 77 | ||
| 80 | trip_low = trip->temperature - trip->hysteresis; | 78 | trip_low = trip->temperature - trip->hysteresis; |
| 81 | 79 | ||
| 82 | if (trip_low < tz->temperature && trip_low > low) { | 80 | if (trip_low < tz->temperature && trip_low > low) |
| 83 | low = trip_low; | 81 | low = trip_low; |
| 84 | low_set = true; | ||
| 85 | same_trip = false; | ||
| 86 | } | ||
| 87 | 82 | ||
| 88 | if (trip->temperature > tz->temperature && | 83 | if (trip->temperature > tz->temperature && |
| 89 | trip->temperature < high) { | 84 | trip->temperature < high) |
| 90 | high = trip->temperature; | 85 | high = trip->temperature; |
| 91 | same_trip = low_set; | ||
| 92 | } | ||
| 93 | } | 86 | } |
| 94 | 87 | ||
| 95 | /* No need to change trip points */ | 88 | /* No need to change trip points */ |
| 96 | if (tz->prev_low_trip == low && tz->prev_high_trip == high) | 89 | if (tz->prev_low_trip == low && tz->prev_high_trip == high) |
| 97 | return; | 90 | return; |
| 98 | 91 | ||
| 99 | /* | ||
| 100 | * If "high" and "low" are the same, skip the change unless this is the | ||
| 101 | * first time. | ||
| 102 | */ | ||
| 103 | if (same_trip && (tz->prev_low_trip != -INT_MAX || | ||
| 104 | tz->prev_high_trip != INT_MAX)) | ||
| 105 | return; | ||
| 106 | |||
| 107 | tz->prev_low_trip = low; | 92 | tz->prev_low_trip = low; |
| 108 | tz->prev_high_trip = high; | 93 | tz->prev_high_trip = high; |
| 109 | 94 | ||
| @@ -94,7 +94,7 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds) · 93 unmodified lines | |||
| 94 | 94 | ||
| 95 | val = ufshcd_readl(hba, REG_UFS_MCQ_CFG); | 95 | val = ufshcd_readl(hba, REG_UFS_MCQ_CFG); |
| 96 | val &= ~MCQ_CFG_MAC_MASK; | 96 | val &= ~MCQ_CFG_MAC_MASK; |
| 97 | val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds); | 97 | val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1); |
| 98 | ufshcd_writel(hba, val, REG_UFS_MCQ_CFG); | 98 | ufshcd_writel(hba, val, REG_UFS_MCQ_CFG); |
| 99 | } | 99 | } |
| 100 | EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac); | 100 | EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac); |
| @@ -1210,8 +1210,10 @@ static int ufs_qcom_set_core_clk_ctrl(struct ufs_hba *hba, bool is_scale_up) · 1209 unmodified lines | |||
| 1210 | 1210 | ||
| 1211 | list_for_each_entry(clki, head, list) { | 1211 | list_for_each_entry(clki, head, list) { |
| 1212 | if (!IS_ERR_OR_NULL(clki->clk) && | 1212 | if (!IS_ERR_OR_NULL(clki->clk) && |
| 1213 | !strcmp(clki->name, "core_clk_unipro")) { | 1213 | !strcmp(clki->name, "core_clk_unipro")) { |
| 1214 | if (is_scale_up) | 1214 | if (!clki->max_freq) |
| 1215 | cycles_in_1us = 150; /* default for backwards compatibility */ | ||
| 1216 | else if (is_scale_up) | ||
| 1215 | cycles_in_1us = ceil(clki->max_freq, (1000 * 1000)); | 1217 | cycles_in_1us = ceil(clki->max_freq, (1000 * 1000)); |
| 1216 | else | 1218 | else |
| 1217 | cycles_in_1us = ceil(clk_get_rate(clki->clk), (1000 * 1000)); | 1219 | cycles_in_1us = ceil(clk_get_rate(clki->clk), (1000 * 1000)); |
| @@ -792,7 +792,7 @@ static int uio_mmap_dma_coherent(struct vm_area_struct *vma) · 791 unmodified lines | |||
| 792 | */ | 792 | */ |
| 793 | vma->vm_pgoff = 0; | 793 | vma->vm_pgoff = 0; |
| 794 | 794 | ||
| 795 | addr = (void *)mem->addr; | 795 | addr = (void *)(uintptr_t)mem->addr; |
| 796 | ret = dma_mmap_coherent(mem->dma_device, | 796 | ret = dma_mmap_coherent(mem->dma_device, |
| 797 | vma, | 797 | vma, |
| 798 | addr, | 798 | addr, |
| @@ -60,7 +60,7 @@ static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode) · 59 unmodified lines | |||
| 60 | 60 | ||
| 61 | addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size, | 61 | addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size, |
| 62 | &uiomem->dma_addr, GFP_KERNEL); | 62 | &uiomem->dma_addr, GFP_KERNEL); |
| 63 | uiomem->addr = addr ? (phys_addr_t) addr : DMEM_MAP_ERROR; | 63 | uiomem->addr = addr ? (uintptr_t) addr : DMEM_MAP_ERROR; |
| 64 | ++uiomem; | 64 | ++uiomem; |
| 65 | } | 65 | } |
| 66 | priv->refcnt++; | 66 | priv->refcnt++; |
| @@ -89,7 +89,7 @@ static int uio_dmem_genirq_release(struct uio_info *info, struct inode *inode) · 22 unmodified lines | |||
| 89 | break; | 89 | break; |
| 90 | if (uiomem->addr) { | 90 | if (uiomem->addr) { |
| 91 | dma_free_coherent(uiomem->dma_device, uiomem->size, | 91 | dma_free_coherent(uiomem->dma_device, uiomem->size, |
| 92 | (void *) uiomem->addr, | 92 | (void *) (uintptr_t) uiomem->addr, |
| 93 | uiomem->dma_addr); | 93 | uiomem->dma_addr); |
| 94 | } | 94 | } |
| 95 | uiomem->addr = DMEM_MAP_ERROR; | 95 | uiomem->addr = DMEM_MAP_ERROR; |
| @@ -191,7 +191,7 @@ static int pruss_probe(struct platform_device *pdev) · 190 unmodified lines | |||
| 191 | p->mem[1].size = sram_pool_sz; | 191 | p->mem[1].size = sram_pool_sz; |
| 192 | p->mem[1].memtype = UIO_MEM_PHYS; | 192 | p->mem[1].memtype = UIO_MEM_PHYS; |
| 193 | 193 | ||
| 194 | p->mem[2].addr = (phys_addr_t) gdev->ddr_vaddr; | 194 | p->mem[2].addr = (uintptr_t) gdev->ddr_vaddr; |
| 195 | p->mem[2].dma_addr = gdev->ddr_paddr; | 195 | p->mem[2].dma_addr = gdev->ddr_paddr; |
| 196 | p->mem[2].size = extram_pool_sz; | 196 | p->mem[2].size = extram_pool_sz; |
| 197 | p->mem[2].memtype = UIO_MEM_DMA_COHERENT; | 197 | p->mem[2].memtype = UIO_MEM_DMA_COHERENT; |
| @@ -485,6 +485,7 @@ out_free_mem: · 484 unmodified lines | |||
| 485 | static int service_outstanding_interrupt(struct wdm_device *desc) | 485 | static int service_outstanding_interrupt(struct wdm_device *desc) |
| 486 | { | 486 | { |
| 487 | int rv = 0; | 487 | int rv = 0; |
| 488 | int used; | ||
| 488 | 489 | ||
| 489 | /* submit read urb only if the device is waiting for it */ | 490 | /* submit read urb only if the device is waiting for it */ |
| 490 | if (!desc->resp_count || !--desc->resp_count) | 491 | if (!desc->resp_count || !--desc->resp_count) |
| @@ -499,7 +500,10 @@ static int service_outstanding_interrupt(struct wdm_device *desc) · 8 unmodified lines | |||
| 499 | goto out; | 500 | goto out; |
| 500 | } | 501 | } |
| 501 | 502 | ||
| 502 | set_bit(WDM_RESPONDING, &desc->flags); | 503 | used = test_and_set_bit(WDM_RESPONDING, &desc->flags); |
| 504 | if (used) | ||
| 505 | goto out; | ||
| 506 | |||
| 503 | spin_unlock_irq(&desc->iuspin); | 507 | spin_unlock_irq(&desc->iuspin); |
| 504 | rv = usb_submit_urb(desc->response, GFP_KERNEL); | 508 | rv = usb_submit_urb(desc->response, GFP_KERNEL); |
| 505 | spin_lock_irq(&desc->iuspin); | 509 | spin_lock_irq(&desc->iuspin); |
| @@ -130,7 +130,6 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); · 129 unmodified lines | |||
| 130 | #define HUB_DEBOUNCE_STEP 25 | 130 | #define HUB_DEBOUNCE_STEP 25 |
| 131 | #define HUB_DEBOUNCE_STABLE 100 | 131 | #define HUB_DEBOUNCE_STABLE 100 |
| 132 | 132 | ||
| 133 | static void hub_release(struct kref *kref); | ||
| 134 | static int usb_reset_and_verify_device(struct usb_device *udev); | 133 | static int usb_reset_and_verify_device(struct usb_device *udev); |
| 135 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state); | 134 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state); |
| 136 | static bool hub_port_warm_reset_required(struct usb_hub *hub, int port1, | 135 | static bool hub_port_warm_reset_required(struct usb_hub *hub, int port1, |
| @@ -720,14 +719,14 @@ static void kick_hub_wq(struct usb_hub *hub) · 583 unmodified lines | |||
| 720 | */ | 719 | */ |
| 721 | intf = to_usb_interface(hub->intfdev); | 720 | intf = to_usb_interface(hub->intfdev); |
| 722 | usb_autopm_get_interface_no_resume(intf); | 721 | usb_autopm_get_interface_no_resume(intf); |
| 723 | kref_get(&hub->kref); | 722 | hub_get(hub); |
| 724 | 723 | ||
| 725 | if (queue_work(hub_wq, &hub->events)) | 724 | if (queue_work(hub_wq, &hub->events)) |
| 726 | return; | 725 | return; |
| 727 | 726 | ||
| 728 | /* the work has already been scheduled */ | 727 | /* the work has already been scheduled */ |
| 729 | usb_autopm_put_interface_async(intf); | 728 | usb_autopm_put_interface_async(intf); |
| 730 | kref_put(&hub->kref, hub_release); | 729 | hub_put(hub); |
| 731 | } | 730 | } |
| 732 | 731 | ||
| 733 | void usb_kick_hub_wq(struct usb_device *hdev) | 732 | void usb_kick_hub_wq(struct usb_device *hdev) |
| @@ -1095,7 +1094,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · 361 unmodified lines | |||
| 1095 | goto init2; | 1094 | goto init2; |
| 1096 | goto init3; | 1095 | goto init3; |
| 1097 | } | 1096 | } |
| 1098 | kref_get(&hub->kref); | 1097 | hub_get(hub); |
| 1099 | 1098 | ||
| 1100 | /* The superspeed hub except for root hub has to use Hub Depth | 1099 | /* The superspeed hub except for root hub has to use Hub Depth |
| 1101 | * value as an offset into the route string to locate the bits | 1100 | * value as an offset into the route string to locate the bits |
| @@ -1343,7 +1342,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · 241 unmodified lines | |||
| 1343 | device_unlock(&hdev->dev); | 1342 | device_unlock(&hdev->dev); |
| 1344 | } | 1343 | } |
| 1345 | 1344 | ||
| 1346 | kref_put(&hub->kref, hub_release); | 1345 | hub_put(hub); |
| 1347 | } | 1346 | } |
| 1348 | 1347 | ||
| 1349 | /* Implement the continuations for the delays above */ | 1348 | /* Implement the continuations for the delays above */ |
| @@ -1759,6 +1758,16 @@ static void hub_release(struct kref *kref) · 409 unmodified lines | |||
| 1759 | kfree(hub); | 1758 | kfree(hub); |
| 1760 | } | 1759 | } |
| 1761 | 1760 | ||
| 1761 | void hub_get(struct usb_hub *hub) | ||
| 1762 | { | ||
| 1763 | kref_get(&hub->kref); | ||
| 1764 | } | ||
| 1765 | |||
| 1766 | void hub_put(struct usb_hub *hub) | ||
| 1767 | { | ||
| 1768 | kref_put(&hub->kref, hub_release); | ||
| 1769 | } | ||
| 1770 | |||
| 1762 | static unsigned highspeed_hubs; | 1771 | static unsigned highspeed_hubs; |
| 1763 | 1772 | ||
| 1764 | static void hub_disconnect(struct usb_interface *intf) | 1773 | static void hub_disconnect(struct usb_interface *intf) |
| @@ -1807,7 +1816,7 @@ static void hub_disconnect(struct usb_interface *intf) · 42 unmodified lines | |||
| 1807 | 1816 | ||
| 1808 | onboard_hub_destroy_pdevs(&hub->onboard_hub_devs); | 1817 | onboard_hub_destroy_pdevs(&hub->onboard_hub_devs); |
| 1809 | 1818 | ||
| 1810 | kref_put(&hub->kref, hub_release); | 1819 | hub_put(hub); |
| 1811 | } | 1820 | } |
| 1812 | 1821 | ||
| 1813 | static bool hub_descriptor_is_sane(struct usb_host_interface *desc) | 1822 | static bool hub_descriptor_is_sane(struct usb_host_interface *desc) |
| @@ -5934,7 +5943,7 @@ out_hdev_lock: · 4120 unmodified lines | |||
| 5934 | 5943 | ||
| 5935 | /* Balance the stuff in kick_hub_wq() and allow autosuspend */ | 5944 | /* Balance the stuff in kick_hub_wq() and allow autosuspend */ |
| 5936 | usb_autopm_put_interface(intf); | 5945 | usb_autopm_put_interface(intf); |
| 5937 | kref_put(&hub->kref, hub_release); | 5946 | hub_put(hub); |
| 5938 | 5947 | ||
| 5939 | kcov_remote_stop(); | 5948 | kcov_remote_stop(); |
| 5940 | } | 5949 | } |
| @@ -129,6 +129,8 @@ extern void usb_hub_remove_port_device(struct usb_hub *hub, · 128 unmodified lines | |||
| 129 | extern int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, | 129 | extern int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, |
| 130 | int port1, bool set); | 130 | int port1, bool set); |
| 131 | extern struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev); | 131 | extern struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev); |
| 132 | extern void hub_get(struct usb_hub *hub); | ||
| 133 | extern void hub_put(struct usb_hub *hub); | ||
| 132 | extern int hub_port_debounce(struct usb_hub *hub, int port1, | 134 | extern int hub_port_debounce(struct usb_hub *hub, int port1, |
| 133 | bool must_be_connected); | 135 | bool must_be_connected); |
| 134 | extern int usb_clear_port_feature(struct usb_device *hdev, | 136 | extern int usb_clear_port_feature(struct usb_device *hdev, |
| @@ -56,11 +56,22 @@ static ssize_t disable_show(struct device *dev, · 55 unmodified lines | |||
| 56 | u16 portstatus, unused; | 56 | u16 portstatus, unused; |
| 57 | bool disabled; | 57 | bool disabled; |
| 58 | int rc; | 58 | int rc; |
| 59 | struct kernfs_node *kn; | ||
| 59 | 60 | ||
| 61 | hub_get(hub); | ||
| 60 | rc = usb_autopm_get_interface(intf); | 62 | rc = usb_autopm_get_interface(intf); |
| 61 | if (rc < 0) | 63 | if (rc < 0) |
| 62 | return rc; | 64 | goto out_hub_get; |
| 63 | 65 | ||
| 66 | /* | ||
| 67 | * Prevent deadlock if another process is concurrently | ||
| 68 | * trying to unregister hdev. | ||
| 69 | */ | ||
| 70 | kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); | ||
| 71 | if (!kn) { | ||
| 72 | rc = -ENODEV; | ||
| 73 | goto out_autopm; | ||
| 74 | } | ||
| 64 | usb_lock_device(hdev); | 75 | usb_lock_device(hdev); |
| 65 | if (hub->disconnected) { | 76 | if (hub->disconnected) { |
| 66 | rc = -ENODEV; | 77 | rc = -ENODEV; |
| @@ -70,9 +81,13 @@ static ssize_t disable_show(struct device *dev, · 3 unmodified lines | |||
| 70 | usb_hub_port_status(hub, port1, &portstatus, &unused); | 81 | usb_hub_port_status(hub, port1, &portstatus, &unused); |
| 71 | disabled = !usb_port_is_power_on(hub, portstatus); | 82 | disabled = !usb_port_is_power_on(hub, portstatus); |
| 72 | 83 | ||
| 73 | out_hdev_lock: | 84 | out_hdev_lock: |
| 74 | usb_unlock_device(hdev); | 85 | usb_unlock_device(hdev); |
| 86 | sysfs_unbreak_active_protection(kn); | ||
| 87 | out_autopm: | ||
| 75 | usb_autopm_put_interface(intf); | 88 | usb_autopm_put_interface(intf); |
| 89 | out_hub_get: | ||
| 90 | hub_put(hub); | ||
| 76 | 91 | ||
| 77 | if (rc) | 92 | if (rc) |
| 78 | return rc; | 93 | return rc; |
| @@ -90,15 +105,26 @@ static ssize_t disable_store(struct device *dev, struct device_attribute *attr, · 11 unmodified lines | |||
| 90 | int port1 = port_dev->portnum; | 105 | int port1 = port_dev->portnum; |
| 91 | bool disabled; | 106 | bool disabled; |
| 92 | int rc; | 107 | int rc; |
| 108 | struct kernfs_node *kn; | ||
| 93 | 109 | ||
| 94 | rc = kstrtobool(buf, &disabled); | 110 | rc = kstrtobool(buf, &disabled); |
| 95 | if (rc) | 111 | if (rc) |
| 96 | return rc; | 112 | return rc; |
| 97 | 113 | ||
| 114 | hub_get(hub); | ||
| 98 | rc = usb_autopm_get_interface(intf); | 115 | rc = usb_autopm_get_interface(intf); |
| 99 | if (rc < 0) | 116 | if (rc < 0) |
| 100 | return rc; | 117 | goto out_hub_get; |
| 101 | 118 | ||
| 119 | /* | ||
| 120 | * Prevent deadlock if another process is concurrently | ||
| 121 | * trying to unregister hdev. | ||
| 122 | */ | ||
| 123 | kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); | ||
| 124 | if (!kn) { | ||
| 125 | rc = -ENODEV; | ||
| 126 | goto out_autopm; | ||
| 127 | } | ||
| 102 | usb_lock_device(hdev); | 128 | usb_lock_device(hdev); |
| 103 | if (hub->disconnected) { | 129 | if (hub->disconnected) { |
| 104 | rc = -ENODEV; | 130 | rc = -ENODEV; |
| @@ -119,9 +145,13 @@ static ssize_t disable_store(struct device *dev, struct device_attribute *attr, · 14 unmodified lines | |||
| 119 | if (!rc) | 145 | if (!rc) |
| 120 | rc = count; | 146 | rc = count; |
| 121 | 147 | ||
| 122 | out_hdev_lock: | 148 | out_hdev_lock: |
| 123 | usb_unlock_device(hdev); | 149 | usb_unlock_device(hdev); |
| 150 | sysfs_unbreak_active_protection(kn); | ||
| 151 | out_autopm: | ||
| 124 | usb_autopm_put_interface(intf); | 152 | usb_autopm_put_interface(intf); |
| 153 | out_hub_get: | ||
| 154 | hub_put(hub); | ||
| 125 | 155 | ||
| 126 | return rc; | 156 | return rc; |
| 127 | } | 157 | } |
| @@ -1217,14 +1217,24 @@ static ssize_t interface_authorized_store(struct device *dev, · 1216 unmodified lines | |||
| 1217 | { | 1217 | { |
| 1218 | struct usb_interface *intf = to_usb_interface(dev); | 1218 | struct usb_interface *intf = to_usb_interface(dev); |
| 1219 | bool val; | 1219 | bool val; |
| 1220 | struct kernfs_node *kn; | ||
| 1220 | 1221 | ||
| 1221 | if (kstrtobool(buf, &val) != 0) | 1222 | if (kstrtobool(buf, &val) != 0) |
| 1222 | return -EINVAL; | 1223 | return -EINVAL; |
| 1223 | 1224 | ||
| 1224 | if (val) | 1225 | if (val) { |
| 1225 | usb_authorize_interface(intf); | 1226 | usb_authorize_interface(intf); |
| 1226 | else | 1227 | } else { |
| 1227 | usb_deauthorize_interface(intf); | 1228 | /* |
| 1229 | * Prevent deadlock if another process is concurrently | ||
| 1230 | * trying to unregister intf. | ||
| 1231 | */ | ||
| 1232 | kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); | ||
| 1233 | if (kn) { | ||
| 1234 | usb_deauthorize_interface(intf); | ||
| 1235 | sysfs_unbreak_active_protection(kn); | ||
| 1236 | } | ||
| 1237 | } | ||
| 1228 | 1238 | ||
| 1229 | return count; | 1239 | return count; |
| 1230 | } | 1240 | } |
| @@ -729,8 +729,14 @@ struct dwc2_dregs_backup { · 728 unmodified lines | |||
| 729 | * struct dwc2_hregs_backup - Holds host registers state before | 729 | * struct dwc2_hregs_backup - Holds host registers state before |
| 730 | * entering partial power down | 730 | * entering partial power down |
| 731 | * @hcfg: Backup of HCFG register | 731 | * @hcfg: Backup of HCFG register |
| 732 | * @hflbaddr: Backup of HFLBADDR register | ||
| 732 | * @haintmsk: Backup of HAINTMSK register | 733 | * @haintmsk: Backup of HAINTMSK register |
| 734 | * @hcchar: Backup of HCCHAR register | ||
| 735 | * @hcsplt: Backup of HCSPLT register | ||
| 733 | * @hcintmsk: Backup of HCINTMSK register | 736 | * @hcintmsk: Backup of HCINTMSK register |
| 737 | * @hctsiz: Backup of HCTSIZ register | ||
| 738 | * @hdma: Backup of HCDMA register | ||
| 739 | * @hcdmab: Backup of HCDMAB register | ||
| 734 | * @hprt0: Backup of HPTR0 register | 740 | * @hprt0: Backup of HPTR0 register |
| 735 | * @hfir: Backup of HFIR register | 741 | * @hfir: Backup of HFIR register |
| 736 | * @hptxfsiz: Backup of HPTXFSIZ register | 742 | * @hptxfsiz: Backup of HPTXFSIZ register |
| @@ -738,8 +744,14 @@ struct dwc2_dregs_backup { · 1 unmodified line | |||
| 738 | */ | 744 | */ |
| 739 | struct dwc2_hregs_backup { | 745 | struct dwc2_hregs_backup { |
| 740 | u32 hcfg; | 746 | u32 hcfg; |
| 747 | u32 hflbaddr; | ||
| 741 | u32 haintmsk; | 748 | u32 haintmsk; |
| 749 | u32 hcchar[MAX_EPS_CHANNELS]; | ||
| 750 | u32 hcsplt[MAX_EPS_CHANNELS]; | ||
| 742 | u32 hcintmsk[MAX_EPS_CHANNELS]; | 751 | u32 hcintmsk[MAX_EPS_CHANNELS]; |
| 752 | u32 hctsiz[MAX_EPS_CHANNELS]; | ||
| 753 | u32 hcidma[MAX_EPS_CHANNELS]; | ||
| 754 | u32 hcidmab[MAX_EPS_CHANNELS]; | ||
| 743 | u32 hprt0; | 755 | u32 hprt0; |
| 744 | u32 hfir; | 756 | u32 hfir; |
| 745 | u32 hptxfsiz; | 757 | u32 hptxfsiz; |
| @@ -1086,6 +1098,7 @@ struct dwc2_hsotg { · 340 unmodified lines | |||
| 1086 | bool needs_byte_swap; | 1098 | bool needs_byte_swap; |
| 1087 | 1099 | ||
| 1088 | /* DWC OTG HW Release versions */ | 1100 | /* DWC OTG HW Release versions */ |
| 1101 | #define DWC2_CORE_REV_4_30a 0x4f54430a | ||
| 1089 | #define DWC2_CORE_REV_2_71a 0x4f54271a | 1102 | #define DWC2_CORE_REV_2_71a 0x4f54271a |
| 1090 | #define DWC2_CORE_REV_2_72a 0x4f54272a | 1103 | #define DWC2_CORE_REV_2_72a 0x4f54272a |
| 1091 | #define DWC2_CORE_REV_2_80a 0x4f54280a | 1104 | #define DWC2_CORE_REV_2_80a 0x4f54280a |
| @@ -1323,6 +1336,7 @@ int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg); · 231 unmodified lines | |||
| 1323 | int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg); | 1336 | int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg); |
| 1324 | 1337 | ||
| 1325 | void dwc2_enable_acg(struct dwc2_hsotg *hsotg); | 1338 | void dwc2_enable_acg(struct dwc2_hsotg *hsotg); |
| 1339 | void dwc2_wakeup_from_lpm_l1(struct dwc2_hsotg *hsotg, bool remotewakeup); | ||
| 1326 | 1340 | ||
| 1327 | /* This function should be called on every hardware interrupt. */ | 1341 | /* This function should be called on every hardware interrupt. */ |
| 1328 | irqreturn_t dwc2_handle_common_intr(int irq, void *dev); | 1342 | irqreturn_t dwc2_handle_common_intr(int irq, void *dev); |
| @@ -297,7 +297,8 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) · 296 unmodified lines | |||
| 297 | 297 | ||
| 298 | /* Exit gadget mode clock gating. */ | 298 | /* Exit gadget mode clock gating. */ |
| 299 | if (hsotg->params.power_down == | 299 | if (hsotg->params.power_down == |
| 300 | DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended) | 300 | DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended && |
| 301 | !hsotg->params.no_clock_gating) | ||
| 301 | dwc2_gadget_exit_clock_gating(hsotg, 0); | 302 | dwc2_gadget_exit_clock_gating(hsotg, 0); |
| 302 | } | 303 | } |
| 303 | 304 | ||
| @@ -322,10 +323,11 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) · 18 unmodified lines | |||
| 322 | * @hsotg: Programming view of DWC_otg controller | 323 | * @hsotg: Programming view of DWC_otg controller |
| 323 | * | 324 | * |
| 324 | */ | 325 | */ |
| 325 | static void dwc2_wakeup_from_lpm_l1(struct dwc2_hsotg *hsotg) | 326 | void dwc2_wakeup_from_lpm_l1(struct dwc2_hsotg *hsotg, bool remotewakeup) |
| 326 | { | 327 | { |
| 327 | u32 glpmcfg; | 328 | u32 glpmcfg; |
| 328 | u32 i = 0; | 329 | u32 pcgctl; |
| 330 | u32 dctl; | ||
| 329 | 331 | ||
| 330 | if (hsotg->lx_state != DWC2_L1) { | 332 | if (hsotg->lx_state != DWC2_L1) { |
| 331 | dev_err(hsotg->dev, "Core isn't in DWC2_L1 state\n"); | 333 | dev_err(hsotg->dev, "Core isn't in DWC2_L1 state\n"); |
| @@ -334,37 +336,57 @@ static void dwc2_wakeup_from_lpm_l1(struct dwc2_hsotg *hsotg) · 2 unmodified lines | |||
| 334 | 336 | ||
| 335 | glpmcfg = dwc2_readl(hsotg, GLPMCFG); | 337 | glpmcfg = dwc2_readl(hsotg, GLPMCFG); |
| 336 | if (dwc2_is_device_mode(hsotg)) { | 338 | if (dwc2_is_device_mode(hsotg)) { |
| 337 | dev_dbg(hsotg->dev, "Exit from L1 state\n"); | 339 | dev_dbg(hsotg->dev, "Exit from L1 state, remotewakeup=%d\n", remotewakeup); |
| 338 | glpmcfg &= ~GLPMCFG_ENBLSLPM; | 340 | glpmcfg &= ~GLPMCFG_ENBLSLPM; |
| 339 | glpmcfg &= ~GLPMCFG_HIRD_THRES_EN; | 341 | glpmcfg &= ~GLPMCFG_HIRD_THRES_MASK; |
| 340 | dwc2_writel(hsotg, glpmcfg, GLPMCFG); | 342 | dwc2_writel(hsotg, glpmcfg, GLPMCFG); |
| 341 | 343 | ||
| 342 | do { | 344 | pcgctl = dwc2_readl(hsotg, PCGCTL); |
| 343 | glpmcfg = dwc2_readl(hsotg, GLPMCFG); | 345 | pcgctl &= ~PCGCTL_ENBL_SLEEP_GATING; |
| 346 | dwc2_writel(hsotg, pcgctl, PCGCTL); | ||
| 344 | 347 | ||
| 345 | if (!(glpmcfg & (GLPMCFG_COREL1RES_MASK | | 348 | glpmcfg = dwc2_readl(hsotg, GLPMCFG); |
| 346 | GLPMCFG_L1RESUMEOK | GLPMCFG_SLPSTS))) | 349 | if (glpmcfg & GLPMCFG_ENBESL) { |
| 347 | break; | 350 | glpmcfg |= GLPMCFG_RSTRSLPSTS; |
| 351 | dwc2_writel(hsotg, glpmcfg, GLPMCFG); | ||
| 352 | } | ||
| 353 | |||
| 354 | if (remotewakeup) { | ||
| 355 | if (dwc2_hsotg_wait_bit_set(hsotg, GLPMCFG, GLPMCFG_L1RESUMEOK, 1000)) { | ||
| 356 | dev_warn(hsotg->dev, "%s: timeout GLPMCFG_L1RESUMEOK\n", __func__); | ||
| 357 | goto fail; | ||
| 358 | return; | ||
| 359 | } | ||
| 360 | |||
| 361 | dctl = dwc2_readl(hsotg, DCTL); | ||
| 362 | dctl |= DCTL_RMTWKUPSIG; | ||
| 363 | dwc2_writel(hsotg, dctl, DCTL); | ||
| 348 | 364 | ||
| 349 | udelay(1); | 365 | if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS, GINTSTS_WKUPINT, 1000)) { |
| 350 | } while (++i < 200); | 366 | dev_warn(hsotg->dev, "%s: timeout GINTSTS_WKUPINT\n", __func__); |
| 367 | goto fail; | ||
| 368 | return; | ||
| 369 | } | ||
| 370 | } | ||
| 351 | 371 | ||
| 352 | if (i == 200) { | 372 | glpmcfg = dwc2_readl(hsotg, GLPMCFG); |
| 353 | dev_err(hsotg->dev, "Failed to exit L1 sleep state in 200us.\n"); | 373 | if (glpmcfg & GLPMCFG_COREL1RES_MASK || glpmcfg & GLPMCFG_SLPSTS || |
| 374 | glpmcfg & GLPMCFG_L1RESUMEOK) { | ||
| 375 | goto fail; | ||
| 354 | return; | 376 | return; |
| 355 | } | 377 | } |
| 356 | dwc2_gadget_init_lpm(hsotg); | 378 | |
| 379 | /* Inform gadget to exit from L1 */ | ||
| 380 | call_gadget(hsotg, resume); | ||
| 381 | /* Change to L0 state */ | ||
| 382 | hsotg->lx_state = DWC2_L0; | ||
| 383 | hsotg->bus_suspended = false; | ||
| 384 | fail: dwc2_gadget_init_lpm(hsotg); | ||
| 357 | } else { | 385 | } else { |
| 358 | /* TODO */ | 386 | /* TODO */ |
| 359 | dev_err(hsotg->dev, "Host side LPM is not supported.\n"); | 387 | dev_err(hsotg->dev, "Host side LPM is not supported.\n"); |
| 360 | return; | 388 | return; |
| 361 | } | 389 | } |
| 362 | |||
| 363 | /* Change to L0 state */ | ||
| 364 | hsotg->lx_state = DWC2_L0; | ||
| 365 | |||
| 366 | /* Inform gadget to exit from L1 */ | ||
| 367 | call_gadget(hsotg, resume); | ||
| 368 | } | 390 | } |
| 369 | 391 | ||
| 370 | /* | 392 | /* |
| @@ -385,7 +407,7 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) · 14 unmodified lines | |||
| 385 | dev_dbg(hsotg->dev, "%s lxstate = %d\n", __func__, hsotg->lx_state); | 407 | dev_dbg(hsotg->dev, "%s lxstate = %d\n", __func__, hsotg->lx_state); |
| 386 | 408 | ||
| 387 | if (hsotg->lx_state == DWC2_L1) { | 409 | if (hsotg->lx_state == DWC2_L1) { |
| 388 | dwc2_wakeup_from_lpm_l1(hsotg); | 410 | dwc2_wakeup_from_lpm_l1(hsotg, false); |
| 389 | return; | 411 | return; |
| 390 | } | 412 | } |
| 391 | 413 | ||
| @@ -408,7 +430,8 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) · 16 unmodified lines | |||
| 408 | 430 | ||
| 409 | /* Exit gadget mode clock gating. */ | 431 | /* Exit gadget mode clock gating. */ |
| 410 | if (hsotg->params.power_down == | 432 | if (hsotg->params.power_down == |
| 411 | DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended) | 433 | DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended && |
| 434 | !hsotg->params.no_clock_gating) | ||
| 412 | dwc2_gadget_exit_clock_gating(hsotg, 0); | 435 | dwc2_gadget_exit_clock_gating(hsotg, 0); |
| 413 | } else { | 436 | } else { |
| 414 | /* Change to L0 state */ | 437 | /* Change to L0 state */ |
| @@ -425,7 +448,8 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) · 10 unmodified lines | |||
| 425 | } | 448 | } |
| 426 | 449 | ||
| 427 | if (hsotg->params.power_down == | 450 | if (hsotg->params.power_down == |
| 428 | DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended) | 451 | DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended && |
| 452 | !hsotg->params.no_clock_gating) | ||
| 429 | dwc2_host_exit_clock_gating(hsotg, 1); | 453 | dwc2_host_exit_clock_gating(hsotg, 1); |
| 430 | 454 | ||
| 431 | /* | 455 | /* |
| @@ -1415,6 +1415,10 @@ static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, · 1414 unmodified lines | |||
| 1415 | ep->name, req, req->length, req->buf, req->no_interrupt, | 1415 | ep->name, req, req->length, req->buf, req->no_interrupt, |
| 1416 | req->zero, req->short_not_ok); | 1416 | req->zero, req->short_not_ok); |
| 1417 | 1417 | ||
| 1418 | if (hs->lx_state == DWC2_L1) { | ||
| 1419 | dwc2_wakeup_from_lpm_l1(hs, true); | ||
| 1420 | } | ||
| 1421 | |||
| 1418 | /* Prevent new request submission when controller is suspended */ | 1422 | /* Prevent new request submission when controller is suspended */ |
| 1419 | if (hs->lx_state != DWC2_L0) { | 1423 | if (hs->lx_state != DWC2_L0) { |
| 1420 | dev_dbg(hs->dev, "%s: submit request only in active state\n", | 1424 | dev_dbg(hs->dev, "%s: submit request only in active state\n", |
| @@ -3727,6 +3731,12 @@ irq_retry: · 2306 unmodified lines | |||
| 3727 | if (hsotg->in_ppd && hsotg->lx_state == DWC2_L2) | 3731 | if (hsotg->in_ppd && hsotg->lx_state == DWC2_L2) |
| 3728 | dwc2_exit_partial_power_down(hsotg, 0, true); | 3732 | dwc2_exit_partial_power_down(hsotg, 0, true); |
| 3729 | 3733 | ||
| 3734 | /* Exit gadget mode clock gating. */ | ||
| 3735 | if (hsotg->params.power_down == | ||
| 3736 | DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended && | ||
| 3737 | !hsotg->params.no_clock_gating) | ||
| 3738 | dwc2_gadget_exit_clock_gating(hsotg, 0); | ||
| 3739 | |||
| 3730 | hsotg->lx_state = DWC2_L0; | 3740 | hsotg->lx_state = DWC2_L0; |
| 3731 | } | 3741 | } |
| 3732 | 3742 | ||
| @@ -2701,8 +2701,11 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions( · 2700 unmodified lines | |||
| 2701 | hsotg->available_host_channels--; | 2701 | hsotg->available_host_channels--; |
| 2702 | } | 2702 | } |
| 2703 | qh = list_entry(qh_ptr, struct dwc2_qh, qh_list_entry); | 2703 | qh = list_entry(qh_ptr, struct dwc2_qh, qh_list_entry); |
| 2704 | if (dwc2_assign_and_init_hc(hsotg, qh)) | 2704 | if (dwc2_assign_and_init_hc(hsotg, qh)) { |
| 2705 | if (hsotg->params.uframe_sched) | ||
| 2706 | hsotg->available_host_channels++; | ||
| 2705 | break; | 2707 | break; |
| 2708 | } | ||
| 2706 | 2709 | ||
| 2707 | /* | 2710 | /* |
| 2708 | * Move the QH from the periodic ready schedule to the | 2711 | * Move the QH from the periodic ready schedule to the |
| @@ -2735,8 +2738,11 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions( · 26 unmodified lines | |||
| 2735 | hsotg->available_host_channels--; | 2738 | hsotg->available_host_channels--; |
| 2736 | } | 2739 | } |
| 2737 | 2740 | ||
| 2738 | if (dwc2_assign_and_init_hc(hsotg, qh)) | 2741 | if (dwc2_assign_and_init_hc(hsotg, qh)) { |
| 2742 | if (hsotg->params.uframe_sched) | ||
| 2743 | hsotg->available_host_channels++; | ||
| 2739 | break; | 2744 | break; |
| 2745 | } | ||
| 2740 | 2746 | ||
| 2741 | /* | 2747 | /* |
| 2742 | * Move the QH from the non-periodic inactive schedule to the | 2748 | * Move the QH from the non-periodic inactive schedule to the |
| @@ -4143,6 +4149,8 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, · 1400 unmodified lines | |||
| 4143 | urb->actual_length); | 4149 | urb->actual_length); |
| 4144 | 4150 | ||
| 4145 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { | 4151 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { |
| 4152 | if (!hsotg->params.dma_desc_enable) | ||
| 4153 | urb->start_frame = qtd->qh->start_active_frame; | ||
| 4146 | urb->error_count = dwc2_hcd_urb_get_error_count(qtd->urb); | 4154 | urb->error_count = dwc2_hcd_urb_get_error_count(qtd->urb); |
| 4147 | for (i = 0; i < urb->number_of_packets; ++i) { | 4155 | for (i = 0; i < urb->number_of_packets; ++i) { |
| 4148 | urb->iso_frame_desc[i].actual_length = | 4156 | urb->iso_frame_desc[i].actual_length = |
| @@ -4649,7 +4657,7 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, · 500 unmodified lines | |||
| 4649 | } | 4657 | } |
| 4650 | 4658 | ||
| 4651 | if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE && | 4659 | if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE && |
| 4652 | hsotg->bus_suspended) { | 4660 | hsotg->bus_suspended && !hsotg->params.no_clock_gating) { |
| 4653 | if (dwc2_is_device_mode(hsotg)) | 4661 | if (dwc2_is_device_mode(hsotg)) |
| 4654 | dwc2_gadget_exit_clock_gating(hsotg, 0); | 4662 | dwc2_gadget_exit_clock_gating(hsotg, 0); |
| 4655 | else | 4663 | else |
| @@ -5406,9 +5414,16 @@ int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) · 750 unmodified lines | |||
| 5406 | /* Backup Host regs */ | 5414 | /* Backup Host regs */ |
| 5407 | hr = &hsotg->hr_backup; | 5415 | hr = &hsotg->hr_backup; |
| 5408 | hr->hcfg = dwc2_readl(hsotg, HCFG); | 5416 | hr->hcfg = dwc2_readl(hsotg, HCFG); |
| 5417 | hr->hflbaddr = dwc2_readl(hsotg, HFLBADDR); | ||
| 5409 | hr->haintmsk = dwc2_readl(hsotg, HAINTMSK); | 5418 | hr->haintmsk = dwc2_readl(hsotg, HAINTMSK); |
| 5410 | for (i = 0; i < hsotg->params.host_channels; ++i) | 5419 | for (i = 0; i < hsotg->params.host_channels; ++i) { |
| 5420 | hr->hcchar[i] = dwc2_readl(hsotg, HCCHAR(i)); | ||
| 5421 | hr->hcsplt[i] = dwc2_readl(hsotg, HCSPLT(i)); | ||
| 5411 | hr->hcintmsk[i] = dwc2_readl(hsotg, HCINTMSK(i)); | 5422 | hr->hcintmsk[i] = dwc2_readl(hsotg, HCINTMSK(i)); |
| 5423 | hr->hctsiz[i] = dwc2_readl(hsotg, HCTSIZ(i)); | ||
| 5424 | hr->hcidma[i] = dwc2_readl(hsotg, HCDMA(i)); | ||
| 5425 | hr->hcidmab[i] = dwc2_readl(hsotg, HCDMAB(i)); | ||
| 5426 | } | ||
| 5412 | 5427 | ||
| 5413 | hr->hprt0 = dwc2_read_hprt0(hsotg); | 5428 | hr->hprt0 = dwc2_read_hprt0(hsotg); |
| 5414 | hr->hfir = dwc2_readl(hsotg, HFIR); | 5429 | hr->hfir = dwc2_readl(hsotg, HFIR); |
| @@ -5442,10 +5457,17 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) · 27 unmodified lines | |||
| 5442 | hr->valid = false; | 5457 | hr->valid = false; |
| 5443 | 5458 | ||
| 5444 | dwc2_writel(hsotg, hr->hcfg, HCFG); | 5459 | dwc2_writel(hsotg, hr->hcfg, HCFG); |
| 5460 | dwc2_writel(hsotg, hr->hflbaddr, HFLBADDR); | ||
| 5445 | dwc2_writel(hsotg, hr->haintmsk, HAINTMSK); | 5461 | dwc2_writel(hsotg, hr->haintmsk, HAINTMSK); |
| 5446 | 5462 | ||
| 5447 | for (i = 0; i < hsotg->params.host_channels; ++i) | 5463 | for (i = 0; i < hsotg->params.host_channels; ++i) { |
| 5464 | dwc2_writel(hsotg, hr->hcchar[i], HCCHAR(i)); | ||
| 5465 | dwc2_writel(hsotg, hr->hcsplt[i], HCSPLT(i)); | ||
| 5448 | dwc2_writel(hsotg, hr->hcintmsk[i], HCINTMSK(i)); | 5466 | dwc2_writel(hsotg, hr->hcintmsk[i], HCINTMSK(i)); |
| 5467 | dwc2_writel(hsotg, hr->hctsiz[i], HCTSIZ(i)); | ||
| 5468 | dwc2_writel(hsotg, hr->hcidma[i], HCDMA(i)); | ||
| 5469 | dwc2_writel(hsotg, hr->hcidmab[i], HCDMAB(i)); | ||
| 5470 | } | ||
| 5449 | 5471 | ||
| 5450 | dwc2_writel(hsotg, hr->hprt0, HPRT0); | 5472 | dwc2_writel(hsotg, hr->hprt0, HPRT0); |
| 5451 | dwc2_writel(hsotg, hr->hfir, HFIR); | 5473 | dwc2_writel(hsotg, hr->hfir, HFIR); |
| @@ -5610,10 +5632,12 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup, · 158 unmodified lines | |||
| 5610 | dwc2_writel(hsotg, hr->hcfg, HCFG); | 5632 | dwc2_writel(hsotg, hr->hcfg, HCFG); |
| 5611 | 5633 | ||
| 5612 | /* De-assert Wakeup Logic */ | 5634 | /* De-assert Wakeup Logic */ |
| 5613 | gpwrdn = dwc2_readl(hsotg, GPWRDN); | 5635 | if (!(rem_wakeup && hsotg->hw_params.snpsid >= DWC2_CORE_REV_4_30a)) { |
| 5614 | gpwrdn &= ~GPWRDN_PMUACTV; | 5636 | gpwrdn = dwc2_readl(hsotg, GPWRDN); |
| 5615 | dwc2_writel(hsotg, gpwrdn, GPWRDN); | 5637 | gpwrdn &= ~GPWRDN_PMUACTV; |
| 5616 | udelay(10); | 5638 | dwc2_writel(hsotg, gpwrdn, GPWRDN); |
| 5639 | udelay(10); | ||
| 5640 | } | ||
| 5617 | 5641 | ||
| 5618 | hprt0 = hr->hprt0; | 5642 | hprt0 = hr->hprt0; |
| 5619 | hprt0 |= HPRT0_PWR; | 5643 | hprt0 |= HPRT0_PWR; |
| @@ -5638,6 +5662,13 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup, · 18 unmodified lines | |||
| 5638 | hprt0 |= HPRT0_RES; | 5662 | hprt0 |= HPRT0_RES; |
| 5639 | dwc2_writel(hsotg, hprt0, HPRT0); | 5663 | dwc2_writel(hsotg, hprt0, HPRT0); |
| 5640 | 5664 | ||
| 5665 | /* De-assert Wakeup Logic */ | ||
| 5666 | if ((rem_wakeup && hsotg->hw_params.snpsid >= DWC2_CORE_REV_4_30a)) { | ||
| 5667 | gpwrdn = dwc2_readl(hsotg, GPWRDN); | ||
| 5668 | gpwrdn &= ~GPWRDN_PMUACTV; | ||
| 5669 | dwc2_writel(hsotg, gpwrdn, GPWRDN); | ||
| 5670 | udelay(10); | ||
| 5671 | } | ||
| 5641 | /* Wait for Resume time and then program HPRT again */ | 5672 | /* Wait for Resume time and then program HPRT again */ |
| 5642 | mdelay(100); | 5673 | mdelay(100); |
| 5643 | hprt0 &= ~HPRT0_RES; | 5674 | hprt0 &= ~HPRT0_RES; |
| @@ -559,7 +559,7 @@ static void dwc2_init_isoc_dma_desc(struct dwc2_hsotg *hsotg, · 558 unmodified lines | |||
| 559 | idx = qh->td_last; | 559 | idx = qh->td_last; |
| 560 | inc = qh->host_interval; | 560 | inc = qh->host_interval; |
| 561 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); | 561 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); |
| 562 | cur_idx = dwc2_frame_list_idx(hsotg->frame_number); | 562 | cur_idx = idx; |
| 563 | next_idx = dwc2_desclist_idx_inc(qh->td_last, inc, qh->dev_speed); | 563 | next_idx = dwc2_desclist_idx_inc(qh->td_last, inc, qh->dev_speed); |
| 564 | 564 | ||
| 565 | /* | 565 | /* |
| @@ -866,6 +866,8 @@ static int dwc2_cmpl_host_isoc_dma_desc(struct dwc2_hsotg *hsotg, · 300 unmodified lines | |||
| 866 | { | 866 | { |
| 867 | struct dwc2_dma_desc *dma_desc; | 867 | struct dwc2_dma_desc *dma_desc; |
| 868 | struct dwc2_hcd_iso_packet_desc *frame_desc; | 868 | struct dwc2_hcd_iso_packet_desc *frame_desc; |
| 869 | u16 frame_desc_idx; | ||
| 870 | struct urb *usb_urb = qtd->urb->priv; | ||
| 869 | u16 remain = 0; | 871 | u16 remain = 0; |
| 870 | int rc = 0; | 872 | int rc = 0; |
| 871 | 873 | ||
| @@ -878,8 +880,11 @@ static int dwc2_cmpl_host_isoc_dma_desc(struct dwc2_hsotg *hsotg, · 6 unmodified lines | |||
| 878 | DMA_FROM_DEVICE); | 880 | DMA_FROM_DEVICE); |
| 879 | 881 | ||
| 880 | dma_desc = &qh->desc_list[idx]; | 882 | dma_desc = &qh->desc_list[idx]; |
| 883 | frame_desc_idx = (idx - qtd->isoc_td_first) & (usb_urb->number_of_packets - 1); | ||
| 881 | 884 | ||
| 882 | frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index_last]; | 885 | frame_desc = &qtd->urb->iso_descs[frame_desc_idx]; |
| 886 | if (idx == qtd->isoc_td_first) | ||
| 887 | usb_urb->start_frame = dwc2_hcd_get_frame_number(hsotg); | ||
| 883 | dma_desc->buf = (u32)(qtd->urb->dma + frame_desc->offset); | 888 | dma_desc->buf = (u32)(qtd->urb->dma + frame_desc->offset); |
| 884 | if (chan->ep_is_in) | 889 | if (chan->ep_is_in) |
| 885 | remain = (dma_desc->status & HOST_DMA_ISOC_NBYTES_MASK) >> | 890 | remain = (dma_desc->status & HOST_DMA_ISOC_NBYTES_MASK) >> |
| @@ -900,7 +905,7 @@ static int dwc2_cmpl_host_isoc_dma_desc(struct dwc2_hsotg *hsotg, · 14 unmodified lines | |||
| 900 | frame_desc->status = 0; | 905 | frame_desc->status = 0; |
| 901 | } | 906 | } |
| 902 | 907 | ||
| 903 | if (++qtd->isoc_frame_index == qtd->urb->packet_count) { | 908 | if (++qtd->isoc_frame_index == usb_urb->number_of_packets) { |
| 904 | /* | 909 | /* |
| 905 | * urb->status is not used for isoc transfers here. The | 910 | * urb->status is not used for isoc transfers here. The |
| 906 | * individual frame_desc status are used instead. | 911 | * individual frame_desc status are used instead. |
| @@ -1005,11 +1010,11 @@ static void dwc2_complete_isoc_xfer_ddma(struct dwc2_hsotg *hsotg, · 98 unmodified lines | |||
| 1005 | return; | 1010 | return; |
| 1006 | idx = dwc2_desclist_idx_inc(idx, qh->host_interval, | 1011 | idx = dwc2_desclist_idx_inc(idx, qh->host_interval, |
| 1007 | chan->speed); | 1012 | chan->speed); |
| 1008 | if (!rc) | 1013 | if (rc == 0) |
| 1009 | continue; | 1014 | continue; |
| 1010 | 1015 | ||
| 1011 | if (rc == DWC2_CMPL_DONE) | 1016 | if (rc == DWC2_CMPL_DONE || rc == DWC2_CMPL_STOP) |
| 1012 | break; | 1017 | goto stop_scan; |
| 1013 | 1018 | ||
| 1014 | /* rc == DWC2_CMPL_STOP */ | 1019 | /* rc == DWC2_CMPL_STOP */ |
| 1015 | 1020 | ||
| @@ -698,7 +698,7 @@ · 697 unmodified lines | |||
| 698 | #define TXSTS_QTOP_TOKEN_MASK (0x3 << 25) | 698 | #define TXSTS_QTOP_TOKEN_MASK (0x3 << 25) |
| 699 | #define TXSTS_QTOP_TOKEN_SHIFT 25 | 699 | #define TXSTS_QTOP_TOKEN_SHIFT 25 |
| 700 | #define TXSTS_QTOP_TERMINATE BIT(24) | 700 | #define TXSTS_QTOP_TERMINATE BIT(24) |
| 701 | #define TXSTS_QSPCAVAIL_MASK (0xff << 16) | 701 | #define TXSTS_QSPCAVAIL_MASK (0x7f << 16) |
| 702 | #define TXSTS_QSPCAVAIL_SHIFT 16 | 702 | #define TXSTS_QSPCAVAIL_SHIFT 16 |
| 703 | #define TXSTS_FSPCAVAIL_MASK (0xffff << 0) | 703 | #define TXSTS_FSPCAVAIL_MASK (0xffff << 0) |
| 704 | #define TXSTS_FSPCAVAIL_SHIFT 0 | 704 | #define TXSTS_FSPCAVAIL_SHIFT 0 |
| @@ -331,7 +331,7 @@ static void dwc2_driver_remove(struct platform_device *dev) · 330 unmodified lines | |||
| 331 | 331 | ||
| 332 | /* Exit clock gating when driver is removed. */ | 332 | /* Exit clock gating when driver is removed. */ |
| 333 | if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE && | 333 | if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE && |
| 334 | hsotg->bus_suspended) { | 334 | hsotg->bus_suspended && !hsotg->params.no_clock_gating) { |
| 335 | if (dwc2_is_device_mode(hsotg)) | 335 | if (dwc2_is_device_mode(hsotg)) |
| 336 | dwc2_gadget_exit_clock_gating(hsotg, 0); | 336 | dwc2_gadget_exit_clock_gating(hsotg, 0); |
| 337 | else | 337 | else |
| @@ -1519,6 +1519,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) · 1518 unmodified lines | |||
| 1519 | else | 1519 | else |
| 1520 | dwc->sysdev = dwc->dev; | 1520 | dwc->sysdev = dwc->dev; |
| 1521 | 1521 | ||
| 1522 | dwc->sys_wakeup = device_may_wakeup(dwc->sysdev); | ||
| 1523 | |||
| 1522 | ret = device_property_read_string(dev, "usb-psy-name", &usb_psy_name); | 1524 | ret = device_property_read_string(dev, "usb-psy-name", &usb_psy_name); |
| 1523 | if (ret >= 0) { | 1525 | if (ret >= 0) { |
| 1524 | dwc->usb_psy = power_supply_get_by_name(usb_psy_name); | 1526 | dwc->usb_psy = power_supply_get_by_name(usb_psy_name); |
| @@ -1133,6 +1133,7 @@ struct dwc3_scratchpad_array { · 1132 unmodified lines | |||
| 1133 | * 3 - Reserved | 1133 | * 3 - Reserved |
| 1134 | * @dis_metastability_quirk: set to disable metastability quirk. | 1134 | * @dis_metastability_quirk: set to disable metastability quirk. |
| 1135 | * @dis_split_quirk: set to disable split boundary. | 1135 | * @dis_split_quirk: set to disable split boundary. |
| 1136 | * @sys_wakeup: set if the device may do system wakeup. | ||
| 1136 | * @wakeup_configured: set if the device is configured for remote wakeup. | 1137 | * @wakeup_configured: set if the device is configured for remote wakeup. |
| 1137 | * @suspended: set to track suspend event due to U3/L2. | 1138 | * @suspended: set to track suspend event due to U3/L2. |
| 1138 | * @imod_interval: set the interrupt moderation interval in 250ns | 1139 | * @imod_interval: set the interrupt moderation interval in 250ns |
| @@ -1357,6 +1358,7 @@ struct dwc3 { · 218 unmodified lines | |||
| 1357 | 1358 | ||
| 1358 | unsigned dis_split_quirk:1; | 1359 | unsigned dis_split_quirk:1; |
| 1359 | unsigned async_callbacks:1; | 1360 | unsigned async_callbacks:1; |
| 1361 | unsigned sys_wakeup:1; | ||
| 1360 | unsigned wakeup_configured:1; | 1362 | unsigned wakeup_configured:1; |
| 1361 | unsigned suspended:1; | 1363 | unsigned suspended:1; |
| 1362 | 1364 | ||
| @@ -51,7 +51,6 @@ · 50 unmodified lines | |||
| 51 | #define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1 | 51 | #define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1 |
| 52 | #define PCI_DEVICE_ID_INTEL_MTLS 0x7f6f | 52 | #define PCI_DEVICE_ID_INTEL_MTLS 0x7f6f |
| 53 | #define PCI_DEVICE_ID_INTEL_MTL 0x7e7e | 53 | #define PCI_DEVICE_ID_INTEL_MTL 0x7e7e |
| 54 | #define PCI_DEVICE_ID_INTEL_ARLH 0x7ec1 | ||
| 55 | #define PCI_DEVICE_ID_INTEL_ARLH_PCH 0x777e | 54 | #define PCI_DEVICE_ID_INTEL_ARLH_PCH 0x777e |
| 56 | #define PCI_DEVICE_ID_INTEL_TGL 0x9a15 | 55 | #define PCI_DEVICE_ID_INTEL_TGL 0x9a15 |
| 57 | #define PCI_DEVICE_ID_AMD_MR 0x163a | 56 | #define PCI_DEVICE_ID_AMD_MR 0x163a |
| @@ -423,7 +422,6 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 365 unmodified lines | |||
| 423 | { PCI_DEVICE_DATA(INTEL, MTLP, &dwc3_pci_intel_swnode) }, | 422 | { PCI_DEVICE_DATA(INTEL, MTLP, &dwc3_pci_intel_swnode) }, |
| 424 | { PCI_DEVICE_DATA(INTEL, MTL, &dwc3_pci_intel_swnode) }, | 423 | { PCI_DEVICE_DATA(INTEL, MTL, &dwc3_pci_intel_swnode) }, |
| 425 | { PCI_DEVICE_DATA(INTEL, MTLS, &dwc3_pci_intel_swnode) }, | 424 | { PCI_DEVICE_DATA(INTEL, MTLS, &dwc3_pci_intel_swnode) }, |
| 426 | { PCI_DEVICE_DATA(INTEL, ARLH, &dwc3_pci_intel_swnode) }, | ||
| 427 | { PCI_DEVICE_DATA(INTEL, ARLH_PCH, &dwc3_pci_intel_swnode) }, | 425 | { PCI_DEVICE_DATA(INTEL, ARLH_PCH, &dwc3_pci_intel_swnode) }, |
| 428 | { PCI_DEVICE_DATA(INTEL, TGL, &dwc3_pci_intel_swnode) }, | 426 | { PCI_DEVICE_DATA(INTEL, TGL, &dwc3_pci_intel_swnode) }, |
| 429 | 427 | ||
| @@ -2955,6 +2955,9 @@ static int dwc3_gadget_start(struct usb_gadget *g, · 2954 unmodified lines | |||
| 2955 | dwc->gadget_driver = driver; | 2955 | dwc->gadget_driver = driver; |
| 2956 | spin_unlock_irqrestore(&dwc->lock, flags); | 2956 | spin_unlock_irqrestore(&dwc->lock, flags); |
| 2957 | 2957 | ||
| 2958 | if (dwc->sys_wakeup) | ||
| 2959 | device_wakeup_enable(dwc->sysdev); | ||
| 2960 | |||
| 2958 | return 0; | 2961 | return 0; |
| 2959 | } | 2962 | } |
| 2960 | 2963 | ||
| @@ -2970,6 +2973,9 @@ static int dwc3_gadget_stop(struct usb_gadget *g) · 9 unmodified lines | |||
| 2970 | struct dwc3 *dwc = gadget_to_dwc(g); | 2973 | struct dwc3 *dwc = gadget_to_dwc(g); |
| 2971 | unsigned long flags; | 2974 | unsigned long flags; |
| 2972 | 2975 | ||
| 2976 | if (dwc->sys_wakeup) | ||
| 2977 | device_wakeup_disable(dwc->sysdev); | ||
| 2978 | |||
| 2973 | spin_lock_irqsave(&dwc->lock, flags); | 2979 | spin_lock_irqsave(&dwc->lock, flags); |
| 2974 | dwc->gadget_driver = NULL; | 2980 | dwc->gadget_driver = NULL; |
| 2975 | dwc->max_cfg_eps = 0; | 2981 | dwc->max_cfg_eps = 0; |
| @@ -4651,6 +4657,10 @@ int dwc3_gadget_init(struct dwc3 *dwc) · 1675 unmodified lines | |||
| 4651 | else | 4657 | else |
| 4652 | dwc3_gadget_set_speed(dwc->gadget, dwc->maximum_speed); | 4658 | dwc3_gadget_set_speed(dwc->gadget, dwc->maximum_speed); |
| 4653 | 4659 | ||
| 4660 | /* No system wakeup if no gadget driver bound */ | ||
| 4661 | if (dwc->sys_wakeup) | ||
| 4662 | device_wakeup_disable(dwc->sysdev); | ||
| 4663 | |||
| 4654 | return 0; | 4664 | return 0; |
| 4655 | 4665 | ||
| 4656 | err5: | 4666 | err5: |
| @@ -173,6 +173,14 @@ int dwc3_host_init(struct dwc3 *dwc) · 172 unmodified lines | |||
| 173 | goto err; | 173 | goto err; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | if (dwc->sys_wakeup) { | ||
| 177 | /* Restore wakeup setting if switched from device */ | ||
| 178 | device_wakeup_enable(dwc->sysdev); | ||
| 179 | |||
| 180 | /* Pass on wakeup setting to the new xhci platform device */ | ||
| 181 | device_init_wakeup(&xhci->dev, true); | ||
| 182 | } | ||
| 183 | |||
| 176 | return 0; | 184 | return 0; |
| 177 | err: | 185 | err: |
| 178 | platform_device_put(xhci); | 186 | platform_device_put(xhci); |
| @@ -181,6 +189,9 @@ err: · 2 unmodified lines | |||
| 181 | 189 | ||
| 182 | void dwc3_host_exit(struct dwc3 *dwc) | 190 | void dwc3_host_exit(struct dwc3 *dwc) |
| 183 | { | 191 | { |
| 192 | if (dwc->sys_wakeup) | ||
| 193 | device_init_wakeup(&dwc->xhci->dev, false); | ||
| 194 | |||
| 184 | platform_device_unregister(dwc->xhci); | 195 | platform_device_unregister(dwc->xhci); |
| 185 | dwc->xhci = NULL; | 196 | dwc->xhci = NULL; |
| 186 | } | 197 | } |
| @@ -292,7 +292,9 @@ int usb_ep_queue(struct usb_ep *ep, · 291 unmodified lines | |||
| 292 | { | 292 | { |
| 293 | int ret = 0; | 293 | int ret = 0; |
| 294 | 294 | ||
| 295 | if (WARN_ON_ONCE(!ep->enabled && ep->address)) { | 295 | if (!ep->enabled && ep->address) { |
| 296 | pr_debug("USB gadget: queue request to disabled ep 0x%x (%s)\n", | ||
| 297 | ep->address, ep->name); | ||
| 296 | ret = -ESHUTDOWN; | 298 | ret = -ESHUTDOWN; |
| 297 | goto out; | 299 | goto out; |
| 298 | } | 300 | } |
| @@ -518,8 +518,10 @@ static int ljca_new_client_device(struct ljca_adapter *adap, u8 type, u8 id, · 517 unmodified lines | |||
| 518 | int ret; | 518 | int ret; |
| 519 | 519 | ||
| 520 | client = kzalloc(sizeof *client, GFP_KERNEL); | 520 | client = kzalloc(sizeof *client, GFP_KERNEL); |
| 521 | if (!client) | 521 | if (!client) { |
| 522 | kfree(data); | ||
| 522 | return -ENOMEM; | 523 | return -ENOMEM; |
| 524 | } | ||
| 523 | 525 | ||
| 524 | client->type = type; | 526 | client->type = type; |
| 525 | client->id = id; | 527 | client->id = id; |
| @@ -535,8 +537,10 @@ static int ljca_new_client_device(struct ljca_adapter *adap, u8 type, u8 id, · 9 unmodified lines | |||
| 535 | auxdev->dev.release = ljca_auxdev_release; | 537 | auxdev->dev.release = ljca_auxdev_release; |
| 536 | 538 | ||
| 537 | ret = auxiliary_device_init(auxdev); | 539 | ret = auxiliary_device_init(auxdev); |
| 538 | if (ret) | 540 | if (ret) { |
| 541 | kfree(data); | ||
| 539 | goto err_free; | 542 | goto err_free; |
| 543 | } | ||
| 540 | 544 | ||
| 541 | ljca_auxdev_acpi_bind(adap, auxdev, adr, id); | 545 | ljca_auxdev_acpi_bind(adap, auxdev, adr, id); |
| 542 | 546 | ||
| @@ -590,12 +594,8 @@ static int ljca_enumerate_gpio(struct ljca_adapter *adap) · 47 unmodified lines | |||
| 590 | valid_pin[i] = get_unaligned_le32(&desc->bank_desc[i].valid_pins); | 594 | valid_pin[i] = get_unaligned_le32(&desc->bank_desc[i].valid_pins); |
| 591 | bitmap_from_arr32(gpio_info->valid_pin_map, valid_pin, gpio_num); | 595 | bitmap_from_arr32(gpio_info->valid_pin_map, valid_pin, gpio_num); |
| 592 | 596 | ||
| 593 | ret = ljca_new_client_device(adap, LJCA_CLIENT_GPIO, 0, "ljca-gpio", | 597 | return ljca_new_client_device(adap, LJCA_CLIENT_GPIO, 0, "ljca-gpio", |
| 594 | gpio_info, LJCA_GPIO_ACPI_ADR); | 598 | gpio_info, LJCA_GPIO_ACPI_ADR); |
| 595 | if (ret) | ||
| 596 | kfree(gpio_info); | ||
| 597 | |||
| 598 | return ret; | ||
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | static int ljca_enumerate_i2c(struct ljca_adapter *adap) | 601 | static int ljca_enumerate_i2c(struct ljca_adapter *adap) |
| @@ -629,10 +629,8 @@ static int ljca_enumerate_i2c(struct ljca_adapter *adap) · 27 unmodified lines | |||
| 629 | ret = ljca_new_client_device(adap, LJCA_CLIENT_I2C, i, | 629 | ret = ljca_new_client_device(adap, LJCA_CLIENT_I2C, i, |
| 630 | "ljca-i2c", i2c_info, | 630 | "ljca-i2c", i2c_info, |
| 631 | LJCA_I2C1_ACPI_ADR + i); | 631 | LJCA_I2C1_ACPI_ADR + i); |
| 632 | if (ret) { | 632 | if (ret) |
| 633 | kfree(i2c_info); | ||
| 634 | return ret; | 633 | return ret; |
| 635 | } | ||
| 636 | } | 634 | } |
| 637 | 635 | ||
| 638 | return 0; | 636 | return 0; |
| @@ -669,10 +667,8 @@ static int ljca_enumerate_spi(struct ljca_adapter *adap) · 30 unmodified lines | |||
| 669 | ret = ljca_new_client_device(adap, LJCA_CLIENT_SPI, i, | 667 | ret = ljca_new_client_device(adap, LJCA_CLIENT_SPI, i, |
| 670 | "ljca-spi", spi_info, | 668 | "ljca-spi", spi_info, |
| 671 | LJCA_SPI1_ACPI_ADR + i); | 669 | LJCA_SPI1_ACPI_ADR + i); |
| 672 | if (ret) { | 670 | if (ret) |
| 673 | kfree(spi_info); | ||
| 674 | return ret; | 671 | return ret; |
| 675 | } | ||
| 676 | } | 672 | } |
| 677 | 673 | ||
| 678 | return 0; | 674 | return 0; |
| @@ -262,13 +262,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) · 261 unmodified lines | |||
| 262 | return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), | 262 | return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), |
| 263 | "could not get vbus regulator\n"); | 263 | "could not get vbus regulator\n"); |
| 264 | 264 | ||
| 265 | nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); | ||
| 266 | if (PTR_ERR(nop->vbus_draw) == -ENODEV) | ||
| 267 | nop->vbus_draw = NULL; | ||
| 268 | if (IS_ERR(nop->vbus_draw)) | ||
| 269 | return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), | ||
| 270 | "could not get vbus regulator\n"); | ||
| 271 | |||
| 272 | nop->dev = dev; | 265 | nop->dev = dev; |
| 273 | nop->phy.dev = nop->dev; | 266 | nop->phy.dev = nop->dev; |
| 274 | nop->phy.label = "nop-xceiv"; | 267 | nop->phy.label = "nop-xceiv"; |
| @@ -533,7 +533,7 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp, · 532 unmodified lines | |||
| 533 | * daft to me. | 533 | * daft to me. |
| 534 | */ | 534 | */ |
| 535 | 535 | ||
| 536 | static struct urb *uas_submit_sense_urb(struct scsi_cmnd *cmnd, gfp_t gfp) | 536 | static int uas_submit_sense_urb(struct scsi_cmnd *cmnd, gfp_t gfp) |
| 537 | { | 537 | { |
| 538 | struct uas_dev_info *devinfo = cmnd->device->hostdata; | 538 | struct uas_dev_info *devinfo = cmnd->device->hostdata; |
| 539 | struct urb *urb; | 539 | struct urb *urb; |
| @@ -541,30 +541,28 @@ static struct urb *uas_submit_sense_urb(struct scsi_cmnd *cmnd, gfp_t gfp) · 1 unmodified line | |||
| 541 | 541 | ||
| 542 | urb = uas_alloc_sense_urb(devinfo, gfp, cmnd); | 542 | urb = uas_alloc_sense_urb(devinfo, gfp, cmnd); |
| 543 | if (!urb) | 543 | if (!urb) |
| 544 | return NULL; | 544 | return -ENOMEM; |
| 545 | usb_anchor_urb(urb, &devinfo->sense_urbs); | 545 | usb_anchor_urb(urb, &devinfo->sense_urbs); |
| 546 | err = usb_submit_urb(urb, gfp); | 546 | err = usb_submit_urb(urb, gfp); |
| 547 | if (err) { | 547 | if (err) { |
| 548 | usb_unanchor_urb(urb); | 548 | usb_unanchor_urb(urb); |
| 549 | uas_log_cmd_state(cmnd, "sense submit err", err); | 549 | uas_log_cmd_state(cmnd, "sense submit err", err); |
| 550 | usb_free_urb(urb); | 550 | usb_free_urb(urb); |
| 551 | return NULL; | ||
| 552 | } | 551 | } |
| 553 | return urb; | 552 | return err; |
| 554 | } | 553 | } |
| 555 | 554 | ||
| 556 | static int uas_submit_urbs(struct scsi_cmnd *cmnd, | 555 | static int uas_submit_urbs(struct scsi_cmnd *cmnd, |
| 557 | struct uas_dev_info *devinfo) | 556 | struct uas_dev_info *devinfo) |
| 558 | { | 557 | { |
| 559 | struct uas_cmd_info *cmdinfo = scsi_cmd_priv(cmnd); | 558 | struct uas_cmd_info *cmdinfo = scsi_cmd_priv(cmnd); |
| 560 | struct urb *urb; | ||
| 561 | int err; | 559 | int err; |
| 562 | 560 | ||
| 563 | lockdep_assert_held(&devinfo->lock); | 561 | lockdep_assert_held(&devinfo->lock); |
| 564 | if (cmdinfo->state & SUBMIT_STATUS_URB) { | 562 | if (cmdinfo->state & SUBMIT_STATUS_URB) { |
| 565 | urb = uas_submit_sense_urb(cmnd, GFP_ATOMIC); | 563 | err = uas_submit_sense_urb(cmnd, GFP_ATOMIC); |
| 566 | if (!urb) | 564 | if (err) |
| 567 | return SCSI_MLQUEUE_DEVICE_BUSY; | 565 | return err; |
| 568 | cmdinfo->state &= ~SUBMIT_STATUS_URB; | 566 | cmdinfo->state &= ~SUBMIT_STATUS_URB; |
| 569 | } | 567 | } |
| 570 | 568 | ||
| @@ -572,7 +570,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, · 1 unmodified line | |||
| 572 | cmdinfo->data_in_urb = uas_alloc_data_urb(devinfo, GFP_ATOMIC, | 570 | cmdinfo->data_in_urb = uas_alloc_data_urb(devinfo, GFP_ATOMIC, |
| 573 | cmnd, DMA_FROM_DEVICE); | 571 | cmnd, DMA_FROM_DEVICE); |
| 574 | if (!cmdinfo->data_in_urb) | 572 | if (!cmdinfo->data_in_urb) |
| 575 | return SCSI_MLQUEUE_DEVICE_BUSY; | 573 | return -ENOMEM; |
| 576 | cmdinfo->state &= ~ALLOC_DATA_IN_URB; | 574 | cmdinfo->state &= ~ALLOC_DATA_IN_URB; |
| 577 | } | 575 | } |
| 578 | 576 | ||
| @@ -582,7 +580,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, · 3 unmodified lines | |||
| 582 | if (err) { | 580 | if (err) { |
| 583 | usb_unanchor_urb(cmdinfo->data_in_urb); | 581 | usb_unanchor_urb(cmdinfo->data_in_urb); |
| 584 | uas_log_cmd_state(cmnd, "data in submit err", err); | 582 | uas_log_cmd_state(cmnd, "data in submit err", err); |
| 585 | return SCSI_MLQUEUE_DEVICE_BUSY; | 583 | return err; |
| 586 | } | 584 | } |
| 587 | cmdinfo->state &= ~SUBMIT_DATA_IN_URB; | 585 | cmdinfo->state &= ~SUBMIT_DATA_IN_URB; |
| 588 | cmdinfo->state |= DATA_IN_URB_INFLIGHT; | 586 | cmdinfo->state |= DATA_IN_URB_INFLIGHT; |
| @@ -592,7 +590,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, · 3 unmodified lines | |||
| 592 | cmdinfo->data_out_urb = uas_alloc_data_urb(devinfo, GFP_ATOMIC, | 590 | cmdinfo->data_out_urb = uas_alloc_data_urb(devinfo, GFP_ATOMIC, |
| 593 | cmnd, DMA_TO_DEVICE); | 591 | cmnd, DMA_TO_DEVICE); |
| 594 | if (!cmdinfo->data_out_urb) | 592 | if (!cmdinfo->data_out_urb) |
| 595 | return SCSI_MLQUEUE_DEVICE_BUSY; | 593 | return -ENOMEM; |
| 596 | cmdinfo->state &= ~ALLOC_DATA_OUT_URB; | 594 | cmdinfo->state &= ~ALLOC_DATA_OUT_URB; |
| 597 | } | 595 | } |
| 598 | 596 | ||
| @@ -602,7 +600,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, · 3 unmodified lines | |||
| 602 | if (err) { | 600 | if (err) { |
| 603 | usb_unanchor_urb(cmdinfo->data_out_urb); | 601 | usb_unanchor_urb(cmdinfo->data_out_urb); |
| 604 | uas_log_cmd_state(cmnd, "data out submit err", err); | 602 | uas_log_cmd_state(cmnd, "data out submit err", err); |
| 605 | return SCSI_MLQUEUE_DEVICE_BUSY; | 603 | return err; |
| 606 | } | 604 | } |
| 607 | cmdinfo->state &= ~SUBMIT_DATA_OUT_URB; | 605 | cmdinfo->state &= ~SUBMIT_DATA_OUT_URB; |
| 608 | cmdinfo->state |= DATA_OUT_URB_INFLIGHT; | 606 | cmdinfo->state |= DATA_OUT_URB_INFLIGHT; |
| @@ -611,7 +609,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, · 2 unmodified lines | |||
| 611 | if (cmdinfo->state & ALLOC_CMD_URB) { | 609 | if (cmdinfo->state & ALLOC_CMD_URB) { |
| 612 | cmdinfo->cmd_urb = uas_alloc_cmd_urb(devinfo, GFP_ATOMIC, cmnd); | 610 | cmdinfo->cmd_urb = uas_alloc_cmd_urb(devinfo, GFP_ATOMIC, cmnd); |
| 613 | if (!cmdinfo->cmd_urb) | 611 | if (!cmdinfo->cmd_urb) |
| 614 | return SCSI_MLQUEUE_DEVICE_BUSY; | 612 | return -ENOMEM; |
| 615 | cmdinfo->state &= ~ALLOC_CMD_URB; | 613 | cmdinfo->state &= ~ALLOC_CMD_URB; |
| 616 | } | 614 | } |
| 617 | 615 | ||
| @@ -621,7 +619,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, · 3 unmodified lines | |||
| 621 | if (err) { | 619 | if (err) { |
| 622 | usb_unanchor_urb(cmdinfo->cmd_urb); | 620 | usb_unanchor_urb(cmdinfo->cmd_urb); |
| 623 | uas_log_cmd_state(cmnd, "cmd submit err", err); | 621 | uas_log_cmd_state(cmnd, "cmd submit err", err); |
| 624 | return SCSI_MLQUEUE_DEVICE_BUSY; | 622 | return err; |
| 625 | } | 623 | } |
| 626 | cmdinfo->cmd_urb = NULL; | 624 | cmdinfo->cmd_urb = NULL; |
| 627 | cmdinfo->state &= ~SUBMIT_CMD_URB; | 625 | cmdinfo->state &= ~SUBMIT_CMD_URB; |
| @@ -698,7 +696,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd) · 70 unmodified lines | |||
| 698 | * of queueing, no matter how fatal the error | 696 | * of queueing, no matter how fatal the error |
| 699 | */ | 697 | */ |
| 700 | if (err == -ENODEV) { | 698 | if (err == -ENODEV) { |
| 701 | set_host_byte(cmnd, DID_ERROR); | 699 | set_host_byte(cmnd, DID_NO_CONNECT); |
| 702 | scsi_done(cmnd); | 700 | scsi_done(cmnd); |
| 703 | goto zombie; | 701 | goto zombie; |
| 704 | } | 702 | } |
| @@ -1310,6 +1310,7 @@ static ssize_t select_usb_power_delivery_store(struct device *dev, · 1309 unmodified lines | |||
| 1310 | { | 1310 | { |
| 1311 | struct typec_port *port = to_typec_port(dev); | 1311 | struct typec_port *port = to_typec_port(dev); |
| 1312 | struct usb_power_delivery *pd; | 1312 | struct usb_power_delivery *pd; |
| 1313 | int ret; | ||
| 1313 | 1314 | ||
| 1314 | if (!port->ops || !port->ops->pd_set) | 1315 | if (!port->ops || !port->ops->pd_set) |
| 1315 | return -EOPNOTSUPP; | 1316 | return -EOPNOTSUPP; |
| @@ -1318,7 +1319,11 @@ static ssize_t select_usb_power_delivery_store(struct device *dev, · 2 unmodified lines | |||
| 1318 | if (!pd) | 1319 | if (!pd) |
| 1319 | return -EINVAL; | 1320 | return -EINVAL; |
| 1320 | 1321 | ||
| 1321 | return port->ops->pd_set(port, pd); | 1322 | ret = port->ops->pd_set(port, pd); |
| 1323 | if (ret) | ||
| 1324 | return ret; | ||
| 1325 | |||
| 1326 | return size; | ||
| 1322 | } | 1327 | } |
| 1323 | 1328 | ||
| 1324 | static ssize_t select_usb_power_delivery_show(struct device *dev, | 1329 | static ssize_t select_usb_power_delivery_show(struct device *dev, |
| @@ -6861,7 +6861,7 @@ static int tcpm_pd_set(struct typec_port *p, struct usb_power_delivery *pd) · 6860 unmodified lines | |||
| 6861 | 6861 | ||
| 6862 | if (data->source_desc.pdo[0]) { | 6862 | if (data->source_desc.pdo[0]) { |
| 6863 | for (i = 0; i < PDO_MAX_OBJECTS && data->source_desc.pdo[i]; i++) | 6863 | for (i = 0; i < PDO_MAX_OBJECTS && data->source_desc.pdo[i]; i++) |
| 6864 | port->snk_pdo[i] = data->source_desc.pdo[i]; | 6864 | port->src_pdo[i] = data->source_desc.pdo[i]; |
| 6865 | port->nr_src_pdo = i + 1; | 6865 | port->nr_src_pdo = i + 1; |
| 6866 | } | 6866 | } |
| 6867 | 6867 | ||
| @@ -6910,7 +6910,9 @@ static int tcpm_pd_set(struct typec_port *p, struct usb_power_delivery *pd) · 42 unmodified lines | |||
| 6910 | 6910 | ||
| 6911 | port->port_source_caps = data->source_cap; | 6911 | port->port_source_caps = data->source_cap; |
| 6912 | port->port_sink_caps = data->sink_cap; | 6912 | port->port_sink_caps = data->sink_cap; |
| 6913 | typec_port_set_usb_power_delivery(p, NULL); | ||
| 6913 | port->selected_pd = pd; | 6914 | port->selected_pd = pd; |
| 6915 | typec_port_set_usb_power_delivery(p, port->selected_pd); | ||
| 6914 | unlock: | 6916 | unlock: |
| 6915 | mutex_unlock(&port->lock); | 6917 | mutex_unlock(&port->lock); |
| 6916 | return ret; | 6918 | return ret; |
| @@ -6943,9 +6945,7 @@ static void tcpm_port_unregister_pd(struct tcpm_port *port) · 26 unmodified lines | |||
| 6943 | port->port_source_caps = NULL; | 6945 | port->port_source_caps = NULL; |
| 6944 | for (i = 0; i < port->pd_count; i++) { | 6946 | for (i = 0; i < port->pd_count; i++) { |
| 6945 | usb_power_delivery_unregister_capabilities(port->pd_list[i]->sink_cap); | 6947 | usb_power_delivery_unregister_capabilities(port->pd_list[i]->sink_cap); |
| 6946 | kfree(port->pd_list[i]->sink_cap); | ||
| 6947 | usb_power_delivery_unregister_capabilities(port->pd_list[i]->source_cap); | 6948 | usb_power_delivery_unregister_capabilities(port->pd_list[i]->source_cap); |
| 6948 | kfree(port->pd_list[i]->source_cap); | ||
| 6949 | devm_kfree(port->dev, port->pd_list[i]); | 6949 | devm_kfree(port->dev, port->pd_list[i]); |
| 6950 | port->pd_list[i] = NULL; | 6950 | port->pd_list[i] = NULL; |
| 6951 | usb_power_delivery_unregister(port->pds[i]); | 6951 | usb_power_delivery_unregister(port->pds[i]); |
| @@ -151,8 +151,12 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) · 150 unmodified lines | |||
| 151 | if (!(cci & UCSI_CCI_COMMAND_COMPLETE)) | 151 | if (!(cci & UCSI_CCI_COMMAND_COMPLETE)) |
| 152 | return -EIO; | 152 | return -EIO; |
| 153 | 153 | ||
| 154 | if (cci & UCSI_CCI_NOT_SUPPORTED) | 154 | if (cci & UCSI_CCI_NOT_SUPPORTED) { |
| 155 | if (ucsi_acknowledge_command(ucsi) < 0) | ||
| 156 | dev_err(ucsi->dev, | ||
| 157 | "ACK of unsupported command failed\n"); | ||
| 155 | return -EOPNOTSUPP; | 158 | return -EOPNOTSUPP; |
| 159 | } | ||
| 156 | 160 | ||
| 157 | if (cci & UCSI_CCI_ERROR) { | 161 | if (cci & UCSI_CCI_ERROR) { |
| 158 | if (cmd == UCSI_GET_ERROR_STATUS) | 162 | if (cmd == UCSI_GET_ERROR_STATUS) |
| @@ -1133,17 +1137,21 @@ static int ucsi_check_cable(struct ucsi_connector *con) · 974 unmodified lines | |||
| 1133 | if (ret < 0) | 1137 | if (ret < 0) |
| 1134 | return ret; | 1138 | return ret; |
| 1135 | 1139 | ||
| 1136 | ret = ucsi_get_cable_identity(con); | 1140 | if (con->ucsi->cap.features & UCSI_CAP_GET_PD_MESSAGE) { |
| 1137 | if (ret < 0) | 1141 | ret = ucsi_get_cable_identity(con); |
| 1138 | return ret; | 1142 | if (ret < 0) |
| 1143 | return ret; | ||
| 1144 | } | ||
| 1139 | 1145 | ||
| 1140 | ret = ucsi_register_plug(con); | 1146 | if (con->ucsi->cap.features & UCSI_CAP_ALT_MODE_DETAILS) { |
| 1141 | if (ret < 0) | 1147 | ret = ucsi_register_plug(con); |
| 1142 | return ret; | 1148 | if (ret < 0) |
| 1149 | return ret; | ||
| 1143 | 1150 | ||
| 1144 | ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_SOP_P); | 1151 | ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_SOP_P); |
| 1145 | if (ret < 0) | 1152 | if (ret < 0) |
| 1146 | return ret; | 1153 | return ret; |
| 1154 | } | ||
| 1147 | 1155 | ||
| 1148 | return 0; | 1156 | return 0; |
| 1149 | } | 1157 | } |
| @@ -1189,8 +1197,10 @@ static void ucsi_handle_connector_change(struct work_struct *work) · 39 unmodified lines | |||
| 1189 | ucsi_register_partner(con); | 1197 | ucsi_register_partner(con); |
| 1190 | ucsi_partner_task(con, ucsi_check_connection, 1, HZ); | 1198 | ucsi_partner_task(con, ucsi_check_connection, 1, HZ); |
| 1191 | ucsi_partner_task(con, ucsi_check_connector_capability, 1, HZ); | 1199 | ucsi_partner_task(con, ucsi_check_connector_capability, 1, HZ); |
| 1192 | ucsi_partner_task(con, ucsi_get_partner_identity, 1, HZ); | 1200 | if (con->ucsi->cap.features & UCSI_CAP_GET_PD_MESSAGE) |
| 1193 | ucsi_partner_task(con, ucsi_check_cable, 1, HZ); | 1201 | ucsi_partner_task(con, ucsi_get_partner_identity, 1, HZ); |
| 1202 | if (con->ucsi->cap.features & UCSI_CAP_CABLE_DETAILS) | ||
| 1203 | ucsi_partner_task(con, ucsi_check_cable, 1, HZ); | ||
| 1194 | 1204 | ||
| 1195 | if (UCSI_CONSTAT_PWR_OPMODE(con->status.flags) == | 1205 | if (UCSI_CONSTAT_PWR_OPMODE(con->status.flags) == |
| 1196 | UCSI_CONSTAT_PWR_OPMODE_PD) | 1206 | UCSI_CONSTAT_PWR_OPMODE_PD) |
| @@ -1215,11 +1225,11 @@ static void ucsi_handle_connector_change(struct work_struct *work) · 18 unmodified lines | |||
| 1215 | if (con->status.change & UCSI_CONSTAT_CAM_CHANGE) | 1225 | if (con->status.change & UCSI_CONSTAT_CAM_CHANGE) |
| 1216 | ucsi_partner_task(con, ucsi_check_altmodes, 1, 0); | 1226 | ucsi_partner_task(con, ucsi_check_altmodes, 1, 0); |
| 1217 | 1227 | ||
| 1218 | clear_bit(EVENT_PENDING, &con->ucsi->flags); | ||
| 1219 | |||
| 1220 | mutex_lock(&ucsi->ppm_lock); | 1228 | mutex_lock(&ucsi->ppm_lock); |
| 1229 | clear_bit(EVENT_PENDING, &con->ucsi->flags); | ||
| 1221 | ret = ucsi_acknowledge_connector_change(ucsi); | 1230 | ret = ucsi_acknowledge_connector_change(ucsi); |
| 1222 | mutex_unlock(&ucsi->ppm_lock); | 1231 | mutex_unlock(&ucsi->ppm_lock); |
| 1232 | |||
| 1223 | if (ret) | 1233 | if (ret) |
| 1224 | dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret); | 1234 | dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret); |
| 1225 | 1235 | ||
| @@ -1237,7 +1247,7 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num) · 11 unmodified lines | |||
| 1237 | struct ucsi_connector *con = &ucsi->connector[num - 1]; | 1247 | struct ucsi_connector *con = &ucsi->connector[num - 1]; |
| 1238 | 1248 | ||
| 1239 | if (!(ucsi->ntfy & UCSI_ENABLE_NTFY_CONNECTOR_CHANGE)) { | 1249 | if (!(ucsi->ntfy & UCSI_ENABLE_NTFY_CONNECTOR_CHANGE)) { |
| 1240 | dev_dbg(ucsi->dev, "Bogus connector change event\n"); | 1250 | dev_dbg(ucsi->dev, "Early connector change event\n"); |
| 1241 | return; | 1251 | return; |
| 1242 | } | 1252 | } |
| 1243 | 1253 | ||
| @@ -1260,13 +1270,47 @@ static int ucsi_reset_connector(struct ucsi_connector *con, bool hard) · 16 unmodified lines | |||
| 1260 | 1270 | ||
| 1261 | static int ucsi_reset_ppm(struct ucsi *ucsi) | 1271 | static int ucsi_reset_ppm(struct ucsi *ucsi) |
| 1262 | { | 1272 | { |
| 1263 | u64 command = UCSI_PPM_RESET; | 1273 | u64 command; |
| 1264 | unsigned long tmo; | 1274 | unsigned long tmo; |
| 1265 | u32 cci; | 1275 | u32 cci; |
| 1266 | int ret; | 1276 | int ret; |
| 1267 | 1277 | ||
| 1268 | mutex_lock(&ucsi->ppm_lock); | 1278 | mutex_lock(&ucsi->ppm_lock); |
| 1269 | 1279 | ||
| 1280 | ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); | ||
| 1281 | if (ret < 0) | ||
| 1282 | goto out; | ||
| 1283 | |||
| 1284 | /* | ||
| 1285 | * If UCSI_CCI_RESET_COMPLETE is already set we must clear | ||
| 1286 | * the flag before we start another reset. Send a | ||
| 1287 | * UCSI_SET_NOTIFICATION_ENABLE command to achieve this. | ||
| 1288 | * Ignore a timeout and try the reset anyway if this fails. | ||
| 1289 | */ | ||
| 1290 | if (cci & UCSI_CCI_RESET_COMPLETE) { | ||
| 1291 | command = UCSI_SET_NOTIFICATION_ENABLE; | ||
| 1292 | ret = ucsi->ops->async_write(ucsi, UCSI_CONTROL, &command, | ||
| 1293 | sizeof(command)); | ||
| 1294 | if (ret < 0) | ||
| 1295 | goto out; | ||
| 1296 | |||
| 1297 | tmo = jiffies + msecs_to_jiffies(UCSI_TIMEOUT_MS); | ||
| 1298 | do { | ||
| 1299 | ret = ucsi->ops->read(ucsi, UCSI_CCI, | ||
| 1300 | &cci, sizeof(cci)); | ||
| 1301 | if (ret < 0) | ||
| 1302 | goto out; | ||
| 1303 | if (cci & UCSI_CCI_COMMAND_COMPLETE) | ||
| 1304 | break; | ||
| 1305 | if (time_is_before_jiffies(tmo)) | ||
| 1306 | break; | ||
| 1307 | msleep(20); | ||
| 1308 | } while (1); | ||
| 1309 | |||
| 1310 | WARN_ON(cci & UCSI_CCI_RESET_COMPLETE); | ||
| 1311 | } | ||
| 1312 | |||
| 1313 | command = UCSI_PPM_RESET; | ||
| 1270 | ret = ucsi->ops->async_write(ucsi, UCSI_CONTROL, &command, | 1314 | ret = ucsi->ops->async_write(ucsi, UCSI_CONTROL, &command, |
| 1271 | sizeof(command)); | 1315 | sizeof(command)); |
| 1272 | if (ret < 0) | 1316 | if (ret < 0) |
| @@ -1589,8 +1633,10 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con) · 316 unmodified lines | |||
| 1589 | ucsi_register_partner(con); | 1633 | ucsi_register_partner(con); |
| 1590 | ucsi_pwr_opmode_change(con); | 1634 | ucsi_pwr_opmode_change(con); |
| 1591 | ucsi_port_psy_changed(con); | 1635 | ucsi_port_psy_changed(con); |
| 1592 | ucsi_get_partner_identity(con); | 1636 | if (con->ucsi->cap.features & UCSI_CAP_GET_PD_MESSAGE) |
| 1593 | ucsi_check_cable(con); | 1637 | ucsi_get_partner_identity(con); |
| 1638 | if (con->ucsi->cap.features & UCSI_CAP_CABLE_DETAILS) | ||
| 1639 | ucsi_check_cable(con); | ||
| 1594 | } | 1640 | } |
| 1595 | 1641 | ||
| 1596 | /* Only notify USB controller if partner supports USB data */ | 1642 | /* Only notify USB controller if partner supports USB data */ |
| @@ -1636,6 +1682,7 @@ static int ucsi_init(struct ucsi *ucsi) · 39 unmodified lines | |||
| 1636 | { | 1682 | { |
| 1637 | struct ucsi_connector *con, *connector; | 1683 | struct ucsi_connector *con, *connector; |
| 1638 | u64 command, ntfy; | 1684 | u64 command, ntfy; |
| 1685 | u32 cci; | ||
| 1639 | int ret; | 1686 | int ret; |
| 1640 | int i; | 1687 | int i; |
| 1641 | 1688 | ||
| @@ -1688,6 +1735,13 @@ static int ucsi_init(struct ucsi *ucsi) · 46 unmodified lines | |||
| 1688 | 1735 | ||
| 1689 | ucsi->connector = connector; | 1736 | ucsi->connector = connector; |
| 1690 | ucsi->ntfy = ntfy; | 1737 | ucsi->ntfy = ntfy; |
| 1738 | |||
| 1739 | ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); | ||
| 1740 | if (ret) | ||
| 1741 | return ret; | ||
| 1742 | if (UCSI_CCI_CONNECTOR(READ_ONCE(cci))) | ||
| 1743 | ucsi_connector_change(ucsi, cci); | ||
| 1744 | |||
| 1691 | return 0; | 1745 | return 0; |
| 1692 | 1746 | ||
| 1693 | err_unregister: | 1747 | err_unregister: |
| @@ -206,7 +206,7 @@ struct ucsi_capability { · 205 unmodified lines | |||
| 206 | #define UCSI_CAP_ATTR_POWER_OTHER BIT(10) | 206 | #define UCSI_CAP_ATTR_POWER_OTHER BIT(10) |
| 207 | #define UCSI_CAP_ATTR_POWER_VBUS BIT(14) | 207 | #define UCSI_CAP_ATTR_POWER_VBUS BIT(14) |
| 208 | u8 num_connectors; | 208 | u8 num_connectors; |
| 209 | u8 features; | 209 | u16 features; |
| 210 | #define UCSI_CAP_SET_UOM BIT(0) | 210 | #define UCSI_CAP_SET_UOM BIT(0) |
| 211 | #define UCSI_CAP_SET_PDM BIT(1) | 211 | #define UCSI_CAP_SET_PDM BIT(1) |
| 212 | #define UCSI_CAP_ALT_MODE_DETAILS BIT(2) | 212 | #define UCSI_CAP_ALT_MODE_DETAILS BIT(2) |
| @@ -215,7 +215,8 @@ struct ucsi_capability { · 2 unmodified lines | |||
| 215 | #define UCSI_CAP_CABLE_DETAILS BIT(5) | 215 | #define UCSI_CAP_CABLE_DETAILS BIT(5) |
| 216 | #define UCSI_CAP_EXT_SUPPLY_NOTIFICATIONS BIT(6) | 216 | #define UCSI_CAP_EXT_SUPPLY_NOTIFICATIONS BIT(6) |
| 217 | #define UCSI_CAP_PD_RESET BIT(7) | 217 | #define UCSI_CAP_PD_RESET BIT(7) |
| 218 | u16 reserved_1; | 218 | #define UCSI_CAP_GET_PD_MESSAGE BIT(8) |
| 219 | u8 reserved_1; | ||
| 219 | u8 num_alt_modes; | 220 | u8 num_alt_modes; |
| 220 | u8 reserved_2; | 221 | u8 reserved_2; |
| 221 | u16 bc_version; | 222 | u16 bc_version; |
| @@ -23,10 +23,11 @@ struct ucsi_acpi { · 22 unmodified lines | |||
| 23 | void *base; | 23 | void *base; |
| 24 | struct completion complete; | 24 | struct completion complete; |
| 25 | unsigned long flags; | 25 | unsigned long flags; |
| 26 | #define UCSI_ACPI_SUPPRESS_EVENT 0 | ||
| 27 | #define UCSI_ACPI_COMMAND_PENDING 1 | ||
| 28 | #define UCSI_ACPI_ACK_PENDING 2 | ||
| 26 | guid_t guid; | 29 | guid_t guid; |
| 27 | u64 cmd; | 30 | u64 cmd; |
| 28 | bool dell_quirk_probed; | ||
| 29 | bool dell_quirk_active; | ||
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | static int ucsi_acpi_dsm(struct ucsi_acpi *ua, int func) | 33 | static int ucsi_acpi_dsm(struct ucsi_acpi *ua, int func) |
| @@ -79,9 +80,9 @@ static int ucsi_acpi_sync_write(struct ucsi *ucsi, unsigned int offset, · 46 unmodified lines | |||
| 79 | int ret; | 80 | int ret; |
| 80 | 81 | ||
| 81 | if (ack) | 82 | if (ack) |
| 82 | set_bit(ACK_PENDING, &ua->flags); | 83 | set_bit(UCSI_ACPI_ACK_PENDING, &ua->flags); |
| 83 | else | 84 | else |
| 84 | set_bit(COMMAND_PENDING, &ua->flags); | 85 | set_bit(UCSI_ACPI_COMMAND_PENDING, &ua->flags); |
| 85 | 86 | ||
| 86 | ret = ucsi_acpi_async_write(ucsi, offset, val, val_len); | 87 | ret = ucsi_acpi_async_write(ucsi, offset, val, val_len); |
| 87 | if (ret) | 88 | if (ret) |
| @@ -92,9 +93,9 @@ static int ucsi_acpi_sync_write(struct ucsi *ucsi, unsigned int offset, · 4 unmodified lines | |||
| 92 | 93 | ||
| 93 | out_clear_bit: | 94 | out_clear_bit: |
| 94 | if (ack) | 95 | if (ack) |
| 95 | clear_bit(ACK_PENDING, &ua->flags); | 96 | clear_bit(UCSI_ACPI_ACK_PENDING, &ua->flags); |
| 96 | else | 97 | else |
| 97 | clear_bit(COMMAND_PENDING, &ua->flags); | 98 | clear_bit(UCSI_ACPI_COMMAND_PENDING, &ua->flags); |
| 98 | 99 | ||
| 99 | return ret; | 100 | return ret; |
| 100 | } | 101 | } |
| @@ -129,51 +130,40 @@ static const struct ucsi_operations ucsi_zenbook_ops = { · 28 unmodified lines | |||
| 129 | }; | 130 | }; |
| 130 | 131 | ||
| 131 | /* | 132 | /* |
| 132 | * Some Dell laptops expect that an ACK command with the | 133 | * Some Dell laptops don't like ACK commands with the |
| 133 | * UCSI_ACK_CONNECTOR_CHANGE bit set is followed by a (separate) | 134 | * UCSI_ACK_CONNECTOR_CHANGE but not the UCSI_ACK_COMMAND_COMPLETE |
| 134 | * ACK command that only has the UCSI_ACK_COMMAND_COMPLETE bit set. | 135 | * bit set. To work around this send a dummy command and bundle the |
| 135 | * If this is not done events are not delivered to OSPM and | 136 | * UCSI_ACK_CONNECTOR_CHANGE with the UCSI_ACK_COMMAND_COMPLETE |
| 136 | * subsequent commands will timeout. | 137 | * for the dummy command. |
| 137 | */ | 138 | */ |
| 138 | static int | 139 | static int |
| 139 | ucsi_dell_sync_write(struct ucsi *ucsi, unsigned int offset, | 140 | ucsi_dell_sync_write(struct ucsi *ucsi, unsigned int offset, |
| 140 | const void *val, size_t val_len) | 141 | const void *val, size_t val_len) |
| 141 | { | 142 | { |
| 142 | struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); | 143 | struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); |
| 143 | u64 cmd = *(u64 *)val, ack = 0; | 144 | u64 cmd = *(u64 *)val; |
| 145 | u64 dummycmd = UCSI_GET_CAPABILITY; | ||
| 144 | int ret; | 146 | int ret; |
| 145 | 147 | ||
| 146 | if (UCSI_COMMAND(cmd) == UCSI_ACK_CC_CI && | 148 | if (cmd == (UCSI_ACK_CC_CI | UCSI_ACK_CONNECTOR_CHANGE)) { |
| 147 | cmd & UCSI_ACK_CONNECTOR_CHANGE) | 149 | cmd |= UCSI_ACK_COMMAND_COMPLETE; |
| 148 | ack = UCSI_ACK_CC_CI | UCSI_ACK_COMMAND_COMPLETE; | 150 | |
| 149 | 151 | /* | |
| 150 | ret = ucsi_acpi_sync_write(ucsi, offset, val, val_len); | 152 | * The UCSI core thinks it is sending a connector change ack |
| 151 | if (ret != 0) | 153 | * and will accept new connector change events. We don't want |
| 152 | return ret; | 154 | * this to happen for the dummy command as its response will |
| 153 | if (ack == 0) | 155 | * still report the very event that the core is trying to clear. |
| 154 | return ret; | 156 | */ |
| 155 | 157 | set_bit(UCSI_ACPI_SUPPRESS_EVENT, &ua->flags); | |
| 156 | if (!ua->dell_quirk_probed) { | 158 | ret = ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, &dummycmd, |
| 157 | ua->dell_quirk_probed = true; | 159 | sizeof(dummycmd)); |
| 158 | 160 | clear_bit(UCSI_ACPI_SUPPRESS_EVENT, &ua->flags); | |
| 159 | cmd = UCSI_GET_CAPABILITY; | 161 | |
| 160 | ret = ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, &cmd, | 162 | if (ret < 0) |
| 161 | sizeof(cmd)); | ||
| 162 | if (ret == 0) | ||
| 163 | return ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, | ||
| 164 | &ack, sizeof(ack)); | ||
| 165 | if (ret != -ETIMEDOUT) | ||
| 166 | return ret; | 163 | return ret; |
| 167 | |||
| 168 | ua->dell_quirk_active = true; | ||
| 169 | dev_err(ua->dev, "Firmware bug: Additional ACK required after ACKing a connector change.\n"); | ||
| 170 | dev_err(ua->dev, "Firmware bug: Enabling workaround\n"); | ||
| 171 | } | 164 | } |
| 172 | 165 | ||
| 173 | if (!ua->dell_quirk_active) | 166 | return ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, &cmd, sizeof(cmd)); |
| 174 | return ret; | ||
| 175 | |||
| 176 | return ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, &ack, sizeof(ack)); | ||
| 177 | } | 167 | } |
| 178 | 168 | ||
| 179 | static const struct ucsi_operations ucsi_dell_ops = { | 169 | static const struct ucsi_operations ucsi_dell_ops = { |
| @@ -209,13 +199,14 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data) · 29 unmodified lines | |||
| 209 | if (ret) | 199 | if (ret) |
| 210 | return; | 200 | return; |
| 211 | 201 | ||
| 212 | if (UCSI_CCI_CONNECTOR(cci)) | 202 | if (UCSI_CCI_CONNECTOR(cci) && |
| 203 | !test_bit(UCSI_ACPI_SUPPRESS_EVENT, &ua->flags)) | ||
| 213 | ucsi_connector_change(ua->ucsi, UCSI_CCI_CONNECTOR(cci)); | 204 | ucsi_connector_change(ua->ucsi, UCSI_CCI_CONNECTOR(cci)); |
| 214 | 205 | ||
| 215 | if (cci & UCSI_CCI_ACK_COMPLETE && test_bit(ACK_PENDING, &ua->flags)) | 206 | if (cci & UCSI_CCI_ACK_COMPLETE && test_bit(ACK_PENDING, &ua->flags)) |
| 216 | complete(&ua->complete); | 207 | complete(&ua->complete); |
| 217 | if (cci & UCSI_CCI_COMMAND_COMPLETE && | 208 | if (cci & UCSI_CCI_COMMAND_COMPLETE && |
| 218 | test_bit(COMMAND_PENDING, &ua->flags)) | 209 | test_bit(UCSI_ACPI_COMMAND_PENDING, &ua->flags)) |
| 219 | complete(&ua->complete); | 210 | complete(&ua->complete); |
| 220 | } | 211 | } |
| 221 | 212 | ||
| @@ -255,6 +255,20 @@ static void pmic_glink_ucsi_notify(struct work_struct *work) · 254 unmodified lines | |||
| 255 | static void pmic_glink_ucsi_register(struct work_struct *work) | 255 | static void pmic_glink_ucsi_register(struct work_struct *work) |
| 256 | { | 256 | { |
| 257 | struct pmic_glink_ucsi *ucsi = container_of(work, struct pmic_glink_ucsi, register_work); | 257 | struct pmic_glink_ucsi *ucsi = container_of(work, struct pmic_glink_ucsi, register_work); |
| 258 | int orientation; | ||
| 259 | int i; | ||
| 260 | |||
| 261 | for (i = 0; i < PMIC_GLINK_MAX_PORTS; i++) { | ||
| 262 | if (!ucsi->port_orientation[i]) | ||
| 263 | continue; | ||
| 264 | orientation = gpiod_get_value(ucsi->port_orientation[i]); | ||
| 265 | |||
| 266 | if (orientation >= 0) { | ||
| 267 | typec_switch_set(ucsi->port_switch[i], | ||
| 268 | orientation ? TYPEC_ORIENTATION_REVERSE | ||
| 269 | : TYPEC_ORIENTATION_NORMAL); | ||
| 270 | } | ||
| 271 | } | ||
| 258 | 272 | ||
| 259 | ucsi_register(ucsi->ucsi); | 273 | ucsi_register(ucsi->ucsi); |
| 260 | } | 274 | } |
| @@ -494,6 +494,7 @@ config FB_SBUS_HELPERS · 493 unmodified lines | |||
| 494 | select FB_CFB_COPYAREA | 494 | select FB_CFB_COPYAREA |
| 495 | select FB_CFB_FILLRECT | 495 | select FB_CFB_FILLRECT |
| 496 | select FB_CFB_IMAGEBLIT | 496 | select FB_CFB_IMAGEBLIT |
| 497 | select FB_IOMEM_FOPS | ||
| 497 | 498 | ||
| 498 | config FB_BW2 | 499 | config FB_BW2 |
| 499 | bool "BWtwo support" | 500 | bool "BWtwo support" |
| @@ -514,6 +515,7 @@ config FB_CG6 · 14 unmodified lines | |||
| 514 | depends on (FB = y) && (SPARC && FB_SBUS) | 515 | depends on (FB = y) && (SPARC && FB_SBUS) |
| 515 | select FB_CFB_COPYAREA | 516 | select FB_CFB_COPYAREA |
| 516 | select FB_CFB_IMAGEBLIT | 517 | select FB_CFB_IMAGEBLIT |
| 518 | select FB_IOMEM_FOPS | ||
| 517 | help | 519 | help |
| 518 | This is the frame buffer device driver for the CGsix (GX, TurboGX) | 520 | This is the frame buffer device driver for the CGsix (GX, TurboGX) |
| 519 | frame buffer. | 521 | frame buffer. |
| @@ -523,6 +525,7 @@ config FB_FFB · 3 unmodified lines | |||
| 523 | depends on FB_SBUS && SPARC64 | 525 | depends on FB_SBUS && SPARC64 |
| 524 | select FB_CFB_COPYAREA | 526 | select FB_CFB_COPYAREA |
| 525 | select FB_CFB_IMAGEBLIT | 527 | select FB_CFB_IMAGEBLIT |
| 528 | select FB_IOMEM_FOPS | ||
| 526 | help | 529 | help |
| 527 | This is the frame buffer device driver for the Creator, Creator3D, | 530 | This is the frame buffer device driver for the Creator, Creator3D, |
| 528 | and Elite3D graphics boards. | 531 | and Elite3D graphics boards. |
| @@ -344,17 +344,21 @@ void v9fs_evict_inode(struct inode *inode) · 343 unmodified lines | |||
| 344 | struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode); | 344 | struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode); |
| 345 | __le32 __maybe_unused version; | 345 | __le32 __maybe_unused version; |
| 346 | 346 | ||
| 347 | truncate_inode_pages_final(&inode->i_data); | 347 | if (!is_bad_inode(inode)) { |
| 348 | truncate_inode_pages_final(&inode->i_data); | ||
| 348 | 349 | ||
| 349 | version = cpu_to_le32(v9inode->qid.version); | 350 | version = cpu_to_le32(v9inode->qid.version); |
| 350 | netfs_clear_inode_writeback(inode, &version); | 351 | netfs_clear_inode_writeback(inode, &version); |
| 351 | 352 | ||
| 352 | clear_inode(inode); | 353 | clear_inode(inode); |
| 353 | filemap_fdatawrite(&inode->i_data); | 354 | filemap_fdatawrite(&inode->i_data); |
| 354 | 355 | ||
| 355 | #ifdef CONFIG_9P_FSCACHE | 356 | #ifdef CONFIG_9P_FSCACHE |
| 356 | fscache_relinquish_cookie(v9fs_inode_cookie(v9inode), false); | 357 | if (v9fs_inode_cookie(v9inode)) |
| 358 | fscache_relinquish_cookie(v9fs_inode_cookie(v9inode), false); | ||
| 357 | #endif | 359 | #endif |
| 360 | } else | ||
| 361 | clear_inode(inode); | ||
| 358 | } | 362 | } |
| 359 | 363 | ||
| 360 | struct inode *v9fs_fid_iget(struct super_block *sb, struct p9_fid *fid) | 364 | struct inode *v9fs_fid_iget(struct super_block *sb, struct p9_fid *fid) |
| @@ -78,11 +78,11 @@ struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid) · 77 unmodified lines | |||
| 78 | 78 | ||
| 79 | retval = v9fs_init_inode(v9ses, inode, &fid->qid, | 79 | retval = v9fs_init_inode(v9ses, inode, &fid->qid, |
| 80 | st->st_mode, new_decode_dev(st->st_rdev)); | 80 | st->st_mode, new_decode_dev(st->st_rdev)); |
| 81 | v9fs_stat2inode_dotl(st, inode, 0); | ||
| 81 | kfree(st); | 82 | kfree(st); |
| 82 | if (retval) | 83 | if (retval) |
| 83 | goto error; | 84 | goto error; |
| 84 | 85 | ||
| 85 | v9fs_stat2inode_dotl(st, inode, 0); | ||
| 86 | v9fs_set_netfs_context(inode); | 86 | v9fs_set_netfs_context(inode); |
| 87 | v9fs_cache_inode_get_cookie(inode); | 87 | v9fs_cache_inode_get_cookie(inode); |
| 88 | retval = v9fs_get_acl(inode, fid); | 88 | retval = v9fs_get_acl(inode, fid); |
| @@ -297,7 +297,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, · 208 unmodified lines | |||
| 297 | umode_t omode) | 297 | umode_t omode) |
| 298 | { | 298 | { |
| 299 | int err; | 299 | int err; |
| 300 | struct v9fs_session_info *v9ses; | ||
| 301 | struct p9_fid *fid = NULL, *dfid = NULL; | 300 | struct p9_fid *fid = NULL, *dfid = NULL; |
| 302 | kgid_t gid; | 301 | kgid_t gid; |
| 303 | const unsigned char *name; | 302 | const unsigned char *name; |
| @@ -307,7 +306,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, · 3 unmodified lines | |||
| 307 | struct posix_acl *dacl = NULL, *pacl = NULL; | 306 | struct posix_acl *dacl = NULL, *pacl = NULL; |
| 308 | 307 | ||
| 309 | p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); | 308 | p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); |
| 310 | v9ses = v9fs_inode2v9ses(dir); | ||
| 311 | 309 | ||
| 312 | omode |= S_IFDIR; | 310 | omode |= S_IFDIR; |
| 313 | if (dir->i_mode & S_ISGID) | 311 | if (dir->i_mode & S_ISGID) |
| @@ -739,7 +737,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir, · 425 unmodified lines | |||
| 739 | kgid_t gid; | 737 | kgid_t gid; |
| 740 | const unsigned char *name; | 738 | const unsigned char *name; |
| 741 | umode_t mode; | 739 | umode_t mode; |
| 742 | struct v9fs_session_info *v9ses; | ||
| 743 | struct p9_fid *fid = NULL, *dfid = NULL; | 740 | struct p9_fid *fid = NULL, *dfid = NULL; |
| 744 | struct inode *inode; | 741 | struct inode *inode; |
| 745 | struct p9_qid qid; | 742 | struct p9_qid qid; |
| @@ -749,7 +746,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir, · 3 unmodified lines | |||
| 749 | dir->i_ino, dentry, omode, | 746 | dir->i_ino, dentry, omode, |
| 750 | MAJOR(rdev), MINOR(rdev)); | 747 | MAJOR(rdev), MINOR(rdev)); |
| 751 | 748 | ||
| 752 | v9ses = v9fs_inode2v9ses(dir); | ||
| 753 | dfid = v9fs_parent_fid(dentry); | 749 | dfid = v9fs_parent_fid(dentry); |
| 754 | if (IS_ERR(dfid)) { | 750 | if (IS_ERR(dfid)) { |
| 755 | err = PTR_ERR(dfid); | 751 | err = PTR_ERR(dfid); |
| @@ -1359,7 +1359,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, · 1358 unmodified lines | |||
| 1359 | SET_UID(psinfo->pr_uid, from_kuid_munged(cred->user_ns, cred->uid)); | 1359 | SET_UID(psinfo->pr_uid, from_kuid_munged(cred->user_ns, cred->uid)); |
| 1360 | SET_GID(psinfo->pr_gid, from_kgid_munged(cred->user_ns, cred->gid)); | 1360 | SET_GID(psinfo->pr_gid, from_kgid_munged(cred->user_ns, cred->gid)); |
| 1361 | rcu_read_unlock(); | 1361 | rcu_read_unlock(); |
| 1362 | strncpy(psinfo->pr_fname, p->comm, sizeof(psinfo->pr_fname)); | 1362 | get_task_comm(psinfo->pr_fname, p); |
| 1363 | 1363 | ||
| 1364 | return 0; | 1364 | return 0; |
| 1365 | } | 1365 | } |
| @@ -1559,7 +1559,8 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) · 1558 unmodified lines | |||
| 1559 | * needing to allocate extents from the block group. | 1559 | * needing to allocate extents from the block group. |
| 1560 | */ | 1560 | */ |
| 1561 | used = btrfs_space_info_used(space_info, true); | 1561 | used = btrfs_space_info_used(space_info, true); |
| 1562 | if (space_info->total_bytes - block_group->length < used) { | 1562 | if (space_info->total_bytes - block_group->length < used && |
| 1563 | block_group->zone_unusable < block_group->length) { | ||
| 1563 | /* | 1564 | /* |
| 1564 | * Add a reference for the list, compensate for the ref | 1565 | * Add a reference for the list, compensate for the ref |
| 1565 | * drop under the "next" label for the | 1566 | * drop under the "next" label for the |
| @@ -4333,6 +4333,19 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num, · 4332 unmodified lines | |||
| 4333 | if (test_and_set_bit(EXTENT_BUFFER_READING, &eb->bflags)) | 4333 | if (test_and_set_bit(EXTENT_BUFFER_READING, &eb->bflags)) |
| 4334 | goto done; | 4334 | goto done; |
| 4335 | 4335 | ||
| 4336 | /* | ||
| 4337 | * Between the initial test_bit(EXTENT_BUFFER_UPTODATE) and the above | ||
| 4338 | * test_and_set_bit(EXTENT_BUFFER_READING), someone else could have | ||
| 4339 | * started and finished reading the same eb. In this case, UPTODATE | ||
| 4340 | * will now be set, and we shouldn't read it in again. | ||
| 4341 | */ | ||
| 4342 | if (unlikely(test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))) { | ||
| 4343 | clear_bit(EXTENT_BUFFER_READING, &eb->bflags); | ||
| 4344 | smp_mb__after_atomic(); | ||
| 4345 | wake_up_bit(&eb->bflags, EXTENT_BUFFER_READING); | ||
| 4346 | return 0; | ||
| 4347 | } | ||
| 4348 | |||
| 4336 | clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags); | 4349 | clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags); |
| 4337 | eb->read_mirror = 0; | 4350 | eb->read_mirror = 0; |
| 4338 | check_buffer_tree_ref(eb); | 4351 | check_buffer_tree_ref(eb); |
| @@ -309,7 +309,7 @@ int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen) · 308 unmodified lines | |||
| 309 | btrfs_warn(fs_info, | 309 | btrfs_warn(fs_info, |
| 310 | "no extent map found for inode %llu (root %lld) when unpinning extent range [%llu, %llu), generation %llu", | 310 | "no extent map found for inode %llu (root %lld) when unpinning extent range [%llu, %llu), generation %llu", |
| 311 | btrfs_ino(inode), btrfs_root_id(inode->root), | 311 | btrfs_ino(inode), btrfs_root_id(inode->root), |
| 312 | start, len, gen); | 312 | start, start + len, gen); |
| 313 | ret = -ENOENT; | 313 | ret = -ENOENT; |
| 314 | goto out; | 314 | goto out; |
| 315 | } | 315 | } |
| @@ -318,7 +318,7 @@ int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen) · 2 unmodified lines | |||
| 318 | btrfs_warn(fs_info, | 318 | btrfs_warn(fs_info, |
| 319 | "found extent map for inode %llu (root %lld) with unexpected start offset %llu when unpinning extent range [%llu, %llu), generation %llu", | 319 | "found extent map for inode %llu (root %lld) with unexpected start offset %llu when unpinning extent range [%llu, %llu), generation %llu", |
| 320 | btrfs_ino(inode), btrfs_root_id(inode->root), | 320 | btrfs_ino(inode), btrfs_root_id(inode->root), |
| 321 | em->start, start, len, gen); | 321 | em->start, start, start + len, gen); |
| 322 | ret = -EUCLEAN; | 322 | ret = -EUCLEAN; |
| 323 | goto out; | 323 | goto out; |
| 324 | } | 324 | } |
| @@ -340,9 +340,9 @@ int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen) · 15 unmodified lines | |||
| 340 | em->mod_len = em->len; | 340 | em->mod_len = em->len; |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | free_extent_map(em); | ||
| 344 | out: | 343 | out: |
| 345 | write_unlock(&tree->lock); | 344 | write_unlock(&tree->lock); |
| 345 | free_extent_map(em); | ||
| 346 | return ret; | 346 | return ret; |
| 347 | 347 | ||
| 348 | } | 348 | } |
| @@ -629,13 +629,13 @@ int btrfs_add_extent_mapping(struct btrfs_fs_info *fs_info, · 280 unmodified lines | |||
| 629 | */ | 629 | */ |
| 630 | ret = merge_extent_mapping(em_tree, existing, | 630 | ret = merge_extent_mapping(em_tree, existing, |
| 631 | em, start); | 631 | em, start); |
| 632 | if (ret) { | 632 | if (WARN_ON(ret)) { |
| 633 | free_extent_map(em); | 633 | free_extent_map(em); |
| 634 | *em_in = NULL; | 634 | *em_in = NULL; |
| 635 | WARN_ONCE(ret, | 635 | btrfs_warn(fs_info, |
| 636 | "extent map merge error existing [%llu, %llu) with em [%llu, %llu) start %llu\n", | 636 | "extent map merge error existing [%llu, %llu) with em [%llu, %llu) start %llu", |
| 637 | existing->start, existing->len, | 637 | existing->start, extent_map_end(existing), |
| 638 | orig_start, orig_len, start); | 638 | orig_start, orig_start + orig_len, start); |
| 639 | } | 639 | } |
| 640 | free_extent_map(existing); | 640 | free_extent_map(existing); |
| 641 | } | 641 | } |
| @@ -2812,7 +2812,17 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, · 2811 unmodified lines | |||
| 2812 | gen = btrfs_get_last_trans_committed(fs_info); | 2812 | gen = btrfs_get_last_trans_committed(fs_info); |
| 2813 | 2813 | ||
| 2814 | for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { | 2814 | for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { |
| 2815 | bytenr = btrfs_sb_offset(i); | 2815 | ret = btrfs_sb_log_location(scrub_dev, i, 0, &bytenr); |
| 2816 | if (ret == -ENOENT) | ||
| 2817 | break; | ||
| 2818 | |||
| 2819 | if (ret) { | ||
| 2820 | spin_lock(&sctx->stat_lock); | ||
| 2821 | sctx->stat.super_errors++; | ||
| 2822 | spin_unlock(&sctx->stat_lock); | ||
| 2823 | continue; | ||
| 2824 | } | ||
| 2825 | |||
| 2816 | if (bytenr + BTRFS_SUPER_INFO_SIZE > | 2826 | if (bytenr + BTRFS_SUPER_INFO_SIZE > |
| 2817 | scrub_dev->commit_total_bytes) | 2827 | scrub_dev->commit_total_bytes) |
| 2818 | break; | 2828 | break; |
| @@ -692,6 +692,16 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices, · 691 unmodified lines | |||
| 692 | device->bdev = file_bdev(bdev_file); | 692 | device->bdev = file_bdev(bdev_file); |
| 693 | clear_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &device->dev_state); | 693 | clear_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &device->dev_state); |
| 694 | 694 | ||
| 695 | if (device->devt != device->bdev->bd_dev) { | ||
| 696 | btrfs_warn(NULL, | ||
| 697 | "device %s maj:min changed from %d:%d to %d:%d", | ||
| 698 | device->name->str, MAJOR(device->devt), | ||
| 699 | MINOR(device->devt), MAJOR(device->bdev->bd_dev), | ||
| 700 | MINOR(device->bdev->bd_dev)); | ||
| 701 | |||
| 702 | device->devt = device->bdev->bd_dev; | ||
| 703 | } | ||
| 704 | |||
| 695 | fs_devices->open_devices++; | 705 | fs_devices->open_devices++; |
| 696 | if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state) && | 706 | if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state) && |
| 697 | device->devid != BTRFS_DEV_REPLACE_DEVID) { | 707 | device->devid != BTRFS_DEV_REPLACE_DEVID) { |
| @@ -1174,23 +1184,30 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, · 476 unmodified lines | |||
| 1174 | struct btrfs_device *device; | 1184 | struct btrfs_device *device; |
| 1175 | struct btrfs_device *latest_dev = NULL; | 1185 | struct btrfs_device *latest_dev = NULL; |
| 1176 | struct btrfs_device *tmp_device; | 1186 | struct btrfs_device *tmp_device; |
| 1187 | int ret = 0; | ||
| 1177 | 1188 | ||
| 1178 | list_for_each_entry_safe(device, tmp_device, &fs_devices->devices, | 1189 | list_for_each_entry_safe(device, tmp_device, &fs_devices->devices, |
| 1179 | dev_list) { | 1190 | dev_list) { |
| 1180 | int ret; | 1191 | int ret2; |
| 1181 | 1192 | ||
| 1182 | ret = btrfs_open_one_device(fs_devices, device, flags, holder); | 1193 | ret2 = btrfs_open_one_device(fs_devices, device, flags, holder); |
| 1183 | if (ret == 0 && | 1194 | if (ret2 == 0 && |
| 1184 | (!latest_dev || device->generation > latest_dev->generation)) { | 1195 | (!latest_dev || device->generation > latest_dev->generation)) { |
| 1185 | latest_dev = device; | 1196 | latest_dev = device; |
| 1186 | } else if (ret == -ENODATA) { | 1197 | } else if (ret2 == -ENODATA) { |
| 1187 | fs_devices->num_devices--; | 1198 | fs_devices->num_devices--; |
| 1188 | list_del(&device->dev_list); | 1199 | list_del(&device->dev_list); |
| 1189 | btrfs_free_device(device); | 1200 | btrfs_free_device(device); |
| 1190 | } | 1201 | } |
| 1202 | if (ret == 0 && ret2 != 0) | ||
| 1203 | ret = ret2; | ||
| 1191 | } | 1204 | } |
| 1192 | if (fs_devices->open_devices == 0) | 1205 | |
| 1206 | if (fs_devices->open_devices == 0) { | ||
| 1207 | if (ret) | ||
| 1208 | return ret; | ||
| 1193 | return -EINVAL; | 1209 | return -EINVAL; |
| 1210 | } | ||
| 1194 | 1211 | ||
| 1195 | fs_devices->opened = 1; | 1212 | fs_devices->opened = 1; |
| 1196 | fs_devices->latest_dev = latest_dev; | 1213 | fs_devices->latest_dev = latest_dev; |
| @@ -1574,11 +1574,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) · 1573 unmodified lines | |||
| 1574 | if (!map) | 1574 | if (!map) |
| 1575 | return -EINVAL; | 1575 | return -EINVAL; |
| 1576 | 1576 | ||
| 1577 | cache->physical_map = btrfs_clone_chunk_map(map, GFP_NOFS); | 1577 | cache->physical_map = map; |
| 1578 | if (!cache->physical_map) { | ||
| 1579 | ret = -ENOMEM; | ||
| 1580 | goto out; | ||
| 1581 | } | ||
| 1582 | 1578 | ||
| 1583 | zone_info = kcalloc(map->num_stripes, sizeof(*zone_info), GFP_NOFS); | 1579 | zone_info = kcalloc(map->num_stripes, sizeof(*zone_info), GFP_NOFS); |
| 1584 | if (!zone_info) { | 1580 | if (!zone_info) { |
| @@ -1690,7 +1686,6 @@ out: · 105 unmodified lines | |||
| 1690 | } | 1686 | } |
| 1691 | bitmap_free(active); | 1687 | bitmap_free(active); |
| 1692 | kfree(zone_info); | 1688 | kfree(zone_info); |
| 1693 | btrfs_free_chunk_map(map); | ||
| 1694 | 1689 | ||
| 1695 | return ret; | 1690 | return ret; |
| 1696 | } | 1691 | } |
| @@ -2175,6 +2170,7 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ · 478 unmodified lines | |||
| 2175 | struct btrfs_chunk_map *map; | 2170 | struct btrfs_chunk_map *map; |
| 2176 | const bool is_metadata = (block_group->flags & | 2171 | const bool is_metadata = (block_group->flags & |
| 2177 | (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)); | 2172 | (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)); |
| 2173 | struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace; | ||
| 2178 | int ret = 0; | 2174 | int ret = 0; |
| 2179 | int i; | 2175 | int i; |
| 2180 | 2176 | ||
| @@ -2250,6 +2246,7 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ · 69 unmodified lines | |||
| 2250 | btrfs_clear_data_reloc_bg(block_group); | 2246 | btrfs_clear_data_reloc_bg(block_group); |
| 2251 | spin_unlock(&block_group->lock); | 2247 | spin_unlock(&block_group->lock); |
| 2252 | 2248 | ||
| 2249 | down_read(&dev_replace->rwsem); | ||
| 2253 | map = block_group->physical_map; | 2250 | map = block_group->physical_map; |
| 2254 | for (i = 0; i < map->num_stripes; i++) { | 2251 | for (i = 0; i < map->num_stripes; i++) { |
| 2255 | struct btrfs_device *device = map->stripes[i].dev; | 2252 | struct btrfs_device *device = map->stripes[i].dev; |
| @@ -2266,13 +2263,16 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ · 10 unmodified lines | |||
| 2266 | zinfo->zone_size >> SECTOR_SHIFT); | 2263 | zinfo->zone_size >> SECTOR_SHIFT); |
| 2267 | memalloc_nofs_restore(nofs_flags); | 2264 | memalloc_nofs_restore(nofs_flags); |
| 2268 | 2265 | ||
| 2269 | if (ret) | 2266 | if (ret) { |
| 2267 | up_read(&dev_replace->rwsem); | ||
| 2270 | return ret; | 2268 | return ret; |
| 2269 | } | ||
| 2271 | 2270 | ||
| 2272 | if (!(block_group->flags & BTRFS_BLOCK_GROUP_DATA)) | 2271 | if (!(block_group->flags & BTRFS_BLOCK_GROUP_DATA)) |
| 2273 | zinfo->reserved_active_zones++; | 2272 | zinfo->reserved_active_zones++; |
| 2274 | btrfs_dev_clear_active_zone(device, physical); | 2273 | btrfs_dev_clear_active_zone(device, physical); |
| 2275 | } | 2274 | } |
| 2275 | up_read(&dev_replace->rwsem); | ||
| 2276 | 2276 | ||
| 2277 | if (!fully_written) | 2277 | if (!fully_written) |
| 2278 | btrfs_dec_block_group_ro(block_group); | 2278 | btrfs_dec_block_group_ro(block_group); |
| @@ -430,7 +430,6 @@ static bool erofs_fc_set_dax_mode(struct fs_context *fc, unsigned int mode) · 429 unmodified lines | |||
| 430 | 430 | ||
| 431 | switch (mode) { | 431 | switch (mode) { |
| 432 | case EROFS_MOUNT_DAX_ALWAYS: | 432 | case EROFS_MOUNT_DAX_ALWAYS: |
| 433 | warnfc(fc, "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); | ||
| 434 | set_opt(&ctx->opt, DAX_ALWAYS); | 433 | set_opt(&ctx->opt, DAX_ALWAYS); |
| 435 | clear_opt(&ctx->opt, DAX_NEVER); | 434 | clear_opt(&ctx->opt, DAX_NEVER); |
| 436 | return true; | 435 | return true; |
| @@ -895,6 +895,7 @@ int transfer_args_to_stack(struct linux_binprm *bprm, · 894 unmodified lines | |||
| 895 | goto out; | 895 | goto out; |
| 896 | } | 896 | } |
| 897 | 897 | ||
| 898 | bprm->exec += *sp_location - MAX_ARG_PAGES * PAGE_SIZE; | ||
| 898 | *sp_location = sp; | 899 | *sp_location = sp; |
| 899 | 900 | ||
| 900 | out: | 901 | out: |
| @@ -1718,7 +1718,8 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) · 1717 unmodified lines | |||
| 1718 | struct buffer_head *dibh, *bh; | 1718 | struct buffer_head *dibh, *bh; |
| 1719 | struct gfs2_holder rd_gh; | 1719 | struct gfs2_holder rd_gh; |
| 1720 | unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift; | 1720 | unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift; |
| 1721 | u64 lblock = (offset + (1 << bsize_shift) - 1) >> bsize_shift; | 1721 | unsigned int bsize = 1 << bsize_shift; |
| 1722 | u64 lblock = (offset + bsize - 1) >> bsize_shift; | ||
| 1722 | __u16 start_list[GFS2_MAX_META_HEIGHT]; | 1723 | __u16 start_list[GFS2_MAX_META_HEIGHT]; |
| 1723 | __u16 __end_list[GFS2_MAX_META_HEIGHT], *end_list = NULL; | 1724 | __u16 __end_list[GFS2_MAX_META_HEIGHT], *end_list = NULL; |
| 1724 | unsigned int start_aligned, end_aligned; | 1725 | unsigned int start_aligned, end_aligned; |
| @@ -1729,7 +1730,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) · 4 unmodified lines | |||
| 1729 | u64 prev_bnr = 0; | 1730 | u64 prev_bnr = 0; |
| 1730 | __be64 *start, *end; | 1731 | __be64 *start, *end; |
| 1731 | 1732 | ||
| 1732 | if (offset >= maxsize) { | 1733 | if (offset + bsize - 1 >= maxsize) { |
| 1733 | /* | 1734 | /* |
| 1734 | * The starting point lies beyond the allocated metadata; | 1735 | * The starting point lies beyond the allocated metadata; |
| 1735 | * there are no blocks to deallocate. | 1736 | * there are no blocks to deallocate. |
| @@ -3831,15 +3831,20 @@ nfsd4_create_session(struct svc_rqst *rqstp, · 3830 unmodified lines | |||
| 3831 | else | 3831 | else |
| 3832 | cs_slot = &unconf->cl_cs_slot; | 3832 | cs_slot = &unconf->cl_cs_slot; |
| 3833 | status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0); | 3833 | status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0); |
| 3834 | if (status) { | 3834 | switch (status) { |
| 3835 | if (status == nfserr_replay_cache) { | 3835 | case nfs_ok: |
| 3836 | status = nfsd4_replay_create_session(cr_ses, cs_slot); | 3836 | cs_slot->sl_seqid++; |
| 3837 | goto out_free_conn; | 3837 | cr_ses->seqid = cs_slot->sl_seqid; |
| 3838 | } | 3838 | break; |
| 3839 | case nfserr_replay_cache: | ||
| 3840 | status = nfsd4_replay_create_session(cr_ses, cs_slot); | ||
| 3841 | fallthrough; | ||
| 3842 | case nfserr_jukebox: | ||
| 3843 | /* The server MUST NOT cache NFS4ERR_DELAY */ | ||
| 3844 | goto out_free_conn; | ||
| 3845 | default: | ||
| 3839 | goto out_cache_error; | 3846 | goto out_cache_error; |
| 3840 | } | 3847 | } |
| 3841 | cs_slot->sl_seqid++; | ||
| 3842 | cr_ses->seqid = cs_slot->sl_seqid; | ||
| 3843 | 3848 | ||
| 3844 | /* RFC 8881 Section 18.36.4 Phase 3: Client ID confirmation. */ | 3849 | /* RFC 8881 Section 18.36.4 Phase 3: Client ID confirmation. */ |
| 3845 | if (conf) { | 3850 | if (conf) { |
| @@ -3859,10 +3864,8 @@ nfsd4_create_session(struct svc_rqst *rqstp, · 13 unmodified lines | |||
| 3859 | old = find_confirmed_client_by_name(&unconf->cl_name, nn); | 3864 | old = find_confirmed_client_by_name(&unconf->cl_name, nn); |
| 3860 | if (old) { | 3865 | if (old) { |
| 3861 | status = mark_client_expired_locked(old); | 3866 | status = mark_client_expired_locked(old); |
| 3862 | if (status) { | 3867 | if (status) |
| 3863 | old = NULL; | 3868 | goto out_expired_error; |
| 3864 | goto out_cache_error; | ||
| 3865 | } | ||
| 3866 | trace_nfsd_clid_replaced(&old->cl_clientid); | 3869 | trace_nfsd_clid_replaced(&old->cl_clientid); |
| 3867 | } | 3870 | } |
| 3868 | move_to_confirmed(unconf); | 3871 | move_to_confirmed(unconf); |
| @@ -3894,6 +3897,17 @@ nfsd4_create_session(struct svc_rqst *rqstp, · 25 unmodified lines | |||
| 3894 | expire_client(old); | 3897 | expire_client(old); |
| 3895 | return status; | 3898 | return status; |
| 3896 | 3899 | ||
| 3900 | out_expired_error: | ||
| 3901 | old = NULL; | ||
| 3902 | /* | ||
| 3903 | * Revert the slot seq_nr change so the server will process | ||
| 3904 | * the client's resend instead of returning a cached response. | ||
| 3905 | */ | ||
| 3906 | if (status == nfserr_jukebox) { | ||
| 3907 | cs_slot->sl_seqid--; | ||
| 3908 | cr_ses->seqid = cs_slot->sl_seqid; | ||
| 3909 | goto out_free_conn; | ||
| 3910 | } | ||
| 3897 | out_cache_error: | 3911 | out_cache_error: |
| 3898 | nfsd4_cache_create_session(cr_ses, cs_slot, status); | 3912 | nfsd4_cache_create_session(cr_ses, cs_slot, status); |
| 3899 | out_free_conn: | 3913 | out_free_conn: |
| @@ -1852,7 +1852,7 @@ retry: · 1851 unmodified lines | |||
| 1852 | trap = lock_rename(tdentry, fdentry); | 1852 | trap = lock_rename(tdentry, fdentry); |
| 1853 | if (IS_ERR(trap)) { | 1853 | if (IS_ERR(trap)) { |
| 1854 | err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; | 1854 | err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; |
| 1855 | goto out; | 1855 | goto out_want_write; |
| 1856 | } | 1856 | } |
| 1857 | err = fh_fill_pre_attrs(ffhp); | 1857 | err = fh_fill_pre_attrs(ffhp); |
| 1858 | if (err != nfs_ok) | 1858 | if (err != nfs_ok) |
| @@ -1922,6 +1922,7 @@ retry: · 63 unmodified lines | |||
| 1922 | } | 1922 | } |
| 1923 | out_unlock: | 1923 | out_unlock: |
| 1924 | unlock_rename(tdentry, fdentry); | 1924 | unlock_rename(tdentry, fdentry); |
| 1925 | out_want_write: | ||
| 1925 | fh_drop_write(ffhp); | 1926 | fh_drop_write(ffhp); |
| 1926 | 1927 | ||
| 1927 | /* | 1928 | /* |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | obj-y += proc.o | 6 | obj-y += proc.o |
| 7 | 7 | ||
| 8 | CFLAGS_task_mmu.o += $(call cc-option,-Wno-override-init,) | 8 | CFLAGS_task_mmu.o += -Wno-override-init |
| 9 | proc-y := nommu.o task_nommu.o | 9 | proc-y := nommu.o task_nommu.o |
| 10 | proc-$(CONFIG_MMU) := task_mmu.o | 10 | proc-$(CONFIG_MMU) := task_mmu.o |
| 11 | 11 | ||
| @@ -612,11 +612,18 @@ int cifs_mknod(struct mnt_idmap *idmap, struct inode *inode, · 611 unmodified lines | |||
| 612 | goto mknod_out; | 612 | goto mknod_out; |
| 613 | } | 613 | } |
| 614 | 614 | ||
| 615 | trace_smb3_mknod_enter(xid, tcon->ses->Suid, tcon->tid, full_path); | ||
| 616 | |||
| 615 | rc = tcon->ses->server->ops->make_node(xid, inode, direntry, tcon, | 617 | rc = tcon->ses->server->ops->make_node(xid, inode, direntry, tcon, |
| 616 | full_path, mode, | 618 | full_path, mode, |
| 617 | device_number); | 619 | device_number); |
| 618 | 620 | ||
| 619 | mknod_out: | 621 | mknod_out: |
| 622 | if (rc) | ||
| 623 | trace_smb3_mknod_err(xid, tcon->ses->Suid, tcon->tid, rc); | ||
| 624 | else | ||
| 625 | trace_smb3_mknod_done(xid, tcon->ses->Suid, tcon->tid); | ||
| 626 | |||
| 620 | free_dentry_path(page); | 627 | free_dentry_path(page); |
| 621 | free_xid(xid); | 628 | free_xid(xid); |
| 622 | cifs_put_tlink(tlink); | 629 | cifs_put_tlink(tlink); |
| @@ -12,6 +12,16 @@ · 11 unmodified lines | |||
| 12 | #include "cifs_fs_sb.h" | 12 | #include "cifs_fs_sb.h" |
| 13 | #include "cifsproto.h" | 13 | #include "cifsproto.h" |
| 14 | 14 | ||
| 15 | /* | ||
| 16 | * Key for fscache inode. [!] Contents must match comparisons in cifs_find_inode(). | ||
| 17 | */ | ||
| 18 | struct cifs_fscache_inode_key { | ||
| 19 | |||
| 20 | __le64 uniqueid; /* server inode number */ | ||
| 21 | __le64 createtime; /* creation time on server */ | ||
| 22 | u8 type; /* S_IFMT file type */ | ||
| 23 | } __packed; | ||
| 24 | |||
| 15 | static void cifs_fscache_fill_volume_coherency( | 25 | static void cifs_fscache_fill_volume_coherency( |
| 16 | struct cifs_tcon *tcon, | 26 | struct cifs_tcon *tcon, |
| 17 | struct cifs_fscache_volume_coherency_data *cd) | 27 | struct cifs_fscache_volume_coherency_data *cd) |
| @@ -97,15 +107,19 @@ void cifs_fscache_release_super_cookie(struct cifs_tcon *tcon) · 79 unmodified lines | |||
| 97 | void cifs_fscache_get_inode_cookie(struct inode *inode) | 107 | void cifs_fscache_get_inode_cookie(struct inode *inode) |
| 98 | { | 108 | { |
| 99 | struct cifs_fscache_inode_coherency_data cd; | 109 | struct cifs_fscache_inode_coherency_data cd; |
| 110 | struct cifs_fscache_inode_key key; | ||
| 100 | struct cifsInodeInfo *cifsi = CIFS_I(inode); | 111 | struct cifsInodeInfo *cifsi = CIFS_I(inode); |
| 101 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 112 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
| 102 | struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); | 113 | struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); |
| 103 | 114 | ||
| 115 | key.uniqueid = cpu_to_le64(cifsi->uniqueid); | ||
| 116 | key.createtime = cpu_to_le64(cifsi->createtime); | ||
| 117 | key.type = (inode->i_mode & S_IFMT) >> 12; | ||
| 104 | cifs_fscache_fill_coherency(&cifsi->netfs.inode, &cd); | 118 | cifs_fscache_fill_coherency(&cifsi->netfs.inode, &cd); |
| 105 | 119 | ||
| 106 | cifsi->netfs.cache = | 120 | cifsi->netfs.cache = |
| 107 | fscache_acquire_cookie(tcon->fscache, 0, | 121 | fscache_acquire_cookie(tcon->fscache, 0, |
| 108 | &cifsi->uniqueid, sizeof(cifsi->uniqueid), | 122 | &key, sizeof(key), |
| 109 | &cd, sizeof(cd), | 123 | &cd, sizeof(cd), |
| 110 | i_size_read(&cifsi->netfs.inode)); | 124 | i_size_read(&cifsi->netfs.inode)); |
| 111 | if (cifsi->netfs.cache) | 125 | if (cifsi->netfs.cache) |
| @@ -1351,6 +1351,8 @@ cifs_find_inode(struct inode *inode, void *opaque) · 1350 unmodified lines | |||
| 1351 | { | 1351 | { |
| 1352 | struct cifs_fattr *fattr = opaque; | 1352 | struct cifs_fattr *fattr = opaque; |
| 1353 | 1353 | ||
| 1354 | /* [!] The compared values must be the same in struct cifs_fscache_inode_key. */ | ||
| 1355 | |||
| 1354 | /* don't match inode with different uniqueid */ | 1356 | /* don't match inode with different uniqueid */ |
| 1355 | if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid) | 1357 | if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid) |
| 1356 | return 0; | 1358 | return 0; |
| @@ -375,6 +375,7 @@ DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(get_reparse_compound_enter); · 374 unmodified lines | |||
| 375 | DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter); | 375 | DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter); |
| 376 | DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter); | 376 | DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter); |
| 377 | DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(tdis_enter); | 377 | DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(tdis_enter); |
| 378 | DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mknod_enter); | ||
| 378 | 379 | ||
| 379 | DECLARE_EVENT_CLASS(smb3_inf_compound_done_class, | 380 | DECLARE_EVENT_CLASS(smb3_inf_compound_done_class, |
| 380 | TP_PROTO(unsigned int xid, | 381 | TP_PROTO(unsigned int xid, |
| @@ -415,7 +416,7 @@ DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_wsl_ea_compound_done); · 34 unmodified lines | |||
| 415 | DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done); | 416 | DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done); |
| 416 | DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done); | 417 | DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done); |
| 417 | DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done); | 418 | DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done); |
| 418 | 419 | DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mknod_done); | |
| 419 | 420 | ||
| 420 | DECLARE_EVENT_CLASS(smb3_inf_compound_err_class, | 421 | DECLARE_EVENT_CLASS(smb3_inf_compound_err_class, |
| 421 | TP_PROTO(unsigned int xid, | 422 | TP_PROTO(unsigned int xid, |
| @@ -461,6 +462,7 @@ DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_wsl_ea_compound_err); · 39 unmodified lines | |||
| 461 | DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err); | 462 | DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err); |
| 462 | DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err); | 463 | DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err); |
| 463 | DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err); | 464 | DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err); |
| 465 | DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mknod_err); | ||
| 464 | 466 | ||
| 465 | /* | 467 | /* |
| 466 | * For logging SMB3 Status code and Command for responses which return errors | 468 | * For logging SMB3 Status code and Command for responses which return errors |
| @@ -530,7 +530,8 @@ xfs_validate_sb_common( · 529 unmodified lines | |||
| 530 | } | 530 | } |
| 531 | 531 | ||
| 532 | if (!xfs_validate_stripe_geometry(mp, XFS_FSB_TO_B(mp, sbp->sb_unit), | 532 | if (!xfs_validate_stripe_geometry(mp, XFS_FSB_TO_B(mp, sbp->sb_unit), |
| 533 | XFS_FSB_TO_B(mp, sbp->sb_width), 0, false)) | 533 | XFS_FSB_TO_B(mp, sbp->sb_width), 0, |
| 534 | xfs_buf_daddr(bp) == XFS_SB_DADDR, false)) | ||
| 534 | return -EFSCORRUPTED; | 535 | return -EFSCORRUPTED; |
| 535 | 536 | ||
| 536 | /* | 537 | /* |
| @@ -1323,8 +1324,10 @@ xfs_sb_get_secondary( · 786 unmodified lines | |||
| 1323 | } | 1324 | } |
| 1324 | 1325 | ||
| 1325 | /* | 1326 | /* |
| 1326 | * sunit, swidth, sectorsize(optional with 0) should be all in bytes, | 1327 | * sunit, swidth, sectorsize(optional with 0) should be all in bytes, so users |
| 1327 | * so users won't be confused by values in error messages. | 1328 | * won't be confused by values in error messages. This function returns false |
| 1329 | * if the stripe geometry is invalid and the caller is unable to repair the | ||
| 1330 | * stripe configuration later in the mount process. | ||
| 1328 | */ | 1331 | */ |
| 1329 | bool | 1332 | bool |
| 1330 | xfs_validate_stripe_geometry( | 1333 | xfs_validate_stripe_geometry( |
| @@ -1332,20 +1335,21 @@ xfs_validate_stripe_geometry( · 1 unmodified line | |||
| 1332 | __s64 sunit, | 1335 | __s64 sunit, |
| 1333 | __s64 swidth, | 1336 | __s64 swidth, |
| 1334 | int sectorsize, | 1337 | int sectorsize, |
| 1338 | bool may_repair, | ||
| 1335 | bool silent) | 1339 | bool silent) |
| 1336 | { | 1340 | { |
| 1337 | if (swidth > INT_MAX) { | 1341 | if (swidth > INT_MAX) { |
| 1338 | if (!silent) | 1342 | if (!silent) |
| 1339 | xfs_notice(mp, | 1343 | xfs_notice(mp, |
| 1340 | "stripe width (%lld) is too large", swidth); | 1344 | "stripe width (%lld) is too large", swidth); |
| 1341 | return false; | 1345 | goto check_override; |
| 1342 | } | 1346 | } |
| 1343 | 1347 | ||
| 1344 | if (sunit > swidth) { | 1348 | if (sunit > swidth) { |
| 1345 | if (!silent) | 1349 | if (!silent) |
| 1346 | xfs_notice(mp, | 1350 | xfs_notice(mp, |
| 1347 | "stripe unit (%lld) is larger than the stripe width (%lld)", sunit, swidth); | 1351 | "stripe unit (%lld) is larger than the stripe width (%lld)", sunit, swidth); |
| 1348 | return false; | 1352 | goto check_override; |
| 1349 | } | 1353 | } |
| 1350 | 1354 | ||
| 1351 | if (sectorsize && (int)sunit % sectorsize) { | 1355 | if (sectorsize && (int)sunit % sectorsize) { |
| @@ -1353,21 +1357,21 @@ xfs_validate_stripe_geometry( · 1 unmodified line | |||
| 1353 | xfs_notice(mp, | 1357 | xfs_notice(mp, |
| 1354 | "stripe unit (%lld) must be a multiple of the sector size (%d)", | 1358 | "stripe unit (%lld) must be a multiple of the sector size (%d)", |
| 1355 | sunit, sectorsize); | 1359 | sunit, sectorsize); |
| 1356 | return false; | 1360 | goto check_override; |
| 1357 | } | 1361 | } |
| 1358 | 1362 | ||
| 1359 | if (sunit && !swidth) { | 1363 | if (sunit && !swidth) { |
| 1360 | if (!silent) | 1364 | if (!silent) |
| 1361 | xfs_notice(mp, | 1365 | xfs_notice(mp, |
| 1362 | "invalid stripe unit (%lld) and stripe width of 0", sunit); | 1366 | "invalid stripe unit (%lld) and stripe width of 0", sunit); |
| 1363 | return false; | 1367 | goto check_override; |
| 1364 | } | 1368 | } |
| 1365 | 1369 | ||
| 1366 | if (!sunit && swidth) { | 1370 | if (!sunit && swidth) { |
| 1367 | if (!silent) | 1371 | if (!silent) |
| 1368 | xfs_notice(mp, | 1372 | xfs_notice(mp, |
| 1369 | "invalid stripe width (%lld) and stripe unit of 0", swidth); | 1373 | "invalid stripe width (%lld) and stripe unit of 0", swidth); |
| 1370 | return false; | 1374 | goto check_override; |
| 1371 | } | 1375 | } |
| 1372 | 1376 | ||
| 1373 | if (sunit && (int)swidth % (int)sunit) { | 1377 | if (sunit && (int)swidth % (int)sunit) { |
| @@ -1375,9 +1379,27 @@ xfs_validate_stripe_geometry( · 1 unmodified line | |||
| 1375 | xfs_notice(mp, | 1379 | xfs_notice(mp, |
| 1376 | "stripe width (%lld) must be a multiple of the stripe unit (%lld)", | 1380 | "stripe width (%lld) must be a multiple of the stripe unit (%lld)", |
| 1377 | swidth, sunit); | 1381 | swidth, sunit); |
| 1378 | return false; | 1382 | goto check_override; |
| 1379 | } | 1383 | } |
| 1380 | return true; | 1384 | return true; |
| 1385 | |||
| 1386 | check_override: | ||
| 1387 | if (!may_repair) | ||
| 1388 | return false; | ||
| 1389 | /* | ||
| 1390 | * During mount, mp->m_dalign will not be set unless the sunit mount | ||
| 1391 | * option was set. If it was set, ignore the bad stripe alignment values | ||
| 1392 | * and allow the validation and overwrite later in the mount process to | ||
| 1393 | * attempt to overwrite the bad stripe alignment values with the values | ||
| 1394 | * supplied by mount options. | ||
| 1395 | */ | ||
| 1396 | if (!mp->m_dalign) | ||
| 1397 | return false; | ||
| 1398 | if (!silent) | ||
| 1399 | xfs_notice(mp, | ||
| 1400 | "Will try to correct with specified mount options sunit (%d) and swidth (%d)", | ||
| 1401 | BBTOB(mp->m_dalign), BBTOB(mp->m_swidth)); | ||
| 1402 | return true; | ||
| 1381 | } | 1403 | } |
| 1382 | 1404 | ||
| 1383 | /* | 1405 | /* |
| @@ -35,8 +35,9 @@ extern int xfs_sb_get_secondary(struct xfs_mount *mp, · 34 unmodified lines | |||
| 35 | struct xfs_trans *tp, xfs_agnumber_t agno, | 35 | struct xfs_trans *tp, xfs_agnumber_t agno, |
| 36 | struct xfs_buf **bpp); | 36 | struct xfs_buf **bpp); |
| 37 | 37 | ||
| 38 | extern bool xfs_validate_stripe_geometry(struct xfs_mount *mp, | 38 | bool xfs_validate_stripe_geometry(struct xfs_mount *mp, |
| 39 | __s64 sunit, __s64 swidth, int sectorsize, bool silent); | 39 | __s64 sunit, __s64 swidth, int sectorsize, bool may_repair, |
| 40 | bool silent); | ||
| 40 | 41 | ||
| 41 | uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); | 42 | uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); |
| 42 | 43 | ||
| @@ -1044,9 +1044,7 @@ xchk_irele( · 1043 unmodified lines | |||
| 1044 | struct xfs_scrub *sc, | 1044 | struct xfs_scrub *sc, |
| 1045 | struct xfs_inode *ip) | 1045 | struct xfs_inode *ip) |
| 1046 | { | 1046 | { |
| 1047 | if (current->journal_info != NULL) { | 1047 | if (sc->tp) { |
| 1048 | ASSERT(current->journal_info == sc->tp); | ||
| 1049 | |||
| 1050 | /* | 1048 | /* |
| 1051 | * If we are in a transaction, we /cannot/ drop the inode | 1049 | * If we are in a transaction, we /cannot/ drop the inode |
| 1052 | * ourselves, because the VFS will trigger writeback, which | 1050 | * ourselves, because the VFS will trigger writeback, which |
| @@ -503,13 +503,6 @@ xfs_vm_writepages( · 502 unmodified lines | |||
| 503 | { | 503 | { |
| 504 | struct xfs_writepage_ctx wpc = { }; | 504 | struct xfs_writepage_ctx wpc = { }; |
| 505 | 505 | ||
| 506 | /* | ||
| 507 | * Writing back data in a transaction context can result in recursive | ||
| 508 | * transactions. This is bad, so issue a warning and get out of here. | ||
| 509 | */ | ||
| 510 | if (WARN_ON_ONCE(current->journal_info)) | ||
| 511 | return 0; | ||
| 512 | |||
| 513 | xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); | 506 | xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); |
| 514 | return iomap_writepages(mapping, wbc, &wpc.ctx, &xfs_writeback_ops); | 507 | return iomap_writepages(mapping, wbc, &wpc.ctx, &xfs_writeback_ops); |
| 515 | } | 508 | } |
| @@ -2039,8 +2039,10 @@ xfs_inodegc_want_queue_work( · 2038 unmodified lines | |||
| 2039 | * - Memory shrinkers queued the inactivation worker and it hasn't finished. | 2039 | * - Memory shrinkers queued the inactivation worker and it hasn't finished. |
| 2040 | * - The queue depth exceeds the maximum allowable percpu backlog. | 2040 | * - The queue depth exceeds the maximum allowable percpu backlog. |
| 2041 | * | 2041 | * |
| 2042 | * Note: If the current thread is running a transaction, we don't ever want to | 2042 | * Note: If we are in a NOFS context here (e.g. current thread is running a |
| 2043 | * wait for other transactions because that could introduce a deadlock. | 2043 | * transaction) the we don't want to block here as inodegc progress may require |
| 2044 | * filesystem resources we hold to make progress and that could result in a | ||
| 2045 | * deadlock. Hence we skip out of here if we are in a scoped NOFS context. | ||
| 2044 | */ | 2046 | */ |
| 2045 | static inline bool | 2047 | static inline bool |
| 2046 | xfs_inodegc_want_flush_work( | 2048 | xfs_inodegc_want_flush_work( |
| @@ -2048,7 +2050,7 @@ xfs_inodegc_want_flush_work( · 1 unmodified line | |||
| 2048 | unsigned int items, | 2050 | unsigned int items, |
| 2049 | unsigned int shrinker_hits) | 2051 | unsigned int shrinker_hits) |
| 2050 | { | 2052 | { |
| 2051 | if (current->journal_info) | 2053 | if (current->flags & PF_MEMALLOC_NOFS) |
| 2052 | return false; | 2054 | return false; |
| 2053 | 2055 | ||
| 2054 | if (shrinker_hits > 0) | 2056 | if (shrinker_hits > 0) |
| @@ -268,19 +268,14 @@ static inline void · 267 unmodified lines | |||
| 268 | xfs_trans_set_context( | 268 | xfs_trans_set_context( |
| 269 | struct xfs_trans *tp) | 269 | struct xfs_trans *tp) |
| 270 | { | 270 | { |
| 271 | ASSERT(current->journal_info == NULL); | ||
| 272 | tp->t_pflags = memalloc_nofs_save(); | 271 | tp->t_pflags = memalloc_nofs_save(); |
| 273 | current->journal_info = tp; | ||
| 274 | } | 272 | } |
| 275 | 273 | ||
| 276 | static inline void | 274 | static inline void |
| 277 | xfs_trans_clear_context( | 275 | xfs_trans_clear_context( |
| 278 | struct xfs_trans *tp) | 276 | struct xfs_trans *tp) |
| 279 | { | 277 | { |
| 280 | if (current->journal_info == tp) { | 278 | memalloc_nofs_restore(tp->t_pflags); |
| 281 | memalloc_nofs_restore(tp->t_pflags); | ||
| 282 | current->journal_info = NULL; | ||
| 283 | } | ||
| 284 | } | 279 | } |
| 285 | 280 | ||
| 286 | static inline void | 281 | static inline void |
| @@ -288,10 +283,8 @@ xfs_trans_switch_context( · 1 unmodified line | |||
| 288 | struct xfs_trans *old_tp, | 283 | struct xfs_trans *old_tp, |
| 289 | struct xfs_trans *new_tp) | 284 | struct xfs_trans *new_tp) |
| 290 | { | 285 | { |
| 291 | ASSERT(current->journal_info == old_tp); | ||
| 292 | new_tp->t_pflags = old_tp->t_pflags; | 286 | new_tp->t_pflags = old_tp->t_pflags; |
| 293 | old_tp->t_pflags = 0; | 287 | old_tp->t_pflags = 0; |
| 294 | current->journal_info = new_tp; | ||
| 295 | } | 288 | } |
| 296 | 289 | ||
| 297 | #endif /* __XFS_TRANS_H__ */ | 290 | #endif /* __XFS_TRANS_H__ */ |
| @@ -1,11 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | #ifndef __ASM_GENERIC_EXPORT_H | ||
| 3 | #define __ASM_GENERIC_EXPORT_H | ||
| 4 | |||
| 5 | /* | ||
| 6 | * <asm/export.h> and <asm-generic/export.h> are deprecated. | ||
| 7 | * Please include <linux/export.h> directly. | ||
| 8 | */ | ||
| 9 | #include <linux/export.h> | ||
| 10 | |||
| 11 | #endif | ||
| @@ -181,12 +181,12 @@ static inline int framer_notifier_unregister(struct framer *framer, · 180 unmodified lines | |||
| 181 | return -ENOSYS; | 181 | return -ENOSYS; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | struct framer *framer_get(struct device *dev, const char *con_id) | 184 | static inline struct framer *framer_get(struct device *dev, const char *con_id) |
| 185 | { | 185 | { |
| 186 | return ERR_PTR(-ENOSYS); | 186 | return ERR_PTR(-ENOSYS); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | void framer_put(struct device *dev, struct framer *framer) | 189 | static inline void framer_put(struct device *dev, struct framer *framer) |
| 190 | { | 190 | { |
| 191 | } | 191 | } |
| 192 | 192 | ||
| @@ -646,8 +646,6 @@ int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc, · 645 unmodified lines | |||
| 646 | struct gpio_device *gpio_device_find(const void *data, | 646 | struct gpio_device *gpio_device_find(const void *data, |
| 647 | int (*match)(struct gpio_chip *gc, | 647 | int (*match)(struct gpio_chip *gc, |
| 648 | const void *data)); | 648 | const void *data)); |
| 649 | struct gpio_device *gpio_device_find_by_label(const char *label); | ||
| 650 | struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode); | ||
| 651 | 649 | ||
| 652 | struct gpio_device *gpio_device_get(struct gpio_device *gdev); | 650 | struct gpio_device *gpio_device_get(struct gpio_device *gdev); |
| 653 | void gpio_device_put(struct gpio_device *gdev); | 651 | void gpio_device_put(struct gpio_device *gdev); |
| @@ -814,6 +812,9 @@ struct gpio_device *gpiod_to_gpio_device(struct gpio_desc *desc); · 160 unmodified lines | |||
| 814 | int gpio_device_get_base(struct gpio_device *gdev); | 812 | int gpio_device_get_base(struct gpio_device *gdev); |
| 815 | const char *gpio_device_get_label(struct gpio_device *gdev); | 813 | const char *gpio_device_get_label(struct gpio_device *gdev); |
| 816 | 814 | ||
| 815 | struct gpio_device *gpio_device_find_by_label(const char *label); | ||
| 816 | struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode); | ||
| 817 | |||
| 817 | #else /* CONFIG_GPIOLIB */ | 818 | #else /* CONFIG_GPIOLIB */ |
| 818 | 819 | ||
| 819 | #include <asm/bug.h> | 820 | #include <asm/bug.h> |
| @@ -843,6 +844,18 @@ static inline const char *gpio_device_get_label(struct gpio_device *gdev) · 23 unmodified lines | |||
| 843 | return NULL; | 844 | return NULL; |
| 844 | } | 845 | } |
| 845 | 846 | ||
| 847 | static inline struct gpio_device *gpio_device_find_by_label(const char *label) | ||
| 848 | { | ||
| 849 | WARN_ON(1); | ||
| 850 | return NULL; | ||
| 851 | } | ||
| 852 | |||
| 853 | static inline struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode) | ||
| 854 | { | ||
| 855 | WARN_ON(1); | ||
| 856 | return NULL; | ||
| 857 | } | ||
| 858 | |||
| 846 | static inline int gpiochip_lock_as_irq(struct gpio_chip *gc, | 859 | static inline int gpiochip_lock_as_irq(struct gpio_chip *gc, |
| 847 | unsigned int offset) | 860 | unsigned int offset) |
| 848 | { | 861 | { |
| @@ -67,6 +67,8 @@ · 66 unmodified lines | |||
| 67 | * later. | 67 | * later. |
| 68 | * IRQF_NO_DEBUG - Exclude from runnaway detection for IPI and similar handlers, | 68 | * IRQF_NO_DEBUG - Exclude from runnaway detection for IPI and similar handlers, |
| 69 | * depends on IRQF_PERCPU. | 69 | * depends on IRQF_PERCPU. |
| 70 | * IRQF_COND_ONESHOT - Agree to do IRQF_ONESHOT if already set for a shared | ||
| 71 | * interrupt. | ||
| 70 | */ | 72 | */ |
| 71 | #define IRQF_SHARED 0x00000080 | 73 | #define IRQF_SHARED 0x00000080 |
| 72 | #define IRQF_PROBE_SHARED 0x00000100 | 74 | #define IRQF_PROBE_SHARED 0x00000100 |
| @@ -82,6 +84,7 @@ · 9 unmodified lines | |||
| 82 | #define IRQF_COND_SUSPEND 0x00040000 | 84 | #define IRQF_COND_SUSPEND 0x00040000 |
| 83 | #define IRQF_NO_AUTOEN 0x00080000 | 85 | #define IRQF_NO_AUTOEN 0x00080000 |
| 84 | #define IRQF_NO_DEBUG 0x00100000 | 86 | #define IRQF_NO_DEBUG 0x00100000 |
| 87 | #define IRQF_COND_ONESHOT 0x00200000 | ||
| 85 | 88 | ||
| 86 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD) | 89 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD) |
| 87 | 90 | ||
| @@ -107,6 +107,7 @@ enum { · 106 unmodified lines | |||
| 107 | 107 | ||
| 108 | ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */ | 108 | ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */ |
| 109 | ATA_DFLAG_CDL_ENABLED = (1 << 21), /* cmd duration limits is enabled */ | 109 | ATA_DFLAG_CDL_ENABLED = (1 << 21), /* cmd duration limits is enabled */ |
| 110 | ATA_DFLAG_RESUMING = (1 << 22), /* Device is resuming */ | ||
| 110 | ATA_DFLAG_DETACH = (1 << 24), | 111 | ATA_DFLAG_DETACH = (1 << 24), |
| 111 | ATA_DFLAG_DETACHED = (1 << 25), | 112 | ATA_DFLAG_DETACHED = (1 << 25), |
| 112 | ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ | 113 | ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ |
| @@ -162,6 +162,14 @@ calc_vm_flag_bits(unsigned long flags) · 161 unmodified lines | |||
| 162 | 162 | ||
| 163 | unsigned long vm_commit_limit(void); | 163 | unsigned long vm_commit_limit(void); |
| 164 | 164 | ||
| 165 | #ifndef arch_memory_deny_write_exec_supported | ||
| 166 | static inline bool arch_memory_deny_write_exec_supported(void) | ||
| 167 | { | ||
| 168 | return true; | ||
| 169 | } | ||
| 170 | #define arch_memory_deny_write_exec_supported arch_memory_deny_write_exec_supported | ||
| 171 | #endif | ||
| 172 | |||
| 165 | /* | 173 | /* |
| 166 | * Denies creating a writable executable mapping or gaining executable permissions. | 174 | * Denies creating a writable executable mapping or gaining executable permissions. |
| 167 | * | 175 | * |
| @@ -17,10 +17,12 @@ · 16 unmodified lines | |||
| 17 | * build_OID_registry.pl to generate the data for look_up_OID(). | 17 | * build_OID_registry.pl to generate the data for look_up_OID(). |
| 18 | */ | 18 | */ |
| 19 | enum OID { | 19 | enum OID { |
| 20 | OID_id_dsa_with_sha1, /* 1.2.840.10030.4.3 */ | ||
| 20 | OID_id_dsa, /* 1.2.840.10040.4.1 */ | 21 | OID_id_dsa, /* 1.2.840.10040.4.1 */ |
| 21 | OID_id_ecPublicKey, /* 1.2.840.10045.2.1 */ | 22 | OID_id_ecPublicKey, /* 1.2.840.10045.2.1 */ |
| 22 | OID_id_prime192v1, /* 1.2.840.10045.3.1.1 */ | 23 | OID_id_prime192v1, /* 1.2.840.10045.3.1.1 */ |
| 23 | OID_id_prime256v1, /* 1.2.840.10045.3.1.7 */ | 24 | OID_id_prime256v1, /* 1.2.840.10045.3.1.7 */ |
| 25 | OID_id_ecdsa_with_sha1, /* 1.2.840.10045.4.1 */ | ||
| 24 | OID_id_ecdsa_with_sha224, /* 1.2.840.10045.4.3.1 */ | 26 | OID_id_ecdsa_with_sha224, /* 1.2.840.10045.4.3.1 */ |
| 25 | OID_id_ecdsa_with_sha256, /* 1.2.840.10045.4.3.2 */ | 27 | OID_id_ecdsa_with_sha256, /* 1.2.840.10045.4.3.2 */ |
| 26 | OID_id_ecdsa_with_sha384, /* 1.2.840.10045.4.3.3 */ | 28 | OID_id_ecdsa_with_sha384, /* 1.2.840.10045.4.3.3 */ |
| @@ -28,6 +30,7 @@ enum OID { · 1 unmodified line | |||
| 28 | 30 | ||
| 29 | /* PKCS#1 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)} */ | 31 | /* PKCS#1 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)} */ |
| 30 | OID_rsaEncryption, /* 1.2.840.113549.1.1.1 */ | 32 | OID_rsaEncryption, /* 1.2.840.113549.1.1.1 */ |
| 33 | OID_sha1WithRSAEncryption, /* 1.2.840.113549.1.1.5 */ | ||
| 31 | OID_sha256WithRSAEncryption, /* 1.2.840.113549.1.1.11 */ | 34 | OID_sha256WithRSAEncryption, /* 1.2.840.113549.1.1.11 */ |
| 32 | OID_sha384WithRSAEncryption, /* 1.2.840.113549.1.1.12 */ | 35 | OID_sha384WithRSAEncryption, /* 1.2.840.113549.1.1.12 */ |
| 33 | OID_sha512WithRSAEncryption, /* 1.2.840.113549.1.1.13 */ | 36 | OID_sha512WithRSAEncryption, /* 1.2.840.113549.1.1.13 */ |
| @@ -64,6 +67,7 @@ enum OID { · 30 unmodified lines | |||
| 64 | OID_PKU2U, /* 1.3.5.1.5.2.7 */ | 67 | OID_PKU2U, /* 1.3.5.1.5.2.7 */ |
| 65 | OID_Scram, /* 1.3.6.1.5.5.14 */ | 68 | OID_Scram, /* 1.3.6.1.5.5.14 */ |
| 66 | OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */ | 69 | OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */ |
| 70 | OID_sha1, /* 1.3.14.3.2.26 */ | ||
| 67 | OID_id_ansip384r1, /* 1.3.132.0.34 */ | 71 | OID_id_ansip384r1, /* 1.3.132.0.34 */ |
| 68 | OID_sha256, /* 2.16.840.1.101.3.4.2.1 */ | 72 | OID_sha256, /* 2.16.840.1.101.3.4.2.1 */ |
| 69 | OID_sha384, /* 2.16.840.1.101.3.4.2.2 */ | 73 | OID_sha384, /* 2.16.840.1.101.3.4.2.2 */ |
| @@ -11,8 +11,8 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | 13 | ||
| 14 | /* 15 pointers + header align the folio_batch structure to a power of two */ | 14 | /* 31 pointers + header align the folio_batch structure to a power of two */ |
| 15 | #define PAGEVEC_SIZE 15 | 15 | #define PAGEVEC_SIZE 31 |
| 16 | 16 | ||
| 17 | struct folio; | 17 | struct folio; |
| 18 | 18 | ||
| @@ -753,8 +753,6 @@ typedef unsigned char *sk_buff_data_t; · 752 unmodified lines | |||
| 753 | * @list: queue head | 753 | * @list: queue head |
| 754 | * @ll_node: anchor in an llist (eg socket defer_list) | 754 | * @ll_node: anchor in an llist (eg socket defer_list) |
| 755 | * @sk: Socket we are owned by | 755 | * @sk: Socket we are owned by |
| 756 | * @ip_defrag_offset: (aka @sk) alternate use of @sk, used in | ||
| 757 | * fragmentation management | ||
| 758 | * @dev: Device we arrived on/are leaving by | 756 | * @dev: Device we arrived on/are leaving by |
| 759 | * @dev_scratch: (aka @dev) alternate use of @dev when @dev would be %NULL | 757 | * @dev_scratch: (aka @dev) alternate use of @dev when @dev would be %NULL |
| 760 | * @cb: Control buffer. Free for use by every layer. Put private vars here | 758 | * @cb: Control buffer. Free for use by every layer. Put private vars here |
| @@ -875,10 +873,7 @@ struct sk_buff { · 114 unmodified lines | |||
| 875 | struct llist_node ll_node; | 873 | struct llist_node ll_node; |
| 876 | }; | 874 | }; |
| 877 | 875 | ||
| 878 | union { | 876 | struct sock *sk; |
| 879 | struct sock *sk; | ||
| 880 | int ip_defrag_offset; | ||
| 881 | }; | ||
| 882 | 877 | ||
| 883 | union { | 878 | union { |
| 884 | ktime_t tstamp; | 879 | ktime_t tstamp; |
| @@ -4991,6 +4991,7 @@ struct cfg80211_ops { · 4990 unmodified lines | |||
| 4991 | * set this flag to update channels on beacon hints. | 4991 | * set this flag to update channels on beacon hints. |
| 4992 | * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link | 4992 | * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link |
| 4993 | * of an NSTR mobile AP MLD. | 4993 | * of an NSTR mobile AP MLD. |
| 4994 | * @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device | ||
| 4994 | */ | 4995 | */ |
| 4995 | enum wiphy_flags { | 4996 | enum wiphy_flags { |
| 4996 | WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), | 4997 | WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), |
| @@ -5002,6 +5003,7 @@ enum wiphy_flags { · 5 unmodified lines | |||
| 5002 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | 5003 | WIPHY_FLAG_4ADDR_STATION = BIT(6), |
| 5003 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | 5004 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), |
| 5004 | WIPHY_FLAG_IBSS_RSN = BIT(8), | 5005 | WIPHY_FLAG_IBSS_RSN = BIT(8), |
| 5006 | WIPHY_FLAG_DISABLE_WEXT = BIT(9), | ||
| 5005 | WIPHY_FLAG_MESH_AUTH = BIT(10), | 5007 | WIPHY_FLAG_MESH_AUTH = BIT(10), |
| 5006 | WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11), | 5008 | WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11), |
| 5007 | WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY = BIT(12), | 5009 | WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY = BIT(12), |
| @@ -175,6 +175,7 @@ void inet_csk_init_xmit_timers(struct sock *sk, · 174 unmodified lines | |||
| 175 | void (*delack_handler)(struct timer_list *), | 175 | void (*delack_handler)(struct timer_list *), |
| 176 | void (*keepalive_handler)(struct timer_list *)); | 176 | void (*keepalive_handler)(struct timer_list *)); |
| 177 | void inet_csk_clear_xmit_timers(struct sock *sk); | 177 | void inet_csk_clear_xmit_timers(struct sock *sk); |
| 178 | void inet_csk_clear_xmit_timers_sync(struct sock *sk); | ||
| 178 | 179 | ||
| 179 | static inline void inet_csk_schedule_ack(struct sock *sk) | 180 | static inline void inet_csk_schedule_ack(struct sock *sk) |
| 180 | { | 181 | { |
| @@ -1759,6 +1759,13 @@ static inline void sock_owned_by_me(const struct sock *sk) · 1758 unmodified lines | |||
| 1759 | #endif | 1759 | #endif |
| 1760 | } | 1760 | } |
| 1761 | 1761 | ||
| 1762 | static inline void sock_not_owned_by_me(const struct sock *sk) | ||
| 1763 | { | ||
| 1764 | #ifdef CONFIG_LOCKDEP | ||
| 1765 | WARN_ON_ONCE(lockdep_sock_is_held(sk) && debug_locks); | ||
| 1766 | #endif | ||
| 1767 | } | ||
| 1768 | |||
| 1762 | static inline bool sock_owned_by_user(const struct sock *sk) | 1769 | static inline bool sock_owned_by_user(const struct sock *sk) |
| 1763 | { | 1770 | { |
| 1764 | sock_owned_by_me(sk); | 1771 | sock_owned_by_me(sk); |
| @@ -188,6 +188,8 @@ static inline void xsk_tx_metadata_complete(struct xsk_tx_metadata_compl *compl, · 187 unmodified lines | |||
| 188 | { | 188 | { |
| 189 | if (!compl) | 189 | if (!compl) |
| 190 | return; | 190 | return; |
| 191 | if (!compl->tx_timestamp) | ||
| 192 | return; | ||
| 191 | 193 | ||
| 192 | *compl->tx_timestamp = ops->tmo_fill_timestamp(priv); | 194 | *compl->tx_timestamp = ops->tmo_fill_timestamp(priv); |
| 193 | } | 195 | } |
| @@ -12,6 +12,7 @@ struct request; · 11 unmodified lines | |||
| 12 | struct scsi_driver { | 12 | struct scsi_driver { |
| 13 | struct device_driver gendrv; | 13 | struct device_driver gendrv; |
| 14 | 14 | ||
| 15 | int (*resume)(struct device *); | ||
| 15 | void (*rescan)(struct device *); | 16 | void (*rescan)(struct device *); |
| 16 | blk_status_t (*init_command)(struct scsi_cmnd *); | 17 | blk_status_t (*init_command)(struct scsi_cmnd *); |
| 17 | void (*uninit_command)(struct scsi_cmnd *); | 18 | void (*uninit_command)(struct scsi_cmnd *); |
| @@ -767,6 +767,7 @@ scsi_template_proc_dir(const struct scsi_host_template *sht); · 766 unmodified lines | |||
| 767 | #define scsi_template_proc_dir(sht) NULL | 767 | #define scsi_template_proc_dir(sht) NULL |
| 768 | #endif | 768 | #endif |
| 769 | extern void scsi_scan_host(struct Scsi_Host *); | 769 | extern void scsi_scan_host(struct Scsi_Host *); |
| 770 | extern int scsi_resume_device(struct scsi_device *sdev); | ||
| 770 | extern int scsi_rescan_device(struct scsi_device *sdev); | 771 | extern int scsi_rescan_device(struct scsi_device *sdev); |
| 771 | extern void scsi_remove_host(struct Scsi_Host *); | 772 | extern void scsi_remove_host(struct Scsi_Host *); |
| 772 | extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); | 773 | extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); |
| @@ -143,6 +143,9 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt, · 142 unmodified lines | |||
| 143 | u32 bus_id, u8 link_type, u8 vbps, u8 bps, | 143 | u32 bus_id, u8 link_type, u8 vbps, u8 bps, |
| 144 | u8 num_ch, u32 rate, u8 dir, u8 dev_type); | 144 | u8 num_ch, u32 rate, u8 dir, u8 dev_type); |
| 145 | 145 | ||
| 146 | int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt, | ||
| 147 | u8 virtual_bus_id); | ||
| 148 | |||
| 146 | #else | 149 | #else |
| 147 | 150 | ||
| 148 | static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev) | 151 | static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev) |
| @@ -184,6 +187,13 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt, · 35 unmodified lines | |||
| 184 | return NULL; | 187 | return NULL; |
| 185 | } | 188 | } |
| 186 | 189 | ||
| 190 | static inline int intel_nhlt_ssp_device_type(struct device *dev, | ||
| 191 | struct nhlt_acpi_table *nhlt, | ||
| 192 | u8 virtual_bus_id) | ||
| 193 | { | ||
| 194 | return -EINVAL; | ||
| 195 | } | ||
| 196 | |||
| 187 | #endif | 197 | #endif |
| 188 | 198 | ||
| 189 | #endif | 199 | #endif |
| @@ -913,14 +913,25 @@ enum kfd_dbg_trap_exception_code { · 912 unmodified lines | |||
| 913 | KFD_EC_MASK(EC_DEVICE_NEW)) | 913 | KFD_EC_MASK(EC_DEVICE_NEW)) |
| 914 | #define KFD_EC_MASK_PROCESS (KFD_EC_MASK(EC_PROCESS_RUNTIME) | \ | 914 | #define KFD_EC_MASK_PROCESS (KFD_EC_MASK(EC_PROCESS_RUNTIME) | \ |
| 915 | KFD_EC_MASK(EC_PROCESS_DEVICE_REMOVE)) | 915 | KFD_EC_MASK(EC_PROCESS_DEVICE_REMOVE)) |
| 916 | #define KFD_EC_MASK_PACKET (KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_DIM_INVALID) | \ | ||
| 917 | KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_GROUP_SEGMENT_SIZE_INVALID) | \ | ||
| 918 | KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_CODE_INVALID) | \ | ||
| 919 | KFD_EC_MASK(EC_QUEUE_PACKET_RESERVED) | \ | ||
| 920 | KFD_EC_MASK(EC_QUEUE_PACKET_UNSUPPORTED) | \ | ||
| 921 | KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_WORK_GROUP_SIZE_INVALID) | \ | ||
| 922 | KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_REGISTER_INVALID) | \ | ||
| 923 | KFD_EC_MASK(EC_QUEUE_PACKET_VENDOR_UNSUPPORTED)) | ||
| 916 | 924 | ||
| 917 | /* Checks for exception code types for KFD search */ | 925 | /* Checks for exception code types for KFD search */ |
| 926 | #define KFD_DBG_EC_IS_VALID(ecode) (ecode > EC_NONE && ecode < EC_MAX) | ||
| 918 | #define KFD_DBG_EC_TYPE_IS_QUEUE(ecode) \ | 927 | #define KFD_DBG_EC_TYPE_IS_QUEUE(ecode) \ |
| 919 | (!!(KFD_EC_MASK(ecode) & KFD_EC_MASK_QUEUE)) | 928 | (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_QUEUE)) |
| 920 | #define KFD_DBG_EC_TYPE_IS_DEVICE(ecode) \ | 929 | #define KFD_DBG_EC_TYPE_IS_DEVICE(ecode) \ |
| 921 | (!!(KFD_EC_MASK(ecode) & KFD_EC_MASK_DEVICE)) | 930 | (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_DEVICE)) |
| 922 | #define KFD_DBG_EC_TYPE_IS_PROCESS(ecode) \ | 931 | #define KFD_DBG_EC_TYPE_IS_PROCESS(ecode) \ |
| 923 | (!!(KFD_EC_MASK(ecode) & KFD_EC_MASK_PROCESS)) | 932 | (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_PROCESS)) |
| 933 | #define KFD_DBG_EC_TYPE_IS_PACKET(ecode) \ | ||
| 934 | (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_PACKET)) | ||
| 924 | 935 | ||
| 925 | 936 | ||
| 926 | /* Runtime enable states */ | 937 | /* Runtime enable states */ |
| @@ -382,7 +382,7 @@ struct mpi3mr_bsg_in_reply_buf { · 381 unmodified lines | |||
| 382 | __u8 mpi_reply_type; | 382 | __u8 mpi_reply_type; |
| 383 | __u8 rsvd1; | 383 | __u8 rsvd1; |
| 384 | __u16 rsvd2; | 384 | __u16 rsvd2; |
| 385 | __u8 reply_buf[1]; | 385 | __u8 reply_buf[]; |
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 388 | /** | 388 | /** |
| @@ -328,6 +328,7 @@ struct ufs_pwr_mode_info { · 327 unmodified lines | |||
| 328 | * @op_runtime_config: called to config Operation and runtime regs Pointers | 328 | * @op_runtime_config: called to config Operation and runtime regs Pointers |
| 329 | * @get_outstanding_cqs: called to get outstanding completion queues | 329 | * @get_outstanding_cqs: called to get outstanding completion queues |
| 330 | * @config_esi: called to config Event Specific Interrupt | 330 | * @config_esi: called to config Event Specific Interrupt |
| 331 | * @config_scsi_dev: called to configure SCSI device parameters | ||
| 331 | */ | 332 | */ |
| 332 | struct ufs_hba_variant_ops { | 333 | struct ufs_hba_variant_ops { |
| 333 | const char *name; | 334 | const char *name; |
| @@ -682,7 +682,7 @@ static void __init populate_initrd_image(char *err) · 681 unmodified lines | |||
| 682 | 682 | ||
| 683 | printk(KERN_INFO "rootfs image is not initramfs (%s); looks like an initrd\n", | 683 | printk(KERN_INFO "rootfs image is not initramfs (%s); looks like an initrd\n", |
| 684 | err); | 684 | err); |
| 685 | file = filp_open("/initrd.image", O_WRONLY | O_CREAT, 0700); | 685 | file = filp_open("/initrd.image", O_WRONLY|O_CREAT|O_LARGEFILE, 0700); |
| 686 | if (IS_ERR(file)) | 686 | if (IS_ERR(file)) |
| 687 | return; | 687 | return; |
| 688 | 688 | ||
| @@ -4,7 +4,7 @@ ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y) · 3 unmodified lines | |||
| 4 | # ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details | 4 | # ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details |
| 5 | cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse | 5 | cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse |
| 6 | endif | 6 | endif |
| 7 | CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy) | 7 | CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy) |
| 8 | 8 | ||
| 9 | obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o | 9 | obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o |
| 10 | obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o | 10 | obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o |
| @@ -38,7 +38,7 @@ · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | /* number of bytes addressable by LDX/STX insn with 16-bit 'off' field */ | 39 | /* number of bytes addressable by LDX/STX insn with 16-bit 'off' field */ |
| 40 | #define GUARD_SZ (1ull << sizeof(((struct bpf_insn *)0)->off) * 8) | 40 | #define GUARD_SZ (1ull << sizeof(((struct bpf_insn *)0)->off) * 8) |
| 41 | #define KERN_VM_SZ ((1ull << 32) + GUARD_SZ) | 41 | #define KERN_VM_SZ (SZ_4G + GUARD_SZ) |
| 42 | 42 | ||
| 43 | struct bpf_arena { | 43 | struct bpf_arena { |
| 44 | struct bpf_map map; | 44 | struct bpf_map map; |
| @@ -110,7 +110,7 @@ static struct bpf_map *arena_map_alloc(union bpf_attr *attr) · 65 unmodified lines | |||
| 110 | return ERR_PTR(-EINVAL); | 110 | return ERR_PTR(-EINVAL); |
| 111 | 111 | ||
| 112 | vm_range = (u64)attr->max_entries * PAGE_SIZE; | 112 | vm_range = (u64)attr->max_entries * PAGE_SIZE; |
| 113 | if (vm_range > (1ull << 32)) | 113 | if (vm_range > SZ_4G) |
| 114 | return ERR_PTR(-E2BIG); | 114 | return ERR_PTR(-E2BIG); |
| 115 | 115 | ||
| 116 | if ((attr->map_extra >> 32) != ((attr->map_extra + vm_range - 1) >> 32)) | 116 | if ((attr->map_extra >> 32) != ((attr->map_extra + vm_range - 1) >> 32)) |
| @@ -301,7 +301,7 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long ad · 184 unmodified lines | |||
| 301 | 301 | ||
| 302 | if (pgoff) | 302 | if (pgoff) |
| 303 | return -EINVAL; | 303 | return -EINVAL; |
| 304 | if (len > (1ull << 32)) | 304 | if (len > SZ_4G) |
| 305 | return -E2BIG; | 305 | return -E2BIG; |
| 306 | 306 | ||
| 307 | /* if user_vm_start was specified at arena creation time */ | 307 | /* if user_vm_start was specified at arena creation time */ |
| @@ -322,7 +322,7 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long ad · 14 unmodified lines | |||
| 322 | if (WARN_ON_ONCE(arena->user_vm_start)) | 322 | if (WARN_ON_ONCE(arena->user_vm_start)) |
| 323 | /* checks at map creation time should prevent this */ | 323 | /* checks at map creation time should prevent this */ |
| 324 | return -EFAULT; | 324 | return -EFAULT; |
| 325 | return round_up(ret, 1ull << 32); | 325 | return round_up(ret, SZ_4G); |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | static int arena_map_mmap(struct bpf_map *map, struct vm_area_struct *vma) | 328 | static int arena_map_mmap(struct bpf_map *map, struct vm_area_struct *vma) |
| @@ -346,7 +346,7 @@ static int arena_map_mmap(struct bpf_map *map, struct vm_area_struct *vma) · 17 unmodified lines | |||
| 346 | return -EBUSY; | 346 | return -EBUSY; |
| 347 | 347 | ||
| 348 | /* Earlier checks should prevent this */ | 348 | /* Earlier checks should prevent this */ |
| 349 | if (WARN_ON_ONCE(vma->vm_end - vma->vm_start > (1ull << 32) || vma->vm_pgoff)) | 349 | if (WARN_ON_ONCE(vma->vm_end - vma->vm_start > SZ_4G || vma->vm_pgoff)) |
| 350 | return -EFAULT; | 350 | return -EFAULT; |
| 351 | 351 | ||
| 352 | if (remember_vma(arena, vma)) | 352 | if (remember_vma(arena, vma)) |
| @@ -420,7 +420,7 @@ static long arena_alloc_pages(struct bpf_arena *arena, long uaddr, long page_cnt · 67 unmodified lines | |||
| 420 | if (uaddr & ~PAGE_MASK) | 420 | if (uaddr & ~PAGE_MASK) |
| 421 | return 0; | 421 | return 0; |
| 422 | pgoff = compute_pgoff(arena, uaddr); | 422 | pgoff = compute_pgoff(arena, uaddr); |
| 423 | if (pgoff + page_cnt > page_cnt_max) | 423 | if (pgoff > page_cnt_max - page_cnt) |
| 424 | /* requested address will be outside of user VMA */ | 424 | /* requested address will be outside of user VMA */ |
| 425 | return 0; | 425 | return 0; |
| 426 | } | 426 | } |
| @@ -447,7 +447,13 @@ static long arena_alloc_pages(struct bpf_arena *arena, long uaddr, long page_cnt · 20 unmodified lines | |||
| 447 | goto out; | 447 | goto out; |
| 448 | 448 | ||
| 449 | uaddr32 = (u32)(arena->user_vm_start + pgoff * PAGE_SIZE); | 449 | uaddr32 = (u32)(arena->user_vm_start + pgoff * PAGE_SIZE); |
| 450 | /* Earlier checks make sure that uaddr32 + page_cnt * PAGE_SIZE will not overflow 32-bit */ | 450 | /* Earlier checks made sure that uaddr32 + page_cnt * PAGE_SIZE - 1 |
| 451 | * will not overflow 32-bit. Lower 32-bit need to represent | ||
| 452 | * contiguous user address range. | ||
| 453 | * Map these pages at kern_vm_start base. | ||
| 454 | * kern_vm_start + uaddr32 + page_cnt * PAGE_SIZE - 1 can overflow | ||
| 455 | * lower 32-bit and it's ok. | ||
| 456 | */ | ||
| 451 | ret = vm_area_map_pages(arena->kern_vm, kern_vm_start + uaddr32, | 457 | ret = vm_area_map_pages(arena->kern_vm, kern_vm_start + uaddr32, |
| 452 | kern_vm_start + uaddr32 + page_cnt * PAGE_SIZE, pages); | 458 | kern_vm_start + uaddr32 + page_cnt * PAGE_SIZE, pages); |
| 453 | if (ret) { | 459 | if (ret) { |
| @@ -510,6 +516,11 @@ static void arena_free_pages(struct bpf_arena *arena, long uaddr, long page_cnt) · 56 unmodified lines | |||
| 510 | if (!page) | 516 | if (!page) |
| 511 | continue; | 517 | continue; |
| 512 | if (page_cnt == 1 && page_mapped(page)) /* mapped by some user process */ | 518 | if (page_cnt == 1 && page_mapped(page)) /* mapped by some user process */ |
| 519 | /* Optimization for the common case of page_cnt==1: | ||
| 520 | * If page wasn't mapped into some user vma there | ||
| 521 | * is no need to call zap_pages which is slow. When | ||
| 522 | * page_cnt is big it's faster to do the batched zap. | ||
| 523 | */ | ||
| 513 | zap_pages(arena, full_uaddr, 1); | 524 | zap_pages(arena, full_uaddr, 1); |
| 514 | vm_area_unmap_pages(arena->kern_vm, kaddr, kaddr + PAGE_SIZE); | 525 | vm_area_unmap_pages(arena->kern_vm, kaddr, kaddr + PAGE_SIZE); |
| 515 | __free_page(page); | 526 | __free_page(page); |
| @@ -80,6 +80,18 @@ static int bloom_map_get_next_key(struct bpf_map *map, void *key, void *next_key · 79 unmodified lines | |||
| 80 | return -EOPNOTSUPP; | 80 | return -EOPNOTSUPP; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | /* Called from syscall */ | ||
| 84 | static int bloom_map_alloc_check(union bpf_attr *attr) | ||
| 85 | { | ||
| 86 | if (attr->value_size > KMALLOC_MAX_SIZE) | ||
| 87 | /* if value_size is bigger, the user space won't be able to | ||
| 88 | * access the elements. | ||
| 89 | */ | ||
| 90 | return -E2BIG; | ||
| 91 | |||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 83 | static struct bpf_map *bloom_map_alloc(union bpf_attr *attr) | 95 | static struct bpf_map *bloom_map_alloc(union bpf_attr *attr) |
| 84 | { | 96 | { |
| 85 | u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits; | 97 | u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits; |
| @@ -191,6 +203,7 @@ static u64 bloom_map_mem_usage(const struct bpf_map *map) · 105 unmodified lines | |||
| 191 | BTF_ID_LIST_SINGLE(bpf_bloom_map_btf_ids, struct, bpf_bloom_filter) | 203 | BTF_ID_LIST_SINGLE(bpf_bloom_map_btf_ids, struct, bpf_bloom_filter) |
| 192 | const struct bpf_map_ops bloom_filter_map_ops = { | 204 | const struct bpf_map_ops bloom_filter_map_ops = { |
| 193 | .map_meta_equal = bpf_map_meta_equal, | 205 | .map_meta_equal = bpf_map_meta_equal, |
| 206 | .map_alloc_check = bloom_map_alloc_check, | ||
| 194 | .map_alloc = bloom_map_alloc, | 207 | .map_alloc = bloom_map_alloc, |
| 195 | .map_free = bloom_map_free, | 208 | .map_free = bloom_map_free, |
| 196 | .map_get_next_key = bloom_map_get_next_key, | 209 | .map_get_next_key = bloom_map_get_next_key, |
| @@ -2548,7 +2548,7 @@ __bpf_kfunc void bpf_throw(u64 cookie) · 2547 unmodified lines | |||
| 2548 | __bpf_kfunc_end_defs(); | 2548 | __bpf_kfunc_end_defs(); |
| 2549 | 2549 | ||
| 2550 | BTF_KFUNCS_START(generic_btf_ids) | 2550 | BTF_KFUNCS_START(generic_btf_ids) |
| 2551 | #ifdef CONFIG_KEXEC_CORE | 2551 | #ifdef CONFIG_CRASH_DUMP |
| 2552 | BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE) | 2552 | BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE) |
| 2553 | #endif | 2553 | #endif |
| 2554 | BTF_ID_FLAGS(func, bpf_obj_new_impl, KF_ACQUIRE | KF_RET_NULL) | 2554 | BTF_ID_FLAGS(func, bpf_obj_new_impl, KF_ACQUIRE | KF_RET_NULL) |
| @@ -5682,6 +5682,13 @@ static bool is_flow_key_reg(struct bpf_verifier_env *env, int regno) · 5681 unmodified lines | |||
| 5682 | return reg->type == PTR_TO_FLOW_KEYS; | 5682 | return reg->type == PTR_TO_FLOW_KEYS; |
| 5683 | } | 5683 | } |
| 5684 | 5684 | ||
| 5685 | static bool is_arena_reg(struct bpf_verifier_env *env, int regno) | ||
| 5686 | { | ||
| 5687 | const struct bpf_reg_state *reg = reg_state(env, regno); | ||
| 5688 | |||
| 5689 | return reg->type == PTR_TO_ARENA; | ||
| 5690 | } | ||
| 5691 | |||
| 5685 | static u32 *reg2btf_ids[__BPF_REG_TYPE_MAX] = { | 5692 | static u32 *reg2btf_ids[__BPF_REG_TYPE_MAX] = { |
| 5686 | #ifdef CONFIG_NET | 5693 | #ifdef CONFIG_NET |
| 5687 | [PTR_TO_SOCKET] = &btf_sock_ids[BTF_SOCK_TYPE_SOCK], | 5694 | [PTR_TO_SOCKET] = &btf_sock_ids[BTF_SOCK_TYPE_SOCK], |
| @@ -6694,6 +6701,11 @@ static int check_stack_access_within_bounds( · 1006 unmodified lines | |||
| 6694 | err = check_stack_slot_within_bounds(env, min_off, state, type); | 6701 | err = check_stack_slot_within_bounds(env, min_off, state, type); |
| 6695 | if (!err && max_off > 0) | 6702 | if (!err && max_off > 0) |
| 6696 | err = -EINVAL; /* out of stack access into non-negative offsets */ | 6703 | err = -EINVAL; /* out of stack access into non-negative offsets */ |
| 6704 | if (!err && access_size < 0) | ||
| 6705 | /* access_size should not be negative (or overflow an int); others checks | ||
| 6706 | * along the way should have prevented such an access. | ||
| 6707 | */ | ||
| 6708 | err = -EFAULT; /* invalid negative access size; integer overflow? */ | ||
| 6697 | 6709 | ||
| 6698 | if (err) { | 6710 | if (err) { |
| 6699 | if (tnum_is_const(reg->var_off)) { | 6711 | if (tnum_is_const(reg->var_off)) { |
| @@ -7019,7 +7031,8 @@ static int check_atomic(struct bpf_verifier_env *env, int insn_idx, struct bpf_i · 319 unmodified lines | |||
| 7019 | if (is_ctx_reg(env, insn->dst_reg) || | 7031 | if (is_ctx_reg(env, insn->dst_reg) || |
| 7020 | is_pkt_reg(env, insn->dst_reg) || | 7032 | is_pkt_reg(env, insn->dst_reg) || |
| 7021 | is_flow_key_reg(env, insn->dst_reg) || | 7033 | is_flow_key_reg(env, insn->dst_reg) || |
| 7022 | is_sk_reg(env, insn->dst_reg)) { | 7034 | is_sk_reg(env, insn->dst_reg) || |
| 7035 | is_arena_reg(env, insn->dst_reg)) { | ||
| 7023 | verbose(env, "BPF_ATOMIC stores into R%d %s is not allowed\n", | 7036 | verbose(env, "BPF_ATOMIC stores into R%d %s is not allowed\n", |
| 7024 | insn->dst_reg, | 7037 | insn->dst_reg, |
| 7025 | reg_type_str(env, reg_state(env, insn->dst_reg)->type)); | 7038 | reg_type_str(env, reg_state(env, insn->dst_reg)->type)); |
| @@ -14014,6 +14027,10 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) · 6988 unmodified lines | |||
| 14014 | verbose(env, "addr_space_cast insn can only convert between address space 1 and 0\n"); | 14027 | verbose(env, "addr_space_cast insn can only convert between address space 1 and 0\n"); |
| 14015 | return -EINVAL; | 14028 | return -EINVAL; |
| 14016 | } | 14029 | } |
| 14030 | if (!env->prog->aux->arena) { | ||
| 14031 | verbose(env, "addr_space_cast insn can only be used in a program that has an associated arena\n"); | ||
| 14032 | return -EINVAL; | ||
| 14033 | } | ||
| 14017 | } else { | 14034 | } else { |
| 14018 | if ((insn->off != 0 && insn->off != 8 && insn->off != 16 && | 14035 | if ((insn->off != 0 && insn->off != 8 && insn->off != 16 && |
| 14019 | insn->off != 32) || insn->imm) { | 14036 | insn->off != 32) || insn->imm) { |
| @@ -14046,8 +14063,11 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) · 26 unmodified lines | |||
| 14046 | if (insn->imm) { | 14063 | if (insn->imm) { |
| 14047 | /* off == BPF_ADDR_SPACE_CAST */ | 14064 | /* off == BPF_ADDR_SPACE_CAST */ |
| 14048 | mark_reg_unknown(env, regs, insn->dst_reg); | 14065 | mark_reg_unknown(env, regs, insn->dst_reg); |
| 14049 | if (insn->imm == 1) /* cast from as(1) to as(0) */ | 14066 | if (insn->imm == 1) { /* cast from as(1) to as(0) */ |
| 14050 | dst_reg->type = PTR_TO_ARENA; | 14067 | dst_reg->type = PTR_TO_ARENA; |
| 14068 | /* PTR_TO_ARENA is 32-bit */ | ||
| 14069 | dst_reg->subreg_def = env->insn_idx + 1; | ||
| 14070 | } | ||
| 14051 | } else if (insn->off == 0) { | 14071 | } else if (insn->off == 0) { |
| 14052 | /* case: R1 = R2 | 14072 | /* case: R1 = R2 |
| 14053 | * copy register state to dest reg | 14073 | * copy register state to dest reg |
| @@ -19601,8 +19621,9 @@ static int do_misc_fixups(struct bpf_verifier_env *env) · 5547 unmodified lines | |||
| 19601 | (((struct bpf_map *)env->prog->aux->arena)->map_flags & BPF_F_NO_USER_CONV)) { | 19621 | (((struct bpf_map *)env->prog->aux->arena)->map_flags & BPF_F_NO_USER_CONV)) { |
| 19602 | /* convert to 32-bit mov that clears upper 32-bit */ | 19622 | /* convert to 32-bit mov that clears upper 32-bit */ |
| 19603 | insn->code = BPF_ALU | BPF_MOV | BPF_X; | 19623 | insn->code = BPF_ALU | BPF_MOV | BPF_X; |
| 19604 | /* clear off, so it's a normal 'wX = wY' from JIT pov */ | 19624 | /* clear off and imm, so it's a normal 'wX = wY' from JIT pov */ |
| 19605 | insn->off = 0; | 19625 | insn->off = 0; |
| 19626 | insn->imm = 0; | ||
| 19606 | } /* cast from as(0) to as(1) should be handled by JIT */ | 19627 | } /* cast from as(0) to as(1) should be handled by JIT */ |
| 19607 | goto next_insn; | 19628 | goto next_insn; |
| 19608 | } | 19629 | } |
| @@ -366,7 +366,9 @@ static int __init reserve_crashkernel_low(unsigned long long low_size) · 365 unmodified lines | |||
| 366 | 366 | ||
| 367 | crashk_low_res.start = low_base; | 367 | crashk_low_res.start = low_base; |
| 368 | crashk_low_res.end = low_base + low_size - 1; | 368 | crashk_low_res.end = low_base + low_size - 1; |
| 369 | #ifdef HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY | ||
| 369 | insert_resource(&iomem_resource, &crashk_low_res); | 370 | insert_resource(&iomem_resource, &crashk_low_res); |
| 371 | #endif | ||
| 370 | #endif | 372 | #endif |
| 371 | return 0; | 373 | return 0; |
| 372 | } | 374 | } |
| @@ -448,8 +450,12 @@ retry: · 75 unmodified lines | |||
| 448 | 450 | ||
| 449 | crashk_res.start = crash_base; | 451 | crashk_res.start = crash_base; |
| 450 | crashk_res.end = crash_base + crash_size - 1; | 452 | crashk_res.end = crash_base + crash_size - 1; |
| 453 | #ifdef HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY | ||
| 454 | insert_resource(&iomem_resource, &crashk_res); | ||
| 455 | #endif | ||
| 451 | } | 456 | } |
| 452 | 457 | ||
| 458 | #ifndef HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY | ||
| 453 | static __init int insert_crashkernel_resources(void) | 459 | static __init int insert_crashkernel_resources(void) |
| 454 | { | 460 | { |
| 455 | if (crashk_res.start < crashk_res.end) | 461 | if (crashk_res.start < crashk_res.end) |
| @@ -462,3 +468,4 @@ static __init int insert_crashkernel_resources(void) · 6 unmodified lines | |||
| 462 | } | 468 | } |
| 463 | early_initcall(insert_crashkernel_resources); | 469 | early_initcall(insert_crashkernel_resources); |
| 464 | #endif | 470 | #endif |
| 471 | #endif | ||
| @@ -1643,8 +1643,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) · 1642 unmodified lines | |||
| 1643 | } | 1643 | } |
| 1644 | 1644 | ||
| 1645 | if (!((old->flags & new->flags) & IRQF_SHARED) || | 1645 | if (!((old->flags & new->flags) & IRQF_SHARED) || |
| 1646 | (oldtype != (new->flags & IRQF_TRIGGER_MASK)) || | 1646 | (oldtype != (new->flags & IRQF_TRIGGER_MASK))) |
| 1647 | ((old->flags ^ new->flags) & IRQF_ONESHOT)) | 1647 | goto mismatch; |
| 1648 | |||
| 1649 | if ((old->flags & IRQF_ONESHOT) && | ||
| 1650 | (new->flags & IRQF_COND_ONESHOT)) | ||
| 1651 | new->flags |= IRQF_ONESHOT; | ||
| 1652 | else if ((old->flags ^ new->flags) & IRQF_ONESHOT) | ||
| 1648 | goto mismatch; | 1653 | goto mismatch; |
| 1649 | 1654 | ||
| 1650 | /* All handlers must agree on per-cpuness */ | 1655 | /* All handlers must agree on per-cpuness */ |
| @@ -236,6 +236,10 @@ choice · 235 unmodified lines | |||
| 236 | possible to load a signed module containing the algorithm to check | 236 | possible to load a signed module containing the algorithm to check |
| 237 | the signature on that module. | 237 | the signature on that module. |
| 238 | 238 | ||
| 239 | config MODULE_SIG_SHA1 | ||
| 240 | bool "Sign modules with SHA-1" | ||
| 241 | select CRYPTO_SHA1 | ||
| 242 | |||
| 239 | config MODULE_SIG_SHA256 | 243 | config MODULE_SIG_SHA256 |
| 240 | bool "Sign modules with SHA-256" | 244 | bool "Sign modules with SHA-256" |
| 241 | select CRYPTO_SHA256 | 245 | select CRYPTO_SHA256 |
| @@ -265,6 +269,7 @@ endchoice · 23 unmodified lines | |||
| 265 | config MODULE_SIG_HASH | 269 | config MODULE_SIG_HASH |
| 266 | string | 270 | string |
| 267 | depends on MODULE_SIG || IMA_APPRAISE_MODSIG | 271 | depends on MODULE_SIG || IMA_APPRAISE_MODSIG |
| 272 | default "sha1" if MODULE_SIG_SHA1 | ||
| 268 | default "sha256" if MODULE_SIG_SHA256 | 273 | default "sha256" if MODULE_SIG_SHA256 |
| 269 | default "sha384" if MODULE_SIG_SHA384 | 274 | default "sha384" if MODULE_SIG_SHA384 |
| 270 | default "sha512" if MODULE_SIG_SHA512 | 275 | default "sha512" if MODULE_SIG_SHA512 |
| @@ -2009,6 +2009,12 @@ static int console_trylock_spinning(void) · 2008 unmodified lines | |||
| 2009 | */ | 2009 | */ |
| 2010 | mutex_acquire(&console_lock_dep_map, 0, 1, _THIS_IP_); | 2010 | mutex_acquire(&console_lock_dep_map, 0, 1, _THIS_IP_); |
| 2011 | 2011 | ||
| 2012 | /* | ||
| 2013 | * Update @console_may_schedule for trylock because the previous | ||
| 2014 | * owner may have been schedulable. | ||
| 2015 | */ | ||
| 2016 | console_may_schedule = 0; | ||
| 2017 | |||
| 2012 | return 1; | 2018 | return 1; |
| 2013 | } | 2019 | } |
| 2014 | 2020 | ||
| @@ -2408,8 +2408,11 @@ static inline int prctl_set_mdwe(unsigned long bits, unsigned long arg3, · 2407 unmodified lines | |||
| 2408 | if (bits & PR_MDWE_NO_INHERIT && !(bits & PR_MDWE_REFUSE_EXEC_GAIN)) | 2408 | if (bits & PR_MDWE_NO_INHERIT && !(bits & PR_MDWE_REFUSE_EXEC_GAIN)) |
| 2409 | return -EINVAL; | 2409 | return -EINVAL; |
| 2410 | 2410 | ||
| 2411 | /* PARISC cannot allow mdwe as it needs writable stacks */ | 2411 | /* |
| 2412 | if (IS_ENABLED(CONFIG_PARISC)) | 2412 | * EOPNOTSUPP might be more appropriate here in principle, but |
| 2413 | * existing userspace depends on EINVAL specifically. | ||
| 2414 | */ | ||
| 2415 | if (!arch_memory_deny_write_exec_supported()) | ||
| 2413 | return -EINVAL; | 2416 | return -EINVAL; |
| 2414 | 2417 | ||
| 2415 | current_bits = get_current_mdwe(); | 2418 | current_bits = get_current_mdwe(); |
| @@ -129,15 +129,17 @@ static int posix_clock_open(struct inode *inode, struct file *fp) · 128 unmodified lines | |||
| 129 | goto out; | 129 | goto out; |
| 130 | } | 130 | } |
| 131 | pccontext->clk = clk; | 131 | pccontext->clk = clk; |
| 132 | fp->private_data = pccontext; | 132 | if (clk->ops.open) { |
| 133 | if (clk->ops.open) | ||
| 134 | err = clk->ops.open(pccontext, fp->f_mode); | 133 | err = clk->ops.open(pccontext, fp->f_mode); |
| 135 | else | 134 | if (err) { |
| 136 | err = 0; | 135 | kfree(pccontext); |
| 137 | 136 | goto out; | |
| 138 | if (!err) { | 137 | } |
| 139 | get_device(clk->dev); | ||
| 140 | } | 138 | } |
| 139 | |||
| 140 | fp->private_data = pccontext; | ||
| 141 | get_device(clk->dev); | ||
| 142 | err = 0; | ||
| 141 | out: | 143 | out: |
| 142 | up_read(&clk->rwsem); | 144 | up_read(&clk->rwsem); |
| 143 | return err; | 145 | return err; |
| @@ -839,7 +839,7 @@ out: · 838 unmodified lines | |||
| 839 | void store_trace_entry_data(void *edata, struct trace_probe *tp, struct pt_regs *regs) | 839 | void store_trace_entry_data(void *edata, struct trace_probe *tp, struct pt_regs *regs) |
| 840 | { | 840 | { |
| 841 | struct probe_entry_arg *earg = tp->entry_arg; | 841 | struct probe_entry_arg *earg = tp->entry_arg; |
| 842 | unsigned long val; | 842 | unsigned long val = 0; |
| 843 | int i; | 843 | int i; |
| 844 | 844 | ||
| 845 | if (!earg) | 845 | if (!earg) |
| @@ -29,8 +29,7 @@ KCOV_INSTRUMENT_mmzone.o := n · 28 unmodified lines | |||
| 29 | KCOV_INSTRUMENT_vmstat.o := n | 29 | KCOV_INSTRUMENT_vmstat.o := n |
| 30 | KCOV_INSTRUMENT_failslab.o := n | 30 | KCOV_INSTRUMENT_failslab.o := n |
| 31 | 31 | ||
| 32 | CFLAGS_init-mm.o += $(call cc-disable-warning, override-init) | 32 | CFLAGS_init-mm.o += -Wno-override-init |
| 33 | CFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides) | ||
| 34 | 33 | ||
| 35 | mmu-y := nommu.o | 34 | mmu-y := nommu.o |
| 36 | mmu-$(CONFIG_MMU) := highmem.o memory.o mincore.o \ | 35 | mmu-$(CONFIG_MMU) := highmem.o memory.o mincore.o \ |
| @@ -4197,7 +4197,23 @@ static void filemap_cachestat(struct address_space *mapping, · 4196 unmodified lines | |||
| 4197 | /* shmem file - in swap cache */ | 4197 | /* shmem file - in swap cache */ |
| 4198 | swp_entry_t swp = radix_to_swp_entry(folio); | 4198 | swp_entry_t swp = radix_to_swp_entry(folio); |
| 4199 | 4199 | ||
| 4200 | /* swapin error results in poisoned entry */ | ||
| 4201 | if (non_swap_entry(swp)) | ||
| 4202 | goto resched; | ||
| 4203 | |||
| 4204 | /* | ||
| 4205 | * Getting a swap entry from the shmem | ||
| 4206 | * inode means we beat | ||
| 4207 | * shmem_unuse(). rcu_read_lock() | ||
| 4208 | * ensures swapoff waits for us before | ||
| 4209 | * freeing the swapper space. However, | ||
| 4210 | * we can race with swapping and | ||
| 4211 | * invalidation, so there might not be | ||
| 4212 | * a shadow in the swapcache (yet). | ||
| 4213 | */ | ||
| 4200 | shadow = get_shadow_from_swap_cache(swp); | 4214 | shadow = get_shadow_from_swap_cache(swp); |
| 4215 | if (!shadow) | ||
| 4216 | goto resched; | ||
| 4201 | } | 4217 | } |
| 4202 | #endif | 4218 | #endif |
| 4203 | if (workingset_test_recent(shadow, true, &workingset)) | 4219 | if (workingset_test_recent(shadow, true, &workingset)) |
| @@ -1653,20 +1653,22 @@ long populate_vma_page_range(struct vm_area_struct *vma, · 1652 unmodified lines | |||
| 1653 | if (vma->vm_flags & VM_LOCKONFAULT) | 1653 | if (vma->vm_flags & VM_LOCKONFAULT) |
| 1654 | return nr_pages; | 1654 | return nr_pages; |
| 1655 | 1655 | ||
| 1656 | /* ... similarly, we've never faulted in PROT_NONE pages */ | ||
| 1657 | if (!vma_is_accessible(vma)) | ||
| 1658 | return -EFAULT; | ||
| 1659 | |||
| 1656 | gup_flags = FOLL_TOUCH; | 1660 | gup_flags = FOLL_TOUCH; |
| 1657 | /* | 1661 | /* |
| 1658 | * We want to touch writable mappings with a write fault in order | 1662 | * We want to touch writable mappings with a write fault in order |
| 1659 | * to break COW, except for shared mappings because these don't COW | 1663 | * to break COW, except for shared mappings because these don't COW |
| 1660 | * and we would not want to dirty them for nothing. | 1664 | * and we would not want to dirty them for nothing. |
| 1665 | * | ||
| 1666 | * Otherwise, do a read fault, and use FOLL_FORCE in case it's not | ||
| 1667 | * readable (ie write-only or executable). | ||
| 1661 | */ | 1668 | */ |
| 1662 | if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE) | 1669 | if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE) |
| 1663 | gup_flags |= FOLL_WRITE; | 1670 | gup_flags |= FOLL_WRITE; |
| 1664 | 1671 | else | |
| 1665 | /* | ||
| 1666 | * We want mlock to succeed for regions that have any permissions | ||
| 1667 | * other than PROT_NONE. | ||
| 1668 | */ | ||
| 1669 | if (vma_is_accessible(vma)) | ||
| 1670 | gup_flags |= FOLL_FORCE; | 1672 | gup_flags |= FOLL_FORCE; |
| 1671 | 1673 | ||
| 1672 | if (locked) | 1674 | if (locked) |
| @@ -1536,7 +1536,9 @@ static inline int zap_present_ptes(struct mmu_gather *tlb, · 1535 unmodified lines | |||
| 1536 | ptep_get_and_clear_full(mm, addr, pte, tlb->fullmm); | 1536 | ptep_get_and_clear_full(mm, addr, pte, tlb->fullmm); |
| 1537 | arch_check_zapped_pte(vma, ptent); | 1537 | arch_check_zapped_pte(vma, ptent); |
| 1538 | tlb_remove_tlb_entry(tlb, pte, addr); | 1538 | tlb_remove_tlb_entry(tlb, pte, addr); |
| 1539 | VM_WARN_ON_ONCE(userfaultfd_wp(vma)); | 1539 | if (userfaultfd_pte_wp(vma, ptent)) |
| 1540 | zap_install_uffd_wp_if_needed(vma, addr, pte, 1, | ||
| 1541 | details, ptent); | ||
| 1540 | ksm_might_unmap_zero_page(mm, ptent); | 1542 | ksm_might_unmap_zero_page(mm, ptent); |
| 1541 | return 1; | 1543 | return 1; |
| 1542 | } | 1544 | } |
| @@ -54,6 +54,22 @@ static depot_stack_handle_t early_handle; · 53 unmodified lines | |||
| 54 | 54 | ||
| 55 | static void init_early_allocated_pages(void); | 55 | static void init_early_allocated_pages(void); |
| 56 | 56 | ||
| 57 | static inline void set_current_in_page_owner(void) | ||
| 58 | { | ||
| 59 | /* | ||
| 60 | * Avoid recursion. | ||
| 61 | * | ||
| 62 | * We might need to allocate more memory from page_owner code, so make | ||
| 63 | * sure to signal it in order to avoid recursion. | ||
| 64 | */ | ||
| 65 | current->in_page_owner = 1; | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline void unset_current_in_page_owner(void) | ||
| 69 | { | ||
| 70 | current->in_page_owner = 0; | ||
| 71 | } | ||
| 72 | |||
| 57 | static int __init early_page_owner_param(char *buf) | 73 | static int __init early_page_owner_param(char *buf) |
| 58 | { | 74 | { |
| 59 | int ret = kstrtobool(buf, &page_owner_enabled); | 75 | int ret = kstrtobool(buf, &page_owner_enabled); |
| @@ -133,23 +149,16 @@ static noinline depot_stack_handle_t save_stack(gfp_t flags) · 73 unmodified lines | |||
| 133 | depot_stack_handle_t handle; | 149 | depot_stack_handle_t handle; |
| 134 | unsigned int nr_entries; | 150 | unsigned int nr_entries; |
| 135 | 151 | ||
| 136 | /* | ||
| 137 | * Avoid recursion. | ||
| 138 | * | ||
| 139 | * Sometimes page metadata allocation tracking requires more | ||
| 140 | * memory to be allocated: | ||
| 141 | * - when new stack trace is saved to stack depot | ||
| 142 | */ | ||
| 143 | if (current->in_page_owner) | 152 | if (current->in_page_owner) |
| 144 | return dummy_handle; | 153 | return dummy_handle; |
| 145 | current->in_page_owner = 1; | ||
| 146 | 154 | ||
| 155 | set_current_in_page_owner(); | ||
| 147 | nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 2); | 156 | nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 2); |
| 148 | handle = stack_depot_save(entries, nr_entries, flags); | 157 | handle = stack_depot_save(entries, nr_entries, flags); |
| 149 | if (!handle) | 158 | if (!handle) |
| 150 | handle = failure_handle; | 159 | handle = failure_handle; |
| 160 | unset_current_in_page_owner(); | ||
| 151 | 161 | ||
| 152 | current->in_page_owner = 0; | ||
| 153 | return handle; | 162 | return handle; |
| 154 | } | 163 | } |
| 155 | 164 | ||
| @@ -164,9 +173,13 @@ static void add_stack_record_to_list(struct stack_record *stack_record, · 8 unmodified lines | |||
| 164 | gfp_mask &= (GFP_ATOMIC | GFP_KERNEL); | 173 | gfp_mask &= (GFP_ATOMIC | GFP_KERNEL); |
| 165 | gfp_mask |= __GFP_NOWARN; | 174 | gfp_mask |= __GFP_NOWARN; |
| 166 | 175 | ||
| 176 | set_current_in_page_owner(); | ||
| 167 | stack = kmalloc(sizeof(*stack), gfp_mask); | 177 | stack = kmalloc(sizeof(*stack), gfp_mask); |
| 168 | if (!stack) | 178 | if (!stack) { |
| 179 | unset_current_in_page_owner(); | ||
| 169 | return; | 180 | return; |
| 181 | } | ||
| 182 | unset_current_in_page_owner(); | ||
| 170 | 183 | ||
| 171 | stack->stack_record = stack_record; | 184 | stack->stack_record = stack_record; |
| 172 | stack->next = NULL; | 185 | stack->next = NULL; |
| @@ -116,7 +116,7 @@ static int shmem_free_file_info(struct super_block *sb, int type) · 115 unmodified lines | |||
| 116 | static int shmem_get_next_id(struct super_block *sb, struct kqid *qid) | 116 | static int shmem_get_next_id(struct super_block *sb, struct kqid *qid) |
| 117 | { | 117 | { |
| 118 | struct mem_dqinfo *info = sb_dqinfo(sb, qid->type); | 118 | struct mem_dqinfo *info = sb_dqinfo(sb, qid->type); |
| 119 | struct rb_node *node = ((struct rb_root *)info->dqi_priv)->rb_node; | 119 | struct rb_node *node; |
| 120 | qid_t id = from_kqid(&init_user_ns, *qid); | 120 | qid_t id = from_kqid(&init_user_ns, *qid); |
| 121 | struct quota_info *dqopt = sb_dqopt(sb); | 121 | struct quota_info *dqopt = sb_dqopt(sb); |
| 122 | struct quota_id *entry = NULL; | 122 | struct quota_id *entry = NULL; |
| @@ -126,6 +126,7 @@ static int shmem_get_next_id(struct super_block *sb, struct kqid *qid) · 3 unmodified lines | |||
| 126 | return -ESRCH; | 126 | return -ESRCH; |
| 127 | 127 | ||
| 128 | down_read(&dqopt->dqio_sem); | 128 | down_read(&dqopt->dqio_sem); |
| 129 | node = ((struct rb_root *)info->dqi_priv)->rb_node; | ||
| 129 | while (node) { | 130 | while (node) { |
| 130 | entry = rb_entry(node, struct quota_id, node); | 131 | entry = rb_entry(node, struct quota_id, node); |
| 131 | 132 | ||
| @@ -165,7 +166,7 @@ out_unlock: · 33 unmodified lines | |||
| 165 | static int shmem_acquire_dquot(struct dquot *dquot) | 166 | static int shmem_acquire_dquot(struct dquot *dquot) |
| 166 | { | 167 | { |
| 167 | struct mem_dqinfo *info = sb_dqinfo(dquot->dq_sb, dquot->dq_id.type); | 168 | struct mem_dqinfo *info = sb_dqinfo(dquot->dq_sb, dquot->dq_id.type); |
| 168 | struct rb_node **n = &((struct rb_root *)info->dqi_priv)->rb_node; | 169 | struct rb_node **n; |
| 169 | struct shmem_sb_info *sbinfo = dquot->dq_sb->s_fs_info; | 170 | struct shmem_sb_info *sbinfo = dquot->dq_sb->s_fs_info; |
| 170 | struct rb_node *parent = NULL, *new_node = NULL; | 171 | struct rb_node *parent = NULL, *new_node = NULL; |
| 171 | struct quota_id *new_entry, *entry; | 172 | struct quota_id *new_entry, *entry; |
| @@ -176,6 +177,8 @@ static int shmem_acquire_dquot(struct dquot *dquot) · 4 unmodified lines | |||
| 176 | mutex_lock(&dquot->dq_lock); | 177 | mutex_lock(&dquot->dq_lock); |
| 177 | 178 | ||
| 178 | down_write(&dqopt->dqio_sem); | 179 | down_write(&dqopt->dqio_sem); |
| 180 | n = &((struct rb_root *)info->dqi_priv)->rb_node; | ||
| 181 | |||
| 179 | while (*n) { | 182 | while (*n) { |
| 180 | parent = *n; | 183 | parent = *n; |
| 181 | entry = rb_entry(parent, struct quota_id, node); | 184 | entry = rb_entry(parent, struct quota_id, node); |
| @@ -264,7 +267,7 @@ static bool shmem_is_empty_dquot(struct dquot *dquot) · 82 unmodified lines | |||
| 264 | static int shmem_release_dquot(struct dquot *dquot) | 267 | static int shmem_release_dquot(struct dquot *dquot) |
| 265 | { | 268 | { |
| 266 | struct mem_dqinfo *info = sb_dqinfo(dquot->dq_sb, dquot->dq_id.type); | 269 | struct mem_dqinfo *info = sb_dqinfo(dquot->dq_sb, dquot->dq_id.type); |
| 267 | struct rb_node *node = ((struct rb_root *)info->dqi_priv)->rb_node; | 270 | struct rb_node *node; |
| 268 | qid_t id = from_kqid(&init_user_ns, dquot->dq_id); | 271 | qid_t id = from_kqid(&init_user_ns, dquot->dq_id); |
| 269 | struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); | 272 | struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); |
| 270 | struct quota_id *entry = NULL; | 273 | struct quota_id *entry = NULL; |
| @@ -275,6 +278,7 @@ static int shmem_release_dquot(struct dquot *dquot) · 4 unmodified lines | |||
| 275 | goto out_dqlock; | 278 | goto out_dqlock; |
| 276 | 279 | ||
| 277 | down_write(&dqopt->dqio_sem); | 280 | down_write(&dqopt->dqio_sem); |
| 281 | node = ((struct rb_root *)info->dqi_priv)->rb_node; | ||
| 278 | while (node) { | 282 | while (node) { |
| 279 | entry = rb_entry(node, struct quota_id, node); | 283 | entry = rb_entry(node, struct quota_id, node); |
| 280 | 284 | ||
| @@ -1444,7 +1444,8 @@ static int uffd_move_lock(struct mm_struct *mm, · 1443 unmodified lines | |||
| 1444 | */ | 1444 | */ |
| 1445 | down_read(&(*dst_vmap)->vm_lock->lock); | 1445 | down_read(&(*dst_vmap)->vm_lock->lock); |
| 1446 | if (*dst_vmap != *src_vmap) | 1446 | if (*dst_vmap != *src_vmap) |
| 1447 | down_read(&(*src_vmap)->vm_lock->lock); | 1447 | down_read_nested(&(*src_vmap)->vm_lock->lock, |
| 1448 | SINGLE_DEPTH_NESTING); | ||
| 1448 | } | 1449 | } |
| 1449 | mmap_read_unlock(mm); | 1450 | mmap_read_unlock(mm); |
| 1450 | return err; | 1451 | return err; |
| @@ -1080,7 +1080,17 @@ static void zswap_decompress(struct zswap_entry *entry, struct page *page) · 1079 unmodified lines | |||
| 1080 | mutex_lock(&acomp_ctx->mutex); | 1080 | mutex_lock(&acomp_ctx->mutex); |
| 1081 | 1081 | ||
| 1082 | src = zpool_map_handle(zpool, entry->handle, ZPOOL_MM_RO); | 1082 | src = zpool_map_handle(zpool, entry->handle, ZPOOL_MM_RO); |
| 1083 | if (acomp_ctx->is_sleepable && !zpool_can_sleep_mapped(zpool)) { | 1083 | /* |
| 1084 | * If zpool_map_handle is atomic, we cannot reliably utilize its mapped buffer | ||
| 1085 | * to do crypto_acomp_decompress() which might sleep. In such cases, we must | ||
| 1086 | * resort to copying the buffer to a temporary one. | ||
| 1087 | * Meanwhile, zpool_map_handle() might return a non-linearly mapped buffer, | ||
| 1088 | * such as a kmap address of high memory or even ever a vmap address. | ||
| 1089 | * However, sg_init_one is only equipped to handle linearly mapped low memory. | ||
| 1090 | * In such cases, we also must copy the buffer to a temporary and lowmem one. | ||
| 1091 | */ | ||
| 1092 | if ((acomp_ctx->is_sleepable && !zpool_can_sleep_mapped(zpool)) || | ||
| 1093 | !virt_addr_valid(src)) { | ||
| 1084 | memcpy(acomp_ctx->buffer, src, entry->length); | 1094 | memcpy(acomp_ctx->buffer, src, entry->length); |
| 1085 | src = acomp_ctx->buffer; | 1095 | src = acomp_ctx->buffer; |
| 1086 | zpool_unmap_handle(zpool, entry->handle); | 1096 | zpool_unmap_handle(zpool, entry->handle); |
| @@ -1094,7 +1104,7 @@ static void zswap_decompress(struct zswap_entry *entry, struct page *page) · 7 unmodified lines | |||
| 1094 | BUG_ON(acomp_ctx->req->dlen != PAGE_SIZE); | 1104 | BUG_ON(acomp_ctx->req->dlen != PAGE_SIZE); |
| 1095 | mutex_unlock(&acomp_ctx->mutex); | 1105 | mutex_unlock(&acomp_ctx->mutex); |
| 1096 | 1106 | ||
| 1097 | if (!acomp_ctx->is_sleepable || zpool_can_sleep_mapped(zpool)) | 1107 | if (src != acomp_ctx->buffer) |
| 1098 | zpool_unmap_handle(zpool, entry->handle); | 1108 | zpool_unmap_handle(zpool, entry->handle); |
| 1099 | } | 1109 | } |
| 1100 | 1110 | ||
| @@ -1313,6 +1323,14 @@ static unsigned long zswap_shrinker_count(struct shrinker *shrinker, · 212 unmodified lines | |||
| 1313 | if (!zswap_shrinker_enabled || !mem_cgroup_zswap_writeback_enabled(memcg)) | 1323 | if (!zswap_shrinker_enabled || !mem_cgroup_zswap_writeback_enabled(memcg)) |
| 1314 | return 0; | 1324 | return 0; |
| 1315 | 1325 | ||
| 1326 | /* | ||
| 1327 | * The shrinker resumes swap writeback, which will enter block | ||
| 1328 | * and may enter fs. XXX: Harmonize with vmscan.c __GFP_FS | ||
| 1329 | * rules (may_enter_fs()), which apply on a per-folio basis. | ||
| 1330 | */ | ||
| 1331 | if (!gfp_has_io_fs(sc->gfp_mask)) | ||
| 1332 | return 0; | ||
| 1333 | |||
| 1316 | #ifdef CONFIG_MEMCG_KMEM | 1334 | #ifdef CONFIG_MEMCG_KMEM |
| 1317 | mem_cgroup_flush_stats(memcg); | 1335 | mem_cgroup_flush_stats(memcg); |
| 1318 | nr_backing = memcg_page_state(memcg, MEMCG_ZSWAP_B) >> PAGE_SHIFT; | 1336 | nr_backing = memcg_page_state(memcg, MEMCG_ZSWAP_B) >> PAGE_SHIFT; |
| @@ -1618,6 +1636,7 @@ bool zswap_load(struct folio *folio) · 299 unmodified lines | |||
| 1618 | swp_entry_t swp = folio->swap; | 1636 | swp_entry_t swp = folio->swap; |
| 1619 | pgoff_t offset = swp_offset(swp); | 1637 | pgoff_t offset = swp_offset(swp); |
| 1620 | struct page *page = &folio->page; | 1638 | struct page *page = &folio->page; |
| 1639 | bool swapcache = folio_test_swapcache(folio); | ||
| 1621 | struct zswap_tree *tree = swap_zswap_tree(swp); | 1640 | struct zswap_tree *tree = swap_zswap_tree(swp); |
| 1622 | struct zswap_entry *entry; | 1641 | struct zswap_entry *entry; |
| 1623 | u8 *dst; | 1642 | u8 *dst; |
| @@ -1630,7 +1649,20 @@ bool zswap_load(struct folio *folio) · 6 unmodified lines | |||
| 1630 | spin_unlock(&tree->lock); | 1649 | spin_unlock(&tree->lock); |
| 1631 | return false; | 1650 | return false; |
| 1632 | } | 1651 | } |
| 1633 | zswap_rb_erase(&tree->rbroot, entry); | 1652 | /* |
| 1653 | * When reading into the swapcache, invalidate our entry. The | ||
| 1654 | * swapcache can be the authoritative owner of the page and | ||
| 1655 | * its mappings, and the pressure that results from having two | ||
| 1656 | * in-memory copies outweighs any benefits of caching the | ||
| 1657 | * compression work. | ||
| 1658 | * | ||
| 1659 | * (Most swapins go through the swapcache. The notable | ||
| 1660 | * exception is the singleton fault on SWP_SYNCHRONOUS_IO | ||
| 1661 | * files, which reads into a private page and may free it if | ||
| 1662 | * the fault fails. We remain the primary owner of the entry.) | ||
| 1663 | */ | ||
| 1664 | if (swapcache) | ||
| 1665 | zswap_rb_erase(&tree->rbroot, entry); | ||
| 1634 | spin_unlock(&tree->lock); | 1666 | spin_unlock(&tree->lock); |
| 1635 | 1667 | ||
| 1636 | if (entry->length) | 1668 | if (entry->length) |
| @@ -1645,9 +1677,10 @@ bool zswap_load(struct folio *folio) · 8 unmodified lines | |||
| 1645 | if (entry->objcg) | 1677 | if (entry->objcg) |
| 1646 | count_objcg_event(entry->objcg, ZSWPIN); | 1678 | count_objcg_event(entry->objcg, ZSWPIN); |
| 1647 | 1679 | ||
| 1648 | zswap_entry_free(entry); | 1680 | if (swapcache) { |
| 1649 | 1681 | zswap_entry_free(entry); | |
| 1650 | folio_mark_dirty(folio); | 1682 | folio_mark_dirty(folio); |
| 1683 | } | ||
| 1651 | 1684 | ||
| 1652 | return true; | 1685 | return true; |
| 1653 | } | 1686 | } |
| @@ -482,7 +482,7 @@ int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · 481 unmodified lines | |||
| 482 | unsigned long flags; | 482 | unsigned long flags; |
| 483 | struct sk_buff_head *list = &sk->sk_receive_queue; | 483 | struct sk_buff_head *list = &sk->sk_receive_queue; |
| 484 | 484 | ||
| 485 | if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) { | 485 | if (atomic_read(&sk->sk_rmem_alloc) >= READ_ONCE(sk->sk_rcvbuf)) { |
| 486 | atomic_inc(&sk->sk_drops); | 486 | atomic_inc(&sk->sk_drops); |
| 487 | trace_sock_rcvqueue_full(sk, skb); | 487 | trace_sock_rcvqueue_full(sk, skb); |
| 488 | return -ENOMEM; | 488 | return -ENOMEM; |
| @@ -552,7 +552,7 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, · 63 unmodified lines | |||
| 552 | 552 | ||
| 553 | skb->dev = NULL; | 553 | skb->dev = NULL; |
| 554 | 554 | ||
| 555 | if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) { | 555 | if (sk_rcvqueues_full(sk, READ_ONCE(sk->sk_rcvbuf))) { |
| 556 | atomic_inc(&sk->sk_drops); | 556 | atomic_inc(&sk->sk_drops); |
| 557 | goto discard_and_relse; | 557 | goto discard_and_relse; |
| 558 | } | 558 | } |
| @@ -220,7 +220,8 @@ void hsr_del_port(struct hsr_port *port) · 219 unmodified lines | |||
| 220 | netdev_update_features(master->dev); | 220 | netdev_update_features(master->dev); |
| 221 | dev_set_mtu(master->dev, hsr_get_max_mtu(hsr)); | 221 | dev_set_mtu(master->dev, hsr_get_max_mtu(hsr)); |
| 222 | netdev_rx_handler_unregister(port->dev); | 222 | netdev_rx_handler_unregister(port->dev); |
| 223 | dev_set_promiscuity(port->dev, -1); | 223 | if (!port->hsr->fwd_offloaded) |
| 224 | dev_set_promiscuity(port->dev, -1); | ||
| 224 | netdev_upper_dev_unlink(port->dev, master->dev); | 225 | netdev_upper_dev_unlink(port->dev, master->dev); |
| 225 | } | 226 | } |
| 226 | 227 | ||
| @@ -771,6 +771,20 @@ void inet_csk_clear_xmit_timers(struct sock *sk) · 770 unmodified lines | |||
| 771 | } | 771 | } |
| 772 | EXPORT_SYMBOL(inet_csk_clear_xmit_timers); | 772 | EXPORT_SYMBOL(inet_csk_clear_xmit_timers); |
| 773 | 773 | ||
| 774 | void inet_csk_clear_xmit_timers_sync(struct sock *sk) | ||
| 775 | { | ||
| 776 | struct inet_connection_sock *icsk = inet_csk(sk); | ||
| 777 | |||
| 778 | /* ongoing timer handlers need to acquire socket lock. */ | ||
| 779 | sock_not_owned_by_me(sk); | ||
| 780 | |||
| 781 | icsk->icsk_pending = icsk->icsk_ack.pending = 0; | ||
| 782 | |||
| 783 | sk_stop_timer_sync(sk, &icsk->icsk_retransmit_timer); | ||
| 784 | sk_stop_timer_sync(sk, &icsk->icsk_delack_timer); | ||
| 785 | sk_stop_timer_sync(sk, &sk->sk_timer); | ||
| 786 | } | ||
| 787 | |||
| 774 | void inet_csk_delete_keepalive_timer(struct sock *sk) | 788 | void inet_csk_delete_keepalive_timer(struct sock *sk) |
| 775 | { | 789 | { |
| 776 | sk_stop_timer(sk, &sk->sk_timer); | 790 | sk_stop_timer(sk, &sk->sk_timer); |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | |||
| 24 | #include <net/ip.h> | 24 | #include <net/ip.h> |
| 25 | #include <net/ipv6.h> | 25 | #include <net/ipv6.h> |
| 26 | 26 | ||
| 27 | #include "../core/sock_destructor.h" | ||
| 28 | |||
| 27 | /* Use skb->cb to track consecutive/adjacent fragments coming at | 29 | /* Use skb->cb to track consecutive/adjacent fragments coming at |
| 28 | * the end of the queue. Nodes in the rb-tree queue will | 30 | * the end of the queue. Nodes in the rb-tree queue will |
| 29 | * contain "runs" of one or more adjacent fragments. | 31 | * contain "runs" of one or more adjacent fragments. |
| @@ -39,6 +41,7 @@ struct ipfrag_skb_cb { · 9 unmodified lines | |||
| 39 | }; | 41 | }; |
| 40 | struct sk_buff *next_frag; | 42 | struct sk_buff *next_frag; |
| 41 | int frag_run_len; | 43 | int frag_run_len; |
| 44 | int ip_defrag_offset; | ||
| 42 | }; | 45 | }; |
| 43 | 46 | ||
| 44 | #define FRAG_CB(skb) ((struct ipfrag_skb_cb *)((skb)->cb)) | 47 | #define FRAG_CB(skb) ((struct ipfrag_skb_cb *)((skb)->cb)) |
| @@ -396,12 +399,12 @@ int inet_frag_queue_insert(struct inet_frag_queue *q, struct sk_buff *skb, · 351 unmodified lines | |||
| 396 | */ | 399 | */ |
| 397 | if (!last) | 400 | if (!last) |
| 398 | fragrun_create(q, skb); /* First fragment. */ | 401 | fragrun_create(q, skb); /* First fragment. */ |
| 399 | else if (last->ip_defrag_offset + last->len < end) { | 402 | else if (FRAG_CB(last)->ip_defrag_offset + last->len < end) { |
| 400 | /* This is the common case: skb goes to the end. */ | 403 | /* This is the common case: skb goes to the end. */ |
| 401 | /* Detect and discard overlaps. */ | 404 | /* Detect and discard overlaps. */ |
| 402 | if (offset < last->ip_defrag_offset + last->len) | 405 | if (offset < FRAG_CB(last)->ip_defrag_offset + last->len) |
| 403 | return IPFRAG_OVERLAP; | 406 | return IPFRAG_OVERLAP; |
| 404 | if (offset == last->ip_defrag_offset + last->len) | 407 | if (offset == FRAG_CB(last)->ip_defrag_offset + last->len) |
| 405 | fragrun_append_to_last(q, skb); | 408 | fragrun_append_to_last(q, skb); |
| 406 | else | 409 | else |
| 407 | fragrun_create(q, skb); | 410 | fragrun_create(q, skb); |
| @@ -418,13 +421,13 @@ int inet_frag_queue_insert(struct inet_frag_queue *q, struct sk_buff *skb, · 10 unmodified lines | |||
| 418 | 421 | ||
| 419 | parent = *rbn; | 422 | parent = *rbn; |
| 420 | curr = rb_to_skb(parent); | 423 | curr = rb_to_skb(parent); |
| 421 | curr_run_end = curr->ip_defrag_offset + | 424 | curr_run_end = FRAG_CB(curr)->ip_defrag_offset + |
| 422 | FRAG_CB(curr)->frag_run_len; | 425 | FRAG_CB(curr)->frag_run_len; |
| 423 | if (end <= curr->ip_defrag_offset) | 426 | if (end <= FRAG_CB(curr)->ip_defrag_offset) |
| 424 | rbn = &parent->rb_left; | 427 | rbn = &parent->rb_left; |
| 425 | else if (offset >= curr_run_end) | 428 | else if (offset >= curr_run_end) |
| 426 | rbn = &parent->rb_right; | 429 | rbn = &parent->rb_right; |
| 427 | else if (offset >= curr->ip_defrag_offset && | 430 | else if (offset >= FRAG_CB(curr)->ip_defrag_offset && |
| 428 | end <= curr_run_end) | 431 | end <= curr_run_end) |
| 429 | return IPFRAG_DUP; | 432 | return IPFRAG_DUP; |
| 430 | else | 433 | else |
| @@ -438,7 +441,7 @@ int inet_frag_queue_insert(struct inet_frag_queue *q, struct sk_buff *skb, · 7 unmodified lines | |||
| 438 | rb_insert_color(&skb->rbnode, &q->rb_fragments); | 441 | rb_insert_color(&skb->rbnode, &q->rb_fragments); |
| 439 | } | 442 | } |
| 440 | 443 | ||
| 441 | skb->ip_defrag_offset = offset; | 444 | FRAG_CB(skb)->ip_defrag_offset = offset; |
| 442 | 445 | ||
| 443 | return IPFRAG_OK; | 446 | return IPFRAG_OK; |
| 444 | } | 447 | } |
| @@ -448,13 +451,28 @@ void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb, · 3 unmodified lines | |||
| 448 | struct sk_buff *parent) | 451 | struct sk_buff *parent) |
| 449 | { | 452 | { |
| 450 | struct sk_buff *fp, *head = skb_rb_first(&q->rb_fragments); | 453 | struct sk_buff *fp, *head = skb_rb_first(&q->rb_fragments); |
| 451 | struct sk_buff **nextp; | 454 | void (*destructor)(struct sk_buff *); |
| 455 | unsigned int orig_truesize = 0; | ||
| 456 | struct sk_buff **nextp = NULL; | ||
| 457 | struct sock *sk = skb->sk; | ||
| 452 | int delta; | 458 | int delta; |
| 453 | 459 | ||
| 460 | if (sk && is_skb_wmem(skb)) { | ||
| 461 | /* TX: skb->sk might have been passed as argument to | ||
| 462 | * dst->output and must remain valid until tx completes. | ||
| 463 | * | ||
| 464 | * Move sk to reassembled skb and fix up wmem accounting. | ||
| 465 | */ | ||
| 466 | orig_truesize = skb->truesize; | ||
| 467 | destructor = skb->destructor; | ||
| 468 | } | ||
| 469 | |||
| 454 | if (head != skb) { | 470 | if (head != skb) { |
| 455 | fp = skb_clone(skb, GFP_ATOMIC); | 471 | fp = skb_clone(skb, GFP_ATOMIC); |
| 456 | if (!fp) | 472 | if (!fp) { |
| 457 | return NULL; | 473 | head = skb; |
| 474 | goto out_restore_sk; | ||
| 475 | } | ||
| 458 | FRAG_CB(fp)->next_frag = FRAG_CB(skb)->next_frag; | 476 | FRAG_CB(fp)->next_frag = FRAG_CB(skb)->next_frag; |
| 459 | if (RB_EMPTY_NODE(&skb->rbnode)) | 477 | if (RB_EMPTY_NODE(&skb->rbnode)) |
| 460 | FRAG_CB(parent)->next_frag = fp; | 478 | FRAG_CB(parent)->next_frag = fp; |
| @@ -463,6 +481,12 @@ void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb, · 2 unmodified lines | |||
| 463 | &q->rb_fragments); | 481 | &q->rb_fragments); |
| 464 | if (q->fragments_tail == skb) | 482 | if (q->fragments_tail == skb) |
| 465 | q->fragments_tail = fp; | 483 | q->fragments_tail = fp; |
| 484 | |||
| 485 | if (orig_truesize) { | ||
| 486 | /* prevent skb_morph from releasing sk */ | ||
| 487 | skb->sk = NULL; | ||
| 488 | skb->destructor = NULL; | ||
| 489 | } | ||
| 466 | skb_morph(skb, head); | 490 | skb_morph(skb, head); |
| 467 | FRAG_CB(skb)->next_frag = FRAG_CB(head)->next_frag; | 491 | FRAG_CB(skb)->next_frag = FRAG_CB(head)->next_frag; |
| 468 | rb_replace_node(&head->rbnode, &skb->rbnode, | 492 | rb_replace_node(&head->rbnode, &skb->rbnode, |
| @@ -470,13 +494,13 @@ void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb, · 1 unmodified line | |||
| 470 | consume_skb(head); | 494 | consume_skb(head); |
| 471 | head = skb; | 495 | head = skb; |
| 472 | } | 496 | } |
| 473 | WARN_ON(head->ip_defrag_offset != 0); | 497 | WARN_ON(FRAG_CB(head)->ip_defrag_offset != 0); |
| 474 | 498 | ||
| 475 | delta = -head->truesize; | 499 | delta = -head->truesize; |
| 476 | 500 | ||
| 477 | /* Head of list must not be cloned. */ | 501 | /* Head of list must not be cloned. */ |
| 478 | if (skb_unclone(head, GFP_ATOMIC)) | 502 | if (skb_unclone(head, GFP_ATOMIC)) |
| 479 | return NULL; | 503 | goto out_restore_sk; |
| 480 | 504 | ||
| 481 | delta += head->truesize; | 505 | delta += head->truesize; |
| 482 | if (delta) | 506 | if (delta) |
| @@ -492,7 +516,7 @@ void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb, · 9 unmodified lines | |||
| 492 | 516 | ||
| 493 | clone = alloc_skb(0, GFP_ATOMIC); | 517 | clone = alloc_skb(0, GFP_ATOMIC); |
| 494 | if (!clone) | 518 | if (!clone) |
| 495 | return NULL; | 519 | goto out_restore_sk; |
| 496 | skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list; | 520 | skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list; |
| 497 | skb_frag_list_init(head); | 521 | skb_frag_list_init(head); |
| 498 | for (i = 0; i < skb_shinfo(head)->nr_frags; i++) | 522 | for (i = 0; i < skb_shinfo(head)->nr_frags; i++) |
| @@ -509,6 +533,21 @@ void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb, · 10 unmodified lines | |||
| 509 | nextp = &skb_shinfo(head)->frag_list; | 533 | nextp = &skb_shinfo(head)->frag_list; |
| 510 | } | 534 | } |
| 511 | 535 | ||
| 536 | out_restore_sk: | ||
| 537 | if (orig_truesize) { | ||
| 538 | int ts_delta = head->truesize - orig_truesize; | ||
| 539 | |||
| 540 | /* if this reassembled skb is fragmented later, | ||
| 541 | * fraglist skbs will get skb->sk assigned from head->sk, | ||
| 542 | * and each frag skb will be released via sock_wfree. | ||
| 543 | * | ||
| 544 | * Update sk_wmem_alloc. | ||
| 545 | */ | ||
| 546 | head->sk = sk; | ||
| 547 | head->destructor = destructor; | ||
| 548 | refcount_add(ts_delta, &sk->sk_wmem_alloc); | ||
| 549 | } | ||
| 550 | |||
| 512 | return nextp; | 551 | return nextp; |
| 513 | } | 552 | } |
| 514 | EXPORT_SYMBOL(inet_frag_reasm_prepare); | 553 | EXPORT_SYMBOL(inet_frag_reasm_prepare); |
| @@ -516,6 +555,8 @@ EXPORT_SYMBOL(inet_frag_reasm_prepare); · 1 unmodified line | |||
| 516 | void inet_frag_reasm_finish(struct inet_frag_queue *q, struct sk_buff *head, | 555 | void inet_frag_reasm_finish(struct inet_frag_queue *q, struct sk_buff *head, |
| 517 | void *reasm_data, bool try_coalesce) | 556 | void *reasm_data, bool try_coalesce) |
| 518 | { | 557 | { |
| 558 | struct sock *sk = is_skb_wmem(head) ? head->sk : NULL; | ||
| 559 | const unsigned int head_truesize = head->truesize; | ||
| 519 | struct sk_buff **nextp = reasm_data; | 560 | struct sk_buff **nextp = reasm_data; |
| 520 | struct rb_node *rbn; | 561 | struct rb_node *rbn; |
| 521 | struct sk_buff *fp; | 562 | struct sk_buff *fp; |
| @@ -579,6 +620,9 @@ void inet_frag_reasm_finish(struct inet_frag_queue *q, struct sk_buff *head, · 57 unmodified lines | |||
| 579 | head->prev = NULL; | 620 | head->prev = NULL; |
| 580 | head->tstamp = q->stamp; | 621 | head->tstamp = q->stamp; |
| 581 | head->mono_delivery_time = q->mono_delivery_time; | 622 | head->mono_delivery_time = q->mono_delivery_time; |
| 623 | |||
| 624 | if (sk) | ||
| 625 | refcount_add(sum_truesize - head_truesize, &sk->sk_wmem_alloc); | ||
| 582 | } | 626 | } |
| 583 | EXPORT_SYMBOL(inet_frag_reasm_finish); | 627 | EXPORT_SYMBOL(inet_frag_reasm_finish); |
| 584 | 628 | ||
| @@ -384,6 +384,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) · 383 unmodified lines | |||
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | skb_dst_drop(skb); | 386 | skb_dst_drop(skb); |
| 387 | skb_orphan(skb); | ||
| 387 | return -EINPROGRESS; | 388 | return -EINPROGRESS; |
| 388 | 389 | ||
| 389 | insert_error: | 390 | insert_error: |
| @@ -487,7 +488,6 @@ int ip_defrag(struct net *net, struct sk_buff *skb, u32 user) · 97 unmodified lines | |||
| 487 | struct ipq *qp; | 488 | struct ipq *qp; |
| 488 | 489 | ||
| 489 | __IP_INC_STATS(net, IPSTATS_MIB_REASMREQDS); | 490 | __IP_INC_STATS(net, IPSTATS_MIB_REASMREQDS); |
| 490 | skb_orphan(skb); | ||
| 491 | 491 | ||
| 492 | /* Lookup (or create) queue header */ | 492 | /* Lookup (or create) queue header */ |
| 493 | qp = ip_find(net, ip_hdr(skb), user, vif); | 493 | qp = ip_find(net, ip_hdr(skb), user, vif); |
| @@ -329,6 +329,7 @@ config NFT_COMPAT_ARP · 328 unmodified lines | |||
| 329 | config IP_NF_ARPFILTER | 329 | config IP_NF_ARPFILTER |
| 330 | tristate "arptables-legacy packet filtering support" | 330 | tristate "arptables-legacy packet filtering support" |
| 331 | select IP_NF_ARPTABLES | 331 | select IP_NF_ARPTABLES |
| 332 | select NETFILTER_FAMILY_ARP | ||
| 332 | depends on NETFILTER_XTABLES | 333 | depends on NETFILTER_XTABLES |
| 333 | help | 334 | help |
| 334 | ARP packet filtering defines a table `filter', which has a series of | 335 | ARP packet filtering defines a table `filter', which has a series of |
| @@ -768,8 +768,10 @@ static int nh_grp_hw_stats_update(struct nexthop *nh, bool *hw_stats_used) · 767 unmodified lines | |||
| 768 | struct net *net = nh->net; | 768 | struct net *net = nh->net; |
| 769 | int err; | 769 | int err; |
| 770 | 770 | ||
| 771 | if (nexthop_notifiers_is_empty(net)) | 771 | if (nexthop_notifiers_is_empty(net)) { |
| 772 | *hw_stats_used = false; | ||
| 772 | return 0; | 773 | return 0; |
| 774 | } | ||
| 773 | 775 | ||
| 774 | err = nh_notifier_grp_hw_stats_init(&info, nh); | 776 | err = nh_notifier_grp_hw_stats_init(&info, nh); |
| 775 | if (err) | 777 | if (err) |
| @@ -2931,6 +2931,8 @@ void tcp_close(struct sock *sk, long timeout) · 2930 unmodified lines | |||
| 2931 | lock_sock(sk); | 2931 | lock_sock(sk); |
| 2932 | __tcp_close(sk, timeout); | 2932 | __tcp_close(sk, timeout); |
| 2933 | release_sock(sk); | 2933 | release_sock(sk); |
| 2934 | if (!sk->sk_net_refcnt) | ||
| 2935 | inet_csk_clear_xmit_timers_sync(sk); | ||
| 2934 | sock_put(sk); | 2936 | sock_put(sk); |
| 2935 | } | 2937 | } |
| 2936 | EXPORT_SYMBOL(tcp_close); | 2938 | EXPORT_SYMBOL(tcp_close); |
| @@ -5416,10 +5416,11 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, · 5415 unmodified lines | |||
| 5416 | 5416 | ||
| 5417 | err = 0; | 5417 | err = 0; |
| 5418 | if (fillargs.ifindex) { | 5418 | if (fillargs.ifindex) { |
| 5419 | err = -ENODEV; | ||
| 5420 | dev = dev_get_by_index_rcu(tgt_net, fillargs.ifindex); | 5419 | dev = dev_get_by_index_rcu(tgt_net, fillargs.ifindex); |
| 5421 | if (!dev) | 5420 | if (!dev) { |
| 5421 | err = -ENODEV; | ||
| 5422 | goto done; | 5422 | goto done; |
| 5423 | } | ||
| 5423 | idev = __in6_dev_get(dev); | 5424 | idev = __in6_dev_get(dev); |
| 5424 | if (idev) | 5425 | if (idev) |
| 5425 | err = in6_dump_addrs(idev, skb, cb, | 5426 | err = in6_dump_addrs(idev, skb, cb, |
| @@ -294,6 +294,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb, · 293 unmodified lines | |||
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | skb_dst_drop(skb); | 296 | skb_dst_drop(skb); |
| 297 | skb_orphan(skb); | ||
| 297 | return -EINPROGRESS; | 298 | return -EINPROGRESS; |
| 298 | 299 | ||
| 299 | insert_error: | 300 | insert_error: |
| @@ -469,7 +470,6 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user) · 169 unmodified lines | |||
| 469 | hdr = ipv6_hdr(skb); | 470 | hdr = ipv6_hdr(skb); |
| 470 | fhdr = (struct frag_hdr *)skb_transport_header(skb); | 471 | fhdr = (struct frag_hdr *)skb_transport_header(skb); |
| 471 | 472 | ||
| 472 | skb_orphan(skb); | ||
| 473 | fq = fq_find(net, fhdr->identification, user, hdr, | 473 | fq = fq_find(net, fhdr->identification, user, hdr, |
| 474 | skb->dev ? skb->dev->ifindex : 0); | 474 | skb->dev ? skb->dev->ifindex : 0); |
| 475 | if (fq == NULL) { | 475 | if (fq == NULL) { |
| @@ -2199,15 +2199,14 @@ static int ieee80211_change_station(struct wiphy *wiphy, · 2198 unmodified lines | |||
| 2199 | } | 2199 | } |
| 2200 | 2200 | ||
| 2201 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | 2201 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && |
| 2202 | sta->sdata->u.vlan.sta) { | 2202 | sta->sdata->u.vlan.sta) |
| 2203 | ieee80211_clear_fast_rx(sta); | ||
| 2204 | RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL); | 2203 | RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL); |
| 2205 | } | ||
| 2206 | 2204 | ||
| 2207 | if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) | 2205 | if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) |
| 2208 | ieee80211_vif_dec_num_mcast(sta->sdata); | 2206 | ieee80211_vif_dec_num_mcast(sta->sdata); |
| 2209 | 2207 | ||
| 2210 | sta->sdata = vlansdata; | 2208 | sta->sdata = vlansdata; |
| 2209 | ieee80211_check_fast_rx(sta); | ||
| 2211 | ieee80211_check_fast_xmit(sta); | 2210 | ieee80211_check_fast_xmit(sta); |
| 2212 | 2211 | ||
| 2213 | if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { | 2212 | if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { |
| @@ -158,7 +158,7 @@ do { \ · 157 unmodified lines | |||
| 158 | _sdata_dbg(print, sdata, "[link %d] " fmt, \ | 158 | _sdata_dbg(print, sdata, "[link %d] " fmt, \ |
| 159 | link_id, ##__VA_ARGS__); \ | 159 | link_id, ##__VA_ARGS__); \ |
| 160 | else \ | 160 | else \ |
| 161 | _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__); \ | 161 | _sdata_dbg(print, sdata, fmt, ##__VA_ARGS__); \ |
| 162 | } while (0) | 162 | } while (0) |
| 163 | #define link_dbg(link, fmt, ...) \ | 163 | #define link_dbg(link, fmt, ...) \ |
| 164 | _link_id_dbg(1, (link)->sdata, (link)->link_id, \ | 164 | _link_id_dbg(1, (link)->sdata, (link)->link_id, \ |
| @@ -131,7 +131,7 @@ struct ieee80211_bss { · 130 unmodified lines | |||
| 131 | }; | 131 | }; |
| 132 | 132 | ||
| 133 | /** | 133 | /** |
| 134 | * enum ieee80211_corrupt_data_flags - BSS data corruption flags | 134 | * enum ieee80211_bss_corrupt_data_flags - BSS data corruption flags |
| 135 | * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted | 135 | * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted |
| 136 | * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted | 136 | * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted |
| 137 | * | 137 | * |
| @@ -144,7 +144,7 @@ enum ieee80211_bss_corrupt_data_flags { · 6 unmodified lines | |||
| 144 | }; | 144 | }; |
| 145 | 145 | ||
| 146 | /** | 146 | /** |
| 147 | * enum ieee80211_valid_data_flags - BSS valid data flags | 147 | * enum ieee80211_bss_valid_data_flags - BSS valid data flags |
| 148 | * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE | 148 | * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE |
| 149 | * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE | 149 | * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE |
| 150 | * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE | 150 | * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE |
| @@ -5874,6 +5874,15 @@ static int ieee80211_ttlm_set_links(struct ieee80211_sub_if_data *sdata, · 5873 unmodified lines | |||
| 5874 | } | 5874 | } |
| 5875 | 5875 | ||
| 5876 | if (sdata->vif.active_links != active_links) { | 5876 | if (sdata->vif.active_links != active_links) { |
| 5877 | /* usable links are affected when active_links are changed, | ||
| 5878 | * so notify the driver about the status change | ||
| 5879 | */ | ||
| 5880 | changed |= BSS_CHANGED_MLD_VALID_LINKS; | ||
| 5881 | active_links &= sdata->vif.active_links; | ||
| 5882 | if (!active_links) | ||
| 5883 | active_links = | ||
| 5884 | BIT(__ffs(sdata->vif.valid_links & | ||
| 5885 | ~dormant_links)); | ||
| 5877 | ret = ieee80211_set_active_links(&sdata->vif, active_links); | 5886 | ret = ieee80211_set_active_links(&sdata->vif, active_links); |
| 5878 | if (ret) { | 5887 | if (ret) { |
| 5879 | sdata_info(sdata, "Failed to set TTLM active links\n"); | 5888 | sdata_info(sdata, "Failed to set TTLM active links\n"); |
| @@ -5888,7 +5897,6 @@ static int ieee80211_ttlm_set_links(struct ieee80211_sub_if_data *sdata, · 8 unmodified lines | |||
| 5888 | goto out; | 5897 | goto out; |
| 5889 | } | 5898 | } |
| 5890 | 5899 | ||
| 5891 | changed |= BSS_CHANGED_MLD_VALID_LINKS; | ||
| 5892 | sdata->vif.suspended_links = suspended_links; | 5900 | sdata->vif.suspended_links = suspended_links; |
| 5893 | if (sdata->vif.suspended_links) | 5901 | if (sdata->vif.suspended_links) |
| 5894 | changed |= BSS_CHANGED_MLD_TTLM; | 5902 | changed |= BSS_CHANGED_MLD_TTLM; |
| @@ -7652,7 +7660,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 1757 unmodified lines | |||
| 7652 | sdata_info(sdata, | 7660 | sdata_info(sdata, |
| 7653 | "failed to insert STA entry for the AP (error %d)\n", | 7661 | "failed to insert STA entry for the AP (error %d)\n", |
| 7654 | err); | 7662 | err); |
| 7655 | goto out_err; | 7663 | goto out_release_chan; |
| 7656 | } | 7664 | } |
| 7657 | } else | 7665 | } else |
| 7658 | WARN_ON_ONCE(!ether_addr_equal(link->u.mgd.bssid, cbss->bssid)); | 7666 | WARN_ON_ONCE(!ether_addr_equal(link->u.mgd.bssid, cbss->bssid)); |
| @@ -7663,8 +7671,9 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 4 unmodified lines | |||
| 7663 | 7671 | ||
| 7664 | return 0; | 7672 | return 0; |
| 7665 | 7673 | ||
| 7674 | out_release_chan: | ||
| 7675 | ieee80211_link_release_channel(link); | ||
| 7666 | out_err: | 7676 | out_err: |
| 7667 | ieee80211_link_release_channel(&sdata->deflink); | ||
| 7668 | ieee80211_vif_set_links(sdata, 0, 0); | 7677 | ieee80211_vif_set_links(sdata, 0, 0); |
| 7669 | return err; | 7678 | return err; |
| 7670 | } | 7679 | } |
| @@ -1200,6 +1200,25 @@ static void nf_tables_table_disable(struct net *net, struct nft_table *table) · 1199 unmodified lines | |||
| 1200 | __NFT_TABLE_F_WAS_AWAKEN | \ | 1200 | __NFT_TABLE_F_WAS_AWAKEN | \ |
| 1201 | __NFT_TABLE_F_WAS_ORPHAN) | 1201 | __NFT_TABLE_F_WAS_ORPHAN) |
| 1202 | 1202 | ||
| 1203 | static bool nft_table_pending_update(const struct nft_ctx *ctx) | ||
| 1204 | { | ||
| 1205 | struct nftables_pernet *nft_net = nft_pernet(ctx->net); | ||
| 1206 | struct nft_trans *trans; | ||
| 1207 | |||
| 1208 | if (ctx->table->flags & __NFT_TABLE_F_UPDATE) | ||
| 1209 | return true; | ||
| 1210 | |||
| 1211 | list_for_each_entry(trans, &nft_net->commit_list, list) { | ||
| 1212 | if ((trans->msg_type == NFT_MSG_NEWCHAIN || | ||
| 1213 | trans->msg_type == NFT_MSG_DELCHAIN) && | ||
| 1214 | trans->ctx.table == ctx->table && | ||
| 1215 | nft_trans_chain_update(trans)) | ||
| 1216 | return true; | ||
| 1217 | } | ||
| 1218 | |||
| 1219 | return false; | ||
| 1220 | } | ||
| 1221 | |||
| 1203 | static int nf_tables_updtable(struct nft_ctx *ctx) | 1222 | static int nf_tables_updtable(struct nft_ctx *ctx) |
| 1204 | { | 1223 | { |
| 1205 | struct nft_trans *trans; | 1224 | struct nft_trans *trans; |
| @@ -1226,7 +1245,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx) · 20 unmodified lines | |||
| 1226 | return -EOPNOTSUPP; | 1245 | return -EOPNOTSUPP; |
| 1227 | 1246 | ||
| 1228 | /* No dormant off/on/off/on games in single transaction */ | 1247 | /* No dormant off/on/off/on games in single transaction */ |
| 1229 | if (ctx->table->flags & __NFT_TABLE_F_UPDATE) | 1248 | if (nft_table_pending_update(ctx)) |
| 1230 | return -EINVAL; | 1249 | return -EINVAL; |
| 1231 | 1250 | ||
| 1232 | trans = nft_trans_alloc(ctx, NFT_MSG_NEWTABLE, | 1251 | trans = nft_trans_alloc(ctx, NFT_MSG_NEWTABLE, |
| @@ -2631,6 +2650,13 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, · 1398 unmodified lines | |||
| 2631 | } | 2650 | } |
| 2632 | } | 2651 | } |
| 2633 | 2652 | ||
| 2653 | if (table->flags & __NFT_TABLE_F_UPDATE && | ||
| 2654 | !list_empty(&hook.list)) { | ||
| 2655 | NL_SET_BAD_ATTR(extack, attr); | ||
| 2656 | err = -EOPNOTSUPP; | ||
| 2657 | goto err_hooks; | ||
| 2658 | } | ||
| 2659 | |||
| 2634 | if (!(table->flags & NFT_TABLE_F_DORMANT) && | 2660 | if (!(table->flags & NFT_TABLE_F_DORMANT) && |
| 2635 | nft_is_base_chain(chain) && | 2661 | nft_is_base_chain(chain) && |
| 2636 | !list_empty(&hook.list)) { | 2662 | !list_empty(&hook.list)) { |
| @@ -2860,6 +2886,9 @@ static int nft_delchain_hook(struct nft_ctx *ctx, · 223 unmodified lines | |||
| 2860 | struct nft_trans *trans; | 2886 | struct nft_trans *trans; |
| 2861 | int err; | 2887 | int err; |
| 2862 | 2888 | ||
| 2889 | if (ctx->table->flags & __NFT_TABLE_F_UPDATE) | ||
| 2890 | return -EOPNOTSUPP; | ||
| 2891 | |||
| 2863 | err = nft_chain_parse_hook(ctx->net, basechain, nla, &chain_hook, | 2892 | err = nft_chain_parse_hook(ctx->net, basechain, nla, &chain_hook, |
| 2864 | ctx->family, chain->flags, extack); | 2893 | ctx->family, chain->flags, extack); |
| 2865 | if (err < 0) | 2894 | if (err < 0) |
| @@ -2944,7 +2973,8 @@ static int nf_tables_delchain(struct sk_buff *skb, const struct nfnl_info *info, · 78 unmodified lines | |||
| 2944 | nft_ctx_init(&ctx, net, skb, info->nlh, family, table, chain, nla); | 2973 | nft_ctx_init(&ctx, net, skb, info->nlh, family, table, chain, nla); |
| 2945 | 2974 | ||
| 2946 | if (nla[NFTA_CHAIN_HOOK]) { | 2975 | if (nla[NFTA_CHAIN_HOOK]) { |
| 2947 | if (chain->flags & NFT_CHAIN_HW_OFFLOAD) | 2976 | if (NFNL_MSG_TYPE(info->nlh->nlmsg_type) == NFT_MSG_DESTROYCHAIN || |
| 2977 | chain->flags & NFT_CHAIN_HW_OFFLOAD) | ||
| 2948 | return -EOPNOTSUPP; | 2978 | return -EOPNOTSUPP; |
| 2949 | 2979 | ||
| 2950 | if (nft_is_base_chain(chain)) { | 2980 | if (nft_is_base_chain(chain)) { |
| @@ -10182,9 +10212,11 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) · 7231 unmodified lines | |||
| 10182 | if (nft_trans_chain_update(trans)) { | 10212 | if (nft_trans_chain_update(trans)) { |
| 10183 | nf_tables_chain_notify(&trans->ctx, NFT_MSG_DELCHAIN, | 10213 | nf_tables_chain_notify(&trans->ctx, NFT_MSG_DELCHAIN, |
| 10184 | &nft_trans_chain_hooks(trans)); | 10214 | &nft_trans_chain_hooks(trans)); |
| 10185 | nft_netdev_unregister_hooks(net, | 10215 | if (!(trans->ctx.table->flags & NFT_TABLE_F_DORMANT)) { |
| 10186 | &nft_trans_chain_hooks(trans), | 10216 | nft_netdev_unregister_hooks(net, |
| 10187 | true); | 10217 | &nft_trans_chain_hooks(trans), |
| 10218 | true); | ||
| 10219 | } | ||
| 10188 | } else { | 10220 | } else { |
| 10189 | nft_chain_del(trans->ctx.chain); | 10221 | nft_chain_del(trans->ctx.chain); |
| 10190 | nf_tables_chain_notify(&trans->ctx, NFT_MSG_DELCHAIN, | 10222 | nf_tables_chain_notify(&trans->ctx, NFT_MSG_DELCHAIN, |
| @@ -10460,9 +10492,11 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) · 269 unmodified lines | |||
| 10460 | break; | 10492 | break; |
| 10461 | case NFT_MSG_NEWCHAIN: | 10493 | case NFT_MSG_NEWCHAIN: |
| 10462 | if (nft_trans_chain_update(trans)) { | 10494 | if (nft_trans_chain_update(trans)) { |
| 10463 | nft_netdev_unregister_hooks(net, | 10495 | if (!(trans->ctx.table->flags & NFT_TABLE_F_DORMANT)) { |
| 10464 | &nft_trans_chain_hooks(trans), | 10496 | nft_netdev_unregister_hooks(net, |
| 10465 | true); | 10497 | &nft_trans_chain_hooks(trans), |
| 10498 | true); | ||
| 10499 | } | ||
| 10466 | free_percpu(nft_trans_chain_stats(trans)); | 10500 | free_percpu(nft_trans_chain_stats(trans)); |
| 10467 | kfree(nft_trans_chain_name(trans)); | 10501 | kfree(nft_trans_chain_name(trans)); |
| 10468 | nft_trans_destroy(trans); | 10502 | nft_trans_destroy(trans); |
| @@ -1516,6 +1516,11 @@ static void nci_rx_work(struct work_struct *work) · 1515 unmodified lines | |||
| 1516 | nfc_send_to_raw_sock(ndev->nfc_dev, skb, | 1516 | nfc_send_to_raw_sock(ndev->nfc_dev, skb, |
| 1517 | RAW_PAYLOAD_NCI, NFC_DIRECTION_RX); | 1517 | RAW_PAYLOAD_NCI, NFC_DIRECTION_RX); |
| 1518 | 1518 | ||
| 1519 | if (!nci_plen(skb->data)) { | ||
| 1520 | kfree_skb(skb); | ||
| 1521 | break; | ||
| 1522 | } | ||
| 1523 | |||
| 1519 | /* Process frame */ | 1524 | /* Process frame */ |
| 1520 | switch (nci_mt(skb->data)) { | 1525 | switch (nci_mt(skb->data)) { |
| 1521 | case NCI_MT_RSP_PKT: | 1526 | case NCI_MT_RSP_PKT: |
| @@ -921,8 +921,6 @@ out_err: · 920 unmodified lines | |||
| 921 | * Caller provides the truncation length of the output token (h) in | 921 | * Caller provides the truncation length of the output token (h) in |
| 922 | * cksumout.len. | 922 | * cksumout.len. |
| 923 | * | 923 | * |
| 924 | * Note that for RPCSEC, the "initial cipher state" is always all zeroes. | ||
| 925 | * | ||
| 926 | * Return values: | 924 | * Return values: |
| 927 | * %GSS_S_COMPLETE: Digest computed, @cksumout filled in | 925 | * %GSS_S_COMPLETE: Digest computed, @cksumout filled in |
| 928 | * %GSS_S_FAILURE: Call failed | 926 | * %GSS_S_FAILURE: Call failed |
| @@ -933,19 +931,22 @@ u32 krb5_etm_checksum(struct crypto_sync_skcipher *cipher, · 4 unmodified lines | |||
| 933 | int body_offset, struct xdr_netobj *cksumout) | 931 | int body_offset, struct xdr_netobj *cksumout) |
| 934 | { | 932 | { |
| 935 | unsigned int ivsize = crypto_sync_skcipher_ivsize(cipher); | 933 | unsigned int ivsize = crypto_sync_skcipher_ivsize(cipher); |
| 936 | static const u8 iv[GSS_KRB5_MAX_BLOCKSIZE]; | ||
| 937 | struct ahash_request *req; | 934 | struct ahash_request *req; |
| 938 | struct scatterlist sg[1]; | 935 | struct scatterlist sg[1]; |
| 936 | u8 *iv, *checksumdata; | ||
| 939 | int err = -ENOMEM; | 937 | int err = -ENOMEM; |
| 940 | u8 *checksumdata; | ||
| 941 | 938 | ||
| 942 | checksumdata = kmalloc(crypto_ahash_digestsize(tfm), GFP_KERNEL); | 939 | checksumdata = kmalloc(crypto_ahash_digestsize(tfm), GFP_KERNEL); |
| 943 | if (!checksumdata) | 940 | if (!checksumdata) |
| 944 | return GSS_S_FAILURE; | 941 | return GSS_S_FAILURE; |
| 942 | /* For RPCSEC, the "initial cipher state" is always all zeroes. */ | ||
| 943 | iv = kzalloc(ivsize, GFP_KERNEL); | ||
| 944 | if (!iv) | ||
| 945 | goto out_free_mem; | ||
| 945 | 946 | ||
| 946 | req = ahash_request_alloc(tfm, GFP_KERNEL); | 947 | req = ahash_request_alloc(tfm, GFP_KERNEL); |
| 947 | if (!req) | 948 | if (!req) |
| 948 | goto out_free_cksumdata; | 949 | goto out_free_mem; |
| 949 | ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL); | 950 | ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL); |
| 950 | err = crypto_ahash_init(req); | 951 | err = crypto_ahash_init(req); |
| 951 | if (err) | 952 | if (err) |
| @@ -969,7 +970,8 @@ u32 krb5_etm_checksum(struct crypto_sync_skcipher *cipher, · 17 unmodified lines | |||
| 969 | 970 | ||
| 970 | out_free_ahash: | 971 | out_free_ahash: |
| 971 | ahash_request_free(req); | 972 | ahash_request_free(req); |
| 972 | out_free_cksumdata: | 973 | out_free_mem: |
| 974 | kfree(iv); | ||
| 973 | kfree_sensitive(checksumdata); | 975 | kfree_sensitive(checksumdata); |
| 974 | return err ? GSS_S_FAILURE : GSS_S_COMPLETE; | 976 | return err ? GSS_S_FAILURE : GSS_S_COMPLETE; |
| 975 | } | 977 | } |
| @@ -1976,10 +1976,10 @@ int tls_sw_recvmsg(struct sock *sk, · 1975 unmodified lines | |||
| 1976 | if (unlikely(flags & MSG_ERRQUEUE)) | 1976 | if (unlikely(flags & MSG_ERRQUEUE)) |
| 1977 | return sock_recv_errqueue(sk, msg, len, SOL_IP, IP_RECVERR); | 1977 | return sock_recv_errqueue(sk, msg, len, SOL_IP, IP_RECVERR); |
| 1978 | 1978 | ||
| 1979 | psock = sk_psock_get(sk); | ||
| 1980 | err = tls_rx_reader_lock(sk, ctx, flags & MSG_DONTWAIT); | 1979 | err = tls_rx_reader_lock(sk, ctx, flags & MSG_DONTWAIT); |
| 1981 | if (err < 0) | 1980 | if (err < 0) |
| 1982 | return err; | 1981 | return err; |
| 1982 | psock = sk_psock_get(sk); | ||
| 1983 | bpf_strp_enabled = sk_psock_strp_enabled(psock); | 1983 | bpf_strp_enabled = sk_psock_strp_enabled(psock); |
| 1984 | 1984 | ||
| 1985 | /* If crypto failed the connection is broken */ | 1985 | /* If crypto failed the connection is broken */ |
| @@ -2152,12 +2152,15 @@ recv_end: · 166 unmodified lines | |||
| 2152 | } | 2152 | } |
| 2153 | 2153 | ||
| 2154 | /* Drain records from the rx_list & copy if required */ | 2154 | /* Drain records from the rx_list & copy if required */ |
| 2155 | if (is_peek || is_kvec) | 2155 | if (is_peek) |
| 2156 | err = process_rx_list(ctx, msg, &control, copied + peeked, | 2156 | err = process_rx_list(ctx, msg, &control, copied + peeked, |
| 2157 | decrypted - peeked, is_peek, NULL); | 2157 | decrypted - peeked, is_peek, NULL); |
| 2158 | else | 2158 | else |
| 2159 | err = process_rx_list(ctx, msg, &control, 0, | 2159 | err = process_rx_list(ctx, msg, &control, 0, |
| 2160 | async_copy_bytes, is_peek, NULL); | 2160 | async_copy_bytes, is_peek, NULL); |
| 2161 | |||
| 2162 | /* we could have copied less than we wanted, and possibly nothing */ | ||
| 2163 | decrypted += max(err, 0) - async_copy_bytes; | ||
| 2161 | } | 2164 | } |
| 2162 | 2165 | ||
| 2163 | copied += decrypted; | 2166 | copied += decrypted; |
| @@ -1024,7 +1024,7 @@ TRACE_EVENT(rdev_get_mpp, · 1023 unmodified lines | |||
| 1024 | TRACE_EVENT(rdev_dump_mpp, | 1024 | TRACE_EVENT(rdev_dump_mpp, |
| 1025 | TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int _idx, | 1025 | TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int _idx, |
| 1026 | u8 *dst, u8 *mpp), | 1026 | u8 *dst, u8 *mpp), |
| 1027 | TP_ARGS(wiphy, netdev, _idx, mpp, dst), | 1027 | TP_ARGS(wiphy, netdev, _idx, dst, mpp), |
| 1028 | TP_STRUCT__entry( | 1028 | TP_STRUCT__entry( |
| 1029 | WIPHY_ENTRY | 1029 | WIPHY_ENTRY |
| 1030 | NETDEV_ENTRY | 1030 | NETDEV_ENTRY |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> | 4 | * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> |
| 5 | * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. | 5 | * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. |
| 6 | * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> |
| 7 | * Copyright (C) 2024 Intel Corporation | ||
| 7 | * | 8 | * |
| 8 | * (As all part of the Linux kernel, this file is GPL) | 9 | * (As all part of the Linux kernel, this file is GPL) |
| 9 | */ | 10 | */ |
| @@ -662,7 +663,8 @@ struct iw_statistics *get_wireless_stats(struct net_device *dev) · 652 unmodified lines | |||
| 662 | dev->ieee80211_ptr->wiphy->wext && | 663 | dev->ieee80211_ptr->wiphy->wext && |
| 663 | dev->ieee80211_ptr->wiphy->wext->get_wireless_stats) { | 664 | dev->ieee80211_ptr->wiphy->wext->get_wireless_stats) { |
| 664 | wireless_warn_cfg80211_wext(); | 665 | wireless_warn_cfg80211_wext(); |
| 665 | if (dev->ieee80211_ptr->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) | 666 | if (dev->ieee80211_ptr->wiphy->flags & (WIPHY_FLAG_SUPPORTS_MLO | |
| 667 | WIPHY_FLAG_DISABLE_WEXT)) | ||
| 666 | return NULL; | 668 | return NULL; |
| 667 | return dev->ieee80211_ptr->wiphy->wext->get_wireless_stats(dev); | 669 | return dev->ieee80211_ptr->wiphy->wext->get_wireless_stats(dev); |
| 668 | } | 670 | } |
| @@ -704,7 +706,8 @@ static iw_handler get_handler(struct net_device *dev, unsigned int cmd) · 35 unmodified lines | |||
| 704 | #ifdef CONFIG_CFG80211_WEXT | 706 | #ifdef CONFIG_CFG80211_WEXT |
| 705 | if (dev->ieee80211_ptr && dev->ieee80211_ptr->wiphy) { | 707 | if (dev->ieee80211_ptr && dev->ieee80211_ptr->wiphy) { |
| 706 | wireless_warn_cfg80211_wext(); | 708 | wireless_warn_cfg80211_wext(); |
| 707 | if (dev->ieee80211_ptr->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) | 709 | if (dev->ieee80211_ptr->wiphy->flags & (WIPHY_FLAG_SUPPORTS_MLO | |
| 710 | WIPHY_FLAG_DISABLE_WEXT)) | ||
| 708 | return NULL; | 711 | return NULL; |
| 709 | handlers = dev->ieee80211_ptr->wiphy->wext; | 712 | handlers = dev->ieee80211_ptr->wiphy->wext; |
| 710 | } | 713 | } |
| @@ -114,6 +114,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) · 113 unmodified lines | |||
| 114 | KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) | 114 | KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) |
| 115 | KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) | 115 | KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) |
| 116 | 116 | ||
| 117 | KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang | ||
| 118 | |||
| 117 | ifdef CONFIG_CC_IS_CLANG | 119 | ifdef CONFIG_CC_IS_CLANG |
| 118 | # Clang before clang-16 would warn on default argument promotions. | 120 | # Clang before clang-16 would warn on default argument promotions. |
| 119 | ifneq ($(call clang-min-version, 160000),y) | 121 | ifneq ($(call clang-min-version, 160000),y) |
| @@ -151,10 +153,6 @@ KBUILD_CFLAGS += -Wtype-limits · 31 unmodified lines | |||
| 151 | KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized) | 153 | KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized) |
| 152 | KBUILD_CFLAGS += $(call cc-option, -Wunused-macros) | 154 | KBUILD_CFLAGS += $(call cc-option, -Wunused-macros) |
| 153 | 155 | ||
| 154 | ifdef CONFIG_CC_IS_CLANG | ||
| 155 | KBUILD_CFLAGS += -Winitializer-overrides | ||
| 156 | endif | ||
| 157 | |||
| 158 | KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2 | 156 | KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2 |
| 159 | 157 | ||
| 160 | else | 158 | else |
| @@ -164,9 +162,7 @@ KBUILD_CFLAGS += -Wno-missing-field-initializers · 3 unmodified lines | |||
| 164 | KBUILD_CFLAGS += -Wno-type-limits | 162 | KBUILD_CFLAGS += -Wno-type-limits |
| 165 | KBUILD_CFLAGS += -Wno-shift-negative-value | 163 | KBUILD_CFLAGS += -Wno-shift-negative-value |
| 166 | 164 | ||
| 167 | ifdef CONFIG_CC_IS_CLANG | 165 | ifdef CONFIG_CC_IS_GCC |
| 168 | KBUILD_CFLAGS += -Wno-initializer-overrides | ||
| 169 | else | ||
| 170 | KBUILD_CFLAGS += -Wno-maybe-uninitialized | 166 | KBUILD_CFLAGS += -Wno-maybe-uninitialized |
| 171 | endif | 167 | endif |
| 172 | 168 | ||
| @@ -23,7 +23,7 @@ modname = $(notdir $(@:.mod.o=)) · 22 unmodified lines | |||
| 23 | part-of-module = y | 23 | part-of-module = y |
| 24 | 24 | ||
| 25 | quiet_cmd_cc_o_c = CC [M] $@ | 25 | quiet_cmd_cc_o_c = CC [M] $@ |
| 26 | cmd_cc_o_c = $(CC) $(filter-out $(CC_FLAGS_CFI) $(CFLAGS_GCOV), $(c_flags)) -c -o $@ $< | 26 | cmd_cc_o_c = $(CC) $(filter-out $(CC_FLAGS_CFI) $(CFLAGS_GCOV) $(CFLAGS_KCSAN), $(c_flags)) -c -o $@ $< |
| 27 | 27 | ||
| 28 | %.mod.o: %.mod.c FORCE | 28 | %.mod.o: %.mod.c FORCE |
| 29 | $(call if_changed_dep,cc_o_c) | 29 | $(call if_changed_dep,cc_o_c) |
| @@ -414,8 +414,8 @@ class PrinterRST(Printer): · 413 unmodified lines | |||
| 414 | version = version.stdout.decode().rstrip() | 414 | version = version.stdout.decode().rstrip() |
| 415 | except: | 415 | except: |
| 416 | try: | 416 | try: |
| 417 | version = subprocess.run(['make', 'kernelversion'], cwd=linuxRoot, | 417 | version = subprocess.run(['make', '-s', '--no-print-directory', 'kernelversion'], |
| 418 | capture_output=True, check=True) | 418 | cwd=linuxRoot, capture_output=True, check=True) |
| 419 | version = version.stdout.decode().rstrip() | 419 | version = version.stdout.decode().rstrip() |
| 420 | except: | 420 | except: |
| 421 | return 'Linux' | 421 | return 'Linux' |
| @@ -552,11 +552,6 @@ static int conf_choice(struct menu *menu) · 551 unmodified lines | |||
| 552 | continue; | 552 | continue; |
| 553 | } | 553 | } |
| 554 | sym_set_tristate_value(child->sym, yes); | 554 | sym_set_tristate_value(child->sym, yes); |
| 555 | for (child = child->list; child; child = child->next) { | ||
| 556 | indent += 2; | ||
| 557 | conf(child); | ||
| 558 | indent -= 2; | ||
| 559 | } | ||
| 560 | return 1; | 555 | return 1; |
| 561 | } | 556 | } |
| 562 | } | 557 | } |
| @@ -89,7 +89,7 @@ void menu_add_visibility(struct expr *dep); · 88 unmodified lines | |||
| 89 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); | 89 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); |
| 90 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); | 90 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); |
| 91 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); | 91 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); |
| 92 | void menu_finalize(struct menu *parent); | 92 | void menu_finalize(void); |
| 93 | void menu_set_type(int type); | 93 | void menu_set_type(int type); |
| 94 | 94 | ||
| 95 | extern struct menu rootmenu; | 95 | extern struct menu rootmenu; |
| @@ -119,7 +119,7 @@ int dialog_checklist(const char *title, const char *prompt, int height, · 118 unmodified lines | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | do_resize: | 121 | do_resize: |
| 122 | if (getmaxy(stdscr) < (height + CHECKLIST_HEIGTH_MIN)) | 122 | if (getmaxy(stdscr) < (height + CHECKLIST_HEIGHT_MIN)) |
| 123 | return -ERRDISPLAYTOOSMALL; | 123 | return -ERRDISPLAYTOOSMALL; |
| 124 | if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN)) | 124 | if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN)) |
| 125 | return -ERRDISPLAYTOOSMALL; | 125 | return -ERRDISPLAYTOOSMALL; |
| @@ -162,17 +162,17 @@ int on_key_esc(WINDOW *win); · 161 unmodified lines | |||
| 162 | int on_key_resize(void); | 162 | int on_key_resize(void); |
| 163 | 163 | ||
| 164 | /* minimum (re)size values */ | 164 | /* minimum (re)size values */ |
| 165 | #define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */ | 165 | #define CHECKLIST_HEIGHT_MIN 6 /* For dialog_checklist() */ |
| 166 | #define CHECKLIST_WIDTH_MIN 6 | 166 | #define CHECKLIST_WIDTH_MIN 6 |
| 167 | #define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */ | 167 | #define INPUTBOX_HEIGHT_MIN 2 /* For dialog_inputbox() */ |
| 168 | #define INPUTBOX_WIDTH_MIN 2 | 168 | #define INPUTBOX_WIDTH_MIN 2 |
| 169 | #define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */ | 169 | #define MENUBOX_HEIGHT_MIN 15 /* For dialog_menu() */ |
| 170 | #define MENUBOX_WIDTH_MIN 65 | 170 | #define MENUBOX_WIDTH_MIN 65 |
| 171 | #define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */ | 171 | #define TEXTBOX_HEIGHT_MIN 8 /* For dialog_textbox() */ |
| 172 | #define TEXTBOX_WIDTH_MIN 8 | 172 | #define TEXTBOX_WIDTH_MIN 8 |
| 173 | #define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */ | 173 | #define YESNO_HEIGHT_MIN 4 /* For dialog_yesno() */ |
| 174 | #define YESNO_WIDTH_MIN 4 | 174 | #define YESNO_WIDTH_MIN 4 |
| 175 | #define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */ | 175 | #define WINDOW_HEIGHT_MIN 19 /* For init_dialog() */ |
| 176 | #define WINDOW_WIDTH_MIN 80 | 176 | #define WINDOW_WIDTH_MIN 80 |
| 177 | 177 | ||
| 178 | int init_dialog(const char *backtitle); | 178 | int init_dialog(const char *backtitle); |
| @@ -43,7 +43,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width · 42 unmodified lines | |||
| 43 | strcpy(instr, init); | 43 | strcpy(instr, init); |
| 44 | 44 | ||
| 45 | do_resize: | 45 | do_resize: |
| 46 | if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN)) | 46 | if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGHT_MIN)) |
| 47 | return -ERRDISPLAYTOOSMALL; | 47 | return -ERRDISPLAYTOOSMALL; |
| 48 | if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN)) | 48 | if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN)) |
| 49 | return -ERRDISPLAYTOOSMALL; | 49 | return -ERRDISPLAYTOOSMALL; |
| @@ -172,7 +172,7 @@ int dialog_menu(const char *title, const char *prompt, · 171 unmodified lines | |||
| 172 | do_resize: | 172 | do_resize: |
| 173 | height = getmaxy(stdscr); | 173 | height = getmaxy(stdscr); |
| 174 | width = getmaxx(stdscr); | 174 | width = getmaxx(stdscr); |
| 175 | if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN) | 175 | if (height < MENUBOX_HEIGHT_MIN || width < MENUBOX_WIDTH_MIN) |
| 176 | return -ERRDISPLAYTOOSMALL; | 176 | return -ERRDISPLAYTOOSMALL; |
| 177 | 177 | ||
| 178 | height -= 4; | 178 | height -= 4; |
| @@ -175,7 +175,7 @@ int dialog_textbox(const char *title, const char *tbuf, int initial_height, · 174 unmodified lines | |||
| 175 | 175 | ||
| 176 | do_resize: | 176 | do_resize: |
| 177 | getmaxyx(stdscr, height, width); | 177 | getmaxyx(stdscr, height, width); |
| 178 | if (height < TEXTBOX_HEIGTH_MIN || width < TEXTBOX_WIDTH_MIN) | 178 | if (height < TEXTBOX_HEIGHT_MIN || width < TEXTBOX_WIDTH_MIN) |
| 179 | return -ERRDISPLAYTOOSMALL; | 179 | return -ERRDISPLAYTOOSMALL; |
| 180 | if (initial_height != 0) | 180 | if (initial_height != 0) |
| 181 | height = initial_height; | 181 | height = initial_height; |
| @@ -291,7 +291,7 @@ int init_dialog(const char *backtitle) · 290 unmodified lines | |||
| 291 | getyx(stdscr, saved_y, saved_x); | 291 | getyx(stdscr, saved_y, saved_x); |
| 292 | 292 | ||
| 293 | getmaxyx(stdscr, height, width); | 293 | getmaxyx(stdscr, height, width); |
| 294 | if (height < WINDOW_HEIGTH_MIN || width < WINDOW_WIDTH_MIN) { | 294 | if (height < WINDOW_HEIGHT_MIN || width < WINDOW_WIDTH_MIN) { |
| 295 | endwin(); | 295 | endwin(); |
| 296 | return -ERRDISPLAYTOOSMALL; | 296 | return -ERRDISPLAYTOOSMALL; |
| 297 | } | 297 | } |
| @@ -32,7 +32,7 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) · 31 unmodified lines | |||
| 32 | WINDOW *dialog; | 32 | WINDOW *dialog; |
| 33 | 33 | ||
| 34 | do_resize: | 34 | do_resize: |
| 35 | if (getmaxy(stdscr) < (height + YESNO_HEIGTH_MIN)) | 35 | if (getmaxy(stdscr) < (height + YESNO_HEIGHT_MIN)) |
| 36 | return -ERRDISPLAYTOOSMALL; | 36 | return -ERRDISPLAYTOOSMALL; |
| 37 | if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN)) | 37 | if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN)) |
| 38 | return -ERRDISPLAYTOOSMALL; | 38 | return -ERRDISPLAYTOOSMALL; |
| @@ -659,9 +659,9 @@ static void conf_choice(struct menu *menu) · 658 unmodified lines | |||
| 659 | dialog_clear(); | 659 | dialog_clear(); |
| 660 | res = dialog_checklist(prompt ? prompt : "Main Menu", | 660 | res = dialog_checklist(prompt ? prompt : "Main Menu", |
| 661 | radiolist_instructions, | 661 | radiolist_instructions, |
| 662 | MENUBOX_HEIGTH_MIN, | 662 | MENUBOX_HEIGHT_MIN, |
| 663 | MENUBOX_WIDTH_MIN, | 663 | MENUBOX_WIDTH_MIN, |
| 664 | CHECKLIST_HEIGTH_MIN); | 664 | CHECKLIST_HEIGHT_MIN); |
| 665 | selected = item_activate_selected(); | 665 | selected = item_activate_selected(); |
| 666 | switch (res) { | 666 | switch (res) { |
| 667 | case 0: | 667 | case 0: |
| @@ -282,7 +282,7 @@ static void sym_check_prop(struct symbol *sym) · 281 unmodified lines | |||
| 282 | } | 282 | } |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | void menu_finalize(struct menu *parent) | 285 | static void _menu_finalize(struct menu *parent, bool inside_choice) |
| 286 | { | 286 | { |
| 287 | struct menu *menu, *last_menu; | 287 | struct menu *menu, *last_menu; |
| 288 | struct symbol *sym; | 288 | struct symbol *sym; |
| @@ -296,7 +296,12 @@ void menu_finalize(struct menu *parent) · 7 unmodified lines | |||
| 296 | * and propagate parent dependencies before moving on. | 296 | * and propagate parent dependencies before moving on. |
| 297 | */ | 297 | */ |
| 298 | 298 | ||
| 299 | if (sym && sym_is_choice(sym)) { | 299 | bool is_choice = false; |
| 300 | |||
| 301 | if (sym && sym_is_choice(sym)) | ||
| 302 | is_choice = true; | ||
| 303 | |||
| 304 | if (is_choice) { | ||
| 300 | if (sym->type == S_UNKNOWN) { | 305 | if (sym->type == S_UNKNOWN) { |
| 301 | /* find the first choice value to find out choice type */ | 306 | /* find the first choice value to find out choice type */ |
| 302 | current_entry = parent; | 307 | current_entry = parent; |
| @@ -394,7 +399,7 @@ void menu_finalize(struct menu *parent) · 91 unmodified lines | |||
| 394 | } | 399 | } |
| 395 | } | 400 | } |
| 396 | 401 | ||
| 397 | if (sym && sym_is_choice(sym)) | 402 | if (is_choice) |
| 398 | expr_free(parentdep); | 403 | expr_free(parentdep); |
| 399 | 404 | ||
| 400 | /* | 405 | /* |
| @@ -402,8 +407,8 @@ void menu_finalize(struct menu *parent) · 1 unmodified line | |||
| 402 | * moving on | 407 | * moving on |
| 403 | */ | 408 | */ |
| 404 | for (menu = parent->list; menu; menu = menu->next) | 409 | for (menu = parent->list; menu; menu = menu->next) |
| 405 | menu_finalize(menu); | 410 | _menu_finalize(menu, is_choice); |
| 406 | } else if (sym) { | 411 | } else if (!inside_choice && sym) { |
| 407 | /* | 412 | /* |
| 408 | * Automatic submenu creation. If sym is a symbol and A, B, C, | 413 | * Automatic submenu creation. If sym is a symbol and A, B, C, |
| 409 | * ... are consecutive items (symbols, menus, ifs, etc.) that | 414 | * ... are consecutive items (symbols, menus, ifs, etc.) that |
| @@ -463,7 +468,7 @@ void menu_finalize(struct menu *parent) · 53 unmodified lines | |||
| 463 | /* Superset, put in submenu */ | 468 | /* Superset, put in submenu */ |
| 464 | expr_free(dep2); | 469 | expr_free(dep2); |
| 465 | next: | 470 | next: |
| 466 | menu_finalize(menu); | 471 | _menu_finalize(menu, false); |
| 467 | menu->parent = parent; | 472 | menu->parent = parent; |
| 468 | last_menu = menu; | 473 | last_menu = menu; |
| 469 | } | 474 | } |
| @@ -582,6 +587,11 @@ void menu_finalize(struct menu *parent) · 112 unmodified lines | |||
| 582 | } | 587 | } |
| 583 | } | 588 | } |
| 584 | 589 | ||
| 590 | void menu_finalize(void) | ||
| 591 | { | ||
| 592 | _menu_finalize(&rootmenu, false); | ||
| 593 | } | ||
| 594 | |||
| 585 | bool menu_has_prompt(struct menu *menu) | 595 | bool menu_has_prompt(struct menu *menu) |
| 586 | { | 596 | { |
| 587 | if (!menu->prompt) | 597 | if (!menu->prompt) |
| @@ -515,7 +515,7 @@ void conf_parse(const char *name) · 514 unmodified lines | |||
| 515 | menu_add_prompt(P_MENU, "Main menu", NULL); | 515 | menu_add_prompt(P_MENU, "Main menu", NULL); |
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | menu_finalize(&rootmenu); | 518 | menu_finalize(); |
| 519 | 519 | ||
| 520 | menu = &rootmenu; | 520 | menu = &rootmenu; |
| 521 | while (menu) { | 521 | while (menu) { |
| @@ -1007,6 +1007,8 @@ static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, · 1006 unmodified lines | |||
| 1007 | 1007 | ||
| 1008 | static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) | 1008 | static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) |
| 1009 | { | 1009 | { |
| 1010 | Elf_Sym *new_sym; | ||
| 1011 | |||
| 1010 | /* If the supplied symbol has a valid name, return it */ | 1012 | /* If the supplied symbol has a valid name, return it */ |
| 1011 | if (is_valid_name(elf, sym)) | 1013 | if (is_valid_name(elf, sym)) |
| 1012 | return sym; | 1014 | return sym; |
| @@ -1015,8 +1017,9 @@ static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) · 2 unmodified lines | |||
| 1015 | * Strive to find a better symbol name, but the resulting name may not | 1017 | * Strive to find a better symbol name, but the resulting name may not |
| 1016 | * match the symbol referenced in the original code. | 1018 | * match the symbol referenced in the original code. |
| 1017 | */ | 1019 | */ |
| 1018 | return symsearch_find_nearest(elf, addr, get_secindex(elf, sym), | 1020 | new_sym = symsearch_find_nearest(elf, addr, get_secindex(elf, sym), |
| 1019 | true, 20); | 1021 | true, 20); |
| 1022 | return new_sym ? new_sym : sym; | ||
| 1020 | } | 1023 | } |
| 1021 | 1024 | ||
| 1022 | static bool is_executable_section(struct elf_info *elf, unsigned int secndx) | 1025 | static bool is_executable_section(struct elf_info *elf, unsigned int secndx) |
| @@ -158,7 +158,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, · 157 unmodified lines | |||
| 158 | struct device_node *child, *sound = NULL; | 158 | struct device_node *child, *sound = NULL; |
| 159 | struct resource *r; | 159 | struct resource *r; |
| 160 | int i, layout = 0, rlen, ok = force; | 160 | int i, layout = 0, rlen, ok = force; |
| 161 | char node_name[6]; | 161 | char node_name[8]; |
| 162 | static const char *rnames[] = { "i2sbus: %pOFn (control)", | 162 | static const char *rnames[] = { "i2sbus: %pOFn (control)", |
| 163 | "i2sbus: %pOFn (tx)", | 163 | "i2sbus: %pOFn (tx)", |
| 164 | "i2sbus: %pOFn (rx)" }; | 164 | "i2sbus: %pOFn (rx)" }; |
| @@ -343,3 +343,29 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt, · 342 unmodified lines | |||
| 343 | return NULL; | 343 | return NULL; |
| 344 | } | 344 | } |
| 345 | EXPORT_SYMBOL(intel_nhlt_get_endpoint_blob); | 345 | EXPORT_SYMBOL(intel_nhlt_get_endpoint_blob); |
| 346 | |||
| 347 | int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt, | ||
| 348 | u8 virtual_bus_id) | ||
| 349 | { | ||
| 350 | struct nhlt_endpoint *epnt; | ||
| 351 | int i; | ||
| 352 | |||
| 353 | if (!nhlt) | ||
| 354 | return -EINVAL; | ||
| 355 | |||
| 356 | epnt = (struct nhlt_endpoint *)nhlt->desc; | ||
| 357 | for (i = 0; i < nhlt->endpoint_count; i++) { | ||
| 358 | /* for SSP link the virtual bus id is the SSP port number */ | ||
| 359 | if (epnt->linktype == NHLT_LINK_SSP && | ||
| 360 | epnt->virtual_bus_id == virtual_bus_id) { | ||
| 361 | dev_dbg(dev, "SSP%d: dev_type=%d\n", virtual_bus_id, | ||
| 362 | epnt->device_type); | ||
| 363 | return epnt->device_type; | ||
| 364 | } | ||
| 365 | |||
| 366 | epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length); | ||
| 367 | } | ||
| 368 | |||
| 369 | return -EINVAL; | ||
| 370 | } | ||
| 371 | EXPORT_SYMBOL(intel_nhlt_ssp_device_type); | ||
| @@ -1024,8 +1024,8 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id) · 1023 unmodified lines | |||
| 1024 | goto err; | 1024 | goto err; |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | dev_dbg(cs35l56->base.dev, "DSP system name: '%s', amp name: '%s'\n", | 1027 | dev_info(cs35l56->base.dev, "DSP system name: '%s', amp name: '%s'\n", |
| 1028 | cs35l56->system_name, cs35l56->amp_name); | 1028 | cs35l56->system_name, cs35l56->amp_name); |
| 1029 | 1029 | ||
| 1030 | regmap_multi_reg_write(cs35l56->base.regmap, cs35l56_hda_dai_config, | 1030 | regmap_multi_reg_write(cs35l56->base.regmap, cs35l56_hda_dai_config, |
| 1031 | ARRAY_SIZE(cs35l56_hda_dai_config)); | 1031 | ARRAY_SIZE(cs35l56_hda_dai_config)); |
| @@ -1045,14 +1045,14 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id) · 13 unmodified lines | |||
| 1045 | pm_runtime_mark_last_busy(cs35l56->base.dev); | 1045 | pm_runtime_mark_last_busy(cs35l56->base.dev); |
| 1046 | pm_runtime_enable(cs35l56->base.dev); | 1046 | pm_runtime_enable(cs35l56->base.dev); |
| 1047 | 1047 | ||
| 1048 | cs35l56->base.init_done = true; | ||
| 1049 | |||
| 1048 | ret = component_add(cs35l56->base.dev, &cs35l56_hda_comp_ops); | 1050 | ret = component_add(cs35l56->base.dev, &cs35l56_hda_comp_ops); |
| 1049 | if (ret) { | 1051 | if (ret) { |
| 1050 | dev_err(cs35l56->base.dev, "Register component failed: %d\n", ret); | 1052 | dev_err(cs35l56->base.dev, "Register component failed: %d\n", ret); |
| 1051 | goto pm_err; | 1053 | goto pm_err; |
| 1052 | } | 1054 | } |
| 1053 | 1055 | ||
| 1054 | cs35l56->base.init_done = true; | ||
| 1055 | |||
| 1056 | return 0; | 1056 | return 0; |
| 1057 | 1057 | ||
| 1058 | pm_err: | 1058 | pm_err: |
| @@ -89,7 +89,7 @@ struct tas2781_hda { · 88 unmodified lines | |||
| 89 | struct snd_kcontrol *dsp_prog_ctl; | 89 | struct snd_kcontrol *dsp_prog_ctl; |
| 90 | struct snd_kcontrol *dsp_conf_ctl; | 90 | struct snd_kcontrol *dsp_conf_ctl; |
| 91 | struct snd_kcontrol *prof_ctl; | 91 | struct snd_kcontrol *prof_ctl; |
| 92 | struct snd_kcontrol *snd_ctls[3]; | 92 | struct snd_kcontrol *snd_ctls[2]; |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static int tas2781_get_i2c_res(struct acpi_resource *ares, void *data) | 95 | static int tas2781_get_i2c_res(struct acpi_resource *ares, void *data) |
| @@ -161,8 +161,6 @@ static void tas2781_hda_playback_hook(struct device *dev, int action) · 65 unmodified lines | |||
| 161 | pm_runtime_put_autosuspend(dev); | 161 | pm_runtime_put_autosuspend(dev); |
| 162 | break; | 162 | break; |
| 163 | default: | 163 | default: |
| 164 | dev_dbg(tas_hda->dev, "Playback action not supported: %d\n", | ||
| 165 | action); | ||
| 166 | break; | 164 | break; |
| 167 | } | 165 | } |
| 168 | } | 166 | } |
| @@ -185,8 +183,15 @@ static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 185 | { | 183 | { |
| 186 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | 184 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); |
| 187 | 185 | ||
| 186 | mutex_lock(&tas_priv->codec_lock); | ||
| 187 | |||
| 188 | ucontrol->value.integer.value[0] = tas_priv->rcabin.profile_cfg_id; | 188 | ucontrol->value.integer.value[0] = tas_priv->rcabin.profile_cfg_id; |
| 189 | 189 | ||
| 190 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n", | ||
| 191 | __func__, kcontrol->id.name, tas_priv->rcabin.profile_cfg_id); | ||
| 192 | |||
| 193 | mutex_unlock(&tas_priv->codec_lock); | ||
| 194 | |||
| 190 | return 0; | 195 | return 0; |
| 191 | } | 196 | } |
| 192 | 197 | ||
| @@ -200,11 +205,19 @@ static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 200 | 205 | ||
| 201 | val = clamp(nr_profile, 0, max); | 206 | val = clamp(nr_profile, 0, max); |
| 202 | 207 | ||
| 208 | mutex_lock(&tas_priv->codec_lock); | ||
| 209 | |||
| 210 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n", | ||
| 211 | __func__, kcontrol->id.name, | ||
| 212 | tas_priv->rcabin.profile_cfg_id, val); | ||
| 213 | |||
| 203 | if (tas_priv->rcabin.profile_cfg_id != val) { | 214 | if (tas_priv->rcabin.profile_cfg_id != val) { |
| 204 | tas_priv->rcabin.profile_cfg_id = val; | 215 | tas_priv->rcabin.profile_cfg_id = val; |
| 205 | ret = 1; | 216 | ret = 1; |
| 206 | } | 217 | } |
| 207 | 218 | ||
| 219 | mutex_unlock(&tas_priv->codec_lock); | ||
| 220 | |||
| 208 | return ret; | 221 | return ret; |
| 209 | } | 222 | } |
| 210 | 223 | ||
| @@ -241,8 +254,15 @@ static int tasdevice_program_get(struct snd_kcontrol *kcontrol, · 30 unmodified lines | |||
| 241 | { | 254 | { |
| 242 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | 255 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); |
| 243 | 256 | ||
| 257 | mutex_lock(&tas_priv->codec_lock); | ||
| 258 | |||
| 244 | ucontrol->value.integer.value[0] = tas_priv->cur_prog; | 259 | ucontrol->value.integer.value[0] = tas_priv->cur_prog; |
| 245 | 260 | ||
| 261 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n", | ||
| 262 | __func__, kcontrol->id.name, tas_priv->cur_prog); | ||
| 263 | |||
| 264 | mutex_unlock(&tas_priv->codec_lock); | ||
| 265 | |||
| 246 | return 0; | 266 | return 0; |
| 247 | } | 267 | } |
| 248 | 268 | ||
| @@ -257,11 +277,18 @@ static int tasdevice_program_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines | |||
| 257 | 277 | ||
| 258 | val = clamp(nr_program, 0, max); | 278 | val = clamp(nr_program, 0, max); |
| 259 | 279 | ||
| 280 | mutex_lock(&tas_priv->codec_lock); | ||
| 281 | |||
| 282 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n", | ||
| 283 | __func__, kcontrol->id.name, tas_priv->cur_prog, val); | ||
| 284 | |||
| 260 | if (tas_priv->cur_prog != val) { | 285 | if (tas_priv->cur_prog != val) { |
| 261 | tas_priv->cur_prog = val; | 286 | tas_priv->cur_prog = val; |
| 262 | ret = 1; | 287 | ret = 1; |
| 263 | } | 288 | } |
| 264 | 289 | ||
| 290 | mutex_unlock(&tas_priv->codec_lock); | ||
| 291 | |||
| 265 | return ret; | 292 | return ret; |
| 266 | } | 293 | } |
| 267 | 294 | ||
| @@ -270,8 +297,15 @@ static int tasdevice_config_get(struct snd_kcontrol *kcontrol, · 2 unmodified lines | |||
| 270 | { | 297 | { |
| 271 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | 298 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); |
| 272 | 299 | ||
| 300 | mutex_lock(&tas_priv->codec_lock); | ||
| 301 | |||
| 273 | ucontrol->value.integer.value[0] = tas_priv->cur_conf; | 302 | ucontrol->value.integer.value[0] = tas_priv->cur_conf; |
| 274 | 303 | ||
| 304 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n", | ||
| 305 | __func__, kcontrol->id.name, tas_priv->cur_conf); | ||
| 306 | |||
| 307 | mutex_unlock(&tas_priv->codec_lock); | ||
| 308 | |||
| 275 | return 0; | 309 | return 0; |
| 276 | } | 310 | } |
| 277 | 311 | ||
| @@ -286,54 +320,39 @@ static int tasdevice_config_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines | |||
| 286 | 320 | ||
| 287 | val = clamp(nr_config, 0, max); | 321 | val = clamp(nr_config, 0, max); |
| 288 | 322 | ||
| 323 | mutex_lock(&tas_priv->codec_lock); | ||
| 324 | |||
| 325 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n", | ||
| 326 | __func__, kcontrol->id.name, tas_priv->cur_conf, val); | ||
| 327 | |||
| 289 | if (tas_priv->cur_conf != val) { | 328 | if (tas_priv->cur_conf != val) { |
| 290 | tas_priv->cur_conf = val; | 329 | tas_priv->cur_conf = val; |
| 291 | ret = 1; | 330 | ret = 1; |
| 292 | } | 331 | } |
| 293 | 332 | ||
| 333 | mutex_unlock(&tas_priv->codec_lock); | ||
| 334 | |||
| 294 | return ret; | 335 | return ret; |
| 295 | } | 336 | } |
| 296 | 337 | ||
| 297 | /* | 338 | static int tas2781_amp_getvol(struct snd_kcontrol *kcontrol, |
| 298 | * tas2781_digital_getvol - get the volum control | ||
| 299 | * @kcontrol: control pointer | ||
| 300 | * @ucontrol: User data | ||
| 301 | * Customer Kcontrol for tas2781 is primarily for regmap booking, paging | ||
| 302 | * depends on internal regmap mechanism. | ||
| 303 | * tas2781 contains book and page two-level register map, especially | ||
| 304 | * book switching will set the register BXXP00R7F, after switching to the | ||
| 305 | * correct book, then leverage the mechanism for paging to access the | ||
| 306 | * register. | ||
| 307 | */ | ||
| 308 | static int tas2781_digital_getvol(struct snd_kcontrol *kcontrol, | ||
| 309 | struct snd_ctl_elem_value *ucontrol) | 339 | struct snd_ctl_elem_value *ucontrol) |
| 310 | { | 340 | { |
| 311 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | 341 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); |
| 312 | struct soc_mixer_control *mc = | 342 | struct soc_mixer_control *mc = |
| 313 | (struct soc_mixer_control *)kcontrol->private_value; | 343 | (struct soc_mixer_control *)kcontrol->private_value; |
| 344 | int ret; | ||
| 314 | 345 | ||
| 315 | return tasdevice_digital_getvol(tas_priv, ucontrol, mc); | 346 | mutex_lock(&tas_priv->codec_lock); |
| 316 | } | ||
| 317 | 347 | ||
| 318 | static int tas2781_amp_getvol(struct snd_kcontrol *kcontrol, | 348 | ret = tasdevice_amp_getvol(tas_priv, ucontrol, mc); |
| 319 | struct snd_ctl_elem_value *ucontrol) | ||
| 320 | { | ||
| 321 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | ||
| 322 | struct soc_mixer_control *mc = | ||
| 323 | (struct soc_mixer_control *)kcontrol->private_value; | ||
| 324 | 349 | ||
| 325 | return tasdevice_amp_getvol(tas_priv, ucontrol, mc); | 350 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %ld\n", |
| 326 | } | 351 | __func__, kcontrol->id.name, ucontrol->value.integer.value[0]); |
| 327 | 352 | ||
| 328 | static int tas2781_digital_putvol(struct snd_kcontrol *kcontrol, | 353 | mutex_unlock(&tas_priv->codec_lock); |
| 329 | struct snd_ctl_elem_value *ucontrol) | ||
| 330 | { | ||
| 331 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | ||
| 332 | struct soc_mixer_control *mc = | ||
| 333 | (struct soc_mixer_control *)kcontrol->private_value; | ||
| 334 | 354 | ||
| 335 | /* The check of the given value is in tasdevice_digital_putvol. */ | 355 | return ret; |
| 336 | return tasdevice_digital_putvol(tas_priv, ucontrol, mc); | ||
| 337 | } | 356 | } |
| 338 | 357 | ||
| 339 | static int tas2781_amp_putvol(struct snd_kcontrol *kcontrol, | 358 | static int tas2781_amp_putvol(struct snd_kcontrol *kcontrol, |
| @@ -342,9 +361,19 @@ static int tas2781_amp_putvol(struct snd_kcontrol *kcontrol, · 2 unmodified lines | |||
| 342 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | 361 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); |
| 343 | struct soc_mixer_control *mc = | 362 | struct soc_mixer_control *mc = |
| 344 | (struct soc_mixer_control *)kcontrol->private_value; | 363 | (struct soc_mixer_control *)kcontrol->private_value; |
| 364 | int ret; | ||
| 365 | |||
| 366 | mutex_lock(&tas_priv->codec_lock); | ||
| 367 | |||
| 368 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: -> %ld\n", | ||
| 369 | __func__, kcontrol->id.name, ucontrol->value.integer.value[0]); | ||
| 345 | 370 | ||
| 346 | /* The check of the given value is in tasdevice_amp_putvol. */ | 371 | /* The check of the given value is in tasdevice_amp_putvol. */ |
| 347 | return tasdevice_amp_putvol(tas_priv, ucontrol, mc); | 372 | ret = tasdevice_amp_putvol(tas_priv, ucontrol, mc); |
| 373 | |||
| 374 | mutex_unlock(&tas_priv->codec_lock); | ||
| 375 | |||
| 376 | return ret; | ||
| 348 | } | 377 | } |
| 349 | 378 | ||
| 350 | static int tas2781_force_fwload_get(struct snd_kcontrol *kcontrol, | 379 | static int tas2781_force_fwload_get(struct snd_kcontrol *kcontrol, |
| @@ -352,9 +381,13 @@ static int tas2781_force_fwload_get(struct snd_kcontrol *kcontrol, · 1 unmodified line | |||
| 352 | { | 381 | { |
| 353 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | 382 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); |
| 354 | 383 | ||
| 384 | mutex_lock(&tas_priv->codec_lock); | ||
| 385 | |||
| 355 | ucontrol->value.integer.value[0] = (int)tas_priv->force_fwload_status; | 386 | ucontrol->value.integer.value[0] = (int)tas_priv->force_fwload_status; |
| 356 | dev_dbg(tas_priv->dev, "%s : Force FWload %s\n", __func__, | 387 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n", |
| 357 | tas_priv->force_fwload_status ? "ON" : "OFF"); | 388 | __func__, kcontrol->id.name, tas_priv->force_fwload_status); |
| 389 | |||
| 390 | mutex_unlock(&tas_priv->codec_lock); | ||
| 358 | 391 | ||
| 359 | return 0; | 392 | return 0; |
| 360 | } | 393 | } |
| @@ -365,14 +398,20 @@ static int tas2781_force_fwload_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 365 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); | 398 | struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol); |
| 366 | bool change, val = (bool)ucontrol->value.integer.value[0]; | 399 | bool change, val = (bool)ucontrol->value.integer.value[0]; |
| 367 | 400 | ||
| 401 | mutex_lock(&tas_priv->codec_lock); | ||
| 402 | |||
| 403 | dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n", | ||
| 404 | __func__, kcontrol->id.name, | ||
| 405 | tas_priv->force_fwload_status, val); | ||
| 406 | |||
| 368 | if (tas_priv->force_fwload_status == val) | 407 | if (tas_priv->force_fwload_status == val) |
| 369 | change = false; | 408 | change = false; |
| 370 | else { | 409 | else { |
| 371 | change = true; | 410 | change = true; |
| 372 | tas_priv->force_fwload_status = val; | 411 | tas_priv->force_fwload_status = val; |
| 373 | } | 412 | } |
| 374 | dev_dbg(tas_priv->dev, "%s : Force FWload %s\n", __func__, | 413 | |
| 375 | tas_priv->force_fwload_status ? "ON" : "OFF"); | 414 | mutex_unlock(&tas_priv->codec_lock); |
| 376 | 415 | ||
| 377 | return change; | 416 | return change; |
| 378 | } | 417 | } |
| @@ -381,9 +420,6 @@ static const struct snd_kcontrol_new tas2781_snd_controls[] = { · 2 unmodified lines | |||
| 381 | ACARD_SINGLE_RANGE_EXT_TLV("Speaker Analog Gain", TAS2781_AMP_LEVEL, | 420 | ACARD_SINGLE_RANGE_EXT_TLV("Speaker Analog Gain", TAS2781_AMP_LEVEL, |
| 382 | 1, 0, 20, 0, tas2781_amp_getvol, | 421 | 1, 0, 20, 0, tas2781_amp_getvol, |
| 383 | tas2781_amp_putvol, amp_vol_tlv), | 422 | tas2781_amp_putvol, amp_vol_tlv), |
| 384 | ACARD_SINGLE_RANGE_EXT_TLV("Speaker Digital Gain", TAS2781_DVC_LVL, | ||
| 385 | 0, 0, 200, 1, tas2781_digital_getvol, | ||
| 386 | tas2781_digital_putvol, dvc_tlv), | ||
| 387 | ACARD_SINGLE_BOOL_EXT("Speaker Force Firmware Load", 0, | 423 | ACARD_SINGLE_BOOL_EXT("Speaker Force Firmware Load", 0, |
| 388 | tas2781_force_fwload_get, tas2781_force_fwload_put), | 424 | tas2781_force_fwload_get, tas2781_force_fwload_put), |
| 389 | }; | 425 | }; |
| @@ -278,7 +278,8 @@ static void run_spu_dma(struct work_struct *work) · 277 unmodified lines | |||
| 278 | dreamcastcard->clicks++; | 278 | dreamcastcard->clicks++; |
| 279 | if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER)) | 279 | if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER)) |
| 280 | dreamcastcard->clicks %= AICA_PERIOD_NUMBER; | 280 | dreamcastcard->clicks %= AICA_PERIOD_NUMBER; |
| 281 | mod_timer(&dreamcastcard->timer, jiffies + 1); | 281 | if (snd_pcm_running(dreamcastcard->substream)) |
| 282 | mod_timer(&dreamcastcard->timer, jiffies + 1); | ||
| 282 | } | 283 | } |
| 283 | } | 284 | } |
| 284 | 285 | ||
| @@ -290,6 +291,8 @@ static void aica_period_elapsed(struct timer_list *t) · 5 unmodified lines | |||
| 290 | /*timer function - so cannot sleep */ | 291 | /*timer function - so cannot sleep */ |
| 291 | int play_period; | 292 | int play_period; |
| 292 | struct snd_pcm_runtime *runtime; | 293 | struct snd_pcm_runtime *runtime; |
| 294 | if (!snd_pcm_running(substream)) | ||
| 295 | return; | ||
| 293 | runtime = substream->runtime; | 296 | runtime = substream->runtime; |
| 294 | dreamcastcard = substream->pcm->private_data; | 297 | dreamcastcard = substream->pcm->private_data; |
| 295 | /* Have we played out an additional period? */ | 298 | /* Have we played out an additional period? */ |
| @@ -350,12 +353,19 @@ static int snd_aicapcm_pcm_open(struct snd_pcm_substream · 54 unmodified lines | |||
| 350 | return 0; | 353 | return 0; |
| 351 | } | 354 | } |
| 352 | 355 | ||
| 356 | static int snd_aicapcm_pcm_sync_stop(struct snd_pcm_substream *substream) | ||
| 357 | { | ||
| 358 | struct snd_card_aica *dreamcastcard = substream->pcm->private_data; | ||
| 359 | |||
| 360 | del_timer_sync(&dreamcastcard->timer); | ||
| 361 | cancel_work_sync(&dreamcastcard->spu_dma_work); | ||
| 362 | return 0; | ||
| 363 | } | ||
| 364 | |||
| 353 | static int snd_aicapcm_pcm_close(struct snd_pcm_substream | 365 | static int snd_aicapcm_pcm_close(struct snd_pcm_substream |
| 354 | *substream) | 366 | *substream) |
| 355 | { | 367 | { |
| 356 | struct snd_card_aica *dreamcastcard = substream->pcm->private_data; | 368 | struct snd_card_aica *dreamcastcard = substream->pcm->private_data; |
| 357 | flush_work(&(dreamcastcard->spu_dma_work)); | ||
| 358 | del_timer(&dreamcastcard->timer); | ||
| 359 | dreamcastcard->substream = NULL; | 369 | dreamcastcard->substream = NULL; |
| 360 | kfree(dreamcastcard->channel); | 370 | kfree(dreamcastcard->channel); |
| 361 | spu_disable(); | 371 | spu_disable(); |
| @@ -401,6 +411,7 @@ static const struct snd_pcm_ops snd_aicapcm_playback_ops = { · 39 unmodified lines | |||
| 401 | .prepare = snd_aicapcm_pcm_prepare, | 411 | .prepare = snd_aicapcm_pcm_prepare, |
| 402 | .trigger = snd_aicapcm_pcm_trigger, | 412 | .trigger = snd_aicapcm_pcm_trigger, |
| 403 | .pointer = snd_aicapcm_pcm_pointer, | 413 | .pointer = snd_aicapcm_pcm_pointer, |
| 414 | .sync_stop = snd_aicapcm_pcm_sync_stop, | ||
| 404 | }; | 415 | }; |
| 405 | 416 | ||
| 406 | /* TO DO: set up to handle more than one pcm instance */ | 417 | /* TO DO: set up to handle more than one pcm instance */ |
| @@ -1356,6 +1356,7 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s · 1355 unmodified lines | |||
| 1356 | int sample_rate, channel_count; | 1356 | int sample_rate, channel_count; |
| 1357 | int bit_depth, ret; | 1357 | int bit_depth, ret; |
| 1358 | u32 nhlt_type; | 1358 | u32 nhlt_type; |
| 1359 | int dev_type = 0; | ||
| 1359 | 1360 | ||
| 1360 | /* convert to NHLT type */ | 1361 | /* convert to NHLT type */ |
| 1361 | switch (linktype) { | 1362 | switch (linktype) { |
| @@ -1371,18 +1372,30 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s · 9 unmodified lines | |||
| 1371 | &bit_depth); | 1372 | &bit_depth); |
| 1372 | if (ret < 0) | 1373 | if (ret < 0) |
| 1373 | return ret; | 1374 | return ret; |
| 1375 | |||
| 1376 | /* | ||
| 1377 | * We need to know the type of the external device attached to a SSP | ||
| 1378 | * port to retrieve the blob from NHLT. However, device type is not | ||
| 1379 | * specified in topology. | ||
| 1380 | * Query the type for the port and then pass that information back | ||
| 1381 | * to the blob lookup function. | ||
| 1382 | */ | ||
| 1383 | dev_type = intel_nhlt_ssp_device_type(sdev->dev, ipc4_data->nhlt, | ||
| 1384 | dai_index); | ||
| 1385 | if (dev_type < 0) | ||
| 1386 | return dev_type; | ||
| 1374 | break; | 1387 | break; |
| 1375 | default: | 1388 | default: |
| 1376 | return 0; | 1389 | return 0; |
| 1377 | } | 1390 | } |
| 1378 | 1391 | ||
| 1379 | dev_dbg(sdev->dev, "dai index %d nhlt type %d direction %d\n", | 1392 | dev_dbg(sdev->dev, "dai index %d nhlt type %d direction %d dev type %d\n", |
| 1380 | dai_index, nhlt_type, dir); | 1393 | dai_index, nhlt_type, dir, dev_type); |
| 1381 | 1394 | ||
| 1382 | /* find NHLT blob with matching params */ | 1395 | /* find NHLT blob with matching params */ |
| 1383 | cfg = intel_nhlt_get_endpoint_blob(sdev->dev, ipc4_data->nhlt, dai_index, nhlt_type, | 1396 | cfg = intel_nhlt_get_endpoint_blob(sdev->dev, ipc4_data->nhlt, dai_index, nhlt_type, |
| 1384 | bit_depth, bit_depth, channel_count, sample_rate, | 1397 | bit_depth, bit_depth, channel_count, sample_rate, |
| 1385 | dir, 0); | 1398 | dir, dev_type); |
| 1386 | 1399 | ||
| 1387 | if (!cfg) { | 1400 | if (!cfg) { |
| 1388 | dev_err(sdev->dev, | 1401 | dev_err(sdev->dev, |
| @@ -11,7 +11,6 @@ help: · 10 unmodified lines | |||
| 11 | @echo '' | 11 | @echo '' |
| 12 | @echo ' acpi - ACPI tools' | 12 | @echo ' acpi - ACPI tools' |
| 13 | @echo ' bpf - misc BPF tools' | 13 | @echo ' bpf - misc BPF tools' |
| 14 | @echo ' cgroup - cgroup tools' | ||
| 15 | @echo ' counter - counter tools' | 14 | @echo ' counter - counter tools' |
| 16 | @echo ' cpupower - a tool for all things x86 CPU power' | 15 | @echo ' cpupower - a tool for all things x86 CPU power' |
| 17 | @echo ' debugging - tools for debugging' | 16 | @echo ' debugging - tools for debugging' |
| @@ -69,7 +68,7 @@ acpi: FORCE · 51 unmodified lines | |||
| 69 | cpupower: FORCE | 68 | cpupower: FORCE |
| 70 | $(call descend,power/$@) | 69 | $(call descend,power/$@) |
| 71 | 70 | ||
| 72 | cgroup counter firewire hv guest bootconfig spi usb virtio mm bpf iio gpio objtool leds wmi pci firmware debugging tracing: FORCE | 71 | counter firewire hv guest bootconfig spi usb virtio mm bpf iio gpio objtool leds wmi pci firmware debugging tracing: FORCE |
| 73 | $(call descend,$@) | 72 | $(call descend,$@) |
| 74 | 73 | ||
| 75 | bpf/%: FORCE | 74 | bpf/%: FORCE |
| @@ -116,7 +115,7 @@ freefall: FORCE · 40 unmodified lines | |||
| 116 | kvm_stat: FORCE | 115 | kvm_stat: FORCE |
| 117 | $(call descend,kvm/$@) | 116 | $(call descend,kvm/$@) |
| 118 | 117 | ||
| 119 | all: acpi cgroup counter cpupower gpio hv firewire \ | 118 | all: acpi counter cpupower gpio hv firewire \ |
| 120 | perf selftests bootconfig spi turbostat usb \ | 119 | perf selftests bootconfig spi turbostat usb \ |
| 121 | virtio mm bpf x86_energy_perf_policy \ | 120 | virtio mm bpf x86_energy_perf_policy \ |
| 122 | tmon freefall iio objtool kvm_stat wmi \ | 121 | tmon freefall iio objtool kvm_stat wmi \ |
| @@ -128,7 +127,7 @@ acpi_install: · 5 unmodified lines | |||
| 128 | cpupower_install: | 127 | cpupower_install: |
| 129 | $(call descend,power/$(@:_install=),install) | 128 | $(call descend,power/$(@:_install=),install) |
| 130 | 129 | ||
| 131 | cgroup_install counter_install firewire_install gpio_install hv_install iio_install perf_install bootconfig_install spi_install usb_install virtio_install mm_install bpf_install objtool_install wmi_install pci_install debugging_install tracing_install: | 130 | counter_install firewire_install gpio_install hv_install iio_install perf_install bootconfig_install spi_install usb_install virtio_install mm_install bpf_install objtool_install wmi_install pci_install debugging_install tracing_install: |
| 132 | $(call descend,$(@:_install=),install) | 131 | $(call descend,$(@:_install=),install) |
| 133 | 132 | ||
| 134 | selftests_install: | 133 | selftests_install: |
| @@ -155,7 +154,7 @@ freefall_install: · 20 unmodified lines | |||
| 155 | kvm_stat_install: | 154 | kvm_stat_install: |
| 156 | $(call descend,kvm/$(@:_install=),install) | 155 | $(call descend,kvm/$(@:_install=),install) |
| 157 | 156 | ||
| 158 | install: acpi_install cgroup_install counter_install cpupower_install gpio_install \ | 157 | install: acpi_install counter_install cpupower_install gpio_install \ |
| 159 | hv_install firewire_install iio_install \ | 158 | hv_install firewire_install iio_install \ |
| 160 | perf_install selftests_install turbostat_install usb_install \ | 159 | perf_install selftests_install turbostat_install usb_install \ |
| 161 | virtio_install mm_install bpf_install x86_energy_perf_policy_install \ | 160 | virtio_install mm_install bpf_install x86_energy_perf_policy_install \ |
| @@ -169,7 +168,7 @@ acpi_clean: · 7 unmodified lines | |||
| 169 | cpupower_clean: | 168 | cpupower_clean: |
| 170 | $(call descend,power/cpupower,clean) | 169 | $(call descend,power/cpupower,clean) |
| 171 | 170 | ||
| 172 | cgroup_clean counter_clean hv_clean firewire_clean bootconfig_clean spi_clean usb_clean virtio_clean mm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean tracing_clean: | 171 | counter_clean hv_clean firewire_clean bootconfig_clean spi_clean usb_clean virtio_clean mm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean tracing_clean: |
| 173 | $(call descend,$(@:_clean=),clean) | 172 | $(call descend,$(@:_clean=),clean) |
| 174 | 173 | ||
| 175 | libapi_clean: | 174 | libapi_clean: |
| @@ -209,7 +208,7 @@ freefall_clean: · 33 unmodified lines | |||
| 209 | build_clean: | 208 | build_clean: |
| 210 | $(call descend,build,clean) | 209 | $(call descend,build,clean) |
| 211 | 210 | ||
| 212 | clean: acpi_clean cgroup_clean counter_clean cpupower_clean hv_clean firewire_clean \ | 211 | clean: acpi_clean counter_clean cpupower_clean hv_clean firewire_clean \ |
| 213 | perf_clean selftests_clean turbostat_clean bootconfig_clean spi_clean usb_clean virtio_clean \ | 212 | perf_clean selftests_clean turbostat_clean bootconfig_clean spi_clean usb_clean virtio_clean \ |
| 214 | mm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ | 213 | mm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ |
| 215 | freefall_clean build_clean libbpf_clean libsubcmd_clean \ | 214 | freefall_clean build_clean libbpf_clean libsubcmd_clean \ |
| @@ -121,7 +121,7 @@ static bool get_datasec_ident(const char *sec_name, char *buf, size_t buf_sz) · 120 unmodified lines | |||
| 121 | int i, n; | 121 | int i, n; |
| 122 | 122 | ||
| 123 | /* recognize hard coded LLVM section name */ | 123 | /* recognize hard coded LLVM section name */ |
| 124 | if (strcmp(sec_name, ".arena.1") == 0) { | 124 | if (strcmp(sec_name, ".addr_space.1") == 0) { |
| 125 | /* this is the name to use in skeleton */ | 125 | /* this is the name to use in skeleton */ |
| 126 | snprintf(buf, buf_sz, "arena"); | 126 | snprintf(buf, buf_sz, "arena"); |
| 127 | return true; | 127 | return true; |
| @@ -498,7 +498,7 @@ struct bpf_struct_ops { · 497 unmodified lines | |||
| 498 | #define KSYMS_SEC ".ksyms" | 498 | #define KSYMS_SEC ".ksyms" |
| 499 | #define STRUCT_OPS_SEC ".struct_ops" | 499 | #define STRUCT_OPS_SEC ".struct_ops" |
| 500 | #define STRUCT_OPS_LINK_SEC ".struct_ops.link" | 500 | #define STRUCT_OPS_LINK_SEC ".struct_ops.link" |
| 501 | #define ARENA_SEC ".arena.1" | 501 | #define ARENA_SEC ".addr_space.1" |
| 502 | 502 | ||
| 503 | enum libbpf_map_type { | 503 | enum libbpf_map_type { |
| 504 | LIBBPF_MAP_UNSPEC, | 504 | LIBBPF_MAP_UNSPEC, |
| @@ -1650,6 +1650,10 @@ static int sys_memfd_create(const char *name, unsigned flags) · 1145 unmodified lines | |||
| 1650 | return syscall(__NR_memfd_create, name, flags); | 1650 | return syscall(__NR_memfd_create, name, flags); |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
| 1653 | #ifndef MFD_CLOEXEC | ||
| 1654 | #define MFD_CLOEXEC 0x0001U | ||
| 1655 | #endif | ||
| 1656 | |||
| 1653 | static int create_placeholder_fd(void) | 1657 | static int create_placeholder_fd(void) |
| 1654 | { | 1658 | { |
| 1655 | int fd; | 1659 | int fd; |
| @@ -5352,8 +5356,8 @@ retry: · 3696 unmodified lines | |||
| 5352 | goto err_out; | 5356 | goto err_out; |
| 5353 | } | 5357 | } |
| 5354 | if (map->def.type == BPF_MAP_TYPE_ARENA) { | 5358 | if (map->def.type == BPF_MAP_TYPE_ARENA) { |
| 5355 | map->mmaped = mmap((void *)map->map_extra, bpf_map_mmap_sz(map), | 5359 | map->mmaped = mmap((void *)(long)map->map_extra, |
| 5356 | PROT_READ | PROT_WRITE, | 5360 | bpf_map_mmap_sz(map), PROT_READ | PROT_WRITE, |
| 5357 | map->map_extra ? MAP_SHARED | MAP_FIXED : MAP_SHARED, | 5361 | map->map_extra ? MAP_SHARED | MAP_FIXED : MAP_SHARED, |
| 5358 | map->fd, 0); | 5362 | map->fd, 0); |
| 5359 | if (map->mmaped == MAP_FAILED) { | 5363 | if (map->mmaped == MAP_FAILED) { |
| @@ -228,8 +228,11 @@ class Type(SpecAttr): · 227 unmodified lines | |||
| 228 | presence = '' | 228 | presence = '' |
| 229 | for i in range(0, len(ref)): | 229 | for i in range(0, len(ref)): |
| 230 | presence = f"{var}->{'.'.join(ref[:i] + [''])}_present.{ref[i]}" | 230 | presence = f"{var}->{'.'.join(ref[:i] + [''])}_present.{ref[i]}" |
| 231 | if self.presence_type() == 'bit': | 231 | # Every layer below last is a nest, so we know it uses bit presence |
| 232 | code.append(presence + ' = 1;') | 232 | # last layer is "self" and may be a complex type |
| 233 | if i == len(ref) - 1 and self.presence_type() != 'bit': | ||
| 234 | continue | ||
| 235 | code.append(presence + ' = 1;') | ||
| 233 | code += self._setter_lines(ri, member, presence) | 236 | code += self._setter_lines(ri, member, presence) |
| 234 | 237 | ||
| 235 | func_name = f"{op_prefix(ri, direction, deref=deref)}_set_{'_'.join(ref)}" | 238 | func_name = f"{op_prefix(ri, direction, deref=deref)}_set_{'_'.join(ref)}" |
| @@ -585,7 +585,7 @@ static int add_dead_ends(struct objtool_file *file) · 584 unmodified lines | |||
| 585 | struct section *rsec; | 585 | struct section *rsec; |
| 586 | struct reloc *reloc; | 586 | struct reloc *reloc; |
| 587 | struct instruction *insn; | 587 | struct instruction *insn; |
| 588 | unsigned long offset; | 588 | uint64_t offset; |
| 589 | 589 | ||
| 590 | /* | 590 | /* |
| 591 | * Check for manually annotated dead ends. | 591 | * Check for manually annotated dead ends. |
| @@ -28,6 +28,8 @@ CONFIG_MCTP_FLOWS=y · 27 unmodified lines | |||
| 28 | CONFIG_INET=y | 28 | CONFIG_INET=y |
| 29 | CONFIG_MPTCP=y | 29 | CONFIG_MPTCP=y |
| 30 | 30 | ||
| 31 | CONFIG_NETDEVICES=y | ||
| 32 | CONFIG_WLAN=y | ||
| 31 | CONFIG_CFG80211=y | 33 | CONFIG_CFG80211=y |
| 32 | CONFIG_MAC80211=y | 34 | CONFIG_MAC80211=y |
| 33 | CONFIG_WLAN_VENDOR_INTEL=y | 35 | CONFIG_WLAN_VENDOR_INTEL=y |
| @@ -38,6 +40,7 @@ CONFIG_DAMON_VADDR=y · 4 unmodified lines | |||
| 38 | CONFIG_DAMON_PADDR=y | 40 | CONFIG_DAMON_PADDR=y |
| 39 | CONFIG_DEBUG_FS=y | 41 | CONFIG_DEBUG_FS=y |
| 40 | CONFIG_DAMON_DBGFS=y | 42 | CONFIG_DAMON_DBGFS=y |
| 43 | CONFIG_DAMON_DBGFS_DEPRECATED=y | ||
| 41 | 44 | ||
| 42 | CONFIG_REGMAP_BUILD=y | 45 | CONFIG_REGMAP_BUILD=y |
| 43 | 46 | ||
| @@ -32,7 +32,7 @@ · 31 unmodified lines | |||
| 32 | */ | 32 | */ |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #if defined(__BPF_FEATURE_ARENA_CAST) && !defined(BPF_ARENA_FORCE_ASM) | 35 | #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) && !defined(BPF_ARENA_FORCE_ASM) |
| 36 | #define __arena __attribute__((address_space(1))) | 36 | #define __arena __attribute__((address_space(1))) |
| 37 | #define cast_kern(ptr) /* nop for bpf prog. emitted by LLVM */ | 37 | #define cast_kern(ptr) /* nop for bpf prog. emitted by LLVM */ |
| 38 | #define cast_user(ptr) /* nop for bpf prog. emitted by LLVM */ | 38 | #define cast_user(ptr) /* nop for bpf prog. emitted by LLVM */ |
| @@ -3,12 +3,14 @@ · 2 unmodified lines | |||
| 3 | #include <test_progs.h> | 3 | #include <test_progs.h> |
| 4 | #include <sys/mman.h> | 4 | #include <sys/mman.h> |
| 5 | #include <network_helpers.h> | 5 | #include <network_helpers.h> |
| 6 | 6 | #include <sys/user.h> | |
| 7 | #ifndef PAGE_SIZE /* on some archs it comes in sys/user.h */ | ||
| 8 | #include <unistd.h> | ||
| 9 | #define PAGE_SIZE getpagesize() | ||
| 10 | #endif | ||
| 7 | #include "arena_htab_asm.skel.h" | 11 | #include "arena_htab_asm.skel.h" |
| 8 | #include "arena_htab.skel.h" | 12 | #include "arena_htab.skel.h" |
| 9 | 13 | ||
| 10 | #define PAGE_SIZE 4096 | ||
| 11 | |||
| 12 | #include "bpf_arena_htab.h" | 14 | #include "bpf_arena_htab.h" |
| 13 | 15 | ||
| 14 | static void test_arena_htab_common(struct htab *htab) | 16 | static void test_arena_htab_common(struct htab *htab) |
| @@ -3,8 +3,11 @@ · 2 unmodified lines | |||
| 3 | #include <test_progs.h> | 3 | #include <test_progs.h> |
| 4 | #include <sys/mman.h> | 4 | #include <sys/mman.h> |
| 5 | #include <network_helpers.h> | 5 | #include <network_helpers.h> |
| 6 | 6 | #include <sys/user.h> | |
| 7 | #define PAGE_SIZE 4096 | 7 | #ifndef PAGE_SIZE /* on some archs it comes in sys/user.h */ |
| 8 | #include <unistd.h> | ||
| 9 | #define PAGE_SIZE getpagesize() | ||
| 10 | #endif | ||
| 8 | 11 | ||
| 9 | #include "bpf_arena_list.h" | 12 | #include "bpf_arena_list.h" |
| 10 | #include "arena_list.skel.h" | 13 | #include "arena_list.skel.h" |
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | /* Copyright (c) 2021 Facebook */ | 2 | /* Copyright (c) 2021 Facebook */ |
| 3 | 3 | ||
| 4 | #include <sys/syscall.h> | 4 | #include <sys/syscall.h> |
| 5 | #include <limits.h> | ||
| 5 | #include <test_progs.h> | 6 | #include <test_progs.h> |
| 6 | #include "bloom_filter_map.skel.h" | 7 | #include "bloom_filter_map.skel.h" |
| 7 | 8 | ||
| @@ -21,6 +22,11 @@ static void test_fail_cases(void) · 13 unmodified lines | |||
| 21 | if (!ASSERT_LT(fd, 0, "bpf_map_create bloom filter invalid value size 0")) | 22 | if (!ASSERT_LT(fd, 0, "bpf_map_create bloom filter invalid value size 0")) |
| 22 | close(fd); | 23 | close(fd); |
| 23 | 24 | ||
| 25 | /* Invalid value size: too big */ | ||
| 26 | fd = bpf_map_create(BPF_MAP_TYPE_BLOOM_FILTER, NULL, 0, INT32_MAX, 100, NULL); | ||
| 27 | if (!ASSERT_LT(fd, 0, "bpf_map_create bloom filter invalid value too large")) | ||
| 28 | close(fd); | ||
| 29 | |||
| 24 | /* Invalid max entries size */ | 30 | /* Invalid max entries size */ |
| 25 | fd = bpf_map_create(BPF_MAP_TYPE_BLOOM_FILTER, NULL, 0, sizeof(value), 0, NULL); | 31 | fd = bpf_map_create(BPF_MAP_TYPE_BLOOM_FILTER, NULL, 0, sizeof(value), 0, NULL); |
| 26 | if (!ASSERT_LT(fd, 0, "bpf_map_create bloom filter invalid max entries size")) | 32 | if (!ASSERT_LT(fd, 0, "bpf_map_create bloom filter invalid max entries size")) |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | #include "cap_helpers.h" | 5 | #include "cap_helpers.h" |
| 6 | #include "verifier_and.skel.h" | 6 | #include "verifier_and.skel.h" |
| 7 | #include "verifier_arena.skel.h" | 7 | #include "verifier_arena.skel.h" |
| 8 | #include "verifier_arena_large.skel.h" | ||
| 8 | #include "verifier_array_access.skel.h" | 9 | #include "verifier_array_access.skel.h" |
| 9 | #include "verifier_basic_stack.skel.h" | 10 | #include "verifier_basic_stack.skel.h" |
| 10 | #include "verifier_bitfield_write.skel.h" | 11 | #include "verifier_bitfield_write.skel.h" |
| @@ -120,6 +121,7 @@ static void run_tests_aux(const char *skel_name, · 109 unmodified lines | |||
| 120 | 121 | ||
| 121 | void test_verifier_and(void) { RUN(verifier_and); } | 122 | void test_verifier_and(void) { RUN(verifier_and); } |
| 122 | void test_verifier_arena(void) { RUN(verifier_arena); } | 123 | void test_verifier_arena(void) { RUN(verifier_arena); } |
| 124 | void test_verifier_arena_large(void) { RUN(verifier_arena_large); } | ||
| 123 | void test_verifier_basic_stack(void) { RUN(verifier_basic_stack); } | 125 | void test_verifier_basic_stack(void) { RUN(verifier_basic_stack); } |
| 124 | void test_verifier_bitfield_write(void) { RUN(verifier_bitfield_write); } | 126 | void test_verifier_bitfield_write(void) { RUN(verifier_bitfield_write); } |
| 125 | void test_verifier_bounds(void) { RUN(verifier_bounds); } | 127 | void test_verifier_bounds(void) { RUN(verifier_bounds); } |
| @@ -22,7 +22,7 @@ int zero = 0; · 21 unmodified lines | |||
| 22 | SEC("syscall") | 22 | SEC("syscall") |
| 23 | int arena_htab_llvm(void *ctx) | 23 | int arena_htab_llvm(void *ctx) |
| 24 | { | 24 | { |
| 25 | #if defined(__BPF_FEATURE_ARENA_CAST) || defined(BPF_ARENA_FORCE_ASM) | 25 | #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) || defined(BPF_ARENA_FORCE_ASM) |
| 26 | struct htab __arena *htab; | 26 | struct htab __arena *htab; |
| 27 | __u64 i; | 27 | __u64 i; |
| 28 | 28 | ||
| @@ -30,13 +30,13 @@ int list_sum; · 29 unmodified lines | |||
| 30 | int cnt; | 30 | int cnt; |
| 31 | bool skip = false; | 31 | bool skip = false; |
| 32 | 32 | ||
| 33 | #ifdef __BPF_FEATURE_ARENA_CAST | 33 | #ifdef __BPF_FEATURE_ADDR_SPACE_CAST |
| 34 | long __arena arena_sum; | 34 | long __arena arena_sum; |
| 35 | int __arena test_val = 1; | 35 | int __arena test_val = 1; |
| 36 | struct arena_list_head __arena global_head; | 36 | struct arena_list_head __arena global_head; |
| 37 | #else | 37 | #else |
| 38 | long arena_sum SEC(".arena.1"); | 38 | long arena_sum SEC(".addr_space.1"); |
| 39 | int test_val SEC(".arena.1"); | 39 | int test_val SEC(".addr_space.1"); |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | int zero; | 42 | int zero; |
| @@ -44,7 +44,7 @@ int zero; · 1 unmodified line | |||
| 44 | SEC("syscall") | 44 | SEC("syscall") |
| 45 | int arena_list_add(void *ctx) | 45 | int arena_list_add(void *ctx) |
| 46 | { | 46 | { |
| 47 | #ifdef __BPF_FEATURE_ARENA_CAST | 47 | #ifdef __BPF_FEATURE_ADDR_SPACE_CAST |
| 48 | __u64 i; | 48 | __u64 i; |
| 49 | 49 | ||
| 50 | list_head = &global_head; | 50 | list_head = &global_head; |
| @@ -66,7 +66,7 @@ int arena_list_add(void *ctx) · 15 unmodified lines | |||
| 66 | SEC("syscall") | 66 | SEC("syscall") |
| 67 | int arena_list_del(void *ctx) | 67 | int arena_list_del(void *ctx) |
| 68 | { | 68 | { |
| 69 | #ifdef __BPF_FEATURE_ARENA_CAST | 69 | #ifdef __BPF_FEATURE_ADDR_SPACE_CAST |
| 70 | struct elem __arena *n; | 70 | struct elem __arena *n; |
| 71 | int sum = 0; | 71 | int sum = 0; |
| 72 | 72 | ||
| @@ -12,14 +12,18 @@ struct { · 11 unmodified lines | |||
| 12 | __uint(type, BPF_MAP_TYPE_ARENA); | 12 | __uint(type, BPF_MAP_TYPE_ARENA); |
| 13 | __uint(map_flags, BPF_F_MMAPABLE); | 13 | __uint(map_flags, BPF_F_MMAPABLE); |
| 14 | __uint(max_entries, 2); /* arena of two pages close to 32-bit boundary*/ | 14 | __uint(max_entries, 2); /* arena of two pages close to 32-bit boundary*/ |
| 15 | __ulong(map_extra, (1ull << 44) | (~0u - __PAGE_SIZE * 2 + 1)); /* start of mmap() region */ | 15 | #ifdef __TARGET_ARCH_arm64 |
| 16 | __ulong(map_extra, (1ull << 32) | (~0u - __PAGE_SIZE * 2 + 1)); /* start of mmap() region */ | ||
| 17 | #else | ||
| 18 | __ulong(map_extra, (1ull << 44) | (~0u - __PAGE_SIZE * 2 + 1)); /* start of mmap() region */ | ||
| 19 | #endif | ||
| 16 | } arena SEC(".maps"); | 20 | } arena SEC(".maps"); |
| 17 | 21 | ||
| 18 | SEC("syscall") | 22 | SEC("syscall") |
| 19 | __success __retval(0) | 23 | __success __retval(0) |
| 20 | int basic_alloc1(void *ctx) | 24 | int basic_alloc1(void *ctx) |
| 21 | { | 25 | { |
| 22 | #if defined(__BPF_FEATURE_ARENA_CAST) | 26 | #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) |
| 23 | volatile int __arena *page1, *page2, *no_page, *page3; | 27 | volatile int __arena *page1, *page2, *no_page, *page3; |
| 24 | 28 | ||
| 25 | page1 = bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0); | 29 | page1 = bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0); |
| @@ -58,7 +62,7 @@ SEC("syscall") · 32 unmodified lines | |||
| 58 | __success __retval(0) | 62 | __success __retval(0) |
| 59 | int basic_alloc2(void *ctx) | 63 | int basic_alloc2(void *ctx) |
| 60 | { | 64 | { |
| 61 | #if defined(__BPF_FEATURE_ARENA_CAST) | 65 | #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) |
| 62 | volatile char __arena *page1, *page2, *page3, *page4; | 66 | volatile char __arena *page1, *page2, *page3, *page4; |
| 63 | 67 | ||
| 64 | page1 = bpf_arena_alloc_pages(&arena, NULL, 2, NUMA_NO_NODE, 0); | 68 | page1 = bpf_arena_alloc_pages(&arena, NULL, 2, NUMA_NO_NODE, 0); |
| @@ -0,0 +1,68 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ | ||
| 3 | |||
| 4 | #include <vmlinux.h> | ||
| 5 | #include <bpf/bpf_helpers.h> | ||
| 6 | #include <bpf/bpf_tracing.h> | ||
| 7 | #include "bpf_misc.h" | ||
| 8 | #include "bpf_experimental.h" | ||
| 9 | #include "bpf_arena_common.h" | ||
| 10 | |||
| 11 | #define ARENA_SIZE (1ull << 32) | ||
| 12 | |||
| 13 | struct { | ||
| 14 | __uint(type, BPF_MAP_TYPE_ARENA); | ||
| 15 | __uint(map_flags, BPF_F_MMAPABLE); | ||
| 16 | __uint(max_entries, ARENA_SIZE / PAGE_SIZE); | ||
| 17 | } arena SEC(".maps"); | ||
| 18 | |||
| 19 | SEC("syscall") | ||
| 20 | __success __retval(0) | ||
| 21 | int big_alloc1(void *ctx) | ||
| 22 | { | ||
| 23 | #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) | ||
| 24 | volatile char __arena *page1, *page2, *no_page, *page3; | ||
| 25 | void __arena *base; | ||
| 26 | |||
| 27 | page1 = base = bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0); | ||
| 28 | if (!page1) | ||
| 29 | return 1; | ||
| 30 | *page1 = 1; | ||
| 31 | page2 = bpf_arena_alloc_pages(&arena, base + ARENA_SIZE - PAGE_SIZE, | ||
| 32 | 1, NUMA_NO_NODE, 0); | ||
| 33 | if (!page2) | ||
| 34 | return 2; | ||
| 35 | *page2 = 2; | ||
| 36 | no_page = bpf_arena_alloc_pages(&arena, base + ARENA_SIZE, | ||
| 37 | 1, NUMA_NO_NODE, 0); | ||
| 38 | if (no_page) | ||
| 39 | return 3; | ||
| 40 | if (*page1 != 1) | ||
| 41 | return 4; | ||
| 42 | if (*page2 != 2) | ||
| 43 | return 5; | ||
| 44 | bpf_arena_free_pages(&arena, (void __arena *)page1, 1); | ||
| 45 | if (*page2 != 2) | ||
| 46 | return 6; | ||
| 47 | if (*page1 != 0) /* use-after-free should return 0 */ | ||
| 48 | return 7; | ||
| 49 | page3 = bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0); | ||
| 50 | if (!page3) | ||
| 51 | return 8; | ||
| 52 | *page3 = 3; | ||
| 53 | if (page1 != page3) | ||
| 54 | return 9; | ||
| 55 | if (*page2 != 2) | ||
| 56 | return 10; | ||
| 57 | if (*(page1 + PAGE_SIZE) != 0) | ||
| 58 | return 11; | ||
| 59 | if (*(page1 - PAGE_SIZE) != 0) | ||
| 60 | return 12; | ||
| 61 | if (*(page2 + PAGE_SIZE) != 0) | ||
| 62 | return 13; | ||
| 63 | if (*(page2 - PAGE_SIZE) != 0) | ||
| 64 | return 14; | ||
| 65 | #endif | ||
| 66 | return 0; | ||
| 67 | } | ||
| 68 | char _license[] SEC("license") = "GPL"; | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | CONFIG_DMABUF_HEAPS=y | ||
| 2 | CONFIG_DMABUF_HEAPS_SYSTEM=y | ||
| 3 | CONFIG_DRM_VGEM=y | ||
| @@ -0,0 +1 @@ | |||
| 1 | timeout=600 | ||
| @@ -19,8 +19,8 @@ include ../lib.mk · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | $(OUTPUT)/subdir: | 20 | $(OUTPUT)/subdir: |
| 21 | mkdir -p $@ | 21 | mkdir -p $@ |
| 22 | $(OUTPUT)/script: | 22 | $(OUTPUT)/script: Makefile |
| 23 | echo '#!/bin/sh' > $@ | 23 | echo '#!/bin/bash' > $@ |
| 24 | echo 'exit $$*' >> $@ | 24 | echo 'exit $$*' >> $@ |
| 25 | chmod +x $@ | 25 | chmod +x $@ |
| 26 | $(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat | 26 | $(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat |
| @@ -16,6 +16,8 @@ SIZE=256 · 15 unmodified lines | |||
| 16 | NAME_MAX=int(subprocess.check_output(["getconf", "NAME_MAX", "."])) | 16 | NAME_MAX=int(subprocess.check_output(["getconf", "NAME_MAX", "."])) |
| 17 | 17 | ||
| 18 | test_num=0 | 18 | test_num=0 |
| 19 | pass_num=0 | ||
| 20 | fail_num=0 | ||
| 19 | 21 | ||
| 20 | code='''#!/usr/bin/perl | 22 | code='''#!/usr/bin/perl |
| 21 | print "Executed interpreter! Args:\n"; | 23 | print "Executed interpreter! Args:\n"; |
| @@ -42,7 +44,7 @@ foreach my $a (@ARGV) { · 20 unmodified lines | |||
| 42 | # ... | 44 | # ... |
| 43 | def test(name, size, good=True, leading="", root="./", target="/perl", | 45 | def test(name, size, good=True, leading="", root="./", target="/perl", |
| 44 | fill="A", arg="", newline="\n", hashbang="#!"): | 46 | fill="A", arg="", newline="\n", hashbang="#!"): |
| 45 | global test_num, tests, NAME_MAX | 47 | global test_num, pass_num, fail_num, tests, NAME_MAX |
| 46 | test_num += 1 | 48 | test_num += 1 |
| 47 | if test_num > tests: | 49 | if test_num > tests: |
| 48 | raise ValueError("more binfmt_script tests than expected! (want %d, expected %d)" | 50 | raise ValueError("more binfmt_script tests than expected! (want %d, expected %d)" |
| @@ -80,16 +82,20 @@ def test(name, size, good=True, leading="", root="./", target="/perl", · 31 unmodified lines | |||
| 80 | if good: | 82 | if good: |
| 81 | print("ok %d - binfmt_script %s (successful good exec)" | 83 | print("ok %d - binfmt_script %s (successful good exec)" |
| 82 | % (test_num, name)) | 84 | % (test_num, name)) |
| 85 | pass_num += 1 | ||
| 83 | else: | 86 | else: |
| 84 | print("not ok %d - binfmt_script %s succeeded when it should have failed" | 87 | print("not ok %d - binfmt_script %s succeeded when it should have failed" |
| 85 | % (test_num, name)) | 88 | % (test_num, name)) |
| 89 | fail_num = 1 | ||
| 86 | else: | 90 | else: |
| 87 | if good: | 91 | if good: |
| 88 | print("not ok %d - binfmt_script %s failed when it should have succeeded (rc:%d)" | 92 | print("not ok %d - binfmt_script %s failed when it should have succeeded (rc:%d)" |
| 89 | % (test_num, name, proc.returncode)) | 93 | % (test_num, name, proc.returncode)) |
| 94 | fail_num = 1 | ||
| 90 | else: | 95 | else: |
| 91 | print("ok %d - binfmt_script %s (correctly failed bad exec)" | 96 | print("ok %d - binfmt_script %s (correctly failed bad exec)" |
| 92 | % (test_num, name)) | 97 | % (test_num, name)) |
| 98 | pass_num += 1 | ||
| 93 | 99 | ||
| 94 | # Clean up crazy binaries | 100 | # Clean up crazy binaries |
| 95 | os.unlink(script) | 101 | os.unlink(script) |
| @@ -166,6 +172,8 @@ test(name="two-under-trunc-arg", size=int(SIZE/2), arg=" ") · 70 unmodified lines | |||
| 166 | test(name="two-under-leading", size=int(SIZE/2), leading=" ") | 172 | test(name="two-under-leading", size=int(SIZE/2), leading=" ") |
| 167 | test(name="two-under-lead-trunc-arg", size=int(SIZE/2), leading=" ", arg=" ") | 173 | test(name="two-under-lead-trunc-arg", size=int(SIZE/2), leading=" ", arg=" ") |
| 168 | 174 | ||
| 175 | print("# Totals: pass:%d fail:%d xfail:0 xpass:0 skip:0 error:0" % (pass_num, fail_num)) | ||
| 176 | |||
| 169 | if test_num != tests: | 177 | if test_num != tests: |
| 170 | raise ValueError("fewer binfmt_script tests than expected! (ran %d, expected %d" | 178 | raise ValueError("fewer binfmt_script tests than expected! (ran %d, expected %d" |
| 171 | % (test_num, tests)) | 179 | % (test_num, tests)) |
| @@ -98,10 +98,9 @@ static int check_execveat_invoked_rc(int fd, const char *path, int flags, · 97 unmodified lines | |||
| 98 | if (child == 0) { | 98 | if (child == 0) { |
| 99 | /* Child: do execveat(). */ | 99 | /* Child: do execveat(). */ |
| 100 | rc = execveat_(fd, path, argv, envp, flags); | 100 | rc = execveat_(fd, path, argv, envp, flags); |
| 101 | ksft_print_msg("execveat() failed, rc=%d errno=%d (%s)\n", | 101 | ksft_print_msg("child execveat() failed, rc=%d errno=%d (%s)\n", |
| 102 | rc, errno, strerror(errno)); | 102 | rc, errno, strerror(errno)); |
| 103 | ksft_test_result_fail("%s\n", test_name); | 103 | exit(errno); |
| 104 | exit(1); /* should not reach here */ | ||
| 105 | } | 104 | } |
| 106 | /* Parent: wait for & check child's exit status. */ | 105 | /* Parent: wait for & check child's exit status. */ |
| 107 | rc = waitpid(child, &status, 0); | 106 | rc = waitpid(child, &status, 0); |
| @@ -226,11 +225,14 @@ static int check_execveat_pathmax(int root_dfd, const char *src, int is_script) · 118 unmodified lines | |||
| 226 | * "If the command name is found, but it is not an executable utility, | 225 | * "If the command name is found, but it is not an executable utility, |
| 227 | * the exit status shall be 126."), so allow either. | 226 | * the exit status shall be 126."), so allow either. |
| 228 | */ | 227 | */ |
| 229 | if (is_script) | 228 | if (is_script) { |
| 229 | ksft_print_msg("Invoke script via root_dfd and relative filename\n"); | ||
| 230 | fail += check_execveat_invoked_rc(root_dfd, longpath + 1, 0, | 230 | fail += check_execveat_invoked_rc(root_dfd, longpath + 1, 0, |
| 231 | 127, 126); | 231 | 127, 126); |
| 232 | else | 232 | } else { |
| 233 | ksft_print_msg("Invoke exec via root_dfd and relative filename\n"); | ||
| 233 | fail += check_execveat(root_dfd, longpath + 1, 0); | 234 | fail += check_execveat(root_dfd, longpath + 1, 0); |
| 235 | } | ||
| 234 | 236 | ||
| 235 | return fail; | 237 | return fail; |
| 236 | } | 238 | } |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | #include <link.h> | 5 | #include <link.h> |
| 6 | #include <stdio.h> | 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
| 8 | #include "../kselftest.h" | ||
| 8 | 9 | ||
| 9 | struct Statistics { | 10 | struct Statistics { |
| 10 | unsigned long long load_address; | 11 | unsigned long long load_address; |
| @@ -41,28 +42,23 @@ int main(int argc, char **argv) · 30 unmodified lines | |||
| 41 | unsigned long long misalign; | 42 | unsigned long long misalign; |
| 42 | int ret; | 43 | int ret; |
| 43 | 44 | ||
| 45 | ksft_print_header(); | ||
| 46 | ksft_set_plan(1); | ||
| 47 | |||
| 44 | ret = dl_iterate_phdr(ExtractStatistics, &extracted); | 48 | ret = dl_iterate_phdr(ExtractStatistics, &extracted); |
| 45 | if (ret != 1) { | 49 | if (ret != 1) |
| 46 | fprintf(stderr, "FAILED\n"); | 50 | ksft_exit_fail_msg("FAILED: dl_iterate_phdr\n"); |
| 47 | return 1; | ||
| 48 | } | ||
| 49 | 51 | ||
| 50 | if (extracted.alignment == 0) { | 52 | if (extracted.alignment == 0) |
| 51 | fprintf(stderr, "No alignment found\n"); | 53 | ksft_exit_fail_msg("FAILED: No alignment found\n"); |
| 52 | return 1; | 54 | else if (extracted.alignment & (extracted.alignment - 1)) |
| 53 | } else if (extracted.alignment & (extracted.alignment - 1)) { | 55 | ksft_exit_fail_msg("FAILED: Alignment is not a power of 2\n"); |
| 54 | fprintf(stderr, "Alignment is not a power of 2\n"); | ||
| 55 | return 1; | ||
| 56 | } | ||
| 57 | 56 | ||
| 58 | misalign = extracted.load_address & (extracted.alignment - 1); | 57 | misalign = extracted.load_address & (extracted.alignment - 1); |
| 59 | if (misalign) { | 58 | if (misalign) |
| 60 | printf("alignment = %llu, load_address = %llu\n", | 59 | ksft_exit_fail_msg("FAILED: alignment = %llu, load_address = %llu\n", |
| 61 | extracted.alignment, extracted.load_address); | 60 | extracted.alignment, extracted.load_address); |
| 62 | fprintf(stderr, "FAILED\n"); | ||
| 63 | return 1; | ||
| 64 | } | ||
| 65 | 61 | ||
| 66 | fprintf(stderr, "PASS\n"); | 62 | ksft_test_result_pass("Completed\n"); |
| 67 | return 0; | 63 | ksft_finished(); |
| 68 | } | 64 | } |
| @@ -23,45 +23,44 @@ · 22 unmodified lines | |||
| 23 | #include <fcntl.h> | 23 | #include <fcntl.h> |
| 24 | #include <sys/mount.h> | 24 | #include <sys/mount.h> |
| 25 | #include <unistd.h> | 25 | #include <unistd.h> |
| 26 | #include "../kselftest.h" | ||
| 26 | 27 | ||
| 27 | int main(void) | 28 | int main(void) |
| 28 | { | 29 | { |
| 30 | int fd, rv; | ||
| 31 | |||
| 32 | ksft_print_header(); | ||
| 33 | ksft_set_plan(1); | ||
| 34 | |||
| 29 | if (unshare(CLONE_NEWNS) == -1) { | 35 | if (unshare(CLONE_NEWNS) == -1) { |
| 30 | if (errno == ENOSYS || errno == EPERM) { | 36 | if (errno == ENOSYS || errno == EPERM) { |
| 31 | fprintf(stderr, "error: unshare, errno %d\n", errno); | 37 | ksft_test_result_skip("error: unshare, errno %d\n", errno); |
| 32 | return 4; | 38 | ksft_finished(); |
| 33 | } | 39 | } |
| 34 | fprintf(stderr, "error: unshare, errno %d\n", errno); | 40 | ksft_exit_fail_msg("error: unshare, errno %d\n", errno); |
| 35 | return 1; | ||
| 36 | } | ||
| 37 | if (mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL) == -1) { | ||
| 38 | fprintf(stderr, "error: mount '/', errno %d\n", errno); | ||
| 39 | return 1; | ||
| 40 | } | 41 | } |
| 42 | |||
| 43 | if (mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL) == -1) | ||
| 44 | ksft_exit_fail_msg("error: mount '/', errno %d\n", errno); | ||
| 45 | |||
| 41 | /* Require "exec" filesystem. */ | 46 | /* Require "exec" filesystem. */ |
| 42 | if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1) { | 47 | if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1) |
| 43 | fprintf(stderr, "error: mount ramfs, errno %d\n", errno); | 48 | ksft_exit_fail_msg("error: mount ramfs, errno %d\n", errno); |
| 44 | return 1; | ||
| 45 | } | ||
| 46 | 49 | ||
| 47 | #define FILENAME "/tmp/1" | 50 | #define FILENAME "/tmp/1" |
| 48 | 51 | ||
| 49 | int fd = creat(FILENAME, 0700); | 52 | fd = creat(FILENAME, 0700); |
| 50 | if (fd == -1) { | 53 | if (fd == -1) |
| 51 | fprintf(stderr, "error: creat, errno %d\n", errno); | 54 | ksft_exit_fail_msg("error: creat, errno %d\n", errno); |
| 52 | return 1; | 55 | |
| 53 | } | ||
| 54 | #define S "#!" FILENAME "\n" | 56 | #define S "#!" FILENAME "\n" |
| 55 | if (write(fd, S, strlen(S)) != strlen(S)) { | 57 | if (write(fd, S, strlen(S)) != strlen(S)) |
| 56 | fprintf(stderr, "error: write, errno %d\n", errno); | 58 | ksft_exit_fail_msg("error: write, errno %d\n", errno); |
| 57 | return 1; | 59 | |
| 58 | } | ||
| 59 | close(fd); | 60 | close(fd); |
| 60 | 61 | ||
| 61 | int rv = execve(FILENAME, NULL, NULL); | 62 | rv = execve(FILENAME, NULL, NULL); |
| 62 | if (rv == -1 && errno == ELOOP) { | 63 | ksft_test_result(rv == -1 && errno == ELOOP, |
| 63 | return 0; | 64 | "execve failed as expected (ret %d, errno %d)\n", rv, errno); |
| 64 | } | 65 | ksft_finished(); |
| 65 | fprintf(stderr, "error: execve, rv %d, errno %d\n", rv, errno); | ||
| 66 | return 1; | ||
| 67 | } | 66 | } |
| @@ -24,7 +24,7 @@ echo 0 > events/enable · 23 unmodified lines | |||
| 24 | echo "Get the most frequently calling function" | 24 | echo "Get the most frequently calling function" |
| 25 | sample_events | 25 | sample_events |
| 26 | 26 | ||
| 27 | target_func=`cut -d: -f3 trace | sed 's/call_site=\([^+]*\)+0x.*/\1/' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'` | 27 | target_func=`cat trace | grep -o 'call_site=\([^+]*\)' | sed 's/call_site=//' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'` |
| 28 | if [ -z "$target_func" ]; then | 28 | if [ -z "$target_func" ]; then |
| 29 | exit_fail | 29 | exit_fail |
| 30 | fi | 30 | fi |
| @@ -203,7 +203,7 @@ int main(int argc, char **argv) · 202 unmodified lines | |||
| 203 | ksft_print_header(); | 203 | ksft_print_header(); |
| 204 | ksft_set_plan(nthreads); | 204 | ksft_set_plan(nthreads); |
| 205 | 205 | ||
| 206 | filed = open(file, O_RDWR|O_CREAT); | 206 | filed = open(file, O_RDWR|O_CREAT, 0664); |
| 207 | if (filed < 0) | 207 | if (filed < 0) |
| 208 | ksft_exit_fail_msg("Unable to open %s: %s\n", file, strerror(errno)); | 208 | ksft_exit_fail_msg("Unable to open %s: %s\n", file, strerror(errno)); |
| 209 | 209 | ||
| @@ -1745,9 +1745,12 @@ void pkey_setup_shadow(void) · 1744 unmodified lines | |||
| 1745 | shadow_pkey_reg = __read_pkey_reg(); | 1745 | shadow_pkey_reg = __read_pkey_reg(); |
| 1746 | } | 1746 | } |
| 1747 | 1747 | ||
| 1748 | pid_t parent_pid; | ||
| 1749 | |||
| 1748 | void restore_settings_atexit(void) | 1750 | void restore_settings_atexit(void) |
| 1749 | { | 1751 | { |
| 1750 | cat_into_file(buf, "/proc/sys/vm/nr_hugepages"); | 1752 | if (parent_pid == getpid()) |
| 1753 | cat_into_file(buf, "/proc/sys/vm/nr_hugepages"); | ||
| 1751 | } | 1754 | } |
| 1752 | 1755 | ||
| 1753 | void save_settings(void) | 1756 | void save_settings(void) |
| @@ -1773,6 +1776,7 @@ void save_settings(void) · 19 unmodified lines | |||
| 1773 | exit(__LINE__); | 1776 | exit(__LINE__); |
| 1774 | } | 1777 | } |
| 1775 | 1778 | ||
| 1779 | parent_pid = getpid(); | ||
| 1776 | atexit(restore_settings_atexit); | 1780 | atexit(restore_settings_atexit); |
| 1777 | close(fd); | 1781 | close(fd); |
| 1778 | } | 1782 | } |
| @@ -137,7 +137,7 @@ static void test_mprotect(int pagemap_fd, int pagesize, bool anon) · 136 unmodified lines | |||
| 137 | if (!map) | 137 | if (!map) |
| 138 | ksft_exit_fail_msg("anon mmap failed\n"); | 138 | ksft_exit_fail_msg("anon mmap failed\n"); |
| 139 | } else { | 139 | } else { |
| 140 | test_fd = open(fname, O_RDWR | O_CREAT); | 140 | test_fd = open(fname, O_RDWR | O_CREAT, 0664); |
| 141 | if (test_fd < 0) { | 141 | if (test_fd < 0) { |
| 142 | ksft_test_result_skip("Test %s open() file failed\n", __func__); | 142 | ksft_test_result_skip("Test %s open() file failed\n", __func__); |
| 143 | return; | 143 | return; |
| @@ -223,7 +223,7 @@ void split_file_backed_thp(void) · 222 unmodified lines | |||
| 223 | ksft_exit_fail_msg("Fail to create file-backed THP split testing file\n"); | 223 | ksft_exit_fail_msg("Fail to create file-backed THP split testing file\n"); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | fd = open(testfile, O_CREAT|O_WRONLY); | 226 | fd = open(testfile, O_CREAT|O_WRONLY, 0664); |
| 227 | if (fd == -1) { | 227 | if (fd == -1) { |
| 228 | ksft_perror("Cannot open testing file"); | 228 | ksft_perror("Cannot open testing file"); |
| 229 | goto cleanup; | 229 | goto cleanup; |
| @@ -18,6 +18,7 @@ bool test_uffdio_wp = true; · 17 unmodified lines | |||
| 18 | unsigned long long *count_verify; | 18 | unsigned long long *count_verify; |
| 19 | uffd_test_ops_t *uffd_test_ops; | 19 | uffd_test_ops_t *uffd_test_ops; |
| 20 | uffd_test_case_ops_t *uffd_test_case_ops; | 20 | uffd_test_case_ops_t *uffd_test_case_ops; |
| 21 | atomic_bool ready_for_fork; | ||
| 21 | 22 | ||
| 22 | static int uffd_mem_fd_create(off_t mem_size, bool hugetlb) | 23 | static int uffd_mem_fd_create(off_t mem_size, bool hugetlb) |
| 23 | { | 24 | { |
| @@ -518,6 +519,8 @@ void *uffd_poll_thread(void *arg) · 494 unmodified lines | |||
| 518 | pollfd[1].fd = pipefd[cpu*2]; | 519 | pollfd[1].fd = pipefd[cpu*2]; |
| 519 | pollfd[1].events = POLLIN; | 520 | pollfd[1].events = POLLIN; |
| 520 | 521 | ||
| 522 | ready_for_fork = true; | ||
| 523 | |||
| 521 | for (;;) { | 524 | for (;;) { |
| 522 | ret = poll(pollfd, 2, -1); | 525 | ret = poll(pollfd, 2, -1); |
| 523 | if (ret <= 0) { | 526 | if (ret <= 0) { |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include <inttypes.h> | 32 | #include <inttypes.h> |
| 33 | #include <stdint.h> | 33 | #include <stdint.h> |
| 34 | #include <sys/random.h> | 34 | #include <sys/random.h> |
| 35 | #include <stdatomic.h> | ||
| 35 | 36 | ||
| 36 | #include "../kselftest.h" | 37 | #include "../kselftest.h" |
| 37 | #include "vm_util.h" | 38 | #include "vm_util.h" |
| @@ -103,6 +104,7 @@ extern bool map_shared; · 65 unmodified lines | |||
| 103 | extern bool test_uffdio_wp; | 104 | extern bool test_uffdio_wp; |
| 104 | extern unsigned long long *count_verify; | 105 | extern unsigned long long *count_verify; |
| 105 | extern volatile bool test_uffdio_copy_eexist; | 106 | extern volatile bool test_uffdio_copy_eexist; |
| 107 | extern atomic_bool ready_for_fork; | ||
| 106 | 108 | ||
| 107 | extern uffd_test_ops_t anon_uffd_test_ops; | 109 | extern uffd_test_ops_t anon_uffd_test_ops; |
| 108 | extern uffd_test_ops_t shmem_uffd_test_ops; | 110 | extern uffd_test_ops_t shmem_uffd_test_ops; |
| @@ -775,6 +775,8 @@ static void uffd_sigbus_test_common(bool wp) · 774 unmodified lines | |||
| 775 | char c; | 775 | char c; |
| 776 | struct uffd_args args = { 0 }; | 776 | struct uffd_args args = { 0 }; |
| 777 | 777 | ||
| 778 | ready_for_fork = false; | ||
| 779 | |||
| 778 | fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); | 780 | fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); |
| 779 | 781 | ||
| 780 | if (uffd_register(uffd, area_dst, nr_pages * page_size, | 782 | if (uffd_register(uffd, area_dst, nr_pages * page_size, |
| @@ -790,6 +792,9 @@ static void uffd_sigbus_test_common(bool wp) · 9 unmodified lines | |||
| 790 | if (pthread_create(&uffd_mon, NULL, uffd_poll_thread, &args)) | 792 | if (pthread_create(&uffd_mon, NULL, uffd_poll_thread, &args)) |
| 791 | err("uffd_poll_thread create"); | 793 | err("uffd_poll_thread create"); |
| 792 | 794 | ||
| 795 | while (!ready_for_fork) | ||
| 796 | ; /* Wait for the poll_thread to start executing before forking */ | ||
| 797 | |||
| 793 | pid = fork(); | 798 | pid = fork(); |
| 794 | if (pid < 0) | 799 | if (pid < 0) |
| 795 | err("fork"); | 800 | err("fork"); |
| @@ -829,6 +834,8 @@ static void uffd_events_test_common(bool wp) · 33 unmodified lines | |||
| 829 | char c; | 834 | char c; |
| 830 | struct uffd_args args = { 0 }; | 835 | struct uffd_args args = { 0 }; |
| 831 | 836 | ||
| 837 | ready_for_fork = false; | ||
| 838 | |||
| 832 | fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); | 839 | fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); |
| 833 | if (uffd_register(uffd, area_dst, nr_pages * page_size, | 840 | if (uffd_register(uffd, area_dst, nr_pages * page_size, |
| 834 | true, wp, false)) | 841 | true, wp, false)) |
| @@ -838,6 +845,9 @@ static void uffd_events_test_common(bool wp) · 3 unmodified lines | |||
| 838 | if (pthread_create(&uffd_mon, NULL, uffd_poll_thread, &args)) | 845 | if (pthread_create(&uffd_mon, NULL, uffd_poll_thread, &args)) |
| 839 | err("uffd_poll_thread create"); | 846 | err("uffd_poll_thread create"); |
| 840 | 847 | ||
| 848 | while (!ready_for_fork) | ||
| 849 | ; /* Wait for the poll_thread to start executing before forking */ | ||
| 850 | |||
| 841 | pid = fork(); | 851 | pid = fork(); |
| 842 | if (pid < 0) | 852 | if (pid < 0) |
| 843 | err("fork"); | 853 | err("fork"); |
| @@ -1427,7 +1437,8 @@ uffd_test_case_t uffd_tests[] = { · 583 unmodified lines | |||
| 1427 | .uffd_fn = uffd_sigbus_wp_test, | 1437 | .uffd_fn = uffd_sigbus_wp_test, |
| 1428 | .mem_targets = MEM_ALL, | 1438 | .mem_targets = MEM_ALL, |
| 1429 | .uffd_feature_required = UFFD_FEATURE_SIGBUS | | 1439 | .uffd_feature_required = UFFD_FEATURE_SIGBUS | |
| 1430 | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_PAGEFAULT_FLAG_WP, | 1440 | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_PAGEFAULT_FLAG_WP | |
| 1441 | UFFD_FEATURE_WP_HUGETLBFS_SHMEM, | ||
| 1431 | }, | 1442 | }, |
| 1432 | { | 1443 | { |
| 1433 | .name = "events", | 1444 | .name = "events", |
| @@ -1177,6 +1177,7 @@ encap_params_common() · 1176 unmodified lines | |||
| 1177 | local plen=$1; shift | 1177 | local plen=$1; shift |
| 1178 | local enc_ethtype=$1; shift | 1178 | local enc_ethtype=$1; shift |
| 1179 | local grp=$1; shift | 1179 | local grp=$1; shift |
| 1180 | local grp_dmac=$1; shift | ||
| 1180 | local src=$1; shift | 1181 | local src=$1; shift |
| 1181 | local mz=$1; shift | 1182 | local mz=$1; shift |
| 1182 | 1183 | ||
| @@ -1195,11 +1196,11 @@ encap_params_common() · 12 unmodified lines | |||
| 1195 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep2_ip src_vni 10020" | 1196 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep2_ip src_vni 10020" |
| 1196 | 1197 | ||
| 1197 | run_cmd "tc -n $ns2 filter replace dev vx0 ingress pref 1 handle 101 proto all flower enc_dst_ip $vtep1_ip action pass" | 1198 | run_cmd "tc -n $ns2 filter replace dev vx0 ingress pref 1 handle 101 proto all flower enc_dst_ip $vtep1_ip action pass" |
| 1198 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1199 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1199 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1200 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1200 | log_test $? 0 "Destination IP - match" | 1201 | log_test $? 0 "Destination IP - match" |
| 1201 | 1202 | ||
| 1202 | run_cmd "ip netns exec $ns1 $mz br0.20 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1203 | run_cmd "ip netns exec $ns1 $mz br0.20 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1203 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1204 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1204 | log_test $? 0 "Destination IP - no match" | 1205 | log_test $? 0 "Destination IP - no match" |
| 1205 | 1206 | ||
| @@ -1212,20 +1213,20 @@ encap_params_common() · 6 unmodified lines | |||
| 1212 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep1_ip dst_port 1111 src_vni 10020" | 1213 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep1_ip dst_port 1111 src_vni 10020" |
| 1213 | 1214 | ||
| 1214 | run_cmd "tc -n $ns2 filter replace dev veth0 ingress pref 1 handle 101 proto $enc_ethtype flower ip_proto udp dst_port 4789 action pass" | 1215 | run_cmd "tc -n $ns2 filter replace dev veth0 ingress pref 1 handle 101 proto $enc_ethtype flower ip_proto udp dst_port 4789 action pass" |
| 1215 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1216 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1216 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 | 1217 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 |
| 1217 | log_test $? 0 "Default destination port - match" | 1218 | log_test $? 0 "Default destination port - match" |
| 1218 | 1219 | ||
| 1219 | run_cmd "ip netns exec $ns1 $mz br0.20 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1220 | run_cmd "ip netns exec $ns1 $mz br0.20 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1220 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 | 1221 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 |
| 1221 | log_test $? 0 "Default destination port - no match" | 1222 | log_test $? 0 "Default destination port - no match" |
| 1222 | 1223 | ||
| 1223 | run_cmd "tc -n $ns2 filter replace dev veth0 ingress pref 1 handle 101 proto $enc_ethtype flower ip_proto udp dst_port 1111 action pass" | 1224 | run_cmd "tc -n $ns2 filter replace dev veth0 ingress pref 1 handle 101 proto $enc_ethtype flower ip_proto udp dst_port 1111 action pass" |
| 1224 | run_cmd "ip netns exec $ns1 $mz br0.20 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1225 | run_cmd "ip netns exec $ns1 $mz br0.20 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1225 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 | 1226 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 |
| 1226 | log_test $? 0 "Non-default destination port - match" | 1227 | log_test $? 0 "Non-default destination port - match" |
| 1227 | 1228 | ||
| 1228 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1229 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1229 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 | 1230 | tc_check_packets "$ns2" "dev veth0 ingress" 101 1 |
| 1230 | log_test $? 0 "Non-default destination port - no match" | 1231 | log_test $? 0 "Non-default destination port - no match" |
| 1231 | 1232 | ||
| @@ -1238,11 +1239,11 @@ encap_params_common() · 6 unmodified lines | |||
| 1238 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep1_ip src_vni 10020" | 1239 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep1_ip src_vni 10020" |
| 1239 | 1240 | ||
| 1240 | run_cmd "tc -n $ns2 filter replace dev vx0 ingress pref 1 handle 101 proto all flower enc_key_id 10010 action pass" | 1241 | run_cmd "tc -n $ns2 filter replace dev vx0 ingress pref 1 handle 101 proto all flower enc_key_id 10010 action pass" |
| 1241 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1242 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1242 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1243 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1243 | log_test $? 0 "Default destination VNI - match" | 1244 | log_test $? 0 "Default destination VNI - match" |
| 1244 | 1245 | ||
| 1245 | run_cmd "ip netns exec $ns1 $mz br0.20 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1246 | run_cmd "ip netns exec $ns1 $mz br0.20 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1246 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1247 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1247 | log_test $? 0 "Default destination VNI - no match" | 1248 | log_test $? 0 "Default destination VNI - no match" |
| 1248 | 1249 | ||
| @@ -1250,11 +1251,11 @@ encap_params_common() · 1 unmodified line | |||
| 1250 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep1_ip vni 10010 src_vni 10020" | 1251 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent dst $vtep1_ip vni 10010 src_vni 10020" |
| 1251 | 1252 | ||
| 1252 | run_cmd "tc -n $ns2 filter replace dev vx0 ingress pref 1 handle 101 proto all flower enc_key_id 10020 action pass" | 1253 | run_cmd "tc -n $ns2 filter replace dev vx0 ingress pref 1 handle 101 proto all flower enc_key_id 10020 action pass" |
| 1253 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1254 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1254 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1255 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1255 | log_test $? 0 "Non-default destination VNI - match" | 1256 | log_test $? 0 "Non-default destination VNI - match" |
| 1256 | 1257 | ||
| 1257 | run_cmd "ip netns exec $ns1 $mz br0.20 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1258 | run_cmd "ip netns exec $ns1 $mz br0.20 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1258 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1259 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1259 | log_test $? 0 "Non-default destination VNI - no match" | 1260 | log_test $? 0 "Non-default destination VNI - no match" |
| 1260 | 1261 | ||
| @@ -1272,6 +1273,7 @@ encap_params_ipv4_ipv4() · 11 unmodified lines | |||
| 1272 | local plen=32 | 1273 | local plen=32 |
| 1273 | local enc_ethtype="ip" | 1274 | local enc_ethtype="ip" |
| 1274 | local grp=239.1.1.1 | 1275 | local grp=239.1.1.1 |
| 1276 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1275 | local src=192.0.2.129 | 1277 | local src=192.0.2.129 |
| 1276 | 1278 | ||
| 1277 | echo | 1279 | echo |
| @@ -1279,7 +1281,7 @@ encap_params_ipv4_ipv4() · 1 unmodified line | |||
| 1279 | echo "------------------------------------------------------------------" | 1281 | echo "------------------------------------------------------------------" |
| 1280 | 1282 | ||
| 1281 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ | 1283 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ |
| 1282 | $grp $src "mausezahn" | 1284 | $grp $grp_dmac $src "mausezahn" |
| 1283 | } | 1285 | } |
| 1284 | 1286 | ||
| 1285 | encap_params_ipv6_ipv4() | 1287 | encap_params_ipv6_ipv4() |
| @@ -1291,6 +1293,7 @@ encap_params_ipv6_ipv4() · 5 unmodified lines | |||
| 1291 | local plen=32 | 1293 | local plen=32 |
| 1292 | local enc_ethtype="ip" | 1294 | local enc_ethtype="ip" |
| 1293 | local grp=ff0e::1 | 1295 | local grp=ff0e::1 |
| 1296 | local grp_dmac=33:33:00:00:00:01 | ||
| 1294 | local src=2001:db8:100::1 | 1297 | local src=2001:db8:100::1 |
| 1295 | 1298 | ||
| 1296 | echo | 1299 | echo |
| @@ -1298,7 +1301,7 @@ encap_params_ipv6_ipv4() · 1 unmodified line | |||
| 1298 | echo "------------------------------------------------------------------" | 1301 | echo "------------------------------------------------------------------" |
| 1299 | 1302 | ||
| 1300 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ | 1303 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ |
| 1301 | $grp $src "mausezahn -6" | 1304 | $grp $grp_dmac $src "mausezahn -6" |
| 1302 | } | 1305 | } |
| 1303 | 1306 | ||
| 1304 | encap_params_ipv4_ipv6() | 1307 | encap_params_ipv4_ipv6() |
| @@ -1310,6 +1313,7 @@ encap_params_ipv4_ipv6() · 5 unmodified lines | |||
| 1310 | local plen=128 | 1313 | local plen=128 |
| 1311 | local enc_ethtype="ipv6" | 1314 | local enc_ethtype="ipv6" |
| 1312 | local grp=239.1.1.1 | 1315 | local grp=239.1.1.1 |
| 1316 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1313 | local src=192.0.2.129 | 1317 | local src=192.0.2.129 |
| 1314 | 1318 | ||
| 1315 | echo | 1319 | echo |
| @@ -1317,7 +1321,7 @@ encap_params_ipv4_ipv6() · 1 unmodified line | |||
| 1317 | echo "------------------------------------------------------------------" | 1321 | echo "------------------------------------------------------------------" |
| 1318 | 1322 | ||
| 1319 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ | 1323 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ |
| 1320 | $grp $src "mausezahn" | 1324 | $grp $grp_dmac $src "mausezahn" |
| 1321 | } | 1325 | } |
| 1322 | 1326 | ||
| 1323 | encap_params_ipv6_ipv6() | 1327 | encap_params_ipv6_ipv6() |
| @@ -1329,6 +1333,7 @@ encap_params_ipv6_ipv6() · 5 unmodified lines | |||
| 1329 | local plen=128 | 1333 | local plen=128 |
| 1330 | local enc_ethtype="ipv6" | 1334 | local enc_ethtype="ipv6" |
| 1331 | local grp=ff0e::1 | 1335 | local grp=ff0e::1 |
| 1336 | local grp_dmac=33:33:00:00:00:01 | ||
| 1332 | local src=2001:db8:100::1 | 1337 | local src=2001:db8:100::1 |
| 1333 | 1338 | ||
| 1334 | echo | 1339 | echo |
| @@ -1336,7 +1341,7 @@ encap_params_ipv6_ipv6() · 1 unmodified line | |||
| 1336 | echo "------------------------------------------------------------------" | 1341 | echo "------------------------------------------------------------------" |
| 1337 | 1342 | ||
| 1338 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ | 1343 | encap_params_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $enc_ethtype \ |
| 1339 | $grp $src "mausezahn -6" | 1344 | $grp $grp_dmac $src "mausezahn -6" |
| 1340 | } | 1345 | } |
| 1341 | 1346 | ||
| 1342 | starg_exclude_ir_common() | 1347 | starg_exclude_ir_common() |
| @@ -1347,6 +1352,7 @@ starg_exclude_ir_common() · 4 unmodified lines | |||
| 1347 | local vtep2_ip=$1; shift | 1352 | local vtep2_ip=$1; shift |
| 1348 | local plen=$1; shift | 1353 | local plen=$1; shift |
| 1349 | local grp=$1; shift | 1354 | local grp=$1; shift |
| 1355 | local grp_dmac=$1; shift | ||
| 1350 | local valid_src=$1; shift | 1356 | local valid_src=$1; shift |
| 1351 | local invalid_src=$1; shift | 1357 | local invalid_src=$1; shift |
| 1352 | local mz=$1; shift | 1358 | local mz=$1; shift |
| @@ -1368,14 +1374,14 @@ starg_exclude_ir_common() · 15 unmodified lines | |||
| 1368 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $invalid_src dst $vtep2_ip src_vni 10010" | 1374 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $invalid_src dst $vtep2_ip src_vni 10010" |
| 1369 | 1375 | ||
| 1370 | # Check that invalid source is not forwarded to any VTEP. | 1376 | # Check that invalid source is not forwarded to any VTEP. |
| 1371 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1377 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1372 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 | 1378 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 |
| 1373 | log_test $? 0 "Block excluded source - first VTEP" | 1379 | log_test $? 0 "Block excluded source - first VTEP" |
| 1374 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 | 1380 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 |
| 1375 | log_test $? 0 "Block excluded source - second VTEP" | 1381 | log_test $? 0 "Block excluded source - second VTEP" |
| 1376 | 1382 | ||
| 1377 | # Check that valid source is forwarded to both VTEPs. | 1383 | # Check that valid source is forwarded to both VTEPs. |
| 1378 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1384 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1379 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1385 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1380 | log_test $? 0 "Forward valid source - first VTEP" | 1386 | log_test $? 0 "Forward valid source - first VTEP" |
| 1381 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 1387 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| @@ -1385,14 +1391,14 @@ starg_exclude_ir_common() · 3 unmodified lines | |||
| 1385 | run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep2_ip src_vni 10010" | 1391 | run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep2_ip src_vni 10010" |
| 1386 | 1392 | ||
| 1387 | # Check that invalid source is not forwarded to any VTEP. | 1393 | # Check that invalid source is not forwarded to any VTEP. |
| 1388 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1394 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1389 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1395 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1390 | log_test $? 0 "Block excluded source after removal - first VTEP" | 1396 | log_test $? 0 "Block excluded source after removal - first VTEP" |
| 1391 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 1397 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| 1392 | log_test $? 0 "Block excluded source after removal - second VTEP" | 1398 | log_test $? 0 "Block excluded source after removal - second VTEP" |
| 1393 | 1399 | ||
| 1394 | # Check that valid source is forwarded to the remaining VTEP. | 1400 | # Check that valid source is forwarded to the remaining VTEP. |
| 1395 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1401 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1396 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 | 1402 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 |
| 1397 | log_test $? 0 "Forward valid source after removal - first VTEP" | 1403 | log_test $? 0 "Forward valid source after removal - first VTEP" |
| 1398 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 1404 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| @@ -1407,6 +1413,7 @@ starg_exclude_ir_ipv4_ipv4() · 8 unmodified lines | |||
| 1407 | local vtep2_ip=198.51.100.200 | 1413 | local vtep2_ip=198.51.100.200 |
| 1408 | local plen=32 | 1414 | local plen=32 |
| 1409 | local grp=239.1.1.1 | 1415 | local grp=239.1.1.1 |
| 1416 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1410 | local valid_src=192.0.2.129 | 1417 | local valid_src=192.0.2.129 |
| 1411 | local invalid_src=192.0.2.145 | 1418 | local invalid_src=192.0.2.145 |
| 1412 | 1419 | ||
| @@ -1415,7 +1422,7 @@ starg_exclude_ir_ipv4_ipv4() · 2 unmodified lines | |||
| 1415 | echo "-------------------------------------------------------------" | 1422 | echo "-------------------------------------------------------------" |
| 1416 | 1423 | ||
| 1417 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1424 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1418 | $valid_src $invalid_src "mausezahn" | 1425 | $grp_dmac $valid_src $invalid_src "mausezahn" |
| 1419 | } | 1426 | } |
| 1420 | 1427 | ||
| 1421 | starg_exclude_ir_ipv6_ipv4() | 1428 | starg_exclude_ir_ipv6_ipv4() |
| @@ -1426,6 +1433,7 @@ starg_exclude_ir_ipv6_ipv4() · 4 unmodified lines | |||
| 1426 | local vtep2_ip=198.51.100.200 | 1433 | local vtep2_ip=198.51.100.200 |
| 1427 | local plen=32 | 1434 | local plen=32 |
| 1428 | local grp=ff0e::1 | 1435 | local grp=ff0e::1 |
| 1436 | local grp_dmac=33:33:00:00:00:01 | ||
| 1429 | local valid_src=2001:db8:100::1 | 1437 | local valid_src=2001:db8:100::1 |
| 1430 | local invalid_src=2001:db8:200::1 | 1438 | local invalid_src=2001:db8:200::1 |
| 1431 | 1439 | ||
| @@ -1434,7 +1442,7 @@ starg_exclude_ir_ipv6_ipv4() · 2 unmodified lines | |||
| 1434 | echo "-------------------------------------------------------------" | 1442 | echo "-------------------------------------------------------------" |
| 1435 | 1443 | ||
| 1436 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1444 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1437 | $valid_src $invalid_src "mausezahn -6" | 1445 | $grp_dmac $valid_src $invalid_src "mausezahn -6" |
| 1438 | } | 1446 | } |
| 1439 | 1447 | ||
| 1440 | starg_exclude_ir_ipv4_ipv6() | 1448 | starg_exclude_ir_ipv4_ipv6() |
| @@ -1445,6 +1453,7 @@ starg_exclude_ir_ipv4_ipv6() · 4 unmodified lines | |||
| 1445 | local vtep2_ip=2001:db8:2000::1 | 1453 | local vtep2_ip=2001:db8:2000::1 |
| 1446 | local plen=128 | 1454 | local plen=128 |
| 1447 | local grp=239.1.1.1 | 1455 | local grp=239.1.1.1 |
| 1456 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1448 | local valid_src=192.0.2.129 | 1457 | local valid_src=192.0.2.129 |
| 1449 | local invalid_src=192.0.2.145 | 1458 | local invalid_src=192.0.2.145 |
| 1450 | 1459 | ||
| @@ -1453,7 +1462,7 @@ starg_exclude_ir_ipv4_ipv6() · 2 unmodified lines | |||
| 1453 | echo "-------------------------------------------------------------" | 1462 | echo "-------------------------------------------------------------" |
| 1454 | 1463 | ||
| 1455 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1464 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1456 | $valid_src $invalid_src "mausezahn" | 1465 | $grp_dmac $valid_src $invalid_src "mausezahn" |
| 1457 | } | 1466 | } |
| 1458 | 1467 | ||
| 1459 | starg_exclude_ir_ipv6_ipv6() | 1468 | starg_exclude_ir_ipv6_ipv6() |
| @@ -1464,6 +1473,7 @@ starg_exclude_ir_ipv6_ipv6() · 4 unmodified lines | |||
| 1464 | local vtep2_ip=2001:db8:2000::1 | 1473 | local vtep2_ip=2001:db8:2000::1 |
| 1465 | local plen=128 | 1474 | local plen=128 |
| 1466 | local grp=ff0e::1 | 1475 | local grp=ff0e::1 |
| 1476 | local grp_dmac=33:33:00:00:00:01 | ||
| 1467 | local valid_src=2001:db8:100::1 | 1477 | local valid_src=2001:db8:100::1 |
| 1468 | local invalid_src=2001:db8:200::1 | 1478 | local invalid_src=2001:db8:200::1 |
| 1469 | 1479 | ||
| @@ -1472,7 +1482,7 @@ starg_exclude_ir_ipv6_ipv6() · 2 unmodified lines | |||
| 1472 | echo "-------------------------------------------------------------" | 1482 | echo "-------------------------------------------------------------" |
| 1473 | 1483 | ||
| 1474 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1484 | starg_exclude_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1475 | $valid_src $invalid_src "mausezahn -6" | 1485 | $grp_dmac $valid_src $invalid_src "mausezahn -6" |
| 1476 | } | 1486 | } |
| 1477 | 1487 | ||
| 1478 | starg_include_ir_common() | 1488 | starg_include_ir_common() |
| @@ -1483,6 +1493,7 @@ starg_include_ir_common() · 4 unmodified lines | |||
| 1483 | local vtep2_ip=$1; shift | 1493 | local vtep2_ip=$1; shift |
| 1484 | local plen=$1; shift | 1494 | local plen=$1; shift |
| 1485 | local grp=$1; shift | 1495 | local grp=$1; shift |
| 1496 | local grp_dmac=$1; shift | ||
| 1486 | local valid_src=$1; shift | 1497 | local valid_src=$1; shift |
| 1487 | local invalid_src=$1; shift | 1498 | local invalid_src=$1; shift |
| 1488 | local mz=$1; shift | 1499 | local mz=$1; shift |
| @@ -1504,14 +1515,14 @@ starg_include_ir_common() · 15 unmodified lines | |||
| 1504 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode include source_list $valid_src dst $vtep2_ip src_vni 10010" | 1515 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode include source_list $valid_src dst $vtep2_ip src_vni 10010" |
| 1505 | 1516 | ||
| 1506 | # Check that invalid source is not forwarded to any VTEP. | 1517 | # Check that invalid source is not forwarded to any VTEP. |
| 1507 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1518 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1508 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 | 1519 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 |
| 1509 | log_test $? 0 "Block excluded source - first VTEP" | 1520 | log_test $? 0 "Block excluded source - first VTEP" |
| 1510 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 | 1521 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 |
| 1511 | log_test $? 0 "Block excluded source - second VTEP" | 1522 | log_test $? 0 "Block excluded source - second VTEP" |
| 1512 | 1523 | ||
| 1513 | # Check that valid source is forwarded to both VTEPs. | 1524 | # Check that valid source is forwarded to both VTEPs. |
| 1514 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1525 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1515 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1526 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1516 | log_test $? 0 "Forward valid source - first VTEP" | 1527 | log_test $? 0 "Forward valid source - first VTEP" |
| 1517 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 1528 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| @@ -1521,14 +1532,14 @@ starg_include_ir_common() · 3 unmodified lines | |||
| 1521 | run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep2_ip src_vni 10010" | 1532 | run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep2_ip src_vni 10010" |
| 1522 | 1533 | ||
| 1523 | # Check that invalid source is not forwarded to any VTEP. | 1534 | # Check that invalid source is not forwarded to any VTEP. |
| 1524 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1535 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1525 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1536 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1526 | log_test $? 0 "Block excluded source after removal - first VTEP" | 1537 | log_test $? 0 "Block excluded source after removal - first VTEP" |
| 1527 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 1538 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| 1528 | log_test $? 0 "Block excluded source after removal - second VTEP" | 1539 | log_test $? 0 "Block excluded source after removal - second VTEP" |
| 1529 | 1540 | ||
| 1530 | # Check that valid source is forwarded to the remaining VTEP. | 1541 | # Check that valid source is forwarded to the remaining VTEP. |
| 1531 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1542 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1532 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 | 1543 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 |
| 1533 | log_test $? 0 "Forward valid source after removal - first VTEP" | 1544 | log_test $? 0 "Forward valid source after removal - first VTEP" |
| 1534 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 1545 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| @@ -1543,6 +1554,7 @@ starg_include_ir_ipv4_ipv4() · 8 unmodified lines | |||
| 1543 | local vtep2_ip=198.51.100.200 | 1554 | local vtep2_ip=198.51.100.200 |
| 1544 | local plen=32 | 1555 | local plen=32 |
| 1545 | local grp=239.1.1.1 | 1556 | local grp=239.1.1.1 |
| 1557 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1546 | local valid_src=192.0.2.129 | 1558 | local valid_src=192.0.2.129 |
| 1547 | local invalid_src=192.0.2.145 | 1559 | local invalid_src=192.0.2.145 |
| 1548 | 1560 | ||
| @@ -1551,7 +1563,7 @@ starg_include_ir_ipv4_ipv4() · 2 unmodified lines | |||
| 1551 | echo "-------------------------------------------------------------" | 1563 | echo "-------------------------------------------------------------" |
| 1552 | 1564 | ||
| 1553 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1565 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1554 | $valid_src $invalid_src "mausezahn" | 1566 | $grp_dmac $valid_src $invalid_src "mausezahn" |
| 1555 | } | 1567 | } |
| 1556 | 1568 | ||
| 1557 | starg_include_ir_ipv6_ipv4() | 1569 | starg_include_ir_ipv6_ipv4() |
| @@ -1562,6 +1574,7 @@ starg_include_ir_ipv6_ipv4() · 4 unmodified lines | |||
| 1562 | local vtep2_ip=198.51.100.200 | 1574 | local vtep2_ip=198.51.100.200 |
| 1563 | local plen=32 | 1575 | local plen=32 |
| 1564 | local grp=ff0e::1 | 1576 | local grp=ff0e::1 |
| 1577 | local grp_dmac=33:33:00:00:00:01 | ||
| 1565 | local valid_src=2001:db8:100::1 | 1578 | local valid_src=2001:db8:100::1 |
| 1566 | local invalid_src=2001:db8:200::1 | 1579 | local invalid_src=2001:db8:200::1 |
| 1567 | 1580 | ||
| @@ -1570,7 +1583,7 @@ starg_include_ir_ipv6_ipv4() · 2 unmodified lines | |||
| 1570 | echo "-------------------------------------------------------------" | 1583 | echo "-------------------------------------------------------------" |
| 1571 | 1584 | ||
| 1572 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1585 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1573 | $valid_src $invalid_src "mausezahn -6" | 1586 | $grp_dmac $valid_src $invalid_src "mausezahn -6" |
| 1574 | } | 1587 | } |
| 1575 | 1588 | ||
| 1576 | starg_include_ir_ipv4_ipv6() | 1589 | starg_include_ir_ipv4_ipv6() |
| @@ -1581,6 +1594,7 @@ starg_include_ir_ipv4_ipv6() · 4 unmodified lines | |||
| 1581 | local vtep2_ip=2001:db8:2000::1 | 1594 | local vtep2_ip=2001:db8:2000::1 |
| 1582 | local plen=128 | 1595 | local plen=128 |
| 1583 | local grp=239.1.1.1 | 1596 | local grp=239.1.1.1 |
| 1597 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1584 | local valid_src=192.0.2.129 | 1598 | local valid_src=192.0.2.129 |
| 1585 | local invalid_src=192.0.2.145 | 1599 | local invalid_src=192.0.2.145 |
| 1586 | 1600 | ||
| @@ -1589,7 +1603,7 @@ starg_include_ir_ipv4_ipv6() · 2 unmodified lines | |||
| 1589 | echo "-------------------------------------------------------------" | 1603 | echo "-------------------------------------------------------------" |
| 1590 | 1604 | ||
| 1591 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1605 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1592 | $valid_src $invalid_src "mausezahn" | 1606 | $grp_dmac $valid_src $invalid_src "mausezahn" |
| 1593 | } | 1607 | } |
| 1594 | 1608 | ||
| 1595 | starg_include_ir_ipv6_ipv6() | 1609 | starg_include_ir_ipv6_ipv6() |
| @@ -1600,6 +1614,7 @@ starg_include_ir_ipv6_ipv6() · 4 unmodified lines | |||
| 1600 | local vtep2_ip=2001:db8:2000::1 | 1614 | local vtep2_ip=2001:db8:2000::1 |
| 1601 | local plen=128 | 1615 | local plen=128 |
| 1602 | local grp=ff0e::1 | 1616 | local grp=ff0e::1 |
| 1617 | local grp_dmac=33:33:00:00:00:01 | ||
| 1603 | local valid_src=2001:db8:100::1 | 1618 | local valid_src=2001:db8:100::1 |
| 1604 | local invalid_src=2001:db8:200::1 | 1619 | local invalid_src=2001:db8:200::1 |
| 1605 | 1620 | ||
| @@ -1608,7 +1623,7 @@ starg_include_ir_ipv6_ipv6() · 2 unmodified lines | |||
| 1608 | echo "-------------------------------------------------------------" | 1623 | echo "-------------------------------------------------------------" |
| 1609 | 1624 | ||
| 1610 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ | 1625 | starg_include_ir_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $grp \ |
| 1611 | $valid_src $invalid_src "mausezahn -6" | 1626 | $grp_dmac $valid_src $invalid_src "mausezahn -6" |
| 1612 | } | 1627 | } |
| 1613 | 1628 | ||
| 1614 | starg_exclude_p2mp_common() | 1629 | starg_exclude_p2mp_common() |
| @@ -1618,6 +1633,7 @@ starg_exclude_p2mp_common() · 3 unmodified lines | |||
| 1618 | local mcast_grp=$1; shift | 1633 | local mcast_grp=$1; shift |
| 1619 | local plen=$1; shift | 1634 | local plen=$1; shift |
| 1620 | local grp=$1; shift | 1635 | local grp=$1; shift |
| 1636 | local grp_dmac=$1; shift | ||
| 1621 | local valid_src=$1; shift | 1637 | local valid_src=$1; shift |
| 1622 | local invalid_src=$1; shift | 1638 | local invalid_src=$1; shift |
| 1623 | local mz=$1; shift | 1639 | local mz=$1; shift |
| @@ -1635,12 +1651,12 @@ starg_exclude_p2mp_common() · 11 unmodified lines | |||
| 1635 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $invalid_src dst $mcast_grp src_vni 10010 via veth0" | 1651 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $invalid_src dst $mcast_grp src_vni 10010 via veth0" |
| 1636 | 1652 | ||
| 1637 | # Check that invalid source is not forwarded. | 1653 | # Check that invalid source is not forwarded. |
| 1638 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1654 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1639 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 | 1655 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 |
| 1640 | log_test $? 0 "Block excluded source" | 1656 | log_test $? 0 "Block excluded source" |
| 1641 | 1657 | ||
| 1642 | # Check that valid source is forwarded. | 1658 | # Check that valid source is forwarded. |
| 1643 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1659 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1644 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1660 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1645 | log_test $? 0 "Forward valid source" | 1661 | log_test $? 0 "Forward valid source" |
| 1646 | 1662 | ||
| @@ -1648,7 +1664,7 @@ starg_exclude_p2mp_common() · 1 unmodified line | |||
| 1648 | run_cmd "ip -n $ns2 address del $mcast_grp/$plen dev veth0" | 1664 | run_cmd "ip -n $ns2 address del $mcast_grp/$plen dev veth0" |
| 1649 | 1665 | ||
| 1650 | # Check that valid source is not received anymore. | 1666 | # Check that valid source is not received anymore. |
| 1651 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1667 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1652 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1668 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1653 | log_test $? 0 "Receive of valid source after removal from group" | 1669 | log_test $? 0 "Receive of valid source after removal from group" |
| 1654 | } | 1670 | } |
| @@ -1660,6 +1676,7 @@ starg_exclude_p2mp_ipv4_ipv4() · 5 unmodified lines | |||
| 1660 | local mcast_grp=238.1.1.1 | 1676 | local mcast_grp=238.1.1.1 |
| 1661 | local plen=32 | 1677 | local plen=32 |
| 1662 | local grp=239.1.1.1 | 1678 | local grp=239.1.1.1 |
| 1679 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1663 | local valid_src=192.0.2.129 | 1680 | local valid_src=192.0.2.129 |
| 1664 | local invalid_src=192.0.2.145 | 1681 | local invalid_src=192.0.2.145 |
| 1665 | 1682 | ||
| @@ -1667,7 +1684,7 @@ starg_exclude_p2mp_ipv4_ipv4() · 1 unmodified line | |||
| 1667 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv4 overlay / IPv4 underlay" | 1684 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv4 overlay / IPv4 underlay" |
| 1668 | echo "---------------------------------------------------------------" | 1685 | echo "---------------------------------------------------------------" |
| 1669 | 1686 | ||
| 1670 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1687 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1671 | $valid_src $invalid_src "mausezahn" | 1688 | $valid_src $invalid_src "mausezahn" |
| 1672 | } | 1689 | } |
| 1673 | 1690 | ||
| @@ -1678,6 +1695,7 @@ starg_exclude_p2mp_ipv6_ipv4() · 4 unmodified lines | |||
| 1678 | local mcast_grp=238.1.1.1 | 1695 | local mcast_grp=238.1.1.1 |
| 1679 | local plen=32 | 1696 | local plen=32 |
| 1680 | local grp=ff0e::1 | 1697 | local grp=ff0e::1 |
| 1698 | local grp_dmac=33:33:00:00:00:01 | ||
| 1681 | local valid_src=2001:db8:100::1 | 1699 | local valid_src=2001:db8:100::1 |
| 1682 | local invalid_src=2001:db8:200::1 | 1700 | local invalid_src=2001:db8:200::1 |
| 1683 | 1701 | ||
| @@ -1685,7 +1703,7 @@ starg_exclude_p2mp_ipv6_ipv4() · 1 unmodified line | |||
| 1685 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv6 overlay / IPv4 underlay" | 1703 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv6 overlay / IPv4 underlay" |
| 1686 | echo "---------------------------------------------------------------" | 1704 | echo "---------------------------------------------------------------" |
| 1687 | 1705 | ||
| 1688 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1706 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1689 | $valid_src $invalid_src "mausezahn -6" | 1707 | $valid_src $invalid_src "mausezahn -6" |
| 1690 | } | 1708 | } |
| 1691 | 1709 | ||
| @@ -1696,6 +1714,7 @@ starg_exclude_p2mp_ipv4_ipv6() · 4 unmodified lines | |||
| 1696 | local mcast_grp=ff0e::2 | 1714 | local mcast_grp=ff0e::2 |
| 1697 | local plen=128 | 1715 | local plen=128 |
| 1698 | local grp=239.1.1.1 | 1716 | local grp=239.1.1.1 |
| 1717 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1699 | local valid_src=192.0.2.129 | 1718 | local valid_src=192.0.2.129 |
| 1700 | local invalid_src=192.0.2.145 | 1719 | local invalid_src=192.0.2.145 |
| 1701 | 1720 | ||
| @@ -1703,7 +1722,7 @@ starg_exclude_p2mp_ipv4_ipv6() · 1 unmodified line | |||
| 1703 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv4 overlay / IPv6 underlay" | 1722 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv4 overlay / IPv6 underlay" |
| 1704 | echo "---------------------------------------------------------------" | 1723 | echo "---------------------------------------------------------------" |
| 1705 | 1724 | ||
| 1706 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1725 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1707 | $valid_src $invalid_src "mausezahn" | 1726 | $valid_src $invalid_src "mausezahn" |
| 1708 | } | 1727 | } |
| 1709 | 1728 | ||
| @@ -1714,6 +1733,7 @@ starg_exclude_p2mp_ipv6_ipv6() · 4 unmodified lines | |||
| 1714 | local mcast_grp=ff0e::2 | 1733 | local mcast_grp=ff0e::2 |
| 1715 | local plen=128 | 1734 | local plen=128 |
| 1716 | local grp=ff0e::1 | 1735 | local grp=ff0e::1 |
| 1736 | local grp_dmac=33:33:00:00:00:01 | ||
| 1717 | local valid_src=2001:db8:100::1 | 1737 | local valid_src=2001:db8:100::1 |
| 1718 | local invalid_src=2001:db8:200::1 | 1738 | local invalid_src=2001:db8:200::1 |
| 1719 | 1739 | ||
| @@ -1721,7 +1741,7 @@ starg_exclude_p2mp_ipv6_ipv6() · 1 unmodified line | |||
| 1721 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv6 overlay / IPv6 underlay" | 1741 | echo "Data path: (*, G) EXCLUDE - P2MP - IPv6 overlay / IPv6 underlay" |
| 1722 | echo "---------------------------------------------------------------" | 1742 | echo "---------------------------------------------------------------" |
| 1723 | 1743 | ||
| 1724 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1744 | starg_exclude_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1725 | $valid_src $invalid_src "mausezahn -6" | 1745 | $valid_src $invalid_src "mausezahn -6" |
| 1726 | } | 1746 | } |
| 1727 | 1747 | ||
| @@ -1732,6 +1752,7 @@ starg_include_p2mp_common() · 4 unmodified lines | |||
| 1732 | local mcast_grp=$1; shift | 1752 | local mcast_grp=$1; shift |
| 1733 | local plen=$1; shift | 1753 | local plen=$1; shift |
| 1734 | local grp=$1; shift | 1754 | local grp=$1; shift |
| 1755 | local grp_dmac=$1; shift | ||
| 1735 | local valid_src=$1; shift | 1756 | local valid_src=$1; shift |
| 1736 | local invalid_src=$1; shift | 1757 | local invalid_src=$1; shift |
| 1737 | local mz=$1; shift | 1758 | local mz=$1; shift |
| @@ -1749,12 +1770,12 @@ starg_include_p2mp_common() · 11 unmodified lines | |||
| 1749 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode include source_list $valid_src dst $mcast_grp src_vni 10010 via veth0" | 1770 | run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode include source_list $valid_src dst $mcast_grp src_vni 10010 via veth0" |
| 1750 | 1771 | ||
| 1751 | # Check that invalid source is not forwarded. | 1772 | # Check that invalid source is not forwarded. |
| 1752 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1773 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $invalid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1753 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 | 1774 | tc_check_packets "$ns2" "dev vx0 ingress" 101 0 |
| 1754 | log_test $? 0 "Block excluded source" | 1775 | log_test $? 0 "Block excluded source" |
| 1755 | 1776 | ||
| 1756 | # Check that valid source is forwarded. | 1777 | # Check that valid source is forwarded. |
| 1757 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1778 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1758 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1779 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1759 | log_test $? 0 "Forward valid source" | 1780 | log_test $? 0 "Forward valid source" |
| 1760 | 1781 | ||
| @@ -1762,7 +1783,7 @@ starg_include_p2mp_common() · 1 unmodified line | |||
| 1762 | run_cmd "ip -n $ns2 address del $mcast_grp/$plen dev veth0" | 1783 | run_cmd "ip -n $ns2 address del $mcast_grp/$plen dev veth0" |
| 1763 | 1784 | ||
| 1764 | # Check that valid source is not received anymore. | 1785 | # Check that valid source is not received anymore. |
| 1765 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1786 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $valid_src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1766 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 1787 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 1767 | log_test $? 0 "Receive of valid source after removal from group" | 1788 | log_test $? 0 "Receive of valid source after removal from group" |
| 1768 | } | 1789 | } |
| @@ -1774,6 +1795,7 @@ starg_include_p2mp_ipv4_ipv4() · 5 unmodified lines | |||
| 1774 | local mcast_grp=238.1.1.1 | 1795 | local mcast_grp=238.1.1.1 |
| 1775 | local plen=32 | 1796 | local plen=32 |
| 1776 | local grp=239.1.1.1 | 1797 | local grp=239.1.1.1 |
| 1798 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1777 | local valid_src=192.0.2.129 | 1799 | local valid_src=192.0.2.129 |
| 1778 | local invalid_src=192.0.2.145 | 1800 | local invalid_src=192.0.2.145 |
| 1779 | 1801 | ||
| @@ -1781,7 +1803,7 @@ starg_include_p2mp_ipv4_ipv4() · 1 unmodified line | |||
| 1781 | echo "Data path: (*, G) INCLUDE - P2MP - IPv4 overlay / IPv4 underlay" | 1803 | echo "Data path: (*, G) INCLUDE - P2MP - IPv4 overlay / IPv4 underlay" |
| 1782 | echo "---------------------------------------------------------------" | 1804 | echo "---------------------------------------------------------------" |
| 1783 | 1805 | ||
| 1784 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1806 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1785 | $valid_src $invalid_src "mausezahn" | 1807 | $valid_src $invalid_src "mausezahn" |
| 1786 | } | 1808 | } |
| 1787 | 1809 | ||
| @@ -1792,6 +1814,7 @@ starg_include_p2mp_ipv6_ipv4() · 4 unmodified lines | |||
| 1792 | local mcast_grp=238.1.1.1 | 1814 | local mcast_grp=238.1.1.1 |
| 1793 | local plen=32 | 1815 | local plen=32 |
| 1794 | local grp=ff0e::1 | 1816 | local grp=ff0e::1 |
| 1817 | local grp_dmac=33:33:00:00:00:01 | ||
| 1795 | local valid_src=2001:db8:100::1 | 1818 | local valid_src=2001:db8:100::1 |
| 1796 | local invalid_src=2001:db8:200::1 | 1819 | local invalid_src=2001:db8:200::1 |
| 1797 | 1820 | ||
| @@ -1799,7 +1822,7 @@ starg_include_p2mp_ipv6_ipv4() · 1 unmodified line | |||
| 1799 | echo "Data path: (*, G) INCLUDE - P2MP - IPv6 overlay / IPv4 underlay" | 1822 | echo "Data path: (*, G) INCLUDE - P2MP - IPv6 overlay / IPv4 underlay" |
| 1800 | echo "---------------------------------------------------------------" | 1823 | echo "---------------------------------------------------------------" |
| 1801 | 1824 | ||
| 1802 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1825 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1803 | $valid_src $invalid_src "mausezahn -6" | 1826 | $valid_src $invalid_src "mausezahn -6" |
| 1804 | } | 1827 | } |
| 1805 | 1828 | ||
| @@ -1810,6 +1833,7 @@ starg_include_p2mp_ipv4_ipv6() · 4 unmodified lines | |||
| 1810 | local mcast_grp=ff0e::2 | 1833 | local mcast_grp=ff0e::2 |
| 1811 | local plen=128 | 1834 | local plen=128 |
| 1812 | local grp=239.1.1.1 | 1835 | local grp=239.1.1.1 |
| 1836 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1813 | local valid_src=192.0.2.129 | 1837 | local valid_src=192.0.2.129 |
| 1814 | local invalid_src=192.0.2.145 | 1838 | local invalid_src=192.0.2.145 |
| 1815 | 1839 | ||
| @@ -1817,7 +1841,7 @@ starg_include_p2mp_ipv4_ipv6() · 1 unmodified line | |||
| 1817 | echo "Data path: (*, G) INCLUDE - P2MP - IPv4 overlay / IPv6 underlay" | 1841 | echo "Data path: (*, G) INCLUDE - P2MP - IPv4 overlay / IPv6 underlay" |
| 1818 | echo "---------------------------------------------------------------" | 1842 | echo "---------------------------------------------------------------" |
| 1819 | 1843 | ||
| 1820 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1844 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1821 | $valid_src $invalid_src "mausezahn" | 1845 | $valid_src $invalid_src "mausezahn" |
| 1822 | } | 1846 | } |
| 1823 | 1847 | ||
| @@ -1828,6 +1852,7 @@ starg_include_p2mp_ipv6_ipv6() · 4 unmodified lines | |||
| 1828 | local mcast_grp=ff0e::2 | 1852 | local mcast_grp=ff0e::2 |
| 1829 | local plen=128 | 1853 | local plen=128 |
| 1830 | local grp=ff0e::1 | 1854 | local grp=ff0e::1 |
| 1855 | local grp_dmac=33:33:00:00:00:01 | ||
| 1831 | local valid_src=2001:db8:100::1 | 1856 | local valid_src=2001:db8:100::1 |
| 1832 | local invalid_src=2001:db8:200::1 | 1857 | local invalid_src=2001:db8:200::1 |
| 1833 | 1858 | ||
| @@ -1835,7 +1860,7 @@ starg_include_p2mp_ipv6_ipv6() · 1 unmodified line | |||
| 1835 | echo "Data path: (*, G) INCLUDE - P2MP - IPv6 overlay / IPv6 underlay" | 1860 | echo "Data path: (*, G) INCLUDE - P2MP - IPv6 overlay / IPv6 underlay" |
| 1836 | echo "---------------------------------------------------------------" | 1861 | echo "---------------------------------------------------------------" |
| 1837 | 1862 | ||
| 1838 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp \ | 1863 | starg_include_p2mp_common $ns1 $ns2 $mcast_grp $plen $grp $grp_dmac \ |
| 1839 | $valid_src $invalid_src "mausezahn -6" | 1864 | $valid_src $invalid_src "mausezahn -6" |
| 1840 | } | 1865 | } |
| 1841 | 1866 | ||
| @@ -1847,6 +1872,7 @@ egress_vni_translation_common() · 5 unmodified lines | |||
| 1847 | local plen=$1; shift | 1872 | local plen=$1; shift |
| 1848 | local proto=$1; shift | 1873 | local proto=$1; shift |
| 1849 | local grp=$1; shift | 1874 | local grp=$1; shift |
| 1875 | local grp_dmac=$1; shift | ||
| 1850 | local src=$1; shift | 1876 | local src=$1; shift |
| 1851 | local mz=$1; shift | 1877 | local mz=$1; shift |
| 1852 | 1878 | ||
| @@ -1882,20 +1908,20 @@ egress_vni_translation_common() · 29 unmodified lines | |||
| 1882 | # Make sure that packets sent from the first VTEP over VLAN 10 are | 1908 | # Make sure that packets sent from the first VTEP over VLAN 10 are |
| 1883 | # received by the SVI corresponding to the L3VNI (14000 / VLAN 4000) on | 1909 | # received by the SVI corresponding to the L3VNI (14000 / VLAN 4000) on |
| 1884 | # the second VTEP, since it is configured as PVID. | 1910 | # the second VTEP, since it is configured as PVID. |
| 1885 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1911 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1886 | tc_check_packets "$ns2" "dev br0.4000 ingress" 101 1 | 1912 | tc_check_packets "$ns2" "dev br0.4000 ingress" 101 1 |
| 1887 | log_test $? 0 "Egress VNI translation - PVID configured" | 1913 | log_test $? 0 "Egress VNI translation - PVID configured" |
| 1888 | 1914 | ||
| 1889 | # Remove PVID flag from VLAN 4000 on the second VTEP and make sure | 1915 | # Remove PVID flag from VLAN 4000 on the second VTEP and make sure |
| 1890 | # packets are no longer received by the SVI interface. | 1916 | # packets are no longer received by the SVI interface. |
| 1891 | run_cmd "bridge -n $ns2 vlan add vid 4000 dev vx0" | 1917 | run_cmd "bridge -n $ns2 vlan add vid 4000 dev vx0" |
| 1892 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1918 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1893 | tc_check_packets "$ns2" "dev br0.4000 ingress" 101 1 | 1919 | tc_check_packets "$ns2" "dev br0.4000 ingress" 101 1 |
| 1894 | log_test $? 0 "Egress VNI translation - no PVID configured" | 1920 | log_test $? 0 "Egress VNI translation - no PVID configured" |
| 1895 | 1921 | ||
| 1896 | # Reconfigure the PVID and make sure packets are received again. | 1922 | # Reconfigure the PVID and make sure packets are received again. |
| 1897 | run_cmd "bridge -n $ns2 vlan add vid 4000 dev vx0 pvid" | 1923 | run_cmd "bridge -n $ns2 vlan add vid 4000 dev vx0 pvid" |
| 1898 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 1924 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 1899 | tc_check_packets "$ns2" "dev br0.4000 ingress" 101 2 | 1925 | tc_check_packets "$ns2" "dev br0.4000 ingress" 101 2 |
| 1900 | log_test $? 0 "Egress VNI translation - PVID reconfigured" | 1926 | log_test $? 0 "Egress VNI translation - PVID reconfigured" |
| 1901 | } | 1927 | } |
| @@ -1908,6 +1934,7 @@ egress_vni_translation_ipv4_ipv4() · 6 unmodified lines | |||
| 1908 | local plen=32 | 1934 | local plen=32 |
| 1909 | local proto="ipv4" | 1935 | local proto="ipv4" |
| 1910 | local grp=239.1.1.1 | 1936 | local grp=239.1.1.1 |
| 1937 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1911 | local src=192.0.2.129 | 1938 | local src=192.0.2.129 |
| 1912 | 1939 | ||
| 1913 | echo | 1940 | echo |
| @@ -1915,7 +1942,7 @@ egress_vni_translation_ipv4_ipv4() · 1 unmodified line | |||
| 1915 | echo "----------------------------------------------------------------" | 1942 | echo "----------------------------------------------------------------" |
| 1916 | 1943 | ||
| 1917 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ | 1944 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ |
| 1918 | $src "mausezahn" | 1945 | $grp_dmac $src "mausezahn" |
| 1919 | } | 1946 | } |
| 1920 | 1947 | ||
| 1921 | egress_vni_translation_ipv6_ipv4() | 1948 | egress_vni_translation_ipv6_ipv4() |
| @@ -1926,6 +1953,7 @@ egress_vni_translation_ipv6_ipv4() · 4 unmodified lines | |||
| 1926 | local plen=32 | 1953 | local plen=32 |
| 1927 | local proto="ipv6" | 1954 | local proto="ipv6" |
| 1928 | local grp=ff0e::1 | 1955 | local grp=ff0e::1 |
| 1956 | local grp_dmac=33:33:00:00:00:01 | ||
| 1929 | local src=2001:db8:100::1 | 1957 | local src=2001:db8:100::1 |
| 1930 | 1958 | ||
| 1931 | echo | 1959 | echo |
| @@ -1933,7 +1961,7 @@ egress_vni_translation_ipv6_ipv4() · 1 unmodified line | |||
| 1933 | echo "----------------------------------------------------------------" | 1961 | echo "----------------------------------------------------------------" |
| 1934 | 1962 | ||
| 1935 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ | 1963 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ |
| 1936 | $src "mausezahn -6" | 1964 | $grp_dmac $src "mausezahn -6" |
| 1937 | } | 1965 | } |
| 1938 | 1966 | ||
| 1939 | egress_vni_translation_ipv4_ipv6() | 1967 | egress_vni_translation_ipv4_ipv6() |
| @@ -1944,6 +1972,7 @@ egress_vni_translation_ipv4_ipv6() · 4 unmodified lines | |||
| 1944 | local plen=128 | 1972 | local plen=128 |
| 1945 | local proto="ipv4" | 1973 | local proto="ipv4" |
| 1946 | local grp=239.1.1.1 | 1974 | local grp=239.1.1.1 |
| 1975 | local grp_dmac=01:00:5e:01:01:01 | ||
| 1947 | local src=192.0.2.129 | 1976 | local src=192.0.2.129 |
| 1948 | 1977 | ||
| 1949 | echo | 1978 | echo |
| @@ -1951,7 +1980,7 @@ egress_vni_translation_ipv4_ipv6() · 1 unmodified line | |||
| 1951 | echo "----------------------------------------------------------------" | 1980 | echo "----------------------------------------------------------------" |
| 1952 | 1981 | ||
| 1953 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ | 1982 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ |
| 1954 | $src "mausezahn" | 1983 | $grp_dmac $src "mausezahn" |
| 1955 | } | 1984 | } |
| 1956 | 1985 | ||
| 1957 | egress_vni_translation_ipv6_ipv6() | 1986 | egress_vni_translation_ipv6_ipv6() |
| @@ -1962,6 +1991,7 @@ egress_vni_translation_ipv6_ipv6() · 4 unmodified lines | |||
| 1962 | local plen=128 | 1991 | local plen=128 |
| 1963 | local proto="ipv6" | 1992 | local proto="ipv6" |
| 1964 | local grp=ff0e::1 | 1993 | local grp=ff0e::1 |
| 1994 | local grp_dmac=33:33:00:00:00:01 | ||
| 1965 | local src=2001:db8:100::1 | 1995 | local src=2001:db8:100::1 |
| 1966 | 1996 | ||
| 1967 | echo | 1997 | echo |
| @@ -1969,7 +1999,7 @@ egress_vni_translation_ipv6_ipv6() · 1 unmodified line | |||
| 1969 | echo "----------------------------------------------------------------" | 1999 | echo "----------------------------------------------------------------" |
| 1970 | 2000 | ||
| 1971 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ | 2001 | egress_vni_translation_common $ns1 $ns2 $mcast_grp $plen $proto $grp \ |
| 1972 | $src "mausezahn -6" | 2002 | $grp_dmac $src "mausezahn -6" |
| 1973 | } | 2003 | } |
| 1974 | 2004 | ||
| 1975 | all_zeros_mdb_common() | 2005 | all_zeros_mdb_common() |
| @@ -1982,12 +2012,18 @@ all_zeros_mdb_common() · 6 unmodified lines | |||
| 1982 | local vtep4_ip=$1; shift | 2012 | local vtep4_ip=$1; shift |
| 1983 | local plen=$1; shift | 2013 | local plen=$1; shift |
| 1984 | local ipv4_grp=239.1.1.1 | 2014 | local ipv4_grp=239.1.1.1 |
| 2015 | local ipv4_grp_dmac=01:00:5e:01:01:01 | ||
| 1985 | local ipv4_unreg_grp=239.2.2.2 | 2016 | local ipv4_unreg_grp=239.2.2.2 |
| 2017 | local ipv4_unreg_grp_dmac=01:00:5e:02:02:02 | ||
| 1986 | local ipv4_ll_grp=224.0.0.100 | 2018 | local ipv4_ll_grp=224.0.0.100 |
| 2019 | local ipv4_ll_grp_dmac=01:00:5e:00:00:64 | ||
| 1987 | local ipv4_src=192.0.2.129 | 2020 | local ipv4_src=192.0.2.129 |
| 1988 | local ipv6_grp=ff0e::1 | 2021 | local ipv6_grp=ff0e::1 |
| 2022 | local ipv6_grp_dmac=33:33:00:00:00:01 | ||
| 1989 | local ipv6_unreg_grp=ff0e::2 | 2023 | local ipv6_unreg_grp=ff0e::2 |
| 2024 | local ipv6_unreg_grp_dmac=33:33:00:00:00:02 | ||
| 1990 | local ipv6_ll_grp=ff02::1 | 2025 | local ipv6_ll_grp=ff02::1 |
| 2026 | local ipv6_ll_grp_dmac=33:33:00:00:00:01 | ||
| 1991 | local ipv6_src=2001:db8:100::1 | 2027 | local ipv6_src=2001:db8:100::1 |
| 1992 | 2028 | ||
| 1993 | # Install all-zeros (catchall) MDB entries for IPv4 and IPv6 traffic | 2029 | # Install all-zeros (catchall) MDB entries for IPv4 and IPv6 traffic |
| @@ -2023,7 +2059,7 @@ all_zeros_mdb_common() · 29 unmodified lines | |||
| 2023 | 2059 | ||
| 2024 | # Send registered IPv4 multicast and make sure it only arrives to the | 2060 | # Send registered IPv4 multicast and make sure it only arrives to the |
| 2025 | # first VTEP. | 2061 | # first VTEP. |
| 2026 | run_cmd "ip netns exec $ns1 mausezahn br0.10 -A $ipv4_src -B $ipv4_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2062 | run_cmd "ip netns exec $ns1 mausezahn br0.10 -a own -b $ipv4_grp_dmac -A $ipv4_src -B $ipv4_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2027 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 2063 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 2028 | log_test $? 0 "Registered IPv4 multicast - first VTEP" | 2064 | log_test $? 0 "Registered IPv4 multicast - first VTEP" |
| 2029 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 | 2065 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 |
| @@ -2031,7 +2067,7 @@ all_zeros_mdb_common() · 1 unmodified line | |||
| 2031 | 2067 | ||
| 2032 | # Send unregistered IPv4 multicast that is not link-local and make sure | 2068 | # Send unregistered IPv4 multicast that is not link-local and make sure |
| 2033 | # it arrives to the first and second VTEPs. | 2069 | # it arrives to the first and second VTEPs. |
| 2034 | run_cmd "ip netns exec $ns1 mausezahn br0.10 -A $ipv4_src -B $ipv4_unreg_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2070 | run_cmd "ip netns exec $ns1 mausezahn br0.10 -a own -b $ipv4_unreg_grp_dmac -A $ipv4_src -B $ipv4_unreg_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2035 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 | 2071 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 |
| 2036 | log_test $? 0 "Unregistered IPv4 multicast - first VTEP" | 2072 | log_test $? 0 "Unregistered IPv4 multicast - first VTEP" |
| 2037 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 2073 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| @@ -2039,7 +2075,7 @@ all_zeros_mdb_common() · 1 unmodified line | |||
| 2039 | 2075 | ||
| 2040 | # Send IPv4 link-local multicast traffic and make sure it does not | 2076 | # Send IPv4 link-local multicast traffic and make sure it does not |
| 2041 | # arrive to any VTEP. | 2077 | # arrive to any VTEP. |
| 2042 | run_cmd "ip netns exec $ns1 mausezahn br0.10 -A $ipv4_src -B $ipv4_ll_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2078 | run_cmd "ip netns exec $ns1 mausezahn br0.10 -a own -b $ipv4_ll_grp_dmac -A $ipv4_src -B $ipv4_ll_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2043 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 | 2079 | tc_check_packets "$ns2" "dev vx0 ingress" 101 2 |
| 2044 | log_test $? 0 "Link-local IPv4 multicast - first VTEP" | 2080 | log_test $? 0 "Link-local IPv4 multicast - first VTEP" |
| 2045 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 | 2081 | tc_check_packets "$ns2" "dev vx0 ingress" 102 1 |
| @@ -2074,7 +2110,7 @@ all_zeros_mdb_common() · 28 unmodified lines | |||
| 2074 | 2110 | ||
| 2075 | # Send registered IPv6 multicast and make sure it only arrives to the | 2111 | # Send registered IPv6 multicast and make sure it only arrives to the |
| 2076 | # third VTEP. | 2112 | # third VTEP. |
| 2077 | run_cmd "ip netns exec $ns1 mausezahn -6 br0.10 -A $ipv6_src -B $ipv6_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2113 | run_cmd "ip netns exec $ns1 mausezahn -6 br0.10 -a own -b $ipv6_grp_dmac -A $ipv6_src -B $ipv6_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2078 | tc_check_packets "$ns2" "dev vx0 ingress" 103 1 | 2114 | tc_check_packets "$ns2" "dev vx0 ingress" 103 1 |
| 2079 | log_test $? 0 "Registered IPv6 multicast - third VTEP" | 2115 | log_test $? 0 "Registered IPv6 multicast - third VTEP" |
| 2080 | tc_check_packets "$ns2" "dev vx0 ingress" 104 0 | 2116 | tc_check_packets "$ns2" "dev vx0 ingress" 104 0 |
| @@ -2082,7 +2118,7 @@ all_zeros_mdb_common() · 1 unmodified line | |||
| 2082 | 2118 | ||
| 2083 | # Send unregistered IPv6 multicast that is not link-local and make sure | 2119 | # Send unregistered IPv6 multicast that is not link-local and make sure |
| 2084 | # it arrives to the third and fourth VTEPs. | 2120 | # it arrives to the third and fourth VTEPs. |
| 2085 | run_cmd "ip netns exec $ns1 mausezahn -6 br0.10 -A $ipv6_src -B $ipv6_unreg_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2121 | run_cmd "ip netns exec $ns1 mausezahn -6 br0.10 -a own -b $ipv6_unreg_grp_dmac -A $ipv6_src -B $ipv6_unreg_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2086 | tc_check_packets "$ns2" "dev vx0 ingress" 103 2 | 2122 | tc_check_packets "$ns2" "dev vx0 ingress" 103 2 |
| 2087 | log_test $? 0 "Unregistered IPv6 multicast - third VTEP" | 2123 | log_test $? 0 "Unregistered IPv6 multicast - third VTEP" |
| 2088 | tc_check_packets "$ns2" "dev vx0 ingress" 104 1 | 2124 | tc_check_packets "$ns2" "dev vx0 ingress" 104 1 |
| @@ -2090,7 +2126,7 @@ all_zeros_mdb_common() · 1 unmodified line | |||
| 2090 | 2126 | ||
| 2091 | # Send IPv6 link-local multicast traffic and make sure it does not | 2127 | # Send IPv6 link-local multicast traffic and make sure it does not |
| 2092 | # arrive to any VTEP. | 2128 | # arrive to any VTEP. |
| 2093 | run_cmd "ip netns exec $ns1 mausezahn -6 br0.10 -A $ipv6_src -B $ipv6_ll_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2129 | run_cmd "ip netns exec $ns1 mausezahn -6 br0.10 -a own -b $ipv6_ll_grp_dmac -A $ipv6_src -B $ipv6_ll_grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2094 | tc_check_packets "$ns2" "dev vx0 ingress" 103 2 | 2130 | tc_check_packets "$ns2" "dev vx0 ingress" 103 2 |
| 2095 | log_test $? 0 "Link-local IPv6 multicast - third VTEP" | 2131 | log_test $? 0 "Link-local IPv6 multicast - third VTEP" |
| 2096 | tc_check_packets "$ns2" "dev vx0 ingress" 104 1 | 2132 | tc_check_packets "$ns2" "dev vx0 ingress" 104 1 |
| @@ -2165,6 +2201,7 @@ mdb_fdb_common() · 68 unmodified lines | |||
| 2165 | local plen=$1; shift | 2201 | local plen=$1; shift |
| 2166 | local proto=$1; shift | 2202 | local proto=$1; shift |
| 2167 | local grp=$1; shift | 2203 | local grp=$1; shift |
| 2204 | local grp_dmac=$1; shift | ||
| 2168 | local src=$1; shift | 2205 | local src=$1; shift |
| 2169 | local mz=$1; shift | 2206 | local mz=$1; shift |
| 2170 | 2207 | ||
| @@ -2188,7 +2225,7 @@ mdb_fdb_common() · 17 unmodified lines | |||
| 2188 | 2225 | ||
| 2189 | # Send IP multicast traffic and make sure it is forwarded by the MDB | 2226 | # Send IP multicast traffic and make sure it is forwarded by the MDB |
| 2190 | # and only arrives to the first VTEP. | 2227 | # and only arrives to the first VTEP. |
| 2191 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2228 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2192 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 2229 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 2193 | log_test $? 0 "IP multicast - first VTEP" | 2230 | log_test $? 0 "IP multicast - first VTEP" |
| 2194 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 | 2231 | tc_check_packets "$ns2" "dev vx0 ingress" 102 0 |
| @@ -2205,7 +2242,7 @@ mdb_fdb_common() · 10 unmodified lines | |||
| 2205 | # Remove the MDB entry and make sure that IP multicast is now forwarded | 2242 | # Remove the MDB entry and make sure that IP multicast is now forwarded |
| 2206 | # by the FDB to the second VTEP. | 2243 | # by the FDB to the second VTEP. |
| 2207 | run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep1_ip src_vni 10010" | 2244 | run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep1_ip src_vni 10010" |
| 2208 | run_cmd "ip netns exec $ns1 $mz br0.10 -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" | 2245 | run_cmd "ip netns exec $ns1 $mz br0.10 -a own -b $grp_dmac -A $src -B $grp -t udp sp=12345,dp=54321 -p 100 -c 1 -q" |
| 2209 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 | 2246 | tc_check_packets "$ns2" "dev vx0 ingress" 101 1 |
| 2210 | log_test $? 0 "IP multicast after removal - first VTEP" | 2247 | log_test $? 0 "IP multicast after removal - first VTEP" |
| 2211 | tc_check_packets "$ns2" "dev vx0 ingress" 102 2 | 2248 | tc_check_packets "$ns2" "dev vx0 ingress" 102 2 |
| @@ -2221,14 +2258,15 @@ mdb_fdb_ipv4_ipv4() · 9 unmodified lines | |||
| 2221 | local plen=32 | 2258 | local plen=32 |
| 2222 | local proto="ipv4" | 2259 | local proto="ipv4" |
| 2223 | local grp=239.1.1.1 | 2260 | local grp=239.1.1.1 |
| 2261 | local grp_dmac=01:00:5e:01:01:01 | ||
| 2224 | local src=192.0.2.129 | 2262 | local src=192.0.2.129 |
| 2225 | 2263 | ||
| 2226 | echo | 2264 | echo |
| 2227 | echo "Data path: MDB with FDB - IPv4 overlay / IPv4 underlay" | 2265 | echo "Data path: MDB with FDB - IPv4 overlay / IPv4 underlay" |
| 2228 | echo "------------------------------------------------------" | 2266 | echo "------------------------------------------------------" |
| 2229 | 2267 | ||
| 2230 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp $src \ | 2268 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp \ |
| 2231 | "mausezahn" | 2269 | $grp_dmac $src "mausezahn" |
| 2232 | } | 2270 | } |
| 2233 | 2271 | ||
| 2234 | mdb_fdb_ipv6_ipv4() | 2272 | mdb_fdb_ipv6_ipv4() |
| @@ -2240,14 +2278,15 @@ mdb_fdb_ipv6_ipv4() · 5 unmodified lines | |||
| 2240 | local plen=32 | 2278 | local plen=32 |
| 2241 | local proto="ipv6" | 2279 | local proto="ipv6" |
| 2242 | local grp=ff0e::1 | 2280 | local grp=ff0e::1 |
| 2281 | local grp_dmac=33:33:00:00:00:01 | ||
| 2243 | local src=2001:db8:100::1 | 2282 | local src=2001:db8:100::1 |
| 2244 | 2283 | ||
| 2245 | echo | 2284 | echo |
| 2246 | echo "Data path: MDB with FDB - IPv6 overlay / IPv4 underlay" | 2285 | echo "Data path: MDB with FDB - IPv6 overlay / IPv4 underlay" |
| 2247 | echo "------------------------------------------------------" | 2286 | echo "------------------------------------------------------" |
| 2248 | 2287 | ||
| 2249 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp $src \ | 2288 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp \ |
| 2250 | "mausezahn -6" | 2289 | $grp_dmac $src "mausezahn -6" |
| 2251 | } | 2290 | } |
| 2252 | 2291 | ||
| 2253 | mdb_fdb_ipv4_ipv6() | 2292 | mdb_fdb_ipv4_ipv6() |
| @@ -2259,14 +2298,15 @@ mdb_fdb_ipv4_ipv6() · 5 unmodified lines | |||
| 2259 | local plen=128 | 2298 | local plen=128 |
| 2260 | local proto="ipv4" | 2299 | local proto="ipv4" |
| 2261 | local grp=239.1.1.1 | 2300 | local grp=239.1.1.1 |
| 2301 | local grp_dmac=01:00:5e:01:01:01 | ||
| 2262 | local src=192.0.2.129 | 2302 | local src=192.0.2.129 |
| 2263 | 2303 | ||
| 2264 | echo | 2304 | echo |
| 2265 | echo "Data path: MDB with FDB - IPv4 overlay / IPv6 underlay" | 2305 | echo "Data path: MDB with FDB - IPv4 overlay / IPv6 underlay" |
| 2266 | echo "------------------------------------------------------" | 2306 | echo "------------------------------------------------------" |
| 2267 | 2307 | ||
| 2268 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp $src \ | 2308 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp \ |
| 2269 | "mausezahn" | 2309 | $grp_dmac $src "mausezahn" |
| 2270 | } | 2310 | } |
| 2271 | 2311 | ||
| 2272 | mdb_fdb_ipv6_ipv6() | 2312 | mdb_fdb_ipv6_ipv6() |
| @@ -2278,14 +2318,15 @@ mdb_fdb_ipv6_ipv6() · 5 unmodified lines | |||
| 2278 | local plen=128 | 2318 | local plen=128 |
| 2279 | local proto="ipv6" | 2319 | local proto="ipv6" |
| 2280 | local grp=ff0e::1 | 2320 | local grp=ff0e::1 |
| 2321 | local grp_dmac=33:33:00:00:00:01 | ||
| 2281 | local src=2001:db8:100::1 | 2322 | local src=2001:db8:100::1 |
| 2282 | 2323 | ||
| 2283 | echo | 2324 | echo |
| 2284 | echo "Data path: MDB with FDB - IPv6 overlay / IPv6 underlay" | 2325 | echo "Data path: MDB with FDB - IPv6 overlay / IPv6 underlay" |
| 2285 | echo "------------------------------------------------------" | 2326 | echo "------------------------------------------------------" |
| 2286 | 2327 | ||
| 2287 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp $src \ | 2328 | mdb_fdb_common $ns1 $ns2 $vtep1_ip $vtep2_ip $plen $proto $grp \ |
| 2288 | "mausezahn -6" | 2329 | $grp_dmac $src "mausezahn -6" |
| 2289 | } | 2330 | } |
| 2290 | 2331 | ||
| 2291 | mdb_grp1_loop() | 2332 | mdb_grp1_loop() |
| @@ -2320,7 +2361,9 @@ mdb_torture_common() · 28 unmodified lines | |||
| 2320 | local vtep1_ip=$1; shift | 2361 | local vtep1_ip=$1; shift |
| 2321 | local vtep2_ip=$1; shift | 2362 | local vtep2_ip=$1; shift |
| 2322 | local grp1=$1; shift | 2363 | local grp1=$1; shift |
| 2364 | local grp1_dmac=$1; shift | ||
| 2323 | local grp2=$1; shift | 2365 | local grp2=$1; shift |
| 2366 | local grp2_dmac=$1; shift | ||
| 2324 | local src=$1; shift | 2367 | local src=$1; shift |
| 2325 | local mz=$1; shift | 2368 | local mz=$1; shift |
| 2326 | local pid1 | 2369 | local pid1 |
| @@ -2345,9 +2388,9 @@ mdb_torture_common() · 18 unmodified lines | |||
| 2345 | pid1=$! | 2388 | pid1=$! |
| 2346 | mdb_grp2_loop $ns1 $vtep1_ip $vtep2_ip $grp2 & | 2389 | mdb_grp2_loop $ns1 $vtep1_ip $vtep2_ip $grp2 & |
| 2347 | pid2=$! | 2390 | pid2=$! |
| 2348 | ip netns exec $ns1 $mz br0.10 -A $src -B $grp1 -t udp sp=12345,dp=54321 -p 100 -c 0 -q & | 2391 | ip netns exec $ns1 $mz br0.10 -a own -b $grp1_dmac -A $src -B $grp1 -t udp sp=12345,dp=54321 -p 100 -c 0 -q & |
| 2349 | pid3=$! | 2392 | pid3=$! |
| 2350 | ip netns exec $ns1 $mz br0.10 -A $src -B $grp2 -t udp sp=12345,dp=54321 -p 100 -c 0 -q & | 2393 | ip netns exec $ns1 $mz br0.10 -a own -b $grp2_dmac -A $src -B $grp2 -t udp sp=12345,dp=54321 -p 100 -c 0 -q & |
| 2351 | pid4=$! | 2394 | pid4=$! |
| 2352 | 2395 | ||
| 2353 | sleep 30 | 2396 | sleep 30 |
| @@ -2363,15 +2406,17 @@ mdb_torture_ipv4_ipv4() · 9 unmodified lines | |||
| 2363 | local vtep1_ip=198.51.100.100 | 2406 | local vtep1_ip=198.51.100.100 |
| 2364 | local vtep2_ip=198.51.100.200 | 2407 | local vtep2_ip=198.51.100.200 |
| 2365 | local grp1=239.1.1.1 | 2408 | local grp1=239.1.1.1 |
| 2409 | local grp1_dmac=01:00:5e:01:01:01 | ||
| 2366 | local grp2=239.2.2.2 | 2410 | local grp2=239.2.2.2 |
| 2411 | local grp2_dmac=01:00:5e:02:02:02 | ||
| 2367 | local src=192.0.2.129 | 2412 | local src=192.0.2.129 |
| 2368 | 2413 | ||
| 2369 | echo | 2414 | echo |
| 2370 | echo "Data path: MDB torture test - IPv4 overlay / IPv4 underlay" | 2415 | echo "Data path: MDB torture test - IPv4 overlay / IPv4 underlay" |
| 2371 | echo "----------------------------------------------------------" | 2416 | echo "----------------------------------------------------------" |
| 2372 | 2417 | ||
| 2373 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp2 $src \ | 2418 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp1_dmac $grp2 \ |
| 2374 | "mausezahn" | 2419 | $grp2_dmac $src "mausezahn" |
| 2375 | } | 2420 | } |
| 2376 | 2421 | ||
| 2377 | mdb_torture_ipv6_ipv4() | 2422 | mdb_torture_ipv6_ipv4() |
| @@ -2380,15 +2425,17 @@ mdb_torture_ipv6_ipv4() · 2 unmodified lines | |||
| 2380 | local vtep1_ip=198.51.100.100 | 2425 | local vtep1_ip=198.51.100.100 |
| 2381 | local vtep2_ip=198.51.100.200 | 2426 | local vtep2_ip=198.51.100.200 |
| 2382 | local grp1=ff0e::1 | 2427 | local grp1=ff0e::1 |
| 2428 | local grp1_dmac=33:33:00:00:00:01 | ||
| 2383 | local grp2=ff0e::2 | 2429 | local grp2=ff0e::2 |
| 2430 | local grp2_dmac=33:33:00:00:00:02 | ||
| 2384 | local src=2001:db8:100::1 | 2431 | local src=2001:db8:100::1 |
| 2385 | 2432 | ||
| 2386 | echo | 2433 | echo |
| 2387 | echo "Data path: MDB torture test - IPv6 overlay / IPv4 underlay" | 2434 | echo "Data path: MDB torture test - IPv6 overlay / IPv4 underlay" |
| 2388 | echo "----------------------------------------------------------" | 2435 | echo "----------------------------------------------------------" |
| 2389 | 2436 | ||
| 2390 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp2 $src \ | 2437 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp1_dmac $grp2 \ |
| 2391 | "mausezahn -6" | 2438 | $grp2_dmac $src "mausezahn -6" |
| 2392 | } | 2439 | } |
| 2393 | 2440 | ||
| 2394 | mdb_torture_ipv4_ipv6() | 2441 | mdb_torture_ipv4_ipv6() |
| @@ -2397,15 +2444,17 @@ mdb_torture_ipv4_ipv6() · 2 unmodified lines | |||
| 2397 | local vtep1_ip=2001:db8:1000::1 | 2444 | local vtep1_ip=2001:db8:1000::1 |
| 2398 | local vtep2_ip=2001:db8:2000::1 | 2445 | local vtep2_ip=2001:db8:2000::1 |
| 2399 | local grp1=239.1.1.1 | 2446 | local grp1=239.1.1.1 |
| 2447 | local grp1_dmac=01:00:5e:01:01:01 | ||
| 2400 | local grp2=239.2.2.2 | 2448 | local grp2=239.2.2.2 |
| 2449 | local grp2_dmac=01:00:5e:02:02:02 | ||
| 2401 | local src=192.0.2.129 | 2450 | local src=192.0.2.129 |
| 2402 | 2451 | ||
| 2403 | echo | 2452 | echo |
| 2404 | echo "Data path: MDB torture test - IPv4 overlay / IPv6 underlay" | 2453 | echo "Data path: MDB torture test - IPv4 overlay / IPv6 underlay" |
| 2405 | echo "----------------------------------------------------------" | 2454 | echo "----------------------------------------------------------" |
| 2406 | 2455 | ||
| 2407 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp2 $src \ | 2456 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp1_dmac $grp2 \ |
| 2408 | "mausezahn" | 2457 | $grp2_dmac $src "mausezahn" |
| 2409 | } | 2458 | } |
| 2410 | 2459 | ||
| 2411 | mdb_torture_ipv6_ipv6() | 2460 | mdb_torture_ipv6_ipv6() |
| @@ -2414,15 +2463,17 @@ mdb_torture_ipv6_ipv6() · 2 unmodified lines | |||
| 2414 | local vtep1_ip=2001:db8:1000::1 | 2463 | local vtep1_ip=2001:db8:1000::1 |
| 2415 | local vtep2_ip=2001:db8:2000::1 | 2464 | local vtep2_ip=2001:db8:2000::1 |
| 2416 | local grp1=ff0e::1 | 2465 | local grp1=ff0e::1 |
| 2466 | local grp1_dmac=33:33:00:00:00:01 | ||
| 2417 | local grp2=ff0e::2 | 2467 | local grp2=ff0e::2 |
| 2468 | local grp2_dmac=33:33:00:00:00:02 | ||
| 2418 | local src=2001:db8:100::1 | 2469 | local src=2001:db8:100::1 |
| 2419 | 2470 | ||
| 2420 | echo | 2471 | echo |
| 2421 | echo "Data path: MDB torture test - IPv6 overlay / IPv6 underlay" | 2472 | echo "Data path: MDB torture test - IPv6 overlay / IPv6 underlay" |
| 2422 | echo "----------------------------------------------------------" | 2473 | echo "----------------------------------------------------------" |
| 2423 | 2474 | ||
| 2424 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp2 $src \ | 2475 | mdb_torture_common $ns1 $vtep1_ip $vtep2_ip $grp1 $grp1_dmac $grp2 \ |
| 2425 | "mausezahn -6" | 2476 | $grp2_dmac $src "mausezahn -6" |
| 2426 | } | 2477 | } |
| 2427 | 2478 | ||
| 2428 | ################################################################################ | 2479 | ################################################################################ |
| @@ -1615,6 +1615,40 @@ TEST_F(tls, getsockopt) · 1614 unmodified lines | |||
| 1615 | EXPECT_EQ(errno, EINVAL); | 1615 | EXPECT_EQ(errno, EINVAL); |
| 1616 | } | 1616 | } |
| 1617 | 1617 | ||
| 1618 | TEST_F(tls, recv_efault) | ||
| 1619 | { | ||
| 1620 | char *rec1 = "1111111111"; | ||
| 1621 | char *rec2 = "2222222222"; | ||
| 1622 | struct msghdr hdr = {}; | ||
| 1623 | struct iovec iov[2]; | ||
| 1624 | char recv_mem[12]; | ||
| 1625 | int ret; | ||
| 1626 | |||
| 1627 | if (self->notls) | ||
| 1628 | SKIP(return, "no TLS support"); | ||
| 1629 | |||
| 1630 | EXPECT_EQ(send(self->fd, rec1, 10, 0), 10); | ||
| 1631 | EXPECT_EQ(send(self->fd, rec2, 10, 0), 10); | ||
| 1632 | |||
| 1633 | iov[0].iov_base = recv_mem; | ||
| 1634 | iov[0].iov_len = sizeof(recv_mem); | ||
| 1635 | iov[1].iov_base = NULL; /* broken iov to make process_rx_list fail */ | ||
| 1636 | iov[1].iov_len = 1; | ||
| 1637 | |||
| 1638 | hdr.msg_iovlen = 2; | ||
| 1639 | hdr.msg_iov = iov; | ||
| 1640 | |||
| 1641 | EXPECT_EQ(recv(self->cfd, recv_mem, 1, 0), 1); | ||
| 1642 | EXPECT_EQ(recv_mem[0], rec1[0]); | ||
| 1643 | |||
| 1644 | ret = recvmsg(self->cfd, &hdr, 0); | ||
| 1645 | EXPECT_LE(ret, sizeof(recv_mem)); | ||
| 1646 | EXPECT_GE(ret, 9); | ||
| 1647 | EXPECT_EQ(memcmp(rec1, recv_mem, 9), 0); | ||
| 1648 | if (ret > 9) | ||
| 1649 | EXPECT_EQ(memcmp(rec2, recv_mem + 9, ret - 9), 0); | ||
| 1650 | } | ||
| 1651 | |||
| 1618 | FIXTURE(tls_err) | 1652 | FIXTURE(tls_err) |
| 1619 | { | 1653 | { |
| 1620 | int fd, cfd; | 1654 | int fd, cfd; |
| @@ -1 +1 @@ | |||
| 1 | timeout=120 | 1 | timeout=180 |