From patchwork Thu Oct 20 12:12:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616828 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D68BDC4332F for ; Thu, 20 Oct 2022 12:14:09 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E183EB914; Thu, 20 Oct 2022 14:13:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E183EB914 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268048; bh=Y1rcYmThX2owFrcbBdOMXqBDMA6/eYfKWheBi2Oua+A=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jUrV3siD4jRF9hD1pHDeZNveAgaYzl4lAvc1y+GVNvu/CP9/FLU1BTE18i6k66DQ1 9x2CpEhfG8bBab0A9bE1PSK9BMzWLRjcc/IFgaTpVgCNUuENB9sz3PzaZMn7e6uQ4h IJEWdNcgs5erffxyHgJ7l3iyHZmIfIPfo9bB5C84= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2B9F6F80549; Thu, 20 Oct 2022 14:12:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D572FF80552; Thu, 20 Oct 2022 14:12:31 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2F15DF804E5 for ; Thu, 20 Oct 2022 14:12:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2F15DF804E5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="g/J8twqM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267946; x=1697803946; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y1rcYmThX2owFrcbBdOMXqBDMA6/eYfKWheBi2Oua+A=; b=g/J8twqMNfUu0htsAOOqq4KvcwM+WngrS6/KrVtd45C1C1Y8nQGdaNxm P9msq6IEzX800cHzD3vnYv2zookVHtaoLgz4m1g62voIA55CGUs3xL4vV Je8FntTqHf2GhrcBKFkvHBe/Bk6JctbtAa7JoCpiUUhQxZvoI7dAPWAjz Rb2lgNVltTcGlMc8JJkMQxGc1iUj/Q5PiYvHQo4Q/kbGUfs8Qo0ru1ydb 0lI+IVidOB14GxU92Ki+K0cTCm6Xx8hSe8JbDFFFwQJbI1quakETsH+sO BOeSl9Ftj3DxZJ79gMET1eLyWo79KzaMa5wCQpiw0+3U3jKJJIVuxiuyt w==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256284" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256284" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:22 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663009858" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663009858" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:20 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 02/19] ASoC: SOF: Introduce container struct for SOF firmware Date: Thu, 20 Oct 2022 15:12:21 +0300 Message-Id: <20221020121238.18339-3-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Move the firmware related information under a new struct (sof_firmware) and add it to the high level snd_sof_dev struct. Convert the generic code to use this new container when working with the basefw and for compatibility reasons set the old plat_data members used by the platforms. Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/ipc3-loader.c | 26 ++++++++++++-------------- sound/soc/sof/ipc4-loader.c | 6 ++---- sound/soc/sof/loader.c | 18 +++++++++++++----- sound/soc/sof/sof-priv.h | 14 ++++++++++++++ 4 files changed, 41 insertions(+), 23 deletions(-) diff --git a/sound/soc/sof/ipc3-loader.c b/sound/soc/sof/ipc3-loader.c index bf423ca4e97b..28218766d211 100644 --- a/sound/soc/sof/ipc3-loader.c +++ b/sound/soc/sof/ipc3-loader.c @@ -138,8 +138,7 @@ static ssize_t ipc3_fw_ext_man_size(struct snd_sof_dev *sdev, const struct firmw static size_t sof_ipc3_fw_parse_ext_man(struct snd_sof_dev *sdev) { - struct snd_sof_pdata *plat_data = sdev->pdata; - const struct firmware *fw = plat_data->fw; + const struct firmware *fw = sdev->basefw.fw; const struct sof_ext_man_elem_header *elem_hdr; const struct sof_ext_man_header *head; ssize_t ext_man_size; @@ -310,18 +309,18 @@ static int sof_ipc3_parse_module_memcpy(struct snd_sof_dev *sdev, static int sof_ipc3_load_fw_to_dsp(struct snd_sof_dev *sdev) { - struct snd_sof_pdata *plat_data = sdev->pdata; - const struct firmware *fw = plat_data->fw; + u32 payload_offset = sdev->basefw.payload_offset; + const struct firmware *fw = sdev->basefw.fw; struct snd_sof_fw_header *header; struct snd_sof_mod_hdr *module; int (*load_module)(struct snd_sof_dev *sof_dev, struct snd_sof_mod_hdr *hdr); size_t remaining; int ret, count; - if (!plat_data->fw) + if (!fw) return -EINVAL; - header = (struct snd_sof_fw_header *)(fw->data + plat_data->fw_offset); + header = (struct snd_sof_fw_header *)(fw->data + payload_offset); load_module = sof_ops(sdev)->load_module; if (!load_module) { dev_dbg(sdev->dev, "Using generic module loading\n"); @@ -331,9 +330,8 @@ static int sof_ipc3_load_fw_to_dsp(struct snd_sof_dev *sdev) } /* parse each module */ - module = (struct snd_sof_mod_hdr *)(fw->data + plat_data->fw_offset + - sizeof(*header)); - remaining = fw->size - sizeof(*header) - plat_data->fw_offset; + module = (struct snd_sof_mod_hdr *)(fw->data + payload_offset + sizeof(*header)); + remaining = fw->size - sizeof(*header) - payload_offset; /* check for wrap */ if (remaining > fw->size) { dev_err(sdev->dev, "%s: fw size smaller than header size\n", __func__); @@ -374,19 +372,19 @@ static int sof_ipc3_load_fw_to_dsp(struct snd_sof_dev *sdev) static int sof_ipc3_validate_firmware(struct snd_sof_dev *sdev) { - struct snd_sof_pdata *plat_data = sdev->pdata; - const struct firmware *fw = plat_data->fw; + u32 payload_offset = sdev->basefw.payload_offset; + const struct firmware *fw = sdev->basefw.fw; struct snd_sof_fw_header *header; - size_t fw_size = fw->size - plat_data->fw_offset; + size_t fw_size = fw->size - payload_offset; - if (fw->size <= plat_data->fw_offset) { + if (fw->size <= payload_offset) { dev_err(sdev->dev, "firmware size must be greater than firmware offset\n"); return -EINVAL; } /* Read the header information from the data pointer */ - header = (struct snd_sof_fw_header *)(fw->data + plat_data->fw_offset); + header = (struct snd_sof_fw_header *)(fw->data + payload_offset); /* verify FW sig */ if (strncmp(header->sig, SND_SOF_FW_SIG, SND_SOF_FW_SIG_SIZE) != 0) { diff --git a/sound/soc/sof/ipc4-loader.c b/sound/soc/sof/ipc4-loader.c index e635ae515fa9..9f433e9b4cd3 100644 --- a/sound/soc/sof/ipc4-loader.c +++ b/sound/soc/sof/ipc4-loader.c @@ -17,9 +17,8 @@ static size_t sof_ipc4_fw_parse_ext_man(struct snd_sof_dev *sdev) { struct sof_ipc4_fw_data *ipc4_data = sdev->private; - struct snd_sof_pdata *plat_data = sdev->pdata; struct sof_man4_fw_binary_header *fw_header; - const struct firmware *fw = plat_data->fw; + const struct firmware *fw = sdev->basefw.fw; struct sof_ext_manifest4_hdr *ext_man_hdr; struct sof_man4_module_config *fm_config; struct sof_ipc4_fw_module *fw_module; @@ -138,9 +137,8 @@ static int sof_ipc4_validate_firmware(struct snd_sof_dev *sdev) { struct sof_ipc4_fw_data *ipc4_data = sdev->private; u32 fw_hdr_offset = ipc4_data->manifest_fw_hdr_offset; - struct snd_sof_pdata *plat_data = sdev->pdata; struct sof_man4_fw_binary_header *fw_header; - const struct firmware *fw = plat_data->fw; + const struct firmware *fw = sdev->basefw.fw; struct sof_ext_manifest4_hdr *ext_man_hdr; ext_man_hdr = (struct sof_ext_manifest4_hdr *)fw->data; diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c index 59e6be59258e..1e31b7c296e7 100644 --- a/sound/soc/sof/loader.c +++ b/sound/soc/sof/loader.c @@ -22,7 +22,7 @@ int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev) int ret; /* Don't request firmware again if firmware is already requested */ - if (plat_data->fw) + if (sdev->basefw.fw) return 0; fw_filename = kasprintf(GFP_KERNEL, "%s/%s", @@ -31,7 +31,7 @@ int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev) if (!fw_filename) return -ENOMEM; - ret = request_firmware(&plat_data->fw, fw_filename, sdev->dev); + ret = request_firmware(&sdev->basefw.fw, fw_filename, sdev->dev); if (ret < 0) { dev_err(sdev->dev, @@ -48,7 +48,7 @@ int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev) ext_man_size = sdev->ipc->ops->fw_loader->parse_ext_manifest(sdev); if (ext_man_size > 0) { /* when no error occurred, drop extended manifest */ - plat_data->fw_offset = ext_man_size; + sdev->basefw.payload_offset = ext_man_size; } else if (!ext_man_size) { /* No extended manifest, so nothing to skip during FW load */ dev_dbg(sdev->dev, "firmware doesn't contain extended manifest\n"); @@ -58,6 +58,12 @@ int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev) fw_filename, ret); } + /* + * Until the platform code is switched to use the new container the fw + * and payload offset must be set in plat_data + */ + plat_data->fw = sdev->basefw.fw; + plat_data->fw_offset = sdev->basefw.payload_offset; err: kfree(fw_filename); @@ -100,7 +106,8 @@ int snd_sof_load_firmware_memcpy(struct snd_sof_dev *sdev) return 0; error: - release_firmware(plat_data->fw); + release_firmware(sdev->basefw.fw); + sdev->basefw.fw = NULL; plat_data->fw = NULL; return ret; @@ -185,7 +192,8 @@ EXPORT_SYMBOL(snd_sof_run_firmware); void snd_sof_fw_unload(struct snd_sof_dev *sdev) { /* TODO: support module unloading at runtime */ - release_firmware(sdev->pdata->fw); + release_firmware(sdev->basefw.fw); + sdev->basefw.fw = NULL; sdev->pdata->fw = NULL; } EXPORT_SYMBOL(snd_sof_fw_unload); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index de08825915b3..3d70b57e4864 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -136,6 +136,17 @@ struct snd_sof_platform_stream_params { bool cont_update_posn; }; +/** + * struct sof_firmware - Container struct for SOF firmware + * @fw: Pointer to the firmware + * @payload_offset: Offset of the data within the loaded firmware image to be + * loaded to the DSP (skipping for example ext_manifest section) + */ +struct sof_firmware { + const struct firmware *fw; + u32 payload_offset; +}; + /* * SOF DSP HW abstraction operations. * Used to abstract DSP HW architecture and any IO busses between host CPU @@ -487,6 +498,9 @@ struct snd_sof_dev { spinlock_t ipc_lock; /* lock for IPC users */ spinlock_t hw_lock; /* lock for HW IO access */ + /* Main, Base firmware image */ + struct sof_firmware basefw; + /* * ASoC components. plat_drv fields are set dynamically so * can't use const From patchwork Thu Oct 20 12:12:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 108F7C433FE for ; Thu, 20 Oct 2022 12:14:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4BF44380A; Thu, 20 Oct 2022 14:13:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4BF44380A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268070; bh=Cbsm4rCNiVKBRKIvYJD7bJ0wCpKcwJ0A4ciloFo1a8Y=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MwtuyJ9dr4dTsY6KNMBFmW5ce9xruhEr0aaTB/Cmgo6Um/DvYBIem43IluI/UMZ/C Gha015RBboSZt1aB/2DbRAIN0obogCSOx94Xa3d9xH7Qj+8CcR7tqwqDcBC0SC+EiT 5Lj6N7t8ovt4orXILBh1ktTR+8M36YiyzgTwDP2A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CB031F8055C; Thu, 20 Oct 2022 14:12:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DBFBDF80557; Thu, 20 Oct 2022 14:12:33 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 598EBF8054A for ; Thu, 20 Oct 2022 14:12:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 598EBF8054A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="D9n3GaE1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267951; x=1697803951; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Cbsm4rCNiVKBRKIvYJD7bJ0wCpKcwJ0A4ciloFo1a8Y=; b=D9n3GaE1HZePEIyvpFCUFe7pak4yD0jQyNUVFIwZwJpRNZ9IG5p6rS2k w6l6Z3eRFO7WwEa4ASNAoEUVkYDXnJxm4kiUOk20kJ07UJNq0JtURX5Lb mLgeLEGPImWkt8sMxQFxmYP8h61ZmPMuw0PTggiiuCusD9lfCJJqQjD2M 4becyayyUKieHQga/3r3YRn/1gukL/cazlflen2AKMa01eGAqFfmcEccH eauxV82FRzqSX6AjTJRXGMH2ag3Uv8p6rpNj+9gHNwsMOsE39n8YqK88I 8cg8aIGqlCdBgXbtz4JBN29oXLRHVhQAdmH05jQgfCI33XwyGlN0QGef8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256306" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256306" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:28 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663009901" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663009901" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:25 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 04/19] ASoC: SOF: Intel: hda-loader: Use the basefw firmware container directly Date: Thu, 20 Oct 2022 15:12:23 +0300 Message-Id: <20221020121238.18339-5-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch to access to the firmware struct via sdev->basefw container to unblock the removal of the firmware information from plat_data. Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/intel/hda-loader.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c index 98812d51b31c..147ddc5ee932 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -318,7 +318,6 @@ int hda_cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev) { - struct snd_sof_pdata *plat_data = sdev->pdata; struct hdac_ext_stream *iccmax_stream; struct hdac_bus *bus = sof_to_bus(sdev); struct firmware stripped_firmware; @@ -329,12 +328,12 @@ int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev) /* save the original LTRP guardband value */ original_gb = snd_hdac_chip_readb(bus, VS_LTRP) & HDA_VS_INTEL_LTRP_GB_MASK; - if (plat_data->fw->size <= plat_data->fw_offset) { + if (sdev->basefw.fw->size <= sdev->basefw.payload_offset) { dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n"); return -EINVAL; } - stripped_firmware.size = plat_data->fw->size - plat_data->fw_offset; + stripped_firmware.size = sdev->basefw.fw->size - sdev->basefw.payload_offset; /* prepare capture stream for ICCMAX */ iccmax_stream = hda_cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, stripped_firmware.size, @@ -405,13 +404,13 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) chip_info = desc->chip_info; - if (plat_data->fw->size <= plat_data->fw_offset) { + if (sdev->basefw.fw->size <= sdev->basefw.payload_offset) { dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n"); return -EINVAL; } - stripped_firmware.data = plat_data->fw->data + plat_data->fw_offset; - stripped_firmware.size = plat_data->fw->size - plat_data->fw_offset; + stripped_firmware.data = sdev->basefw.fw->data + sdev->basefw.payload_offset; + stripped_firmware.size = sdev->basefw.fw->size - sdev->basefw.payload_offset; /* init for booting wait */ init_waitqueue_head(&sdev->boot_wait); From patchwork Thu Oct 20 12:12:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06F56C433FE for ; Thu, 20 Oct 2022 12:15:02 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1E15FA84F; Thu, 20 Oct 2022 14:14:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1E15FA84F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268100; bh=XLbqecGj+LTs3g2fH1TiOmFcVGXnoPAIqxLqFazp94k=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=m4w3kCBYI7+vSvZwEy7vEOeu8hLWCCaOelujjZ4slp4dWiDkcLMSHE9ryylRu98CL aYsYmQ3svDzS5WWwQL+M3PUYp8GOzx8p6tJRneu/GvzR3D5PW7y7hnn23Fzy8gY9Ir Usf8n/K4KNTkN7+ctHxAuCm/+ueh3wsfdlKJrdP4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 88D49F8055B; Thu, 20 Oct 2022 14:12:42 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 04D7EF80564; Thu, 20 Oct 2022 14:12:39 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4C9D3F80564 for ; Thu, 20 Oct 2022 14:12:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4C9D3F80564 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fNsEcLSS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267958; x=1697803958; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XLbqecGj+LTs3g2fH1TiOmFcVGXnoPAIqxLqFazp94k=; b=fNsEcLSSo1MsL7HoVFFOGb3/SOUb8f0rXpkrVGTK+dPPxiSaB/9u4o77 Jcc/JP4JxuHPVAPMnHd4B4RugF+W3Xc/n1G1H8LO53CTYXSPiL9OTZ6ub UXHxfx4WkL4XrYCKKiEu9H8RSLt7uJU9IKEmZb6F3Aqe3a9yNsicVmyQd KKMpYWxZi7ELUx5thf54g6OaLijE3V3iV+UrTEv03zvWuw5XnnsvilE5p 27lzAl8fxzeYNSVcPjQgW8NrlqcdW+K1NKDQE0rHpjs/YY1G2gCoaVTto qGst1lyVSVFzgmzQNHwRzho9hq8jEgGzz9eef2q43X5zajgNQdG8H6+El w==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256345" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256345" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:36 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663009968" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663009968" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:34 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 07/19] ASoC: SOF: ipc: ops: Add support for optional init and exit callbacks Date: Thu, 20 Oct 2022 15:12:26 +0300 Message-Id: <20221020121238.18339-8-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add support for IPC specific initialization (init) and cleanup (exit) callback. These callbacks can be used by IPC implementation to do basic initialization and cleanup. Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/ipc.c | 6 ++++++ sound/soc/sof/sof-priv.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index 6ed3f9b6a0c4..30781e808a02 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -200,6 +200,9 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev) return NULL; } + if (ops->init && ops->init(sdev)) + return NULL; + ipc->ops = ops; return ipc; @@ -217,5 +220,8 @@ void snd_sof_ipc_free(struct snd_sof_dev *sdev) mutex_lock(&ipc->tx_mutex); ipc->disable_ipc_tx = true; mutex_unlock(&ipc->tx_mutex); + + if (ipc->ops->exit) + ipc->ops->exit(sdev); } EXPORT_SYMBOL(snd_sof_ipc_free); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 3d70b57e4864..ea6013ab1d4a 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -443,6 +443,9 @@ struct sof_ipc_pcm_ops; * @fw_loader: Pointer to Firmware Loader ops * @fw_tracing: Pointer to Firmware tracing ops * + * @init: Optional pointer for IPC related initialization + * @exit: Optional pointer for IPC related cleanup + * * @tx_msg: Function pointer for sending a 'short' IPC message * @set_get_data: Function pointer for set/get data ('large' IPC message). This * function may split up the 'large' message and use the @tx_msg @@ -464,6 +467,9 @@ struct sof_ipc_ops { const struct sof_ipc_fw_loader_ops *fw_loader; const struct sof_ipc_fw_tracing_ops *fw_tracing; + int (*init)(struct snd_sof_dev *sdev); + void (*exit)(struct snd_sof_dev *sdev); + int (*tx_msg)(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes, void *reply_data, size_t reply_bytes, bool no_pm); int (*set_get_data)(struct snd_sof_dev *sdev, void *data, size_t data_bytes, From patchwork Thu Oct 20 12:12:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6096EC4332F for ; Thu, 20 Oct 2022 12:15:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8C334B94F; Thu, 20 Oct 2022 14:14:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8C334B94F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268131; bh=R8JozkiKpCIDL6DTAfnCV94Gczf2QS9j/Vvdd+j3VKk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=G8KtHf0KJIMJkzmctJlmBMQLhOeMjBRS/aiPH/3ySIVHDTl8d+fG2vnQ6+sC5b+xf eUSA2O8NbrnpaR8NJpGFb5lJeVgK3ZftgElRC077xvqVwitF7grzQkIZ1ZjC2DTIuI qAu57+Qx3aziXugz4J/CqmYTiiLiB7CxwoknTkv4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F229FF8059F; Thu, 20 Oct 2022 14:12:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DC5E3F8059F; Thu, 20 Oct 2022 14:12:47 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6419DF80564 for ; Thu, 20 Oct 2022 14:12:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6419DF80564 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PngyoSAQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267962; x=1697803962; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R8JozkiKpCIDL6DTAfnCV94Gczf2QS9j/Vvdd+j3VKk=; b=PngyoSAQtrUhzMGrSJzMGlltfwO+LXyCe3tk5hAUOukPWi4OKFh1t8qM 2f37X3APDzzIe/aO86xYzfv+Nw6MPWuP0YLaOBWwQ0BwIisU/eu+1H14R pbYA5ZTgnNyYlqttHReyo35LSwgTJ0XwYenAEKvPzBhJ1rjNctO3u3i60 hlRNxW55yzrxB9lPX+9fRwd6/CLiibCNnEaVcMrmV8UuSMHkwdgcoN8BI xiTsxBIL/QL0gnlYNIM+orD1Z1xZcqBqzq+1A0jmvHjik9OtdzX6l5Bhr E5K3hv39Ue6FFh5LwGCsHXuuzDvj35PS+ljKrkQz3ke5j+fKZCFOJi19K w==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256355" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256355" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:39 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663009996" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663009996" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:36 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 08/19] ASoC: SOF: ipc4-loader: Save the maximum number of libraries supported Date: Thu, 20 Oct 2022 15:12:27 +0300 Message-Id: <20221020121238.18339-9-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The firmware supports external libraries (containing modules) to be loaded runtime. The firmware configuration contains the maximum number of libraries supported, including the base firmware (which is library 0). Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/ipc4-loader.c | 7 +++++++ sound/soc/sof/ipc4-priv.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/sound/soc/sof/ipc4-loader.c b/sound/soc/sof/ipc4-loader.c index 9f433e9b4cd3..2495a205ef78 100644 --- a/sound/soc/sof/ipc4-loader.c +++ b/sound/soc/sof/ipc4-loader.c @@ -202,6 +202,13 @@ static int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev) trace_sof_ipc4_fw_config(sdev, "Trace log size", *tuple->value); ipc4_data->mtrace_log_bytes = *tuple->value; break; + case SOF_IPC4_FW_CFG_MAX_LIBS_COUNT: + trace_sof_ipc4_fw_config(sdev, "maximum number of libraries", + *tuple->value); + ipc4_data->max_libs_count = *tuple->value; + if (!ipc4_data->max_libs_count) + ipc4_data->max_libs_count = 1; + break; default: break; } diff --git a/sound/soc/sof/ipc4-priv.h b/sound/soc/sof/ipc4-priv.h index e3b8484a2f1f..7f5c7a47b3a7 100644 --- a/sound/soc/sof/ipc4-priv.h +++ b/sound/soc/sof/ipc4-priv.h @@ -32,6 +32,8 @@ enum sof_ipc4_mtrace_type { * @nhlt: NHLT table either from the BIOS or the topology manifest * @mtrace_type: mtrace type supported on the booted platform * @mtrace_log_bytes: log bytes as reported by the firmware via fw_config reply + * @max_libs_count: Maximum number of libraries support by the FW including the + * base firmware */ struct sof_ipc4_fw_data { u32 manifest_fw_hdr_offset; @@ -40,6 +42,7 @@ struct sof_ipc4_fw_data { void *nhlt; enum sof_ipc4_mtrace_type mtrace_type; u32 mtrace_log_bytes; + u32 max_libs_count; }; /** From patchwork Thu Oct 20 12:12:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616824 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E541C4332F for ; Thu, 20 Oct 2022 12:16:09 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4468F380A; Thu, 20 Oct 2022 14:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4468F380A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268167; bh=harZd7Lz+mWF1/Yn+jBNxNUw+FZSRnSwIU7PbYqHggE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UQEJDWxPujdy34aaCWCsiOqiSsyVi4g4EwRriwIDfHfuIBaziz3SOs/Bc76n0jUIb eZGQDXg0oTb/ql55SZBGzriZr/H+TA6lwTX/ZXUtva4k6WMb82sCn2+I0yO7F8zbwR uuSz1SitGmgY0AvY5m9pviDmvH7QZP5rmyE0b96E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 90F60F805AC; Thu, 20 Oct 2022 14:12:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 098A9F805A0; Thu, 20 Oct 2022 14:12:50 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EDA8DF80589 for ; Thu, 20 Oct 2022 14:12:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EDA8DF80589 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QEIaKLuz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267968; x=1697803968; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=harZd7Lz+mWF1/Yn+jBNxNUw+FZSRnSwIU7PbYqHggE=; b=QEIaKLuzy7NXGLPj2Hel4stBHYpatuznLcfb5tUOQPq/Zm+sKqZU0mA6 +fBk8BSzPXTwIYqgVR+7HfLT938pm39VgXt2D08PVKlV/pd/rj8uT6VZy OYdbyQTWhFtig1ITFNfvTiTesffV9vOiBnOcYgdeCh3kcBj8E29Ca5RTv HjyMiHLrDSJDKbHprjuGhpE3yVDbRJYd5+dCB+/a5ChXpSv66vmDabjKS Kwk0MizZECJbxZ2Ebs7R8FjhcQeFT1GDPnZ8IUDQjzbMngKHm7m39wRIs YvIM2+tpOZQotZb0fihWaTq54ZhH1tYTUCP2+8TJNBOYzJySBaqV6duN6 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256370" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256370" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:45 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663010033" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663010033" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:42 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 10/19] ASoC: SOF: IPC4: Add helper for looking up module by UUID Date: Thu, 20 Oct 2022 15:12:29 +0300 Message-Id: <20221020121238.18339-11-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add a simple helper to walk the loaded libraries and their modules to make the ipc4-topology not aware of the underlying infrastructure and simplify the code. Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/ipc4-loader.c | 21 +++++++++++++++++++++ sound/soc/sof/ipc4-priv.h | 3 +++ sound/soc/sof/ipc4-topology.c | 17 +++-------------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/sound/soc/sof/ipc4-loader.c b/sound/soc/sof/ipc4-loader.c index 5506ec997328..b7e8b3f3d4f0 100644 --- a/sound/soc/sof/ipc4-loader.c +++ b/sound/soc/sof/ipc4-loader.c @@ -160,6 +160,27 @@ static size_t sof_ipc4_fw_parse_basefw_ext_man(struct snd_sof_dev *sdev) return payload_offset; } +struct sof_ipc4_fw_module *sof_ipc4_find_module_by_uuid(struct snd_sof_dev *sdev, + const guid_t *uuid) +{ + struct sof_ipc4_fw_data *ipc4_data = sdev->private; + struct sof_ipc4_fw_library *fw_lib; + unsigned long lib_id; + int i; + + if (guid_is_null(uuid)) + return NULL; + + xa_for_each(&ipc4_data->fw_lib_xa, lib_id, fw_lib) { + for (i = 0; i < fw_lib->num_modules; i++) { + if (guid_equal(uuid, &fw_lib->modules[i].man4_module_entry.uuid)) + return &fw_lib->modules[i]; + } + } + + return NULL; +} + static int sof_ipc4_validate_firmware(struct snd_sof_dev *sdev) { struct sof_ipc4_fw_data *ipc4_data = sdev->private; diff --git a/sound/soc/sof/ipc4-priv.h b/sound/soc/sof/ipc4-priv.h index bce168083f09..ecfa9f701ef1 100644 --- a/sound/soc/sof/ipc4-priv.h +++ b/sound/soc/sof/ipc4-priv.h @@ -84,4 +84,7 @@ extern const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops; int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 id, u32 state); int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core); + +struct sof_ipc4_fw_module *sof_ipc4_find_module_by_uuid(struct snd_sof_dev *sdev, + const guid_t *uuid); #endif diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 98f7f5421ba5..ab85dde4303b 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -289,22 +289,11 @@ static int sof_ipc4_widget_set_module_info(struct snd_sof_widget *swidget) { struct snd_soc_component *scomp = swidget->scomp; struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); - struct sof_ipc4_fw_data *ipc4_data = sdev->private; - struct sof_ipc4_fw_library *fw_lib; - unsigned long lib_id; - int i; - xa_for_each(&ipc4_data->fw_lib_xa, lib_id, fw_lib) { - /* set module info */ - for (i = 0; i < fw_lib->num_modules; i++) { - struct sof_ipc4_fw_module *module = &fw_lib->modules[i]; + swidget->module_info = sof_ipc4_find_module_by_uuid(sdev, &swidget->uuid); - if (guid_equal(&swidget->uuid, &module->man4_module_entry.uuid)) { - swidget->module_info = module; - return 0; - } - } - } + if (swidget->module_info) + return 0; dev_err(sdev->dev, "failed to find module info for widget %s with UUID %pUL\n", swidget->widget->name, &swidget->uuid); From patchwork Thu Oct 20 12:12:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97A3BC4332F for ; Thu, 20 Oct 2022 12:16:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D4171B951; Thu, 20 Oct 2022 14:15:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D4171B951 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268199; bh=HIJX79Cmx+QrbG5qu/NnUufTMEwinzfDKMcENe5d77M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QDhBJHXkFwM6VW7GrmNd4VyzUuWNdk2Hjwb3U68ls1VsHBZWu/pelNuebpRx8WvMI Ee2kCNrZlaq0gqcAI7udkN+dHE3HggnXLlYPuRacft+BnBDvPLkJHDvA4P3hq6BDKH RO+rVRcXBr9Q7VqIPSxalR6+1qaI0OaqWTVjeiXE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2B59CF805C0; Thu, 20 Oct 2022 14:12:59 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4FB1AF805C0; Thu, 20 Oct 2022 14:12:57 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6FADBF805B1 for ; Thu, 20 Oct 2022 14:12:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6FADBF805B1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VXpesf/W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267973; x=1697803973; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HIJX79Cmx+QrbG5qu/NnUufTMEwinzfDKMcENe5d77M=; b=VXpesf/WiZ791R+1yRdSvcw1RN+jBB/UPpWq2bbkBn5jwKktYFMyx7K8 oxTlJubLWVNLpWC3FAbVzW/VuPQd6GFZqIRq5ZaHo6mzrozlaUjnzoY/T 2D0hbuqB3Sv+4wBoCNYWICqBvpPchat3F3Xrlxc01WtgbXtwZtkOiKRxD UzuIF6SeEpQBYwXYhA8Km6xNeienxq1bPPCOBpq/xuJ9AQRQoXSJpkXik 7wIuXdT5AhnaAF33xsgsL3GdQDyJm7kSUrsdAuzILcJgqvotF6dl5lx3f WXxK14bekUsuA44v5R6PlEYxfnfda03XuYoZot7CF2aKIdQq7f0JulhyK g==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256388" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256388" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:50 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663010072" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663010072" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:47 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 12/19] ASoC: SOF: Intel: Set the default firmware library path for IPC4 Date: Thu, 20 Oct 2022 15:12:31 +0300 Message-Id: <20221020121238.18339-13-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The default path for the external firmware libraries are: intel/avs-lib/ or intel/sof-ipc4-lib/ Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/intel/pci-apl.c | 6 ++++++ sound/soc/sof/intel/pci-cnl.c | 9 +++++++++ sound/soc/sof/intel/pci-icl.c | 6 ++++++ sound/soc/sof/intel/pci-mtl.c | 3 +++ sound/soc/sof/intel/pci-tgl.c | 21 +++++++++++++++++++++ 5 files changed, 45 insertions(+) diff --git a/sound/soc/sof/intel/pci-apl.c b/sound/soc/sof/intel/pci-apl.c index 998e219011f0..69279dcc92dc 100644 --- a/sound/soc/sof/intel/pci-apl.c +++ b/sound/soc/sof/intel/pci-apl.c @@ -33,6 +33,9 @@ static const struct sof_dev_desc bxt_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/apl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/apl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -61,6 +64,9 @@ static const struct sof_dev_desc glk_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/glk", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/glk", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", diff --git a/sound/soc/sof/intel/pci-cnl.c b/sound/soc/sof/intel/pci-cnl.c index c797356f7028..8db3f8d15b55 100644 --- a/sound/soc/sof/intel/pci-cnl.c +++ b/sound/soc/sof/intel/pci-cnl.c @@ -34,6 +34,9 @@ static const struct sof_dev_desc cnl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/cnl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/cnl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -62,6 +65,9 @@ static const struct sof_dev_desc cfl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/cnl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/cnl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -91,6 +97,9 @@ static const struct sof_dev_desc cml_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/cnl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/cnl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", diff --git a/sound/soc/sof/intel/pci-icl.c b/sound/soc/sof/intel/pci-icl.c index 48f24f8ace26..d6cf75e357db 100644 --- a/sound/soc/sof/intel/pci-icl.c +++ b/sound/soc/sof/intel/pci-icl.c @@ -34,6 +34,9 @@ static const struct sof_dev_desc icl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/icl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/icl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -62,6 +65,9 @@ static const struct sof_dev_desc jsl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/jsl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/jsl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", diff --git a/sound/soc/sof/intel/pci-mtl.c b/sound/soc/sof/intel/pci-mtl.c index 9f39da984e9f..6e4e6d4ef5a5 100644 --- a/sound/soc/sof/intel/pci-mtl.c +++ b/sound/soc/sof/intel/pci-mtl.c @@ -34,6 +34,9 @@ static const struct sof_dev_desc mtl_desc = { .default_fw_path = { [SOF_INTEL_IPC4] = "intel/sof-ipc4/mtl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/sof-ipc4-lib/mtl", + }, .default_tplg_path = { [SOF_INTEL_IPC4] = "intel/sof-ace-tplg", }, diff --git a/sound/soc/sof/intel/pci-tgl.c b/sound/soc/sof/intel/pci-tgl.c index 757a7c6bb770..e80c4dfef85a 100644 --- a/sound/soc/sof/intel/pci-tgl.c +++ b/sound/soc/sof/intel/pci-tgl.c @@ -34,6 +34,9 @@ static const struct sof_dev_desc tgl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/tgl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/tgl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -62,6 +65,9 @@ static const struct sof_dev_desc tglh_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/tgl-h", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/tgl-h", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -90,6 +96,9 @@ static const struct sof_dev_desc ehl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/ehl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/ehl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -118,6 +127,9 @@ static const struct sof_dev_desc adls_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/adl-s", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/adl-s", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -146,6 +158,9 @@ static const struct sof_dev_desc adl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/adl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/adl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -205,6 +220,9 @@ static const struct sof_dev_desc rpls_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/rpl-s", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/rpl-s", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", @@ -233,6 +251,9 @@ static const struct sof_dev_desc rpl_desc = { [SOF_IPC] = "intel/sof", [SOF_INTEL_IPC4] = "intel/avs/rpl", }, + .default_lib_path = { + [SOF_INTEL_IPC4] = "intel/avs-lib/rpl", + }, .default_tplg_path = { [SOF_IPC] = "intel/sof-tplg", [SOF_INTEL_IPC4] = "intel/avs-tplg", From patchwork Thu Oct 20 12:12:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616822 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F32C5C4332F for ; Thu, 20 Oct 2022 12:17:09 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 17A33B94B; Thu, 20 Oct 2022 14:16:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 17A33B94B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268228; bh=Xj8w222ACi84RYUXalfRWFmffwg/1MxjQrKP2Ddxr5M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UYrPbIEkie9712Y22qj/N6zSJQf2G9gZ2mmg/8VUeOWDizEa4mvpJUwV/y4KDqBOD vgBKk9hu5ne7NS/H+G9MM18ZtVbk7GEm0XvA7LYqaOTknwjMg3CGs2jfZd1V07tl+R +0XWzBAWDXZFl6pXZTwI+/u/HwEPGWSR3eVurV0g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 16038F805C7; Thu, 20 Oct 2022 14:13:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AF4E0F805BB; Thu, 20 Oct 2022 14:13:01 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E2464F805BB for ; Thu, 20 Oct 2022 14:12:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E2464F805BB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Wo70PWQI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267979; x=1697803979; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xj8w222ACi84RYUXalfRWFmffwg/1MxjQrKP2Ddxr5M=; b=Wo70PWQIngQCOA80Zt9+z9g+IVctUcei+BYx4Dwver+od5fUx/zGOWLe 73drZ4VyUo5/JmU3tAmnwr2sBlTwjgCNAaBhzKswOqF1SCvIOKYOo9/qa AGNbNT9cdOdxFZ0r1uEa8eSh6uG1SkTWxVzLg0ZL/tLLUqkFcqY9+vKVi vnA8D+EZk3GX8kHvJx3Iyx02pK0tFS2933H5G8j87foL2ZKW8ty7e889Z xIigvxSJvpXH7s4u7QWOAsm2DmeGHuR2cz++C2LlLnuRkS+QPzKYhFp3I nxuZeiNeY3aRfkTdDwYPJMMX0UG42O283CleUAZqoQbawSLhCFkVtpbNi Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256407" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256407" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:56 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663010112" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663010112" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:53 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 14/19] ASoC: SOF: Intel: hda: Add flag to indicate that the firmware is IMR booted Date: Thu, 20 Oct 2022 15:12:33 +0300 Message-Id: <20221020121238.18339-15-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Dynamic loading of external libraries should not be done if the firmware was booted from IMR since in that case the libraries will be restored along with the basefw. The booted_from_imr flag is introduced and set to true if the IMR boot was successful and to false if cold booting is executed. The reason for the new flag is that guessing from existing flags, used to decide if we should try booting from IMR or not is not going to be robust as the IMR boot itself can fail and in that case a full, cold boot is executed. Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/intel/hda-loader.c | 6 +++++- sound/soc/sof/intel/hda.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c index 147ddc5ee932..5ed524e166d2 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -396,12 +396,16 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) dev_dbg(sdev->dev, "IMR restore supported, booting from IMR directly\n"); hda->boot_iteration = 0; ret = hda_dsp_boot_imr(sdev); - if (!ret) + if (!ret) { + hda->booted_from_imr = true; return 0; + } dev_warn(sdev->dev, "IMR restore failed, trying to cold boot\n"); } + hda->booted_from_imr = false; + chip_info = desc->chip_info; if (sdev->basefw.fw->size <= sdev->basefw.payload_offset) { diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 65657d145dc2..4d9eb321a046 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -481,6 +481,7 @@ enum sof_hda_D0_substate { struct sof_intel_hda_dev { bool imrboot_supported; bool skip_imr_boot; + bool booted_from_imr; int boot_iteration; From patchwork Thu Oct 20 12:12:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616820 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 015E1C433FE for ; Thu, 20 Oct 2022 12:18:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2BA1A37AB; Thu, 20 Oct 2022 14:17:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2BA1A37AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268296; bh=4TEBX8EwgFg+vodi7TTyk76ED89H2x9OnLo/TLKQtPA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PnQYyL7eFoGefl8HuWsPsZLaKobEYTlFXDpNlD+GM4SCNEvj4TZ7aLXxZt5LsRemz DWkcV4ZH2Iv6YVr+XQSO8zTn3hhOE1fR2O3stjJAS38E7HYPWjKHXYfJnMgQ3Kv7pG EZ3Fz9jf2/L7M0DwoI9tFMLAIkWcMdjoiP1z9cxg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1A786F80542; Thu, 20 Oct 2022 14:13:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B2E25F8053C; Thu, 20 Oct 2022 14:13:17 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 64695F805C9 for ; Thu, 20 Oct 2022 14:13:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 64695F805C9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HZQab413" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267984; x=1697803984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4TEBX8EwgFg+vodi7TTyk76ED89H2x9OnLo/TLKQtPA=; b=HZQab413BbNURgBRODl6co0r+rqZer3X6p6/vR3K5wU+dmnGXt6w8FUS 9X33G7tIcQlblpSbb/F7jCQzrVFzHsiTpbs2rIkFGgEGONJ8f69LAHyCi bSicOyTnYe4bobARXN2iSoZckHJ26w7FeDy6gOaPVo4ci4Qnn1Cd+IX1s EyBFB8UgfIeVYs920fr5eB8Z/sXxcW48/s9CCJbPFbFv6PQLfZVUWUizZ 6vLaJUqrdwoN9pgSfmYWm1YF6eVutKT96stpkHyBJq8fOmTF3hbxIqfX4 7gxszwLfMQOwzuCq//+k7Wxiyn8w0q1ndAOvKRORkUrL/JEChcZTEBO+N Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256424" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256424" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:13:01 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663010150" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663010150" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:12:58 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 16/19] ASoC: SOF: loader: Add support for IPC dependent post firmware boot ops Date: Thu, 20 Oct 2022 15:12:35 +0300 Message-Id: <20221020121238.18339-17-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add support for executing IPC dependent tasks after a successful firmware boot. The new post_fw_boot ops can make the fw_loader query_fw_configuration callback redundant as IPC code can handle the first boot internally. Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/loader.c | 6 ++++++ sound/soc/sof/sof-priv.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c index 723bd8267a3d..a1c4a51636c9 100644 --- a/sound/soc/sof/loader.c +++ b/sound/soc/sof/loader.c @@ -174,6 +174,12 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev) return ret; } + if (sdev->ipc->ops->post_fw_boot) { + ret = sdev->ipc->ops->post_fw_boot(sdev); + if (ret) + return ret; + } + if (sdev->first_boot && sdev->ipc->ops->fw_loader->query_fw_configuration) return sdev->ipc->ops->fw_loader->query_fw_configuration(sdev); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index ea6013ab1d4a..c7ab78b042aa 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -445,6 +445,8 @@ struct sof_ipc_pcm_ops; * * @init: Optional pointer for IPC related initialization * @exit: Optional pointer for IPC related cleanup + * @post_fw_boot: Optional pointer to execute IPC related tasks after firmware + * boot. * * @tx_msg: Function pointer for sending a 'short' IPC message * @set_get_data: Function pointer for set/get data ('large' IPC message). This @@ -469,6 +471,7 @@ struct sof_ipc_ops { int (*init)(struct snd_sof_dev *sdev); void (*exit)(struct snd_sof_dev *sdev); + int (*post_fw_boot)(struct snd_sof_dev *sdev); int (*tx_msg)(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes, void *reply_data, size_t reply_bytes, bool no_pm); From patchwork Thu Oct 20 12:12:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 616821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D839BC433FE for ; Thu, 20 Oct 2022 12:17:51 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0AF25B95E; Thu, 20 Oct 2022 14:17:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0AF25B95E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666268270; bh=pG5f4b7Y7kY7R2vw4tdnNGiff5DiDZqyzyt1sLyP1P4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ojoK6OXOdmP8eLjtprMqKX9qYk2hhC4R7xOUWr4F1D+MLC2r6scG2AE0I0L2usBC/ tQzcUcy1zcopxyaGW/hj68LjwLXIs+1Ftysr9QQyq3yeMrzO01uN5ZqPZ+wkadlDLc wwZMMCyvyT+L0eteZizqVGRKeuctupmzEp9PiYRM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D8392F805E1; Thu, 20 Oct 2022 14:13:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8081EF805E1; Thu, 20 Oct 2022 14:13:12 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 03E1EF805D4 for ; Thu, 20 Oct 2022 14:13:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 03E1EF805D4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IZCmOHAT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666267987; x=1697803987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pG5f4b7Y7kY7R2vw4tdnNGiff5DiDZqyzyt1sLyP1P4=; b=IZCmOHATOr6DIWxyqmEBM3OZGdbuepwSahyAXR9Cf9EuuY8l+ekwc9dD cJBaKF+V/za2PYc6NRftA1e+NV8ieT6poTkq3KrRRDaZRtiYomYfwA3vn sSABErmMqPnCv4igWsUklcb93BADmKDC+tfOcDuf+EQjrQj5KEtcb/T34 7mnIlUryPJbmJp1yJ0A7D0z+BoiCDXLSsU3m8Rlipzcq1awDYjrX+f9Oc K2bdfcBkVZVMUtMsmcXMO5NS/8VZNFGyL/BXn1V3LsfQlg0e6I9rEjgQ5 Fj6l2Ekq9kIC1SES4iBrMuiBa8q4f/bthjM6ht3xu0CEqNpjl/gD3bJtw Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333256435" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="333256435" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:13:04 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="663010173" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="663010173" Received: from awrynn-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.12.86]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 05:13:01 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 17/19] ASoC: SOF: ipc4: Stop using the query_fw_configuration fw_loader ops Date: Thu, 20 Oct 2022 15:12:36 +0300 Message-Id: <20221020121238.18339-18-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> References: <20221020121238.18339-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, chao.song@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Execute the configuration query from the generic post_fw_boot callback and do not set the query_fw_configuration ops to allow it's removal. Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Chao Song Reviewed-by: Kai Vehmanen --- sound/soc/sof/ipc4-loader.c | 3 +-- sound/soc/sof/ipc4-priv.h | 1 + sound/soc/sof/ipc4.c | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/ipc4-loader.c b/sound/soc/sof/ipc4-loader.c index b7e8b3f3d4f0..dbe3ee4ef08c 100644 --- a/sound/soc/sof/ipc4-loader.c +++ b/sound/soc/sof/ipc4-loader.c @@ -202,7 +202,7 @@ static int sof_ipc4_validate_firmware(struct snd_sof_dev *sdev) return 0; } -static int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev) +int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev) { struct sof_ipc4_fw_data *ipc4_data = sdev->private; const struct sof_ipc_ops *iops = sdev->ipc->ops; @@ -273,5 +273,4 @@ static int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev) const struct sof_ipc_fw_loader_ops ipc4_loader_ops = { .validate = sof_ipc4_validate_firmware, .parse_ext_manifest = sof_ipc4_fw_parse_basefw_ext_man, - .query_fw_configuration = sof_ipc4_query_fw_configuration, }; diff --git a/sound/soc/sof/ipc4-priv.h b/sound/soc/sof/ipc4-priv.h index 7e7115ada2a2..e4bd6d93fb0f 100644 --- a/sound/soc/sof/ipc4-priv.h +++ b/sound/soc/sof/ipc4-priv.h @@ -90,6 +90,7 @@ extern const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops; int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 id, u32 state); int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core); +int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev); struct sof_ipc4_fw_module *sof_ipc4_find_module_by_uuid(struct snd_sof_dev *sdev, const guid_t *uuid); #endif diff --git a/sound/soc/sof/ipc4.c b/sound/soc/sof/ipc4.c index cafbd75d8762..91c4ea72b4b6 100644 --- a/sound/soc/sof/ipc4.c +++ b/sound/soc/sof/ipc4.c @@ -687,9 +687,18 @@ static void sof_ipc4_exit(struct snd_sof_dev *sdev) xa_destroy(&ipc4_data->fw_lib_xa); } +static int sof_ipc4_post_boot(struct snd_sof_dev *sdev) +{ + if (sdev->first_boot) + return sof_ipc4_query_fw_configuration(sdev); + + return 0; +} + const struct sof_ipc_ops ipc4_ops = { .init = sof_ipc4_init, .exit = sof_ipc4_exit, + .post_fw_boot = sof_ipc4_post_boot, .tx_msg = sof_ipc4_tx_msg, .rx_msg = sof_ipc4_rx_msg, .set_get_data = sof_ipc4_set_get_data,