RE: [PATCH v4 7/8] crypto: ccp: Add support for ringing a platform doorbell

From: Limonciello, Mario
Date: Tue Mar 21 2023 - 17:16:19 EST


[Public]

> Hi Mario,
> [...]
> > +int psp_ring_platform_doorbell(int msg)
> > +{
> > + struct psp_device *psp = psp_get_master_device();
> > + struct psp_platform_access_device *pa_dev;
> > + u32 __iomem *button, *cmd;
> > + int ret, val;
> > +
> > + if (!psp || !psp->platform_access_data)
> > + return -ENODEV;
> > +
> > + pa_dev = psp->platform_access_data;
> > + button = psp->io_regs + pa_dev->vdata->doorbell_button_reg;
> > + cmd = psp->io_regs + pa_dev->vdata->doorbell_cmd_reg;
> > +
> > + mutex_lock(&pa_dev->doorbell_mutex);
> > +
> > + if (check_doorbell(button)) {
> > + dev_dbg(psp->dev, "doorbell is not ready\n");
>
> Can you change dev_dbg() to dev_err() when there is an error in all
> cases in that function?

Sure, I'll adjust this.

> [...]
>
> > +
> > + val = FIELD_GET(PSP_CMDRESP_STS, ioread32(cmd));
> > + if (val) {
> > + ret = -EIO;
> > + goto unlock;
> > + }
>
> Are you sure that PSP_CMDRESP_STS should be zero? My tests failed due
> to the fact the val is 1 and moreover I don't see that check in the
> original Jan's patch.
> Can you also add here dev_err()?

I got a link to the spec for this stuff and that was how I understood it to work.

As it's a command/response register those lower 15 bits should be 0 to indicate
it worked and anything else is some kind of failure.

As some of these patches are merged, I'll rebase on cryptodev-2.6 and send
out an updated patch series.