7.2.6-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 779/1815 arm64: dts: qcom: msm8998: Dont pull-up I2C pins by default in sleep
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 58ce9a2b9099bb26aed55d4e350c32af94930532 ]
When the I2C controller is disabled, no communication is expected to take place. Without traffic on the bus, the pull-up is unnecessary.
Both the vendor kernel for this platform and DTs of other SoCs in upstream concur this logic. Change the default and clean up now-NOP overrides.
--- .../dts/qcom/msm8998-sony-xperia-yoshino.dtsi | 4 ---- .../boot/dts/qcom/msm8998-xiaomi-sagit.dts | 5 ---- arch/arm64/boot/dts/qcom/msm8998.dtsi | 24 +++++++++---------- 3 files changed, 12 insertions(+), 21 deletions(-)
arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi +0 -4
@@ -229,10 +229,6 @@ rmi4-f11@11 { }; }; -&blsp1_i2c5_sleep { - bias-disable; -}; - &blsp1_uart3 { status = "okay";
arch/arm64/boot/dts/qcom/msm8998-xiaomi-sagit.dts +0 -5
@@ -217,11 +217,6 @@ rmi4-f1a@1a { }; }; -&blsp1_i2c5_sleep { - /delete-property/ bias-pull-up; - bias-disable; -}; - &blsp1_uart3 { status = "okay";
arch/arm64/boot/dts/qcom/msm8998.dtsi +12 -12
@@ -1183,7 +1183,7 @@ blsp1_i2c1_sleep: blsp1-i2c1-sleep-state-state { pins = "gpio2", "gpio3"; function = "blsp_i2c1"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp1_i2c2_default: blsp1-i2c2-default-state {
@@ -1197,7 +1197,7 @@ blsp1_i2c2_sleep: blsp1-i2c2-sleep-state-state { pins = "gpio32", "gpio33"; function = "blsp_i2c2"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp1_i2c3_default: blsp1-i2c3-default-state {
@@ -1211,7 +1211,7 @@ blsp1_i2c3_sleep: blsp1-i2c3-sleep-state { pins = "gpio47", "gpio48"; function = "blsp_i2c3"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp1_i2c4_default: blsp1-i2c4-default-state {
@@ -1225,7 +1225,7 @@ blsp1_i2c4_sleep: blsp1-i2c4-sleep-state { pins = "gpio10", "gpio11"; function = "blsp_i2c4"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp1_i2c5_default: blsp1-i2c5-default-state {
@@ -1239,7 +1239,7 @@ blsp1_i2c5_sleep: blsp1-i2c5-sleep-state { pins = "gpio87", "gpio88"; function = "blsp_i2c5"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp1_i2c6_default: blsp1-i2c6-default-state {
@@ -1253,7 +1253,7 @@ blsp1_i2c6_sleep: blsp1-i2c6-sleep-state { pins = "gpio43", "gpio44"; function = "blsp_i2c6"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp1_spi_b_default: blsp1-spi-b-default-state {
@@ -1318,7 +1318,7 @@ blsp2_i2c1_sleep: blsp2-i2c1-sleep-state { pins = "gpio55", "gpio56"; function = "blsp_i2c7"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp2_i2c2_default: blsp2-i2c2-default-state {
@@ -1332,7 +1332,7 @@ blsp2_i2c2_sleep: blsp2-i2c2-sleep-state { pins = "gpio6", "gpio7"; function = "blsp_i2c8"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp2_i2c3_default: blsp2-i2c3-default-state {
@@ -1346,7 +1346,7 @@ blsp2_i2c3_sleep: blsp2-i2c3-sleep-state { pins = "gpio51", "gpio52"; function = "blsp_i2c9"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp2_i2c4_default: blsp2-i2c4-default-state {
@@ -1360,7 +1360,7 @@ blsp2_i2c4_sleep: blsp2-i2c4-sleep-state { pins = "gpio67", "gpio68"; function = "blsp_i2c10"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp2_i2c5_default: blsp2-i2c5-default-state {
@@ -1374,7 +1374,7 @@ blsp2_i2c5_sleep: blsp2-i2c5-sleep-state { pins = "gpio60", "gpio61"; function = "blsp_i2c11"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp2_i2c6_default: blsp2-i2c6-default-state {
@@ -1388,7 +1388,7 @@ blsp2_i2c6_sleep: blsp2-i2c6-sleep-state { pins = "gpio83", "gpio84"; function = "blsp_i2c12"; drive-strength = <2>; - bias-pull-up; + bias-disable; }; blsp2_spi1_default: blsp2-spi1-default-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 780/1815 arm64: dts: qcom: msm8976-longcheer-l9360: Fix accidental node override
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit bd0bb7d97773026c9f5d5f8ff1dcf987f8051045 ]
The active and sleep pinctrl states for the touchscreen interrupt pin shared the same node name, creating a single node, accidentally overridden immediately after the definition. Alter the names to make them distinct and to silence DT checker warnings.
--- arch/arm64/boot/dts/qcom/msm8976-longcheer-l9360.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8976-longcheer-l9360.dts +2 -2
@@ -455,14 +455,14 @@ sdc2_cd_sleep: sdc2-cd-sleep-state { bias-disable; }; - ts_int_default: ts-int-state { + ts_int_default: ts-int-default-state { pins = "gpio65"; function = "gpio"; drive-strength = <2>; bias-pull-down; }; - ts_int_sleep: ts-int-state { + ts_int_sleep: ts-int-sleep-state { pins = "gpio65"; function = "gpio"; drive-strength = <2>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 781/1815 arm64: dts: qcom: sdm632-motorola-ocean: Fix LED default trigger property
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit c82ea31fb783d9ce4080eca1a7bb855f4648fc28 ]
The correct property name is "linux,default-trigger", not "default-trigger". Fix it to avoid DT checker warnings and let the OSes consume the intended information.
--- arch/arm64/boot/dts/qcom/sdm632-motorola-ocean.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm632-motorola-ocean.dts +1 -1
@@ -130,7 +130,7 @@ led-controller@36 { led: led@1 { reg = <1>; - default-trigger = "backlight"; + linux,default-trigger = "backlight"; function = LED_FUNCTION_BACKLIGHT; led-sources = <0 1 2>; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 782/1815 arm64: dts: qcom: qcs404: Fix DTBS Check errors in usb controller nodes
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Kurapati <[email protected]>
[ Upstream commit 9812d0a3077489f67afaca84dcc7e01a440ee106 ]
The following errors pop up when DTBS check is done for qcs404 based platforms:
arch/arm64/boot/dts/qcom/qcs404-evb-4000.dtb: usb@79b8800 (qcom,qcs404- dwc3): interrupt-names:1: 'qusb2_phy' was expected
from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml
arch/arm64/boot/dts/qcom/qcs404-evb-4000.dtb: usb@79b8800 (qcom,qcs404- dwc3): interrupt-names:2: 'hs_phy_irq' was expected
from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml
arch/arm64/boot/dts/qcom/qcs404-evb-4000.dtb: usb@7678800 (qcom,qcs404- dwc3): interrupt-names:2: 'hs_phy_irq' was expected
from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml
arch/arm64/boot/dts/qcom/qcs404-evb-4000.dtb: usb@7678800 (qcom,qcs404- dwc3): interrupt-names:1: 'qusb2_phy' was expected
from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml
Modify ordering of hs_phy and qusb2_phy interrupts to fix the errors.
--- arch/arm64/boot/dts/qcom/qcs404.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/qcs404.dtsi +8 -8
@@ -677,11 +677,11 @@ usb3: usb@7678800 { assigned-clock-rates = <19200000>, <200000000>; interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 319 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 319 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "pwr_event", - "hs_phy_irq", - "qusb2_phy"; + "qusb2_phy", + "hs_phy_irq"; status = "disabled";
@@ -716,11 +716,11 @@ usb2: usb@79b8800 { assigned-clock-rates = <19200000>, <133333333>; interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 318 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 318 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "pwr_event", - "hs_phy_irq", - "qusb2_phy"; + "qusb2_phy", + "hs_phy_irq"; status = "disabled";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 783/1815 clk: qcom: gcc-qcm2290: dont park QUP RCGs upon registration
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 9c4cee964e0ccc155e4ab8fa6cec88fffc262c63 ]
The gcc_qupv3_wrap0_s[0-5]_clk_src RCGs feed the QUP serial engines (UART/I2C/SPI). Since shared RCGs are parked to XO at registration time, binding the gcc-qcm2290 driver reprograms these clocks away from the rate configured by the bootloader. For the UART used as the boot console this drops early console output until the serial driver later reconfigures the clock.
Switch the QUP wrap0 clock sources over to clk_rcg2_shared_no_init_park_ops so their frequency is left unchanged at registration time, keeping the bootloader-configured console working across the gcc driver probe.
--- drivers/clk/qcom/gcc-qcm2290.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/qcom/gcc-qcm2290.c +6 -6
@@ -1082,7 +1082,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s0_clk_src_init = { .name = "gcc_qupv3_wrap0_s0_clk_src", .parent_data = gcc_parents_1, .num_parents = ARRAY_SIZE(gcc_parents_1), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s0_clk_src = {
@@ -1098,7 +1098,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s1_clk_src_init = { .name = "gcc_qupv3_wrap0_s1_clk_src", .parent_data = gcc_parents_1, .num_parents = ARRAY_SIZE(gcc_parents_1), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s1_clk_src = {
@@ -1114,7 +1114,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s2_clk_src_init = { .name = "gcc_qupv3_wrap0_s2_clk_src", .parent_data = gcc_parents_1, .num_parents = ARRAY_SIZE(gcc_parents_1), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s2_clk_src = {
@@ -1130,7 +1130,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s3_clk_src_init = { .name = "gcc_qupv3_wrap0_s3_clk_src", .parent_data = gcc_parents_1, .num_parents = ARRAY_SIZE(gcc_parents_1), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s3_clk_src = {
@@ -1146,7 +1146,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s4_clk_src_init = { .name = "gcc_qupv3_wrap0_s4_clk_src", .parent_data = gcc_parents_1, .num_parents = ARRAY_SIZE(gcc_parents_1), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s4_clk_src = {
@@ -1162,7 +1162,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s5_clk_src_init = { .name = "gcc_qupv3_wrap0_s5_clk_src", .parent_data = gcc_parents_1, .num_parents = ARRAY_SIZE(gcc_parents_1), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s5_clk_src = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 784/1815 soc: qcom: pmic_glink_altmode: Define the TBT extradata properly
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit b255c6f4e6b48e09227cd68777a5d2ec1d36dc31 ]
Before the fixes-referenced commit, there was a trailing 'u32 reserved' after the payload array. That commit gobbled it up into the thunderbolt extradata. Push it back where it belongs.
There's no functional change, since the outer struct size remains identical - struct usbc_sc8280x_tbt_data and therefore the union it's a part of made up for the difference and the res bytes were ignored anyway.
--- drivers/soc/qcom/pmic_glink_altmode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/qcom/pmic_glink_altmode.c +2 -1
@@ -53,7 +53,7 @@ struct usbc_sc8280x_tbt_data {/* This field is NOP on USB4, all cables support rounded rates by spec */ u8 rounded_cable : 1; u8 power_limited : 1; -u8 res[11 ]; +u8 res[7 ]; };struct usbc_notify {
@@ -74,6 +74,7 @@ struct usbc_notify {struct usbc_sc8280x_dp_data dp;struct usbc_sc8280x_tbt_data tbt; } extended_data; +u32 reserved; };struct usbc_sc8180x_notify {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 785/1815 arm64: dts: qcom: glymur-crd: Add FocalTech ft3d81 touchscreen support
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pradyot Kumar Nayak <[email protected]>
[ Upstream commit 67b5818ecadeb75e29c14add973b8cada2a73788 ]
The touchscreen module on Glymur/Mahua CRDs is different from the one used on Hamoa CRDs and requires the reset-gpios to be wired to the device. Without this in place the reset line will remain permanently asserted during resume leaving the device offline and causing all I2C transactions to fail with -ENXIO.
i2c_hid_of 3-0038: failed to change power setting. i2c_hid_of 3-0038: PM: dpm_run_callback():i2c_hid_core_pm_resume [i2c_hid] returns -6 i2c_hid_of 3-0038: PM: failed to resume async: error -6
The touchscreen on Glymur/Mahua-CRD is a focaltech ft3d81, which is hardware-compatible with the ft8112.
we have added the required change in DT.
--- arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/glymur-crd.dtsi +3 -4
@@ -631,14 +631,13 @@ &i2c8 { status = "okay"; touchscreen@38 { - compatible = "hid-over-i2c"; + compatible = "focaltech,ft3d81", "focaltech,ft8112"; reg = <0x38>; - hid-descr-addr = <0x1>; interrupts-extended = <&tlmm 51 IRQ_TYPE_LEVEL_LOW>; - vdd-supply = <&vreg_misc_3p3>; - vddl-supply = <&vreg_l15b_e0_1p8>; + vcc33-supply = <&vreg_misc_3p3>; + vccio-supply = <&vreg_l15b_e0_1p8>; reset-gpios = <&tlmm 48 GPIO_ACTIVE_LOW>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 786/1815 arm64: dts: qcom: sc8280xp-crd: Fix the pin index for misc_3p3_reg_en
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 0e05c183f3b97427f00d619132ba5984494f6886 ]
The correct pin is GPIO1. Fix it.
--- arch/arm64/boot/dts/qcom/sc8280xp-crd.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-crd.dts +2 -2
@@ -182,7 +182,7 @@ vreg_misc_3p3: regulator-misc-3p3 { regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; - gpio = <&pmc8280_1_gpios 2 GPIO_ACTIVE_HIGH>; + gpio = <&pmc8280_1_gpios 1 GPIO_ACTIVE_HIGH>; enable-active-high; pinctrl-names = "default";
@@ -915,7 +915,7 @@ kypd_vol_up_n: kypd-vol-up-n-state { }; misc_3p3_reg_en: misc-3p3-reg-en-state { - pins = "gpio2"; + pins = "gpio1"; function = "normal"; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 787/1815 firmware: qcom: scm: add trace events for the SMC call interface
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuvaraj Ranganathan <[email protected]>
[ Upstream commit f6bb2daa4584229af155c2488b83151999315293 ]
The SCM SMC call path is opaque at runtime. Stalls caused by firmware congestion, QCOM_SCM_WAITQ_SLEEP/RESUME cycles, and EBUSY retry loops are invisible without recompiling the kernel with temporary printk statements or attaching a hardware debugger.
Add five TRACE_EVENTs covering the complete lifecycle of an SCM call:
scm_smc_request
Emit before each arm_smccc_smc_quirk() invocation. Records the SMC function ID, decoded service and command identifiers, argument count, and up to six register arguments in hex and decimal. Because the caller loops on QCOM_SCM_INTERRUPTED, this event fires once per physical SMC instruction including inte
scm_smc_done
Emit after the outer __scm_smc_do() returns, pairing each request with its final outcome. Records the SMC function ID, the kernel error code returned to the caller, and the four firmware result registers a0-a3.
scm_waitq_sleep
Emit when the firmware returns QCOM_SCM_WAITQ_SLEEP. Records the wait-queue context and the SMC call context handles required to issue the matching WAITQ_RESUME.
scm_waitq_resume
Emit just before constructing and sending the WAITQ_RESUME follow-up call. Records the SMC call context handle being resumed.
scm_waitq_get_wq_ctx
Emit after a successful WAITQ_GET_WQ_CTX fast-call. Records the returned wait-queue context, flags, and more_pending indicator.
These events let ftrace and perf reconstruct the full sequence of firmware interactions, measure per-call and end-to-end latency, and attribute waitqueue stalls to specific service/command pairs without modifying driver source.
Stable-dep-of: 966d23c7e68e ("firmware: qcom: scm: Fix NULL dereference in IRQ handler before __scm is published")
--- drivers/firmware/qcom/qcom_scm_trace.h | 143 +++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 drivers/firmware/qcom/qcom_scm_trace.h
drivers/firmware/qcom/qcom_scm_trace.h new file +143 -0
@@ -0,0 +1,143 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +*/ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM qcom_scm + +#if !defined(_TRACE_SCM_SMC_INTERFACE_H) || defined(TRACE_HEADER_MULTI_READ ) + +#define _TRACE_SCM_SMC_INTERFACE_H + +#include <linux/tracepoint.h> + +TRACE_EVENT (scm_smc_request, + + TP_PROTO(unsigned long a0, const struct arm_smccc_args *smc), + +TP_ARGS (a0, smc), + +TP_STRUCT__entry ( + __field(u64, smc_id) + __field(u8, svc_id) + __field(u8, cmd_id) + __field(u8, args_cnt) + __dynamic_array(unsigned long, args, +min_t (u8, (smc->args[1 ] &0xF ), (u8 )6 )) + ), + +TP_fast_assign ( + __entry->smc_id = a0; + __entry->svc_id = (smc->args[0] >> 8) & 0xFF; + __entry->cmd_id = smc->args[0] & 0xFF; + u8 n = min_t(u8, (smc->args[1] & 0xF), (u8)6); + + __entry->args_cnt = n; + + unsigned long *dst = __get_dynamic_array(args); + + for (int i = 0; i < n; i++) + dst[i] = smc->args[2 + i]; + ), + +TP_printk ("smc_id:0x%08llx svc_id:0x%02x cmd_id:0x%02x args_cnt:%u args:%s" , + __entry->smc_id, __entry->svc_id, __entry->cmd_id, __entry->args_cnt, +__print_dynamic_array (args,sizeof (unsigned long ))) +); + +TRACE_EVENT (scm_waitq_sleep, + + TP_PROTO(u32 wq_ctx, u32 smc_ctx), + +TP_ARGS (wq_ctx, smc_ctx), + +TP_STRUCT__entry ( + __field(u32, wq_ctx) +__field (u32, smc_call_ctx) + ), + +TP_fast_assign ( + __entry->wq_ctx = wq_ctx; + __entry->smc_call_ctx = smc_ctx; + ), + +TP_printk ("wq_ctx:%u, smc_call_ctx:%u" , __entry->wq_ctx, __entry->smc_call_ctx) +); + +TRACE_EVENT (scm_waitq_resume, + + TP_PROTO(u32 smc_ctx), + +TP_ARGS (smc_ctx), + +TP_STRUCT__entry ( +__field (u32, smc_call_ctx) + ), + +TP_fast_assign ( + __entry->smc_call_ctx = smc_ctx; + ), + +TP_printk ("smc_call_ctx:%u" , __entry->smc_call_ctx) +); + +TRACE_EVENT (scm_waitq_get_wq_ctx, + + TP_PROTO(u32 wq_ctx, u32 flags, u32 pending), + +TP_ARGS (wq_ctx, flags, pending), + +TP_STRUCT__entry ( + __field(u32, wq_ctx) + __field(u32, flags) +__field (u32, more_pending) + ), + +TP_fast_assign ( + __entry->wq_ctx = wq_ctx; + __entry->flags = flags; + __entry->more_pending = pending; + ), + +TP_printk ("wq_ctx:%u, flags:%u, more_pending:%u" , + __entry->wq_ctx, __entry->flags, __entry->more_pending) +); + +TRACE_EVENT (scm_smc_done, + + TP_PROTO(int ret, u64 smc_id, struct arm_smccc_res *smc_res), + +TP_ARGS (ret, smc_id, smc_res), + +TP_STRUCT__entry ( + __field(int, ret) + __field(u64, smc_id) + __field(unsigned long, res) + __field(unsigned long, res0) + __field(unsigned long, res1) + __field(unsigned long, res2) + ), + +TP_fast_assign ( + __entry->ret = ret; + __entry->smc_id = smc_id; + __entry->res = smc_res->a0; + __entry->res0 = smc_res->a1; + __entry->res1 = smc_res->a2; + __entry->res2 = smc_res->a3; + ), + +TP_printk ("smc_id:0x%08llx, ret:%d res_to_callee:0x%lx res0:0x%lx res1:0x%lx res2:0x%lx" , + __entry->smc_id, __entry->ret, __entry->res, + __entry->res0, __entry->res1, __entry->res2) +); + +#endif /* _TRACE_SCM_SMC_INTERFACE_H */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE qcom_scm_trace + +#include <trace/define_trace.h> +
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 788/1815 firmware: qcom: scm: instrument SMC call path with tracepoints
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuvaraj Ranganathan <[email protected]>
[ Upstream commit 41329e72363c02facfeae063ef304aa7ced68c3b ]
Wire the five tracepoints defined in qcom_scm_trace.h into the SMC execution path by including the header with CREATE_TRACE_POINTS.
Stable-dep-of: 966d23c7e68e ("firmware: qcom: scm: Fix NULL dereference in IRQ handler before __scm is published")
--- drivers/firmware/qcom/Makefile | 1 + drivers/firmware/qcom/qcom_scm-smc.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
drivers/firmware/qcom/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_QCOM_SCM) += qcom-scm.o qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o +CFLAGS_qcom_scm-smc.o := -I$(src) obj-$(CONFIG_QCOM_TZMEM) += qcom_tzmem.o obj-$(CONFIG_QCOM_QSEECOM) += qcom_qseecom.o obj-$(CONFIG_QCOM_QSEECOM_UEFISECAPP) += qcom_qseecom_uefisecapp.o
drivers/firmware/qcom/qcom_scm-smc.c +10 -0
@@ -24,6 +24,9 @@ struct arm_smccc_args {unsigned long args[8 ]; }; +#define CREATE_TRACE_POINTS +#include "qcom_scm_trace.h" +static DEFINE_MUTEX (qcom_scm_lock);#define QCOM_SCM_EBUSY_WAIT_MS 30
@@ -44,6 +47,7 @@ static void __scm_smc_do_quirk(const struct arm_smccc_args *smc, quirk.state.a6 =0 ; do { + trace_scm_smc_request(a0, smc); arm_smccc_smc_quirk(a0, smc->args[1], smc->args[2], smc->args[3], smc->args[4], smc->args[5], quirk.state.a6, smc->args[7], res, &quirk);
@@ -83,6 +87,7 @@ int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending)if (ret)return ret; +trace_scm_waitq_get_wq_ctx (get_wq_res.a1, get_wq_res.a2, get_wq_res.a3); *wq_ctx = get_wq_res.a1; *flags = get_wq_res.a2; *more_pending = get_wq_res.a3;
@@ -105,10 +110,12 @@ static int __scm_smc_do_quirk_handle_waitq(struct device *dev, struct arm_smccc_ wq_ctx = res->a1; smc_call_ctx = res->a2; +trace_scm_waitq_sleep (wq_ctx, smc_call_ctx); ret =qcom_scm_wait_for_wq_completion (wq_ctx);if (ret)return ret; +trace_scm_waitq_resume (smc_call_ctx);fill_wq_resume_args (&resume, smc_call_ctx); smc = &resume; }
@@ -201,6 +208,9 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, } ret =__scm_smc_do (dev, &smc, &smc_res, atomic); + +trace_scm_smc_done (ret, smc.args[0 ], &smc_res); +if (ret)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 789/1815 firmware: qcom: scm: Fix NULL dereference in IRQ handler before __scm is published
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit 966d23c7e68ea32679275a7e3d2383181002c868 ]
In qcom_scm_probe(), devm_request_threaded_irq() is called before smp_store_release(&__scm, scm). Two paths can dereference __scm before it is published, both causing a NULL pointer dereference.
The IRQ handler receives scm via its data argument but passes only wq_ctx to qcom_scm_waitq_wakeup() and qcom_scm_get_completion(), which then dereference __scm directly. Thread scm through both functions so the IRQ handler path never touches __scm.
Non-atomic SMC calls made during probe (e.g. from qcom_tzmem_init via qcom_scm_shm_bridge_enable) can return WAITQ_SLEEP, causing qcom_scm_wait_for_wq_completion() to run before __scm is published and dereference it. Add platform_set_drvdata(pdev, scm) early in probe and change qcom_scm_wait_for_wq_completion() to take the device pointer and use dev_get_drvdata() to reach scm, removing any dependency on __scm.
--- drivers/firmware/qcom/qcom_scm-smc.c | 2 +- drivers/firmware/qcom/qcom_scm.c | 22 ++++++++++------------ drivers/firmware/qcom/qcom_scm.h | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-)
drivers/firmware/qcom/qcom_scm-smc.c +1 -1
@@ -111,7 +111,7 @@ static int __scm_smc_do_quirk_handle_waitq(struct device *dev, struct arm_smccc_ smc_call_ctx = res->a2;trace_scm_waitq_sleep (wq_ctx, smc_call_ctx); - ret =qcom_scm_wait_for_wq_completion (wq_ctx); + ret =qcom_scm_wait_for_wq_completion (dev, wq_ctx);if (ret)return ret;
drivers/firmware/qcom/qcom_scm.c +10 -12
@@ -2630,23 +2630,20 @@ static int qcom_scm_get_waitq_irq(struct qcom_scm *scm)return irq_create_fwspec_mapping (&fwspec); } -static struct completion *qcom_scm_get_completion (u32 wq_ctx) +static struct completion *qcom_scm_get_completion (struct qcom_scm *scm,u32 wq_ctx) { -struct completion *wq; - -if (WARN_ON_ONCE (wq_ctx >= __scm->wq_cnt)) +if (WARN_ON_ONCE (wq_ctx >= scm->wq_cnt))return ERR_PTR (-EINVAL ); - wq = &__scm->waitq_comps[wq_ctx]; - -return wq; +return &scm->waitq_comps[wq_ctx]; } -int qcom_scm_wait_for_wq_completion (u32 wq_ctx) +int qcom_scm_wait_for_wq_completion (struct device *dev,u32 wq_ctx) { +struct qcom_scm *scm =dev_get_drvdata (dev);struct completion *wq; - wq =qcom_scm_get_completion (wq_ctx); + wq =qcom_scm_get_completion (scm, wq_ctx);if (IS_ERR (wq))return PTR_ERR (wq);
@@ -2655,11 +2652,11 @@ int qcom_scm_wait_for_wq_completion(u32 wq_ctx)return 0 ; } -static int qcom_scm_waitq_wakeup (unsigned int wq_ctx) +static int qcom_scm_waitq_wakeup (struct qcom_scm *scm,unsigned int wq_ctx) {struct completion *wq; - wq =qcom_scm_get_completion (wq_ctx); + wq =qcom_scm_get_completion (scm, wq_ctx);if (IS_ERR (wq))return PTR_ERR (wq);
@@ -2686,7 +2683,7 @@ static irqreturn_t qcom_scm_irq_handler(int irq, void *data) goto out; } - ret =qcom_scm_waitq_wakeup (wq_ctx); + ret =qcom_scm_waitq_wakeup (scm, wq_ctx);if (ret) goto out; }while (more_pending);
@@ -2746,6 +2743,7 @@ static int qcom_scm_probe(struct platform_device *pdev)return -ENOMEM ; scm->dev = &pdev->dev; +platform_set_drvdata (pdev, scm); ret =qcom_scm_find_dload_address (&pdev->dev, &scm->dload_mode_addr);if (ret <0 )return ret;
drivers/firmware/qcom/qcom_scm.h +1 -1
@@ -66,7 +66,7 @@ struct qcom_scm_res {u64 result[MAX_QCOM_SCM_RETS ]; }; -int qcom_scm_wait_for_wq_completion (u32 wq_ctx); +int qcom_scm_wait_for_wq_completion (struct device *dev,u32 wq_ctx);int scm_get_wq_ctx (u32 *wq_ctx,u32 *flags,u32 *more_pending);#define SCM_SMC_FNID (s, c) ((((s) & 0xFF) << 8) | ((c) & 0xFF))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 790/1815 firmware: qcom: scm: Fix reserved memory cleanup on probe failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit b697b20cea4374d27e2134da4bb7b0ea39f36c8b ]
of_reserved_mem_device_init() adds an entry to a global list with no devres counterpart. If qcom_scm_probe() fails after the call the assignment is never cleaned up. A probe retry would add a duplicate entry, leaking the original one permanently.
Add an err_rmem label that calls of_reserved_mem_device_release() and route all error paths after of_reserved_mem_device_init() through it. of_reserved_mem_device_release() is safe to call unconditionally as it simply walks an empty list when nothing was assigned.
--- drivers/firmware/qcom/qcom_scm.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/firmware/qcom/qcom_scm.c +14 -6
@@ -2785,9 +2785,11 @@ static int qcom_scm_probe(struct platform_device *pdev) "Failed to setup the reserved memory region for TZ mem\n"); ret =qcom_tzmem_enable (scm->dev); -if (ret) -return dev_err_probe (scm->dev, ret, -"Failed to enable the TrustZone memory allocator\n" ); +if (ret) { + ret =dev_err_probe (scm->dev, ret, +"Failed to enable the TrustZone memory allocator\n" ); + goto err_rmem; + }memset (&pool_config,0 ,sizeof (pool_config)); pool_config.initial_size =0 ;
@@ -2795,9 +2797,11 @@ static int qcom_scm_probe(struct platform_device *pdev) pool_config.max_size =SZ_256K ; scm->mempool =devm_qcom_tzmem_pool_new (scm->dev, &pool_config); -if (IS_ERR (scm->mempool)) -return dev_err_probe (scm->dev,PTR_ERR (scm->mempool), -"Failed to create the SCM memory pool\n" ); +if (IS_ERR (scm->mempool)) { + ret =dev_err_probe (scm->dev,PTR_ERR (scm->mempool), +"Failed to create the SCM memory pool\n" ); + goto err_rmem; + } ret =qcom_scm_query_waitq_count (scm); scm->wq_cnt = ret <0 ?QCOM_SCM_DEFAULT_WAITQ_COUNT : ret;
@@ -2868,6 +2872,10 @@ static int qcom_scm_probe(struct platform_device *pdev)qcom_scm_gunyah_wdt_init (scm);return 0 ; + +err_rmem: +of_reserved_mem_device_release (scm->dev); +return ret; }static void qcom_scm_shutdown (struct platform_device *pdev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 791/1815 firmware: qcom: scm: Fix tzmem state on probe retry
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit 9941fe8a04f3d258e07eb5899db3027252a4190f ]
qcom_tzmem_enable() returns -EBUSY if called a second time, but this causes probe retries to fail permanently if a later step in qcom_scm_probe() defers after qcom_tzmem_enable() has already succeeded.
Use DO_ONCE() to ensure qcom_tzmem_init() runs exactly once across all calls in a thread-safe manner. qcom_tzmem_dev is set on every call since probe retries use the same device pointer. The result of the first initialisation is cached and returned to every subsequent caller.
--- drivers/firmware/qcom/qcom_tzmem.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/firmware/qcom/qcom_tzmem.c +9 -4
@@ -15,6 +15,7 @@#include <linux/kernel.h> #include <linux/list.h> #include <linux/mm.h> +#include <linux/once.h> #include <linux/radix-tree.h> #include <linux/slab.h> #include <linux/spinlock.h>
@@ -507,14 +508,18 @@ phys_addr_t qcom_tzmem_to_phys(void *vaddr) }EXPORT_SYMBOL_GPL (qcom_tzmem_to_phys); +static void qcom_tzmem_do_init (int *result) +{ + *result =qcom_tzmem_init (); +} +int qcom_tzmem_enable (struct device *dev) { -if (qcom_tzmem_dev) -return -EBUSY ; +static int result; qcom_tzmem_dev = dev; - -return qcom_tzmem_init (); +DO_ONCE (qcom_tzmem_do_init, &result); +return result; }EXPORT_SYMBOL_GPL (qcom_tzmem_enable);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 792/1815 block: fix dio leak on metadata mapping error
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 702a2a9f3dfe066a7481698c858371112f3cb697 ]
A failed integrity mapping holds a dio reference, so we need to go through the full bio ending in case there were previously submitted bio's in the sequence.
--- block/fops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
block/fops.c +4 -2
@@ -238,8 +238,10 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, }if (iocb->ki_flags &IOCB_HAS_METADATA ) { ret =bio_integrity_map_iter (bio, iocb->private); -if (unlikely (ret)) - goto fail; +if (unlikely (ret)) { +bio_endio_status (bio,errno_to_blk_status (ret)); +break ; + } }if (is_read) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 793/1815 arm64: dts: qcom: glymur: Fix PDC IRQ mapping
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 1b0b6ddd0299efa29d18f68a2d7152ad67cb9576 ]
Some of the sub-ranges are inconsistent with HW docs. Fix them. They are valid for both Glymur and Mahua.
--- arch/arm64/boot/dts/qcom/glymur.dtsi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/glymur.dtsi +7 -3
@@ -4836,9 +4836,13 @@ dispcc: clock-controller@af00000 { pdc: interrupt-controller@b220000 { compatible = "qcom,glymur-pdc", "qcom,pdc"; reg = <0x0 0x0b220000 0x0 0x10000>; - qcom,pdc-ranges = <0 745 51>, - <51 527 47>, - <98 609 32>, + qcom,pdc-ranges = <0 745 38>, + <40 785 11>, + <51 527 4>, + <57 533 10>, + <70 546 4>, + <75 551 18>, + <108 619 22>, <130 717 12>, <142 251 5>, <147 796 16>,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 794/1815 arm64: dts: qcom: talos: Fix cpu6 1094.4MHz OPP frequency typo
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit f2eb18c66b98fbfcbab4daef42c04f4becba7d79 ]
opp-1094400000 in cpu6_opp_table has a typo in opp-hz, missing a trailing zero. Fix it to resolve the following OPP update failures:
cpu cpu6: Voltage update failed freq=1094400
cpu cpu6: failed to update OPP for freq=1094400
--- arch/arm64/boot/dts/qcom/talos.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/talos.dtsi +1 -1
@@ -351,7 +351,7 @@ opp-1017600000 { }; opp-1094400000 { - opp-hz = /bits/ 64 <109440000>; + opp-hz = /bits/ 64 <1094400000>; opp-peak-kBps = <(1017600 * 4) (940800 * 16)>; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 795/1815 arm64: dts: qcom: sm8250-xiaomi-elish: correct the board ID
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dawid Wróbel <[email protected]>
[ Upstream commit 299731d4fbeaaa141ce2e8226ca00cb30d6ab647 ]
elish declares the same qcom,msm-id and qcom,board-id pair as sm8250-sony-xperia-edo.dtsi, so a bootloader choosing between appended device trees cannot tell the two boards apart.
0x10008 is Sony's value. The downstream device tree for this board, elish-sm8250-overlay.dts, uses qcom,board-id = <47 0>, i.e. platform type 0x2f.
--- arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi +1 -1
@@ -28,7 +28,7 @@ / { /* required for bootloader to select correct board */ qcom,msm-id = <QCOM_ID_SM8250 0x20001>; /* SM8250 v2.1 */ - qcom,board-id = <0x10008 0>; + qcom,board-id = <0x2f 0>; aliases { serial0 = &uart6;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 796/1815 arm64: dts: qcom: kaanapali: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 35eda0e5f87d52ed9f015f8a44155e8ab2ad9c5a ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/kaanapali.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/kaanapali.dtsi +2 -2
@@ -2310,8 +2310,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, operating-points-v2 = <&pcie0_opp_table>; - iommu-map = <0 &apps_smmu 0x1400 0x1>, - <0x100 &apps_smmu 0x1401 0x1>; + iommu-map = <0 &apps_smmu 0x1400 0x0 0x1>, + <0x100 &apps_smmu 0x1401 0x0 0x1>; interrupt-map = <0 0 0 1 &intc 0 0 GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>, <0 0 0 2 &intc 0 0 GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 797/1815 arm64: dts: qcom: kodiak: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 52dac5bda29a3acd896fab2567605683d34970db ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/kodiak.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/kodiak.dtsi +4 -4
@@ -2281,8 +2281,8 @@ pcie0: pcie@1c00000 { "aggre0", "aggre1"; - iommu-map = <0x0 &apps_smmu 0x1c00 0x1>, - <0x100 &apps_smmu 0x1c01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c00 0x0 0x1>, + <0x100 &apps_smmu 0x1c01 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -2427,8 +2427,8 @@ pcie1: pcie@1c08000 { dma-coherent; - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>; status = "disabled";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 798/1815 arm64: dts: qcom: sar2130p: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit f605087abc70ecac53757a7ae0d2d8068342ec4b ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sar2130p.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sar2130p.dtsi +4 -4
@@ -1329,8 +1329,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, &config_noc SLAVE_PCIE_0 QCOM_ICC_TAG_ALWAYS>; interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &apps_smmu 0x1c00 0x1>, - <0x100 &apps_smmu 0x1c01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c00 0x0 0x1>, + <0x100 &apps_smmu 0x1c01 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -1455,8 +1455,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, &config_noc SLAVE_PCIE_1 QCOM_ICC_TAG_ALWAYS>; interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &apps_smmu 0x1e00 0x1>, - <0x100 &apps_smmu 0x1e01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1e00 0x0 0x1>, + <0x100 &apps_smmu 0x1e01 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>, <&gcc GCC_PCIE_1_LINK_DOWN_BCR>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 799/1815 arm64: dts: qcom: sc8180x: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit a4548204821a56c23cd711cfad2a637ca055ff47 ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +8 -8
@@ -1767,8 +1767,8 @@ pcie0: pcie@1c00000 { assigned-clocks = <&gcc GCC_PCIE_0_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1d80 0x1>, - <0x100 &apps_smmu 0x1d81 0x1>; + iommu-map = <0x0 &apps_smmu 0x1d80 0x0 0x1>, + <0x100 &apps_smmu 0x1d81 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -1886,8 +1886,8 @@ pcie3: pcie@1c08000 { assigned-clocks = <&gcc GCC_PCIE_3_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1e00 0x1>, - <0x100 &apps_smmu 0x1e01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1e00 0x0 0x1>, + <0x100 &apps_smmu 0x1e01 0x0 0x1>; resets = <&gcc GCC_PCIE_3_BCR>; reset-names = "pci";
@@ -2006,8 +2006,8 @@ pcie1: pcie@1c10000 { assigned-clocks = <&gcc GCC_PCIE_1_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>; reset-names = "pci";
@@ -2126,8 +2126,8 @@ pcie2: pcie@1c18000 { assigned-clocks = <&gcc GCC_PCIE_2_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1d00 0x1>, - <0x100 &apps_smmu 0x1d01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1d00 0x0 0x1>, + <0x100 &apps_smmu 0x1d01 0x0 0x1>; resets = <&gcc GCC_PCIE_2_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 800/1815 arm64: dts: qcom: sdm845: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit deaea7e982bc353c8d3c406774970f16ed901adb ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 64 ++++++++++++++-------------- 1 file changed, 32 insertions(+), 32 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +32 -32
@@ -2372,22 +2372,22 @@ pcie0: pcie@1c00000 { "slave_q2a", "tbu"; - iommu-map = <0x0 &apps_smmu 0x1c10 0x1>, - <0x100 &apps_smmu 0x1c11 0x1>, - <0x200 &apps_smmu 0x1c12 0x1>, - <0x300 &apps_smmu 0x1c13 0x1>, - <0x400 &apps_smmu 0x1c14 0x1>, - <0x500 &apps_smmu 0x1c15 0x1>, - <0x600 &apps_smmu 0x1c16 0x1>, - <0x700 &apps_smmu 0x1c17 0x1>, - <0x800 &apps_smmu 0x1c18 0x1>, - <0x900 &apps_smmu 0x1c19 0x1>, - <0xa00 &apps_smmu 0x1c1a 0x1>, - <0xb00 &apps_smmu 0x1c1b 0x1>, - <0xc00 &apps_smmu 0x1c1c 0x1>, - <0xd00 &apps_smmu 0x1c1d 0x1>, - <0xe00 &apps_smmu 0x1c1e 0x1>, - <0xf00 &apps_smmu 0x1c1f 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c10 0x0 0x1>, + <0x100 &apps_smmu 0x1c11 0x0 0x1>, + <0x200 &apps_smmu 0x1c12 0x0 0x1>, + <0x300 &apps_smmu 0x1c13 0x0 0x1>, + <0x400 &apps_smmu 0x1c14 0x0 0x1>, + <0x500 &apps_smmu 0x1c15 0x0 0x1>, + <0x600 &apps_smmu 0x1c16 0x0 0x1>, + <0x700 &apps_smmu 0x1c17 0x0 0x1>, + <0x800 &apps_smmu 0x1c18 0x0 0x1>, + <0x900 &apps_smmu 0x1c19 0x0 0x1>, + <0xa00 &apps_smmu 0x1c1a 0x0 0x1>, + <0xb00 &apps_smmu 0x1c1b 0x0 0x1>, + <0xc00 &apps_smmu 0x1c1c 0x0 0x1>, + <0xd00 &apps_smmu 0x1c1d 0x0 0x1>, + <0xe00 &apps_smmu 0x1c1e 0x0 0x1>, + <0xf00 &apps_smmu 0x1c1f 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -2502,22 +2502,22 @@ pcie1: pcie@1c08000 { assigned-clocks = <&gcc GCC_PCIE_1_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1c00 0x1>, - <0x100 &apps_smmu 0x1c01 0x1>, - <0x200 &apps_smmu 0x1c02 0x1>, - <0x300 &apps_smmu 0x1c03 0x1>, - <0x400 &apps_smmu 0x1c04 0x1>, - <0x500 &apps_smmu 0x1c05 0x1>, - <0x600 &apps_smmu 0x1c06 0x1>, - <0x700 &apps_smmu 0x1c07 0x1>, - <0x800 &apps_smmu 0x1c08 0x1>, - <0x900 &apps_smmu 0x1c09 0x1>, - <0xa00 &apps_smmu 0x1c0a 0x1>, - <0xb00 &apps_smmu 0x1c0b 0x1>, - <0xc00 &apps_smmu 0x1c0c 0x1>, - <0xd00 &apps_smmu 0x1c0d 0x1>, - <0xe00 &apps_smmu 0x1c0e 0x1>, - <0xf00 &apps_smmu 0x1c0f 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c00 0x0 0x1>, + <0x100 &apps_smmu 0x1c01 0x0 0x1>, + <0x200 &apps_smmu 0x1c02 0x0 0x1>, + <0x300 &apps_smmu 0x1c03 0x0 0x1>, + <0x400 &apps_smmu 0x1c04 0x0 0x1>, + <0x500 &apps_smmu 0x1c05 0x0 0x1>, + <0x600 &apps_smmu 0x1c06 0x0 0x1>, + <0x700 &apps_smmu 0x1c07 0x0 0x1>, + <0x800 &apps_smmu 0x1c08 0x0 0x1>, + <0x900 &apps_smmu 0x1c09 0x0 0x1>, + <0xa00 &apps_smmu 0x1c0a 0x0 0x1>, + <0xb00 &apps_smmu 0x1c0b 0x0 0x1>, + <0xc00 &apps_smmu 0x1c0c 0x0 0x1>, + <0xd00 &apps_smmu 0x1c0d 0x0 0x1>, + <0xe00 &apps_smmu 0x1c0e 0x0 0x1>, + <0xf00 &apps_smmu 0x1c0f 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 801/1815 arm64: dts: qcom: sm8150: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit d2e56fb42e3d10d7e711063cdc00523ddb31d544 ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +4 -4
@@ -1893,8 +1893,8 @@ pcie0: pcie@1c00000 { "bus_slave", "slave_q2a"; - iommu-map = <0x0 &apps_smmu 0x1d80 0x1>, - <0x100 &apps_smmu 0x1d81 0x1>; + iommu-map = <0x0 &apps_smmu 0x1d80 0x0 0x1>, + <0x100 &apps_smmu 0x1d81 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -2011,8 +2011,8 @@ pcie1: pcie@1c08000 { assigned-clocks = <&gcc GCC_PCIE_1_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1e00 0x1>, - <0x100 &apps_smmu 0x1e01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1e00 0x0 0x1>, + <0x100 &apps_smmu 0x1e01 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 802/1815 arm64: dts: qcom: sm8250: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit c41749e9554d4e03e7074f5d1e46140bc4ac77bd ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +6 -6
@@ -2190,8 +2190,8 @@ pcie0: pcie@1c00000 { "tbu", "ddrss_sf_tbu"; - iommu-map = <0x0 &apps_smmu 0x1c00 0x1>, - <0x100 &apps_smmu 0x1c01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c00 0x0 0x1>, + <0x100 &apps_smmu 0x1c01 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -2317,8 +2317,8 @@ pcie1: pcie@1c08000 { assigned-clocks = <&gcc GCC_PCIE_1_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>; reset-names = "pci";
@@ -2444,8 +2444,8 @@ pcie2: pcie@1c10000 { assigned-clocks = <&gcc GCC_PCIE_2_AUX_CLK>; assigned-clock-rates = <19200000>; - iommu-map = <0x0 &apps_smmu 0x1d00 0x1>, - <0x100 &apps_smmu 0x1d01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1d00 0x0 0x1>, + <0x100 &apps_smmu 0x1d01 0x0 0x1>; resets = <&gcc GCC_PCIE_2_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 803/1815 arm64: dts: qcom: sm8350: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 80337ea3a154230621c0b4e3c831f5d81712ba18 ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +4 -4
@@ -1575,8 +1575,8 @@ pcie0: pcie@1c00000 { "aggre1", "aggre0"; - iommu-map = <0x0 &apps_smmu 0x1c00 0x1>, - <0x100 &apps_smmu 0x1c01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c00 0x0 0x1>, + <0x100 &apps_smmu 0x1c01 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -1684,8 +1684,8 @@ pcie1: pcie@1c08000 { "ddrss_sf_tbu", "aggre1"; - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 804/1815 arm64: dts: qcom: sm8450: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 9b10e56647fa8f7ab62c7e45ebf4b168f7befa7f ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sm8450.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8450.dtsi +4 -4
@@ -2023,8 +2023,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, "aggre0", "aggre1"; - iommu-map = <0x0 &apps_smmu 0x1c00 0x1>, - <0x100 &apps_smmu 0x1c01 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c00 0x0 0x1>, + <0x100 &apps_smmu 0x1c01 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -2188,8 +2188,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, "ddrss_sf_tbu", "aggre1"; - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 805/1815 arm64: dts: qcom: sm8550: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 16d98ee918d63018eaa6cc260791b71319aa4faa ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sm8550.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8550.dtsi +4 -4
@@ -2382,8 +2382,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, msi-map = <0x0 &gic_its 0x1400 0x1>, <0x100 &gic_its 0x1401 0x1>; - iommu-map = <0x0 &apps_smmu 0x1400 0x1>, - <0x100 &apps_smmu 0x1401 0x1>; + iommu-map = <0x0 &apps_smmu 0x1400 0x0 0x1>, + <0x100 &apps_smmu 0x1401 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
@@ -2561,8 +2561,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, msi-map = <0x0 &gic_its 0x1480 0x1>, <0x100 &gic_its 0x1481 0x1>; - iommu-map = <0x0 &apps_smmu 0x1480 0x1>, - <0x100 &apps_smmu 0x1481 0x1>; + iommu-map = <0x0 &apps_smmu 0x1480 0x0 0x1>, + <0x100 &apps_smmu 0x1481 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>, <&gcc GCC_PCIE_1_LINK_DOWN_BCR>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 806/1815 arm64: dts: qcom: sm8650: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 8ccba7b44609d58db088447a771f6f30cfa8739e ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sm8650.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8650.dtsi +4 -4
@@ -3626,8 +3626,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, operating-points-v2 = <&pcie0_opp_table>; - iommu-map = <0 &apps_smmu 0x1400 0x1>, - <0x100 &apps_smmu 0x1401 0x1>; + iommu-map = <0 &apps_smmu 0x1400 0x0 0x1>, + <0x100 &apps_smmu 0x1401 0x0 0x1>; interrupt-map = <0 0 0 1 &intc 0 0 GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH 0>, <0 0 0 2 &intc 0 0 GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH 0>,
@@ -3819,8 +3819,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, operating-points-v2 = <&pcie1_opp_table>; - iommu-map = <0 &apps_smmu 0x1480 0x1>, - <0x100 &apps_smmu 0x1481 0x1>; + iommu-map = <0 &apps_smmu 0x1480 0x0 0x1>, + <0x100 &apps_smmu 0x1481 0x0 0x1>; interrupt-map = <0 0 0 1 &intc 0 0 GIC_SPI 434 IRQ_TYPE_LEVEL_HIGH 0>, <0 0 0 2 &intc 0 0 GIC_SPI 435 IRQ_TYPE_LEVEL_HIGH 0>,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 807/1815 arm64: dts: qcom: sm8750: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 366a540432a38c1c1533a319bc07b333f53752b6 ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/sm8750.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8750.dtsi +2 -2
@@ -5280,8 +5280,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &apps_smmu 0x1400 0x1>, - <0x100 &apps_smmu 0x1401 0x1>; + iommu-map = <0x0 &apps_smmu 0x1400 0x0 0x1>, + <0x100 &apps_smmu 0x1401 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 808/1815 arm64: dts: qcom: talos: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit f7e687d6050f27a03847abadc12d6821576d06ee ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/talos.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/talos.dtsi +2 -2
@@ -1349,8 +1349,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, &config_noc SLAVE_PCIE_0 QCOM_ICC_TAG_ACTIVE_ONLY>; interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &apps_smmu 0x400 0x1>, - <0x100 &apps_smmu 0x401 0x1>; + iommu-map = <0x0 &apps_smmu 0x400 0x0 0x1>, + <0x100 &apps_smmu 0x401 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>; reset-names = "pci";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 809/1815 arm64: dts: qcom: lemans: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 19b4c47fc9733a953e9586bc0906a3be378b4cd5 ]
The IOMMU provider pcie_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/lemans.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/lemans.dtsi +4 -4
@@ -2760,8 +2760,8 @@ pcie0: pcie@1c00000 { <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_PCIE_0 0>; interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &pcie_smmu 0x0000 0x1>, - <0x100 &pcie_smmu 0x0001 0x1>; + iommu-map = <0x0 &pcie_smmu 0x0000 0x0 0x1>, + <0x100 &pcie_smmu 0x0001 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>, <&gcc GCC_PCIE_0_LINK_DOWN_BCR>;
@@ -2933,8 +2933,8 @@ pcie1: pcie@1c10000 { <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_PCIE_1 0>; interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &pcie_smmu 0x0080 0x1>, - <0x100 &pcie_smmu 0x0081 0x1>; + iommu-map = <0x0 &pcie_smmu 0x0080 0x0 0x1>, + <0x100 &pcie_smmu 0x0081 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>, <&gcc GCC_PCIE_1_LINK_DOWN_BCR>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 810/1815 arm64: dts: qcom: monaco: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 2e455d9278550c8886a94e30a906437a26c79581 ]
The IOMMU provider pcie_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/monaco.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/monaco.dtsi +4 -4
@@ -2349,8 +2349,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &pcie_smmu 0x0000 0x1>, - <0x100 &pcie_smmu 0x0001 0x1>; + iommu-map = <0x0 &pcie_smmu 0x0000 0x0 0x1>, + <0x100 &pcie_smmu 0x0001 0x0 0x1>; resets = <&gcc GCC_PCIE_0_BCR>, <&gcc GCC_PCIE_0_LINK_DOWN_BCR>;
@@ -2526,8 +2526,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, &config_noc SLAVE_PCIE_1 QCOM_ICC_TAG_ACTIVE_ONLY>; interconnect-names = "pcie-mem", "cpu-pcie"; - iommu-map = <0x0 &pcie_smmu 0x0080 0x1>, - <0x100 &pcie_smmu 0x0081 0x1>; + iommu-map = <0x0 &pcie_smmu 0x0080 0x0 0x1>, + <0x100 &pcie_smmu 0x0081 0x0 0x1>; resets = <&gcc GCC_PCIE_1_BCR>, <&gcc GCC_PCIE_1_LINK_DOWN_BCR>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 811/1815 arm64: dts: qcom: monaco-monza-som: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit d7ae79013e6c9b2374948d70856045cc84c9261d ]
The IOMMU provider pcie_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/monaco-monza-som.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/monaco-monza-som.dtsi +8 -8
@@ -196,14 +196,14 @@ &iris { /* PCIe0 Gen4 x2 */ &pcie0 { - iommu-map = <0x0 &pcie_smmu 0x0000 0x1>, - <0x100 &pcie_smmu 0x0001 0x1>, - <0x200 &pcie_smmu 0x0007 0x1>, - <0x208 &pcie_smmu 0x0002 0x1>, - <0x210 &pcie_smmu 0x0003 0x1>, - <0x218 &pcie_smmu 0x0004 0x1>, - <0x300 &pcie_smmu 0x0005 0x1>, - <0x400 &pcie_smmu 0x0006 0x1>; + iommu-map = <0x0 &pcie_smmu 0x0000 0x0 0x1>, + <0x100 &pcie_smmu 0x0001 0x0 0x1>, + <0x200 &pcie_smmu 0x0007 0x0 0x1>, + <0x208 &pcie_smmu 0x0002 0x0 0x1>, + <0x210 &pcie_smmu 0x0003 0x0 0x1>, + <0x218 &pcie_smmu 0x0004 0x0 0x1>, + <0x300 &pcie_smmu 0x0005 0x0 0x1>, + <0x400 &pcie_smmu 0x0006 0x0 0x1>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 812/1815 arm64: dts: qcom: monaco-evk-ifp-mezzanine: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit b35b58535b45441a4521d50215b5668731857c7d ]
The IOMMU provider pcie_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- .../dts/qcom/monaco-evk-ifp-mezzanine.dtso | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/qcom/monaco-evk-ifp-mezzanine.dtso +9 -9
@@ -50,15 +50,15 @@ }; &pcie0 { - iommu-map = <0x0 &pcie_smmu 0x0 0x1>, - <0x100 &pcie_smmu 0x1 0x1>, - <0x208 &pcie_smmu 0x2 0x1>, - <0x210 &pcie_smmu 0x3 0x1>, - <0x218 &pcie_smmu 0x4 0x1>, - <0x300 &pcie_smmu 0x5 0x1>, - <0x400 &pcie_smmu 0x6 0x1>, - <0x500 &pcie_smmu 0x7 0x1>, - <0x501 &pcie_smmu 0x8 0x1>; + iommu-map = <0x0 &pcie_smmu 0x0 0x0 0x1>, + <0x100 &pcie_smmu 0x1 0x0 0x1>, + <0x208 &pcie_smmu 0x2 0x0 0x1>, + <0x210 &pcie_smmu 0x3 0x0 0x1>, + <0x218 &pcie_smmu 0x4 0x0 0x1>, + <0x300 &pcie_smmu 0x5 0x0 0x1>, + <0x400 &pcie_smmu 0x6 0x0 0x1>, + <0x500 &pcie_smmu 0x7 0x0 0x1>, + <0x501 &pcie_smmu 0x8 0x0 0x1>; }; &pcieport0 {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 813/1815 arm64: dts: qcom: lemans-evk-ifp-mezzanine: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 6ee8ab6ca91dcea05793809df8a1dcfa94bcf3f0 ]
The IOMMU provider pcie_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- .../dts/qcom/lemans-evk-ifp-mezzanine.dtso | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/qcom/lemans-evk-ifp-mezzanine.dtso +9 -9
@@ -204,15 +204,15 @@ }; &pcie0 { - iommu-map = <0x0 &pcie_smmu 0x0 0x1>, - <0x100 &pcie_smmu 0x1 0x1>, - <0x208 &pcie_smmu 0x2 0x1>, - <0x210 &pcie_smmu 0x3 0x1>, - <0x218 &pcie_smmu 0x4 0x1>, - <0x300 &pcie_smmu 0x5 0x1>, - <0x400 &pcie_smmu 0x6 0x1>, - <0x500 &pcie_smmu 0x7 0x1>, - <0x501 &pcie_smmu 0x8 0x1>; + iommu-map = <0x0 &pcie_smmu 0x0 0x0 0x1>, + <0x100 &pcie_smmu 0x1 0x0 0x1>, + <0x208 &pcie_smmu 0x2 0x0 0x1>, + <0x210 &pcie_smmu 0x3 0x0 0x1>, + <0x218 &pcie_smmu 0x4 0x0 0x1>, + <0x300 &pcie_smmu 0x5 0x0 0x1>, + <0x400 &pcie_smmu 0x6 0x0 0x1>, + <0x500 &pcie_smmu 0x7 0x0 0x1>, + <0x501 &pcie_smmu 0x8 0x0 0x1>; }; &pcieport0 {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 814/1815 arm64: dts: qcom: qcs6490-radxa-dragon-q6a: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 82a10eb6aeab412abd83a57cc3a605213d1dc1d5 ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- .../boot/dts/qcom/qcs6490-radxa-dragon-q6a.dts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/qcom/qcs6490-radxa-dragon-q6a.dts +9 -9
@@ -546,15 +546,15 @@ &pcie1 { pinctrl-names = "default"; /* Support for QPS615 PCIe switch */ - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>, - <0x208 &apps_smmu 0x1c84 0x1>, - <0x210 &apps_smmu 0x1c85 0x1>, - <0x218 &apps_smmu 0x1c86 0x1>, - <0x300 &apps_smmu 0x1c87 0x1>, - <0x400 &apps_smmu 0x1c88 0x1>, - <0x500 &apps_smmu 0x1c89 0x1>, - <0x501 &apps_smmu 0x1c90 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>, + <0x208 &apps_smmu 0x1c84 0x0 0x1>, + <0x210 &apps_smmu 0x1c85 0x0 0x1>, + <0x218 &apps_smmu 0x1c86 0x0 0x1>, + <0x300 &apps_smmu 0x1c87 0x0 0x1>, + <0x400 &apps_smmu 0x1c88 0x0 0x1>, + <0x500 &apps_smmu 0x1c89 0x0 0x1>, + <0x501 &apps_smmu 0x1c90 0x0 0x1>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 815/1815 arm64: dts: qcom: qcs6490-thundercomm-minipc-g1iot: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit fc3c550b3847636f6c0732dc6c94e879ab5ff578 ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- .../qcom/qcs6490-thundercomm-minipc-g1iot.dts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts +9 -9
@@ -711,15 +711,15 @@ &pcie1 { <&pcie1_wake_n>; pinctrl-names = "default"; - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>, - <0x208 &apps_smmu 0x1c84 0x1>, - <0x210 &apps_smmu 0x1c85 0x1>, - <0x218 &apps_smmu 0x1c86 0x1>, - <0x300 &apps_smmu 0x1c87 0x1>, - <0x400 &apps_smmu 0x1c88 0x1>, - <0x500 &apps_smmu 0x1c89 0x1>, - <0x501 &apps_smmu 0x1c90 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>, + <0x208 &apps_smmu 0x1c84 0x0 0x1>, + <0x210 &apps_smmu 0x1c85 0x0 0x1>, + <0x218 &apps_smmu 0x1c86 0x0 0x1>, + <0x300 &apps_smmu 0x1c87 0x0 0x1>, + <0x400 &apps_smmu 0x1c88 0x0 0x1>, + <0x500 &apps_smmu 0x1c89 0x0 0x1>, + <0x501 &apps_smmu 0x1c90 0x0 0x1>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 816/1815 arm64: dts: qcom: qcs6490-rb3gen2: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 485dc5e557a8fef1374669f4ebe027c947187325 ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +9 -9
@@ -846,15 +846,15 @@ &pcie1 { pinctrl-0 = <&pcie1_reset_n>, <&pcie1_wake_n>, <&pcie1_clkreq_n>; pinctrl-names = "default"; - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>, - <0x208 &apps_smmu 0x1c84 0x1>, - <0x210 &apps_smmu 0x1c85 0x1>, - <0x218 &apps_smmu 0x1c86 0x1>, - <0x300 &apps_smmu 0x1c87 0x1>, - <0x400 &apps_smmu 0x1c88 0x1>, - <0x500 &apps_smmu 0x1c89 0x1>, - <0x501 &apps_smmu 0x1c90 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>, + <0x208 &apps_smmu 0x1c84 0x0 0x1>, + <0x210 &apps_smmu 0x1c85 0x0 0x1>, + <0x218 &apps_smmu 0x1c86 0x0 0x1>, + <0x300 &apps_smmu 0x1c87 0x0 0x1>, + <0x400 &apps_smmu 0x1c88 0x0 0x1>, + <0x500 &apps_smmu 0x1c89 0x0 0x1>, + <0x501 &apps_smmu 0x1c90 0x0 0x1>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 817/1815 arm64: dts: qcom: qcs6490-rb3gen2-industrial-mezzanine: Fix the PCIe iommu-map entries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 770d1448435bca2b1cd00854dc9401320b584d5b ]
The IOMMU provider apps_smmu uses '#iommu-cells = <2>', but the PCIe iommu-map entries specify only one cell for the SID, omitting the SID mask. This went unnoticed until the OF core started warning with commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps"):
iommu-map has 1-cell entries targeting 2-cell #iommu-cells, treating as 1-cell output
So fix the entries to match the provider's '#iommu-cells' property.
--- .../qcs6490-rb3gen2-industrial-mezzanine.dtso | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-)
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2-industrial-mezzanine.dtso +25 -25
@@ -54,15 +54,15 @@ pinctrl-0 = <&pcie0_reset_n>, <&pcie0_wake_n>, <&pcie0_clkreq_n>; pinctrl-names = "default"; - iommu-map = <0x0 &apps_smmu 0x1c00 0x1>, - <0x100 &apps_smmu 0x1c01 0x1>, - <0x208 &apps_smmu 0x1c04 0x1>, - <0x210 &apps_smmu 0x1c05 0x1>, - <0x218 &apps_smmu 0x1c06 0x1>, - <0x300 &apps_smmu 0x1c07 0x1>, - <0x400 &apps_smmu 0x1c08 0x1>, - <0x500 &apps_smmu 0x1c09 0x1>, - <0x501 &apps_smmu 0x1c10 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c00 0x0 0x1>, + <0x100 &apps_smmu 0x1c01 0x0 0x1>, + <0x208 &apps_smmu 0x1c04 0x0 0x1>, + <0x210 &apps_smmu 0x1c05 0x0 0x1>, + <0x218 &apps_smmu 0x1c06 0x0 0x1>, + <0x300 &apps_smmu 0x1c07 0x0 0x1>, + <0x400 &apps_smmu 0x1c08 0x0 0x1>, + <0x500 &apps_smmu 0x1c09 0x0 0x1>, + <0x501 &apps_smmu 0x1c10 0x0 0x1>; status = "okay"; };
@@ -151,22 +151,22 @@ }; &pcie1 { - iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, - <0x100 &apps_smmu 0x1c81 0x1>, - <0x208 &apps_smmu 0x1c84 0x1>, - <0x210 &apps_smmu 0x1c85 0x1>, - <0x218 &apps_smmu 0x1c86 0x1>, - <0x300 &apps_smmu 0x1c87 0x1>, - <0x408 &apps_smmu 0x1c90 0x1>, - <0x410 &apps_smmu 0x1c91 0x1>, - <0x418 &apps_smmu 0x1c92 0x1>, - <0x500 &apps_smmu 0x1c93 0x1>, - <0x600 &apps_smmu 0x1c94 0x1>, - <0x700 &apps_smmu 0x1c95 0x1>, - <0x701 &apps_smmu 0x1c96 0x1>, - <0x800 &apps_smmu 0x1c97 0x1>, - <0x900 &apps_smmu 0x1c98 0x1>, - <0x901 &apps_smmu 0x1c99 0x1>; + iommu-map = <0x0 &apps_smmu 0x1c80 0x0 0x1>, + <0x100 &apps_smmu 0x1c81 0x0 0x1>, + <0x208 &apps_smmu 0x1c84 0x0 0x1>, + <0x210 &apps_smmu 0x1c85 0x0 0x1>, + <0x218 &apps_smmu 0x1c86 0x0 0x1>, + <0x300 &apps_smmu 0x1c87 0x0 0x1>, + <0x408 &apps_smmu 0x1c90 0x0 0x1>, + <0x410 &apps_smmu 0x1c91 0x0 0x1>, + <0x418 &apps_smmu 0x1c92 0x0 0x1>, + <0x500 &apps_smmu 0x1c93 0x0 0x1>, + <0x600 &apps_smmu 0x1c94 0x0 0x1>, + <0x700 &apps_smmu 0x1c95 0x0 0x1>, + <0x701 &apps_smmu 0x1c96 0x0 0x1>, + <0x800 &apps_smmu 0x1c97 0x0 0x1>, + <0x900 &apps_smmu 0x1c98 0x0 0x1>, + <0x901 &apps_smmu 0x1c99 0x0 0x1>; }; &pcie1_switch0_dsp1 {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 818/1815 power: supply: isp1704_charger: cancel work on remove
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongyan Xu <[email protected]>
[ Upstream commit 60c5b8a9ef4dbc5d69bbc1a960fe55826cb3b643 ]
The USB notifier and initial VBUS detection can schedule isp->work. The remove path unregisters the notifier and power supply, but does not wait for queued or running work before tearing down the power supply state.
Cancel the work after unregistering the notifier. Do this before unregistering the power supply.
This issue was found by a static analysis tool.
--- drivers/power/supply/isp1704_charger.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/isp1704_charger.c +1 -0
@@ -482,6 +482,7 @@ static void isp1704_charger_remove(struct platform_device *pdev)struct isp1704_charger *isp =platform_get_drvdata (pdev);usb_unregister_notifier (isp->phy, &isp->nb); +cancel_work_sync (&isp->work);power_supply_unregister (isp->psy);isp1704_charger_set_power (isp,0 ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 819/1815 power: supply: sc2731_charger: cancel work on remove
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongyan Xu <[email protected]>
[ Upstream commit dfc859bb8d332c525872f1a44028137724fa1998 ]
The USB notifier and initial charger detection can schedule info->work. The remove path unregisters the notifier, but does not cancel queued or running work before the devm-allocated driver data is released.
Set the platform drvdata used by remove, then cancel the work after unregistering the notifier.
This issue was found by a static analysis tool.
--- drivers/power/supply/sc2731_charger.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/power/supply/sc2731_charger.c +2 -0
@@ -466,6 +466,7 @@ static int sc2731_charger_probe(struct platform_device *pdev)mutex_init (&info->lock); info->dev = &pdev->dev;INIT_WORK (&info->work, sc2731_charger_work); +platform_set_drvdata (pdev, info); info->regmap =dev_get_regmap (pdev->dev.parent,NULL );if (!info->regmap) {
@@ -516,6 +517,7 @@ static void sc2731_charger_remove(struct platform_device *pdev)struct sc2731_charger_info *info =platform_get_drvdata (pdev);usb_unregister_notifier (info->usb_phy, &info->usb_notify); +cancel_work_sync (&info->work); }static const struct of_device_id sc2731_charger_of_match[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 820/1815 bpf: Fix potential UAF in bpf_netns_link_update_prog
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Lehui <[email protected]>
[ Upstream commit 5c5997836381010fc5907b36bc17d3b19407e933 ]
In bpf_netns_link_update_prog, the checks for old_prog and prog type are currently performed locklessly before acquiring netns_bpf_mutex. This creates a race condition that can lead to a UAF issue.
If two threads concurrently execute BPF_LINK_UPDATE on the same netns link, the following execution path can trigger a UAF:
CPU0 CPU1bpf_netns_link_update_prog
if (old_prog && old_prog != link->prog)
return -EPERM;
bpf_netns_link_update_prog
if (old_prog && old_prog != link->prog)
...
old_prog = xchg(&link->prog, new_prog);
bpf_prog_put(old_prog); if (new_prog->type != link->prog->type) <-- trigger UAF
Fix this by moving the old_prog and prog->type checks inside the netns_bpf_mutex critical section. Meanwhile, use guard() to simplify lock management and avoid all the goto jumping.
--- kernel/bpf/net_namespace.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
kernel/bpf/net_namespace.c +6 -11
@@ -171,33 +171,28 @@ static int bpf_netns_link_update_prog(struct bpf_link *link,struct net *net;int idx, ret; +guard (mutex)(&netns_bpf_mutex); +if (old_prog && old_prog != link->prog)return -EPERM ;if (new_prog->type != link->prog->type)return -EINVAL ; -mutex_lock (&netns_bpf_mutex); - net = net_link->net; -if (!net || !check_net (net)) { +if (!net || !check_net (net))/* Link auto-detached or netns dying */ - ret = -ENOLINK ; - goto out_unlock; - } +return -ENOLINK ; run_array =rcu_dereference_protected (net->bpf.run_array[type],lockdep_is_held (&netns_bpf_mutex)); idx =link_index (net, type, net_link); ret =bpf_prog_array_update_at (run_array, idx, new_prog);if (ret) - goto out_unlock; +return ret; old_prog =xchg (&link->prog, new_prog);bpf_prog_put (old_prog); - -out_unlock: -mutex_unlock (&netns_bpf_mutex); -return ret; +return 0 ; } static int bpf_netns_link_fill_info(const struct bpf_link *link,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 821/1815 bpf: Fix potential UAF when reading bpf link info
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Lehui <[email protected]>
[ Upstream commit 863f3ddd0b8ac65abfb50d3be0869268ac0e277b ]
In bpf_link_show_fdinfo and bpf_link_get_info_by_fd, link->prog is accessed without holding any locks. If the prog is concurrently replaced via bpf_link_update, the old prog can be freed, leading to a potential UAF issue.
Fix this by accessing link->prog under RCU protection to safely fetch the pointer and guarantee its lifetime while reading its fields.
--- kernel/bpf/syscall.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
kernel/bpf/syscall.c +17 -4
@@ -3471,9 +3471,10 @@ static const char *bpf_link_type_strs[] = {static void bpf_link_show_fdinfo (struct seq_file *m,struct file *filp) {const struct bpf_link *link = filp->private_data; -const struct bpf_prog *prog = link->prog; +const struct bpf_prog *prog;enum bpf_link_type type = link->type;char prog_tag[sizeof (prog->tag) *2 +1 ] = { }; +u32 prog_id =0 ;if (type <ARRAY_SIZE (bpf_link_type_strs) && bpf_link_type_strs[type]) {if (link->type ==BPF_LINK_TYPE_KPROBE_MULTI )
@@ -3490,13 +3491,20 @@ static void bpf_link_show_fdinfo(struct seq_file *m, struct file *filp) }seq_printf (m,"link_id:\t%u\n" , link->id); +rcu_read_lock (); + prog =READ_ONCE (link->prog);if (prog) {bin2hex (prog_tag, prog->tag,sizeof (prog->tag)); + prog_id = prog->aux->id; + } +rcu_read_unlock (); + +if (prog) {seq_printf (m,"prog_tag:\t%s\n" "prog_id:\t%u\n" , prog_tag, - prog->aux->id); + prog_id); }if (link->ops->show_fdinfo) link->ops->show_fdinfo (link, m);
@@ -5535,6 +5543,7 @@ static int bpf_link_get_info_by_fd(struct file *file, {struct bpf_link_info __user *uinfo =u64_to_user_ptr (attr->info.info);struct bpf_link_info info; +const struct bpf_prog *prog;u32 info_len = attr->info.info_len;int err;
@@ -5549,8 +5558,12 @@ static int bpf_link_get_info_by_fd(struct file *file, info.type = link->type; info.id = link->id; -if (link->prog) - info.prog_id = link->prog->aux->id; + +rcu_read_lock (); + prog =READ_ONCE (link->prog); +if (prog) + info.prog_id = prog->aux->id; +rcu_read_unlock ();if (link->ops->fill_link_info) { err = link->ops->fill_link_info (link, &info);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 822/1815 platform/chrome: lightbar: Limit payload to max packet size
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Savery <[email protected]>
[ Upstream commit ed1d1f519c56c6c2ffa13f3d52cd77beb023db13 ]
The LIGHTBAR_CMD_SET_PROGRAM command uses an 8-bit size field for its payload length, but the protocol-negotiated max_request may exceed the maximum value an 8-bit integer can represent.
When this occurs, large payloads (e.g., >255 bytes) integer wrap the 8-bit size variable when assigning param->set_program_ex.size, causing truncation and parse failures downstream in the EC firmware stack.
Clamp max_size to the maximum value the structural size field can support.
--- drivers/platform/chrome/cros_ec_lightbar.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_lightbar.c +6 -1
@@ -504,9 +504,14 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,return -EINVAL ; } }else { +/* +* Bound the payload strictly by the maximum value the structural +* size field can natively support. +*/ extra_bytes = offsetof(typeof(*param), set_program_ex) +sizeof (param->set_program_ex); - max_size = ec->ec_dev->max_request - extra_bytes; + max_size =min_t (size_t, ec->ec_dev->max_request - extra_bytes, +type_max (typeof (param->set_program_ex.size))); } msg =alloc_lightbar_cmd_msg (ec);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 823/1815 lib/test_hmm: fail dmirror_fault() when the mirrored mm is gone
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsburskii <[email protected]>
[ Upstream commit 6a8024511ddf4877435c34fb3d6028aa8e590649 ]
dmirror_fault() is called from the dmirror_read() and dmirror_write() retry loops after dmirror_do_read() or dmirror_do_write() finds a missing device page table entry.
If the mirrored mm has already exited, mmget_not_zero() fails. The current code returns 0 in that case, which tells the caller that faulting succeeded even though no page was faulted and no device page table entry was installed. The caller then retries the same address, hits -ENOENT again, and can loop forever without making progress.
Return -EFAULT instead, so the ioctl fails when the mirrored mm is no longer faultable.
--- lib/test_hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_hmm.c +1 -1
@@ -407,7 +407,7 @@ static int dmirror_fault(struct dmirror *dmirror, unsigned long start,/* Since the mm is for the mirrored process, get a reference first. */ if (!mmget_not_zero (mm)) -return 0 ; +return -EFAULT ;for (addr = start; addr < end; addr = range.end) { range.start = addr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 824/1815 arm64: dts: qcom: eliza: Add fallback compatible for ADSP remoteproc
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit b589944ecd95fe4a51bc2aab13ce83b298b7bcc8 ]
The ADSP found on Eliza SoC is actually fully compatible with the ones from SM8750 class. So add the SM8550 compatible as fallback, just like the rest from the SM8750 class SoCs.
--- arch/arm64/boot/dts/qcom/eliza.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/eliza.dtsi +1 -1
@@ -1967,7 +1967,7 @@ tcsr: clock-controller@1fbf000 { }; remoteproc_adsp: remoteproc@3000000 { - compatible = "qcom,eliza-adsp-pas"; + compatible = "qcom,eliza-adsp-pas", "qcom,sm8550-adsp-pas"; reg = <0x0 0x03000000 0x0 0x10000>; interrupts-extended = <&pdc 6 IRQ_TYPE_EDGE_RISING>,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 825/1815 clk: qcom: nord: use BRANCH_HALT_SKIP for PHY pipe clocks
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 3a8a7d597b07ffe388b47fb524827be52c9f7e0f ]
The PCIe and USB3 pipe clocks on Nord are sourced from their respective PHYs. The halt bit for these branches does not toggle reliably when the PHY is powered down or not yet brought up, so polling for it with BRANCH_HALT_VOTED can spuriously time out.
Switch these pipe clock branches to BRANCH_HALT_SKIP, matching the convention used for PHY-sourced pipe clocks elsewhere in the Qualcomm clock drivers.
--- drivers/clk/qcom/gcc-nord.c | 8 ++++---- drivers/clk/qcom/negcc-nord.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/clk/qcom/gcc-nord.c +4 -4
@@ -701,7 +701,7 @@ static struct clk_branch gcc_pcie_a_phy_rchng_clk = {static struct clk_branch gcc_pcie_a_pipe_clk = { .halt_reg =0x49068 , - .halt_check =BRANCH_HALT_VOTED , + .halt_check =BRANCH_HALT_SKIP , .hwcg_reg =0x49068 , .hwcg_bit =1 , .clkr = {
@@ -850,7 +850,7 @@ static struct clk_branch gcc_pcie_b_phy_rchng_clk = {static struct clk_branch gcc_pcie_b_pipe_clk = { .halt_reg =0x4a068 , - .halt_check =BRANCH_HALT_VOTED , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x9d008 , .enable_mask =BIT (24 ),
@@ -995,7 +995,7 @@ static struct clk_branch gcc_pcie_c_phy_rchng_clk = {static struct clk_branch gcc_pcie_c_pipe_clk = { .halt_reg =0x4b068 , - .halt_check =BRANCH_HALT_VOTED , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x9d010 , .enable_mask =BIT (1 ),
@@ -1140,7 +1140,7 @@ static struct clk_branch gcc_pcie_d_phy_rchng_clk = {static struct clk_branch gcc_pcie_d_pipe_clk = { .halt_reg =0x4c068 , - .halt_check =BRANCH_HALT_VOTED , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x9d010 , .enable_mask =BIT (10 ),
drivers/clk/qcom/negcc-nord.c +2 -2
@@ -1641,7 +1641,7 @@ static struct clk_branch ne_gcc_usb3_prim_phy_com_aux_clk = {static struct clk_branch ne_gcc_usb3_prim_phy_pipe_clk = { .halt_reg =0x2a074 , - .halt_check =BRANCH_HALT_VOTED , + .halt_check =BRANCH_HALT_SKIP , .hwcg_reg =0x2a074 , .hwcg_bit =1 , .clkr = {
@@ -1697,7 +1697,7 @@ static struct clk_branch ne_gcc_usb3_sec_phy_com_aux_clk = {static struct clk_branch ne_gcc_usb3_sec_phy_pipe_clk = { .halt_reg =0x2c074 , - .halt_check =BRANCH_HALT_VOTED , + .halt_check =BRANCH_HALT_SKIP , .hwcg_reg =0x2c074 , .hwcg_bit =1 , .clkr = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 826/1815 clk: qcom: negcc-nord: use clk_regmap_phy_mux for USB3 pipe clock srcs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit a5c2859ffe9c8e033e2df1ef62357fa5692008f1 ]
ne_gcc_usb3_prim_phy_pipe_clk_src and ne_gcc_usb3_sec_phy_pipe_clk_src are 2-bit muxes selecting between a PHY-sourced USB3 pipe clock and BI_TCXO, implemented with clk_regmap_mux_closest_ops. This requires manual parent switching and does not park the mux on the reference clock when the clock is disabled.
Convert both to clk_regmap_phy_mux with clk_regmap_phy_mux_ops, which automatically parks the mux on the XO/ref source on disable and restores the PHY parent on enable, matching the existing UFS symbol clock conversions in this driver.
--- drivers/clk/qcom/negcc-nord.c | 49 +++++++++-------------------------- 1 file changed, 12 insertions(+), 37 deletions(-)
drivers/clk/qcom/negcc-nord.c +12 -37
@@ -16,7 +16,6 @@#include "clk-rcg.h" #include "clk-regmap.h" #include "clk-regmap-divider.h" -#include "clk-regmap-mux.h" #include "clk-regmap-phy-mux.h" #include "common.h" #include "gdsc.h"
@@ -41,8 +40,6 @@ enum {P_UFS_PHY_RX_SYMBOL_0_CLK ,P_UFS_PHY_RX_SYMBOL_1_CLK , P_UFS_PHY_TX_SYMBOL_0_CLK, -P_USB3_PHY_SEC_WRAPPER_NE_GCC_USB31_PIPE_CLK , - P_USB3_PHY_WRAPPER_NE_GCC_USB31_PIPE_CLK, }; static struct clk_alpha_pll ne_gcc_gpll0 = {
@@ -165,26 +162,6 @@ static const struct clk_parent_data ne_gcc_parent_data_5[] = { { .index = DT_BI_TCXO }, }; -static const struct parent_map ne_gcc_parent_map_6[] = { - {P_USB3_PHY_WRAPPER_NE_GCC_USB31_PIPE_CLK ,0 }, - {P_BI_TCXO ,2 }, -}; - -static const struct clk_parent_data ne_gcc_parent_data_6[] = { - { .index =DT_USB3_PHY_WRAPPER_NE_GCC_USB31_PIPE_CLK }, - { .index =DT_BI_TCXO }, -}; - -static const struct parent_map ne_gcc_parent_map_7[] = { - {P_USB3_PHY_SEC_WRAPPER_NE_GCC_USB31_PIPE_CLK ,0 }, - {P_BI_TCXO ,2 }, -}; - -static const struct clk_parent_data ne_gcc_parent_data_7[] = { - { .index =DT_USB3_PHY_SEC_WRAPPER_NE_GCC_USB31_PIPE_CLK }, - { .index =DT_BI_TCXO }, -}; -static struct clk_regmap_phy_mux ne_gcc_ufs_phy_rx_symbol_0_clk_src = { .reg =0x33068 , .clkr = {
@@ -227,32 +204,30 @@ static struct clk_regmap_phy_mux ne_gcc_ufs_phy_tx_symbol_0_clk_src = { }, }; -static struct clk_regmap_mux ne_gcc_usb3_prim_phy_pipe_clk_src = { +static struct clk_regmap_phy_mux ne_gcc_usb3_prim_phy_pipe_clk_src = { .reg =0x2a078 , - .shift =0 , - .width =2 , - .parent_map = ne_gcc_parent_map_6, .clkr = { .hw.init = &(const struct clk_init_data ) { .name ="ne_gcc_usb3_prim_phy_pipe_clk_src" , - .parent_data = ne_gcc_parent_data_6, - .num_parents =ARRAY_SIZE (ne_gcc_parent_data_6), - .ops = &clk_regmap_mux_closest_ops, + .parent_data = &(const struct clk_parent_data ){ + .index =DT_USB3_PHY_WRAPPER_NE_GCC_USB31_PIPE_CLK , + }, + .num_parents =1 , + .ops = &clk_regmap_phy_mux_ops, }, }, }; -static struct clk_regmap_mux ne_gcc_usb3_sec_phy_pipe_clk_src = { +static struct clk_regmap_phy_mux ne_gcc_usb3_sec_phy_pipe_clk_src = { .reg =0x2c078 , - .shift =0 , - .width =2 , - .parent_map = ne_gcc_parent_map_7, .clkr = { .hw.init = &(const struct clk_init_data ) { .name ="ne_gcc_usb3_sec_phy_pipe_clk_src" , - .parent_data = ne_gcc_parent_data_7, - .num_parents =ARRAY_SIZE (ne_gcc_parent_data_7), - .ops = &clk_regmap_mux_closest_ops, + .parent_data = &(const struct clk_parent_data ){ + .index =DT_USB3_PHY_SEC_WRAPPER_NE_GCC_USB31_PIPE_CLK , + }, + .num_parents =1 , + .ops = &clk_regmap_phy_mux_ops, }, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 827/1815 clk: qcom: gcc-nord: mark PCIe link clocks as critical
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 6c3a4d971503b04b00d75a37882becb3c2f57f30 ]
The PCIe link AHB and XO clocks must remain enabled for proper operation. Representing them as clk_branch instances allows them to be gated, which is undesirable.
Remove their clk_branch definitions and register their CBCRs as critical clocks instead so they remain enabled.
This matches the handling of similar always-on clocks in other Qualcomm clock drivers.
--- drivers/clk/qcom/gcc-nord.c | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-)
drivers/clk/qcom/gcc-nord.c +7 -30
@@ -1184,34 +1184,6 @@ static struct clk_branch gcc_pcie_d_slv_q2a_axi_clk = { }, }; -static struct clk_branch gcc_pcie_link_ahb_clk = { - .halt_reg =0x52464 , - .halt_check =BRANCH_HALT , - .clkr = { - .enable_reg =0x52464 , - .enable_mask =BIT (0 ), - .hw.init = &(const struct clk_init_data ) { - .name ="gcc_pcie_link_ahb_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; - -static struct clk_branch gcc_pcie_link_xo_clk = { - .halt_reg =0x52468 , - .halt_check =BRANCH_HALT_VOTED , - .hwcg_reg =0x52468 , - .hwcg_bit =1 , - .clkr = { - .enable_reg =0x52468 , - .enable_mask =BIT (0 ), - .hw.init = &(const struct clk_init_data ) { - .name ="gcc_pcie_link_xo_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch gcc_pcie_noc_async_bridge_clk = { .halt_reg =0x52048 , .halt_check =BRANCH_HALT_SKIP ,
@@ -1757,8 +1729,6 @@ static struct clk_regmap *gcc_nord_clocks[] = { [GCC_PCIE_D_PIPE_CLK_SRC] = &gcc_pcie_d_pipe_clk_src.clkr, [GCC_PCIE_D_SLV_AXI_CLK] = &gcc_pcie_d_slv_axi_clk.clkr, [GCC_PCIE_D_SLV_Q2A_AXI_CLK] = &gcc_pcie_d_slv_q2a_axi_clk.clkr, - [GCC_PCIE_LINK_AHB_CLK] = &gcc_pcie_link_ahb_clk.clkr, - [GCC_PCIE_LINK_XO_CLK] = &gcc_pcie_link_xo_clk.clkr, [GCC_PCIE_NOC_ASYNC_BRIDGE_CLK] = &gcc_pcie_noc_async_bridge_clk.clkr, [GCC_PCIE_NOC_CNOC_SF_QX_CLK] = &gcc_pcie_noc_cnoc_sf_qx_clk.clkr, [GCC_PCIE_NOC_M_CFG_CLK] = &gcc_pcie_noc_m_cfg_clk.clkr,
@@ -1849,9 +1819,16 @@ static const struct regmap_config gcc_nord_regmap_config = { .fast_io = true, }; +static const u32 gcc_nord_critical_cbcrs[] = { +0x52464 ,/* GCC_PCIE_LINK_AHB_CLK */ +0x52468 ,/* GCC_PCIE_LINK_XO_CLK */ +}; +static const struct qcom_cc_driver_data gcc_nord_driver_data = { .dfs_rcgs = gcc_nord_dfs_clocks, .num_dfs_rcgs =ARRAY_SIZE (gcc_nord_dfs_clocks), + .clk_cbcrs = gcc_nord_critical_cbcrs, + .num_clk_cbcrs =ARRAY_SIZE (gcc_nord_critical_cbcrs), };static const struct qcom_cc_desc gcc_nord_desc = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 828/1815 clk: qcom: negcc-nord: keep GPU2 CFG clock enabled via critical CBCR
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 936e98ef12f714c19150a5595bbd296d9489b2e1 ]
The GPU2 CFG clock must remain enabled for correct operation and should not be exposed as a controllable clk_branch.
Remove the clk_branch and mark its CBCR as critical instead to prevent unintended gating. This follows the same approach as 'nw_gcc_gpu_cfg_ahb_clk' and aligns with other always-on clocks in Qualcomm CC drivers.
--- drivers/clk/qcom/negcc-nord.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/clk/qcom/negcc-nord.c +6 -16
@@ -926,21 +926,6 @@ static struct clk_branch ne_gcc_gp2_clk = { }, }; -static struct clk_branch ne_gcc_gpu_2_cfg_clk = { - .halt_reg =0x34004 , - .halt_check =BRANCH_HALT_VOTED , - .hwcg_reg =0x34004 , - .hwcg_bit =1 , - .clkr = { - .enable_reg =0x34004 , - .enable_mask =BIT (0 ), - .hw.init = &(const struct clk_init_data ) { - .name ="ne_gcc_gpu_2_cfg_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch ne_gcc_gpu_2_gpll0_clk_src = { .halt_check =BRANCH_HALT_DELAY , .clkr = {
@@ -1791,7 +1776,6 @@ static struct clk_regmap *ne_gcc_nord_clocks[] = { [NE_GCC_GPLL0] = &ne_gcc_gpll0.clkr, [NE_GCC_GPLL0_OUT_EVEN] = &ne_gcc_gpll0_out_even.clkr, [NE_GCC_GPLL2] = &ne_gcc_gpll2.clkr, - [NE_GCC_GPU_2_CFG_CLK] = &ne_gcc_gpu_2_cfg_clk.clkr, [NE_GCC_GPU_2_GPLL0_CLK_SRC] = &ne_gcc_gpu_2_gpll0_clk_src.clkr, [NE_GCC_GPU_2_GPLL0_DIV_CLK_SRC] = &ne_gcc_gpu_2_gpll0_div_clk_src.clkr, [NE_GCC_GPU_2_HSCNOC_GFX_CLK] = &ne_gcc_gpu_2_hscnoc_gfx_clk.clkr,
@@ -1920,10 +1904,16 @@ static void clk_nord_regs_configure(struct device *dev, struct regmap *regmap)qcom_branch_set_force_mem_core (regmap, ne_gcc_ufs_phy_axi_clk, true); } +static const u32 ne_gcc_nord_critical_cbcrs[] = { +0x34004 ,/* NE_GCC_GPU_2_CFG_CLK */ +}; +static const struct qcom_cc_driver_data ne_gcc_nord_driver_data = { .dfs_rcgs = ne_gcc_nord_dfs_clocks, .num_dfs_rcgs =ARRAY_SIZE (ne_gcc_nord_dfs_clocks), .clk_regs_configure = clk_nord_regs_configure, + .clk_cbcrs = ne_gcc_nord_critical_cbcrs, + .num_clk_cbcrs =ARRAY_SIZE (ne_gcc_nord_critical_cbcrs), };static const struct qcom_cc_desc ne_gcc_nord_desc = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 829/1815 clk: qcom: dispcc-qcm2290: Move to the latest common qcom_cc_probe() model
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit b8b5b26aa10e57c154ceb7d32d573afb864823aa ]
Update the QCM2290 DISPCC driver to use the qcom_cc_probe() model by moving the critical clocks handling and PLL configurations from probe to the driver_data to align with the latest convention.
Stable-dep-of: 11345cbf17ca ("clk: qcom: dispcc-qcm2290: Enable runtime PM support")
--- drivers/clk/qcom/dispcc-qcm2290.c | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/clk/qcom/dispcc-qcm2290.c +19 -19
@@ -2,6 +2,7 @@/* * Copyright (c) 2020, The Linux Foundation. All rights reserved. * Copyright (c) 2021, Linaro Ltd. +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #include <linux/clk-provider.h>
@@ -48,6 +49,7 @@ static const struct alpha_pll_config disp_cc_pll0_config = {static struct clk_alpha_pll disp_cc_pll0 = { .offset =0x0 , + .config = &disp_cc_pll0_config, .vco_table = spark_vco, .num_vco =ARRAY_SIZE (spark_vco), .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ],
@@ -482,6 +484,14 @@ static struct clk_regmap *disp_cc_qcm2290_clocks[] = { [DISP_CC_SLEEP_CLK_SRC] = &disp_cc_sleep_clk_src.clkr, }; +static struct clk_alpha_pll *disp_cc_qcm2290_plls[] = { + &disp_cc_pll0, +}; + +static const u32 disp_cc_qcm2290_critical_cbcrs[] = { +0x604c ,/* DISP_CC_XO_CLK */ +}; +static const struct regmap_config disp_cc_qcm2290_regmap_config = { .reg_bits =32 , .reg_stride =4 ,
@@ -490,6 +500,13 @@ static const struct regmap_config disp_cc_qcm2290_regmap_config = { .fast_io = true, }; +static const struct qcom_cc_driver_data disp_cc_qcm2290_driver_data = { + .alpha_plls = disp_cc_qcm2290_plls, + .num_alpha_plls =ARRAY_SIZE (disp_cc_qcm2290_plls), + .clk_cbcrs = disp_cc_qcm2290_critical_cbcrs, + .num_clk_cbcrs =ARRAY_SIZE (disp_cc_qcm2290_critical_cbcrs), +}; +static const struct qcom_cc_desc disp_cc_qcm2290_desc = { .config = &disp_cc_qcm2290_regmap_config, .clks = disp_cc_qcm2290_clocks,
@@ -498,6 +515,7 @@ static const struct qcom_cc_desc disp_cc_qcm2290_desc = { .num_gdscs = ARRAY_SIZE(disp_cc_qcm2290_gdscs), .resets = disp_cc_qcm2290_resets, .num_resets = ARRAY_SIZE(disp_cc_qcm2290_resets), + .driver_data = &disp_cc_qcm2290_driver_data, };static const struct of_device_id disp_cc_qcm2290_match_table[] = {
@@ -508,25 +526,7 @@ MODULE_DEVICE_TABLE(of, disp_cc_qcm2290_match_table);static int disp_cc_qcm2290_probe (struct platform_device *pdev) { -struct regmap *regmap; -int ret; - - regmap =qcom_cc_map (pdev, &disp_cc_qcm2290_desc); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); - -clk_alpha_pll_configure (&disp_cc_pll0, regmap, &disp_cc_pll0_config); - -/* Keep some clocks always-on */ -qcom_branch_set_clk_en (regmap,0x604c );/* DISP_CC_XO_CLK */ - - ret =qcom_cc_really_probe (&pdev->dev, &disp_cc_qcm2290_desc, regmap); -if (ret) { -dev_err (&pdev->dev,"Failed to register DISP CC clocks\n" ); -return ret; - } - -return ret; +return qcom_cc_probe (pdev, &disp_cc_qcm2290_desc); }static struct platform_driver disp_cc_qcm2290_driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 830/1815 clk: qcom: dispcc-qcm2290: Enable runtime PM support
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit 11345cbf17cacc3828f7bcb021ecc07c687d04f2 ]
The QCM2290 DISPCC is now associated with a power domain (RPMPD_CX) to propagate genpd performance state votes to the CX rail. Set use_rpm to true so that a runtime PM reference is acquired and released around probe, instead of leaving a permanent 'enable' vote on the power domain.
--- drivers/clk/qcom/dispcc-qcm2290.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/dispcc-qcm2290.c +1 -0
@@ -515,6 +515,7 @@ static const struct qcom_cc_desc disp_cc_qcm2290_desc = { .num_gdscs = ARRAY_SIZE(disp_cc_qcm2290_gdscs), .resets = disp_cc_qcm2290_resets, .num_resets = ARRAY_SIZE(disp_cc_qcm2290_resets), + .use_rpm = true, .driver_data = &disp_cc_qcm2290_driver_data, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 831/1815 clk: qcom: qcm2290: Set POLL_CFG_GDSCR flag for DISPCC and GPUCC GDSCs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit 6b0044bc75b04374c58d082d4cd59f57db83e8dc ]
The Qualcomm QCM2290 SoC GDSCR status bit may not reflect the actual state of the GDSC, instead the power on/off bits in CFG_GDSCR must be polled to determine the GDSC state correctly. Set POLL_CFG_GDSCR flag for the QCM2290 MDSS GDSC and GPUCC GX GDSC to ensure the correct GDSC status. This is not applicable for GPUCC CX GDSC, which relies on gds_hw_ctrl status.
--- drivers/clk/qcom/dispcc-qcm2290.c | 2 +- drivers/clk/qcom/gpucc-qcm2290.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/dispcc-qcm2290.c +1 -1
@@ -455,7 +455,7 @@ static struct gdsc mdss_gdsc = { .name = "mdss_gdsc", }, .pwrsts = PWRSTS_OFF_ON, - .flags = HW_CTRL, + .flags = HW_CTRL | POLL_CFG_GDSCR, }; static struct gdsc *disp_cc_qcm2290_gdscs[] = {
drivers/clk/qcom/gpucc-qcm2290.c +1 -1
@@ -313,7 +313,7 @@ static struct gdsc gpu_gx_gdsc = { }, .parent = &gpu_cx_gdsc.pd, .pwrsts = PWRSTS_OFF_ON, - .flags = CLAMP_IO | AON_RESET | SW_RESET, + .flags = POLL_CFG_GDSCR | CLAMP_IO | AON_RESET | SW_RESET, };static struct clk_regmap *gpu_cc_qcm2290_clocks[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 832/1815 clk: qcom: qcm2290: Add RETAIN_FF_ENABLE flag for DISPCC and GPUCC GDSCs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit 899dfd90229e3d83aa85a27b3d5d1d78bdb7385d ]
Add RETAIN_FF_ENABLE flag for DISPCC and GPUCC GDSCs on QCM2290 to retain the register context across GDSC power collapse.
--- drivers/clk/qcom/dispcc-qcm2290.c | 2 +- drivers/clk/qcom/gpucc-qcm2290.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/qcom/dispcc-qcm2290.c +1 -1
@@ -455,7 +455,7 @@ static struct gdsc mdss_gdsc = { .name = "mdss_gdsc", }, .pwrsts = PWRSTS_OFF_ON, - .flags = HW_CTRL | POLL_CFG_GDSCR, + .flags = HW_CTRL | POLL_CFG_GDSCR | RETAIN_FF_ENABLE, }; static struct gdsc *disp_cc_qcm2290_gdscs[] = {
drivers/clk/qcom/gpucc-qcm2290.c +2 -2
@@ -300,7 +300,7 @@ static struct gdsc gpu_cx_gdsc = { .name = "gpu_cx_gdsc", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = RETAIN_FF_ENABLE | VOTABLE, }; static struct gdsc gpu_gx_gdsc = {
@@ -313,7 +313,7 @@ static struct gdsc gpu_gx_gdsc = { }, .parent = &gpu_cx_gdsc.pd, .pwrsts = PWRSTS_OFF_ON, - .flags = POLL_CFG_GDSCR | CLAMP_IO | AON_RESET | SW_RESET, + .flags = RETAIN_FF_ENABLE | POLL_CFG_GDSCR | CLAMP_IO | AON_RESET | SW_RESET, };static struct clk_regmap *gpu_cc_qcm2290_clocks[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 833/1815 clk: qcom: qcm2290: Update DISPCC and GPUCC GDSC *wait_val values
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit 08cfbfd81dd6e27167b1331e0c485bd0414cf5fe ]
Update the QCM2290 DISPCC and GPUCC GDSC wait_val fields to match the hardware default values. Incorrect settings can cause the GDSC FSM to stuck, leading to power on/off failures.
--- drivers/clk/qcom/dispcc-qcm2290.c | 3 +++ drivers/clk/qcom/gpucc-qcm2290.c | 6 ++++++ 2 files changed, 9 insertions(+)
drivers/clk/qcom/dispcc-qcm2290.c +3 -0
@@ -451,6 +451,9 @@ static const struct qcom_reset_map disp_cc_qcm2290_resets[] = {static struct gdsc mdss_gdsc = { .gdscr =0x3000 , + .en_rest_wait_val =0x2 , + .en_few_wait_val =0x2 , + .clk_dis_wait_val =0xf , .pd = { .name ="mdss_gdsc" , },
drivers/clk/qcom/gpucc-qcm2290.c +6 -0
@@ -296,6 +296,9 @@ static struct clk_branch gpu_cc_hlos1_vote_gpu_smmu_clk = {static struct gdsc gpu_cx_gdsc = { .gdscr =0x106c , .gds_hw_ctrl =0x1540 , + .en_rest_wait_val =0x2 , + .en_few_wait_val =0x2 , + .clk_dis_wait_val =0x2 , .pd = { .name ="gpu_cx_gdsc" , },
@@ -308,6 +311,9 @@ static struct gdsc gpu_gx_gdsc = { .clamp_io_ctrl = 0x1508, .resets = (unsigned int []){ GPU_GX_BCR }, .reset_count = 1, + .en_rest_wait_val = 0x2, + .en_few_wait_val = 0x2, + .clk_dis_wait_val = 0x2, .pd = { .name = "gpu_gx_gdsc", },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 834/1815 clk: qcom: gpucc-qcm2290: Drop pm_clk handling
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit 1b2e1f5a37dd4c856a9269bc7e5988c642db5847 ]
Drop the pm_clk handling from QCM2290 GPUCC driver as the required GCC AHB clocks are kept always enabled by the GCC driver during probe.
Stable-dep-of: 7274ea68d2b4 ("clk: qcom: gpucc-qcm2290: Keep the critical clocks always-on from probe")
--- drivers/clk/qcom/gpucc-qcm2290.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/clk/qcom/gpucc-qcm2290.c +0 -11
@@ -7,7 +7,6 @@#include <linux/clk-provider.h> #include <linux/module.h> #include <linux/platform_device.h> -#include <linux/pm_clock.h> #include <linux/pm_runtime.h> #include <linux/regmap.h>
@@ -385,16 +384,6 @@ static int gpu_cc_qcm2290_probe(struct platform_device *pdev)if (ret)return ret; - ret =devm_pm_clk_create (&pdev->dev); -if (ret) -return ret; - - ret =pm_clk_add (&pdev->dev,NULL ); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to acquire ahb clock\n" ); -return ret; - } - ret =pm_runtime_resume_and_get (&pdev->dev);if (ret)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 835/1815 clk: qcom: gpucc-qcm2290: Move to the latest common qcom_cc_probe() model
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit 1b4599bc20e98d61c274b3449ca392b8e2b07b4a ]
Update the QCM2290 GPUCC driver to use the qcom_cc_probe() model by moving the critical clocks handling and PLL configurations from probe to the driver_data to align with the latest convention.
Stable-dep-of: 7274ea68d2b4 ("clk: qcom: gpucc-qcm2290: Keep the critical clocks always-on from probe")
--- drivers/clk/qcom/gpucc-qcm2290.c | 50 +++++++++++++------------------- 1 file changed, 20 insertions(+), 30 deletions(-)
drivers/clk/qcom/gpucc-qcm2290.c +20 -30
@@ -2,12 +2,12 @@/* * Copyright (c) 2020, The Linux Foundation. All rights reserved. * Copyright (c) 2024, Linaro Limited +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #include <linux/clk-provider.h> #include <linux/module.h> #include <linux/platform_device.h> -#include <linux/pm_runtime.h> #include <linux/regmap.h> #include <dt-bindings/clock/qcom,qcm2290-gpucc.h>
@@ -19,6 +19,7 @@#include "clk-regmap-divider.h" #include "clk-regmap-mux.h" #include "clk-regmap-phy-mux.h" +#include "common.h" #include "gdsc.h" #include "reset.h"
@@ -55,6 +56,7 @@ static const struct alpha_pll_config gpu_cc_pll0_config = {static struct clk_alpha_pll gpu_cc_pll0 = { .offset =0x0 , + .config = &gpu_cc_pll0_config, .vco_table = huayra_vco, .num_vco =ARRAY_SIZE (huayra_vco), .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_HUAYRA_2290 ],
@@ -346,6 +348,14 @@ static struct gdsc *gpu_cc_qcm2290_gdscs[] = { [GPU_GX_GDSC] = &gpu_gx_gdsc, }; +static struct clk_alpha_pll *gpu_cc_qcm2290_plls[] = { + &gpu_cc_pll0, +}; + +static const u32 gpu_cc_qcm2290_critical_cbcrs[] = { +0x1060 ,/* GPU_CC_GX_CXO_CLK */ +}; +static const struct regmap_config gpu_cc_qcm2290_regmap_config = { .reg_bits =32 , .reg_stride =4 ,
@@ -354,6 +364,12 @@ static const struct regmap_config gpu_cc_qcm2290_regmap_config = { .fast_io = true, }; +static const struct qcom_cc_driver_data gpu_cc_qcm2290_driver_data = { + .alpha_plls = gpu_cc_qcm2290_plls, + .num_alpha_plls =ARRAY_SIZE (gpu_cc_qcm2290_plls), + .clk_cbcrs = gpu_cc_qcm2290_critical_cbcrs, + .num_clk_cbcrs =ARRAY_SIZE (gpu_cc_qcm2290_critical_cbcrs), +};static const struct qcom_cc_desc gpu_cc_qcm2290_desc = { .config = &gpu_cc_qcm2290_regmap_config,
@@ -363,6 +379,8 @@ static const struct qcom_cc_desc gpu_cc_qcm2290_desc = { .num_resets = ARRAY_SIZE(gpu_cc_qcm2290_resets), .gdscs = gpu_cc_qcm2290_gdscs, .num_gdscs = ARRAY_SIZE(gpu_cc_qcm2290_gdscs), + .use_rpm = true, + .driver_data = &gpu_cc_qcm2290_driver_data, };static const struct of_device_id gpu_cc_qcm2290_match_table[] = {
@@ -373,35 +391,7 @@ MODULE_DEVICE_TABLE(of, gpu_cc_qcm2290_match_table);static int gpu_cc_qcm2290_probe (struct platform_device *pdev) { -struct regmap *regmap; -int ret; - - regmap =qcom_cc_map (pdev, &gpu_cc_qcm2290_desc); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); - - ret =devm_pm_runtime_enable (&pdev->dev); -if (ret) -return ret; - - ret =pm_runtime_resume_and_get (&pdev->dev); -if (ret) -return ret; - -clk_huayra_2290_pll_configure (&gpu_cc_pll0, regmap, &gpu_cc_pll0_config); - -regmap_update_bits (regmap,0x1060 ,BIT (0 ),BIT (0 ));/* GPU_CC_GX_CXO_CLK */ - - ret =qcom_cc_really_probe (&pdev->dev, &gpu_cc_qcm2290_desc, regmap); -if (ret) { -dev_err (&pdev->dev,"Failed to register display clock controller\n" ); - goto out_pm_runtime_put; - } - -out_pm_runtime_put: -pm_runtime_put_sync (&pdev->dev); - -return 0 ; +return qcom_cc_probe (pdev, &gpu_cc_qcm2290_desc); }static struct platform_driver gpu_cc_qcm2290_driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 836/1815 clk: qcom: gpucc-qcm2290: Keep the critical clocks always-on from probe
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit 7274ea68d2b4be491de0ece45fdce709cfde3154 ]
Drop modelling of gpu_cc_ahb_clk and keep it always enabled from probe similar to other critical clocks, since marking it as CLK_IS_CRITICAL causes the clock framework to invoke clk_pm_runtime_get() during prepare, which prevents the associated power domains from collapsing.
--- drivers/clk/qcom/gpucc-qcm2290.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/clk/qcom/gpucc-qcm2290.c +1 -15
@@ -148,20 +148,6 @@ static struct clk_rcg2 gpu_cc_gx_gfx3d_clk_src = { }, }; -static struct clk_branch gpu_cc_ahb_clk = { - .halt_reg =0x1078 , - .halt_check =BRANCH_HALT_DELAY , - .clkr = { - .enable_reg =0x1078 , - .enable_mask =BIT (0 ), - .hw.init = &(struct clk_init_data ){ - .name ="gpu_cc_ahb_clk" , - .flags =CLK_IS_CRITICAL , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch gpu_cc_crc_ahb_clk = { .halt_reg =0x107c , .halt_check =BRANCH_HALT_DELAY ,
@@ -324,7 +310,6 @@ static struct gdsc gpu_gx_gdsc = { };static struct clk_regmap *gpu_cc_qcm2290_clocks[] = { - [GPU_CC_AHB_CLK ] = &gpu_cc_ahb_clk.clkr, [GPU_CC_CRC_AHB_CLK ] = &gpu_cc_crc_ahb_clk.clkr, [GPU_CC_CX_GFX3D_CLK ] = &gpu_cc_cx_gfx3d_clk.clkr, [GPU_CC_CX_GMU_CLK ] = &gpu_cc_cx_gmu_clk.clkr,
@@ -353,6 +338,7 @@ static struct clk_alpha_pll *gpu_cc_qcm2290_plls[] = { };static const u32 gpu_cc_qcm2290_critical_cbcrs[] = { +0x1078 ,/* GPU_CC_AHB_CLK */ 0x1060 ,/* GPU_CC_GX_CXO_CLK */ };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 837/1815 clk: qcom: gpucc-qcm2290: Park RCGs clk source at XO during disable
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imran Shaik <[email protected]>
[ Upstream commit ab46b5fb668b8b9b848a8f036fc4c06ce86b7e3b ]
The RCG's clk src has to be parked at XO while disabling as per hardware team's recommendation, hence use clk_rcg2_shared_ops to achieve the same.
--- drivers/clk/qcom/gpucc-qcm2290.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gpucc-qcm2290.c +1 -1
@@ -144,7 +144,7 @@ static struct clk_rcg2 gpu_cc_gx_gfx3d_clk_src = { .parent_data = gpu_cc_parent_data_1, .num_parents = ARRAY_SIZE(gpu_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 838/1815 clk: qcom: Return expected ENOMEM error on dynamic allocation failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Zapolskiy <[email protected]>
[ Upstream commit 22d9257f08913b6eec3e8ece4d13d9c41f14428b ]
If a dynamic memory allocation fails, the returned error code in clock controller driver probe functions on a few legacy platforms should be set to -ENOMEM instead of -EINVAL.
--- drivers/clk/qcom/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/common.c +2 -2
@@ -169,7 +169,7 @@ static int _qcom_cc_register_board_clk(struct device *dev, const char *path,if (!node) { fixed =devm_kzalloc (dev,sizeof (*fixed),GFP_KERNEL );if (!fixed) -return -EINVAL ; +return -ENOMEM ; fixed->fixed_rate = rate; fixed->hw.init = &init_data;
@@ -186,7 +186,7 @@ static int _qcom_cc_register_board_clk(struct device *dev, const char *path,if (add_factor) { factor =devm_kzalloc (dev,sizeof (*factor),GFP_KERNEL );if (!factor) -return -EINVAL ; +return -ENOMEM ; factor->mult = factor->div =1 ; factor->hw.init = &init_data;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 839/1815 md/bitmap: resume array on backlog_store() error path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Cheng <[email protected]>
[ Upstream commit 2911cd0a0f4366a7e06832bc5f0a7fdcc138e4dc ]
backlog_store() suspends the array before checking whether a write-mostly device exists. If no such device exists, the error path only unlocks reconfig_mutex and leaves the array suspended, blocking subsequent I/O.
Use mddev_unlock_and_resume() to release both states.
--- drivers/md/md-bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-bitmap.c +1 -1
@@ -2857,7 +2857,7 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len)if (!has_write_mostly) {pr_warn_ratelimited ("%s: can't set backlog, no write mostly device available\n" ,mdname (mddev)); -mddev_unlock (mddev); +mddev_unlock_and_resume (mddev);return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 840/1815 md: scope memalloc_noio to allocation critical sections
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Cheng <[email protected]>
[ Upstream commit bace2010dd7ac07bc980575afb135c406730a7fe ]
Storing a memalloc_noio_save() token in mddev->noio_flags lets one task save the token and another task restore it. With concurrent suspend sysfs writes, task A can enter PF_MEMALLOC_NOIO, return to userspace still in that scope, and later task B can restore A's saved token.
Avoid tying the token lifetime to mddev. Keep mddev_suspend() and mddev_resume() only responsible for array suspension, and enter PF_MEMALLOC_NOIO only in the MD paths that allocate memory after the array has been suspended. Restore the token before resuming the array.
A reproducer repeatedly writes suspend_lo and suspend_hi from concurrent workers and checks each worker's /proc/self/stat flags before and after the sysfs write.
--- drivers/md/md-bitmap.c | 3 +++ drivers/md/md.c | 53 ++++++++++++++++++++++++++++-------------- drivers/md/md.h | 1 - drivers/md/raid5.c | 14 +++++++---- 4 files changed, 48 insertions(+), 23 deletions(-)
drivers/md/md-bitmap.c +3 -0
@@ -2624,10 +2624,12 @@ static ssize_t location_store(struct mddev *mddev, const char *buf, size_t len) { int rv; +unsigned int noio_flags; rv =mddev_suspend_and_lock (mddev);if (rv)return rv; + noio_flags =memalloc_noio_save ();if (mddev->pers) {if (mddev->recovery || mddev->sync_thread) {
@@ -2714,6 +2716,7 @@ location_store(struct mddev *mddev, const char *buf, size_t len) } rv =0 ; out: +memalloc_noio_restore (noio_flags);mddev_unlock_and_resume (mddev);if (rv)return rv;
drivers/md/md.c +36 -17
206 lines not on this page · raw message
drivers/md/md.h +0 -1
@@ -621,7 +621,6 @@ struct mddev {struct md_cluster_info *cluster_info;struct md_cluster_operations *cluster_ops;unsigned int good_device_nr;/* good device num within cluster raid */ -unsigned int noio_flag;/* for memalloc scope API */ /* * Temporarily store rdev that will be finally removed when
drivers/md/raid5.c +9 -5
@@ -2471,11 +2471,6 @@ static int scribble_alloc(struct raid5_percpu *percpu,sizeof (unsigned int ) * (num +2 );void *scribble; -/* -* If here is in raid array suspend context, it is in memalloc noio -* context as well, there is no potential recursive memory reclaim -* I/Os with the GFP_KERNEL flag. -*/ scribble =kvmalloc_array (cnt, obj_size,GFP_KERNEL );if (!scribble)return -ENOMEM ;
@@ -2490,6 +2485,7 @@ static int scribble_alloc(struct raid5_percpu *percpu,static int resize_chunks (struct r5conf *conf,int new_disks,int new_sectors) {unsigned long cpu; +unsigned int noio_flags;int err =0 ;/* Never shrink. */
@@ -2498,6 +2494,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors)return 0 ;raid5_quiesce (conf->mddev, true); + noio_flags =memalloc_noio_save ();cpus_read_lock ();for_each_present_cpu (cpu) {
@@ -2511,6 +2508,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors) }cpus_read_unlock (); +memalloc_noio_restore (noio_flags);raid5_quiesce (conf->mddev, false);if (!err) {
@@ -7028,6 +7026,7 @@ raid5_store_stripe_size(struct mddev *mddev, const char *page, size_t len) {struct r5conf *conf;unsigned long new; +unsigned int noio_flags =0 ;int err;int size;
@@ -7068,6 +7067,7 @@ raid5_store_stripe_size(struct mddev *mddev, const char *page, size_t len) goto out_unlock; } + noio_flags =memalloc_noio_save ();mutex_lock (&conf->cache_size_mutex); size = conf->max_nr_stripes;
@@ -7084,6 +7084,7 @@ raid5_store_stripe_size(struct mddev *mddev, const char *page, size_t len)mutex_unlock (&conf->cache_size_mutex); out_unlock: +memalloc_noio_restore (noio_flags);mddev_unlock_and_resume (mddev);return err ?: len; }
@@ -8964,6 +8965,7 @@ static void *raid6_takeover(struct mddev *mddev)static int raid5_change_consistency_policy (struct mddev *mddev,const char *buf) {struct r5conf *conf; +unsigned int noio_flags;int err; err =mddev_suspend_and_lock (mddev);
@@ -8975,6 +8977,7 @@ static int raid5_change_consistency_policy(struct mddev *mddev, const char *buf)return -ENODEV ; } + noio_flags =memalloc_noio_save ();if (strncmp (buf,"ppl" ,3 ) ==0 ) {/* ppl only works with RAID 5 */ if (!raid5_has_ppl (conf) && conf->level ==5 ) {
@@ -9014,6 +9017,7 @@ static int raid5_change_consistency_policy(struct mddev *mddev, const char *buf)if (!err)md_update_sb (mddev,1 ); +memalloc_noio_restore (noio_flags);mddev_unlock_and_resume (mddev);return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 841/1815 iommu/dma: Check atomic pool allocation result directly
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aneesh Kumar K.V (Arm) <[email protected]>
[ Upstream commit af95a0ebc0a0db0762be75f51eadf770bad01aaa ]
The non-blocking, non-coherent allocation path uses dma_alloc_from_pool(), which returns the allocated page and fills cpu_addr only on success.
Do not rely on cpu_addr to detect allocation failure in this path. Check the returned page directly before using it for the IOMMU mapping.
--- drivers/iommu/dma-iommu.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/iommu/dma-iommu.c +8 -5
@@ -1671,13 +1671,16 @@ void *iommu_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, }if (IS_ENABLED (CONFIG_DMA_DIRECT_REMAP ) && - !gfpflags_allow_blocking (gfp) && !coherent) + !gfpflags_allow_blocking (gfp) && !coherent) { page =dma_alloc_from_pool (dev,PAGE_ALIGN (size), &cpu_addr, - gfp,NULL ); -else + gfp,NULL ); +if (!page) +return NULL ; + }else { cpu_addr =iommu_dma_alloc_pages (dev, size, &page, gfp, attrs); -if (!cpu_addr) -return NULL ; +if (!cpu_addr) +return NULL ; + } *handle =__iommu_dma_map (dev,page_to_phys (page), size, ioprot, dev->coherent_dma_mask);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 842/1815 swiotlb: Preserve allocation virtual address for dynamic pools
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aneesh Kumar K.V (Arm) <[email protected]>
[ Upstream commit 57d29044d0f29a76c6ec0c112c8c7371d5608dc7 ]
swiotlb_alloc_tlb() can allocate from the DMA atomic pool when a decrypted pool is needed from atomic context. With CONFIG_DMA_DIRECT_REMAP, the atomic pool is backed by remapped virtual addresses, which are not the same as the direct-map addresses returned by phys_to_virt().
swiotlb_init_io_tlb_pool() currently reconstructs the pool virtual address from the physical start address. For atomic-pool backed allocations this stores the wrong address in pool->vaddr. Later, swiotlb_free_tlb() passes that address to dma_free_from_pool(), which will fail to recognize the chunk
Pass the virtual address returned by the allocation path into swiotlb_init_io_tlb_pool(), and store that address in pool->vaddr. This keeps the pool free path using the same virtual address as the allocator.
--- kernel/dma/swiotlb.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
kernel/dma/swiotlb.c +19 -12
@@ -266,9 +266,9 @@ void __init swiotlb_update_mem_attributes(void) }static void swiotlb_init_io_tlb_pool (struct io_tlb_pool *mem,phys_addr_t start, -unsigned long nslabs,bool late_alloc,unsigned int nareas) +void *vaddr,unsigned long nslabs,bool late_alloc, +unsigned int nareas) { -void *vaddr =phys_to_virt (start);unsigned long bytes = nslabs <<IO_TLB_SHIFT , i; mem->nslabs = nslabs;
@@ -409,7 +409,7 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,return ; } -swiotlb_init_io_tlb_pool (mem,__pa (tlb), nslabs, false, nareas); +swiotlb_init_io_tlb_pool (mem,__pa (tlb), tlb, nslabs, false, nareas);add_mem_pool (&io_tlb_default_mem, mem);if (flags &SWIOTLB_VERBOSE )
@@ -507,7 +507,7 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask,set_memory_decrypted ((unsigned long )vstart, (nslabs <<IO_TLB_SHIFT ) >>PAGE_SHIFT ); -swiotlb_init_io_tlb_pool (mem,virt_to_phys (vstart), nslabs, true, +swiotlb_init_io_tlb_pool (mem,virt_to_phys (vstart), vstart, nslabs, true, nareas);add_mem_pool (&io_tlb_default_mem, mem);
@@ -605,25 +605,26 @@ static struct page *alloc_dma_pages(gfp_t gfp, size_t bytes, u64 phys_limit)* @bytes: Size of the buffer. * @phys_limit: Maximum allowed physical address of the buffer. * @gfp: GFP flags for the allocation. +* @vaddr: Receives the virtual address for the allocated buffer. * * Return: Allocated pages, or %NULL on allocation failure. */ static struct page *swiotlb_alloc_tlb (struct device *dev,size_t bytes, -u64 phys_limit,gfp_t gfp) +u64 phys_limit,gfp_t gfp,void **vaddr) {struct page *page; + *vaddr =NULL ; +/* * Allocate from the atomic pools if memory is encrypted and * the allocation is atomic, because decrypting may block. */ if (!gfpflags_allow_blocking (gfp) && dev &&force_dma_unencrypted (dev)) { -void *vaddr; -if (!IS_ENABLED (CONFIG_DMA_COHERENT_POOL ))return NULL ; -return dma_alloc_from_pool (dev, bytes, &vaddr, gfp, +return dma_alloc_from_pool (dev, bytes, vaddr, gfp, dma_coherent_ok); }
@@ -645,6 +646,8 @@ static struct page *swiotlb_alloc_tlb(struct device *dev, size_t bytes,return NULL ; } +if (page) + *vaddr =phys_to_virt (page_to_phys (page));return page; }
@@ -685,6 +688,7 @@ static struct io_tlb_pool *swiotlb_alloc_pool(struct device *dev, {struct io_tlb_pool *pool;unsigned int slot_order; +void *tlb_vaddr;struct page *tlb;size_t pool_size;size_t tlb_size;
@@ -701,7 +705,8 @@ static struct io_tlb_pool *swiotlb_alloc_pool(struct device *dev, pool->areas = (void *)pool +sizeof (*pool); tlb_size = nslabs <<IO_TLB_SHIFT ; -while (!(tlb =swiotlb_alloc_tlb (dev, tlb_size, phys_limit, gfp))) { +while (!(tlb =swiotlb_alloc_tlb (dev, tlb_size, phys_limit, gfp, + &tlb_vaddr))) {if (nslabs <= minslabs) goto error_tlb; nslabs =ALIGN (nslabs >>1 ,IO_TLB_SEGSIZE );
@@ -715,11 +720,12 @@ static struct io_tlb_pool *swiotlb_alloc_pool(struct device *dev,if (!pool->slots) goto error_slots; -swiotlb_init_io_tlb_pool (pool,page_to_phys (tlb), nslabs, true, nareas); +swiotlb_init_io_tlb_pool (pool,page_to_phys (tlb), tlb_vaddr, nslabs, + true, nareas);return pool; error_slots: -swiotlb_free_tlb (page_address (tlb), tlb_size); +swiotlb_free_tlb (tlb_vaddr, tlb_size); error_tlb:kfree (pool); error:
@@ -1851,7 +1857,8 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem,set_memory_decrypted ((unsigned long )phys_to_virt (rmem->base), rmem->size >>PAGE_SHIFT ); -swiotlb_init_io_tlb_pool (pool, rmem->base, nslabs, +swiotlb_init_io_tlb_pool (pool, rmem->base,phys_to_virt (rmem->base), + nslabs, false, nareas); mem->force_bounce = true; mem->for_alloc = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 843/1815 i3c: dw: avoid shift-out-of-bounds when DAA assigns no devices
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 038cf48b3170af26a70bf2dee4f8c3ac910f5176 ]
On an empty bus ENTDAA assigns nothing, so cmd->rx_len (the count of addresses left unassigned) equals master->maxdevs.
The GENMASK() index master->maxdevs - cmd->rx_len - 1 then becomes -1, which trips up UBSAN. This happens every time on boot on a Gigabyte/AMD server:
UBSAN: shift-out-of-bounds in drivers/i3c/master/dw-i3c-master.c:905:12
shift exponent 64 is too large for 64-bit type 'long unsigned int'
CPU: 7 UID: 0 PID: 963 Comm: (udev-worker) Not tainted 7.0.11-200.fc44.x86_64 #1 PREEMPT(lazy)
Hardware name: Giga Computing E163-Z34-AAH1-000/MZ33-DC1-000, BIOS R32_F45 04/01/2026
Call Trace:
<TASK>
dump_stack_lvl+0x5d/0x80
ubsan_epilogue+0x5/0x2b
__ubsan_handle_shift_out_of_bounds.cold+0xd7/0x1ab
dw_i3c_master_daa.cold+0x1b/0x96 [dw_i3c_master]
i3c_master_do_daa_ext.part.0+0x3e/0xf0 [i3c]Skip the mask when no new device was assigned.
--- drivers/i3c/master/dw-i3c-master.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/i3c/master/dw-i3c-master.c +9 -1
@@ -888,7 +888,15 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)if (!wait_for_completion_timeout (&xfer->comp,XFER_TIMEOUT ))dw_i3c_master_dequeue_xfer (master, xfer); - newdevs =GENMASK (master->maxdevs - cmd->rx_len -1 ,0 ); +/* +* cmd->rx_len holds the number of addresses ENTDAA left unassigned. +* On an empty bus rx_len == maxdevs, so avoid GENMASK(-1, 0). +*/ +if (cmd->rx_len >= master->maxdevs) + newdevs =0 ; +else + newdevs =GENMASK (master->maxdevs - cmd->rx_len -1 ,0 ); + newdevs &= ~olddevs;for (pos =0 ; pos < master->maxdevs; pos++) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 844/1815 i3c: master: adi: add OF module alias for autoloading
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Can Peng <[email protected]>
[ Upstream commit a733069a1943f30922b90bde5eef3cb25b010f8b ]
The Analog Devices I3C master driver can be built as a module and uses adi_i3c_master_of_match as its OF match table, but the table is not exported for module alias generation.
Add the MODULE_DEVICE_TABLE(of, ...) entry so modpost can generate OF module aliases for OF based module autoloading.
--- drivers/i3c/master/adi-i3c-master.c | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/master/adi-i3c-master.c +1 -0
@@ -929,6 +929,7 @@ static const struct of_device_id adi_i3c_master_of_match[] = { { .compatible = "adi,i3c-master-v1" }, {} }; +MODULE_DEVICE_TABLE (of, adi_i3c_master_of_match);static int adi_i3c_master_probe (struct platform_device *pdev) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 845/1815 fs: annotate inode timestamp accessors
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Peng <[email protected]>
[ Upstream commit c610d2d0787961cdd6fc1de69d9be1ff3687e1a6 ]
syzbot reported a KCSAN race between fill_mg_cmtime() and inode_set_ctime_to_ts() on inode->i_ctime_{sec,nsec}.
stat/getattr can sample inode timestamps while update paths store new values concurrently, so KCSAN can report benign races on these fields.
Annotate the timestamp accessors with READ_ONCE()/WRITE_ONCE(), and use the ctime accessor for the remaining ctime loads. This avoids the KCSAN reports without changing timestamp semantics.
--- fs/inode.c | 18 +++++++++--------- fs/stat.c | 2 +- include/linux/fs.h | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-)
fs/inode.c +9 -9
@@ -2833,8 +2833,8 @@ struct timespec64 inode_set_ctime_to_ts(struct inode *inode, struct timespec64 t {trace_inode_set_ctime_to_ts (inode, &ts);set_normalized_timespec64 (&ts, ts.tv_sec, ts.tv_nsec); - inode->i_ctime_sec = ts.tv_sec; - inode->i_ctime_nsec = ts.tv_nsec; +WRITE_ONCE (inode->i_ctime_sec, ts.tv_sec); +WRITE_ONCE (inode->i_ctime_nsec, ts.tv_nsec);return ts; }EXPORT_SYMBOL (inode_set_ctime_to_ts);
@@ -2908,7 +2908,7 @@ struct timespec64 inode_set_ctime_current(struct inode *inode)*/ cns =smp_load_acquire (&inode->i_ctime_nsec);if (cns &I_CTIME_QUERIED ) { -struct timespec64 ctime = { .tv_sec = inode->i_ctime_sec, +struct timespec64 ctime = { .tv_sec =inode_get_ctime_sec (inode), .tv_nsec = cns & ~I_CTIME_QUERIED };if (timespec64_compare (&now, &ctime) <=0 ) {
@@ -2920,7 +2920,7 @@ struct timespec64 inode_set_ctime_current(struct inode *inode)mgtime_counter_inc (mg_ctime_updates);/* No need to cmpxchg if it's exactly the same */ -if (cns == now.tv_nsec && inode->i_ctime_sec == now.tv_sec) { +if (cns == now.tv_nsec &&inode_get_ctime_sec (inode) == now.tv_sec) {trace_ctime_xchg_skip (inode, &now); goto out; }
@@ -2929,7 +2929,7 @@ struct timespec64 inode_set_ctime_current(struct inode *inode)/* Try to swap the nsec value into place. */ if (try_cmpxchg (&inode->i_ctime_nsec, &cur, now.tv_nsec)) {/* If swap occurred, then we're (mostly) done */ - inode->i_ctime_sec = now.tv_sec; +WRITE_ONCE (inode->i_ctime_sec, now.tv_sec);trace_ctime_ns_xchg (inode, cns, now.tv_nsec, cur);mgtime_counter_inc (mg_ctime_swaps); }else {
@@ -2944,7 +2944,7 @@ struct timespec64 inode_set_ctime_current(struct inode *inode) goto retry; }/* Otherwise, keep the existing ctime */ - now.tv_sec = inode->i_ctime_sec; + now.tv_sec =inode_get_ctime_sec (inode); now.tv_nsec = cur & ~I_CTIME_QUERIED ; } out:
@@ -2977,7 +2977,7 @@ struct timespec64 inode_set_ctime_deleg(struct inode *inode, struct timespec64 u/* pairs with try_cmpxchg below */ cur =smp_load_acquire (&inode->i_ctime_nsec); cur_ts.tv_nsec = cur & ~I_CTIME_QUERIED ; - cur_ts.tv_sec = inode->i_ctime_sec; + cur_ts.tv_sec =inode_get_ctime_sec (inode);/* If the update is older than the existing value, skip it. */ if (timespec64_compare (&update, &cur_ts) <=0 )
@@ -3003,7 +3003,7 @@ struct timespec64 inode_set_ctime_deleg(struct inode *inode, struct timespec64 u retry: old = cur;if (try_cmpxchg (&inode->i_ctime_nsec, &cur, update.tv_nsec)) { - inode->i_ctime_sec = update.tv_sec; +WRITE_ONCE (inode->i_ctime_sec, update.tv_sec);mgtime_counter_inc (mg_ctime_swaps);return update; }
@@ -3019,7 +3019,7 @@ struct timespec64 inode_set_ctime_deleg(struct inode *inode, struct timespec64 u goto retry;/* Otherwise, it was a new timestamp. */ - cur_ts.tv_sec = inode->i_ctime_sec; + cur_ts.tv_sec =inode_get_ctime_sec (inode); cur_ts.tv_nsec = cur & ~I_CTIME_QUERIED ;return cur_ts; }
fs/stat.c +1 -1
@@ -53,7 +53,7 @@ void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode) } stat->mtime =inode_get_mtime (inode); - stat->ctime.tv_sec = inode->i_ctime_sec; + stat->ctime.tv_sec =inode_get_ctime_sec (inode); stat->ctime.tv_nsec = (u32 )atomic_read (pcn);if (!(stat->ctime.tv_nsec &I_CTIME_QUERIED )) stat->ctime.tv_nsec = ((u32 )atomic_fetch_or (I_CTIME_QUERIED , pcn));
include/linux/fs.h +10 -10
@@ -1598,12 +1598,12 @@ struct timespec64 inode_set_ctime_deleg(struct inode *inode,static inline time64_t inode_get_atime_sec (const struct inode *inode) { -return inode->i_atime_sec; +return READ_ONCE (inode->i_atime_sec); }static inline long inode_get_atime_nsec (const struct inode *inode) { -return inode->i_atime_nsec; +return READ_ONCE (inode->i_atime_nsec); }static inline struct timespec64 inode_get_atime (const struct inode *inode)
@@ -1617,8 +1617,8 @@ static inline struct timespec64 inode_get_atime(const struct inode *inode)static inline struct timespec64 inode_set_atime_to_ts (struct inode *inode,struct timespec64 ts) { - inode->i_atime_sec = ts.tv_sec; - inode->i_atime_nsec = ts.tv_nsec; +WRITE_ONCE (inode->i_atime_sec, ts.tv_sec); +WRITE_ONCE (inode->i_atime_nsec, ts.tv_nsec);return ts; }
@@ -1633,12 +1633,12 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,static inline time64_t inode_get_mtime_sec (const struct inode *inode) { -return inode->i_mtime_sec; +return READ_ONCE (inode->i_mtime_sec); }static inline long inode_get_mtime_nsec (const struct inode *inode) { -return inode->i_mtime_nsec; +return READ_ONCE (inode->i_mtime_nsec); }static inline struct timespec64 inode_get_mtime (const struct inode *inode)
@@ -1651,8 +1651,8 @@ static inline struct timespec64 inode_get_mtime(const struct inode *inode)static inline struct timespec64 inode_set_mtime_to_ts (struct inode *inode,struct timespec64 ts) { - inode->i_mtime_sec = ts.tv_sec; - inode->i_mtime_nsec = ts.tv_nsec; +WRITE_ONCE (inode->i_mtime_sec, ts.tv_sec); +WRITE_ONCE (inode->i_mtime_nsec, ts.tv_nsec);return ts; }
@@ -1677,12 +1677,12 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode,static inline time64_t inode_get_ctime_sec (const struct inode *inode) { -return inode->i_ctime_sec; +return READ_ONCE (inode->i_ctime_sec); }static inline long inode_get_ctime_nsec (const struct inode *inode) { -return inode->i_ctime_nsec & ~I_CTIME_QUERIED ; +return READ_ONCE (inode->i_ctime_nsec) & ~I_CTIME_QUERIED ; }static inline struct timespec64 inode_get_ctime (const struct inode *inode)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 846/1815 md/raid1: create serial pool adding rdev to array with serialize_policy=1
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Wilck <[email protected]>
[ Upstream commit 140234b2380ffb8ffb0cfc46fee0e822f43adef7 ]
The following bug has been observed with kernel 7.1.3 after adding a new rdev to an existing RAID1 array with serialize_policy enabled:
Oops: 0002 [#1] CPU: 0 UID: 0 PID: 19639 Comm: ext4lazyinit Not tainted 7.1.3-1-default RIP: _raw_spin_lock_irqsave+0x27/0x50 CR2: 0000000000004960 Call Trace: wait_for_serialization+0xb9/0x260 [raid1] raid1_make_request+0x762/0xaff [raid1] md_handle_request+0x1c9/0x2e0 [md_mod]
The raid1.c code calls wait_for_serialization() if the MD_SERIALIZE_POLICY is set, and wait_for_serialization assumes that rdev->serial is initialized. Normally this will be the case for arrays that have the serialize_policy sysfs attribute set to 1.
But when a new rdev is added to an existing array in bind_rdev_to_array(), the condition at mddev_create_serial_pool() causes creation of rdev->serial to be skipped. Fix it.
--- drivers/md/md.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -235,7 +235,8 @@ void mddev_create_serial_pool(struct mddev *mddev, struct md_rdev *rdev)int ret =0 ;unsigned int noio_flags; -if (rdev && !rdev_need_serial (rdev) && +if (!test_bit (MD_SERIALIZE_POLICY , &mddev->flags) && + rdev && !rdev_need_serial (rdev) && !test_bit (CollisionCheck, &rdev->flags))return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 847/1815 pinctrl: qcom: shikra: Fix intr_target_width for summary interrupt routing
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Komal Bajaj <[email protected]>
[ Upstream commit 1e7b04c12c077e8829991833a9aa2cb3bdacab61 ]
The intr_target_width field sets the mask width used when writing target processor into interrupt config register and deciding which processor receives summary interrupt for a given GPIO.
Without it, pinctrl driver defaults to a 3-bit mask. On Shikra, this field is 4 bits wide, which could corrupt adjacent bits and mis-route interrupts. Set intr_target_width = 4 to match the hardware.
--- drivers/pinctrl/qcom/pinctrl-shikra.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/qcom/pinctrl-shikra.c +1 -0
@@ -44,6 +44,7 @@ .intr_status_bit = 0, \ .intr_wakeup_enable_bit = 7, \ .intr_wakeup_present_bit = 6, \ + .intr_target_width = 4, \ .intr_target_bit = 8, \ .intr_target_kpss_val = 3, \ .intr_raw_status_bit = 4, \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 848/1815 locking/lockdep: Fix NULL pointer dereference in __lock_set_class()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naveen Kumar Chaudhary <[email protected]>
[ Upstream commit 7577e00b9ab506202b9f1a33de3cc8cc6413a4db ]
register_lock_class() can return NULL when the lock class pool is exhausted, graph_lock() fails, or key validation fails. However, __lock_set_class() uses the return value directly in pointer arithmetic without a NULL check:
class = register_lock_class(lock, subclass, 0); hlock->class_idx = class - lock_classes;
If class is NULL, this computes a wild offset that corrupts hlock->class_idx. The subsequent reacquire_held_locks() call will invoke hlock_class() with this corrupted index, leading to a NULL or out-of-bounds pointer dereference.
Add the missing NULL check, consistent with how __lock_acquire() already handles this case at the same call site.
--- kernel/locking/lockdep.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/locking/lockdep.c +2 -0
@@ -5437,6 +5437,8 @@ __lock_set_class(struct lockdep_map *lock, const char *name, lock->wait_type_outer, lock->lock_type); class =register_lock_class (lock, subclass,0 ); +if (!class) +return 0 ; hlock->class_idx = class - lock_classes; curr->lockdep_depth = i;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 849/1815 dcache: keep shrink_dcache_for_umount() making progress on busy roots
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 78db93943210df61c8446aae35af6836e2cf04aa ]
Commit e9895609cb7f ("wind ->s_roots via ->d_sib instead of ->d_hash") moved secondary roots from ->d_hash to ->d_sib. Secondary roots are now d_unhashed(), so __d_drop() returns without removing them from ->s_roots. Consequently, d_drop() in do_one_tree() no longer guarantees progress through the list.
If a secondary root is still busy once do_one_tree() is done with it, its final dput() cannot evict it. The root remains ->s_roots.first and the loop selects it forever, holding ->s_umount for write and repeatedly reporting the same dentry.
The root does not need a leaked reference of its own for that. Every child pins its parent (d_alloc() takes a reference on it) and umount_check() deliberately reports a busy descendant instead of complaining about its ancestors, so a single leaked dentry reference anywhere below a secondary root is enough. For filesystems that build ->s_root with d_obtain_root() - nfs, ceph, nilfs2 snapshot mounts - that is the entire tree.
Before e9895609cb7f, ___d_drop() special-cased IS_ROOT dentries and removed them from ->s_roots regardless of their refcount, so the d_drop() in do_one_tree() detached the root from the superblock no matter what. Commit 9c8c10e262e0 ("more graceful recovery in umount_collect()") deliberately made busy dentries nonfatal: report them and finish the unmount rather than BUG() while holding ->s_umount.
Restore that by detaching the root in do_one_tree() itself, next to the d_drop() that used to do it. That covers both callers - the ->s_roots loop and ->s_root, which for the filesystems above is a secondary root as well. In the normal case dentry_unlist() finds ->d_sib already unhashed when eviction occurs.
A permanently leaked reference remains leaked after unmount, as it did before e9895609cb7f; if the extra reference is merely delayed, its final dput() may run after teardown has advanced. Leaving the root on ->s_roots is not an alternative: the superblock would then be freed with a live dentry still linked into it, and that dentry's dentry_unlist() would take ->s_roots_lock on freed memory.
Christian Brauner <[email protected]> says:
Moved the ->s_roots removal from the shrink_dcache_for_umount() loop into do_one_tree(), so a busy ->s_root obtained from d_obtain_root() is detached on the first pass instead of being reported a second time when the loop picks it off ->s_roots. Extended the commit message with the pinned-ancestor case.
--- fs/dcache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/dcache.c +6 -1
@@ -1794,7 +1794,12 @@ static void do_one_tree(struct dentry *dentry) {shrink_dcache_tree (dentry, true);d_walk (dentry, dentry, umount_check); -d_drop (dentry); +spin_lock (&dentry->d_lock); +__d_drop (dentry); +/* A busy root survives the dput() below so don't leave it on ->s_roots. */ +if (unlikely (!hlist_unhashed (&dentry->d_sib))) +unlink_secondary_root (dentry); +spin_unlock (&dentry->d_lock);dput (dentry); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 850/1815 iomap: release the folio batch on iomap callback failures
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Foster <[email protected]>
[ Upstream commit 31e3d833d522746a93d135e8b465d16f8ad33453 ]
A sashiko review of an unrelated patch points out that the folio batch mechanism used for iomap zero range fails to release the batch in a couple error scenarios. If either calls to ->iomap_end() or ->iomap_begin() fail, the direct return paths bypass the batch cleanup.
The ->iomap_end() case is not a practical issue at the moment because there is no user of the mechanism that returns an error from this path. The ->iomap_begin() case is theoretically possible because XFS can invoke the fill helper and error out at various points thereafter. This subtly complicates things because XFS does not transfer iomap_flags to the iomap data structure in the error path.
To deal with both of these issues, first make sure to invoke the cleanup helper in the error path for either fs callback. Second, update the helper to clear the flag unconditionally and release the batch so long as it is populated. This more clearly delineates the purpose of the flag to control the I/O path and not necessarily the status of the fbatch, so add a comment around this as well.
--- fs/iomap/iter.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
fs/iomap/iter.c +14 -4
@@ -6,12 +6,18 @@#include <linux/iomap.h> #include "trace.h" +/* +* Release the iter folio batch. Note that the iomap flag is meant to control +* the I/O path for the mapping and may not be set in error situations. +*/ static inline void iomap_iter_clean_fbatch (struct iomap_iter *iter) { -if (iter->iomap.flags &IOMAP_F_FOLIO_BATCH ) { +if (!iter->fbatch) +return ; + iter->iomap.flags &= ~IOMAP_F_FOLIO_BATCH ; +if (folio_batch_count (iter->fbatch)) {folio_batch_release (iter->fbatch);folio_batch_reinit (iter->fbatch); - iter->iomap.flags &= ~IOMAP_F_FOLIO_BATCH ; } }
@@ -79,7 +85,7 @@ int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops) olen), advanced, iter->flags, &iter->iomap);if (ret <0 && !advanced) -return ret; + goto error; }/* detect old return semantics where this would advance */
@@ -110,7 +116,11 @@ int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops) ret = ops->iomap_begin (iter->inode, iter->pos, iter->len, iter->flags, &iter->iomap, &iter->srcmap);if (ret <0 ) -return ret; + goto error;iomap_iter_done (iter);return 1 ; + +error: +iomap_iter_clean_fbatch (iter); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 851/1815 dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Kumar Chaurasiya (IBM) <[email protected]>
[ Upstream commit be809b60cbb61aab96179f44ac3670242ae72996 ]
When building with LLVM=1 for architectures like powerpc where CONFIG_DMA_SHARED_BUFFER is not enabled, the build fails with:
ld.lld: error: undefined symbol: dma_resv_reset_max_fences
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
helpers.c
rust/helpers/helpers.o:(rust_helper_dma_resv_unlock)
The issue occurs because:
1. CONFIG_DEBUG_MUTEXES=y is enabled
2. CONFIG_DMA_SHARED_BUFFER is not enabled
3. dma_resv_reset_max_fences() is declared in the header when CONFIG_DEBUG_MUTEXES is set
4. But the function is only compiled in drivers/dma-buf/dma-resv.c, which is only built when CONFIG_DMA_SHARED_BUFFER is enabled
5. Rust helpers call dma_resv_unlock() which calls dma_resv_reset_max_fences(), causing an undefined symbol
Fix this by compiling dma-resv.c file only when CONFIG_DMA_SHARED_BUFFER is enabled.
--- rust/helpers/helpers.c | 2 ++ 1 file changed, 2 insertions(+)
rust/helpers/helpers.c +2 -0
@@ -58,7 +58,9 @@#include "cred.c" #include "device.c" #include "dma.c" +#ifdef CONFIG_DMA_SHARED_BUFFER #include "dma-resv.c" +#endif #include "drm.c" #include "drm_gpuvm.c" #include "err.c"
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 852/1815 powerpc: implement get_direction() in cpm2
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy (CS GROUP) <[email protected]>
[ Upstream commit ca16219e9babc874349a6ac307d56523871a9137 ]
The lack of get_direction() callback in this driver causes GPIOLIB to emit a warning. Implement it.
--- arch/powerpc/sysdev/cpm_common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/powerpc/sysdev/cpm_common.c +13 -0
@@ -181,6 +181,18 @@ static int cpm2_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)return 0 ; } +static int cpm2_gpio32_get_direction (struct gpio_chip *gc,unsigned int gpio) +{ +struct cpm2_gpio32_chip *cpm2_gc =gpiochip_get_data (gc); +struct cpm2_ioports __iomem *iop = cpm2_gc->regs; +u32 pin_mask =1 << (31 - gpio); + +if (in_be32 (&iop->dir) & pin_mask) +return GPIO_LINE_DIRECTION_OUT ; + +return GPIO_LINE_DIRECTION_IN ; +} +int cpm2_gpiochip_add32 (struct device *dev) {struct device_node *np = dev->of_node;
@@ -199,6 +211,7 @@ int cpm2_gpiochip_add32(struct device *dev) gc->ngpio =32 ; gc->direction_input = cpm2_gpio32_dir_in; gc->direction_output = cpm2_gpio32_dir_out; + gc->get_direction = cpm2_gpio32_get_direction; gc->get = cpm2_gpio32_get; gc->set = cpm2_gpio32_set; gc->parent = dev;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 853/1815 powerpc/44x: Set GPIO chip parent
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit b9254d222d0b38cc6f7b73119fad6316f65278be ]
The PPC4xx GPIO driver stopped assigning an explicit parent to the gpio_chip when it moved away from of_mm_gpiochip_add_data().
Restore that association from the platform device so OF GPIO lookup can match phandles to the registered gpiochip.
Tested on: Cisco MX60W. No more probe deferral.
--- arch/powerpc/platforms/44x/gpio.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/44x/gpio.c +1 -0
@@ -169,6 +169,7 @@ static int ppc4xx_gpio_probe(struct platform_device *ofdev) gc = &chip->gc; + gc->parent = dev; gc->base =-1 ; gc->ngpio =32 ; gc->direction_input = ppc4xx_gpio_dir_in;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 854/1815 powerpc/crash: Fix possible memory leak in update_crash_elfcorehdr()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 4cc4b586007fbbf8edba4f1d0849e9a06b0cf6c3 ]
In get_crash_memory_ranges(), if crash_exclude_mem_range() failed after realloc_mem_ranges() has successfully allocated the cmem memory, it just returns an error but leaves cmem pointing to the allocated memory, nor is it freed in the caller update_crash_elfcorehdr(), which cause a memory leak, goto out to free the cmem.
--- arch/powerpc/kexec/crash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kexec/crash.c +1 -1
@@ -502,7 +502,7 @@ static void update_crash_elfcorehdr(struct kimage *image, struct memory_notify * ret =get_crash_memory_ranges (&cmem);if (ret) {pr_err ("Failed to get crash mem range\n" ); -return ; + goto out; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 855/1815 misc: vmc_vmci: Fix potential memory leak in vmci_event_subscribe()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit 210854a96ef18b09b45a2a59ff14ca06dfe5ad4d ]
The memory allocated for struct vmci_subscription (sub) is not freed in the error path when have_new_id is false. Fix that by adding a kfree() call, and moving the read of sub->id to a point before freeing.
--- drivers/misc/vmw_vmci/vmci_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/vmw_vmci/vmci_event.c +2 -2
@@ -179,16 +179,16 @@ int vmci_event_subscribe(u32 event, } } + *new_subscription_id = sub->id;if (have_new_id) {list_add_rcu (&sub->node, &subscriber_array[event]); retval =VMCI_SUCCESS ; }else { +kfree (sub); retval =VMCI_ERROR_NO_RESOURCES ; }mutex_unlock (&subscriber_mutex); - - *new_subscription_id = sub->id;return retval; }EXPORT_SYMBOL_GPL (vmci_event_subscribe);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 856/1815 misc: sgi-gru: remove interrupt-context page-table walks
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 928a8e9f523df845fc496bcb9811013b67aabec5 ]
The GRU TLB miss handler walks a process's page tables without holding page-table locks or a reference to the mapped page. It also uses a kernel page-table accessor on user page tables and supports only PMD-level large mappings on x86-64.
Remove the direct walker. Send interrupt faults directly to user polling mode so the existing call-OS fallback retries them in process context.
Remove the mmap-lock failure statistic that can no longer be incremented.
--- drivers/misc/sgi-gru/grufault.c | 101 ++++--------------------------- drivers/misc/sgi-gru/gruprocfs.c | 1 - drivers/misc/sgi-gru/grutables.h | 1 - 3 files changed, 12 insertions(+), 91 deletions(-)
drivers/misc/sgi-gru/grufault.c +12 -89
@@ -166,13 +166,8 @@ static void get_clear_fault_map(struct gru_state *gru, }/* -* Atomic (interrupt context) & non-atomic (user context) functions to -* convert a vaddr into a physical address. The size of the page -* is returned in pageshift. -* returns: -* 0 - successful -* < 0 - error code -* 1 - (atomic only) try again in non-atomic context +* Convert a user virtual address to a physical address in process context. +* The size of the page is returned in pageshift. */ static int non_atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr, int write,
@@ -192,87 +187,25 @@ static int non_atomic_pte_lookup(struct vm_area_struct *vma,return 0 ; } -/* -* atomic_pte_lookup -* -* Convert a user virtual address to a physical address -* Only supports Intel large pages (2MB only) on x86_64. -* ZZZ - hugepage support is incomplete -* -* NOTE: mmap_lock is already held on entry to this function. This -* guarantees existence of the page tables. -*/ -static int atomic_pte_lookup (struct vm_area_struct *vma,unsigned long vaddr, -int write,unsigned long *paddr,int *pageshift) -{ -pgd_t *pgdp; -p4d_t *p4dp; -pud_t *pudp; -pmd_t *pmdp; -pte_t pte; - - pgdp =pgd_offset (vma->vm_mm, vaddr); -if (unlikely (pgd_none (*pgdp))) - goto err; - - p4dp =p4d_offset (pgdp, vaddr); -if (unlikely (p4d_none (*p4dp))) - goto err; - - pudp =pud_offset (p4dp, vaddr); -if (unlikely (pud_none (*pudp))) - goto err; - - pmdp =pmd_offset (pudp, vaddr); -if (unlikely (pmd_none (*pmdp))) - goto err; -#ifdef CONFIG_X86_64 -if (unlikely (pmd_leaf (*pmdp))) - pte =ptep_get ((pte_t *)pmdp); - else -#endif - pte = *pte_offset_kernel (pmdp, vaddr); - -if (unlikely (!pte_present (pte) || - (write && (!pte_write (pte) || !pte_dirty (pte))))) -return 1 ; - - *paddr =pte_pfn (pte) <<PAGE_SHIFT ; -#ifdef CONFIG_HUGETLB_PAGE - *pageshift =is_vm_hugetlb_page (vma) ?HPAGE_SHIFT :PAGE_SHIFT ; -#else - *pageshift =PAGE_SHIFT ; -#endif -return 0 ; - -err: -return 1 ; -} -static int gru_vtop (struct gru_thread_state *gts,unsigned long vaddr,int write,int atomic,unsigned long *gpa,int *pageshift) {struct mm_struct *mm = gts->ts_mm;struct vm_area_struct *vma;unsigned long paddr; -int ret, ps; +int ps; vma =find_vma (mm, vaddr);if (!vma) goto inval; -/* -* Atomic lookup is faster & usually works even if called in non-atomic -* context. -*/ -rmb ();/* Must/check ms_range_active before loading PTEs */ - ret =atomic_pte_lookup (vma, vaddr, write, &paddr, &ps); -if (ret) { -if (atomic) - goto upm; -if (non_atomic_pte_lookup (vma, vaddr, write, &paddr, &ps)) - goto inval; - } +if (atomic) + goto upm; + +/* Order the caller's ms_range_active check before loading PTEs. */ +rmb (); +if (non_atomic_pte_lookup (vma, vaddr, write, &paddr, &ps)) + goto inval;if (is_gru_paddr (paddr)) goto inval; paddr = paddr & ~((1UL << ps) -1 );
@@ -569,19 +502,9 @@ static irqreturn_t gru_intr(int chiplet, int blade)continue ; } -/* -* This is running in interrupt context. Trylock the mmap_lock. -* If it fails, retry the fault in user context. -*/ +/* Address translation may sleep, so retry the fault in user context. */ gts->ustats.fmm_tlbmiss++; -if (!gts->ts_force_cch_reload && -mmap_read_trylock (gts->ts_mm)) { -gru_try_dropin (gru, gts, tfh,NULL ); -mmap_read_unlock (gts->ts_mm); - }else { -tfh_user_polling_mode (tfh); -STAT (intr_mm_lock_failed); - } +tfh_user_polling_mode (tfh); }return IRQ_HANDLED ; }
drivers/misc/sgi-gru/gruprocfs.c +0 -1
@@ -54,7 +54,6 @@ static int statistics_show(struct seq_file *s, void *p)printstat (s, intr_cbr);printstat (s, intr_tfh);printstat (s, intr_spurious); -printstat (s, intr_mm_lock_failed);printstat (s, call_os);printstat (s, call_os_wait_queue);printstat (s, user_flush_tlb);
drivers/misc/sgi-gru/grutables.h +0 -1
@@ -182,7 +182,6 @@ struct gru_stats_s {atomic_long_t intr_cbr;atomic_long_t intr_tfh;atomic_long_t intr_spurious; -atomic_long_t intr_mm_lock_failed;atomic_long_t call_os;atomic_long_t call_os_wait_queue;atomic_long_t user_flush_tlb;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 857/1815 fanotify: report full event length for FIONREAD
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yichong Chen <[email protected]>
[ Upstream commit 68615158c12de36220446dfea5cfdf9ba6c19690 ]
fanotify_ioctl(FIONREAD) reports the number of bytes available to read from the event queue. It currently accounts only FAN_EVENT_METADATA_LEN for each queued event.
That underestimates events that carry additional information records, such as FAN_REPORT_DFID_NAME events. A userspace program that uses FIONREAD to size its read buffer can receive a length that is smaller than the next event. Reading with that buffer then fails with -EINVAL, while a larger buffer succeeds and reports a larger metadata.event_len.
Use fanotify_event_len() when summing queued events so FIONREAD includes all info records.
--- fs/notify/fanotify/fanotify_user.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/notify/fanotify/fanotify_user.c +4 -1
@@ -1147,11 +1147,13 @@ static long fanotify_ioctl(struct file *file, unsigned int cmd, unsigned long ar {struct fsnotify_group *group;struct fsnotify_event *fsn_event; +unsigned int info_mode;void __user *p;int ret = -ENOTTY ;size_t send_len =0 ; group = file->private_data; + info_mode =FAN_GROUP_FLAG (group,FANOTIFY_INFO_MODES ); p = (void __user *) arg;
@@ -1159,7 +1161,8 @@ static long fanotify_ioctl(struct file *file, unsigned int cmd, unsigned long arcase FIONREAD :spin_lock (&group->notification_lock);list_for_each_entry (fsn_event, &group->notification_list, list) - send_len +=FAN_EVENT_METADATA_LEN ; + send_len +=fanotify_event_len (info_mode, +FANOTIFY_E (fsn_event));spin_unlock (&group->notification_lock); ret =put_user (send_len, (int __user *) p);break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 858/1815 wifi: mt76: connac: add MT7991A (0x7991) to is_mt7996()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Gomzyakov <[email protected]>
[ Upstream commit 574bd79955d166c00c2b1531fed591ee70b6ba04 ]
The MT7991A chipset uses PCI device ID 0x7991 (MT7996_DEVICE_ID_2), but is_mt7996() only checks for 0x7990. This causes MT7991A devices to use incorrect chip-specific settings, such as:
- MSDU_CNT_V2 instead of MSDU_CNT in TX descriptors
- Wrong WTBL BMC size (32 instead of 64)
- Incorrect prefetch depth for MCU queues
--- drivers/net/wireless/mediatek/mt76/mt76_connac.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac.h +2 -1
@@ -245,7 +245,8 @@ static inline bool is_mt798x(struct mt76_dev *dev)static inline bool is_mt7996 (struct mt76_dev *dev) { -return mt76_chip (dev) ==0x7990 ; +u16 chip =mt76_chip (dev); +return chip ==0x7990 || chip ==0x7991 ; }static inline bool is_mt7992 (struct mt76_dev *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 859/1815 wifi: mt76: mt76x02: do not WARN on invalid rx descriptor length
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devin Wittmayer <[email protected]>
[ Upstream commit 81497634d9f872fd3e8b03aada55574afff6f174 ]
The MPDU length in the rx descriptor comes from the hardware. In monitor mode with the fcsfail filter enabled, the hardware passes up corrupted frames, and a corrupted frame can report a length larger than the received buffer. The bounds check correctly discards such frames, but its WARN_ON_ONCE wrapper means any over-the-air garbage frame taints the kernel, and panics it on the first such frame when panic_on_warn is set.
Drop the WARN and discard the frame silently, matching what commit c2d4c8723dbf ("mt76x2: remove some harmless WARN_ONs in tx status and rx path") did for the neighboring rx and tx status paths.
Observed immediately on rx with an MT7612U in fcsfail monitor mode on a busy channel.
--- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +1 -1
@@ -848,7 +848,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb, } } -if (WARN_ON_ONCE (len > skb->len)) +if (len > skb->len)return -EINVAL ;if (pskb_trim (skb, len))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 860/1815 wifi: mt76: fix handling channel context with different bands in mt76_switch_vif_chanctx()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shayne Chen <[email protected]>
[ Upstream commit 70869cc429fffc77de51e7777c0ecb651e8fca07 ]
When performing channel switches on different radios within a short timeframe, channel contexts with different bands can be carried for each struct ieee80211_vif_chanctx_switch.
Rework mt76_switch_vif_chanctx() to properly handle this scenario.
--- drivers/net/wireless/mediatek/mt76/channel.c | 92 +++++++++++--------- 1 file changed, 49 insertions(+), 43 deletions(-)
drivers/net/wireless/mediatek/mt76/channel.c +49 -43
@@ -186,68 +186,74 @@ int mt76_switch_vif_chanctx(struct ieee80211_hw *hw, int n_vifs, enum ieee80211_chanctx_switch_mode mode) { -struct mt76_chanctx *old_ctx = (struct mt76_chanctx *)vifs->old_ctx->drv_priv; -struct mt76_chanctx *new_ctx = (struct mt76_chanctx *)vifs->new_ctx->drv_priv; -struct ieee80211_chanctx_conf *conf = vifs->new_ctx; -struct mt76_phy *old_phy = old_ctx->phy; -struct mt76_phy *phy = hw->priv; +struct ieee80211_vif_chanctx_switch *v; +struct mt76_chanctx *old_ctx, *new_ctx; +struct mt76_phy *old_phy, *phy = hw->priv;struct mt76_dev *dev = phy->dev;struct mt76_vif_link *mlink; -bool update_chan; +bool need_update[__MT_MAX_BAND] = {};int i, ret =0 ; -if (mode ==CHANCTX_SWMODE_SWAP_CONTEXTS ) - phy = new_ctx->phy = dev->band_phys[conf->def.chan->band]; -else - phy = new_ctx->phy; -if (!phy) -return -EINVAL ; +for (i =0 ; i < n_vifs; i++) { + v = &vifs[i]; + new_ctx = (struct mt76_chanctx *)v->new_ctx->drv_priv; +if (mode ==CHANCTX_SWMODE_SWAP_CONTEXTS ) + phy = new_ctx->phy = dev->band_phys[v->new_ctx->def.chan->band]; +else + phy = new_ctx->phy; - update_chan = phy->chanctx != new_ctx; -if (update_chan) { -if (dev->scan.phy == phy) -mt76_abort_scan (dev); +if (!phy) +return -EINVAL ; -cancel_delayed_work_sync (&phy->mac_work); +if (need_update[phy->band_idx]) +continue ; + +if (phy->chanctx != new_ctx) { +if (dev->scan.phy == phy) +mt76_abort_scan (dev); + +cancel_delayed_work_sync (&phy->mac_work); + need_update[phy->band_idx] = true; + } }mutex_lock (&dev->mutex); -if (mode ==CHANCTX_SWMODE_SWAP_CONTEXTS && - phy != old_phy && old_phy->chanctx == old_ctx) - old_phy->chanctx =NULL ; +for (i =0 ; i < n_vifs; i++) { + v = &vifs[i]; + old_ctx = (struct mt76_chanctx *)v->old_ctx->drv_priv; + old_phy = old_ctx->phy; + + new_ctx = (struct mt76_chanctx *)v->new_ctx->drv_priv; + phy = new_ctx->phy; -if (update_chan) - ret =mt76_phy_update_channel (phy, vifs->new_ctx); +if (mode ==CHANCTX_SWMODE_SWAP_CONTEXTS && old_phy->chanctx && + old_phy->chanctx == old_ctx && phy != old_phy) + old_phy->chanctx =NULL ; -if (ret) - goto out; +if (need_update[phy->band_idx]) { + ret =mt76_phy_update_channel (phy, v->new_ctx); +if (ret) + goto out; -if (old_phy == phy) - goto skip_link_replace; + need_update[phy->band_idx] = false; + } -for (i =0 ; i < n_vifs; i++) { - mlink =mt76_vif_conf_link (dev, vifs[i].vif, vifs[i].link_conf); + mlink =mt76_vif_conf_link (dev, v->vif, v->link_conf);if (!mlink)continue ; - dev->drv->vif_link_remove (old_phy, vifs[i].vif, - vifs[i].link_conf, mlink); - - ret = dev->drv->vif_link_add (phy, vifs[i].vif, - vifs[i].link_conf, mlink); -if (ret) - goto out; - - } +if (old_phy != phy) { + dev->drv->vif_link_remove (old_phy, v->vif, v->link_conf, + mlink); -skip_link_replace: -for (i =0 ; i < n_vifs; i++) { - mlink =mt76_vif_conf_link (dev, vifs[i].vif, vifs[i].link_conf); -if (!mlink) -continue ; + ret = dev->drv->vif_link_add (phy, v->vif, v->link_conf, + mlink); +if (ret) + goto out; + } - mlink->ctx = vifs->new_ctx; + mlink->ctx = v->new_ctx;if (mlink->beacon_mon_interval)WRITE_ONCE (mlink->beacon_mon_last, jiffies); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 861/1815 wifi: mt76: mt792x: stop USB register access after bus hang
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
[ Upstream commit e137e5fd245cb6c0ae378607cc8090c913d984b2 ]
Mark the mt792x USB bus hung on the first control timeout and switch register access to no-op bus ops. Each failed vendor request may spend up to MT_VEND_REQ_MAX_RETRY * MT_VEND_REQ_TOUT_MS, about 3 seconds, and teardown/reset paths can keep issuing such requests after the device has stopped responding.
Also skip the USB WFSYS reset path after bus_hung is set, since it uses UHW vendor requests as well.
mt7925u 1-2:1.3: vendor request req:63 off:0018 failed:-110 mt7925u 1-2:1.3: vendor request req:63 off:0018 failed:-110 mt7925u 1-2:1.3: vendor request req:63 off:0018 failed:-110 mt7925u 1-2:1.3: vendor request req:63 off:0018 failed:-110 mt7925u 1-2:1.3: vendor request req:63 off:0018 failed:-110
Avoid repeating those register reads after the bus is known to be hung by switching register access to no-op handlers.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + .../net/wireless/mediatek/mt76/mt792x_usb.c | 91 ++++++++++++++++--- drivers/net/wireless/mediatek/mt76/usb.c | 11 +++ 3 files changed, 90 insertions(+), 13 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +1 -0
@@ -672,6 +672,7 @@ struct mt76_usb {u8 out_ep[__MT_EP_OUT_MAX];u8 in_ep[__MT_EP_IN_MAX]; +void (*ctrl_timeout)(struct mt76_dev *dev,int err);bool sg_en;struct mt76u_mcu {
drivers/net/wireless/mediatek/mt76/mt792x_usb.c +78 -13
120 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/usb.c +11 -0
@@ -30,6 +30,8 @@ int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type,for (i =0 ; i <MT_VEND_REQ_MAX_RETRY ; i++) {if (test_bit (MT76_REMOVED , &dev->phy.state))return -EIO ; +if (dev->usb.ctrl_timeout &&atomic_read (&dev->bus_hung)) +return -EIO ; ret =usb_control_msg (udev, pipe, req, req_type, val, offset, buf, len,MT_VEND_REQ_TOUT_MS );
@@ -42,6 +44,15 @@ int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type,dev_err (dev->dev,"vendor request req:%02x off:%04x failed:%d\n" , req, offset, ret); + +if (dev->usb.ctrl_timeout) { +atomic_set (&dev->bus_hung, true); +dev_err (dev->dev,"vendor request req:%02x off:%04x timed out, marking bus hung\n" , + req, offset); + dev->usb.ctrl_timeout (dev, ret); +return ret; + } +return ret; }EXPORT_SYMBOL_GPL (__mt76u_vendor_request);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 862/1815 wifi: mt76: mt7921: validate CLC firmware records
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laxman Acharya Padhya <[email protected]>
[ Upstream commit 9417c5818a0146980c2608fda94c908e604eb033 ]
The CLC region is supplied by firmware, but the loader trusts the region count and each record length. A malformed image can make the region table pointer precede the firmware buffer, make the record loop fail to advance, or index phy->clc past its end. Validate the table and record bounds before dereferencing or copying.
--- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +24 -4
@@ -415,7 +415,8 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)struct mt76_dev *mdev = &dev->mt76;struct mt792x_phy *phy = &dev->phy;const struct firmware *fw; -int ret, i, len, offset =0 ; +size_t clc_len, fw_data_len, len, offset =0 ; +int ret, i;u8 *clc_base =NULL , hw_encap =0 ; dev->phy.clc_chan_conf =0xff ;
@@ -441,13 +442,21 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name) } hdr = (const void *)(fw->data + fw->size -sizeof (*hdr)); +if (hdr->n_region > (fw->size -sizeof (*hdr)) /sizeof (*region)) { +dev_err (mdev->dev,"Invalid firmware region table\n" ); + ret = -EINVAL ; + goto out; + } + fw_data_len = fw->size -sizeof (*hdr) - + hdr->n_region *sizeof (*region); +for (i =0 ; i < hdr->n_region; i++) { region = (const void *)((const u8 *)hdr - (hdr->n_region - i) *sizeof (*region)); len =le32_to_cpu (region->len);/* check if we have valid buffer size */ -if (offset + len > fw->size) { +if (len > fw_data_len - offset) {dev_err (mdev->dev,"Invalid firmware region\n" ); ret = -EINVAL ; goto out;
@@ -464,8 +473,19 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)if (!clc_base) goto out; -for (offset =0 ; offset < len; offset +=le32_to_cpu (clc->len)) { +for (offset =0 ; offset < len; offset += clc_len) { +if (len - offset <sizeof (*clc)) { + ret = -EINVAL ; + goto out; + } + clc = (const struct mt7921_clc *)(clc_base + offset); + clc_len =le32_to_cpu (clc->len); +if (clc_len <sizeof (*clc) || clc_len > len - offset || + clc->idx >=ARRAY_SIZE (phy->clc)) { + ret = -EINVAL ; + goto out; + }/* do not init buf again if chip reset triggered */ if (phy->clc[clc->idx])
@@ -477,7 +497,7 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)continue ; phy->clc[clc->idx] =devm_kmemdup (mdev->dev, clc, -le32_to_cpu (clc->len), + clc_len,GFP_KERNEL );if (!phy->clc[clc->idx]) {
Signature · 1 line
2.53.0
Re: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
Quoted 1 line · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
[...]
Quoted 1 line
[ Upstream commit
9417c5818a0146980c2608fda94c908e604eb033]
Please drop this from 7.2, 6.18, 6.12, 6.6 and 6.1 for now.
On its own it breaks probe on MT7922 with linux-firmware 20260810:
the CLC blob in WIFI_RAM_CODE_MT7922_1.bin carries a record with idx 3, these trees size phy->clc[] at 3 or 2, and the new bounds check fails mt7921_run_firmware() with -EINVAL. Mainline is fine because e9f3f1cc133f, also in v7.3-rc1, grew the array to 4. Mikhail Gavrilov hit it with this commit on a v7.2 tree:
https://lore.kernel.org/all/[email protected]/
The check is still wanted here, today that record is indexed past the array (UBSAN, https://bugzilla.redhat.com/show_bug.cgi?id=2515420),
but only with the follow-up that skips unknown records. That is on linux-wireless with Tested-by and Reviewed-by, not applied yet:
https://lore.kernel.org/linux-wireless/[email protected]/
Once it lands the two can go together.
Sasha Levin
maintainerRe: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
Quoted 1 line
Please drop this from 7.2, 6.18, 6.12, 6.6 and 6.1 for now.
Dropped from the 7.2, 6.18, 6.12, 6.6, and 6.1 queues.
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
Quoted 1 line · Sasha Levin
Dropped from the 7.2, 6.18, 6.12, 6.6, and 6.1 queues.
The follow-up is in mainline as of v7.3-rc3:
1a296bfd3e77 ("wifi: mt76: mt7921: skip unknown CLC firmware records")
Please queue it with 9417c5818a01 for 7.2, 6.18, 6.12, 6.6 and 6.1. Your dropped backports of 9417c5818a01 plus 1a296bfd3e775e on top apply on 7.2.5, 6.18.51, 6.12.109, 6.6.156 and 6.1.187.
Re: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
Quoted 1 line
Please queue it with
9417c5818a01for 7.2, 6.18, 6.12, 6.6 and 6.1.
Queued both for 7.2, 6.18, 6.12, 6.6 and 6.1, thanks.
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 863/1815 wifi: mt76: mt7915: fix net_fill_forward_path for non-DBDC mt7986
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhi-Jun You <[email protected]>
[ Upstream commit bade0d238b60c29dafcc7da17501fa489495d6ae ]
Current implementation assumes that the hardware supports DBDC or single band and binds to band0.
This causes net_fill_forward_path to select the wrong queue for non-DBDC mt7986 because it binds to band1 and getting the following in dmesg:
ieee80211 phy2: WA: --> drop by reaseon:1, msdu id = 0xc002 but failed!mtk_wed1: error status=00000002
ieee80211 phy2: WA: txblk10324e00
len = 128
DW0 : 10 00 00 00
DW1 : 00 00 00 00
DW2 : 00 00 00 00
DW3 : 72 0f 94 68
DW4 : 00 00 00 00
DW5 : ff 03 00 00
DW6 : 00 00 3c 40
DW7 : 00 17 dd 14
DW8 : 79 6f 00 00
DW9 : 02 c0 00 00
DW10 : 58 c5 34 10
DW11 : 00 00 00 00
DW12 : 00 06 3e 00
DW13 : 00 00 00 80
DW14 : 10 8c 00 00
DW15 : 00 00 00 00
DW16 : 00 00 00 00
DW17 : 00 00 00 00
DW18 : 00 00 00 00
DW19 : 00 00 00 00
DW20 : 00 00 00 00
DW21 : 00 00 00 00
DW22 : 00 00 00 00
DW23 : 00 00 00 00
DW24 : 00 00 00 00
DW25 : 00 00 00 00
DW26 : 00 00 00 00
DW27 : 00 00 00 00
DW28 : 00 00 00 00
DW29 : 00 00 00 00
DW30 : 00 00 00 00
DW31 : 00 00 00 00
Fix it by using phy->mt76->band_idx for queue which works for both non-DBDC and DBDC devices.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +1 -1
@@ -1743,7 +1743,7 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, path->mtk_wdma.wdma_idx = wed->wdma_idx; path->mtk_wdma.bss = mvif->mt76.idx; path->mtk_wdma.wcid =is_mt7915 (&dev->mt76) ? msta->wcid.idx :0x3ff ; - path->mtk_wdma.queue = phy != &dev->phy; + path->mtk_wdma.queue = phy->mt76->band_idx; ctx->dev =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 864/1815 wifi: mt76: connac: add NAN connection type
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
[ Upstream commit b7ab9f780dc8f6cc9ce30333e9f131ed3419c6b3 ]
Introduce a dedicated NAN connection type for connac firmware and use it for NAN interface device, BSS and station records.
Add the common NAN MCU command and event IDs used by mt7925.
Stable-dep-of: 217f9e7bb025 ("wifi: mt76: mt792x: fix use-after-free in mt76_rx_poll_complete")
--- .../net/wireless/mediatek/mt76/mt76_connac_mcu.c | 14 ++++++++++++++ .../net/wireless/mediatek/mt76/mt76_connac_mcu.h | 4 ++++ 2 files changed, 18 insertions(+)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +14 -0
@@ -422,6 +422,10 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, basic->conn_type =cpu_to_le32 (CONNECTION_IBSS_ADHOC ); basic->aid =cpu_to_le16 (link_sta->sta->aid);break ; +case NL80211_IFTYPE_NAN : +case NL80211_IFTYPE_NAN_DATA : + basic->conn_type =cpu_to_le32 (CONNECTION_NAN ); +break ;default :WARN_ON (1 );break ;
@@ -1217,6 +1221,11 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,case NL80211_IFTYPE_ADHOC : basic_req.basic.conn_type =cpu_to_le32 (CONNECTION_IBSS_ADHOC );break ; +case NL80211_IFTYPE_NAN : +case NL80211_IFTYPE_NAN_DATA : + basic_req.basic.conn_type =cpu_to_le32 (CONNECTION_NAN ); + basic_req.basic.conn_state = !enable; +break ;default :WARN_ON (1 );break ;
@@ -1627,6 +1636,11 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,case NL80211_IFTYPE_ADHOC : basic_req.basic.conn_type =cpu_to_le32 (CONNECTION_IBSS_ADHOC );break ; +case NL80211_IFTYPE_NAN : +case NL80211_IFTYPE_NAN_DATA : + basic_req.basic.conn_type =cpu_to_le32 (CONNECTION_NAN ); + basic_req.basic.active = enable; +break ;default :WARN_ON (1 );break ;
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +4 -0
@@ -876,6 +876,7 @@ enum {#define NETWORK_P2P BIT(17)#define NETWORK_IBSS BIT(18)#define NETWORK_WDS BIT(21) +#define NETWORK_NAN BIT(22)#define SCAN_FUNC_RANDOM_MAC BIT(0)#define SCAN_FUNC_RNR_SCAN BIT(3)
@@ -888,6 +889,7 @@ enum {#define CONNECTION_IBSS_ADHOC (STA_TYPE_ADHOC | NETWORK_IBSS)#define CONNECTION_WDS (STA_TYPE_WDS | NETWORK_WDS)#define CONNECTION_INFRA_BC (STA_TYPE_BC | NETWORK_INFRA) +#define CONNECTION_NAN (NETWORK_NAN)#define CONN_STATE_DISCONNECT 0#define CONN_STATE_CONNECT 1
@@ -1074,6 +1076,7 @@ enum {MCU_UNI_EVENT_THERMAL =0x35 ,MCU_UNI_EVENT_RSSI_MONITOR =0x41 ,MCU_UNI_EVENT_NIC_CAPAB =0x43 , +MCU_UNI_EVENT_NAN =0x56 ,MCU_UNI_EVENT_WED_RRO =0x57 ,MCU_UNI_EVENT_PER_STA_INFO =0x6d , MCU_UNI_EVENT_ALL_STA_INFO = 0x6e,
@@ -1313,6 +1316,7 @@ enum {MCU_UNI_CMD_FIXED_RATE_TABLE =0x40 ,MCU_UNI_CMD_RSSI_MONITOR =0x41 ,MCU_UNI_CMD_TESTMODE_CTRL =0x46 , +MCU_UNI_CMD_NAN =0x56 ,MCU_UNI_CMD_RRO =0x57 ,MCU_UNI_CMD_OFFCH_SCAN_CTRL =0x58 , MCU_UNI_CMD_PER_STA_INFO = 0x6d,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 865/1815 wifi: mt76: mt7925: add NAN MCU helpers
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
[ Upstream commit a5487a6824068cba6fab02f3e5186940a59275ed ]
Add the mt7925 NAN MCU ABI and helpers for enable, disable, configuration updates, availability updates and peer schedule commands.
Upper-layer integration is added by later patches.
Stable-dep-of: 217f9e7bb025 ("wifi: mt76: mt792x: fix use-after-free in mt76_rx_poll_complete")
--- .../wireless/mediatek/mt76/mt7925/Makefile | 2 +- .../net/wireless/mediatek/mt76/mt7925/nan.c | 927 ++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7925/nan.h | 419 ++++++++ .../net/wireless/mediatek/mt76/mt7925/regd.c | 30 + .../net/wireless/mediatek/mt76/mt7925/regd.h | 3 + drivers/net/wireless/mediatek/mt76/mt792x.h | 38 + 6 files changed, 1418 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wireless/mediatek/mt76/mt7925/nan.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt7925/nan.h
drivers/net/wireless/mediatek/mt76/mt7925/Makefile +1 -1
@@ -4,7 +4,7 @@ obj-$(CONFIG_MT7925_COMMON) += mt7925-common.o obj-$(CONFIG_MT7925E) += mt7925e.o obj-$(CONFIG_MT7925U) += mt7925u.o -mt7925-common-y := mac.o mcu.o regd.o main.o init.o debugfs.o +mt7925-common-y := mac.o mcu.o regd.o main.o init.o debugfs.o nan.o mt7925-common-$(CONFIG_NL80211_TESTMODE) += testmode.o mt7925e-y := pci.o pci_mac.o pci_mcu.o mt7925u-y := usb.o
drivers/net/wireless/mediatek/mt76/mt7925/nan.c new file +927 -0
927 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7925/nan.h new file +419 -0
419 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7925/regd.c +30 -0
@@ -217,6 +217,36 @@ mt7925_regd_is_valid_alpha2(const char *alpha2)return false; } +bool +mt7925_regd_is_valid_channel (struct mt792x_dev *dev, +enum nl80211_band band, +struct ieee80211_channel *chan) +{ +struct ieee80211_hw *hw =mt76_hw (dev); +struct wiphy *wiphy = hw->wiphy; +struct ieee80211_supported_band *sband; +struct ieee80211_channel *ch; +int i; + +if (!chan) +return false; + + sband = wiphy->bands[band]; +if (!sband) +return false; + +for (i =0 ; i < sband->n_channels; i++) { + ch = &sband->channels[i]; + +if (ch->hw_value == chan->hw_value && + ((ch->flags &IEEE80211_CHAN_DISABLED ) ==0 )) +return true; + } + +return false; +} +EXPORT_SYMBOL_GPL (mt7925_regd_is_valid_channel); +int mt7925_regd_change (struct mt792x_phy *phy,char *alpha2) {struct wiphy *wiphy = phy->mt76->hw->wiphy;
drivers/net/wireless/mediatek/mt76/mt7925/regd.h +3 -0
@@ -13,6 +13,9 @@ void mt7925_regd_be_ctrl(struct mt792x_dev *dev, u8 *alpha2);void mt7925_regd_notifier (struct wiphy *wiphy,struct regulatory_request *req);bool mt7925_regd_clc_supported (struct mt792x_dev *dev);int mt7925_regd_change (struct mt792x_phy *phy,char *alpha2); +bool mt7925_regd_is_valid_channel (struct mt792x_dev *dev, +enum nl80211_band band, +struct ieee80211_channel *chan);int mt7925_regd_init (struct mt792x_phy *phy);#endif
drivers/net/wireless/mediatek/mt76/mt792x.h +38 -0
@@ -115,6 +115,18 @@ struct mt792x_link_sta {struct ieee80211_link_sta *pri_link; }; +struct mt792x_sta_nan_sched { +u16 committed_dw; +u32 sch_idx; +bool idx_assigned; +unsigned long ndp_ctx_bitmap; +u8 ndp_ctx_id;/* assigned NDP context ID (for NDI sta) */ +struct { +u8 map_id; +struct cfg80211_chan_def chans[CFG80211_NAN_SCHED_NUM_TIME_SLOTS ]; + } maps[CFG80211_NAN_MAX_PEER_MAPS ]; +}; +struct mt792x_sta {struct mt792x_link_sta deflink;/* must be first */ struct mt792x_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS ];
@@ -123,6 +135,9 @@ struct mt792x_sta {u16 valid_links;u8 deflink_id; + +/* NAN peer schedule */ +struct mt792x_sta_nan_sched nan_sched; };DECLARE_EWMA (rssi,10 ,8 );
@@ -139,6 +154,25 @@ struct mt792x_bss_conf {unsigned int link_id; }; +struct mt792x_nan_conf { +u8 master_pref; +u8 bands; +u8 cluster_id[ETH_ALEN ]; +u32 discovery_beacon_interval; +bool enable_dw_notification; +}; + +struct mt792x_nan { +struct mt792x_nan_conf conf; + +/* Scheduler */ +struct cfg80211_chan_def local_sched[CFG80211_NAN_SCHED_NUM_TIME_SLOTS ]; +u32 seq_id; + +/* Connection index bitmap, up to NAN_MAX_CONN_CFG peers */ +unsigned long conn_bitmap; +}; +struct mt792x_vif {struct mt792x_bss_conf bss_conf;/* must be first */ struct mt792x_bss_conf __rcu *link_conf[IEEE80211_MLD_MAX_NUM_LINKS ];
@@ -153,6 +187,8 @@ struct mt792x_vif {struct work_struct csa_work;struct timer_list csa_timer; + +struct mt792x_nan nan; };struct mt792x_phy {
@@ -283,6 +319,8 @@ struct mt792x_dev {u32 backup_l2;struct ieee80211_chanctx_conf *new_ctx; + +struct ieee80211_vif *nan_vif; }; static inline struct mt792x_bss_conf *
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 866/1815 wifi: mt76: add init_wiphy callback
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
[ Upstream commit 4ee3d2a5f2cd5b6d0ba0d997913c1b763ef4d5c5 ]
Add an optional callback for drivers to finalize wiphy state after mt76 has initialized the supported bands and before registration.
Stable-dep-of: 217f9e7bb025 ("wifi: mt76: mt792x: fix use-after-free in mt76_rx_poll_complete")
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt76.h | 3 +++ 2 files changed, 10 insertions(+)
drivers/net/wireless/mediatek/mt76/mac80211.c +7 -0
@@ -681,6 +681,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size, dev = hw->priv; dev->hw = hw; dev->dev = pdev; + dev->init_wiphy =NULL ; dev->drv = drv_ops; dev->dma_dev = pdev;
@@ -779,6 +780,12 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,mt76_check_sband (&dev->phy, &phy->sband_5g,NL80211_BAND_5GHZ );mt76_check_sband (&dev->phy, &phy->sband_6g,NL80211_BAND_6GHZ ); +if (dev->init_wiphy) { + ret = dev->init_wiphy (dev); +if (ret) +return ret; + } +if (IS_ENABLED (CONFIG_MT76_LEDS )) { ret =mt76_led_init (phy);if (ret)
drivers/net/wireless/mediatek/mt76/mt76.h +3 -0
@@ -941,6 +941,9 @@ struct mt76_dev {const struct mt76_bus_ops *bus;const struct mt76_driver_ops *drv;const struct mt76_mcu_ops *mcu_ops; + +/* Optional callback to finalize wiphy state before registration. */ +int (*init_wiphy)(struct mt76_dev *dev);struct device *dev;struct device *dma_dev;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 867/1815 wifi: mt76: mt792x: fix use-after-free in mt76_rx_poll_complete
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eason Lai <[email protected]>
[ Upstream commit 217f9e7bb02558759be9d9ecfe532e9708741c50 ]
A use-after-free issue occurs in mt76_rx_poll_complete due to a race condition. The STA has already been removed, but the rx_status still had a pointer to the wcid in the STA.
Set the links' wcid pointers to be NULL for a MLD in mt7925_sta_pre_rcu_remove()
BUG: KASAN: invalid-access in mt76_rx_poll_complete+0x280/0x470 Call trace: dump_backtrace+0xec/0x128 show_stack+0x18/0x28 dump_stack_lvl+0x40/0xc8 print_report+0x1b8/0x710 kasan_report+0xe0/0x144 do_bad_area+0x120/0x260 do_tag_check_fault+0x20/0x34 do_mem_abort+0x54/0xa8 el1_abort+0x3c/0x5c el1h_64_sync_handler+0x40/0xcc el1h_64_sync+0x7c/0x80 mt76_rx_poll_complete+0x280/0x470 mt76_dma_rx_poll+0x114/0x51c mt792x_poll_rx+0x60/0xf8 napi_threaded_poll_loop+0xe0/0x450 napi_threaded_poll+0x80/0x9c kthread+0x11c/0x158 ret_from_fork+0x10/0x20
--- .../net/wireless/mediatek/mt76/mt7925/main.c | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +35 -1
@@ -2494,6 +2494,40 @@ static void mt7925_stop(struct ieee80211_hw *hw, bool suspend)mt792x_stop (hw, suspend); } +static void mt7925_sta_pre_rcu_remove (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta) +{ +struct mt76_phy *phy = hw->priv; +struct mt76_dev *dev = phy->dev; +struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; + +mutex_lock (&dev->mutex); +spin_lock_bh (&dev->status_lock); + +if (ieee80211_vif_is_mld (vif)) { +struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; +struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; +unsigned long valid = mvif->valid_links; +struct mt792x_link_sta *mlink; +unsigned int link_id; + +for_each_set_bit (link_id, &valid,IEEE80211_MLD_MAX_NUM_LINKS ) { + mlink =mt792x_sta_to_link (msta, link_id); +if (!mlink || !mlink->wcid.sta) +continue ; +if (mlink->wcid.idx <ARRAY_SIZE (dev->wcid)) +rcu_assign_pointer (dev->wcid[mlink->wcid.idx], +NULL ); + } + }else { +rcu_assign_pointer (dev->wcid[wcid->idx],NULL ); + } + +spin_unlock_bh (&dev->status_lock); +mutex_unlock (&dev->mutex); +} +const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start,
@@ -2506,7 +2540,7 @@ const struct ieee80211_ops mt7925_ops = { .start_ap = mt7925_start_ap, .stop_ap = mt7925_stop_ap, .sta_state = mt76_sta_state, - .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove, + .sta_pre_rcu_remove = mt7925_sta_pre_rcu_remove, .set_key = mt7925_set_key, .sta_set_decap_offload = mt7925_sta_set_decap_offload,#if IS_ENABLED (CONFIG_IPV6 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 868/1815 wifi: mt76: mt7921: Add PCIe AER handler support to prevent system crash
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eason Lai <[email protected]>
[ Upstream commit 915672c5ae32deeb72f4572856d123f314791136 ]
When an AER error occurs and the bus is hung, the register reads return 0xFFFFFFFF, causing the DMA queue state to be corrupted and resulting in an invalid memory access when accessing q->desc[] or q->entry[].
Unable to handle kernel paging request at virtual address ffffffc01099eac0 pc : mt76_dma_add_buf+0x124/0x188 [mt76] lr : mt76_dma_rx_fill+0x11c/0x1d8 [mt76]
sp : ffffffc016d9bbf0
x29: ffffffc016d9bc10 x28: 0000000000000000
x27: 0000000000000000 x26: ffffffb7855e50b8
x25: ffffffb80d04f000 x24: 0000000000000000
x23: 0000000000000ec0 x22: ffffffb796803648
x21: ffffffb796801f80 x20: ffffffb7968035f8
x19: 0000000000000ec0 x18: 0000000000000000
x17: 000000004ec00000 x16: 000000000ec00000
x15: ffffffc01099eac0 x14: 000000004ec00000
x13: 00000000ffc5a000 x12: ffffffc016d9bc32
x11: 00000000ffffffff x10: 0000000000000002
x9 : 0000000000000000 x8 : 000000000000b4ac
x7 : 0000000000000a20 x6 : ffffffb6c1806400
x5 : 0000000000000000 x4 : ffffffb80d04f000
x3 : 0000000000000000 x2 : 0000000000000001
x1 : 000000000ec04000 x0 : ffffffb7968035f8
Call trace: mt76_dma_add_buf+0x124/0x188 [mt76 (HASH:1029 4)] mt76_dma_rx_reset+0xe8/0xfc [mt76 (HASH:1029 4)] mt7921_wpdma_reset+0x188/0x1b0 [mt7921e (HASH:ee48 5)] mt7921e_mac_reset+0x128/0x418 [mt7921e (HASH:ee48 5)] mt7921_mac_reset_work+0xac/0x1a8 [mt7921_common (HASH:f721 6)] process_one_work+0x188/0x514 worker_thread+0x12c/0x300 kthread+0x140/0x1fc ret_from_fork+0x10/0x30
Fix the invalid memory access by validating the DMA index read from the hardware before it is used as a queue index. An out-of-range value, such as the 0xFFFFFFFF returned while the bus is hung, is now clamped so it can no longer corrupt q->head or q->tail. In addition, check the bus_hung flag in mt7921_mac_reset_work() before attempting the reset sequence, reject MCU messages while the bus is hung, and install no-op bus operations when an unrecoverable AER error is detected, preventing further invalid hardware accesses.
Due to hardware limitations - such as the lack of a connected hardware reset pin or the absence of host re-probe functionality - affected Wi-Fi devices may not fully recover to a normal operational state after certain errors, even with AER enabled.
--- drivers/net/wireless/mediatek/mt76/dma.c | 27 +++-- drivers/net/wireless/mediatek/mt76/mcu.c | 12 +- .../net/wireless/mediatek/mt76/mt76_connac.h | 5 + .../net/wireless/mediatek/mt76/mt7921/mac.c | 3 + .../net/wireless/mediatek/mt76/mt7921/pci.c | 103 ++++++++++++++++++ 5 files changed, 139 insertions(+), 11 deletions(-)
drivers/net/wireless/mediatek/mt76/dma.c +20 -7
@@ -186,6 +186,18 @@ mt76_dma_queue_magic_cnt_init(struct mt76_dev *dev, struct mt76_queue *q) } } +/* A hung bus (e.g. after a PCIe AER error) reads 0xffffffff from every +* register, so clamp an out-of-range index to the fallback to keep it from +* corrupting q->head/q->tail. +*/ +static int +mt76_dma_read_dma_idx (struct mt76_queue *q,int fallback) +{ +u32 idx =Q_READ (q, dma_idx); + +return idx < q->ndesc ? idx : fallback; +} +static void mt76_dma_sync_idx (struct mt76_dev *dev,struct mt76_queue *q) {
@@ -201,7 +213,8 @@ mt76_dma_sync_idx(struct mt76_dev *dev, struct mt76_queue *q) }Q_WRITE (q, desc_base, q->desc_dma); - q->head =Q_READ (q, dma_idx); + + q->head =mt76_dma_read_dma_idx (q,0 ); q->tail = q->head; }
@@ -419,7 +432,7 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, struct mt76_queue *q, bool flush)if (flush) last =-1 ;else - last =Q_READ (q, dma_idx); + last =mt76_dma_read_dma_idx (q,-1 );while (q->queued >0 && q->tail != last) {mt76_dma_tx_cleanup_idx (dev, q, q->tail, &entry);
@@ -432,7 +445,7 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, struct mt76_queue *q, bool flush) }if (!flush && q->tail == last) - last =Q_READ (q, dma_idx); + last =mt76_dma_read_dma_idx (q,-1 ); }spin_unlock_bh (&q->cleanup_lock);
@@ -625,8 +638,8 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q, buf.len = skb->len;spin_lock_bh (&q->lock); -mt76_dma_add_buf (dev, q, &buf,1 , tx_info, skb,NULL ); -mt76_dma_kick_queue (dev, q); +if (mt76_dma_add_buf (dev, q, &buf,1 , tx_info, skb,NULL ) >=0 ) +mt76_dma_kick_queue (dev, q);spin_unlock_bh (&q->lock);return 0 ;
@@ -983,7 +996,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)if ((q->flags &MT_QFLAG_WED_RRO_EN ) || (IS_ENABLED (CONFIG_NET_MEDIATEK_SOC_WED ) &&mt76_queue_is_wed_tx_free (q))) { - dma_idx =Q_READ (q, dma_idx); + dma_idx =mt76_dma_read_dma_idx (q, q->tail); check_ddone = true; }
@@ -993,7 +1006,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)if (check_ddone) {if (q->tail == dma_idx) - dma_idx =Q_READ (q, dma_idx); + dma_idx =mt76_dma_read_dma_idx (q, q->tail);if (q->tail == dma_idx)break ;
drivers/net/wireless/mediatek/mt76/mcu.c +8 -4
@@ -78,15 +78,19 @@ int mt76_mcu_skb_send_and_get_msg(struct mt76_dev *dev, struct sk_buff *skb,unsigned long expires;int ret, seq; -if (mt76_is_sdio (dev)) -if (test_bit (MT76_RESET , &dev->phy.state) &&atomic_read (&dev->bus_hung)) -return -EIO ; -if (ret_skb) *ret_skb =NULL ;mutex_lock (&dev->mcu.mutex); +if ((mt76_is_mmio (dev) &&atomic_read (&dev->bus_hung)) || + (mt76_is_sdio (dev) &&test_bit (MT76_RESET , &dev->phy.state) && +atomic_read (&dev->bus_hung))) { + orig_skb = skb; + ret = -EIO ; + goto out; + } +if (dev->mcu_ops->mcu_skb_prepare_msg) { orig_skb = skb; ret = dev->mcu_ops->mcu_skb_prepare_msg (dev, skb, cmd, &seq);
drivers/net/wireless/mediatek/mt76/mt76_connac.h +5 -0
@@ -48,6 +48,11 @@ enum rx_pkt_type {#define MT_TXD_LEN_MSDU_LAST BIT(14)#define MT_TXD_LEN_AMSDU_LAST BIT(15) +/* PCIE part */ +#define PCIE_AER_UNC_STATUS_OFFSET 0x204 +#define PCIE_AER_UNC_MASK_OFFSET 0x208 +#define PCIE_AER_CO_STATUS_OFFSET 0x210 +enum {CMD_CBW_20MHZ =IEEE80211_STA_RX_BW_20 ,CMD_CBW_40MHZ =IEEE80211_STA_RX_BW_40 ,
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +3 -0
@@ -674,6 +674,9 @@ void mt7921_mac_reset_work(struct work_struct *work)cancel_work_sync (&pm->wake_work);for (i =0 ; i <10 ; i++) { +if (atomic_read (&dev->mt76.bus_hung)) +return ; +mutex_lock (&dev->mt76.mutex); ret =mt792x_dev_reset (dev);mutex_unlock (&dev->mt76.mutex);
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +103 -0
115 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 869/1815 wifi: mt76: mt7927: set band index for sniffer mode
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
[ Upstream commit c410102bbff0803c9dc44056b917aff90abcbaec ]
Use the active channel context to select the SNIFFER command band index on MT7927, and fall back to the PHY chandef when no channel context is available.
Also pass the same band index to the sniffer channel configuration. This keeps monitor setup on the correct band, especially when multiple PHY band contexts are present.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +14 -0
@@ -2174,6 +2174,8 @@ int mt7925_get_txpwr_info(struct mt792x_dev *dev, u8 band_idx, struct mt7925_txp int mt7925_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif, bool enable) { + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct ieee80211_chanctx_conf *ctx = mvif->bss_conf.mt76.ctx; struct { struct { u8 band_idx;
@@ -2196,6 +2198,15 @@ int mt7925_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif, }, }; +if (is_mt7927 (&dev->mt76)) { +struct ieee80211_channel *chan; + + chan = ctx ? ctx->def.chan : mvif->phy->mt76->chandef.chan; + +if (chan) + req.hdr.band_idx =mt7927_band_idx (chan->band); + } +return mt76_mcu_send_msg (&dev->mt76,MCU_UNI_CMD (SNIFFER ), &req,sizeof (req), true); }
@@ -2255,6 +2266,9 @@ int mt7925_mcu_config_sniffer(struct mt792x_vif *vif, }, }; +if (is_mt7927 (mphy->dev)) + req.hdr.band_idx =mt7927_band_idx (chandef->chan->band); +if (chandef->chan->band <ARRAY_SIZE (ch_band)) req.tlv.ch_band = ch_band[chandef->chan->band];if (chandef->width <ARRAY_SIZE (ch_width))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 870/1815 wifi: mt76: mt7925: update clc before setting sar power table
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jared.Huang <[email protected]>
[ Upstream commit 8a27c5c764040fbc990cc416a927b1d7eadf559f ]
Fix the power table update sequence to ensure CLC is loaded before setting SAR power table.
The firmware requires CLC baseline to be established first
to properly calculate the final power limit as min(clc_limit, rate_limit,sar_limit).
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +7 -1
@@ -1828,9 +1828,15 @@ static int mt7925_set_sar_specs(struct ieee80211_hw *hw,int err;mt792x_mutex_acquire (dev); + err =mt7925_mcu_set_clc (dev, dev->mt76.alpha2, + dev->country_ie_env); +if (err <0 ) + goto out; + err =mt7925_set_tx_sar_pwr (hw, sar); -mt792x_mutex_release (dev); +out: +mt792x_mutex_release (dev);return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 871/1815 wifi: mt76: mt7925: fix msg len mismatch between driver and firmware
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jared.Huang <[email protected]>
[ Upstream commit 9ddb7487aa7cccb6e1880b4151ab5895109eb8d6 ]
The mt7925_tx_power_limit_tlv struct begins with a 4-byte rsv[] field that acts as a UNI command header prefix. The firmware dispatcher did not use the 4-byte rsv[] and will only check the payloads after the 4-byte rsv[] As a result, the total message length minus the 4-byte prefix. Fix this by setting len to msg_len - 4.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +1 -1
@@ -3843,7 +3843,7 @@ mt7925_mcu_rate_txpower_band(struct mt76_phy *phy,memcpy (tx_power_tlv->alpha2, dev->alpha2,sizeof (dev->alpha2)); tx_power_tlv->n_chan = num_ch; tx_power_tlv->tag =cpu_to_le16 (0x1 ); - tx_power_tlv->len =cpu_to_le16 (msg_len); + tx_power_tlv->len =cpu_to_le16 (msg_len -4 );switch (band) {case NL80211_BAND_2GHZ :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 872/1815 wifi: mt76: mt792x: Fix memory leak in SDIO TX path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eason Lai <[email protected]>
[ Upstream commit 808f2767d4217a5b96f674288573b9b89d432eed ]
When tx_prepare_skb() returns an error in the SDIO TX path, the skb is not freed, leading to a memory leak. This can occur when zero-length frames (such as WNM NULL frames) are dropped to prevent potential hardware TX hangs.
Fix this by properly releasing the skb with ieee80211_tx_status_ext() when tx_prepare_skb() fails.
--- drivers/net/wireless/mediatek/mt76/sdio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/sdio.c +10 -1
@@ -519,6 +519,10 @@ mt76s_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q, enum mt76_txq_id qid, struct sk_buff *skb, struct mt76_wcid *wcid, struct ieee80211_sta *sta) { + struct ieee80211_tx_status status = { + .sta = sta, + }; +struct mt76_tx_info tx_info = { .skb = skb, };
@@ -531,8 +535,13 @@ mt76s_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q, skb->prev = skb->next =NULL ; err = dev->drv->tx_prepare_skb (dev,NULL , qid, wcid, sta, &tx_info); -if (err <0 ) +if (err <0 ) { + status.skb = tx_info.skb; +spin_lock_bh (&dev->rx_lock); +ieee80211_tx_status_ext (dev->hw, &status); +spin_unlock_bh (&dev->rx_lock);return err; + } q->entry[q->head].skb = tx_info.skb; q->entry[q->head].buf_sz = len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 873/1815 wifi: mt76: mt7996: fix EAPOL source BSS for non-MLD stations
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chad Monroe <[email protected]>
[ Upstream commit 6bb5066cfcd4296ac5e0b6872f43f96a43bfe566 ]
A non-MLD station's EAPOL and data frames are tagged with link_id == IEEE80211_LINK_UNSPECIFIED, which now skips the per-link lookup in mt7996_mac_write_txwi() and leaves omac_idx/band_idx/wmm_idx at slot
0. When the radio also runs AP VAPs the station's omac is non-zero (get_omac_idx() prefers HW BSSID slots 1-3), so its EAPOL frames egress from the wrong BSS and the 4-way handshake times out even though association succeeds.
In mt7996_tx_prepare_skb(), resolve the link from the peer wcid when link_id is UNSPECIFIED and the wcid is not the global entry, restoring the pre-MLO behaviour for station traffic.
--- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +5 -0
@@ -1030,6 +1030,11 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, IEEE80211_TX_CTRL_MLO_LINK); } +/* non-MLD frames are LINK_UNSPECIFIED; use the wcid's own link */ +if (link_id ==IEEE80211_LINK_UNSPECIFIED && + wcid != &dev->mt76.global_wcid) + link_id = wcid->link_id; +if (link_id != wcid->link_id && link_id !=IEEE80211_LINK_UNSPECIFIED ) {if (msta) { struct mt7996_sta_link *msta_link =
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 874/1815 wifi: mt76: mt7996: fix non-MLD station num_sta leak
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chad Monroe <[email protected]>
[ Upstream commit 2087f029924b75324cfa9a41ba1a349a9620f06e ]
The MLO link-reconfiguration rework moved the per-phy num_sta decrement inside a link_valid guard. link_valid is only set for MLO links, but num_sta is incremented for every station link, including the non-MLO deflink. Non-MLO stations bump num_sta on association and never drop it on removal.
A non-zero num_sta forces connected-mode off-channel scanning which prevents the directed probe exchange needed to find hidden APs.
Decrement phy->num_sta on the actual link teardown, pairing it with the unconditional increment on link creation.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +6 -6
@@ -1202,15 +1202,9 @@ void mt7996_mac_sta_remove_link(struct mt7996_dev *dev,mt76_wcid_cleanup (&dev->mt76, &msta_link->wcid);if (msta_link->wcid.link_valid) { -struct mt7996_phy *phy; -mt7996_mac_wtbl_update (dev, msta_link->wcid.idx,MT_WTBL_UPDATE_ADM_COUNT_CLEAR ); - phy =__mt7996_phy (dev, msta_link->wcid.phy_idx); -if (phy) - phy->mt76->num_sta--; -if (msta->deflink_id == link_id) { msta->deflink_id =IEEE80211_LINK_UNSPECIFIED ;if (msta->seclink_id == link_id) {
@@ -1236,6 +1230,12 @@ void mt7996_mac_sta_remove_link(struct mt7996_dev *dev, }if (flush) { +struct mt7996_phy *phy = +__mt7996_phy (dev, msta_link->wcid.phy_idx); + +if (phy) + phy->mt76->num_sta--; +rcu_assign_pointer (msta->link[link_id],NULL );rcu_assign_pointer (dev->mt76.wcid[msta_link->wcid.idx],NULL );mt76_wcid_mask_clear (dev->mt76.wcid_mask, msta_link->wcid.idx);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 875/1815 wifi: mt76: mt7996: fix capability of EHT-MCS 15 in MRU
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shayne Chen <[email protected]>
[ Upstream commit 29e889c4ada83c69d10a3937f5ae2934306e2e3d ]
According to the definition in IEEE Std 802.11be-2024, Table 9-417r:
- If 80 MHz is not supported, bit 1-3 are set to 0.
- If 160 MHz is not supported, bit 2-3 are set to 0.
- If 320 MHz is not supported, bit 3 is set to 0.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +10 -6
@@ -1561,7 +1561,6 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,struct ieee80211_sta_eht_cap *eht_cap = &data->eht_cap;struct ieee80211_eht_cap_elem_fixed *eht_cap_elem = &eht_cap->eht_cap_elem;struct ieee80211_eht_mcs_nss_supp *eht_nss = &eht_cap->eht_mcs_nss_supp; -enum nl80211_chan_width width = phy->mt76->chandef.width;int nss =hweight8 (phy->mt76->antenna_mask);int sts =hweight16 (phy->mt76->chainmask);u8 val;
@@ -1637,11 +1636,16 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,u8_encode_bits (u8_get_bits (1 ,GENMASK (1 ,0 )),IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK ); - val = width ==NL80211_CHAN_WIDTH_320 ?0xf : - width ==NL80211_CHAN_WIDTH_160 ?0x7 : - width ==NL80211_CHAN_WIDTH_80 ?0x3 :0x1 ; - eht_cap_elem->phy_cap_info[6 ] = -u8_encode_bits (val,IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK ); + eht_cap_elem->phy_cap_info[6 ] =IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK ; +if (band !=NL80211_BAND_6GHZ ) { + eht_cap_elem->phy_cap_info[6 ] &= + ~IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_320MHZ ; + +if (band !=NL80211_BAND_5GHZ ) + eht_cap_elem->phy_cap_info[6 ] &= + ~(IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_160MHZ | +IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_80MHZ ); + } val =u8_encode_bits (nss,IEEE80211_EHT_MCS_NSS_RX ) |u8_encode_bits (nss,IEEE80211_EHT_MCS_NSS_TX );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 876/1815 wifi: mt76: fix RX data queuing of RRO 3.0
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rex Lu <[email protected]>
[ Upstream commit 86897f106669c07eea4c34b54c3268d448d41426 ]
For RRO 3.0, RX data released from a RRO data queue should be put to the indicator queue. The frames are processed and completed in the context of the indicator queue NAPI, which only polls skbs queued on the MT_RXQ_RRO_IND list; frames queued under the data queue id are left sitting on that list until the data queue NAPI happens to run, stalling and reordering RX data.
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mac80211.c +8 -0
@@ -893,6 +893,7 @@ static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)struct sk_buff *skb = phy->rx_amsdu[q].head;struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;struct mt76_dev *dev = phy->dev; +struct mt76_queue *rxq = &dev->q_rx[q]; phy->rx_amsdu[q].head =NULL ; phy->rx_amsdu[q].tail =NULL ;
@@ -921,6 +922,13 @@ static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)return ; } } + +/* RRO 3.0 data queue skbs are processed and completed in the context +* of the indicator queue NAPI, which only polls its own skb list +*/ +if (mt76_queue_is_wed_rro_data (rxq) && dev->hwrro_mode ==MT76_HWRRO_V3 ) + q =MT_RXQ_RRO_IND ; +__skb_queue_tail (&dev->rx_skb[q], skb); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 877/1815 wifi: mt76: mt7996: fix MLD ID in MAC TXD and HIF TXP
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chiu <[email protected]>
[ Upstream commit ce35ecffc96e6d097d27b6fe30677a2cfe2e0461 ]
Problem:
MCU command timeout while the firmware state is normal, and the firmware keeps showing the error log "ERROR!! NO PAUSE...".
Root cause:
If the MLD_ID field in the TXD is neither the primary link id nor the secondary link id, it may lead to a firmware busy loop when the third link is in power saving mode.
Remap frames directed to a third link to the primary link wcid. Since TX status events and txfree completions carry the wcid the firmware saw, use the remapped wcid for packet id tracking and non-AQL packet accounting as well, while the frame keeps its original link context for addressing, band and OMAC selection.
--- .../net/wireless/mediatek/mt76/mt7996/mac.c | 29 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7996/main.c | 2 +- .../wireless/mediatek/mt76/mt7996/mt7996.h | 1 + 3 files changed, 31 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +29 -0
@@ -854,6 +854,33 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi, txwi[6 ] |=cpu_to_le32 (MT_TXD6_DIS_MAT ); } +/* The WLAN_IDX in the TXD and TXP must belong to the primary or secondary +* link of an MLD station; any other link id can make the firmware spin when +* that link is in powersave. Completion events carry the same index, so the +* wcid used for status tracking and accounting must match it +*/ +struct mt76_wcid *mt7996_get_tx_wcid (struct mt76_wcid *wcid) +{ +struct mt7996_sta_link *msta_link; +struct mt7996_sta *msta; + +if (!wcid->sta) +return wcid; + + msta_link = container_of(wcid, struct mt7996_sta_link, wcid); + msta = msta_link->sta; + +if (!msta || wcid->link_id == msta->seclink_id || + wcid->link_id == msta->deflink_id) +return wcid; + + msta_link =mt7996_sta_link (msta, msta->deflink_id); +if (msta_link) +return &msta_link->wcid; + +return wcid; +} + void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, struct sk_buff *skb, struct mt76_wcid *wcid, struct ieee80211_key_conf *key, int pid,
@@ -1091,6 +1118,8 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, tx_info->buf[1].len, DMA_TO_DEVICE); } + wcid =mt7996_get_tx_wcid (wcid); + pid =mt76_tx_status_skb_add (mdev, wcid, tx_info->skb);memset (txwi_ptr,0 ,MT_TXD_SIZE );/* Transmit non qos data by 802.11 header and need to fill txd by host*/
drivers/net/wireless/mediatek/mt76/mt7996/main.c +1 -1
@@ -1579,7 +1579,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,if (msta_link) wcid = &msta_link->wcid; } -mt76_tx (mphy, control->sta, wcid, skb); +mt76_tx (mphy, control->sta,mt7996_get_tx_wcid (wcid), skb); unlock:rcu_read_unlock (); }
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +1 -0
@@ -871,6 +871,7 @@ bool mt7996_mac_wtbl_update(struct mt7996_dev *dev, int idx, u32 mask);void mt7996_mac_reset_counters (struct mt7996_phy *phy);void mt7996_mac_cca_stats_reset (struct mt7996_phy *phy);void mt7996_mac_enable_nf (struct mt7996_dev *dev,u8 band); +struct mt76_wcid *mt7996_get_tx_wcid (struct mt76_wcid *wcid); void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, struct sk_buff *skb, struct mt76_wcid *wcid, struct ieee80211_key_conf *key, int pid,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 878/1815 wifi: mt76: fix non-AQL packet accounting for MLO stations
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael-CY Lee <[email protected]>
[ Upstream commit 8ae659743ba936b22ecb4620815887728e2820d6 ]
__mt76_tx_queue_skb() overrides the wcid passed by the driver with sta->drv_priv, so the wcid might incorrectly be changed after TX, causing wcid->non_aql_packets to be counted on the wrong wcid. For example, on the AP side, if a station's setup link is the 5G link and the station uses 2G to transmit a frame, the value of non_aql_packets is increased on the 5G wcid but decreased on the 2G wcid. Once the inflated counter exceeds MT_MAX_NON_AQL_PKT, the TX scheduler permanently refuses to service the station.
Drop the reassignment and account on the wcid used for transmission. This also records the actual wcid in the queue entry.
--- drivers/net/wireless/mediatek/mt76/tx.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/wireless/mediatek/mt76/tx.c +0 -4
@@ -324,10 +324,6 @@ __mt76_tx_queue_skb(struct mt76_phy *phy, int qid, struct sk_buff *skb,if (idx <0 || !sta)return idx; - wcid = (struct mt76_wcid *)sta->drv_priv; -if (!wcid->sta) -return idx; - q->entry[idx].wcid = wcid->idx;if (!non_aql)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 879/1815 wifi: mt76: assign link_id when sending probe request during scan
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael-CY Lee <[email protected]>
[ Upstream commit f137fabc1313427e08af06a414d929ebd9fd37d6 ]
The link_id in info->control.flags is required by mt7996 to select the correct mt76_wcid for transmission.
Not assigning the link_id in info->control.flags is equivalent to assigning the link_id to 0, causing mt7996 to select link_id 0 for transmission, so probe requests sent on behalf of an MLD vif scanning via a different link were transmitted with the wrong per-link wcid.
--- drivers/net/wireless/mediatek/mt76/scan.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/mediatek/mt76/scan.c +5 -0
@@ -48,6 +48,7 @@ mt76_scan_send_probe(struct mt76_dev *dev, struct cfg80211_ssid *ssid)struct mt76_phy *phy = dev->scan.phy;struct ieee80211_tx_info *info;struct sk_buff *skb; +u8 link_id; skb =ieee80211_probereq_get (phy->hw, vif->addr, ssid->ssid, ssid->ssid_len, req->ie_len);
@@ -77,6 +78,10 @@ mt76_scan_send_probe(struct mt76_dev *dev, struct cfg80211_ssid *ssid) info->flags |=IEEE80211_TX_CTL_NO_CCK_RATE ; info->control.flags |=IEEE80211_TX_CTRL_DONT_USE_RATE_MASK ; + link_id = mvif->wcid ? mvif->wcid->link_id :IEEE80211_LINK_UNSPECIFIED ; + info->control.flags &= ~IEEE80211_TX_CTRL_MLO_LINK ; + info->control.flags |=u32_encode_bits (link_id,IEEE80211_TX_CTRL_MLO_LINK ); +mt76_tx (phy,NULL , mvif->wcid, skb); out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 880/1815 wifi: mt76: mt7996: validate RX band_idx before dereferencing phys[]
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 2243778a5fae8329ab5f18e7adcd7e03b911a1b7 ]
band_idx comes from a 2-bit descriptor field (0-3) and was used directly to index dev->mt76.phys[] (size __MT_MAX_BAND == 3) and dereference the result. A corrupt or reserved descriptor value could index out of bounds or hit a NULL phy on parts with fewer bands. Reject invalid band indices, mirroring mt7996_rx_get_wcid().
--- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +6 -0
@@ -441,7 +441,13 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q,memset (status,0 ,sizeof (*status)); band_idx =FIELD_GET (MT_RXD1_NORMAL_BAND_IDX , rxd1); +if (!mt7996_band_valid (dev, band_idx)) +return -EINVAL ; + mphy = dev->mt76.phys[band_idx]; +if (!mphy) +return -EINVAL ; + phy = mphy->priv; status->phy_idx = mphy->band_idx;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 881/1815 wifi: mt76: mt7996: set MT76_MCU_RESET before waking MCU waiters on full reset
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 6469ae71e7e5d0132c934972f628f346ad0379cd ]
mt7996_mac_full_reset() called wake_up(&dev->mt76.mcu.wait) without first setting MT76_MCU_RESET. The MCU response wait condition only checks the response queue and that bit, so the wake-up released nobody: a thread blocked in an MCU command against the dead firmware (typically holding dev->mt76.mutex) stayed asleep until its multi-second timeout, stalling recovery. Set the bit before the wake-up, as mt7915 does.
--- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +1 -0
@@ -2460,6 +2460,7 @@ mt7996_mac_full_reset(struct mt7996_dev *dev) dev->recovery.hw_full_reset = true; +set_bit (MT76_MCU_RESET , &dev->mphy.state);wake_up (&dev->mt76.mcu.wait);ieee80211_stop_queues (hw);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 882/1815 wifi: mt76: mt7915: clear wcid mask under mutex after RCU pointer clear
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 6486e11a6e2f679597af2d5bb48c3b07a2b2a7ba ]
mt7915_remove_interface() cleared the wcid mask bit with no lock held and before clearing the RCU wcid pointer. The mask is a non-atomic RMW shared with the allocators, which all run under dev->mt76.mutex; on DBDC the two wiphys share one mt76_dev, so this raced add_interface/sta_add on the other band and could leak or double-hand-out a wcid. Clearing the bit before the RCU pointer also let a concurrent allocation reuse the index and publish its wcid, which the subsequent NULL assignment then wiped. Move the clear into the existing mutex section, after the RCU pointer is cleared.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +1 -1
@@ -294,7 +294,6 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw,mt7915_mcu_add_bss_info (phy, vif, false);mt7915_mcu_add_sta (dev, vif,NULL ,CONN_STATE_DISCONNECT , false); -mt76_wcid_mask_clear (dev->mt76.wcid_mask, mvif->sta.wcid.idx);mutex_lock (&dev->mt76.mutex);mt76_testmode_reset (phy->mt76, true);
@@ -310,6 +309,7 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw,mutex_lock (&dev->mt76.mutex); dev->mt76.vif_mask &= ~BIT_ULL (mvif->mt76.idx); phy->omac_mask &= ~BIT_ULL (mvif->mt76.omac_idx); +mt76_wcid_mask_clear (dev->mt76.wcid_mask, mvif->sta.wcid.idx);mutex_unlock (&dev->mt76.mutex);spin_lock_bh (&dev->mt76.sta_poll_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 883/1815 wifi: mt76: mt7915: avoid nss underflow in mt7915_mcu_get_sta_nss
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 4a2f4be532e3ea4e2b536e411793a05aaa51af25 ]
If a peer's VHT/HE MCS map has no supported spatial stream (all fields 0x3), the loop exits with nss == 0 and the function returned (u8)-1 (255), which was then written into the firmware sta_rec_bf beamforming fields. Clamp the result to 0.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +1 -1
@@ -51,7 +51,7 @@ mt7915_mcu_get_sta_nss(u16 mcs_map)break ; } -return nss -1 ; +return nss ? nss -1 :0 ; } static void
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 884/1815 wifi: mt76: mt7996: dont report a zero TX bitrate
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit d4d92ccded678c92c390003926097ddbb6516bc7 ]
mt7996_sta_statistics() set NL80211_STA_INFO_TX_BITRATE unconditionally after the block that already sets it, so a station with no rate info yet was reported to userspace with a valid-but-zero TX rate. Drop the redundant unconditional assignments; the in-block ones are sufficient.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +0 -2
@@ -1883,8 +1883,6 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw, sinfo->txrate.flags = txrate->flags; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_BITRATE ); } - sinfo->txrate.flags = txrate->flags; - sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_BITRATE ); sinfo->tx_failed = msta_link->wcid.stats.tx_failed; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_FAILED );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 885/1815 wifi: mt76: mt7915: write RX header translation bit to the correct register
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 236145737480c4c0c515e09061d0d5f77cf52d3f ]
MT_MDP_DCR0_RX_HDR_TRANS_EN is a field of MT_MDP_DCR0, but monitor-mode handling applied it to the per-band MT_DMA_DCR0 register instead. As a result RX header translation was never disabled in the MDP when entering monitor mode, and an undocumented bit of MT_DMA_DCR0 was toggled. Target MT_MDP_DCR0, matching the mt7996 driver.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +1 -1
@@ -493,7 +493,7 @@ static int mt7915_config(struct ieee80211_hw *hw, int radio_idx,mt76_rmw_field (dev,MT_DMA_DCR0 (band),MT_DMA_DCR0_RXD_G5_EN , enabled); -mt76_rmw_field (dev,MT_DMA_DCR0 (band),MT_MDP_DCR0_RX_HDR_TRANS_EN , +mt76_rmw_field (dev,MT_MDP_DCR0 ,MT_MDP_DCR0_RX_HDR_TRANS_EN , !dev->monitor_mask);mt76_testmode_reset (phy->mt76, true);mt76_wr (dev,MT_WF_RFCR (band), rxfilter);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 886/1815 wifi: mt76: fix 4th chain ACK RSSI bitmask in sta_poll
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 5caa622956166f6c445a384c7e964da4d553a501 ]
The per-chain response-frame RSSI values are packed one per byte, but the 4th chain was extracted with GENMASK(31, 14) instead of GENMASK(31, 24). The wrong mask overlaps chains 1-3 and shifts by 14, producing a garbage chain-3 value that corrupts ack_signal/avg_ack_signal on 4x4 radios. Extract the correct byte.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 -1
@@ -221,7 +221,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) rssi[0 ] =to_rssi (GENMASK (7 ,0 ), val); rssi[1 ] =to_rssi (GENMASK (15 ,8 ), val); rssi[2 ] =to_rssi (GENMASK (23 ,16 ), val); - rssi[3 ] =to_rssi (GENMASK (31 ,14 ), val); + rssi[3 ] =to_rssi (GENMASK (31 ,24 ), val); msta->ack_signal =mt76_rx_signal (msta->vif->phy->mt76->antenna_mask, rssi);
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -1
@@ -156,7 +156,7 @@ static void mt7921_mac_sta_poll(struct mt792x_dev *dev) rssi[0 ] =to_rssi (GENMASK (7 ,0 ), val); rssi[1 ] =to_rssi (GENMASK (15 ,8 ), val); rssi[2 ] =to_rssi (GENMASK (23 ,16 ), val); - rssi[3 ] =to_rssi (GENMASK (31 ,14 ), val); + rssi[3 ] =to_rssi (GENMASK (31 ,24 ), val); mlink->ack_signal =mt76_rx_signal (msta->vif->phy->mt76->antenna_mask, rssi);
drivers/net/wireless/mediatek/mt76/mt7925/mac.c +1 -1
@@ -145,7 +145,7 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev) rssi[0 ] =to_rssi (GENMASK (7 ,0 ), val); rssi[1 ] =to_rssi (GENMASK (15 ,8 ), val); rssi[2 ] =to_rssi (GENMASK (23 ,16 ), val); - rssi[3 ] =to_rssi (GENMASK (31 ,14 ), val); + rssi[3 ] =to_rssi (GENMASK (31 ,24 ), val); mlink->ack_signal =mt76_rx_signal (msta->vif->phy->mt76->antenna_mask, rssi);
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +1 -1
@@ -166,7 +166,7 @@ static void mt7996_mac_sta_poll(struct mt7996_dev *dev) rssi[0 ] =to_rssi (GENMASK (7 ,0 ), val); rssi[1 ] =to_rssi (GENMASK (15 ,8 ), val); rssi[2 ] =to_rssi (GENMASK (23 ,16 ), val); - rssi[3 ] =to_rssi (GENMASK (31 ,14 ), val); + rssi[3 ] =to_rssi (GENMASK (31 ,24 ), val); mlink =rcu_dereference (msta->vif->mt76.link[wcid->link_id]);if (mlink) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 887/1815 wifi: mt76: fix stranded frames in mt76_txq_schedule_pending
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 422dd2db28ae27c35a586acd9ad482f30000c090 ]
A wcid is added to phy->tx_list whenever either tx_pending or tx_offchannel becomes non-empty, but the requeue check after a partial schedule required BOTH queues to be non-empty. When mt76_txq_schedule_pending_wcid() returns -1 (queue stopped or MT76_RESET) it leaves frames in tx_pending while tx_offchannel is empty, so the wcid is dropped from every scheduling list and its frames stall until the next mt76_tx() for that wcid or wcid cleanup. This strands EAPOL/mgmt/nullfunc frames under momentary queue-full or across scan/channel-switch, causing association and 4-way-handshake timeouts.
Requeue when either queue still holds frames, matching the enqueue condition.
--- drivers/net/wireless/mediatek/mt76/tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/tx.c +2 -2
@@ -682,8 +682,8 @@ void mt76_txq_schedule_pending(struct mt76_phy *phy) ret =mt76_txq_schedule_pending_wcid (phy, wcid, &wcid->tx_pending);spin_lock (&phy->tx_lock); -if (!skb_queue_empty (&wcid->tx_pending) && - !skb_queue_empty (&wcid->tx_offchannel) && +if ((!skb_queue_empty (&wcid->tx_pending) || + !skb_queue_empty (&wcid->tx_offchannel)) &&list_empty (&wcid->tx_list))list_add_tail (&wcid->tx_list, &phy->tx_list); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 888/1815 wifi: mt76: fix uninitialised RXDMAD_C descriptor info
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit d3ecac68f73b11828e72eaf7952a9beb5caea12b ]
Unlike other WED-RRO queues, RXDMAD_C frames continue into the skb build path, but mt76_dma_get_buf() skips the desc->info read for RRO queues, so the uninitialised on-stack info was stored into skb->cb and passed to rx_skb(); initialise it to zero.
--- drivers/net/wireless/mediatek/mt76/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/dma.c +1 -1
@@ -1002,7 +1002,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)while (done < budget) {bool drop = false; -u32 info; +u32 info =0 ;if (check_ddone) {if (q->tail == dma_idx)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 889/1815 wifi: mt76: fix RXDMAD_C buffer recycling race
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit e1f97c10a4ec2b9db69a134b757304399ca903ce ]
The RXDMAD_C buffers come from the RRO data queues' page pools, which are bound to a different NAPI, so the direct page-pool recycle used here could race the owning NAPI; take the non-direct path as is already done for WED RX queues.
--- drivers/net/wireless/mediatek/mt76/dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/dma.c +2 -1
@@ -990,7 +990,8 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)struct sk_buff *skb;unsigned char *data;bool check_ddone = false; -bool allow_direct = !mt76_queue_is_wed_rx (q); +bool allow_direct = !mt76_queue_is_wed_rx (q) && + !mt76_queue_is_wed_rro_rxdmad_c (q);bool more; if ((q->flags & MT_QFLAG_WED_RRO_EN) ||
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 890/1815 wifi: mt76: mt7915: poll the correct SLP CTRL register for the second adie
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit dd59a6126a8f1bd52bf6bd057bf0c8307f76a74b ]
The clock enable path for the second adie sets MT_ADIE_SLP_CTRL_CK0(1) but polled the busy bit of MT_ADIE_SLP_CTRL_CK0(0), so dual-adie bring-up could proceed before the adie1 clock was stable.
--- drivers/net/wireless/mediatek/mt76/mt7915/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/soc.c +1 -1
@@ -908,7 +908,7 @@ static void mt7986_wmac_clock_enable(struct mt7915_dev *dev, u32 adie_type)read_poll_timeout (mt76_rr, cur, !(cur &MT_SLP_CTRL_BSY_MASK ),USEC_PER_MSEC ,50 *USEC_PER_MSEC , false, - dev,MT_ADIE_SLP_CTRL_CK0 (0 )); + dev,MT_ADIE_SLP_CTRL_CK0 (1 )); }mt76_wmac_spi_unlock (dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 891/1815 wifi: mt76: check txfree done event on the WED hw path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rex Lu <[email protected]>
[ Upstream commit 3310e71a74b176d3613dfb42b6bc630d99e90cbb ]
Check the txfree done event DW1 bit 15 when WED is enabled, to avoid the driver reading a txfree done event before WED has finished reading it. No need to check this flag on WED v2, otherwise SER will occur.
The bit position was previously defined as MT_DMA_CTL_BURST, which is unused; rename it to match its function on the txfree ring.
--- drivers/net/wireless/mediatek/mt76/dma.c | 9 +++++++++ drivers/net/wireless/mediatek/mt76/dma.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/dma.c +9 -0
@@ -608,6 +608,15 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush, q->desc[idx].ctrl |=cpu_to_le32 (MT_DMA_CTL_DMA_DONE ); else if (!(q->desc[idx].ctrl & cpu_to_le32(MT_DMA_CTL_DMA_DONE)))return NULL ; +#ifdef CONFIG_NET_MEDIATEK_SOC_WED +/* on WED v3 the M_DONE bit signals that WED is done reading +* the txfree descriptor; WED v2 does not set it +*/ + else if (dev->mmio.wed.version > 2 && + mt76_queue_is_wed_tx_free(q) && + !(q->desc[idx].ctrl & cpu_to_le32(MT_DMA_CTL_M_DONE))) +return NULL ; +#endif } done: q->tail = (q->tail +1 ) % q->ndesc;
drivers/net/wireless/mediatek/mt76/dma.h +1 -1
@@ -11,7 +11,7 @@#define MT_DMA_CTL_SD_LEN1 GENMASK(13, 0)#define MT_DMA_CTL_LAST_SEC1 BIT(14) -#define MT_DMA_CTL_BURST BIT(15) +#define MT_DMA_CTL_M_DONE BIT(15)#define MT_DMA_CTL_SD_LEN0 GENMASK(29, 16)#define MT_DMA_CTL_LAST_SEC0 BIT(30)#define MT_DMA_CTL_DMA_DONE BIT(31)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 892/1815 wifi: mt76: fix HE DCM max-RU capability encoding
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit cbeed7096794f748d16c78cd9d3e0004420d1e9d ]
sta_rec_he.dcm_rx_max_nss was assigned twice: the second assignment, sourced from HE PHY capability byte 8 (DCM max RU), overwrote the RX-NSS value and left dcm_max_ru at zero. Every associated HE station advertising DCM support was configured in firmware with a wrong dcm_rx_max_nss and a zero dcm_max_ru. Store the DCM max-RU value in dcm_max_ru as intended.
The same copy-paste error existed in both the shared connac2 path and the mt7915 path.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 -1
@@ -757,7 +757,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)HE_PHY (CAP3_DCM_MAX_CONST_RX_MASK , elem->phy_cap_info[3 ]); he->dcm_rx_max_nss =HE_PHY (CAP3_DCM_MAX_RX_NSS_2 , elem->phy_cap_info[3 ]); - he->dcm_rx_max_nss = + he->dcm_max_ru =HE_PHY (CAP8_DCM_MAX_RU_MASK , elem->phy_cap_info[8 ]); he->pkt_ext =2 ;
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +1 -1
@@ -902,7 +902,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,HE_PHY (CAP3_DCM_MAX_CONST_RX_MASK , elem->phy_cap_info[3 ]); he->dcm_rx_max_nss =HE_PHY (CAP3_DCM_MAX_RX_NSS_2 , elem->phy_cap_info[3 ]); - he->dcm_rx_max_nss = + he->dcm_max_ru =HE_PHY (CAP8_DCM_MAX_RU_MASK , elem->phy_cap_info[8 ]); he->pkt_ext =2 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 893/1815 wifi: mt76: mt7996: bound TLV walk in mt7996_mcu_get_chip_config
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 44af52467e72094351a362bf69effd52f1d9c186 ]
The response TLV loop advanced by tlv->len without a minimum, so a theoretical firmware response containing a zero-length TLV could spin forever, hanging the CPU during device probe.
The u32 payload was also read without bounds checking. Reject a short fixed field, stop on a TLV whose length underruns the header or overruns the skb.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +13 -3
@@ -4445,21 +4445,31 @@ int mt7996_mcu_get_chip_config(struct mt7996_dev *dev, u32 *cap)return ret;/* fixed field */ +if (skb->len <4 ) { +dev_kfree_skb (skb); +return -EINVAL ; + }skb_pull (skb,4 ); buf = skb->data; -while (buf - skb->data < skb->len) { +while (buf - skb->data +sizeof (struct tlv ) <= skb->len) {struct tlv *tlv = (struct tlv *)buf; +u16 tlv_len =le16_to_cpu (tlv->len); + +if (tlv_len <sizeof (*tlv) || + tlv_len > skb->len - (buf - skb->data)) +break ;switch (le16_to_cpu (tlv->tag)) {case UNI_EVENT_CHIP_CONFIG_EFUSE_VERSION : - *cap =le32_to_cpu (*(__le32 *)(buf +sizeof (*tlv))); +if (tlv_len >=sizeof (*tlv) +sizeof (__le32)) + *cap =le32_to_cpu (*(__le32 *)(buf +sizeof (*tlv)));break ;default :break ; } - buf +=le16_to_cpu (tlv->len); + buf += tlv_len; }dev_kfree_skb (skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 894/1815 wifi: mt76: fix out-of-bounds access in mmio copy helpers
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 6689b4a65e88d7b019e687fa9d6943ca070f3e43 ]
mt76_mmio_write_copy() and mt76_mmio_read_copy() iterate up to ALIGN(len, 4), so a length that is not a multiple of four reads past the source buffer (write_copy) or writes past the destination (read_copy). Copy the aligned body in the loop and handle the remaining tail through a 4-byte bounce buffer, keeping the register access width unchanged.
--- drivers/net/wireless/mediatek/mt76/mmio.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mmio.c +16 -2
@@ -35,9 +35,16 @@ static void mt76_mmio_write_copy(struct mt76_dev *dev, u32 offset, {int i; -for (i =0 ; i <ALIGN (len,4 ); i +=4 ) +for (i =0 ; i +4 <= len; i +=4 )writel (get_unaligned_le32 (data + i), dev->mmio.regs + offset + i); + +if (i < len) { +u8 tmp[4 ] = {}; + +memcpy (tmp, data + i, len - i); +writel (get_unaligned_le32 (tmp), dev->mmio.regs + offset + i); + } } static void mt76_mmio_read_copy(struct mt76_dev *dev, u32 offset,
@@ -45,9 +52,16 @@ static void mt76_mmio_read_copy(struct mt76_dev *dev, u32 offset, {int i; -for (i =0 ; i <ALIGN (len,4 ); i +=4 ) +for (i =0 ; i +4 <= len; i +=4 )put_unaligned_le32 (readl (dev->mmio.regs + offset + i), data + i); + +if (i < len) { +u8 tmp[4 ]; + +put_unaligned_le32 (readl (dev->mmio.regs + offset + i), tmp); +memcpy (data + i, tmp, len - i); + } } static int mt76_mmio_wr_rp(struct mt76_dev *dev, u32 base,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 895/1815 wifi: mt76: mt7915: unwind state on add_interface failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 2fb6480c52f611338e1b0abe5e6219be1fc9ab75 ]
When mt76_wcid_alloc() fails, mt7915_add_interface() returned without clearing the vif_mask/omac_mask bits it had already set, without removing the firmware dev info added earlier, and without clearing a monitor_vif pointer to the vif mac80211 is about to free. mac80211 does not call remove_interface() for a failed add, so the indices and firmware dev entry leaked permanently and testmode could dereference the stale monitor_vif. Add a proper error unwind.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +11 -1
@@ -249,7 +249,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw, idx =mt76_wcid_alloc (dev->mt76.wcid_mask,mt7915_wtbl_size (dev));if (idx <0 ) { ret = -ENOSPC ; - goto out; + goto err; }INIT_LIST_HEAD (&mvif->sta.rc_list);
@@ -277,7 +277,17 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,mt7915_mcu_add_sta (dev, vif,NULL ,CONN_STATE_PORT_SECURE , true);rcu_assign_pointer (dev->mt76.wcid[idx], &mvif->sta.wcid); +mutex_unlock (&dev->mt76.mutex); + +return 0 ; + +err: + dev->mt76.vif_mask &= ~BIT_ULL (mvif->mt76.idx); + phy->omac_mask &= ~BIT_ULL (mvif->mt76.omac_idx); +mt7915_mcu_add_dev_info (phy, vif, false); out: +if (phy->monitor_vif == vif) + phy->monitor_vif =NULL ;mutex_unlock (&dev->mt76.mutex);return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 896/1815 wifi: mt76: mt7996: hold dev->mt76.mutex while disabling tx worker in SER
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 6190db312b8230813f529f014b26247c6d9800d0 ]
mt7996_mac_reset_work() parked the tx worker and disabled the RX/TX NAPIs before taking dev->mt76.mutex. mt76_worker_disable()/_enable() are plain kthread park/unpark, not refcounted, and __mt76_set_channel() toggles the same worker and the MT76_RESET bit under the mutex. An L1 SER racing a channel switch could therefore have the worker unparked and MT76_RESET cleared while the reset path resets the DMA rings, corrupting descriptors or tokens. Take the mutex before disabling the worker, as mt7915 does.
--- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +2 -2
@@ -2575,6 +2575,8 @@ void mt7996_mac_reset_work(struct work_struct *work)cancel_delayed_work_sync (&phy->mt76->mac_work); } +mutex_lock (&dev->mt76.mutex); +mt76_worker_disable (&dev->mt76.tx_worker);mt76_for_each_q_rx (&dev->mt76, i) { if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
@@ -2592,8 +2594,6 @@ void mt7996_mac_reset_work(struct work_struct *work) }napi_disable (&dev->mt76.tx_napi); -mutex_lock (&dev->mt76.mutex); -mt76_wr (dev,MT_MCU_INT_EVENT ,MT_MCU_INT_EVENT_DMA_STOPPED );if (mt7996_wait_reset_state (dev,MT_MCU_CMD_RESET_DONE )) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 897/1815 wifi: mt76: decode the full VHT Rx STBC capability field
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit e8b76a6e0d04d13ae55dc746a270f382825c395b ]
The Rx STBC subfield of the VHT capabilities is a 3-bit cumulative value, but the driver only tested the RXSTBC_1 bit when advertising the peer's Rx STBC support to firmware. A peer reporting Rx STBC of 2, 3 or 4 has that bit clear, so STBC was never used towards it. Test the full IEEE80211_VHT_CAP_RXSTBC_MASK, matching the HT path.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +1 -1
@@ -1625,7 +1625,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, cap |=STA_CAP_VHT_SGI_160 ;if (sta->deflink.vht_cap.cap &IEEE80211_VHT_CAP_TXSTBC ) cap |=STA_CAP_VHT_TX_STBC ; -if (sta->deflink.vht_cap.cap &IEEE80211_VHT_CAP_RXSTBC_1 ) +if (sta->deflink.vht_cap.cap &IEEE80211_VHT_CAP_RXSTBC_MASK ) cap |=STA_CAP_VHT_RX_STBC ;if (mvif->cap.vht_ldpc && (sta->deflink.vht_cap.cap &IEEE80211_VHT_CAP_RXLDPC ))
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +1 -1
@@ -2483,7 +2483,7 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev, cap |=STA_CAP_VHT_SGI_160 ;if (link_sta->vht_cap.cap &IEEE80211_VHT_CAP_TXSTBC ) cap |=STA_CAP_VHT_TX_STBC ; -if (link_sta->vht_cap.cap &IEEE80211_VHT_CAP_RXSTBC_1 ) +if (link_sta->vht_cap.cap &IEEE80211_VHT_CAP_RXSTBC_MASK ) cap |=STA_CAP_VHT_RX_STBC ;if ((vif->type !=NL80211_IFTYPE_AP || link_conf->vht_ldpc) && (link_sta->vht_cap.cap &IEEE80211_VHT_CAP_RXLDPC ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 898/1815 wifi: mt76: fix ER-SU 106-tone RU check in RX rate decode
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 29fe963d86e434b32d07958a6785be724e45c787 ]
MT_PHY_TYPE_HE_EXT_SU is an enum value (9), not a bit flag, so the bitwise test "*mode & MT_PHY_TYPE_HE_EXT_SU" also matches OFDM, HT-GF and several HE/EHT modes. Only genuine ER-SU should be classified as a 106-tone RU at 40 MHz; use an equality comparison.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +1 -1
@@ -1114,7 +1114,7 @@ int mt76_connac2_mac_fill_rx_rate(struct mt76_dev *dev,case IEEE80211_STA_RX_BW_20 :break ;case IEEE80211_STA_RX_BW_40 : -if (*mode &MT_PHY_TYPE_HE_EXT_SU && +if (*mode ==MT_PHY_TYPE_HE_EXT_SU && (idx &MT_PRXV_TX_ER_SU_106T )) { status->bw =RATE_INFO_BW_HE_RU ; status->he_ru =
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +1 -1
@@ -349,7 +349,7 @@ mt7996_mac_fill_rx_rate(struct mt7996_dev *dev,case IEEE80211_STA_RX_BW_20 :break ;case IEEE80211_STA_RX_BW_40 : -if (*mode &MT_PHY_TYPE_HE_EXT_SU && +if (*mode ==MT_PHY_TYPE_HE_EXT_SU && (idx &MT_PRXV_TX_ER_SU_106T )) { status->bw =RATE_INFO_BW_HE_RU ; status->he_ru =
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 899/1815 wifi: mt76: mt7996: reserve space for the CSA-abort countdown TLV
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 50c66bab321140c49aa2ed779a3ec9d2f085b458 ]
When a CSA countdown is active, mt7996_mcu_beacon_cntdwn() emits two bss_bcn_cntdwn_tlv entries (the CSA countdown and the CCA-abort BCC), but MT7996_BEACON_UPDATE_SIZE only reserved one. With MBSSID enabled and a near-maximum beacon template the extra 8 bytes could push the offload command past MT7996_MAX_BSS_OFFLOAD_SIZE and trigger skb_over_panic(). Reserve room for both countdown TLVs.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.h +1 -1
@@ -917,7 +917,7 @@ enum {#define MT7996_BEACON_UPDATE_SIZE (sizeof(struct bss_req_hdr) + \ sizeof(struct bss_bcn_content_tlv) + \ 4 + MT_TXD_SIZE + \ - sizeof(struct bss_bcn_cntdwn_tlv) + \ + sizeof(struct bss_bcn_cntdwn_tlv) * 2 + \ sizeof(struct bss_bcn_mbss_tlv))#define MT7996_MAX_BSS_OFFLOAD_SIZE 2048#define MT7996_MAX_BEACON_SIZE (MT7996_MAX_BSS_OFFLOAD_SIZE - \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 900/1815 wifi: mt76: mt7996: dont leak MLD group index on remap alloc failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 151a6cf0d12f5d333b93b634dbe5834ea0b77ce7 ]
mt7996_change_vif_links() sets the mld_idx_mask group bit before allocating the remap index. If the remap allocation fails it jumped to the exit without clearing that bit, permanently consuming one of the 16 MLD group slots. Release the group bit on the error path.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +1 -0
@@ -2458,6 +2458,7 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, idx =get_free_idx (dev->mld_remap_idx_mask,0 ,15 ) -1 ;if (idx <0 ) { + dev->mld_idx_mask &= ~BIT_ULL (mvif->mld_group_idx); ret = -ENOSPC ; goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 901/1815 wifi: mt76: cancel reset and rc work on device unregister
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit e995d3dccc9d980af13a60ad37409ed1561f9eeb ]
Both drivers cancelled dump_work on unregister but left reset_work and rc_work to be flushed only by destroy_workqueue() in mt76_free_device(), which runs after the hw is unregistered and the hardware stopped. A reset_work that fires in that window calls ieee80211_restart_hw() and re-arms mac_work on an unregistered hw, and rc_work touches station state being torn down. Cancel both up front, alongside dump_work.
--- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt7996/init.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/init.c +2 -0
@@ -1295,6 +1295,8 @@ int mt7915_register_device(struct mt7915_dev *dev)void mt7915_unregister_device (struct mt7915_dev *dev) {cancel_work_sync (&dev->dump_work); +cancel_work_sync (&dev->reset_work); +cancel_work_sync (&dev->rc_work);mt7915_unregister_ext_phy (dev);mt7915_coredump_unregister (dev);mt7915_unregister_thermal (&dev->phy);
drivers/net/wireless/mediatek/mt76/mt7996/init.c +2 -0
@@ -1803,6 +1803,8 @@ void mt7996_unregister_device(struct mt7996_dev *dev) {cancel_work_sync (&dev->dump_work);cancel_work_sync (&dev->wed_rro.work); +cancel_work_sync (&dev->reset_work); +cancel_work_sync (&dev->rc_work);mt7996_unregister_phy (mt7996_phy3 (dev));mt7996_unregister_phy (mt7996_phy2 (dev));mt7996_unregister_thermal (&dev->phy);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 902/1815 wifi: mt76: report data NSS for STBC frames in RX rate decode
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 4238535e85d41abe6fad545bbcdb3d91d191637f ]
The RX rate decoder set status->nss straight from the PRXV NSTS field, which for STBC frames is twice the data spatial-stream count. cfg80211 then reported a doubled RX bitrate in station dumps and radiotap. Halve nss for STBC, matching the TX status path.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 4 ++++ 2 files changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +4 -0
@@ -1069,6 +1069,10 @@ int mt76_connac2_mac_fill_rx_rate(struct mt76_dev *dev, bw =FIELD_GET (MT_CRXV_FRAME_MODE , v2); } +/* the hardware reports NSTS; report the data NSS for STBC frames */ +if (stbc && nss >1 ) + nss >>=1 ; +switch (*mode) {case MT_PHY_TYPE_CCK : cck = true;
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +4 -0
@@ -294,6 +294,10 @@ mt7996_mac_fill_rx_rate(struct mt7996_dev *dev, dcm =FIELD_GET (MT_PRXV_DCM , v2); bw =FIELD_GET (MT_PRXV_FRAME_MODE , v2); +/* the hardware reports NSTS; report the data NSS for STBC frames */ +if (stbc && nss >1 ) + nss >>=1 ; +switch (*mode) {case MT_PHY_TYPE_CCK : cck = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 903/1815 wifi: mt76: mt7915: use little-endian for bss_info_ra wire fields
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 04280d0a56be4264720e7b205daaa332c715e5ec ]
train_up_high_thres, train_up_rule_rssi and low_traffic_thres were declared as host-native short in a firmware-facing TLV and assigned host-order constants, so on a big-endian host the firmware received byte-swapped rate-adaptation thresholds. Declare them __le16 and convert with cpu_to_le16().
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 6 +++--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +3 -3
@@ -576,9 +576,9 @@ mt7915_mcu_bss_ra_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, ra->rx_streams = max_nss; ra->algo =4 ; ra->train_up_rule =2 ; - ra->train_up_high_thres =110 ; - ra->train_up_rule_rssi =-70 ; - ra->low_traffic_thres =2 ; + ra->train_up_high_thres =cpu_to_le16 (110 ); + ra->train_up_rule_rssi =cpu_to_le16 (-70 ); + ra->low_traffic_thres =cpu_to_le16 (2 ); ra->phy_cap =cpu_to_le32 (0xfdf ); ra->interval =cpu_to_le32 (500 ); ra->fast_interval =cpu_to_le32 (100 );
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +3 -3
@@ -318,9 +318,9 @@ struct bss_info_ra {u8 antenna_idx;u8 train_up_rule;u8 rsv[3 ]; -unsigned short train_up_high_thres; -short train_up_rule_rssi; -unsigned short low_traffic_thres; +__le16 train_up_high_thres; +__le16 train_up_rule_rssi; +__le16 low_traffic_thres;__le16 max_phyrate;__le32 phy_cap;__le32 interval;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 904/1815 wifi: mt76: mt7996: add missing rdd_idx check when enabling background radar
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: StanleyYP Wang <[email protected]>
[ Upstream commit dbca5c4d29826cecd3185fb1ae2746205ab55127 ]
Add the missing rdd idx check (< 0) in mt7996_mcu_rdd_background_enable(). mt7996_get_rdd_idx() returns -1 for phys without 5 GHz support, and the negative index was passed to the RDD MCU command unchecked.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +3 -0
@@ -4023,6 +4023,9 @@ int mt7996_mcu_rdd_background_enable(struct mt7996_phy *phy,struct mt7996_dev *dev = phy->dev;int err, region, rdd_idx =mt7996_get_rdd_idx (phy, true); +if (rdd_idx <0 ) +return -EINVAL ; +if (!chandef) {/* disable offchain */ err =mt7996_mcu_rdd_cmd (dev,RDD_STOP , rdd_idx,0 );if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 905/1815 wifi: mt76: only consume the WO drop bit on WED v2 devices
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 1df54335590bb025c3bd706a9ba9c6e73a1d3000 ]
The RX path is handled by the WO MCU only on WED v2 hardware. On WED v3 the same buf1 bit does not carry drop information, so evaluating it there causes spurious RX drops.
--- drivers/net/wireless/mediatek/mt76/dma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/dma.c +6 -1
@@ -547,8 +547,13 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx, t->ptr =NULL ;mt76_put_rxwi (dev, t); -if (drop) +#ifdef CONFIG_NET_MEDIATEK_SOC_WED +/* the WO MCU owns the RX path only on WED v2, on newer +* versions this buf1 bit carries no drop information +*/ +if (drop && dev->mmio.wed.version ==2 ) *drop |= !!(buf1 &MT_DMA_CTL_WO_DROP ); +#endif }else { dma_sync_single_for_cpu(dev->dma_dev, e->dma_addr[0], SKB_WITH_OVERHEAD(q->buf_size),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 906/1815 ACPI: processor: Unregister cpufreq notifier on init failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Can Peng <[email protected]>
[ Upstream commit 06f32dd67e6b23a05bef0d8183c5335af91c0c3b ]
acpi_processor_driver_init() registers the cpufreq policy notifier before registering the ACPI processor driver and setting up CPU hotplug state.
If driver_register() or cpuhp_setup_state() fails, the error path only unregisters the ACPI processor driver and the idle driver. The cpufreq notifier remains registered even though initialization failed.
Mirror the module exit path on the init failure path and unregister the cpufreq notifier when it has been registered.
--- drivers/acpi/processor_driver.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/acpi/processor_driver.c +6 -0
@@ -285,6 +285,12 @@ static int __init acpi_processor_driver_init(void) unregister_idle_drv:acpi_processor_unregister_idle_driver (); +if (acpi_processor_cpufreq_init) { +cpufreq_unregister_notifier (&acpi_processor_notifier_block, +CPUFREQ_POLICY_NOTIFIER ); + acpi_processor_cpufreq_init = false; + } +return result; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 907/1815 drm/msm/dpu: Fix DMA SSPP REC block offsets on DPU v13
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongxing Mou <[email protected]>
[ Upstream commit 8834f5494ab5e169b1c0fb4cbcb5464fd81d1ed0 ]
On DPU v13, the DMA SSPP REC0 and REC1 blocks are located at offsets 0x1000 and 0x3000 from the SSPP common base.
The existing DMA SSPP sub-block descriptor does not initialize sspp_rec0_blk and sspp_rec1_blk, causing REC register accesses to be performed at offset 0 instead of the corresponding REC block. As a result, DMA SSPP pipes are not programmed correctly and fail to produce output.
Introduce a DPU v13 specific DMA SSPP descriptor with the correct REC block offsets and use it for all DMA SSPPs in the Kaanapali catalog.
Patchwork: https://patchwork.freedesktop.org/patch/741230/
--- .../drm/msm/disp/dpu1/catalog/dpu_13_0_kaanapali.h | 12 ++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_13_0_kaanapali.h +6 -6
@@ -86,42 +86,42 @@ static const struct dpu_sspp_cfg kaanapali_sspp[] = { .name = "sspp_8", .id = SSPP_DMA0, .base = 0x97000, .len = 0x84, .features = DMA_SDM845_MASK_SDMA, - .sblk = &dpu_dma_sblk, + .sblk = &dpu_dma_sblk_v13, .xin_id = 1, .type = SSPP_TYPE_DMA, }, { .name = "sspp_9", .id = SSPP_DMA1, .base = 0xa0000, .len = 0x84, .features = DMA_SDM845_MASK_SDMA, - .sblk = &dpu_dma_sblk, + .sblk = &dpu_dma_sblk_v13, .xin_id = 5, .type = SSPP_TYPE_DMA, }, { .name = "sspp_10", .id = SSPP_DMA2, .base = 0xa9000, .len = 0x84, .features = DMA_SDM845_MASK_SDMA, - .sblk = &dpu_dma_sblk, + .sblk = &dpu_dma_sblk_v13, .xin_id = 9, .type = SSPP_TYPE_DMA, }, { .name = "sspp_11", .id = SSPP_DMA3, .base = 0xb2000, .len = 0x84, .features = DMA_SDM845_MASK_SDMA, - .sblk = &dpu_dma_sblk, + .sblk = &dpu_dma_sblk_v13, .xin_id = 13, .type = SSPP_TYPE_DMA, }, { .name = "sspp_12", .id = SSPP_DMA4, .base = 0xbb000, .len = 0x84, .features = DMA_CURSOR_SDM845_MASK_SDMA, - .sblk = &dpu_dma_sblk, + .sblk = &dpu_dma_sblk_v13, .xin_id = 14, .type = SSPP_TYPE_DMA, }, { .name = "sspp_13", .id = SSPP_DMA5, .base = 0xc4000, .len = 0x84, .features = DMA_CURSOR_SDM845_MASK_SDMA, - .sblk = &dpu_dma_sblk, + .sblk = &dpu_dma_sblk_v13, .xin_id = 15, .type = SSPP_TYPE_DMA, },
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +12 -0
@@ -303,6 +303,16 @@ static const u32 wb2_formats_rgb_yuv[] = { .num_formats = ARRAY_SIZE(plane_formats), \ } +#define _DMA_SBLK_V13 () \ + { \ + .sspp_rec0_blk = {.name = "sspp_rec0", \ + .base = 0x1000, .len = 0x180,}, \ + .sspp_rec1_blk = {.name = "sspp_rec1", \ + .base = 0x3000, .len = 0x180,}, \ + .format_list = plane_formats, \ + .num_formats = ARRAY_SIZE(plane_formats), \ + } +static const struct dpu_rotation_cfg dpu_rot_sc7280_cfg_v2 = { .rot_maxheight =1088 , .rot_num_formats =ARRAY_SIZE (rotation_v2_formats),
@@ -353,6 +363,8 @@ static const struct dpu_sspp_sub_blks dpu_rgb_sblk = _RGB_SBLK();static const struct dpu_sspp_sub_blks dpu_dma_sblk =_DMA_SBLK (); +static const struct dpu_sspp_sub_blks dpu_dma_sblk_v13 =_DMA_SBLK_V13 (); +/************************************************************* * MIXER sub blocks config *************************************************************/
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 908/1815 drm/msm: dont tear down KMS twice when KMS init fails
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 93c125e4ea98fb25f927ba5a334d85845127d667 ]
When priv->kms_init() (mdp4_kms_init() / mdp5_kms_init()) fails partway through, both display drivers already tear their KMS state down via mdp4_destroy() / mdp5_kms_destroy() before returning the error. The common error path in msm_drm_init() then runs msm_drm_uninit() -> msm_drm_kms_uninit(), which tries to destroy the very same KMS a second time, which causes a use-after-free crash.
Bring MDP4/MDP5 in line with the DPU driver whose dpu_kms_init() doesn't perform error cleanup on the failure. Let the common path own the cleanup, instead of freeing the KMS from their error paths.
The crash trace for the reference:
__lock_acquire from lock_acquire (kernel/locking/lockdep.c:5906 kernel/locking/lockdep.c:5863) lock_acquire from touch_wq_lockdep_map (kernel/workqueue.c:4094 (discriminator 1)) touch_wq_lockdep_map from __flush_workqueue (kernel/workqueue.c:4136)
__flush_workqueue from msm_drm_kms_uninit (drivers/gpu/drm/msm/msm_kms.c:243 (discriminator 33)) msm_drm_kms_uninit from msm_drm_uninit (drivers/gpu/drm/msm/msm_drv.c:93)
msm_drm_uninit from msm_drm_init (drivers/gpu/drm/msm/msm_drv.c:184)
msm_drm_init from try_to_bring_up_aggregate_device (drivers/base/component.c:249 drivers/base/component.c:227) try_to_bring_up_aggregate_device from __component_add (drivers/base/component.c:269 drivers/base/component.c:748) __component_add from dsi_host_attach (drivers/gpu/drm/msm/dsi/dsi_host.c:1739)
dsi_host_attach from mipi_dsi_attach (drivers/gpu/drm/drm_mipi_dsi.c:383)
mipi_dsi_attach from sharp_nt_panel_probe (drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c:247)
Patchwork: https://patchwork.freedesktop.org/patch/742068/
--- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 22 ++++++++-------------- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 +++-------- 2 files changed, 11 insertions(+), 22 deletions(-)
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +8 -14
@@ -398,7 +398,7 @@ static int mdp4_kms_init(struct drm_device *dev) ret =mdp_kms_init (&mdp4_kms->base, &kms_funcs);if (ret) {DRM_DEV_ERROR (dev->dev,"failed to init kms\n" ); - goto fail; +return ret; } kms = priv->kms;
@@ -409,7 +409,7 @@ static int mdp4_kms_init(struct drm_device *dev) ret =regulator_enable (mdp4_kms->vdd);if (ret) {DRM_DEV_ERROR (dev->dev,"failed to enable regulator vdd: %d\n" , ret); - goto fail; +return ret; } }
@@ -421,7 +421,7 @@ static int mdp4_kms_init(struct drm_device *dev)DRM_DEV_ERROR (dev->dev,"unexpected MDP version: v%d.%d\n" , major, minor); ret = -ENXIO ; - goto fail; +return ret; } mdp4_kms->rev = minor;
@@ -430,7 +430,7 @@ static int mdp4_kms_init(struct drm_device *dev)if (!mdp4_kms->lut_clk) {DRM_DEV_ERROR (dev->dev,"failed to get lut_clk\n" ); ret = -ENODEV ; - goto fail; +return ret; }clk_set_rate (mdp4_kms->lut_clk, max_clk); }
@@ -452,7 +452,7 @@ static int mdp4_kms_init(struct drm_device *dev) vm =msm_kms_init_vm (mdp4_kms->dev,NULL );if (IS_ERR (vm)) { ret =PTR_ERR (vm); - goto fail; +return ret; } kms->vm = vm;
@@ -460,7 +460,7 @@ static int mdp4_kms_init(struct drm_device *dev) ret =modeset_init (mdp4_kms);if (ret) {DRM_DEV_ERROR (dev->dev,"modeset_init failed: %d\n" , ret); - goto fail; +return ret; } mdp4_kms->blank_cursor_bo =msm_gem_new (dev,SZ_16K ,MSM_BO_WC |MSM_BO_SCANOUT );
@@ -468,14 +468,14 @@ static int mdp4_kms_init(struct drm_device *dev) ret =PTR_ERR (mdp4_kms->blank_cursor_bo);DRM_DEV_ERROR (dev->dev,"could not allocate blank-cursor bo: %d\n" , ret); mdp4_kms->blank_cursor_bo =NULL ; - goto fail; +return ret; } ret =msm_gem_get_and_pin_iova (mdp4_kms->blank_cursor_bo, kms->vm, &mdp4_kms->blank_cursor_iova);if (ret) {DRM_DEV_ERROR (dev->dev,"could not pin blank-cursor bo: %d\n" , ret); - goto fail; +return ret; } dev->mode_config.min_width =0 ;
@@ -484,12 +484,6 @@ static int mdp4_kms_init(struct drm_device *dev) dev->mode_config.max_height =2048 ;return 0 ; - -fail: -if (kms) -mdp4_destroy (kms); - -return ret; }static const struct dev_pm_ops mdp4_pm_ops = {
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +3 -8
@@ -517,7 +517,7 @@ static int mdp5_kms_init(struct drm_device *dev) ret =mdp_kms_init (&mdp5_kms->base, &kms_funcs);if (ret) {DRM_DEV_ERROR (&pdev->dev,"failed to init kms\n" ); - goto fail; +return ret; } config =mdp5_cfg_get_config (mdp5_kms->cfg);
@@ -540,7 +540,7 @@ static int mdp5_kms_init(struct drm_device *dev) vm =msm_kms_init_vm (mdp5_kms->dev, pdev->dev.parent);if (IS_ERR (vm)) { ret =PTR_ERR (vm); - goto fail; +return ret; } kms->vm = vm;
@@ -550,7 +550,7 @@ static int mdp5_kms_init(struct drm_device *dev) ret =modeset_init (mdp5_kms);if (ret) {DRM_DEV_ERROR (&pdev->dev,"modeset_init failed: %d\n" , ret); - goto fail; +return ret; } dev->mode_config.min_width =0 ;
@@ -562,11 +562,6 @@ static int mdp5_kms_init(struct drm_device *dev) dev->vblank_disable_immediate = true;return 0 ; -fail: -if (kms) -mdp5_kms_destroy (kms); - -return ret; }static void mdp5_destroy (struct mdp5_kms *mdp5_kms)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 909/1815 drm/msm/dp: reject YUV420-only modes without VSC SDP support
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 684f95fb4e9ad10aac39fbb1fa7592a59d7f54ea ]
DP conveys YUV 420 colorimetry through a VSC SDP. A sink that advertises a mode as YUV-420-only therefore cannot be driven at all unless the panel supports VSC SDP, yet msm_dp_bridge_mode_valid() only used the VSC SDP capability to decide whether to halve the pixel clock, otherwise letting such modes through to be validated (and possibly accepted) at the full RGB clock the sink cannot display.
Reject 420-only modes with MODE_NO_420 when the panel does not support VSC SDP. With those modes filtered out, being a 420-only mode implies VSC SDP support, so the YUV-420 test reduces to drm_mode_is_420_only(): drop msm_dp_is_yuv_420_enabled() and call the DRM helper directly at its two callers (the DPU encoder already has the connector from the atomic state).
Patchwork: https://patchwork.freedesktop.org/patch/741713/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 +-- drivers/gpu/drm/msm/dp/dp_display.c | 28 +++++++++------------ drivers/gpu/drm/msm/msm_drv.h | 8 ------ 3 files changed, 13 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -2
@@ -710,8 +710,7 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,if (fb &&MSM_FORMAT_IS_YUV (msm_framebuffer_format (fb))) topology->num_cdm++; }else if (disp_info->intf_type ==INTF_DP ) { -if (msm_dp_is_yuv_420_enabled (priv->kms->dp[disp_info->h_tile_instance[0 ]], - adj_mode)) +if (drm_mode_is_420_only (&connector->display_info, adj_mode)) topology->num_cdm++; } }
drivers/gpu/drm/msm/dp/dp_display.c +12 -16
@@ -698,6 +698,7 @@ enum drm_mode_status msm_dp_bridge_mode_valid(struct drm_bridge *bridge,u32 mode_rate_khz =0 , supported_rate_khz =0 , mode_bpp =0 ;struct msm_dp *dp;int mode_pclk_khz = mode->clock; +bool is_yuv_420; dp =to_dp_bridge (bridge)->msm_dp_display;
@@ -709,9 +710,16 @@ enum drm_mode_status msm_dp_bridge_mode_valid(struct drm_bridge *bridge, msm_dp_display = container_of(dp, struct msm_dp_display_private, msm_dp_display); link_info = &msm_dp_display->panel->link_info; -if ((drm_mode_is_420_only (&dp->connector->display_info, mode) && - msm_dp_display->panel->vsc_sdp_supported) || -msm_dp_wide_bus_available (dp)) + is_yuv_420 =drm_mode_is_420_only (&dp->connector->display_info, mode); + +/* +* YUV 420 is carried over DP by signalling the colorimetry through a +* VSC SDP, so a 420-only mode cannot be driven without VSC SDP support. +*/ +if (is_yuv_420 && !msm_dp_display->panel->vsc_sdp_supported) +return MODE_NO_420 ; + +if (is_yuv_420 ||msm_dp_wide_bus_available (dp)) mode_pclk_khz /=2 ;if (mode_pclk_khz >DP_MAX_PIXEL_CLK_KHZ )
@@ -1277,22 +1285,10 @@ void __exit msm_dp_unregister(void)platform_driver_unregister (&msm_dp_display_driver); } -bool msm_dp_is_yuv_420_enabled (const struct msm_dp *msm_dp_display, -const struct drm_display_mode *mode) -{ -struct msm_dp_display_private *dp; -const struct drm_display_info *info; - - dp = container_of(msm_dp_display, struct msm_dp_display_private, msm_dp_display); - info = &msm_dp_display->connector->display_info; - -return dp->panel->vsc_sdp_supported &&drm_mode_is_420_only (info, mode); -} -bool msm_dp_needs_periph_flush (const struct msm_dp *msm_dp_display,const struct drm_display_mode *mode) { -return msm_dp_is_yuv_420_enabled (msm_dp_display, mode); +return drm_mode_is_420_only (&msm_dp_display->connector->display_info, mode); }bool msm_dp_wide_bus_available (const struct msm_dp *msm_dp_display)
drivers/gpu/drm/msm/msm_drv.h +0 -8
@@ -356,8 +356,6 @@ void __exit msm_dp_unregister(void);int msm_dp_modeset_init (struct msm_dp *dp_display,struct drm_device *dev,struct drm_encoder *encoder,bool yuv_supported);void msm_dp_snapshot (struct msm_disp_state *disp_state,struct msm_dp *dp_display); -bool msm_dp_is_yuv_420_enabled (const struct msm_dp *dp_display, -const struct drm_display_mode *mode);bool msm_dp_needs_periph_flush (const struct msm_dp *dp_display,const struct drm_display_mode *mode);bool msm_dp_wide_bus_available (const struct msm_dp *dp_display);
@@ -382,12 +380,6 @@ static inline void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm { } -static inline bool msm_dp_is_yuv_420_enabled (const struct msm_dp *dp_display, -const struct drm_display_mode *mode) -{ -return false; -} -static inline bool msm_dp_needs_periph_flush (const struct msm_dp *dp_display,const struct drm_display_mode *mode) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 910/1815 drm/msm/dp: do not reject wide-bus modes while a YUV420 mode is active
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit bd926e62d355879133452bc3889447f8e89757f2 ]
msm_dp_bridge_mode_valid() halves the candidate mode's pixel clock when the sink either uses YUV 420 output or drives the wide bus, so that modes relying on those to stay under DP_MAX_PIXEL_CLK_KHZ are accepted. The wide bus part is queried through msm_dp_wide_bus_available(), which returns false whenever the currently committed mode uses YUV 420 output:
it inspects the stored msm_dp_mode.out_fmt_is_yuv_420 of the active mode, not the mode being validated.
Consequently, while a YUV 420 mode is active, an RGB mode that needs the wide bus to fit under DP_MAX_PIXEL_CLK_KHZ has its pixel clock left un-halved and is wrongly rejected as MODE_CLOCK_HIGH.
The candidate mode's YUV 420 status is already evaluated as is_yuv_420, and the wide bus is disabled precisely for YUV 420 output, so halving the pixel clock for either case is equivalent to halving it when the candidate is YUV 420 or the controller supports the wide bus. Test wide_bus_supported directly, so the decision no longer depends on the format of the active mode.
Patchwork: https://patchwork.freedesktop.org/patch/741740/
--- drivers/gpu/drm/msm/dp/dp_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dp/dp_display.c +1 -1
@@ -719,7 +719,7 @@ enum drm_mode_status msm_dp_bridge_mode_valid(struct drm_bridge *bridge,if (is_yuv_420 && !msm_dp_display->panel->vsc_sdp_supported)return MODE_NO_420 ; -if (is_yuv_420 ||msm_dp_wide_bus_available (dp)) +if (is_yuv_420 || msm_dp_display->wide_bus_supported) mode_pclk_khz /=2 ;if (mode_pclk_khz >DP_MAX_PIXEL_CLK_KHZ )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 911/1815 perf: arm_spe: Make wakeup range check overflow safe
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit fcc5eaea2d234162dfb8258372dd897bc2a1b862 ]
The current code checks whether the wakeup point is in the current writable range by comparing it with handle->head + handle->size.
The perf AUX head is a monotonically increasing index, so that addition can overflow when head is close to ULONG_MAX. In that case, a wakeup point which is still inside the free space range can be missed.
Use unsigned subtraction to compare the distance from head to wakeup against the handle->size. This can dismiss the issue when addition overflow.
This is unlikely to happen in practice, but the change makes the watermark check logically correct.
--- drivers/perf/arm_spe_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_spe_pmu.c +1 -1
@@ -577,7 +577,7 @@ static u64 __arm_spe_pmu_next_off(struct perf_output_handle *handle)* the page boundary following it. Keep the tail boundary if * that's lower. */ -if (handle->wakeup < (handle->head + handle->size) && head <= wakeup) +if ((handle->wakeup - handle->head) < handle->size && head <= wakeup) limit =min (limit,round_up (wakeup,PAGE_SIZE ));if (limit > head)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 912/1815 drm/msm/dpu: Drop sneaky dev_pm_opp_set_rate(0)
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 811c38907eab0f66c22c5e5708e6f8eab14d76fa ]
dev_pm_opp_set_rate(0) removes the vote specified in required-opps but does not actually park the clock, making it run without the necessary power backing. Prevent that from happening when _dpu_core_perf_get_core_clk_rate() returns 0.
Patchwork: https://patchwork.freedesktop.org/patch/742779/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +4 -0
@@ -394,6 +394,10 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,trace_dpu_core_perf_update_clk (kms->dev, !crtc->enabled, clk_rate); +/* If we're going offline, PM callbacks will disable the clocks instead */ +if (!clk_rate) +return 0 ; + clk_rate =min (clk_rate, kms->perf.max_core_clk_rate); ret =dev_pm_opp_set_rate (&kms->pdev->dev, clk_rate);if (ret) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 913/1815 drm/msm/dp: Drop dev_pm_opp_set_rate(0)
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit cebfa9909e27ec7b7cbaec25ee5516cf886baa39 ]
dev_pm_opp_set_rate(0) removes the vote specified in required-opps but does not actually park the clock, making it run without the necessary power backing. Drop the explicit calls to it.
Patchwork: https://patchwork.freedesktop.org/patch/742781/
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -4
@@ -1950,13 +1950,12 @@ static int msm_dp_ctrl_reinitialize_mainlink(struct msm_dp_ctrl_private *ctrl)msm_dp_ctrl_mainlink_disable (ctrl); ctrl->phy_opts.dp.lanes = ctrl->link->link_params.num_lanes;phy_configure (phy, &ctrl->phy_opts); +/* * Disable and re-enable the mainlink clock since the * link clock might have been adjusted as part of the * link maintenance. */ -dev_pm_opp_set_rate (ctrl->dev,0 ); -msm_dp_ctrl_link_clk_disable (&ctrl->msm_dp_ctrl);phy_power_off (phy);
@@ -1982,7 +1981,6 @@ static int msm_dp_ctrl_deinitialize_mainlink(struct msm_dp_ctrl_private *ctrl)msm_dp_ctrl_reset (&ctrl->msm_dp_ctrl); -dev_pm_opp_set_rate (ctrl->dev,0 );msm_dp_ctrl_link_clk_disable (&ctrl->msm_dp_ctrl);phy_power_off (phy);
@@ -2602,7 +2600,6 @@ void msm_dp_ctrl_off(struct msm_dp_ctrl *msm_dp_ctrl) ctrl->stream_clks_on = false; } -dev_pm_opp_set_rate (ctrl->dev,0 );msm_dp_ctrl_link_clk_disable (&ctrl->msm_dp_ctrl);phy_power_off (phy);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 914/1815 drm/msm/dsi: Drop dev_pm_opp_set_rate(0)
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 06b7ba206561619bb34116f49e0ef26b867ce3aa ]
dev_pm_opp_set_rate(0) removes the vote specified in required-opps but does not actually park the clock, making it run without the necessary power backing. Drop the explicit call to it.
Every call site of ops->link_clk_disable() is followed by pm_runtime_put(), so the power vote will be rescinded if deemed safe.
Patchwork: https://patchwork.freedesktop.org/patch/742783/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -2
@@ -549,8 +549,6 @@ int dsi_link_clk_enable_v2(struct msm_dsi_host *msm_host)void dsi_link_clk_disable_6g (struct msm_dsi_host *msm_host) { -/* Drop the performance state vote */ -dev_pm_opp_set_rate (&msm_host->pdev->dev,0 );clk_disable_unprepare (msm_host->esc_clk);clk_disable_unprepare (msm_host->pixel_clk);clk_disable_unprepare (msm_host->byte_intf_clk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 915/1815 wifi: ath11k: fix leak in ath11k_service_ready_ext_event()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Johnson <[email protected]>
[ Upstream commit 0293be2212d319d59589082461abf2a9b626cd1c ]
Currently, during ath11k_service_ready_ext_event() processing, svc_rdy_ext.mac_phy_caps can be allocated during TLV parsing. This is a temporary allocation that is freed on the success path, but not on the error path. If parsing succeeds far enough to allocate mac_phy_caps and then fails on a later TLV, the allocation leaks. So free the allocation on the error path.
Compile tested only.
--- drivers/net/wireless/ath/ath11k/wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath11k/wmi.c +1 -0
@@ -5129,6 +5129,7 @@ static int ath11k_service_ready_ext_event(struct ath11k_base *ab,return 0 ; err: +kfree (svc_rdy_ext.mac_phy_caps);ath11k_wmi_free_dbring_caps (ab);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 916/1815 ASoC: codecs: tas2783-sdw: Propagate regcache_sync() errors
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 0d6b2d6f93a6715827a9b3c027cd8448d76e0e47 ]
regcache_sync() can fail while replaying cached register state after SoundWire resume or attach handling. tas2783 currently ignores that failure.
Propagate the error and restore cache-only/dirty state on failure.
Stable-dep-of: b627da430357 ("ASoC: tas2783-sdw: drop stale regcache on uninitialized re-attach")
--- sound/soc/codecs/tas2783-sdw.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
sound/soc/codecs/tas2783-sdw.c +14 -2
@@ -1098,7 +1098,13 @@ static s32 tas2783_sdca_dev_resume(struct device *dev) }regcache_cache_only (tas_dev->regmap, false); -regcache_sync (tas_dev->regmap); + ret =regcache_sync (tas_dev->regmap); +if (ret) { +regcache_cache_only (tas_dev->regmap, true); +regcache_mark_dirty (tas_dev->regmap); +return ret; + } +return 0 ; }
@@ -1209,6 +1215,7 @@ static s32 tas_update_status(struct sdw_slave *slave, {struct tas2783_prv *tas_dev =dev_get_drvdata (&slave->dev);struct device *dev = &slave->dev; +int ret; dev_dbg(dev, "Peripheral status = %s", status == SDW_SLAVE_UNATTACHED ? "unattached" :
@@ -1226,7 +1233,12 @@ static s32 tas_update_status(struct sdw_slave *slave,/* updated the cache data to device */ regcache_cache_only (tas_dev->regmap, false); -regcache_sync (tas_dev->regmap); + ret =regcache_sync (tas_dev->regmap); +if (ret) { +regcache_cache_only (tas_dev->regmap, true); +regcache_mark_dirty (tas_dev->regmap); +return ret; + }/* perform I/O transfers required for Slave initialization */ return tas_io_init (&slave->dev, slave);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 917/1815 ASoC: tas2783-sdw: drop stale regcache on uninitialized re-attach
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Golovko <[email protected]>
[ Upstream commit b627da43035744ca4d691fbf56eef60268319873 ]
When the peripheral re-attaches after the SoundWire controller was power-gated during system suspend (s2idle reaching S0i3 on AMD ACP), the amplifier has lost all of its register and DSP state. tas_update_status() handles that by re-running tas_io_init(), which writes the device's TAS2783_SW_RESET register - a vendor register write that clears the device's register file and DSP state, not a SoundWire reset, so no re-enumeration is involved - and re-downloads the firmware. Before doing any of that, it syncs back a register cache that still holds the pre-suspend values.
That sync is useless, since the reset immediately wipes whatever it wrote, and it leaves the cache claiming that the amplifier is already powered up and unmuted. Subsequent read-modify-write updates - DAPM amplifier power-up, SDCA PDE transitions at stream start - then see "no change" and skip the hardware write. Playback runs without a single error while the speakers stay silent. Unbinding and rebinding the driver restores audio, since probe starts from a fresh cache.
Drop the cache instead of syncing it when an uninitialized device attaches, so that later accesses see the real hardware state.
Reordering the sync after tas_io_init() and marking the cache dirty is not a workable alternative here: tas_regmap has no .writeable_reg, so the cache accepts every register up to .max_register, including ones for which tas2783_sdca_mbq_size() returns 0. regmap_sdw_mbq_size() rejects those with -EINVAL, so the replay fails on the first such register and takes initialization down with it.
Cached user settings fall back to hardware defaults across such a power loss, which seems clearly preferable to a silent amplifier - the device is being reset and its firmware reloaded at this point anyway.
Tested on an ASUS ProArt PX13 HN7306EAC (AMD Strix Halo, ACP7.0, two TAS2783 amplifiers plus RT721 on SoundWire link 1): the speakers work after an s2idle resume with ~51 s of S0i3 residency, where previously they stayed silent despite a complete firmware re-download.
--- sound/soc/codecs/tas2783-sdw.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
sound/soc/codecs/tas2783-sdw.c +16 -8
@@ -1215,7 +1215,6 @@ static s32 tas_update_status(struct sdw_slave *slave, {struct tas2783_prv *tas_dev =dev_get_drvdata (&slave->dev);struct device *dev = &slave->dev; -int ret; dev_dbg(dev, "Peripheral status = %s", status == SDW_SLAVE_UNATTACHED ? "unattached" :
@@ -1231,14 +1230,23 @@ static s32 tas_update_status(struct sdw_slave *slave,if (tas_dev->hw_init || tas_dev->status !=SDW_SLAVE_ATTACHED )return 0 ; -/* updated the cache data to device */ regcache_cache_only (tas_dev->regmap, false); - ret =regcache_sync (tas_dev->regmap); -if (ret) { -regcache_cache_only (tas_dev->regmap, true); -regcache_mark_dirty (tas_dev->regmap); -return ret; - } + +/* +* The device is attaching uninitialized: either this is the first +* attach, or it lost power (and with it all register and DSP state) +* while the controller was power-gated during system suspend. The +* cache still holds the pre-suspend values, and tas_io_init() below +* resets the device via TAS2783_SW_RESET anyway, so syncing it back +* is both useless and harmful: later read-modify-write updates would +* compare against stale data and skip the hardware write. +* +* Drop the cache instead, so that subsequent accesses see the real +* hardware state. Syncing after the reset is not an option either: +* the cache accepts registers for which tas2783_sdca_mbq_size() +* returns 0, and writing those back fails with -EINVAL. +*/ +regcache_drop_region (tas_dev->regmap,0 ,UINT_MAX );/* perform I/O transfers required for Slave initialization */ return tas_io_init (&slave->dev, slave);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 918/1815 ARM: tegra: Fix OF node reference leaks in IRQ init
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 7acac0cabaac6967e1f987bfedd4418204c813a7 ]
tegra114_gic_cpu_pm_registration() and tegra_init_irq() use of_find_matching_node() for temporary IRQ init lookups, but the helper returns a referenced node even when the result is used only as a boolean or as an of_iomap() input.
Use scoped device_node cleanup for both lookups so the references are dropped when the functions return.
--- arch/arm/mach-tegra/irq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm/mach-tegra/irq.c +6 -3
@@ -66,9 +66,9 @@ static const struct of_device_id tegra114_dt_gic_match[] __initconst = {static void __init tegra114_gic_cpu_pm_registration (void ) { -struct device_node *dn; + struct device_node *dn __free(device_node) = +of_find_matching_node (NULL , tegra114_dt_gic_match); - dn =of_find_matching_node (NULL , tegra114_dt_gic_match);if (!dn)return ;
@@ -88,7 +88,10 @@ static const struct of_device_id tegra_ictlr_match[] __initconst = {void __init tegra_init_irq (void ) { -if (WARN_ON (!of_find_matching_node (NULL , tegra_ictlr_match))) + struct device_node *dn __free(device_node) = +of_find_matching_node (NULL , tegra_ictlr_match); + +if (WARN_ON (!dn))pr_warn ("Outdated DT detected, suspend/resume will NOT work\n" );tegra114_gic_cpu_pm_registration ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 919/1815 arm64: tegra: Fix CMDQV interrupt type on Tegra264
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashish Mhetre <[email protected]>
[ Upstream commit 5af7a8a522f61ae2a3e5038c889e231e56d63526 ]
The CMDQV interrupts on Tegra264 are described as level-triggered, but per the hardware interrupt documentation these interrupts are actually edge-triggered.
Correct the interrupt type for all CMDQV nodes from IRQ_TYPE_LEVEL_HIGH to IRQ_TYPE_EDGE_RISING.
--- arch/arm64/boot/dts/nvidia/tegra264.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/nvidia/tegra264.dtsi +5 -5
@@ -3393,7 +3393,7 @@ smmu1: iommu@5000000 { cmdqv1: cmdqv@5200000 { compatible = "nvidia,tegra264-cmdqv"; reg = <0x00 0x5200000 0x0 0x830000>; - interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 19 IRQ_TYPE_EDGE_RISING>; status = "disabled"; };
@@ -3413,7 +3413,7 @@ smmu2: iommu@6000000 { cmdqv2: cmdqv@6200000 { compatible = "nvidia,tegra264-cmdqv"; reg = <0x00 0x6200000 0x0 0x830000>; - interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>; status = "disabled"; };
@@ -3486,7 +3486,7 @@ smmu0: iommu@a000000 { cmdqv0: cmdqv@a200000 { compatible = "nvidia,tegra264-cmdqv"; reg = <0x00 0xa200000 0x0 0x830000>; - interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 28 IRQ_TYPE_EDGE_RISING>; status = "disabled"; };
@@ -3506,7 +3506,7 @@ smmu4: iommu@b000000 { cmdqv4: cmdqv@b200000 { compatible = "nvidia,tegra264-cmdqv"; reg = <0x00 0xb200000 0x0 0x830000>; - interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 37 IRQ_TYPE_EDGE_RISING>; status = "disabled"; };
@@ -3831,7 +3831,7 @@ smmu3: iommu@6000000 { cmdqv3: cmdqv@6200000 { compatible = "nvidia,tegra264-cmdqv"; reg = <0x00 0x6200000 0x0 0x830000>; - interrupts = <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 232 IRQ_TYPE_EDGE_RISING>; status = "disabled"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 920/1815 regulator: core: use system_freezable_wq for init complete work
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joy Zou <[email protected]>
[ Upstream commit 03eab318cedd6ae34ecd34533cd986edf5237164 ]
schedule_delayed_work() uses system_wq, which is non-freezable, allowing regulator_init_complete_work to run concurrently with system suspend. This work fires ~30s after boot to disable unused regulators via I2C. When it races with PM suspend, the I2C adapter may already be suspended, triggering a -ESHUTDOWN warning in __i2c_transfer():
WARNING: ... at __i2c_transfer+0x36c/0x3c8
Call trace: __i2c_transfer i2c_transfer regmap_i2c_write _regmap_update_bits regulator_disable_regmap _regulator_do_disable regulator_late_cleanup regulator_init_complete_work_function process_one_work
Switch to system_freezable_wq so the work is frozen before any device is suspended, eliminating the race.
--- drivers/regulator/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/regulator/core.c +4 -2
@@ -27,6 +27,7 @@#include <linux/regulator/driver.h> #include <linux/regulator/machine.h> #include <linux/module.h> +#include <linux/workqueue.h> #define CREATE_TRACE_POINTS #include <trace/events/regulator.h>
@@ -6899,8 +6900,9 @@ static int __init regulator_init_complete(void)* we'd only do this on systems that need it, and a kernel * command line option might be useful. */ -schedule_delayed_work (®ulator_init_complete_work, -msecs_to_jiffies (30000 )); +queue_delayed_work (system_freezable_wq, + ®ulator_init_complete_work, +msecs_to_jiffies (30000 ));return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 921/1815 ASoC: SDCA: Add missing stub for sdca_fdl_free_state()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit f6970d8535a95c137f05e9ca825072de3b217b88 ]
There should be a stub for sdca_fdl_free_state() for the case FDL support isn't built into the kernel. Add the missing stub.
--- include/sound/sdca_fdl.h | 4 ++++ 1 file changed, 4 insertions(+)
include/sound/sdca_fdl.h +4 -0
@@ -83,6 +83,10 @@ static inline int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt)return 0 ; } +static inline void sdca_fdl_free_state (struct sdca_interrupt *interrupt) +{ +} +static inline int sdca_fdl_process (struct sdca_interrupt *interrupt) {return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 922/1815 perf unwind-libdw: Fix unwinding of multi-threaded processes
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alessio Podda <[email protected]>
[ Upstream commit f2effca1ef5d30b1ead61d74faea5e251f604a26 ]
The libdw callback API has two levels: dwfl_getthread_frames() first finds the requested thread using the next_thread() or get_thread() callback and then walks its stack.
Since perf only has a snapshot of the stack of a single thread, it provides a stubbed-out API that always returns the pid the Dwfl was attached with (i.e. whatever was passed to dwfl_attach_state()), rather than the actual sampled thread's TID.
Commit 6b2658b3f36a ("perf unwind-libdw: Don't discard loaded ELF/DWARF after every unwind") changed libdw unwinding from recreating the Dwfl object for each sample to caching it in struct maps, which is shared by every thread in the process. It left next_thread() unchanged.
Since the pid passed to dwfl_attach_state() is only set at creation, only the thread of the first sample is ever found. As a result, dwfl_getthread_frames() fails with ESRCH when asked to unwind a sample from another thread.
Make next_thread() return the current sample's TID, provide get_thread() so libdw can find it directly, and pass the process PID expected by dwfl_attach_state(). This allows libdw to unwind samples from every thread in a multi-threaded process.
Add a shell regression test that records a four-thread workload and verifies that libdw recovers the worker callchain for every worker TID.
--- .../shell/test_dwarf_unwind_multithreaded.sh | 65 +++++++++++++++++++ tools/perf/util/unwind-libdw.c | 24 ++++++- 2 files changed, 86 insertions(+), 3 deletions(-) create mode 100755 tools/perf/tests/shell/test_dwarf_unwind_multithreaded.sh
tools/perf/tests/shell/test_dwarf_unwind_multithreaded.sh new file +65 -0
@@ -0,0 +1,65 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Test libdw unwinding of multi-threaded processes (exclusive) + +set -e + +if ! perf check feature -q libdw-dwarf-unwind; then + echo "Skip: libdw DWARF unwinding is not available" + exit 2 +fi + +tmpdir=$(mktemp -d /tmp/perf-test-dwarf-unwind-multithreaded.XXXXXX) +perf_data="$tmpdir/perf.data" +perf_script="$tmpdir/perf-script.txt" +nr_threads=4 +nr_worker_threads=$((nr_threads - 1)) + +cleanup() +{ + trap - EXIT TERM INT + rm -rf "$tmpdir" +} + +trap cleanup EXIT TERM INT + +if ! perf record -q -e task-clock:u -F 99 --call-graph dwarf,8192 \ + -o "$perf_data" -- perf test -w thloop 2 "$nr_threads" +then + echo "Skip: failed to record task-clock:u" + exit 2 +fi + +if ! perf script --unwind-style=libdw \ + -F comm,pid,tid,event,ip,sym -i "$perf_data" > "$perf_script" +then + echo "Error: failed to process the recording with libdw" >&2 + exit 1 +fi + +nr_unwound_threads=$( + awk ' + BEGIN { RS = "" } + + # thfunc is the worker-only caller of test_loop. Finding it proves + # that libdw unwound beyond the sampled leaf for this worker TID. + /thfunc/ { + split($2, id, "/") + seen[id[2]] = 1 + } + + END { + for (tid in seen) + nr_tids++ + print nr_tids + 0 + } + ' "$perf_script" +) + +if [ "$nr_unwound_threads" -ne "$nr_worker_threads" ]; then + echo "Error: expected callchains for $nr_worker_threads worker TIDs," \ + "found $nr_unwound_threads" >&2 + exit 1 +fi + +exit 0
tools/perf/util/unwind-libdw.c +21 -3
@@ -1,4 +1,5 @@// SPDX-License-Identifier: GPL-2.0 +#include <assert.h> #include <linux/compiler.h> #include <elfutils/libdw.h> #include <elfutils/libdwfl.h>
@@ -173,14 +174,30 @@ static int entry(u64 ip, struct unwind_info *ui)return 0 ; } -static pid_t next_thread (Dwfl *dwfl,void *arg,void **thread_argp) +static pid_t next_thread (Dwfl *dwfl__maybe_unused ,void *arg,void **thread_argp) { +struct dwfl_ui_thread_info *dwfl_ui_ti = arg; +/* We want only single thread to be processed. */ if (*thread_argp !=NULL )return 0 ; +assert (dwfl_ui_ti->ui !=NULL ); *thread_argp = arg; -return dwfl_pid (dwfl); +return thread__tid (dwfl_ui_ti->ui->thread); +} + +static bool get_thread (Dwfl *dwfl__maybe_unused ,pid_t tid,void *arg, +void **thread_argp) +{ +struct dwfl_ui_thread_info *dwfl_ui_ti = arg; + +assert (dwfl_ui_ti->ui !=NULL ); +if (tid !=thread__tid (dwfl_ui_ti->ui->thread)) +return false; + + *thread_argp = arg; +return true; } static int access_dso_mem(struct unwind_info *ui, Dwarf_Addr addr,
@@ -306,6 +323,7 @@ static bool libdw_set_initial_registers(Dwfl_Thread *thread, void *arg)static const Dwfl_Thread_Callbacks callbacks = { .next_thread = next_thread, + .get_thread = get_thread, .memory_read = memory_read, .set_initial_registers = libdw_set_initial_registers, };
@@ -400,7 +418,7 @@ int libdw__get_entries(unwind_entry_cb_t cb, void *arg,if (err) goto out; -dwfl_attach_state (dwfl,/*elf=*/ NULL ,thread__tid (thread), &callbacks, +dwfl_attach_state (dwfl,/*elf=*/ NULL ,thread__pid (thread), &callbacks,/* Dwfl thread function argument*/ dwfl_ui_ti);// Ignore thread already attached error.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 923/1815 perf libdw: Fix outer-frame name resolution and spurious "(inlined)" tag
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Liang <[email protected]>
[ Upstream commit 022bcb6ba2d384d772f68477d11b2684afd6e715 ]
cu_walk_functions_at() calls libdw_a2l_cb() with the containing DW_TAG_subprogram DIE first, then each DW_TAG_inlined_subroutine nested inside. The callback treated both the same way, causing two bugs:
1) die_name() returns the unqualified DW_AT_name, so every C++ frame lost its namespace/class prefix (ns::Class::method collapsed to method).
2) new_inline_sym() re-uses base_sym only when funcname matches base_sym->name exactly; otherwise it fabricates a fake symbol tagged "(inlined)". Any mismatch between the DWARF name and the ELF symbol name mis-tags an outer, non-inline frame as inlined. This hits C++ (die_name()'s unqualified output never matches the demangled ELF symbol) and it also hits C functions that GCC IPA-cloned (foo vs foo.isra.0 / .constprop / .part / .cold), since DW_AT_linkage_name doesn't reflect those renames.
Fix both:
* Prefer die_get_linkage_name() (mangled, fully qualified), falling back to die_name() when absent (C, extern "C"). new_inline_sym() already demangles via dso__demangle_sym().
* For DW_TAG_subprogram DIEs, use base_sym directly -- the DIE tag already tells us it is the outer function, sidestepping the name comparison entirely for both C++ qualification and GCC IPA-clone renames.
--- tools/perf/util/libdw.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
tools/perf/util/libdw.c +30 -4
@@ -82,13 +82,39 @@ struct libdw_a2l_cb_args {static int libdw_a2l_cb (Dwarf_Die *die,void *_args) {struct libdw_a2l_cb_args *args = _args; -struct symbol *inline_sym =new_inline_sym (args->dso, args->sym,die_name (die));const char *call_fname =die_get_call_file (die);int call_lineno =die_get_call_lineno (die);char *call_srcline = srcline__unknown; - -if (!inline_sym) - goto abort_enomem; +struct symbol *inline_sym; + +if (dwarf_tag (die) == DW_TAG_subprogram && args->sym) { +/* +* cu_walk_functions_at() opens the walk with the +* containing DW_TAG_subprogram DIE (the non-inlined outer +* function). That's just the base symbol -- use it +* directly. Avoids a fragile name-vs-name compare in +* new_inline_sym() that misfires when GCC IPA passes +* (.isra/.constprop/.part/.cold) rename the ELF symbol +* while DWARF keeps the pre-clone linkage name, which +* left the outer frame spuriously tagged "(inlined)". +*/ + inline_sym = args->sym; + }else { +/* +* Prefer DW_AT_linkage_name so C++ inline frames keep +* their namespace/class qualification. new_inline_sym() +* runs the name through dso__demangle_sym(), so the +* mangled linkage name is turned back into +* "Namespace::Class::method". Fall back to DW_AT_name +* (unqualified) when no linkage name is present, e.g. +* for C code or extern "C" functions. +*/ +const char *funcname =die_get_linkage_name (die) ?:die_name (die); + + inline_sym =new_inline_sym (args->dso, args->sym, funcname); +if (!inline_sym) + goto abort_enomem; + }/* Assign caller information to the parent. */ if (call_fname)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 924/1815 perf machine: Fix fd leak on bounds check in maps__set_modules_path_dir()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 23010160bb9fd6e7ce940e232cd660b37ab9b20b ]
The bounds check for root_len >= path_size returns -1 directly without closing the directory fd opened by io_dir__init() a few lines above.
Jump to the out label instead, which calls close(iod.dirfd).
--- tools/perf/util/machine.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/util/machine.c +4 -2
@@ -1411,8 +1411,10 @@ static int maps__set_modules_path_dir(struct maps *maps, char *path, size_t pathreturn -1 ; }/* Bounds check, should never happen. */ -if (root_len >= path_size) -return -1 ; +if (root_len >= path_size) { + ret =-1 ; + goto out; + } path[root_len++] ='/' ;while ((dent =io_dir__readdir (&iod)) !=NULL ) {if (io_dir__is_dir (&iod, dent)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 925/1815 perf machine: Fix NULL parent dereference in fork event processing
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 73ac546bd6ba8ed4dc8d7a90fcb9bb8236de1568 ]
machine__process_fork_event() calls machine__findnew_thread() for the parent thread, which can return NULL on allocation failure. The code then dereferences parent via thread__pid(parent) without a NULL check when validating whether the parent PID matches. The later NULL check at thread__fork() does not prevent this earlier dereference.
Add a NULL guard before accessing the parent thread.
--- tools/perf/util/machine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/machine.c +2 -1
@@ -1923,7 +1923,8 @@ int machine__process_fork_event(struct machine *machine, union perf_event *event* (fork) event that would have removed the thread was lost. Assume the * latter case and continue on as best we can. */ -if (thread__pid (parent) != (pid_t )event->fork.ppid) { +if (parent !=NULL && +thread__pid (parent) != (pid_t )event->fork.ppid) {dump_printf ("removing erroneous parent thread %d/%d\n" ,thread__pid (parent),thread__tid (parent));machine__remove_thread (machine, parent);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 926/1815 perf machine: Guard against NULL strlist in machines__findnew()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit e27b96d0a34e1dc87affecf221a99fee8f6c5afc ]
The static 'seen' strlist caches guestmount paths that have already been reported as inaccessible, to avoid repeating the error message. If strlist__new() fails (OOM), 'seen' stays NULL and the next call dereferences it via strlist__has_entry() and strlist__add().
Guard both calls so that on allocation failure the error message is still printed (just not deduplicated) instead of crashing.
--- tools/perf/util/machine.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/util/machine.c +3 -2
@@ -340,9 +340,10 @@ struct machine *machines__findnew(struct machines *machines, pid_t pid)if (!seen) seen =strlist__new (NULL ,NULL ); -if (!strlist__has_entry (seen, path)) { +if (!seen || !strlist__has_entry (seen, path)) {pr_err ("Can't access file %s\n" , path); -strlist__add (seen, path); +if (seen) +strlist__add (seen, path); } machine =NULL ; goto out;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 927/1815 perf machine: Check snprintf truncation in machines__findnew()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit cc6abe0012bf8c04af8275266f8ed7c55ba4a5fb ]
The guestmount path is built with snprintf() into a PATH_MAX buffer without checking the return value. If symbol_conf.guestmount is long enough to cause truncation, the truncated path could match a different directory, causing the wrong guest to be associated with the pid.
Check for truncation and bail out early.
--- tools/perf/util/machine.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/util/machine.c +6 -1
@@ -333,7 +333,12 @@ struct machine *machines__findnew(struct machines *machines, pid_t pid)if ((pid !=HOST_KERNEL_ID ) && (pid !=DEFAULT_GUEST_KERNEL_ID ) && (symbol_conf.guestmount)) { -snprintf (path,sizeof (path),"%s/%d" , symbol_conf.guestmount, pid); +if (snprintf (path,sizeof (path),"%s/%d" , + symbol_conf.guestmount, pid) >= (int )sizeof (path)) { +pr_err ("Guest path too long for pid %d\n" , pid); + machine =NULL ; + goto out; + }if (access (path,R_OK )) {static struct strlist *seen;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 928/1815 perf machine: Dont abort guest map creation on first inaccessible dir
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit b687e1a418fb819ef83c362d84c216a6a841e3b0 ]
machines__create_guest_kernel_maps() jumps to the failure label when one guest directory's kallsyms file fails access(), skipping all remaining valid guest directories. An inaccessible directory is not fatal — other guests may still be reachable.
Replace 'goto failure' with 'continue' so the loop processes all directories, and remove the now-unreferenced failure label.
--- tools/perf/util/machine.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/util/machine.c +2 -4
@@ -1269,14 +1269,12 @@ int machines__create_guest_kernel_maps(struct machines *machines)snprintf (path,sizeof (path),"%s/%s/proc/kallsyms" , symbol_conf.guestmount, namelist[i]->d_name); - ret =access (path,R_OK ); -if (ret) { +if (access (path,R_OK )) {pr_debug ("Can't access file %s\n" , path); - goto failure; +continue ; }machines__create_kernel_maps (machines, pid); } -failure:free (namelist); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 929/1815 perf machine: Reset errno before strtol in guest kernel map creation
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 29ec46e43f6ca7d6a6651db724d4ffd820f46e8b ]
machines__create_guest_kernel_maps() checks errno == ERANGE after strtol() to detect overflow, but does not clear errno first. A stale ERANGE from an earlier library call (e.g. scandir internals) causes valid numeric directory names to be incorrectly skipped.
Set errno = 0 before strtol() so only the current conversion can trigger the ERANGE check.
--- tools/perf/util/machine.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/machine.c +1 -0
@@ -1258,6 +1258,7 @@ int machines__create_guest_kernel_maps(struct machines *machines)/* Filter out . and .. */ continue ; } + errno =0 ; pid = (pid_t )strtol (namelist[i]->d_name, &endp,10 ); if ((*endp != '\0') || (endp == namelist[i]->d_name) ||
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 930/1815 perf machine: Free scandir entries in guest kernel map creation
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit f53bf58dcd11e1cb088d3b91a035fef77062094b ]
machines__create_guest_kernel_maps() calls scandir() which allocates both the namelist array and each individual dirent entry. The code frees the namelist array but not the individual entries, leaking memory proportional to the number of directories under guestmount.
Free each namelist[i] after it is no longer needed.
--- tools/perf/util/machine.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/util/machine.c +4 -0
@@ -1256,6 +1256,7 @@ int machines__create_guest_kernel_maps(struct machines *machines)for (i =0 ; i < items; i++) {if (!isdigit (namelist[i]->d_name[0 ])) {/* Filter out . and .. */ +free (namelist[i]);continue ; } errno =0 ;
@@ -1265,6 +1266,7 @@ int machines__create_guest_kernel_maps(struct machines *machines) (errno == ERANGE)) {pr_debug ("invalid directory (%s). Skipping.\n" , namelist[i]->d_name); +free (namelist[i]);continue ; } snprintf(path, sizeof(path), "%s/%s/proc/kallsyms",
@@ -1272,9 +1274,11 @@ int machines__create_guest_kernel_maps(struct machines *machines) namelist[i]->d_name);if (access (path,R_OK )) {pr_debug ("Can't access file %s\n" , path); +free (namelist[i]);continue ; }machines__create_kernel_maps (machines, pid); +free (namelist[i]); }free (namelist); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 931/1815 perf machine: Check snprintf truncation for guest kallsyms path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit d04ef71492fad7230d474efe33d05f4c0563d409 ]
machines__create_guest_kernel_maps() builds the guest kallsyms path with snprintf() without checking the return value. A truncated path could pass the access() check if a prefix directory happens to contain a file named "kallsyms", leading to the wrong file being used for symbol resolution.
Check for truncation and skip the directory.
--- tools/perf/util/machine.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/perf/util/machine.c +8 -3
@@ -1269,9 +1269,14 @@ int machines__create_guest_kernel_maps(struct machines *machines)free (namelist[i]);continue ; } -snprintf (path,sizeof (path),"%s/%s/proc/kallsyms" , - symbol_conf.guestmount, - namelist[i]->d_name); +if (snprintf (path,sizeof (path),"%s/%s/proc/kallsyms" , + symbol_conf.guestmount, + namelist[i]->d_name) >= (int )sizeof (path)) { +pr_debug ("Guest kallsyms path too long for %s. Skipping.\n" , + namelist[i]->d_name); +free (namelist[i]); +continue ; + }if (access (path,R_OK )) {pr_debug ("Can't access file %s\n" , path);free (namelist[i]);
Signature · 1 line
2.53.0