Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp91253lqo; Tue, 7 May 2024 13:10:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW9sruysvdueytSMKytcv2OwrS9zLqPCOwEyZdbiUqKtsSLGvSdmm4RX6cmNAq6SxhJNbpbQZfeUeQpuk6yECgiq8AlJ0pRasxHZTbgqQ== X-Google-Smtp-Source: AGHT+IGoNY1VwqPYr4Tkb4eFrl+Vz6zB0PizY4G9vXhwsVAC5H0vkvyzumI7a7nFJLm/RdoziVMs X-Received: by 2002:a92:c242:0:b0:36c:a2c:ceaf with SMTP id e9e14a558f8ab-36caecc863fmr6251575ab.6.1715112628785; Tue, 07 May 2024 13:10:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715112628; cv=pass; d=google.com; s=arc-20160816; b=TsRSUuYL/YYs72TRQX7cfWyJv8/A1QRTK9fyVbyDtm/p6K2oimPlrXNiHmKKIlbipd TKZTL3Y7ydGMqRvxFkjBRVMPl/kPHCbrQWnsyzuxww8FZ+SZ+BTY2SDh00mALuLEHHlR mUo7J55s3l3UpAEUJEFonnZImD9HYNNio8dLxyBd9Bmz/MIBSIPb4/LdRCk3bip+62wJ crwabBtvRv/TZN9jn3JNumRNS6TCsnrBbtDeTjLLKv4lrZg6ISGWUn33NgiwrBVejrLh S5xZy4diiaH0U7cC7rKX6gboQWGFHkui0437yeGp8DxiGAdN3RosAPe4M0c7CP5cW79a JTGA== 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=5j0NXx2LSx5D1CSIPg0eq6373pPRIn5SgAw4YDaZreE=; fh=tk8sqZoIP78riW3PYc75n3+DQFkqFrW+9GPE0/sstVA=; b=ZjjgaJpd97wEhWwo0ttf4dpctU5MtykjqMgXsc8H4B3XSYTWOky/joEhmiX6989Rsy FCADoFasU1glAoJiH8HjUQQbduxzUPqoX+Tjy2eVsz5gbN6aCmDyOyWZeUMwemPDjTOq FaE6NGKgl+14gT/4Kp97YEj1iMojO2hdyyHWI2+OfVDxXLyUeqAONRLaftXKdeL72+vE ctqSKwWf7BzRAzB7X9RzNVW62wTOBUCqf//hEfV117sdhuUcccbI0ePGeqOtxOivtZsY j/NQD5ndlQTgd3JJ4+ptC9WlbD1RGMSXKxJ9PsnOaEDqkBb6ENmGFqvQtMk5fXo6AGVs TJ0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Oueu9MTS; 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-172108-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a5-20020a63d405000000b00615707f807csi10629308pgh.115.2024.05.07.13.10.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 13:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172108-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Oueu9MTS; 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-172108-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172108-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id AD32CB253FA for ; Tue, 7 May 2024 20:03:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D15A182C84; Tue, 7 May 2024 19:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Oueu9MTS" 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 5FF6C17EB91; Tue, 7 May 2024 19:52:12 +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=1715111533; cv=none; b=Trmuq9ChYuBEjJn/AHdeRMx+Lcbd4h6qHu202fiQviHVq7SqOgpIpsgmUI7awvN8/wmhSFXjEz8r8wTp4h5RmFO9rkyGJ3MGLZfY69rVjUrKt+fHzn0cRuydtDuJ9xUBrBXcW9F+9ZUfAXFwHob1Qtk9jZ1v40qVu2ALza3fc2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715111533; c=relaxed/simple; bh=0SgrZf8eUp9Evx0jEHfaab1vSHRb1SyommXBWU4FjdY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=g4s82Dv9/GwUTf7q3prr816/CFYdpj94Y4l9hjyxRVZOv9JibOB9G4DEjH2R8IQaGtq9ht9OXMJheOJHhPLeeOmF+RY/XMrQZMHdtwuMPCt18jwi7SVDCzLdptdOkj/BX0slyecILM2SaR3Z7EA5Fh2qDPMY9R/XweSfW9jcoxI= 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=Oueu9MTS; 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 447JiXl7029328; Tue, 7 May 2024 19:51:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=qcppdkim1; bh=5j0NXx2LSx5D1CSIPg0e q6373pPRIn5SgAw4YDaZreE=; b=Oueu9MTSNMVILloGOhtYcoWMzkYLe4VHCPdo tC+gTp5Ds+2/kXeNNUu1VP7OCS+YZMCtbeH885FYUHyl2qyUykcq3TiPzyufODnv uFBlbFdSUYJBbQcoj9EvQI9MfKFeS+7zLgSzdhfsVqi7N2fq2ka75CoHLkpVqojm 2S3QZTiP7VHmYPhwyAffF1oK+kLCv9lgpIEEW0/ldbps34ZA46n1Bij3oTFb+gA1 oJpvNUkkjcSJZypdq9KPC/hDvjYO1pNpxokKCt+AfFTQvFVeOhO3xnlQJ6bihHgN bDg1izMANBFyLWXVtzPZlIH0/e4QLUaD/E7uSQSUo4tvX4yaeQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xysg9g5wt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 19:51:30 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 447JpSGT019763 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 May 2024 19:51:28 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; Tue, 7 May 2024 12:51:27 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v21 04/39] usb: xhci: Allow for secondary interrupter to set IMOD Date: Tue, 7 May 2024 12:50:41 -0700 Message-ID: <20240507195116.9464-5-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240507195116.9464-1-quic_wcheng@quicinc.com> References: <20240507195116.9464-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: MD0hDLnaLCFjxGOjx_STcFNqCWTPGxbA X-Proofpoint-ORIG-GUID: MD0hDLnaLCFjxGOjx_STcFNqCWTPGxbA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-07_12,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 mlxscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=710 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405070138 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 4879e1c3f0fe..7e7b15ec0cc7 100644 --- a/drivers/usb/host/xhci-sideband.c +++ b/drivers/usb/host/xhci-sideband.c @@ -254,7 +254,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; @@ -268,7 +268,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 9232c53d204a..eb1d1f946cdb 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 1035dae43cee..5fc95dd499aa 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);