From: Sasha Levin Date: Fri, 24 Nov 2023 04:28:41 +0000 (-0500) Subject: Fixes for 5.15 X-Git-Tag: v4.14.331~79^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13bced1aebb82edb36d2e6734090c451aa887bcd;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/arm64-dts-qcom-ipq6018-fix-tcsr_mutex-register-size.patch b/queue-5.15/arm64-dts-qcom-ipq6018-fix-tcsr_mutex-register-size.patch new file mode 100644 index 00000000000..08e39a75568 --- /dev/null +++ b/queue-5.15/arm64-dts-qcom-ipq6018-fix-tcsr_mutex-register-size.patch @@ -0,0 +1,45 @@ +From b320a6fab8a13f95cd736a0c2355ceac8c0239c8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Sep 2023 15:25:34 +0530 +Subject: arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size + +From: Vignesh Viswanathan + +[ Upstream commit 72fc3d58b87b0d622039c6299b89024fbb7b420f ] + +IPQ6018's TCSR Mutex HW lock register has 32 locks of size 4KB each. +Total size of the TCSR Mutex registers is 128KB. + +Fix size of the tcsr_mutex hwlock register to 0x20000. + +Changes in v2: + - Drop change to remove qcom,ipq6018-tcsr-mutex compatible string + - Added Fixes and stable tags + +Cc: stable@vger.kernel.org +Fixes: 5bf635621245 ("arm64: dts: ipq6018: Add a few device nodes") +Signed-off-by: Vignesh Viswanathan +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230905095535.1263113-2-quic_viswanat@quicinc.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +index 43339557d7e5a..dde6fde10f8d3 100644 +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -249,7 +249,7 @@ + + tcsr_mutex: hwlock@1905000 { + compatible = "qcom,ipq6018-tcsr-mutex", "qcom,tcsr-mutex"; +- reg = <0x0 0x01905000 0x0 0x1000>; ++ reg = <0x0 0x01905000 0x0 0x20000>; + #hwlock-cells = <1>; + }; + +-- +2.42.0 + diff --git a/queue-5.15/arm64-dts-qcom-ipq6018-switch-tcsr-mutex-to-mmio.patch b/queue-5.15/arm64-dts-qcom-ipq6018-switch-tcsr-mutex-to-mmio.patch new file mode 100644 index 00000000000..cdfb1198e80 --- /dev/null +++ b/queue-5.15/arm64-dts-qcom-ipq6018-switch-tcsr-mutex-to-mmio.patch @@ -0,0 +1,60 @@ +From 86c32aa55abcbc17b89d612029a81bc594f74ace Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Sep 2022 11:20:31 +0200 +Subject: arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO + +From: Krzysztof Kozlowski + +[ Upstream commit f5e303aefc06b7508d7a490f9a2d80e4dc134c70 ] + +The TCSR mutex bindings allow device to be described only with address +space (so it uses MMIO, not syscon regmap). This seems reasonable as +TCSR mutex is actually a dedicated IO address space and it also fixes DT +schema checks: + + qcom/ipq6018-cp01-c1.dtb: hwlock: 'reg' is a required property + qcom/ipq6018-cp01-c1.dtb: hwlock: 'syscon' does not match any of the regexes: 'pinctrl-[0-9]+' + +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Bjorn Andersson +Link: https://lore.kernel.org/r/20220909092035.223915-12-krzysztof.kozlowski@linaro.org +Stable-dep-of: 72fc3d58b87b ("arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +index 13651a5ac5a69..43339557d7e5a 100644 +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -129,12 +129,6 @@ + }; + }; + +- tcsr_mutex: hwlock { +- compatible = "qcom,tcsr-mutex"; +- syscon = <&tcsr_mutex_regs 0 0x80>; +- #hwlock-cells = <1>; +- }; +- + pmuv8: pmu { + compatible = "arm,cortex-a53-pmu"; + interrupts = ; + }; + +- tcsr_mutex_regs: syscon@1905000 { +- compatible = "syscon"; +- reg = <0x0 0x01905000 0x0 0x8000>; ++ tcsr_mutex: hwlock@1905000 { ++ compatible = "qcom,ipq6018-tcsr-mutex", "qcom,tcsr-mutex"; ++ reg = <0x0 0x01905000 0x0 0x1000>; ++ #hwlock-cells = <1>; + }; + + tcsr: syscon@1937000 { +-- +2.42.0 + diff --git a/queue-5.15/bluetooth-add-device-0bda-887b-to-device-tables.patch b/queue-5.15/bluetooth-add-device-0bda-887b-to-device-tables.patch new file mode 100644 index 00000000000..c98ca311f8a --- /dev/null +++ b/queue-5.15/bluetooth-add-device-0bda-887b-to-device-tables.patch @@ -0,0 +1,67 @@ +From a2a8e4ec74d5ef71081d246e29da4896591b5ef6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Mar 2023 19:52:02 -0500 +Subject: bluetooth: Add device 0bda:887b to device tables + +From: Larry Finger + +[ Upstream commit 730a1d1a93a3e30c3723f87af97a8517334b2203 ] + +This device is part of a Realtek RTW8852BE chip. + +The device table entry is as follows: + +T: Bus=03 Lev=01 Prnt=01 Port=12 Cnt=02 Dev#= 3 Spd=12 MxCh= 0 +D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 +P: Vendor=0bda ProdID=887b Rev= 0.00 +S: Manufacturer=Realtek +S: Product=Bluetooth Radio +S: SerialNumber=00e04c000001 +C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms +I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms +I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms +I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms +I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms +I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms + +Signed-off-by: Larry Finger +Signed-off-by: Luiz Augusto von Dentz +Stable-dep-of: da06ff1f585e ("Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE") +Signed-off-by: Sasha Levin +--- + drivers/bluetooth/btusb.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index c1ce5592921af..5b905f1501578 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -439,6 +439,8 @@ static const struct usb_device_id blacklist_table[] = { + /* Realtek 8852BE Bluetooth devices */ + { USB_DEVICE(0x0cb8, 0xc559), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, ++ { USB_DEVICE(0x0bda, 0x887b), .driver_info = BTUSB_REALTEK | ++ BTUSB_WIDEBAND_SPEECH }, + + /* Realtek Bluetooth devices */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01), +-- +2.42.0 + diff --git a/queue-5.15/bluetooth-add-device-13d3-3571-to-device-tables.patch b/queue-5.15/bluetooth-add-device-13d3-3571-to-device-tables.patch new file mode 100644 index 00000000000..30c6531a928 --- /dev/null +++ b/queue-5.15/bluetooth-add-device-13d3-3571-to-device-tables.patch @@ -0,0 +1,65 @@ +From 77fc9cabd92a93fa31fe3a1be3b8c9b3bc303d92 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Mar 2023 19:52:03 -0500 +Subject: bluetooth: Add device 13d3:3571 to device tables + +From: Larry Finger + +[ Upstream commit 069f534247bb6db4f8c2c2ea8e9155abf495c37e ] + +This device is part of a Realtek RTW8852BE chip. The device table is as follows: + +T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 +D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 +P: Vendor=13d3 ProdID=3571 Rev= 0.00 +S: Manufacturer=Realtek +S: Product=Bluetooth Radio +S: SerialNumber=00e04c000001 +C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms +I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms +I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms +I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms +I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms +I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms + +Signed-off-by: Larry Finger +Signed-off-by: Luiz Augusto von Dentz +Stable-dep-of: da06ff1f585e ("Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE") +Signed-off-by: Sasha Levin +--- + drivers/bluetooth/btusb.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index 5b905f1501578..363642eda5323 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -441,6 +441,8 @@ static const struct usb_device_id blacklist_table[] = { + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0bda, 0x887b), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, ++ { USB_DEVICE(0x13d3, 0x3571), .driver_info = BTUSB_REALTEK | ++ BTUSB_WIDEBAND_SPEECH }, + + /* Realtek Bluetooth devices */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01), +-- +2.42.0 + diff --git a/queue-5.15/bluetooth-btusb-add-0bda-b85b-for-fn-link-rtl8852be.patch b/queue-5.15/bluetooth-btusb-add-0bda-b85b-for-fn-link-rtl8852be.patch new file mode 100644 index 00000000000..a5b4838e563 --- /dev/null +++ b/queue-5.15/bluetooth-btusb-add-0bda-b85b-for-fn-link-rtl8852be.patch @@ -0,0 +1,75 @@ +From cb8bcb15f4a2def0fb1a3fe26ae0c60ee5cdd2a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 19:21:17 +0800 +Subject: Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE + +From: Guan Wentao + +[ Upstream commit da06ff1f585ea784c79f80e7fab0e0c4ebb49c1c ] + +Add PID/VID 0bda:b85b for Realtek RTL8852BE USB bluetooth part. +The PID/VID was reported by the patch last year. [1] +Some SBCs like rockpi 5B A8 module contains the device. +And it`s founded in website. [2] [3] + +Here is the device tables in /sys/kernel/debug/usb/devices . + +T: Bus=07 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 +D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 +P: Vendor=0bda ProdID=b85b Rev= 0.00 +S: Manufacturer=Realtek +S: Product=Bluetooth Radio +S: SerialNumber=00e04c000001 +C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms +I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms +I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms +I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms +I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms +I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms + +Link: https://lore.kernel.org/all/20220420052402.19049-1-tangmeng@uniontech.com/ [1] +Link: https://forum.radxa.com/t/bluetooth-on-ubuntu/13051/4 [2] +Link: https://ubuntuforums.org/showthread.php?t=2489527 [3] + +Cc: stable@vger.kernel.org +Signed-off-by: Meng Tang +Signed-off-by: Guan Wentao +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + drivers/bluetooth/btusb.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index ea0ab93097905..a862f859f7a50 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -441,6 +441,8 @@ static const struct usb_device_id blacklist_table[] = { + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0bda, 0x887b), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, ++ { USB_DEVICE(0x0bda, 0xb85b), .driver_info = BTUSB_REALTEK | ++ BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3570), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3571), .driver_info = BTUSB_REALTEK | +-- +2.42.0 + diff --git a/queue-5.15/bluetooth-btusb-add-realtek-rtl8852be-support-id-0x0.patch b/queue-5.15/bluetooth-btusb-add-realtek-rtl8852be-support-id-0x0.patch new file mode 100644 index 00000000000..63ca9fbf413 --- /dev/null +++ b/queue-5.15/bluetooth-btusb-add-realtek-rtl8852be-support-id-0x0.patch @@ -0,0 +1,70 @@ +From 00460075492d004a8b7c237e73660f353973748f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Nov 2022 11:10:05 +0300 +Subject: Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559 + +From: Artem Lukyanov + +[ Upstream commit 393b4916b7b5b94faf5c6a7c68df1c62d17e4f38 ] + +Add the support ID(0x0cb8, 0xc559) to usb_device_id table for +Realtek RTL8852BE. + +The device info from /sys/kernel/debug/usb/devices as below. + +T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 +D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 +P: Vendor=0cb8 ProdID=c559 Rev= 0.00 +S: Manufacturer=Realtek +S: Product=Bluetooth Radio +S: SerialNumber=00e04c000001 +C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms +I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms +I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms +I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms +I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms +I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms + +Signed-off-by: Artem Lukyanov +Signed-off-by: Luiz Augusto von Dentz +Stable-dep-of: da06ff1f585e ("Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE") +Signed-off-by: Sasha Levin +--- + drivers/bluetooth/btusb.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index 91a08892df223..c1ce5592921af 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -436,6 +436,10 @@ static const struct usb_device_id blacklist_table[] = { + { USB_DEVICE(0x13d3, 0x3586), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + ++ /* Realtek 8852BE Bluetooth devices */ ++ { USB_DEVICE(0x0cb8, 0xc559), .driver_info = BTUSB_REALTEK | ++ BTUSB_WIDEBAND_SPEECH }, ++ + /* Realtek Bluetooth devices */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01), + .driver_info = BTUSB_REALTEK }, +-- +2.42.0 + diff --git a/queue-5.15/bluetooth-btusb-add-rtw8852be-device-13d3-3570-to-de.patch b/queue-5.15/bluetooth-btusb-add-rtw8852be-device-13d3-3570-to-de.patch new file mode 100644 index 00000000000..41776ae9ae4 --- /dev/null +++ b/queue-5.15/bluetooth-btusb-add-rtw8852be-device-13d3-3570-to-de.patch @@ -0,0 +1,68 @@ +From fadc942e654e7c36b7e665f45503fee8e136fbb5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 24 Sep 2023 16:46:55 +0530 +Subject: Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables + +From: Masum Reza + +[ Upstream commit 02be109d3a405dbc4d53fb4b4473d7a113548088 ] + +This device is used in TP-Link TX20E WiFi+Bluetooth adapter. + +Relevant information in /sys/kernel/debug/usb/devices +about the Bluetooth device is listed as the below. + +T: Bus=01 Lev=01 Prnt=01 Port=08 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 +D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 +P: Vendor=13d3 ProdID=3570 Rev= 0.00 +S: Manufacturer=Realtek +S: Product=Bluetooth Radio +S: SerialNumber=00e04c000001 +C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms +I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms +I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms +I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms +I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms +I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb +E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms +E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms + +Signed-off-by: Masum Reza +Signed-off-by: Luiz Augusto von Dentz +Stable-dep-of: da06ff1f585e ("Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE") +Signed-off-by: Sasha Levin +--- + drivers/bluetooth/btusb.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index 363642eda5323..ea0ab93097905 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -441,6 +441,8 @@ static const struct usb_device_id blacklist_table[] = { + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0bda, 0x887b), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, ++ { USB_DEVICE(0x13d3, 0x3570), .driver_info = BTUSB_REALTEK | ++ BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3571), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + +-- +2.42.0 + diff --git a/queue-5.15/cpufreq-stats-fix-buffer-overflow-detection-in-trans.patch b/queue-5.15/cpufreq-stats-fix-buffer-overflow-detection-in-trans.patch new file mode 100644 index 00000000000..c4cf5725092 --- /dev/null +++ b/queue-5.15/cpufreq-stats-fix-buffer-overflow-detection-in-trans.patch @@ -0,0 +1,87 @@ +From 9d11dd94d7935f22ae587f36e54103d22ee89296 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Oct 2023 20:30:14 +0200 +Subject: cpufreq: stats: Fix buffer overflow detection in trans_stats() + +From: Christian Marangi + +[ Upstream commit ea167a7fc2426f7685c3735e104921c1a20a6d3f ] + +Commit 3c0897c180c6 ("cpufreq: Use scnprintf() for avoiding potential +buffer overflow") switched from snprintf to the more secure scnprintf +but never updated the exit condition for PAGE_SIZE. + +As the commit say and as scnprintf document, what scnprintf returns what +is actually written not counting the '\0' end char. This results in the +case of len exceeding the size, len set to PAGE_SIZE - 1, as it can be +written at max PAGE_SIZE - 1 (as '\0' is not counted) + +Because of len is never set to PAGE_SIZE, the function never break early, +never prints the warning and never return -EFBIG. + +Fix this by changing the condition to PAGE_SIZE - 1 to correctly trigger +the error. + +Cc: 5.10+ # 5.10+ +Fixes: 3c0897c180c6 ("cpufreq: Use scnprintf() for avoiding potential buffer overflow") +Signed-off-by: Christian Marangi +[ rjw: Subject and changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/cpufreq_stats.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c +index 1570d6f3e75d3..6e57df7a2249f 100644 +--- a/drivers/cpufreq/cpufreq_stats.c ++++ b/drivers/cpufreq/cpufreq_stats.c +@@ -131,25 +131,25 @@ static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf) + len += scnprintf(buf + len, PAGE_SIZE - len, " From : To\n"); + len += scnprintf(buf + len, PAGE_SIZE - len, " : "); + for (i = 0; i < stats->state_num; i++) { +- if (len >= PAGE_SIZE) ++ if (len >= PAGE_SIZE - 1) + break; + len += scnprintf(buf + len, PAGE_SIZE - len, "%9u ", + stats->freq_table[i]); + } +- if (len >= PAGE_SIZE) +- return PAGE_SIZE; ++ if (len >= PAGE_SIZE - 1) ++ return PAGE_SIZE - 1; + + len += scnprintf(buf + len, PAGE_SIZE - len, "\n"); + + for (i = 0; i < stats->state_num; i++) { +- if (len >= PAGE_SIZE) ++ if (len >= PAGE_SIZE - 1) + break; + + len += scnprintf(buf + len, PAGE_SIZE - len, "%9u: ", + stats->freq_table[i]); + + for (j = 0; j < stats->state_num; j++) { +- if (len >= PAGE_SIZE) ++ if (len >= PAGE_SIZE - 1) + break; + + if (pending) +@@ -159,12 +159,12 @@ static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf) + + len += scnprintf(buf + len, PAGE_SIZE - len, "%9u ", count); + } +- if (len >= PAGE_SIZE) ++ if (len >= PAGE_SIZE - 1) + break; + len += scnprintf(buf + len, PAGE_SIZE - len, "\n"); + } + +- if (len >= PAGE_SIZE) { ++ if (len >= PAGE_SIZE - 1) { + pr_warn_once("cpufreq transition table exceeds PAGE_SIZE. Disabling\n"); + return -EFBIG; + } +-- +2.42.0 + diff --git a/queue-5.15/driver-core-add-dma_cleanup-callback-in-bus_type.patch b/queue-5.15/driver-core-add-dma_cleanup-callback-in-bus_type.patch new file mode 100644 index 00000000000..050f10616ad --- /dev/null +++ b/queue-5.15/driver-core-add-dma_cleanup-callback-in-bus_type.patch @@ -0,0 +1,89 @@ +From e19e821c42d0f37d64153517b29687d3819dc188 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Apr 2022 08:49:51 +0800 +Subject: driver core: Add dma_cleanup callback in bus_type + +From: Lu Baolu + +[ Upstream commit 25f3bcfc54bcf7b0e45d140ec8bfbbf10ba11869 ] + +The bus_type structure defines dma_configure() callback for bus drivers +to configure DMA on the devices. This adds the paired dma_cleanup() +callback and calls it during driver unbinding so that bus drivers can do +some cleanup work. + +One use case for this paired DMA callbacks is for the bus driver to check +for DMA ownership conflicts during driver binding, where multiple devices +belonging to a same IOMMU group (the minimum granularity of isolation and +protection) may be assigned to kernel drivers or user space respectively. + +Without this change, for example, the vfio driver has to listen to a bus +BOUND_DRIVER event and then BUG_ON() in case of dma ownership conflict. +This leads to bad user experience since careless driver binding operation +may crash the system if the admin overlooks the group restriction. Aside +from bad design, this leads to a security problem as a root user, even with +lockdown=integrity, can force the kernel to BUG. + +With this change, the bus driver could check and set the DMA ownership in +driver binding process and fail on ownership conflicts. The DMA ownership +should be released during driver unbinding. + +Signed-off-by: Lu Baolu +Reviewed-by: Greg Kroah-Hartman +Reviewed-by: Jason Gunthorpe +Link: https://lore.kernel.org/r/20220418005000.897664-3-baolu.lu@linux.intel.com +Signed-off-by: Joerg Roedel +Stable-dep-of: 2e84dc379200 ("driver core: Release all resources during unbind before updating device links") +Signed-off-by: Sasha Levin +--- + drivers/base/dd.c | 5 +++++ + include/linux/device/bus.h | 3 +++ + 2 files changed, 8 insertions(+) + +diff --git a/drivers/base/dd.c b/drivers/base/dd.c +index 81683c99d6293..394ef41d732a9 100644 +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -669,6 +669,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) + if (dev->bus) + blocking_notifier_call_chain(&dev->bus->p->bus_notifier, + BUS_NOTIFY_DRIVER_NOT_BOUND, dev); ++ if (dev->bus && dev->bus->dma_cleanup) ++ dev->bus->dma_cleanup(dev); + pinctrl_bind_failed: + device_links_no_driver(dev); + device_unbind_cleanup(dev); +@@ -1225,6 +1227,9 @@ static void __device_release_driver(struct device *dev, struct device *parent) + else if (drv->remove) + drv->remove(dev); + ++ if (dev->bus && dev->bus->dma_cleanup) ++ dev->bus->dma_cleanup(dev); ++ + device_links_driver_cleanup(dev); + device_unbind_cleanup(dev); + +diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h +index 062777a45a74d..a52a6fe39eec9 100644 +--- a/include/linux/device/bus.h ++++ b/include/linux/device/bus.h +@@ -59,6 +59,8 @@ struct fwnode_handle; + * bus supports. + * @dma_configure: Called to setup DMA configuration on a device on + * this bus. ++ * @dma_cleanup: Called to cleanup DMA configuration on a device on ++ * this bus. + * @pm: Power management operations of this bus, callback the specific + * device driver's pm-ops. + * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU +@@ -103,6 +105,7 @@ struct bus_type { + int (*num_vf)(struct device *dev); + + int (*dma_configure)(struct device *dev); ++ void (*dma_cleanup)(struct device *dev); + + const struct dev_pm_ops *pm; + +-- +2.42.0 + diff --git a/queue-5.15/driver-core-move-driver_sysfs_remove-after-driver_sy.patch b/queue-5.15/driver-core-move-driver_sysfs_remove-after-driver_sy.patch new file mode 100644 index 00000000000..b325ea67416 --- /dev/null +++ b/queue-5.15/driver-core-move-driver_sysfs_remove-after-driver_sy.patch @@ -0,0 +1,64 @@ +From 1e0d9ee2546f9ee4faf204e4e944f24773e472ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 31 Dec 2021 11:39:00 +0800 +Subject: driver core: Move driver_sysfs_remove() after driver_sysfs_add() + +From: Lu Baolu + +[ Upstream commit 885e50253bfd6750327a265405461496d6af1639 ] + +The driver_sysfs_remove() should be called after driver_sysfs_add() in +really_probe(). The out-of-order driver_sysfs_remove() tries to remove +some nonexistent nodes under the device and driver sysfs nodes. This is +allowed, hence this change doesn't fix any problem, just a cleanup. + +Signed-off-by: Lu Baolu +Link: https://lore.kernel.org/r/20211231033901.2168664-2-baolu.lu@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 2e84dc379200 ("driver core: Release all resources during unbind before updating device links") +Signed-off-by: Sasha Levin +--- + drivers/base/dd.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/base/dd.c b/drivers/base/dd.c +index ab0b2eb5fa07f..f5371daf4fd29 100644 +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -576,14 +576,14 @@ static int really_probe(struct device *dev, struct device_driver *drv) + if (dev->bus->dma_configure) { + ret = dev->bus->dma_configure(dev); + if (ret) +- goto probe_failed; ++ goto sysfs_failed; + } + + ret = driver_sysfs_add(dev); + if (ret) { + pr_err("%s: driver_sysfs_add(%s) failed\n", + __func__, dev_name(dev)); +- goto probe_failed; ++ goto sysfs_failed; + } + + if (dev->pm_domain && dev->pm_domain->activate) { +@@ -659,6 +659,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) + else if (drv->remove) + drv->remove(dev); + probe_failed: ++ driver_sysfs_remove(dev); ++sysfs_failed: + if (dev->bus) + blocking_notifier_call_chain(&dev->bus->p->bus_notifier, + BUS_NOTIFY_DRIVER_NOT_BOUND, dev); +@@ -668,7 +670,6 @@ static int really_probe(struct device *dev, struct device_driver *drv) + arch_teardown_dma_ops(dev); + kfree(dev->dma_range_map); + dev->dma_range_map = NULL; +- driver_sysfs_remove(dev); + dev->driver = NULL; + dev_set_drvdata(dev, NULL); + if (dev->pm_domain && dev->pm_domain->dismiss) +-- +2.42.0 + diff --git a/queue-5.15/driver-core-refactor-multiple-copies-of-device-clean.patch b/queue-5.15/driver-core-refactor-multiple-copies-of-device-clean.patch new file mode 100644 index 00000000000..916988be110 --- /dev/null +++ b/queue-5.15/driver-core-refactor-multiple-copies-of-device-clean.patch @@ -0,0 +1,108 @@ +From 7026884fd91f17a98191dca0a3b00cce394226d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Feb 2022 16:52:56 -0600 +Subject: driver core: Refactor multiple copies of device cleanup + +From: Rob Herring + +[ Upstream commit 9ad307213fa4081f4bc2f2daa31d4f2d35d7a213 ] + +There are 3 copies of the same device cleanup code used for probe failure, +testing re-probing, and device unbinding. Changes to this code often miss +at least one of the copies of the code. See commits d0243bbd5dd3 ("drivers +core: Free dma_range_map when driver probe failed") and d8f7a5484f21 +("driver core: Free DMA range map when device is released") for example. + +Let's refactor the code to its own function. + +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20220223225257.1681968-2-robh@kernel.org +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 2e84dc379200 ("driver core: Release all resources during unbind before updating device links") +Signed-off-by: Sasha Levin +--- + drivers/base/dd.c | 46 ++++++++++++++++------------------------------ + 1 file changed, 16 insertions(+), 30 deletions(-) + +diff --git a/drivers/base/dd.c b/drivers/base/dd.c +index f5371daf4fd29..81683c99d6293 100644 +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -505,6 +505,19 @@ static ssize_t state_synced_show(struct device *dev, + } + static DEVICE_ATTR_RO(state_synced); + ++static void device_unbind_cleanup(struct device *dev) ++{ ++ devres_release_all(dev); ++ arch_teardown_dma_ops(dev); ++ kfree(dev->dma_range_map); ++ dev->dma_range_map = NULL; ++ dev->driver = NULL; ++ dev_set_drvdata(dev, NULL); ++ if (dev->pm_domain && dev->pm_domain->dismiss) ++ dev->pm_domain->dismiss(dev); ++ pm_runtime_reinit(dev); ++ dev_pm_set_driver_flags(dev, 0); ++} + + static int call_driver_probe(struct device *dev, struct device_driver *drv) + { +@@ -627,16 +640,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) + else if (drv->remove) + drv->remove(dev); + +- devres_release_all(dev); +- arch_teardown_dma_ops(dev); +- kfree(dev->dma_range_map); +- dev->dma_range_map = NULL; + driver_sysfs_remove(dev); +- dev->driver = NULL; +- dev_set_drvdata(dev, NULL); +- if (dev->pm_domain && dev->pm_domain->dismiss) +- dev->pm_domain->dismiss(dev); +- pm_runtime_reinit(dev); ++ device_unbind_cleanup(dev); + + goto re_probe; + } +@@ -666,16 +671,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) + BUS_NOTIFY_DRIVER_NOT_BOUND, dev); + pinctrl_bind_failed: + device_links_no_driver(dev); +- devres_release_all(dev); +- arch_teardown_dma_ops(dev); +- kfree(dev->dma_range_map); +- dev->dma_range_map = NULL; +- dev->driver = NULL; +- dev_set_drvdata(dev, NULL); +- if (dev->pm_domain && dev->pm_domain->dismiss) +- dev->pm_domain->dismiss(dev); +- pm_runtime_reinit(dev); +- dev_pm_set_driver_flags(dev, 0); ++ device_unbind_cleanup(dev); + done: + return ret; + } +@@ -1230,17 +1226,7 @@ static void __device_release_driver(struct device *dev, struct device *parent) + drv->remove(dev); + + device_links_driver_cleanup(dev); +- +- devres_release_all(dev); +- arch_teardown_dma_ops(dev); +- kfree(dev->dma_range_map); +- dev->dma_range_map = NULL; +- dev->driver = NULL; +- dev_set_drvdata(dev, NULL); +- if (dev->pm_domain && dev->pm_domain->dismiss) +- dev->pm_domain->dismiss(dev); +- pm_runtime_reinit(dev); +- dev_pm_set_driver_flags(dev, 0); ++ device_unbind_cleanup(dev); + + klist_remove(&dev->p->knode_driver); + device_pm_check_callbacks(dev); +-- +2.42.0 + diff --git a/queue-5.15/driver-core-release-all-resources-during-unbind-befo.patch b/queue-5.15/driver-core-release-all-resources-during-unbind-befo.patch new file mode 100644 index 00000000000..b8870474da0 --- /dev/null +++ b/queue-5.15/driver-core-release-all-resources-during-unbind-befo.patch @@ -0,0 +1,56 @@ +From 5ed42eeb1f404d6f001d14a3b0351142aae3119c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Oct 2023 18:38:50 -0700 +Subject: driver core: Release all resources during unbind before updating + device links +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Saravana Kannan + +[ Upstream commit 2e84dc37920012b458e9458b19fc4ed33f81bc74 ] + +This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional +dependencies tracking support") where the device link status was +incorrectly updated in the driver unbind path before all the device's +resources were released. + +Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support") +Cc: stable +Reported-by: Uwe Kleine-König +Closes: https://lore.kernel.org/all/20231014161721.f4iqyroddkcyoefo@pengutronix.de/ +Signed-off-by: Saravana Kannan +Cc: Thierry Reding +Cc: Yang Yingliang +Cc: Andy Shevchenko +Cc: Mark Brown +Cc: Matti Vaittinen +Cc: James Clark +Acked-by: "Rafael J. Wysocki" +Tested-by: Uwe Kleine-König +Acked-by: Uwe Kleine-König +Link: https://lore.kernel.org/r/20231018013851.3303928-1-saravanak@google.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/base/dd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/base/dd.c b/drivers/base/dd.c +index 394ef41d732a9..5f521def6b7c0 100644 +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -1230,8 +1230,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) + if (dev->bus && dev->bus->dma_cleanup) + dev->bus->dma_cleanup(dev); + +- device_links_driver_cleanup(dev); + device_unbind_cleanup(dev); ++ device_links_driver_cleanup(dev); + + klist_remove(&dev->p->knode_driver); + device_pm_check_callbacks(dev); +-- +2.42.0 + diff --git a/queue-5.15/ksmbd-fix-slab-out-of-bounds-write-in-smb_inherit_da.patch b/queue-5.15/ksmbd-fix-slab-out-of-bounds-write-in-smb_inherit_da.patch new file mode 100644 index 00000000000..2cbb43d78f3 --- /dev/null +++ b/queue-5.15/ksmbd-fix-slab-out-of-bounds-write-in-smb_inherit_da.patch @@ -0,0 +1,79 @@ +From 39f78a5d57bb55ee12a1b3306265f45050124fcb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Nov 2023 12:46:24 +0900 +Subject: ksmbd: fix slab out of bounds write in smb_inherit_dacl() + +From: Namjae Jeon + +[ Upstream commit eebff19acaa35820cb09ce2ccb3d21bee2156ffb ] + +slab out-of-bounds write is caused by that offsets is bigger than pntsd +allocation size. This patch add the check to validate 3 offsets using +allocation size. + +Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-22271 +Cc: stable@vger.kernel.org +Signed-off-by: Namjae Jeon +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/ksmbd/smbacl.c | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) + +diff --git a/fs/ksmbd/smbacl.c b/fs/ksmbd/smbacl.c +index 3781bca2c8fc4..83f805248a814 100644 +--- a/fs/ksmbd/smbacl.c ++++ b/fs/ksmbd/smbacl.c +@@ -1105,6 +1105,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, + struct smb_acl *pdacl; + struct smb_sid *powner_sid = NULL, *pgroup_sid = NULL; + int powner_sid_size = 0, pgroup_sid_size = 0, pntsd_size; ++ int pntsd_alloc_size; + + if (parent_pntsd->osidoffset) { + powner_sid = (struct smb_sid *)((char *)parent_pntsd + +@@ -1117,9 +1118,10 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, + pgroup_sid_size = 1 + 1 + 6 + (pgroup_sid->num_subauth * 4); + } + +- pntsd = kzalloc(sizeof(struct smb_ntsd) + powner_sid_size + +- pgroup_sid_size + sizeof(struct smb_acl) + +- nt_size, GFP_KERNEL); ++ pntsd_alloc_size = sizeof(struct smb_ntsd) + powner_sid_size + ++ pgroup_sid_size + sizeof(struct smb_acl) + nt_size; ++ ++ pntsd = kzalloc(pntsd_alloc_size, GFP_KERNEL); + if (!pntsd) { + rc = -ENOMEM; + goto free_aces_base; +@@ -1134,6 +1136,27 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, + pntsd->gsidoffset = parent_pntsd->gsidoffset; + pntsd->dacloffset = parent_pntsd->dacloffset; + ++ if ((u64)le32_to_cpu(pntsd->osidoffset) + powner_sid_size > ++ pntsd_alloc_size) { ++ rc = -EINVAL; ++ kfree(pntsd); ++ goto free_aces_base; ++ } ++ ++ if ((u64)le32_to_cpu(pntsd->gsidoffset) + pgroup_sid_size > ++ pntsd_alloc_size) { ++ rc = -EINVAL; ++ kfree(pntsd); ++ goto free_aces_base; ++ } ++ ++ if ((u64)le32_to_cpu(pntsd->dacloffset) + sizeof(struct smb_acl) + nt_size > ++ pntsd_alloc_size) { ++ rc = -EINVAL; ++ kfree(pntsd); ++ goto free_aces_base; ++ } ++ + if (pntsd->osidoffset) { + struct smb_sid *owner_sid = (struct smb_sid *)((char *)pntsd + + le32_to_cpu(pntsd->osidoffset)); +-- +2.42.0 + diff --git a/queue-5.15/powerpc-pseries-ddw-simplify-enable_ddw.patch b/queue-5.15/powerpc-pseries-ddw-simplify-enable_ddw.patch new file mode 100644 index 00000000000..90b0a792d08 --- /dev/null +++ b/queue-5.15/powerpc-pseries-ddw-simplify-enable_ddw.patch @@ -0,0 +1,80 @@ +From 43c7548c2667c29992a03b80208d4d73beab7daa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 8 Nov 2021 15:03:18 +1100 +Subject: powerpc/pseries/ddw: simplify enable_ddw() + +From: Alexey Kardashevskiy + +[ Upstream commit fb4ee2b30cd09e95524640149e4ee0d7f22c3e7b ] + +This drops rather useless ddw_enabled flag as direct_mapping implies +it anyway. + +While at this, fix indents in enable_ddw(). + +This should not cause any behavioral change. + +Signed-off-by: Alexey Kardashevskiy +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20211108040320.3857636-3-aik@ozlabs.ru +Stable-dep-of: 3bf983e4e93c ("powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping for SR-IOV device") +Signed-off-by: Sasha Levin +--- + arch/powerpc/platforms/pseries/iommu.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c +index ec5d84b4958c5..aa5f8074e9b10 100644 +--- a/arch/powerpc/platforms/pseries/iommu.c ++++ b/arch/powerpc/platforms/pseries/iommu.c +@@ -1241,7 +1241,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) + u32 ddw_avail[DDW_APPLICABLE_SIZE]; + struct dma_win *window; + struct property *win64; +- bool ddw_enabled = false; + struct failed_ddw_pdn *fpdn; + bool default_win_removed = false, direct_mapping = false; + bool pmem_present; +@@ -1256,7 +1255,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) + + if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len)) { + direct_mapping = (len >= max_ram_len); +- ddw_enabled = true; + goto out_unlock; + } + +@@ -1411,8 +1409,8 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) + dev_info(&dev->dev, "failed to map DMA window for %pOF: %d\n", + dn, ret); + +- /* Make sure to clean DDW if any TCE was set*/ +- clean_dma_window(pdn, win64->value); ++ /* Make sure to clean DDW if any TCE was set*/ ++ clean_dma_window(pdn, win64->value); + goto out_del_list; + } + } else { +@@ -1459,7 +1457,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) + spin_unlock(&dma_win_list_lock); + + dev->dev.archdata.dma_offset = win_addr; +- ddw_enabled = true; + goto out_unlock; + + out_del_list: +@@ -1495,10 +1492,10 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) + * as RAM, then we failed to create a window to cover persistent + * memory and need to set the DMA limit. + */ +- if (pmem_present && ddw_enabled && direct_mapping && len == max_ram_len) ++ if (pmem_present && direct_mapping && len == max_ram_len) + dev->dev.bus_dma_limit = dev->dev.archdata.dma_offset + (1ULL << len); + +- return ddw_enabled && direct_mapping; ++ return direct_mapping; + } + + static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) +-- +2.42.0 + diff --git a/queue-5.15/powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch b/queue-5.15/powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch new file mode 100644 index 00000000000..278d0448743 --- /dev/null +++ b/queue-5.15/powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch @@ -0,0 +1,74 @@ +From df6fb58a767fd174a6fdcc76ce2b86124b567419 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Oct 2023 22:08:02 -0500 +Subject: powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping + for SR-IOV device + +From: Gaurav Batra + +[ Upstream commit 3bf983e4e93ce8e6d69e9d63f52a66ec0856672e ] + +When a device is initialized, the driver invokes dma_supported() twice - +first for streaming mappings followed by coherent mappings. For an +SR-IOV device, default window is deleted and DDW created. With vPMEM +enabled, TCE mappings are dynamically created for both vPMEM and SR-IOV +device. There are no direct mappings. + +First time when dma_supported() is called with 64 bit mask, DDW is created +and marked as dynamic window. The second time dma_supported() is called, +enable_ddw() finds existing window for the device and incorrectly returns +it as "direct mapping". + +This only happens when size of DDW is big enough to map max LPAR memory. + +This results in streaming TCEs to not get dynamically mapped, since code +incorrently assumes these are already pre-mapped. The adapter initially +comes up but goes down due to EEH. + +Fixes: 381ceda88c4c ("powerpc/pseries/iommu: Make use of DDW for indirect mapping") +Cc: stable@vger.kernel.org # v5.15+ +Signed-off-by: Gaurav Batra +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231003030802.47914-1-gbatra@linux.vnet.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/platforms/pseries/iommu.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c +index aa5f8074e9b10..bee61292de23b 100644 +--- a/arch/powerpc/platforms/pseries/iommu.c ++++ b/arch/powerpc/platforms/pseries/iommu.c +@@ -891,7 +891,8 @@ static int remove_ddw(struct device_node *np, bool remove_prop, const char *win_ + return 0; + } + +-static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int *window_shift) ++static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int *window_shift, ++ bool *direct_mapping) + { + struct dma_win *window; + const struct dynamic_dma_window_prop *dma64; +@@ -904,6 +905,7 @@ static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int *windo + dma64 = window->prop; + *dma_addr = be64_to_cpu(dma64->dma_base); + *window_shift = be32_to_cpu(dma64->window_shift); ++ *direct_mapping = window->direct; + found = true; + break; + } +@@ -1253,10 +1255,8 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) + + mutex_lock(&dma_win_init_mutex); + +- if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len)) { +- direct_mapping = (len >= max_ram_len); ++ if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len, &direct_mapping)) + goto out_unlock; +- } + + /* + * If we already went through this for a previous function of +-- +2.42.0 + diff --git a/queue-5.15/regmap-ensure-range-selector-registers-are-updated-a.patch b/queue-5.15/regmap-ensure-range-selector-registers-are-updated-a.patch new file mode 100644 index 00000000000..e267f71d331 --- /dev/null +++ b/queue-5.15/regmap-ensure-range-selector-registers-are-updated-a.patch @@ -0,0 +1,95 @@ +From 7fd9b1e6246b0853d02e64b75cde5631d134a5cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Oct 2023 16:49:19 +0100 +Subject: regmap: Ensure range selector registers are updated after cache sync + +From: Mark Brown + +[ Upstream commit 0ec7731655de196bc1e4af99e495b38778109d22 ] + +When we sync the register cache we do so with the cache bypassed in order +to avoid overhead from writing the synced values back into the cache. If +the regmap has ranges and the selector register for those ranges is in a +register which is cached this has the unfortunate side effect of meaning +that the physical and cached copies of the selector register can be out of +sync after a cache sync. The cache will have whatever the selector was when +the sync started and the hardware will have the selector for the register +that was synced last. + +Fix this by rewriting all cached selector registers after every sync, +ensuring that the hardware and cache have the same content. This will +result in extra writes that wouldn't otherwise be needed but is simple +so hopefully robust. We don't read from the hardware since not all +devices have physical read support. + +Given that nobody noticed this until now it is likely that we are rarely if +ever hitting this case. + +Reported-by: Hector Martin +Cc: stable@vger.kernel.org +Signed-off-by: Mark Brown +Link: https://lore.kernel.org/r/20231026-regmap-fix-selector-sync-v1-1-633ded82770d@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/base/regmap/regcache.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c +index 0b517a83c4493..b04e8c90aca20 100644 +--- a/drivers/base/regmap/regcache.c ++++ b/drivers/base/regmap/regcache.c +@@ -325,6 +325,11 @@ static int regcache_default_sync(struct regmap *map, unsigned int min, + return 0; + } + ++static int rbtree_all(const void *key, const struct rb_node *node) ++{ ++ return 0; ++} ++ + /** + * regcache_sync - Sync the register cache with the hardware. + * +@@ -342,6 +347,7 @@ int regcache_sync(struct regmap *map) + unsigned int i; + const char *name; + bool bypass; ++ struct rb_node *node; + + if (WARN_ON(map->cache_type == REGCACHE_NONE)) + return -EINVAL; +@@ -386,6 +392,30 @@ int regcache_sync(struct regmap *map) + map->async = false; + map->cache_bypass = bypass; + map->no_sync_defaults = false; ++ ++ /* ++ * If we did any paging with cache bypassed and a cached ++ * paging register then the register and cache state might ++ * have gone out of sync, force writes of all the paging ++ * registers. ++ */ ++ rb_for_each(node, 0, &map->range_tree, rbtree_all) { ++ struct regmap_range_node *this = ++ rb_entry(node, struct regmap_range_node, node); ++ ++ /* If there's nothing in the cache there's nothing to sync */ ++ ret = regcache_read(map, this->selector_reg, &i); ++ if (ret != 0) ++ continue; ++ ++ ret = _regmap_write(map, this->selector_reg, i); ++ if (ret != 0) { ++ dev_err(map->dev, "Failed to write %x = %x: %d\n", ++ this->selector_reg, i, ret); ++ break; ++ } ++ } ++ + map->unlock(map->lock_arg); + + regmap_async_complete(map); +-- +2.42.0 + diff --git a/queue-5.15/serial-meson-use-platform_get_irq-to-get-the-interru.patch b/queue-5.15/serial-meson-use-platform_get_irq-to-get-the-interru.patch new file mode 100644 index 00000000000..4a4a5006f25 --- /dev/null +++ b/queue-5.15/serial-meson-use-platform_get_irq-to-get-the-interru.patch @@ -0,0 +1,69 @@ +From f365a310f65daf3666352285250605530f4ebebe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Dec 2021 14:29:10 +0000 +Subject: serial: meson: Use platform_get_irq() to get the interrupt + +From: Lad Prabhakar + +[ Upstream commit 5b68061983471470d4109bac776145245f06bc09 ] + +platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static +allocation of IRQ resources in DT core code, this causes an issue +when using hierarchical interrupt domains using "interrupts" property +in the node as this bypasses the hierarchical setup and messes up the +irq chaining. + +In preparation for removal of static setup of IRQ resource from DT core +code use platform_get_irq(). + +Signed-off-by: Lad Prabhakar +Link: https://lore.kernel.org/r/20211224142917.6966-5-prabhakar.mahadev-lad.rj@bp.renesas.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 2a1d728f20ed ("tty: serial: meson: fix hard LOCKUP on crtscts mode") +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/meson_uart.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c +index 62e6c1af13445..b6e8db0ddf065 100644 +--- a/drivers/tty/serial/meson_uart.c ++++ b/drivers/tty/serial/meson_uart.c +@@ -726,10 +726,11 @@ static int meson_uart_probe_clocks(struct platform_device *pdev, + + static int meson_uart_probe(struct platform_device *pdev) + { +- struct resource *res_mem, *res_irq; ++ struct resource *res_mem; + struct uart_port *port; + u32 fifosize = 64; /* Default is 64, 128 for EE UART_0 */ + int ret = 0; ++ int irq; + + if (pdev->dev.of_node) + pdev->id = of_alias_get_id(pdev->dev.of_node, "serial"); +@@ -752,9 +753,9 @@ static int meson_uart_probe(struct platform_device *pdev) + if (!res_mem) + return -ENODEV; + +- res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); +- if (!res_irq) +- return -ENODEV; ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) ++ return irq; + + of_property_read_u32(pdev->dev.of_node, "fifo-size", &fifosize); + +@@ -779,7 +780,7 @@ static int meson_uart_probe(struct platform_device *pdev) + port->iotype = UPIO_MEM; + port->mapbase = res_mem->start; + port->mapsize = resource_size(res_mem); +- port->irq = res_irq->start; ++ port->irq = irq; + port->flags = UPF_BOOT_AUTOCONF | UPF_LOW_LATENCY; + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MESON_CONSOLE); + port->dev = &pdev->dev; +-- +2.42.0 + diff --git a/queue-5.15/series b/queue-5.15/series index c0ef5c42e23..359f99ac95d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -233,3 +233,21 @@ i3c-master-svc-fix-wrong-data-return-when-ibi-happen-during-start-frame.patch i3c-master-svc-fix-ibi-may-not-return-mandatory-data-byte.patch i3c-master-svc-fix-check-wrong-status-register-in-irq-handler.patch i3c-master-svc-fix-sda-keep-low-when-polling-ibiwon-timeout-happen.patch +serial-meson-use-platform_get_irq-to-get-the-interru.patch +tty-serial-meson-fix-hard-lockup-on-crtscts-mode.patch +regmap-ensure-range-selector-registers-are-updated-a.patch +cpufreq-stats-fix-buffer-overflow-detection-in-trans.patch +bluetooth-btusb-add-realtek-rtl8852be-support-id-0x0.patch +bluetooth-add-device-0bda-887b-to-device-tables.patch +bluetooth-add-device-13d3-3571-to-device-tables.patch +bluetooth-btusb-add-rtw8852be-device-13d3-3570-to-de.patch +bluetooth-btusb-add-0bda-b85b-for-fn-link-rtl8852be.patch +ksmbd-fix-slab-out-of-bounds-write-in-smb_inherit_da.patch +arm64-dts-qcom-ipq6018-switch-tcsr-mutex-to-mmio.patch +arm64-dts-qcom-ipq6018-fix-tcsr_mutex-register-size.patch +driver-core-move-driver_sysfs_remove-after-driver_sy.patch +driver-core-refactor-multiple-copies-of-device-clean.patch +driver-core-add-dma_cleanup-callback-in-bus_type.patch +driver-core-release-all-resources-during-unbind-befo.patch +powerpc-pseries-ddw-simplify-enable_ddw.patch +powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch diff --git a/queue-5.15/tty-serial-meson-fix-hard-lockup-on-crtscts-mode.patch b/queue-5.15/tty-serial-meson-fix-hard-lockup-on-crtscts-mode.patch new file mode 100644 index 00000000000..28fd6265f0f --- /dev/null +++ b/queue-5.15/tty-serial-meson-fix-hard-lockup-on-crtscts-mode.patch @@ -0,0 +1,101 @@ +From a31fb8d08fe9f59d0644ae1905ecee43634ae89a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 14 Oct 2023 11:39:26 +0000 +Subject: tty: serial: meson: fix hard LOCKUP on crtscts mode + +From: Pavel Krasavin + +[ Upstream commit 2a1d728f20edeee7f26dc307ed9df4e0d23947ab ] + +There might be hard lockup if we set crtscts mode on port without RTS/CTS configured: + +# stty -F /dev/ttyAML6 crtscts; echo 1 > /dev/ttyAML6; echo 2 > /dev/ttyAML6 +[ 95.890386] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: +[ 95.890857] rcu: 3-...0: (201 ticks this GP) idle=e33c/1/0x4000000000000000 softirq=5844/5846 fqs=4984 +[ 95.900212] rcu: (detected by 2, t=21016 jiffies, g=7753, q=296 ncpus=4) +[ 95.906972] Task dump for CPU 3: +[ 95.910178] task:bash state:R running task stack:0 pid:205 ppid:1 flags:0x00000202 +[ 95.920059] Call trace: +[ 95.922485] __switch_to+0xe4/0x168 +[ 95.925951] 0xffffff8003477508 +[ 95.974379] watchdog: Watchdog detected hard LOCKUP on cpu 3 +[ 95.974424] Modules linked in: 88x2cs(O) rtc_meson_vrtc + +Possible solution would be to not allow to setup crtscts on such port. + +Tested on S905X3 based board. + +Fixes: ff7693d079e5 ("ARM: meson: serial: add MesonX SoC on-chip uart driver") +Cc: stable@vger.kernel.org +Signed-off-by: Pavel Krasavin +Reviewed-by: Neil Armstrong +Reviewed-by: Dmitry Rokosov + +v6: stable tag added +v5: https://lore.kernel.org/lkml/OF43DA36FF.2BD3BB21-ON00258A47.005A8125-00258A47.005A9513@gdc.ru/ +added missed Reviewed-by tags, Fixes tag added according to Dmitry and Neil notes +v4: https://lore.kernel.org/lkml/OF55521400.7512350F-ON00258A47.003F7254-00258A47.0040E15C@gdc.ru/ +More correct patch subject according to Jiri's note +v3: https://lore.kernel.org/lkml/OF6CF5FFA0.CCFD0E8E-ON00258A46.00549EDF-00258A46.0054BB62@gdc.ru/ +"From:" line added to the mail +v2: https://lore.kernel.org/lkml/OF950BEF72.7F425944-ON00258A46.00488A76-00258A46.00497D44@gdc.ru/ +braces for single statement removed according to Dmitry's note +v1: https://lore.kernel.org/lkml/OF28B2B8C9.5BC0CD28-ON00258A46.0037688F-00258A46.0039155B@gdc.ru/ +Link: https://lore.kernel.org/r/OF66360032.51C36182-ON00258A48.003F656B-00258A48.0040092C@gdc.ru + +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/meson_uart.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c +index b6e8db0ddf065..7e653d681ac01 100644 +--- a/drivers/tty/serial/meson_uart.c ++++ b/drivers/tty/serial/meson_uart.c +@@ -368,10 +368,14 @@ static void meson_uart_set_termios(struct uart_port *port, + else + val |= AML_UART_STOP_BIT_1SB; + +- if (cflags & CRTSCTS) +- val &= ~AML_UART_TWO_WIRE_EN; +- else ++ if (cflags & CRTSCTS) { ++ if (port->flags & UPF_HARD_FLOW) ++ val &= ~AML_UART_TWO_WIRE_EN; ++ else ++ termios->c_cflag &= ~CRTSCTS; ++ } else { + val |= AML_UART_TWO_WIRE_EN; ++ } + + writel(val, port->membase + AML_UART_CONTROL); + +@@ -731,6 +735,7 @@ static int meson_uart_probe(struct platform_device *pdev) + u32 fifosize = 64; /* Default is 64, 128 for EE UART_0 */ + int ret = 0; + int irq; ++ bool has_rtscts; + + if (pdev->dev.of_node) + pdev->id = of_alias_get_id(pdev->dev.of_node, "serial"); +@@ -758,6 +763,7 @@ static int meson_uart_probe(struct platform_device *pdev) + return irq; + + of_property_read_u32(pdev->dev.of_node, "fifo-size", &fifosize); ++ has_rtscts = of_property_read_bool(pdev->dev.of_node, "uart-has-rtscts"); + + if (meson_ports[pdev->id]) { + dev_err(&pdev->dev, "port %d already allocated\n", pdev->id); +@@ -782,6 +788,8 @@ static int meson_uart_probe(struct platform_device *pdev) + port->mapsize = resource_size(res_mem); + port->irq = irq; + port->flags = UPF_BOOT_AUTOCONF | UPF_LOW_LATENCY; ++ if (has_rtscts) ++ port->flags |= UPF_HARD_FLOW; + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MESON_CONSOLE); + port->dev = &pdev->dev; + port->line = pdev->id; +-- +2.42.0 +