From patchwork Fri Mar 6 16:40:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 5956321 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DEB05BF440 for ; Fri, 6 Mar 2015 16:40:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF38820256 for ; Fri, 6 Mar 2015 16:40:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C872F2038D for ; Fri, 6 Mar 2015 16:40:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755519AbbCFQkt (ORCPT ); Fri, 6 Mar 2015 11:40:49 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:54033 "EHLO mailhub1.si.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755103AbbCFQkr (ORCPT ); Fri, 6 Mar 2015 11:40:47 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 781201C8571; Fri, 6 Mar 2015 17:40:46 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from mailhub1.si.c-s.fr ([192.168.12.234]) by localhost (mailhub1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zq05T6xkUg-A; Fri, 6 Mar 2015 17:40:46 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 5411B1C8570; Fri, 6 Mar 2015 17:40:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 40650C73C5; Fri, 6 Mar 2015 17:40:46 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ymQeQMjyXe5Q; Fri, 6 Mar 2015 17:40:46 +0100 (CET) Received: from PO10863.localdomain (unknown [172.25.231.75]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0B7C3C73C4; Fri, 6 Mar 2015 17:40:46 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id E399B1A241C; Fri, 6 Mar 2015 17:40:45 +0100 (CET) From: Christophe Leroy To: Kim Phillips , Herbert Xu , "David S. Miller" CC: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-crypto@vger.kernel.org Subject: [PATCH v2 10/17] crypto: talitos - Move interrupt related macros in talitos2.h Message-Id: <20150306164045.E399B1A241C@localhost.localdomain> Date: Fri, 6 Mar 2015 17:40:45 +0100 (CET) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move interrupt related macros in talitos2.h as they are specific to SEC2 Signed-off-by: Christophe Leroy --- drivers/crypto/talitos.c | 58 --------------------------------------------- drivers/crypto/talitos2.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 58 deletions(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index ffa103b..b1ba98b 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -262,32 +262,6 @@ void talitos_flush_channel(struct device *dev, int ch, int error, int reset_ch) /* * process completed requests for channels that have done status */ -#define DEF_TALITOS_DONE(name, ch_done_mask) \ -static void talitos_done_##name(unsigned long data) \ -{ \ - struct device *dev = (struct device *)data; \ - struct talitos_private *priv = dev_get_drvdata(dev); \ - unsigned long flags; \ - \ - if (ch_done_mask & 1) \ - talitos_flush_channel(dev, 0, 0, 0); \ - if (priv->num_channels == 1) \ - goto out; \ - if (ch_done_mask & (1 << 2)) \ - talitos_flush_channel(dev, 1, 0, 0); \ - if (ch_done_mask & (1 << 4)) \ - talitos_flush_channel(dev, 2, 0, 0); \ - if (ch_done_mask & (1 << 6)) \ - talitos_flush_channel(dev, 3, 0, 0); \ - \ -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) DEF_TALITOS_DONE(ch1_3, TALITOS_ISR_CH_1_3_DONE) @@ -399,38 +373,6 @@ void talitos_report_eu_error(struct device *dev, int ch) in_be32(priv->chan[ch].reg + TALITOS_DESCBUF_LO + 8*i)); } -#define DEF_TALITOS_INTERRUPT(name, ch_done_mask, ch_err_mask, tlet) \ -static irqreturn_t talitos_interrupt_##name(int irq, void *data) \ -{ \ - 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 & 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; \ -} DEF_TALITOS_INTERRUPT(4ch, TALITOS_ISR_4CHDONE, TALITOS_ISR_4CHERR, 0) DEF_TALITOS_INTERRUPT(ch0_2, TALITOS_ISR_CH_0_2_DONE, TALITOS_ISR_CH_0_2_ERR, 0) DEF_TALITOS_INTERRUPT(ch1_3, TALITOS_ISR_CH_1_3_DONE, TALITOS_ISR_CH_1_3_ERR, 1) diff --git a/drivers/crypto/talitos2.h b/drivers/crypto/talitos2.h index f9da9f2..10c7313 100644 --- a/drivers/crypto/talitos2.h +++ b/drivers/crypto/talitos2.h @@ -222,3 +222,63 @@ static inline void do_init_device(struct talitos_private *priv) setbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_INIT); setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); } + +#define DEF_TALITOS_DONE(name, ch_done_mask) \ +static void talitos_done_##name(unsigned long data) \ +{ \ + struct device *dev = (struct device *)data; \ + struct talitos_private *priv = dev_get_drvdata(dev); \ + unsigned long flags; \ + \ + if (ch_done_mask & 1) \ + talitos_flush_channel(dev, 0, 0, 0); \ + if (priv->num_channels == 1) \ + goto out; \ + if (ch_done_mask & (1 << 2)) \ + talitos_flush_channel(dev, 1, 0, 0); \ + if (ch_done_mask & (1 << 4)) \ + talitos_flush_channel(dev, 2, 0, 0); \ + if (ch_done_mask & (1 << 6)) \ + talitos_flush_channel(dev, 3, 0, 0); \ + \ +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); \ +} + +#define DEF_TALITOS_INTERRUPT(name, ch_done_mask, ch_err_mask, tlet) \ +static irqreturn_t talitos_interrupt_##name(int irq, void *data) \ +{ \ + 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 & 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; \ +}