From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6E14C77B70 for ; Fri, 14 Apr 2023 08:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=rUxw2i8ZIcRFFxm5ljErWAqYi4zNV6vjhwAMfxIeiXI=; b=BHdeE1nr2L3jIv bs7mljCVtmmqtTSSksk+Sf8TLlRF040kTXsePLtT0DlRasbSb3bjb7cR+l+PqLaWJ1Z4OEsp8tgvh bGSpRt5biIlTNI2K6kSXUigTtg+1OoCCmJnoN9fJKXiqaEBckfcBErssWVwaiYtlXpAZKAFnkhwg1 q1u20y+TAH+HdpZhSTkRGll/4yGPQm1hrme4Eg51JE/NUIgnKzKGDZUDnt7vbh2P8qUfizNGZ6V5Z BpnwVQhbonGLB5067PXHJZ8jbowaRXb6rXuEv9zjbK3F0c9rdWXe+Jeg+U90i7sWdpKXUH3RWj2pR 6TpRMj7zuWo1ZX8mADMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pnESm-008dUC-05; Fri, 14 Apr 2023 08:07:20 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pnESi-008dTe-2b for linux-arm-kernel@lists.infradead.org; Fri, 14 Apr 2023 08:07:18 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48D0F614C6; Fri, 14 Apr 2023 08:07:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24FEEC433D2; Fri, 14 Apr 2023 08:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681459635; bh=CMhlV7gPjxolgtoBHwxReUD4SNxzZsVia1mEu5DPBd8=; h=From:To:Cc:Subject:Date:From; b=uABKpT3UCvTTNEsfJZpyjJBkygzHhGJQja6hX0ABRo3ZqRlS5uvNVlZFDkeNBkODp otvcfYNuh5ilBkLyOcNItBbWSMahvv2QXfZr797hemQq9CMMIAWj38JQH8YderAKqR sO6P/HMzoBSFL/erIvEGazK5Sz4CT/bQdL5ou1qDI503nuLI1F734X9l4lJx+GkrH8 E46a+sPrkwchkLNtJsm+bRvr+0bOnKVL2kW52GfGvMG4J3wnfIpUe/sCIO5MCOiOXV czagPpNjp7NFkphzMdAOFXugeRxgOOrwECN3vAsxfc16HFcG4FF6BdZ0i5mGZ6lDre BnDVmWVbfjsOA== From: Arnd Bergmann To: Linus Walleij , Imre Kaloz , Krzysztof Halasa , Corentin Labbe , Herbert Xu , "David S. Miller" , Tom Zanussi Cc: Arnd Bergmann , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ixp4xx_crypto: fix building wiht 64-bit dma_addr_t Date: Fri, 14 Apr 2023 10:06:56 +0200 Message-Id: <20230414080709.284005-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230414_010716_961029_EADEB79B X-CRM114-Status: GOOD ( 19.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann The crypt_ctl structure must be exactly 64 bytes long to work correctly, and it has to be a power-of-two size to allow turning the 64-bit division in crypt_phys2virt() into a shift operation, avoiding the link failure: ERROR: modpost: "__aeabi_uldivmod" [drivers/crypto/intel/ixp4xx/ixp4xx_crypto.ko] undefined! The failure now shows up because the driver is available for compile testing after the move, and a previous fix turned the more descriptive BUILD_BUG_ON() into a link error. Change the variably-sized dma_addr_t into the expected 'u32' type that is needed for the hardware, and reinstate the size check for all 32-bit architectures to simplify debugging if it hits again. Fixes: 1bc7fdbf2677 ("crypto: ixp4xx - Move driver to drivers/crypto/intel/ixp4xx") Signed-off-by: Arnd Bergmann --- drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c index 5d640f13ad1c..ed15379a9818 100644 --- a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c +++ b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c @@ -118,9 +118,9 @@ struct crypt_ctl { u8 mode; /* NPE_OP_* operation mode */ #endif u8 iv[MAX_IVLEN]; /* IV for CBC mode or CTR IV for CTR mode */ - dma_addr_t icv_rev_aes; /* icv or rev aes */ - dma_addr_t src_buf; - dma_addr_t dst_buf; + u32 icv_rev_aes; /* icv or rev aes */ + u32 src_buf; + u32 dst_buf; #ifdef __ARMEB__ u16 auth_offs; /* Authentication start offset */ u16 auth_len; /* Authentication data length */ @@ -263,7 +263,8 @@ static int setup_crypt_desc(void) { struct device *dev = &pdev->dev; - BUILD_BUG_ON(!IS_ENABLED(CONFIG_COMPILE_TEST) && + BUILD_BUG_ON(!(IS_ENABLED(CONFIG_COMPILE_TEST) && + IS_ENABLED(CONFIG_64BIT)) && sizeof(struct crypt_ctl) != 64); crypt_virt = dma_alloc_coherent(dev, NPE_QLEN * sizeof(struct crypt_ctl), @@ -1170,10 +1171,11 @@ static int aead_perform(struct aead_request *req, int encrypt, } if (unlikely(lastlen < authsize)) { + dma_addr_t dma; /* The 12 hmac bytes are scattered, * we need to copy them into a safe buffer */ - req_ctx->hmac_virt = dma_pool_alloc(buffer_pool, flags, - &crypt->icv_rev_aes); + req_ctx->hmac_virt = dma_pool_alloc(buffer_pool, flags, &dma); + crypt->icv_rev_aes = dma; if (unlikely(!req_ctx->hmac_virt)) goto free_buf_dst; if (!encrypt) { -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel