From patchwork Mon Jun 18 22:33:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10472755 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE09260532 for ; Mon, 18 Jun 2018 22:33:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D53552841F for ; Mon, 18 Jun 2018 22:33:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C99F728B05; Mon, 18 Jun 2018 22:33:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2306C2841F for ; Mon, 18 Jun 2018 22:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935389AbeFRWdr (ORCPT ); Mon, 18 Jun 2018 18:33:47 -0400 Received: from mail-oi0-f73.google.com ([209.85.218.73]:38016 "EHLO mail-oi0-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935073AbeFRWdq (ORCPT ); Mon, 18 Jun 2018 18:33:46 -0400 Received: by mail-oi0-f73.google.com with SMTP id y123-v6so10712442oie.5 for ; Mon, 18 Jun 2018 15:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:message-id:subject:from:to:cc; bh=0Oa10YrP13cYVIrY5xGdE99dV/MlR+jJk2SVmNfATM0=; b=kJc4HljioPYNgY6QEeK9ramtOw8AEW47kGpDTQZLfSL0h4b4GABx2m6/u7KpChLDDm BISap7w7+eErOtlBNrZLn2m/NfP8nXHlDcczLxp+vcNyiKIGTjfLjn5bdwTrDW6JVUNB wCIqVMV7rZ3uv61RnIIYK0xu6GN/gPjrB96yAUoaC5aJ0haTPP2M8taUbpcBK+4IvRrK 7QS2mmQJZNoHaX4Xvx+AosXG8N+Babhn+igvx799VLHnhHenCLEOiYv5diimdJapv2Az UlRKMlbaj4gEvqKfFpPR+dAixenqDFi7nlRWxPDhwlPOSZ5QiPsEY1W22ckLwuHtwijR XNeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=0Oa10YrP13cYVIrY5xGdE99dV/MlR+jJk2SVmNfATM0=; b=Xep6CEUxYnXg64HZLTsvW7rouz5znXHoj4H7IUy5T4tZPtC/W3akYR97PYgHVj7k3S gy3YE3uzyLSQ3AD3rb2PpVbPlEYsGIw63tgN4pHHBulPQhhFpdaZkETIydo/vqb8Tfob oY26euLu8w8sZZCE4pMks7wMju8nwKghp2AxBWGqGbk+WG+RbehEevGA7CkpzHo0r+Fr 7wq7IRjzGm7QTRitMpUaR6KQsWgc2V+Ozc7uhHXa7LvtPsuxAOQMDsUqpyemaA0lUKpE hdAfyr0P44bpLNTgJ1Yu00tTiS6tLPSg5Dv9PEyEh7/GNHEvKYnOHTzZr1WFZ07/7LAn U1Vg== X-Gm-Message-State: APt69E34XnGvSxc4ufMRSvHbEpjDDt17RyAD8wQiUlZC6FVyqkJ6G/oM PSQ2oZSE90Zg+lp32MMZVe5LvMmZbvKwLY7yvAkzeO6ZR0kJYkrSHNaQxeP0n7tq3P32XjMxM4Y 5X89q+iuPAKK9Bc/FtRI38Z8EEryUGqNJJKWk/V4K4hOdmO+5rU7z4CP5dJouI1+PkqQbjGhb5r w= X-Google-Smtp-Source: ADUXVKJ0Ilmj8j8kU7798O9QX3EPB/t0ikmsO72v9F5VsmzIO4h6lgwZXumr4zgWxsRf3zlCpniMvommf2+S3Q== MIME-Version: 1.0 X-Received: by 2002:aca:3956:: with SMTP id g83-v6mr6712803oia.67.1529361225764; Mon, 18 Jun 2018 15:33:45 -0700 (PDT) Date: Mon, 18 Jun 2018 15:33:23 -0700 Message-Id: <20180618223323.130072-1-ebiggers@google.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog Subject: [PATCH] crypto: arm/speck - fix building in Thumb2 mode From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Stefan Agner , Eric Biggers Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Building the kernel with CONFIG_THUMB2_KERNEL=y and CONFIG_CRYPTO_SPECK_NEON set fails with the following errors: arch/arm/crypto/speck-neon-core.S: Assembler messages: arch/arm/crypto/speck-neon-core.S:419: Error: r13 not allowed here -- `bic sp,#0xf' arch/arm/crypto/speck-neon-core.S:423: Error: r13 not allowed here -- `bic sp,#0xf' arch/arm/crypto/speck-neon-core.S:427: Error: r13 not allowed here -- `bic sp,#0xf' arch/arm/crypto/speck-neon-core.S:431: Error: r13 not allowed here -- `bic sp,#0xf' The problem is that the 'bic' instruction can't operate on the 'sp' register in Thumb2 mode. Fix it by using a temporary register. This isn't in the main loop, so the performance difference is negligible. This also matches what aes-neonbs-core.S does. Reported-by: Stefan Agner Fixes: ede9622162fa ("crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS") Signed-off-by: Eric Biggers Acked-by: Ard Biesheuvel Reviewed-by: Stefan Agner --- arch/arm/crypto/speck-neon-core.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/crypto/speck-neon-core.S b/arch/arm/crypto/speck-neon-core.S index 3c1e203e53b9..57caa742016e 100644 --- a/arch/arm/crypto/speck-neon-core.S +++ b/arch/arm/crypto/speck-neon-core.S @@ -272,9 +272,11 @@ * Allocate stack space to store 128 bytes worth of tweaks. For * performance, this space is aligned to a 16-byte boundary so that we * can use the load/store instructions that declare 16-byte alignment. + * For Thumb2 compatibility, don't do the 'bic' directly on 'sp'. */ - sub sp, #128 - bic sp, #0xf + sub r12, sp, #128 + bic r12, #0xf + mov sp, r12 .if \n == 64 // Load first tweak