summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-08-21 18:38:50 (GMT)
committerEmil Medve <Emilian.Medve@Freescale.com>2013-04-30 08:17:27 (GMT)
commit05bc115a8136cb828a012ec9457d5725a1498ffa (patch)
tree0c8ec72351dd735897e96436522815ca7cb0419d /drivers/char
parentf1a32eddf445d38d086ebbdfb7201f9dfafcda11 (diff)
downloadlinux-fsl-qoriq-05bc115a8136cb828a012ec9457d5725a1498ffa.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 50007e1..9d6c416 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -742,18 +742,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 = get_cycles();
input[0] = cycles ^ jiffies;
input[1] = irq;
- if (regs) {
- __u64 ip = instruction_pointer(regs);
+ if (ip) {
input[2] = ip;
input[3] = ip >> 32;
}
@@ -767,7 +765,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