Re: [PATCH] crypto: caam - use JobR's space to access page 0 regs
From: Horia Geanta
Date: Wed Nov 13 2024 - 11:22:28 EST
On 11/11/2024 2:22 PM, Ahmad Fatoum wrote:
> Hello Guarav,
>
> Thanks for your patch.
>
> On 11.11.24 13:10, Gaurav Jain wrote:
[...]
>> #define pr_fmt(fmt) "caam blob_gen: " fmt
>> @@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv,
>> }
>>
>> ctrlpriv = dev_get_drvdata(jrdev->parent);
>> - moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->perfmon.status));
>> + moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
>
> I believe your change is correct, but I would prefer that ctrlpriv gets a perfmon
> member that is initialized in caam_probe to either &ctrlpriv->ctrl->perfmon.status
> or &ctrlpriv->jr[0]->perfmon.status and then the code here would just use
> &ctrlpriv->perfmon->status.
>
> This would simplify code not only here, but also in caam_ctrl_rng_init.
>
Agree.
But maybe this refactoring deserves a separate patch, given that is should also
cover the case when the Job Ring device corresponding to "ctrlpriv->jr[0]"
is unbounded from the driver.
Thanks,
Horia