From: Greg Kroah-Hartman Date: Mon, 30 Apr 2012 13:37:07 +0000 (-0400) Subject: 3.3-stable patches X-Git-Tag: v3.3.5~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=782894ffbb00070be461c67239caf9b40794fda1;p=thirdparty%2Fkernel%2Fstable-queue.git 3.3-stable patches added patches: crypto-talitos-properly-lock-access-to-global-talitos-registers.patch --- diff --git a/queue-3.3/crypto-talitos-properly-lock-access-to-global-talitos-registers.patch b/queue-3.3/crypto-talitos-properly-lock-access-to-global-talitos-registers.patch new file mode 100644 index 00000000000..ad11a68d88a --- /dev/null +++ b/queue-3.3/crypto-talitos-properly-lock-access-to-global-talitos-registers.patch @@ -0,0 +1,94 @@ +From 511d63cb19329235bc9298b64010ec494b5e1408 Mon Sep 17 00:00:00 2001 +From: Horia Geanta +Date: Fri, 30 Mar 2012 17:49:53 +0300 +Subject: crypto: talitos - properly lock access to global talitos registers + +From: Horia Geanta + +commit 511d63cb19329235bc9298b64010ec494b5e1408 upstream. + +Access to global talitos registers must be protected for the case when +affinities are configured such that primary and secondary talitos irqs +run on different cpus. + +Signed-off-by: Horia Geanta +Signed-off-by: Kim Phillips +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/talitos.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +--- a/drivers/crypto/talitos.c ++++ b/drivers/crypto/talitos.c +@@ -124,6 +124,9 @@ struct talitos_private { + void __iomem *reg; + int irq[2]; + ++ /* SEC global registers lock */ ++ spinlock_t reg_lock ____cacheline_aligned; ++ + /* SEC version geometry (from device tree node) */ + unsigned int num_channels; + unsigned int chfifo_len; +@@ -412,6 +415,7 @@ static void talitos_done_##name(unsigned + { \ + struct device *dev = (struct device *)data; \ + struct talitos_private *priv = dev_get_drvdata(dev); \ ++ unsigned long flags; \ + \ + if (ch_done_mask & 1) \ + flush_channel(dev, 0, 0, 0); \ +@@ -427,8 +431,10 @@ static void talitos_done_##name(unsigned + out: \ + /* At this point, all completed channels have been processed */ \ + /* Unmask done interrupts for channels completed later on. */ \ ++ spin_lock_irqsave(&priv->reg_lock, flags); \ + setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ + setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ ++ spin_unlock_irqrestore(&priv->reg_lock, flags); \ + } + DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) + DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) +@@ -619,22 +625,28 @@ static irqreturn_t talitos_interrupt_##n + struct device *dev = data; \ + struct talitos_private *priv = dev_get_drvdata(dev); \ + u32 isr, isr_lo; \ ++ unsigned long flags; \ + \ ++ spin_lock_irqsave(&priv->reg_lock, flags); \ + isr = in_be32(priv->reg + TALITOS_ISR); \ + isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ + /* Acknowledge interrupt */ \ + out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ + out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ + \ +- if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ +- talitos_error(dev, isr, isr_lo); \ +- else \ ++ if (unlikely(isr & ch_err_mask || isr_lo)) { \ ++ spin_unlock_irqrestore(&priv->reg_lock, flags); \ ++ talitos_error(dev, isr & ch_err_mask, isr_lo); \ ++ } \ ++ else { \ + if (likely(isr & ch_done_mask)) { \ + /* mask further done interrupts. */ \ + clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ + /* done_task will unmask done interrupts at exit */ \ + tasklet_schedule(&priv->done_task[tlet]); \ + } \ ++ spin_unlock_irqrestore(&priv->reg_lock, flags); \ ++ } \ + \ + return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ + IRQ_NONE; \ +@@ -2718,6 +2730,8 @@ static int talitos_probe(struct platform + + priv->ofdev = ofdev; + ++ spin_lock_init(&priv->reg_lock); ++ + err = talitos_probe_irq(ofdev); + if (err) + goto err_out; diff --git a/queue-3.3/series b/queue-3.3/series index a0d177ff2db..0e44297c4e5 100644 --- a/queue-3.3/series +++ b/queue-3.3/series @@ -33,3 +33,4 @@ usb-gadget-dummy-do-not-call-pullup-on-udc_stop.patch usb-gadget-uvc-uvc_request_data-length-field-must-be-signed.patch pipes-add-a-packetized-pipe-mode-for-writing.patch autofs-make-the-autofsv5-packet-file-descriptor-use-a-packetized-pipe.patch +crypto-talitos-properly-lock-access-to-global-talitos-registers.patch