From eb708510c031585945e2d01be1dfaf3c1bf27bd8 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 10 Dec 2023 14:38:51 -0500 Subject: [PATCH] Fixes for 6.6 Signed-off-by: Sasha Levin --- ...ts-mediatek-add-missing-space-before.patch | 277 +++++++++++ ...-kukui-fix-underscores-in-node-names.patch | 432 ++++++++++++++++++ ...remove-bogous-__exit-annotation-for-.patch | 72 +++ ...ash-when-perf-and-sysfs-modes-are-us.patch | 88 ++++ ...oc-smb-config-smb-buffer-before-regi.patch | 82 ++++ ...oc-smb-fix-sleep-while-close-preempt.patch | 229 ++++++++++ ...oc-smb-fix-uninitialized-before-use-.patch | 47 ++ .../drm-amdgpu-disable-mcbp-by-default.patch | 41 ++ ...hisi_ptt-add-dummy-callback-pmu-read.patch | 51 +++ ...n-t-sign-extend-function-return-valu.patch | 157 +++++++ ...on-t-sign-extend-memory-load-operand.patch | 159 +++++++ ...c-fix-problem-of-return-eoverflow-in.patch | 38 ++ ...c-return-negative-error-code-in-mei_.patch | 37 ++ ...perand-number-out-of-range-build-err.patch | 37 ++ ...ze-of-the-bug_table-on-64-bit-kernel.patch | 122 +++++ ...ts-arm64-ampereone-add-missing-defau.patch | 53 +++ queue-6.6/series | 16 + 17 files changed, 1938 insertions(+) create mode 100644 queue-6.6/arm64-dts-mediatek-add-missing-space-before.patch create mode 100644 queue-6.6/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch create mode 100644 queue-6.6/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch create mode 100644 queue-6.6/coresight-fix-crash-when-perf-and-sysfs-modes-are-us.patch create mode 100644 queue-6.6/coresight-ultrasoc-smb-config-smb-buffer-before-regi.patch create mode 100644 queue-6.6/coresight-ultrasoc-smb-fix-sleep-while-close-preempt.patch create mode 100644 queue-6.6/coresight-ultrasoc-smb-fix-uninitialized-before-use-.patch create mode 100644 queue-6.6/drm-amdgpu-disable-mcbp-by-default.patch create mode 100644 queue-6.6/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch create mode 100644 queue-6.6/loongarch-bpf-don-t-sign-extend-function-return-valu.patch create mode 100644 queue-6.6/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch create mode 100644 queue-6.6/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch create mode 100644 queue-6.6/misc-mei-client.c-return-negative-error-code-in-mei_.patch create mode 100644 queue-6.6/parisc-fix-asm-operand-number-out-of-range-build-err.patch create mode 100644 queue-6.6/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch create mode 100644 queue-6.6/perf-vendor-events-arm64-ampereone-add-missing-defau.patch diff --git a/queue-6.6/arm64-dts-mediatek-add-missing-space-before.patch b/queue-6.6/arm64-dts-mediatek-add-missing-space-before.patch new file mode 100644 index 00000000000..06a378a3991 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-add-missing-space-before.patch @@ -0,0 +1,277 @@ +From 7d99e4b1e6ae72291436298d275d714014e074fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 Jul 2023 17:00:06 +0200 +Subject: arm64: dts: mediatek: add missing space before { + +From: Krzysztof Kozlowski + +[ Upstream commit a9c740c57f977deb41bc53c02d0dae3d0e2f191a ] + +Add missing whitespace between node name/label and opening {. + +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20230705150006.293690-2-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Stable-dep-of: 8980c30141d3 ("arm64: dts: mt8183: kukui: Fix underscores in node names") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8183-evb.dts | 48 +++++++++---------- + .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 12 ++--- + .../boot/dts/mediatek/mt8183-pumpkin.dts | 12 ++--- + 3 files changed, 36 insertions(+), 36 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts +index a27d906db7ea0..77f9ab94c00bd 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts +@@ -155,8 +155,8 @@ &mt6358_vsram_gpu_reg { + }; + + &pio { +- i2c_pins_0: i2c0{ +- pins_i2c{ ++ i2c_pins_0: i2c0 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -164,8 +164,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_1: i2c1{ +- pins_i2c{ ++ i2c_pins_1: i2c1 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -173,8 +173,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_2: i2c2{ +- pins_i2c{ ++ i2c_pins_2: i2c2 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -182,8 +182,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_3: i2c3{ +- pins_i2c{ ++ i2c_pins_3: i2c3 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -191,8 +191,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_4: i2c4{ +- pins_i2c{ ++ i2c_pins_4: i2c4 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -200,8 +200,8 @@ pins_i2c{ + }; + }; + +- i2c_pins_5: i2c5{ +- pins_i2c{ ++ i2c_pins_5: i2c5 { ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -209,8 +209,8 @@ pins_i2c{ + }; + }; + +- spi_pins_0: spi0{ +- pins_spi{ ++ spi_pins_0: spi0 { ++ pins_spi { + pinmux = , + , + , +@@ -324,8 +324,8 @@ pins_clk { + }; + }; + +- spi_pins_1: spi1{ +- pins_spi{ ++ spi_pins_1: spi1 { ++ pins_spi { + pinmux = , + , + , +@@ -334,8 +334,8 @@ pins_spi{ + }; + }; + +- spi_pins_2: spi2{ +- pins_spi{ ++ spi_pins_2: spi2 { ++ pins_spi { + pinmux = , + , + , +@@ -344,8 +344,8 @@ pins_spi{ + }; + }; + +- spi_pins_3: spi3{ +- pins_spi{ ++ spi_pins_3: spi3 { ++ pins_spi { + pinmux = , + , + , +@@ -354,8 +354,8 @@ pins_spi{ + }; + }; + +- spi_pins_4: spi4{ +- pins_spi{ ++ spi_pins_4: spi4 { ++ pins_spi { + pinmux = , + , + , +@@ -364,8 +364,8 @@ pins_spi{ + }; + }; + +- spi_pins_5: spi5{ +- pins_spi{ ++ spi_pins_5: spi5 { ++ pins_spi { + pinmux = , + , + , +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +index a3add21602337..9a6bfa5882e31 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +@@ -692,7 +692,7 @@ pins_scp_uart { + }; + + spi0_pins: spi0 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -702,7 +702,7 @@ pins_spi{ + }; + + spi1_pins: spi1 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -712,7 +712,7 @@ pins_spi{ + }; + + spi2_pins: spi2 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + ; +@@ -725,7 +725,7 @@ pins_spi_mi { + }; + + spi3_pins: spi3 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -735,7 +735,7 @@ pins_spi{ + }; + + spi4_pins: spi4 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +@@ -745,7 +745,7 @@ pins_spi{ + }; + + spi5_pins: spi5 { +- pins_spi{ ++ pins_spi { + pinmux = , + , + , +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts b/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts +index 526bcae7a3f8f..b5784a60c315d 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts +@@ -193,7 +193,7 @@ &mt6358_vsram_gpu_reg { + + &pio { + i2c_pins_0: i2c0 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -202,7 +202,7 @@ pins_i2c{ + }; + + i2c_pins_1: i2c1 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -211,7 +211,7 @@ pins_i2c{ + }; + + i2c_pins_2: i2c2 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -220,7 +220,7 @@ pins_i2c{ + }; + + i2c_pins_3: i2c3 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -229,7 +229,7 @@ pins_i2c{ + }; + + i2c_pins_4: i2c4 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -238,7 +238,7 @@ pins_i2c{ + }; + + i2c_pins_5: i2c5 { +- pins_i2c{ ++ pins_i2c { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +-- +2.42.0 + diff --git a/queue-6.6/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch b/queue-6.6/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch new file mode 100644 index 00000000000..e6159d084cb --- /dev/null +++ b/queue-6.6/arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch @@ -0,0 +1,432 @@ +From 5369d7f8bb88c58b3128173548e427c46c3fbfc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Oct 2023 12:09:10 -0700 +Subject: arm64: dts: mt8183: kukui: Fix underscores in node names + +From: Hsin-Yi Wang + +[ Upstream commit 8980c30141d3986beab815d85762b9c67196ed72 ] + +Replace underscores with hyphens in pinctrl node names both for consistency +and to adhere to the bindings. + +Cc: stable@vger.kernel.org +Fixes: cd894e274b74 ("arm64: dts: mt8183: Add krane-sku176 board") +Fixes: 1652dbf7363a ("arm64: dts: mt8183: add scp node") +Fixes: 27eaf34df364 ("arm64: dts: mt8183: config dsi node") +Signed-off-by: Hsin-Yi Wang +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20231026191343.3345279-2-hsinyi@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + .../dts/mediatek/mt8183-kukui-jacuzzi.dtsi | 6 +- + .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 94 +++++++++---------- + 2 files changed, 50 insertions(+), 50 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +index 649477af2f413..820260348de9b 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +@@ -443,20 +443,20 @@ pins2 { + }; + + touchscreen_pins: touchscreen-pins { +- touch_int_odl { ++ touch-int-odl { + pinmux = ; + input-enable; + bias-pull-up; + }; + +- touch_rst_l { ++ touch-rst-l { + pinmux = ; + output-high; + }; + }; + + trackpad_pins: trackpad-pins { +- trackpad_int { ++ trackpad-int { + pinmux = ; + input-enable; + bias-disable; /* pulled externally */ +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +index 9a6bfa5882e31..6f333f5cbeb98 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +@@ -432,7 +432,7 @@ &mt6358_vsram_gpu_reg { + + &pio { + aud_pins_default: audiopins { +- pins_bus { ++ pins-bus { + pinmux = , + , + , +@@ -454,7 +454,7 @@ pins_bus { + }; + + aud_pins_tdm_out_on: audiotdmouton { +- pins_bus { ++ pins-bus { + pinmux = , + , + , +@@ -466,7 +466,7 @@ pins_bus { + }; + + aud_pins_tdm_out_off: audiotdmoutoff { +- pins_bus { ++ pins-bus { + pinmux = , + , + , +@@ -480,13 +480,13 @@ pins_bus { + }; + + bt_pins: bt-pins { +- pins_bt_en { ++ pins-bt-en { + pinmux = ; + output-low; + }; + }; + +- ec_ap_int_odl: ec_ap_int_odl { ++ ec_ap_int_odl: ec-ap-int-odl { + pins1 { + pinmux = ; + input-enable; +@@ -494,7 +494,7 @@ pins1 { + }; + }; + +- h1_int_od_l: h1_int_od_l { ++ h1_int_od_l: h1-int-od-l { + pins1 { + pinmux = ; + input-enable; +@@ -502,7 +502,7 @@ pins1 { + }; + + i2c0_pins: i2c0 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -511,7 +511,7 @@ pins_bus { + }; + + i2c1_pins: i2c1 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -520,7 +520,7 @@ pins_bus { + }; + + i2c2_pins: i2c2 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + bias-disable; +@@ -529,7 +529,7 @@ pins_bus { + }; + + i2c3_pins: i2c3 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -538,7 +538,7 @@ pins_bus { + }; + + i2c4_pins: i2c4 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + bias-disable; +@@ -547,7 +547,7 @@ pins_bus { + }; + + i2c5_pins: i2c5 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + mediatek,pull-up-adv = <3>; +@@ -556,7 +556,7 @@ pins_bus { + }; + + i2c6_pins: i2c6 { +- pins_bus { ++ pins-bus { + pinmux = , + ; + bias-disable; +@@ -564,7 +564,7 @@ pins_bus { + }; + + mmc0_pins_default: mmc0-pins-default { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -579,13 +579,13 @@ pins_cmd_dat { + mediatek,pull-up-adv = <01>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; + }; + +- pins_rst { ++ pins-rst { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <01>; +@@ -593,7 +593,7 @@ pins_rst { + }; + + mmc0_pins_uhs: mmc0-pins-uhs { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -608,19 +608,19 @@ pins_cmd_dat { + mediatek,pull-up-adv = <01>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; + }; + +- pins_ds { ++ pins-ds { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; + }; + +- pins_rst { ++ pins-rst { + pinmux = ; + drive-strength = ; + mediatek,pull-up-adv = <01>; +@@ -628,7 +628,7 @@ pins_rst { + }; + + mmc1_pins_default: mmc1-pins-default { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -638,7 +638,7 @@ pins_cmd_dat { + mediatek,pull-up-adv = <10>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + input-enable; + mediatek,pull-down-adv = <10>; +@@ -646,7 +646,7 @@ pins_clk { + }; + + mmc1_pins_uhs: mmc1-pins-uhs { +- pins_cmd_dat { ++ pins-cmd-dat { + pinmux = , + , + , +@@ -657,7 +657,7 @@ pins_cmd_dat { + mediatek,pull-up-adv = <10>; + }; + +- pins_clk { ++ pins-clk { + pinmux = ; + drive-strength = ; + mediatek,pull-down-adv = <10>; +@@ -665,15 +665,15 @@ pins_clk { + }; + }; + +- panel_pins_default: panel_pins_default { +- panel_reset { ++ panel_pins_default: panel-pins-default { ++ panel-reset { + pinmux = ; + output-low; + bias-pull-up; + }; + }; + +- pwm0_pin_default: pwm0_pin_default { ++ pwm0_pin_default: pwm0-pin-default { + pins1 { + pinmux = ; + output-high; +@@ -685,14 +685,14 @@ pins2 { + }; + + scp_pins: scp { +- pins_scp_uart { ++ pins-scp-uart { + pinmux = , + ; + }; + }; + + spi0_pins: spi0 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -702,7 +702,7 @@ pins_spi { + }; + + spi1_pins: spi1 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -712,20 +712,20 @@ pins_spi { + }; + + spi2_pins: spi2 { +- pins_spi { ++ pins-spi { + pinmux = , + , + ; + bias-disable; + }; +- pins_spi_mi { ++ pins-spi-mi { + pinmux = ; + mediatek,pull-down-adv = <00>; + }; + }; + + spi3_pins: spi3 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -735,7 +735,7 @@ pins_spi { + }; + + spi4_pins: spi4 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -745,7 +745,7 @@ pins_spi { + }; + + spi5_pins: spi5 { +- pins_spi { ++ pins-spi { + pinmux = , + , + , +@@ -755,63 +755,63 @@ pins_spi { + }; + + uart0_pins_default: uart0-pins-default { +- pins_rx { ++ pins-rx { + pinmux = ; + input-enable; + bias-pull-up; + }; +- pins_tx { ++ pins-tx { + pinmux = ; + }; + }; + + uart1_pins_default: uart1-pins-default { +- pins_rx { ++ pins-rx { + pinmux = ; + input-enable; + bias-pull-up; + }; +- pins_tx { ++ pins-tx { + pinmux = ; + }; +- pins_rts { ++ pins-rts { + pinmux = ; + output-enable; + }; +- pins_cts { ++ pins-cts { + pinmux = ; + input-enable; + }; + }; + + uart1_pins_sleep: uart1-pins-sleep { +- pins_rx { ++ pins-rx { + pinmux = ; + input-enable; + bias-pull-up; + }; +- pins_tx { ++ pins-tx { + pinmux = ; + }; +- pins_rts { ++ pins-rts { + pinmux = ; + output-enable; + }; +- pins_cts { ++ pins-cts { + pinmux = ; + input-enable; + }; + }; + + wifi_pins_pwrseq: wifi-pins-pwrseq { +- pins_wifi_enable { ++ pins-wifi-enable { + pinmux = ; + output-low; + }; + }; + + wifi_pins_wakeup: wifi-pins-wakeup { +- pins_wifi_wakeup { ++ pins-wifi-wakeup { + pinmux = ; + input-enable; + }; +-- +2.42.0 + diff --git a/queue-6.6/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch b/queue-6.6/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch new file mode 100644 index 00000000000..370e1c17a80 --- /dev/null +++ b/queue-6.6/coresight-etm4x-remove-bogous-__exit-annotation-for-.patch @@ -0,0 +1,72 @@ +From e82893f66f758b5c4eb4a024b1baa8da23e440fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Sep 2023 10:16:37 +0200 +Subject: coresight: etm4x: Remove bogous __exit annotation for some functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 348ddab81f7b0983d9fb158df910254f08d3f887 ] + +etm4_platform_driver (which lives in ".data" contains a reference to +etm4_remove_platform_dev(). So the latter must not be marked with __exit +which results in the function being discarded for a build with +CONFIG_CORESIGHT_SOURCE_ETM4X=y which in turn makes the remove pointer +contain invalid data. + +etm4x_amba_driver referencing etm4_remove_amba() has the same issue. + +Drop the __exit annotations for the two affected functions and a third +one that is called by the other two. + +For reasons I don't understand this isn't catched by building with +CONFIG_DEBUG_SECTION_MISMATCH=y. + +Fixes: c23bc382ef0e ("coresight: etm4x: Refactor probing routine") +Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") +Signed-off-by: Uwe Kleine-König +Reviewed-by: James Clark +Link: https://lore.kernel.org/all/20230929081540.yija47lsj35xtj4v@pengutronix.de/ +Link: https://lore.kernel.org/r/20230929081637.2377335-1-u.kleine-koenig@pengutronix.de +Signed-off-by: Suzuki K Poulose +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index 77b0271ce6eb9..34aee59dd1473 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -2224,7 +2224,7 @@ static void clear_etmdrvdata(void *info) + per_cpu(delayed_probe, cpu) = NULL; + } + +-static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) ++static void etm4_remove_dev(struct etmv4_drvdata *drvdata) + { + bool had_delayed_probe; + /* +@@ -2253,7 +2253,7 @@ static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) + } + } + +-static void __exit etm4_remove_amba(struct amba_device *adev) ++static void etm4_remove_amba(struct amba_device *adev) + { + struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); + +@@ -2261,7 +2261,7 @@ static void __exit etm4_remove_amba(struct amba_device *adev) + etm4_remove_dev(drvdata); + } + +-static int __exit etm4_remove_platform_dev(struct platform_device *pdev) ++static int etm4_remove_platform_dev(struct platform_device *pdev) + { + struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev); + +-- +2.42.0 + diff --git a/queue-6.6/coresight-fix-crash-when-perf-and-sysfs-modes-are-us.patch b/queue-6.6/coresight-fix-crash-when-perf-and-sysfs-modes-are-us.patch new file mode 100644 index 00000000000..dd4fb83f56c --- /dev/null +++ b/queue-6.6/coresight-fix-crash-when-perf-and-sysfs-modes-are-us.patch @@ -0,0 +1,88 @@ +From 2555bfdf5322a0ce6bbe9073eccdfbd1c33c35fd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Oct 2023 14:14:52 +0100 +Subject: coresight: Fix crash when Perf and sysfs modes are used concurrently + +From: James Clark + +[ Upstream commit 287e82cf69aa264a52bc37591bd0eb407e20f85c ] + +Partially revert the change in commit 6148652807ba ("coresight: Enable +and disable helper devices adjacent to the path") which changed the bare +call from source_ops(csdev)->enable() to coresight_enable_source() for +Perf sessions. It was missed that coresight_enable_source() is +specifically for the sysfs interface, rather than being a generic call. +This interferes with the sysfs reference counting to cause the following +crash: + + $ perf record -e cs_etm/@tmc_etr0/ -C 0 & + $ echo 1 > /sys/bus/coresight/devices/tmc_etr0/enable_sink + $ echo 1 > /sys/bus/coresight/devices/etm0/enable_source + $ echo 0 > /sys/bus/coresight/devices/etm0/enable_source + + Unable to handle kernel NULL pointer dereference at virtual + address 00000000000001d0 + Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP + ... + Call trace: + etm4_disable+0x54/0x150 [coresight_etm4x] + coresight_disable_source+0x6c/0x98 [coresight] + coresight_disable+0x74/0x1c0 [coresight] + enable_source_store+0x88/0xa0 [coresight] + dev_attr_store+0x20/0x40 + sysfs_kf_write+0x4c/0x68 + kernfs_fop_write_iter+0x120/0x1b8 + vfs_write+0x2dc/0x3b0 + ksys_write+0x70/0x108 + __arm64_sys_write+0x24/0x38 + invoke_syscall+0x50/0x128 + el0_svc_common.constprop.0+0x104/0x130 + do_el0_svc+0x40/0xb8 + el0_svc+0x2c/0xb8 + el0t_64_sync_handler+0xc0/0xc8 + el0t_64_sync+0x1a4/0x1a8 + Code: d53cd042 91002000 b9402a81 b8626800 (f940ead5) + ---[ end trace 0000000000000000 ]--- + +This commit linked below also fixes the issue, but has unlocked updates +to the mode which could potentially race. So until we come up with a +more complete solution that takes all locking and interaction between +both modes into account, just revert back to the old behavior for Perf. + +Reported-by: Junhao He +Closes: https://lore.kernel.org/linux-arm-kernel/20230921132904.60996-1-hejunhao3@huawei.com/ +Fixes: 6148652807ba ("coresight: Enable and disable helper devices adjacent to the path") +Tested-by: Junhao He +Signed-off-by: James Clark +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20231006131452.646721-1-james.clark@arm.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c +index 5ca6278baff4f..89e8ed214ea49 100644 +--- a/drivers/hwtracing/coresight/coresight-etm-perf.c ++++ b/drivers/hwtracing/coresight/coresight-etm-perf.c +@@ -493,7 +493,7 @@ static void etm_event_start(struct perf_event *event, int flags) + goto fail_end_stop; + + /* Finally enable the tracer */ +- if (coresight_enable_source(csdev, CS_MODE_PERF, event)) ++ if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF)) + goto fail_disable_path; + + /* +@@ -587,7 +587,7 @@ static void etm_event_stop(struct perf_event *event, int mode) + return; + + /* stop tracer */ +- coresight_disable_source(csdev, event); ++ source_ops(csdev)->disable(csdev, event); + + /* tell the core */ + event->hw.state = PERF_HES_STOPPED; +-- +2.42.0 + diff --git a/queue-6.6/coresight-ultrasoc-smb-config-smb-buffer-before-regi.patch b/queue-6.6/coresight-ultrasoc-smb-config-smb-buffer-before-regi.patch new file mode 100644 index 00000000000..72f2659f836 --- /dev/null +++ b/queue-6.6/coresight-ultrasoc-smb-config-smb-buffer-before-regi.patch @@ -0,0 +1,82 @@ +From 614e15d7ebf1899b91f2375dd4496e6971c5df79 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Nov 2023 21:33:44 +0800 +Subject: coresight: ultrasoc-smb: Config SMB buffer before register sink + +From: Junhao He + +[ Upstream commit 830a7f54db102c889a3fe1c0a225f369ac05f07f ] + +The SMB dirver register the enable/disable sysfs interface in function +smb_register_sink(), however the buffer depends on the following +configuration to work well. So it'll be possible for user to access an +unreset one. + +Move the config buffer operation to before register_sink(). +Ignore the return value, if smb_config_inport() fails. That will +cause the hardwares disable trace path to fail, should not affect +SMB driver remove. So we make smb_remove() return success, + +Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver") +Signed-off-by: Junhao He +Reviewed-by: James Clark +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20231114133346.30489-3-hejunhao3@huawei.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/ultrasoc-smb.c | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c +index 0a0fe9fcc57f9..2f2aba90a5148 100644 +--- a/drivers/hwtracing/coresight/ultrasoc-smb.c ++++ b/drivers/hwtracing/coresight/ultrasoc-smb.c +@@ -583,37 +583,32 @@ static int smb_probe(struct platform_device *pdev) + return ret; + } + ++ ret = smb_config_inport(dev, true); ++ if (ret) ++ return ret; ++ ++ platform_set_drvdata(pdev, drvdata); + spin_lock_init(&drvdata->spinlock); + drvdata->pid = -1; + + ret = smb_register_sink(pdev, drvdata); + if (ret) { ++ smb_config_inport(&pdev->dev, false); + dev_err(dev, "Failed to register SMB sink\n"); + return ret; + } + +- ret = smb_config_inport(dev, true); +- if (ret) { +- smb_unregister_sink(drvdata); +- return ret; +- } +- +- platform_set_drvdata(pdev, drvdata); +- + return 0; + } + + static int smb_remove(struct platform_device *pdev) + { + struct smb_drv_data *drvdata = platform_get_drvdata(pdev); +- int ret; +- +- ret = smb_config_inport(&pdev->dev, false); +- if (ret) +- return ret; + + smb_unregister_sink(drvdata); + ++ smb_config_inport(&pdev->dev, false); ++ + return 0; + } + +-- +2.42.0 + diff --git a/queue-6.6/coresight-ultrasoc-smb-fix-sleep-while-close-preempt.patch b/queue-6.6/coresight-ultrasoc-smb-fix-sleep-while-close-preempt.patch new file mode 100644 index 00000000000..a2449b88ee7 --- /dev/null +++ b/queue-6.6/coresight-ultrasoc-smb-fix-sleep-while-close-preempt.patch @@ -0,0 +1,229 @@ +From 62fbf7eabc34124fee9db9c821ff4d8d947984c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Nov 2023 21:33:43 +0800 +Subject: coresight: ultrasoc-smb: Fix sleep while close preempt in enable_smb + +From: Junhao He + +[ Upstream commit b8411287aef4a994eff0c68f5597910c4194dfe3 ] + +When we to enable the SMB by perf, the perf sched will call perf_ctx_lock() +to close system preempt in event_function_call(). But SMB::enable_smb() use +mutex to lock the critical section, which may sleep. + + BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580 + in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 153023, name: perf + preempt_count: 2, expected: 0 + RCU nest depth: 0, expected: 0 + INFO: lockdep is turned off. + irq event stamp: 0 + hardirqs last enabled at (0): [<0000000000000000>] 0x0 + hardirqs last disabled at (0): [] copy_process+0xae8/0x2b48 + softirqs last enabled at (0): [] copy_process+0xae8/0x2b48 + softirqs last disabled at (0): [<0000000000000000>] 0x0 + CPU: 2 PID: 153023 Comm: perf Kdump: loaded Tainted: G W O 6.5.0-rc4+ #1 + + Call trace: + ... + __mutex_lock+0xbc/0xa70 + mutex_lock_nested+0x34/0x48 + smb_update_buffer+0x58/0x360 [ultrasoc_smb] + etm_event_stop+0x204/0x2d8 [coresight] + etm_event_del+0x1c/0x30 [coresight] + event_sched_out+0x17c/0x3b8 + group_sched_out.part.0+0x5c/0x208 + __perf_event_disable+0x15c/0x210 + event_function+0xe0/0x230 + remote_function+0xb4/0xe8 + generic_exec_single+0x160/0x268 + smp_call_function_single+0x20c/0x2a0 + event_function_call+0x20c/0x220 + _perf_event_disable+0x5c/0x90 + perf_event_for_each_child+0x58/0xc0 + _perf_ioctl+0x34c/0x1250 + perf_ioctl+0x64/0x98 + ... + +Use spinlock to replace mutex to control driver data access to one at a +time. The function copy_to_user() may sleep, it cannot be in a spinlock +context, so we can't simply replace it in smb_read(). But we can ensure +that only one user gets the SMB device fd by smb_open(), so remove the +locks from smb_read() and buffer synchronization is guaranteed by the user. + +Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver") +Signed-off-by: Junhao He +Reviewed-by: James Clark +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20231114133346.30489-2-hejunhao3@huawei.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/ultrasoc-smb.c | 35 +++++++++------------- + drivers/hwtracing/coresight/ultrasoc-smb.h | 6 ++-- + 2 files changed, 17 insertions(+), 24 deletions(-) + +diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c +index e9a32a97fbee6..0a0fe9fcc57f9 100644 +--- a/drivers/hwtracing/coresight/ultrasoc-smb.c ++++ b/drivers/hwtracing/coresight/ultrasoc-smb.c +@@ -99,7 +99,7 @@ static int smb_open(struct inode *inode, struct file *file) + struct smb_drv_data, miscdev); + int ret = 0; + +- mutex_lock(&drvdata->mutex); ++ spin_lock(&drvdata->spinlock); + + if (drvdata->reading) { + ret = -EBUSY; +@@ -115,7 +115,7 @@ static int smb_open(struct inode *inode, struct file *file) + + drvdata->reading = true; + out: +- mutex_unlock(&drvdata->mutex); ++ spin_unlock(&drvdata->spinlock); + + return ret; + } +@@ -132,10 +132,8 @@ static ssize_t smb_read(struct file *file, char __user *data, size_t len, + if (!len) + return 0; + +- mutex_lock(&drvdata->mutex); +- + if (!sdb->data_size) +- goto out; ++ return 0; + + to_copy = min(sdb->data_size, len); + +@@ -145,20 +143,15 @@ static ssize_t smb_read(struct file *file, char __user *data, size_t len, + + if (copy_to_user(data, sdb->buf_base + sdb->buf_rdptr, to_copy)) { + dev_dbg(dev, "Failed to copy data to user\n"); +- to_copy = -EFAULT; +- goto out; ++ return -EFAULT; + } + + *ppos += to_copy; +- + smb_update_read_ptr(drvdata, to_copy); +- +- dev_dbg(dev, "%zu bytes copied\n", to_copy); +-out: + if (!sdb->data_size) + smb_reset_buffer(drvdata); +- mutex_unlock(&drvdata->mutex); + ++ dev_dbg(dev, "%zu bytes copied\n", to_copy); + return to_copy; + } + +@@ -167,9 +160,9 @@ static int smb_release(struct inode *inode, struct file *file) + struct smb_drv_data *drvdata = container_of(file->private_data, + struct smb_drv_data, miscdev); + +- mutex_lock(&drvdata->mutex); ++ spin_lock(&drvdata->spinlock); + drvdata->reading = false; +- mutex_unlock(&drvdata->mutex); ++ spin_unlock(&drvdata->spinlock); + + return 0; + } +@@ -262,7 +255,7 @@ static int smb_enable(struct coresight_device *csdev, enum cs_mode mode, + struct smb_drv_data *drvdata = dev_get_drvdata(csdev->dev.parent); + int ret = 0; + +- mutex_lock(&drvdata->mutex); ++ spin_lock(&drvdata->spinlock); + + /* Do nothing, the trace data is reading by other interface now */ + if (drvdata->reading) { +@@ -294,7 +287,7 @@ static int smb_enable(struct coresight_device *csdev, enum cs_mode mode, + + dev_dbg(&csdev->dev, "Ultrasoc SMB enabled\n"); + out: +- mutex_unlock(&drvdata->mutex); ++ spin_unlock(&drvdata->spinlock); + + return ret; + } +@@ -304,7 +297,7 @@ static int smb_disable(struct coresight_device *csdev) + struct smb_drv_data *drvdata = dev_get_drvdata(csdev->dev.parent); + int ret = 0; + +- mutex_lock(&drvdata->mutex); ++ spin_lock(&drvdata->spinlock); + + if (drvdata->reading) { + ret = -EBUSY; +@@ -327,7 +320,7 @@ static int smb_disable(struct coresight_device *csdev) + + dev_dbg(&csdev->dev, "Ultrasoc SMB disabled\n"); + out: +- mutex_unlock(&drvdata->mutex); ++ spin_unlock(&drvdata->spinlock); + + return ret; + } +@@ -408,7 +401,7 @@ static unsigned long smb_update_buffer(struct coresight_device *csdev, + if (!buf) + return 0; + +- mutex_lock(&drvdata->mutex); ++ spin_lock(&drvdata->spinlock); + + /* Don't do anything if another tracer is using this sink. */ + if (atomic_read(&csdev->refcnt) != 1) +@@ -432,7 +425,7 @@ static unsigned long smb_update_buffer(struct coresight_device *csdev, + if (!buf->snapshot && lost) + perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); + out: +- mutex_unlock(&drvdata->mutex); ++ spin_unlock(&drvdata->spinlock); + + return data_size; + } +@@ -590,7 +583,7 @@ static int smb_probe(struct platform_device *pdev) + return ret; + } + +- mutex_init(&drvdata->mutex); ++ spin_lock_init(&drvdata->spinlock); + drvdata->pid = -1; + + ret = smb_register_sink(pdev, drvdata); +diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.h b/drivers/hwtracing/coresight/ultrasoc-smb.h +index d2e14e8d2c8a8..82a44c14a8829 100644 +--- a/drivers/hwtracing/coresight/ultrasoc-smb.h ++++ b/drivers/hwtracing/coresight/ultrasoc-smb.h +@@ -8,7 +8,7 @@ + #define _ULTRASOC_SMB_H + + #include +-#include ++#include + + /* Offset of SMB global registers */ + #define SMB_GLB_CFG_REG 0x00 +@@ -105,7 +105,7 @@ struct smb_data_buffer { + * @csdev: Component vitals needed by the framework. + * @sdb: Data buffer for SMB. + * @miscdev: Specifics to handle "/dev/xyz.smb" entry. +- * @mutex: Control data access to one at a time. ++ * @spinlock: Control data access to one at a time. + * @reading: Synchronise user space access to SMB buffer. + * @pid: Process ID of the process being monitored by the + * session that is using this component. +@@ -116,7 +116,7 @@ struct smb_drv_data { + struct coresight_device *csdev; + struct smb_data_buffer sdb; + struct miscdevice miscdev; +- struct mutex mutex; ++ spinlock_t spinlock; + bool reading; + pid_t pid; + enum cs_mode mode; +-- +2.42.0 + diff --git a/queue-6.6/coresight-ultrasoc-smb-fix-uninitialized-before-use-.patch b/queue-6.6/coresight-ultrasoc-smb-fix-uninitialized-before-use-.patch new file mode 100644 index 00000000000..fbc48275cf6 --- /dev/null +++ b/queue-6.6/coresight-ultrasoc-smb-fix-uninitialized-before-use-.patch @@ -0,0 +1,47 @@ +From fd0e418758282bfcf58c9fbd29fbeb2c20c86e12 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Nov 2023 21:33:45 +0800 +Subject: coresight: ultrasoc-smb: Fix uninitialized before use buf_hw_base + +From: Junhao He + +[ Upstream commit 862c135bde8bc185e8aae2110374175e6a1b6ed5 ] + +In smb_reset_buffer, the sdb->buf_hw_base variable is uninitialized +before use, which initializes it in smb_init_data_buffer. And the SMB +regiester are set in smb_config_inport. +So move the call after smb_config_inport. + +Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver") +Signed-off-by: Junhao He +Reviewed-by: James Clark +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20231114133346.30489-4-hejunhao3@huawei.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/coresight/ultrasoc-smb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c +index 2f2aba90a5148..6e32d31a95fe0 100644 +--- a/drivers/hwtracing/coresight/ultrasoc-smb.c ++++ b/drivers/hwtracing/coresight/ultrasoc-smb.c +@@ -477,7 +477,6 @@ static int smb_init_data_buffer(struct platform_device *pdev, + static void smb_init_hw(struct smb_drv_data *drvdata) + { + smb_disable_hw(drvdata); +- smb_reset_buffer(drvdata); + + writel(SMB_LB_CFG_LO_DEFAULT, drvdata->base + SMB_LB_CFG_LO_REG); + writel(SMB_LB_CFG_HI_DEFAULT, drvdata->base + SMB_LB_CFG_HI_REG); +@@ -587,6 +586,7 @@ static int smb_probe(struct platform_device *pdev) + if (ret) + return ret; + ++ smb_reset_buffer(drvdata); + platform_set_drvdata(pdev, drvdata); + spin_lock_init(&drvdata->spinlock); + drvdata->pid = -1; +-- +2.42.0 + diff --git a/queue-6.6/drm-amdgpu-disable-mcbp-by-default.patch b/queue-6.6/drm-amdgpu-disable-mcbp-by-default.patch new file mode 100644 index 00000000000..47dcd1f179e --- /dev/null +++ b/queue-6.6/drm-amdgpu-disable-mcbp-by-default.patch @@ -0,0 +1,41 @@ +From 0d334cb01f26dbeadea8a5238f8d77a8a12afab8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Dec 2023 08:38:15 +0800 +Subject: drm/amdgpu: disable MCBP by default + +From: Jiadong Zhu + +[ Upstream commit d6a57588666301acd9d42d3b00d74240964f07f6 ] + +Disable MCBP(mid command buffer preemption) by default as old Mesa +hangs with it. We shall not enable the feature that breaks old usermode +driver. + +Fixes: 50a7c8765ca6 ("drm/amdgpu: enable mcbp by default on gfx9") +Signed-off-by: Jiadong Zhu +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index a164857bdb9f4..94e91516952c4 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -3478,10 +3478,6 @@ static void amdgpu_device_set_mcbp(struct amdgpu_device *adev) + adev->gfx.mcbp = true; + else if (amdgpu_mcbp == 0) + adev->gfx.mcbp = false; +- else if ((adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 0, 0)) && +- (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 0, 0)) && +- adev->gfx.num_gfx_rings) +- adev->gfx.mcbp = true; + + if (amdgpu_sriov_vf(adev)) + adev->gfx.mcbp = true; +-- +2.42.0 + diff --git a/queue-6.6/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch b/queue-6.6/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch new file mode 100644 index 00000000000..9d05e0e3745 --- /dev/null +++ b/queue-6.6/hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch @@ -0,0 +1,51 @@ +From a9a284f01af05a8b9bfc49a9d647b9196a295b69 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Oct 2023 16:47:31 +0800 +Subject: hwtracing: hisi_ptt: Add dummy callback pmu::read() + +From: Junhao He + +[ Upstream commit 55e0a2fb0cb5ab7c9c99c1ad4d3e6954de8b73a0 ] + +When start trace with perf option "-C $cpu" and immediately stop it +with SIGTERM or others, the perf core will invoke pmu::read() while +the driver doesn't implement it. Add a dummy pmu::read() to avoid +any issues. + +Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") +Signed-off-by: Junhao He +Signed-off-by: Yicong Yang +Acked-by: Jonathan Cameron +Signed-off-by: Suzuki K Poulose +Link: https://lore.kernel.org/r/20231010084731.30450-6-yangyicong@huawei.com +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/ptt/hisi_ptt.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c +index 49ea1b0f74890..3045d1894b81b 100644 +--- a/drivers/hwtracing/ptt/hisi_ptt.c ++++ b/drivers/hwtracing/ptt/hisi_ptt.c +@@ -1178,6 +1178,10 @@ static void hisi_ptt_pmu_del(struct perf_event *event, int flags) + hisi_ptt_pmu_stop(event, PERF_EF_UPDATE); + } + ++static void hisi_ptt_pmu_read(struct perf_event *event) ++{ ++} ++ + static void hisi_ptt_remove_cpuhp_instance(void *hotplug_node) + { + cpuhp_state_remove_instance_nocalls(hisi_ptt_pmu_online, hotplug_node); +@@ -1221,6 +1225,7 @@ static int hisi_ptt_register_pmu(struct hisi_ptt *hisi_ptt) + .stop = hisi_ptt_pmu_stop, + .add = hisi_ptt_pmu_add, + .del = hisi_ptt_pmu_del, ++ .read = hisi_ptt_pmu_read, + }; + + reg = readl(hisi_ptt->iobase + HISI_PTT_LOCATION); +-- +2.42.0 + diff --git a/queue-6.6/loongarch-bpf-don-t-sign-extend-function-return-valu.patch b/queue-6.6/loongarch-bpf-don-t-sign-extend-function-return-valu.patch new file mode 100644 index 00000000000..9a05122ecf6 --- /dev/null +++ b/queue-6.6/loongarch-bpf-don-t-sign-extend-function-return-valu.patch @@ -0,0 +1,157 @@ +From 92e64456efabc46801bc3725f54369d4f86dac60 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 15:49:16 +0800 +Subject: LoongArch: BPF: Don't sign extend function return value + +From: Hengqi Chen + +[ Upstream commit 5d47ec2e6f4c64e30e392cfe9532df98c9beb106 ] + +The `cls_redirect` test triggers a kernel panic like: + + # ./test_progs -t cls_redirect + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + [ 30.938489] CPU 3 Unable to handle kernel paging request at virtual address fffffffffd814de0, era == ffff800002009fb8, ra == ffff800002009f9c + [ 30.939331] Oops[#1]: + [ 30.939513] CPU: 3 PID: 1260 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 #35 a896aca3f4164f09cc346f89f2e09832e07be5f6 + [ 30.939732] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022 + [ 30.939901] pc ffff800002009fb8 ra ffff800002009f9c tp 9000000104da4000 sp 9000000104da7ab0 + [ 30.940038] a0 fffffffffd814de0 a1 9000000104da7a68 a2 0000000000000000 a3 9000000104da7c10 + [ 30.940183] a4 9000000104da7c14 a5 0000000000000002 a6 0000000000000021 a7 00005555904d7f90 + [ 30.940321] t0 0000000000000110 t1 0000000000000000 t2 fffffffffd814de0 t3 0004c4b400000000 + [ 30.940456] t4 ffffffffffffffff t5 00000000c3f63600 t6 0000000000000000 t7 0000000000000000 + [ 30.940590] t8 000000000006d803 u0 0000000000000020 s9 9000000104da7b10 s0 900000010504c200 + [ 30.940727] s1 fffffffffd814de0 s2 900000010504c200 s3 9000000104da7c10 s4 9000000104da7ad0 + [ 30.940866] s5 0000000000000000 s6 90000000030e65bc s7 9000000104da7b44 s8 90000000044f6fc0 + [ 30.941015] ra: ffff800002009f9c bpf_prog_846803e5ae81417f_cls_redirect+0xa0/0x590 + [ 30.941535] ERA: ffff800002009fb8 bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590 + [ 30.941696] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) + [ 30.942224] PRMD: 00000004 (PPLV0 +PIE -PWE) + [ 30.942330] EUEN: 00000003 (+FPE +SXE -ASXE -BTE) + [ 30.942453] ECFG: 00071c1c (LIE=2-4,10-12 VS=7) + [ 30.942612] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0) + [ 30.942764] BADV: fffffffffd814de0 + [ 30.942854] PRID: 0014c010 (Loongson-64bit, Loongson-3A5000) + [ 30.942974] Modules linked in: + [ 30.943078] Process test_progs (pid: 1260, threadinfo=00000000ce303226, task=000000007d10bb76) + [ 30.943306] Stack : 900000010a064000 90000000044f6fc0 9000000104da7b48 0000000000000000 + [ 30.943495] 0000000000000000 9000000104da7c14 9000000104da7c10 900000010504c200 + [ 30.943626] 0000000000000001 ffff80001b88c000 9000000104da7b70 90000000030e6668 + [ 30.943785] 0000000000000000 9000000104da7b58 ffff80001b88c048 9000000003d05000 + [ 30.943936] 900000000303ac88 0000000000000000 0000000000000000 9000000104da7b70 + [ 30.944091] 0000000000000000 0000000000000001 0000000731eeab00 0000000000000000 + [ 30.944245] ffff80001b88c000 0000000000000000 0000000000000000 54b99959429f83b8 + [ 30.944402] ffff80001b88c000 90000000044f6fc0 9000000101d70000 ffff80001b88c000 + [ 30.944538] 000000000000005a 900000010504c200 900000010a064000 900000010a067000 + [ 30.944697] 9000000104da7d88 0000000000000000 9000000003d05000 90000000030e794c + [ 30.944852] ... + [ 30.944924] Call Trace: + [ 30.945120] [] bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590 + [ 30.945650] [<90000000030e6668>] bpf_test_run+0x1ec/0x2f8 + [ 30.945958] [<90000000030e794c>] bpf_prog_test_run_skb+0x31c/0x684 + [ 30.946065] [<90000000026d4f68>] __sys_bpf+0x678/0x2724 + [ 30.946159] [<90000000026d7288>] sys_bpf+0x20/0x2c + [ 30.946253] [<90000000032dd224>] do_syscall+0x7c/0x94 + [ 30.946343] [<9000000002541c5c>] handle_syscall+0xbc/0x158 + [ 30.946492] + [ 30.946549] Code: 0015030e 5c0009c0 5001d000 <28c00304> 02c00484 29c00304 00150009 2a42d2e4 0280200d + [ 30.946793] + [ 30.946971] ---[ end trace 0000000000000000 ]--- + [ 32.093225] Kernel panic - not syncing: Fatal exception in interrupt + [ 32.093526] Kernel relocated by 0x2320000 + [ 32.093630] .text @ 0x9000000002520000 + [ 32.093725] .data @ 0x9000000003400000 + [ 32.093792] .bss @ 0x9000000004413200 + [ 34.971998] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]--- + +This is because we signed-extend function return values. When subprog +mode is enabled, we have: + + cls_redirect() + -> get_global_metrics() returns pcpu ptr 0xfffffefffc00b480 + +The pointer returned is later signed-extended to 0xfffffffffc00b480 at +`BPF_JMP | BPF_EXIT`. During BPF prog run, this triggers unhandled page +fault and a kernel panic. + +Drop the unnecessary signed-extension on return values like other +architectures do. + +With this change, we have: + + # ./test_progs -t cls_redirect + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + #51/1 cls_redirect/cls_redirect_inlined:OK + #51/2 cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK + #51/3 cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK + #51/4 cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK + #51/5 cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK + #51/6 cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK + #51/7 cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK + #51/8 cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK + #51/9 cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK + #51/10 cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK + #51/11 cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK + #51/12 cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK + #51/13 cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK + #51/14 cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK + #51/15 cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK + #51/16 cls_redirect/cls_redirect_subprogs:OK + #51/17 cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK + #51/18 cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK + #51/19 cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK + #51/20 cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK + #51/21 cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK + #51/22 cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK + #51/23 cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK + #51/24 cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK + #51/25 cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK + #51/26 cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK + #51/27 cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK + #51/28 cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK + #51/29 cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK + #51/30 cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK + #51/31 cls_redirect/cls_redirect_dynptr:OK + #51/32 cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK + #51/33 cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK + #51/34 cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK + #51/35 cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK + #51/36 cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK + #51/37 cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK + #51/38 cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK + #51/39 cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK + #51/40 cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK + #51/41 cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK + #51/42 cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK + #51/43 cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK + #51/44 cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK + #51/45 cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK + #51 cls_redirect:OK + Summary: 1/45 PASSED, 0 SKIPPED, 0 FAILED + +Fixes: 5dc615520c4d ("LoongArch: Add BPF JIT support") +Signed-off-by: Hengqi Chen +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/net/bpf_jit.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c +index 5d02bc6acec2e..00915fb3cb82c 100644 +--- a/arch/loongarch/net/bpf_jit.c ++++ b/arch/loongarch/net/bpf_jit.c +@@ -855,8 +855,6 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext + + /* function return */ + case BPF_JMP | BPF_EXIT: +- emit_sext_32(ctx, regmap[BPF_REG_0], true); +- + if (i == ctx->prog->len - 1) + break; + +-- +2.42.0 + diff --git a/queue-6.6/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch b/queue-6.6/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch new file mode 100644 index 00000000000..c13d8dce788 --- /dev/null +++ b/queue-6.6/loongarch-bpf-don-t-sign-extend-memory-load-operand.patch @@ -0,0 +1,159 @@ +From 6c6c56f3d438cf8f0dc8a9e9e6d112f170edbd8e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 15:49:16 +0800 +Subject: LoongArch: BPF: Don't sign extend memory load operand + +From: Hengqi Chen + +[ Upstream commit fe5757553bf9ebe45ae8ecab5922f6937c8d8dfc ] + +The `cgrp_local_storage` test triggers a kernel panic like: + + # ./test_progs -t cgrp_local_storage + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + [ 550.930632] CPU 1 Unable to handle kernel paging request at virtual address 0000000000000080, era == ffff80000200be34, ra == ffff80000200be00 + [ 550.931781] Oops[#1]: + [ 550.931966] CPU: 1 PID: 1303 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 #35 a896aca3f4164f09cc346f89f2e09832e07be5f6 + [ 550.932215] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022 + [ 550.932403] pc ffff80000200be34 ra ffff80000200be00 tp 9000000108350000 sp 9000000108353dc0 + [ 550.932545] a0 0000000000000000 a1 0000000000000517 a2 0000000000000118 a3 00007ffffbb15558 + [ 550.932682] a4 00007ffffbb15620 a5 90000001004e7700 a6 0000000000000021 a7 0000000000000118 + [ 550.932824] t0 ffff80000200bdc0 t1 0000000000000517 t2 0000000000000517 t3 00007ffff1c06ee0 + [ 550.932961] t4 0000555578ae04d0 t5 fffffffffffffff8 t6 0000000000000004 t7 0000000000000020 + [ 550.933097] t8 0000000000000040 u0 00000000000007b8 s9 9000000108353e00 s0 90000001004e7700 + [ 550.933241] s1 9000000004005000 s2 0000000000000001 s3 0000000000000000 s4 0000555555eb2ec8 + [ 550.933379] s5 00007ffffbb15bb8 s6 00007ffff1dafd60 s7 000055555663f610 s8 00007ffff1db0050 + [ 550.933520] ra: ffff80000200be00 bpf_prog_98f1b9e767be2a84_on_enter+0x40/0x200 + [ 550.933911] ERA: ffff80000200be34 bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200 + [ 550.934105] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) + [ 550.934596] PRMD: 00000004 (PPLV0 +PIE -PWE) + [ 550.934712] EUEN: 00000003 (+FPE +SXE -ASXE -BTE) + [ 550.934836] ECFG: 00071c1c (LIE=2-4,10-12 VS=7) + [ 550.934976] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0) + [ 550.935097] BADV: 0000000000000080 + [ 550.935181] PRID: 0014c010 (Loongson-64bit, Loongson-3A5000) + [ 550.935291] Modules linked in: + [ 550.935391] Process test_progs (pid: 1303, threadinfo=000000006c3b1c41, task=0000000061f84a55) + [ 550.935643] Stack : 00007ffffbb15bb8 0000555555eb2ec8 0000000000000000 0000000000000001 + [ 550.935844] 9000000004005000 ffff80001b864000 00007ffffbb15450 90000000029aa034 + [ 550.935990] 0000000000000000 9000000108353ec0 0000000000000118 d07d9dfb09721a09 + [ 550.936175] 0000000000000001 0000000000000000 9000000108353ec0 0000000000000118 + [ 550.936314] 9000000101d46ad0 900000000290abf0 000055555663f610 0000000000000000 + [ 550.936479] 0000000000000003 9000000108353ec0 00007ffffbb15450 90000000029d7288 + [ 550.936635] 00007ffff1dafd60 000055555663f610 0000000000000000 0000000000000003 + [ 550.936779] 9000000108353ec0 90000000035dd1f0 00007ffff1dafd58 9000000002841c5c + [ 550.936939] 0000000000000119 0000555555eea5a8 00007ffff1d78780 00007ffffbb153e0 + [ 550.937083] ffffffffffffffda 00007ffffbb15518 0000000000000040 00007ffffbb15558 + [ 550.937224] ... + [ 550.937299] Call Trace: + [ 550.937521] [] bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200 + [ 550.937910] [<90000000029aa034>] bpf_trace_run2+0x90/0x154 + [ 550.938105] [<900000000290abf0>] syscall_trace_enter.isra.0+0x1cc/0x200 + [ 550.938224] [<90000000035dd1f0>] do_syscall+0x48/0x94 + [ 550.938319] [<9000000002841c5c>] handle_syscall+0xbc/0x158 + [ 550.938477] + [ 550.938607] Code: 580009ae 50016000 262402e4 <28c20085> 14092084 03a00084 16000024 03240084 00150006 + [ 550.938851] + [ 550.939021] ---[ end trace 0000000000000000 ]--- + +Further investigation shows that this panic is triggered by memory +load operations: + + ptr = bpf_cgrp_storage_get(&map_a, task->cgroups->dfl_cgrp, 0, + BPF_LOCAL_STORAGE_GET_F_CREATE); + +The expression `task->cgroups->dfl_cgrp` involves two memory load. +Since the field offset fits in imm12 or imm14, we use ldd or ldptrd +instructions. But both instructions have the side effect that it will +signed-extended the imm operand. Finally, we got the wrong addresses +and panics is inevitable. + +Use a generic ldxd instruction to avoid this kind of issues. + +With this change, we have: + + # ./test_progs -t cgrp_local_storage + Can't find bpf_testmod.ko kernel module: -2 + WARNING! Selftests relying on bpf_testmod.ko will be skipped. + test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec + #48/1 cgrp_local_storage/tp_btf:OK + test_attach_cgroup:PASS:skel_open 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22 + test_attach_cgroup:FAIL:prog_attach unexpected error: -524 + #48/2 cgrp_local_storage/attach_cgroup:FAIL + test_recursion:PASS:skel_open_and_load 0 nsec + libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'on_lookup': failed to auto-attach: -524 + test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/3 cgrp_local_storage/recursion:FAIL + #48/4 cgrp_local_storage/negative:OK + #48/5 cgrp_local_storage/cgroup_iter_sleepable:OK + test_yes_rcu_lock:PASS:skel_open 0 nsec + test_yes_rcu_lock:PASS:skel_load 0 nsec + libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524 + test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/6 cgrp_local_storage/yes_rcu_lock:FAIL + #48/7 cgrp_local_storage/no_rcu_lock:OK + #48 cgrp_local_storage:FAIL + + All error logs: + test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec + test_attach_cgroup:PASS:skel_open 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + test_attach_cgroup:PASS:prog_attach 0 nsec + libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22 + test_attach_cgroup:FAIL:prog_attach unexpected error: -524 + #48/2 cgrp_local_storage/attach_cgroup:FAIL + test_recursion:PASS:skel_open_and_load 0 nsec + libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'on_lookup': failed to auto-attach: -524 + test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/3 cgrp_local_storage/recursion:FAIL + test_yes_rcu_lock:PASS:skel_open 0 nsec + test_yes_rcu_lock:PASS:skel_load 0 nsec + libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22 + libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524 + test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524) + #48/6 cgrp_local_storage/yes_rcu_lock:FAIL + #48 cgrp_local_storage:FAIL + Summary: 0/4 PASSED, 0 SKIPPED, 1 FAILED + +No panics any more (The test still failed because lack of BPF trampoline +which I am actively working on). + +Fixes: 5dc615520c4d ("LoongArch: Add BPF JIT support") +Signed-off-by: Hengqi Chen +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/net/bpf_jit.c | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c +index db9342b2d0e66..5d02bc6acec2e 100644 +--- a/arch/loongarch/net/bpf_jit.c ++++ b/arch/loongarch/net/bpf_jit.c +@@ -907,14 +907,8 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext + } + break; + case BPF_DW: +- if (is_signed_imm12(off)) { +- emit_insn(ctx, ldd, dst, src, off); +- } else if (is_signed_imm14(off)) { +- emit_insn(ctx, ldptrd, dst, src, off); +- } else { +- move_imm(ctx, t1, off, is32); +- emit_insn(ctx, ldxd, dst, src, t1); +- } ++ move_imm(ctx, t1, off, is32); ++ emit_insn(ctx, ldxd, dst, src, t1); + break; + } + +-- +2.42.0 + diff --git a/queue-6.6/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch b/queue-6.6/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch new file mode 100644 index 00000000000..8859ebc0693 --- /dev/null +++ b/queue-6.6/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch @@ -0,0 +1,38 @@ +From c6b45086adf5f8a0b69203215d10d6a88bda9d9e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 17:55:26 +0800 +Subject: misc: mei: client.c: fix problem of return '-EOVERFLOW' in + mei_cl_write + +From: Su Hui + +[ Upstream commit ee6236027218f8531916f1c5caa5dc330379f287 ] + +Clang static analyzer complains that value stored to 'rets' is never +read.Let 'buf_len = -EOVERFLOW' to make sure we can return '-EOVERFLOW'. + +Fixes: 8c8d964ce90f ("mei: move hbuf_depth from the mei device to the hw modules") +Signed-off-by: Su Hui +Link: https://lore.kernel.org/r/20231120095523.178385-2-suhui@nfschina.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/mei/client.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c +index 75bc2a32ec0d7..32f2287823184 100644 +--- a/drivers/misc/mei/client.c ++++ b/drivers/misc/mei/client.c +@@ -2032,7 +2032,7 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, unsigned long time + + hbuf_slots = mei_hbuf_empty_slots(dev); + if (hbuf_slots < 0) { +- rets = -EOVERFLOW; ++ buf_len = -EOVERFLOW; + goto out; + } + +-- +2.42.0 + diff --git a/queue-6.6/misc-mei-client.c-return-negative-error-code-in-mei_.patch b/queue-6.6/misc-mei-client.c-return-negative-error-code-in-mei_.patch new file mode 100644 index 00000000000..bdb34814710 --- /dev/null +++ b/queue-6.6/misc-mei-client.c-return-negative-error-code-in-mei_.patch @@ -0,0 +1,37 @@ +From 93d4cdc31dfca96c4fd1de73885354453a25b462 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 17:55:23 +0800 +Subject: misc: mei: client.c: return negative error code in mei_cl_write + +From: Su Hui + +[ Upstream commit 8f06aee8089cf42fd99a20184501bd1347ce61b9 ] + +mei_msg_hdr_init() return negative error code, rets should be +'PTR_ERR(mei_hdr)' rather than '-PTR_ERR(mei_hdr)'. + +Fixes: 0cd7c01a60f8 ("mei: add support for mei extended header.") +Signed-off-by: Su Hui +Link: https://lore.kernel.org/r/20231120095523.178385-1-suhui@nfschina.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/mei/client.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c +index 5c19097266fe0..75bc2a32ec0d7 100644 +--- a/drivers/misc/mei/client.c ++++ b/drivers/misc/mei/client.c +@@ -2011,7 +2011,7 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, unsigned long time + + mei_hdr = mei_msg_hdr_init(cb); + if (IS_ERR(mei_hdr)) { +- rets = -PTR_ERR(mei_hdr); ++ rets = PTR_ERR(mei_hdr); + mei_hdr = NULL; + goto err; + } +-- +2.42.0 + diff --git a/queue-6.6/parisc-fix-asm-operand-number-out-of-range-build-err.patch b/queue-6.6/parisc-fix-asm-operand-number-out-of-range-build-err.patch new file mode 100644 index 00000000000..6391ff4cbe7 --- /dev/null +++ b/queue-6.6/parisc-fix-asm-operand-number-out-of-range-build-err.patch @@ -0,0 +1,37 @@ +From 6d9596ddce366a7925e41e443ff029b387bf9736 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 10:39:26 +0100 +Subject: parisc: Fix asm operand number out of range build error in bug table + +From: Helge Deller + +[ Upstream commit 487635756198cad563feb47539c6a37ea57f1dae ] + +Build is broken if CONFIG_DEBUG_BUGVERBOSE=n. +Fix it be using the correct asm operand number. + +Signed-off-by: Helge Deller +Reported-by: Linux Kernel Functional Testing +Fixes: fe76a1349f23 ("parisc: Use natural CPU alignment for bug_table") +Cc: stable@vger.kernel.org # v6.0+ +Signed-off-by: Sasha Levin +--- + arch/parisc/include/asm/bug.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h +index 1641ff9a8b83e..833555f74ffa7 100644 +--- a/arch/parisc/include/asm/bug.h ++++ b/arch/parisc/include/asm/bug.h +@@ -71,7 +71,7 @@ + asm volatile("\n" \ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ +- "\t.align %2\n" \ ++ "\t.align 4\n" \ + "2:\t" __BUG_REL(1b) "\n" \ + "\t.short %0\n" \ + "\t.blockz %1-4-2\n" \ +-- +2.42.0 + diff --git a/queue-6.6/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch b/queue-6.6/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch new file mode 100644 index 00000000000..e24722b794c --- /dev/null +++ b/queue-6.6/parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch @@ -0,0 +1,122 @@ +From 66aba1208c46675497fe08e01a9b44a407d638cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Nov 2023 21:57:19 +0100 +Subject: parisc: Reduce size of the bug_table on 64-bit kernel by half + +From: Helge Deller + +[ Upstream commit 43266838515d30dc0c45d5c7e6e7edacee6cce92 ] + +Enable GENERIC_BUG_RELATIVE_POINTERS which will store 32-bit relative +offsets to the bug address and the source file name instead of 64-bit +absolute addresses. This effectively reduces the size of the +bug_table[] array by half on 64-bit kernels. + +Signed-off-by: Helge Deller +Stable-dep-of: 487635756198 ("parisc: Fix asm operand number out of range build error in bug table") +Signed-off-by: Sasha Levin +--- + arch/parisc/Kconfig | 7 +++++-- + arch/parisc/include/asm/bug.h | 34 +++++++++++++++++----------------- + 2 files changed, 22 insertions(+), 19 deletions(-) + +diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig +index 68cbe666510a3..8c45b98dfe0e4 100644 +--- a/arch/parisc/Kconfig ++++ b/arch/parisc/Kconfig +@@ -113,9 +113,12 @@ config ARCH_HAS_ILOG2_U64 + default n + + config GENERIC_BUG +- bool +- default y ++ def_bool y + depends on BUG ++ select GENERIC_BUG_RELATIVE_POINTERS if 64BIT ++ ++config GENERIC_BUG_RELATIVE_POINTERS ++ bool + + config GENERIC_HWEIGHT + bool +diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h +index b9cad0bb4461b..1641ff9a8b83e 100644 +--- a/arch/parisc/include/asm/bug.h ++++ b/arch/parisc/include/asm/bug.h +@@ -17,26 +17,27 @@ + #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff" + #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */ + +-#if defined(CONFIG_64BIT) +-#define ASM_WORD_INSN ".dword\t" ++#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS ++# define __BUG_REL(val) ".word " __stringify(val) " - ." + #else +-#define ASM_WORD_INSN ".word\t" ++# define __BUG_REL(val) ".word " __stringify(val) + #endif + ++ + #ifdef CONFIG_DEBUG_BUGVERBOSE + #define BUG() \ + do { \ + asm volatile("\n" \ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ +- "\t.align %4\n" \ +- "2:\t" ASM_WORD_INSN "1b, %c0\n" \ ++ "\t.align 4\n" \ ++ "2:\t" __BUG_REL(1b) "\n" \ ++ "\t" __BUG_REL(%c0) "\n" \ + "\t.short %1, %2\n" \ +- "\t.blockz %3-2*%4-2*2\n" \ ++ "\t.blockz %3-2*4-2*2\n" \ + "\t.popsection" \ + : : "i" (__FILE__), "i" (__LINE__), \ +- "i" (0), "i" (sizeof(struct bug_entry)), \ +- "i" (sizeof(long)) ); \ ++ "i" (0), "i" (sizeof(struct bug_entry)) ); \ + unreachable(); \ + } while(0) + +@@ -54,15 +55,15 @@ + asm volatile("\n" \ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ +- "\t.align %4\n" \ +- "2:\t" ASM_WORD_INSN "1b, %c0\n" \ ++ "\t.align 4\n" \ ++ "2:\t" __BUG_REL(1b) "\n" \ ++ "\t" __BUG_REL(%c0) "\n" \ + "\t.short %1, %2\n" \ +- "\t.blockz %3-2*%4-2*2\n" \ ++ "\t.blockz %3-2*4-2*2\n" \ + "\t.popsection" \ + : : "i" (__FILE__), "i" (__LINE__), \ + "i" (BUGFLAG_WARNING|(flags)), \ +- "i" (sizeof(struct bug_entry)), \ +- "i" (sizeof(long)) ); \ ++ "i" (sizeof(struct bug_entry)) ); \ + } while(0) + #else + #define __WARN_FLAGS(flags) \ +@@ -71,13 +72,12 @@ + "1:\t" PARISC_BUG_BREAK_ASM "\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ + "\t.align %2\n" \ +- "2:\t" ASM_WORD_INSN "1b\n" \ ++ "2:\t" __BUG_REL(1b) "\n" \ + "\t.short %0\n" \ +- "\t.blockz %1-%2-2\n" \ ++ "\t.blockz %1-4-2\n" \ + "\t.popsection" \ + : : "i" (BUGFLAG_WARNING|(flags)), \ +- "i" (sizeof(struct bug_entry)), \ +- "i" (sizeof(long)) ); \ ++ "i" (sizeof(struct bug_entry)) ); \ + } while(0) + #endif + +-- +2.42.0 + diff --git a/queue-6.6/perf-vendor-events-arm64-ampereone-add-missing-defau.patch b/queue-6.6/perf-vendor-events-arm64-ampereone-add-missing-defau.patch new file mode 100644 index 00000000000..6413e91bc26 --- /dev/null +++ b/queue-6.6/perf-vendor-events-arm64-ampereone-add-missing-defau.patch @@ -0,0 +1,53 @@ +From 3cd6d7e61dc7db62f7a34871eb7dc4868162ff44 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Nov 2023 18:15:48 -0800 +Subject: perf vendor events arm64: AmpereOne: Add missing + DefaultMetricgroupName fields + +From: Ilkka Koskinen + +[ Upstream commit 90fe70d4e23cb57253d2668a171d5695c332deb7 ] + +AmpereOne metrics were missing DefaultMetricgroupName from metrics with +"Default" in group name resulting perf to segfault. Add the missing +field to address the issue. + +Fixes: 59faeaf80d02 ("perf vendor events arm64: Fix for AmpereOne metrics") +Signed-off-by: Ilkka Koskinen +Reviewed-by: Ian Rogers +Cc: James Clark +Cc: Will Deacon +Cc: Leo Yan +Cc: Mike Leach +Cc: John Garry +Cc: linux-arm-kernel@lists.infradead.org +Link: https://lore.kernel.org/r/20231201021550.1109196-2-ilkka@os.amperecomputing.com +Signed-off-by: Namhyung Kim +Signed-off-by: Sasha Levin +--- + tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json +index e2848a9d48487..afcdad58ef89c 100644 +--- a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json ++++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json +@@ -231,6 +231,7 @@ + "MetricName": "slots_lost_misspeculation_fraction", + "MetricExpr": "100 * ((OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots))", + "BriefDescription": "Fraction of slots lost due to misspeculation", ++ "DefaultMetricgroupName": "TopdownL1", + "MetricGroup": "Default;TopdownL1", + "ScaleUnit": "1percent of slots" + }, +@@ -238,6 +239,7 @@ + "MetricName": "retired_fraction", + "MetricExpr": "100 * (OP_RETIRED / (CPU_CYCLES * #slots))", + "BriefDescription": "Fraction of slots retiring, useful work", ++ "DefaultMetricgroupName": "TopdownL1", + "MetricGroup": "Default;TopdownL1", + "ScaleUnit": "1percent of slots" + }, +-- +2.42.0 + diff --git a/queue-6.6/series b/queue-6.6/series index 6f0c5161489..a0f0b4233eb 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -186,3 +186,19 @@ arm64-dts-mediatek-mt8183-move-thermal-zones-to-the-root-node.patch arm64-dts-mediatek-mt8183-evb-fix-unit_address_vs_reg-warning-on-ntc.patch arm64-dts-mediatek-mt8186-fix-clock-names-for-power-domains.patch arm64-dts-mediatek-mt8186-change-gpu-speedbin-nvmem-cell-name.patch +coresight-etm4x-remove-bogous-__exit-annotation-for-.patch +coresight-fix-crash-when-perf-and-sysfs-modes-are-us.patch +hwtracing-hisi_ptt-add-dummy-callback-pmu-read.patch +coresight-ultrasoc-smb-fix-sleep-while-close-preempt.patch +coresight-ultrasoc-smb-config-smb-buffer-before-regi.patch +coresight-ultrasoc-smb-fix-uninitialized-before-use-.patch +misc-mei-client.c-return-negative-error-code-in-mei_.patch +misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch +perf-vendor-events-arm64-ampereone-add-missing-defau.patch +loongarch-bpf-don-t-sign-extend-memory-load-operand.patch +loongarch-bpf-don-t-sign-extend-function-return-valu.patch +parisc-reduce-size-of-the-bug_table-on-64-bit-kernel.patch +parisc-fix-asm-operand-number-out-of-range-build-err.patch +arm64-dts-mediatek-add-missing-space-before.patch +arm64-dts-mt8183-kukui-fix-underscores-in-node-names.patch +drm-amdgpu-disable-mcbp-by-default.patch -- 2.47.3