From: Greg Kroah-Hartman Date: Mon, 28 Jul 2025 16:15:14 +0000 (+0200) Subject: 6.12-stable patches X-Git-Tag: v6.6.101~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3773ed214d9edbdc201a7b927a88ef3195167792;p=thirdparty%2Fkernel%2Fstable-queue.git 6.12-stable patches added patches: rust-give-clippy-the-minimum-supported-rust-version.patch selftests-bpf-add-tests-with-stack-ptr-register-in-conditional-jmp.patch usb-typec-tcpm-allow-switching-to-mode-accessory-to-mux-properly.patch usb-typec-tcpm-allow-to-use-sink-in-accessory-mode.patch usb-typec-tcpm-apply-vbus-before-data-bringup-in-tcpm_src_attach.patch --- diff --git a/queue-6.12/rust-give-clippy-the-minimum-supported-rust-version.patch b/queue-6.12/rust-give-clippy-the-minimum-supported-rust-version.patch new file mode 100644 index 0000000000..d23ce29c16 --- /dev/null +++ b/queue-6.12/rust-give-clippy-the-minimum-supported-rust-version.patch @@ -0,0 +1,50 @@ +From f0915acd1fc6060a35e3f18673072671583ff0be Mon Sep 17 00:00:00 2001 +From: Miguel Ojeda +Date: Sat, 23 Nov 2024 23:23:45 +0100 +Subject: rust: give Clippy the minimum supported Rust version + +From: Miguel Ojeda + +commit f0915acd1fc6060a35e3f18673072671583ff0be upstream. + +Clippy's lints may avoid emitting a suggestion to use a language or +library feature that is not supported by the minimum supported version, +if given by the `msrv` field in the configuration file. + +For instance, Clippy should not suggest using `let ... else` in a lint +if the MSRV did not implement that syntax. + +If the MSRV is not provided, Clippy will assume all features are available. + +Thus enable it with the minimum Rust version the kernel supports. + +Note that there is currently a small disadvantage in doing so: since +we still use unstable features that nevertheless work in the range +of versions we support (e.g. `#[expect(...)]`), we lose suggestions +for those. However, over time we will stop using unstable features +(especially language and library ones) as it is our goal, thus, in the +end, we will want to have the `msrv` set. + +Rust is also considering adding a similar feature in `rustc` too, which +we should probably enable if it becomes available [2]. + +Link: https://github.com/rust-lang/rust-clippy/blob/8298da72e7b81fa30c515631b40fc4c0845948cb/clippy_utils/src/msrvs.rs#L20 [1] +Link: https://github.com/rust-lang/compiler-team/issues/772 [2] +Reviewed-by: Alice Ryhl +Link: https://lore.kernel.org/r/20241123222345.346976-1-ojeda@kernel.org +Signed-off-by: Miguel Ojeda +Signed-off-by: Greg Kroah-Hartman +--- + .clippy.toml | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/.clippy.toml ++++ b/.clippy.toml +@@ -1,5 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + ++msrv = "1.78.0" ++ + check-private-items = true + + disallowed-macros = [ diff --git a/queue-6.12/selftests-bpf-add-tests-with-stack-ptr-register-in-conditional-jmp.patch b/queue-6.12/selftests-bpf-add-tests-with-stack-ptr-register-in-conditional-jmp.patch new file mode 100644 index 0000000000..127bbec3f2 --- /dev/null +++ b/queue-6.12/selftests-bpf-add-tests-with-stack-ptr-register-in-conditional-jmp.patch @@ -0,0 +1,121 @@ +From 5ffb537e416ee22dbfb3d552102e50da33fec7f6 Mon Sep 17 00:00:00 2001 +From: Yonghong Song +Date: Fri, 23 May 2025 21:13:40 -0700 +Subject: selftests/bpf: Add tests with stack ptr register in conditional jmp + +From: Yonghong Song + +commit 5ffb537e416ee22dbfb3d552102e50da33fec7f6 upstream. + +Add two tests: + - one test has 'rX r10' where rX is not r10, and + - another test has 'rX rY' where rX and rY are not r10 + but there is an early insn 'rX = r10'. + +Without previous verifier change, both tests will fail. + +Signed-off-by: Yonghong Song +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20250524041340.4046304-1-yonghong.song@linux.dev +[ shung-hsi.yu: contains additional hunks for kernel/bpf/verifier.c that + should be part of the previous patch in the series, commit + e2d2115e56c4 "bpf: Do not include stack ptr register in precision + backtracking bookkeeping", which already incorporated. ] +Link: https://lore.kernel.org/all/9b41f9f5-396f-47e0-9a12-46c52087df6c@linux.dev/ +Signed-off-by: Shung-Hsi Yu +Signed-off-by: Greg Kroah-Hartman +--- +Verified that newly added test passes in 6.15.y[1] as well as 6.12.y[2] + +1: https://github.com/shunghsiyu/libbpf/actions/runs/16561115937/job/46830912531 +2: https://github.com/shunghsiyu/libbpf/actions/runs/16561115937/job/46830912533 +--- + kernel/bpf/verifier.c | 7 +- + tools/testing/selftests/bpf/progs/verifier_precision.c | 53 +++++++++++++++++ + 2 files changed, 58 insertions(+), 2 deletions(-) + +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -15480,6 +15480,8 @@ static int check_cond_jmp_op(struct bpf_ + + if (src_reg->type == PTR_TO_STACK) + insn_flags |= INSN_F_SRC_REG_STACK; ++ if (dst_reg->type == PTR_TO_STACK) ++ insn_flags |= INSN_F_DST_REG_STACK; + } else { + if (insn->src_reg != BPF_REG_0) { + verbose(env, "BPF_JMP/JMP32 uses reserved fields\n"); +@@ -15489,10 +15491,11 @@ static int check_cond_jmp_op(struct bpf_ + memset(src_reg, 0, sizeof(*src_reg)); + src_reg->type = SCALAR_VALUE; + __mark_reg_known(src_reg, insn->imm); ++ ++ if (dst_reg->type == PTR_TO_STACK) ++ insn_flags |= INSN_F_DST_REG_STACK; + } + +- if (dst_reg->type == PTR_TO_STACK) +- insn_flags |= INSN_F_DST_REG_STACK; + if (insn_flags) { + err = push_insn_history(env, this_branch, insn_flags, 0); + if (err) +--- a/tools/testing/selftests/bpf/progs/verifier_precision.c ++++ b/tools/testing/selftests/bpf/progs/verifier_precision.c +@@ -130,4 +130,57 @@ __naked int state_loop_first_last_equal( + ); + } + ++__used __naked static void __bpf_cond_op_r10(void) ++{ ++ asm volatile ( ++ "r2 = 2314885393468386424 ll;" ++ "goto +0;" ++ "if r2 <= r10 goto +3;" ++ "if r1 >= -1835016 goto +0;" ++ "if r2 <= 8 goto +0;" ++ "if r3 <= 0 goto +0;" ++ "exit;" ++ ::: __clobber_all); ++} ++ ++SEC("?raw_tp") ++__success __log_level(2) ++__msg("8: (bd) if r2 <= r10 goto pc+3") ++__msg("9: (35) if r1 >= 0xffe3fff8 goto pc+0") ++__msg("10: (b5) if r2 <= 0x8 goto pc+0") ++__msg("mark_precise: frame1: last_idx 10 first_idx 0 subseq_idx -1") ++__msg("mark_precise: frame1: regs=r2 stack= before 9: (35) if r1 >= 0xffe3fff8 goto pc+0") ++__msg("mark_precise: frame1: regs=r2 stack= before 8: (bd) if r2 <= r10 goto pc+3") ++__msg("mark_precise: frame1: regs=r2 stack= before 7: (05) goto pc+0") ++__naked void bpf_cond_op_r10(void) ++{ ++ asm volatile ( ++ "r3 = 0 ll;" ++ "call __bpf_cond_op_r10;" ++ "r0 = 0;" ++ "exit;" ++ ::: __clobber_all); ++} ++ ++SEC("?raw_tp") ++__success __log_level(2) ++__msg("3: (bf) r3 = r10") ++__msg("4: (bd) if r3 <= r2 goto pc+1") ++__msg("5: (b5) if r2 <= 0x8 goto pc+2") ++__msg("mark_precise: frame0: last_idx 5 first_idx 0 subseq_idx -1") ++__msg("mark_precise: frame0: regs=r2 stack= before 4: (bd) if r3 <= r2 goto pc+1") ++__msg("mark_precise: frame0: regs=r2 stack= before 3: (bf) r3 = r10") ++__naked void bpf_cond_op_not_r10(void) ++{ ++ asm volatile ( ++ "r0 = 0;" ++ "r2 = 2314885393468386424 ll;" ++ "r3 = r10;" ++ "if r3 <= r2 goto +1;" ++ "if r2 <= 8 goto +2;" ++ "r0 = 2 ll;" ++ "exit;" ++ ::: __clobber_all); ++} ++ + char _license[] SEC("license") = "GPL"; diff --git a/queue-6.12/series b/queue-6.12/series index b6f293cfdd..6c5d983a30 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -64,3 +64,8 @@ selftests-mptcp-connect-also-cover-alt-modes.patch selftests-mptcp-connect-also-cover-checksum.patch mm-vmscan-fix-hwpoisoned-large-folio-handling-in-shrink_folio_list.patch mm-zsmalloc-do-not-pass-__gfp_movable-if-config_compaction-n.patch +rust-give-clippy-the-minimum-supported-rust-version.patch +selftests-bpf-add-tests-with-stack-ptr-register-in-conditional-jmp.patch +usb-typec-tcpm-allow-to-use-sink-in-accessory-mode.patch +usb-typec-tcpm-allow-switching-to-mode-accessory-to-mux-properly.patch +usb-typec-tcpm-apply-vbus-before-data-bringup-in-tcpm_src_attach.patch diff --git a/queue-6.12/usb-typec-tcpm-allow-switching-to-mode-accessory-to-mux-properly.patch b/queue-6.12/usb-typec-tcpm-allow-switching-to-mode-accessory-to-mux-properly.patch new file mode 100644 index 0000000000..5a8bc2b010 --- /dev/null +++ b/queue-6.12/usb-typec-tcpm-allow-switching-to-mode-accessory-to-mux-properly.patch @@ -0,0 +1,120 @@ +From 8a50da849151e7e12b43c1d8fe7ad302223aef6b Mon Sep 17 00:00:00 2001 +From: Michael Grzeschik +Date: Fri, 4 Apr 2025 00:43:06 +0200 +Subject: usb: typec: tcpm: allow switching to mode accessory to mux properly + +From: Michael Grzeschik + +commit 8a50da849151e7e12b43c1d8fe7ad302223aef6b upstream. + +The funciton tcpm_acc_attach is not setting the proper state when +calling tcpm_set_role. The function tcpm_set_role is currently only +handling TYPEC_STATE_USB. For the tcpm_acc_attach to switch into other +modal states tcpm_set_role needs to be extended by an extra state +parameter. This patch is handling the proper state change when calling +tcpm_acc_attach. + +Signed-off-by: Michael Grzeschik +Reviewed-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20250404-ml-topic-tcpm-v1-3-b99f44badce8@pengutronix.de +Stable-dep-of: bec15191d523 ("usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach") +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/tcpm/tcpm.c | 27 ++++++++++++++++++--------- + 1 file changed, 18 insertions(+), 9 deletions(-) + +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -1132,7 +1132,7 @@ static int tcpm_set_attached_state(struc + port->data_role); + } + +-static int tcpm_set_roles(struct tcpm_port *port, bool attached, ++static int tcpm_set_roles(struct tcpm_port *port, bool attached, int state, + enum typec_role role, enum typec_data_role data) + { + enum typec_orientation orientation; +@@ -1169,7 +1169,7 @@ static int tcpm_set_roles(struct tcpm_po + } + } + +- ret = tcpm_mux_set(port, TYPEC_STATE_USB, usb_role, orientation); ++ ret = tcpm_mux_set(port, state, usb_role, orientation); + if (ret < 0) + return ret; + +@@ -4339,7 +4339,8 @@ static int tcpm_src_attach(struct tcpm_p + + tcpm_enable_auto_vbus_discharge(port, true); + +- ret = tcpm_set_roles(port, true, TYPEC_SOURCE, tcpm_data_role_for_source(port)); ++ ret = tcpm_set_roles(port, true, TYPEC_STATE_USB, ++ TYPEC_SOURCE, tcpm_data_role_for_source(port)); + if (ret < 0) + return ret; + +@@ -4514,7 +4515,8 @@ static int tcpm_snk_attach(struct tcpm_p + + tcpm_enable_auto_vbus_discharge(port, true); + +- ret = tcpm_set_roles(port, true, TYPEC_SINK, tcpm_data_role_for_sink(port)); ++ ret = tcpm_set_roles(port, true, TYPEC_STATE_USB, ++ TYPEC_SINK, tcpm_data_role_for_sink(port)); + if (ret < 0) + return ret; + +@@ -4539,6 +4541,7 @@ static int tcpm_acc_attach(struct tcpm_p + int ret; + enum typec_role role; + enum typec_data_role data; ++ int state = TYPEC_STATE_USB; + + if (port->attached) + return 0; +@@ -4547,7 +4550,13 @@ static int tcpm_acc_attach(struct tcpm_p + data = tcpm_port_is_sink(port) ? tcpm_data_role_for_sink(port) + : tcpm_data_role_for_source(port); + +- ret = tcpm_set_roles(port, true, role, data); ++ if (tcpm_port_is_audio(port)) ++ state = TYPEC_MODE_AUDIO; ++ ++ if (tcpm_port_is_debug(port)) ++ state = TYPEC_MODE_DEBUG; ++ ++ ret = tcpm_set_roles(port, true, state, role, data); + if (ret < 0) + return ret; + +@@ -5306,7 +5315,7 @@ static void run_state_machine(struct tcp + */ + tcpm_set_vconn(port, false); + tcpm_set_vbus(port, false); +- tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE, ++ tcpm_set_roles(port, port->self_powered, TYPEC_STATE_USB, TYPEC_SOURCE, + tcpm_data_role_for_source(port)); + /* + * If tcpc fails to notify vbus off, TCPM will wait for PD_T_SAFE_0V + +@@ -5338,7 +5347,7 @@ static void run_state_machine(struct tcp + tcpm_set_vconn(port, false); + if (port->pd_capable) + tcpm_set_charge(port, false); +- tcpm_set_roles(port, port->self_powered, TYPEC_SINK, ++ tcpm_set_roles(port, port->self_powered, TYPEC_STATE_USB, TYPEC_SINK, + tcpm_data_role_for_sink(port)); + /* + * VBUS may or may not toggle, depending on the adapter. +@@ -5462,10 +5471,10 @@ static void run_state_machine(struct tcp + case DR_SWAP_CHANGE_DR: + tcpm_unregister_altmodes(port); + if (port->data_role == TYPEC_HOST) +- tcpm_set_roles(port, true, port->pwr_role, ++ tcpm_set_roles(port, true, TYPEC_STATE_USB, port->pwr_role, + TYPEC_DEVICE); + else +- tcpm_set_roles(port, true, port->pwr_role, ++ tcpm_set_roles(port, true, TYPEC_STATE_USB, port->pwr_role, + TYPEC_HOST); + tcpm_ams_finish(port); + tcpm_set_state(port, ready_state(port), 0); diff --git a/queue-6.12/usb-typec-tcpm-allow-to-use-sink-in-accessory-mode.patch b/queue-6.12/usb-typec-tcpm-allow-to-use-sink-in-accessory-mode.patch new file mode 100644 index 0000000000..48ae50762f --- /dev/null +++ b/queue-6.12/usb-typec-tcpm-allow-to-use-sink-in-accessory-mode.patch @@ -0,0 +1,44 @@ +From 64843d0ba96d3eae297025562111d57585273366 Mon Sep 17 00:00:00 2001 +From: Michael Grzeschik +Date: Fri, 4 Apr 2025 00:43:04 +0200 +Subject: usb: typec: tcpm: allow to use sink in accessory mode + +From: Michael Grzeschik + +commit 64843d0ba96d3eae297025562111d57585273366 upstream. + +Since the function tcpm_acc_attach is not setting the data and role for +for the sink case we extend it to check for it first. + +Signed-off-by: Michael Grzeschik +Reviewed-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20250404-ml-topic-tcpm-v1-1-b99f44badce8@pengutronix.de +Stable-dep-of: bec15191d523 ("usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach") +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/tcpm/tcpm.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -4537,12 +4537,17 @@ static void tcpm_snk_detach(struct tcpm_ + static int tcpm_acc_attach(struct tcpm_port *port) + { + int ret; ++ enum typec_role role; ++ enum typec_data_role data; + + if (port->attached) + return 0; + +- ret = tcpm_set_roles(port, true, TYPEC_SOURCE, +- tcpm_data_role_for_source(port)); ++ role = tcpm_port_is_sink(port) ? TYPEC_SINK : TYPEC_SOURCE; ++ data = tcpm_port_is_sink(port) ? tcpm_data_role_for_sink(port) ++ : tcpm_data_role_for_source(port); ++ ++ ret = tcpm_set_roles(port, true, role, data); + if (ret < 0) + return ret; + diff --git a/queue-6.12/usb-typec-tcpm-apply-vbus-before-data-bringup-in-tcpm_src_attach.patch b/queue-6.12/usb-typec-tcpm-apply-vbus-before-data-bringup-in-tcpm_src_attach.patch new file mode 100644 index 0000000000..5a437ccc05 --- /dev/null +++ b/queue-6.12/usb-typec-tcpm-apply-vbus-before-data-bringup-in-tcpm_src_attach.patch @@ -0,0 +1,101 @@ +From bec15191d52300defa282e3fd83820f69e447116 Mon Sep 17 00:00:00 2001 +From: RD Babiera +Date: Wed, 18 Jun 2025 23:06:04 +0000 +Subject: usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach + +From: RD Babiera + +commit bec15191d52300defa282e3fd83820f69e447116 upstream. + +This patch fixes Type-C compliance test TD 4.7.6 - Try.SNK DRP Connect +SNKAS. + +tVbusON has a limit of 275ms when entering SRC_ATTACHED. Compliance +testers can interpret the TryWait.Src to Attached.Src transition after +Try.Snk as being in Attached.Src the entire time, so ~170ms is lost +to the debounce timer. + +Setting the data role can be a costly operation in host mode, and when +completed after 100ms can cause Type-C compliance test check TD 4.7.5.V.4 +to fail. + +Turn VBUS on before tcpm_set_roles to meet timing requirement. + +Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)") +Cc: stable +Signed-off-by: RD Babiera +Reviewed-by: Badhri Jagan Sridharan +Reviewed-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20250618230606.3272497-2-rdbabiera@google.com +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/tcpm/tcpm.c | 34 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -4339,17 +4339,6 @@ static int tcpm_src_attach(struct tcpm_p + + tcpm_enable_auto_vbus_discharge(port, true); + +- ret = tcpm_set_roles(port, true, TYPEC_STATE_USB, +- TYPEC_SOURCE, tcpm_data_role_for_source(port)); +- if (ret < 0) +- return ret; +- +- if (port->pd_supported) { +- ret = port->tcpc->set_pd_rx(port->tcpc, true); +- if (ret < 0) +- goto out_disable_mux; +- } +- + /* + * USB Type-C specification, version 1.2, + * chapter 4.5.2.2.8.1 (Attached.SRC Requirements) +@@ -4359,13 +4348,24 @@ static int tcpm_src_attach(struct tcpm_p + (polarity == TYPEC_POLARITY_CC2 && port->cc1 == TYPEC_CC_RA)) { + ret = tcpm_set_vconn(port, true); + if (ret < 0) +- goto out_disable_pd; ++ return ret; + } + + ret = tcpm_set_vbus(port, true); + if (ret < 0) + goto out_disable_vconn; + ++ ret = tcpm_set_roles(port, true, TYPEC_STATE_USB, TYPEC_SOURCE, ++ tcpm_data_role_for_source(port)); ++ if (ret < 0) ++ goto out_disable_vbus; ++ ++ if (port->pd_supported) { ++ ret = port->tcpc->set_pd_rx(port->tcpc, true); ++ if (ret < 0) ++ goto out_disable_mux; ++ } ++ + port->pd_capable = false; + + port->partner = NULL; +@@ -4376,14 +4376,14 @@ static int tcpm_src_attach(struct tcpm_p + + return 0; + +-out_disable_vconn: +- tcpm_set_vconn(port, false); +-out_disable_pd: +- if (port->pd_supported) +- port->tcpc->set_pd_rx(port->tcpc, false); + out_disable_mux: + tcpm_mux_set(port, TYPEC_STATE_SAFE, USB_ROLE_NONE, + TYPEC_ORIENTATION_NONE); ++out_disable_vbus: ++ tcpm_set_vbus(port, false); ++out_disable_vconn: ++ tcpm_set_vconn(port, false); ++ + return ret; + } +