dax: check for data cache aliasing at runtime
[linux-2.6-microblaze.git] / drivers / dax / super.c
index 97ef2a9..7643b1a 100644 (file)
@@ -451,6 +451,16 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
        dev_t devt;
        int minor;
 
+       /*
+        * Unavailable on architectures with virtually aliased data caches,
+        * except for device-dax (NULL operations pointer), which does
+        * not use aliased mappings from the kernel.
+        */
+       if (ops && (IS_ENABLED(CONFIG_ARM) ||
+           IS_ENABLED(CONFIG_MIPS) ||
+           IS_ENABLED(CONFIG_SPARC)))
+               return ERR_PTR(-EOPNOTSUPP);
+
        if (WARN_ON_ONCE(ops && !ops->zero_page_range))
                return ERR_PTR(-EINVAL);