Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1493965ybj; Fri, 20 Sep 2019 11:24:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmcR1SiKBoXALpVRxkkvJ7DoV4C6nXyzjLsoF75mj5bcS+v6bKItK/u+0wiLpSN523fDDk X-Received: by 2002:aa7:d692:: with SMTP id d18mr13974770edr.95.1569003849111; Fri, 20 Sep 2019 11:24:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569003849; cv=none; d=google.com; s=arc-20160816; b=tq5wEmcosDAaTjkRk4/8Hi1Oh5y50F+YamwF21CCiyV84nJWuYWcwIbXmTzlMKhj5p GoTZLrQuFLVgJ5NbQPudmqjXMHgxSl8bEwXdWWZAZpPU+TxdezVFCyZUDMGWJOzbrY35 QTSfFqDonnBJT1j/liFXWdFISSY2i8UGwJfqaXmHJ4lWgyUHa8OMMiQDqbhNheUmsz/s WWyoJczTJtwfvSTxNNlm4ApxJRYtXjR7GzrSu+XOcfD7rjk+eFksiSGF1XfdzU2tzUi1 X34y8icwJDi9+Wuu7k/V2i9DWCZE8OlUX4Vy1uBi4yzqfPaN+gvXVRUe8luk4AMADTFb kjEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=IQGr6F9qquEV7+ubWXtYHIkbCqEQKmuV3d7K3fHGOCw=; b=iuzG3rV53/whWwhvwiMNX54S22Jh7e8g3fQZY5h2SiW3D/3/z3eFACRips5w2IObCf QzFjhXuUxfnNdA0kpjq/AL7jd1U8+MEsml/KTIDzw9DJ43IikGYmfKoBrjhdqwDvrZ2w wLfo9khIW+rxqMcfMmqVHOyAHSHXxKSJEAvBrnBMH0GNpEW7Ivfk0UZt9xkFlVKrViBi 33imZwKNLgyvQBRMK5APq0n+DLpEjuRCmxo3RBjqIU4ihrqr8QeDq7QyjoZdfXoSrqXJ Lc4JIxLiFJicwLMfs/6MULckEyWncrTd6sli9xFJze8wZS4rRTTkzVkVhKfWwR+qxrHw o9Uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si1941697edb.346.2019.09.20.11.23.36; Fri, 20 Sep 2019 11:24:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405197AbfITIdu (ORCPT + 99 others); Fri, 20 Sep 2019 04:33:50 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:49788 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404945AbfITIdu (ORCPT ); Fri, 20 Sep 2019 04:33:50 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 526151DA269D57266B53; Fri, 20 Sep 2019 16:33:48 +0800 (CST) Received: from [127.0.0.1] (10.202.227.179) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Fri, 20 Sep 2019 16:33:39 +0800 Subject: Re: [PATCH 2/2] [v2] crypto: hisilicon - allow compile-testing on x86 To: Arnd Bergmann , Herbert Xu , "David S. Miller" , Zhou Wang References: <20190919140650.1289963-2-arnd@arndb.de> <20190919140917.1290556-1-arnd@arndb.de> CC: Jonathan Cameron , Kenneth Lee , Mao Wenan , Hao Fang , Shiju Jose , , From: John Garry Message-ID: Date: Fri, 20 Sep 2019 09:33:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20190919140917.1290556-1-arnd@arndb.de> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.179] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 19/09/2019 15:09, Arnd Bergmann wrote: > 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 nit: spelling mistake > writeq(). > > Signed-off-by: Arnd Bergmann > --- > v2: actually add !CPU_BIG_ENDIAN dependency as described in the > changelog > --- > drivers/crypto/hisilicon/Kconfig | 9 ++++++--- > drivers/crypto/hisilicon/qm.c | 6 ++++++ > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/crypto/hisilicon/Kconfig b/drivers/crypto/hisilicon/Kconfig > index ebaf91e0146d..7bfcaa7674fd 100644 > --- a/drivers/crypto/hisilicon/Kconfig > +++ b/drivers/crypto/hisilicon/Kconfig > @@ -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 > diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c > index f975c393a603..a8ed699081b7 100644 > --- a/drivers/crypto/hisilicon/qm.c > +++ b/drivers/crypto/hisilicon/qm.c > @@ -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; > Hi Arnd, > + 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" > As I understand, this operation needs to be done atomically. So - even though your change is just for compile testing - the memcpy_to_io() may not do the same thing on other archs, right? I just wonder if it's right to make that change, or at least warn the imaginary user of possible malfunction for !arm64. Thanks, John