6.1.83-rc1 review
Subsystems (7)
Sasha Levin
maintainerPATCH 141/451 arm64: dts: mt8183: kukui: Split out keyboard node and describe detachables
In reply to Sasha LevinFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit 82492c4ef8f65f93cd4a35c4b52518935acbb2fa ]
Kukui devices krane, kodana, and kakadu use detachable keyboards, which only have switches to be registered.
Change the keyboard node's compatible of those boards to the newly introduced "google,cros-ec-keyb-switches", which won't include matrix properties.
Stable-dep-of: 04bd6411f506 ("arm64: dts: mt8183: Move CrosEC base detection node to kukui-based DTs")
--- arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi | 2 ++ arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi | 6 ++++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi | 6 ++++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi | 6 ++++++ arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 - 5 files changed, 20 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +2 -0
@@ -4,6 +4,8 @@ */ #include "mt8183-kukui.dtsi" +/* Must come after mt8183-kukui.dtsi to modify cros_ec */ +#include <arm/cros-ec-keyboard.dtsi> / { panel: panel {
arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi +6 -0
@@ -372,6 +372,12 @@ pen_eject { }; }; +&cros_ec { + keyboard-controller { + compatible = "google,cros-ec-keyb-switches"; + }; +}; + &qca_wifi { qcom,ath10k-calibration-variant = "GO_KAKADU"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi +6 -0
@@ -339,6 +339,12 @@ touch_pin_reset: pin_reset { }; }; +&cros_ec { + keyboard-controller { + compatible = "google,cros-ec-keyb-switches"; + }; +}; + &qca_wifi { qcom,ath10k-calibration-variant = "GO_KODAMA"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi +6 -0
@@ -343,6 +343,12 @@ rst_pin { }; }; +&cros_ec { + keyboard-controller { + compatible = "google,cros-ec-keyb-switches"; + }; +}; + &qca_wifi { qcom,ath10k-calibration-variant = "LE_Krane"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +0 -1
@@ -999,5 +999,4 @@ hub@1 { }; }; -#include <arm/cros-ec-keyboard.dtsi> #include <arm/cros-ec-sbs.dtsi>
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 142/451 arm64: dts: mt8183: Move CrosEC base detection node to kukui-based DTs
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 04bd6411f506357fd1faedc2b2156e7ef206aa9a ]
The cbas node is used to describe base detection functionality in the ChromeOS EC, which is used for units that have a detachable keyboard and thus rely on this functionality to switch between tablet and laptop mode.
Despite the original commit having added the cbas node to the mt8183-kukui.dtsi, not all machines that include it are detachables. In fact all machines that include from mt8183-kukui-jacuzzi.dtsi are either clamshells (ie normal laptops) or convertibles, meaning the keyboard can be flipped but not detached. The detection for the keyboard getting flipped is handled by the driver bound to the keyboard-controller node in the EC.
Move the base detection node from the base kukui dtsi to the dtsis where all machines are detachables, and thus actually make use of the node.
--- arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 4 ---- 4 files changed, 12 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi +4 -0
@@ -373,6 +373,10 @@ pen_eject { }; &cros_ec { + cbas { + compatible = "google,cros-cbas"; + }; + keyboard-controller { compatible = "google,cros-ec-keyb-switches"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi +4 -0
@@ -340,6 +340,10 @@ touch_pin_reset: pin_reset { }; &cros_ec { + cbas { + compatible = "google,cros-cbas"; + }; + keyboard-controller { compatible = "google,cros-ec-keyb-switches"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi +4 -0
@@ -344,6 +344,10 @@ rst_pin { }; &cros_ec { + cbas { + compatible = "google,cros-cbas"; + }; + keyboard-controller { compatible = "google,cros-ec-keyb-switches"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +0 -4
@@ -896,10 +896,6 @@ usbc_extcon: extcon0 { google,usb-port-id = <0>; }; - cbas { - compatible = "google,cros-cbas"; - }; - typec { compatible = "google,cros-ec-typec"; #address-cells = <1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 143/451 arm64: dts: mediatek: mt7986: add "#reset-cells" to infracfg
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit d993daff5962b2dd08f32a83bb1c0e5fa75732ea ]
MT7986's Infrastructure System Configuration Controller includes reset controller. It can reset blocks as specified in the include/dt-bindings/reset/mt7986-resets.h . Add #reset-cells so it can be referenced properly.
This fixes:arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dtb: infracfg@10001000: '#reset-cells' is a required property
from schema $id: http://devicetree.org/schemas/arm/mediatek/mediatek,infracfg.yaml#
--- arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +1 -0
@@ -110,6 +110,7 @@ infracfg: infracfg@10001000 { compatible = "mediatek,mt7986-infracfg", "syscon"; reg = <0 0x10001000 0 0x1000>; #clock-cells = <1>; + #reset-cells = <1>; }; wed_pcie: wed-pcie@10003000 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 144/451 arm64: dts: mediatek: mt8192-asurada: Remove CrosEC base detection node
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 9b49cabe631b0a25aaf8fc2ba81b5b9ea6ff01b7 ]
The commit adding the ChromeOS EC to the Asurada Devicetree mistakenly added a base detection node. While tablet mode detection is supported by CrosEC and used by Hayato, it is done through the cros-ec-keyb driver. The base detection node, which is handled by the hid-google-hammer driver, also provides tablet mode detection but by checking base attachment status on the CrosEC, which is not supported for Asurada.
Hence, remove the unused CrosEC base detection node for Asurada.
--- arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 4 ---- 1 file changed, 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +0 -4
@@ -819,10 +819,6 @@ cros_ec: ec@0 { #address-cells = <1>; #size-cells = <0>; - base_detection: cbas { - compatible = "google,cros-cbas"; - }; - cros_ec_pwm: pwm { compatible = "google,cros-ec-pwm"; #pwm-cells = <1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 145/451 arm64: dts: mediatek: mt8192: fix vencoder clock name
In reply to Sasha LevinFrom: Eugen Hristev <[email protected]>
[ Upstream commit 76aac0f2a46847ed4a7a4fdd848dd66023c19ad1 ]
Clock name should be venc_sel as per binding.
Fix the warning message :arch/arm64/boot/dts/mediatek/mt8192-asurada-hayato-r1.dtb: vcodec@17020000: clock-names:0: 'venc_sel' was expected
from schema $id: http://devicetree.org/schemas/media/mediatek,vcodec-encoder.yaml#
--- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +1 -1
@@ -1539,7 +1539,7 @@ vcodec_enc: vcodec@17020000 { mediatek,scp = <&scp>; power-domains = <&spm MT8192_POWER_DOMAIN_VENC>; clocks = <&vencsys CLK_VENC_SET1_VENC>; - clock-names = "venc-set1"; + clock-names = "venc_sel"; assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>; assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL_D4>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 146/451 arm64: dts: mediatek: mt7622: add missing "device_type" to memory nodes
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 99d100e00144bc01b49a697f4bc4398f2f7e7ce4 ]
This fixes:arch/arm64/boot/dts/mediatek/mt7622-rfb1.dtb: /: memory@40000000: 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/memory.yaml#arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dtb: /: memory@40000000: 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/memory.yaml#
--- arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts | 1 + arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 1 + 2 files changed, 2 insertions(+)
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +1 -0
@@ -74,6 +74,7 @@ led-1 { memory@40000000 { reg = <0 0x40000000 0 0x40000000>; + device_type = "memory"; }; reg_1p8v: regulator-1p8v {
arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +1 -0
@@ -56,6 +56,7 @@ key-wps { memory@40000000 { reg = <0 0x40000000 0 0x20000000>; + device_type = "memory"; }; reg_1p8v: regulator-1p8v {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 147/451 bpf: Mark bpf_spin_{lock,unlock}() helpers with notrace correctly
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit 178c54666f9c4d2f49f2ea661d0c11b52f0ed190 ]
Currently tracing is supposed not to allow for bpf_spin_{lock,unlock}() helper calls. This is to prevent deadlock for the following cases:
- there is a prog (prog-A) calling bpf_spin_{lock,unlock}().
- there is a tracing program (prog-B), e.g., fentry, attached to bpf_spin_lock() and/or bpf_spin_unlock().
- prog-B calls bpf_spin_{lock,unlock}().
For such a case, when prog-A calls bpf_spin_{lock,unlock}(), a deadlock will happen.
The related source codes are below in kernel/bpf/helpers.c:
notrace BPF_CALL_1(bpf_spin_lock, struct bpf_spin_lock *, lock) notrace BPF_CALL_1(bpf_spin_unlock, struct bpf_spin_lock *, lock)
notrace is supposed to prevent fentry prog from attaching to bpf_spin_{lock,unlock}().
But actually this is not the case and fentry prog can successfully attached to bpf_spin_lock(). Siddharth Chintamaneni reported the issue in [1]. The following is the macro definition for above BPF_CALL_1:
#define BPF_CALL_x(x, name, ...) \
static __always_inline \
u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \
typedef u64 (*btf_##name)(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \
u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \
u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \
{ \
return ((btf_##name)____##name)(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
} \
static __always_inline \
u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))#define BPF_CALL_1(name, ...) BPF_CALL_x(1, name, __VA_ARGS__)
The notrace attribute is actually applied to the static always_inline function ____bpf_spin_{lock,unlock}(). The actual callback function bpf_spin_{lock,unlock}() is not marked with notrace, hence allowing fentry prog to attach to two helpers, and this
may cause the above mentioned deadlock. Siddharth Chintamaneni actually has a reproducer in [2].
To fix the issue, a new macro NOTRACE_BPF_CALL_1 is introduced which will add notrace attribute to the original function instead of the hidden always_inline function and this fixed the problem.
[1] https://lore.kernel.org/bpf/CAE5sdEigPnoGrzN8WU7Tx-h-iFuMZgW06qp0KHWtpvoXxf1OAQ@mail.gmail.com/
[2] https://lore.kernel.org/bpf/CAE5sdEg6yUc_Jz50AnUXEEUh6O73yQ1Z6NV2srJnef0ZrQkZew@mail.gmail.com/
--- include/linux/filter.h | 21 ++++++++++++--------- kernel/bpf/helpers.c | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-)
include/linux/filter.h +12 -9
@@ -495,24 +495,27 @@ static inline bool insn_is_zext(const struct bpf_insn *insn)__BPF_MAP (n, __BPF_DECL_ARGS, __BPF_N, u64, __ur_1, u64, __ur_2, \ u64, __ur_3, u64, __ur_4, u64, __ur_5) -#define BPF_CALL_x (x, name, ...) \ +#define BPF_CALL_x (x, attr, name, ...) \ static __always_inline \ u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ typedef u64 (*btf_##name)(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ - u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ - u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ + attr u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ + attr u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ { \ return ((btf_##name)____##name)(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ } \ static __always_inline \ u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) -#define BPF_CALL_0 (name, ...) BPF_CALL_x(0, name, __VA_ARGS__) -#define BPF_CALL_1 (name, ...) BPF_CALL_x(1, name, __VA_ARGS__) -#define BPF_CALL_2 (name, ...) BPF_CALL_x(2, name, __VA_ARGS__) -#define BPF_CALL_3 (name, ...) BPF_CALL_x(3, name, __VA_ARGS__) -#define BPF_CALL_4 (name, ...) BPF_CALL_x(4, name, __VA_ARGS__) -#define BPF_CALL_5 (name, ...) BPF_CALL_x(5, name, __VA_ARGS__) +#define __NOATTR +#define BPF_CALL_0 (name, ...) BPF_CALL_x(0, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_1 (name, ...) BPF_CALL_x(1, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_2 (name, ...) BPF_CALL_x(2, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_3 (name, ...) BPF_CALL_x(3, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_4 (name, ...) BPF_CALL_x(4, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_5 (name, ...) BPF_CALL_x(5, __NOATTR, name, __VA_ARGS__) + +#define NOTRACE_BPF_CALL_1 (name, ...) BPF_CALL_x(1, notrace, name, __VA_ARGS__)#define bpf_ctx_range (TYPE ,MEMBER ) \ offsetof(TYPE, MEMBER) ... offsetofend(TYPE, MEMBER) - 1
kernel/bpf/helpers.c +2 -2
@@ -328,7 +328,7 @@ static inline void __bpf_spin_lock_irqsave(struct bpf_spin_lock *lock)__this_cpu_write (irqsave_flags, flags); } -notrace BPF_CALL_1 (bpf_spin_lock ,struct bpf_spin_lock *,lock ) +NOTRACE_BPF_CALL_1(bpf_spin_lock, struct bpf_spin_lock *, lock) {__bpf_spin_lock_irqsave (lock);return 0 ;
@@ -350,7 +350,7 @@ static inline void __bpf_spin_unlock_irqrestore(struct bpf_spin_lock *lock)local_irq_restore (flags); } -notrace BPF_CALL_1 (bpf_spin_unlock ,struct bpf_spin_lock *,lock ) +NOTRACE_BPF_CALL_1(bpf_spin_unlock, struct bpf_spin_lock *, lock) {__bpf_spin_unlock_irqrestore (lock);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 148/451 selftests/bpf: Convert test_global_funcs test to test_loader framework
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 95ebb376176c52382293e05e63f142114a5e40ef ]
Convert 17 test_global_funcs subtests into test_loader framework for easier maintenance and more declarative way to define expected failures/successes.
Stable-dep-of: 879bbe7aa4af ("bpf: don't infer PTR_TO_CTX for programs with unnamed context type")
--- .../bpf/prog_tests/test_global_funcs.c | 131 +++++------------- .../selftests/bpf/progs/test_global_func1.c | 6 +- .../selftests/bpf/progs/test_global_func10.c | 4 +- .../selftests/bpf/progs/test_global_func11.c | 4 +- .../selftests/bpf/progs/test_global_func12.c | 4 +- .../selftests/bpf/progs/test_global_func13.c | 4 +- .../selftests/bpf/progs/test_global_func14.c | 4 +- .../selftests/bpf/progs/test_global_func15.c | 4 +- .../selftests/bpf/progs/test_global_func16.c | 4 +- .../selftests/bpf/progs/test_global_func17.c | 4 +- .../selftests/bpf/progs/test_global_func2.c | 43 +++++- .../selftests/bpf/progs/test_global_func3.c | 10 +- .../selftests/bpf/progs/test_global_func4.c | 55 +++++++- .../selftests/bpf/progs/test_global_func5.c | 4 +- .../selftests/bpf/progs/test_global_func6.c | 4 +- .../selftests/bpf/progs/test_global_func7.c | 4 +- .../selftests/bpf/progs/test_global_func8.c | 4 +- .../selftests/bpf/progs/test_global_func9.c | 4 +- 18 files changed, 174 insertions(+), 123 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c +34 -97
@@ -1,104 +1,41 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <test_progs.h> - -const char *err_str; -bool found; - -static int libbpf_debug_print (enum libbpf_print_level level, -const char *format,va_list args) -{ -char *log_buf; - -if (level !=LIBBPF_WARN || -strcmp (format,"libbpf: \n%s\n" )) { -vprintf (format, args); -return 0 ; - } - - log_buf = va_arg(args, char *); -if (!log_buf) - goto out; -if (err_str &&strstr (log_buf, err_str) ==0 ) - found = true; -out: -printf (format, log_buf); -return 0 ; -} - -extern int extra_prog_load_log_flags; - -static int check_load (const char *file) -{ -struct bpf_object *obj =NULL ; -struct bpf_program *prog; -int err; - - found = false; - - obj =bpf_object__open_file (file,NULL ); - err =libbpf_get_error (obj); -if (err) -return err; - - prog =bpf_object__next_program (obj,NULL ); -if (!prog) { - err = -ENOENT ; - goto err_out; - } - -bpf_program__set_flags (prog,BPF_F_TEST_RND_HI32 ); -bpf_program__set_log_level (prog, extra_prog_load_log_flags); - - err =bpf_object__load (obj); - -err_out: -bpf_object__close (obj); -return err; -} - -struct test_def { -const char *file; -const char *err_str; -}; +#include "test_global_func1.skel.h" +#include "test_global_func2.skel.h" +#include "test_global_func3.skel.h" +#include "test_global_func4.skel.h" +#include "test_global_func5.skel.h" +#include "test_global_func6.skel.h" +#include "test_global_func7.skel.h" +#include "test_global_func8.skel.h" +#include "test_global_func9.skel.h" +#include "test_global_func10.skel.h" +#include "test_global_func11.skel.h" +#include "test_global_func12.skel.h" +#include "test_global_func13.skel.h" +#include "test_global_func14.skel.h" +#include "test_global_func15.skel.h" +#include "test_global_func16.skel.h" +#include "test_global_func17.skel.h" void test_test_global_funcs (void ) { -struct test_def tests[] = { - {"test_global_func1.bpf.o" ,"combined stack size of 4 calls is 544" }, - {"test_global_func2.bpf.o" }, - {"test_global_func3.bpf.o" ,"the call stack of 8 frames" }, - {"test_global_func4.bpf.o" }, - {"test_global_func5.bpf.o" ,"expected pointer to ctx, but got PTR" }, - {"test_global_func6.bpf.o" ,"modified ctx ptr R2" }, - {"test_global_func7.bpf.o" ,"foo() doesn't return scalar" }, - {"test_global_func8.bpf.o" }, - {"test_global_func9.bpf.o" }, - {"test_global_func10.bpf.o" ,"invalid indirect read from stack" }, - {"test_global_func11.bpf.o" ,"Caller passes invalid args into func#1" }, - {"test_global_func12.bpf.o" ,"invalid mem access 'mem_or_null'" }, - {"test_global_func13.bpf.o" ,"Caller passes invalid args into func#1" }, - {"test_global_func14.bpf.o" ,"reference type('FWD S') size cannot be determined" }, - {"test_global_func15.bpf.o" ,"At program exit the register R0 has value" }, - {"test_global_func16.bpf.o" ,"invalid indirect read from stack" }, - {"test_global_func17.bpf.o" ,"Caller passes invalid args into func#1" }, - }; -libbpf_print_fn_t old_print_fn =NULL ; -int err, i, duration =0 ; - - old_print_fn =libbpf_set_print (libbpf_debug_print); - -for (i =0 ; i <ARRAY_SIZE (tests); i++) { -const struct test_def *test = &tests[i]; - -if (!test__start_subtest (test->file)) -continue ; - - err_str = test->err_str; - err =check_load (test->file); -CHECK_FAIL (!!err ^ !!err_str); -if (err_str) -CHECK (found,"" ,"expected string '%s'" , err_str); - } -libbpf_set_print (old_print_fn); +RUN_TESTS (test_global_func1); +RUN_TESTS (test_global_func2); +RUN_TESTS (test_global_func3); +RUN_TESTS (test_global_func4); +RUN_TESTS (test_global_func5); +RUN_TESTS (test_global_func6); +RUN_TESTS (test_global_func7); +RUN_TESTS (test_global_func8); +RUN_TESTS (test_global_func9); +RUN_TESTS (test_global_func10); +RUN_TESTS (test_global_func11); +RUN_TESTS (test_global_func12); +RUN_TESTS (test_global_func13); +RUN_TESTS (test_global_func14); +RUN_TESTS (test_global_func15); +RUN_TESTS (test_global_func16); +RUN_TESTS (test_global_func17); }
tools/testing/selftests/bpf/progs/test_global_func1.c +3 -3
@@ -3,10 +3,9 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" -#ifndef MAX_STACK #define MAX_STACK (512 - 3 * 32 + 8) -#endif static __attribute__ ((noinline))int f0 (int var,struct __sk_buff *skb)
@@ -39,7 +38,8 @@ int f3(int val, struct __sk_buff *skb, int var) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("combined stack size of 4 calls is 544") +int global_func1(struct __sk_buff *skb) {return f0 (1 , skb) +f1 (skb) +f2 (2 , skb) +f3 (3 , skb,4 ); }
tools/testing/selftests/bpf/progs/test_global_func10.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct Small {int x;
@@ -21,7 +22,8 @@ __noinline int foo(const struct Big *big) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("invalid indirect read from stack") +int global_func10(struct __sk_buff *skb) {const struct Small small = {.x = skb->len };
tools/testing/selftests/bpf/progs/test_global_func11.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -13,7 +14,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("Caller passes invalid args into func#1") +int global_func11(struct __sk_buff *skb) {return foo ((const void *)skb); }
tools/testing/selftests/bpf/progs/test_global_func12.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -13,7 +14,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("invalid mem access 'mem_or_null'") +int global_func12(struct __sk_buff *skb) {const struct S s = {.x = skb->len };
tools/testing/selftests/bpf/progs/test_global_func13.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -16,7 +17,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("Caller passes invalid args into func#1") +int global_func13(struct __sk_buff *skb) {const struct S *s = (const struct S *)(0xbedabeda );
tools/testing/selftests/bpf/progs/test_global_func14.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S ;
@@ -14,7 +15,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("reference type('FWD S') size cannot be determined") +int global_func14(struct __sk_buff *skb) {return foo (NULL );
tools/testing/selftests/bpf/progs/test_global_func15.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(unsigned int *v) {
@@ -12,7 +13,8 @@ __noinline int foo(unsigned int *v) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("At program exit the register R0 has value") +int global_func15(struct __sk_buff *skb) {unsigned int v =1 ;
tools/testing/selftests/bpf/progs/test_global_func16.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(int (*arr)[10]) {
@@ -12,7 +13,8 @@ __noinline int foo(int (*arr)[10]) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("invalid indirect read from stack") +int global_func16(struct __sk_buff *skb) {int array[10 ];
tools/testing/selftests/bpf/progs/test_global_func17.c +3 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <vmlinux.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(int *p) {
@@ -10,7 +11,8 @@ __noinline int foo(int *p)const volatile int i; SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("Caller passes invalid args into func#1") +int global_func17(struct __sk_buff *skb) {return foo ((int *)&i); }
tools/testing/selftests/bpf/progs/test_global_func2.c +42 -1
46 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_global_func3.c +3 -7
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))int f1 (struct __sk_buff *skb)
@@ -46,20 +47,15 @@ int f7(struct __sk_buff *skb)return f6 (skb); } -#ifndef NO_FN8 __attribute__ ((noinline))int f8 (struct __sk_buff *skb) {return f7 (skb); } -#endif SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("the call stack of 8 frames") +int global_func3(struct __sk_buff *skb) { -#ifndef NO_FN8 return f8 (skb); -#else -return f7 (skb); -#endif }
tools/testing/selftests/bpf/progs/test_global_func4.c +53 -2
57 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_global_func5.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))int f1 (struct __sk_buff *skb)
@@ -25,7 +26,8 @@ int f3(int val, struct __sk_buff *skb) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("expected pointer to ctx, but got PTR") +int global_func5(struct __sk_buff *skb) {return f1 (skb) +f2 (2 , skb) +f3 (3 , skb); }
tools/testing/selftests/bpf/progs/test_global_func6.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))int f1 (struct __sk_buff *skb)
@@ -25,7 +26,8 @@ int f3(int val, struct __sk_buff *skb) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("modified ctx ptr R2") +int global_func6(struct __sk_buff *skb) {return f1 (skb) +f2 (2 , skb) +f3 (3 , skb); }
tools/testing/selftests/bpf/progs/test_global_func7.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))void foo (struct __sk_buff *skb)
@@ -11,7 +12,8 @@ void foo(struct __sk_buff *skb) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("foo() doesn't return scalar") +int global_func7(struct __sk_buff *skb) {foo (skb);return 0 ;
tools/testing/selftests/bpf/progs/test_global_func8.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(struct __sk_buff *skb) {
@@ -10,7 +11,8 @@ __noinline int foo(struct __sk_buff *skb) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__success +int global_func8 (struct __sk_buff *skb) {if (!foo (skb))return 0 ;
tools/testing/selftests/bpf/progs/test_global_func9.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -74,7 +75,8 @@ __noinline int quuz(int **p) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__success +int global_func9 (struct __sk_buff *skb) {int result =0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 149/451 selftests/bpf: Add global subprog context passing tests
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit e2b5cfc978f871996d1f8667515c0e06b33e620e ]
Add tests validating that it's possible to pass context arguments into global subprogs for various types of programs, including a particularly tricky KPROBE programs (which cover kprobes, uprobes, USDTs, a vast and important class of programs).
Stable-dep-of: 879bbe7aa4af ("bpf: don't infer PTR_TO_CTX for programs with unnamed context type")
--- .../bpf/prog_tests/test_global_funcs.c | 2 + .../bpf/progs/test_global_func_ctx_args.c | 104 ++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/test_global_func_ctx_args.c
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c +2 -0
@@ -18,6 +18,7 @@#include "test_global_func15.skel.h" #include "test_global_func16.skel.h" #include "test_global_func17.skel.h" +#include "test_global_func_ctx_args.skel.h" void test_test_global_funcs (void ) {
@@ -38,4 +39,5 @@ void test_test_global_funcs(void)RUN_TESTS (test_global_func15);RUN_TESTS (test_global_func16);RUN_TESTS (test_global_func17); +RUN_TESTS (test_global_func_ctx_args); }
tools/testing/selftests/bpf/progs/test_global_func_ctx_args.c new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 150/451 bpf: don't infer PTR_TO_CTX for programs with unnamed context type
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 879bbe7aa4afa80acf72a1cad7f52416ea78c52d ]
For program types that don't have named context type name (e.g., BPF iterator programs or tracepoint programs), ctx_tname will be a non-NULL empty string. For such programs it shouldn't be possible to have PTR_TO_CTX argument for global subprogs based on type name alone. arg:ctx tag is the only way to have PTR_TO_CTX passed into global subprog for such program types.
Fix this loophole, which currently would assume PTR_TO_CTX whenever user uses a pointer to anonymous struct as an argument to their global subprogs. This happens in practice with the following (quite common, in practice) approach:
typedef struct { /* anonymous */
int x; } my_type_t;
int my_subprog(my_type_t *arg) { ... }
User's intent is to have PTR_TO_MEM argument for arg, but verifier will complain about expecting PTR_TO_CTX.
This fix also closes unintended s390x-specific KPROBE handling of PTR_TO_CTX case. Selftest change is necessary to accommodate this.
--- kernel/bpf/btf.c | 3 +++ .../bpf/progs/test_global_func_ctx_args.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+)
kernel/bpf/btf.c +3 -0
@@ -5135,6 +5135,9 @@ btf_get_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf,bpf_log (log,"Please fix kernel include/linux/bpf_types.h\n" );return NULL ; } +/* program types without named context types work only with arg:ctx tag */ +if (ctx_tname[0 ] =='\0' ) +return false;/* only compare that prog's ctx type name is the same as * kernel expects. No need to compare field by field. * It's ok for bpf prog to do:
tools/testing/selftests/bpf/progs/test_global_func_ctx_args.c +19 -0
@@ -26,6 +26,23 @@ int kprobe_typedef_ctx(void *ctx)return kprobe_typedef_ctx_subprog (ctx); } +/* s390x defines: +* +* typedef user_pt_regs bpf_user_pt_regs_t; +* typedef struct { ... } user_pt_regs; +* +* And so "canonical" underlying struct type is anonymous. +* So on s390x only valid ways to have PTR_TO_CTX argument in global subprogs +* are: +* - bpf_user_pt_regs_t *ctx (typedef); +* - struct bpf_user_pt_regs_t *ctx (backwards compatible struct hack); +* - void *ctx __arg_ctx (arg:ctx tag) +* +* Other architectures also allow using underlying struct types (e.g., +* `struct pt_regs *ctx` for x86-64) +*/ +#ifndef bpf_target_s390 +#define pt_regs_struct_t typeof(*(__PT_REGS_CAST((struct pt_regs *)NULL)))__weak int kprobe_struct_ctx_subprog (pt_regs_struct_t *ctx)
@@ -40,6 +57,8 @@ int kprobe_resolved_ctx(void *ctx) return kprobe_struct_ctx_subprog(ctx); } +#endif +/* this is current hack to make this work on old kernels */ struct bpf_user_pt_regs_t {};
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 151/451 ARM: dts: qcom: msm8974: correct qfprom node size
In reply to Sasha LevinFrom: Craig Tatlor <[email protected]>
[ Upstream commit 724c4bf0e4bf81dba77736afb93964c986c3c123 ]
The qfprom actually is bigger than 0x1000, so adjust the reg.
Note that the non-ECC-corrected qfprom can be found at 0xfc4b8000 (-0x4000). The current reg points to the ECC-corrected qfprom block which should have equivalent values at all offsets compared to the non-corrected version.
[[email protected]: extract to standalone patch and adjust for review comments]
--- arch/arm/boot/dts/qcom-msm8974.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-msm8974.dtsi +1 -1
@@ -1134,7 +1134,7 @@ restart@fc4ab000 { qfprom: qfprom@fc4bc000 { compatible = "qcom,msm8974-qfprom", "qcom,qfprom"; - reg = <0xfc4bc000 0x1000>; + reg = <0xfc4bc000 0x2100>; #address-cells = <1>; #size-cells = <1>; tsens_calib: calib@d0 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 152/451 wifi: wilc1000: prevent use-after-free on vif when cleaning up all interfaces
In reply to Sasha LevinFrom: Alexis Lothoré <[email protected]>
[ Upstream commit cb5942b77c05d54310a0420cac12935e9b6aa21c ]
wilc_netdev_cleanup currently triggers a KASAN warning, which can be observed on interface registration error path, or simply by removing the module/unbinding device from driver:
echo spi0.1 > /sys/bus/spi/drivers/wilc1000_spi/unbind
==================================================================
BUG: KASAN: slab-use-after-free in wilc_netdev_cleanup+0x508/0x5cc Read of size 4 at addr c54d1ce8 by task sh/86 CPU: 0 PID: 86 Comm: sh Not tainted 6.8.0-rc1+ #117 Hardware name: Atmel SAMA5 unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x34/0x58 dump_stack_lvl from print_report+0x154/0x500 print_report from kasan_report+0xac/0xd8 kasan_report from wilc_netdev_cleanup+0x508/0x5cc wilc_netdev_cleanup from wilc_bus_remove+0xc8/0xec wilc_bus_remove from spi_remove+0x8c/0xac spi_remove from device_release_driver_internal+0x434/0x5f8 device_release_driver_internal from unbind_store+0xbc/0x108 unbind_store from kernfs_fop_write_iter+0x398/0x584 kernfs_fop_write_iter from vfs_write+0x728/0xf88 vfs_write from ksys_write+0x110/0x1e4 ksys_write from ret_fast_syscall+0x0/0x1c
[...]
Allocated by task 1: kasan_save_track+0x30/0x5c __kasan_kmalloc+0x8c/0x94 __kmalloc_node+0x1cc/0x3e4 kvmalloc_node+0x48/0x180 alloc_netdev_mqs+0x68/0x11dc alloc_etherdev_mqs+0x28/0x34 wilc_netdev_ifc_init+0x34/0x8ec wilc_cfg80211_init+0x690/0x910 wilc_bus_probe+0xe0/0x4a0 spi_probe+0x158/0x1b0 really_probe+0x270/0xdf4 __driver_probe_device+0x1dc/0x580 driver_probe_device+0x60/0x140 __driver_attach+0x228/0x5d4 bus_for_each_dev+0x13c/0x1a8 bus_add_driver+0x2a0/0x608 driver_register+0x24c/0x578 do_one_initcall+0x180/0x310 kernel_init_freeable+0x424/0x484 kernel_init+0x20/0x148 ret_from_fork+0x14/0x28 Freed by task 86: kasan_save_track+0x30/0x5c kasan_save_free_info+0x38/0x58 __kasan_slab_free+0xe4/0x140 kfree+0xb0/0x238 device_release+0xc0/0x2a8 kobject_put+0x1d4/0x46c netdev_run_todo+0x8fc/0x11d0 wilc_netdev_cleanup+0x1e4/0x5cc wilc_bus_remove+0xc8/0xec spi_remove+0x8c/0xac device_release_driver_internal+0x434/0x5f8 unbind_store+0xbc/0x108 kernfs_fop_write_iter+0x398/0x584 vfs_write+0x728/0xf88 ksys_write+0x110/0x1e4 ret_fast_syscall+0x0/0x1c [...]
David Mosberger-Tan initial investigation [1] showed that this use-after-free is due to netdevice unregistration during vif list traversal. When unregistering a net device, since the needs_free_netdev has been set to true during registration, the netdevice object is also freed, and as a consequence, the corresponding vif object too, since it is attached to it as private netdevice data. The next occurrence of the loop then tries to access freed vif pointer to the list to move forward in the list.
Fix this use-after-free thanks to two mechanisms:
- navigate in the list with list_for_each_entry_safe, which allows to safely modify the list as we go through each element. For each element, remove it from the list with list_del_rcu
- make sure to wait for RCU grace period end after each vif removal to make sure it is safe to free the corresponding vif too (through unregister_netdev)
Since we are in a RCU "modifier" path (not a "reader" path), and because such path is expected not to be concurrent to any other modifier (we are using the vif_mutex lock), we do not need to use RCU list API, that's why we can benefit from list_for_each_entry_safe.
[1] https://lore.kernel.org/linux-wireless/[email protected]/
--- .../net/wireless/microchip/wilc1000/netdev.c | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +7 -21
@@ -878,8 +878,7 @@ static const struct net_device_ops wilc_netdev_ops = {void wilc_netdev_cleanup (struct wilc *wilc) { -struct wilc_vif *vif; -int srcu_idx, ifc_cnt =0 ; +struct wilc_vif *vif, *vif_tmp;if (!wilc)return ;
@@ -889,32 +888,19 @@ void wilc_netdev_cleanup(struct wilc *wilc) wilc->firmware =NULL ; } - srcu_idx =srcu_read_lock (&wilc->srcu); -list_for_each_entry_rcu (vif, &wilc->vif_list, list) { +list_for_each_entry_safe (vif, vif_tmp, &wilc->vif_list, list) { +mutex_lock (&wilc->vif_mutex); +list_del_rcu (&vif->list); + wilc->vif_num--; +mutex_unlock (&wilc->vif_mutex); +synchronize_srcu (&wilc->srcu);if (vif->ndev)unregister_netdev (vif->ndev); } -srcu_read_unlock (&wilc->srcu, srcu_idx);wilc_wfi_deinit_mon_interface (wilc, false);destroy_workqueue (wilc->hif_workqueue); -while (ifc_cnt <WILC_NUM_CONCURRENT_IFC ) { -mutex_lock (&wilc->vif_mutex); -if (wilc->vif_num <=0 ) { -mutex_unlock (&wilc->vif_mutex); -break ; - } - vif =wilc_get_wl_to_vif (wilc); -if (!IS_ERR (vif)) -list_del_rcu (&vif->list); - - wilc->vif_num--; -mutex_unlock (&wilc->vif_mutex); -synchronize_srcu (&wilc->srcu); - ifc_cnt++; - } -wilc_wlan_cfg_deinit (wilc);wlan_deinit_locks (wilc);wiphy_unregister (wilc->wiphy);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 153/451 ACPI: processor_idle: Fix memory leak in acpi_processor_power_exit()
In reply to Sasha LevinFrom: Armin Wolf <[email protected]>
[ Upstream commit e18afcb7b2a12b635ac10081f943fcf84ddacc51 ]
After unregistering the CPU idle device, the memory associated with it is not freed, leading to a memory leak:
unreferenced object 0xffff896282f6c000 (size 1024):
comm "swapper/0", pid 1, jiffies 4294893170 hex dump (first 32 bytes):
00 00 00 00 0b 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 8836a742):
[<ffffffff993495ed>] kmalloc_trace+0x29d/0x340
[<ffffffff9972f3b3>] acpi_processor_power_init+0xf3/0x1c0
[<ffffffff9972d263>] __acpi_processor_start+0xd3/0xf0
[<ffffffff9972d2bc>] acpi_processor_start+0x2c/0x50
[<ffffffff99805872>] really_probe+0xe2/0x480
[<ffffffff99805c98>] __driver_probe_device+0x78/0x160
[<ffffffff99805daf>] driver_probe_device+0x1f/0x90
[<ffffffff9980601e>] __driver_attach+0xce/0x1c0
[<ffffffff99803170>] bus_for_each_dev+0x70/0xc0
[<ffffffff99804822>] bus_add_driver+0x112/0x210
[<ffffffff99807245>] driver_register+0x55/0x100
[<ffffffff9aee4acb>] acpi_processor_driver_init+0x3b/0xc0
[<ffffffff990012d1>] do_one_initcall+0x41/0x300
[<ffffffff9ae7c4b0>] kernel_init_freeable+0x320/0x470
[<ffffffff99b231f6>] kernel_init+0x16/0x1b0
[<ffffffff99042e6d>] ret_from_fork+0x2d/0x50Fix this by freeing the CPU idle device after unregistering it.
--- drivers/acpi/processor_idle.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/processor_idle.c +2 -0
@@ -1431,6 +1431,8 @@ int acpi_processor_power_exit(struct acpi_processor *pr) acpi_processor_registered--;if (acpi_processor_registered ==0 )cpuidle_unregister_driver (&acpi_idle_driver); + +kfree (dev); } pr->flags.power_setup_done =0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 154/451 bus: tegra-aconnect: Update dependency to ARCH_TEGRA
In reply to Sasha LevinFrom: Peter Robinson <[email protected]>
[ Upstream commit 4acd21a45c1446277e2abaece97d7fa7c2e692a9 ]
Update the architecture dependency to be the generic Tegra because the driver works on the four latest Tegra generations not just Tegra210, if you build a kernel with a specific ARCH_TEGRA_xxx_SOC option that excludes Tegra210 you don't get this driver.
--- drivers/bus/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/bus/Kconfig +3 -2
@@ -186,11 +186,12 @@ config SUNXI_RSB config TEGRA_ACONNECT tristate "Tegra ACONNECT Bus Driver" - depends on ARCH_TEGRA_210_SOC + depends on ARCH_TEGRA depends on OF && PM help Driver for the Tegra ACONNECT bus which is used to interface with - the devices inside the Audio Processing Engine (APE) for Tegra210. + the devices inside the Audio Processing Engine (APE) for + Tegra210 and later. config TEGRA_GMI tristate "Tegra Generic Memory Interface bus driver"
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 155/451 iommu/amd: Mark interrupt as managed
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 0feda94c868d396fac3b3cb14089d2d989a07c72 ]
On many systems that have an AMD IOMMU the following sequence of warnings is observed during bootup.
``` pci 0000:00:00.2 can't derive routing for PCI INT A pci 0000:00:00.2: PCI INT A: not connected ```
This series of events happens because of the IOMMU initialization sequence order and the lack of _PRT entries for the IOMMU.
During initialization the IOMMU driver first enables the PCI device using pci_enable_device(). This will call acpi_pci_irq_enable() which will check if the interrupt is declared in a PCI routing table (_PRT) entry. According to the PCI spec [1] these routing entries are only required under PCI root bridges:
The _PRT object is required under all PCI root bridges
The IOMMU is directly connected to the root complex, so there is no parent bridge to look for a _PRT entry. The first warning is emitted since no entry could be found in the hierarchy. The second warning is then emitted because the interrupt hasn't yet been configured to any value. The pin was configured in pci_read_irq() but the byte in PCI_INTERRUPT_LINE return 0xff which means "Unknown".
After that sequence of events pci_enable_msi() is called and this will allocate an interrupt.
That is both of these warnings are totally harmless because the IOMMU uses MSI for interrupts. To avoid even trying to probe for a _PRT entry mark the IOMMU as IRQ managed. This avoids both warnings.
--- drivers/iommu/amd/init.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/amd/init.c +3 -0
@@ -2047,6 +2047,9 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)/* Prevent binding other PCI device drivers to IOMMU devices */ iommu->dev->match_driver = false; +/* ACPI _PRT won't have an IRQ for IOMMU */ + iommu->dev->irq_managed =1 ; +pci_read_config_dword (iommu->dev, cap_ptr +MMIO_CAP_HDR_OFFSET , &iommu->cap);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 156/451 wifi: brcmsmac: avoid function pointer casts
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit e1ea6db35fc3ba5ff063f097385e9f7a88c25356 ]
An old cleanup went a little too far and causes a warning with clang-16 and higher as it breaks control flow integrity (KCFI) rules:
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
64 | brcms_init_timer(physhim->wl, (void (*)(void *))fn,
| ^~~~~~~~~~~~~~~~~~~~
Change this one instance back to passing a void pointer so it can be used with the timer callback interface.
--- .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c | 3 ++- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c | 5 ++--- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c +2 -1
@@ -383,8 +383,9 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)return sh; } -static void wlc_phy_timercb_phycal (struct brcms_phy *pi) +static void wlc_phy_timercb_phycal (void *ptr) { +struct brcms_phy *pi = ptr;uint delay =5 ;if (PHY_PERICAL_MPHASE_PENDING (pi)) {
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c +2 -3
@@ -57,12 +57,11 @@ void wlc_phy_shim_detach(struct phy_shim_info *physhim) }struct wlapi_timer *wlapi_init_timer (struct phy_shim_info *physhim, -void (*fn)(struct brcms_phy *pi), +void (*fn)(void *pi),void *arg,const char *name) {return (struct wlapi_timer *) -brcms_init_timer (physhim->wl, (void (*)(void *))fn, - arg, name); +brcms_init_timer (physhim->wl, fn, arg, name); }void wlapi_free_timer (struct wlapi_timer *t)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h +1 -1
@@ -131,7 +131,7 @@ void wlc_phy_shim_detach(struct phy_shim_info *physhim);/* PHY to WL utility functions */ struct wlapi_timer *wlapi_init_timer (struct phy_shim_info *physhim, -void (*fn)(struct brcms_phy *pi), +void (*fn)(void *pi),void *arg,const char *name);void wlapi_free_timer (struct wlapi_timer *t);void wlapi_add_timer (struct wlapi_timer *t,uint ms,int periodic);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 157/451 arm64: dts: qcom: sdm845-db845c: correct PCIe wake-gpios
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 584a327c5cffc36369b2a8953d9448826240f1ac ]
Bindings allow a "wake", not "enable", GPIO. Schematics also use WAKE name for the pin:
sdm845-db845c.dtb: pcie@1c00000: Unevaluated properties are not allowed ('enable-gpio' was unexpected)
--- arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +1 -1
@@ -532,7 +532,7 @@ &mss_pil { &pcie0 { status = "okay"; perst-gpios = <&tlmm 35 GPIO_ACTIVE_LOW>; - enable-gpio = <&tlmm 134 GPIO_ACTIVE_HIGH>; + wake-gpios = <&tlmm 134 GPIO_ACTIVE_HIGH>; vddpe-3v3-supply = <&pcie0_3p3v_dual>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 158/451 arm64: dts: qcom: sm8150: use 'gpios' suffix for PCI GPIOs
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit af6f6778d34cb40e60368e288767f674cc0c5f60 ]
Linux handles both versions, but bindings expect GPIO properties to have 'gpios' suffix instead of 'gpio':
sa8155p-adp.dtb: pci@1c00000: Unevaluated properties are not allowed ('perst-gpio' was unexpected)
Stable-dep-of: 7c38989d0f7a ("arm64: dts: qcom: sm8150: correct PCIe wake-gpios")
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +2 -2
@@ -1822,7 +1822,7 @@ pcie0: pci@1c00000 { phys = <&pcie0_lane>; phy-names = "pciephy"; - perst-gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>; + perst-gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; enable-gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>; pinctrl-names = "default";
@@ -1925,7 +1925,7 @@ pcie1: pci@1c08000 { phys = <&pcie1_lane>; phy-names = "pciephy"; - perst-gpio = <&tlmm 102 GPIO_ACTIVE_HIGH>; + perst-gpios = <&tlmm 102 GPIO_ACTIVE_HIGH>; enable-gpio = <&tlmm 104 GPIO_ACTIVE_HIGH>; pinctrl-names = "default";
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 159/451 arm64: dts: qcom: sm8150: correct PCIe wake-gpios
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7c38989d0f7a35c83e7c4781271d42662903fa8d ]
Bindings allow a "wake", not "enable", GPIO. Schematics also use WAKE name for the pin:
sa8155p-adp.dtb: pcie@1c00000: Unevaluated properties are not allowed ('enable-gpio' was unexpected)
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +1 -1
@@ -1823,7 +1823,7 @@ pcie0: pci@1c00000 { phy-names = "pciephy"; perst-gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; - enable-gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>; + wake-gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&pcie0_default_state>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 160/451 powercap: dtpm_cpu: Fix error check against freq_qos_add_request()
In reply to Sasha LevinFrom: Daniel Lezcano <[email protected]>
[ Upstream commit b50155cb0d609437236c88201206267835c6f965 ]
The caller of the function freq_qos_add_request() checks again a non zero value but freq_qos_add_request() can return '1' if the request already exists. Therefore, the setup function fails while the QoS request actually did not failed.
Fix that by changing the check against a negative value like all the other callers of the function.
--- drivers/powercap/dtpm_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/powercap/dtpm_cpu.c +1 -1
@@ -219,7 +219,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) ret =freq_qos_add_request (&policy->constraints, &dtpm_cpu->qos_req,FREQ_QOS_MAX , pd->table[pd->nr_perf_states -1 ].frequency); -if (ret) +if (ret <0 ) goto out_dtpm_unregister;cpufreq_cpu_put (policy);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 161/451 net: ena: Remove ena_select_queue
In reply to Sasha LevinFrom: Kamal Heib <[email protected]>
[ Upstream commit 78e886ba2b549945ecada055ee0765f0ded5707a ]
Avoid the following warnings by removing the ena_select_queue() function and rely on the net core to do the queue selection, The issue happen when an skb received from an interface with more queues than ena is forwarded to the ena interface.
[ 1176.159959] eth0 selects TX queue 11, but real number of TX queues is 8 [ 1176.863976] eth0 selects TX queue 14, but real number of TX queues is 8 [ 1180.767877] eth0 selects TX queue 14, but real number of TX queues is 8 [ 1188.703742] eth0 selects TX queue 14, but real number of TX queues is 8
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +0 -17
@@ -3174,22 +3174,6 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; } -static u16 ena_select_queue (struct net_device *dev,struct sk_buff *skb, -struct net_device *sb_dev) -{ -u16 qid; -/* we suspect that this is good for in--kernel network services that -* want to loop incoming skb rx to tx in normal user generated traffic, -* most probably we will not get to this -*/ -if (skb_rx_queue_recorded (skb)) - qid =skb_get_rx_queue (skb); -else - qid =netdev_pick_tx (dev, skb,NULL ); - -return qid; -} -static void ena_config_host_info (struct ena_com_dev *ena_dev,struct pci_dev *pdev) {struct device *dev = &pdev->dev;
@@ -3359,7 +3343,6 @@ static const struct net_device_ops ena_netdev_ops = { .ndo_open = ena_open, .ndo_stop = ena_close, .ndo_start_xmit = ena_start_xmit, - .ndo_select_queue = ena_select_queue, .ndo_get_stats64 = ena_get_stats64, .ndo_tx_timeout = ena_tx_timeout, .ndo_change_mtu = ena_change_mtu,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 162/451 arm64: dts: mt8195-cherry-tomato: change watchdog reset boot flow
In reply to Sasha LevinFrom: Hsin-Te Yuan <[email protected]>
[ Upstream commit ef569d5db50e7edd709e482157769a5b3c367e22 ]
The external output reset signal was originally disabled and sent from firmware. However, an unfixed bug in the firmware on tomato prevents the signal from being sent, causing the device to fail to boot. To fix this, enable external output reset signal to allow the device to reboot normally.
--- arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts | 4 ++++ arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts | 4 ++++ arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts | 4 ++++ 3 files changed, 12 insertions(+)
arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts +4 -0
@@ -13,3 +13,7 @@ / { &ts_10 { status = "okay"; }; + +&watchdog { + /delete-property/ mediatek,disable-extrst; +};
arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts +4 -0
@@ -33,3 +33,7 @@ pins-low-power-pcie0-disable { &ts_10 { status = "okay"; }; + +&watchdog { + /delete-property/ mediatek,disable-extrst; +};
arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts +4 -0
@@ -34,3 +34,7 @@ pins-low-power-pcie0-disable { &ts_10 { status = "okay"; }; + +&watchdog { + /delete-property/ mediatek,disable-extrst; +};
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 163/451 firmware: arm_scmi: Fix double free in SMC transport cleanup path
In reply to Sasha LevinFrom: Andre Przywara <[email protected]>
[ Upstream commit f1d71576d2c9ec8fdb822173fa7f3de79475e9bd ]
When the generic SCMI code tears down a channel, it calls the chan_free callback function, defined by each transport. Since multiple protocols might share the same transport_info member, chan_free() might want to clean up the same member multiple times within the given SCMI transport implementation. In this case, it is SMC transport. This will lead to a NULL pointer dereference at the second time:
| scmi_protocol scmi_dev.1: Enabled polling mode TX channel - prot_id:16
| arm-scmi firmware:scmi: SCMI Notifications - Core Enabled.
| arm-scmi firmware:scmi: unable to communicate with SCMI
| Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
| Mem abort info:
| ESR = 0x0000000096000004
| EC = 0x25: DABT (current EL), IL = 32 bits
| SET = 0, FnV = 0
| EA = 0, S1PTW = 0
| FSC = 0x04: level 0 translation fault
| Data abort info:
| ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
| CM = 0, WnR = 0, TnD = 0, TagAccess = 0
| GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
| user pgtable: 4k pages, 48-bit VAs, pgdp=0000000881ef8000
| [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
| Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
| Modules linked in:
| CPU: 4 PID: 1 Comm: swapper/0 Not tainted 6.7.0-rc2-00124-g455ef3d016c9-dirty #793
| Hardware name: FVP Base RevC (DT)
| pstate: 61400009 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
| pc : smc_chan_free+0x3c/0x6c
| lr : smc_chan_free+0x3c/0x6c
| Call trace:
| smc_chan_free+0x3c/0x6c
| idr_for_each+0x68/0xf8
| scmi_cleanup_channels.isra.0+0x2c/0x58
| scmi_probe+0x434/0x734
| platform_probe+0x68/0xd8
| really_probe+0x110/0x27c
| __driver_probe_device+0x78/0x12c
| driver_probe_device+0x3c/0x118
| __driver_attach+0x74/0x128
| bus_for_each_dev+0x78/0xe0
| driver_attach+0x24/0x30
| bus_add_driver+0xe4/0x1e8
| driver_register+0x60/0x128
| __platform_driver_register+0x28/0x34
| scmi_driver_init+0x84/0xc0
| do_one_initcall+0x78/0x33c
| kernel_init_freeable+0x2b8/0x51c
| kernel_init+0x24/0x130
| ret_from_fork+0x10/0x20
| Code: f0004701 910a0021 aa1403e5 97b91c70 (b9400280)
| ---[ end trace 0000000000000000 ]---Simply check for the struct pointer being NULL before trying to access its members, to avoid this situation.
This was found when a transport doesn't really work (for instance no SMC service), the probe routines then tries to clean up, and triggers a crash.
--- drivers/firmware/arm_scmi/smc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/firmware/arm_scmi/smc.c +7 -0
@@ -171,6 +171,13 @@ static int smc_chan_free(int id, void *p, void *data)struct scmi_chan_info *cinfo = p;struct scmi_smc *scmi_info = cinfo->transport_info; +/* +* Different protocols might share the same chan info, so a previous +* smc_chan_free call might have already freed the structure. +*/ +if (!scmi_info) +return 0 ; +/* Ignore any possible further reception on the IRQ path */ if (scmi_info->irq >0 )free_irq (scmi_info->irq, scmi_info);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 164/451 wifi: wilc1000: revert reset line logic flip
In reply to Sasha LevinFrom: Alexis Lothoré <[email protected]>
[ Upstream commit f3ec643947634bed41b97bd56b248f7c78498eab ]
This reverts commit fcf690b0b47494df51d214db5c5a714a400b0257.
When using a wilc1000 chip over a spi bus, users can optionally define a reset gpio and a chip enable gpio. The reset line of wilc1000 is active low, so to hold the chip in reset, a low (physical) value must be applied.
The corresponding device tree binding documentation was introduced by commit f31ee3c0a555 ("wilc1000: Document enable-gpios and reset-gpios properties") and correctly indicates that the reset line is an active-low signal. The corresponding driver part, brought by commit ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver") was applying the correct logic. But commit fcf690b0b474 ("wifi: wilc1000: use correct sequence of RESET for chip Power-UP/Down") eventually flipped this logic and started misusing the gpiod APIs, applying an inverted logic when powering up/down the chip (for example, setting the reset line to a logic "1" during power up, which in fact asserts the reset line when device tree describes the reset line as GPIO_ACTIVE_LOW). As a consequence, any platform currently using the driver in SPI mode must use a faulty reset line description in device tree, or else chip will be maintained in reset and will not even allow to bring up the chip.
Fix reset line usage by inverting back the gpiod APIs usage, setting the reset line to the logic value "0" when powering the chip, and the logic value "1" when powering off the chip.
--- drivers/net/wireless/microchip/wilc1000/spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/microchip/wilc1000/spi.c +3 -3
@@ -191,11 +191,11 @@ static void wilc_wlan_power(struct wilc *wilc, bool on)/* assert ENABLE: */ gpiod_set_value (gpios->enable,1 );mdelay (5 ); -/* assert RESET: */ -gpiod_set_value (gpios->reset,1 ); - }else {/* deassert RESET: */ gpiod_set_value (gpios->reset,0 ); + }else { +/* assert RESET: */ +gpiod_set_value (gpios->reset,1 );/* deassert ENABLE: */ gpiod_set_value (gpios->enable,0 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 165/451 ARM: dts: arm: realview: Fix development chip ROM compatible value
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3baa4c5143d65ebab2de0d99a395e5f4f1f46608 ]
When the development chip ROM was added, the "direct-mapped" compatible value was already obsolete. In addition, the device node lacked the accompanying "probe-type" property, causing the old physmap_of_core driver to fall back to trying all available probe types. Unfortunately this fallback was lost when the DT and pdata cases were merged.
Fix this by using the modern "mtd-rom" compatible value instead.
--- arch/arm/boot/dts/arm-realview-pb1176.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/arm-realview-pb1176.dts +1 -1
@@ -451,7 +451,7 @@ pb1176_serial3: serial@1010f000 { /* Direct-mapped development chip ROM */ pb1176_rom@10200000 { - compatible = "direct-mapped"; + compatible = "mtd-rom"; reg = <0x10200000 0x4000>; bank-width = <1>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 166/451 arm64: dts: renesas: r9a07g043: Split out RZ/G2UL SoC specific parts
In reply to Sasha LevinFrom: Lad Prabhakar <[email protected]>
[ Upstream commit b9a0be2054964026aa58966ce9724b672f210835 ]
Move RZ/G2UL SoC specific parts to r9a07g043u.dtsi so that r9a07g043.dtsi can be shared with RZ/Five (RISC-V SoC).
Below are the changes due to which SoC specific parts are moved to r9a07g043u.dtsi:
- RZ/G2UL has Cortex-A55 (ARM64) whereas RZ/Five has AX45MP (RISC-V),
- RZ/G2UL has GICv3 as interrupt controller whereas RZ/Five has PLIC,
- RZ/G2UL has interrupts for SYSC block whereas interrupts are missing for SYSC block on RZ/Five,
- RZ/G2UL has armv8-timer whereas RZ/Five has riscv-timer,
- RZ/G2UL has PSCI whereas RZ/Five have OpenSBI.
Stable-dep-of: 14fe225dd5fc ("arm64: dts: renesas: rzg2l: Add missing interrupts to IRQC nodes")
--- arch/arm64/boot/dts/renesas/r9a07g043.dtsi | 54 +------------------ arch/arm64/boot/dts/renesas/r9a07g043u.dtsi | 60 +++++++++++++++++++++ 2 files changed, 61 insertions(+), 53 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g043.dtsi +1 -53
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* - * Device Tree Source for the RZ/G2UL SoC + * Device Tree Source for the RZ/Five and RZ/G2UL SoCs * * Copyright (C) 2022 Renesas Electronics Corp. */
@@ -68,36 +68,8 @@ opp-1000000000 { }; }; - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu0: cpu@0 { - compatible = "arm,cortex-a55"; - reg = <0>; - device_type = "cpu"; - #cooling-cells = <2>; - next-level-cache = <&L3_CA55>; - enable-method = "psci"; - clocks = <&cpg CPG_CORE R9A07G043_CLK_I>; - operating-points-v2 = <&cluster0_opp>; - }; - - L3_CA55: cache-controller-0 { - compatible = "cache"; - cache-unified; - cache-size = <0x40000>; - }; - }; - - psci { - compatible = "arm,psci-1.0", "arm,psci-0.2"; - method = "smc"; - }; - soc: soc { compatible = "simple-bus"; - interrupt-parent = <&gic>; #address-cells = <2>; #size-cells = <2>; ranges;
@@ -545,12 +517,6 @@ cpg: clock-controller@11010000 { sysc: system-controller@11020000 { compatible = "renesas,r9a07g043-sysc"; reg = <0 0x11020000 0 0x10000>; - interrupts = <SOC_PERIPHERAL_IRQ(42) IRQ_TYPE_LEVEL_HIGH>, - <SOC_PERIPHERAL_IRQ(43) IRQ_TYPE_LEVEL_HIGH>, - <SOC_PERIPHERAL_IRQ(44) IRQ_TYPE_LEVEL_HIGH>, - <SOC_PERIPHERAL_IRQ(45) IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "lpm_int", "ca55stbydone_int", - "cm33stbyr_int", "ca55_deny"; status = "disabled"; };
@@ -603,16 +569,6 @@ dmac: dma-controller@11820000 { dma-channels = <16>; }; - gic: interrupt-controller@11900000 { - compatible = "arm,gic-v3"; - #interrupt-cells = <3>; - #address-cells = <0>; - interrupt-controller; - reg = <0x0 0x11900000 0 0x40000>, - <0x0 0x11940000 0 0x60000>; - interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>; - }; - sdhi0: mmc@11c00000 { compatible = "renesas,sdhi-r9a07g043", "renesas,rcar-gen3-sdhi";
@@ -893,12 +849,4 @@ target: trip-point { }; }; }; - - timer { - compatible = "arm,armv8-timer"; - interrupts-extended = <&gic GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>, - <&gic GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>, - <&gic GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>, - <&gic GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>; - }; };
arch/arm64/boot/dts/renesas/r9a07g043u.dtsi +60 -0
63 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 167/451 arm64: dts: renesas: r9a07g043u: Add IRQC node
In reply to Sasha LevinFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 48ab6eddd8bbcf7e9c8ae27bf42d0b52a777aaba ]
Add IRQC node to R9A07G043 (RZ/G2UL) SoC DTSI.
Stable-dep-of: 14fe225dd5fc ("arm64: dts: renesas: rzg2l: Add missing interrupts to IRQC nodes")
--- arch/arm64/boot/dts/renesas/r9a07g043u.dtsi | 68 +++++++++++++++++++++ 1 file changed, 68 insertions(+)
arch/arm64/boot/dts/renesas/r9a07g043u.dtsi +68 -0
@@ -51,6 +51,74 @@ timer { &soc { interrupt-parent = <&gic>; + irqc: interrupt-controller@110a0000 { + compatible = "renesas,r9a07g043u-irqc", + "renesas,rzg2l-irqc"; + reg = <0 0x110a0000 0 0x10000>; + #interrupt-cells = <2>; + #address-cells = <0>; + interrupt-controller; + interrupts = <SOC_PERIPHERAL_IRQ(0) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(1) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(2) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(3) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(4) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(5) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(6) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(7) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(8) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(444) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(445) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(446) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(447) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(448) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(449) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(450) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(451) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(452) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(453) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(454) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(455) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(456) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(457) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(458) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(459) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(460) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(461) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(462) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(463) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(464) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(465) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(466) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(467) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(468) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(469) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(470) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(471) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(472) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(473) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(474) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(475) IRQ_TYPE_LEVEL_HIGH>, + <SOC_PERIPHERAL_IRQ(25) IRQ_TYPE_EDGE_RISING>; + interrupt-names = "nmi", + "irq0", "irq1", "irq2", "irq3", + "irq4", "irq5", "irq6", "irq7", + "tint0", "tint1", "tint2", "tint3", + "tint4", "tint5", "tint6", "tint7", + "tint8", "tint9", "tint10", "tint11", + "tint12", "tint13", "tint14", "tint15", + "tint16", "tint17", "tint18", "tint19", + "tint20", "tint21", "tint22", "tint23", + "tint24", "tint25", "tint26", "tint27", + "tint28", "tint29", "tint30", "tint31", + "bus-err"; + clocks = <&cpg CPG_MOD R9A07G043_IA55_CLK>, + <&cpg CPG_MOD R9A07G043_IA55_PCLK>; + clock-names = "clk", "pclk"; + power-domains = <&cpg>; + resets = <&cpg R9A07G043_IA55_RESETN>; + }; + gic: interrupt-controller@11900000 { compatible = "arm,gic-v3"; #interrupt-cells = <3>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 168/451 arm64: dts: renesas: rzg2l: Add missing interrupts to IRQC nodes
In reply to Sasha LevinFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 14fe225dd5fcd5928583b0bcc34398a581f51602 ]
The IRQC IP block supports Bus error and ECCRAM interrupts on RZ/G2L and alike SoC's (listed below). Update the IRQC nodes with the missing interrupts, and additionally, include the 'interrupt-names' properties in the IRQC nodes so that the driver can parse interrupts by name.
- R9A07G043U - RZ/G2UL
- R9A07G044L/R9A07G044LC - RZ/{G2L,G2LC}
- R9A07G054 - RZ/V2L--- arch/arm64/boot/dts/renesas/r9a07g043u.dtsi | 12 +++++++++-- arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 22 ++++++++++++++++++++- arch/arm64/boot/dts/renesas/r9a07g054.dtsi | 22 ++++++++++++++++++++- 3 files changed, 52 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g043u.dtsi +10 -2
@@ -99,7 +99,13 @@ irqc: interrupt-controller@110a0000 { <SOC_PERIPHERAL_IRQ(473) IRQ_TYPE_LEVEL_HIGH>, <SOC_PERIPHERAL_IRQ(474) IRQ_TYPE_LEVEL_HIGH>, <SOC_PERIPHERAL_IRQ(475) IRQ_TYPE_LEVEL_HIGH>, - <SOC_PERIPHERAL_IRQ(25) IRQ_TYPE_EDGE_RISING>; + <SOC_PERIPHERAL_IRQ(25) IRQ_TYPE_EDGE_RISING>, + <SOC_PERIPHERAL_IRQ(34) IRQ_TYPE_EDGE_RISING>, + <SOC_PERIPHERAL_IRQ(35) IRQ_TYPE_EDGE_RISING>, + <SOC_PERIPHERAL_IRQ(36) IRQ_TYPE_EDGE_RISING>, + <SOC_PERIPHERAL_IRQ(37) IRQ_TYPE_EDGE_RISING>, + <SOC_PERIPHERAL_IRQ(38) IRQ_TYPE_EDGE_RISING>, + <SOC_PERIPHERAL_IRQ(39) IRQ_TYPE_EDGE_RISING>; interrupt-names = "nmi", "irq0", "irq1", "irq2", "irq3", "irq4", "irq5", "irq6", "irq7",
@@ -111,7 +117,9 @@ irqc: interrupt-controller@110a0000 { "tint20", "tint21", "tint22", "tint23", "tint24", "tint25", "tint26", "tint27", "tint28", "tint29", "tint30", "tint31", - "bus-err"; + "bus-err", "ec7tie1-0", "ec7tie2-0", + "ec7tiovf-0", "ec7tie1-1", "ec7tie2-1", + "ec7tiovf-1"; clocks = <&cpg CPG_MOD R9A07G043_IA55_CLK>, <&cpg CPG_MOD R9A07G043_IA55_PCLK>; clock-names = "clk", "pclk";
arch/arm64/boot/dts/renesas/r9a07g044.dtsi +21 -1
@@ -698,7 +698,27 @@ irqc: interrupt-controller@110a0000 { <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 25 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 34 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 37 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 38 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 39 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "nmi", "irq0", "irq1", "irq2", "irq3", + "irq4", "irq5", "irq6", "irq7", + "tint0", "tint1", "tint2", "tint3", + "tint4", "tint5", "tint6", "tint7", + "tint8", "tint9", "tint10", "tint11", + "tint12", "tint13", "tint14", "tint15", + "tint16", "tint17", "tint18", "tint19", + "tint20", "tint21", "tint22", "tint23", + "tint24", "tint25", "tint26", "tint27", + "tint28", "tint29", "tint30", "tint31", + "bus-err", "ec7tie1-0", "ec7tie2-0", + "ec7tiovf-0", "ec7tie1-1", "ec7tie2-1", + "ec7tiovf-1"; clocks = <&cpg CPG_MOD R9A07G044_IA55_CLK>, <&cpg CPG_MOD R9A07G044_IA55_PCLK>; clock-names = "clk", "pclk";
arch/arm64/boot/dts/renesas/r9a07g054.dtsi +21 -1
@@ -704,7 +704,27 @@ irqc: interrupt-controller@110a0000 { <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 25 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 34 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 37 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 38 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 39 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "nmi", "irq0", "irq1", "irq2", "irq3", + "irq4", "irq5", "irq6", "irq7", + "tint0", "tint1", "tint2", "tint3", + "tint4", "tint5", "tint6", "tint7", + "tint8", "tint9", "tint10", "tint11", + "tint12", "tint13", "tint14", "tint15", + "tint16", "tint17", "tint18", "tint19", + "tint20", "tint21", "tint22", "tint23", + "tint24", "tint25", "tint26", "tint27", + "tint28", "tint29", "tint30", "tint31", + "bus-err", "ec7tie1-0", "ec7tie2-0", + "ec7tiovf-0", "ec7tie1-1", "ec7tie2-1", + "ec7tiovf-1"; clocks = <&cpg CPG_MOD R9A07G054_IA55_CLK>, <&cpg CPG_MOD R9A07G054_IA55_PCLK>; clock-names = "clk", "pclk";
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 169/451 arm64: dts: renesas: r8a779a0: Update to R-Car Gen4 compatible values
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit a1ca409cc050166a9e8ed183c1d4192f511cf6a2 ]
Despite the name, R-Car V3U is the first member of the R-Car Gen4 family. Hence update the compatible properties in various device nodes to include family-specific compatible values for R-Car Gen4 instead of R-Car Gen3:
- EtherAVB,
- MSIOF.
Stable-dep-of: 0c51912331f8 ("arm64: dts: renesas: r8a779a0: Correct avb[01] reg sizes")
--- arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/renesas/r8a779a0.dtsi +12 -12
@@ -656,7 +656,7 @@ channel7 { avb0: ethernet@e6800000 { compatible = "renesas,etheravb-r8a779a0", - "renesas,etheravb-rcar-gen3"; + "renesas,etheravb-rcar-gen4"; reg = <0 0xe6800000 0 0x800>; interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>,
@@ -704,7 +704,7 @@ avb0: ethernet@e6800000 { avb1: ethernet@e6810000 { compatible = "renesas,etheravb-r8a779a0", - "renesas,etheravb-rcar-gen3"; + "renesas,etheravb-rcar-gen4"; reg = <0 0xe6810000 0 0x800>; interrupts = <GIC_SPI 281 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>,
@@ -752,7 +752,7 @@ avb1: ethernet@e6810000 { avb2: ethernet@e6820000 { compatible = "renesas,etheravb-r8a779a0", - "renesas,etheravb-rcar-gen3"; + "renesas,etheravb-rcar-gen4"; reg = <0 0xe6820000 0 0x1000>; interrupts = <GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 307 IRQ_TYPE_LEVEL_HIGH>,
@@ -800,7 +800,7 @@ avb2: ethernet@e6820000 { avb3: ethernet@e6830000 { compatible = "renesas,etheravb-r8a779a0", - "renesas,etheravb-rcar-gen3"; + "renesas,etheravb-rcar-gen4"; reg = <0 0xe6830000 0 0x1000>; interrupts = <GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 332 IRQ_TYPE_LEVEL_HIGH>,
@@ -848,7 +848,7 @@ avb3: ethernet@e6830000 { avb4: ethernet@e6840000 { compatible = "renesas,etheravb-r8a779a0", - "renesas,etheravb-rcar-gen3"; + "renesas,etheravb-rcar-gen4"; reg = <0 0xe6840000 0 0x1000>; interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>,
@@ -896,7 +896,7 @@ avb4: ethernet@e6840000 { avb5: ethernet@e6850000 { compatible = "renesas,etheravb-r8a779a0", - "renesas,etheravb-rcar-gen3"; + "renesas,etheravb-rcar-gen4"; reg = <0 0xe6850000 0 0x1000>; interrupts = <GIC_SPI 381 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 382 IRQ_TYPE_LEVEL_HIGH>,
@@ -1019,7 +1019,7 @@ tpu: pwm@e6e80000 { msiof0: spi@e6e90000 { compatible = "renesas,msiof-r8a779a0", - "renesas,rcar-gen3-msiof"; + "renesas,rcar-gen4-msiof"; reg = <0 0xe6e90000 0 0x0064>; interrupts = <GIC_SPI 245 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 618>;
@@ -1034,7 +1034,7 @@ msiof0: spi@e6e90000 { msiof1: spi@e6ea0000 { compatible = "renesas,msiof-r8a779a0", - "renesas,rcar-gen3-msiof"; + "renesas,rcar-gen4-msiof"; reg = <0 0xe6ea0000 0 0x0064>; interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 619>;
@@ -1049,7 +1049,7 @@ msiof1: spi@e6ea0000 { msiof2: spi@e6c00000 { compatible = "renesas,msiof-r8a779a0", - "renesas,rcar-gen3-msiof"; + "renesas,rcar-gen4-msiof"; reg = <0 0xe6c00000 0 0x0064>; interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 620>;
@@ -1064,7 +1064,7 @@ msiof2: spi@e6c00000 { msiof3: spi@e6c10000 { compatible = "renesas,msiof-r8a779a0", - "renesas,rcar-gen3-msiof"; + "renesas,rcar-gen4-msiof"; reg = <0 0xe6c10000 0 0x0064>; interrupts = <GIC_SPI 248 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 621>;
@@ -1079,7 +1079,7 @@ msiof3: spi@e6c10000 { msiof4: spi@e6c20000 { compatible = "renesas,msiof-r8a779a0", - "renesas,rcar-gen3-msiof"; + "renesas,rcar-gen4-msiof"; reg = <0 0xe6c20000 0 0x0064>; interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 622>;
@@ -1094,7 +1094,7 @@ msiof4: spi@e6c20000 { msiof5: spi@e6c28000 { compatible = "renesas,msiof-r8a779a0", - "renesas,rcar-gen3-msiof"; + "renesas,rcar-gen4-msiof"; reg = <0 0xe6c28000 0 0x0064>; interrupts = <GIC_SPI 250 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 623>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 170/451 arm64: dts: renesas: r8a779a0: Correct avb[01] reg sizes
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 0c51912331f8ba5ce5fb52f46e340945160672a3 ]
All Ethernet AVB instances on R-Car V3U have registers related to UDP/IP support, but the declared register blocks for the first two instances are too small to cover them.
Fix this by extending the register block sizes.
--- arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/renesas/r8a779a0.dtsi +2 -2
@@ -657,7 +657,7 @@ channel7 { avb0: ethernet@e6800000 { compatible = "renesas,etheravb-r8a779a0", "renesas,etheravb-rcar-gen4"; - reg = <0 0xe6800000 0 0x800>; + reg = <0 0xe6800000 0 0x1000>; interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>,
@@ -705,7 +705,7 @@ avb0: ethernet@e6800000 { avb1: ethernet@e6810000 { compatible = "renesas,etheravb-r8a779a0", "renesas,etheravb-rcar-gen4"; - reg = <0 0xe6810000 0 0x800>; + reg = <0 0xe6810000 0 0x1000>; interrupts = <GIC_SPI 281 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 283 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 171/451 arm64: dts: renesas: r8a779g0: Correct avb[01] reg sizes
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 7edbb5880dc3317a5eaec2166de71ff394598e6b ]
All Ethernet AVB instances on R-Car V4H have registers related to UDP/IP support, but the declared register blocks for the first two instances are too small to cover them.
Fix this by extending the register block sizes.
--- arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/renesas/r8a779g0.dtsi +2 -2
@@ -337,7 +337,7 @@ hscif0: serial@e6540000 { avb0: ethernet@e6800000 { compatible = "renesas,etheravb-r8a779g0", "renesas,etheravb-rcar-gen4"; - reg = <0 0xe6800000 0 0x800>; + reg = <0 0xe6800000 0 0x1000>; interrupts = <GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH>,
@@ -384,7 +384,7 @@ avb0: ethernet@e6800000 { avb1: ethernet@e6810000 { compatible = "renesas,etheravb-r8a779g0", "renesas,etheravb-rcar-gen4"; - reg = <0 0xe6810000 0 0x800>; + reg = <0 0xe6810000 0 0x1000>; interrupts = <GIC_SPI 360 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 361 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 362 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 172/451 net: mctp: copy skb ext data when fragmenting
In reply to Sasha LevinFrom: Jeremy Kerr <[email protected]>
[ Upstream commit 1394c1dec1c619a46867ed32791a29695372bff8 ]
If we're fragmenting on local output, the original packet may contain ext data for the MCTP flows. We'll want this in the resulting fragment skbs too.
So, do a skb_ext_copy() in the fragmentation path, and implement the MCTP-specific parts of an ext copy operation.
--- net/core/skbuff.c | 8 ++++++++ net/mctp/route.c | 3 +++ 2 files changed, 11 insertions(+)
net/core/skbuff.c +8 -0
@@ -6500,6 +6500,14 @@ static struct skb_ext *skb_ext_maybe_cow(struct skb_ext *old,for (i =0 ; i < sp->len; i++) xfrm_state_hold(sp->xvec[i]); } +#endif +#ifdef CONFIG_MCTP_FLOWS +if (old_active & (1 <<SKB_EXT_MCTP )) { +struct mctp_flow *flow =skb_ext_get_ptr (old,SKB_EXT_MCTP ); + +if (flow->key) +refcount_inc (&flow->key->refs); + }#endif __skb_ext_put (old);return new;
net/mctp/route.c +3 -0
@@ -843,6 +843,9 @@ static int mctp_do_fragment_route(struct mctp_route *rt, struct sk_buff *skb,/* copy message payload */ skb_copy_bits (skb, pos,skb_transport_header (skb2), size); +/* we need to copy the extensions, for MCTP flow data */ +skb_ext_copy (skb2, skb); +/* do route */ rc = rt->output (rt, skb2);if (rc)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 173/451 pstore: inode: Convert mutex usage to guard(mutex)
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit e2eeddefb046dbc771a6fa426f7f98fb25adfe68 ]
Replace open-coded mutex handling with cleanup.h guard(mutex) and scoped_guard(mutex, ...).
Stable-dep-of: a43e0fc5e913 ("pstore: inode: Only d_invalidate() is needed")
--- fs/pstore/inode.c | 76 +++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 45 deletions(-)
fs/pstore/inode.c +31 -45
@@ -182,25 +182,21 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry) {struct pstore_private *p =d_inode (dentry)->i_private;struct pstore_record *record = p->record; -int rc =0 ;if (!record->psi->erase)return -EPERM ;/* Make sure we can't race while removing this file. */ -mutex_lock (&records_list_lock); -if (!list_empty (&p->list)) -list_del_init (&p->list); -else - rc = -ENOENT ; - p->dentry =NULL ; -mutex_unlock (&records_list_lock); -if (rc) -return rc; - -mutex_lock (&record->psi->read_mutex); - record->psi->erase (record); -mutex_unlock (&record->psi->read_mutex); + scoped_guard(mutex, &records_list_lock) { +if (!list_empty (&p->list)) +list_del_init (&p->list); +else +return -ENOENT ; + p->dentry =NULL ; + } + +scoped_guard (mutex, &record->psi->read_mutex) + record->psi->erase(record);return simple_unlink (dir, dentry); }
@@ -292,19 +288,16 @@ static struct dentry *psinfo_lock_root(void) {struct dentry *root; -mutex_lock (&pstore_sb_lock); +guard (mutex)(&pstore_sb_lock);/* * Having no backend is fine -- no records appear. * Not being mounted is fine -- nothing to do. */ -if (!psinfo || !pstore_sb) { -mutex_unlock (&pstore_sb_lock); +if (!psinfo || !pstore_sb)return NULL ; - } root = pstore_sb->s_root;inode_lock (d_inode (root)); -mutex_unlock (&pstore_sb_lock);return root; }
@@ -319,19 +312,19 @@ int pstore_put_backend_records(struct pstore_info *psi)if (!root)return 0 ; -mutex_lock (&records_list_lock); -list_for_each_entry_safe (pos, tmp, &records_list, list) { -if (pos->record->psi == psi) { -list_del_init (&pos->list); - rc =simple_unlink (d_inode (root), pos->dentry); -if (WARN_ON (rc)) -break ; -d_drop (pos->dentry); -dput (pos->dentry); - pos->dentry =NULL ; + scoped_guard(mutex, &records_list_lock) { +list_for_each_entry_safe (pos, tmp, &records_list, list) { +if (pos->record->psi == psi) { +list_del_init (&pos->list); + rc =simple_unlink (d_inode (root), pos->dentry); +if (WARN_ON (rc)) +break ; +d_drop (pos->dentry); +dput (pos->dentry); + pos->dentry =NULL ; + } } } -mutex_unlock (&records_list_lock);inode_unlock (d_inode (root));
@@ -355,20 +348,20 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)if (WARN_ON (!inode_is_locked (d_inode (root))))return -EINVAL ; - rc = -EEXIST ; +guard (mutex)(&records_list_lock); +/* Skip records that are already present in the filesystem. */ -mutex_lock (&records_list_lock);list_for_each_entry (pos, &records_list, list) {if (pos->record->type == record->type && pos->record->id == record->id && pos->record->psi == record->psi) - goto fail; +return -EEXIST ; } rc = -ENOMEM ; inode =pstore_get_inode (root->d_sb);if (!inode) - goto fail; +return -ENOMEM ; inode->i_mode =S_IFREG |0444 ; inode->i_fop = &pstore_file_operations; scnprintf(name, sizeof(name), "%s-%s-%llu%s",
@@ -395,7 +388,6 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)d_add (dentry, inode);list_add (&private->list, &records_list); -mutex_unlock (&records_list_lock);return 0 ;
@@ -403,8 +395,6 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)free_pstore_private (private); fail_inode:iput (inode); -fail: -mutex_unlock (&records_list_lock);return rc; }
@@ -450,9 +440,8 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)if (!sb->s_root)return -ENOMEM ; -mutex_lock (&pstore_sb_lock); - pstore_sb = sb; -mutex_unlock (&pstore_sb_lock); +scoped_guard (mutex, &pstore_sb_lock) + pstore_sb = sb;pstore_get_records (0 );
@@ -467,17 +456,14 @@ static struct dentry *pstore_mount(struct file_system_type *fs_type,static void pstore_kill_sb (struct super_block *sb) { -mutex_lock (&pstore_sb_lock); +guard (mutex)(&pstore_sb_lock);WARN_ON (pstore_sb && pstore_sb != sb);kill_litter_super (sb); pstore_sb =NULL ; -mutex_lock (&records_list_lock); +guard (mutex)(&records_list_lock);INIT_LIST_HEAD (&records_list); -mutex_unlock (&records_list_lock); - -mutex_unlock (&pstore_sb_lock); }static struct file_system_type pstore_fs_type = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 174/451 pstore: inode: Only d_invalidate() is needed
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit a43e0fc5e9134a46515de2f2f8d4100b74e50de3 ]
Unloading a modular pstore backend with records in pstorefs would trigger the dput() double-drop warning:
WARNING: CPU: 0 PID: 2569 at fs/dcache.c:762 dput.part.0+0x3f3/0x410
Using the combo of d_drop()/dput() (as mentioned in Documentation/filesystems/vfs.rst) isn't the right approach here, and leads to the reference counting problem seen above. Use d_invalidate() and update the code to not bother checking for error codes that can never happen.
--- fs/pstore/inode.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
fs/pstore/inode.c +3 -7
@@ -306,7 +306,6 @@ int pstore_put_backend_records(struct pstore_info *psi) {struct pstore_private *pos, *tmp;struct dentry *root; -int rc =0 ; root =psinfo_lock_root ();if (!root)
@@ -316,11 +315,8 @@ int pstore_put_backend_records(struct pstore_info *psi)list_for_each_entry_safe (pos, tmp, &records_list, list) {if (pos->record->psi == psi) {list_del_init (&pos->list); - rc =simple_unlink (d_inode (root), pos->dentry); -if (WARN_ON (rc)) -break ; -d_drop (pos->dentry); -dput (pos->dentry); +d_invalidate (pos->dentry); +simple_unlink (d_inode (root), pos->dentry); pos->dentry =NULL ; } }
@@ -328,7 +324,7 @@ int pstore_put_backend_records(struct pstore_info *psi)inode_unlock (d_inode (root)); -return rc; +return 0 ; }/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 175/451 arm64: dts: allwinner: h6: Add RX DMA channel for SPDIF
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 7b59348c11f3355e284d77bbe3d33632ddadcfc2 ]
The SPDIF hardware found on the H6 supports both transmit and receive functions. However it is missing the RX DMA channel.
Add the SPDIF hardware block's RX DMA channel. Also remove the by-default pinmux, since the end device can choose to implement either or both functionalities.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts | 2 ++ arch/arm64/boot/dts/allwinner/sun50i-h6-tanix.dtsi | 2 ++ arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 7 +++---- 3 files changed, 7 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts +2 -0
@@ -291,6 +291,8 @@ sw { }; &spdif { + pinctrl-names = "default"; + pinctrl-0 = <&spdif_tx_pin>; status = "okay"; };
arch/arm64/boot/dts/allwinner/sun50i-h6-tanix.dtsi +2 -0
@@ -166,6 +166,8 @@ &r_ir { }; &spdif { + pinctrl-names = "default"; + pinctrl-0 = <&spdif_tx_pin>; status = "okay"; };
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +3 -4
@@ -406,6 +406,7 @@ spi1_cs_pin: spi1-cs-pin { function = "spi1"; }; + /omit-if-no-ref/ spdif_tx_pin: spdif-tx-pin { pins = "PH7"; function = "spdif";
@@ -655,10 +656,8 @@ spdif: spdif@5093000 { clocks = <&ccu CLK_BUS_SPDIF>, <&ccu CLK_SPDIF>; clock-names = "apb", "spdif"; resets = <&ccu RST_BUS_SPDIF>; - dmas = <&dma 2>; - dma-names = "tx"; - pinctrl-names = "default"; - pinctrl-0 = <&spdif_tx_pin>; + dmas = <&dma 2>, <&dma 2>; + dma-names = "rx", "tx"; status = "disabled"; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 176/451 ARM: dts: imx6dl-yapp4: Move phy reset into switch node
In reply to Sasha LevinFrom: Michal Vokáč <[email protected]>
[ Upstream commit 7da7b84fee58c85a6075022023d31edea40e81a1 ]
Drop the phy-reset-duration and phy-reset-gpios deprecated properties and move reset-gpios under the switch node.
Stable-dep-of: 023bd910d3ab ("ARM: dts: imx6dl-yapp4: Fix typo in the QCA switch register address")
--- arch/arm/boot/dts/imx6dl-yapp4-common.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +1 -2
@@ -106,8 +106,6 @@ &fec { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; - phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; - phy-reset-duration = <20>; phy-supply = <&sw2_reg>; status = "okay";
@@ -131,6 +129,7 @@ phy_port3: phy@2 { switch@10 { compatible = "qca,qca8334"; reg = <10>; + reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; switch_ports: ports { #address-cells = <1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 177/451 ARM: dts: imx6dl-yapp4: Fix typo in the QCA switch register address
In reply to Sasha LevinFrom: Michal Vokáč <[email protected]>
[ Upstream commit 023bd910d3ab735459f84b22bb99fb9e00bd9d76 ]
This change does not have any functional effect. The switch works just fine without this patch as it has full access to all the addresses on the bus. This is simply a clean-up to set the node name address and reg address to the same value.
--- arch/arm/boot/dts/imx6dl-yapp4-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +1 -1
@@ -128,7 +128,7 @@ phy_port3: phy@2 { switch@10 { compatible = "qca,qca8334"; - reg = <10>; + reg = <0x10>; reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; switch_ports: ports {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 178/451 ARM: dts: imx6dl-yapp4: Move the internal switch PHYs under the switch node
In reply to Sasha LevinFrom: Michal Vokáč <[email protected]>
[ Upstream commit 79978bff2e4b8e05ebdf5fc3ee6b794002393484 ]
We identified that the PHYs actually do not work since commit 7da7b84fee58 ("ARM: dts: imx6dl-yapp4: Move phy reset into switch node") as a coincidence of several circumstances.
The reset signal is kept asserted by a pull-down resistor on the board unless it is deasserted by GPIO from the SoC. This is to keep the switch dead until it is configured properly by the kernel and user space.
Prior to the referenced commit the switch was reset by the FEC driver and the reset GPIO was actively deasserted. The mdio-bus was scanned and the attached switch and its PHYs were found and configured.
With the referenced commit the switch is reset by the qca8k driver. Because of another bug in the qca8k driver, functionality of the reset pin depends on its pre-kernel configuration. See commit c44fc98f0a8f ("net: dsa: qca8k: fix illegal usage of GPIO")
The problem did not appear until we removed support for the switch and configuration of its reset pin from the bootloader.
To fix that, properly describe the internal mdio-bus configuration of the qca8334 switch. The PHYs are internal to the switch and sit on its internal mdio-bus.
--- arch/arm/boot/dts/imx6dl-yapp4-common.dtsi | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +15 -8
@@ -118,14 +118,6 @@ mdio { #address-cells = <1>; #size-cells = <0>; - phy_port2: phy@1 { - reg = <1>; - }; - - phy_port3: phy@2 { - reg = <2>; - }; - switch@10 { compatible = "qca,qca8334"; reg = <0x10>;
@@ -150,15 +142,30 @@ fixed-link { eth2: port@2 { reg = <2>; label = "eth2"; + phy-mode = "internal"; phy-handle = <&phy_port2>; }; eth1: port@3 { reg = <3>; label = "eth1"; + phy-mode = "internal"; phy-handle = <&phy_port3>; }; }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy_port2: ethernet-phy@1 { + reg = <1>; + }; + + phy_port3: ethernet-phy@2 { + reg = <2>; + }; + }; }; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 179/451 arm64: dts: marvell: reorder crypto interrupts on Armada SoCs
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit ec55a22149d64f9ac41845d923b884d4a666bf4d ]
Match order specified in binding documentation. It says "mem" should be the last interrupt.
This fixes:arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:0: 'ring0' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:1: 'ring1' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:2: 'ring2' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:3: 'ring3' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:4: 'eip' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:5: 'mem' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#
--- arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 10 +++++----- arch/arm64/boot/dts/marvell/armada-cp11x.dtsi | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +5 -5
@@ -426,14 +426,14 @@ xor11 { crypto: crypto@90000 { compatible = "inside-secure,safexcel-eip97ies"; reg = <0x90000 0x20000>; - interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, + interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "mem", "ring0", "ring1", - "ring2", "ring3", "eip"; + <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "ring0", "ring1", "ring2", + "ring3", "eip", "mem"; clocks = <&nb_periph_clk 15>; };
arch/arm64/boot/dts/marvell/armada-cp11x.dtsi +5 -5
@@ -506,14 +506,14 @@ CP11X_LABEL(sdhci0): mmc@780000 { CP11X_LABEL(crypto): crypto@800000 { compatible = "inside-secure,safexcel-eip197b"; reg = <0x800000 0x200000>; - interrupts = <87 IRQ_TYPE_LEVEL_HIGH>, - <88 IRQ_TYPE_LEVEL_HIGH>, + interrupts = <88 IRQ_TYPE_LEVEL_HIGH>, <89 IRQ_TYPE_LEVEL_HIGH>, <90 IRQ_TYPE_LEVEL_HIGH>, <91 IRQ_TYPE_LEVEL_HIGH>, - <92 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "mem", "ring0", "ring1", - "ring2", "ring3", "eip"; + <92 IRQ_TYPE_LEVEL_HIGH>, + <87 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "ring0", "ring1", "ring2", "ring3", + "eip", "mem"; clock-names = "core", "reg"; clocks = <&CP11X_LABEL(clk) 1 26>, <&CP11X_LABEL(clk) 1 17>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 180/451 ACPI: resource: Add Infinity laptops to irq1_edge_low_force_override
In reply to Sasha LevinFrom: David McFarland <[email protected]>
[ Upstream commit e2605d4039a42a03000856b3229932455717b48b ]
A user reported a keyboard problem similar to ones reported with other Zen laptops, on an Infinity E15-5A165-BM.
Add board name matches for this model and one (untested) close relative to irq1_edge_low_force_override.
Stable-dep-of: 021a67d09615 ("ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override")
--- drivers/acpi/resource.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/resource.c +12 -0
@@ -543,6 +543,18 @@ static const struct dmi_system_id lg_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "17U70P"), }, }, + { +/* Infinity E15-5A165-BM */ + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GM5RG1E0009COM"), + }, + }, + { +/* Infinity E15-5A305-1M */ + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GM5RGEE0016COM"), + }, + }, { } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 181/451 ACPI: resource: Do IRQ override on Lunnen Ground laptops
In reply to Sasha LevinFrom: "Alexey I. Froloff" <[email protected]>
[ Upstream commit e23ad54fef186aa66007895be1382c88f1ee2bf7 ]
The Lunnen Ground 15 and 16 needs IRQ overriding for the keyboard to work.
Adding an entries for these laptops to the override_table makes the internal keyboard functional.
Stable-dep-of: 021a67d09615 ("ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override")
--- drivers/acpi/resource.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/acpi/resource.c +14 -0
@@ -555,6 +555,20 @@ static const struct dmi_system_id lg_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "GM5RGEE0016COM"), }, }, + { + /* Lunnen Ground 15 / AMD Ryzen 5 5500U */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Lunnen"), + DMI_MATCH(DMI_BOARD_NAME, "LLL5DAW"), + }, + }, + { +/* Lunnen Ground 16 / AMD Ryzen 7 5800U */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Lunnen"), + DMI_MATCH(DMI_BOARD_NAME, "LL6FA"), + }, + }, { } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 182/451 ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override
In reply to Sasha LevinFrom: Maxim Kudinov <[email protected]>
[ Upstream commit 021a67d096154893cd1d883c7be0097e2ee327fd ]
A known issue on some Zen laptops, keyboard stopped working due to commit 9946e39fe8d0 [email protected]("ACPI: resource: skip IRQ override on AMD Zen platforms") on kernel 5.19.10.
The ACPI IRQ override is required for this board due to buggy DSDT, thus adding the board vendor and name to irq1_edge_low_force_override fixes the issue.
--- drivers/acpi/resource.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/resource.c +7 -0
@@ -569,6 +569,13 @@ static const struct dmi_system_id lg_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "LL6FA"), }, }, + { + /* MAIBENBEN X577 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MAIBENBEN"), + DMI_MATCH(DMI_BOARD_NAME, "X577"), + }, + }, { } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 183/451 ACPI: scan: Fix device check notification handling
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 793551c965116d9dfaf0550dacae1396a20efa69 ]
It is generally invalid to fail a Device Check notification if the scan handler has not been attached to the given device after a bus rescan, because there may be valid reasons for the scan handler to refuse attaching to the device (for example, the device is not ready).
For this reason, modify acpi_scan_device_check() to return 0 in that case without printing a warning.
While at it, reduce the log level of the "already enumerated" message in the same function, because it is only interesting when debugging notification handling
--- drivers/acpi/scan.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/acpi/scan.c +2 -6
@@ -315,18 +315,14 @@ static int acpi_scan_device_check(struct acpi_device *adev)* again). */ if (adev->handler) { -dev_warn (&adev->dev,"Already enumerated\n" ); -return -EALREADY ; +dev_dbg (&adev->dev,"Already enumerated\n" ); +return 0 ; } error =acpi_bus_scan (adev->handle);if (error) {dev_warn (&adev->dev,"Namespace scan failure\n" );return error; } -if (!adev->handler) { -dev_warn (&adev->dev,"Enumeration failure\n" ); - error = -ENODEV ; - } }else { error =acpi_scan_device_not_present (adev); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 184/451 arm64: dts: rockchip: add missing interrupt-names for rk356x vdpu
In reply to Sasha LevinFrom: Heiko Stuebner <[email protected]>
[ Upstream commit d1c44d9afa6f89aa0e10a191f30868eb12cd719f ]
The video-codec@fdea0400 was missing the interrupt-names property that is part of the binding. Add it.
--- arch/arm64/boot/dts/rockchip/rk356x.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +1 -0
@@ -596,6 +596,7 @@ vpu: video-codec@fdea0400 { compatible = "rockchip,rk3568-vpu"; reg = <0x0 0xfdea0000 0x0 0x800>; interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vdpu"; clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; clock-names = "aclk", "hclk"; iommus = <&vdpu_mmu>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 185/451 x86, relocs: Ignore relocations in .notes section
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit aaa8736370db1a78f0e8434344a484f9fd20be3b ]
When building with CONFIG_XEN_PV=y, .text symbols are emitted into the .notes section so that Xen can find the "startup_xen" entry point. This information is used prior to booting the kernel, so relocations are not useful. In fact, performing relocations against the .notes section means that the KASLR base is exposed since /sys/kernel/notes is world-readable.
To avoid leaking the KASLR base without breaking unprivileged tools that are expecting to read /sys/kernel/notes, skip performing relocations in the .notes section. The values readable in .notes are then identical to those found in System.map.
--- arch/x86/tools/relocs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/tools/relocs.c +8 -0
@@ -653,6 +653,14 @@ static void print_absolute_relocs(void)if (!(sec_applies->shdr.sh_flags &SHF_ALLOC )) {continue ; } +/* +* Do not perform relocations in .notes section; any +* values there are meant for pre-boot consumption (e.g. +* startup_xen). +*/ +if (sec_applies->shdr.sh_type ==SHT_NOTE ) { +continue ; + } sh_symtab = sec_symtab->symtab; sym_strtab = sec_symtab->link->strtab;for (j =0 ; j < sec->shdr.sh_size/sizeof (Elf_Rel); j++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 186/451 SUNRPC: fix some memleaks in gssx_dec_option_array
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 3cfcfc102a5e57b021b786a755a38935e357797d ]
The creds and oa->data need to be freed in the error-handling paths after their allocation. So this patch add these deallocations in the corresponding paths.
--- net/sunrpc/auth_gss/gss_rpc_xdr.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
net/sunrpc/auth_gss/gss_rpc_xdr.c +19 -8
@@ -250,8 +250,8 @@ static int gssx_dec_option_array(struct xdr_stream *xdr, creds =kzalloc (sizeof (struct svc_cred ),GFP_KERNEL );if (!creds) { -kfree (oa->data); -return -ENOMEM ; + err = -ENOMEM ; + goto free_oa; } oa->data[0 ].option.data =CREDS_VALUE ;
@@ -265,29 +265,40 @@ static int gssx_dec_option_array(struct xdr_stream *xdr,/* option buffer */ p =xdr_inline_decode (xdr,4 ); -if (unlikely (p ==NULL )) -return -ENOSPC ; +if (unlikely (p ==NULL )) { + err = -ENOSPC ; + goto free_creds; + } length =be32_to_cpup (p); p =xdr_inline_decode (xdr, length); -if (unlikely (p ==NULL )) -return -ENOSPC ; +if (unlikely (p ==NULL )) { + err = -ENOSPC ; + goto free_creds; + }if (length ==sizeof (CREDS_VALUE ) &&memcmp (p,CREDS_VALUE ,sizeof (CREDS_VALUE )) ==0 ) {/* We have creds here. parse them */ err =gssx_dec_linux_creds (xdr, creds);if (err) -return err; + goto free_creds; oa->data[0 ].value.len =1 ;/* presence */ }else {/* consume uninteresting buffer */ err =gssx_dec_buffer (xdr, &dummy);if (err) -return err; + goto free_creds; } }return 0 ; + +free_creds: +kfree (creds); +free_oa: +kfree (oa->data); + oa->data =NULL ; +return err; } static int gssx_dec_status(struct xdr_stream *xdr,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 187/451 mmc: wmt-sdmmc: remove an incorrect release_mem_region() call in the .remove function
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ae5004a40a262d329039b99b62bd3fe7645b66ad ]
This looks strange to call release_mem_region() in a remove function without any request_mem_region() in the probe or "struct resource" somewhere.
So remove the corresponding code.
--- drivers/mmc/host/wmt-sdmmc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/mmc/host/wmt-sdmmc.c +0 -4
@@ -886,7 +886,6 @@ static int wmt_mci_remove(struct platform_device *pdev) {struct mmc_host *mmc;struct wmt_mci_priv *priv; -struct resource *res;u32 reg_tmp; mmc =platform_get_drvdata (pdev);
@@ -914,9 +913,6 @@ static int wmt_mci_remove(struct platform_device *pdev)clk_disable_unprepare (priv->clk_sdmmc);clk_put (priv->clk_sdmmc); - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -release_mem_region (res->start,resource_size (res)); -mmc_free_host (mmc);dev_info (&pdev->dev,"WMT MCI device removed\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 188/451 ACPI: CPPC: enable AMD CPPC V2 support for family 17h processors
In reply to Sasha LevinFrom: Perry Yuan <[email protected]>
[ Upstream commit a51ab63b297ce9e26e3ffb9be896018a42d5f32f ]
As there are some AMD processors which only support CPPC V2 firmware and BIOS implementation, the amd_pstate driver will be failed to load when system booting with below kernel warning message:
[ 0.477523] amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
To make the amd_pstate driver can be loaded on those TR40 processors, it needs to match x86_model from 0x30 to 0x7F for family 17H. With the change, the system can load amd_pstate driver as expected.
--- arch/x86/kernel/acpi/cppc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/acpi/cppc.c +1 -1
@@ -20,7 +20,7 @@ bool cpc_supported_by_cpu(void) (boot_cpu_data.x86_model >= 0x20 && boot_cpu_data.x86_model <= 0x2f)))return true; else if (boot_cpu_data.x86 == 0x17 && - boot_cpu_data.x86_model >= 0x70 && boot_cpu_data.x86_model <= 0x7f) + boot_cpu_data.x86_model >= 0x30 && boot_cpu_data.x86_model <= 0x7f) return true;return boot_cpu_has (X86_FEATURE_CPPC ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 189/451 wifi: rtw88: 8821c: Fix beacon loss and disconnect
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit e1dfa21427baeb813f9a2f9ceab6b7d32c3ca425 ]
Tenda U9 V2.0, which contains RTL8811CU, is practically unusable because of frequent disconnections:
Feb 23 14:46:45 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-BEACON-LOSS Feb 23 14:46:46 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-DISCONNECTED bssid=90:55:de:__:__:__ reason=4 locally_generated=1
Feb 23 14:46:52 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-CONNECTED - Connection to 90:55:de:__:__:__ completed [id=0 id_str=] Feb 23 14:46:54 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-BEACON-LOSS Feb 23 14:46:55 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-DISCONNECTED bssid=90:55:de:__:__:__ reason=4 locally_generated=1
Feb 23 14:47:01 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-CONNECTED - Connection to 90:55:de:__:__:__ completed [id=0 id_str=] Feb 23 14:47:04 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-BEACON-LOSS Feb 23 14:47:05 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-DISCONNECTED bssid=90:55:de:__:__:__ reason=4 locally_generated=1
This is caused by a mistake in the chip initialisation. This version of the chip requires loading an extra AGC table right after the main one, but the extra table is being loaded at the wrong time, in rtw_chip_board_info_setup().
Move the extra AGC table loading to the right place, in rtw_phy_load_tables().
The rtw_chip_board_info_setup() can only do "software" things, and rtw_phy_load_tables() can really do IO.
--- drivers/net/wireless/realtek/rtw88/main.c | 2 -- drivers/net/wireless/realtek/rtw88/phy.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +0 -2
@@ -1989,8 +1989,6 @@ static int rtw_chip_board_info_setup(struct rtw_dev *rtwdev)rtw_phy_setup_phy_cond (rtwdev,0 );rtw_phy_init_tx_power (rtwdev); -if (rfe_def->agc_btg_tbl) -rtw_load_table (rtwdev, rfe_def->agc_btg_tbl);rtw_load_table (rtwdev, rfe_def->phy_pg_tbl);rtw_load_table (rtwdev, rfe_def->txpwr_lmt_tbl);rtw_phy_tx_power_by_rate_config (hal);
drivers/net/wireless/realtek/rtw88/phy.c +3 -0
@@ -1761,12 +1761,15 @@ static void rtw_load_rfk_table(struct rtw_dev *rtwdev)void rtw_phy_load_tables (struct rtw_dev *rtwdev) { +const struct rtw_rfe_def *rfe_def =rtw_get_rfe_def (rtwdev);const struct rtw_chip_info *chip = rtwdev->chip;u8 rf_path;rtw_load_table (rtwdev, chip->mac_tbl);rtw_load_table (rtwdev, chip->bb_tbl);rtw_load_table (rtwdev, chip->agc_tbl); +if (rfe_def->agc_btg_tbl) +rtw_load_table (rtwdev, rfe_def->agc_btg_tbl);rtw_load_rfk_table (rtwdev);for (rf_path =0 ; rf_path < rtwdev->hal.rf_path_num; rf_path++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 190/451 wifi: rtw88: 8821c: Fix false alarm count
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit c238adbc578eeb70cbc8fdd1bef3666b0f585b13 ]
total_fa_cnt is supposed to include cck_fa_cnt and ofdm_fa_cnt, not just ofdm_fa_cnt.
--- drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/rtw8821c.c +1 -1
@@ -674,9 +674,9 @@ static void rtw8821c_false_alarm_statistics(struct rtw_dev *rtwdev) dm_info->cck_fa_cnt = cck_fa_cnt; dm_info->ofdm_fa_cnt = ofdm_fa_cnt; + dm_info->total_fa_cnt = ofdm_fa_cnt;if (cck_enable) dm_info->total_fa_cnt += cck_fa_cnt; - dm_info->total_fa_cnt = ofdm_fa_cnt; crc32_cnt =rtw_read32 (rtwdev,REG_CRC_CCK ); dm_info->cck_ok_cnt =FIELD_GET (GENMASK (15 ,0 ), crc32_cnt);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 191/451 PCI: Make pci_dev_is_disconnected() helper public for other drivers
In reply to Sasha LevinFrom: Ethan Zhao <[email protected]>
[ Upstream commit 39714fd73c6b60a8d27bcc5b431afb0828bf4434 ]
Make pci_dev_is_disconnected() public so that it can be called from Intel VT-d driver to quickly fix/workaround the surprise removal unplug hang issue for those ATS capable devices on PCIe switch downstream hotplug capable ports.
Beside pci_device_is_present() function, this one has no config space space access, so is light enough to optimize the normal pure surprise removal and safe removal flow.
Stable-dep-of: 4fc82cd907ac ("iommu/vt-d: Don't issue ATS Invalidation request when device is disconnected")
--- drivers/pci/pci.h | 5 ----- include/linux/pci.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pci.h +0 -5
@@ -357,11 +357,6 @@ static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused)return 0 ; } -static inline bool pci_dev_is_disconnected (const struct pci_dev *dev) -{ -return dev->error_state == pci_channel_io_perm_failure; -} -/* pci_dev priv_flags */ #define PCI_DEV_ADDED 0#define PCI_DPC_RECOVERED 1
include/linux/pci.h +5 -0
@@ -2355,6 +2355,11 @@ static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)return NULL ; } +static inline bool pci_dev_is_disconnected (const struct pci_dev *dev) +{ +return dev->error_state == pci_channel_io_perm_failure; +} +void pci_request_acs (void );bool pci_acs_enabled (struct pci_dev *pdev,u16 acs_flags); bool pci_acs_path_enabled(struct pci_dev *start,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 192/451 iommu/vt-d: Don't issue ATS Invalidation request when device is disconnected
In reply to Sasha LevinFrom: Ethan Zhao <[email protected]>
[ Upstream commit 4fc82cd907ac075648789cc3a00877778aa1838b ]
For those endpoint devices connect to system via hotplug capable ports, users could request a hot reset to the device by flapping device's link through setting the slot's link control register, as pciehp_ist() DLLSC interrupt sequence response, pciehp will unload the device driver and then power it off. thus cause an IOMMU device-TLB invalidation (Intel VT-d spec, or ATS Invalidation in PCIe spec r6.1) request for non-existence target device to be sent and deadly loop to retry that request after ITE fault triggered in interrupt context.
That would cause following continuous hard lockup warning and system hang
[ 4211.433662] pcieport 0000:17:01.0: pciehp: Slot(108): Link Down
[ 4211.433664] pcieport 0000:17:01.0: pciehp: Slot(108): Card not present
[ 4223.822591] NMI watchdog: Watchdog detected hard LOCKUP on cpu 144
[ 4223.822622] CPU: 144 PID: 1422 Comm: irq/57-pciehp Kdump: loaded Tainted: G S
OE kernel version xxxx
[ 4223.822623] Hardware name: vendorname xxxx 666-106,
BIOS 01.01.02.03.01 05/15/2023
[ 4223.822623] RIP: 0010:qi_submit_sync+0x2c0/0x490
[ 4223.822624] Code: 48 be 00 00 00 00 00 08 00 00 49 85 74 24 20 0f 95 c1 48 8b
57 10 83 c1 04 83 3c 1a 03 0f 84 a2 01 00 00 49 8b 04 24 8b 70 34 <40> f6 c6 1
0 74 17 49 8b 04 24 8b 80 80 00 00 00 89 c2 d3 fa 41 39
[ 4223.822624] RSP: 0018:ffffc4f074f0bbb8 EFLAGS: 00000093
[ 4223.822625] RAX: ffffc4f040059000 RBX: 0000000000000014 RCX: 0000000000000005
[ 4223.822625] RDX: ffff9f3841315800 RSI: 0000000000000000 RDI: ffff9f38401a8340
[ 4223.822625] RBP: ffff9f38401a8340 R08: ffffc4f074f0bc00 R09: 0000000000000000
[ 4223.822626] R10: 0000000000000010 R11: 0000000000000018 R12: ffff9f384005e200
[ 4223.822626] R13: 0000000000000004 R14: 0000000000000046 R15: 0000000000000004
[ 4223.822626] FS: 0000000000000000(0000) GS:ffffa237ae400000(0000)
knlGS:0000000000000000
[ 4223.822627] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4223.822627] CR2: 00007ffe86515d80 CR3: 000002fd3000a001 CR4: 0000000000770ee0
[ 4223.822627] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 4223.822628] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400
[ 4223.822628] PKRU: 55555554
[ 4223.822628] Call Trace:
[ 4223.822628] qi_flush_dev_iotlb+0xb1/0xd0
[ 4223.822628] __dmar_remove_one_dev_info+0x224/0x250
[ 4223.822629] dmar_remove_one_dev_info+0x3e/0x50
[ 4223.822629] intel_iommu_release_device+0x1f/0x30
[ 4223.822629] iommu_release_device+0x33/0x60
[ 4223.822629] iommu_bus_notifier+0x7f/0x90
[ 4223.822630] blocking_notifier_call_chain+0x60/0x90
[ 4223.822630] device_del+0x2e5/0x420
[ 4223.822630] pci_remove_bus_device+0x70/0x110
[ 4223.822630] pciehp_unconfigure_device+0x7c/0x130
[ 4223.822631] pciehp_disable_slot+0x6b/0x100
[ 4223.822631] pciehp_handle_presence_or_link_change+0xd8/0x320
[ 4223.822631] pciehp_ist+0x176/0x180
[ 4223.822631] ? irq_finalize_oneshot.part.50+0x110/0x110
[ 4223.822632] irq_thread_fn+0x19/0x50
[ 4223.822632] irq_thread+0x104/0x190
[ 4223.822632] ? irq_forced_thread_fn+0x90/0x90
[ 4223.822632] ? irq_thread_check_affinity+0xe0/0xe0
[ 4223.822633] kthread+0x114/0x130
[ 4223.822633] ? __kthread_cancel_work+0x40/0x40
[ 4223.822633] ret_from_fork+0x1f/0x30
[ 4223.822633] Kernel panic - not syncing: Hard LOCKUP
[ 4223.822634] CPU: 144 PID: 1422 Comm: irq/57-pciehp Kdump: loaded Tainted: G S
OE kernel version xxxx
[ 4223.822634] Hardware name: vendorname xxxx 666-106,
BIOS 01.01.02.03.01 05/15/2023
[ 4223.822634] Call Trace:
[ 4223.822634] <NMI>
[ 4223.822635] dump_stack+0x6d/0x88
[ 4223.822635] panic+0x101/0x2d0
[ 4223.822635] ? ret_from_fork+0x11/0x30
[ 4223.822635] nmi_panic.cold.14+0xc/0xc
[ 4223.822636] watchdog_overflow_callback.cold.8+0x6d/0x81
[ 4223.822636] __perf_event_overflow+0x4f/0xf0
[ 4223.822636] handle_pmi_common+0x1ef/0x290
[ 4223.822636] ? __set_pte_vaddr+0x28/0x40
[ 4223.822637] ? flush_tlb_one_kernel+0xa/0x20
[ 4223.822637] ? __native_set_fixmap+0x24/0x30
[ 4223.822637] ? ghes_copy_tofrom_phys+0x70/0x100
[ 4223.822637] ? __ghes_peek_estatus.isra.16+0x49/0xa0
[ 4223.822637] intel_pmu_handle_irq+0xba/0x2b0
[ 4223.822638] perf_event_nmi_handler+0x24/0x40
[ 4223.822638] nmi_handle+0x4d/0xf0
[ 4223.822638] default_do_nmi+0x49/0x100
[ 4223.822638] exc_nmi+0x134/0x180
[ 4223.822639] end_repeat_nmi+0x16/0x67
[ 4223.822639] RIP: 0010:qi_submit_sync+0x2c0/0x490
[ 4223.822639] Code: 48 be 00 00 00 00 00 08 00 00 49 85 74 24 20 0f 95 c1 48 8b
57 10 83 c1 04 83 3c 1a 03 0f 84 a2 01 00 00 49 8b 04 24 8b 70 34 <40> f6 c6 10
74 17 49 8b 04 24 8b 80 80 00 00 00 89 c2 d3 fa 41 39
[ 4223.822640] RSP: 0018:ffffc4f074f0bbb8 EFLAGS: 00000093
[ 4223.822640] RAX: ffffc4f040059000 RBX: 0000000000000014 RCX: 0000000000000005
[ 4223.822640] RDX: ffff9f3841315800 RSI: 0000000000000000 RDI: ffff9f38401a8340
[ 4223.822641] RBP: ffff9f38401a8340 R08: ffffc4f074f0bc00 R09: 0000000000000000
[ 4223.822641] R10: 0000000000000010 R11: 0000000000000018 R12: ffff9f384005e200
[ 4223.822641] R13: 0000000000000004 R14: 0000000000000046 R15: 0000000000000004
[ 4223.822641] ? qi_submit_sync+0x2c0/0x490
[ 4223.822642] ? qi_submit_sync+0x2c0/0x490
[ 4223.822642] </NMI>
[ 4223.822642] qi_flush_dev_iotlb+0xb1/0xd0
[ 4223.822642] __dmar_remove_one_dev_info+0x224/0x250
[ 4223.822643] dmar_remove_one_dev_info+0x3e/0x50
[ 4223.822643] intel_iommu_release_device+0x1f/0x30
[ 4223.822643] iommu_release_device+0x33/0x60
[ 4223.822643] iommu_bus_notifier+0x7f/0x90
[ 4223.822644] blocking_notifier_call_chain+0x60/0x90
[ 4223.822644] device_del+0x2e5/0x420
[ 4223.822644] pci_remove_bus_device+0x70/0x110
[ 4223.822644] pciehp_unconfigure_device+0x7c/0x130
[ 4223.822644] pciehp_disable_slot+0x6b/0x100
[ 4223.822645] pciehp_handle_presence_or_link_change+0xd8/0x320
[ 4223.822645] pciehp_ist+0x176/0x180
[ 4223.822645] ? irq_finalize_oneshot.part.50+0x110/0x110
[ 4223.822645] irq_thread_fn+0x19/0x50
[ 4223.822646] irq_thread+0x104/0x190
[ 4223.822646] ? irq_forced_thread_fn+0x90/0x90
[ 4223.822646] ? irq_thread_check_affinity+0xe0/0xe0
[ 4223.822646] kthread+0x114/0x130
[ 4223.822647] ? __kthread_cancel_work+0x40/0x40
[ 4223.822647] ret_from_fork+0x1f/0x30
[ 4223.822647] Kernel Offset: 0x6400000 from 0xffffffff81000000 (relocationrange: 0xffffffff80000000-0xffffffffbfffffff)
Such issue could be triggered by all kinds of regular surprise removal hotplug operation. like:
1. pull EP(endpoint device) out directly.
2. turn off EP's power.
3. bring the link down.
etc.
this patch aims to work for regular safe removal and surprise removal unplug. these hot unplug handling process could be optimized for fix the ATS Invalidation hang issue by calling pci_dev_is_disconnected() in function devtlb_invalidation_with_pasid() to check target device state to avoid sending meaningless ATS Invalidation request to iommu when device is gone. (see IMPLEMENTATION NOTE in PCIe spec r6.1 section 10.3.1)
For safe removal, device wouldn't be removed until the whole software handling process is done, it wouldn't trigger the hard lock up issue caused by too long ATS Invalidation timeout wait. In safe removal path, device state isn't set to pci_channel_io_perm_failure in pciehp_unconfigure_device() by checking 'presence' parameter, calling pci_dev_is_disconnected() in devtlb_invalidation_with_pasid() will return false there, wouldn't break the function.
For surprise removal, device state is set to pci_channel_io_perm_failure in pciehp_unconfigure_device(), means device is already gone (disconnected) call pci_dev_is_disconnected() in devtlb_invalidation_with_pasid() will return true to break the function not to send ATS Invalidation request to the disconnected device blindly, thus avoid to trigger further ITE fault, and ITE fault will block all invalidation request to be handled. furthermore retry the timeout request could trigger hard lockup.
safe removal (present) & surprise removal (not present)
pciehp_ist()
pciehp_handle_presence_or_link_change()
pciehp_disable_slot()
remove_board()
pciehp_unconfigure_device(presence) {
if (!presence)
pci_walk_bus(parent, pci_dev_set_disconnected, NULL);
}this patch works for regular safe removal and surprise removal of ATS capable endpoint on PCIe switch downstream ports.
--- drivers/iommu/intel/pasid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/intel/pasid.c +3 -0
@@ -435,6 +435,9 @@ devtlb_invalidation_with_pasid(struct intel_iommu *iommu,if (!info || !info->ats_enabled)return ; +if (pci_dev_is_disconnected (to_pci_dev (dev))) +return ; + sid = info->bus <<8 | info->devfn; qdep = info->ats_qdep; pfsid = info->pfsid;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 193/451 igb: Fix missing time sync events
In reply to Sasha LevinFrom: Vinicius Costa Gomes <[email protected]>
[ Upstream commit ee14cc9ea19ba9678177e2224a9c58cce5937c73 ]
Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed.
The E1000_TSIRC Time Sync Interrupt Cause register can be cleared in two ways, by either reading it or by writing '1' into the specific cause bit. This is documented in section 8.16.1.
The following flow was used:
1. read E1000_TSIRC into 'tsicr';
2. handle the interrupts present into 'tsirc' and mark them in 'ack';
3. write 'ack' into E1000_TSICR;
As both (1) and (3) will clear the interrupt cause, if the same interrupt happens again between (1) and (3) it will be ignored, causing events to be missed.
Remove the extra clear in (3).
--- drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +5 -18
@@ -6926,44 +6926,31 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)static void igb_tsync_interrupt (struct igb_adapter *adapter) {struct e1000_hw *hw = &adapter->hw; -u32 ack =0 , tsicr =rd32 (E1000_TSICR ); +u32 tsicr =rd32 (E1000_TSICR );struct ptp_clock_event event;if (tsicr &TSINTR_SYS_WRAP ) { event.type =PTP_CLOCK_PPS ;if (adapter->ptp_caps.pps)ptp_clock_event (adapter->ptp_clock, &event); - ack |=TSINTR_SYS_WRAP ; }if (tsicr &E1000_TSICR_TXTS ) {/* retrieve hardware timestamp */ schedule_work (&adapter->ptp_tx_work); - ack |=E1000_TSICR_TXTS ; } -if (tsicr &TSINTR_TT0 ) { +if (tsicr &TSINTR_TT0 )igb_perout (adapter,0 ); - ack |=TSINTR_TT0 ; - } -if (tsicr &TSINTR_TT1 ) { +if (tsicr &TSINTR_TT1 )igb_perout (adapter,1 ); - ack |=TSINTR_TT1 ; - } -if (tsicr &TSINTR_AUTT0 ) { +if (tsicr &TSINTR_AUTT0 )igb_extts (adapter,0 ); - ack |=TSINTR_AUTT0 ; - } -if (tsicr &TSINTR_AUTT1 ) { +if (tsicr &TSINTR_AUTT1 )igb_extts (adapter,1 ); - ack |=TSINTR_AUTT1 ; - } - -/* acknowledge the interrupts */ -wr32 (E1000_TSICR , ack); }static irqreturn_t igb_msix_other (int irq,void *data)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 194/451 Bluetooth: Remove HCI_POWER_OFF_TIMEOUT
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit 968667f2e0345a67a6eea5a502f4659085666564 ]
With commit cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED"), the power off sequence got refactored so that this timeout was no longer necessary, let's remove the leftover define from the header too.
--- include/net/bluetooth/hci.h | 1 - 1 file changed, 1 deletion(-)
include/net/bluetooth/hci.h +0 -1
@@ -416,7 +416,6 @@ enum {#define HCI_NCMD_TIMEOUT msecs_to_jiffies(4000)/* 4 seconds */ #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000)/* 45 seconds */ #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000)/* 2 seconds */ -#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000)/* 5 seconds */ #define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000)/* 20 seconds */ #define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(4000)/* 4 seconds */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 195/451 Bluetooth: mgmt: Remove leftover queuing of power_off work
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit fee054b7579fe252f8b9e6c17b9c5bfdaa84dd7e ]
Queuing of power_off work was introduced in these functions with commits 8b064a3ad377 ("Bluetooth: Clean up HCI state when doing power off") and c9910d0fb4fc ("Bluetooth: Fix disconnecting connections in non-connected states") in an effort to clean up state and do things like disconnecting devices before actually powering off the device.
After that, commit a3172b7eb4a2 ("Bluetooth: Add timer to force power off") introduced a timeout to ensure that the device actually got powered off, even if some of the cleanup work would never complete.
This code later got refactored with commit cf75ad8b41d2 ("Bluetooth:hci_sync: Convert MGMT_SET_POWERED"), which made powering off the device synchronous and removed the need for initiating the power_off work from other places. The timeout mentioned above got removed too, because we now also made use of the command timeout during power on/off.
These days the power_off work still exists, but it only seems to only be used for HCI_AUTO_OFF functionality, which is why we never noticed those two leftover places where we queue power_off work. So let's remove that code.
--- net/bluetooth/mgmt.c | 16 ---------------- 1 file changed, 16 deletions(-)
net/bluetooth/mgmt.c +0 -16
@@ -9766,14 +9766,6 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,struct mgmt_ev_device_disconnected ev;struct sock *sk =NULL ; -/* The connection is still in hci_conn_hash so test for 1 -* instead of 0 to know if this is the last one. -*/ -if (mgmt_powering_down (hdev) &&hci_conn_count (hdev) ==1 ) { -cancel_delayed_work (&hdev->power_off); -queue_work (hdev->req_workqueue, &hdev->power_off.work); - } -if (!mgmt_connected)return ;
@@ -9830,14 +9822,6 @@ void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, {struct mgmt_ev_connect_failed ev; -/* The connection is still in hci_conn_hash so test for 1 -* instead of 0 to know if this is the last one. -*/ -if (mgmt_powering_down (hdev) &&hci_conn_count (hdev) ==1 ) { -cancel_delayed_work (&hdev->power_off); -queue_work (hdev->req_workqueue, &hdev->power_off.work); - } -bacpy (&ev.addr.bdaddr, bdaddr); ev.addr.type =link_to_bdaddr (link_type, addr_type); ev.status =mgmt_status (status);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 196/451 Bluetooth: Remove superfluous call to hci_conn_check_pending()
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit 78e3639fc8031275010c3287ac548c0bc8de83b1 ]
The "pending connections" feature was originally introduced with commit 4c67bc74f016 ("[Bluetooth] Support concurrent connect requests") and 6bd57416127e ("[Bluetooth] Handling pending connect attempts after inquiry") to handle controllers supporting only a single connection request at a time. Later things were extended to also cancel ongoing inquiries on connect() with commit 89e65975fea5 ("Bluetooth: Cancel Inquiry before Create Connection").
With commit a9de9248064b ("[Bluetooth] Switch from OGF+OCF to using only opcodes"), hci_conn_check_pending() was introduced as a helper to consolidate a few places where we check for pending connections (indicated by the BT_CONNECT2 flag) and then try to connect.
This refactoring commit also snuck in two more calls to hci_conn_check_pending():
- One is in the failure callback of hci_cs_inquiry(), this one probably makes sense: If we send an "HCI Inquiry" command and then immediately after a "Create Connection" command, the "Create Connection" command might fail before the "HCI Inquiry" command, and then we want to retry the "Create Connection" on failure of the "HCI Inquiry".
- The other added call to hci_conn_check_pending() is in the event handler for the "Remote Name" event, this seems unrelated and is possibly a copy-paste error, so remove that one.
--- net/bluetooth/hci_event.c | 2 -- 1 file changed, 2 deletions(-)
net/bluetooth/hci_event.c +0 -2
@@ -3567,8 +3567,6 @@ static void hci_remote_name_evt(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"status 0x%2.2x" , ev->status); -hci_conn_check_pending (hdev); -hci_dev_lock (hdev); conn =hci_conn_hash_lookup_ba (hdev,ACL_LINK , &ev->bdaddr);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 197/451 Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
In reply to Sasha LevinFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit 56d074d26c5828773b00b2185dd7e1d08273b8e8 ]
The optional variants for the gpiod_get() family of functions return NULL if the GPIO in question is not associated with this device. They return ERR_PTR() on any other error. NULL descriptors are graciously handled by GPIOLIB and can be safely passed to any of the GPIO consumer interfaces as they will return 0 and act as if the function succeeded. If one is using the optional variant, then there's no point in checking for NULL.
--- drivers/bluetooth/hci_qca.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_qca.c +3 -3
@@ -2254,7 +2254,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW ); -if (IS_ERR_OR_NULL (qcadev->bt_en) && +if (IS_ERR (qcadev->bt_en) && (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 )) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" );
@@ -2263,7 +2263,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN ); -if (IS_ERR_OR_NULL (qcadev->sw_ctrl) && +if (IS_ERR (qcadev->sw_ctrl) && (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 || data->soc_type ==QCA_WCN7850 ))
@@ -2285,7 +2285,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)default : qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW ); -if (IS_ERR_OR_NULL (qcadev->bt_en)) { +if (IS_ERR (qcadev->bt_en)) {dev_warn (&serdev->dev,"failed to acquire enable gpio\n" ); power_ctrl_enabled = false; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 198/451 Bluetooth: Cancel sync command before suspend and power off
In reply to Sasha LevinFrom: Archie Pusaka <[email protected]>
[ Upstream commit f419863588217f76eaf754e1dfce21ea7fcb026d ]
Some of the sync commands might take a long time to complete, e.g. LE Create Connection when the peer device isn't responding might take 20 seconds before it times out. If suspend command is issued during this time, it will need to wait for completion since both commands are using the same sync lock.
This patch cancel any running sync commands before attempting to suspend or adapter power off.
Stable-dep-of: 2615fd9a7c25 ("Bluetooth: hci_sync: Fix overwriting request callback")
--- net/bluetooth/hci_core.c | 3 +++ net/bluetooth/mgmt.c | 4 ++++ 2 files changed, 7 insertions(+)
net/bluetooth/hci_core.c +3 -0
@@ -2838,6 +2838,9 @@ int hci_suspend_dev(struct hci_dev *hdev)if (mgmt_powering_down (hdev))return 0 ; +/* Cancel potentially blocking sync operation before suspend */ +__hci_cmd_sync_cancel (hdev, -EHOSTDOWN ); +hci_req_sync_lock (hdev); ret =hci_suspend_sync (hdev);hci_req_sync_unlock (hdev);
net/bluetooth/mgmt.c +4 -0
@@ -1401,6 +1401,10 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data, goto failed; } +/* Cancel potentially blocking sync operation before power off */ +if (cp->val ==0x00 ) +__hci_cmd_sync_cancel (hdev, -EHOSTDOWN ); + err =hci_cmd_sync_queue (hdev, set_powered_sync, cmd, mgmt_set_powered_complete);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 199/451 Bluetooth: hci_sync: Only allow hci_cmd_sync_queue if running
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit d883a4669a1def6d121ccf5e64ad28260d1c9531 ]
This makes sure hci_cmd_sync_queue only queue new work if HCI_RUNNING has been set otherwise there is a risk of commands being sent while turning off.
Because hci_cmd_sync_queue can no longer queue work while HCI_RUNNING is not set it cannot be used to power on adapters so instead hci_cmd_sync_submit is introduced which bypass the HCI_RUNNING check, so it behaves like the old implementation.
Stable-dep-of: 2615fd9a7c25 ("Bluetooth: hci_sync: Fix overwriting request callback")
--- include/net/bluetooth/hci_sync.h | 2 ++ net/bluetooth/hci_sync.c | 25 +++++++++++++++++++++++-- net/bluetooth/mgmt.c | 12 ++++++++---- 3 files changed, 33 insertions(+), 6 deletions(-)
include/net/bluetooth/hci_sync.h +2 -0
@@ -41,6 +41,8 @@ void hci_cmd_sync_clear(struct hci_dev *hdev);void hci_cmd_sync_cancel (struct hci_dev *hdev,int err);void __hci_cmd_sync_cancel (struct hci_dev *hdev,int err); +int hci_cmd_sync_submit (struct hci_dev *hdev,hci_cmd_sync_work_func_t func, +void *data,hci_cmd_sync_work_destroy_t destroy);int hci_cmd_sync_queue (struct hci_dev *hdev,hci_cmd_sync_work_func_t func,void *data,hci_cmd_sync_work_destroy_t destroy);
net/bluetooth/hci_sync.c +23 -2
@@ -680,8 +680,12 @@ void hci_cmd_sync_cancel(struct hci_dev *hdev, int err) }EXPORT_SYMBOL (hci_cmd_sync_cancel); -int hci_cmd_sync_queue (struct hci_dev *hdev,hci_cmd_sync_work_func_t func, -void *data,hci_cmd_sync_work_destroy_t destroy) +/* Submit HCI command to be run in as cmd_sync_work: +* +* - hdev must _not_ be unregistered +*/ +int hci_cmd_sync_submit (struct hci_dev *hdev,hci_cmd_sync_work_func_t func, +void *data,hci_cmd_sync_work_destroy_t destroy) {struct hci_cmd_sync_work_entry *entry;int err =0 ;
@@ -711,6 +715,23 @@ int hci_cmd_sync_queue(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,mutex_unlock (&hdev->unregister_lock);return err; } +EXPORT_SYMBOL (hci_cmd_sync_submit); + +/* Queue HCI command: +* +* - hdev must be running +*/ +int hci_cmd_sync_queue (struct hci_dev *hdev,hci_cmd_sync_work_func_t func, +void *data,hci_cmd_sync_work_destroy_t destroy) +{ +/* Only queue command if hdev is running which means it had been opened +* and is either on init phase or is already up. +*/ +if (!test_bit (HCI_RUNNING , &hdev->flags)) +return -ENETDOWN ; + +return hci_cmd_sync_submit (hdev, func, data, destroy); +}EXPORT_SYMBOL (hci_cmd_sync_queue);int hci_update_eir_sync (struct hci_dev *hdev)
net/bluetooth/mgmt.c +8 -4
@@ -1402,11 +1402,15 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data, }/* Cancel potentially blocking sync operation before power off */ -if (cp->val ==0x00 ) +if (cp->val ==0x00 ) {__hci_cmd_sync_cancel (hdev, -EHOSTDOWN ); - - err =hci_cmd_sync_queue (hdev, set_powered_sync, cmd, - mgmt_set_powered_complete); + err =hci_cmd_sync_queue (hdev, set_powered_sync, cmd, + mgmt_set_powered_complete); + }else { +/* Use hci_cmd_sync_submit since hdev might not be running */ + err =hci_cmd_sync_submit (hdev, set_powered_sync, cmd, + mgmt_set_powered_complete); + }if (err <0 )mgmt_pending_remove (cmd);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 200/451 Bluetooth: hci_conn: Consolidate code for aborting connections
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit a13f316e90fdb1fb6df6582e845aa9b3270f3581 ]
This consolidates code for aborting connections using hci_cmd_sync_queue so it is synchronized with other threads, but because of the fact that some commands may block the cmd_sync_queue while waiting specific events this attempt to cancel those requests by using hci_cmd_sync_cancel.
Stable-dep-of: 2615fd9a7c25 ("Bluetooth: hci_sync: Fix overwriting request callback")
--- include/net/bluetooth/hci_core.h | 2 +- net/bluetooth/hci_conn.c | 154 ++++++------------------------- net/bluetooth/hci_sync.c | 23 +++-- net/bluetooth/mgmt.c | 15 +-- 4 files changed, 47 insertions(+), 147 deletions(-)
include/net/bluetooth/hci_core.h +1 -1
@@ -739,6 +739,7 @@ struct hci_conn {unsigned long flags;enum conn_reasons conn_reason; +__u8 abort_reason;__u32 clock;__u16 clock_accuracy;
@@ -758,7 +759,6 @@ struct hci_conn {struct delayed_work auto_accept_work;struct delayed_work idle_work;struct delayed_work le_conn_timeout; -struct work_struct le_scan_cleanup;struct device dev;struct dentry *debugfs;
net/bluetooth/hci_conn.c +30 -124
188 lines not on this page · raw message
net/bluetooth/hci_sync.c +15 -8
@@ -5230,22 +5230,27 @@ static int hci_disconnect_sync(struct hci_dev *hdev, struct hci_conn *conn, }static int hci_le_connect_cancel_sync (struct hci_dev *hdev, -struct hci_conn *conn) +struct hci_conn *conn,u8 reason) { +/* Return reason if scanning since the connection shall probably be +* cleanup directly. +*/ if (test_bit (HCI_CONN_SCANNING , &conn->flags)) -return 0 ; +return reason; -if (test_and_set_bit (HCI_CONN_CANCEL , &conn->flags)) +if (conn->role ==HCI_ROLE_SLAVE || +test_and_set_bit (HCI_CONN_CANCEL , &conn->flags))return 0 ;return __hci_cmd_sync_status (hdev,HCI_OP_LE_CREATE_CONN_CANCEL ,0 ,NULL ,HCI_CMD_TIMEOUT ); } -static int hci_connect_cancel_sync (struct hci_dev *hdev,struct hci_conn *conn) +static int hci_connect_cancel_sync (struct hci_dev *hdev,struct hci_conn *conn, +u8 reason) {if (conn->type ==LE_LINK ) -return hci_le_connect_cancel_sync (hdev, conn); +return hci_le_connect_cancel_sync (hdev, conn, reason);if (hdev->hci_ver <BLUETOOTH_VER_1_2 )return 0 ;
@@ -5298,9 +5303,11 @@ int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason)case BT_CONFIG :return hci_disconnect_sync (hdev, conn, reason);case BT_CONNECT : - err =hci_connect_cancel_sync (hdev, conn); + err =hci_connect_cancel_sync (hdev, conn, reason);/* Cleanup hci_conn object if it cannot be cancelled as it -* likelly means the controller and host stack are out of sync. +* likelly means the controller and host stack are out of sync +* or in case of LE it was still scanning so it can be cleanup +* safely. */ if (err) {hci_dev_lock (hdev);
@@ -6215,7 +6222,7 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn) done:if (err == -ETIMEDOUT ) -hci_le_connect_cancel_sync (hdev, conn); +hci_le_connect_cancel_sync (hdev, conn,0x00 );/* Re-enable advertising after the connection attempt is finished. */ hci_resume_advertising_sync (hdev);
net/bluetooth/mgmt.c +1 -14
@@ -3583,18 +3583,6 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,return err; } -static int abort_conn_sync (struct hci_dev *hdev,void *data) -{ -struct hci_conn *conn; -u16 handle =PTR_ERR (data); - - conn =hci_conn_hash_lookup_handle (hdev, handle); -if (!conn) -return 0 ; - -return hci_abort_conn_sync (hdev, conn,HCI_ERROR_REMOTE_USER_TERM ); -} -static int cancel_pair_device (struct sock *sk,struct hci_dev *hdev,void *data,u16 len) {
@@ -3645,8 +3633,7 @@ static int cancel_pair_device(struct sock *sk, struct hci_dev *hdev, void *data, le_addr_type(addr->type));if (conn->conn_reason ==CONN_REASON_PAIR_DEVICE ) -hci_cmd_sync_queue (hdev, abort_conn_sync,ERR_PTR (conn->handle), -NULL ); +hci_abort_conn (conn,HCI_ERROR_REMOTE_USER_TERM ); unlock:hci_dev_unlock (hdev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 201/451 Bluetooth: hci_core: Cancel request on command timeout
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 63298d6e752fc0ec7f5093860af8bc9f047b30c8 ]
If command has timed out call __hci_cmd_sync_cancel to notify the hci_req since it will inevitably cause a timeout.
This also rework the code around __hci_cmd_sync_cancel since it was wrongly assuming it needs to cancel timer as well, but sometimes the timers have not been started or in fact they already had timed out in which case they don't need to be cancel yet again.
Stable-dep-of: 2615fd9a7c25 ("Bluetooth: hci_sync: Fix overwriting request callback")
--- include/net/bluetooth/hci_sync.h | 2 +- net/bluetooth/hci_core.c | 86 +++++++++++++++++++++----------- net/bluetooth/hci_request.c | 2 +- net/bluetooth/hci_sync.c | 20 ++++---- net/bluetooth/mgmt.c | 2 +- 5 files changed, 72 insertions(+), 40 deletions(-)
include/net/bluetooth/hci_sync.h +1 -1
@@ -39,7 +39,7 @@ int __hci_cmd_sync_status_sk(struct hci_dev *hdev, u16 opcode, u32 plen,void hci_cmd_sync_init (struct hci_dev *hdev);void hci_cmd_sync_clear (struct hci_dev *hdev);void hci_cmd_sync_cancel (struct hci_dev *hdev,int err); -void __hci_cmd_sync_cancel (struct hci_dev *hdev,int err); +void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err);int hci_cmd_sync_submit (struct hci_dev *hdev,hci_cmd_sync_work_func_t func,void *data,hci_cmd_sync_work_destroy_t destroy);
net/bluetooth/hci_core.c +58 -28
117 lines not on this page · raw message
net/bluetooth/hci_request.c +1 -1
@@ -916,7 +916,7 @@ void hci_request_setup(struct hci_dev *hdev)void hci_request_cancel_all (struct hci_dev *hdev) { -__hci_cmd_sync_cancel (hdev,ENODEV ); +hci_cmd_sync_cancel_sync (hdev,ENODEV );cancel_interleave_scan (hdev); }
net/bluetooth/hci_sync.c +11 -9
@@ -651,7 +651,7 @@ void hci_cmd_sync_clear(struct hci_dev *hdev)mutex_unlock (&hdev->cmd_sync_work_lock); } -void __hci_cmd_sync_cancel (struct hci_dev *hdev,int err) +void hci_cmd_sync_cancel (struct hci_dev *hdev,int err) {bt_dev_dbg (hdev,"err 0x%2.2x" , err);
@@ -659,15 +659,17 @@ void __hci_cmd_sync_cancel(struct hci_dev *hdev, int err) hdev->req_result = err; hdev->req_status =HCI_REQ_CANCELED ; -cancel_delayed_work_sync (&hdev->cmd_timer); -cancel_delayed_work_sync (&hdev->ncmd_timer); -atomic_set (&hdev->cmd_cnt,1 ); - -wake_up_interruptible (&hdev->req_wait_q); +queue_work (hdev->workqueue, &hdev->cmd_sync_cancel_work); } } +EXPORT_SYMBOL (hci_cmd_sync_cancel); -void hci_cmd_sync_cancel (struct hci_dev *hdev,int err) +/* Cancel ongoing command request synchronously: +* +* - Set result and mark status to HCI_REQ_CANCELED +* - Wakeup command sync thread +*/ +void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err) {bt_dev_dbg (hdev,"err 0x%2.2x" , err);
@@ -675,10 +677,10 @@ void hci_cmd_sync_cancel(struct hci_dev *hdev, int err) hdev->req_result = err; hdev->req_status =HCI_REQ_CANCELED ; -queue_work (hdev->workqueue, &hdev->cmd_sync_cancel_work); +wake_up_interruptible (&hdev->req_wait_q); } } -EXPORT_SYMBOL (hci_cmd_sync_cancel); +EXPORT_SYMBOL (hci_cmd_sync_cancel_sync);/* Submit HCI command to be run in as cmd_sync_work: *
net/bluetooth/mgmt.c +1 -1
@@ -1403,7 +1403,7 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,/* Cancel potentially blocking sync operation before power off */ if (cp->val ==0x00 ) { -__hci_cmd_sync_cancel (hdev, -EHOSTDOWN ); +hci_cmd_sync_cancel_sync (hdev, -EHOSTDOWN ); err =hci_cmd_sync_queue (hdev, set_powered_sync, cmd, mgmt_set_powered_complete); }else {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 202/451 Bluetooth: hci_sync: Fix overwriting request callback
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 2615fd9a7c2507eb3be3fbe49dcec88a2f56454a ]
In a few cases the stack may generate commands as responses to events which would happen to overwrite the sent_cmd, so this attempts to store the request in req_skb so even if sent_cmd is replaced with a new command the pending request will remain in stored in req_skb.
--- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_conn.c | 2 +- net/bluetooth/hci_core.c | 46 ++++++++++++++++++++++---------- net/bluetooth/hci_event.c | 18 ++++++------- net/bluetooth/hci_sync.c | 21 ++++++++++++--- 5 files changed, 61 insertions(+), 27 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
@@ -549,6 +549,7 @@ struct hci_dev {__u32 req_status;__u32 req_result;struct sk_buff *req_skb; +struct sk_buff *req_rsp;void *smp_data;void *smp_bredr_data;
net/bluetooth/hci_conn.c +1 -1
@@ -2813,7 +2813,7 @@ int hci_abort_conn(struct hci_conn *conn, u8 reason)case HCI_EV_LE_CONN_COMPLETE :case HCI_EV_LE_ENHANCED_CONN_COMPLETE :case HCI_EVT_LE_CIS_ESTABLISHED : -hci_cmd_sync_cancel (hdev, -ECANCELED ); +hci_cmd_sync_cancel (hdev,ECANCELED );break ; } }
net/bluetooth/hci_core.c +32 -14
92 lines not on this page · raw message
net/bluetooth/hci_event.c +9 -9
@@ -4329,7 +4329,7 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, void *data,* (since for this kind of commands there will not be a command * complete event). */ -if (ev->status || (hdev->sent_cmd && !hci_skb_event (hdev->sent_cmd))) { +if (ev->status || (hdev->req_skb && !hci_skb_event (hdev->req_skb))) {hci_req_cmd_complete (hdev, *opcode, ev->status, req_complete, req_complete_skb);if (hci_dev_test_flag (hdev,HCI_CMD_PENDING )) {
@@ -7147,10 +7147,10 @@ static void hci_le_meta_evt(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"subevent 0x%2.2x" , ev->subevent);/* Only match event if command OGF is for LE */ -if (hdev->sent_cmd && -hci_opcode_ogf (hci_skb_opcode (hdev->sent_cmd)) ==0x08 && -hci_skb_event (hdev->sent_cmd) == ev->subevent) { - *opcode =hci_skb_opcode (hdev->sent_cmd); +if (hdev->req_skb && +hci_opcode_ogf (hci_skb_opcode (hdev->req_skb)) ==0x08 && +hci_skb_event (hdev->req_skb) == ev->subevent) { + *opcode =hci_skb_opcode (hdev->req_skb);hci_req_cmd_complete (hdev, *opcode,0x00 , req_complete, req_complete_skb); }
@@ -7537,10 +7537,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) }/* Only match event if command OGF is not for LE */ -if (hdev->sent_cmd && -hci_opcode_ogf (hci_skb_opcode (hdev->sent_cmd)) !=0x08 && -hci_skb_event (hdev->sent_cmd) == event) { -hci_req_cmd_complete (hdev,hci_skb_opcode (hdev->sent_cmd), +if (hdev->req_skb && +hci_opcode_ogf (hci_skb_opcode (hdev->req_skb)) !=0x08 && +hci_skb_event (hdev->req_skb) == event) { +hci_req_cmd_complete (hdev,hci_skb_opcode (hdev->req_skb), status, &req_complete, &req_complete_skb); req_evt = event; }
net/bluetooth/hci_sync.c +18 -3
@@ -31,6 +31,10 @@ static void hci_cmd_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode, hdev->req_result = result; hdev->req_status =HCI_REQ_DONE ; +/* Free the request command so it is not used as response */ +kfree_skb (hdev->req_skb); + hdev->req_skb =NULL ; +if (skb) {struct sock *sk =hci_skb_sk (skb);
@@ -38,7 +42,7 @@ static void hci_cmd_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,if (sk)sock_put (sk); - hdev->req_skb =skb_get (skb); + hdev->req_rsp =skb_get (skb); }wake_up_interruptible (&hdev->req_wait_q);
@@ -186,8 +190,8 @@ struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen, hdev->req_status =0 ; hdev->req_result =0 ; - skb = hdev->req_skb; - hdev->req_skb =NULL ; + skb = hdev->req_rsp; + hdev->req_rsp =NULL ;bt_dev_dbg (hdev,"end: err %d" , err);
@@ -4879,6 +4883,11 @@ int hci_dev_open_sync(struct hci_dev *hdev) hdev->sent_cmd =NULL ; } +if (hdev->req_skb) { +kfree_skb (hdev->req_skb); + hdev->req_skb =NULL ; + } +clear_bit (HCI_RUNNING , &hdev->flags);hci_sock_dev_event (hdev,HCI_DEV_CLOSE );
@@ -5040,6 +5049,12 @@ int hci_dev_close_sync(struct hci_dev *hdev) hdev->sent_cmd =NULL ; } +/* Drop last request */ +if (hdev->req_skb) { +kfree_skb (hdev->req_skb); + hdev->req_skb =NULL ; + } +clear_bit (HCI_RUNNING , &hdev->flags);hci_sock_dev_event (hdev,HCI_DEV_CLOSE );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 203/451 Bluetooth: hci_core: Fix possible buffer overflow
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 81137162bfaa7278785b24c1fd2e9e74f082e8e4 ]
struct hci_dev_info has a fixed size name[8] field so in the event that hdev->name is bigger than that strcpy would attempt to write past its size, so this fixes this problem by switching to use strscpy.
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -908,7 +908,7 @@ int hci_get_dev_info(void __user *arg)else flags = hdev->flags; -strcpy (di.name, hdev->name); +strscpy (di.name, hdev->name,sizeof (di.name)); di.bdaddr = hdev->bdaddr; di.type = (hdev->bus &0x0f ) | ((hdev->dev_type &0x03 ) <<4 ); di.flags = flags;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 204/451 Bluetooth: af_bluetooth: Fix deadlock
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit f7b94bdc1ec107c92262716b073b3e816d4784fb ]
Attemting to do sock_lock on .recvmsg may cause a deadlock as shown bellow, so instead of using sock_sock this uses sk_receive_queue.lock on bt_sock_ioctl to avoid the UAF:
INFO: task kworker/u9:1:121 blocked for more than 30 seconds.
Not tainted 6.7.6-lemon #183
Workqueue: hci0 hci_rx_work
Call Trace:
<TASK>
__schedule+0x37d/0xa00
schedule+0x32/0xe0
__lock_sock+0x68/0xa0
? __pfx_autoremove_wake_function+0x10/0x10
lock_sock_nested+0x43/0x50
l2cap_sock_recv_cb+0x21/0xa0
l2cap_recv_frame+0x55b/0x30a0
? psi_task_switch+0xeb/0x270
? finish_task_switch.isra.0+0x93/0x2a0
hci_rx_work+0x33a/0x3f0
process_one_work+0x13a/0x2f0
worker_thread+0x2f0/0x410
? __pfx_worker_thread+0x10/0x10
kthread+0xe0/0x110
? __pfx_kthread+0x10/0x10
ret_from_fork+0x2c/0x50
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1b/0x30
</TASK>--- net/bluetooth/af_bluetooth.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
net/bluetooth/af_bluetooth.c +3 -7
@@ -264,14 +264,11 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags &MSG_OOB )return -EOPNOTSUPP ; -lock_sock (sk); - skb =skb_recv_datagram (sk, flags, &err);if (!skb) {if (sk->sk_shutdown &RCV_SHUTDOWN ) err =0 ; -release_sock (sk);return err; }
@@ -297,8 +294,6 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,skb_free_datagram (sk, skb); -release_sock (sk); -if (flags &MSG_TRUNC ) copied = skblen;
@@ -521,10 +516,11 @@ int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)if (sk->sk_state ==BT_LISTEN )return -EINVAL ; -lock_sock (sk); +spin_lock (&sk->sk_receive_queue.lock); skb =skb_peek (&sk->sk_receive_queue); amount = skb ? skb->len :0 ; -release_sock (sk); +spin_unlock (&sk->sk_receive_queue.lock); + err =put_user (amount, (int __user *)arg);break ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 205/451 Bluetooth: fix use-after-free in accessing skb after sending it
In reply to Sasha LevinFrom: Pauli Virtanen <[email protected]>
[ Upstream commit 947ec0d002dce8577b655793dcc6fc78d67b7cb6 ]
hci_send_cmd_sync first sends skb and then tries to clone it. However, the driver may have already freed the skb at that point.
Fix by cloning the sent_cmd cloned just above, instead of the original.
Log:
================================================================
BUG: KASAN: slab-use-after-free in __copy_skb_header+0x1a/0x240 ... Call Trace: .. __skb_clone+0x59/0x2c0 hci_cmd_work+0x3b3/0x3d0 [bluetooth] process_one_work+0x459/0x900 ... Allocated by task 129: ... __alloc_skb+0x1ae/0x220 __hci_cmd_sync_sk+0x44c/0x7a0 [bluetooth] __hci_cmd_sync_status+0x24/0xb0 [bluetooth] set_cig_params_sync+0x778/0x7d0 [bluetooth] ... Freed by task 0: ... kmem_cache_free+0x157/0x3c0 __usb_hcd_giveback_urb+0x11e/0x1e0 usb_giveback_urb_bh+0x1ad/0x2a0 tasklet_action_common.isra.0+0x259/0x4a0 __do_softirq+0x15b/0x5a7 ================================================================
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -4176,7 +4176,7 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)if (hci_req_status_pend (hdev) && !hci_dev_test_and_set_flag (hdev,HCI_CMD_PENDING )) {kfree_skb (hdev->req_skb); - hdev->req_skb =skb_clone (skb,GFP_KERNEL ); + hdev->req_skb =skb_clone (hdev->sent_cmd,GFP_KERNEL ); }atomic_dec (&hdev->cmd_cnt);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 206/451 sr9800: Add check for usbnet_get_endpoints
In reply to Sasha LevinFrom: Chen Ni <[email protected]>
[ Upstream commit 07161b2416f740a2cb87faa5566873f401440a61 ]
Add check for usbnet_get_endpoints() and return the error if it fails in order to transfer the error.
--- drivers/net/usb/sr9800.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/sr9800.c +3 -1
@@ -737,7 +737,9 @@ static int sr9800_bind(struct usbnet *dev, struct usb_interface *intf) data->eeprom_len =SR9800_EEPROM_LEN ; -usbnet_get_endpoints (dev, intf); + ret =usbnet_get_endpoints (dev, intf); +if (ret) + goto out;/* LED Setting Rule : * AABB:CCDD
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 207/451 s390/cache: prevent rebuild of shared_cpu_list
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit cb0cd4ee11142339f2d47eef6db274290b7a482d ]
With commit 36bbc5b4ffab ("cacheinfo: Allow early detection and population of cache attributes") the shared cpu list for each cache level higher than L1 is rebuilt even if the list already has been set up.
This is caused by the removal of the cpumask_empty() check within cache_shared_cpu_map_setup().
However architectures can enforce that the shared cpu list is not rebuilt by simply setting cpu_map_populated of the per cpu cache info structure to true, which is also the fix for this problem.
Before:
$ cat /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list 0-7
After:
$ cat /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list 1
--- arch/s390/kernel/cache.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/kernel/cache.c +1 -0
@@ -166,5 +166,6 @@ int populate_cache_leaves(unsigned int cpu)ci_leaf_init (this_leaf++, pvt, ctype, level, cpu); } } + this_cpu_ci->cpu_map_populated = true;return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 208/451 bpf: Fix DEVMAP_HASH overflow check on 32-bit arches
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 281d464a34f540de166cee74b723e97ac2515ec3 ]
The devmap code allocates a number hash buckets equal to the next power of two of the max_entries value provided when creating the map. When rounding up to the next power of two, the 32-bit variable storing the number of buckets can overflow, and the code checks for overflow by checking if the truncated 32-bit value is equal to 0. However, on 32-bit arches the rounding up itself can overflow mid-way through, because it ends up doing a left-shift of 32 bits on an unsigned long value. If the size of an unsigned long is four bytes, this is undefined behaviour, so there is no guarantee that we'll end up with a nice and tidy 0-value at the end.
Syzbot managed to turn this into a crash on arm32 by creating a DEVMAP_HASH with max_entries > 0x80000000 and then trying to update it. Fix this by moving the overflow check to before the rounding up operation.
Message-ID: <[email protected]>
--- kernel/bpf/devmap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
kernel/bpf/devmap.c +6 -5
@@ -131,13 +131,14 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr)bpf_map_init_from_attr (&dtab->map, attr);if (attr->map_type ==BPF_MAP_TYPE_DEVMAP_HASH ) { - dtab->n_buckets =roundup_pow_of_two (dtab->map.max_entries); - -if (!dtab->n_buckets)/* Overflow check */ +/* hash table size must be power of 2; roundup_pow_of_two() can +* overflow into UB on 32-bit arches, so check that first +*/ +if (dtab->map.max_entries >1UL <<31 )return -EINVAL ; - } -if (attr->map_type ==BPF_MAP_TYPE_DEVMAP_HASH ) { + dtab->n_buckets =roundup_pow_of_two (dtab->map.max_entries); + dtab->dev_index_head =dev_map_create_hash (dtab->n_buckets, dtab->map.numa_node);if (!dtab->dev_index_head)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 209/451 bpf: Fix hashtab overflow check on 32-bit arches
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 6787d916c2cf9850c97a0a3f73e08c43e7d973b1 ]
The hashtab code relies on roundup_pow_of_two() to compute the number of hash buckets, and contains an overflow check by checking if the resulting value is 0. However, on 32-bit arches, the roundup code itself can overflow by doing a 32-bit left-shift of an unsigned long value, which is undefined behaviour, so it is not guaranteed to truncate neatly. This was triggered by syzbot on the DEVMAP_HASH type, which contains the same check, copied from the hashtab code. So apply the same fix to hashtab, by moving the overflow check to before the roundup.
Message-ID: <[email protected]>
--- kernel/bpf/hashtab.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
kernel/bpf/hashtab.c +9 -5
@@ -495,7 +495,13 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) num_possible_cpus()); } -/* hash table size must be power of 2 */ +/* hash table size must be power of 2; roundup_pow_of_two() can overflow +* into UB on 32-bit arches, so check that first +*/ + err = -E2BIG ; +if (htab->map.max_entries >1UL <<31 ) + goto free_htab; + htab->n_buckets =roundup_pow_of_two (htab->map.max_entries); htab->elem_size = sizeof(struct htab_elem) +
@@ -505,10 +511,8 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr)else htab->elem_size +=round_up (htab->map.value_size,8 ); - err = -E2BIG ; -/* prevent zero size kmalloc and check for u32 overflow */ -if (htab->n_buckets ==0 || - htab->n_buckets >U32_MAX /sizeof (struct bucket )) +/* check for u32 overflow */ +if (htab->n_buckets >U32_MAX /sizeof (struct bucket )) goto free_htab; err = -ENOMEM ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 210/451 bpf: Fix stackmap overflow check on 32-bit arches
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 7a4b21250bf79eef26543d35bd390448646c536b ]
The stackmap code relies on roundup_pow_of_two() to compute the number of hash buckets, and contains an overflow check by checking if the resulting value is 0. However, on 32-bit arches, the roundup code itself can overflow by doing a 32-bit left-shift of an unsigned long value, which is undefined behaviour, so it is not guaranteed to truncate neatly. This was triggered by syzbot on the DEVMAP_HASH type, which contains the same check, copied from the hashtab code.
The commit in the fixes tag actually attempted to fix this, but the fix did not account for the UB, so the fix only works on CPUs where an overflow does result in a neat truncation to zero, which is not guaranteed. Checking the value before rounding does not have this problem.
Message-ID: <[email protected]>
--- kernel/bpf/stackmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/stackmap.c +6 -3
@@ -94,11 +94,14 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr) }else if (value_size /8 > sysctl_perf_event_max_stack)return ERR_PTR (-EINVAL ); -/* hash table size must be power of 2 */ - n_buckets =roundup_pow_of_two (attr->max_entries); -if (!n_buckets) +/* hash table size must be power of 2; roundup_pow_of_two() can overflow +* into UB on 32-bit arches, so check that first +*/ +if (attr->max_entries >1UL <<31 )return ERR_PTR (-E2BIG ); + n_buckets =roundup_pow_of_two (attr->max_entries); + cost = n_buckets *sizeof (struct stack_map_bucket *) +sizeof (*smap); smap =bpf_map_area_alloc (cost,bpf_map_attr_numa_node (attr));if (!smap)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 211/451 iommu/vt-d: Retrieve IOMMU perfmon capability information
In reply to Sasha LevinFrom: Kan Liang <[email protected]>
[ Upstream commit a6a5006dad572a53b5df3f47e1471d207ae9ba49 ]
The performance monitoring infrastructure, perfmon, is to support collection of information about key events occurring during operation of the remapping hardware, to aid performance tuning and debug. Each remapping hardware unit has capability registers that indicate support for performance monitoring features and enumerate the capabilities.
Add alloc_iommu_pmu() to retrieve IOMMU perfmon capability information for each iommu unit. The information is stored in the iommu->pmu data structure. Capability registers are read-only, so it's safe to prefetch and store them in the pmu structure. This could avoid unnecessary VMEXIT when this code is running in the virtualization environment.
Add free_iommu_pmu() to free the saved capability information when freeing the iommu unit.
Add a kernel config option for the IOMMU perfmon feature. Unless a user explicitly uses the perf tool to monitor the IOMMU perfmon event, there isn't any impact for the existing IOMMU. Enable it by default.
Stable-dep-of: 70bad345e622 ("iommu: Fix compilation without CONFIG_IOMMU_INTEL")
--- drivers/iommu/intel/Kconfig | 11 +++ drivers/iommu/intel/Makefile | 1 + drivers/iommu/intel/dmar.c | 7 ++ drivers/iommu/intel/iommu.h | 43 ++++++++- drivers/iommu/intel/perfmon.c | 172 ++++++++++++++++++++++++++++++++++ drivers/iommu/intel/perfmon.h | 40 ++++++++ 6 files changed, 273 insertions(+), 1 deletion(-) create mode 100644 drivers/iommu/intel/perfmon.c create mode 100644 drivers/iommu/intel/perfmon.h
drivers/iommu/intel/Kconfig +11 -0
@@ -96,4 +96,15 @@ config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON passing intel_iommu=sm_on to the kernel. If not sure, please use the default value. +config INTEL_IOMMU_PERF_EVENTS + def_bool y + bool "Intel IOMMU performance events" + depends on INTEL_IOMMU && PERF_EVENTS + help + Selecting this option will enable the performance monitoring + infrastructure in the Intel IOMMU. It collects information about + key events occurring during operation of the remapping hardware, + to aid performance tuning and debug. These are available on modern + processors which support Intel VT-d 4.0 and later. + endif # INTEL_IOMMU
drivers/iommu/intel/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_DMAR_PERF) += perf.o obj-$(CONFIG_INTEL_IOMMU_DEBUGFS) += debugfs.o obj-$(CONFIG_INTEL_IOMMU_SVM) += svm.o obj-$(CONFIG_IRQ_REMAP) += irq_remapping.o +obj-$(CONFIG_INTEL_IOMMU_PERF_EVENTS) += perfmon.o
drivers/iommu/intel/dmar.c +7 -0
@@ -34,6 +34,7 @@#include "../irq_remapping.h" #include "perf.h" #include "trace.h" +#include "perfmon.h" typedef int (*dmar_res_handler_t )(struct acpi_dmar_header *,void *);struct dmar_res_callback {
@@ -1104,6 +1105,9 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)if (sts &DMA_GSTS_QIES ) iommu->gcmd |=DMA_GCMD_QIE ; +if (alloc_iommu_pmu (iommu)) +pr_debug ("Cannot alloc PMU for iommu (seq_id = %d)\n" , iommu->seq_id); +raw_spin_lock_init (&iommu->register_lock);/*
@@ -1131,6 +1135,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) err_sysfs:iommu_device_sysfs_remove (&iommu->iommu); err_unmap: +free_iommu_pmu (iommu);unmap_iommu (iommu); error_free_seq_id:ida_free (&dmar_seq_ids, iommu->seq_id);
@@ -1146,6 +1151,8 @@ static void free_iommu(struct intel_iommu *iommu)iommu_device_sysfs_remove (&iommu->iommu); } +free_iommu_pmu (iommu); +if (iommu->irq) {if (iommu->pr_irq) {free_irq (iommu->pr_irq, iommu);
drivers/iommu/intel/iommu.h +42 -1
79 lines not on this page · raw message
drivers/iommu/intel/perfmon.c new file +172 -0
172 lines not on this page · raw message
drivers/iommu/intel/perfmon.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* +* PERFCFGOFF_REG, PERFFRZOFF_REG +* PERFOVFOFF_REG, PERFCNTROFF_REG +*/ +#define IOMMU_PMU_NUM_OFF_REGS 4 +#define IOMMU_PMU_OFF_REGS_STEP 4 + +#define IOMMU_PMU_CFG_OFFSET 0x100 +#define IOMMU_PMU_CFG_CNTRCAP_OFFSET 0x80 +#define IOMMU_PMU_CFG_CNTREVCAP_OFFSET 0x84 +#define IOMMU_PMU_CFG_SIZE 0x8 +#define IOMMU_PMU_CFG_FILTERS_OFFSET 0x4 + +#define IOMMU_PMU_CAP_REGS_STEP 8 + +#define iommu_cntrcap_pcc (p) ((p) & 0x1) +#define iommu_cntrcap_cw (p) (((p) >> 8) & 0xff) +#define iommu_cntrcap_ios (p) (((p) >> 16) & 0x1) +#define iommu_cntrcap_egcnt (p) (((p) >> 28) & 0xf) + +#define iommu_event_select (p) ((p) & 0xfffffff) +#define iommu_event_group (p) (((p) >> 28) & 0xf) + +#ifdef CONFIG_INTEL_IOMMU_PERF_EVENTS +int alloc_iommu_pmu (struct intel_iommu *iommu); +void free_iommu_pmu (struct intel_iommu *iommu); +#else +static inline int +alloc_iommu_pmu (struct intel_iommu *iommu) +{ +return 0 ; +} + +static inline void +free_iommu_pmu (struct intel_iommu *iommu) +{ +} +#endif /* CONFIG_INTEL_IOMMU_PERF_EVENTS */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 212/451 iommu: Fix compilation without CONFIG_IOMMU_INTEL
In reply to Sasha LevinFrom: Bert Karwatzki <[email protected]>
[ Upstream commit 70bad345e622c23bb530016925c936ab04a646ac ]
When the kernel is comiled with CONFIG_IRQ_REMAP=y but without CONFIG_IOMMU_INTEL compilation fails since commit def054b01a8678 with an undefined reference to device_rbtree_find(). This patch makes sure that intel specific code is only compiled with CONFIG_IOMMU_INTEL=y.
--- drivers/iommu/Kconfig | 2 +- drivers/iommu/intel/Makefile | 2 ++ drivers/iommu/irq_remapping.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/iommu/Kconfig +1 -1
@@ -192,7 +192,7 @@ source "drivers/iommu/intel/Kconfig" config IRQ_REMAP bool "Support for Interrupt Remapping" depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI - select DMAR_TABLE + select DMAR_TABLE if INTEL_IOMMU help Supports Interrupt remapping for IO-APIC and MSI devices. To use x2apic mode in the CPU's which support x2APIC enhancements or
drivers/iommu/intel/Makefile +2 -0
@@ -5,5 +5,7 @@ obj-$(CONFIG_DMAR_TABLE) += trace.o cap_audit.o obj-$(CONFIG_DMAR_PERF) += perf.o obj-$(CONFIG_INTEL_IOMMU_DEBUGFS) += debugfs.o obj-$(CONFIG_INTEL_IOMMU_SVM) += svm.o +ifdef CONFIG_INTEL_IOMMU obj-$(CONFIG_IRQ_REMAP) += irq_remapping.o +endif obj-$(CONFIG_INTEL_IOMMU_PERF_EVENTS) += perfmon.o
drivers/iommu/irq_remapping.c +2 -1
@@ -99,7 +99,8 @@ int __init irq_remapping_prepare(void)if (disable_irq_remap)return -ENOSYS ; -if (intel_irq_remap_ops.prepare () ==0 ) +if (IS_ENABLED (CONFIG_INTEL_IOMMU ) && + intel_irq_remap_ops.prepare () ==0 ) remap_ops = &intel_irq_remap_ops;else if (IS_ENABLED (CONFIG_AMD_IOMMU ) && amd_iommu_irq_ops.prepare () ==0 )
Signature · 1 line
2.43.0
Re: [PATCH 6.1 212/451] iommu: Fix compilation without CONFIG_IOMMU_INTEL
Hi!
Quoted 6 lines
[ Upstream commit
70bad345e622c23bb530016925c936ab04a646ac]When the kernel is comiled with
CONFIG_IRQ_REMAP=ybut withoutCONFIG_IOMMU_INTELcompilation fails since commitdef054b01a8678with an undefined reference todevice_rbtree_find(). This patch makes sure that intel specific code is only compiled withCONFIG_IOMMU_INTEL=y.
We don't have commit def054b01a8678 in -stable, so we should not need this.
Best regards,
Pavel
Quoted 36 lines
+++ b/drivers/iommu/Kconfig
drivers/iommu/Kconfig +1
-1@@ -192,7 +192,7 @@ source "drivers/iommu/intel/Kconfig" config IRQ_REMAP bool "Support for Interrupt Remapping" depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI - select DMAR_TABLE + select DMAR_TABLE if INTEL_IOMMU help Supports Interrupt remapping for IO-APIC and MSI devices. To use x2apic mode in the CPU's which support x2APIC enhancements ordrivers/iommu/intel/Makefile +2
-0@@ -5,5 +5,7 @@ obj-$(CONFIG_DMAR_TABLE) += trace.o cap_audit.o obj-$(CONFIG_DMAR_PERF) += perf.o obj-$(CONFIG_INTEL_IOMMU_DEBUGFS) += debugfs.o obj-$(CONFIG_INTEL_IOMMU_SVM) += svm.o +ifdef CONFIG_INTEL_IOMMU obj-$(CONFIG_IRQ_REMAP) += irq_remapping.o +endif obj-$(CONFIG_INTEL_IOMMU_PERF_EVENTS) += perfmon.odrivers/iommu/irq_remapping.c +2
-1@@ -99,7 +99,8 @@ int __init irq_remapping_prepare(void)if (disable_irq_remap)return -ENOSYS ; -if (intel_irq_remap_ops.prepare () ==0 ) +if (IS_ENABLED (CONFIG_INTEL_IOMMU ) && + intel_irq_remap_ops.prepare () ==0 ) remap_ops = &intel_irq_remap_ops;else if (IS_ENABLED (CONFIG_AMD_IOMMU ) && amd_iommu_irq_ops.prepare () ==0 )
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Sasha Levin
maintainerPATCH 213/451 ipv6: fib6_rules: flush route cache when rule is changed
In reply to Sasha LevinFrom: Shiming Cheng <[email protected]>
[ Upstream commit c4386ab4f6c600f75fdfd21143f89bac3e625d0d ]
When rule policy is changed, ipv6 socket cache is not refreshed. The sock's skb still uses a outdated route cache and was sent to a wrong interface.
To avoid this error we should update fib node's version when rule is changed. Then skb's route will be reroute checked as route cache version is already different with fib node version. The route cache is refreshed to match the latest rule.
--- net/ipv6/fib6_rules.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/ipv6/fib6_rules.c +6 -0
@@ -449,6 +449,11 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule) +nla_total_size (16 );/* src */ } +static void fib6_rule_flush_cache (struct fib_rules_ops *ops) +{ +rt_genid_bump_ipv6 (ops->fro_net); +} +static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = { .family =AF_INET6 , .rule_size =sizeof (struct fib6_rule ),
@@ -461,6 +466,7 @@ static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = { .compare = fib6_rule_compare, .fill = fib6_rule_fill, .nlmsg_payload = fib6_rule_nlmsg_payload, + .flush_cache = fib6_rule_flush_cache, .nlgroup = RTNLGRP_IPV6_RULE, .owner = THIS_MODULE, .fro_net = &init_net,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 214/451 net: ip_tunnel: make sure to pull inner header in ip_tunnel_rcv()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit b0ec2abf98267f14d032102551581c833b0659d3 ]
Apply the same fix than ones found in :
8d975c15c0cd ("ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()") 1ca1ba465e55 ("geneve: make sure to pull inner header in geneve_rx()")
We have to save skb->network_header in a temporary variable in order to be able to recompute the network_header pointer after a pskb_inet_may_pull() call.
pskb_inet_may_pull() makes sure the needed headers are in skb->head.
syzbot reported:
BUG: KMSAN: uninit-value in __INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline] BUG: KMSAN: uninit-value in INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline] BUG: KMSAN: uninit-value in IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline] BUG: KMSAN: uninit-value in ip_tunnel_rcv+0xed9/0x2ed0 net/ipv4/ip_tunnel.c:409 __INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline] INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline] IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline] ip_tunnel_rcv+0xed9/0x2ed0 net/ipv4/ip_tunnel.c:409 __ipgre_rcv+0x9bc/0xbc0 net/ipv4/ip_gre.c:389 ipgre_rcv net/ipv4/ip_gre.c:411 [inline] gre_rcv+0x423/0x19f0 net/ipv4/ip_gre.c:447 gre_rcv+0x2a4/0x390 net/ipv4/gre_demux.c:163 ip_protocol_deliver_rcu+0x264/0x1300 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x2b8/0x440 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:461 [inline] ip_rcv_finish net/ipv4/ip_input.c:449 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] ip_rcv+0x46f/0x760 net/ipv4/ip_input.c:569 __netif_receive_skb_one_core net/core/dev.c:5534 [inline] __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5648 netif_receive_skb_internal net/core/dev.c:5734 [inline] netif_receive_skb+0x58/0x660 net/core/dev.c:5793 tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1556 tun_get_user+0x53b9/0x66e0 drivers/net/tun.c:2009 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2055 call_write_iter include/linux/fs.h:2087 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xb6b/0x1520 fs/read_write.c:590 ksys_write+0x20f/0x4c0 fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:652 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
__alloc_pages+0x9a6/0xe00 mm/page_alloc.c:4590 alloc_pages_mpol+0x62b/0x9d0 mm/mempolicy.c:2133 alloc_pages+0x1be/0x1e0 mm/mempolicy.c:2204 skb_page_frag_refill+0x2bf/0x7c0 net/core/sock.c:2909 tun_build_skb drivers/net/tun.c:1686 [inline] tun_get_user+0xe0a/0x66e0 drivers/net/tun.c:1826 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2055 call_write_iter include/linux/fs.h:2087 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xb6b/0x1520 fs/read_write.c:590 ksys_write+0x20f/0x4c0 fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:652 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
--- net/ipv4/ip_tunnel.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
net/ipv4/ip_tunnel.c +14 -1
@@ -364,7 +364,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, bool log_ecn_error) {const struct iphdr *iph =ip_hdr (skb); -int err; +int nh, err;#ifdef CONFIG_NET_IPGRE_BROADCAST if (ipv4_is_multicast (iph->daddr)) {
@@ -390,8 +390,21 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, tunnel->i_seqno =ntohl (tpi->seq) +1 ; } +/* Save offset of outer header relative to skb->head, +* because we are going to reset the network header to the inner header +* and might change skb->head. +*/ + nh =skb_network_header (skb) - skb->head; +skb_set_network_header (skb, (tunnel->dev->type ==ARPHRD_ETHER ) ?ETH_HLEN :0 ); +if (!pskb_inet_may_pull (skb)) { +DEV_STATS_INC (tunnel->dev, rx_length_errors); +DEV_STATS_INC (tunnel->dev, rx_errors); + goto drop; + } + iph = (struct iphdr *)(skb->head + nh); + err =IP_ECN_decapsulate (iph, skb);if (unlikely (err)) {if (log_ecn_error)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 215/451 net: phy: fix phy_get_internal_delay accessing an empty array
In reply to Sasha LevinFrom: Kévin L'hôpital <[email protected]>
[ Upstream commit 4469c0c5b14a0919f5965c7ceac96b523eb57b79 ]
The phy_get_internal_delay function could try to access to an empty array in the case that the driver is calling phy_get_internal_delay without defining delay_values and rx-internal-delay-ps or tx-internal-delay-ps is defined to 0 in the device-tree. This will lead to "unable to handle kernel NULL pointer dereference at virtual address 0". To avoid this kernel oops, the test should be delay
Quoted 1 line
= 0. As there is already delay < 0 test just before, the test could
only be size == 0.
--- drivers/net/phy/phy_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +1 -1
@@ -2893,7 +2893,7 @@ s32 phy_get_internal_delay(struct phy_device *phydev, struct device *dev,if (delay <0 )return delay; -if (delay && size ==0 ) +if (size ==0 )return delay;if (delay < delay_values[0 ] || delay > delay_values[size -1 ]) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 216/451 net: hns3: fix wrong judgment condition issue
In reply to Sasha LevinFrom: Jijie Shao <[email protected]>
[ Upstream commit 07a1d6dc90baedcf5d713e2b003b9e387130ee30 ]
In hns3_dcbnl_ieee_delapp, should check ieee_delapp not ieee_setapp. This path fix the wrong judgment.
--- drivers/net/ethernet/hisilicon/hns3/hns3_dcbnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_dcbnl.c +1 -1
@@ -76,7 +76,7 @@ static int hns3_dcbnl_ieee_delapp(struct net_device *ndev, struct dcb_app *app)if (hns3_nic_resetting (ndev))return -EBUSY ; -if (h->kinfo.dcb_ops->ieee_setapp) +if (h->kinfo.dcb_ops->ieee_delapp)return h->kinfo.dcb_ops->ieee_delapp (h, app);return -EOPNOTSUPP ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 217/451 net: hns3: fix kernel crash when 1588 is received on HIP08 devices
In reply to Sasha LevinFrom: Yonglong Liu <[email protected]>
[ Upstream commit 0fbcf2366ba9888cf02eda23e35fde7f7fcc07c3 ]
The HIP08 devices does not register the ptp devices, so the hdev->ptp is NULL, but the hardware can receive 1588 messages, and set the HNS3_RXD_TS_VLD_B bit, so, if match this case, the access of hdev->ptp->flags will cause a kernel crash:
[ 5888.946472] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 [ 5888.946475] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 ... [ 5889.266118] pc : hclge_ptp_get_rx_hwts+0x40/0x170 [hclge] [ 5889.272612] lr : hclge_ptp_get_rx_hwts+0x34/0x170 [hclge] [ 5889.279101] sp : ffff800012c3bc50 [ 5889.283516] x29: ffff800012c3bc50 x28: ffff2040002be040 [ 5889.289927] x27: ffff800009116484 x26: 0000000080007500 [ 5889.296333] x25: 0000000000000000 x24: ffff204001c6f000 [ 5889.302738] x23: ffff204144f53c00 x22: 0000000000000000 [ 5889.309134] x21: 0000000000000000 x20: ffff204004220080 [ 5889.315520] x19: ffff204144f53c00 x18: 0000000000000000 [ 5889.321897] x17: 0000000000000000 x16: 0000000000000000 [ 5889.328263] x15: 0000004000140ec8 x14: 0000000000000000 [ 5889.334617] x13: 0000000000000000 x12: 00000000010011df [ 5889.340965] x11: bbfeff4d22000000 x10: 0000000000000000 [ 5889.347303] x9 : ffff800009402124 x8 : 0200f78811dfbb4d [ 5889.353637] x7 : 2200000000191b01 x6 : ffff208002a7d480 [ 5889.359959] x5 : 0000000000000000 x4 : 0000000000000000 [ 5889.366271] x3 : 0000000000000000 x2 : 0000000000000000 [ 5889.372567] x1 : 0000000000000000 x0 : ffff20400095c080 [ 5889.378857] Call trace: [ 5889.382285] hclge_ptp_get_rx_hwts+0x40/0x170 [hclge] [ 5889.388304] hns3_handle_bdinfo+0x324/0x410 [hns3] [ 5889.394055] hns3_handle_rx_bd+0x60/0x150 [hns3] [ 5889.399624] hns3_clean_rx_ring+0x84/0x170 [hns3] [ 5889.405270] hns3_nic_common_poll+0xa8/0x220 [hns3] [ 5889.411084] napi_poll+0xcc/0x264 [ 5889.415329] net_rx_action+0xd4/0x21c [ 5889.419911] __do_softirq+0x130/0x358 [ 5889.424484] irq_exit+0x134/0x154 [ 5889.428700] __handle_domain_irq+0x88/0xf0 [ 5889.433684] gic_handle_irq+0x78/0x2c0 [ 5889.438319] el1_irq+0xb8/0x140 [ 5889.442354] arch_cpu_idle+0x18/0x40 [ 5889.446816] default_idle_call+0x5c/0x1c0 [ 5889.451714] cpuidle_idle_call+0x174/0x1b0 [ 5889.456692] do_idle+0xc8/0x160 [ 5889.460717] cpu_startup_entry+0x30/0xfc [ 5889.465523] secondary_start_kernel+0x158/0x1ec [ 5889.470936] Code: 97ffab78 f9411c14 91408294 f9457284 (f9400c80) [ 5889.477950] SMP: stopping secondary CPUs [ 5890.514626] SMP: failed to stop secondary CPUs 0-69,71-95 [ 5890.522951] Starting crashdump kernel...
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +1 -1
@@ -120,7 +120,7 @@ void hclge_ptp_get_rx_hwts(struct hnae3_handle *handle, struct sk_buff *skb,u64 ns = nsec;u32 sec_h; -if (!test_bit (HCLGE_PTP_FLAG_RX_EN , &hdev->ptp->flags)) +if (!hdev->ptp || !test_bit (HCLGE_PTP_FLAG_RX_EN , &hdev->ptp->flags))return ;/* Since the BD does not have enough space for the higher 16 bits of
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 218/451 net: hns3: fix port duplex configure error in IMP reset
In reply to Sasha LevinFrom: Jie Wang <[email protected]>
[ Upstream commit 11d80f79dd9f871a52feba4bf24b5ac39f448eb7 ]
Currently, the mac port is fixed to configured as full dplex mode in hclge_mac_init() when driver initialization or reset restore. Users may change the mode to half duplex with ethtool, so it may cause the user configuration dropped after reset.
To fix it, don't change the duplex mode when resetting.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +4 -1
@@ -2990,7 +2990,10 @@ static int hclge_mac_init(struct hclge_dev *hdev)int ret; hdev->support_sfp_query = true; - hdev->hw.mac.duplex =HCLGE_MAC_FULL ; + +if (!test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) + hdev->hw.mac.duplex =HCLGE_MAC_FULL ; + ret =hclge_cfg_mac_speed_dup_hw (hdev, hdev->hw.mac.speed, hdev->hw.mac.duplex, hdev->hw.mac.lane_num);if (ret)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 219/451 Bluetooth: MGMT: Fix always using HCI_MAX_AD_LENGTH
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 112b5090c21905531314fee41f691f0317bbf4f6 ]
HCI_MAX_AD_LENGTH shall only be used if the controller doesn't support extended advertising, otherwise HCI_MAX_EXT_AD_LENGTH shall be used instead.
Stable-dep-of: 2ab3e8d67fc1 ("Bluetooth: Fix eir name length")
--- include/net/bluetooth/hci_core.h | 4 ++++ net/bluetooth/hci_event.c | 12 +++++++----- net/bluetooth/mgmt.c | 6 +++--- 3 files changed, 14 insertions(+), 8 deletions(-)
include/net/bluetooth/hci_core.h +4 -0
@@ -1710,6 +1710,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn);/* Extended advertising support */ #define ext_adv_capable (dev) (((dev)->le_features[1] & HCI_LE_EXT_ADV)) +/* Maximum advertising length */ +#define max_adv_len (dev) \ + (ext_adv_capable(dev) ? HCI_MAX_EXT_AD_LENGTH : HCI_MAX_AD_LENGTH) +/* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 1789: * * C24: Mandatory if the LE Controller supports Connection State and either
net/bluetooth/hci_event.c +7 -5
@@ -1761,7 +1761,7 @@ static void store_pending_adv_report(struct hci_dev *hdev, bdaddr_t *bdaddr, {struct discovery_state *d = &hdev->discovery; -if (len >HCI_MAX_AD_LENGTH ) +if (len >max_adv_len (hdev))return ;bacpy (&d->last_adv_addr, bdaddr);
@@ -6240,8 +6240,9 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,return ; } -if (!ext_adv && len >HCI_MAX_AD_LENGTH ) { -bt_dev_err_ratelimited (hdev,"legacy adv larger than 31 bytes" ); +if (len >max_adv_len (hdev)) { +bt_dev_err_ratelimited (hdev, +"adv larger than maximum supported" );return ; }
@@ -6306,7 +6307,8 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,*/ conn =check_pending_le_conn (hdev, bdaddr, bdaddr_type, bdaddr_resolved, type); -if (!ext_adv && conn && type ==LE_ADV_IND && len <=HCI_MAX_AD_LENGTH ) { +if (!ext_adv && conn && type ==LE_ADV_IND && + len <=max_adv_len (hdev)) {/* Store report for later inclusion by * mgmt_device_connected */
@@ -6447,7 +6449,7 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, void *data, info->length + 1))break ; -if (info->length <=HCI_MAX_AD_LENGTH ) { +if (info->length <=max_adv_len (hdev)) { rssi = info->data[info->length]; process_adv_report(hdev, info->type, &info->bdaddr, info->bdaddr_type, NULL, 0, rssi,
net/bluetooth/mgmt.c +3 -3
@@ -8436,8 +8436,8 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev, supported_flags =get_supported_adv_flags (hdev); rp->supported_flags =cpu_to_le32 (supported_flags); - rp->max_adv_data_len =HCI_MAX_AD_LENGTH ; - rp->max_scan_rsp_len =HCI_MAX_AD_LENGTH ; + rp->max_adv_data_len =max_adv_len (hdev); + rp->max_scan_rsp_len =max_adv_len (hdev); rp->max_instances = hdev->le_num_of_adv_sets; rp->num_instances = hdev->adv_instance_cnt;
@@ -8473,7 +8473,7 @@ static u8 calculate_name_len(struct hci_dev *hdev)static u8 tlv_data_max_len (struct hci_dev *hdev,u32 adv_flags,bool is_adv_data) { -u8 max_len =HCI_MAX_AD_LENGTH ; +u8 max_len =max_adv_len (hdev);if (is_adv_data) { if (adv_flags & (MGMT_ADV_FLAG_DISCOV |
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 220/451 Bluetooth: hci_core: Fix missing instances using HCI_MAX_AD_LENGTH
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit db08722fc7d46168fe31d9b8a7b29229dd959f9f ]
There a few instances still using HCI_MAX_AD_LENGTH instead of using max_adv_len which takes care of detecting what is the actual maximum length depending on if the controller supports EA or not.
Stable-dep-of: 2ab3e8d67fc1 ("Bluetooth: Fix eir name length")
--- include/net/bluetooth/hci_core.h | 6 +++--- net/bluetooth/eir.c | 2 +- net/bluetooth/mgmt.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
include/net/bluetooth/hci_core.h +3 -3
@@ -81,7 +81,7 @@ struct discovery_state {u8 last_adv_addr_type;s8 last_adv_rssi;u32 last_adv_flags; -u8 last_adv_data[HCI_MAX_AD_LENGTH ]; +u8 last_adv_data[HCI_MAX_EXT_AD_LENGTH ];u8 last_adv_data_len;bool report_invalid_rssi;bool result_filtering;
@@ -293,7 +293,7 @@ struct adv_pattern {__u8 ad_type;__u8 offset;__u8 length; -__u8 value[HCI_MAX_AD_LENGTH ]; +__u8 value[HCI_MAX_EXT_AD_LENGTH ]; };struct adv_rssi_thresholds {
@@ -727,7 +727,7 @@ struct hci_conn {__u16 le_conn_interval;__u16 le_conn_latency;__u16 le_supv_timeout; -__u8 le_adv_data[HCI_MAX_AD_LENGTH ]; +__u8 le_adv_data[HCI_MAX_EXT_AD_LENGTH ];__u8 le_adv_data_len;__u8 le_per_adv_data[HCI_MAX_PER_AD_LENGTH ];__u8 le_per_adv_data_len;
net/bluetooth/eir.c +1 -1
@@ -33,7 +33,7 @@ u8 eir_append_local_name(struct hci_dev *hdev, u8 *ptr, u8 ad_len)size_t complete_len;/* no space left for name (+ NULL + type + len) */ -if ((HCI_MAX_AD_LENGTH - ad_len) <HCI_MAX_SHORT_NAME_LENGTH +3 ) +if ((max_adv_len (hdev) - ad_len) <HCI_MAX_SHORT_NAME_LENGTH +3 )return ad_len;/* use complete name if present and fits */
net/bluetooth/mgmt.c +3 -3
@@ -5378,9 +5378,9 @@ static u8 parse_adv_monitor_pattern(struct adv_monitor *m, u8 pattern_count,for (i =0 ; i < pattern_count; i++) { offset = patterns[i].offset; length = patterns[i].length; -if (offset >=HCI_MAX_AD_LENGTH || - length >HCI_MAX_AD_LENGTH || - (offset + length) >HCI_MAX_AD_LENGTH ) +if (offset >=HCI_MAX_EXT_AD_LENGTH || + length >HCI_MAX_EXT_AD_LENGTH || + (offset + length) >HCI_MAX_EXT_AD_LENGTH )return MGMT_STATUS_INVALID_PARAMS ; p =kmalloc (sizeof (*p),GFP_KERNEL );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 221/451 Bluetooth: Fix eir name length
In reply to Sasha LevinFrom: Frédéric Danis <[email protected]>
[ Upstream commit 2ab3e8d67fc1d4a7638b769cf83023ec209fc0a9 ]
According to Section 1.2 of Core Specification Supplement Part A the complete or short name strings are defined as utf8s, which should not include the trailing NULL for variable length array as defined in Core Specification Vol1 Part E Section 2.9.3.
Removing the trailing NULL allows PTS to retrieve the random address based on device name, e.g. for SM/PER/KDU/BV-02-C, SM/PER/KDU/BV-08-C or GAP/BROB/BCST/BV-03-C.
--- net/bluetooth/eir.c | 29 +++++++---------------------- net/bluetooth/mgmt.c | 2 +- 2 files changed, 8 insertions(+), 23 deletions(-)
net/bluetooth/eir.c +7 -22
@@ -13,48 +13,33 @@#define PNP_INFO_SVCLASS_ID 0x1200 -static u8 eir_append_name (u8 *eir,u16 eir_len,u8 type,u8 *data,u8 data_len) -{ -u8 name[HCI_MAX_SHORT_NAME_LENGTH +1 ]; - -/* If data is already NULL terminated just pass it directly */ -if (data[data_len -1 ] =='\0' ) -return eir_append_data (eir, eir_len, type, data, data_len); - -memcpy (name, data,HCI_MAX_SHORT_NAME_LENGTH ); - name[HCI_MAX_SHORT_NAME_LENGTH ] ='\0' ; - -return eir_append_data (eir, eir_len, type, name,sizeof (name)); -} -u8 eir_append_local_name (struct hci_dev *hdev,u8 *ptr,u8 ad_len) {size_t short_len;size_t complete_len; -/* no space left for name (+ NULL + type + len) */ -if ((max_adv_len (hdev) - ad_len) <HCI_MAX_SHORT_NAME_LENGTH +3 ) +/* no space left for name (+ type + len) */ +if ((max_adv_len (hdev) - ad_len) <HCI_MAX_SHORT_NAME_LENGTH +2 )return ad_len;/* use complete name if present and fits */ complete_len =strnlen (hdev->dev_name,sizeof (hdev->dev_name));if (complete_len && complete_len <=HCI_MAX_SHORT_NAME_LENGTH ) -return eir_append_name (ptr, ad_len,EIR_NAME_COMPLETE , - hdev->dev_name, complete_len +1 ); +return eir_append_data (ptr, ad_len,EIR_NAME_COMPLETE , + hdev->dev_name, complete_len);/* use short name if present */ short_len =strnlen (hdev->short_name,sizeof (hdev->short_name));if (short_len) -return eir_append_name (ptr, ad_len,EIR_NAME_SHORT , +return eir_append_data (ptr, ad_len,EIR_NAME_SHORT , hdev->short_name, - short_len ==HCI_MAX_SHORT_NAME_LENGTH ? - short_len : short_len +1 ); + short_len);/* use shortened full name if present, we already know that name * is longer then HCI_MAX_SHORT_NAME_LENGTH */ if (complete_len) -return eir_append_name (ptr, ad_len,EIR_NAME_SHORT , +return eir_append_data (ptr, ad_len,EIR_NAME_SHORT , hdev->dev_name,HCI_MAX_SHORT_NAME_LENGTH );
net/bluetooth/mgmt.c +1 -1
@@ -8465,7 +8465,7 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev,static u8 calculate_name_len (struct hci_dev *hdev) { -u8 buf[HCI_MAX_SHORT_NAME_LENGTH +3 ]; +u8 buf[HCI_MAX_SHORT_NAME_LENGTH +2 ];/* len + type + name */ return eir_append_local_name (hdev, buf,0 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 222/451 net: phy: dp83822: Fix RGMII TX delay configuration
In reply to Sasha LevinFrom: Tim Pambor <[email protected]>
[ Upstream commit c8a5c731fd1223090af57da33838c671a7fc6a78 ]
The logic for enabling the TX clock shift is inverse of enabling the RX clock shift. The TX clock shift is disabled when DP83822_TX_CLK_SHIFT is set. Correct the current behavior and always write the delay configuration to ensure consistent delay settings regardless of bootloader configuration.
Reference: https://www.ti.com/lit/ds/symlink/dp83822i.pdf p. 69
--- drivers/net/phy/dp83822.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
drivers/net/phy/dp83822.c +20 -17
@@ -380,7 +380,7 @@ static int dp83822_config_init(struct phy_device *phydev) {struct dp83822_private *dp83822 = phydev->priv;struct device *dev = &phydev->mdio.dev; -int rgmii_delay; +int rgmii_delay =0 ;s32 rx_int_delay;s32 tx_int_delay;int err =0 ;
@@ -390,30 +390,33 @@ static int dp83822_config_init(struct phy_device *phydev) rx_int_delay =phy_get_internal_delay (phydev, dev,NULL ,0 , true); -if (rx_int_delay <=0 ) - rgmii_delay =0 ; -else - rgmii_delay =DP83822_RX_CLK_SHIFT ; +/* Set DP83822_RX_CLK_SHIFT to enable rx clk internal delay */ +if (rx_int_delay >0 ) + rgmii_delay |=DP83822_RX_CLK_SHIFT ; tx_int_delay =phy_get_internal_delay (phydev, dev,NULL ,0 , false); + +/* Set DP83822_TX_CLK_SHIFT to disable tx clk internal delay */ if (tx_int_delay <=0 ) - rgmii_delay &= ~DP83822_TX_CLK_SHIFT ; -else rgmii_delay |=DP83822_TX_CLK_SHIFT ; -if (rgmii_delay) { - err =phy_set_bits_mmd (phydev,DP83822_DEVADDR , -MII_DP83822_RCSR , rgmii_delay); -if (err) -return err; - } + err =phy_modify_mmd (phydev,DP83822_DEVADDR ,MII_DP83822_RCSR , +DP83822_RX_CLK_SHIFT |DP83822_TX_CLK_SHIFT , rgmii_delay); +if (err) +return err; + + err =phy_set_bits_mmd (phydev,DP83822_DEVADDR , +MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); -phy_set_bits_mmd (phydev,DP83822_DEVADDR , -MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); +if (err) +return err; }else { -phy_clear_bits_mmd (phydev,DP83822_DEVADDR , -MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); + err =phy_clear_bits_mmd (phydev,DP83822_DEVADDR , +MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); + +if (err) +return err; }if (dp83822->fx_enabled) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 223/451 OPP: debugfs: Fix warning around icc_get_name()
In reply to Sasha LevinFrom: Viresh Kumar <[email protected]>
[ Upstream commit 28330ceb953e39880ea77da4895bb902a1244860 ]
If the kernel isn't built with interconnect support, icc_get_name() returns NULL and we get following warning:
drivers/opp/debugfs.c: In function 'bw_name_read':drivers/opp/debugfs.c:43:42: error: '%.62s' directive argument is null [-Werror=format-overflow=]
i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path));
Fix it.
--- drivers/opp/debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/opp/debugfs.c +4 -2
@@ -37,10 +37,12 @@ static ssize_t bw_name_read(struct file *fp, char __user *userbuf, size_t count, loff_t *ppos) { struct icc_path *path = fp->private_data; +const char *name =icc_get_name (path);char buf[64 ]; -int i; +int i =0 ; - i =scnprintf (buf,sizeof (buf),"%.62s\n" ,icc_get_name (path)); +if (name) + i =scnprintf (buf,sizeof (buf),"%.62s\n" , name);return simple_read_from_buffer (userbuf, count, ppos, buf, i); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 224/451 tcp: fix incorrect parameter validation in the do_tcp_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 716edc9706deb3bb2ff56e2eeb83559cea8f22db ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/ipv4/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +2 -2
@@ -4102,11 +4102,11 @@ int do_tcp_getsockopt(struct sock *sk, int level,if (copy_from_sockptr (&len, optlen,sizeof (int )))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int)); -if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); +switch (optname) {case TCP_MAXSEG : val = tp->mss_cache;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 225/451 ipmr: fix incorrect parameter validation in the ip_mroute_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 5c3be3e0eb44b7f978bb6cbb20ad956adb93f736 ]
The 'olr' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'olr' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/ipv4/ipmr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/ipmr.c +3 -1
@@ -1581,9 +1581,11 @@ int ip_mroute_getsockopt(struct sock *sk, int optname, sockptr_t optval,if (copy_from_sockptr (&olr, optlen,sizeof (int )))return -EFAULT ; - olr = min_t(unsigned int, olr, sizeof(int));if (olr <0 )return -EINVAL ; + + olr = min_t(unsigned int, olr, sizeof(int)); +if (copy_to_sockptr (optlen, &olr,sizeof (int )))return -EFAULT ;if (copy_to_sockptr (optval, &val, olr))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 226/451 l2tp: fix incorrect parameter validation in the pppol2tp_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 955e9876ba4ee26eeaab1b13517f5b2c88e73d55 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/l2tp/l2tp_ppp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/l2tp/l2tp_ppp.c +2 -2
@@ -1356,11 +1356,11 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, int optname,if (get_user (len, optlen))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int)); -if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); + err = -ENOTCONN ;if (!sk->sk_user_data) goto end;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 227/451 udp: fix incorrect parameter validation in the udp_lib_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 4bb3ba7b74fceec6f558745b25a43c6521cf5506 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/ipv4/udp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/udp.c +2 -2
@@ -2790,11 +2790,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname,if (get_user (len, optlen))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int)); -if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); +switch (optname) {case UDP_CORK : val =udp_test_bit (CORK , sk);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 228/451 net: kcm: fix incorrect parameter validation in the kcm_getsockopt) function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 3ed5f415133f9b7518fbe55ba9ae9a3f5e700929 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/kcm/kcmsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/kcm/kcmsock.c +2 -1
@@ -1274,10 +1274,11 @@ static int kcm_getsockopt(struct socket *sock, int level, int optname,if (get_user (len, optlen))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int));if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); +switch (optname) {case KCM_RECV_DISABLE : val = kcm->rx_disabled;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 229/451 net/x25: fix incorrect parameter validation in the x25_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit d6eb8de2015f0c24822e47356f839167ebde2945 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/x25/af_x25.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/x25/af_x25.c +2 -2
@@ -460,12 +460,12 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,if (get_user (len, optlen)) goto out; - len = min_t(unsigned int, len, sizeof(int)); - rc = -EINVAL ;if (len <0 ) goto out; + len = min_t(unsigned int, len, sizeof(int)); + rc = -EFAULT ;if (put_user (len, optlen)) goto out;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 230/451 nfp: flower: handle acti_netdevs allocation failure
In reply to Sasha LevinFrom: Duoming Zhou <[email protected]>
[ Upstream commit 84e95149bd341705f0eca6a7fcb955c548805002 ]
The kmalloc_array() in nfp_fl_lag_do_work() will return null, if the physical memory has run out. As a result, if we dereference the acti_netdevs, the null pointer dereference bugs will happen.
This patch adds a check to judge whether allocation failure occurs. If it happens, the delayed work will be rescheduled and try again.
--- drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +5 -0
@@ -308,6 +308,11 @@ static void nfp_fl_lag_do_work(struct work_struct *work) acti_netdevs =kmalloc_array (entry->slave_cnt,sizeof (*acti_netdevs),GFP_KERNEL ); +if (!acti_netdevs) { +schedule_delayed_work (&lag->work, +NFP_FL_LAG_DELAY ); +continue ; + }/* Include sanity check in the loop. It may be that a bond has * changed between processing the last notification and the
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 231/451 bpf: hardcode BPF_PROG_PACK_SIZE to 2MB * num_possible_nodes()
In reply to Sasha LevinFrom: Puranjay Mohan <[email protected]>
[ Upstream commit d6170e4aaf86424c24ce06e355b4573daa891b17 ]
On some architectures like ARM64, PMD_SIZE can be really large in some configurations. Like with CONFIG_ARM64_64K_PAGES=y the PMD_SIZE is 512MB.
Use 2MB * num_possible_nodes() as the size for allocations done through the prog pack allocator. On most architectures, PMD_SIZE will be equal to 2MB in case of 4KB pages and will be greater than 2MB for bigger page sizes.
Message-ID: <[email protected]>
--- kernel/bpf/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/bpf/core.c +6 -1
@@ -857,7 +857,12 @@ static LIST_HEAD(pack_list);* CONFIG_MMU=n. Use PAGE_SIZE in these cases. */ #ifdef PMD_SIZE -#define BPF_PROG_PACK_SIZE (PMD_SIZE * num_possible_nodes()) +/* PMD_SIZE is really big for some archs. It doesn't make sense to +* reserve too much memory in one allocation. Hardcode BPF_PROG_PACK_SIZE to +* 2MiB * num_possible_nodes(). On most architectures PMD_SIZE will be +* greater than or equal to 2MB. +*/ +#define BPF_PROG_PACK_SIZE (SZ_2M * num_possible_nodes())#else #define BPF_PROG_PACK_SIZE PAGE_SIZE#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 232/451 dm raid: fix false positive for requeue needed during reshape
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit b25b8f4b8ecef0f48c05f0c3572daeabefe16526 ]
An empty flush doesn't have a payload, so it should never be looked at when considering to possibly requeue a bio for the case when a reshape is in progress.
--- drivers/md/dm-raid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-raid.c +2 -2
@@ -3325,14 +3325,14 @@ static int raid_map(struct dm_target *ti, struct bio *bio)struct mddev *mddev = &rs->md;/* -* If we're reshaping to add disk(s)), ti->len and +* If we're reshaping to add disk(s), ti->len and * mddev->array_sectors will differ during the process * (ti->len > mddev->array_sectors), so we have to requeue * bios with addresses > mddev->array_sectors here or * there will occur accesses past EOD of the component * data images thus erroring the raid set. */ -if (unlikely (bio_end_sector (bio) > mddev->array_sectors)) +if (unlikely (bio_has_data (bio) &&bio_end_sector (bio) > mddev->array_sectors))return DM_MAPIO_REQUEUE ;md_handle_request (mddev, bio);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 233/451 dm: call the resume method on internal suspend
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 65e8fbde64520001abf1c8d0e573561b4746ef38 ]
There is this reported crash when experimenting with the lvm2 testsuite. The list corruption is caused by the fact that the postsuspend and resume methods were not paired correctly; there were two consecutive calls to the origin_postsuspend function. The second call attempts to remove the "hash_list" entry from a list, while it was already removed by the first call.
Fix __dm_internal_resume so that it calls the preresume and resume methods of the table's targets.
If a preresume method of some target fails, we are in a tricky situation. We can't return an error because dm_internal_resume isn't supposed to return errors. We can't return success, because then the "resume" and "postsuspend" methods would not be paired correctly. So, we set the DMF_SUSPENDED flag and we fake normal suspend - it may confuse userspace tools, but it won't cause a kernel crash.
------------[ cut here ]------------ kernel BUG at lib/list_debug.c:56! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 1 PID: 8343 Comm: dmsetup Not tainted 6.8.0-rc6 #4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 RIP: 0010:__list_del_entry_valid_or_report+0x77/0xc0 <snip> RSP: 0018:ffff8881b831bcc0 EFLAGS: 00010282 RAX: 000000000000004e RBX: ffff888143b6eb80 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffffffff819053d0 RDI: 00000000ffffffff RBP: ffff8881b83a3400 R08: 00000000fffeffff R09: 0000000000000058 R10: 0000000000000000 R11: ffffffff81a24080 R12: 0000000000000001 R13: ffff88814538e000 R14: ffff888143bc6dc0 R15: ffffffffa02e4bb0 FS: 00000000f7c0f780(0000) GS:ffff8893f0a40000(0000) knlGS:0000000000000000 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 0000000057fb5000 CR3: 0000000143474000 CR4: 00000000000006b0 Call Trace: <TASK> ? die+0x2d/0x80 ? do_trap+0xeb/0xf0 ? __list_del_entry_valid_or_report+0x77/0xc0 ? do_error_trap+0x60/0x80 ? __list_del_entry_valid_or_report+0x77/0xc0 ? exc_invalid_op+0x49/0x60 ? __list_del_entry_valid_or_report+0x77/0xc0 ? asm_exc_invalid_op+0x16/0x20 ? table_deps+0x1b0/0x1b0 [dm_mod] ? __list_del_entry_valid_or_report+0x77/0xc0 origin_postsuspend+0x1a/0x50 [dm_snapshot] dm_table_postsuspend_targets+0x34/0x50 [dm_mod] dm_suspend+0xd8/0xf0 [dm_mod] dev_suspend+0x1f2/0x2f0 [dm_mod] ? table_deps+0x1b0/0x1b0 [dm_mod] ctl_ioctl+0x300/0x5f0 [dm_mod] dm_compat_ctl_ioctl+0x7/0x10 [dm_mod] __x64_compat_sys_ioctl+0x104/0x170 do_syscall_64+0x184/0x1b0 entry_SYSCALL_64_after_hwframe+0x46/0x4e RIP: 0033:0xf7e6aead <snip> ---[ end trace 0000000000000000 ]---
--- drivers/md/dm.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/md/dm.c +20 -6
@@ -2897,6 +2897,9 @@ static void __dm_internal_suspend(struct mapped_device *md, unsigned int suspendstatic void __dm_internal_resume (struct mapped_device *md) { +int r; +struct dm_table *map; +BUG_ON (!md->internal_suspend_count);if (--md->internal_suspend_count)
@@ -2905,12 +2908,23 @@ static void __dm_internal_resume(struct mapped_device *md)if (dm_suspended_md (md)) goto done;/* resume from nested suspend */ -/* -* NOTE: existing callers don't need to call dm_table_resume_targets -* (which may fail -- so best to avoid it for now by passing NULL map) -*/ - (void )__dm_resume (md,NULL ); - + map =rcu_dereference_protected (md->map,lockdep_is_held (&md->suspend_lock)); + r =__dm_resume (md, map); +if (r) { +/* +* If a preresume method of some target failed, we are in a +* tricky situation. We can't return an error to the caller. We +* can't fake success because then the "resume" and +* "postsuspend" methods would not be paired correctly, and it +* would break various targets, for example it would cause list +* corruption in the "origin" target. +* +* So, we fake normal suspend here, to make sure that the +* "resume" and "postsuspend" methods will be paired correctly. +*/ +DMERR ("Preresume method failed: %d" , r); +set_bit (DMF_SUSPENDED , &md->flags); + } done:clear_bit (DMF_SUSPENDED_INTERNALLY , &md->flags);smp_mb__after_atomic ();
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 234/451 drm/tegra: dsi: Add missing check for of_find_device_by_node
In reply to Sasha LevinFrom: Chen Ni <[email protected]>
[ Upstream commit afe6fcb9775882230cd29b529203eabd5d2a638d ]
Add check for the return value of of_find_device_by_node() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/gpu/drm/tegra/dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/dsi.c +3 -1
@@ -1534,9 +1534,11 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) np =of_parse_phandle (dsi->dev->of_node,"nvidia,ganged-mode" ,0 );if (np) {struct platform_device *gangster =of_find_device_by_node (np); +of_node_put (np); +if (!gangster) +return -EPROBE_DEFER ; dsi->slave =platform_get_drvdata (gangster); -of_node_put (np);if (!dsi->slave) {put_device (&gangster->dev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 235/451 drm/tegra: dpaux: Fix PM disable depth imbalance in tegra_dpaux_probe
In reply to Sasha LevinFrom: Zhang Shurong <[email protected]>
[ Upstream commit 0800880f4eb789b7d299db40f2e86e056bd33a4e ]
The pm_runtime_enable function increases the power disable depth, which means that we must perform a matching decrement on the error handling path to maintain balance within the given context. Additionally, we need to address the same issue for pm_runtime_get_sync. We fix this by invoking pm_runtime_disable and pm_runtime_put_sync when error returns.
--- drivers/gpu/drm/tegra/dpaux.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/tegra/dpaux.c +10 -4
@@ -524,7 +524,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)if (err <0 ) {dev_err (dpaux->dev,"failed to request IRQ#%u: %d\n" , dpaux->irq, err); -return err; + goto err_pm_disable; }disable_irq (dpaux->irq);
@@ -544,7 +544,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)*/ err =tegra_dpaux_pad_config (dpaux,DPAUX_PADCTL_FUNC_I2C );if (err <0 ) -return err; + goto err_pm_disable;#ifdef CONFIG_GENERIC_PINCONF dpaux->desc.name =dev_name (&pdev->dev);
@@ -557,7 +557,8 @@ static int tegra_dpaux_probe(struct platform_device *pdev) dpaux->pinctrl =devm_pinctrl_register (&pdev->dev, &dpaux->desc, dpaux);if (IS_ERR (dpaux->pinctrl)) {dev_err (&pdev->dev,"failed to register pincontrol\n" ); -return PTR_ERR (dpaux->pinctrl); + err =PTR_ERR (dpaux->pinctrl); + goto err_pm_disable; }#endif /* enable and clear all interrupts */
@@ -573,10 +574,15 @@ static int tegra_dpaux_probe(struct platform_device *pdev) err =devm_of_dp_aux_populate_ep_devices (&dpaux->aux);if (err <0 ) {dev_err (dpaux->dev,"failed to populate AUX bus: %d\n" , err); -return err; + goto err_pm_disable; }return 0 ; + +err_pm_disable: +pm_runtime_put_sync (&pdev->dev); +pm_runtime_disable (&pdev->dev); +return err; }static int tegra_dpaux_remove (struct platform_device *pdev)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 236/451 drm/tegra: dsi: Make use of the helper function dev_err_probe()
In reply to Sasha LevinFrom: Cai Huoqing <[email protected]>
[ Upstream commit fc75e4fcbd1e4252a0481ebb23cd4516c127a8e2 ]
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, the error value gets printed.
Stable-dep-of: 830c1ded3563 ("drm/tegra: dsi: Fix some error handling paths in tegra_dsi_probe()")
--- drivers/gpu/drm/tegra/dsi.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/gpu/drm/tegra/dsi.c +12 -16
@@ -1591,28 +1591,24 @@ static int tegra_dsi_probe(struct platform_device *pdev) } dsi->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (dsi->clk)) { -dev_err (&pdev->dev,"cannot get DSI clock\n" ); -return PTR_ERR (dsi->clk); - } +if (IS_ERR (dsi->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk), +"cannot get DSI clock\n" ); dsi->clk_lp =devm_clk_get (&pdev->dev,"lp" ); -if (IS_ERR (dsi->clk_lp)) { -dev_err (&pdev->dev,"cannot get low-power clock\n" ); -return PTR_ERR (dsi->clk_lp); - } +if (IS_ERR (dsi->clk_lp)) +return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_lp), +"cannot get low-power clock\n" ); dsi->clk_parent =devm_clk_get (&pdev->dev,"parent" ); -if (IS_ERR (dsi->clk_parent)) { -dev_err (&pdev->dev,"cannot get parent clock\n" ); -return PTR_ERR (dsi->clk_parent); - } +if (IS_ERR (dsi->clk_parent)) +return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_parent), +"cannot get parent clock\n" ); dsi->vdd =devm_regulator_get (&pdev->dev,"avdd-dsi-csi" ); -if (IS_ERR (dsi->vdd)) { -dev_err (&pdev->dev,"cannot get VDD supply\n" ); -return PTR_ERR (dsi->vdd); - } +if (IS_ERR (dsi->vdd)) +return dev_err_probe (&pdev->dev,PTR_ERR (dsi->vdd), +"cannot get VDD supply\n" ); err =tegra_dsi_setup_clocks (dsi);if (err <0 ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 237/451 drm/tegra: dsi: Fix some error handling paths in tegra_dsi_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 830c1ded356369cd1303e8bb87ce3fea6e744de8 ]
If an error occurs after calling tegra_output_probe(), tegra_output_remove() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/dsi.c | 54 ++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 19 deletions(-)
drivers/gpu/drm/tegra/dsi.c +35 -19
@@ -1586,44 +1586,58 @@ static int tegra_dsi_probe(struct platform_device *pdev)if (!pdev->dev.pm_domain) { dsi->rst =devm_reset_control_get (&pdev->dev,"dsi" ); -if (IS_ERR (dsi->rst)) -return PTR_ERR (dsi->rst); +if (IS_ERR (dsi->rst)) { + err =PTR_ERR (dsi->rst); + goto remove; + } } dsi->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (dsi->clk)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk), -"cannot get DSI clock\n" ); +if (IS_ERR (dsi->clk)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk), +"cannot get DSI clock\n" ); + goto remove; + } dsi->clk_lp =devm_clk_get (&pdev->dev,"lp" ); -if (IS_ERR (dsi->clk_lp)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_lp), -"cannot get low-power clock\n" ); +if (IS_ERR (dsi->clk_lp)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_lp), +"cannot get low-power clock\n" ); + goto remove; + } dsi->clk_parent =devm_clk_get (&pdev->dev,"parent" ); -if (IS_ERR (dsi->clk_parent)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_parent), -"cannot get parent clock\n" ); +if (IS_ERR (dsi->clk_parent)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_parent), +"cannot get parent clock\n" ); + goto remove; + } dsi->vdd =devm_regulator_get (&pdev->dev,"avdd-dsi-csi" ); -if (IS_ERR (dsi->vdd)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->vdd), -"cannot get VDD supply\n" ); +if (IS_ERR (dsi->vdd)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->vdd), +"cannot get VDD supply\n" ); + goto remove; + } err =tegra_dsi_setup_clocks (dsi);if (err <0 ) {dev_err (&pdev->dev,"cannot setup clocks\n" ); -return err; + goto remove; } regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); dsi->regs =devm_ioremap_resource (&pdev->dev, regs); -if (IS_ERR (dsi->regs)) -return PTR_ERR (dsi->regs); +if (IS_ERR (dsi->regs)) { + err =PTR_ERR (dsi->regs); + goto remove; + } dsi->mipi =tegra_mipi_request (&pdev->dev, pdev->dev.of_node); -if (IS_ERR (dsi->mipi)) -return PTR_ERR (dsi->mipi); +if (IS_ERR (dsi->mipi)) { + err =PTR_ERR (dsi->mipi); + goto remove; + } dsi->host.ops = &tegra_dsi_host_ops; dsi->host.dev = &pdev->dev;
@@ -1654,6 +1668,8 @@ static int tegra_dsi_probe(struct platform_device *pdev)mipi_dsi_host_unregister (&dsi->host); mipi_free:tegra_mipi_free (dsi->mipi); +remove: +tegra_output_remove (&dsi->output);return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 238/451 drm/tegra: dsi: Fix missing pm_runtime_disable() in the error handling path of tegra_dsi_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5286a9fc280c45b6b307ee1b07f7a997e042252c ]
If an error occurs after calling pm_runtime_enable(), pm_runtime_disable() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/dsi.c +1 -0
@@ -1665,6 +1665,7 @@ static int tegra_dsi_probe(struct platform_device *pdev)return 0 ; unregister: +pm_runtime_disable (&pdev->dev);mipi_dsi_host_unregister (&dsi->host); mipi_free:tegra_mipi_free (dsi->mipi);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 239/451 drm/tegra: hdmi: Convert to devm_platform_ioremap_resource()
In reply to Sasha LevinFrom: Yangtao Li <[email protected]>
[ Upstream commit faae5646c13f4697fd2ba29b10e38f9be5aa890a ]
Use devm_platform_ioremap_resource() to simplify code.
Stable-dep-of: 643ae131b859 ("drm/tegra: hdmi: Fix some error handling paths in tegra_hdmi_probe()")
--- drivers/gpu/drm/tegra/hdmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/tegra/hdmi.c +1 -3
@@ -1776,7 +1776,6 @@ static irqreturn_t tegra_hdmi_irq(int irq, void *data)static int tegra_hdmi_probe (struct platform_device *pdev) {struct tegra_hdmi *hdmi; -struct resource *regs;int err; hdmi =devm_kzalloc (&pdev->dev,sizeof (*hdmi),GFP_KERNEL );
@@ -1838,8 +1837,7 @@ static int tegra_hdmi_probe(struct platform_device *pdev)if (err <0 )return err; - regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - hdmi->regs =devm_ioremap_resource (&pdev->dev, regs); + hdmi->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (hdmi->regs))return PTR_ERR (hdmi->regs);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 240/451 drm/tegra: hdmi: Fix some error handling paths in tegra_hdmi_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 643ae131b8598fb2940c92c7d23fe62823a119c8 ]
If an error occurs after calling tegra_output_probe(), tegra_output_remove() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/hdmi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/drm/tegra/hdmi.c +13 -7
@@ -1838,12 +1838,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev)return err; hdmi->regs =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (hdmi->regs)) -return PTR_ERR (hdmi->regs); +if (IS_ERR (hdmi->regs)) { + err =PTR_ERR (hdmi->regs); + goto remove; + } err =platform_get_irq (pdev,0 );if (err <0 ) -return err; + goto remove; hdmi->irq = err;
@@ -1852,18 +1854,18 @@ static int tegra_hdmi_probe(struct platform_device *pdev)if (err <0 ) {dev_err (&pdev->dev,"failed to request IRQ#%u: %d\n" , hdmi->irq, err); -return err; + goto remove; }platform_set_drvdata (pdev, hdmi); err =devm_pm_runtime_enable (&pdev->dev);if (err) -return err; + goto remove; err =devm_tegra_core_dev_init_opp_table_common (&pdev->dev);if (err) -return err; + goto remove;INIT_LIST_HEAD (&hdmi->client.list); hdmi->client.ops = &hdmi_client_ops;
@@ -1873,10 +1875,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev)if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err); -return err; + goto remove; }return 0 ; + +remove: +tegra_output_remove (&hdmi->output); +return err; }static int tegra_hdmi_remove (struct platform_device *pdev)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 241/451 drm/tegra: rgb: Fix some error handling paths in tegra_dc_rgb_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit bc456b5d93dbfdbd89f2a036f4f3d8026595f9e4 ]
If an error occurs after calling tegra_output_probe(), tegra_output_remove() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/rgb.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/tegra/rgb.c +11 -5
@@ -214,26 +214,28 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc) rgb->clk =devm_clk_get (dc->dev,NULL );if (IS_ERR (rgb->clk)) {dev_err (dc->dev,"failed to get clock\n" ); -return PTR_ERR (rgb->clk); + err =PTR_ERR (rgb->clk); + goto remove; } rgb->clk_parent =devm_clk_get (dc->dev,"parent" );if (IS_ERR (rgb->clk_parent)) {dev_err (dc->dev,"failed to get parent clock\n" ); -return PTR_ERR (rgb->clk_parent); + err =PTR_ERR (rgb->clk_parent); + goto remove; } err =clk_set_parent (rgb->clk, rgb->clk_parent);if (err <0 ) {dev_err (dc->dev,"failed to set parent clock: %d\n" , err); -return err; + goto remove; } rgb->pll_d_out0 =clk_get_sys (NULL ,"pll_d_out0" );if (IS_ERR (rgb->pll_d_out0)) { err =PTR_ERR (rgb->pll_d_out0);dev_err (dc->dev,"failed to get pll_d_out0: %d\n" , err); -return err; + goto remove; }if (dc->soc->has_pll_d2_out0) {
@@ -241,13 +243,17 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)if (IS_ERR (rgb->pll_d2_out0)) { err =PTR_ERR (rgb->pll_d2_out0);dev_err (dc->dev,"failed to get pll_d2_out0: %d\n" , err); -return err; + goto remove; } } dc->rgb = &rgb->output;return 0 ; + +remove: +tegra_output_remove (&rgb->output); +return err; }int tegra_dc_rgb_remove (struct tegra_dc *dc)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 242/451 drm/tegra: rgb: Fix missing clk_put() in the error handling paths of tegra_dc_rgb_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 45c8034db47842b25a3ab6139d71e13b4e67b9b3 ]
If clk_get_sys(..., "pll_d2_out0") fails, the clk_get_sys() call must be undone.
Add the missing clk_put and a new 'put_pll_d_out0' label in the error handling path, and use it.
--- drivers/gpu/drm/tegra/rgb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/rgb.c +3 -1
@@ -243,7 +243,7 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)if (IS_ERR (rgb->pll_d2_out0)) { err =PTR_ERR (rgb->pll_d2_out0);dev_err (dc->dev,"failed to get pll_d2_out0: %d\n" , err); - goto remove; + goto put_pll; } }
@@ -251,6 +251,8 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)return 0 ; +put_pll: +clk_put (rgb->pll_d_out0); remove:tegra_output_remove (&rgb->output);return err;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 243/451 drm/tegra: output: Fix missing i2c_put_adapter() in the error handling paths of tegra_output_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 2db4578ef6ffb2b52115ca0ebf897b60ec559556 ]
If an error occurs after a successful of_get_i2c_adapter_by_node() call, it should be undone by a corresponding i2c_put_adapter().
Add the missing i2c_put_adapter() call.
--- drivers/gpu/drm/tegra/output.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/tegra/output.c +12 -4
@@ -139,8 +139,10 @@ int tegra_output_probe(struct tegra_output *output)GPIOD_IN , "HDMI hotplug detect");if (IS_ERR (output->hpd_gpio)) { -if (PTR_ERR (output->hpd_gpio) != -ENOENT ) -return PTR_ERR (output->hpd_gpio); +if (PTR_ERR (output->hpd_gpio) != -ENOENT ) { + err =PTR_ERR (output->hpd_gpio); + goto put_i2c; + } output->hpd_gpio =NULL ; }
@@ -149,7 +151,7 @@ int tegra_output_probe(struct tegra_output *output) err =gpiod_to_irq (output->hpd_gpio);if (err <0 ) {dev_err (output->dev,"gpiod_to_irq(): %d\n" , err); -return err; + goto put_i2c; } output->hpd_irq = err;
@@ -162,7 +164,7 @@ int tegra_output_probe(struct tegra_output *output)if (err <0 ) {dev_err (output->dev,"failed to request IRQ#%u: %d\n" , output->hpd_irq, err); -return err; + goto put_i2c; } output->connector.polled =DRM_CONNECTOR_POLL_HPD ;
@@ -176,6 +178,12 @@ int tegra_output_probe(struct tegra_output *output) }return 0 ; + +put_i2c: +if (output->ddc) +i2c_put_adapter (output->ddc); + +return err; }void tegra_output_remove (struct tegra_output *output)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 244/451 drm/rockchip: inno_hdmi: Fix video timing
In reply to Sasha LevinFrom: Alex Bee <[email protected]>
[ Upstream commit 47a145c03484d33e65d773169d5ca1b9fe2a492e ]
The controller wants the difference between *total and *sync_start in the HDMI_VIDEO_EXT_*DELAY registers. Otherwise the signal is very unstable for certain non-VIC modes. See downstream commit [0].
[0] https://github.com/rockchip-linux/kernel/commit/8eb559f2502c
--- drivers/gpu/drm/rockchip/inno_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/inno_hdmi.c +2 -2
@@ -411,7 +411,7 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi,hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HBLANK_L , value &0xFF );hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HBLANK_H , (value >>8 ) &0xFF ); - value = mode->hsync_start - mode->hdisplay; + value = mode->htotal - mode->hsync_start;hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HDELAY_L , value &0xFF );hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HDELAY_H , (value >>8 ) &0xFF );
@@ -426,7 +426,7 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi, value = mode->vtotal - mode->vdisplay;hdmi_writeb (hdmi,HDMI_VIDEO_EXT_VBLANK , value &0xFF ); - value = mode->vsync_start - mode->vdisplay; + value = mode->vtotal - mode->vsync_start;hdmi_writeb (hdmi,HDMI_VIDEO_EXT_VDELAY , value &0xFF ); value = mode->vsync_end - mode->vsync_start;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 245/451 drm: Don't treat 0 as -1 in drm_fixp2int_ceil
In reply to Sasha LevinFrom: Harry Wentland <[email protected]>
[ Upstream commit cf8837d7204481026335461629b84ac7f4538fa5 ]
Unit testing this in VKMS shows that passing 0 into this function returns -1, which is highly counter- intuitive. Fix it by checking whether the input is
Quoted 1 line
= 0 instead of > 0.
--- include/drm/drm_fixed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_fixed.h +1 -1
@@ -94,7 +94,7 @@ static inline int drm_fixp2int_round(s64 a)static inline int drm_fixp2int_ceil (s64 a) { -if (a >0 ) +if (a >=0 )return drm_fixp2int (a +DRM_FIXED_ALMOST_ONE );else return drm_fixp2int (a -DRM_FIXED_ALMOST_ONE );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 246/451 drm/vmwgfx: fix a memleak in vmw_gmrid_man_get_node
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 89709105a6091948ffb6ec2427954cbfe45358ce ]
When ida_alloc_max fails, resources allocated before should be freed, including *res allocated by kmalloc and ttm_resource_init.
--- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +4 -1
@@ -65,8 +65,11 @@ static int vmw_gmrid_man_get_node(struct ttm_resource_manager *man,ttm_resource_init (bo, place, *res); id =ida_alloc_max (&gman->gmr_ida, gman->max_gmr_ids -1 ,GFP_KERNEL ); -if (id <0 ) +if (id <0 ) { +ttm_resource_fini (man, *res); +kfree (*res);return id; + }spin_lock (&gman->lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 247/451 drm/rockchip: lvds: do not overwrite error code
In reply to Sasha LevinFrom: Quentin Schulz <[email protected]>
[ Upstream commit 79b09453c4e369ca81cfb670d0136d089e3b92f0 ]
ret variable stores the return value of drm_of_find_panel_or_bridge which can return error codes different from EPROBE_DEFER. Therefore, let's just return that error code instead of forcing it to EPROBE_DEFER.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +0 -1
@@ -578,7 +578,6 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, goto err_put_port; }else if (ret) {DRM_DEV_ERROR (dev,"failed to find panel and bridge node\n" ); - ret = -EPROBE_DEFER ; goto err_put_port; }if (lvds->panel)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 248/451 drm/rockchip: lvds: do not print scary message when probing defer
In reply to Sasha LevinFrom: Quentin Schulz <[email protected]>
[ Upstream commit 52d11c863ac92e36a0365249f7f6d27ac48c78bc ]
This scary message can misled the user into thinking something bad has happened and needs to be fixed, however it could simply be part of a normal boot process where EPROBE_DEFER is taken into account. Therefore, let's use dev_err_probe so that this message doesn't get shown (by default) when the return code is EPROBE_DEFER.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +1 -1
@@ -577,7 +577,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, ret = -EINVAL ; goto err_put_port; }else if (ret) { -DRM_DEV_ERROR (dev,"failed to find panel and bridge node\n" ); +dev_err_probe (dev, ret,"failed to find panel and bridge node\n" ); goto err_put_port; }if (lvds->panel)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 249/451 drm/panel-edp: use put_sync in unprepare
In reply to Sasha LevinFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit 49ddab089611ae5ddd0201ddbbf633da75bfcc25 ]
Some edp panel requires T10 (Delay from end of valid video data transmitted by the Source device to power-off) less than 500ms. Using autosuspend with delay set as 1000 violates this requirement.
Use put_sync_suspend in unprepare to meet the spec. For other cases (such as getting EDID), it still uses autosuspend.
--- drivers/gpu/drm/panel/panel-edp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +1 -2
@@ -413,8 +413,7 @@ static int panel_edp_unprepare(struct drm_panel *panel)if (!p->prepared)return 0 ; -pm_runtime_mark_last_busy (panel->dev); - ret =pm_runtime_put_autosuspend (panel->dev); + ret =pm_runtime_put_sync_suspend (panel->dev);if (ret <0 )return ret; p->prepared = false;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 250/451 drm/lima: fix a memleak in lima_heap_alloc
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 04ae3eb470e52a3c41babe85ff8cee195e4dcbea ]
When lima_vm_map_bo fails, the resources need to be deallocated, or there will be memleaks.
--- drivers/gpu/drm/lima/lima_gem.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/gpu/drm/lima/lima_gem.c +14 -9
@@ -75,29 +75,34 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) }else { bo->base.sgt =kmalloc (sizeof (*bo->base.sgt),GFP_KERNEL );if (!bo->base.sgt) { -sg_free_table (&sgt); -return -ENOMEM ; + ret = -ENOMEM ; + goto err_out0; } } ret =dma_map_sgtable (dev, &sgt,DMA_BIDIRECTIONAL ,0 ); -if (ret) { -sg_free_table (&sgt); -kfree (bo->base.sgt); - bo->base.sgt =NULL ; -return ret; - } +if (ret) + goto err_out1; *bo->base.sgt = sgt;if (vm) { ret =lima_vm_map_bo (vm, bo, old_size >>PAGE_SHIFT );if (ret) -return ret; + goto err_out2; } bo->heap_size = new_size;return 0 ; + +err_out2: +dma_unmap_sgtable (dev, &sgt,DMA_BIDIRECTIONAL ,0 ); +err_out1: +kfree (bo->base.sgt); + bo->base.sgt =NULL ; +err_out0: +sg_free_table (&sgt); +return ret; } int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 251/451 ASoC: amd: acp: Add missing error handling in sof-mach
In reply to Sasha LevinFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit d0ada20279db2649a7549a2b8a4a3379c59f238d ]
Handle potential acp_sofdsp_dai_links_create() errors in ACP SOF machine driver's probe function. Note there is no need for an undo.
While at it, switch to dev_err_probe().
--- sound/soc/amd/acp/acp-sof-mach.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
sound/soc/amd/acp/acp-sof-mach.c +6 -8
@@ -114,16 +114,14 @@ static int acp_sof_probe(struct platform_device *pdev) card->num_controls =ARRAY_SIZE (acp_controls); card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data; -acp_sofdsp_dai_links_create (card); + ret =acp_sofdsp_dai_links_create (card); +if (ret) +return dev_err_probe (&pdev->dev, ret,"Failed to create DAI links\n" ); ret =devm_snd_soc_register_card (&pdev->dev, card); -if (ret) { -dev_err (&pdev->dev, -"devm_snd_soc_register_card(%s) failed: %d\n" , - card->name, ret); -return ret; - } - +if (ret) +return dev_err_probe (&pdev->dev, ret, +"Failed to register card(%s)\n" , card->name);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 252/451 dmaengine: tegra210-adma: Update dependency to ARCH_TEGRA
In reply to Sasha LevinFrom: Peter Robinson <[email protected]>
[ Upstream commit 33b7db45533af240fe44e809f9dc4d604cf82d07 ]
Update the architecture dependency to be the generic Tegra because the driver works on the four latest Tegra generations not just T210, if you build a kernel with a specific ARCH_TEGRA_xxx_SOC option that excludes 210 you don't get this driver.
--- drivers/dma/Kconfig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/dma/Kconfig +7 -7
@@ -665,16 +665,16 @@ config TEGRA20_APB_DMA config TEGRA210_ADMA tristate "NVIDIA Tegra210 ADMA support" - depends on (ARCH_TEGRA_210_SOC || COMPILE_TEST) + depends on (ARCH_TEGRA || COMPILE_TEST) select DMA_ENGINE select DMA_VIRTUAL_CHANNELS help - Support for the NVIDIA Tegra210 ADMA controller driver. The - DMA controller has multiple DMA channels and is used to service - various audio clients in the Tegra210 audio processing engine - (APE). This DMA controller transfers data from memory to - peripheral and vice versa. It does not support memory to - memory data transfer. + Support for the NVIDIA Tegra210/Tegra186/Tegra194/Tegra234 ADMA + controller driver. The DMA controller has multiple DMA channels + and is used to service various audio clients in the Tegra210 + audio processing engine (APE). This DMA controller transfers + data from memory to peripheral and vice versa. It does not + support memory to memory data transfer. config TIMB_DMA tristate "Timberdale FPGA DMA support"
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 253/451 media: tc358743: register v4l2 async device only after successful setup
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 87399f1ff92203d65f1febf5919429f4bb613a02 ]
Ensure the device has been setup correctly before registering the v4l2 async device, thus allowing userspace to access.
--- drivers/media/i2c/tc358743.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/i2c/tc358743.c +4 -3
@@ -2094,9 +2094,6 @@ static int tc358743_probe(struct i2c_client *client) state->mbus_fmt_code =MEDIA_BUS_FMT_RGB888_1X24 ; sd->dev = &client->dev; - err =v4l2_async_register_subdev (sd); -if (err <0 ) - goto err_hdl;mutex_init (&state->confctl_mutex);
@@ -2154,6 +2151,10 @@ static int tc358743_probe(struct i2c_client *client)if (err) goto err_work_queues; + err =v4l2_async_register_subdev (sd); +if (err <0 ) + goto err_work_queues; +v4l2_info (sd,"%s found @ 0x%x (%s)\n" , client->name, client->addr <<1 , client->adapter->name);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 254/451 PCI/DPC: Print all TLP Prefixes, not just the first
In reply to Sasha LevinFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 6568d82512b0a64809acff3d7a747362fa4288c8 ]
The TLP Prefix Log Register consists of multiple DWORDs (PCIe r6.1 sec 7.9.14.13) but the loop in dpc_process_rp_pio_error() keeps reading from the first DWORD, so we print only the first PIO TLP Prefix (duplicated several times), and we never print the second, third, etc., Prefixes.
Add the iteration count based offset calculation into the config read.
--- drivers/pci/pcie/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +1 -1
@@ -231,7 +231,7 @@ static void dpc_process_rp_pio_error(struct pci_dev *pdev)for (i =0 ; i < pdev->dpc_rp_log_size -5 ; i++) {pci_read_config_dword (pdev, - cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG , &prefix); + cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG + i *4 , &prefix);pci_err (pdev,"TLP Prefix Header: dw%d, %#010x\n" , i, prefix); } clear_status:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 255/451 perf record: Fix possible incorrect free in record__switch_output()
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit aff10a165201f6f60cff225083ce301ad3f5d8f1 ]
perf_data__switch() may not assign a legal value to 'new_filename'. In this case, 'new_filename' uses the on-stack value, which may cause a incorrect free and unexpected result.
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -1785,8 +1785,8 @@ static int record__switch_output(struct record *rec, bool at_exit) {struct perf_data *data = &rec->data; +char *new_filename =NULL ;int fd, err; -char *new_filename;/* Same Size: "2015122520103046"*/ char timestamp[] ="InvalidTimestamp" ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 256/451 HID: lenovo: Add middleclick_workaround sysfs knob for cptkbd
In reply to Sasha LevinFrom: Mikhail Khvainitski <[email protected]>
[ Upstream commit 2814646f76f8518326964f12ff20aaee70ba154d ]
Previous attempt to autodetect well-behaving patched firmware introduced in commit 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround") has shown that there are false-positives on original firmware (on both 1st gen and 2nd gen keyboards) which causes the middle button click workaround to be mistakenly disabled.
This commit adds explicit parameter to sysfs to control this workaround.
--- drivers/hid/hid-lenovo.c | 57 +++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 18 deletions(-)
drivers/hid/hid-lenovo.c +39 -18
@@ -54,10 +54,10 @@ struct lenovo_drvdata {/* 0: Up * 1: Down (undecided) * 2: Scrolling -* 3: Patched firmware, disable workaround */ u8 middlebutton_state;bool fn_lock; +bool middleclick_workaround_cptkbd; };#define map_key_clear (c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c))
@@ -621,6 +621,36 @@ static ssize_t attr_sensitivity_store_cptkbd(struct device *dev,return count; } +static ssize_t attr_middleclick_workaround_show_cptkbd (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct hid_device *hdev =to_hid_device (dev); +struct lenovo_drvdata *cptkbd_data =hid_get_drvdata (hdev); + +return snprintf (buf,PAGE_SIZE ,"%u\n" , + cptkbd_data->middleclick_workaround_cptkbd); +} + +static ssize_t attr_middleclick_workaround_store_cptkbd (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct hid_device *hdev =to_hid_device (dev); +struct lenovo_drvdata *cptkbd_data =hid_get_drvdata (hdev); +int value; + +if (kstrtoint (buf,10 , &value)) +return -EINVAL ; +if (value <0 || value >1 ) +return -EINVAL ; + + cptkbd_data->middleclick_workaround_cptkbd = !!value; + +return count; +} +static struct device_attribute dev_attr_fn_lock = __ATTR(fn_lock, S_IWUSR | S_IRUGO,
@@ -632,10 +662,16 @@ static struct device_attribute dev_attr_sensitivity_cptkbd = attr_sensitivity_show_cptkbd, attr_sensitivity_store_cptkbd); +static struct device_attribute dev_attr_middleclick_workaround_cptkbd = +__ATTR (middleclick_workaround,S_IWUSR |S_IRUGO , + attr_middleclick_workaround_show_cptkbd, + attr_middleclick_workaround_store_cptkbd); +static struct attribute *lenovo_attributes_cptkbd[] = { &dev_attr_fn_lock.attr, &dev_attr_sensitivity_cptkbd.attr, + &dev_attr_middleclick_workaround_cptkbd.attr,NULL };
@@ -686,23 +722,7 @@ static int lenovo_event_cptkbd(struct hid_device *hdev, {struct lenovo_drvdata *cptkbd_data =hid_get_drvdata (hdev); -if (cptkbd_data->middlebutton_state !=3 ) { -/* REL_X and REL_Y events during middle button pressed -* are only possible on patched, bug-free firmware -* so set middlebutton_state to 3 -* to never apply workaround anymore -*/ -if (hdev->product ==USB_DEVICE_ID_LENOVO_CUSBKBD && - cptkbd_data->middlebutton_state ==1 && - usage->type ==EV_REL && - (usage->code ==REL_X || usage->code ==REL_Y )) { - cptkbd_data->middlebutton_state =3 ; -/* send middle button press which was hold before */ -input_event (field->hidinput->input, -EV_KEY ,BTN_MIDDLE ,1 ); -input_sync (field->hidinput->input); - } - +if (cptkbd_data->middleclick_workaround_cptkbd) {/* "wheel" scroll events */ if (usage->type ==EV_REL && (usage->code ==REL_WHEEL || usage->code ==REL_HWHEEL )) {
@@ -1166,6 +1186,7 @@ static int lenovo_probe_cptkbd(struct hid_device *hdev) cptkbd_data->middlebutton_state =0 ; cptkbd_data->fn_lock = true; cptkbd_data->sensitivity =0x05 ; + cptkbd_data->middleclick_workaround_cptkbd = true;lenovo_features_set_cptkbd (hdev); ret =sysfs_create_group (&hdev->dev.kobj, &lenovo_attr_group_cptkbd);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 257/451 drm/amd/display: Fix a potential buffer overflow in 'dp_dsc_clock_en_read()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 4b09715f1504f1b6e8dff0e9643630610bc05141 ]
Tell snprintf() to store at most 10 bytes in the output buffer instead of 30.
Fixes the below:drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:1508 dp_dsc_clock_en_read() error: snprintf() is printing too much 30 vs 10
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1 -1
@@ -1358,7 +1358,7 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,const uint32_t rd_buf_size =10 ;struct pipe_ctx *pipe_ctx;ssize_t result =0 ; -int i, r, str_len =30 ; +int i, r, str_len =10 ; rd_buf =kcalloc (rd_buf_size,sizeof (char ),GFP_KERNEL );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 258/451 drm/amd/display: Fix potential NULL pointer dereferences in 'dcn10_set_output_transfer_func()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 9ccfe80d022df7c595f1925afb31de2232900656 ]
The 'stream' pointer is used in dcn10_set_output_transfer_func() before the check if 'stream' is NULL.
Fixes the below:drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn10/dcn10_hwseq.c:1892 dcn10_set_output_transfer_func() warn: variable dereferenced before check 'stream' (see line 1875)
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +5 -2
@@ -1854,6 +1854,9 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx, {struct dpp *dpp = pipe_ctx->plane_res.dpp; +if (!stream) +return false; +if (dpp ==NULL )return false;
@@ -1876,8 +1879,8 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx, }else dpp->funcs->dpp_program_regamma_pwl (dpp,NULL ,OPP_REGAMMA_BYPASS ); -if (stream !=NULL && stream->ctx !=NULL && - stream->out_transfer_func !=NULL ) { +if (stream->ctx && + stream->out_transfer_func) {log_tf (stream->ctx, stream->out_transfer_func, dpp->regamma_params.hw_points_num);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 259/451 pinctrl: renesas: r8a779g0: Add Audio SSI pins, groups, and functions
In reply to Sasha LevinFrom: Linh Phung <[email protected]>
[ Upstream commit b37d57e1daccbc1a0393d9207d5c48f9181fe85a ]
Add pins, groups, and functions for the Serial Sound Interface (SSI) on the Renesas R-Car V4H (R8A779G0) SoC.
Stable-dep-of: 68540257cdf1 ("pinctrl: renesas: r8a779g0: Add missing SCIF_CLK2 pin group/function")
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/pinctrl/renesas/pfc-r8a779g0.c +26 -0
@@ -2360,6 +2360,22 @@ static const unsigned int scif_clk_mux[] = { SCIF_CLK_MARK, }; +/* - SSI ------------------------------------------------- */ +static const unsigned int ssi_data_pins[] = { +/* SSI_SD */ +RCAR_GP_PIN (1 ,20 ), +}; +static const unsigned int ssi_data_mux[] = { +SSI_SD_MARK , +}; +static const unsigned int ssi_ctrl_pins[] = { +/* SSI_SCK, SSI_WS */ +RCAR_GP_PIN (1 ,18 ),RCAR_GP_PIN (1 ,19 ), +}; +static const unsigned int ssi_ctrl_mux[] = { +SSI_SCK_MARK ,SSI_WS_MARK , +}; +/* - TPU ------------------------------------------------------------------- */ static const unsigned int tpu_to0_pins[] = {/* TPU0TO0 */
@@ -2652,6 +2668,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (scif4_ctrl),SH_PFC_PIN_GROUP (scif_clk), +SH_PFC_PIN_GROUP (ssi_data), +SH_PFC_PIN_GROUP (ssi_ctrl), +SH_PFC_PIN_GROUP (tpu_to0),/* suffix might be updated */ SH_PFC_PIN_GROUP (tpu_to0_a),/* suffix might be updated */ SH_PFC_PIN_GROUP(tpu_to1), /* suffix might be updated */
@@ -2964,6 +2983,11 @@ static const char * const scif_clk_groups[] = { "scif_clk", }; +static const char *const ssi_groups[] = { +"ssi_data" , +"ssi_ctrl" , +}; +static const char *const tpu_groups[] = {/* suffix might be updated */ "tpu_to0" ,
@@ -3045,6 +3069,8 @@ static const struct sh_pfc_function pinmux_functions[] = {SH_PFC_FUNCTION (scif4),SH_PFC_FUNCTION (scif_clk), +SH_PFC_FUNCTION (ssi), +SH_PFC_FUNCTION (tpu), SH_PFC_FUNCTION(tsn0),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 260/451 pinctrl: renesas: r8a779g0: Add missing SCIF_CLK2 pin group/function
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 68540257cdf1d07ff8a649aa94c21c5804bbb9b0 ]
R-Car V4H actually has two SCIF_CLK pins.
The second pin provides the SCIF_CLK signal for HSCIF2 and SCIF4.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/pinctrl/renesas/pfc-r8a779g0.c +14 -0
@@ -2360,6 +2360,14 @@ static const unsigned int scif_clk_mux[] = { SCIF_CLK_MARK, }; +static const unsigned int scif_clk2_pins[] = { +/* SCIF_CLK2 */ +RCAR_GP_PIN (8 ,11 ), +}; +static const unsigned int scif_clk2_mux[] = { +SCIF_CLK2_MARK , +}; +/* - SSI ------------------------------------------------- */ static const unsigned int ssi_data_pins[] = {/* SSI_SD */
@@ -2667,6 +2675,7 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (scif4_clk),SH_PFC_PIN_GROUP (scif4_ctrl),SH_PFC_PIN_GROUP (scif_clk), +SH_PFC_PIN_GROUP (scif_clk2),SH_PFC_PIN_GROUP (ssi_data), SH_PFC_PIN_GROUP(ssi_ctrl),
@@ -2983,6 +2992,10 @@ static const char * const scif_clk_groups[] = { "scif_clk", }; +static const char *const scif_clk2_groups[] = { +"scif_clk2" , +}; +static const char *const ssi_groups[] = {"ssi_data" ,"ssi_ctrl" ,
@@ -3068,6 +3081,7 @@ static const struct sh_pfc_function pinmux_functions[] = {SH_PFC_FUNCTION (scif3),SH_PFC_FUNCTION (scif4),SH_PFC_FUNCTION (scif_clk), +SH_PFC_FUNCTION (scif_clk2), SH_PFC_FUNCTION(ssi),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 261/451 clk: samsung: exynos850: Propagate SPI IPCLK rate change
In reply to Sasha LevinFrom: Sam Protsenko <[email protected]>
[ Upstream commit 67c15187d4910ee353374676d4dddf09d8cb227e ]
When SPI transfer is being prepared, the spi-s3c64xx driver will call clk_set_rate() to change the rate of SPI source clock (IPCLK). But IPCLK is a gate (leaf) clock, so it must propagate the rate change up the clock tree, so that corresponding DIV clocks can actually change their divider values. Add CLK_SET_RATE_PARENT flag to corresponding clocks for all SPI instances in Exynos850 (spi_0, spi_1 and spi_2) to make it possible. This change involves next clocks:
usi_spi_0:
Clock Block Div range
--------------------------------------------
gout_spi0_ipclk CMU_PERI -
dout_peri_spi0 CMU_PERI /1..32
mout_peri_spi_user CMU_PERI -
dout_peri_ip CMU_TOP /1..16
usi_cmgp0:
Clock Block Div range
--------------------------------------------
gout_cmgp_usi0_ipclk CMU_CMGP -
dout_cmgp_usi0 CMU_CMGP /1..32
mout_cmgp_usi0 CMU_CMGP -
gout_clkcmu_cmgp_bus CMU_APM -
dout_apm_bus CMU_APM /1..8
usi_cmgp1:
Clock Block Div range
--------------------------------------------
gout_cmgp_usi1_ipclk CMU_CMGP -
dout_cmgp_usi1 CMU_CMGP /1..32
mout_cmgp_usi1 CMU_CMGP -
gout_clkcmu_cmgp_bus CMU_APM -
dout_apm_bus CMU_APM /1..8
With input clock of 400 MHz, this scheme provides next IPCLK rate range, for each SPI block:
SPI0: 781 kHz ... 400 MHz
SPI1/2: 1.6 MHz ... 400 MHzAccounting for internal /4 divider in SPI blocks, and because the max SPI frequency is limited at 50 MHz, it gives us next SPI SCK rates:
SPI0: 200 kHz ... 49.9 MHz
SPI1/2: 400 kHz ... 49.9 MHzWhich should cover all possible applications of SPI bus. Of course, setting SPI frequency to values as low as 500 kHz will also affect the common bus dividers (dout_apm_bus or dout_peri_ip), which in turn effectively lowers the rates for all leaf bus clocks derived from those dividers, like HSI2C and I3C clocks. But at least it gives the board designer a choice, whether to keep all clocks (SPI/HSI2C/I3C) at high frequencies, or make all those clocks have lower frequencies. Not propagating the rate change to those common dividers would limit this choice to "only high frequencies are allowed for SPI/HSI2C/I3C" option, making the common dividers useless. This decision follows the "Worse is better" approach, relying on the users/engineers to know the system internals when working with such low-level features, instead of trying to account for all possible use-cases.
--- drivers/clk/samsung/clk-exynos850.c | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/clk/samsung/clk-exynos850.c +17 -16
@@ -572,7 +572,7 @@ static const struct samsung_div_clock apm_div_clks[] __initconst = {static const struct samsung_gate_clock apm_gate_clks[]__initconst = {GATE (CLK_GOUT_CLKCMU_CMGP_BUS ,"gout_clkcmu_cmgp_bus" ,"dout_apm_bus" , -CLK_CON_GAT_CLKCMU_CMGP_BUS ,21 ,0 ,0 ), +CLK_CON_GAT_CLKCMU_CMGP_BUS ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CLKCMU_CHUB_BUS ,"gout_clkcmu_chub_bus" ,"mout_clkcmu_chub_bus" ,CLK_CON_GAT_GATE_CLKCMU_CHUB_BUS ,21 ,0 ,0 ),
@@ -936,19 +936,19 @@ static const struct samsung_fixed_rate_clock cmgp_fixed_clks[] __initconst = {static const struct samsung_mux_clock cmgp_mux_clks[]__initconst = {MUX (CLK_MOUT_CMGP_ADC ,"mout_cmgp_adc" , mout_cmgp_adc_p,CLK_CON_MUX_CLK_CMGP_ADC ,0 ,1 ), -MUX (CLK_MOUT_CMGP_USI0 ,"mout_cmgp_usi0" , mout_cmgp_usi0_p, -CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0 ,0 ,1 ), -MUX (CLK_MOUT_CMGP_USI1 ,"mout_cmgp_usi1" , mout_cmgp_usi1_p, -CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1 ,0 ,1 ), +MUX_F (CLK_MOUT_CMGP_USI0 ,"mout_cmgp_usi0" , mout_cmgp_usi0_p, +CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0 ,0 ,1 ,CLK_SET_RATE_PARENT ,0 ), +MUX_F (CLK_MOUT_CMGP_USI1 ,"mout_cmgp_usi1" , mout_cmgp_usi1_p, +CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1 ,0 ,1 ,CLK_SET_RATE_PARENT ,0 ), };static const struct samsung_div_clock cmgp_div_clks[]__initconst = {DIV (CLK_DOUT_CMGP_ADC ,"dout_cmgp_adc" ,"gout_clkcmu_cmgp_bus" ,CLK_CON_DIV_DIV_CLK_CMGP_ADC ,0 ,4 ), -DIV (CLK_DOUT_CMGP_USI0 ,"dout_cmgp_usi0" ,"mout_cmgp_usi0" , -CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0 ,0 ,5 ), -DIV (CLK_DOUT_CMGP_USI1 ,"dout_cmgp_usi1" ,"mout_cmgp_usi1" , -CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1 ,0 ,5 ), +DIV_F (CLK_DOUT_CMGP_USI0 ,"dout_cmgp_usi0" ,"mout_cmgp_usi0" , +CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0 ,0 ,5 ,CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_CMGP_USI1 ,"dout_cmgp_usi1" ,"mout_cmgp_usi1" , +CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1 ,0 ,5 ,CLK_SET_RATE_PARENT ,0 ), };static const struct samsung_gate_clock cmgp_gate_clks[]__initconst = {
@@ -963,12 +963,12 @@ static const struct samsung_gate_clock cmgp_gate_clks[] __initconst = { "gout_clkcmu_cmgp_bus", CLK_CON_GAT_GOUT_CMGP_GPIO_PCLK, 21, CLK_IGNORE_UNUSED, 0),GATE (CLK_GOUT_CMGP_USI0_IPCLK ,"gout_cmgp_usi0_ipclk" ,"dout_cmgp_usi0" , -CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CMGP_USI0_PCLK ,"gout_cmgp_usi0_pclk" ,"gout_clkcmu_cmgp_bus" ,CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_PCLK ,21 ,0 ,0 ),GATE (CLK_GOUT_CMGP_USI1_IPCLK ,"gout_cmgp_usi1_ipclk" ,"dout_cmgp_usi1" , -CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CMGP_USI1_PCLK ,"gout_cmgp_usi1_pclk" ,"gout_clkcmu_cmgp_bus" , CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_PCLK, 21, 0, 0),
@@ -1409,8 +1409,9 @@ static const struct samsung_mux_clock peri_mux_clks[] __initconst = { mout_peri_uart_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART_USER, 4, 1),MUX (CLK_MOUT_PERI_HSI2C_USER ,"mout_peri_hsi2c_user" , mout_peri_hsi2c_user_p,PLL_CON0_MUX_CLKCMU_PERI_HSI2C_USER ,4 ,1 ), -MUX (CLK_MOUT_PERI_SPI_USER ,"mout_peri_spi_user" , mout_peri_spi_user_p, - PLL_CON0_MUX_CLKCMU_PERI_SPI_USER, 4, 1), +MUX_F (CLK_MOUT_PERI_SPI_USER ,"mout_peri_spi_user" , + mout_peri_spi_user_p,PLL_CON0_MUX_CLKCMU_PERI_SPI_USER ,4 ,1 , + CLK_SET_RATE_PARENT, 0), }; static const struct samsung_div_clock peri_div_clks[] __initconst = {
@@ -1420,8 +1421,8 @@ static const struct samsung_div_clock peri_div_clks[] __initconst = { CLK_CON_DIV_DIV_CLK_PERI_HSI2C_1, 0, 5),DIV (CLK_DOUT_PERI_HSI2C2 ,"dout_peri_hsi2c2" ,"gout_peri_hsi2c2" ,CLK_CON_DIV_DIV_CLK_PERI_HSI2C_2 ,0 ,5 ), -DIV (CLK_DOUT_PERI_SPI0 ,"dout_peri_spi0" ,"mout_peri_spi_user" , - CLK_CON_DIV_DIV_CLK_PERI_SPI_0, 0, 5), +DIV_F (CLK_DOUT_PERI_SPI0 ,"dout_peri_spi0" ,"mout_peri_spi_user" , + CLK_CON_DIV_DIV_CLK_PERI_SPI_0, 0, 5, CLK_SET_RATE_PARENT, 0), }; static const struct samsung_gate_clock peri_gate_clks[] __initconst = {
@@ -1463,7 +1464,7 @@ static const struct samsung_gate_clock peri_gate_clks[] __initconst = { "mout_peri_bus_user", CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK, 21, 0, 0),GATE (CLK_GOUT_SPI0_IPCLK ,"gout_spi0_ipclk" ,"dout_peri_spi0" , -CLK_CON_GAT_GOUT_PERI_SPI_0_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_PERI_SPI_0_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_SPI0_PCLK ,"gout_spi0_pclk" ,"mout_peri_bus_user" ,CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK ,21 ,0 ,0 ), GATE(CLK_GOUT_SYSREG_PERI_PCLK, "gout_sysreg_peri_pclk",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 262/451 perf evsel: Fix duplicate initialization of data->id in evsel__parse_sample()
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit 4962aec0d684c8edb14574ccd0da53e4926ff834 ]
data->id has been initialized at line 2362, remove duplicate initialization.
--- tools/perf/util/evsel.c | 1 - 1 file changed, 1 deletion(-)
tools/perf/util/evsel.c +0 -1
@@ -2375,7 +2375,6 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event, data->period = evsel->core.attr.sample_period; data->cpumode = event->header.misc &PERF_RECORD_MISC_CPUMODE_MASK ; data->misc = event->header.misc; - data->id =-1ULL ; data->data_src =PERF_MEM_DATA_SRC_NONE ; data->vcpu =-1 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 263/451 PCI/AER: Fix rootport attribute paths in ABI docs
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit 0e7d29a39a546161ea3a49e8e282a43212d7ff68 ]
The 'aer_stats' directory never made it into the sixth and final revision of the series adding the sysfs AER attributes.
--- Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats +3 -3
@@ -100,19 +100,19 @@ collectors) that are AER capable. These indicate the number of error messages as device, so these counters include them and are thus cumulative of all the error messages on the PCI hierarchy originating at that root port. -What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_cor +What: /sys/bus/pci/devices/<dev>/aer_rootport_total_err_cor Date: July 2018 KernelVersion: 4.19.0 Contact: [email protected], [email protected] Description: Total number of ERR_COR messages reported to rootport. -What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_fatal +What: /sys/bus/pci/devices/<dev>/aer_rootport_total_err_fatal Date: July 2018 KernelVersion: 4.19.0 Contact: [email protected], [email protected] Description: Total number of ERR_FATAL messages reported to rootport. -What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_nonfatal +What: /sys/bus/pci/devices/<dev>/aer_rootport_total_err_nonfatal Date: July 2018 KernelVersion: 4.19.0 Contact: [email protected], [email protected]
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 264/451 clk: meson: Add missing clocks to axg_clk_regmaps
In reply to Sasha LevinFrom: Igor Prusov <[email protected]>
[ Upstream commit ba535bce57e71463a86f8b33a0ea88c26e3a6418 ]
Some clocks were missing from axg_clk_regmaps, which caused kernel panic during cat /sys/kernel/debug/clk/clk_summary
[ 57.349402] Unable to handle kernel NULL pointer dereference at virtual address 00000000000001fc ... [ 57.430002] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 57.436900] pc : regmap_read+0x1c/0x88 [ 57.440608] lr : clk_regmap_gate_is_enabled+0x3c/0xb0 [ 57.445611] sp : ffff800082f1b690 [ 57.448888] x29: ffff800082f1b690 x28: 0000000000000000 x27: ffff800080eb9a70 [ 57.455961] x26: 0000000000000007 x25: 0000000000000016 x24: 0000000000000000 [ 57.463033] x23: ffff800080e8b488 x22: 0000000000000015 x21: ffff00000e7e7000 [ 57.470106] x20: ffff00000400ec00 x19: 0000000000000000 x18: ffffffffffffffff [ 57.477178] x17: 0000000000000000 x16: 0000000000000000 x15: ffff0000042a3000 [ 57.484251] x14: 0000000000000000 x13: ffff0000042a2fec x12: 0000000005f5e100 [ 57.491323] x11: abcc77118461cefd x10: 0000000000000020 x9 : ffff8000805e4b24 [ 57.498396] x8 : ffff0000028063c0 x7 : ffff800082f1b710 x6 : ffff800082f1b710 [ 57.505468] x5 : 00000000ffffffd0 x4 : ffff800082f1b6e0 x3 : 0000000000001000 [ 57.512541] x2 : ffff800082f1b6e4 x1 : 000000000000012c x0 : 0000000000000000 [ 57.519615] Call trace: [ 57.522030] regmap_read+0x1c/0x88 [ 57.525393] clk_regmap_gate_is_enabled+0x3c/0xb0 [ 57.530050] clk_core_is_enabled+0x44/0x120 [ 57.534190] clk_summary_show_subtree+0x154/0x2f0 [ 57.538847] clk_summary_show_subtree+0x220/0x2f0 [ 57.543505] clk_summary_show_subtree+0x220/0x2f0 [ 57.548162] clk_summary_show_subtree+0x220/0x2f0 [ 57.552820] clk_summary_show_subtree+0x220/0x2f0 [ 57.557477] clk_summary_show_subtree+0x220/0x2f0 [ 57.562135] clk_summary_show_subtree+0x220/0x2f0 [ 57.566792] clk_summary_show_subtree+0x220/0x2f0 [ 57.571450] clk_summary_show+0x84/0xb8 [ 57.575245] seq_read_iter+0x1bc/0x4b8 [ 57.578954] seq_read+0x8c/0xd0 [ 57.582059] full_proxy_read+0x68/0xc8 [ 57.585767] vfs_read+0xb0/0x268 [ 57.588959] ksys_read+0x70/0x108 [ 57.592236] __arm64_sys_read+0x24/0x38 [ 57.596031] invoke_syscall+0x50/0x128 [ 57.599740] el0_svc_common.constprop.0+0x48/0xf8 [ 57.604397] do_el0_svc+0x28/0x40 [ 57.607675] el0_svc+0x34/0xb8 [ 57.610694] el0t_64_sync_handler+0x13c/0x158 [ 57.615006] el0t_64_sync+0x190/0x198 [ 57.618635] Code: a9bd7bfd 910003fd a90153f3 aa0003f3 (b941fc00) [ 57.624668] ---[ end trace 0000000000000000 ]---
--- drivers/clk/meson/axg.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/meson/axg.c +2 -0
@@ -2144,7 +2144,9 @@ static struct clk_regmap *const axg_clk_regmaps[] = { &axg_vclk_input, &axg_vclk2_input, &axg_vclk_div, + &axg_vclk_div1, &axg_vclk2_div, + &axg_vclk2_div1, &axg_vclk_div2_en, &axg_vclk_div4_en, &axg_vclk_div6_en,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 265/451 media: em28xx: annotate unchecked call to media_device_register()
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit fd61d77a3d28444b2635f0c8b5a2ecd6a4d94026 ]
Static analyzers generate alerts for an unchecked call to media_device_register(). However, in this case, the device will work reliably without the media controller API.
Add a comment above the call to prevent future unnecessary changes.
--- drivers/media/usb/em28xx/em28xx-cards.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/usb/em28xx/em28xx-cards.c +4 -0
@@ -4094,6 +4094,10 @@ static int em28xx_usb_probe(struct usb_interface *intf,* topology will likely change after the load of the em28xx subdrivers. */ #ifdef CONFIG_MEDIA_CONTROLLER +/* +* No need to check the return value, the device will still be +* usable without media controller API. +*/ retval =media_device_register (dev->media_dev);#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 266/451 media: v4l2-tpg: fix some memleaks in tpg_alloc
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 8cf9c5051076e0eb958f4361d50d8b0c3ee6691c ]
In tpg_alloc, resources should be deallocated in each and every error-handling paths, since they are allocated in for statements. Otherwise there would be memleaks because tpg_free is called only when tpg_alloc return 0.
--- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 52 +++++++++++++++---- 1 file changed, 42 insertions(+), 10 deletions(-)
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +42 -10
@@ -113,6 +113,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) {unsigned pat;unsigned plane; +int ret =0 ; tpg->max_line_width = max_w;for (pat =0 ; pat <TPG_MAX_PAT_LINES ; pat++) {
@@ -121,14 +122,18 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) tpg->lines[pat][plane] =vzalloc (array3_size (max_w,2 , pixelsz)); -if (!tpg->lines[pat][plane]) -return -ENOMEM ; +if (!tpg->lines[pat][plane]) { + ret = -ENOMEM ; + goto free_lines; + }if (plane ==0 )continue ; tpg->downsampled_lines[pat][plane] =vzalloc (array3_size (max_w,2 , pixelsz)); -if (!tpg->downsampled_lines[pat][plane]) -return -ENOMEM ; +if (!tpg->downsampled_lines[pat][plane]) { + ret = -ENOMEM ; + goto free_lines; + } } }for (plane =0 ; plane <TPG_MAX_PLANES ; plane++) {
@@ -136,18 +141,45 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) tpg->contrast_line[plane] =vzalloc (array_size (pixelsz, max_w)); -if (!tpg->contrast_line[plane]) -return -ENOMEM ; +if (!tpg->contrast_line[plane]) { + ret = -ENOMEM ; + goto free_contrast_line; + } tpg->black_line[plane] =vzalloc (array_size (pixelsz, max_w)); -if (!tpg->black_line[plane]) -return -ENOMEM ; +if (!tpg->black_line[plane]) { + ret = -ENOMEM ; + goto free_contrast_line; + } tpg->random_line[plane] =vzalloc (array3_size (max_w,2 , pixelsz)); -if (!tpg->random_line[plane]) -return -ENOMEM ; +if (!tpg->random_line[plane]) { + ret = -ENOMEM ; + goto free_contrast_line; + } }return 0 ; + +free_contrast_line: +for (plane =0 ; plane <TPG_MAX_PLANES ; plane++) { +vfree (tpg->contrast_line[plane]); +vfree (tpg->black_line[plane]); +vfree (tpg->random_line[plane]); + tpg->contrast_line[plane] =NULL ; + tpg->black_line[plane] =NULL ; + tpg->random_line[plane] =NULL ; + } +free_lines: +for (pat =0 ; pat <TPG_MAX_PAT_LINES ; pat++) +for (plane =0 ; plane <TPG_MAX_PLANES ; plane++) { +vfree (tpg->lines[pat][plane]); + tpg->lines[pat][plane] =NULL ; +if (plane ==0 ) +continue ; +vfree (tpg->downsampled_lines[pat][plane]); + tpg->downsampled_lines[pat][plane] =NULL ; + } +return ret; }EXPORT_SYMBOL_GPL (tpg_alloc);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 267/451 media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 8f94b49a5b5d386c038e355bef6347298aabd211 ]
The entity->name (i.e. name) is allocated in v4l2_m2m_register_entity but isn't freed in its following error-handling paths. This patch adds such deallocation to prevent memleak of entity->name.
--- drivers/media/v4l2-core/v4l2-mem2mem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-mem2mem.c +8 -2
@@ -1084,11 +1084,17 @@ static int v4l2_m2m_register_entity(struct media_device *mdev, entity->function = function; ret =media_entity_pads_init (entity, num_pads, pads); -if (ret) +if (ret) { +kfree (entity->name); + entity->name =NULL ;return ret; + } ret =media_device_register_entity (mdev, entity); -if (ret) +if (ret) { +kfree (entity->name); + entity->name =NULL ;return ret; + }return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 268/451 media: edia: dvbdev: fix a use-after-free
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 8c64f4cdf4e6cc5682c52523713af8c39c94e6d5 ]
In dvb_register_device, *pdvbdev is set equal to dvbdev, which is freed in several error-handling paths. However, *pdvbdev is not set to NULL after dvbdev's deallocation, causing use-after-frees in many places, for example, in the following call chain:
budget_register
|-> dvb_dmxdev_init
|-> dvb_register_device
|-> dvb_dmxdev_release
|-> dvb_unregister_device
|-> dvb_remove_device
|-> dvb_device_put
|-> kref_putWhen calling dvb_unregister_device, dmxdev->dvbdev (i.e. *pdvbdev in dvb_register_device) could point to memory that had been freed in dvb_register_device. Thereafter, this pointer is transferred to kref_put and triggering a use-after-free.
--- drivers/media/dvb-core/dvbdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/dvb-core/dvbdev.c +5 -0
@@ -494,6 +494,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, dvbdevfops =kmemdup (template->fops,sizeof (*dvbdevfops),GFP_KERNEL );if (!dvbdevfops) {kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return -ENOMEM ; }
@@ -502,6 +503,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,if (!new_node) {kfree (dvbdevfops);kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return -ENOMEM ; }
@@ -535,6 +537,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, }list_del (&dvbdev->list_head);kfree (dvbdev); + *pdvbdev =NULL ;up_write (&minor_rwsem);mutex_unlock (&dvbdev_register_lock);return -EINVAL ;
@@ -557,6 +560,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,dvb_media_device_free (dvbdev);list_del (&dvbdev->list_head);kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return ret; }
@@ -575,6 +579,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,dvb_media_device_free (dvbdev);list_del (&dvbdev->list_head);kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return PTR_ERR (clsdev); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 269/451 pinctrl: mediatek: Drop bogus slew rate register range for MT8186
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 3a29c87548809405bcbc66acc69cbe6f15184d94 ]
The MT8186 does not support configuring pin slew rate. This is evident from both the datasheet, and the fact that the driver points the slew rate register range at the GPIO direction register range.
Drop the bogus setting.
--- drivers/pinctrl/mediatek/pinctrl-mt8186.c | 1 - 1 file changed, 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-mt8186.c +0 -1
@@ -1198,7 +1198,6 @@ static const struct mtk_pin_reg_calc mt8186_reg_cals[PINCTRL_PIN_REG_MAX] = { [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8186_pin_dir_range), [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8186_pin_di_range), [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8186_pin_do_range), - [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt8186_pin_dir_range), [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8186_pin_smt_range), [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8186_pin_ies_range), [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8186_pin_pu_range),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 270/451 pinctrl: mediatek: Drop bogus slew rate register range for MT8192
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit e15ab05a6b3ed42f2f43f8bd1a1abdbde64afecd ]
The MT8192 does not support configuring pin slew rate. This is evident from both the datasheet, and the fact that the driver points the slew rate register range at the GPIO direction register range.
Drop the bogus setting.
--- drivers/pinctrl/mediatek/pinctrl-mt8192.c | 1 - 1 file changed, 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-mt8192.c +0 -1
@@ -1379,7 +1379,6 @@ static const struct mtk_pin_reg_calc mt8192_reg_cals[PINCTRL_PIN_REG_MAX] = { [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8192_pin_dir_range), [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8192_pin_di_range), [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8192_pin_do_range), - [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt8192_pin_dir_range), [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8192_pin_smt_range), [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8192_pin_ies_range), [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8192_pin_pu_range),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 271/451 clk: qcom: reset: Commonize the de/assert functions
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit eda40d9c583e95e0b6ac69d2950eec10f802e0e8 ]
They do the same thing, except the last argument of the last function call differs. Commonize them.
Stable-dep-of: 2f8cf2c3f3e3 ("clk: qcom: reset: Ensure write completion on reset de/assertion")
--- drivers/clk/qcom/reset.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/clk/qcom/reset.c +9 -13
@@ -22,8 +22,8 @@ static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)return 0 ; } -static int -qcom_reset_assert (struct reset_controller_dev *rcdev,unsigned long id) +static int qcom_reset_set_assert (struct reset_controller_dev *rcdev, +unsigned long id,bool assert) {struct qcom_reset_controller *rst;const struct qcom_reset_map *map;
@@ -33,21 +33,17 @@ qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) map = &rst->reset_map[id]; mask = map->bitmask ? map->bitmask :BIT (map->bit); -return regmap_update_bits (rst->regmap, map->reg, mask, mask); +return regmap_update_bits (rst->regmap, map->reg, mask, assert ? mask :0 ); } -static int -qcom_reset_deassert (struct reset_controller_dev *rcdev,unsigned long id) +static int qcom_reset_assert (struct reset_controller_dev *rcdev,unsigned long id) { -struct qcom_reset_controller *rst; -const struct qcom_reset_map *map; -u32 mask; - - rst =to_qcom_reset_controller (rcdev); - map = &rst->reset_map[id]; - mask = map->bitmask ? map->bitmask :BIT (map->bit); +return qcom_reset_set_assert (rcdev, id, true); +} -return regmap_update_bits (rst->regmap, map->reg, mask,0 ); +static int qcom_reset_deassert (struct reset_controller_dev *rcdev,unsigned long id) +{ +return qcom_reset_set_assert (rcdev, id, false); }const struct reset_control_ops qcom_reset_ops = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 272/451 clk: qcom: reset: Ensure write completion on reset de/assertion
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 2f8cf2c3f3e3f7ef61bd19abb4b0bb797ad50aaf ]
Trying to toggle the resets in a rapid fashion can lead to the changes not actually arriving at the clock controller block when we expect them to. This was observed at least on SM8250.
Read back the value after regmap_update_bits to ensure write completion.
--- drivers/clk/qcom/reset.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/qcom/reset.c +6 -1
@@ -33,7 +33,12 @@ static int qcom_reset_set_assert(struct reset_controller_dev *rcdev, map = &rst->reset_map[id]; mask = map->bitmask ? map->bitmask :BIT (map->bit); -return regmap_update_bits (rst->regmap, map->reg, mask, assert ? mask :0 ); +regmap_update_bits (rst->regmap, map->reg, mask, assert ? mask :0 ); + +/* Read back the register to ensure write completion, ignore the value */ +regmap_read (rst->regmap, map->reg, &mask); + +return 0 ; }static int qcom_reset_assert (struct reset_controller_dev *rcdev,unsigned long id)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 273/451 quota: simplify drop_dquot_ref()
In reply to Sasha LevinFrom: Baokun Li <[email protected]>
[ Upstream commit 7bce48f0fec602b3b6c335963b26d9eefa417788 ]
As Honza said, remove_inode_dquot_ref() currently does not release the last dquot reference but instead adds the dquot to tofree_head list. This is because dqput() can sleep while dropping of the last dquot reference (writing back the dquot and calling ->release_dquot()) and that must not happen under dq_list_lock. Now that dqput() queues the final dquot cleanup into a workqueue, remove_inode_dquot_ref() can call dqput() unconditionally and we can significantly simplify it.
Here we open code the simplified code of remove_inode_dquot_ref() into remove_dquot_ref() and remove the function put_dquot_list() which is no longer used.
Message-Id: <[email protected]>
Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot pointers")
--- fs/quota/dquot.c | 70 +++++++----------------------------------------- 1 file changed, 9 insertions(+), 61 deletions(-)
fs/quota/dquot.c +9 -61
@@ -1084,59 +1084,7 @@ static int add_dquot_ref(struct super_block *sb, int type)return err; } -/* -* Remove references to dquots from inode and add dquot to list for freeing -* if we have the last reference to dquot -*/ -static void remove_inode_dquot_ref (struct inode *inode,int type, -struct list_head *tofree_head) -{ -struct dquot **dquots =i_dquot (inode); -struct dquot *dquot = dquots[type]; - -if (!dquot) -return ; - - dquots[type] =NULL ; -if (list_empty (&dquot->dq_free)) { -/* -* The inode still has reference to dquot so it can't be in the -* free list -*/ -spin_lock (&dq_list_lock); -list_add (&dquot->dq_free, tofree_head); -spin_unlock (&dq_list_lock); - }else { -/* -* Dquot is already in a list to put so we won't drop the last -* reference here. -*/ -dqput (dquot); - } -} - -/* -* Free list of dquots -* Dquots are removed from inodes and no new references can be got so we are -* the only ones holding reference -*/ -static void put_dquot_list (struct list_head *tofree_head) -{ -struct list_head *act_head; -struct dquot *dquot; - - act_head = tofree_head->next; -while (act_head != tofree_head) { - dquot = list_entry(act_head, struct dquot, dq_free); - act_head = act_head->next; -/* Remove dquot from the list so we won't have problems... */ -list_del_init (&dquot->dq_free); -dqput (dquot); - } -} - -static void remove_dquot_ref (struct super_block *sb,int type, -struct list_head *tofree_head) +static void remove_dquot_ref (struct super_block *sb,int type) {struct inode *inode;#ifdef CONFIG_QUOTA_DEBUG
@@ -1153,11 +1101,16 @@ static void remove_dquot_ref(struct super_block *sb, int type,*/ spin_lock (&dq_data_lock);if (!IS_NOQUOTA (inode)) { +struct dquot **dquots =i_dquot (inode); +struct dquot *dquot = dquots[type]; +#ifdef CONFIG_QUOTA_DEBUG if (unlikely (inode_get_rsv_space (inode) >0 )) reserved =1 ;#endif -remove_inode_dquot_ref (inode, type, tofree_head); + dquots[type] =NULL ; +if (dquot) +dqput (dquot); }spin_unlock (&dq_data_lock); }
@@ -1174,13 +1127,8 @@ static void remove_dquot_ref(struct super_block *sb, int type,/* Gather all references from inodes and drop them */ static void drop_dquot_ref (struct super_block *sb,int type) { -LIST_HEAD (tofree_head); - -if (sb->dq_op) { -remove_dquot_ref (sb, type, &tofree_head); -synchronize_srcu (&dquot_srcu); -put_dquot_list (&tofree_head); - } +if (sb->dq_op) +remove_dquot_ref (sb, type); } static inline
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 274/451 quota: Fix potential NULL pointer dereference
In reply to Sasha LevinFrom: Wang Jianjian <[email protected]>
[ Upstream commit d0aa72604fbd80c8aabb46eda00535ed35570f1f ]
Below race may cause NULL pointer dereference
P1 P2dquot_free_inode quota_off
drop_dquot_ref
remove_dquot_ref dquots = i_dquot(inode)
dquots = i_dquot(inode)
srcu_read_lock
dquots[cnt]) != NULL (1)
dquots[type] = NULL (2)
spin_lock(&dquots[cnt]->dq_dqb_lock) (3)
....
If dquot_free_inode(or other routines) checks inode's quota pointers (1) before quota_off sets it to NULL(2) and use it (3) after that, NULL pointer dereference will be triggered.
So let's fix it by using a temporary pointer to avoid this issue.
Message-Id: <[email protected]>
Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot pointers")
--- fs/quota/dquot.c | 98 ++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 41 deletions(-)
fs/quota/dquot.c +57 -41
@@ -399,15 +399,17 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)EXPORT_SYMBOL (dquot_mark_dquot_dirty);/* Dirtify all the dquots - this can block when journalling */ -static inline int mark_all_dquot_dirty (struct dquot *const *dquot) +static inline int mark_all_dquot_dirty (struct dquot *const *dquots) {int ret, err, cnt; +struct dquot *dquot; ret = err =0 ;for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (dquot[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (dquot)/* Even in case of error we have to continue */ - ret =mark_dquot_dirty (dquot[cnt]); + ret =mark_dquot_dirty (dquot);if (!err) err = ret; }
@@ -1684,6 +1686,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)struct dquot_warn warn[MAXQUOTAS ];int reserve = flags &DQUOT_SPACE_RESERVE ;struct dquot **dquots; +struct dquot *dquot;if (!inode_quota_active (inode)) {if (reserve) {
@@ -1703,27 +1706,26 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) index =srcu_read_lock (&dquot_srcu);spin_lock (&inode->i_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ;if (reserve) { - ret =dquot_add_space (dquots[cnt],0 , number, flags, - &warn[cnt]); + ret =dquot_add_space (dquot,0 , number, flags, &warn[cnt]); }else { - ret =dquot_add_space (dquots[cnt], number,0 , flags, - &warn[cnt]); + ret =dquot_add_space (dquot, number,0 , flags, &warn[cnt]); }if (ret) {/* Back out changes we already did */ for (cnt--; cnt >=0 ; cnt--) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; -spin_lock (&dquots[cnt]->dq_dqb_lock); +spin_lock (&dquot->dq_dqb_lock);if (reserve) -dquot_free_reserved_space (dquots[cnt], - number); +dquot_free_reserved_space (dquot, number);else -dquot_decr_space (dquots[cnt], number); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +dquot_decr_space (dquot, number); +spin_unlock (&dquot->dq_dqb_lock); }spin_unlock (&inode->i_lock); goto out_flush_warn;
@@ -1754,6 +1756,7 @@ int dquot_alloc_inode(struct inode *inode)int cnt, ret =0 , index;struct dquot_warn warn[MAXQUOTAS ];struct dquot *const *dquots; +struct dquot *dquot;if (!inode_quota_active (inode))return 0 ;
@@ -1764,17 +1767,19 @@ int dquot_alloc_inode(struct inode *inode) index =srcu_read_lock (&dquot_srcu);spin_lock (&inode->i_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; - ret =dquot_add_inodes (dquots[cnt],1 , &warn[cnt]); + ret =dquot_add_inodes (dquot,1 , &warn[cnt]);if (ret) {for (cnt--; cnt >=0 ; cnt--) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ;/* Back out changes we already did */ -spin_lock (&dquots[cnt]->dq_dqb_lock); -dquot_decr_inodes (dquots[cnt],1 ); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +spin_lock (&dquot->dq_dqb_lock); +dquot_decr_inodes (dquot,1 ); +spin_unlock (&dquot->dq_dqb_lock); } goto warn_put_all; }
@@ -1796,6 +1801,7 @@ EXPORT_SYMBOL(dquot_alloc_inode);int dquot_claim_space_nodirty (struct inode *inode,qsize_t number) {struct dquot **dquots; +struct dquot *dquot;int cnt, index;if (!inode_quota_active (inode)) {
@@ -1811,9 +1817,8 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)spin_lock (&inode->i_lock);/* Claim reserved quotas to allocated quotas */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (dquots[cnt]) { -struct dquot *dquot = dquots[cnt]; - + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (dquot) {spin_lock (&dquot->dq_dqb_lock);if (WARN_ON_ONCE (dquot->dq_dqb.dqb_rsvspace < number)) number = dquot->dq_dqb.dqb_rsvspace;
@@ -1838,6 +1843,7 @@ EXPORT_SYMBOL(dquot_claim_space_nodirty);void dquot_reclaim_space_nodirty (struct inode *inode,qsize_t number) {struct dquot **dquots; +struct dquot *dquot;int cnt, index;if (!inode_quota_active (inode)) {
@@ -1853,9 +1859,8 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)spin_lock (&inode->i_lock);/* Claim reserved quotas to allocated quotas */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (dquots[cnt]) { -struct dquot *dquot = dquots[cnt]; - + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (dquot) {spin_lock (&dquot->dq_dqb_lock);if (WARN_ON_ONCE (dquot->dq_dqb.dqb_curspace < number)) number = dquot->dq_dqb.dqb_curspace;
@@ -1882,6 +1887,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ];struct dquot **dquots; +struct dquot *dquot;int reserve = flags &DQUOT_SPACE_RESERVE , index;if (!inode_quota_active (inode)) {
@@ -1902,17 +1908,18 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)int wtype; warn[cnt].w_type =QUOTA_NL_NOWARN ; -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; -spin_lock (&dquots[cnt]->dq_dqb_lock); - wtype =info_bdq_free (dquots[cnt], number); +spin_lock (&dquot->dq_dqb_lock); + wtype =info_bdq_free (dquot, number);if (wtype !=QUOTA_NL_NOWARN ) -prepare_warning (&warn[cnt], dquots[cnt], wtype); +prepare_warning (&warn[cnt], dquot, wtype);if (reserve) -dquot_free_reserved_space (dquots[cnt], number); +dquot_free_reserved_space (dquot, number);else -dquot_decr_space (dquots[cnt], number); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +dquot_decr_space (dquot, number); +spin_unlock (&dquot->dq_dqb_lock); }if (reserve) *inode_reserved_space (inode) -= number;
@@ -1937,6 +1944,7 @@ void dquot_free_inode(struct inode *inode)unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ];struct dquot *const *dquots; +struct dquot *dquot;int index;if (!inode_quota_active (inode))
@@ -1947,16 +1955,16 @@ void dquot_free_inode(struct inode *inode)spin_lock (&inode->i_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {int wtype; - warn[cnt].w_type =QUOTA_NL_NOWARN ; -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; -spin_lock (&dquots[cnt]->dq_dqb_lock); - wtype =info_idq_free (dquots[cnt],1 ); +spin_lock (&dquot->dq_dqb_lock); + wtype =info_idq_free (dquot,1 );if (wtype !=QUOTA_NL_NOWARN ) -prepare_warning (&warn[cnt], dquots[cnt], wtype); -dquot_decr_inodes (dquots[cnt],1 ); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +prepare_warning (&warn[cnt], dquot, wtype); +dquot_decr_inodes (dquot,1 ); +spin_unlock (&dquot->dq_dqb_lock); }spin_unlock (&inode->i_lock);mark_all_dquot_dirty (dquots);
@@ -1983,7 +1991,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)qsize_t rsv_space =0 ;qsize_t inode_usage =1 ;struct dquot *transfer_from[MAXQUOTAS ] = {}; -int cnt, ret =0 ; +int cnt, index, ret =0 ;char is_valid[MAXQUOTAS ] = {};struct dquot_warn warn_to[MAXQUOTAS ];struct dquot_warn warn_from_inodes[MAXQUOTAS ];
@@ -2072,8 +2080,16 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)spin_unlock (&inode->i_lock);spin_unlock (&dq_data_lock); +/* +* These arrays are local and we hold dquot references so we don't need +* the srcu protection but still take dquot_srcu to avoid warning in +* mark_all_dquot_dirty(). +*/ + index =srcu_read_lock (&dquot_srcu);mark_all_dquot_dirty (transfer_from);mark_all_dquot_dirty (transfer_to); +srcu_read_unlock (&dquot_srcu, index); +flush_warnings (warn_to);flush_warnings (warn_from_inodes);flush_warnings (warn_from_space);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 275/451 quota: Fix rcu annotations of inode dquot pointers
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 179b8c97ebf63429589f5afeba59a181fe70603e ]
Dquot pointers in i_dquot array in the inode are protected by dquot_srcu. Annotate the array pointers with __rcu, perform the locked dereferences with srcu_dereference_check() instead of plain reads, and set the array elements with rcu_assign_pointer().
--- fs/quota/dquot.c | 66 ++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 27 deletions(-)
fs/quota/dquot.c +39 -27
@@ -399,7 +399,7 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)EXPORT_SYMBOL (dquot_mark_dquot_dirty);/* Dirtify all the dquots - this can block when journalling */ -static inline int mark_all_dquot_dirty (struct dquot *const *dquots) +static inline int mark_all_dquot_dirty (struct dquot __rcu *const *dquots) {int ret, err, cnt;struct dquot *dquot;
@@ -1006,14 +1006,15 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid) }EXPORT_SYMBOL (dqget); -static inline struct dquot **i_dquot (struct inode *inode) +static inline struct dquot __rcu **i_dquot (struct inode *inode) { -return inode->i_sb->s_op->get_dquots (inode); +/* Force __rcu for now until filesystems are fixed */ +return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots (inode); }static int dqinit_needed (struct inode *inode,int type) { -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;int cnt;if (IS_NOQUOTA (inode))
@@ -1103,14 +1104,16 @@ static void remove_dquot_ref(struct super_block *sb, int type)*/ spin_lock (&dq_data_lock);if (!IS_NOQUOTA (inode)) { -struct dquot **dquots =i_dquot (inode); -struct dquot *dquot = dquots[type]; +struct dquot __rcu **dquots =i_dquot (inode); +struct dquot *dquot =srcu_dereference_check ( + dquots[type], &dquot_srcu, +lockdep_is_held (&dq_data_lock));#ifdef CONFIG_QUOTA_DEBUG if (unlikely (inode_get_rsv_space (inode) >0 )) reserved =1 ;#endif - dquots[type] =NULL ; +rcu_assign_pointer (dquots[type],NULL );if (dquot)dqput (dquot); }
@@ -1463,7 +1466,8 @@ static int inode_quota_active(const struct inode *inode)static int __dquot_initialize (struct inode *inode,int type) {int cnt, init_needed =0 ; -struct dquot **dquots, *got[MAXQUOTAS ] = {}; +struct dquot __rcu **dquots; +struct dquot *got[MAXQUOTAS ] = {};struct super_block *sb = inode->i_sb;qsize_t rsv;int ret =0 ;
@@ -1538,7 +1542,7 @@ static int __dquot_initialize(struct inode *inode, int type)if (!got[cnt])continue ;if (!dquots[cnt]) { - dquots[cnt] = got[cnt]; +rcu_assign_pointer (dquots[cnt], got[cnt]); got[cnt] =NULL ;/* * Make quota reservation system happy if someone
@@ -1546,12 +1550,16 @@ static int __dquot_initialize(struct inode *inode, int type)*/ rsv =inode_get_rsv_space (inode);if (unlikely (rsv)) { +struct dquot *dquot =srcu_dereference_check ( + dquots[cnt], &dquot_srcu, +lockdep_is_held (&dq_data_lock)); +spin_lock (&inode->i_lock);/* Get reservation again under proper lock */ rsv =__inode_get_rsv_space (inode); -spin_lock (&dquots[cnt]->dq_dqb_lock); - dquots[cnt]->dq_dqb.dqb_rsvspace += rsv; -spin_unlock (&dquots[cnt]->dq_dqb_lock); +spin_lock (&dquot->dq_dqb_lock); + dquot->dq_dqb.dqb_rsvspace += rsv; +spin_unlock (&dquot->dq_dqb_lock);spin_unlock (&inode->i_lock); } }
@@ -1573,7 +1581,7 @@ EXPORT_SYMBOL(dquot_initialize);bool dquot_initialize_needed (struct inode *inode) { -struct dquot **dquots; +struct dquot __rcu **dquots;int i;if (!inode_quota_active (inode))
@@ -1598,13 +1606,14 @@ EXPORT_SYMBOL(dquot_initialize_needed);static void __dquot_drop (struct inode *inode) {int cnt; -struct dquot **dquots =i_dquot (inode); +struct dquot __rcu **dquots =i_dquot (inode);struct dquot *put[MAXQUOTAS ];spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { - put[cnt] = dquots[cnt]; - dquots[cnt] =NULL ; + put[cnt] =srcu_dereference_check (dquots[cnt], &dquot_srcu, +lockdep_is_held (&dq_data_lock)); +rcu_assign_pointer (dquots[cnt],NULL ); }spin_unlock (&dq_data_lock);dqput_all (put);
@@ -1612,7 +1621,7 @@ static void __dquot_drop(struct inode *inode)void dquot_drop (struct inode *inode) { -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;int cnt;if (IS_NOQUOTA (inode))
@@ -1685,7 +1694,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)int cnt, ret =0 , index;struct dquot_warn warn[MAXQUOTAS ];int reserve = flags &DQUOT_SPACE_RESERVE ; -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;if (!inode_quota_active (inode)) {
@@ -1755,7 +1764,7 @@ int dquot_alloc_inode(struct inode *inode) {int cnt, ret =0 , index;struct dquot_warn warn[MAXQUOTAS ]; -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;struct dquot *dquot;if (!inode_quota_active (inode))
@@ -1800,7 +1809,7 @@ EXPORT_SYMBOL(dquot_alloc_inode);*/ int dquot_claim_space_nodirty (struct inode *inode,qsize_t number) { -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;int cnt, index;
@@ -1842,7 +1851,7 @@ EXPORT_SYMBOL(dquot_claim_space_nodirty);*/ void dquot_reclaim_space_nodirty (struct inode *inode,qsize_t number) { -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;int cnt, index;
@@ -1886,7 +1895,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags) {unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ]; -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;int reserve = flags &DQUOT_SPACE_RESERVE , index;
@@ -1943,7 +1952,7 @@ void dquot_free_inode(struct inode *inode) {unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ]; -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;struct dquot *dquot;int index;
@@ -1990,6 +1999,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)qsize_t cur_space;qsize_t rsv_space =0 ;qsize_t inode_usage =1 ; +struct dquot __rcu **dquots;struct dquot *transfer_from[MAXQUOTAS ] = {};int cnt, index, ret =0 ;char is_valid[MAXQUOTAS ] = {};
@@ -2022,6 +2032,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) } cur_space =__inode_get_bytes (inode); rsv_space =__inode_get_rsv_space (inode); + dquots =i_dquot (inode);/* * Build the transfer_from list, check limits, and update usage in * the target structures.
@@ -2036,7 +2047,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)if (!sb_has_quota_active (inode->i_sb, cnt))continue ; is_valid[cnt] =1 ; - transfer_from[cnt] =i_dquot (inode)[cnt]; + transfer_from[cnt] =srcu_dereference_check (dquots[cnt], + &dquot_srcu,lockdep_is_held (&dq_data_lock)); ret =dquot_add_inodes (transfer_to[cnt], inode_usage, &warn_to[cnt]);if (ret)
@@ -2075,7 +2087,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) rsv_space);spin_unlock (&transfer_from[cnt]->dq_dqb_lock); } -i_dquot (inode)[cnt] = transfer_to[cnt]; +rcu_assign_pointer (dquots[cnt], transfer_to[cnt]); }spin_unlock (&inode->i_lock);spin_unlock (&dq_data_lock);
@@ -2086,8 +2098,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)* mark_all_dquot_dirty(). */ index =srcu_read_lock (&dquot_srcu); -mark_all_dquot_dirty (transfer_from); -mark_all_dquot_dirty (transfer_to); +mark_all_dquot_dirty ((struct dquot __rcu **)transfer_from); +mark_all_dquot_dirty ((struct dquot __rcu **)transfer_to);srcu_read_unlock (&dquot_srcu, index);flush_warnings (warn_to);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 276/451 PCI: switchtec: Fix an error handling path in switchtec_pci_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit dec529b0b0572b32f9eb91c882dd1f08ca657efb ]
The commit in Fixes changed the logic on how resources are released and introduced a new switchtec_exit_pci() that need to be called explicitly in order to undo a corresponding switchtec_init_pci().
This was done in the remove function, but not in the probe.
Fix the probe now.
--- drivers/pci/switch/switchtec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/switch/switchtec.c +3 -1
@@ -1674,7 +1674,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, rc =switchtec_init_isr (stdev);if (rc) {dev_err (&stdev->dev,"failed to init isr.\n" ); - goto err_put; + goto err_exit_pci; } iowrite32(SWITCHTEC_EVENT_CLEAR |
@@ -1695,6 +1695,8 @@ static int switchtec_pci_probe(struct pci_dev *pdev, err_devadd:stdev_kill (stdev); +err_exit_pci: +switchtec_exit_pci (stdev); err_put:ida_free (&switchtec_minor_ida,MINOR (stdev->dev.devt));put_device (&stdev->dev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 277/451 crypto: xilinx - call finalize with bh disabled
In reply to Sasha LevinFrom: Quanyang Wang <[email protected]>
[ Upstream commit a853450bf4c752e664abab0b2fad395b7ad7701c ]
When calling crypto_finalize_request, BH should be disabled to avoid triggering the following calltrace:
------------[ cut here ]------------
WARNING: CPU: 2 PID: 74 at crypto/crypto_engine.c:58 crypto_finalize_request+0xa0/0x118
Modules linked in: cryptodev(O)
CPU: 2 PID: 74 Comm: firmware:zynqmp Tainted: G O 6.8.0-rc1-yocto-standard #323
Hardware name: ZynqMP ZCU102 Rev1.0 (DT)
pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : crypto_finalize_request+0xa0/0x118
lr : crypto_finalize_request+0x104/0x118
sp : ffffffc085353ce0
x29: ffffffc085353ce0 x28: 0000000000000000 x27: ffffff8808ea8688
x26: ffffffc081715038 x25: 0000000000000000 x24: ffffff880100db00
x23: ffffff880100da80 x22: 0000000000000000 x21: 0000000000000000
x20: ffffff8805b14000 x19: ffffff880100da80 x18: 0000000000010450
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000003 x13: 0000000000000000 x12: ffffff880100dad0
x11: 0000000000000000 x10: ffffffc0832dcd08 x9 : ffffffc0812416d8
x8 : 00000000000001f4 x7 : ffffffc0830d2830 x6 : 0000000000000001
x5 : ffffffc082091000 x4 : ffffffc082091658 x3 : 0000000000000000
x2 : ffffffc7f9653000 x1 : 0000000000000000 x0 : ffffff8802d20000
Call trace:
crypto_finalize_request+0xa0/0x118
crypto_finalize_aead_request+0x18/0x30
zynqmp_handle_aes_req+0xcc/0x388
crypto_pump_work+0x168/0x2d8
kthread_worker_fn+0xfc/0x3a0
kthread+0x118/0x138
ret_from_fork+0x10/0x20
irq event stamp: 40
hardirqs last enabled at (39): [<ffffffc0812416f8>] _raw_spin_unlock_irqrestore+0x70/0xb0
hardirqs last disabled at (40): [<ffffffc08122d208>] el1_dbg+0x28/0x90
softirqs last enabled at (36): [<ffffffc080017dec>] kernel_neon_begin+0x8c/0xf0
softirqs last disabled at (34): [<ffffffc080017dc0>] kernel_neon_begin+0x60/0xf0
---[ end trace 0000000000000000 ]------ drivers/crypto/xilinx/zynqmp-aes-gcm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/xilinx/zynqmp-aes-gcm.c +3 -0
@@ -231,7 +231,10 @@ static int zynqmp_handle_aes_req(struct crypto_engine *engine, err =zynqmp_aes_aead_cipher (areq); } +local_bh_disable ();crypto_finalize_aead_request (engine, areq, err); +local_bh_enable (); +return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 278/451 perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str()
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit 1eb3d924e3c0b8c27388b0583a989d757866efb6 ]
slist needs to be freed in both error path and normal path in thread_map__new_by_tid_str().
--- tools/perf/util/thread_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread_map.c +1 -1
@@ -279,13 +279,13 @@ struct perf_thread_map *thread_map__new_by_tid_str(const char *tid_str) threads->nr = ntasks; } out: +strlist__delete (slist);if (threads)refcount_set (&threads->refcnt,1 );return threads; out_free_threads:zfree (&threads); -strlist__delete (slist); goto out; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 279/451 drm/msm/dpu: fix the programming of INTF_CFG2_DATA_HCTL_EN
In reply to Sasha LevinFrom: Abhinav Kumar <[email protected]>
[ Upstream commit 2f4a67a3894e15c135125cb54edc5b43abc1b70e ]
Currently INTF_CFG2_DATA_HCTL_EN is coupled with the enablement of widebus but this is incorrect because we should be enabling this bit independent of widebus except for cases where compression is enabled in one pixel per clock mode.
Fix this by making the condition checks more explicit and enabling INTF_CFG2_DATA_HCTL_EN for all other cases when supported by DPU.
Patchwork: https://patchwork.freedesktop.org/patch/576722/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 7 +++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 7 +++++++ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 15 +++++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 + 5 files changed, 25 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +7 -0
@@ -228,6 +228,13 @@ bool dpu_encoder_is_widebus_enabled(const struct drm_encoder *drm_enc)return dpu_enc->wide_bus_en; } +bool dpu_encoder_is_dsc_enabled (const struct drm_encoder *drm_enc) +{ +const struct dpu_encoder_virt *dpu_enc =to_dpu_encoder_virt (drm_enc); + +return dpu_enc->dsc ? true : false; +} +int dpu_encoder_get_crc_values_cnt (const struct drm_encoder *drm_enc) {struct dpu_encoder_virt *dpu_enc;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +7 -0
@@ -175,6 +175,13 @@ int dpu_encoder_get_vsync_count(struct drm_encoder *drm_enc);bool dpu_encoder_is_widebus_enabled (const struct drm_encoder *drm_enc); +/** +* dpu_encoder_is_dsc_enabled - indicate whether dsc is enabled +* for the encoder. +* @drm_enc: Pointer to previously created drm encoder structure +*/ +bool dpu_encoder_is_dsc_enabled (const struct drm_encoder *drm_enc); +/** * dpu_encoder_get_crc_values_cnt - get number of physical encoders contained * in virtual encoder that can collect CRC values
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +1 -0
@@ -100,6 +100,7 @@ static void drm_mode_to_intf_timing_params( } timing->wide_bus_en =dpu_encoder_is_widebus_enabled (phys_enc->parent); + timing->compression_en =dpu_encoder_is_dsc_enabled (phys_enc->parent);/* * for DP, divide the horizonal parameters by 2 when
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +9 -6
@@ -154,13 +154,8 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx, hsync_ctl = (hsync_period <<16 ) | p->hsync_pulse_width; display_hctl = (hsync_end_x <<16 ) | hsync_start_x; -/* -* DATA_HCTL_EN controls data timing which can be different from -* video timing. It is recommended to enable it for all cases, except -* if compression is enabled in 1 pixel per clock mode -*/ if (p->wide_bus_en) - intf_cfg2 |=INTF_CFG2_DATABUS_WIDEN |INTF_CFG2_DATA_HCTL_EN ; + intf_cfg2 |=INTF_CFG2_DATABUS_WIDEN ; data_width = p->width;
@@ -230,6 +225,14 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx,DPU_REG_WRITE (c,INTF_CONFIG , intf_cfg);DPU_REG_WRITE (c,INTF_PANEL_FORMAT , panel_format);if (ctx->cap->features &BIT (DPU_DATA_HCTL_EN )) { +/* +* DATA_HCTL_EN controls data timing which can be different from +* video timing. It is recommended to enable it for all cases, except +* if compression is enabled in 1 pixel per clock mode +*/ +if (!(p->compression_en && !p->wide_bus_en)) + intf_cfg2 |=INTF_CFG2_DATA_HCTL_EN ; +DPU_REG_WRITE (c,INTF_CONFIG2 , intf_cfg2);DPU_REG_WRITE (c,INTF_DISPLAY_DATA_HCTL , display_data_hctl);DPU_REG_WRITE (c,INTF_ACTIVE_DATA_HCTL , active_data_hctl);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +1 -0
@@ -33,6 +33,7 @@ struct intf_timing_params {u32 hsync_skew;bool wide_bus_en; +bool compression_en; };struct intf_prog_fetch {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 280/451 drm/msm/dpu: Only enable DSC_MODE_MULTIPLEX if dsc_merge is enabled
In reply to Sasha LevinFrom: Marijn Suijten <[email protected]>
[ Upstream commit 06267d22f9ee6fd34150b6dcdb2fa6983e1a85bc ]
When the topology calls for two interfaces on the current fixed topology of 2 DSC blocks, or uses 1 DSC block for a single interface (e.g. SC7280 with only one DSC block), there should be no merging of DSC output.
This is already represented by the return value of dpu_encoder_use_dsc_merge(), but not yet used to correctly configure this flag.
Patchwork: https://patchwork.freedesktop.org/patch/577067/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +3 -1
@@ -1871,7 +1871,9 @@ static void dpu_encoder_prep_dsc(struct dpu_encoder_virt *dpu_enc, dsc_common_mode =0 ; pic_width = dsc->pic_width; - dsc_common_mode =DSC_MODE_MULTIPLEX |DSC_MODE_SPLIT_PANEL ; + dsc_common_mode =DSC_MODE_SPLIT_PANEL ; +if (dpu_encoder_use_dsc_merge (enc_master->parent)) + dsc_common_mode |=DSC_MODE_MULTIPLEX ;if (enc_master->intf_mode ==INTF_MODE_VIDEO ) dsc_common_mode |=DSC_MODE_VIDEO ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 281/451 drm/radeon/ni: Fix wrong firmware size logging in ni_init_microcode()
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit c4891d979c7668b195a0a75787967ec95a24ecef ]
Clean up a typo in pr_err() erroneously printing NI MC 'rdev->mc_fw->size' during SMC firmware load. Log 'rdev->smc_fw->size' instead.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/radeon/ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ni.c +1 -1
@@ -813,7 +813,7 @@ int ni_init_microcode(struct radeon_device *rdev) err =0 ; }else if (rdev->smc_fw->size != smc_req_size) {pr_err ("ni_mc: Bogus length %zu in firmware \"%s\"\n" , - rdev->mc_fw->size, fw_name); + rdev->smc_fw->size, fw_name); err = -EINVAL ; } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 282/451 clk: renesas: r8a779g0: Add CMT clocks
In reply to Sasha LevinFrom: Wolfram Sang <[email protected]>
[ Upstream commit 523ed9442b997c39220ee364b07a8773623e3a58 ]
Stable-dep-of: abb3fa662b8f ("clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks")
--- drivers/clk/renesas/r8a779g0-cpg-mssr.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/renesas/r8a779g0-cpg-mssr.c +4 -0
@@ -169,6 +169,10 @@ static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = {DEF_MOD ("i2c4" ,522 ,R8A779G0_CLK_S0D6_PER ),DEF_MOD ("i2c5" ,523 ,R8A779G0_CLK_S0D6_PER ),DEF_MOD ("wdt1:wdt0" ,907 ,R8A779G0_CLK_R ), +DEF_MOD ("cmt0" ,910 ,R8A779G0_CLK_R ), +DEF_MOD ("cmt1" ,911 ,R8A779G0_CLK_R ), +DEF_MOD ("cmt2" ,912 ,R8A779G0_CLK_R ), +DEF_MOD ("cmt3" ,913 ,R8A779G0_CLK_R ),DEF_MOD ("pfc0" ,915 ,R8A779G0_CLK_CL16M ),DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CL16M ), DEF_MOD("pfc2", 917, R8A779G0_CLK_CL16M),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 283/451 clk: renesas: r8a779g0: Add Audio clocks
In reply to Sasha LevinFrom: Kuninori Morimoto <[email protected]>
[ Upstream commit 8dffb520ace48bcb996db049540c78261730213c ]
Add module clocks for the Audio (SSI/SSIU) blocks on the Renesas R-Car V4H (R8A779G0) SoC.
Stable-dep-of: abb3fa662b8f ("clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks")
--- drivers/clk/renesas/r8a779g0-cpg-mssr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/renesas/r8a779g0-cpg-mssr.c +2 -0
@@ -177,6 +177,8 @@ static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = {DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CL16M ),DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CL16M ),DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CL16M ), +DEF_MOD ("ssiu" ,2926 ,R8A779G0_CLK_S0D6_PER ), + DEF_MOD("ssi", 2927, R8A779G0_CLK_S0D6_PER), };/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 284/451 clk: renesas: r8a779g0: Add thermal clock
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 7502a04dae0e614bc14553e31461e50499bc67aa ]
Add the module clock used by the Thermal Sensor/Chip Internal Voltage Monitor/Core Voltage Monitor (THS/CIVM/CVM) on the Renesas R-Car V4H (R8A779G0) SoC.
Based on a large patch in the BSP by Kazuya Mizuguchi.
Stable-dep-of: abb3fa662b8f ("clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks")
--- drivers/clk/renesas/r8a779g0-cpg-mssr.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/renesas/r8a779g0-cpg-mssr.c +1 -0
@@ -177,6 +177,7 @@ static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = {DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CL16M ),DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CL16M ),DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CL16M ), +DEF_MOD ("tsc" ,919 ,R8A779G0_CLK_CL16M ),DEF_MOD ("ssiu" ,2926 ,R8A779G0_CLK_S0D6_PER ), DEF_MOD("ssi", 2927, R8A779G0_CLK_S0D6_PER), };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 285/451 clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit abb3fa662b8f8eaed1590b0e7a4e19eda467cdd3 ]
According to the R-Car V4H Series Hardware User’s Manual Rev.1.00, the parent clock of the Pin Function (PFC/GPIO) module clocks is the CP clock.
Fix this by adding the missing CP clock, and correcting the PFC parents.
--- drivers/clk/renesas/r8a779g0-cpg-mssr.c | 11 ++++++----- include/dt-bindings/clock/r8a779g0-cpg-mssr.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/clk/renesas/r8a779g0-cpg-mssr.c +6 -5
@@ -22,7 +22,7 @@enum clk_ids {/* Core Clock Outputs exported to DT */ -LAST_DT_CORE_CLK =R8A779G0_CLK_R , +LAST_DT_CORE_CLK =R8A779G0_CLK_CP ,/* External Input Clocks */ CLK_EXTAL ,
@@ -139,6 +139,7 @@ static const struct cpg_core_clk r8a779g0_core_clks[] __initconst = {DEF_FIXED ("svd2_vip" ,R8A779G0_CLK_SVD2_VIP ,CLK_SV_VIP ,2 ,1 ),DEF_FIXED ("cbfusa" ,R8A779G0_CLK_CBFUSA ,CLK_EXTAL ,2 ,1 ),DEF_FIXED ("cpex" ,R8A779G0_CLK_CPEX ,CLK_EXTAL ,2 ,1 ), +DEF_FIXED ("cp" ,R8A779G0_CLK_CP ,CLK_EXTAL ,2 ,1 ),DEF_FIXED ("viobus" ,R8A779G0_CLK_VIOBUS ,CLK_VIO ,1 ,1 ),DEF_FIXED ("viobusd2" ,R8A779G0_CLK_VIOBUSD2 ,CLK_VIO ,2 ,1 ), DEF_FIXED("vcbus", R8A779G0_CLK_VCBUS, CLK_VC, 1, 1),
@@ -173,10 +174,10 @@ static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,911 ,R8A779G0_CLK_R ),DEF_MOD ("cmt2" ,912 ,R8A779G0_CLK_R ),DEF_MOD ("cmt3" ,913 ,R8A779G0_CLK_R ), -DEF_MOD ("pfc0" ,915 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CL16M ), +DEF_MOD ("pfc0" ,915 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CP ),DEF_MOD ("tsc" ,919 ,R8A779G0_CLK_CL16M ),DEF_MOD ("ssiu" ,2926 ,R8A779G0_CLK_S0D6_PER ), DEF_MOD("ssi", 2927, R8A779G0_CLK_S0D6_PER),
include/dt-bindings/clock/r8a779g0-cpg-mssr.h +1 -0
@@ -86,5 +86,6 @@#define R8A779G0_CLK_CPEX 74#define R8A779G0_CLK_CBFUSA 75#define R8A779G0_CLK_R 76 +#define R8A779G0_CLK_CP 77#endif /* __DT_BINDINGS_CLOCK_R8A779G0_CPG_MSSR_H__ */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 286/451 clk: renesas: r8a779f0: Correct PFC/GPIO parent clock
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit d1b32a83a02d9433dbd8c5f4d6fc44aa597755bd ]
According to the R-Car S4 Series Hardware User’s Manual Rev.0.81, the parent clock of the Pin Function (PFC/GPIO) module clock is the CP clock.
As this clock is not documented to exist on R-Car S4, use the CPEX clock instead.
--- drivers/clk/renesas/r8a779f0-cpg-mssr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +1 -1
@@ -159,7 +159,7 @@ static const struct mssr_mod_clk r8a779f0_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,911 ,R8A779F0_CLK_R ),DEF_MOD ("cmt2" ,912 ,R8A779F0_CLK_R ),DEF_MOD ("cmt3" ,913 ,R8A779F0_CLK_R ), -DEF_MOD ("pfc0" ,915 ,R8A779F0_CLK_CL16M ), +DEF_MOD ("pfc0" ,915 ,R8A779F0_CLK_CPEX ),DEF_MOD ("tsc" ,919 ,R8A779F0_CLK_CL16M ), DEF_MOD("ufs", 1514, R8A779F0_CLK_S0D4_HSC), };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 287/451 ALSA: seq: fix function cast warnings
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit d7bf73809849463f76de42aad62c850305dd6c5d ]
clang-16 points out a control flow integrity (kcfi) issue when event callbacks get converted to incompatible types:
sound/core/seq/seq_midi.c:135:30: error: cast from 'int (*)(struct snd_rawmidi_substream *, const char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
135 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/seq/seq_virmidi.c:83:31: error: cast from 'int (*)(struct snd_rawmidi_substream *, const unsigned char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
83 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~For addressing those errors, introduce wrapper functions that are used for callbacks and bridge to the actual function call with pointer cast.
The code was originally added with the initial ALSA merge in linux-2.5.4.
[ the patch description shamelessly copied from Arnd's original patch
-- tiwai ]
--- sound/core/seq/seq_midi.c | 8 +++++++- sound/core/seq/seq_virmidi.c | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-)
sound/core/seq/seq_midi.c +7 -1
@@ -112,6 +112,12 @@ static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, ireturn 0 ; } +/* callback for snd_seq_dump_var_event(), bridging to dump_midi() */ +static int __dump_midi (void *ptr,void *buf,int count) +{ +return dump_midi (ptr, buf, count); +} +static int event_process_midi (struct snd_seq_event *ev,int direct,void *private_data,int atomic,int hop) {
@@ -131,7 +137,7 @@ static int event_process_midi(struct snd_seq_event *ev, int direct,pr_debug ("ALSA: seq_midi: invalid sysex event flags = 0x%x\n" , ev->flags);return 0 ; } -snd_seq_dump_var_event (ev, (snd_seq_dump_func_t )dump_midi, substream); +snd_seq_dump_var_event (ev, __dump_midi, substream);snd_midi_event_reset_decode (msynth->parser); }else {if (msynth->parser ==NULL )
sound/core/seq/seq_virmidi.c +8 -1
@@ -62,6 +62,13 @@ static void snd_virmidi_init_event(struct snd_virmidi *vmidi,/* * decode input event and put to read buffer of each opened file */ + +/* callback for snd_seq_dump_var_event(), bridging to snd_rawmidi_receive() */ +static int dump_to_rawmidi (void *ptr,void *buf,int count) +{ +return snd_rawmidi_receive (ptr, buf, count); +} +static int snd_virmidi_dev_receive_event (struct snd_virmidi_dev *rdev,struct snd_seq_event *ev,bool atomic)
@@ -80,7 +87,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,if (ev->type ==SNDRV_SEQ_EVENT_SYSEX ) {if ((ev->flags &SNDRV_SEQ_EVENT_LENGTH_MASK ) !=SNDRV_SEQ_EVENT_LENGTH_VARIABLE )continue ; -snd_seq_dump_var_event (ev, (snd_seq_dump_func_t )snd_rawmidi_receive, vmidi->substream); +snd_seq_dump_var_event (ev, dump_to_rawmidi, vmidi->substream);snd_midi_event_reset_decode (vmidi->parser); }else { len =snd_midi_event_decode (vmidi->parser, msg,sizeof (msg), ev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 288/451 perf stat: Avoid metric-only segv
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 2543947c77e0e224bda86b4e7220c2f6714da463 ]
Cycles is recognized as part of a hard coded metric in stat-shadow.c, it may call print_metric_only with a NULL fmt string leading to a segfault. Handle the NULL fmt explicitly.
--- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/stat-display.c +1 -1
@@ -366,7 +366,7 @@ static void print_metric_only(struct perf_stat_config *config,if (color) mlen +=strlen (color) +sizeof (PERF_COLOR_RESET ) -1 ; -color_snprintf (str,sizeof (str), color ?:"" , fmt, val); +color_snprintf (str,sizeof (str), color ?:"" , fmt ?:"" , val);fprintf (out,"%*s " , mlen, str); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 289/451 ASoC: meson: aiu: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 98ac85a00f31d2e9d5452b825a9ed0153d934043 ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/aiu.c:243:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
243 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/aiu.c | 19 ++++--------------- sound/soc/meson/aiu.h | 1 - 2 files changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/aiu.c +4 -15
@@ -218,11 +218,12 @@ static const char * const aiu_spdif_ids[] = {static int aiu_clk_get (struct device *dev) {struct aiu *aiu =dev_get_drvdata (dev); +struct clk *pclk;int ret; - aiu->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (aiu->pclk)) -return dev_err_probe (dev,PTR_ERR (aiu->pclk),"Can't get the aiu pclk\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"Can't get the aiu pclk\n" ); aiu->spdif_mclk =devm_clk_get (dev,"spdif_mclk" );if (IS_ERR (aiu->spdif_mclk))
@@ -239,18 +240,6 @@ static int aiu_clk_get(struct device *dev)if (ret)return dev_err_probe (dev, ret,"Can't get the spdif clocks\n" ); - ret =clk_prepare_enable (aiu->pclk); -if (ret) { -dev_err (dev,"peripheral clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - aiu->pclk); -if (ret) -dev_err (dev,"failed to add reset action on pclk" ); -return ret; }
sound/soc/meson/aiu.h +0 -1
@@ -33,7 +33,6 @@ struct aiu_platform_data { };struct aiu { -struct clk *pclk;struct clk *spdif_mclk;struct aiu_interface i2s;struct aiu_interface spdif;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 290/451 ASoC: meson: t9015: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 5ad992c71b6a8e8a547954addc7af9fbde6ca10a ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/t9015.c:274:4: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
274 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/t9015.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/t9015.c +4 -16
@@ -48,7 +48,6 @@#define POWER_CFG 0x10struct t9015 { -struct clk *pclk;struct regulator *avdd; };
@@ -249,6 +248,7 @@ static int t9015_probe(struct platform_device *pdev)struct t9015 *priv;void __iomem *regs;struct regmap *regmap; +struct clk *pclk;int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );
@@ -256,26 +256,14 @@ static int t9015_probe(struct platform_device *pdev)return -ENOMEM ;platform_set_drvdata (pdev, priv); - priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) -return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get core clock\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"failed to get core clock\n" ); priv->avdd =devm_regulator_get (dev,"AVDD" );if (IS_ERR (priv->avdd))return dev_err_probe (dev,PTR_ERR (priv->avdd),"failed to AVDD\n" ); - ret =clk_prepare_enable (priv->pclk); -if (ret) { -dev_err (dev,"core clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - priv->pclk); -if (ret) -return ret; - ret =device_reset (dev);if (ret) {dev_err (dev,"reset failed\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 291/451 powerpc: Force inlining of arch_vmap_p{u/m}d_supported()
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit c5aebb53b32460bc52680dd4e2a2f6b84d5ea521 ]
arch_vmap_pud_supported() and arch_vmap_pmd_supported() are expected to constant-fold to false when RADIX is not enabled.
Force inlining in order to avoid following failure which leads to unexpected call of non-existing pud_set_huge() and pmd_set_huge() on powerpc 8xx.
In function 'pud_huge_tests',
inlined from 'debug_vm_pgtable' at mm/debug_vm_pgtable.c:1399:2:./arch/powerpc/include/asm/vmalloc.h:9:33: warning: inlining failed in call to 'arch_vmap_pud_supported.isra': call is unlikely and code size would grow [-Winline]
9 | #define arch_vmap_pud_supported arch_vmap_pud_supported
| ^~~~~~~~~~~~~~~~~~~~~~~./arch/powerpc/include/asm/vmalloc.h:10:20: note: in expansion of macro 'arch_vmap_pud_supported'
10 | static inline bool arch_vmap_pud_supported(pgprot_t prot)
| ^~~~~~~~~~~~~~~~~~~~~~~
./arch/powerpc/include/asm/vmalloc.h:9:33: note: called from here
9 | #define arch_vmap_pud_supported arch_vmap_pud_supportedmm/debug_vm_pgtable.c:458:14: note: in expansion of macro 'arch_vmap_pud_supported'
458 | if (!arch_vmap_pud_supported(args->page_prot) ||
| ^~~~~~~~~~~~~~~~~~~~~~~
--- arch/powerpc/include/asm/vmalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/vmalloc.h +2 -2
@@ -7,14 +7,14 @@#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP #define arch_vmap_pud_supported arch_vmap_pud_supported -static inline bool arch_vmap_pud_supported (pgprot_t prot) +static __always_inline bool arch_vmap_pud_supported(pgprot_t prot) {/* HPT does not cope with large pages in the vmalloc area */ return radix_enabled (); }#define arch_vmap_pmd_supported arch_vmap_pmd_supported -static inline bool arch_vmap_pmd_supported (pgprot_t prot) +static __always_inline bool arch_vmap_pmd_supported(pgprot_t prot) {return radix_enabled (); }
Signature · 1 line
2.43.0