]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
crypto: hisilicon - allow compile-testing on x86
authorArnd Bergmann <arnd@arndb.de>
Thu, 19 Sep 2019 14:09:06 +0000 (16:09 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 4 Oct 2019 15:06:19 +0000 (01:06 +1000)
To avoid missing arm64 specific warnings that get introduced
in this driver, allow compile-testing on all 64-bit architectures.

The only actual arm64 specific code in this driver is an open-
coded 128 bit MMIO write. On non-arm64 the same can be done
using memcpy_toio. What I also noticed is that the mmio store
(either one) is not endian-safe, this will only work on little-
endian configurations, so I also add a Kconfig dependency on
that, regardless of the architecture.
Finally, a depenndecy on CONFIG_64BIT is needed because of the
writeq().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/Kconfig
drivers/crypto/hisilicon/qm.c

index ebaf91e0146d17058e2ae8d344fdfda03044880b..7bfcaa7674fdc880b0ae430d2a962718aaa7ef66 100644 (file)
@@ -16,14 +16,15 @@ config CRYPTO_DEV_HISI_SEC
 
 config CRYPTO_DEV_HISI_QM
        tristate
-       depends on ARM64 && PCI && PCI_MSI
+       depends on ARM64 || COMPILE_TEST
+       depends on PCI && PCI_MSI
        help
          HiSilicon accelerator engines use a common queue management
          interface. Specific engine driver may use this module.
 
 config CRYPTO_HISI_SGL
        tristate
-       depends on ARM64
+       depends on ARM64 || COMPILE_TEST
        help
          HiSilicon accelerator engines use a common hardware scatterlist
          interface for data format. Specific engine driver may use this
@@ -31,7 +32,9 @@ config CRYPTO_HISI_SGL
 
 config CRYPTO_DEV_HISI_ZIP
        tristate "Support for HiSilicon ZIP accelerator"
-       depends on ARM64 && PCI && PCI_MSI
+       depends on PCI && PCI_MSI
+       depends on ARM64 || (COMPILE_TEST && 64BIT)
+       depends on !CPU_BIG_ENDIAN || COMPILE_TEST
        select CRYPTO_DEV_HISI_QM
        select CRYPTO_HISI_SGL
        select SG_SPLIT
index f975c393a6037fb071f3e71e17de5e239f784349..a8ed699081b7fa225ee5144cb9c354c58fab5103 100644 (file)
@@ -331,6 +331,12 @@ static void qm_mb_write(struct hisi_qm *qm, const void *src)
        void __iomem *fun_base = qm->io_base + QM_MB_CMD_SEND_BASE;
        unsigned long tmp0 = 0, tmp1 = 0;
 
+       if (!IS_ENABLED(CONFIG_ARM64)) {
+               memcpy_toio(fun_base, src, 16);
+               wmb();
+               return;
+       }
+
        asm volatile("ldp %0, %1, %3\n"
                     "stp %0, %1, %2\n"
                     "dsb sy\n"