Re: [RFC PATCH v1 14/38] coco: host: arm64: Device communication support

Bjorn Helgaas
2025-08-04T22:29:54Z

On Mon, Jul 28, 2025 at 07:21:51PM +0530, Aneesh Kumar K.V (Arm) wrote:
> Add helpers for device communication from RMM

> +++ b/drivers/virt/coco/arm-cca-host/rmm-da.c
> +static int __do_dev_communicate(int type, struct pci_tsm *tsm)
> +{

> + /* FIXME!! depending on the DevComms status,
> + * it might require to ABORT the communcation.

s/communcation/communication/

Even better, fix the FIXME :)

> + */
> + return -EINVAL;
> + }
> +
> + if (io_exit->cache_rsp_len > cache_remaining)
> + return -EINVAL;
> +
> + memcpy(cache_buf + *cache_offset,
> + (comm_data->resp_buff + io_exit->cache_rsp_offset), io_exit->cache_rsp_len);
> + *cache_offset += io_exit->cache_rsp_len;
> + }
> +
> + /*
> + * wait for last packet request from RMM.
> + * We should not find this because our device communication in synchronous

s/communication in/communication is/

> + */
> + if (io_exit->flags & RMI_DEV_COMM_EXIT_WAIT)
> + return -ENXIO;
> +
> + is_multi = !!(io_exit->flags & RMI_DEV_COMM_EXIT_MULTI);
> +
> + /* next packet to send */
> + if (io_exit->flags & RMI_DEV_COMM_EXIT_SEND) {
> + nbytes = doe_send_req_resp(tsm);
> + if (nbytes < 0) {
> + /* report error back to RMM */
> + io_enter->status = RMI_DEV_COMM_ERROR;
> + } else {
> + /* send response back to RMM */
> + io_enter->resp_len = nbytes;
> + io_enter->status = RMI_DEV_COMM_RESPONSE;
> + }
> + } else {
> + /* no data transmitted => no data received */
> + io_enter->resp_len = 0;
> + }
> +
> + /* The call need to do multiple request/respnse */

s/respnse/response/

> + if (is_multi)
> + goto redo_communicate;
> +
> + return 0;
> +}