From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Elior, Ariel" Subject: RE: [PATCH net-next v2 1/6] qed: Add doorbell overflow recovery mechanism Date: Tue, 23 Oct 2018 05:16:21 +0000 Message-ID: References: <20181022164045.25393-1-Ariel.Elior@cavium.com> <20181022164045.25393-2-Ariel.Elior@cavium.com> <20181022.200559.1672641132565115543.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "netdev@vger.kernel.org" , "Kalderon, Michal" , "Tayar, Tomer" To: David Miller Return-path: Received: from mail-by2nam03on0068.outbound.protection.outlook.com ([104.47.42.68]:30623 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727101AbeJWNiI (ORCPT ); Tue, 23 Oct 2018 09:38:08 -0400 In-Reply-To: <20181022.200559.1672641132565115543.davem@davemloft.net> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: > > > +#ifndef writeq > > +#define writeq writeq > > +static inline void writeq(u64 val, void __iomem *reg) > > +{ > > + writel(val & 0xffffffff, reg); > > + writel(val >> 32, reg + 0x4UL); > > +} > > +#endif >=20 > Please use the appropriate generic header file to achieve this, do not > reimplement it. >=20 > See include/linux/io-64-nonatomic*.h and think very carefully about > which one is appropriate. >=20 > Specifically, if a register read has side effects but only if you read > the lower or upper half you want to make sure that you use the > implementation that reads the half the doesn't trigger the side > effects first. This way the whole 64-bit value can be sampled before > status bits clear, or whatever. >=20 > Likewise for which half of a register, when written, commits the > results. >=20 > If both halfs trigger the side effect or the commit of the write, you > cannot enable your driver on 32-bit architectures. >=20 > So this is not such a simple fix where you just hack the build to pass, > you have to really think hard about what the code does, how the hardware > works, and if this can even work properly on 32-bit platforms. >=20 > Thank you. Thanks for pointing out the generic implementation. In our drivers we only = use The 64b macros for a single purpose - writing the rdma CQ doorbells. It wil= l not be used in any other register access. In this case the "lower and then uppe= r" is the correct behavior for us. I will send a v3 using the generic implementat= ion. Thanks, Ariel