Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp90286lqc; Thu, 7 Mar 2024 11:07:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPnLkKDpk395Z0AD5IqsWhkcWbiqqWYHSlpFd1gyE8q6ggZQsrQ7ydJrPKXGsxCeHDP9can826OtezYXok4WjC8BLwwdvOb4Awpzuujw== X-Google-Smtp-Source: AGHT+IEa2RJkBA1/jTKor4o3xw0e6y4F9aq7cXZOV7j7MYrLtxjSvwd4+pVAsP6nWNjbz4N3J0zv X-Received: by 2002:a17:906:4551:b0:a45:270e:3617 with SMTP id s17-20020a170906455100b00a45270e3617mr9809737ejq.27.1709838457355; Thu, 07 Mar 2024 11:07:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709838457; cv=pass; d=google.com; s=arc-20160816; b=pE41zYlGghge0YbOEtLDMdbB2WxoaNTH3gjY2MSquSrQowTiJKH6bROK5QyoE4z9ij 06Sgb4SwpZEn3xbPxXgrLzx2ZaMAPQ0+KVqo8bNqRqT90s7Fwytd9WtldfbwlqZu1AC1 668aTp2M6PXdbDR2EI9HijicTr0giz96HrNeRjkcF5FyB8/asfzEe+bPVpNuRu8KCITv mkseQHjY8UkYYWaPsMQB7N009rxuDHCIC4cYlFqphU3zFoeAH5+jC+O+p+oDvRz1otCO JQKZp6ysNkVPUu7+OO30Z/1zzii7Of+jlCxexJ8CrnnBJ1UJByXolzez0BqOgpYmCiDT 3W+Q== 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=vaF/4wCcB8716OmkqYdm1mjnH1bqK2s/Tq/szIv64gg=; b=D+on8fdEtJOotAvOjbj5LRLHDlXniUUB4uyM9eo3R5ALEBPwQRG2mkilw+7d0yAouR rN3YaT5gJL0k51HpamwmkxE+x+UIE7GPoIWO3PuMA6D66ikMIwc0N/IC3s3I0Uu8Vd8k O5lNihj1SVbxvKocWUlMFVQyrhKfwJDPFYn6RTQcHBhiJ08JmRz2Kuw+S1R0hLnGYmii dWugr2D3KjBTnP3jYj1HpHY2Cy31oPKNXx/KrMPth0FU64r/py78U65oKKZHs2Yp1mIA 5Xqmdu7xsjX/tmHXBIfUESK0s54aknZuinxjsD/7TcaTmy4nZPvpdPo/YUQgMZkmg5Gr GrFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=O8zMarDO; 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-96059-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96059-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 dk16-20020a170906f0d000b00a45a738e8f1si2123046ejb.706.2024.03.07.11.07.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 11:07:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96059-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=O8zMarDO; 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-96059-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96059-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 E3EDA1F21F41 for ; Thu, 7 Mar 2024 19:07:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 200041369B5; Thu, 7 Mar 2024 19:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="O8zMarDO" 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 42E79137C30; Thu, 7 Mar 2024 19:06:00 +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=1709838362; cv=none; b=rN0mW5TZzLnU1umtNOrYzRLptBKVyzyUsrOmddog0YVGuQS0kFPnjzv++20XgWNf/BbdGEZ2FTHcl1D8wYC3yaZoOUcVBd2bVj1Zmd34dK6yUC3bjFZk3UeiTZ78kjbVb3mvvGhqqd7gCU799+WE1x6dgbKQDolYO0EeppajIig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709838362; c=relaxed/simple; bh=433s858Ofhq5QpJwmBw+pFYMu3RV2E0h9F/0wjaadU8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q0KY+LZHcjxEI2pf4XE7cXsKL+XQFJjXpFLyBZzxunmpnvqptwEFPYe7xF3dQIhQqc0eTS6PH5d1AKk1anJ62ktzEXvcb22VlfbatwHenN0h3MDBe5mdbcZso4aKDxDVbHThX52lYsXtqbDXnHUV//qTBSNcAA1YPrLxFejxOCI= 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=O8zMarDO; 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 (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 427FxUWW016711; Thu, 7 Mar 2024 19:05: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=O8 zMarDOuaVv+g1rs/1d9z+dm9NDM/aJdyX+8zu9l26LM6mcMmAKWfMfY9c7MX62Zy g+suHKzzHDRwB0EqsU5BiF78fuZGsaeuBTgKmfryh9PEQKRt8wXDZVNwh9JFbOiW YOic17/ZpUqcmJ2D7f+LU734MTD7EgBlxAudXXXqQUYtU+9CQFVCwDWh5PewDMTa +d1l8v+rFXHsibd33svQLgcSbeIO7Tdj8vxc/AM7uKJvsDfcMW1ySpfSCDJCcqBu swMYH3jNAWZDzwWcUMg082CLn3NZubZuFchO/Tb+WbvSzT9So6tV+eXimXhYTAd2 3Ky4GoPJNRv36A1P9L4A== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wq588hrw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Mar 2024 19:05:46 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 427J5jJF004563 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 7 Mar 2024 19:05: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.1118.40; Thu, 7 Mar 2024 11:05:44 -0800 From: Georgi Djakov To: , , , , , , CC: , , , , , , , , , , , Subject: [PATCH v6 3/7] iommu/arm-smmu: Allow using a threaded handler for context interrupts Date: Thu, 7 Mar 2024 11:05:21 -0800 Message-ID: <20240307190525.395291-4-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307190525.395291-1-quic_c_gdjako@quicinc.com> References: <20240307190525.395291-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: 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: gycJQua4o1j_CWYTeG-F4KfQseZWOJep X-Proofpoint-ORIG-GUID: gycJQua4o1j_CWYTeG-F4KfQseZWOJep 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-03-07_14,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403070133 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);