Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp528257pxb; Thu, 12 Aug 2021 23:57:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZINrWlakb+G4mscZP8DfdPKhdHoPXiAJVrB9jkZlppCScltJ5W08QFpp9nMPTDX1leNEO X-Received: by 2002:a02:866b:: with SMTP id e98mr927263jai.48.1628837840284; Thu, 12 Aug 2021 23:57:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628837840; cv=none; d=google.com; s=arc-20160816; b=N5mAfSYyJaY6Vc4XFa7kmZw+a+AAJYx3jAg2yZ9t4iF3FxD+T32nJDerMTDtWNZBha XbY7AqIzI/HA9d7+4pCUmv+e7leg7EuwkCPcYr3n5Qq67pSeGo26nAdiIhovr4wyuZQ4 8+bF+YSRmoECuLo2XXddZjgnqXlFv+zbNKD6PvptnhhLmLbtWHgunOyGkyDTL5LkSggd A0LKinyTPKR1IBdMGKoHo4wK2Edhfl5dwnNT5oE8Cj0eKm9naKFbZQobfmZ0CTT5fT5/ oCyx/J0gvjsowuq6OPYI0LvmDPJaDv18zxFV8XXOkbfF/7A9mwBVazRSGE8XwX2XWwMt 7UnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=YhAAPL2sM/bN1FwmkRtjcxsFew7r7Y1UOWsPTs+/hHE=; b=Os6miGJDqqcrA8mIq1bM64pC7z3nezZHieADQllbo0Rc9iy5ZtzfmY2V0En4aPi/fQ w/2CRfflphbYh12vTN0ZGArW/ZdUqA1Mk3UOwG4KjFYRqC7qXCx6/MULO6H5hdordpxg z2yJQoZ13yHU5RnkK4XCvJ9XkHqUgmkSdOH61QoUvdgujEM/4PI42PPkUQDO1Y/rUpKL 6UReOsePxVO6vD0Sgh8ZLnnBxUCc+8NpCbDNe4yYQTauPSfV7KcUPgCWFf8Sy6h7CnBA j01nKGzjCO9/NQa+yeQZzK52qQCqKumO0kFkVi9bLLDvDvJ9kl1GBqb8DQUe9pT64HNz 6/LA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si726330ilm.23.2021.08.12.23.57.09; Thu, 12 Aug 2021 23:57:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239050AbhHMGzv (ORCPT + 99 others); Fri, 13 Aug 2021 02:55:51 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:60568 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238248AbhHMGzu (ORCPT ); Fri, 13 Aug 2021 02:55:50 -0400 X-UUID: 2a117821365d45e4ab29a4fe1e2624f8-20210813 X-UUID: 2a117821365d45e4ab29a4fe1e2624f8-20210813 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1983747755; Fri, 13 Aug 2021 14:55:20 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Aug 2021 14:55:19 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 14:55:18 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v2 12/29] iommu/mediatek: Always enable output PA over 32bits in isr Date: Fri, 13 Aug 2021 14:53:07 +0800 Message-ID: <20210813065324.29220-13-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210813065324.29220-1-yong.wu@mediatek.com> References: <20210813065324.29220-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the output PA[32:33] is contained by the flag IOVA_34. This is not right. the iova_34 has no relation with pa[32:33], the 32bits iova still could map to pa[32:33]. Move it out from the flag. No need fix tag since currently only mt8192 use the calulation and it always has this IOVA_34 flag. Prepare for the IOMMU that still use IOVA 32bits but its dram size may be over 4GB. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index abc721a1da21..a831e56a90eb 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -297,11 +297,11 @@ static irqreturn_t mtk_iommu_isr(int irq, void *dev_id) write = fault_iova & F_MMU_FAULT_VA_WRITE_BIT; if (MTK_IOMMU_HAS_FLAG(data->plat_data, IOVA_34_EN)) { va34_32 = FIELD_GET(F_MMU_INVAL_VA_34_32_MASK, fault_iova); - pa34_32 = FIELD_GET(F_MMU_INVAL_PA_34_32_MASK, fault_iova); fault_iova = fault_iova & F_MMU_INVAL_VA_31_12_MASK; fault_iova |= (u64)va34_32 << 32; - fault_pa |= (u64)pa34_32 << 32; } + pa34_32 = FIELD_GET(F_MMU_INVAL_PA_34_32_MASK, fault_iova); + fault_pa |= (u64)pa34_32 << 32; fault_port = F_MMU_INT_ID_PORT_ID(regval); if (MTK_IOMMU_HAS_FLAG(data->plat_data, HAS_SUB_COMM)) { -- 2.18.0