From patchwork Fri Mar 28 11:05:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 27253 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DBE0F20062 for ; Fri, 28 Mar 2014 11:06:01 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wp18sf17133752obc.0 for ; Fri, 28 Mar 2014 04:06:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=w2aATohlnWloM3aUb8GGXF6hXrZH65DxQimUtHYujJc=; b=V6jTdjcwNiJVejVP2S6c1IGa0bfxLpn1HO7Z+S/yp/xuAIvy/dcSc7HN2LoCx9310R 7YFc/cmtA90/s5Ut/ZqA7XZTn9ik/exwe2gLVw2B00WaLSmY18h8AbeucZGXbT/Rmz+d CnrQYrbMsAOl+XNJvGTBB7mlLu4uCDmKgO+eINTcD6NO6u+J+H/W9reQL6ggS2rOgbpm myU2OC8QO+Iwqm/mawi1lwUUVP0RwrWK5gfv+ggNd0QswBGnR2DBnVHWd7cl4qCS1p2C zEX+mRNaNa/TIs4Fl/vaY/Tr38RlDF2Gm+3OFceqyavpW9h41Yf8zCGdmR3W4491mVLM QurA== X-Gm-Message-State: ALoCoQkWkGoOmXhAUX6B+99ovVX3OwUyOZku+1M84gG0VqvIVS5OjeKpdy2T++9YNHrawBquiSvh X-Received: by 10.43.78.135 with SMTP id zm7mr2707738icb.27.1396004761013; Fri, 28 Mar 2014 04:06:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.40 with SMTP id 37ls1456741qgk.32.gmail; Fri, 28 Mar 2014 04:06:00 -0700 (PDT) X-Received: by 10.221.29.137 with SMTP id ry9mr6681606vcb.6.1396004760911; Fri, 28 Mar 2014 04:06:00 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id wg4si1186252vcb.38.2014.03.28.04.06.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:06:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so5570940vcb.5 for ; Fri, 28 Mar 2014 04:06:00 -0700 (PDT) X-Received: by 10.52.147.238 with SMTP id tn14mr5567750vdb.23.1396004760380; Fri, 28 Mar 2014 04:06:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp26116vck; Fri, 28 Mar 2014 04:05:59 -0700 (PDT) X-Received: by 10.180.205.204 with SMTP id li12mr11579344wic.34.1396004759463; Fri, 28 Mar 2014 04:05:59 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id fg5si1641598wib.120.2014.03.28.04.05.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Mar 2014 04:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTUba-0001qN-2I; Fri, 28 Mar 2014 11:05:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTUbX-00019W-Fp; Fri, 28 Mar 2014 11:05:43 +0000 Received: from mail-wg0-f47.google.com ([74.125.82.47]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTUbU-00018t-U9 for linux-arm-kernel@lists.infradead.org; Fri, 28 Mar 2014 11:05:41 +0000 Received: by mail-wg0-f47.google.com with SMTP id x12so3385185wgg.6 for ; Fri, 28 Mar 2014 04:05:17 -0700 (PDT) X-Received: by 10.180.12.115 with SMTP id x19mr46646296wib.19.1396004717353; Fri, 28 Mar 2014 04:05:17 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id i9sm6092500wiy.17.2014.03.28.04.05.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:05:16 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com Subject: [PATCH RFC 1/3] arm64/crypto: add shared macro to test for NEED_RESCHED Date: Fri, 28 Mar 2014 12:05:33 +0100 Message-Id: <1396004735-15475-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1396004735-15475-1-git-send-email-ard.biesheuvel@linaro.org> References: <1396004735-15475-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140328_070541_064586_83406B92 X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.47 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: marex@denx.de, steve.capper@linaro.org, Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This adds arch/arm64/crypto/preempt.h, currently containing just a single asm macro definition 'b_if_no_resched' that will be shared between multiple crypto algorithm implementations that need to test for preemption in the inner loop. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/preempt.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 arch/arm64/crypto/preempt.h diff --git a/arch/arm64/crypto/preempt.h b/arch/arm64/crypto/preempt.h new file mode 100644 index 000000000000..94302d5b5ae9 --- /dev/null +++ b/arch/arm64/crypto/preempt.h @@ -0,0 +1,28 @@ +/* + * preempt.h - shared macros to check preempt state + * + * Copyright (C) 2014 Linaro Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include + + /* + * Branch to 'lb' but only if we have not been tagged for preemption. + * + * Expects current->thread_info in ti, or NULL if running in interrupt + * context. reg is a scratch x register. + */ + .macro b_if_no_resched, ti, reg, lb +#if defined(CONFIG_PREEMPT) || defined(CONFIG_PREEMPT_VOLUNTARY) + cbz \ti, \lb // have thread_info? + ldr \reg, [\ti, #TI_FLAGS] // get flags + tbz \reg, #TIF_NEED_RESCHED, \lb // needs rescheduling? +#else + b \lb +#endif + .endm