On 2020-09-23 9:24 PM, Rojewski, Cezary wrote: > On 2020-09-23 3:17 PM, Andy Shevchenko wrote: >> On Wed, Sep 23, 2020 at 02:24:56PM +0200, Cezary Rojewski wrote: >>> Implement IRQ handlers for immediate and delayed replies and >>> notifications. Communication is synchronous and allows for serialization >>> of maximum one message at a time. >>> ... >>> + if (!ret && reply->data && reply->size) >> >>> + memcpy(reply->data, ipc->rx.data, ipc->rx.size); >> >> This I didn't get. You copy data by using source size?! >> >>> + } >>> + >>> + return ret; >> >> I guess the above piece may be refactored, but I don't know how until it is >> clear why it's written like this. >> >> ... >> > > Well, ipc->rx.size equals reply->size as long as IPC procedure is in > progress and reply != NULL. So either ipc->rx.size or reply->size > suffices. > > IPC protocol is quite simple here (albeit cAVS arguably is even simpler): > > OUTBOX <channel: request - reply model> > TX: copy request header to appropriate register, copy payload to outbox > <IRQ> > RX: copy reply header, copy returned payload only in successful case > Forgotten to mention: yes OUTBOX's TX == OUTBOX's RX (HOST owns the space during the request phase and yields the ownership to DSP once IPCC_BUSY bit is set). No ownership juggling in INBOX case. Czarek