From patchwork Thu Sep 21 21:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 143154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5304618vqi; Thu, 21 Sep 2023 20:57:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMaqsCoOfLOUyptOi20qwPzqom6XH4FVaZ1XOn0CXajjazYyXoVH3RHS0HfqlPMRHbCdCL X-Received: by 2002:a17:902:bb8f:b0:1c4:202d:8747 with SMTP id m15-20020a170902bb8f00b001c4202d8747mr5732873pls.50.1695355036604; Thu, 21 Sep 2023 20:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695355036; cv=none; d=google.com; s=arc-20160816; b=ewYwr70HiOQc2A6F6emPS2mYxA51Io4Imx64kM8dr2JxjsKSK7hPrpMA0R57QjJB1J jpVAZbDSE+G8l/AUaFDZUGRygClzLAI9wPZCZ+s44S1cz2O3AnhgqMZVedvuiG5cw1dt TtwVLYQIfVgpJCvduezNSAOiL6MoU/3AG7kTVUenKCVfxTcgVYx3u6Kcqvb3eIqng2bN cJD+OkwHakRCwfcJDe01RE1prPB7iYOQ6umSWdr2aL4grmw47qjISIXs3GICviVXxHW5 Km1y2y2LxNgT8FjdPzfDT/odDAZgBDbGAOcdMjc2SeYq47xP3rTGWfdsilSSAwKime0X iCtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=r31eiFMh/CBoLoST6JeTG7QMm3NUYna5E/5qOM98ZVk=; fh=MhCCCRx4c0AeUz43uLzZOKA4YzcBN2mk3tAWrRRVvW4=; b=gjWnVdCh4iHCzDce2615sFlJ+HvblNvurpzmR+ihGVm9G1BifqvgH9h15ssn/hMo0B ix64r9sHaFK1uaqwOa5+KJ7IqEMyoUVhOVvUB1qBUh/jvzCO7Hh1brfird/0ETX9ZLiY iTUtaAxZIX5Z9wUBOViawVkndq2+JRHg3YIp4ZMYBjhsslAzUh9ZubEwSTb/U935FEkw GhMa+a9JYHyJTDeL0FG/BqfvMYp0Nh8kW0j5KAgv34Mp9LoyyHAfPMHpTys0H9CIkdXX DJLWoQ0tndPq5oZEOKbaueopIhoANHIzdDXatgh2F4UZSlFkTLtAgRBOUS90FkaNdLml LwUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Y5guhq4G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u13-20020a170902e5cd00b001b8ac52a19esi3341963plf.436.2023.09.21.20.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 20:57:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Y5guhq4G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id ADA4685391A8; Thu, 21 Sep 2023 14:54:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233079AbjIUVy0 (ORCPT + 29 others); Thu, 21 Sep 2023 17:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232815AbjIUVxZ (ORCPT ); Thu, 21 Sep 2023 17:53:25 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACFB32D72; Thu, 21 Sep 2023 14:49:49 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38LLnPVq020951; Thu, 21 Sep 2023 21:49:25 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=r31eiFMh/CBoLoST6JeTG7QMm3NUYna5E/5qOM98ZVk=; b=Y5guhq4G6OJnBoQzBr3WF0dMDMtDF/1SSMaKQ9dXOgmab/ioDw9wEGzU2eHoMON+MQHY d+fUg2GTmKJEDkSFH4JbLPOCaxF2vFcMgZoQIzoQyOOHS5JOH9sA9EjEN3RdcwCEWD7t bRYN8JBHE17lte1osmZapN1XpLiPNdoevxp7twYu+sdvbN60U/9boS3lhOYvXKsUaGpb T1PTa5geEXuibnF1z+xIZ4p6BXG7z3KKrVJUe2bFWNZL9Qaz1+OnUMtouz3BytK9htK7 UaEJ/0VkEnVhHhtfjWbPLmsSRdU4cKdJJ7PL/ZJ4+hiNe1I4zudy9ZhW9Zks5xLWAuBY og== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t8um1r96p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 21:49:25 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38LLms02032081 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 21:48:54 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.1118.36; Thu, 21 Sep 2023 14:48:54 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , Wesley Cheng Subject: [PATCH v7 05/33] usb: host: xhci-mem: Allow for interrupter clients to choose specific index Date: Thu, 21 Sep 2023 14:48:15 -0700 Message-ID: <20230921214843.18450-6-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230921214843.18450-1-quic_wcheng@quicinc.com> References: <20230921214843.18450-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: eUN8CFd5kyyqjmFzFTWDPwE4rZi5uOpD X-Proofpoint-GUID: eUN8CFd5kyyqjmFzFTWDPwE4rZi5uOpD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-21_19,2023-09-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 mlxlogscore=469 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309210189 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:54:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777708602624169313 X-GMAIL-MSGID: 1777708602624169313 Some clients may operate only on a specific XHCI interrupter instance. Allow for the associated class driver to request for the interrupter that it requires. Signed-off-by: Wesley Cheng --- drivers/usb/host/xhci-mem.c | 12 ++++++------ include/linux/usb/xhci-intr.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 94cbc25e77ca..9d07aea34fc6 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2328,7 +2328,7 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir, } struct xhci_interrupter * -xhci_create_secondary_interrupter(struct usb_hcd *hcd) +xhci_create_secondary_interrupter(struct usb_hcd *hcd, int intr_num) { struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct xhci_interrupter *ir; @@ -2343,15 +2343,15 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd) return NULL; spin_lock_irq(&xhci->lock); - /* Find available secondary interrupter, interrupter 0 is reserverd for primary */ for (i = 1; i < xhci->max_interrupters; i++) { - if (xhci->interrupters[i] == NULL) { - err = xhci_add_interrupter(xhci, ir, i); - break; + if ((intr_num > 0 && i == intr_num) || intr_num <= 0) { + if (xhci->interrupters[i] == NULL) { + err = xhci_add_interrupter(xhci, ir, i); + break; + } } } - spin_unlock_irq(&xhci->lock); if (err) { xhci_warn(xhci, "Failed to add secondary interrupter, max interrupters %d\n", diff --git a/include/linux/usb/xhci-intr.h b/include/linux/usb/xhci-intr.h index e0091ee2c73a..738b0f0481a6 100644 --- a/include/linux/usb/xhci-intr.h +++ b/include/linux/usb/xhci-intr.h @@ -81,6 +81,6 @@ struct xhci_interrupter { }; struct xhci_interrupter * -xhci_create_secondary_interrupter(struct usb_hcd *hcd); +xhci_create_secondary_interrupter(struct usb_hcd *hcd, int intr_num); void xhci_remove_secondary_interrupter(struct usb_hcd *hcd, struct xhci_interrupter *ir); #endif