Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp973337rdb; Fri, 17 Nov 2023 20:29:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHHCJ+xmV8VWAzNMFJ8AVpYvj4/yrFuzZUMrPH3ebC97IQlWwp0aHqHs8+xO+1OBj2lkIv X-Received: by 2002:a05:6a00:4307:b0:6c3:468c:6caa with SMTP id cb7-20020a056a00430700b006c3468c6caamr1795178pfb.6.1700281752844; Fri, 17 Nov 2023 20:29:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700281752; cv=none; d=google.com; s=arc-20160816; b=NuMFXU1wzVv+b7/BgdYzCcLdufQx5X3N2p2Y9DufM/vTig8fqfapgalS99/xWmHU1N EsPs10pB9S4A2NJ4z+SeZ9G99Wkjmwh4rmLUzCmSpsMFX8R8AcexjZX14wZYXIMmJMaj K3aECFqmMUKLKYJotk4+ZvhurLCXKxKeoiVIk7+oPMoxLUl8RsiHAJA7jU1SOfFHMOpu HfKJF/0cm7UycVLp/q9PdzVJ6DeQNji5K5mUafNXeRf6tqTRHoIR0Z8tXGJRJ1f+JwEj 9TJL3Eo1xcyg/adoU6kesbymsOYC8mYE3ipx2FiegjO4iC3BdIAi20IphfUeSVIxmaOy 1Wbw== 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=oZpwpALLZVf5oYxfHsoNAR84kMoOdlvkAEAeKd3xYIQ=; fh=ajqwJHB27W/J8EhLqkTAR2+yy30uzELfRT2VzGpH0WI=; b=oyCG97mH+mu+8OlnF10KAi7RqiirqLX7QLBBZyKtzWrzFpDJE+aLNuf5faseMa3nMV irAorhYZEp7YtJz1izVepEp08mFbOvQfSQXic0ip1XmpVoUxAVg6hqSdihZOtILCY0YM VmdxitvQVDIcI4esbXJqNgzv2ms2R9XLdNYghFz9ctFbe2lh6BkAxZi52BkqYDHcfJW8 t+zmQnP2K1oJEzi4FkkFKpU03H4poi9YRRl0ZNOgg9FWyEJcHJD+UCy8DZNA3ZurvNEt wO58fi8mNPh/CZxrxZfiL6RhXkANA/ra884u+cV52vSA/2ICvXk8qSEEH0KJQBDFJp2u Ufwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UR5caZcv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id z2-20020a626502000000b006cb3a2f407bsi1755636pfb.389.2023.11.17.20.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 20:29:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UR5caZcv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 90CAF810D646; Fri, 17 Nov 2023 20:29:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233075AbjKRE20 (ORCPT + 99 others); Fri, 17 Nov 2023 23:28:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233008AbjKRE2K (ORCPT ); Fri, 17 Nov 2023 23:28:10 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EA8810DA; Fri, 17 Nov 2023 20:28:06 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AI4Mmki004987; Sat, 18 Nov 2023 04:27:45 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=oZpwpALLZVf5oYxfHsoNAR84kMoOdlvkAEAeKd3xYIQ=; b=UR5caZcvRLqxff+pK84r6w5W3GBhNGIVdezUyDg3jxICvtDZATA3HZ8nWZzSa97glYQW zU0TmItCW3aSYx/RBViVOl8IUlspFdVmz9cw+JZ5aTz8G4bqYEBZcjFErwRbeGx0fKcj 5eYWZJ1z17GBOniRMQbSs4AiFlsQ0Li2CzlpupKo5K7Sihxy8WV69R4mzGE/ud2gBqC/ Egrx6n5foKFcqu5Nc7BTLhRdpLsWHn8fmxjDs2Rtx/Cfr9cH+KBd7/zy6PzzuM3SdL8p hwynU8k5mWGBbPgs33obBaaKgCw+Yfv8z0yx+w0E8CQ4Mn34e5MopBP+yiegIUuHaDbF xg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uenc0r1yg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 18 Nov 2023 04:27:45 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AI4RiNG032729 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 18 Nov 2023 04:27:44 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; Fri, 17 Nov 2023 20:27:43 -0800 From: Georgi Djakov To: , , , , , CC: , , , , , , , , , , , Subject: [PATCH v2 4/6] iommu/arm-smmu: Allow using a threaded handler for context interrupts Date: Fri, 17 Nov 2023 20:27:28 -0800 Message-ID: <20231118042730.2799-5-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231118042730.2799-1-quic_c_gdjako@quicinc.com> References: <20231118042730.2799-1-quic_c_gdjako@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) 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: nKuik_H_sbSzZ3Z50FpC8LgBu4e9Vu5M X-Proofpoint-ORIG-GUID: nKuik_H_sbSzZ3Z50FpC8LgBu4e9Vu5M X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-18_02,2023-11-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 phishscore=0 spamscore=0 suspectscore=0 clxscore=1015 mlxlogscore=964 bulkscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311180032 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 20:29:05 -0800 (PST) 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);