Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034317AbcJ0XZB (ORCPT ); Thu, 27 Oct 2016 19:25:01 -0400 Received: from mail-qt0-f170.google.com ([209.85.216.170]:32895 "EHLO mail-qt0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034145AbcJ0XY6 (ORCPT ); Thu, 27 Oct 2016 19:24:58 -0400 Subject: Re: [PATCH] clk: xgene: Don't call __pa on ioremaped address To: Michael Turquette , Stephen Boyd , Loc Ho References: <1477610508-7449-1-git-send-email-labbott@redhat.com> Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org From: Laura Abbott Message-ID: Date: Thu, 27 Oct 2016 16:24:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1477610508-7449-1-git-send-email-labbott@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2176 Lines: 58 On 10/27/2016 04:21 PM, Laura Abbott wrote: > ioremaped addresses are not linearly mapped so the physical > address can not be figured out via __pa. More generally, there > is no guarantee that backing value of an ioremapped address > is a physical address at all. The value here is only used > for debugging so just drop the call to __pa on the ioremapped > address. > > Signed-off-by: Laura Abbott > --- > Found while working on virt_to_phys debugging for arm64 > --- > drivers/clk/clk-xgene.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c > index 3433132..4697bf9 100644 > --- a/drivers/clk/clk-xgene.c > +++ b/drivers/clk/clk-xgene.c > @@ -243,22 +243,20 @@ static int xgene_clk_enable(struct clk_hw *hw) > struct xgene_clk *pclk = to_xgene_clk(hw); > unsigned long flags = 0; > u32 data; > - phys_addr_t reg; > > if (pclk->lock) > spin_lock_irqsave(pclk->lock, flags); > > if (pclk->param.csr_reg != NULL) { > pr_debug("%s clock enabled\n", clk_hw_get_name(hw)); > - reg = __pa(pclk->param.csr_reg); > /* First enable the clock */ > data = xgene_clk_read(pclk->param.csr_reg + > pclk->param.reg_clk_offset); > data |= pclk->param.reg_clk_mask; > xgene_clk_write(data, pclk->param.csr_reg + > pclk->param.reg_clk_offset); > - pr_debug("%s clock PADDR base %pa clk offset 0x%08X mask 0x%08X value 0x%08X\n", > - clk_hw_get_name(hw), ®, > + pr_debug("%s clk offset 0x%08X mask 0x%08X value 0x%08X\n", > + clk_hw_get_name(hw), > pclk->param.reg_clk_offset, pclk->param.reg_clk_mask, > data); > > @@ -269,7 +267,7 @@ static int xgene_clk_enable(struct clk_hw *hw) > xgene_clk_write(data, pclk->param.csr_reg + > pclk->param.reg_csr_offset); > pr_debug("%s CSR RESET PADDR base %pa csr offset 0x%08X mask 0x%08X value 0x%08X\n", Bah, this got fixed locally but didn't get amended. I'll remove the format here in a v2 assuming there are no other objections. > - clk_hw_get_name(hw), ®, > + clk_hw_get_name(hw), > pclk->param.reg_csr_offset, pclk->param.reg_csr_mask, > data); > } >