Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp28005lqp; Mon, 10 Jun 2024 16:59:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWb+AsX7SNXyOBkTx/nf8CDG43zfEmULv2b9VsncR649yxRqJYE5E2JSDIfDCkukgHdREiyXIraVy8VojW3kl4pBuG/z90hAWHXNPQELw== X-Google-Smtp-Source: AGHT+IGS1/4dKJI3QO40Jfqj1toL0uR300vVVH6tsXsy43WJOQJdsTqQI6PKkLWShSG6hKZk6DsF X-Received: by 2002:a05:6000:cd1:b0:35e:83af:c0cd with SMTP id ffacd0b85a97d-35efed0a19fmr7463187f8f.14.1718063987550; Mon, 10 Jun 2024 16:59:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718063987; cv=pass; d=google.com; s=arc-20160816; b=bFsOLjd02d94s+rCDIusLgkRslpFTOTOqJliQ0fWj8UPUIf3X6ETlmvSF9jrWNdgNP F/lCXaVs5pHlu4K8Za3BYzwohXdNSbDhD9bPoQcTadaWII9zTgz1C6goFGzj8ixv51i7 I5lblaSvmlhljG1b/glADdq1fq+8zFXWswgLVT9ZoyDinVxg2j5P5tCIlHtR56AzJzis 6od6BjrwSI8r9kbWKUvE+7ndFfYaxbjZYbQMQBdxP4BoQ5M7QXpGcRMDC+N9gApU834o JVRvn/8t9ZYh901NlViQ7IyP7qiP3Bcojl2f1BIFTxrY0k9JC0Vvm5P1cwsGKaot4Tcy 3BYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VKPJYciOWdn4CHsMb0ZGUDDGnNrSGe/49oKInxiIGdw=; fh=wtHMo7F9o0E380HmQ3oEdtbLMOdVnxgjuxg3Tsny7VY=; b=hYJ5LEn2GOUoAZS35AUhfbnWbUWtzUY2rT1vlWhRwbZfiYqb1swFhE9DXpAg9ECYLb RUlejcj+vbBYIrKvGNX1ulTUWOgpFcxB3gzBMiIEmi4YSscENSZBoIwMtbThRubkEQZT yFR/nyHwxhvkJs1UIwQrloJgsvVTVPJ7vQljBnUJ1RfQqmZXukLP/FqOBXCI4AnxUYMe G1hedRQJ/tAldWGqYkJ26ZRsXX4/ataQZIsHArZ53LIZpTFVbpjJ4plRoS1SH+GuBt82 HguJ8D9+3ZlEIKOUKMj45GY2btU75DrHgPv2F0koMGs+kPgoPqVOzcPvN1OAKUbZz1dk 7Mng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CTjCOqX3; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-209075-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209075-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6efecbb5d0si291764166b.47.2024.06.10.16.59.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 16:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209075-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CTjCOqX3; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-209075-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209075-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 153F01F228A5 for ; Mon, 10 Jun 2024 23:59:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C84B15532C; Mon, 10 Jun 2024 23:58:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="CTjCOqX3" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6201715251B; Mon, 10 Jun 2024 23:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718063923; cv=none; b=rSvawucCS65yElEzZ5QRYv1GX0aFjAaGYzeqBvS5eWWmJSHmPN5Ngx4/A5lwpdHS9wAVHfC9GDVQDjxC/5YLKIiHljtcDAB8huDMTc8KtUl1B/KfLDO9uc+gZTeGZbdNVWM/6vuFHdMJu6J14tcsKSJx7lnPLkVnBvsWQzUJzpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718063923; c=relaxed/simple; bh=QVgWaaYEEcsUT6bvDe9VM8T2WMmhn1VpGiCa8jvulI4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pbeOKn6mHnDYXtkubQunrYSrW6vxz78jigJBsX8PnlIrvGNf0Ay2O4l069L28DYoG87t4gnpevny7QzFZQQXJaXc9hT10BsSWrl5SHLrF9fkrFLWTxAn61tGCfo1YrbO4Nr6dnfNHzNSXYsdtXlql4Fn2dw/sEfUuygvEvQ/mZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=CTjCOqX3; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45ADCdJ1016219; Mon, 10 Jun 2024 23:58:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=VKPJYciOWdn4CHsMb0ZGUDDG nNrSGe/49oKInxiIGdw=; b=CTjCOqX3VWhEzg9J0JuYLS49halpP+Z2yfKwsOfL vxbVMs1VOjwV5BwZG2xjfVpIj5WRP57AmfupRUYkpHxljH/6/CSqOTGJG9pPEhBU WSvaKamri6l0icrfnsIdUPROEBMMUucWyzDNLV9IwWFMG7h9fZF+Wc4gxOo+zLyK CBrY1Um+A0jiRcyxo18GpzJjyuqU7wqjtfy3HO0MJZC3JQPwN/Z6DUnFqsX09L/r K54+CrHTdl5jvl/pGdiWC1khlZ6iTJKZyzgUsbWAugSHu7xQ/GylwQzEtyCk53NQ n/ZFdEml3D1t/ZtpMJw9VgQaRJ7pbm0l+evE3cHBIr9igg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ymgfk5ekq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jun 2024 23:58:23 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45ANwLDi001482 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jun 2024 23:58:21 GMT Received: from hu-wcheng-lv.qualcomm.com (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 10 Jun 2024 16:58:21 -0700 From: Wesley Cheng To: , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v23 09/32] usb: dwc3: Specify maximum number of XHCI interrupters Date: Mon, 10 Jun 2024 16:57:45 -0700 Message-ID: <20240610235808.22173-10-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240610235808.22173-1-quic_wcheng@quicinc.com> References: <20240610235808.22173-1-quic_wcheng@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 8u-3A7QwHi_XpJh_GioEhAG49tgVZLRt X-Proofpoint-ORIG-GUID: 8u-3A7QwHi_XpJh_GioEhAG49tgVZLRt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-10_07,2024-06-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 phishscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=920 suspectscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406100177 Allow for the DWC3 host driver to pass along XHCI property that defines how many interrupters to allocate. This is in relation for the number of event rings that can be potentially used by other processors within the system. Acked-by: Thinh Nguyen Signed-off-by: Wesley Cheng --- drivers/usb/dwc3/core.c | 12 ++++++++++++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 3 +++ 3 files changed, 17 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7ee61a89520b..7aa6f9700757 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1573,6 +1573,7 @@ static void dwc3_get_properties(struct dwc3 *dwc) u8 tx_thr_num_pkt_prd = 0; u8 tx_max_burst_prd = 0; u8 tx_fifo_resize_max_num; + u16 num_hc_interrupters; const char *usb_psy_name; int ret; @@ -1595,6 +1596,9 @@ static void dwc3_get_properties(struct dwc3 *dwc) */ tx_fifo_resize_max_num = 6; + /* default to a single XHCI interrupter */ + num_hc_interrupters = 1; + dwc->maximum_speed = usb_get_maximum_speed(dev); dwc->max_ssp_rate = usb_get_maximum_ssp_rate(dev); dwc->dr_mode = usb_get_dr_mode(dev); @@ -1648,6 +1652,12 @@ static void dwc3_get_properties(struct dwc3 *dwc) &tx_thr_num_pkt_prd); device_property_read_u8(dev, "snps,tx-max-burst-prd", &tx_max_burst_prd); + device_property_read_u16(dev, "num-hc-interrupters", + &num_hc_interrupters); + /* DWC3 core allowed to have a max of 8 interrupters */ + if (num_hc_interrupters > 8) + num_hc_interrupters = 8; + dwc->do_fifo_resize = device_property_read_bool(dev, "tx-fifo-resize"); if (dwc->do_fifo_resize) @@ -1736,6 +1746,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->imod_interval = 0; dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; + + dwc->num_hc_interrupters = num_hc_interrupters; } /* check whether the core supports IMOD */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 3781c736c1a1..95e6989d116e 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1077,6 +1077,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize * @clear_stall_protocol: endpoint number that requires a delayed status phase + * @num_hc_interrupters: number of host controller interrupters * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs @@ -1318,6 +1319,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; + u16 num_hc_interrupters; const char *hsphy_interface; diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index a171b27a7845..3e5687d6d631 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -180,6 +180,9 @@ int dwc3_host_init(struct dwc3 *dwc) if (DWC3_VER_IS_WITHIN(DWC3, ANY, 300A)) props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped"); + props[prop_idx++] = PROPERTY_ENTRY_U16("num-hc-interrupters", + dwc->num_hc_interrupters); + if (prop_idx) { ret = device_create_managed_software_node(&xhci->dev, props, NULL); if (ret) {