Replace the following fs/Kconfig:FS_DAX dependency:

  depends on !(ARM || MIPS || SPARC)

By a runtime check within alloc_dax().

This is done in preparation for its use by each filesystem supporting
the "dax" mount option to validate whether DAX is indeed supported.

This is done in preparation for using cpu_dcache_is_aliasing() in a
following change which will properly support architectures which detect
data cache aliasing at runtime.

Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing 
caches")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: linux...@kvack.org
Cc: linux-a...@vger.kernel.org
Cc: Dan Williams <dan.j.willi...@intel.com>
Cc: Vishal Verma <vishal.l.ve...@intel.com>
Cc: Dave Jiang <dave.ji...@intel.com>
Cc: Matthew Wilcox <wi...@infradead.org>
Cc: Arnd Bergmann <a...@arndb.de>
Cc: Russell King <li...@armlinux.org.uk>
Cc: nvd...@lists.linux.dev
Cc: linux-...@vger.kernel.org
Cc: linux-fsde...@vger.kernel.org
Cc: dm-devel@lists.linux.dev
---
 drivers/dax/super.c | 6 ++++++
 fs/Kconfig          | 1 -
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 0da9232ea175..e9f397b8a5a3 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -445,6 +445,12 @@ 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. */
+       if (IS_ENABLED(CONFIG_ARM) ||
+           IS_ENABLED(CONFIG_MIPS) ||
+           IS_ENABLED(CONFIG_SPARC))
+               return NULL;
+
        if (WARN_ON_ONCE(ops && !ops->zero_page_range))
                return ERR_PTR(-EINVAL);
 
diff --git a/fs/Kconfig b/fs/Kconfig
index 42837617a55b..e5efdb3b276b 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -56,7 +56,6 @@ endif # BLOCK
 config FS_DAX
        bool "File system based Direct Access (DAX) support"
        depends on MMU
-       depends on !(ARM || MIPS || SPARC)
        depends on ZONE_DEVICE || FS_DAX_LIMITED
        select FS_IOMAP
        select DAX
-- 
2.39.2


Reply via email to