Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp77148rdb; Wed, 18 Oct 2023 19:20:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFdxaQz0MIn/f9UVBhtnAPugYu9KTUQiluhC+siMgRbEaTU7nILNicacuBH+9V9TPX1dRs X-Received: by 2002:a05:6a00:17a3:b0:6b8:780:94e5 with SMTP id s35-20020a056a0017a300b006b8078094e5mr856353pfg.18.1697682019133; Wed, 18 Oct 2023 19:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697682019; cv=none; d=google.com; s=arc-20160816; b=LiqtBg/dOkjip5Un6Yk6Z4TjHcc9Nbu8FnlUfU4zqdPK2sxogcRCNZavZiQKqfjBdk 9M1BSTGyf5Iu9v/M9Idqg9exwg1SmjsQib0eCqyRrPu/N59RllMZeud67eNP+A1HjlKZ CXscNUsmLF1DaOGYIvfBnjlu95nYZuf5asJnxsL9QSOPyUNLSk6wUiqLfTjXHuT9gtM/ QpFVDN6zKpzHdSgOyySXmN7L3yllDZr0vQsm4GktNwVUXt6O9BGFC4cJosh9k33n1feL KYORtfq8lrlD2RTGFsrwXxy45ruIArMDoEfCTMsGWGEulw2Aj2IGVVLrZ11yJPwGhuVF 3ytg== 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=rSZyjBns+k9ApsVQaas5ctcturc6JQrl8dAUcAP5WfI=; fh=ajqwJHB27W/J8EhLqkTAR2+yy30uzELfRT2VzGpH0WI=; b=EtmfFXaLwAT6ycQTs6NHPf6FobihKdgg47p4jsfzWp3sVduZEsgEGTof/67bnzwE7s nTkUUAjrZhwMnppakVGVLK8f3y3sUY7/2aaRXfR9OKyk0cOqoKz+kl+WMtvPrp1rqRFY gVz1/CZIMceSmXB4pSBG0WXOAo9N/bz6nGnfngHrsUS6xKm3M0nfQlWd0fweJrocQuhR BzR1CeWi70ZZuT+FNP4P8fAYBXBeeu8YdYOCGZXJMyx5nCFyKoQ8hO0n2LRth4H5nf3L n64++fvMJTdF6BZAr/FgQLIc76gF0E5Hgo7X0yxkwgaq9MPnFzMqOmxgBYXTh+aoYM5X 6wIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=bBMCDIPb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h71-20020a63834a000000b00578b6e2f462si3391937pge.351.2023.10.18.19.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 19:20:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=bBMCDIPb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 4FB2882164EA; Wed, 18 Oct 2023 19:20:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232444AbjJSCUK (ORCPT + 99 others); Wed, 18 Oct 2023 22:20:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232385AbjJSCUE (ORCPT ); Wed, 18 Oct 2023 22:20:04 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B497D114; Wed, 18 Oct 2023 19:20:02 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39J2JLLn021860; Thu, 19 Oct 2023 02:19:43 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=rSZyjBns+k9ApsVQaas5ctcturc6JQrl8dAUcAP5WfI=; b=bBMCDIPbLCPjtJi08uTga0emi1Ca6MBJ+iP5HWodEu+Pad3RXHXqfSZ3aXhMdTJkWE97 et5WRGwxwT7clguvrLExJhO8ayuRTsQ0DWTYR7myGoNwEuelMZJh7WHkea17nsTMQD1e vkWcUBD3KCZc1+rIw/3FBYIBI+vt/lzF5yUvnGxPeA9CMZYh9wLbuNcd29+CXD/tnoOZ ytVJ65wkASWy/usl8Z3uhW2H8oqpjXWuUfhALm1HmSJjzgJX+ncYDWvu/FmFroZQBC8v 1iULpi5ucO9UYgePOZId4qILeJK18HUlf55CLdeB8P+jHKPQKBQmEZGLJ0OwC0HJQRTY uQ== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tt8xsam22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 02:19:43 +0000 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 39J2Jg3V023043 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 02:19:42 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.39; Wed, 18 Oct 2023 19:19:41 -0700 From: Georgi Djakov To: , , , , , CC: , , , , , , , , , , , Subject: [PATCH 4/6] iommu/arm-smmu: Allow using a threaded handler for context interrupts Date: Wed, 18 Oct 2023 19:19:21 -0700 Message-ID: <20231019021923.13939-5-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231019021923.13939-1-quic_c_gdjako@quicinc.com> References: <20231019021923.13939-1-quic_c_gdjako@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.49.16.6] 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-GUID: FGv9foiXPH_io7IIJ0_yJu0rjt2_hGh_ X-Proofpoint-ORIG-GUID: FGv9foiXPH_io7IIJ0_yJu0rjt2_hGh_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-19_02,2023-10-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 suspectscore=0 clxscore=1015 impostorscore=0 phishscore=0 adultscore=0 priorityscore=1501 mlxlogscore=957 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310190018 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 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 19:20:17 -0700 (PDT) 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 d6d1a2a55cc0..a6561bb245ad 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -796,8 +796,16 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, else context_fault = arm_smmu_context_fault; - ret = devm_request_irq(smmu->dev, irq, context_fault, - IRQF_SHARED, "arm-smmu-context-fault", 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", + domain); + else + ret = devm_request_irq(smmu->dev, irq, context_fault, + IRQF_SHARED, "arm-smmu-context-fault", 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 e5df65c0f81a..09f11f942ff8 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h @@ -439,6 +439,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);