Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp625131lqb; Wed, 17 Apr 2024 06:39:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWbk9iu68BXSWc0KgQzjoa2lQOrQmle6ur6y0gNWg/79XRyxYvI5V85MWIm9IogabHk8SIEoSxHLXd6U2Z+hdS69grCAwn41VA2uuXJZQ== X-Google-Smtp-Source: AGHT+IG32F5fyCOjlJwTj5D/Jb3cNq/Frlf3oM8g2YGxDf9073N2+GSoW+TxevCpyd6NVGWiIRty X-Received: by 2002:a05:622a:1808:b0:434:6b70:4a1e with SMTP id t8-20020a05622a180800b004346b704a1emr9683275qtc.6.1713361190187; Wed, 17 Apr 2024 06:39:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713361190; cv=pass; d=google.com; s=arc-20160816; b=B8wKkv27IPCaFrmk5vpImnhLlNjeLh/X0NGkW/KyzEOI2LIuHMU2yvpxmjHqng+ZZ6 zsUGC5VXJkiB8lrVifugXJBsYLMCQktrjBxoysVRIbj+YRoxkYlLz5mkRtLQNKnNxlq3 ckAfia7Odq+MLq7yioJ1+Zw6yBfOep5VqbdXFOz9Yl6KEURyQCMI2Skkw04q6S8CDx1H dEP95dYy3VMGYoJAhR/w1zOjNCmX6RX1RD+u8hWCgathh0oATe9p3pwHIFowR/mj4ybs qnw/kzIDO69eWNdsupgWFgGU5XRnjNTZ6mi1YkII950EjBD3KxcH8VdM7VJoocqOCbv1 2BSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NYo5bTbP9SVkLOmtSkvA5WYl0Q0ujSV7BQbMNNZl+QQ=; fh=gTQnRIxpB4/GKsMy5s7HvzYf0xa4wk69uZmT/C+IYXQ=; b=rW1lPGAl+HjjbpAOaYu0sUXuDKZyeUlFqoWMjpAqWO8blKNzu+6Kpmo/KCuwFIIsSL QRij9ZeW7rhNC3jb/xCeVA/CrwFr/DTwRPZHu/ZvTln0i5zMg8CUkdQJFkBpkwsXjfK7 fPN7BJsIfBz/EdXy1TiaLT2JDyTe88vYGR8i2B8RNxiCZLEUK6NbOc1naZdpHeq9HpAM +j5yhqWXy0k0MqsfLtJx+m9Kz75zKan/ZZzUyevHIutnhuogj7sW1wqvTJODSkeRP38t k9PIItnh6mWt0U4D1IO66KK5W0GctLGuXCYvR9XhpvIsZxn+cNgjSiJCqZx5j+TF4cYW 5MPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dwyqLLT1; 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-148602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g17-20020ac87d11000000b0043699f456c2si11857840qtb.240.2024.04.17.06.39.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 06:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dwyqLLT1; 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-148602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148602-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C71BA1C20D24 for ; Wed, 17 Apr 2024 13:39:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3ACB31428FD; Wed, 17 Apr 2024 13:38:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="dwyqLLT1" 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 7BB421411E5; Wed, 17 Apr 2024 13:38:07 +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=1713361088; cv=none; b=W4mOJm1O1x3jGkRZEvInfvBrNmOX6nKQ4SK7d+dwxQYfl6Nt9cZLKSLMgG9dS9EbDsIR+h+Bfj2PV6R/ys8Sy7COLF2urrMv/ktDyATNx4oBIeS+CEuJydIUOcfgzkVASPlrNok8yicOuaAvsTY0nvQQpBhHLDm3o4Jbyx7xDO4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713361088; c=relaxed/simple; bh=433s858Ofhq5QpJwmBw+pFYMu3RV2E0h9F/0wjaadU8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u8xJOKhjfwb043djpl0Vgxk1QMVOwlzHkEqy9zgidOMr5wzekam4duoD+Bi2fU/5+ghStvB9WGFjoA9WRQ8lDRjV+l/UgWVDTotpZrPVDOa+2IgQFKRku7skB8sYSXf+7WqHaYBg14pahqCdC6pkX/PZdjOgCUre9uWWmbqRRRw= 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=dwyqLLT1; 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 (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 43HApqsv027589; Wed, 17 Apr 2024 13:37:46 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-transfer-encoding:content-type; s= qcppdkim1; bh=NYo5bTbP9SVkLOmtSkvA5WYl0Q0ujSV7BQbMNNZl+QQ=; b=dw yqLLT17An0NNUdtt4SpDEKI5f7t4HH/a9npdMRnIXoPPcAwYu0KzgRRPZL61xwKI ndwcxfCiYjFHl+qpMjjy/KAA3gyUCx6vVwc95T73g+wVPWrZ8/dT5o8YSfv87tgv zlW72IaPc7etEFftE2rQ+oISt94ILiGviqhQqoa6i/t/B1Hu0Z8zSNeX6h6fQsLr NvcxfxTOt4izr4fvI4DtnO5BlCS7/YN6asjs/401ikx9kejEfGM3TtIPnwTi46cT 9xiryhkdjspBeJ+lGyU6tYtzDZ9Or6HNuxBf6VSx3XzQgLXmow6my5ocXx0aQo9x x8fPOwCvRheGgEbFeMnA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xj7tr13ud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Apr 2024 13:37:46 +0000 (GMT) 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 43HDbjlB030706 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Apr 2024 13:37:45 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.1544.9; Wed, 17 Apr 2024 06:37:45 -0700 From: Georgi Djakov To: , , , CC: , , , , , , , , , , , , , , Subject: [PATCH v8 3/7] iommu/arm-smmu: Allow using a threaded handler for context interrupts Date: Wed, 17 Apr 2024 06:37:27 -0700 Message-ID: <20240417133731.2055383-4-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240417133731.2055383-1-quic_c_gdjako@quicinc.com> References: <20240417133731.2055383-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-Transfer-Encoding: 8bit Content-Type: text/plain 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-ORIG-GUID: hgufg7yNyRnAh8CCQJxaAZVv7SFM2ukc X-Proofpoint-GUID: hgufg7yNyRnAh8CCQJxaAZVv7SFM2ukc 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-04-17_10,2024-04-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 adultscore=0 suspectscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404170094 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 c572d877b0e1..dcf0479363c3 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 1670e95c4637..4765c6945c34 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);