From patchwork Fri Aug 23 20:00:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 821759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0644CC531DC for ; Fri, 23 Aug 2024 20:06:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5A6351FF; Fri, 23 Aug 2024 22:06:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5A6351FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1724443596; bh=aw59SIunqFIELS5Fh0+Q8lxZNWNSMCUFa1CSIJx6JvQ=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=PnsgOClesJFUBDvLTxmNKX4hqVeWLYzs+SGyYt7gYsMIKL6FcwPYNYZbKdfztBjPJ Z5ZaflIv11fiWGdGJSuxbpldibmm7/Qg6aCuu/S1PfgJcDgL5lv3XBvs7SHuC3xInI P0YnrhDS8S3OlT4gPes+ECYkI5vae5l36sa0Du2k= Received: by alsa1.perex.cz (Postfix, from userid 50401) id CFBADF80603; Fri, 23 Aug 2024 22:05:31 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 7756DF80603; Fri, 23 Aug 2024 22:05:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A769AF80496; Fri, 23 Aug 2024 22:02:01 +0200 (CEST) Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D50B7F80517 for ; Fri, 23 Aug 2024 22:01:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D50B7F80517 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=OIPbGLHg Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47NBD2wA009021; Fri, 23 Aug 2024 20:01:16 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=EbpUGdZYWaz1gSCzAD70ouF4 KW64zbhrUQmGahwL2ZM=; b=OIPbGLHgBM/uSttHDcD7BY9T0AzRWDNJiCh1Nb0E AIsFU6Qkyr1/Fk+f53/xKcjJtWUVHo9QakbjSrzCqK5maP5X0us2BeAFOZSgSxAP 29pbePjghq92Ugo9lrtSeGcQ8Cg9NWeqFe2A8R53BjgsrFsGUxD/jwnEn8Sq77C4 Ovh0u9ow2so3sXIPId56HS+zdp0Bbrf1wqaEz9T2FLcDWL+H5UXsZC73HEUer5Lm +LyJUDs3MTrp/ELNGssKgIIxaJ2HXXQTz1oVjH+lygpFE34VE8zcvaQMC2QmG3Na MzbPfd9A0bK9U98LJbvFkwAtRdu+ljT7wEKwRhir/ORENg== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 414pe5v8ch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2024 20:01:16 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 47NK1EVG008329 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2024 20:01:14 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; Fri, 23 Aug 2024 13:01:14 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , CC: , , , , , , , , Wesley Cheng Subject: [PATCH v25 04/33] usb: xhci: Allow for secondary interrupter to set IMOD Date: Fri, 23 Aug 2024 13:00:32 -0700 Message-ID: <20240823200101.26755-5-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240823200101.26755-1-quic_wcheng@quicinc.com> References: <20240823200101.26755-1-quic_wcheng@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] 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-ORIG-GUID: kUAMkixSalBMAvNgxvAJbo6QLoj3pMjW X-Proofpoint-GUID: kUAMkixSalBMAvNgxvAJbo6QLoj3pMjW 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-08-23_16,2024-08-23_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 spamscore=0 mlxlogscore=675 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408230147 Message-ID-Hash: YK762XJH3QC4AW5NS2ABSBL5VUJAOL4R X-Message-ID-Hash: YK762XJH3QC4AW5NS2ABSBL5VUJAOL4R X-MailFrom: quic_wcheng@quicinc.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: When creating a secondary interrupter, add an argument for XHCI sideband clients to specify an interrupt moderation value for the interrupter context. Signed-off-by: Wesley Cheng --- drivers/usb/host/xhci-mem.c | 4 +++- drivers/usb/host/xhci-sideband.c | 4 ++-- drivers/usb/host/xhci.c | 2 +- drivers/usb/host/xhci.h | 5 ++++- include/linux/usb/xhci-sideband.h | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 3100219d6496..2ca5937b73f4 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2334,7 +2334,8 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir, } struct xhci_interrupter * -xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs) +xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs, + u32 imod_interval) { struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct xhci_interrupter *ir; @@ -2367,6 +2368,7 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs) return NULL; } + xhci_set_interrupter_moderation(ir, imod_interval); xhci_dbg(xhci, "Add secondary interrupter %d, max interrupters %d\n", i, xhci->max_interrupters); diff --git a/drivers/usb/host/xhci-sideband.c b/drivers/usb/host/xhci-sideband.c index 281ab4c1fc42..f06bb49ede4d 100644 --- a/drivers/usb/host/xhci-sideband.c +++ b/drivers/usb/host/xhci-sideband.c @@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(xhci_sideband_get_event_buffer); */ int xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg, - bool ip_autoclear) + bool ip_autoclear, u32 imod_interval) { int ret = 0; @@ -273,7 +273,7 @@ xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg, } sb->ir = xhci_create_secondary_interrupter(xhci_to_hcd(sb->xhci), - num_seg); + num_seg, imod_interval); if (!sb->ir) { ret = -ENOMEM; goto out; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 3a051ed32907..0b22342bbff1 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -347,7 +347,7 @@ static int xhci_disable_interrupter(struct xhci_interrupter *ir) } /* interrupt moderation interval imod_interval in nanoseconds */ -static int xhci_set_interrupter_moderation(struct xhci_interrupter *ir, +int xhci_set_interrupter_moderation(struct xhci_interrupter *ir, u32 imod_interval) { u32 imod; diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 58236b435e1c..a2db8250b1fd 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1832,7 +1832,8 @@ struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci, void xhci_free_container_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); struct xhci_interrupter * -xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs); +xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs, + u32 imod_interval); void xhci_remove_secondary_interrupter(struct usb_hcd *hcd, struct xhci_interrupter *ir); @@ -1872,6 +1873,8 @@ int xhci_alloc_tt_info(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, struct usb_device *hdev, struct usb_tt *tt, gfp_t mem_flags); +int xhci_set_interrupter_moderation(struct xhci_interrupter *ir, + u32 imod_interval); /* xHCI ring, segment, TRB, and TD functions */ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb); diff --git a/include/linux/usb/xhci-sideband.h b/include/linux/usb/xhci-sideband.h index a03f0958ebed..dd4b1a27c08d 100644 --- a/include/linux/usb/xhci-sideband.h +++ b/include/linux/usb/xhci-sideband.h @@ -56,7 +56,7 @@ xhci_sideband_get_event_buffer(struct xhci_sideband *sb); int xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg, - bool ip_autoclear); + bool ip_autoclear, u32 imod_interval); void xhci_sideband_remove_interrupter(struct xhci_sideband *sb);