Skip to contentSkip to conversation

remoteproc: guard wc-ioremap helpers with HAS_IOMEM

PATCH In review Ben Levinsky 2 participants 2 messages Jun 30 – Jul 1 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: guard wc-ioremap helpers with HAS_IOMEM

The common wc-ioremap carveout callbacks live in remoteproc_internal.h, which is included by the remoteproc core. This means the helper bodies are parsed even for builds that do not enable any platform driver using those callbacks.

On s390, CONFIG_HAS_IOMEM and CONFIG_GENERIC_IOREMAP depend on CONFIG_PCI. A randconfig with CONFIG_REMOTEPROC=y and CONFIG_PCI=n therefore has no usable ioremap_wc() or iounmap() declarations, and fails to build the common remoteproc objects with implicit declarations from the helper bodies.

Only include linux/io.h and build the real wc-ioremap helpers when CONFIG_HAS_IOMEM is enabled. Provide no-IOMEM stubs so the internal header remains self-contained for randconfig and COMPILE_TEST coverage.

Fixes 50227acbf4e5 ("remoteproc: Add common wc-ioremap carveout callbacks")
drivers/remoteproc/remoteproc_internal.h +16 -0
index 02c00475b010..3a742ef6ef60 100644
@@ -14,7 +14,9 @@
 
 #include <linux/irqreturn.h>
 #include <linux/firmware.h>
+#ifdef CONFIG_HAS_IOMEM
 #include <linux/io.h>
+#endif
 
 struct rproc;
 
@@ -123,6 +125,7 @@ rproc_find_carveout_by_name(struct rproc *rproc, const char *name, ...);
 void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev);
 void rproc_remove_rvdev(struct rproc_vdev *rvdev);
 
+#ifdef CONFIG_HAS_IOMEM
 static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
 					     struct rproc_mem_entry *mem)
 {
@@ -148,6 +151,19 @@ static inline int rproc_mem_entry_iounmap(struct rproc *rproc,
 
 	return 0;
 }
+#else
+static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
+					     struct rproc_mem_entry *mem)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int rproc_mem_entry_iounmap(struct rproc *rproc,
+					  struct rproc_mem_entry *mem)
+{
+	return 0;
+}
+#endif
 
 #define rproc_elf_load_rsc_table_optional(rproc, fw, dev_func, fmt, ...)	\
 	({									\
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 12 lines · Ben Levinsky

The common wc-ioremap carveout callbacks live in remoteproc_internal.h, which is included by the remoteproc core. This means the helper bodies are parsed even for builds that do not enable any platform driver using those callbacks.

On s390, CONFIG_HAS_IOMEM and CONFIG_GENERIC_IOREMAP depend on CONFIG_PCI. A randconfig with CONFIG_REMOTEPROC=y and CONFIG_PCI=n therefore has no usable ioremap_wc() or iounmap() declarations, and fails to build the common remoteproc objects with implicit declarations from the helper bodies.

Quoted 9 lines

Only include linux/io.h and build the real wc-ioremap helpers when CONFIG_HAS_IOMEM is enabled. Provide no-IOMEM stubs so the internal header remains self-contained for randconfig and COMPILE_TEST coverage.

Fixes 50227acbf4e5 ("remoteproc: Add common wc-ioremap carveout callbacks")

Applied - let's see if that satisfies the bot.

Thanks,
Mathieu

Quoted 45 lines
drivers/remoteproc/remoteproc_internal.h +16 -1
index 02c00475b010..3a742ef6ef60 100644
@@ -14,7 +14,9 @@
 
 #include <linux/irqreturn.h>
 #include <linux/firmware.h>
+#ifdef CONFIG_HAS_IOMEM
 #include <linux/io.h>
+#endif
 
 struct rproc;
 
@@ -123,6 +125,7 @@ rproc_find_carveout_by_name(struct rproc *rproc, const char *name, ...);
 void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev);
 void rproc_remove_rvdev(struct rproc_vdev *rvdev);
 
+#ifdef CONFIG_HAS_IOMEM
 static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
                                             struct rproc_mem_entry *mem)
 {
@@ -148,6 +151,19 @@ static inline int rproc_mem_entry_iounmap(struct rproc *rproc,
 
        return 0;
 }
+#else
+static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
+                                            struct rproc_mem_entry *mem)
+{
+       return -EOPNOTSUPP;
+}
+
+static inline int rproc_mem_entry_iounmap(struct rproc *rproc,
+                                         struct rproc_mem_entry *mem)
+{
+       return 0;
+}
+#endif
 
 #define rproc_elf_load_rsc_table_optional(rproc, fw, dev_func, fmt, ...)       \
        ({                                                                      \
--

2.34.1