summaryrefslogtreecommitdiff
path: root/include/linux/timex.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-10-10 12:31:43 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-10-10 12:31:43 -0700
commitf715729ee4cb666f51749f6cd86d06fff1e6e17b (patch)
treecf8f2c6c2d90441d6a978915b5d7eb0b19981f44 /include/linux/timex.h
parent8273548c5455e3ae27e905a77bad277535837329 (diff)
parent61875f30daf60305712e25b209ef41ced2635bad (diff)
Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
Pull /dev/random changes from Ted Ts'o: "These patches are designed to enable improvements to /dev/random for non-x86 platforms, in particular MIPS and ARM" * tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random: random: allow architectures to optionally define random_get_entropy() random: run random_int_secret_init() run after all late_initcalls
Diffstat (limited to 'include/linux/timex.h')
-rw-r--r--include/linux/timex.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h
index dd3edd7dfc94..9d3f1a5b6178 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -64,6 +64,20 @@
#include <asm/timex.h>
+#ifndef random_get_entropy
+/*
+ * The random_get_entropy() function is used by the /dev/random driver
+ * in order to extract entropy via the relative unpredictability of
+ * when an interrupt takes places versus a high speed, fine-grained
+ * timing source or cycle counter. Since it will be occurred on every
+ * single interrupt, it must have a very low cost/overhead.
+ *
+ * By default we use get_cycles() for this purpose, but individual
+ * architectures may override this in their asm/timex.h header file.
+ */
+#define random_get_entropy() get_cycles()
+#endif
+
/*
* SHIFT_PLL is used as a dampening factor to define how much we
* adjust the frequency correction for a given offset in PLL mode.