Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp371820rdb; Tue, 19 Dec 2023 22:11:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFX+qbi6hLke/oLe/tQhyOTI7MZR8niC7UzKgJ75bhZ4QLIL276BxGdRTCKHVcvBT7uVbHQ X-Received: by 2002:a17:906:f0c1:b0:a1f:5526:ead1 with SMTP id dk1-20020a170906f0c100b00a1f5526ead1mr2198277ejb.58.1703052704513; Tue, 19 Dec 2023 22:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703052704; cv=none; d=google.com; s=arc-20160816; b=uaTGDJEBwMcJypSoa1+HRFqAhjLxVl4mKiKxkffPFgwqkblsHVJIqwVahndXHXj+IY 8Mnp/jcGJoUKHdnEsrW4apPC64pViurtO2NcSCU1exKgL5PHW+V66Zy6cuSTNVtw0DVQ Q3wrihq/g0hDiz1QhdFYGFgH2DFU23uWjxajswZuSiGXRTr8m2YakPn6s/TQNIktAzqo Zmql/1j91NF/49mOkvShhDkgrhLUIMjJ8h2vxvcBqT5xMkEJFOptgldyb/8dZ+3CYCqu 74ebVDGYSY0R9r1GVYKrzGuwKjKQq6Lzsy9nwDKECclYNLe086U0qC+k26cOz+wsyu1O jC7Q== ARC-Message-Signature: i=1; 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=eoSOgLHAo5PU3AY5/6NYTjXTGHyxG/Npqvsyfy7LU60=; fh=ajqwJHB27W/J8EhLqkTAR2+yy30uzELfRT2VzGpH0WI=; b=JZZAS9R9yP4uiSTVRuHQi2VgAEcER3c7dYL7XygpABt/UkTiR7GYcqLK6soA3CH3Rw t64Wo7f6GCzemfWHJKBc7t0cnGRhk5kBEjZ0FvNs7wIdQyc6OosK4NN3sslJYze5gQ6x 4Z26qMLMI+oTAQz1w1XwJOwElfcO0M1RxrOm8Pl2+gSPw+uoor9ttpSrBhJmb5TWFO4W XEyZL4kXdE/Mq1ecLC8/1jiJEzB2n6xaROKos0B0Mm3Nl5DW+F+WmnIw/LcVfKn3wltA fRLxD2vNCeYV5eQ1bFqJ+Swt/95G6unUluBjCM8KLBzI4JH5WxuP3tD1pzE0gqYv2oCF 6ZOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=RRdjsfGw; spf=pass (google.com: domain of linux-kernel+bounces-6398-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6398-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o15-20020a170906600f00b00a1d1f6bb286si11131670ejj.302.2023.12.19.22.11.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 22:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6398-linux.lists.archive=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=RRdjsfGw; spf=pass (google.com: domain of linux-kernel+bounces-6398-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6398-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 60EB11F26E29 for ; Wed, 20 Dec 2023 06:03:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD4D113FF5; Wed, 20 Dec 2023 06:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="RRdjsfGw" X-Original-To: linux-kernel@vger.kernel.org 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 C6316134B7; Wed, 20 Dec 2023 06:02:59 +0000 (UTC) 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BK47Oe8016643; Wed, 20 Dec 2023 06:02:48 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=eoSOgLHAo5PU3AY5/6NY TjXTGHyxG/Npqvsyfy7LU60=; b=RRdjsfGwF/ESO4MBjbCVHrmdosVhRPfripen /WLEuPvdKnlB040cr1n750itQEBEQglsrTd+uEXeoCFygsSJgVMaTlWDwdmWqAPo S/cY/AgbI/HpIByAM+ynK92yYSSb0Z/3CaUKmsiJZOPsDHtKJ8POVMQE7yBwWBJI c+3CYjvRPtyxkIMsRn40NGfkhN8W58pFAr6F4QPtHyJesCZ1Irk8viZsMgKR82lC ubGlvScfmXdNMCG7I/O/SAl5m7faNi5bvcspNcpRRZU20qqRRvuCJiPFTwQ3eiHv mCdoQuzIZ3pQH3POfZOkWaKbzQJf1ry1Y13fpS2vIR8DdxtAGg== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v37vxtmqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 06:02:48 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BK62mHG023301 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 06:02:48 GMT Received: from hu-c-gdjako-lv.qualcomm.com (10.49.16.6) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 19 Dec 2023 22:02:47 -0800 From: Georgi Djakov To: , , , , , CC: , , , , , , , , , , , Subject: [PATCH v3 4/9] iommu/arm-smmu: Allow using a threaded handler for context interrupts Date: Tue, 19 Dec 2023 22:02:31 -0800 Message-ID: <20231220060236.18600-5-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231220060236.18600-1-quic_c_gdjako@quicinc.com> References: <20231220060236.18600-1-quic_c_gdjako@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 nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: bcG8l1si0NAW3U4uxFm5P-cMyTddr-fJ X-Proofpoint-GUID: bcG8l1si0NAW3U4uxFm5P-cMyTddr-fJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=983 suspectscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 clxscore=1015 mlxscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312200038 Threaded IRQ handlers run in a less critical context compared to normal IRQs, so they can perform more complex and time-consuming operations without causing significant delays in other parts of the kernel. During a context fault, it might be needed to do more processing and gather debug information from TBUs in the handler. These operations may sleep, so add an option to use a threaded IRQ handler in these cases. Signed-off-by: Georgi Djakov --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 12 ++++++++++-- drivers/iommu/arm/arm-smmu/arm-smmu.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 68b6bc5e7c71..82436a454c5e 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -806,8 +806,16 @@ static int arm_smmu_init_domain_context(struct arm_smmu_domain *smmu_domain, else context_fault = arm_smmu_context_fault; - ret = devm_request_irq(smmu->dev, irq, context_fault, IRQF_SHARED, - "arm-smmu-context-fault", smmu_domain); + if (smmu->impl && smmu->impl->context_fault_needs_threaded_irq) + ret = devm_request_threaded_irq(smmu->dev, irq, NULL, + context_fault, + IRQF_ONESHOT | IRQF_SHARED, + "arm-smmu-context-fault", + smmu_domain); + else + ret = devm_request_irq(smmu->dev, irq, context_fault, IRQF_SHARED, + "arm-smmu-context-fault", smmu_domain); + if (ret < 0) { dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", cfg->irptndx, irq); diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h index 17f704920190..54cb9dfcec76 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h @@ -438,6 +438,7 @@ struct arm_smmu_impl { int (*def_domain_type)(struct device *dev); irqreturn_t (*global_fault)(int irq, void *dev); irqreturn_t (*context_fault)(int irq, void *dev); + bool context_fault_needs_threaded_irq; int (*alloc_context_bank)(struct arm_smmu_domain *smmu_domain, struct arm_smmu_device *smmu, struct device *dev, int start);