Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp78653imu; Wed, 2 Jan 2019 02:41:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN56dLFoNcS0TZrqry2brVQaPeFRLwu5AIjxYxj/sj4wCrXVKabUrJj3LJk2OsR8Lq+ZWs5f X-Received: by 2002:a65:5a4c:: with SMTP id z12mr13090925pgs.188.1546425701631; Wed, 02 Jan 2019 02:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546425701; cv=none; d=google.com; s=arc-20160816; b=GaSvzJrsbKkht48EwnVFReguEDI1Yjreb3zHLU+UJsB4H3s6DNR70K4c8HLJO3bv41 BM4RL6QkMT4hjOH0EfA2KM8ckx8WAHtLC9p3ALOshJxdqsM91b6tZKErSLz1LOj+vL44 FoEJ1cFZ4Vl3QCGiWnvH7zNSWPfv4/rXnE3AakDxPHGV5lXKQMFgJFIZX3cdVSPO5lGF GoVpYSID5g3d1XcTF12OgZs/izJ4LbNbuRGHfWAuMud9UEqqlkGjqMEgRkWt76hMvVQP EYER3GkANCeSt3HfterdBvuZXM1LcCMWFsJIvS9B5peL85xPtAwa3YutjYSeld3Sza1m Y7lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=fnZJkltmh7WNlf5M6YvCEpvrwtksMzbtbcfc5RJB+Ds=; b=x+qe2wSgoUjjppXPklKBIVxXMzmzwUMgzrduu1wFwOcl3nBEN7xBc4TiTyk9c5rRW2 AqhGhP0rl3+mtyxAaSPLhEsGX1G/HcPrJ9RNAGfJ9SmW2RUoKTV5i6ryzlAQnvqhDmht iDslop9ycmZ/3aIHLIXMjirqzx1CY/dXZLzTgGbFfp1HF2MmTkviAy9ZX/Cqhi/uFZPd SrR6VO57Pgtf18Nqo9Fjv3k1Bi67xvQfrajIQDFdkRXgzjJr1tiVmZpNbNdAuBq25n4A RJGNQ3fWBlRAfigaJOtKJMPXao/gm7vpWHg5ULMHV+18uw6ME/kBJrp974sp2DiXPSlo 0Wew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si9568646plr.355.2019.01.02.02.41.21; Wed, 02 Jan 2019 02:41:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729112AbfABJcI (ORCPT + 99 others); Wed, 2 Jan 2019 04:32:08 -0500 Received: from mailgw02.mediatek.com ([1.203.163.81]:13035 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726782AbfABJcI (ORCPT ); Wed, 2 Jan 2019 04:32:08 -0500 X-UUID: 6bb6328efc2e4d2da87376707b0603b3-20190102 X-UUID: 6bb6328efc2e4d2da87376707b0603b3-20190102 Received: from mtkcas32.mediatek.inc [(172.27.4.250)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1232002991; Wed, 02 Jan 2019 17:32:03 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 2 Jan 2019 17:31:53 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 2 Jan 2019 17:31:53 +0800 Message-ID: <1546421513.32203.12.camel@mhfsdcap03> Subject: Re: [PATCH v5 18/20] iommu/mediatek: Fix VLD_PA_RANGE register backup when suspend From: Yong Wu To: Nicolas Boichat CC: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring , Tomasz Figa , Will Deacon , , , , lkml , linux-arm Mailing List , , Arnd Bergmann , Yingjoe Chen , Date: Wed, 2 Jan 2019 17:31:53 +0800 In-Reply-To: References: <1546314952-15990-1-git-send-email-yong.wu@mediatek.com> <1546314952-15990-19-git-send-email-yong.wu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-01-02 at 14:54 +0800, Nicolas Boichat wrote: > On Tue, Jan 1, 2019 at 11:59 AM Yong Wu wrote: > > > > The register VLD_PA_RNG(0x118) was forgot to backup while adding 4GB > > mode support for mt2712. this patch add it. > > > > Fixes: 30e2fccf9512 ("iommu/mediatek: Enlarge the validate PA range > > for 4GB mode") > > Signed-off-by: Yong Wu > > --- > > drivers/iommu/mtk_iommu.c | 2 ++ > > drivers/iommu/mtk_iommu.h | 1 + > > 2 files changed, 3 insertions(+) > > > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > > index 7fcef19..ddf1969 100644 > > --- a/drivers/iommu/mtk_iommu.c > > +++ b/drivers/iommu/mtk_iommu.c > > @@ -716,6 +716,7 @@ static int __maybe_unused mtk_iommu_suspend(struct device *dev) > > reg->int_control0 = readl_relaxed(base + REG_MMU_INT_CONTROL0); > > reg->int_main_control = readl_relaxed(base + REG_MMU_INT_MAIN_CONTROL); > > reg->ivrp_paddr = readl_relaxed(base + REG_MMU_IVRP_PADDR); > > + reg->vld_pa_range = readl_relaxed(base + REG_MMU_VLD_PA_RNG); > > Don't we want to add: > if (data->plat_data->vld_pa_rng) > before this save/restore operation? Or it doesn't matter? It doesn't matter. If some SoCs don't have it, the register doesn't conflict with the others. Reading it will return 0, and writing 0 will have no effect. > > > clk_disable_unprepare(data->bclk); > > return 0; > > } > > @@ -740,6 +741,7 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev) > > writel_relaxed(reg->int_control0, base + REG_MMU_INT_CONTROL0); > > writel_relaxed(reg->int_main_control, base + REG_MMU_INT_MAIN_CONTROL); > > writel_relaxed(reg->ivrp_paddr, base + REG_MMU_IVRP_PADDR); > > + writel_relaxed(reg->vld_pa_range, base + REG_MMU_VLD_PA_RNG); > > if (m4u_dom) > > writel(m4u_dom->cfg.arm_v7s_cfg.ttbr[0] & MMU_PT_ADDR_MASK, > > base + REG_MMU_PT_BASE_ADDR); > > diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h > > index 0a7c463..c500bfd 100644 > > --- a/drivers/iommu/mtk_iommu.h > > +++ b/drivers/iommu/mtk_iommu.h > > @@ -33,6 +33,7 @@ struct mtk_iommu_suspend_reg { > > u32 int_control0; > > u32 int_main_control; > > u32 ivrp_paddr; > > + u32 vld_pa_range; > > Well, please be consistent ,-) Either vld_pa_rng, or valid_pa_range ,-) Thanks. I will use "vld_pa_rng", Keep same with the register name from CODA. > > > }; > > > > enum mtk_iommu_plat { > > -- > > 1.9.1 > >