summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-08-21 18:38:50 (GMT)
committerScott Wood <scottwood@freescale.com>2015-02-13 22:21:02 (GMT)
commit9a27bb504194a8f6351513b3153c290c2ec90b09 (patch)
tree0d90afd9b4c644f495f28c138ab61733fc8043e2 /drivers/char
parentbdf96ee423279aa590ba3afd784013771f85de70 (diff)
downloadlinux-fsl-qoriq-9a27bb504194a8f6351513b3153c290c2ec90b09.tar.xz
random: Make it work on rt
Delegate the random insertion to the forced threaded interrupt handler. Store the return IP of the hard interrupt handler in the irq descriptor and feed it into the random generator as a source of entropy. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable-rt@vger.kernel.org
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/random.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 6d33427..8f1489c 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -739,18 +739,16 @@ EXPORT_SYMBOL_GPL(add_input_randomness);
static DEFINE_PER_CPU(struct fast_pool, irq_randomness);
-void add_interrupt_randomness(int irq, int irq_flags)
+void add_interrupt_randomness(int irq, int irq_flags, __u64 ip)
{
struct entropy_store *r;
struct fast_pool *fast_pool = &__get_cpu_var(irq_randomness);
- struct pt_regs *regs = get_irq_regs();
unsigned long now = jiffies;
__u32 input[4], cycles = random_get_entropy();
input[0] = cycles ^ jiffies;
input[1] = irq;
- if (regs) {
- __u64 ip = instruction_pointer(regs);
+ if (ip) {
input[2] = ip;
input[3] = ip >> 32;
}
@@ -764,7 +762,11 @@ void add_interrupt_randomness(int irq, int irq_flags)
fast_pool->last = now;
r = nonblocking_pool.initialized ? &input_pool : &nonblocking_pool;
+#ifndef CONFIG_PREEMPT_RT_FULL
__mix_pool_bytes(r, &fast_pool->pool, sizeof(fast_pool->pool), NULL);
+#else
+ mix_pool_bytes(r, &fast_pool->pool, sizeof(fast_pool->pool), NULL);
+#endif
/*
* If we don't have a valid cycle counter, and we see
* back-to-back timer interrupts, then skip giving credit for