Re: [PATCH RESEND v2 06/12] coco: host: arm64: Add RMM device communication helpers

From: Jonathan Cameron

Date: Thu Oct 30 2025 - 06:01:02 EST


On Thu, 30 Oct 2025 14:48:20 +0530
Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxx> wrote:

> Jonathan Cameron <jonathan.cameron@xxxxxxxxxx> writes:
> ...
>
> >> + /*
> >> + * Some device communication error will transition the
> >> + * device to error state. Report that.
> >> + */
> >> + if (type == PDEV_COMMUNICATE)
> >> + ret = rmi_pdev_get_state(virt_to_phys(pf0_dsc->rmm_pdev),
> >> + (enum rmi_pdev_state *)&state);
> >> + if (ret)
> >> + state = error_state;
> > Whilst not strictly needed I'd do this as:
> >
> > if (type == PDEV_COMMUNICATE) {
> > ret = rmi_pdev_get_state(virt_to_phys(pf0_dsc->rmm_pdev),
> > (enum rmi_pdev_state *)&state);
> > if (ret)
> > state = error_state;
> > }
> >
> > Just to make it clear that reg check is just on the output of the call above.
> > If we didn't make that call it is definitely zero but nice not to have
> > to reason about it.
> >
>
> Some of this is because follow up patch adds more details there. In this case.
>
> /*
> * Some device communication error will transition the
> * device to error state. Report that.
> */
> if (type == PDEV_COMMUNICATE)
> ret = rmi_pdev_get_state(virt_to_phys(pf0_dsc->rmm_pdev),
> (enum rmi_pdev_state *)&state);
> else
> ret = rmi_vdev_get_state(virt_to_phys(host_tdi->rmm_vdev),
> (enum rmi_vdev_state *)&state);
> if (ret)
> state = error_state;
>
Ah fair enough I missed that.

J
>
>
> >
> >> + }
> >> +
> >> + if (state == error_state)
> >> + pci_err(tsm->pdev, "device communication error\n");
> >> +
> >> + return state;
> >> +}
> >> +
>
> -aneesh