From patchwork Wed Feb 7 01:33:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 197781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2058069dyb; Tue, 6 Feb 2024 23:24:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFXE6QHg3hlH/SUFzuRvFTy4e+BVQbtBLAOH70JyHVdHOru3/506DSoSqLhtQE1xukU35/ X-Received: by 2002:a05:6870:3323:b0:219:c919:a3c with SMTP id x35-20020a056870332300b00219c9190a3cmr1795689oae.51.1707290677201; Tue, 06 Feb 2024 23:24:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707290677; cv=pass; d=google.com; s=arc-20160816; b=hSpb9uGlrvfiqoiAilzJi1jeGdS2YZ78WELduX2nBLknqknNsV4ZFqTvWnE472N3ci gBv5kOJJtLAUdwuIGDcY2ueN54nh85ZHLI5aXcoajY3OEGGYreWF2jtaObc36HcKPxVk RgzA7FY6GhXAX6//qUQwMSBEqXm1ixnoWYs8VvfJ77Nh2dHEP1BHX5JYdT5CD9EfJh2I g7ut04u8Aaa8vn/gAjQHO5bmB7lqQp7b8KxjGCOHI8fUyX+9gGfCxiPPT556rfQ89LeC +K0X38vyBD+mKxZwljgq/wa91R7CrMmjrYQtKPyoFwLIPaSd5fkUYVonX9MC/MER1zyM EXLA== 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=DRzNf2h2qIM9/niJ5pFyIO/r07OJqBum/ymEEJkM55A=; fh=9StMGWPL8IdzLyT3aLVbBv6pg7VLxJOWnMmVo96dA8A=; b=v4glWLjZQftbMkICaAuT7SbG5Cl1hebyJeobiQVKYB7HFTSLYAdJUEJIvlvxeKQIxW YMWHCSqdrWRIrNbRNw+HJaEQ5iF6JwFJ6Txv4/nyqIxZ46/4oiNjM1lKVC+YvFWvK2jA vrZHDD4Ahs4pCeQUVfzvsN1jAzX27UsE4k7wy/XsiWmut/xspOix1lDtvT0p1rCVfTZC iB1qoGj3twUKiftDyg5xi+RVVUKnjXPPxTzUYQCkbbNxsqj8oIV5T7NmHoaEvbwg0g/6 ezPGmtrSRJODfNch17I4TZLkvIIpGO12jZ9qH9rmuWCyAV8IW+0nIejCuEmDnvotXdKw FHvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="k/wbroWT"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-55804-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55804-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCX8ZWRUVea6AJmwUJvlAy9L4/lc6Zj0bvbEZ2zcldUwydo/Ex3DMA9SmW0ov4Of6BRJbm9Eeoygo0n6mdvm0DZw3QsQ2A== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q20-20020a656a94000000b005d8bb95ce75si871307pgu.197.2024.02.06.23.24.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 23:24:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55804-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="k/wbroWT"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-55804-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55804-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 14B2AB233E7 for ; Wed, 7 Feb 2024 01:40:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 946CC10940; Wed, 7 Feb 2024 01:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k/wbroWT" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 37F661094E; Wed, 7 Feb 2024 01:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707269965; cv=none; b=PkTw69m4PyzoHcFsEHgn0ncDewk6BiN4KhZgP+j0fPl3OVqA9/4QM/w6bQewnz74Ap0jkztHkYEimB/t3fArqq0h4sUIEa+XZxBqcVeuc3r4HRlqAsHPy7pq9/mRLmd8mZIWYC9TeOZJkNJQ5M7NpM+Y1X+SE7vbrPgOSBmT8l8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707269965; c=relaxed/simple; bh=bQjTjgCLfYsPH5p+7Al5Zy19r6O5Dl9UPL8NgLDT+B4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UWcIGD/dupFmYgKpx3h6dZCRzbKnvGDlwU+0xThKLypXhAXg8dxaGQXHcTdkUbb1IMuWOSYQavVlLZRq1f3ODKrbultT00oEXg5vmY+/IoBvKe+vGYbSFFn20mvfm3wD3ZYJKIF8IIPtVDULSA5wlWcEFGKxNuNDofXpYe+8nbA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=k/wbroWT; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707269962; x=1738805962; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bQjTjgCLfYsPH5p+7Al5Zy19r6O5Dl9UPL8NgLDT+B4=; b=k/wbroWTYdx5G8IYcrIs4DYH/jZde7R2usYeuXYOww3UOjxMhlLamBUz bmnZ3/8Yz75sCw19QrdNnB0Hxb0TGhDs9GtbrDlfo8RhXzA7oEtfMtJru pUm+Mtuh6lKSTU8DRh1ZVsQxRx5cvrcyYwXbSo2Sc3nXoSu00aie+82I7 n+f1ohzMsI0USrUzynRl+06qmAXbQ7Sg7eQrsoYk9NTZdYMPAhGCWH/hq c87I4I4HrKgHbIMgMMuCPsZVUuCjU8YE7aaCTu8VzIcBOuYmSAMP7kzJe H3cn/c8cUA2veAQROCs8TkFhlIrdTrPsgUppU6rlZhKFUbSNNfIjqoYuL w==; X-IronPort-AV: E=McAfee;i="6600,9927,10976"; a="11533988" X-IronPort-AV: E=Sophos;i="6.05,248,1701158400"; d="scan'208";a="11533988" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2024 17:39:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,248,1701158400"; d="scan'208";a="1190574" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmviesa010.fm.intel.com with ESMTP; 06 Feb 2024 17:39:13 -0800 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen Cc: Yi Liu , Jacob Pan , Longfang Liu , Yan Zhao , Joel Granados , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu , Jason Gunthorpe Subject: [PATCH v12 02/16] iommu/arm-smmu-v3: Remove unrecoverable faults reporting Date: Wed, 7 Feb 2024 09:33:11 +0800 Message-Id: <20240207013325.95182-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207013325.95182-1-baolu.lu@linux.intel.com> References: <20240207013325.95182-1-baolu.lu@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790224028953864939 X-GMAIL-MSGID: 1790224028953864939 No device driver registers fault handler to handle the reported unrecoveraable faults. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian Reviewed-by: Jason Gunthorpe Tested-by: Longfang Liu --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 46 ++++++--------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 0ffb1cf17e0b..4cf1054ed321 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1461,7 +1461,6 @@ arm_smmu_find_master(struct arm_smmu_device *smmu, u32 sid) static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) { int ret; - u32 reason; u32 perm = 0; struct arm_smmu_master *master; bool ssid_valid = evt[0] & EVTQ_0_SSV; @@ -1471,16 +1470,9 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) switch (FIELD_GET(EVTQ_0_ID, evt[0])) { case EVT_ID_TRANSLATION_FAULT: - reason = IOMMU_FAULT_REASON_PTE_FETCH; - break; case EVT_ID_ADDR_SIZE_FAULT: - reason = IOMMU_FAULT_REASON_OOR_ADDRESS; - break; case EVT_ID_ACCESS_FAULT: - reason = IOMMU_FAULT_REASON_ACCESS; - break; case EVT_ID_PERMISSION_FAULT: - reason = IOMMU_FAULT_REASON_PERMISSION; break; default: return -EOPNOTSUPP; @@ -1490,6 +1482,9 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) if (evt[1] & EVTQ_1_S2) return -EFAULT; + if (!(evt[1] & EVTQ_1_STALL)) + return -EOPNOTSUPP; + if (evt[1] & EVTQ_1_RnW) perm |= IOMMU_FAULT_PERM_READ; else @@ -1501,32 +1496,17 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) if (evt[1] & EVTQ_1_PnU) perm |= IOMMU_FAULT_PERM_PRIV; - if (evt[1] & EVTQ_1_STALL) { - flt->type = IOMMU_FAULT_PAGE_REQ; - flt->prm = (struct iommu_fault_page_request) { - .flags = IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE, - .grpid = FIELD_GET(EVTQ_1_STAG, evt[1]), - .perm = perm, - .addr = FIELD_GET(EVTQ_2_ADDR, evt[2]), - }; + flt->type = IOMMU_FAULT_PAGE_REQ; + flt->prm = (struct iommu_fault_page_request) { + .flags = IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE, + .grpid = FIELD_GET(EVTQ_1_STAG, evt[1]), + .perm = perm, + .addr = FIELD_GET(EVTQ_2_ADDR, evt[2]), + }; - if (ssid_valid) { - flt->prm.flags |= IOMMU_FAULT_PAGE_REQUEST_PASID_VALID; - flt->prm.pasid = FIELD_GET(EVTQ_0_SSID, evt[0]); - } - } else { - flt->type = IOMMU_FAULT_DMA_UNRECOV; - flt->event = (struct iommu_fault_unrecoverable) { - .reason = reason, - .flags = IOMMU_FAULT_UNRECOV_ADDR_VALID, - .perm = perm, - .addr = FIELD_GET(EVTQ_2_ADDR, evt[2]), - }; - - if (ssid_valid) { - flt->event.flags |= IOMMU_FAULT_UNRECOV_PASID_VALID; - flt->event.pasid = FIELD_GET(EVTQ_0_SSID, evt[0]); - } + if (ssid_valid) { + flt->prm.flags |= IOMMU_FAULT_PAGE_REQUEST_PASID_VALID; + flt->prm.pasid = FIELD_GET(EVTQ_0_SSID, evt[0]); } mutex_lock(&smmu->streams_mutex);