From patchwork Wed Feb 28 01:35:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 207581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3076803dyb; Tue, 27 Feb 2024 17:40:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXh8n3mhRQVwuOVOf88ZG2ctlJQ2DNVHIVCuRaQkdLfNxFS0CoOkBnjBw+ICfB/oRacHpGvuQEewlmAeluM+Q8s++DoqQ== X-Google-Smtp-Source: AGHT+IENtvokklRANfRQ2tcN1AsGUchse0diDrdm3P7lNdcB5QNNvGog3DJO2Mqw6+P08FmzPO3E X-Received: by 2002:a17:906:f817:b0:a3f:1f0b:57d9 with SMTP id kh23-20020a170906f81700b00a3f1f0b57d9mr7779915ejb.1.1709084428647; Tue, 27 Feb 2024 17:40:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709084428; cv=pass; d=google.com; s=arc-20160816; b=eybeQ/yQYNfxRIKYGXCP3fqodX+MumcnfUgihPNTxvP37rJhjUfd4KSPTSNwUOo2kH uHriMd81Ntzetzj4+LK5l+CX3SoBigmiU3QMH0HUQX3TiVbrY5JUh9gN0Z4gD7YgX6sM 1jpyoik1JMl6vmB+Gsrt86DGnhqy3FIPZ6fuzcsY6FR5nH2N7Hcv+E286iZRlDrl0cuW DD2iY3bN4A9eRgV2ZTsFwbYA+Fr8EU661eAc7nzAEDdtkbYOw5O1z1QhQzvuDzZCyNaj AoiDD0yteKamt/IpfHRqv3h9Oy0tD3IFL1O0BNwy2r/gzAsCrFWCvREcQfMxq+8xK5bx DJhA== 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=43Y107OTi62mysj+97E42k9CxbAKw69bBJuDumhcQb8=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=0RbJrxrPWkVMV8QpD8RmCN8xFer28Ui+7vvN2GQIU2Ki5J6WKWg7dv0VCGTs4tw2VE PURewHBY9ana4/6JZrHf8OP/fwNzDCTolU/4Y3gX5AxYiTFXHPsUzIdnmOzlHITu7TZM dgYQCP/+oAGPVQppDIktRBJCpUV1kKppb3w8DBBk9UAKmKU4ToC15o+tt8+k4BwfxyKp aobAG4AsR8w2hl3GywWMhXSH0sPcwor45jfb02tYjoswSwp4Tbcz39n1ozoqgbI7pDK6 EZ5U6PCzm8b1G7gYJsY0xkWeJ+rhDf1YVMXUblnL2q1Fs+LKrIB9vfDQDJZjDJUZJwgw pljg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=g4DjWMSU; 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-84341-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84341-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q15-20020a17090622cf00b00a3d62b89211si1234478eja.293.2024.02.27.17.40.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:40:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84341-ouuuleilei=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=g4DjWMSU; 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-84341-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84341-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1E59C1F26FE1 for ; Wed, 28 Feb 2024 01:40:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C0DD286AF; Wed, 28 Feb 2024 01:36:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="g4DjWMSU" 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 CD6F01865; Wed, 28 Feb 2024 01:36:50 +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=1709084213; cv=none; b=SG0a80p9ni0OnhpXsVqYsdI8x5BksCL9U1ASHM/SL+CSNfSJnkMLIcBWj8s6pNNG62vCK1Ms6Xik6gsVHNYPuHncdLLKxfHCZKtKp9e78rHqLJz2+T2incMXT0yiuOqeFsPMaxj24v1iDTgmxWW0Gj5VRXQVj8I4ujMwhxxTyz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709084213; c=relaxed/simple; bh=1lZ9C3IooDwlk8tTDX36s+KlO4L2cj6MdvkA+2BRvL0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K5YzpU9UQqijynkNH9UP3ngC/2KMszli8bBOuRKDv0TyoLaKOymCbF5OoAbX+O8o7A9/7hoOsi+igywCqsf8j2F4AULT9rcj49bya88ye8Ck0CKc5WifP4iF8810gsmakxd2mAE3Ro0riX4rCCQAD1DpN19UwnFFdpfClZLeLLA= 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=g4DjWMSU; 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 (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41S0vXB9030336; Wed, 28 Feb 2024 01:36:31 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=43Y107OTi62mysj+97E4 2k9CxbAKw69bBJuDumhcQb8=; b=g4DjWMSUT8kPD3Ox/6rMVta9fc/jQkeqAg1/ 4KASwgMpLBzZvV2vyUnQVvEUyY9UAi0xnuDscAGNN9bvbJs649m9kWfS0N74QKN4 Sa5iPpXIMLuZjawP9Js+7ts7HzMdMBtJMoYUfHT9xMOFZ6k8F6bBVVCuYs7DGe+o I0XRx+ScBqXusWzbQp/nt511ONBkVObDvfCQnMnMCdyl+tHMXFgXMXVtzbPdHcEC K6SlDQhMnBCXL66psK0YQwHHRnpzP5rCs94B+nsd/mV/0VEbcd6icHCoTfOcxV4r 3c8UpxHw8T/2tvOSdWNkXiymvZSlE1VPY5XMe6RBF+E9SqMhZA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3whrqag955-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:31 +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 41S1aUJC016660 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:30 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; Tue, 27 Feb 2024 17:36:30 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v18 03/41] usb: host: xhci: Repurpose event handler for skipping interrupter events Date: Tue, 27 Feb 2024 17:35:41 -0800 Message-ID: <20240228013619.29758-4-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240228013619.29758-1-quic_wcheng@quicinc.com> References: <20240228013619.29758-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-GUID: O9GlNHXHoHA927EnI4VENswBaBds_y-y X-Proofpoint-ORIG-GUID: O9GlNHXHoHA927EnI4VENswBaBds_y-y 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-27_11,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 bulkscore=0 phishscore=0 clxscore=1015 mlxscore=0 mlxlogscore=880 lowpriorityscore=0 spamscore=0 priorityscore=1501 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280011 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792104913540167735 X-GMAIL-MSGID: 1792104913540167735 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 d4a28ac4967f..82c10a5ac6e9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2962,14 +2962,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); /* @@ -3058,8 +3066,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 8908c3f5af6f..9039f234cf52 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1433,6 +1433,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;