All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta@nxp.com>
To: Vijay Balakrishna <vijayb@linux.microsoft.com>,
	Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>,
	Horia Geanta <horia.geanta@nxp.com>,
	Varun Sethi <V.Sethi@nxp.com>, Gaurav Jain <gaurav.jain@nxp.com>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Franck Lenormand <franck.lenormand@nxp.com>
Cc: "code@tyhicks.com" <code@tyhicks.com>
Subject: RE: [EXT] Re: [PATCH] drivers: crypto: caam: jr: Allow quiesce when quiesced
Date: Mon, 27 Feb 2023 07:32:41 +0000	[thread overview]
Message-ID: <DU2PR04MB8630DF686E62018E2F90FEC595AF9@DU2PR04MB8630.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <9f33c874-17ef-ddd8-041c-e1f9995385fa@linux.microsoft.com>

Change the year in the License header.

After changing, you can add the reviewed by me.
Reviewed-By: Pankaj Gupta <pankaj.gupta@nxp.com>

> -----Original Message-----
> From: Vijay Balakrishna <vijayb@linux.microsoft.com>
> Sent: Tuesday, February 21, 2023 11:03 PM
> To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; Horia Geanta
> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Pankaj Gupta
> <pankaj.gupta@nxp.com>; Gaurav Jain <gaurav.jain@nxp.com>;
> herbert@gondor.apana.org.au; davem@davemloft.net; linux-
> crypto@vger.kernel.org; linux-kernel@vger.kernel.org; Franck Lenormand
> <franck.lenormand@nxp.com>
> Cc: code@tyhicks.com
> Subject: [EXT] Re: [PATCH] drivers: crypto: caam: jr: Allow quiesce when
> quiesced
> 
> Caution: EXT Email
> 
> On 2/20/2023 9:42 PM, meenakshi.aggarwal@nxp.com wrote:
> > From: Horia Geanta <horia.geanta@nxp.com>
> >
> > Issues:
> > - Job ring device is busy when do kexec reboot
> > - Failed to flush job ring when do system suspend-resume
> >
> > Fix:
> > Flush the job ring to stop the running jobs.
> >
> > Signed-off-by: Horia Geanta <horia.geanta@nxp.com>
> > Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
> 
> Tested-by: Vijay Balakrishna <vijayb@linux.microsoft.com>
> 
> Thanks,
> Vijay
> 
> 
> > ---
> >   drivers/crypto/caam/jr.c | 53 +++++++++++++++++++++++++++++++++-
> ------
> >   1 file changed, 44 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index
> > 724fdec18bf9..8745fe3cb575 100644
> > --- a/drivers/crypto/caam/jr.c
> > +++ b/drivers/crypto/caam/jr.c
> > @@ -72,19 +72,27 @@ static void caam_jr_crypto_engine_exit(void *data)
> >       crypto_engine_exit(jrpriv->engine);
> >   }
> >
> > -static int caam_reset_hw_jr(struct device *dev)
> > +/*
> > + * Put the CAAM in quiesce, ie stop
> > + *
> > + * Must be called with itr disabled
> > + */
> > +static int caam_jr_stop_processing(struct device *dev, u32 jrcr_bits)
> >   {
> >       struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
> >       unsigned int timeout = 100000;
> >
> > -     /*
> > -      * mask interrupts since we are going to poll
> > -      * for reset completion status
> > -      */
> > -     clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JRCFG_IMSK);
> > +     /* Check the current status */
> > +     if (rd_reg32(&jrp->rregs->jrintstatus) & JRINT_ERR_HALT_INPROGRESS)
> > +             goto wait_quiesce_completion;
> >
> > -     /* initiate flush (required prior to reset) */
> > -     wr_reg32(&jrp->rregs->jrcommand, JRCR_RESET);
> > +     /* Reset the field */
> > +     clrsetbits_32(&jrp->rregs->jrintstatus, JRINT_ERR_HALT_MASK, 0);
> > +
> > +     /* initiate flush / park (required prior to reset) */
> > +     wr_reg32(&jrp->rregs->jrcommand, jrcr_bits);
> > +
> > +wait_quiesce_completion:
> >       while (((rd_reg32(&jrp->rregs->jrintstatus) & JRINT_ERR_HALT_MASK)
> ==
> >               JRINT_ERR_HALT_INPROGRESS) && --timeout)
> >               cpu_relax();
> > @@ -95,8 +103,35 @@ static int caam_reset_hw_jr(struct device *dev)
> >               return -EIO;
> >       }
> >
> > +     return 0;
> > +}
> > +
> > +/*
> > + * Flush the job ring, so the jobs running will be stopped, jobs
> > +queued will be
> > + * invalidated and the CAAM will no longer fetch fron input ring.
> > + *
> > + * Must be called with itr disabled
> > + */
> > +static int caam_jr_flush(struct device *dev) {
> > +     return caam_jr_stop_processing(dev, JRCR_RESET); }
> > +
> > +static int caam_reset_hw_jr(struct device *dev) {
> > +     struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
> > +     unsigned int timeout = 100000;
> > +     int err;
> > +     /*
> > +      * mask interrupts since we are going to poll
> > +      * for reset completion status
> > +      */
> > +     clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JRCFG_IMSK);
> > +     err = caam_jr_flush(dev);
> > +     if (err)
> > +             return err;
> > +
> >       /* initiate reset */
> > -     timeout = 100000;
> >       wr_reg32(&jrp->rregs->jrcommand, JRCR_RESET);
> >       while ((rd_reg32(&jrp->rregs->jrcommand) & JRCR_RESET) && --
> timeout)
> >               cpu_relax();

  reply	other threads:[~2023-02-27  7:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 10:50 [PATCH] drivers: crypto: caam: jr: Allow quiesce when quiesced meenakshi.aggarwal
2023-02-21  5:40 ` [PATCH] drivers: crypto: caam: jr: add .shutdown hook meenakshi.aggarwal
2023-02-21 17:32   ` Vijay Balakrishna
2023-02-27  7:32     ` [EXT] " Pankaj Gupta
2023-03-01  5:39       ` Meenakshi Aggarwal
2023-03-10 10:33         ` Meenakshi Aggarwal
2023-03-10 10:53   ` Herbert Xu
2023-03-11  8:25   ` meenakshi.aggarwal
2023-03-16  6:07   ` [PATCH v2] " meenakshi.aggarwal
2023-03-24 10:29     ` Herbert Xu
2023-02-21  5:42 ` [PATCH] drivers: crypto: caam: jr: Allow quiesce when quiesced meenakshi.aggarwal
2023-02-21 17:33   ` Vijay Balakrishna
2023-02-27  7:32     ` Pankaj Gupta [this message]
2023-02-28 18:37   ` meenakshi.aggarwal
2023-03-10 10:34     ` Meenakshi Aggarwal
2023-03-10 11:32     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DU2PR04MB8630DF686E62018E2F90FEC595AF9@DU2PR04MB8630.eurprd04.prod.outlook.com \
    --to=pankaj.gupta@nxp.com \
    --cc=V.Sethi@nxp.com \
    --cc=code@tyhicks.com \
    --cc=davem@davemloft.net \
    --cc=franck.lenormand@nxp.com \
    --cc=gaurav.jain@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=meenakshi.aggarwal@nxp.com \
    --cc=vijayb@linux.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.