Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp628498ybl; Thu, 23 Jan 2020 05:03:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzmOSUluqPK46/ClxLnI0ocQ8ch7jX6fzy1NWevW5QnNiBkhrtIuZCi0KjFsbZmbYXvtrxc X-Received: by 2002:a54:4715:: with SMTP id k21mr10565278oik.163.1579784620309; Thu, 23 Jan 2020 05:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579784620; cv=none; d=google.com; s=arc-20160816; b=SKfZN2ra0l1wt0BOCQCc7xDrhvv6fHzCy0+bIsvHbCE9VCKGa0UQc/J+4jncU9+AKI kSn0WZkLv6MuJp5NzfmoyZqyAnjvyeRp93YvYe5h7jmNkPD4ajnw1fhEEVzIqth3gKfV +NB0MSPhcTeYtOJGBNKlzcGr63M+oIj9HQK5SGojXWwx8hReA0zKoIz0YJUtwr5ZVzf2 4LWNEVGATI2OOorYajOLTkiizYwLM92nWc4SsEARhhV0OZCEOsR4JHXYjqwP5aa6Xx5p Cao+FqkhxLVHJmAinb2n4in8AfVWfaSg1juv9RhIQCxMDHX9W9MEbpCdF8f//lcGB0Fq iGwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1bWB6ONkrT4WgWO4GSee5Bs4kxW688nuEU9Jrsivajs=; b=Pyk1Xw4ZyXs/wiFaVylWYeSBq5lx3xu1i5nhyQqjPxz/dwEqEQ+CuJviMCzQh0SOiZ Vn3Hu8nlVwKCC4tSTS+ulM82gRHl9vrrr6zPdkgTmngk+Ede5MxNSMoTNHLSPQCYHdEV 6zyUBTsU5rlaGu98+gr4VAo7tdoyT347pnFYm1nzTXfJlk52Y6SsvPXCwH99dCuYS5eK GkAGIAw0rM0HZQmAc23GOvo/fUUD3Bn0m5GJRcNTzFpf0xw5F5W3kQBrtfqs+so57ZMs gI/NIOdUKgrzvPt+Tl8dEfmWY0GzCjEBCdMbbLEHJrviz8kOT6BRUx+kPcxvLCiHkhIQ 60Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cj15zwE2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si1108677oto.176.2020.01.23.05.03.21; Thu, 23 Jan 2020 05:03:40 -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; dkim=pass header.i=@linaro.org header.s=google header.b=cj15zwE2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726968AbgAWNCA (ORCPT + 99 others); Thu, 23 Jan 2020 08:02:00 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:38608 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgAWNCA (ORCPT ); Thu, 23 Jan 2020 08:02:00 -0500 Received: by mail-pj1-f65.google.com with SMTP id l35so1268334pje.3 for ; Thu, 23 Jan 2020 05:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1bWB6ONkrT4WgWO4GSee5Bs4kxW688nuEU9Jrsivajs=; b=cj15zwE2L+LsB3Pok/kWy1UJUW3Nev9f/JDrLWnnKhnzn/mGek2Gs2OMBkG/caj1Zp BDuPozbl5U14q/wGz9Mbwkydb3P751tr5PWr89W5JkUe1VVv0QSWC5pEt6mDTcvmWK1g fVc/6+FXMdGeXFWL8khum5toRJ2dEzuKBiMZuUyq55iL03rdg4fYnhf5fkbWh5jJ9ldD bG9+E22yE8jDSDkiqM69UlbG0TaHxAuLAm8sM1QDAS6OCrTq8ONEeNiFlCPMjp046E+i FUkQRIusYeVsYJeMbegvmdDgNuE39wBn+RS0vb7azWTrzZgzLnvSXFVT+3PVW0RKCsN9 yHaA== 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=1bWB6ONkrT4WgWO4GSee5Bs4kxW688nuEU9Jrsivajs=; b=PaMnFm/eFx5WorJoXL0BgL3HQ8nkdmwBlMvgLGdolubhFBpd8y61/FpecX7CRXPMiN uZh29oD3U7MqodsB1xXc/GqccuC7xICYoZxXHKXpqNj+QOOgFaWghBQNku8S5eLf13gL mr9wsGZZCQslFbsluzcfYj+mLMQJJKjea/0xhZhMOkRYLvvMdmkrri0FDABRiSzedVpn 00zZXAQeFaIESr3EhtQbUmGHuedzQ08ssvFhzH6EAr4WHi9wGh494TNoG0vUezHtbzsC uwXtPICZQIwOf6BXoMo4pDfMWeC17LgvGgHDF+980lrBXvZ9gjdeWLZ7s+PeMcEFOm/9 t27w== X-Gm-Message-State: APjAAAXFuWFXyONUcwIXNjLNuGYDnkEahnhXZr6Zw85EKEu2BTIYvgYa y6iaTrHoofKdRwtuWV1bUpwL X-Received: by 2002:a17:902:9691:: with SMTP id n17mr16555805plp.304.1579784519567; Thu, 23 Jan 2020 05:01:59 -0800 (PST) Received: from mani ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id g22sm3015074pgk.85.2020.01.23.05.01.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2020 05:01:58 -0800 (PST) Date: Thu, 23 Jan 2020 18:31:51 +0530 From: Manivannan Sadhasivam To: Arnd Bergmann Cc: gregkh , smohanad@codeaurora.org, Jeffrey Hugo , Kalle Valo , Bjorn Andersson , hemantk@codeaurora.org, linux-arm-msm , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 05/16] bus: mhi: core: Add support for ringing channel/event ring doorbells Message-ID: <20200123130151.GD8937@mani> References: <20200123111836.7414-1-manivannan.sadhasivam@linaro.org> <20200123111836.7414-6-manivannan.sadhasivam@linaro.org> <20200123120050.GB8937@mani> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 23, 2020 at 01:44:32PM +0100, Arnd Bergmann wrote: > On Thu, Jan 23, 2020 at 1:01 PM Manivannan Sadhasivam > wrote: > > On Thu, Jan 23, 2020 at 12:39:06PM +0100, Arnd Bergmann wrote: > > > On Thu, Jan 23, 2020 at 12:19 PM Manivannan Sadhasivam > > > wrote: > > > > > > > +int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl, > > > > + void __iomem *base, u32 offset, u32 *out) > > > > +{ > > > > + u32 tmp = readl_relaxed(base + offset); > > > .... > > > > +void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base, > > > > + u32 offset, u32 val) > > > > +{ > > > > + writel_relaxed(val, base + offset); > > > > > > Please avoid using _relaxed accessors by default, and use the regular > > > ones instead. There are a number of things that can go wrong with > > > the relaxed version, so ideally each caller should have a comment > > > explaining why this instance is safe without the barriers and why it > > > matters to not have it. > > > > > > If there are performance critical callers of mhi_read_reg/mhi_write_reg, > > > you could add mhi_read_reg_relaxed/mhi_write_reg_relaxed for those > > > and apply the same rules there. > > > > > > Usually most mmio accesses are only needed for reconfiguration or > > > other slow paths. > > > > > > > Fair point. I'll defer to readl/writel APIs and I also need to add > > le32_to_cpu/cpu_to_le32 to them. > > What do you need the byteswap for? All of the above already > assume that the registers are little-endian. > I thought the readl/writel are native endian... Now I read the macro definitions once again and looks like these APIs are LE for all archs... So it is not needed. Sorry for the confusion. Thanks, Mani > Arnd