* [PATCH 0/3] io.h, logic_pio: Allow barriers for inX() and outX() be overridden
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Since commits a7851aa54c0c ("io: change outX() to have their own IO
barrier overrides") and 87fe2d543f81 ("io: change inX() to have their own
IO barrier overrides"), the outX() and inX() functions have memory
barriers which can be overridden per-arch.
However, under CONFIG_INDIRECT_PIO, logic_pio defines its own version of
inX() and outX(), which still use readb et al. For these, the barrier
after a raw read is weaker than it otherwise would be.
This series generates consistent behaviour for logic_pio, by defining
generic _inX() and _outX() in asm-generic/io.h, and using those in
logic_pio. Generic _inX() and _outX() have per-arch overrideable
barriers.
The topic was discussed there originally:
https://lore.kernel.org/lkml/2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com/
A small tidy-up patch is included.
I hope that series can go through the arm-soc tree, as with other recent
logic_pio changes.
John Garry (3):
io: Provide _inX() and _outX()
logic_pio: Improve macro argument name
logic_pio: Use _inX() and _outX()
include/asm-generic/io.h | 64 +++++++++++++++++++++++++++++++++---------------
lib/logic_pio.c | 22 ++++++++---------
2 files changed, 55 insertions(+), 31 deletions(-)
--
2.12.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] io.h, logic_pio: Allow barriers for inX() and outX() be overridden
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Since commits a7851aa54c0c ("io: change outX() to have their own IO
barrier overrides") and 87fe2d543f81 ("io: change inX() to have their own
IO barrier overrides"), the outX() and inX() functions have memory
barriers which can be overridden per-arch.
However, under CONFIG_INDIRECT_PIO, logic_pio defines its own version of
inX() and outX(), which still use readb et al. For these, the barrier
after a raw read is weaker than it otherwise would be.
This series generates consistent behaviour for logic_pio, by defining
generic _inX() and _outX() in asm-generic/io.h, and using those in
logic_pio. Generic _inX() and _outX() have per-arch overrideable
barriers.
The topic was discussed there originally:
https://lore.kernel.org/lkml/2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com/
A small tidy-up patch is included.
I hope that series can go through the arm-soc tree, as with other recent
logic_pio changes.
John Garry (3):
io: Provide _inX() and _outX()
logic_pio: Improve macro argument name
logic_pio: Use _inX() and _outX()
include/asm-generic/io.h | 64 +++++++++++++++++++++++++++++++++---------------
lib/logic_pio.c | 22 ++++++++---------
2 files changed, 55 insertions(+), 31 deletions(-)
--
2.12.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] io.h, logic_pio: Allow barriers for inX() and outX() be overridden
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: linux-arch, John Garry, okaya, linux-kernel, jiaxun.yang,
linuxarm, olof, bhelgaas, linux-arm-kernel
Since commits a7851aa54c0c ("io: change outX() to have their own IO
barrier overrides") and 87fe2d543f81 ("io: change inX() to have their own
IO barrier overrides"), the outX() and inX() functions have memory
barriers which can be overridden per-arch.
However, under CONFIG_INDIRECT_PIO, logic_pio defines its own version of
inX() and outX(), which still use readb et al. For these, the barrier
after a raw read is weaker than it otherwise would be.
This series generates consistent behaviour for logic_pio, by defining
generic _inX() and _outX() in asm-generic/io.h, and using those in
logic_pio. Generic _inX() and _outX() have per-arch overrideable
barriers.
The topic was discussed there originally:
https://lore.kernel.org/lkml/2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com/
A small tidy-up patch is included.
I hope that series can go through the arm-soc tree, as with other recent
logic_pio changes.
John Garry (3):
io: Provide _inX() and _outX()
logic_pio: Improve macro argument name
logic_pio: Use _inX() and _outX()
include/asm-generic/io.h | 64 +++++++++++++++++++++++++++++++++---------------
lib/logic_pio.c | 22 ++++++++---------
2 files changed, 55 insertions(+), 31 deletions(-)
--
2.12.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/3] io: Provide _inX() and _outX()
2020-03-18 15:55 ` John Garry
(?)
(?)
@ 2020-03-18 15:55 ` John Garry
-1 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Since commit a7851aa54c0c ("io: change outX() to have their own IO
barrier overrides") and commit 87fe2d543f81 ("io: change inX() to have
their own IO barrier overrides"), the outX and inX functions have memory
barriers which can be overridden.
However, the generic logic_pio lib has continued to use readl/writel et al
for IO port accesses, which has weaker barriers on arm64.
Provide generic _inX() and _outX(), which can be used by logic pio.
Signed-off-by: John Garry <john.garry@huawei.com>
---
include/asm-generic/io.h | 64 +++++++++++++++++++++++++++++++++---------------
1 file changed, 44 insertions(+), 20 deletions(-)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index d39ac997dda8..31f647389c84 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -448,17 +448,15 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,
#define IO_SPACE_LIMIT 0xffff
#endif
-#include <linux/logic_pio.h>
-
/*
* {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
* implemented on hardware that needs an additional delay for I/O accesses to
* take effect.
*/
-#ifndef inb
-#define inb inb
-static inline u8 inb(unsigned long addr)
+#ifndef _inb
+#define _inb _inb
+static inline u16 _inb(unsigned long addr)
{
u8 val;
@@ -469,9 +467,9 @@ static inline u8 inb(unsigned long addr)
}
#endif
-#ifndef inw
-#define inw inw
-static inline u16 inw(unsigned long addr)
+#ifndef _inw
+#define _inw _inw
+static inline u16 _inw(unsigned long addr)
{
u16 val;
@@ -482,9 +480,9 @@ static inline u16 inw(unsigned long addr)
}
#endif
-#ifndef inl
-#define inl inl
-static inline u32 inl(unsigned long addr)
+#ifndef _inl
+#define _inl _inl
+static inline u16 _inl(unsigned long addr)
{
u32 val;
@@ -495,9 +493,9 @@ static inline u32 inl(unsigned long addr)
}
#endif
-#ifndef outb
-#define outb outb
-static inline void outb(u8 value, unsigned long addr)
+#ifndef _outb
+#define _outb _outb
+static inline void _outb(u8 value, unsigned long addr)
{
__io_pbw();
__raw_writeb(value, PCI_IOBASE + addr);
@@ -505,9 +503,9 @@ static inline void outb(u8 value, unsigned long addr)
}
#endif
-#ifndef outw
-#define outw outw
-static inline void outw(u16 value, unsigned long addr)
+#ifndef _outw
+#define _outw _outw
+static inline void _outw(u16 value, unsigned long addr)
{
__io_pbw();
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
@@ -515,9 +513,9 @@ static inline void outw(u16 value, unsigned long addr)
}
#endif
-#ifndef outl
-#define outl outl
-static inline void outl(u32 value, unsigned long addr)
+#ifndef _outl
+#define _outl _outl
+static inline void _outl(u32 value, unsigned long addr)
{
__io_pbw();
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
@@ -525,6 +523,32 @@ static inline void outl(u32 value, unsigned long addr)
}
#endif
+#include <linux/logic_pio.h>
+
+#ifndef inb
+#define inb _inb
+#endif
+
+#ifndef inw
+#define inw _inw
+#endif
+
+#ifndef inl
+#define inl _inl
+#endif
+
+#ifndef outb
+#define outb _outb
+#endif
+
+#ifndef outw
+#define outw _outw
+#endif
+
+#ifndef outl
+#define outl _outl
+#endif
+
#ifndef inb_p
#define inb_p inb_p
static inline u8 inb_p(unsigned long addr)
--
2.12.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 1/3] io: Provide _inX() and _outX()
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: linux-arch, John Garry, okaya, linux-kernel, jiaxun.yang,
linuxarm, olof, bhelgaas, linux-arm-kernel
Since commit a7851aa54c0c ("io: change outX() to have their own IO
barrier overrides") and commit 87fe2d543f81 ("io: change inX() to have
their own IO barrier overrides"), the outX and inX functions have memory
barriers which can be overridden.
However, the generic logic_pio lib has continued to use readl/writel et al
for IO port accesses, which has weaker barriers on arm64.
Provide generic _inX() and _outX(), which can be used by logic pio.
Signed-off-by: John Garry <john.garry@huawei.com>
---
include/asm-generic/io.h | 64 +++++++++++++++++++++++++++++++++---------------
1 file changed, 44 insertions(+), 20 deletions(-)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index d39ac997dda8..31f647389c84 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -448,17 +448,15 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,
#define IO_SPACE_LIMIT 0xffff
#endif
-#include <linux/logic_pio.h>
-
/*
* {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
* implemented on hardware that needs an additional delay for I/O accesses to
* take effect.
*/
-#ifndef inb
-#define inb inb
-static inline u8 inb(unsigned long addr)
+#ifndef _inb
+#define _inb _inb
+static inline u16 _inb(unsigned long addr)
{
u8 val;
@@ -469,9 +467,9 @@ static inline u8 inb(unsigned long addr)
}
#endif
-#ifndef inw
-#define inw inw
-static inline u16 inw(unsigned long addr)
+#ifndef _inw
+#define _inw _inw
+static inline u16 _inw(unsigned long addr)
{
u16 val;
@@ -482,9 +480,9 @@ static inline u16 inw(unsigned long addr)
}
#endif
-#ifndef inl
-#define inl inl
-static inline u32 inl(unsigned long addr)
+#ifndef _inl
+#define _inl _inl
+static inline u16 _inl(unsigned long addr)
{
u32 val;
@@ -495,9 +493,9 @@ static inline u32 inl(unsigned long addr)
}
#endif
-#ifndef outb
-#define outb outb
-static inline void outb(u8 value, unsigned long addr)
+#ifndef _outb
+#define _outb _outb
+static inline void _outb(u8 value, unsigned long addr)
{
__io_pbw();
__raw_writeb(value, PCI_IOBASE + addr);
@@ -505,9 +503,9 @@ static inline void outb(u8 value, unsigned long addr)
}
#endif
-#ifndef outw
-#define outw outw
-static inline void outw(u16 value, unsigned long addr)
+#ifndef _outw
+#define _outw _outw
+static inline void _outw(u16 value, unsigned long addr)
{
__io_pbw();
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
@@ -515,9 +513,9 @@ static inline void outw(u16 value, unsigned long addr)
}
#endif
-#ifndef outl
-#define outl outl
-static inline void outl(u32 value, unsigned long addr)
+#ifndef _outl
+#define _outl _outl
+static inline void _outl(u32 value, unsigned long addr)
{
__io_pbw();
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
@@ -525,6 +523,32 @@ static inline void outl(u32 value, unsigned long addr)
}
#endif
+#include <linux/logic_pio.h>
+
+#ifndef inb
+#define inb _inb
+#endif
+
+#ifndef inw
+#define inw _inw
+#endif
+
+#ifndef inl
+#define inl _inl
+#endif
+
+#ifndef outb
+#define outb _outb
+#endif
+
+#ifndef outw
+#define outw _outw
+#endif
+
+#ifndef outl
+#define outl _outl
+#endif
+
#ifndef inb_p
#define inb_p inb_p
static inline u8 inb_p(unsigned long addr)
--
2.12.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 1/3] io: Provide _inX() and _outX()
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Since commit a7851aa54c0c ("io: change outX() to have their own IO
barrier overrides") and commit 87fe2d543f81 ("io: change inX() to have
their own IO barrier overrides"), the outX and inX functions have memory
barriers which can be overridden.
However, the generic logic_pio lib has continued to use readl/writel et al
for IO port accesses, which has weaker barriers on arm64.
Provide generic _inX() and _outX(), which can be used by logic pio.
Signed-off-by: John Garry <john.garry@huawei.com>
---
include/asm-generic/io.h | 64 +++++++++++++++++++++++++++++++++---------------
1 file changed, 44 insertions(+), 20 deletions(-)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index d39ac997dda8..31f647389c84 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -448,17 +448,15 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,
#define IO_SPACE_LIMIT 0xffff
#endif
-#include <linux/logic_pio.h>
-
/*
* {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
* implemented on hardware that needs an additional delay for I/O accesses to
* take effect.
*/
-#ifndef inb
-#define inb inb
-static inline u8 inb(unsigned long addr)
+#ifndef _inb
+#define _inb _inb
+static inline u16 _inb(unsigned long addr)
{
u8 val;
@@ -469,9 +467,9 @@ static inline u8 inb(unsigned long addr)
}
#endif
-#ifndef inw
-#define inw inw
-static inline u16 inw(unsigned long addr)
+#ifndef _inw
+#define _inw _inw
+static inline u16 _inw(unsigned long addr)
{
u16 val;
@@ -482,9 +480,9 @@ static inline u16 inw(unsigned long addr)
}
#endif
-#ifndef inl
-#define inl inl
-static inline u32 inl(unsigned long addr)
+#ifndef _inl
+#define _inl _inl
+static inline u16 _inl(unsigned long addr)
{
u32 val;
@@ -495,9 +493,9 @@ static inline u32 inl(unsigned long addr)
}
#endif
-#ifndef outb
-#define outb outb
-static inline void outb(u8 value, unsigned long addr)
+#ifndef _outb
+#define _outb _outb
+static inline void _outb(u8 value, unsigned long addr)
{
__io_pbw();
__raw_writeb(value, PCI_IOBASE + addr);
@@ -505,9 +503,9 @@ static inline void outb(u8 value, unsigned long addr)
}
#endif
-#ifndef outw
-#define outw outw
-static inline void outw(u16 value, unsigned long addr)
+#ifndef _outw
+#define _outw _outw
+static inline void _outw(u16 value, unsigned long addr)
{
__io_pbw();
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
@@ -515,9 +513,9 @@ static inline void outw(u16 value, unsigned long addr)
}
#endif
-#ifndef outl
-#define outl outl
-static inline void outl(u32 value, unsigned long addr)
+#ifndef _outl
+#define _outl _outl
+static inline void _outl(u32 value, unsigned long addr)
{
__io_pbw();
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
@@ -525,6 +523,32 @@ static inline void outl(u32 value, unsigned long addr)
}
#endif
+#include <linux/logic_pio.h>
+
+#ifndef inb
+#define inb _inb
+#endif
+
+#ifndef inw
+#define inw _inw
+#endif
+
+#ifndef inl
+#define inl _inl
+#endif
+
+#ifndef outb
+#define outb _outb
+#endif
+
+#ifndef outw
+#define outw _outw
+#endif
+
+#ifndef outl
+#define outl _outl
+#endif
+
#ifndef inb_p
#define inb_p inb_p
static inline u8 inb_p(unsigned long addr)
--
2.12.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 1/3] io: Provide _inX() and _outX()
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: linux-arch, John Garry, okaya, linux-kernel, jiaxun.yang,
linuxarm, olof, bhelgaas, linux-arm-kernel
Since commit a7851aa54c0c ("io: change outX() to have their own IO
barrier overrides") and commit 87fe2d543f81 ("io: change inX() to have
their own IO barrier overrides"), the outX and inX functions have memory
barriers which can be overridden.
However, the generic logic_pio lib has continued to use readl/writel et al
for IO port accesses, which has weaker barriers on arm64.
Provide generic _inX() and _outX(), which can be used by logic pio.
Signed-off-by: John Garry <john.garry@huawei.com>
---
include/asm-generic/io.h | 64 +++++++++++++++++++++++++++++++++---------------
1 file changed, 44 insertions(+), 20 deletions(-)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index d39ac997dda8..31f647389c84 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -448,17 +448,15 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,
#define IO_SPACE_LIMIT 0xffff
#endif
-#include <linux/logic_pio.h>
-
/*
* {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
* implemented on hardware that needs an additional delay for I/O accesses to
* take effect.
*/
-#ifndef inb
-#define inb inb
-static inline u8 inb(unsigned long addr)
+#ifndef _inb
+#define _inb _inb
+static inline u16 _inb(unsigned long addr)
{
u8 val;
@@ -469,9 +467,9 @@ static inline u8 inb(unsigned long addr)
}
#endif
-#ifndef inw
-#define inw inw
-static inline u16 inw(unsigned long addr)
+#ifndef _inw
+#define _inw _inw
+static inline u16 _inw(unsigned long addr)
{
u16 val;
@@ -482,9 +480,9 @@ static inline u16 inw(unsigned long addr)
}
#endif
-#ifndef inl
-#define inl inl
-static inline u32 inl(unsigned long addr)
+#ifndef _inl
+#define _inl _inl
+static inline u16 _inl(unsigned long addr)
{
u32 val;
@@ -495,9 +493,9 @@ static inline u32 inl(unsigned long addr)
}
#endif
-#ifndef outb
-#define outb outb
-static inline void outb(u8 value, unsigned long addr)
+#ifndef _outb
+#define _outb _outb
+static inline void _outb(u8 value, unsigned long addr)
{
__io_pbw();
__raw_writeb(value, PCI_IOBASE + addr);
@@ -505,9 +503,9 @@ static inline void outb(u8 value, unsigned long addr)
}
#endif
-#ifndef outw
-#define outw outw
-static inline void outw(u16 value, unsigned long addr)
+#ifndef _outw
+#define _outw _outw
+static inline void _outw(u16 value, unsigned long addr)
{
__io_pbw();
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
@@ -515,9 +513,9 @@ static inline void outw(u16 value, unsigned long addr)
}
#endif
-#ifndef outl
-#define outl outl
-static inline void outl(u32 value, unsigned long addr)
+#ifndef _outl
+#define _outl _outl
+static inline void _outl(u32 value, unsigned long addr)
{
__io_pbw();
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
@@ -525,6 +523,32 @@ static inline void outl(u32 value, unsigned long addr)
}
#endif
+#include <linux/logic_pio.h>
+
+#ifndef inb
+#define inb _inb
+#endif
+
+#ifndef inw
+#define inw _inw
+#endif
+
+#ifndef inl
+#define inl _inl
+#endif
+
+#ifndef outb
+#define outb _outb
+#endif
+
+#ifndef outw
+#define outw _outw
+#endif
+
+#ifndef outl
+#define outl _outl
+#endif
+
#ifndef inb_p
#define inb_p inb_p
static inline u8 inb_p(unsigned long addr)
--
2.12.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/3] logic_pio: Improve macro argument name
2020-03-18 15:55 ` John Garry
(?)
@ 2020-03-18 15:55 ` John Garry
-1 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Macro argument "bw" is used for building byte, word, and long-based
functions. Use "bwl" instead, to include long.
Signed-off-by: John Garry <john.garry@huawei.com>
---
lib/logic_pio.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index f511a99bb389..21dc731bec88 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -229,13 +229,13 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr)
}
#if defined(CONFIG_INDIRECT_PIO) && defined(PCI_IOBASE)
-#define BUILD_LOGIC_IO(bw, type) \
-type logic_in##bw(unsigned long addr) \
+#define BUILD_LOGIC_IO(bwl, type) \
+type logic_in##bwl(unsigned long addr) \
{ \
type ret = (type)~0; \
\
if (addr < MMIO_UPPER_LIMIT) { \
- ret = read##bw(PCI_IOBASE + addr); \
+ ret = read##bwl(PCI_IOBASE + addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -248,10 +248,10 @@ type logic_in##bw(unsigned long addr) \
return ret; \
} \
\
-void logic_out##bw(type value, unsigned long addr) \
+void logic_out##bwl(type value, unsigned long addr) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- write##bw(value, PCI_IOBASE + addr); \
+ write##bwl(value, PCI_IOBASE + addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -263,11 +263,11 @@ void logic_out##bw(type value, unsigned long addr) \
} \
} \
\
-void logic_ins##bw(unsigned long addr, void *buffer, \
- unsigned int count) \
+void logic_ins##bwl(unsigned long addr, void *buffer, \
+ unsigned int count) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- reads##bw(PCI_IOBASE + addr, buffer, count); \
+ reads##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -280,11 +280,11 @@ void logic_ins##bw(unsigned long addr, void *buffer, \
\
} \
\
-void logic_outs##bw(unsigned long addr, const void *buffer, \
- unsigned int count) \
+void logic_outs##bwl(unsigned long addr, const void *buffer, \
+ unsigned int count) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- writes##bw(PCI_IOBASE + addr, buffer, count); \
+ writes##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
--
2.12.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/3] logic_pio: Improve macro argument name
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Macro argument "bw" is used for building byte, word, and long-based
functions. Use "bwl" instead, to include long.
Signed-off-by: John Garry <john.garry@huawei.com>
---
lib/logic_pio.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index f511a99bb389..21dc731bec88 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -229,13 +229,13 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr)
}
#if defined(CONFIG_INDIRECT_PIO) && defined(PCI_IOBASE)
-#define BUILD_LOGIC_IO(bw, type) \
-type logic_in##bw(unsigned long addr) \
+#define BUILD_LOGIC_IO(bwl, type) \
+type logic_in##bwl(unsigned long addr) \
{ \
type ret = (type)~0; \
\
if (addr < MMIO_UPPER_LIMIT) { \
- ret = read##bw(PCI_IOBASE + addr); \
+ ret = read##bwl(PCI_IOBASE + addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -248,10 +248,10 @@ type logic_in##bw(unsigned long addr) \
return ret; \
} \
\
-void logic_out##bw(type value, unsigned long addr) \
+void logic_out##bwl(type value, unsigned long addr) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- write##bw(value, PCI_IOBASE + addr); \
+ write##bwl(value, PCI_IOBASE + addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -263,11 +263,11 @@ void logic_out##bw(type value, unsigned long addr) \
} \
} \
\
-void logic_ins##bw(unsigned long addr, void *buffer, \
- unsigned int count) \
+void logic_ins##bwl(unsigned long addr, void *buffer, \
+ unsigned int count) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- reads##bw(PCI_IOBASE + addr, buffer, count); \
+ reads##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -280,11 +280,11 @@ void logic_ins##bw(unsigned long addr, void *buffer, \
\
} \
\
-void logic_outs##bw(unsigned long addr, const void *buffer, \
- unsigned int count) \
+void logic_outs##bwl(unsigned long addr, const void *buffer, \
+ unsigned int count) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- writes##bw(PCI_IOBASE + addr, buffer, count); \
+ writes##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
--
2.12.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/3] logic_pio: Improve macro argument name
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: linux-arch, John Garry, okaya, linux-kernel, jiaxun.yang,
linuxarm, olof, bhelgaas, linux-arm-kernel
Macro argument "bw" is used for building byte, word, and long-based
functions. Use "bwl" instead, to include long.
Signed-off-by: John Garry <john.garry@huawei.com>
---
lib/logic_pio.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index f511a99bb389..21dc731bec88 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -229,13 +229,13 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr)
}
#if defined(CONFIG_INDIRECT_PIO) && defined(PCI_IOBASE)
-#define BUILD_LOGIC_IO(bw, type) \
-type logic_in##bw(unsigned long addr) \
+#define BUILD_LOGIC_IO(bwl, type) \
+type logic_in##bwl(unsigned long addr) \
{ \
type ret = (type)~0; \
\
if (addr < MMIO_UPPER_LIMIT) { \
- ret = read##bw(PCI_IOBASE + addr); \
+ ret = read##bwl(PCI_IOBASE + addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -248,10 +248,10 @@ type logic_in##bw(unsigned long addr) \
return ret; \
} \
\
-void logic_out##bw(type value, unsigned long addr) \
+void logic_out##bwl(type value, unsigned long addr) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- write##bw(value, PCI_IOBASE + addr); \
+ write##bwl(value, PCI_IOBASE + addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -263,11 +263,11 @@ void logic_out##bw(type value, unsigned long addr) \
} \
} \
\
-void logic_ins##bw(unsigned long addr, void *buffer, \
- unsigned int count) \
+void logic_ins##bwl(unsigned long addr, void *buffer, \
+ unsigned int count) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- reads##bw(PCI_IOBASE + addr, buffer, count); \
+ reads##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -280,11 +280,11 @@ void logic_ins##bw(unsigned long addr, void *buffer, \
\
} \
\
-void logic_outs##bw(unsigned long addr, const void *buffer, \
- unsigned int count) \
+void logic_outs##bwl(unsigned long addr, const void *buffer, \
+ unsigned int count) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- writes##bw(PCI_IOBASE + addr, buffer, count); \
+ writes##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
--
2.12.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/3] logic_pio: Use _inX() and _outX()
2020-03-18 15:55 ` John Garry
(?)
@ 2020-03-18 15:55 ` John Garry
-1 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Use _inX() and _outX(), which include memory barriers which may be
overridden per arch.
Signed-off-by: John Garry <john.garry@huawei.com>
---
lib/logic_pio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index 21dc731bec88..f32fe481b492 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -235,7 +235,7 @@ type logic_in##bwl(unsigned long addr) \
type ret = (type)~0; \
\
if (addr < MMIO_UPPER_LIMIT) { \
- ret = read##bwl(PCI_IOBASE + addr); \
+ ret = _in##bwl(addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -251,7 +251,7 @@ type logic_in##bwl(unsigned long addr) \
void logic_out##bwl(type value, unsigned long addr) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- write##bwl(value, PCI_IOBASE + addr); \
+ _out##bwl(value, addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
--
2.12.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/3] logic_pio: Use _inX() and _outX()
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: okaya, bhelgaas, linux-kernel, linux-arch, linux-arm-kernel,
linuxarm, olof, jiaxun.yang, John Garry
Use _inX() and _outX(), which include memory barriers which may be
overridden per arch.
Signed-off-by: John Garry <john.garry@huawei.com>
---
lib/logic_pio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index 21dc731bec88..f32fe481b492 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -235,7 +235,7 @@ type logic_in##bwl(unsigned long addr) \
type ret = (type)~0; \
\
if (addr < MMIO_UPPER_LIMIT) { \
- ret = read##bwl(PCI_IOBASE + addr); \
+ ret = _in##bwl(addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -251,7 +251,7 @@ type logic_in##bwl(unsigned long addr) \
void logic_out##bwl(type value, unsigned long addr) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- write##bwl(value, PCI_IOBASE + addr); \
+ _out##bwl(value, addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
--
2.12.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/3] logic_pio: Use _inX() and _outX()
@ 2020-03-18 15:55 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-18 15:55 UTC (permalink / raw)
To: xuwei5, arnd
Cc: linux-arch, John Garry, okaya, linux-kernel, jiaxun.yang,
linuxarm, olof, bhelgaas, linux-arm-kernel
Use _inX() and _outX(), which include memory barriers which may be
overridden per arch.
Signed-off-by: John Garry <john.garry@huawei.com>
---
lib/logic_pio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index 21dc731bec88..f32fe481b492 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -235,7 +235,7 @@ type logic_in##bwl(unsigned long addr) \
type ret = (type)~0; \
\
if (addr < MMIO_UPPER_LIMIT) { \
- ret = read##bwl(PCI_IOBASE + addr); \
+ ret = _in##bwl(addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
@@ -251,7 +251,7 @@ type logic_in##bwl(unsigned long addr) \
void logic_out##bwl(type value, unsigned long addr) \
{ \
if (addr < MMIO_UPPER_LIMIT) { \
- write##bwl(value, PCI_IOBASE + addr); \
+ _out##bwl(value, addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \
\
--
2.12.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] io.h, logic_pio: Allow barriers for inX() and outX() be overridden
2020-03-18 15:55 ` John Garry
@ 2020-03-18 16:21 ` Arnd Bergmann
-1 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2020-03-18 16:21 UTC (permalink / raw)
To: John Garry
Cc: xuwei (O),
Sinan Kaya, Bjorn Helgaas, linux-kernel, linux-arch, Linux ARM,
Linuxarm, Olof Johansson, Jiaxun Yang
On Wed, Mar 18, 2020 at 4:59 PM John Garry <john.garry@huawei.com> wrote:
>
> Since commits a7851aa54c0c ("io: change outX() to have their own IO
> barrier overrides") and 87fe2d543f81 ("io: change inX() to have their own
> IO barrier overrides"), the outX() and inX() functions have memory
> barriers which can be overridden per-arch.
>
> However, under CONFIG_INDIRECT_PIO, logic_pio defines its own version of
> inX() and outX(), which still use readb et al. For these, the barrier
> after a raw read is weaker than it otherwise would be.
>
> This series generates consistent behaviour for logic_pio, by defining
> generic _inX() and _outX() in asm-generic/io.h, and using those in
> logic_pio. Generic _inX() and _outX() have per-arch overrideable
> barriers.
>
> The topic was discussed there originally:
> https://lore.kernel.org/lkml/2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com/
>
> A small tidy-up patch is included.
>
> I hope that series can go through the arm-soc tree, as with other recent
> logic_pio changes.
Looks good to me, thanks for the cleanup!
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] io.h, logic_pio: Allow barriers for inX() and outX() be overridden
@ 2020-03-18 16:21 ` Arnd Bergmann
0 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2020-03-18 16:21 UTC (permalink / raw)
To: John Garry
Cc: linux-arch, Sinan Kaya, linux-kernel, Jiaxun Yang, Linuxarm,
Olof Johansson, xuwei (O),
Bjorn Helgaas, Linux ARM
On Wed, Mar 18, 2020 at 4:59 PM John Garry <john.garry@huawei.com> wrote:
>
> Since commits a7851aa54c0c ("io: change outX() to have their own IO
> barrier overrides") and 87fe2d543f81 ("io: change inX() to have their own
> IO barrier overrides"), the outX() and inX() functions have memory
> barriers which can be overridden per-arch.
>
> However, under CONFIG_INDIRECT_PIO, logic_pio defines its own version of
> inX() and outX(), which still use readb et al. For these, the barrier
> after a raw read is weaker than it otherwise would be.
>
> This series generates consistent behaviour for logic_pio, by defining
> generic _inX() and _outX() in asm-generic/io.h, and using those in
> logic_pio. Generic _inX() and _outX() have per-arch overrideable
> barriers.
>
> The topic was discussed there originally:
> https://lore.kernel.org/lkml/2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com/
>
> A small tidy-up patch is included.
>
> I hope that series can go through the arm-soc tree, as with other recent
> logic_pio changes.
Looks good to me, thanks for the cleanup!
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/3] io: Provide _inX() and _outX()
2020-03-18 15:55 ` John Garry
` (2 preceding siblings ...)
(?)
@ 2020-03-18 22:31 ` kbuild test robot
2020-03-19 10:21 ` John Garry
-1 siblings, 1 reply; 17+ messages in thread
From: kbuild test robot @ 2020-03-18 22:31 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 12741 bytes --]
Hi John,
I love your patch! Perhaps something to improve:
[auto build test WARNING on arm-soc/for-next]
[also build test WARNING on linux/master linus/master v5.6-rc6 next-20200318]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/John-Garry/io-h-logic_pio-Allow-barriers-for-inX-and-outX-be-overridden/20200319-040340
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
config: x86_64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project 14a1b80e044aac1947c891525cf30521be0a79b7)
reproduce:
# FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/i915/i915_drv.c:30:
In file included from include/linux/acpi.h:35:
In file included from include/acpi/acpi_io.h:5:
In file included from include/linux/io.h:13:
In file included from arch/x86/include/asm/io.h:375:
>> include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/gpu/drm/i915/i915_drv.c:30:
In file included from include/linux/acpi.h:35:
In file included from include/acpi/acpi_io.h:5:
In file included from include/linux/io.h:13:
In file included from arch/x86/include/asm/io.h:375:
include/asm-generic/io.h:490:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/gpu/drm/i915/i915_drv.c:30:
In file included from include/linux/acpi.h:35:
In file included from include/acpi/acpi_io.h:5:
In file included from include/linux/io.h:13:
In file included from arch/x86/include/asm/io.h:375:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
6 warnings generated.
--
In file included from drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:7:
In file included from include/linux/intel-iommu.h:14:
In file included from include/linux/iova.h:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/x86/include/asm/io.h:375:
>> include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:7:
In file included from include/linux/intel-iommu.h:14:
In file included from include/linux/iova.h:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/x86/include/asm/io.h:375:
include/asm-generic/io.h:490:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:7:
In file included from include/linux/intel-iommu.h:14:
In file included from include/linux/iova.h:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/x86/include/asm/io.h:375:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:1433:22: warning: result of comparison of constant 576460752303423487 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
if (unlikely(remain > N_RELOC(ULONG_MAX)))
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
7 warnings generated.
--
In file included from drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:7:
In file included from include/linux/intel-iommu.h:14:
In file included from include/linux/iova.h:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/x86/include/asm/io.h:375:
>> include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:7:
In file included from include/linux/intel-iommu.h:14:
In file included from include/linux/iova.h:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/x86/include/asm/io.h:375:
include/asm-generic/io.h:490:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:7:
In file included from include/linux/intel-iommu.h:14:
In file included from include/linux/iova.h:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/x86/include/asm/io.h:375:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:1433:22: warning: result of comparison of constant 576460752303423487 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
if (unlikely(remain > N_RELOC(ULONG_MAX)))
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
7 warnings generated.
vim +464 include/asm-generic/io.h
3f7e212df82ca0 Arnd Bergmann 2009-05-13 450
9216efafc52ff9 Thierry Reding 2014-10-01 451 /*
9216efafc52ff9 Thierry Reding 2014-10-01 452 * {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
9216efafc52ff9 Thierry Reding 2014-10-01 453 * implemented on hardware that needs an additional delay for I/O accesses to
9216efafc52ff9 Thierry Reding 2014-10-01 454 * take effect.
9216efafc52ff9 Thierry Reding 2014-10-01 455 */
9216efafc52ff9 Thierry Reding 2014-10-01 456
5ae6dd12ec6d6b John Garry 2020-03-18 457 #ifndef _inb
5ae6dd12ec6d6b John Garry 2020-03-18 458 #define _inb _inb
5ae6dd12ec6d6b John Garry 2020-03-18 459 static inline u16 _inb(unsigned long addr)
9216efafc52ff9 Thierry Reding 2014-10-01 460 {
87fe2d543f8173 Sinan Kaya 2018-04-05 461 u8 val;
87fe2d543f8173 Sinan Kaya 2018-04-05 462
87fe2d543f8173 Sinan Kaya 2018-04-05 463 __io_pbr();
87fe2d543f8173 Sinan Kaya 2018-04-05 @464 val = __raw_readb(PCI_IOBASE + addr);
abbbbc83a210e9 Will Deacon 2019-02-22 465 __io_par(val);
87fe2d543f8173 Sinan Kaya 2018-04-05 466 return val;
9216efafc52ff9 Thierry Reding 2014-10-01 467 }
9216efafc52ff9 Thierry Reding 2014-10-01 468 #endif
9216efafc52ff9 Thierry Reding 2014-10-01 469
:::::: The code at line 464 was first introduced by commit
:::::: 87fe2d543f817300e13f0ea683f38c122737856e io: change inX() to have their own IO barrier overrides
:::::: TO: Sinan Kaya <okaya@codeaurora.org>
:::::: CC: Arnd Bergmann <arnd@arndb.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29003 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/3] io: Provide _inX() and _outX()
2020-03-18 22:31 ` kbuild test robot
@ 2020-03-19 10:21 ` John Garry
0 siblings, 0 replies; 17+ messages in thread
From: John Garry @ 2020-03-19 10:21 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 13880 bytes --]
On 18/03/2020 22:31, kbu
{{{ild test robot wrote:
> Hi John,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on arm-soc/for-next]
> [also build test WARNING on linux/master linus/master v5.6-rc6 next-20200318]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>
> url: https://github.com/0day-ci/linux/commits/John-Garry/io-h-logic_pio-Allow-barriers-for-inX-and-outX-be-overridden/20200319-040340
> base: https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
> config: x86_64-defconfig (attached as .config)
> compiler: clang version 11.0.0 (git://gitmirror/llvm_project 14a1b80e044aac1947c891525cf30521be0a79b7)
> reproduce:
> # FIXME the reproduce steps for clang is not ready yet
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> In file included from drivers/gpu/drm/i915/i915_drv.c:30:
> In file included from include/linux/acpi.h:35:
> In file included from include/acpi/acpi_io.h:5:
> In file included from include/linux/io.h:13:
> In file included from arch/x86/include/asm/io.h:375:
>>> include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __raw_readb(PCI_IOBASE + addr);
I figure that previously x86 would not hit this because it was
surrounded by the #ifndef inb, and inb is defined.
I suppose I can also surround _inb with #ifndef inb, instead of #ifndef
_inb. That will just mean that archs cannot override _inb, not that any do.
Example:
#ifndef inb
static inline u16 _inb(unsigned long addr)
{
u8 val;
__io_pbr();
val = __raw_readb(PCI_IOBASE + addr);
__io_par(val);
return val;
}
#endif
or, as an alternative, have:
val = __raw_readb((void __iomem *)((unsigned long)PCI_IOBASE + addr));
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:477:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr));
> ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
> #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
> ^
> In file included from drivers/gpu/drm/i915/i915_drv.c:30:
> In file included from include/linux/acpi.h:35:
> In file included from include/acpi/acpi_io.h:5:
> In file included from include/linux/io.h:13:
> In file included from arch/x86/include/asm/io.h:375:
> include/asm-generic/io.h:490:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
> ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
> #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
> ^
> In file included from drivers/gpu/drm/i915/i915_drv.c:30:
> In file included from include/linux/acpi.h:35:
> In file included from include/acpi/acpi_io.h:5:
> In file included from include/linux/io.h:13:
> In file included from arch/x86/include/asm/io.h:375:
> include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writeb(value, PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:511:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:521:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> 6 warnings generated.
> --
> In file included from drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:7:
> In file included from include/linux/intel-iommu.h:14:
> In file included from include/linux/iova.h:16:
> In file included from include/linux/dma-mapping.h:11:
> In file included from include/linux/scatterlist.h:9:
> In file included from arch/x86/include/asm/io.h:375:
>>> include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __raw_readb(PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:477:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr));
> ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
> #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
> ^
> In file included from drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:7:
> In file included from include/linux/intel-iommu.h:14:
> In file included from include/linux/iova.h:16:
> In file included from include/linux/dma-mapping.h:11:
> In file included from include/linux/scatterlist.h:9:
> In file included from arch/x86/include/asm/io.h:375:
> include/asm-generic/io.h:490:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
> ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
> #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
> ^
> In file included from drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:7:
> In file included from include/linux/intel-iommu.h:14:
> In file included from include/linux/iova.h:16:
> In file included from include/linux/dma-mapping.h:11:
> In file included from include/linux/scatterlist.h:9:
> In file included from arch/x86/include/asm/io.h:375:
> include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writeb(value, PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:511:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:521:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:1433:22: warning: result of comparison of constant 576460752303423487 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
> if (unlikely(remain > N_RELOC(ULONG_MAX)))
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
> include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
> # define unlikely(x) __builtin_expect(!!(x), 0)
> ^
> 7 warnings generated.
> --
> In file included from drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:7:
> In file included from include/linux/intel-iommu.h:14:
> In file included from include/linux/iova.h:16:
> In file included from include/linux/dma-mapping.h:11:
> In file included from include/linux/scatterlist.h:9:
> In file included from arch/x86/include/asm/io.h:375:
>>> include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __raw_readb(PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:477:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr));
> ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
> #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
> ^
> In file included from drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:7:
> In file included from include/linux/intel-iommu.h:14:
> In file included from include/linux/iova.h:16:
> In file included from include/linux/dma-mapping.h:11:
> In file included from include/linux/scatterlist.h:9:
> In file included from arch/x86/include/asm/io.h:375:
> include/asm-generic/io.h:490:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
> ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
> #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
> ^
> In file included from drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:7:
> In file included from include/linux/intel-iommu.h:14:
> In file included from include/linux/iova.h:16:
> In file included from include/linux/dma-mapping.h:11:
> In file included from include/linux/scatterlist.h:9:
> In file included from arch/x86/include/asm/io.h:375:
> include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writeb(value, PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:511:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:521:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> drivers/gpu//drm/i915/gem/i915_gem_execbuffer.c:1433:22: warning: result of comparison of constant 576460752303423487 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
> if (unlikely(remain > N_RELOC(ULONG_MAX)))
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
> include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
> # define unlikely(x) __builtin_expect(!!(x), 0)
> ^
> 7 warnings generated.
>
> vim +464 include/asm-generic/io.h
>
> 3f7e212df82ca0 Arnd Bergmann 2009-05-13 450
> 9216efafc52ff9 Thierry Reding 2014-10-01 451 /*
> 9216efafc52ff9 Thierry Reding 2014-10-01 452 * {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
> 9216efafc52ff9 Thierry Reding 2014-10-01 453 * implemented on hardware that needs an additional delay for I/O accesses to
> 9216efafc52ff9 Thierry Reding 2014-10-01 454 * take effect.
> 9216efafc52ff9 Thierry Reding 2014-10-01 455 */
> 9216efafc52ff9 Thierry Reding 2014-10-01 456
> 5ae6dd12ec6d6b John Garry 2020-03-18 457 #ifndef _inb
> 5ae6dd12ec6d6b John Garry 2020-03-18 458 #define _inb _inb
> 5ae6dd12ec6d6b John Garry 2020-03-18 459 static inline u16 _inb(unsigned long addr)
> 9216efafc52ff9 Thierry Reding 2014-10-01 460 {
> 87fe2d543f8173 Sinan Kaya 2018-04-05 461 u8 val;
> 87fe2d543f8173 Sinan Kaya 2018-04-05 462
> 87fe2d543f8173 Sinan Kaya 2018-04-05 463 __io_pbr();
> 87fe2d543f8173 Sinan Kaya 2018-04-05 @464 val = __raw_readb(PCI_IOBASE + addr);
> abbbbc83a210e9 Will Deacon 2019-02-22 465 __io_par(val);
> 87fe2d543f8173 Sinan Kaya 2018-04-05 466 return val;
> 9216efafc52ff9 Thierry Reding 2014-10-01 467 }
> 9216efafc52ff9 Thierry Reding 2014-10-01 468 #endif
> 9216efafc52ff9 Thierry Reding 2014-10-01 469
>
> :::::: The code at line 464 was first introduced by commit
> :::::: 87fe2d543f817300e13f0ea683f38c122737856e io: change inX() to have their own IO barrier overrides
>
> :::::: TO: Sinan Kaya <okaya@codeaurora.org>
> :::::: CC: Arnd Bergmann <arnd@arndb.de>
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2020-03-19 10:21 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 15:55 [PATCH 0/3] io.h, logic_pio: Allow barriers for inX() and outX() be overridden John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 15:55 ` [PATCH 1/3] io: Provide _inX() and _outX() John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 22:31 ` kbuild test robot
2020-03-19 10:21 ` John Garry
2020-03-18 15:55 ` [PATCH 2/3] logic_pio: Improve macro argument name John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 15:55 ` [PATCH 3/3] logic_pio: Use _inX() and _outX() John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 15:55 ` John Garry
2020-03-18 16:21 ` [PATCH 0/3] io.h, logic_pio: Allow barriers for inX() and outX() be overridden Arnd Bergmann
2020-03-18 16:21 ` Arnd Bergmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.