From de9b8beadc6f9bd7069dbecd7c42716fb5cf574d Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Fri, 28 Apr 2023 13:45:29 +0300 Subject: [PATCH] ipc: ipc3: Add support for SOF_IPC_FW_READY sequence initiated by host In the case of i.MX93 Linux will send an IPC_FW_READY message to SOF and will expect to receive the following information in the hostbox: 1) reply structure 2) sof_ipc_fw_ready structure 3) sof_ipc_fw_ready structure This flow is required because the FW (due to Jailhouse's design) will be up before the platform driver from Linux so the SOF_IPC_FW_READY sequence can't be initiated by SOF. Signed-off-by: Laurentiu Mihalcea --- src/ipc/ipc3/handler.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/ipc/ipc3/handler.c b/src/ipc/ipc3/handler.c index 7d42b58d8ca2..6b869c95aecc 100644 --- a/src/ipc/ipc3/handler.c +++ b/src/ipc/ipc3/handler.c @@ -1603,6 +1603,35 @@ void ipc_boot_complete_msg(struct ipc_cmd_hdr *header, uint32_t data) header->dat[1] = data; } +static int ipc_fw_ready(void) +{ +#ifdef CONFIG_IMX93_A55 + /* VERY IMPORTANT: + * * due to how the FW is started, i.MX93 has the + * following flow (please note that the host driver + * is blacklisted and inserted later on): + * + * 1) Linux kernel boots and user space becomes + * available. + * 2) FW is started (through Jailhouse) => SOF is running + * 4) Host driver module is inserted. + * 5) Host platform driver sends SOF_IPC_FW_READY and + * expects SOF to send the SOF_IPC_FW_READY + * message, the window regions and the reply + * header in the following order: + * 1) reply structure + * 2) sof_ipc_fw_ready structure + * 3) windows structure + * (all of the above information is written + * contiguously in the hostbox) + */ + return platform_boot_complete(0); +#else + /* any other platform should not receive SOF_IPC_FW_READY from host */ + return -EINVAL; +#endif /* CONFIG_IMX93_A55 */ +} + /* * Global IPC Operations. */ @@ -1663,6 +1692,9 @@ void ipc_cmd(struct ipc_cmd_hdr *_hdr) case SOF_IPC_GLB_DEBUG: ret = ipc_glb_debug_message(hdr->cmd); break; + case SOF_IPC_FW_READY: + ret = ipc_fw_ready(); + break; #if CONFIG_DEBUG case SOF_IPC_GLB_TEST: ret = ipc_glb_test_message(hdr->cmd);