From patchwork Thu Feb 1 21:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 195464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp23993dyc; Thu, 1 Feb 2024 13:08:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGWwSIXkKnuPPAtPIp1+Bw5dS4s5pWBM8sXRyKmdyqZjzmFWWR5yyENBlAqhHYUVjj7jw3 X-Received: by 2002:a2e:9b46:0:b0:2cf:555f:1c6e with SMTP id o6-20020a2e9b46000000b002cf555f1c6emr32129ljj.23.1706821693988; Thu, 01 Feb 2024 13:08:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706821693; cv=pass; d=google.com; s=arc-20160816; b=M7wdcKuZ5X85S5R+Gd35//EyQ2HltZLqhPqEG518mXQT2Cuk0A1HGUknIadnzpSiGm 9f+uuhTPC/vrG7Vwuab/CO1Q2IBYQBQ+dxqivWkRRcUYrW2IowQrF7FQwurmui8T+8Pe tmyvuqA0dLD8QFJ4MCpisw736ajh2pmmogEfC56u5A3fK7/RRz08YcjrSTz5e5ONS1vI 8eXeK0uS3X+0x7Z3Tsp5dqLR2QbUQ34ADLX0Pp2juLJ5oxnq3G7skwiCJejFf75wskhD aEdu4agzAxPrOsR0IWFOt634Zjy3i9xOcCS/Psg0rrlrEcq9izWk71KmBDtovYY85qON nzLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Yo6mt08BzZh4ti0thGywzcIIeaF3bfv7zEpkxXs3RrI=; fh=BhxrabRPvRx4t4C6qHGZErcE6aA/lNMwJxc7ZEtCvRo=; b=CVZLf/Wx24reXKX0Kogl9kMI1j9QmQyDnCcpP3QJAg87YEDnA2NiT6Z58y0/0kHX2E u92XFNKfKELgvd5RWDQ/LuqbaRZTnwWL9Q+GwmGmuDt2E8yl8xILRho98aCJ7+/wyNZL xWgzEnJcBxmsdSFUiylH/7cQmJtJoZUMv5LnaFV4A+Y9SKsD8rekxPTAVCsVlY8taOoW MYFduJFpVMXfn2XnvjaoxnUnyR27tz0AjIp7B8eEHzYGwvcz4OdzwHsN06bDRTcNkKMJ 82x5KWIvH+UtVfyWM0K+b74yWEgLQa6mRmGm72z6USlO3V7Nbh6KOa1SXLprYyq2RCUN H30Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fIWeuz6n; 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-48851-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48851-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCVKmC39bNfVKdiv/u2oEuI3gvFKTdQRo4igjd4HMAWkenzvcnObwiqcUGQ9fN04+X0ESX8souLp0ESOBPlcPZtqcJtW1A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c17-20020aa7c991000000b0055f4535a8adsi157526edt.534.2024.02.01.13.08.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 13:08:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48851-ouuuleilei=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=fIWeuz6n; 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-48851-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48851-ouuuleilei=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 499C81F262F3 for ; Thu, 1 Feb 2024 21:08:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 837B04655F; Thu, 1 Feb 2024 21:06:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="fIWeuz6n" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 300D83D0A3; Thu, 1 Feb 2024 21:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706821562; cv=none; b=VZeG3eEWXGkihkXQ9cG0Zbmvwoo9iEHRnvHx1jmWZoxEWI5MHkPq0cnKj64SYBDAe2KKshsrMCoL5qVPGcjpI7squrK3liugWPHlahhu7SLXYImpaorClAoQRazfhfj7Gh+NFDs3I3Ud/Ov6U6g0SXKWnvyXyg1+WD0oIzv1P+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706821562; c=relaxed/simple; bh=RHKHArtBtKB1VCRmAOVuF7WnYk38bEAed/hFJbNEY0U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Oc2LaxxiEWimR3Uj3SW9NUwGWV1jzvU8my5uvTV/lGtgX09YBzcGNZrpGGtbyLo3gn0hp/oy7NVuAQHMhEXVtp6cggcwfebRUfiaHsMmNaLmKgPcE6GbrDeDpkdPLMhj398VXHTKGfR15jvEkZF03+R6A4s63UrJCtAP2RVjUus= 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=fIWeuz6n; arc=none smtp.client-ip=205.220.180.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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 411D1OZU018819; Thu, 1 Feb 2024 21:05: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=Yo6mt08BzZh4ti0thGyw zcIIeaF3bfv7zEpkxXs3RrI=; b=fIWeuz6nvUleWO/vtagNtlHB/6W5uZ2+ii3y xfJAyZJLdtwRW8HTwDcRMzC6Yn/Sz5OhHMS26owfUI6ACb5DPuF7wVc+4wxSIwEX BjfDw0OrISUg0w0WotgPqIWc93lmbFcsozWYlP/+ZxrZcUR9HgDJmwVqyP+hFtqH gfFRtighxvPKStY62klTc3U6We080i4jsG3vKnbXm3LDj7LMCy23/lAqwZg7JPlG rNYle0TDIQBrfxJw+Yk7bXO3wTWWQ/iJtm8u5Q1bNJDm0WAhXpHxQ+4CLKHfXJmr bD2ZaaTmsn5XuBJJXXhoWpjt8lypSq+5H+ZO1QfKXyL4ktXD9Q== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w0619j7k7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Feb 2024 21:05:43 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 411L5gng009684 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 1 Feb 2024 21:05: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.40; Thu, 1 Feb 2024 13:05:41 -0800 From: Georgi Djakov To: , , , , , , CC: , , , , , , , , , , , Subject: [PATCH v4 05/10] iommu/arm-smmu: Allow using a threaded handler for context interrupts Date: Thu, 1 Feb 2024 13:05:24 -0800 Message-ID: <20240201210529.7728-6-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240201210529.7728-1-quic_c_gdjako@quicinc.com> References: <20240201210529.7728-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 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: L28F24bAlHBffxt0T1HZ1guh94Zd1kAJ X-Proofpoint-ORIG-GUID: L28F24bAlHBffxt0T1HZ1guh94Zd1kAJ 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-01_06,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 phishscore=0 impostorscore=0 bulkscore=0 mlxlogscore=987 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2402010163 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789732264582226711 X-GMAIL-MSGID: 1789732264582226711 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 68b6bc5e7c71..978ef8ab042c 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 17f704920190..54cb9dfcec76 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);