From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796182513; b=w3fVruuAtWI4mMgmieVPbRFbX+tLBkFda4uyv4dUs2ONL+92gh/y3YTZRW9KJ2tyynAK N6l/pk9x4eJGP71J/JAqpChKAwV9aJYfWqQVmElMMsaTOcMUgt0Gar6+9ZtmpP4iws5E4 ROiGvS6UcNba0tg09wGgUzdDuKFkDP1ObWTEiPZzLY+i99oa9NBQfpNN5OqpEyT5GZmiU gduTV14UczVeS1yQ4atyUGLCGCHEX1GP7FV0MLyfJTc7ClZrmpEF5gyJuQcXLBjbmprq+ fN9CDGbUZoP9MGvJCOgYrEY6Yu1TWC16WWELiFtHiWADdoTkTLPg5UHkCZwmWphFfGg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796182513; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Date:From: To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:X-Authority-Analysis: X-Proofpoint-Spam-Info:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=Us8X1ZI2embABM2ur4ETT9EQZFfA1A6ayAraf2yTEjQ=; b=leHAVfiv6sMJDmrtwsDyBwxsORAWYve0GvhGleB4IgCWUnKz5hrIo4LTi/dYpL700Wnb BejMr2+l/uYtpHM4LNKAbRKttdvIhcGRkvQnYLPPMT1od3bHlJ39vTqUXJ47rCNgfnqVK EjVsLBWVcgjXKgNAc8N1oA4zjDXh1JB3oKm4arWPf5G1YM5bFJKjTgzREUYJvLQwP6fIg mCIcWN9cy1gP1RNYat6jR/OO5wN9KmztFMQY416hUTjfLNNipukoqq45L5PWYl6C7JwVH VQwvHMX22YGwx19DFAj8B+1vfeoMJslD9rx0rOnQOv+2qvHefOsSlxW8k9KfzZGyayw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=pIjSArpU; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=QMxIE67J; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF64B606A323 for ; Wed, 2 Dec 2026 03:35:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DF64B606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=pIjSArpU; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=QMxIE67J Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B22u4Mc327169 for ; Wed, 2 Dec 2026 03:35:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=Us8X1ZI2embABM2ur4ETT9EQ ZFfA1A6ayAraf2yTEjQ=; b=pIjSArpUl42xvffnMqSQaz9/PSt8BAPfoCQmZ5t4 rN6BPKlBeie/MfeiPf+nKtxuS5Fvef0KGNIs947kFTUODCW/xsuBhT2wyG/PNAtg nJd/xXv/2tRN7IFa7JoUCgAT/V9f7oIYXoEQ91BP51Cx8zk7n5kTLnZXvK++X7qQ n+fSEUP9kl2p+WWMtO/I4Pd7YPl1850sICOb7MxJrm0tu7k0zXZ+yLux29TRJBDw rWCW8Yw9uTkRSUXGpcz2bZBalJiwQTIOOGXu8JBVFDXcbuuDQpm+Klgu6QP69cPa 65AZfi+2gQSZmq8ftobH8qtecd+u/dOUNboYQLSRWatfPA== Received: from mail-dl1-f69.google.com (mail-dl1-f69.google.com [74.125.82.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ja4ky9j50-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 03:35:12 +0000 (GMT) Received: by mail-dl1-f69.google.com with SMTP id a92af1059eb24-1b56c696405so6055771c88.1 for ; Tue, 01 Dec 2026 19:35:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796182511; x=1796787311; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Us8X1ZI2embABM2ur4ETT9EQZFfA1A6ayAraf2yTEjQ=; b=QMxIE67J59uvyEa9iGtGKMiuNImWdawaqfV0G6DoIoxuRmoYprGL7uWH5fPSDkOPyh aJgcsR2jP278TDE2ZFxK8UgI3yBRbJ7O5o7cdawGeizbGj+bndHs5Stkq6r2WsMV8qwF oedrDiLsI+4boaUxKG/NadzyUQzX9giMq4Fa7MRrh4QIc2CqNIx6ydHVkzE7IEjkVHr7 S9NIUeCsnzYuwgsdhayTdf7geNwlHVjlkOaDxiR9c1S4UgmHio4dwhxhhd+zP3ilbah1 y9bd2I566bub+KhHvbA2qZQ0MYoBu2Ccf3F1yF9BJwynbIok9Lf0jqGaRQ7ffctlOTC2 w8/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796182511; x=1796787311; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Us8X1ZI2embABM2ur4ETT9EQZFfA1A6ayAraf2yTEjQ=; b=cWjgtl6mfdY9CMl7EspNBxwbvNWhQXBNXOKakeBUTJ44wqlxc26CNmKHZaXCZmwtbe suL/vRF1xxThulhbQrVI8c/L4Mas9Da3tkZ5+xJ4RpG0mpNa/Zms2kFxRQ6l8knKBqtX x8VmLiKFZo/S+NwQ1aLNIBMcyGQX2sRT4Pj4YygXKZKankCBHnOjT1uTgsNAIm4tIbv1 Pzg+8Q3yFddVVV2hkOEhd3U2aO00QnopwfTzeRCcrSlkr0hwaM5M/zFhKcOvc12Fw3/v egokDya4n3Vs7a55EJK11vNJ61TqaqZu/kM50xCh4JCBJEW1ZU/CxIvvB7CL88DzjRpY L18g== X-Forwarded-Encrypted: i=1; AL+hErFNWnrGdVT4wnOGY+elcKgkNVpsFtkiJaeS52M/4jmzWjDW5EgEFPv1zb0oeYJ3H7nUhNhSMySFFjWm0Kvr@vger.kernel.org X-Gm-Message-State: APuU4Z8ag2zDJOpV78dyIw/QgeCOgDWcd/8A8Qn2+O7WlCIn84ZwjljB VcuxxEIn3bi+mr6k4oPz26irKkgobzLUwFhELmB8UegjaeeeXCWEMOf6pAhdHWCh3SS0OJuS9wK YbAkwBW/OcAo/CbcCpg4kmOskLTalognMxib0lHIUOmcKgUCMG43XwoWFmVTKSpGtEBgR X-Gm-Gg: AZFdTZde3mTZpY8J0ZksLuYZX7TxsusJCsUIqYqNItgBMe2lew2NUdG/EwPLzCZ4Myh aa5iTdnO62A8x5AlO3aRDehszTrUoCw5S7SPOYRN31i7rHK95gDZ6NwKwBuInNErNpsh5t2xZ5m VGPVDcHZeIRjcnCOM+SUHDAEszG8rJno3j7pOlLJ5DDgG79tAgFbbiW4nvGwM+ms7PwvqwllaDJ zqtZH0ndvxvg/y+WOHHn7/+cYEy3hQYQBmpVKCAVVcSaINN3KZR+LAHARxuLnPzH7eBOvF/e1Uk ipfhtBiwBFzapVdBlTFS/BAKW7aWar4Ddb/QVkYHG1uZ3+qSOCWohwShFln+7LN6jLN0x2y4NQR z1CrkuR/fazps9MpgZdrs/4GsWVlfkisVtNVbdIfBrrxY2JjOa4p798+QHvmIpFHqcNs50OCJu8 owVuzPgEpPbhCkGRHQiuh0 X-Received: by 2002:a05:701b:4558:10b0:1b3:b4cf:8f18 with SMTP id a92af1059eb24-1b556926cfbmr39258698c88.41.1796182511316; Tue, 01 Dec 2026 19:35:11 -0800 (PST) X-Received: by 2002:a05:701b:4558:10b0:1b3:b4cf:8f18 with SMTP id a92af1059eb24-1b556926cfbmr39258681c88.41.1796182510816; Tue, 01 Dec 2026 19:35:10 -0800 (PST) Received: from hu-petche-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5568592adsm86491762c88.15.2026.12.01.19.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 19:35:10 -0800 (PST) Date: Tue, 1 Dec 2026 19:35:08 -0800 From: Peter Chen To: Krishna Kurapati Cc: Thinh Nguyen , Greg Kroah-Hartman , Pratham Pratap , Jack Pham , Wesley Cheng , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 2/2] usb: dwc3: qcom: Vote ICC DDR bandwidth based on connected device speed Message-ID: References: <20261130-dynamic-icc-voting-v1-0-1a05a5320adc@oss.qualcomm.com> <20261130-dynamic-icc-voting-v1-2-1a05a5320adc@oss.qualcomm.com> X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130-dynamic-icc-voting-v1-2-1a05a5320adc@oss.qualcomm.com> X-Authority-Analysis: v=2.4 cv=O8ysLx9W c=1 sm=1 tr=0 ts=6b0f91f0 cx=c_pps a=kVLUcbK0zfr7ocalXnG1qA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=kj9zAlcOel0A:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=bXUgLIVcRQSiyoUw_O4A:9 a=CjuIK1q_8ugA:10 a=vr4QvYf-bLy2KjpDp97w:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDAxMyBTYWx0ZWRfXx4R6lRaM8hJR 0cWEOXu0QUIi9e+u8HDmP0AtvVLjb86MAfLn83Bh3lAHzcfuaq4Muw8E/SfNtgb1qpsZr7x5uAT lCW/0WVEo68kTcqshVzMwkV9YFZE8yc= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDAxMyBTYWx0ZWRfX9ZEzpiTvGieZ xIBTF1l1FfB3qdQHuD8y/NSR2Nblua7ArLc/m4+L7y9m1iHe43A/X+BUJz3ygXzRXafW6HPTmE8 p7AUab1RO/Z13kzQqBSkUtTjz2YSn2GZdNbi2pwxMPmgBQHF1Namzik10ylPGPoBfHAzv4P1o5P vNYb936Xc1YEPwzLiUY/EDno+yQXQDioamAOrMPaLwESiC8iOSrSNhDR55nf66Dbk9qpYNGz6Bs rD0kkIMp6WlUA0Sw2U9CCyg0USj+JD2W4HJqHKtcFvbhUIT81wt8dGKcHXQvNyu5AY5Ye4BFDb6 gtWCrt8NNvNXxx4+wurtlFX/dSnH+NASjMnggB8fX3+OEcHk0sB1FRyvjUoAN+LcR5FdjRS7+Fa Dn5lXVrlN0AGkBUnUGXURh75dMbu4g371mwDtwrX1MrM1/yqga/hukyM7N+fFbrNoPorDrihqYb TKxDo9dVbY8pHXHS18w== X-Proofpoint-ORIG-GUID: Bax5J4aGGFXdeXpp5jYtd85PVnvWcwG_ X-Proofpoint-GUID: Bax5J4aGGFXdeXpp5jYtd85PVnvWcwG_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_01,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020013 On 26-11-30 23:11:13, Krishna Kurapati wrote: > In host mode the actual transfer speed is not known at probe time. The > DDR interconnect bandwidth has historically been voted at the maximum > (SuperSpeed) value unconditionally, No unconditionally, just according to static max_speed. > +static bool dwc3_qcom_is_ss_rhport_connected(struct dwc3_qcom *qcom) > +{ > + struct dwc3 *dwc = &qcom->dwc; > + struct xhci_hcd *xhci; > + struct usb_hcd *hcd; > + unsigned int i; > + u32 portsc; > + > + if (!dwc->xhci) > + return false; > + > + hcd = platform_get_drvdata(dwc->xhci); > + xhci = hcd_to_xhci(hcd); > + > + for (i = 0; i < xhci->usb3_rhub.num_ports; i++) { > + portsc = xhci_portsc_readl(xhci->usb3_rhub.ports[i]); > + if ((portsc & PORT_CONNECT) && DEV_SUPERSPEED_ANY(portsc)) > + return true; > + } > + > + return false; > +} There is a similar API: dwc3_qcom_read_usb2_speed, would you modify it and for getting all speed usage? Besides, please check Bot's comments. Peter > + > +static int dwc3_qcom_host_notifier(struct notifier_block *nb, > + unsigned long event, void *ptr) > +{ > + struct dwc3_qcom *qcom = container_of(nb, struct dwc3_qcom, host_nb); > + struct dwc3 *dwc = &qcom->dwc; > + struct usb_device *udev = ptr; > + struct usb_bus *ubus = ptr; > + > + if (!dwc || !dwc->xhci) > + return NOTIFY_DONE; > + > + if (event == USB_DEVICE_ADD || event == USB_DEVICE_REMOVE) > + ubus = udev->bus; > + > + if (strcmp(dev_name(ubus->sysdev), dev_name(dwc->sysdev)) != 0) > + return NOTIFY_DONE; > + > + if (event != USB_DEVICE_ADD && event != USB_DEVICE_REMOVE) > + return NOTIFY_DONE; > + > + /* > + * For direct-attach devices, new udev is direct child of root hub > + * i.e. dwc -> xhci -> root_hub -> udev > + * root_hub's udev->parent==NULL, so traverse struct device hierarchy > + */ > + if (udev->parent && !udev->parent->parent && > + udev->dev.parent->parent == &dwc->xhci->dev) { > + if (event == USB_DEVICE_ADD) { > + if (!dwc3_qcom_is_ss_rhport_connected(qcom)) { > + dwc3_qcom_interconnect_set_ddr_bw(qcom, > + USB_SPEED_HIGH); > + > + } else { > + dwc3_qcom_interconnect_set_ddr_bw(qcom, > + USB_SPEED_SUPER); > + } > + } else { > + dwc3_qcom_interconnect_set_ddr_bw(qcom, > + USB_SPEED_UNKNOWN); > + } > + } > + > + return NOTIFY_DONE; > +} > + > static void dwc3_qcom_set_role_notifier(struct dwc3 *dwc, enum usb_role next_role) > { > struct dwc3_qcom *qcom = to_dwc3_qcom(dwc); > @@ -617,6 +689,13 @@ static void dwc3_qcom_set_role_notifier(struct dwc3 *dwc, enum usb_role next_rol > pm_runtime_mark_last_busy(qcom->dev); > pm_runtime_put_sync(qcom->dev); > > + if (next_role == USB_ROLE_HOST) { > + qcom->host_nb.notifier_call = dwc3_qcom_host_notifier; > + usb_register_notify(&qcom->host_nb); > + } else if (qcom->current_role == USB_ROLE_HOST) { > + usb_unregister_notify(&qcom->host_nb); > + } > + > /* > * Current role changes via usb_role_switch_set_role callback protected > * internally by mutex lock. > @@ -749,8 +828,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev) > qcom->current_role = USB_ROLE_DEVICE; > } > > - qcom->dwc.glue_ops = &dwc3_qcom_glue_ops; > + if (qcom->current_role == USB_ROLE_HOST) { > + qcom->host_nb.notifier_call = dwc3_qcom_host_notifier; > + usb_register_notify(&qcom->host_nb); > + } > > + qcom->dwc.glue_ops = &dwc3_qcom_glue_ops; > qcom->dwc.dev = dev; > probe_data.dwc = &qcom->dwc; > probe_data.res = &res; > @@ -789,6 +872,9 @@ static void dwc3_qcom_remove(struct platform_device *pdev) > if (pm_runtime_resume_and_get(qcom->dev) < 0) > return; > > + if (qcom->current_role == USB_ROLE_HOST) > + usb_unregister_notify(&qcom->host_nb); > + > dwc3_core_remove(&qcom->dwc); > clk_bulk_disable_unprepare(qcom->num_clocks, qcom->clks); > dwc3_qcom_interconnect_exit(qcom); > > -- > 2.34.1 > -- Thanks, Peter Chen