Re: [PATCH RESEND v2 06/12] coco: host: arm64: Add RMM device communication helpers
From: Aneesh Kumar K . V
Date: Thu Oct 30 2025 - 05:18:28 EST
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;
>
>> + }
>> +
>> + if (state == error_state)
>> + pci_err(tsm->pdev, "device communication error\n");
>> +
>> + return state;
>> +}
>> +
-aneesh