From patchwork Fri Dec 15 08:31:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13494108 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF8F512E58 for ; Fri, 15 Dec 2023 08:17:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Vf+oJzrr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702628245; x=1734164245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kwflmmhNZONA4rW+VKgS7JbnBTIZJk36G+az/1qW6ns=; b=Vf+oJzrrQWdGK4YdlmlNd53yyY86kwVMVYdZRo0K/NV8RU6K0gadOEtj 3VHmb31ewulAs69QHphkhueaZbhyCzmr00cxRHAMO+p1AC2Ezy2jhh3c1 Q19F0up0cW9DDLIm9AhFCEQyBC4xhfvh883XrGEIWdEBLNjbCzhEkOY7G e1nRjvikYauMmUmxPR/tTHoXoOC85TRaB3CZ9vweVfUqrC+Izr9qGpecF 3IXFVsnZDI1mw/ewRRCAnAkbUWgZE5G+vrdgkI5BlJWhfkLnBYrXrwIhN DRzc+7Q55Px/lEkffGGeanFFaQSdcZrqTv8Z4WBX9PwD5KdNRWisz2su6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="2414124" X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="2414124" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 00:17:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="16206819" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 00:17:23 -0800 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH 1/3] ASoC: SOF: IPC4: synchronize fw_config_params with fw definitions Date: Fri, 15 Dec 2023 16:31:00 +0800 Message-Id: <20231215083102.3064200-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215083102.3064200-1-yung-chuan.liao@linux.intel.com> References: <20231215083102.3064200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Rander Wang Update fw_config_params in driver. Signed-off-by: Rander Wang Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- include/sound/sof/ipc4/header.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/sound/sof/ipc4/header.h b/include/sound/sof/ipc4/header.h index 2c81d6dde577..1eb538e18236 100644 --- a/include/sound/sof/ipc4/header.h +++ b/include/sound/sof/ipc4/header.h @@ -423,6 +423,12 @@ enum sof_ipc4_fw_config_params { SOF_IPC4_FW_CFG_RESERVED, SOF_IPC4_FW_CFG_POWER_GATING_POLICY, SOF_IPC4_FW_CFG_ASSERT_MODE, + SOF_IPC4_FW_RESERVED1, + SOF_IPC4_FW_RESERVED2, + SOF_IPC4_FW_RESERVED3, + SOF_IPC4_FW_RESERVED4, + SOF_IPC4_FW_RESERVED5, + SOF_IPC4_FW_CONTEXT_SAVE }; struct sof_ipc4_fw_version { From patchwork Fri Dec 15 08:31:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13494109 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0A0A13AF6 for ; Fri, 15 Dec 2023 08:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="R/nl844l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702628247; x=1734164247; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DELCmHn2rLPgGpXQonJqBtlZXcCxRqE5FP9uGZArDh0=; b=R/nl844lMrGFIKK9d9a+HSLoaiP+9aGDe9cfFeGKm67rGAu89iS9y9Ih OHB81ck9IrwSdX9BdghoxvxlphoEyQW0Gwib2qoYvjJVCFyAhwwWzgHqB rvJgP5bvhjm+cratRHlYheEcDhRNCrRNyHlpgde/McMF6us3WxbqGJXG5 h6igrTDzGYxM7qk4DlErP1inqKo7hn5iR3oUbm+Et++1jSV8n0zFDdihS ayRQXTNpLP6c2CO5lzQnRxDsbKbl0nuVAjMSZiivDQxo/g50AfyV5unIi eXmEh2gPd/A2jBw0o8QdQxc+exSCnlMiQBne6q9kou6RkVFwNaMptjniF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="2414128" X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="2414128" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 00:17:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="16206829" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 00:17:25 -0800 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH 2/3] ASoC: SOF: IPC4: query fw_context_save feature from fw Date: Fri, 15 Dec 2023 16:31:01 +0800 Message-Id: <20231215083102.3064200-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215083102.3064200-1-yung-chuan.liao@linux.intel.com> References: <20231215083102.3064200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Rander Wang Driver queries fw_context_save feature when fw is ready and can skip library reload with this feature since library is saved in persistent memory. The default value of fw_context_save is true unless fw reports false. Signed-off-by: Rander Wang Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- sound/soc/sof/intel/lnl.c | 2 ++ sound/soc/sof/intel/mtl.c | 2 ++ sound/soc/sof/intel/tgl.c | 2 ++ sound/soc/sof/ipc4-loader.c | 3 +++ sound/soc/sof/ipc4-priv.h | 1 + 5 files changed, 10 insertions(+) diff --git a/sound/soc/sof/intel/lnl.c b/sound/soc/sof/intel/lnl.c index dfbe4067a349..ec2a346100f3 100644 --- a/sound/soc/sof/intel/lnl.c +++ b/sound/soc/sof/intel/lnl.c @@ -156,6 +156,8 @@ int sof_lnl_ops_init(struct snd_sof_dev *sdev) ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2; + ipc4_data->fw_context_save = true; + /* External library loading support */ ipc4_data->load_library = hda_dsp_ipc4_load_library; diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c index d4b666f125ea..df05dc77b8d5 100644 --- a/sound/soc/sof/intel/mtl.c +++ b/sound/soc/sof/intel/mtl.c @@ -718,6 +718,8 @@ int sof_mtl_ops_init(struct snd_sof_dev *sdev) ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2; + ipc4_data->fw_context_save = true; + /* External library loading support */ ipc4_data->load_library = hda_dsp_ipc4_load_library; diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c index d890cac6cb01..c2bb04c89b9d 100644 --- a/sound/soc/sof/intel/tgl.c +++ b/sound/soc/sof/intel/tgl.c @@ -91,6 +91,8 @@ int sof_tgl_ops_init(struct snd_sof_dev *sdev) ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2; + ipc4_data->fw_context_save = true; + /* External library loading support */ ipc4_data->load_library = hda_dsp_ipc4_load_library; diff --git a/sound/soc/sof/ipc4-loader.c b/sound/soc/sof/ipc4-loader.c index eaa04762eb11..3539b0a66e1b 100644 --- a/sound/soc/sof/ipc4-loader.c +++ b/sound/soc/sof/ipc4-loader.c @@ -391,6 +391,9 @@ int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev) goto out; } break; + case SOF_IPC4_FW_CONTEXT_SAVE: + ipc4_data->fw_context_save = *tuple->value; + break; default: break; } diff --git a/sound/soc/sof/ipc4-priv.h b/sound/soc/sof/ipc4-priv.h index fea93b693f4d..1d39836d5efa 100644 --- a/sound/soc/sof/ipc4-priv.h +++ b/sound/soc/sof/ipc4-priv.h @@ -81,6 +81,7 @@ struct sof_ipc4_fw_data { u32 mtrace_log_bytes; int max_num_pipelines; u32 max_libs_count; + bool fw_context_save; int (*load_library)(struct snd_sof_dev *sdev, struct sof_ipc4_fw_library *fw_lib, bool reload); From patchwork Fri Dec 15 08:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13494110 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EEE6111B1 for ; Fri, 15 Dec 2023 08:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hV2RBr9A" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702628249; x=1734164249; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zwLBxMonVK0AOgxTrekrxFdQ+N4/czfNF8KfEhPQQ2w=; b=hV2RBr9A4mqqtvL4SYLXNyq0S8pxYAKmdcbO8u1qKf2JayWqpDy9gS0K tdEwm372M4k8idRQ5Wmrb+7nqPQP+jPvgTaoQAmBfV01Y1g3cO1YVsOqX 1+lKYLWMXqBm+2e53PFixf7kgqXho1wYDN7M5YRGEjHquDQZ71ZMJpGDE gnhKJLWTMW135/O1z+Oo64vya84EUTH6qrqT9F5lVjahxYcpdcpjehm6x j0sxzCTUE6a8z+FyCxhH9ktxDnr3lp6WM/d5kRzD5eCE6pjp/fRMytakG XNCZwbr8oYyGqgPdCrDvB/Fo0QZ57Ag5pbeIUB+hN2D/B7yjqVPSDji78 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="2414133" X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="2414133" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 00:17:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="16206837" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 00:17:27 -0800 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH 3/3] ASoC: SOF: Intel: check fw_context_save for library reload Date: Fri, 15 Dec 2023 16:31:02 +0800 Message-Id: <20231215083102.3064200-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215083102.3064200-1-yung-chuan.liao@linux.intel.com> References: <20231215083102.3064200-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Rander Wang If fw_context_save is defined by fw, driver can skip library reload on d3 exit or reload library. Signed-off-by: Rander Wang Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- sound/soc/sof/intel/hda-loader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c index bc3256d714f0..d5af0a5fc46e 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -551,14 +551,15 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev, struct sof_ipc4_fw_library *fw_lib, bool reload) { struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; + struct sof_ipc4_fw_data *ipc4_data = sdev->private; struct hdac_ext_stream *hext_stream; struct firmware stripped_firmware; struct sof_ipc4_msg msg = {}; struct snd_dma_buffer dmab; int ret, ret1; - /* IMR booting will restore the libraries as well, skip the loading */ - if (reload && hda->booted_from_imr) + /* if IMR booting is enabled and fw context is saved for D3 state, skip the loading */ + if (reload && hda->booted_from_imr && ipc4_data->fw_context_save) return 0; /* the fw_lib has been verified during loading, we can trust the validity here */