All of lore.kernel.org
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 1/3] arm64/crypto: add shared macro to test for NEED_RESCHED
Date: Fri, 28 Mar 2014 12:05:33 +0100	[thread overview]
Message-ID: <1396004735-15475-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1396004735-15475-1-git-send-email-ard.biesheuvel@linaro.org>

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 <ard.biesheuvel@linaro.org>
---
 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 <ard.biesheuvel@linaro.org>
+ *
+ * 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 <asm/asm-offsets.h>
+#include <asm/thread_info.h>
+
+	/*
+	 * 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
-- 
1.8.3.2

  reply	other threads:[~2014-03-28 11:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 11:05 [PATCH RFC 0/3] arm64: NEON crypto under CONFIG_PREEMPT Ard Biesheuvel
2014-03-28 11:05 ` Ard Biesheuvel [this message]
2014-03-29  1:53   ` [PATCH RFC 1/3] arm64/crypto: add shared macro to test for NEED_RESCHED Nicolas Pitre
2014-03-31 19:07     ` Ard Biesheuvel
2014-03-28 11:05 ` [PATCH RFC 2/3] arm64/crypto: SHA-1 using ARMv8 Crypto Extensions Ard Biesheuvel
2014-03-28 11:05 ` [PATCH RFC 3/3] arm64/crypto: SHA-224/SHA-256 " Ard Biesheuvel
2014-03-29  2:03 ` [PATCH RFC 0/3] arm64: NEON crypto under CONFIG_PREEMPT Nicolas Pitre
2014-03-31 19:04   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396004735-15475-2-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.