Received: by 2002:ab2:644:0:b0:1ec:cbc4:63fb with SMTP id 4csp1164727lqn; Mon, 26 Feb 2024 09:24:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUXFtBHDqNbKhPad6fkCTcbUExwom9hrBqynnvAbwzhTP7TuSlqDvwMnQXTBrytv3rQJhhuM/XbrXObtk15x8nL3gs/rPOF9HO6qf57zw== X-Google-Smtp-Source: AGHT+IFdSYgf/v2y0JsUcROunwJy4P8dwRnX7ZP9NImL9AMSdE0zS8QyUQvcRSk/DpKW9G+hj1pE X-Received: by 2002:a05:6a20:c908:b0:1a0:e189:8568 with SMTP id gx8-20020a056a20c90800b001a0e1898568mr12419982pzb.15.1708968252119; Mon, 26 Feb 2024 09:24:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708968252; cv=pass; d=google.com; s=arc-20160816; b=s+yXFGP54CrBkDnDJ5H4dsh03VNhpZt2QLkvJDFsvJrqNdTJLRLlVAWPPyO+QEp2cZ AFU0S3w1j3jnaHvTwDfZkISPCkgZf+dnNDG0eUYCU3jRl7CqPMI/t+CXtgQvrw04sfu4 C+YkXQG9a6vAkEnDtQNXYTtL23abut0oiZzHlbzMHEfXJgXHsJw+AChMW+PlcxyuDzkB ZZVdnDaZGlmRQx/a6U+XCiLf4xO2UVvgKW98JLd4gtKX/9U8PB031jM1TnfkBG/uaZrE x7ldny/jMHw0y7ch8X061dMxBdjzkpB+iqDuwqNLkw/d5NHM3mD+T9mmh5J9Q3ZqDS2B wt6Q== 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=DqCD5vo/ZHTCtloKxZg3X6uBZkMSvMAdRgwVxNCc+ws=; fh=vaF/4wCcB8716OmkqYdm1mjnH1bqK2s/Tq/szIv64gg=; b=Zn+RD/qPZXPhZJhTWB/kyPLppVpv1G/t0m4KEohjnACIJr/Lg0X/EzXXQ/eOreKgzr MIWDae7AiFWgDEC149LpQ98znSmR2iVPma5BEWmqjEzVibYeFIEWWmQVdPSK2WujPSpT XlgPLOhXZ8B6cRdZY/qYxCJ76sZl8LesRgG/mGfcS48j8o6jXTrfeeppqX0fiBZYyBu5 jP/OCsac8Z4P5wLCjtP3zVFNI46l6wBKO7hgMcypk4LOE7ZiRRb4sGmRIXboFyKz04H2 2115rJRW7DWYMSBYK5BBMV0UUiRSnHA559SFCADCY/OpMEl8lP36q7NTw+4Kc2RiDRj7 FDvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=omPRSKDF; 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-82049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h18-20020a656392000000b005d7b75a5df9si3932113pgv.669.2024.02.26.09.24.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:24:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=omPRSKDF; 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-82049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82049-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1237428E7E0 for ; Mon, 26 Feb 2024 17:23:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 346BC12FF69; Mon, 26 Feb 2024 17:22:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="omPRSKDF" 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 D1D5A12CD9C; Mon, 26 Feb 2024 17:22:49 +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=1708968171; cv=none; b=NisJC/XnhdjiXZhmp9Hl4LagckjsqdiFmBfszJwv7tLOJvTewyv3apxgU8cLs1D/kT7uXIse6Y8jHk394EWvnxrQZsRvN9BODpDy2ntuw3O13Lg4AiCGrAPwIoN3tYiL4z+Tw7sIqem8zu2rhPucV/4p/CRm+D2w/hWnrTz5ak4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708968171; c=relaxed/simple; bh=7rZ4bLnEZoK2AKdsiFJgy5QItLaIu0cdIrWRLQNnX1Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bdu0V8ed4JTMNTFlzO0D6utSYsr/lDra+D4bxfxJ7pXyB7OYpjW19Caahz12zm8wzMpMgFDYSU2KIEKpmygOB4x3SZQFz26/v81Q5yjmfaFxpn7eJM6TPE9TzTSIaxuugWCGNUi+5npF1Lz3uFm2Bb+pfATDwIZDu4H3a61bYaE= 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=omPRSKDF; 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41QF9ElA026943; Mon, 26 Feb 2024 17:22:35 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=DqCD5vo/ZHTCtloKxZg3X6uBZkMSvMAdRgwVxNCc+ws=; b=om PRSKDFIOX5KYkHmFKmjcAAJbCq8HD4GCAnEjWE6qIkDoghbTUrF7ahVZ+RKEtdKu 7gbGO2u+wiFVnTPXQWihUXHlpV8L2tm5UlyWW9/D7nHgAuprxPxrwQP2pkdo70kb vXA1Buuy1wuZ+Q3cUTaIzmE3qYY5yExAxhaxTuJL9rntuOkPE9T9r/k0v9aWePUX 0WQjXWFNLRrhhRiStKvpTtUmnpcR0+NCP5XK41o3eVR8zFg++5wF+OCt/cbE2CKj Qx2FOKKo3pZCRjGvM/+uFX6F2lLkbzk8wkOQlSNTilNVLfU/N09tkl+fGw9p4Ljc WsQspXOwl7Vne5Tkyo9g== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wgkxnhja2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 17:22:35 +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 41QHMYNv006891 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 17:22:34 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; Mon, 26 Feb 2024 09:22:33 -0800 From: Georgi Djakov To: , , , , , , CC: , , , , , , , , , , , Subject: [PATCH v5 3/7] iommu/arm-smmu: Allow using a threaded handler for context interrupts Date: Mon, 26 Feb 2024 09:22:14 -0800 Message-ID: <20240226172218.69486-4-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226172218.69486-1-quic_c_gdjako@quicinc.com> References: <20240226172218.69486-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: ITPRnSXrRhcdbPTLuIR9FExw8adZIqcN X-Proofpoint-GUID: ITPRnSXrRhcdbPTLuIR9FExw8adZIqcN 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-02-26_11,2024-02-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 bulkscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402260132 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 6317aaf7b3ab..faf3241e4808 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);