Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4175379pxb; Tue, 25 Jan 2022 05:10:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyW8Bl/QJr8nDR02MbldIk5grMFLwWqBhqpDnNrLbW0IHc474wxumKGsNr8kMUnVKLuYnYc X-Received: by 2002:a05:6402:190d:: with SMTP id e13mr10487063edz.6.1643116208848; Tue, 25 Jan 2022 05:10:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643116208; cv=none; d=google.com; s=arc-20160816; b=p9G1qWEExqpBaLSZDd2YE74N0G2QzX3rhOa0+27MDm0HACI6y0I9g/3UU80QWLE2Ll H3ylE7ciJB2RyfhDj4vZrwQtL3eVGWewbU7Q9T+hM0+ugsumPBRhW+yPMKGii8Ud4OAF HqtVmTX+5/LRuP+i7ErAwa1yDC22hNfsuGYeDg7htWrIEDbhkzpFaeTFqmzVXL2rYWey foa/zO2Zp9jPjrHN9EpYudXEDldJ0i7MDCbtSkNSTBT0A1P4iUM+75D9p7XO5fKGxfWk EfAZBvGFeWbYvJBTVeZyHLqOxhq2G3mz/2+gv6tj8v6+DmLPLPES+8EN2LmG4A6Z9fiF e9xA== 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=op/hP5mgdCqwSxFFmTpbH2gkkxIxy9nmAyZGpEJwgjk=; b=N7nSOYmPk4jF03rYu+OMO4DKHwkYEdpxpjAUSBc88MWjkDr5EFLjBnEcE5rAqPrbTi VY5d8w5bIcSrYuTirNhV9c890YMZe2d0Yc14FU7T0gAhfjDktef71mtEraBRWZaovg+S jBmEoua0P+XR/DN+uCTf7eFWyufGkPC6VhUfK8VI7vrz9HNMiZGESUTI61MUx3rfo5+7 a9DWii3hs4htLOWtkRLYBJ8sD/6Rqt00wBUhcmmTfT/H7pG9v2W4HqCfcg0drcAmBvnh n1ULVpn10SG8g9zY3vqULjVXxbclK2ctunDbrRmFJk4FNohagJYe1GNAYTMwAfwCdegl AfGQ== 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 h20si3740439ede.184.2022.01.25.05.09.42; Tue, 25 Jan 2022 05:10:08 -0800 (PST) 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 S1456739AbiAYJMf (ORCPT + 99 others); Tue, 25 Jan 2022 04:12:35 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:36166 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1454424AbiAYI73 (ORCPT ); Tue, 25 Jan 2022 03:59:29 -0500 X-UUID: a85e81f47b9540669ab6b002372274ae-20220125 X-UUID: a85e81f47b9540669ab6b002372274ae-20220125 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1885687726; Tue, 25 Jan 2022 16:58:53 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Tue, 25 Jan 2022 16:58:52 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 Jan 2022 16:58:50 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , "Matthias Brugger" , Will Deacon CC: Robin Murphy , Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , , "AngeloGioacchino Del Regno" , , , , Subject: [PATCH v4 14/35] iommu/mediatek: Always enable output PA over 32bits in isr Date: Tue, 25 Jan 2022 16:56:13 +0800 Message-ID: <20220125085634.17972-15-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220125085634.17972-1-yong.wu@mediatek.com> References: <20220125085634.17972-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 Reviewed-by: AngeloGioacchino Del Regno --- 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 028b2192c414..548fa8448a6e 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -283,11 +283,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