From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next v2 1/6] qed: Add doorbell overflow recovery mechanism Date: Mon, 22 Oct 2018 20:05:59 -0700 (PDT) Message-ID: <20181022.200559.1672641132565115543.davem@davemloft.net> References: <20181022164045.25393-1-Ariel.Elior@cavium.com> <20181022164045.25393-2-Ariel.Elior@cavium.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Michal.Kalderon@cavium.com, Tomer.Tayar@cavium.com To: Ariel.Elior@cavium.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:40180 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726438AbeJWL1V (ORCPT ); Tue, 23 Oct 2018 07:27:21 -0400 In-Reply-To: <20181022164045.25393-2-Ariel.Elior@cavium.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Ariel Elior Date: Mon, 22 Oct 2018 19:40:40 +0300 > > +#ifndef writeq > +#define writeq writeq > +static inline void writeq(u64 val, void __iomem *reg) > +{ > + writel(val & 0xffffffff, reg); > + writel(val >> 32, reg + 0x4UL); > +} > +#endif Please use the appropriate generic header file to achieve this, do not reimplement it. See include/linux/io-64-nonatomic*.h and think very carefully about which one is appropriate. 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. Likewise for which half of a register, when written, commits the results. If both halfs trigger the side effect or the commit of the write, you cannot enable your driver on 32-bit architectures. 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. Thank you.