linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h
@ 2019-06-20 22:13 Paul Burton
  2019-06-21  2:09 ` Maciej W. Rozycki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paul Burton @ 2019-06-20 22:13 UTC (permalink / raw)
  To: Maciej W. Rozycki, David S. Miller, netdev
  Cc: Paul Burton, Serge Semin, linux-mips, linux-kernel

Currently arch/mips/include/asm/io.h provides 64b memory accessor
functions such as readq & writeq even on MIPS32 platforms where those
accessors cannot actually perform a 64b memory access. They instead
BUG(). This is unfortunate for drivers which either #ifdef on the
presence of these accessors, or can function with non-atomic
implementations of them found in either linux/io-64-nonatomic-lo-hi.h or
linux/io-64-nonatomic-hi-lo.h. As such we're preparing to remove the
definitions of these 64b accessor functions for MIPS32 kernels.

In preparation for this, include linux/io-64-nonatomic-lo-hi.h in
defza.c in order to provide a non-atomic implementation of the
readq_relaxed & writeq_relaxed functions that are used by this code. In
practice this will have no runtime effect, since use of the 64b accessor
functions is conditional upon sizeof(unsigned long) == 8, ie. upon
CONFIG_64BIT=y. This means the calls to these non-atomic readq & writeq
implementations will be optimized out anyway, but we need their
definitions to keep the compiler happy.

For 64bit kernels using this code this change should also have no effect
because asm/io.h will continue to provide the definitions of
readq_relaxed & writeq_relaxed, which linux/io-64-nonatomic-lo-hi.h
checks for before defining itself.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Serge Semin <Sergey.Semin@t-platforms.ru>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Maciej, David, if you'd be happy to provide an Ack so that I can take
this through the mips-next branch that would be great; that'll let me
apply it prior to the asm/io.h change.
---
 drivers/net/fddi/defza.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/fddi/defza.c b/drivers/net/fddi/defza.c
index c5cae8e74dc4..060712c666bf 100644
--- a/drivers/net/fddi/defza.c
+++ b/drivers/net/fddi/defza.c
@@ -33,6 +33,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h
  2019-06-20 22:13 [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h Paul Burton
@ 2019-06-21  2:09 ` Maciej W. Rozycki
  2019-06-23 18:25 ` David Miller
  2019-06-24 21:16 ` Paul Burton
  2 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2019-06-21  2:09 UTC (permalink / raw)
  To: Paul Burton
  Cc: David S. Miller, netdev, Paul Burton, Serge Semin, linux-mips,
	linux-kernel

On Thu, 20 Jun 2019, Paul Burton wrote:

> Maciej, David, if you'd be happy to provide an Ack so that I can take
> this through the mips-next branch that would be great; that'll let me
> apply it prior to the asm/io.h change.

Acked-by: Maciej W. Rozycki <macro@linux-mips.org>

 Sure, thanks for doing this work.

  Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h
  2019-06-20 22:13 [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h Paul Burton
  2019-06-21  2:09 ` Maciej W. Rozycki
@ 2019-06-23 18:25 ` David Miller
  2019-06-24 21:16 ` Paul Burton
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-06-23 18:25 UTC (permalink / raw)
  To: paul.burton
  Cc: macro, netdev, pburton, Sergey.Semin, linux-mips, linux-kernel

From: Paul Burton <paul.burton@mips.com>
Date: Thu, 20 Jun 2019 22:13:58 +0000

> Currently arch/mips/include/asm/io.h provides 64b memory accessor
> functions such as readq & writeq even on MIPS32 platforms where those
> accessors cannot actually perform a 64b memory access. They instead
> BUG(). This is unfortunate for drivers which either #ifdef on the
> presence of these accessors, or can function with non-atomic
> implementations of them found in either linux/io-64-nonatomic-lo-hi.h or
> linux/io-64-nonatomic-hi-lo.h. As such we're preparing to remove the
> definitions of these 64b accessor functions for MIPS32 kernels.
> 
> In preparation for this, include linux/io-64-nonatomic-lo-hi.h in
> defza.c in order to provide a non-atomic implementation of the
> readq_relaxed & writeq_relaxed functions that are used by this code. In
> practice this will have no runtime effect, since use of the 64b accessor
> functions is conditional upon sizeof(unsigned long) == 8, ie. upon
> CONFIG_64BIT=y. This means the calls to these non-atomic readq & writeq
> implementations will be optimized out anyway, but we need their
> definitions to keep the compiler happy.
> 
> For 64bit kernels using this code this change should also have no effect
> because asm/io.h will continue to provide the definitions of
> readq_relaxed & writeq_relaxed, which linux/io-64-nonatomic-lo-hi.h
> checks for before defining itself.
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>
 ...
> Maciej, David, if you'd be happy to provide an Ack so that I can take
> this through the mips-next branch that would be great; that'll let me
> apply it prior to the asm/io.h change.

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h
  2019-06-20 22:13 [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h Paul Burton
  2019-06-21  2:09 ` Maciej W. Rozycki
  2019-06-23 18:25 ` David Miller
@ 2019-06-24 21:16 ` Paul Burton
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2019-06-24 21:16 UTC (permalink / raw)
  To: Paul Burton
  Cc: Maciej W. Rozycki, David S. Miller, netdev, Paul Burton,
	Serge Semin, linux-mips, linux-kernel, linux-mips

Hello,

Paul Burton wrote:
> Currently arch/mips/include/asm/io.h provides 64b memory accessor
> functions such as readq & writeq even on MIPS32 platforms where those
> accessors cannot actually perform a 64b memory access. They instead
> BUG(). This is unfortunate for drivers which either #ifdef on the
> presence of these accessors, or can function with non-atomic
> implementations of them found in either linux/io-64-nonatomic-lo-hi.h or
> linux/io-64-nonatomic-hi-lo.h. As such we're preparing to remove the
> definitions of these 64b accessor functions for MIPS32 kernels.
> 
> In preparation for this, include linux/io-64-nonatomic-lo-hi.h in
> defza.c in order to provide a non-atomic implementation of the
> readq_relaxed & writeq_relaxed functions that are used by this code. In
> practice this will have no runtime effect, since use of the 64b accessor
> functions is conditional upon sizeof(unsigned long) == 8, ie. upon
> CONFIG_64BIT=y. This means the calls to these non-atomic readq & writeq
> implementations will be optimized out anyway, but we need their
> definitions to keep the compiler happy.
> 
> For 64bit kernels using this code this change should also have no effect
> because asm/io.h will continue to provide the definitions of
> readq_relaxed & writeq_relaxed, which linux/io-64-nonatomic-lo-hi.h
> checks for before defining itself.
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Cc: Serge Semin <Sergey.Semin@t-platforms.ru>
> Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Acked-by: Maciej W. Rozycki <macro@linux-mips.org>
> Acked-by: David S. Miller <davem@davemloft.net>

Applied to mips-next.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-24 21:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 22:13 [PATCH] FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h Paul Burton
2019-06-21  2:09 ` Maciej W. Rozycki
2019-06-23 18:25 ` David Miller
2019-06-24 21:16 ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).