From patchwork Mon Feb 12 01:22:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 199591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2258461dyd; Sun, 11 Feb 2024 22:15:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+bxGuZzY7QlKIXvhDkVaNdhnRcnYCFDNDG3tJdnmc5wrKQrNnHHvcfE2qs6XtfCDlpTDf X-Received: by 2002:ad4:4c52:0:b0:68c:8bbc:12f3 with SMTP id cs18-20020ad44c52000000b0068c8bbc12f3mr11790717qvb.9.1707718531875; Sun, 11 Feb 2024 22:15:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707718531; cv=pass; d=google.com; s=arc-20160816; b=QbCgLLXmpiXJqyJ9yLMFVZaIh1N24jHFts5t2RwjVEY9RtI4ZN7dJjdK4Jaw8HDnKg eHFDGklwaWtqdzkjURsMMdp9yX1cImzDm9dlW0uBzKuS2YhD29IelrTdGRYOB0sob1Vv Ob6FEIljGICHj4Pc6AAENKls9JF58ErpSOB5QlVzs/2Fn6hSYKd31Pkf2mcctqiwrD28 KVkGffRIPwu8OcoSxzUGwHlkzJYJOSKpDQSWrgKYhi2YacWA2m6/bFoVJ7Gx9ab1piDF KyjJCjTq+cFA5pJWuF9PwaZYYrm/IpiGw8oQQIfXAlVdCxs5+hjkJiBB49TUTEWrXtiz UInQ== 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=QNJiGRmbETZziGu+qLGwxL03Tk8ZoKF8/pd569x0cqA=; b=ZfIm37iknCHz+NY8X/Uvg0VhnBbXi1X25hw1fRxvNFvutvDLoTH1Z/E75Ej/TfrsD2 vcBjFxxdMFkqj9aTXdOnIjcISpYNSTFQhidAjDwiur1wjzEnG3YMEksNDWsZQUVzLUvE JijZ7tJJABc6MaVS3006ivVvdbHzgdkK+nbCor4huMsbtmhJ0dFlCXGyBoN/tKpMT9uD FBlHji59lObxml2DUZGdqIxqjJzZChkGjuyZrRTh9/Xu31pXHwuzSJam7RX3glJPZuyb qiZx4fR/iMgxeq1W0KPpMjhX9ygmVGRvxXGSZpi/mWenEG7elCCF5Z6wYC40RExyNAwk 4BSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VtMdP2fN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61042-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVL1IKiTrcKL5fvcaobeJgg8yv9fuyXKJeS2BCdeIZMheJLlsMO1jx74QIbyNvQp7zhz5uG2HCqiyc0/m8udiVSMjAvrQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d12-20020ac847cc000000b0042c7c29a554si1112181qtr.420.2024.02.11.22.15.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 22:15:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VtMdP2fN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61042-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E970C1C22113 for ; Mon, 12 Feb 2024 01:29:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCCAD847C; Mon, 12 Feb 2024 01:28:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VtMdP2fN" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 A333910FA; Mon, 12 Feb 2024 01:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707701305; cv=none; b=daOQsoyrgwpO7It0wMhY+8atPCaa+hbNWk0wguL0+PEpx5ytUOIiUwUQAeUfyu1nGUvRShVd0dW/EaxPflcx5Xxfe0Yc8frvkpQY/NN6MLNwA+BUJms6GueXsqzruo+Z+jegIPDTaVLeXUqZuJ2toB3a96mR0KZHcrO01WlHYDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707701305; c=relaxed/simple; bh=bQjTjgCLfYsPH5p+7Al5Zy19r6O5Dl9UPL8NgLDT+B4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sRQJI/bWx8hzZdKn9HO9Qc/aBrr07ocNiIAFajthy3x3xF4PxJUhjwWVx8T3wOMkdJoyMBkJfwhegzu7pdHKgIxoQCXD6qFfQjtOZuXs5xudN8ky6lpk61JYynKRoV5DFgL+sIRpYhEHIo3+1QybxSRSpdZrxncIaPrift+SKdE= 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=VtMdP2fN; arc=none smtp.client-ip=198.175.65.15 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=1707701304; x=1739237304; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bQjTjgCLfYsPH5p+7Al5Zy19r6O5Dl9UPL8NgLDT+B4=; b=VtMdP2fN81705zPs+rB+4QYqUfAOAxGcMXOuYuNvr4e7EYXmtrdNQsNp 8vKlXhNhVJKq/u7UciG1jakco2B2ndXcO5JDC3qFMf+lFWwrFtUpoBII+ I9TivpY1hv7z98/Sqrudq96VOtEV/9KuXibM0O9CVwTIIDqzbKbylfQbu FN7T88MxaG2WYjOALKGC/gY9VXbmstGazhsbrkgZEiCuB1MphhDfz2yPu Lz/e/gcRnXUylFia4kL+nf0A/MeiM19Y9ER0dqxIGB018ufgsai1UMhkH ZgJLIwhX7jeHaKs1dQVUwxREhUwybei1olDBGWTKn9y1/+3bKjaPrXdqN g==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="5502069" X-IronPort-AV: E=Sophos;i="6.05,261,1701158400"; d="scan'208";a="5502069" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2024 17:28:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,261,1701158400"; d="scan'208";a="7132147" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orviesa005.jf.intel.com with ESMTP; 11 Feb 2024 17:28:20 -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 v13 02/16] iommu/arm-smmu-v3: Remove unrecoverable faults reporting Date: Mon, 12 Feb 2024 09:22:13 +0800 Message-Id: <20240212012227.119381-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240212012227.119381-1-baolu.lu@linux.intel.com> References: <20240212012227.119381-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: 1790672667081825304 X-GMAIL-MSGID: 1790672667081825304 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);