Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp502416pxb; Thu, 23 Sep 2021 05:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweiW8CvskgLI2SmN02exaz06WBvM5n2vcTVqv1PxDtlTKcZyoBlQrVC/sQR4IMO2ynB++B X-Received: by 2002:aa7:cf93:: with SMTP id z19mr4994253edx.202.1632398651255; Thu, 23 Sep 2021 05:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632398651; cv=none; d=google.com; s=arc-20160816; b=XqQcPivucX6AhBzgk+hI6a7+N96HcoYDPnrublHppx3Ayxcl3zNe3BoRKNiSJd7VZR ZGBzNMY9JlfY8MyeaOI81TyfydQ4X1MmBhwKYhpyv8TJw840IPPs28JktilfqusM+U6x LHB6BiVCRf3lMLdHVqjOs86wyjlPlpD442GryWVpCvHnQteaDx7yOBGr8YrRVVz9/ZLX Y5fWtkWNn57LMxRcXbICAwsM6LoOaoUd1LgkK/5mX7dybT6ubQOWyc70KsQJNQjVixKK g0eacYXPu5OALQ5NuBWmVNnAErirHHC+usgbF71uGdd+CW21ecYE3zDXi16o3LPecj5z JM6Q== 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=ztHU6FBxRhNspacm2MpsKQRC5dX7ggCDMF21tVAajSc=; b=W1dch5dJxdr8meQnxhLfsLGjZ6G0h70q4tmWspTLztuathJWC4Z4BAJ42HFBMj3L/h RUQLF4zpjupZxappgjv578SovO/pZzARs7WBW9FrEFtbFDyTGe/QznhwSJKAhmVHbJR5 MDit36oE8VwP9AhWX6OtBOhJ9PNappbqyjjQ49uXHcVuUaTYpAMsYuRohLfYyEp8v63P CDiLtKy0jEU9gObEik1RYXn0u6qYyYA6/GgfwoimNqDjIC1GU3+TKg5KXS7oIUhRVlO/ MVerKKQi8Vxk5rLikyqKePZJOjW/QydAQ7DgeJTZbN5CZ8Kx1YzmmyDe6q1G5DHxRE5T GJmQ== 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 gv43si5750138ejc.88.2021.09.23.05.03.39; Thu, 23 Sep 2021 05:04:11 -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 S240858AbhIWMDC (ORCPT + 99 others); Thu, 23 Sep 2021 08:03:02 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:51864 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S240818AbhIWMCy (ORCPT ); Thu, 23 Sep 2021 08:02:54 -0400 X-UUID: 375af7b77c404858b6453caae60fd09c-20210923 X-UUID: 375af7b77c404858b6453caae60fd09c-20210923 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 3760164; Thu, 23 Sep 2021 20:01:21 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Sep 2021 20:01:19 +0800 Received: from localhost.localdomain (10.17.3.154) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Sep 2021 20:01:19 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , Subject: [PATCH v3 14/33] iommu/mediatek: Always enable output PA over 32bits in isr Date: Thu, 23 Sep 2021 19:58:21 +0800 Message-ID: <20210923115840.17813-15-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210923115840.17813-1-yong.wu@mediatek.com> References: <20210923115840.17813-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 4a33b6c6b1db..ef98f19ce86e 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -289,11 +289,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