+ iomap-use-non-raw-io-functions-for-ioreadwritexxbe.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: iomap: use non-raw io functions for io{read|write}XXbe
has been added to the -mm tree.  Its filename is
     iomap-use-non-raw-io-functions-for-ioreadwritexxbe.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/iomap-use-non-raw-io-functions-for-ioreadwritexxbe.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/iomap-use-non-raw-io-functions-for-ioreadwritexxbe.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Subject: iomap: use non-raw io functions for io{read|write}XXbe

Patch series "Add io{read|write}64 to io-64-atomic headers", v18.

A cleanup series to push a number of instances of people defining their
own io{read|write}64 functions into common headers seing they don't exist
in non-64bit systems.  This series adds inline functions to the
io-64-nonatomic headers and then cleans up the drivers that defined their
own copies.

This cleanup was originally requested by Greg after he reviewed my
Switchtec NTB code.


This patch (of 7):

Fix an asymmetry in the io{read|write}XXbe functions in that the
big-endian variants make use of the raw io accessors while the
little-endian variants use the regular accessors.  Some architectures
implement barriers to order against both spinlocks and DMA accesses and
for these case, the big-endian variant of the API would not be protected.

Thus, change the mmio_XXXXbe macros to use the appropriate swab() function
wrapping the regular accessor.  This is similar to what was done for PIO.

When this code was originally written, barriers in the IO accessors were
not common and the accessors simply wrapped the raw functions in a
conversion to CPU endianness.  Since then, barriers have been added in
some architectures and are now missing in the big endian variant of the
API.

This also manages to silence a few sparse warnings that check for using
the correct endian types which the original code did not annotate
correctly.

Link: http://lkml.kernel.org/r/20180622194752.11221-2-logang@xxxxxxxxxxxx
Link: http://lkml.kernel.org/r/CAK8P3a25zQDxyaY3iVv+JmSSzs7F6ssGc+HdBkGs54ZfViX+Fg@xxxxxxxxxxxxxx
Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Kate Stewart <kstewart@xxxxxxxxxxxxxxxxxxx>
Cc: Philippe Ombredanne <pombredanne@xxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Alan Cox <gnomes@xxxxxxxxxxxxxxxxxxx>
Cc: Allen Hubbe <Allen.Hubbe@xxxxxxxx>
Cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Dan Douglass <dan.douglass@xxxxxxx>
Cc: Dave Jiang <dave.jiang@xxxxxxxxx>
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
Cc: Helge Deller <deller@xxxxxx>
Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Cc: Horia Geantă <horia.geanta@xxxxxxx>
Cc: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxxxxx>
Cc: Jon Mason <jdmason@xxxxxxxx>
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Cc: Nicholas Piggin <npiggin@xxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Suresh Warrier <warrier@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/iomap.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff -puN lib/iomap.c~iomap-use-non-raw-io-functions-for-ioreadwritexxbe lib/iomap.c
--- a/lib/iomap.c~iomap-use-non-raw-io-functions-for-ioreadwritexxbe
+++ a/lib/iomap.c
@@ -65,8 +65,8 @@ static void bad_io_access(unsigned long
 #endif
 
 #ifndef mmio_read16be
-#define mmio_read16be(addr) be16_to_cpu(__raw_readw(addr))
-#define mmio_read32be(addr) be32_to_cpu(__raw_readl(addr))
+#define mmio_read16be(addr) swab16(readw(addr))
+#define mmio_read32be(addr) swab32(readl(addr))
 #endif
 
 unsigned int ioread8(void __iomem *addr)
@@ -106,8 +106,8 @@ EXPORT_SYMBOL(ioread32be);
 #endif
 
 #ifndef mmio_write16be
-#define mmio_write16be(val,port) __raw_writew(be16_to_cpu(val),port)
-#define mmio_write32be(val,port) __raw_writel(be32_to_cpu(val),port)
+#define mmio_write16be(val,port) writew(swab16(val),port)
+#define mmio_write32be(val,port) writel(swab32(val),port)
 #endif
 
 void iowrite8(u8 val, void __iomem *addr)
_

Patches currently in -mm which might be from logang@xxxxxxxxxxxx are

iomap-use-non-raw-io-functions-for-ioreadwritexxbe.patch
parisc-iomap-introduce-ioreadwrite64.patch
iomap-introduce-ioreadwrite64_lo_hihi_lo.patch
io-64-nonatomic-add-ioreadwrite64_lo_hi_hi_lo-macros.patch
ntb-ntb_hw_intel-use-io-64-nonatomic-instead-of-in-driver-hacks.patch
crypto-caam-cleanup-config_64bit-ifdefs-when-using-ioreadwrite64.patch
ntb-ntb_hw_switchtec-cleanup-64bit-io-defines-to-use-the-common-header.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux