Re: [PATCH v2 2/2] crypto: starfive - Add RSA algo support

From: Herbert Xu
Date: Fri Jun 09 2023 - 05:05:45 EST


On Fri, Jun 02, 2023 at 10:55:51AM +0800, Jia Jie Ho wrote:
>
> +static inline void starfive_pka_irq_mask_clear(struct starfive_cryp_ctx *ctx)
> +{
> + struct starfive_cryp_dev *cryp = ctx->cryp;
> + u32 stat;
> +
> + reinit_completion(&cryp->pka_done);
> +
> + stat = readl(cryp->base + STARFIVE_IE_MASK_OFFSET);
> + stat &= ~STARFIVE_IE_MASK_PKA_DONE;
> + writel(stat, cryp->base + STARFIVE_IE_MASK_OFFSET);
> +}

Shouldn't the order of reinit_completion and the register write
be reversed? Otherwise what's to stop a spurious interrupt from
completing pka_done prematurely?

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt