From patchwork Tue Feb 13 00:53:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 200150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp271653dyb; Mon, 12 Feb 2024 17:37:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU37ekB4QwSGCJu6aFUZIXbubkBD6uci7tpifOcZl689/ecRFLiTy8zc1OnKc2HPwCzi2zbY4Dosngf6TP+sWMpTmXgNQ== X-Google-Smtp-Source: AGHT+IFGTJe/efusfd0p2/curpoESxvSgvRbbLqTfmOLqLEIHkzhWdaOxyj/Dw/hSvQXqYgmQptv X-Received: by 2002:a05:6a00:84c:b0:6e0:3894:998f with SMTP id q12-20020a056a00084c00b006e03894998fmr2035453pfk.17.1707788249572; Mon, 12 Feb 2024 17:37:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707788249; cv=pass; d=google.com; s=arc-20160816; b=nH/mBsCICkW7YiEqHEv9rdhq00TrC2bc03Ud8nl9BJo40eGcqb/0rbkV5BAwrnBiQ/ IxkggH8Uf1TTCAf5hzAhWJGQzx7VRlZLIqHwSd5w1krs26sKOqwqIdrTNveJYykcJ/6l 0ANuGQa8rEbeFg7DGxw2g5HDr8q3Lpn6+ROs2fYbZ1dil5XGdOIRpBa3cmEs5mOHa2Db MCjmwJfjSmTzB6IKoV539w+pAr/fiBXb7SCHWhNMRYU8phk+yBJyusshih0ZAz8sz9dR GPeWKbokg5DAe64U7nwMSuvHZLZ7gJNCbp+I6ypoXh7k6TvzS/fbtReBGZGOf1pAL5qh 6s1Q== 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=xzOBrfDY1od+4Hb15JRtAcSYTxJyZa8TNxYwb0Lo8t0=; fh=Toarj2zsimOyZrz2I3rIcsG53nyXGc4veCFBRF02gcA=; b=NPf96le3l+lSte8CNtZqgQ9Fg7cq+RCweHOkct84ET+pvnfaA/0t55ztOlLy2a98VI jjgX6EdxQd/BwIIp7zAY6krjhDtuSTgsfS0Jq3sTwlaCpsvPmHxgal8bf2xaALN6uNUy aL8L+D5mWvkXxdSsNpbf52qm5yoXmZpCZoQf77WicardnyMLNG2JN5ZTeWv4a/mLQew/ CLqBR/aGdTsViBa3WuwhNYowouOdNTAtSe7jfEHa8L6eSCtYmu/+Ie3YZMojiShR6Hzc asLLkFY2j7q6QUTkm8VB2oA/2xSzl+FCqd3lr1BvSdADJeZDH4dn5BoXMRq+YT9Et5zs bnsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=TPUSE0WI; 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-62789-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62789-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCUtUpb4BybkCezV3Vnzfhth+b5K3zHWjfxc9MmXgUZJi8JC/CwMrNRGN4D7PRvYbAMVafVAQJ2k3UaTIxXrdRttwG2z2w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g9-20020a63dd49000000b005dc82dd7342si465656pgj.740.2024.02.12.17.37.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 17:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62789-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=TPUSE0WI; 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-62789-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62789-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0D96028BAEB for ; Tue, 13 Feb 2024 01:28:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B9335F85D; Tue, 13 Feb 2024 00:55:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="TPUSE0WI" 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 55667224C7; Tue, 13 Feb 2024 00:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707785699; cv=none; b=lZj8fdekTimn0P2xkSk/BmqhQYXti8zeaCe8anPg7mzlmmF5nvbJlXpqiYD2uZX2LP9l4tq5ApkPlbhRaEAicpsB/ViFoGIvaC/frz5VaJAfaNAZuWhEBbQ3feTkUBgVAuw6K1ILsW7qGp+2TO5o6XP37lc+r53VKaq5kENH754= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707785699; c=relaxed/simple; bh=4wdCwc+iVxrd0/Vexs840M3pCv76BsAs/d8m7vV44Kw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hr0Nkcq7JoJ4MlG3mOEU8F8tkUbvLFnI+shqITfezMmiAGa8EOad3w3IgMFgmpNvyt77s3n/1NualqizmKELBM5qcmI03OiEOOo0X0g4o6cQTfka/imVKUHI/qaXbq2+G8qzF8MJ7NDcp3OD5IMS6/WFDa6xvAyoxD/dc9qML1c= 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=TPUSE0WI; arc=none smtp.client-ip=205.220.180.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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41CNmAVJ032703; Tue, 13 Feb 2024 00:54:37 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=xzOBrfDY1od+4Hb15JRt AcSYTxJyZa8TNxYwb0Lo8t0=; b=TPUSE0WI4YCX+/9t7JvM4xrbaNVSJnBlRSfR Eqv+DY+9d+B3HgzHS/18964GGnmYPMzyMX14Ywx/nEgOpsZcSZevHKoWyPIpUAke 09sfpCx/5Md/iYi3dOD314jY8It7kQId9ShkizvhC4FQMsO/wMN7w8QXrSVsTHH+ Nt4dW7eTKw6/FX7mSa9Gw1sv3PpG+k3mxbYlBOqmtq/QKgjiDw8zgoAC6wWFzurw gljEdF+meavH1TsWTJIsVISuySzIQr4Hj6zwF2izncxlfbu489ZL/I5YI8cxgSef AOYvmsw/QT02mBghueGDzc6HyI1R19R7hEcyG1cdpekeqaexGA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w7s390kbh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54:37 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41D0saW2026782 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54:36 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.40; Mon, 12 Feb 2024 16:54:35 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v15 12/50] usb: host: xhci: Repurpose event handler for skipping interrupter events Date: Mon, 12 Feb 2024 16:53:44 -0800 Message-ID: <20240213005422.3121-13-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240213005422.3121-1-quic_wcheng@quicinc.com> References: <20240213005422.3121-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 X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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: V02w5S8oxe2qZYGWjB73fFRf533jXXxf X-Proofpoint-GUID: V02w5S8oxe2qZYGWjB73fFRf533jXXxf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_20,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 spamscore=0 bulkscore=0 phishscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=809 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402130005 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790745771423977915 X-GMAIL-MSGID: 1790745771423977915 Depending on the interrupter use case, the OS may only be used to handle the interrupter event ring clean up. In these scenarios, event TRBs don't need to be handled by the OS, so introduce an xhci interrupter flag to tag if the events from an interrupter needs to be handled or not. Signed-off-by: Wesley Cheng --- drivers/usb/host/xhci-ring.c | 17 +++++++++++++---- drivers/usb/host/xhci.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 6ef95f67970a..958d6fd6d156 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2912,14 +2912,22 @@ static int handle_tx_event(struct xhci_hcd *xhci, } /* - * This function handles one OS-owned event on the event ring. It may drop - * xhci->lock between event processing (e.g. to pass up port status changes). + * This function handles one OS-owned event on the event ring, or ignores one event + * on interrupters which are non-OS owned. It may drop xhci->lock between event + * processing (e.g. to pass up port status changes). */ static int xhci_handle_event_trb(struct xhci_hcd *xhci, struct xhci_interrupter *ir, union xhci_trb *event) { u32 trb_type; + /* + * Some interrupters do not need to handle event TRBs, as they may be + * managed by another entity, but rely on the OS to clean up. + */ + if (ir->skip_events) + return 0; + trace_xhci_handle_event(ir->event_ring, &event->generic); /* @@ -3008,8 +3016,9 @@ static void xhci_clear_interrupt_pending(struct xhci_hcd *xhci, } /* - * Handle all OS-owned events on an interrupter event ring. It may drop - * and reaquire xhci->lock between event processing. + * Handle all OS-owned events on an interrupter event ring, or skip pending events + * for non OS owned interrupter event ring. It may drop and reaquire xhci->lock + * between event processing. */ static int xhci_handle_events(struct xhci_hcd *xhci, struct xhci_interrupter *ir) { diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 7c2481838f79..ad9d93c645ad 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1432,6 +1432,7 @@ struct xhci_interrupter { struct xhci_intr_reg __iomem *ir_set; unsigned int intr_num; bool ip_autoclear; + bool skip_events; u32 isoc_bei_interval; /* For interrupter registers save and restore over suspend/resume */ u32 s3_irq_pending;