From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31598C433E1 for ; Thu, 23 Jul 2020 10:01:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AE1320737 for ; Thu, 23 Jul 2020 10:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595498504; bh=izeJyw5OGLETv+NMCChNJQz1ZQ4GTatkR8y1AWk5KfM=; h=Date:From:To:List-Id:Cc:Subject:References:In-Reply-To:List-ID: From; b=LtbwyLckwX55y29DGOm+zZe5Pyqnmn+SOnwxx4/qPcBI7gWTZCZMpE24ZQvZVJXUR J6KLTmq0cjDsB1TMKQv/Fo0u9bvayrb9R64CQXZrheq/FWvyv7SP3IMBgbhIhaZooa 5UI1Av0sXx5HIxwSBMka2WWkP+AGahNweQ5DZHrQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727859AbgGWKBn (ORCPT ); Thu, 23 Jul 2020 06:01:43 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:36334 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726982AbgGWKBn (ORCPT ); Thu, 23 Jul 2020 06:01:43 -0400 Received: by mail-ed1-f65.google.com with SMTP id dg28so4076004edb.3; Thu, 23 Jul 2020 03:01:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hslSkDk2GV4smH9H5xKkxfOrQX9nbu5qQFnRZrSLifU=; b=RJhho/I+QbuF9egQiumAbcszur8GB1mv5ZrXupJsH9hQxGESyFin62m+Z1+f/vSP3L T1JxRDHozHQKTGXCT9mUHmp3T5St2mWp6L0CHj8XNp82QLolBNVqCs86v2WWyx9L31Xo mJBkRmOTxIRMNfeLjjKOcJx0Xif0cYNJ8gu26i7//qOy8ZfCKcAawGa2vGxihyU4uCq2 b/bMZwLs9w5xAKdxGPQCJLj3ZarOifAqdZeklmxPjs+qWVAetX2NTdT3ST1KvyKLY4zl lp2wLgApMQhWuw/yzgpCSvTamnFuds9Ym1bN6uH/s6d3pul4qmMUKejH28Rfpt2XvrcM n3+w== X-Gm-Message-State: AOAM530NagihXxMcXJIiXoTSByLMbZdgZozWLTUUdu2CxWRfig3EpLZY +kQrYsQzZmPT653MyFO7xY+p1A3Q17k= X-Google-Smtp-Source: ABdhPJyI1dXtFK9c7xFGtDoq/er+m8wTtbHeKjPM3NBbXDh2gegj/He+I6/0VjA5aQ16XwVCcNk6hQ== X-Received: by 2002:a05:6402:1a42:: with SMTP id bf2mr3292640edb.292.1595498500867; Thu, 23 Jul 2020 03:01:40 -0700 (PDT) Received: from kozik-lap ([194.230.155.213]) by smtp.googlemail.com with ESMTPSA id h24sm1689173ejg.53.2020.07.23.03.01.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jul 2020 03:01:40 -0700 (PDT) Date: Thu, 23 Jul 2020 12:01:36 +0200 From: Krzysztof Kozlowski To: Arnd Bergmann List-Id: Cc: Olof Johansson , arm-soc , SoC Team , Markus Mayer , bcm-kernel-feedback-list , Florian Fainelli , Santosh Shilimkar , Matthias Brugger , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Thierry Reding , Jonathan Hunter , "linux-kernel@vger.kernel.org" , Linux ARM , "moderated list:ARM/Mediatek SoC..." , linux-omap , "open list:TEGRA ARCHITECTURE SUPPORT" , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman Subject: Re: [PATCH 14/23] memory: ti-emif-pm: Fix cast to iomem pointer Message-ID: <20200723100136.GB30472@kozik-lap> References: <20200723073744.13400-1-krzk@kernel.org> <20200723073744.13400-15-krzk@kernel.org> <20200723090230.GB25935@kozik-lap> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org On Thu, Jul 23, 2020 at 11:14:02AM +0200, Arnd Bergmann wrote: > On Thu, Jul 23, 2020 at 11:02 AM Krzysztof Kozlowski wrote: > > On Thu, Jul 23, 2020 at 10:48:19AM +0200, Arnd Bergmann wrote: > > > On Thu, Jul 23, 2020 at 9:39 AM Krzysztof Kozlowski wrote: > > > > > > > > Cast pointer to iomem memory properly to fix sparse warning: > > > > > > > > drivers/memory/ti-emif-pm.c:251:38: warning: incorrect type in argument 1 (different address spaces) > > > > drivers/memory/ti-emif-pm.c:251:38: expected void const volatile [noderef] __iomem *addr > > > > drivers/memory/ti-emif-pm.c:251:38: got void * > > > > > > > > Signed-off-by: Krzysztof Kozlowski > > > > --- > > > > drivers/memory/ti-emif-pm.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c > > > > index 9c90f815ad3a..6c747c1e98cb 100644 > > > > --- a/drivers/memory/ti-emif-pm.c > > > > +++ b/drivers/memory/ti-emif-pm.c > > > > @@ -248,7 +248,7 @@ MODULE_DEVICE_TABLE(of, ti_emif_of_match); > > > > static int ti_emif_resume(struct device *dev) > > > > { > > > > unsigned long tmp = > > > > - __raw_readl((void *)emif_instance->ti_emif_sram_virt); > > > > + __raw_readl((void __iomem *)emif_instance->ti_emif_sram_virt); > > > > > > > > > > Maybe this shouldn't even be __raw_readl(), but instead READ_ONCE()? > > > > Won't readl() be enough? Indeed it looks problematic. > > readl() won't work on big-endian kernels, since this is a byte comparison. Ah, right. > > > > The other accesses in this file don't use MMIO wrappers either but just treat > > > it as a pointer. The effect would be the same though. > > > > I think all the reads and writes are with readl() and writel(). > > I actually see only one other access: > > copy_addr = sram_exec_copy(emif_data->sram_pool_code, > (void *)emif_data->ti_emif_sram_virt, > &ti_emif_sram, ti_emif_sram_sz); > > and this one ends up in a memcpy() that does not perform any byte > swapping or barriers. At least the barrier would come through mutex in sram_exec_copy() and later spin locks for page table manipulation. Anyway, I do not have the HW to test the changes or to confirm whether this is real issue. I guess the driver author/owner should follow up on this report. Best regards, Krzysztof