Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp185140rdb; Mon, 22 Jan 2024 00:16:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcWubSX85xlV+7lVzrlr3/HFRaXvOXOd4yAaLOkaPwcpy157qDJRFEWdGVsQ0JgZ5AXMYZ X-Received: by 2002:ac2:4947:0:b0:50e:8e98:c25c with SMTP id o7-20020ac24947000000b0050e8e98c25cmr1361015lfi.70.1705911382572; Mon, 22 Jan 2024 00:16:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705911382; cv=pass; d=google.com; s=arc-20160816; b=ad/2KwO/OwYty1/ZKyYdW61O8cZ6GI0BUODC9tjXaRRtieV1Rnq72xyfz424jj+DqO auUD7vhn5IoBs1jwspeBgSjssSARYhJKbRHgcqhLs+OzB1kpPxdLUw079hnqjrG0nS5t 2jFhp8yQubAkaTdh2KBrCxfS88aMl0nE2w3Rkl7KfHG7nxYi5/5bC7BsjiGDTLgCweCx oEGgZHX0gJvTgWeFe8fDuuhEY8zJh1xoUc2ntOMb5VmqobfnxDx0kMeTWvx30yDehaw0 K497587T+bOaCFR0Pb+CZSWBCor/BPrYR2jTPD3zpL5qLUPgQjST+TWVxUPP0UViIwVE O+/w== 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=0puWr8qDwzaogZbtOaymnvHkPoKpvOitlnMkTa2cyaw=; b=viZubtbJrwzjiIAXgaI2cnVwQxweLQUgzNsIXqY6b14e8uob+tTyl+VLjMmESPQiRn KoePvrxFCLMROr/2LZP1gYjR9ggj0jscn9kHWmwKQn+59Y3hrN2U3n5A4vMGtYHlnN51 pbQUVgriDYhAOVAHJnQQgtaDb/Sr+BuWsK4LXRFPerDC29BFFfQTqE8BYBwTpAbh9hXf rtDpM1nZOX2VfsXUESJStgrp0Ujzn3dgQoJP9fUllGypFTvrStYstICDcsOgtVbnDo1s aKTded25HLItDUBAsrXgbEbPzBzNV/QS8cvXrzGAYccGxZ9PcgKsVJ0+d9W2Kp4m4XOW 6/+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SZHT2XNK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-32346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32346-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id oq10-20020a170906cc8a00b00a2d5d42cb77si5922201ejb.276.2024.01.22.00.16.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 00:16:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32346-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=@intel.com header.s=Intel header.b=SZHT2XNK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-32346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32346-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id E3FC31F23B50 for ; Mon, 22 Jan 2024 05:49:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE8E1E545; Mon, 22 Jan 2024 05:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SZHT2XNK" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) (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 BEF76CA66; Mon, 22 Jan 2024 05:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705902523; cv=none; b=NImPBvwis7ITB4tUfbPnAWY7zDptFaW0A9KfItDqUo4ceGEOhl9YJ6vhY8TF7PFf8VkExAxR0yyH7qvK/2hJzcbSQ8STn4IZmSvFhxQfPDkJ1LBEcwhiDHmUf+Kvn870TlE8hWQeabzE5rs2ZFyrfO6qnNO2FBcq7c0JcbxZYcs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705902523; c=relaxed/simple; bh=bQjTjgCLfYsPH5p+7Al5Zy19r6O5Dl9UPL8NgLDT+B4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aRZKDCHW8dBPkWr2AxUvrmm1TrNwd6PdogNs0IvakSf8Y5oPA/op3ZvqA+6mqxxs6xZSWiVhMgK/MpNx69vV3Hhh68Gpc/ETvsaRIxmaUEv8uoRZ655Gl+u3udsOmMWPNeZW4dxXMGyNKOzZxD8I9aJX0GhcENRs+NsP5TU6OcQ= 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=SZHT2XNK; arc=none smtp.client-ip=134.134.136.100 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=1705902521; x=1737438521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bQjTjgCLfYsPH5p+7Al5Zy19r6O5Dl9UPL8NgLDT+B4=; b=SZHT2XNKPPD5yqMMDmzi8LY5JC645lTluN6Lu8yHaJ5r0cgg2FZS7hHo 7t1hA62t7tqfNfHlqUrxhA+/HjD+HDNI5g578+cL/uXK4ohsb563OICXb G5oRvURFJkVTeNXR/2/4hDqVKBOhwTRx759aDhLL2IDga3+DaZu9IIQTg izMsBoUi7n3DdKHVlswFtPUpkiWmObTR1pVc5fzbArtYnl1XRbvrjWvWS 3IeLwbgEphEZ39x3B6V2uAFa+hgh//41pW5cB4XukWtfJS2COsbMa138T GR4CYIZnIaGzqaqyZBNtxelpOf6fNrx3+bOR4Ke8FiadKVCqjkwOelSpa w==; X-IronPort-AV: E=McAfee;i="6600,9927,10960"; a="467487048" X-IronPort-AV: E=Sophos;i="6.05,211,1701158400"; d="scan'208";a="467487048" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2024 21:48:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10960"; a="1116763869" X-IronPort-AV: E=Sophos;i="6.05,211,1701158400"; d="scan'208";a="1116763869" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 21 Jan 2024 21:48:37 -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 , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu , Jason Gunthorpe Subject: [PATCH v10 02/16] iommu/arm-smmu-v3: Remove unrecoverable faults reporting Date: Mon, 22 Jan 2024 13:42:54 +0800 Message-Id: <20240122054308.23901-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122054308.23901-1-baolu.lu@linux.intel.com> References: <20240122054308.23901-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 Content-Transfer-Encoding: 8bit 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); -- 2.34.1