diff mbox

[08/10] arch: introduce strict_ioremap

Message ID 20150720001817.30857.69287.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams July 20, 2015, 12:18 a.m. UTC
In preparation for enabling memremap(), add support for strict mappings.
strict_ioremap_<type>() returns NULL if the arch does not implement the
mapping type, rather than falling back silently to ioremap().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 include/linux/io.h |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Christoph Hellwig July 21, 2015, 1:30 p.m. UTC | #1
On Sun, Jul 19, 2015 at 08:18:17PM -0400, Dan Williams wrote:
> In preparation for enabling memremap(), add support for strict mappings.
> strict_ioremap_<type>() returns NULL if the arch does not implement the
> mapping type, rather than falling back silently to ioremap().

Please don't introduce another large number of ioremap variants.

I think we should go straight to the ioremap_flags variant, although
I wonder if we should even bother with ioremap_flags for this use
case, given that we really want memremap-like semantics for anything
that isn't plain ioremap (and maybe ioremap_nocache).

Sorry or being the downer, but I really think we need to clean up this
mess deeply insted of trying to paper over it.
Dan Williams July 21, 2015, 4:11 p.m. UTC | #2
On Tue, Jul 21, 2015 at 6:30 AM, Christoph Hellwig <hch@lst.de> wrote:
> On Sun, Jul 19, 2015 at 08:18:17PM -0400, Dan Williams wrote:
>> In preparation for enabling memremap(), add support for strict mappings.
>> strict_ioremap_<type>() returns NULL if the arch does not implement the
>> mapping type, rather than falling back silently to ioremap().
>
> Please don't introduce another large number of ioremap variants.
>
> I think we should go straight to the ioremap_flags variant, although
> I wonder if we should even bother with ioremap_flags for this use
> case, given that we really want memremap-like semantics for anything
> that isn't plain ioremap (and maybe ioremap_nocache).
>
> Sorry or being the downer, but I really think we need to clean up this
> mess deeply insted of trying to paper over it.

No worries.  I'll rework the series around the idea that memremap() is
a replacement rather than a wrapper for ioremap_<type>().
diff mbox

Patch

diff --git a/include/linux/io.h b/include/linux/io.h
index 58482241c95c..080a4fbf2ba4 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -130,6 +130,27 @@  static inline void __iomem *ioremap_uc(resource_size_t offset,
 }
 #endif
 
+static inline void __iomem *strict_ioremap_cache(resource_size_t offset,
+		unsigned long size)
+{
+#ifdef ioremap_cache
+	return ioremap_cache(offset, size);
+#else
+	return (void __force __iomem *) NULL;
+#endif
+}
+
+static inline void __iomem *strict_ioremap_wt(resource_size_t offset,
+		unsigned long size)
+{
+#ifdef ioremap_wt
+	return ioremap_wt(offset, size);
+#else
+	return (void __force __iomem *) NULL;
+#endif
+}
+
+
 /*
  * Some systems do not have legacy ISA devices.
  * /dev/port is not a valid interface on these systems.