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.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,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 D0A15C433E0 for ; Thu, 23 Jul 2020 10:03:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D28C20737 for ; Thu, 23 Jul 2020 10:03:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lmD1D/oH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D28C20737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Vc0rgestdpP5tF9I7RVsFbdy5uJpuf7dOIOa4KZC42Q=; b=lmD1D/oH65RmioCIDDCXmE6tO Xl8Pv8mNjsf3nhQBQUWnBybugM8U/9vw1FQtLHA5ekhPwWsoAylhGgUBEWB0xdwh4NkbXrLwBMD1W PIbEQUp/0W4SM5ImIbRIWsrAQsqWGMBBTJkz/sXsnC5Uvq8r3w8Uk0Z/GaEtRes58byYVcX5BWQim I/acuNBauoiwc7IWTJxczxkmQ6GBPSETAMMZMJdAXkL4Ptq6xnyNs/VaXSPelRZkUnd/Ioe3q2Ocf hfa9iR277LJJO2mULKrL4OYRqudxRuapormGrPz9B8GMy0rAc/bq5GsWCoslNE/H8CLPwnlA5c+VG hgiPtgiQw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyY2r-0002lE-GS; Thu, 23 Jul 2020 10:01:45 +0000 Received: from mail-ed1-f68.google.com ([209.85.208.68]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyY2o-0002kR-HJ; Thu, 23 Jul 2020 10:01:43 +0000 Received: by mail-ed1-f68.google.com with SMTP id b13so1687860edz.7; Thu, 23 Jul 2020 03:01:42 -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=UGTDv//qMW/fnxm5ClGxcmys9448ucN075KKPOc7/HFTPArP8vjA71t+n1Z5UWmaPV 8EQecLP7zAl3VGXnKY5mxcCBdbxIb+xSrIza1AjswVL6JnLr96wGzkAyypPs39fW/PDS GvkqvrW2+zzUVoNaxyxp+nSLmN6+IPN2QtiHWNazHbrLl2CUqqERIUTQE0TWfvMTLJFq gCikCzzHknp0ztXIZaViK5018t/9cLygkMbr5W0iRKcqGS3xg2AQiiiDsy4FjQrz6abT p/4qOuNhRDpAeUtnjPHwHScu7KQZc/CO++99Ykc8kuYMfToEOt51+5NMsRVP2gnrU4Yu yKCA== X-Gm-Message-State: AOAM530dIV7cQd3sEmR+OWWWWnoOTdXLoWl2Ze32d0ozqm4ATeod1FSK Og/ZaBtwae4xf7Slo8Y9z/A= 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 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_060142_583274_BDB5C4FE X-CRM114-Status: GOOD ( 29.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: Cc: Florian Fainelli , "open list:TEGRA ARCHITECTURE SUPPORT" , linux-omap , Tony Lindgren , Greg Kroah-Hartman , "moderated list:ARM/Mediatek SoC..." , "linux-kernel@vger.kernel.org" , Vladimir Zapolskiy , Matthias Brugger , SoC Team , arm-soc , bcm-kernel-feedback-list , Markus Mayer , Santosh Shilimkar , Olof Johansson , Thierry Reding , Andrew Morton , Jonathan Hunter , Linus Torvalds , Linux ARM , Roger Quadros Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel