Skip to contentSkip to conversation

s390: provide default ioremap and iounmap declaration

PATCH Superseded Logan Gunthorpe 3 participants 4 messages May 25, 2017 – May 29, 2017 s390

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390: provide default ioremap and iounmap declaration

Add a default ioremap function which was not provided in all circumstances. (Only when CONFIG_PCI was set).

I have designs to use them in scatterlist.c where they'd likely never be called without CONFIG_PCI set, but it is needed to compile. Thus, if the function is ever hit it returns NULL.

Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Al Viro <[email protected]>

---

Thanks to Al Viro for pointing out this corner case in s390.

 arch/s390/include/asm/io.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/s390/include/asm/io.h +11 -0
index 437e9af..f4140d4 100644
@@ -73,6 +73,17 @@ static inline void ioport_unmap(void __iomem *p)
 #define __raw_writel	zpci_write_u32
 #define __raw_writeq	zpci_write_u64
 
+#else
+
+static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
+{
+	return NULL;
+}
+
+static inline void iounmap(void __iomem *addr)
+{
+}
+
 #endif /* CONFIG_PCI */
 
 #include <asm-generic/io.h>

--
2.1.4

#1 lore raw
Quoted 28 lines · Logan Gunthorpe

Add a default ioremap function which was not provided in all circumstances. (Only when CONFIG_PCI was set).

I have designs to use them in scatterlist.c where they'd likely never be called without CONFIG_PCI set, but it is needed to compile. Thus, if the function is ever hit it returns NULL.

Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Al Viro <[email protected]>

---

Thanks to Al Viro for pointing out this corner case in s390.

 arch/s390/include/asm/io.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/s390/include/asm/io.h +2 -0
index 437e9af..f4140d4 100644
@@ -73,6 +73,17 @@ static inline void ioport_unmap(void __iomem *p)
 #define __raw_writel	zpci_write_u32
 #define __raw_writeq	zpci_write_u64
 
+#else
+

arch/s390/include/asm/io.h static inline void ioport_unmap(void __iomem *p) · line 87

Quoted 10 lines
arch/s390/include/asm/io.h +9 -0
+static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
+{
+	return NULL;
+}
+
+static inline void iounmap(void __iomem *addr)
+{
+}
+
 #endif /* CONFIG_PCI */

I'd rather move the #ifdef CONFIG_PCI than implementing this yet another time (see patch below). But I'll leave that up to Sebastian.

arch/s390/include/asm/io.h +2 -2
index 437e9af96688..904e4b3af95d 100644
@@ -25,8 +25,6 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
 
 #define IO_SPACE_LIMIT 0
 
-#ifdef CONFIG_PCI
-
 #define ioremap_nocache(addr, size)	ioremap(addr, size)
 #define ioremap_wc			ioremap_nocache
 #define ioremap_wt			ioremap_nocache
@@ -49,6 +47,8 @@ static inline void ioport_unmap(void __iomem *p)
 {
 }
 
+#ifdef CONFIG_PCI
+
 /*
  * s390 needs a private implementation of pci_iomap since ioremap with its
  * offset parameter isn't sufficient. That's because BAR spaces are not
#2 lore raw
Quoted 3 lines · Heiko Carstens

On Thu, May 25, 2017 at 09:43:48AM -0600, Logan Gunthorpe wrote:
I'd rather move the #ifdef CONFIG_PCI than implementing this yet another time (see patch below). But I'll leave that up to Sebastian.

I'd be more than happy with this change. Let me know if you want me to resubmit a patch that looks like that.

Thanks,

Logan

Quoted 23 lines
arch/s390/include/asm/io.h +2 -2
index 437e9af96688..904e4b3af95d 100644
@@ -25,8 +25,6 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
 
 #define IO_SPACE_LIMIT 0
 
-#ifdef CONFIG_PCI
-
 #define ioremap_nocache(addr, size)	ioremap(addr, size)
 #define ioremap_wc			ioremap_nocache
 #define ioremap_wt			ioremap_nocache
@@ -49,6 +47,8 @@ static inline void ioport_unmap(void __iomem *p)
 {
 }
 
+#ifdef CONFIG_PCI
+
 /*
  * s390 needs a private implementation of pci_iomap since ioremap with its
  * offset parameter isn't sufficient. That's because BAR spaces are not
#3 lore raw

Hi,

Quoted 4 lines · Logan Gunthorpe
Quoted 3 lines · Heiko Carstens

On Thu, May 25, 2017 at 09:43:48AM -0600, Logan Gunthorpe wrote:
I'd rather move the #ifdef CONFIG_PCI than implementing this yet another time (see patch below). But I'll leave that up to Sebastian.

Yes I've had prepared the same patch because of build failures in linux-next due to this commit (linux-next commit id)
db1534d linux/io.h: Add pci_remap_cfgspace() interface

But I'd never send it because this commit was changed to add #ifdef CONFIG_PCI.

Quoted 2 lines

I'd be more than happy with this change. Let me know if you want me to resubmit a patch that looks like that.

Yes please do. I'll Ack it.

Thanks,
Sebastian