Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2007885rwb; Thu, 27 Jul 2023 00:05:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlHCmDxt7gHv0CkNblkkrq6v8WNQIFo2nO/E1kFJWWSE/9MgcQ1mF2Kw3H8cQfYaB581Guew X-Received: by 2002:a17:906:3053:b0:993:a379:6158 with SMTP id d19-20020a170906305300b00993a3796158mr1203792ejd.17.1690441501709; Thu, 27 Jul 2023 00:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690441501; cv=none; d=google.com; s=arc-20160816; b=ct8leC//VN7iVbFHUDP9Y1BREFlJsmkQ9iF3hEuF9OVcFd+nLkBKMa9jepcSCYLI0u 3dpAQRB04ifPIl8fOysGjQ19ew3T4JEc7oxUb2Ywm4RRTveVIa9Rwa59h/Ub/blkYWgo 49W5Pc4vKn0tHoE57t3s89v/kxthzM4/vOX39y1w4TMFy+eFGH2YxH2PwIRTxffwVupo AucyWBlfu3wFmoxBPT22T0S2uEJr2dtxAT9Hr+ecWTwerLTmVEpFDm7kGg0pNMAu6xOD cU11pTfn/y/q2Bz0VV32UbHujPjLSsDDGsn/OkQ2sxJqkp9HR6vYA+r5J6XyZnbG6Txo DzSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l5hVkA6E+kFNstkcIUFxtYccU5sQKLqIBV8tD6/6Ar0=; fh=5v0QJkujOnxKSzhmeWiMX/0q9X35NwMz+SRMkKa4moc=; b=SBtYJNxbb7UD+10qoP0byndp48mMr6XCgdTke2dofaxzMLgYk8EKF+nKzRX0ZOcJN5 HleRoCZDVHzuFuyqIlR0NTsESmFJWD5hkHRFDs6wQ2iPU8jULNC5bHEYwm48XRXiqazn F6AbttbgzLNZ7G7R+K7O4DCZYN/n0IMJx7F64L/Mq9r1/unUa19tfi85Usuym9rRRwth Y7fx5ry7ybdMdeHGWO4Tdzwl/OM45m4RJjxM70ZnT/W3tL5P2+JePUwsPeM+2bwzHydp zNrFNDq/HJhmMWbUyWAV2+13pu2aDe3p4C9kMAhCGjkZZ2N6lEdq/Jk4TBUMSZKbtlOp UKfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Mt46eQj3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx23-20020a170906ca5700b0098e4aef078esi541840ejb.778.2023.07.27.00.04.37; Thu, 27 Jul 2023 00:05:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Mt46eQj3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbjG0Fvg (ORCPT + 99 others); Thu, 27 Jul 2023 01:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbjG0Fv2 (ORCPT ); Thu, 27 Jul 2023 01:51:28 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B329392; Wed, 26 Jul 2023 22:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690437057; x=1721973057; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qEkLeytCBh+ls2SZHvBlTsXTq4GnHP0G53aREH/RDNA=; b=Mt46eQj3XWFok0+oegywbK/uKKjVbPgQ/8HnHHUsUuO16EQCUn10YRhN AtyRjk7panpMFC/1BBqhOAEWGN85eVrV2/tW+EAmLbvkxFTIbg1M7yeMT zF9kFL2pmmwuNqr6e4aasE0Iu+f4Cax1mohBWQ5B0wyBGrsS877LWJ0I0 WINRhgBzaHf2NmuN8ViUX33SHNNmNjLXEA1hUcFJFD0TXl1bGl+zyWkKU LliyQjeFsuToLDlQhxgwr3c9S0sIlMrpQYuMTHFyRJbupw3JtJLZra3Qp xJOl6roiUywvZ80SdFBYSG5gruIltNve/SdHcMNdP23SAMsYO5DReHdmz Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="399152494" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="399152494" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 22:50:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="840585264" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="840585264" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga002.fm.intel.com with ESMTP; 26 Jul 2023 22:50:53 -0700 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen Cc: Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 02/12] iommu/arm-smmu-v3: Remove unrecoverable faults reporting Date: Thu, 27 Jul 2023 13:48:27 +0800 Message-Id: <20230727054837.147050-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230727054837.147050-1-baolu.lu@linux.intel.com> References: <20230727054837.147050-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No device driver registers fault handler to handle the reported unrecoveraable faults. Remove it to avoid dead code. Signed-off-by: Lu Baolu --- 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 9b0dc3505601..1a43f904b6b8 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1469,7 +1469,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; @@ -1479,16 +1478,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; @@ -1498,6 +1490,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 @@ -1509,32 +1504,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