From: Sasha Levin Date: Sun, 7 Apr 2024 12:53:28 +0000 (-0400) Subject: Fixes for 5.10 X-Git-Tag: v5.15.154~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c18abfdde63232065c45b3ba96fd1f8a5ea37c86;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.10 Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/arm64-dts-qcom-sc7180-remove-clock-for-bluetooth-on-.patch b/queue-5.10/arm64-dts-qcom-sc7180-remove-clock-for-bluetooth-on-.patch new file mode 100644 index 00000000000..198f1ca7dc0 --- /dev/null +++ b/queue-5.10/arm64-dts-qcom-sc7180-remove-clock-for-bluetooth-on-.patch @@ -0,0 +1,40 @@ +From 2d5d59e13dc9d87cc5dea0fe823878c665767c2b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Mar 2021 13:34:32 -0800 +Subject: arm64: dts: qcom: sc7180: Remove clock for bluetooth on Trogdor + +From: Venkata Lakshmi Narayana Gubba + +[ Upstream commit a307a9773420dc7d385991f61fbede2fe100bd78 ] + +Removed voting for RPMH_RF_CLK2 which is not required as it is +getting managed by BT SoC through SW_CTRL line. + +Cc: Matthias Kaehlcke +Signed-off-by: Venkata Lakshmi Narayana Gubba +Signed-off-by: Douglas Anderson +Reviewed-by: Matthias Kaehlcke +Reviewed-by: Stephen Boyd +Link: https://lore.kernel.org/r/20210301133318.v2.8.I80c268f163e6d49a70af1238be442b5de400c579@changeid +Signed-off-by: Bjorn Andersson +Stable-dep-of: e12e28009e58 ("arm64: dts: qcom: sc7180-trogdor: mark bluetooth address as broken") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +index cb2c47f13a8a4..3f5883e8bf319 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +@@ -810,7 +810,6 @@ ap_spi_fp: &spi10 { + vddrf-supply = <&pp1300_l2c>; + vddch0-supply = <&pp3300_l10c>; + max-speed = <3200000>; +- clocks = <&rpmhcc RPMH_RF_CLK2>; + }; + }; + +-- +2.43.0 + diff --git a/queue-5.10/arm64-dts-qcom-sc7180-trogdor-mark-bluetooth-address.patch b/queue-5.10/arm64-dts-qcom-sc7180-trogdor-mark-bluetooth-address.patch new file mode 100644 index 00000000000..d8bedd43f75 --- /dev/null +++ b/queue-5.10/arm64-dts-qcom-sc7180-trogdor-mark-bluetooth-address.patch @@ -0,0 +1,55 @@ +From 348a148e469a5a660ca54441b1a5a30bc6642dcd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Mar 2024 08:55:52 +0100 +Subject: arm64: dts: qcom: sc7180-trogdor: mark bluetooth address as broken + +From: Johan Hovold + +[ Upstream commit e12e28009e584c8f8363439f6a928ec86278a106 ] + +Several Qualcomm Bluetooth controllers lack persistent storage for the +device address and instead one can be provided by the boot firmware +using the 'local-bd-address' devicetree property. + +The Bluetooth bindings clearly states that the address should be +specified in little-endian order, but due to a long-standing bug in the +Qualcomm driver which reversed the address some boot firmware has been +providing the address in big-endian order instead. + +The boot firmware in SC7180 Trogdor Chromebooks is known to be affected +so mark the 'local-bd-address' property as broken to maintain backwards +compatibility with older firmware when fixing the underlying driver bug. + +Note that ChromeOS always updates the kernel and devicetree in lockstep +so that there is no need to handle backwards compatibility with older +devicetrees. + +Fixes: 7ec3e67307f8 ("arm64: dts: qcom: sc7180-trogdor: add initial trogdor and lazor dt") +Cc: stable@vger.kernel.org # 5.10 +Cc: Rob Clark +Reviewed-by: Douglas Anderson +Signed-off-by: Johan Hovold +Acked-by: Bjorn Andersson +Reviewed-by: Bjorn Andersson +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +index 3f5883e8bf319..9ce8bfbf7ea21 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +@@ -810,6 +810,8 @@ ap_spi_fp: &spi10 { + vddrf-supply = <&pp1300_l2c>; + vddch0-supply = <&pp3300_l10c>; + max-speed = <3200000>; ++ ++ qcom,local-bd-address-broken; + }; + }; + +-- +2.43.0 + diff --git a/queue-5.10/net-ravb-always-process-tx-descriptor-ring.patch b/queue-5.10/net-ravb-always-process-tx-descriptor-ring.patch new file mode 100644 index 00000000000..fbebbee0fe6 --- /dev/null +++ b/queue-5.10/net-ravb-always-process-tx-descriptor-ring.patch @@ -0,0 +1,55 @@ +From 1e09d2019b5dc811b4f872092548750094e4644b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Apr 2024 15:53:04 +0100 +Subject: net: ravb: Always process TX descriptor ring + +From: Paul Barker + +[ Upstream commit 596a4254915f94c927217fe09c33a6828f33fb25 ] + +The TX queue should be serviced each time the poll function is called, +even if the full RX work budget has been consumed. This prevents +starvation of the TX queue when RX bandwidth usage is high. + +Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") +Signed-off-by: Paul Barker +Reviewed-by: Sergey Shtylyov +Link: https://lore.kernel.org/r/20240402145305.82148-1-paul.barker.ct@bp.renesas.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb_main.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index 8a4dff0566f7d..b08478aabc6e6 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -911,12 +911,12 @@ static int ravb_poll(struct napi_struct *napi, int budget) + int q = napi - priv->napi; + int mask = BIT(q); + int quota = budget; ++ bool unmask; + + /* Processing RX Descriptor Ring */ + /* Clear RX interrupt */ + ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); +- if (ravb_rx(ndev, "a, q)) +- goto out; ++ unmask = !ravb_rx(ndev, "a, q); + + /* Processing RX Descriptor Ring */ + spin_lock_irqsave(&priv->lock, flags); +@@ -926,6 +926,9 @@ static int ravb_poll(struct napi_struct *napi, int budget) + netif_wake_subqueue(ndev, q); + spin_unlock_irqrestore(&priv->lock, flags); + ++ if (!unmask) ++ goto out; ++ + napi_complete(napi); + + /* Re-enable RX/TX interrupts */ +-- +2.43.0 + diff --git a/queue-5.10/revert-usb-phy-generic-get-the-vbus-supply.patch b/queue-5.10/revert-usb-phy-generic-get-the-vbus-supply.patch new file mode 100644 index 00000000000..9e7cb9ab8f2 --- /dev/null +++ b/queue-5.10/revert-usb-phy-generic-get-the-vbus-supply.patch @@ -0,0 +1,45 @@ +From ba7e81051a1bd63ab22bcf86c14c6a869d6b6c0e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Mar 2024 10:26:27 +0100 +Subject: Revert "usb: phy: generic: Get the vbus supply" + +From: Alexander Stein + +[ Upstream commit fdada0db0b2ae2addef4ccafe50937874dbeeebe ] + +This reverts commit 75fd6485cccef269ac9eb3b71cf56753341195ef. +This patch was applied twice by accident, causing probe failures. +Revert the accident. + +Signed-off-by: Alexander Stein +Fixes: 75fd6485ccce ("usb: phy: generic: Get the vbus supply") +Cc: stable +Reviewed-by: Sean Anderson +Link: https://lore.kernel.org/r/20240314092628.1869414-1-alexander.stein@ew.tq-group.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/phy/phy-generic.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c +index 34b9f81401871..661a229c105dd 100644 +--- a/drivers/usb/phy/phy-generic.c ++++ b/drivers/usb/phy/phy-generic.c +@@ -268,13 +268,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) + return -EPROBE_DEFER; + } + +- nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); +- if (PTR_ERR(nop->vbus_draw) == -ENODEV) +- nop->vbus_draw = NULL; +- if (IS_ERR(nop->vbus_draw)) +- return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), +- "could not get vbus regulator\n"); +- + nop->dev = dev; + nop->phy.dev = nop->dev; + nop->phy.label = "nop-xceiv"; +-- +2.43.0 + diff --git a/queue-5.10/scsi-qla2xxx-update-manufacturer-detail.patch b/queue-5.10/scsi-qla2xxx-update-manufacturer-detail.patch new file mode 100644 index 00000000000..5d084b07302 --- /dev/null +++ b/queue-5.10/scsi-qla2xxx-update-manufacturer-detail.patch @@ -0,0 +1,39 @@ +From 89dcb1237b7c0f6c02705500825c26804ac3484e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Feb 2024 22:11:20 +0530 +Subject: scsi: qla2xxx: Update manufacturer detail + +From: Bikash Hazarika + +[ Upstream commit 688fa069fda6fce24d243cddfe0c7024428acb74 ] + +Update manufacturer detail from "Marvell Semiconductor, Inc." to +"Marvell". + +Cc: stable@vger.kernel.org +Signed-off-by: Bikash Hazarika +Signed-off-by: Nilesh Javali +Link: https://lore.kernel.org/r/20240227164127.36465-5-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qla2xxx/qla_def.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h +index 7dfd93cb4674d..b8628bceb3aeb 100644 +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -56,7 +56,7 @@ typedef struct { + #include "qla_nvme.h" + #define QLA2XXX_DRIVER_NAME "qla2xxx" + #define QLA2XXX_APIDEV "ql2xapidev" +-#define QLA2XXX_MANUFACTURER "Marvell Semiconductor, Inc." ++#define QLA2XXX_MANUFACTURER "Marvell" + + /* + * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, +-- +2.43.0 + diff --git a/queue-5.10/scsi-qla2xxx-update-manufacturer-details.patch b/queue-5.10/scsi-qla2xxx-update-manufacturer-details.patch new file mode 100644 index 00000000000..403b03a1fe2 --- /dev/null +++ b/queue-5.10/scsi-qla2xxx-update-manufacturer-details.patch @@ -0,0 +1,53 @@ +From 499f2ea39671f328f4e200a0090400f14ba8e692 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jul 2022 22:20:44 -0700 +Subject: scsi: qla2xxx: Update manufacturer details + +From: Bikash Hazarika + +[ Upstream commit 1ccad27716ecad1fd58c35e579bedb81fa5e1ad5 ] + +Update manufacturer details to indicate Marvell Semiconductors. + +Link: https://lore.kernel.org/r/20220713052045.10683-10-njavali@marvell.com +Cc: stable@vger.kernel.org +Reviewed-by: Himanshu Madhani +Signed-off-by: Bikash Hazarika +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Stable-dep-of: 688fa069fda6 ("scsi: qla2xxx: Update manufacturer detail") +Signed-off-by: Sasha Levin +--- + drivers/scsi/qla2xxx/qla_def.h | 2 +- + drivers/scsi/qla2xxx/qla_gs.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h +index 6645b69fc2a0f..7dfd93cb4674d 100644 +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -56,7 +56,7 @@ typedef struct { + #include "qla_nvme.h" + #define QLA2XXX_DRIVER_NAME "qla2xxx" + #define QLA2XXX_APIDEV "ql2xapidev" +-#define QLA2XXX_MANUFACTURER "QLogic Corporation" ++#define QLA2XXX_MANUFACTURER "Marvell Semiconductor, Inc." + + /* + * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, +diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c +index 20bbd69e35e51..d9ac17dbad789 100644 +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -1614,7 +1614,7 @@ qla2x00_hba_attributes(scsi_qla_host_t *vha, void *entries, + eiter->type = cpu_to_be16(FDMI_HBA_MANUFACTURER); + alen = scnprintf( + eiter->a.manufacturer, sizeof(eiter->a.manufacturer), +- "%s", "QLogic Corporation"); ++ "%s", QLA2XXX_MANUFACTURER); + alen += FDMI_ATTR_ALIGNMENT(alen); + alen += FDMI_ATTR_TYPELEN(eiter); + eiter->len = cpu_to_be16(alen); +-- +2.43.0 + diff --git a/queue-5.10/series b/queue-5.10/series index f9dda39ca46..5fe35ba7d6e 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -221,3 +221,11 @@ udp-do-not-transition-udp-gro-fraglist-partial-checksums-to-unnecessary.patch octeontx2-pf-check-negative-error-code-in-otx2_open.patch i40e-fix-i40e_count_filters-to-count-only-active-new-filters.patch i40e-fix-vf-may-be-used-uninitialized-in-this-function-warning.patch +scsi-qla2xxx-update-manufacturer-details.patch +scsi-qla2xxx-update-manufacturer-detail.patch +revert-usb-phy-generic-get-the-vbus-supply.patch +usb-typec-ucsi-check-for-notifications-after-init.patch +udp-do-not-accept-non-tunnel-gso-skbs-landing-in-a-t.patch +net-ravb-always-process-tx-descriptor-ring.patch +arm64-dts-qcom-sc7180-remove-clock-for-bluetooth-on-.patch +arm64-dts-qcom-sc7180-trogdor-mark-bluetooth-address.patch diff --git a/queue-5.10/udp-do-not-accept-non-tunnel-gso-skbs-landing-in-a-t.patch b/queue-5.10/udp-do-not-accept-non-tunnel-gso-skbs-landing-in-a-t.patch new file mode 100644 index 00000000000..2f885a79c72 --- /dev/null +++ b/queue-5.10/udp-do-not-accept-non-tunnel-gso-skbs-landing-in-a-t.patch @@ -0,0 +1,156 @@ +From 68a0d5e025a8e3acaca298471ba5ccdc59c36b3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Mar 2024 12:33:58 +0100 +Subject: udp: do not accept non-tunnel GSO skbs landing in a tunnel + +From: Antoine Tenart + +[ Upstream commit 3d010c8031e39f5fa1e8b13ada77e0321091011f ] + +When rx-udp-gro-forwarding is enabled UDP packets might be GROed when +being forwarded. If such packets might land in a tunnel this can cause +various issues and udp_gro_receive makes sure this isn't the case by +looking for a matching socket. This is performed in +udp4/6_gro_lookup_skb but only in the current netns. This is an issue +with tunneled packets when the endpoint is in another netns. In such +cases the packets will be GROed at the UDP level, which leads to various +issues later on. The same thing can happen with rx-gro-list. + +We saw this with geneve packets being GROed at the UDP level. In such +case gso_size is set; later the packet goes through the geneve rx path, +the geneve header is pulled, the offset are adjusted and frag_list skbs +are not adjusted with regard to geneve. When those skbs hit +skb_fragment, it will misbehave. Different outcomes are possible +depending on what the GROed skbs look like; from corrupted packets to +kernel crashes. + +One example is a BUG_ON[1] triggered in skb_segment while processing the +frag_list. Because gso_size is wrong (geneve header was pulled) +skb_segment thinks there is "geneve header size" of data in frag_list, +although it's in fact the next packet. The BUG_ON itself has nothing to +do with the issue. This is only one of the potential issues. + +Looking up for a matching socket in udp_gro_receive is fragile: the +lookup could be extended to all netns (not speaking about performances) +but nothing prevents those packets from being modified in between and we +could still not find a matching socket. It's OK to keep the current +logic there as it should cover most cases but we also need to make sure +we handle tunnel packets being GROed too early. + +This is done by extending the checks in udp_unexpected_gso: GSO packets +lacking the SKB_GSO_UDP_TUNNEL/_CSUM bits and landing in a tunnel must +be segmented. + +[1] kernel BUG at net/core/skbuff.c:4408! + RIP: 0010:skb_segment+0xd2a/0xf70 + __udp_gso_segment+0xaa/0x560 + +Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.") +Fixes: 36707061d6ba ("udp: allow forwarding of plain (non-fraglisted) UDP GRO packets") +Signed-off-by: Antoine Tenart +Reviewed-by: Willem de Bruijn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + include/linux/udp.h | 28 ++++++++++++++++++++++++++++ + net/ipv4/udp.c | 7 +++++++ + net/ipv4/udp_offload.c | 5 +++++ + net/ipv6/udp.c | 2 +- + 4 files changed, 41 insertions(+), 1 deletion(-) + +diff --git a/include/linux/udp.h b/include/linux/udp.h +index ae58ff3b6b5b8..a220880019d6b 100644 +--- a/include/linux/udp.h ++++ b/include/linux/udp.h +@@ -131,6 +131,24 @@ static inline void udp_cmsg_recv(struct msghdr *msg, struct sock *sk, + } + } + ++DECLARE_STATIC_KEY_FALSE(udp_encap_needed_key); ++#if IS_ENABLED(CONFIG_IPV6) ++DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); ++#endif ++ ++static inline bool udp_encap_needed(void) ++{ ++ if (static_branch_unlikely(&udp_encap_needed_key)) ++ return true; ++ ++#if IS_ENABLED(CONFIG_IPV6) ++ if (static_branch_unlikely(&udpv6_encap_needed_key)) ++ return true; ++#endif ++ ++ return false; ++} ++ + static inline bool udp_unexpected_gso(struct sock *sk, struct sk_buff *skb) + { + if (!skb_is_gso(skb)) +@@ -142,6 +160,16 @@ static inline bool udp_unexpected_gso(struct sock *sk, struct sk_buff *skb) + if (skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST && !udp_sk(sk)->accept_udp_fraglist) + return true; + ++ /* GSO packets lacking the SKB_GSO_UDP_TUNNEL/_CSUM bits might still ++ * land in a tunnel as the socket check in udp_gro_receive cannot be ++ * foolproof. ++ */ ++ if (udp_encap_needed() && ++ READ_ONCE(udp_sk(sk)->encap_rcv) && ++ !(skb_shinfo(skb)->gso_type & ++ (SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP_TUNNEL_CSUM))) ++ return true; ++ + return false; + } + +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index b2541c7d7c87f..0b7e76e6f2028 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -602,6 +602,13 @@ static inline bool __udp_is_mcast_sock(struct net *net, struct sock *sk, + } + + DEFINE_STATIC_KEY_FALSE(udp_encap_needed_key); ++EXPORT_SYMBOL(udp_encap_needed_key); ++ ++#if IS_ENABLED(CONFIG_IPV6) ++DEFINE_STATIC_KEY_FALSE(udpv6_encap_needed_key); ++EXPORT_SYMBOL(udpv6_encap_needed_key); ++#endif ++ + void udp_encap_enable(void) + { + static_branch_inc(&udp_encap_needed_key); +diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c +index 9f6dcdaf86a4d..445d8bc30fdd1 100644 +--- a/net/ipv4/udp_offload.c ++++ b/net/ipv4/udp_offload.c +@@ -512,6 +512,11 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, + unsigned int off = skb_gro_offset(skb); + int flush = 1; + ++ /* We can do L4 aggregation only if the packet can't land in a tunnel ++ * otherwise we could corrupt the inner stream. Detecting such packets ++ * cannot be foolproof and the aggregation might still happen in some ++ * cases. Such packets should be caught in udp_unexpected_gso later. ++ */ + NAPI_GRO_CB(skb)->is_flist = 0; + if (skb->dev->features & NETIF_F_GRO_FRAGLIST) + NAPI_GRO_CB(skb)->is_flist = sk ? !udp_sk(sk)->gro_enabled: 1; +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c +index 5385037209a6b..b5d879f2501da 100644 +--- a/net/ipv6/udp.c ++++ b/net/ipv6/udp.c +@@ -474,7 +474,7 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, + goto try_again; + } + +-DEFINE_STATIC_KEY_FALSE(udpv6_encap_needed_key); ++DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); + void udpv6_encap_enable(void) + { + static_branch_inc(&udpv6_encap_needed_key); +-- +2.43.0 + diff --git a/queue-5.10/usb-typec-ucsi-check-for-notifications-after-init.patch b/queue-5.10/usb-typec-ucsi-check-for-notifications-after-init.patch new file mode 100644 index 00000000000..8a9087b2467 --- /dev/null +++ b/queue-5.10/usb-typec-ucsi-check-for-notifications-after-init.patch @@ -0,0 +1,70 @@ +From d1d681805efd208e8c36de3f4a35632b064b85fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Mar 2024 08:39:23 +0100 +Subject: usb: typec: ucsi: Check for notifications after init + +From: Christian A. Ehrhardt + +[ Upstream commit 808a8b9e0b87bbc72bcc1f7ddfe5d04746e7ce56 ] + +The completion notification for the final SET_NOTIFICATION_ENABLE +command during initialization can include a connector change +notification. However, at the time this completion notification is +processed, the ucsi struct is not ready to handle this notification. +As a result the notification is ignored and the controller +never sends an interrupt again. + +Re-check CCI for a pending connector state change after +initialization is complete. Adjust the corresponding debug +message accordingly. + +Fixes: 71a1fa0df2a3 ("usb: typec: ucsi: Store the notification mask") +Cc: stable@vger.kernel.org +Signed-off-by: Christian A. Ehrhardt +Reviewed-by: Heikki Krogerus +Tested-by: Neil Armstrong # on SM8550-QRD +Link: https://lore.kernel.org/r/20240320073927.1641788-3-lk@c--e.de +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/typec/ucsi/ucsi.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c +index 2ddc8936a8935..ad648372106bd 100644 +--- a/drivers/usb/typec/ucsi/ucsi.c ++++ b/drivers/usb/typec/ucsi/ucsi.c +@@ -827,7 +827,7 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num) + struct ucsi_connector *con = &ucsi->connector[num - 1]; + + if (!(ucsi->ntfy & UCSI_ENABLE_NTFY_CONNECTOR_CHANGE)) { +- dev_dbg(ucsi->dev, "Bogus connector change event\n"); ++ dev_dbg(ucsi->dev, "Early connector change event\n"); + return; + } + +@@ -1191,6 +1191,7 @@ static int ucsi_init(struct ucsi *ucsi) + { + struct ucsi_connector *con; + u64 command, ntfy; ++ u32 cci; + int ret; + int i; + +@@ -1242,6 +1243,13 @@ static int ucsi_init(struct ucsi *ucsi) + goto err_unregister; + + ucsi->ntfy = ntfy; ++ ++ ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); ++ if (ret) ++ return ret; ++ if (UCSI_CCI_CONNECTOR(READ_ONCE(cci))) ++ ucsi_connector_change(ucsi, cci); ++ + return 0; + + err_unregister: +-- +2.43.0 +