ASoC: SOF: fixes and improvements
Subsystems (3)
cover ASoC: SOF: fixes and improvements
No new features in this patchset but fixes and improvements identified during validation/product hardening/SoundWire development.
I realize we are at the end of the merge window so will let Takashi/Mark decide if this series can be provided as fixes for v5.4 or queued for later.
Kai Vehmanen (2):
ASoC: SOF: pcm: fix resource leak in hw_free
ASoC: SOF: Intel: hda: fix warnings during FW load
Keyon Jie (1):
ASoC: SOF: topology: fix parse fail issue for byte/bool tuple types
Liam Girdwood (3):
ASoC: SOF: ipc: retain DSP context after FW exception.
ASoC: SOF: Intel: initialise and verify FW crash dump data.
ASoC: SOF: Intel: Add context data to any IPC timeout.
Marcin Rajwa (2):
ASoC: SOF: ipc: introduce no_stream_position in sof_ipc_stream_params
struct
ASoC: SOF: Intel: hda: fix reset of host_period_bytes
Pan Xiuli (1):
ASoC: SOF: pcm: harden PCM STOP sequence
Pierre-Louis Bossart (2):
ASoC: SOF: loader: fix kernel oops on firmware boot failure
ASoC: SOF: trace: move to opt-in with Kconfig and module parameter
Ranjani Sridharan (2):
ASoC: SOF: core: check for mandatory fw_ready op during SOF probe
ASoC: SOF: Intel: hda: Disable DMI L1 entry during capture
include/sound/sof/stream.h | 4 +-- sound/soc/sof/Kconfig | 16 ++++++++++++ sound/soc/sof/core.c | 28 +++++++++++++++----- sound/soc/sof/debug.c | 16 ++++++++++++ sound/soc/sof/intel/Kconfig | 10 +++++++ sound/soc/sof/intel/bdw.c | 29 +++++++++++++++++++- sound/soc/sof/intel/byt.c | 29 +++++++++++++++++++- sound/soc/sof/intel/hda-ctrl.c | 12 +++------ sound/soc/sof/intel/hda-loader.c | 1 + sound/soc/sof/intel/hda-pcm.c | 15 ++++++++--- sound/soc/sof/intel/hda-stream.c | 45 +++++++++++++++++++++++++++----- sound/soc/sof/intel/hda.c | 7 +++++ sound/soc/sof/intel/hda.h | 5 +++- sound/soc/sof/ipc.c | 10 +------ sound/soc/sof/loader.c | 4 +-- sound/soc/sof/pcm.c | 35 +++++++++++++++++-------- sound/soc/sof/sof-priv.h | 17 ++++++++---- sound/soc/sof/topology.c | 4 ++- sound/soc/sof/trace.c | 17 +++++++++++- 19 files changed, 245 insertions(+), 59 deletions(-)
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 1/13 ASoC: SOF: loader: fix kernel oops on firmware boot failure
When we fail to boot the firmware, we encounter a kernel oops in hda_dsp_get_registers(), which is called conditionally in hda_dsp_dump() when the sdev_>boot_complete flag is set.
Setting this flag _after_ dumping the data fixes the issue and does not change the programming flow.
--- sound/soc/sof/loader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/loader.c +2 -2
@@ -546,10 +546,10 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev) msecs_to_jiffies(sdev->boot_timeout));if (ret ==0 ) {dev_err (sdev->dev,"error: firmware boot failure\n" ); -/* after this point FW_READY msg should be ignored */ - sdev->boot_complete = true;snd_sof_dsp_dbg_dump (sdev,SOF_DBG_REGS |SOF_DBG_MBOX |SOF_DBG_TEXT |SOF_DBG_PCI ); +/* after this point FW_READY msg should be ignored */ + sdev->boot_complete = true;return -EIO ; }
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: loader: fix kernel oops on firmware boot failure" to the asoc tree
The patch
ASoC: SOF: loader: fix kernel oops on firmware boot failure
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 798614885a0e1b867ceb0197c30c2d82575c73b0 Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 27 Sep 2019 15:05:26 -0500
Subject: [PATCH] ASoC: SOF: loader: fix kernel oops on firmware boot failure
When we fail to boot the firmware, we encounter a kernel oops in hda_dsp_get_registers(), which is called conditionally in hda_dsp_dump() when the sdev_>boot_complete flag is set.
Setting this flag _after_ dumping the data fixes the issue and does not change the programming flow.
--- sound/soc/sof/loader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/loader.c +2 -2
@@ -546,10 +546,10 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev) msecs_to_jiffies(sdev->boot_timeout));if (ret ==0 ) {dev_err (sdev->dev,"error: firmware boot failure\n" ); -/* after this point FW_READY msg should be ignored */ - sdev->boot_complete = true;snd_sof_dsp_dbg_dump (sdev,SOF_DBG_REGS |SOF_DBG_MBOX |SOF_DBG_TEXT |SOF_DBG_PCI ); +/* after this point FW_READY msg should be ignored */ + sdev->boot_complete = true;return -EIO ; }
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/13 ASoC: SOF: topology: fix parse fail issue for byte/bool tuple types
In reply to Pierre-Louis BossartFrom: Keyon Jie <[email protected]>
We are using sof_parse_word_tokens() to parse tokens with bool/byte/short/word tuple types, here add the missing check, to fix the parsing failure at byte/bool tuple types.
--- sound/soc/sof/topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/sof/topology.c +3 -1
@@ -920,7 +920,9 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp,for (j =0 ; j < count; j++) {/* match token type */ if (!(tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_WORD || - tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_SHORT )) + tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_SHORT || + tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_BYTE || + tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_BOOL ))continue ;/* match token id */
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: topology: fix parse fail issue for byte/bool tuple types" to the asoc tree
The patch
ASoC: SOF: topology: fix parse fail issue for byte/bool tuple types
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 2e305a074061121220a2828f97a57d315cf8efba Mon Sep 17 00:00:00 2001
From: Keyon Jie <[email protected]>
Date: Fri, 27 Sep 2019 15:05:27 -0500
Subject: [PATCH] ASoC: SOF: topology: fix parse fail issue for byte/bool tuple
types
We are using sof_parse_word_tokens() to parse tokens with bool/byte/short/word tuple types, here add the missing check, to fix the parsing failure at byte/bool tuple types.
--- sound/soc/sof/topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/sof/topology.c +3 -1
@@ -920,7 +920,9 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp,for (j =0 ; j < count; j++) {/* match token type */ if (!(tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_WORD || - tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_SHORT )) + tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_SHORT || + tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_BYTE || + tokens[j].type ==SND_SOC_TPLG_TUPLE_TYPE_BOOL ))continue ;/* match token id */
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 3/13 ASoC: SOF: trace: move to opt-in with Kconfig and module parameter
In reply to Pierre-Louis BossartIn a number of debug cases, the DMA-based trace can add problems (e.g. with HDaudio channel allocation). It also generates additional traffic on the bus and if the DMA handling is unreliable will prevent audio use-cases from working normally. Using the trace also requires tools to be installed on the target.
The trace can be instead handled as dynamic debug. We can use a Kconfig to force the trace to be enabled in all cases, or use a module parameter to enable it on a need-basis, e.g. by setting "options snd_sof sof_debug=0x1" in a /etc/modprobe.d file.
--- sound/soc/sof/Kconfig | 8 ++++++++ sound/soc/sof/core.c | 25 +++++++++++++++++++------ sound/soc/sof/sof-priv.h | 13 +++++++++---- sound/soc/sof/trace.c | 17 ++++++++++++++++- 4 files changed, 52 insertions(+), 11 deletions(-)
sound/soc/sof/Kconfig +8 -0
@@ -142,6 +142,14 @@ config SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE Say Y if you want to enable caching the memory windows. If unsure, select "N". +config SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE + bool "SOF enable firmware trace" + help + The firmware trace can be enabled either at build-time with + this option, or dynamically by setting flags in the SOF core + module parameter (similar to dynamic debug) + If unsure, select "N". + config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST bool "SOF enable IPC flood test" help
sound/soc/sof/core.c +19 -6
@@ -16,6 +16,11 @@#include "sof-priv.h" #include "ops.h" +/* see SOF_DBG_ flags */ +int sof_core_debug; +module_param_named (sof_debug, sof_core_debug, int,0444 ); +MODULE_PARM_DESC (sof_debug,"SOF core debug options (0x0 all off)" ); +/* SOF defaults if not provided by the platform in ms */ #define TIMEOUT_DEFAULT_IPC_MS 500#define TIMEOUT_DEFAULT_BOOT_MS 2000
@@ -350,12 +355,20 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) goto fw_run_err; } -/* init DMA trace */ - ret =snd_sof_init_trace (sdev); -if (ret <0 ) { -/* non fatal */ -dev_warn (sdev->dev, -"warning: failed to initialize trace %d\n" , ret); +if (IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE ) || + (sof_core_debug &SOF_DBG_ENABLE_TRACE )) { + sdev->dtrace_is_supported = true; + +/* init DMA trace */ + ret =snd_sof_init_trace (sdev); +if (ret <0 ) { +/* non fatal */ +dev_warn (sdev->dev, +"warning: failed to initialize trace %d\n" , + ret); + } + }else { +dev_dbg (sdev->dev,"SOF firmware trace disabled\n" ); }/* hereafter all FW boot flows are for PM reasons */
sound/soc/sof/sof-priv.h +9 -4
@@ -28,10 +28,14 @@#include <uapi/sound/sof/fw.h> /* debug flags */ -#define SOF_DBG_REGS BIT(1) -#define SOF_DBG_MBOX BIT(2) -#define SOF_DBG_TEXT BIT(3) -#define SOF_DBG_PCI BIT(4) +#define SOF_DBG_ENABLE_TRACE BIT(0) +#define SOF_DBG_REGS BIT(1) +#define SOF_DBG_MBOX BIT(2) +#define SOF_DBG_TEXT BIT(3) +#define SOF_DBG_PCI BIT(4) + +/* global debug state set by SOF_DBG_ flags */ +extern int sof_core_debug;/* max BARs mmaped devices can use */ #define SND_SOF_BARS 8
@@ -434,6 +438,7 @@ struct snd_sof_dev {int dma_trace_pages;wait_queue_head_t trace_sleep;u32 host_offset; +u32 dtrace_is_supported;/* set with Kconfig or module parameter */ u32 dtrace_is_enabled;u32 dtrace_error;u32 dtrace_draining;
sound/soc/sof/trace.c +16 -1
@@ -162,6 +162,9 @@ int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev)struct sof_ipc_reply ipc_reply;int ret; +if (!sdev->dtrace_is_supported) +return 0 ; +if (sdev->dtrace_is_enabled || !sdev->dma_trace_pages)return -EINVAL ;
@@ -222,6 +225,9 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev) {int ret; +if (!sdev->dtrace_is_supported) +return 0 ; +/* set false before start initialization */ sdev->dtrace_is_enabled = false;
@@ -277,6 +283,9 @@ EXPORT_SYMBOL(snd_sof_init_trace);int snd_sof_trace_update_pos (struct snd_sof_dev *sdev,struct sof_ipc_dma_trace_posn *posn) { +if (!sdev->dtrace_is_supported) +return 0 ; +if (sdev->dtrace_is_enabled && sdev->host_offset != posn->host_offset) { sdev->host_offset = posn->host_offset;wake_up (&sdev->trace_sleep);
@@ -293,6 +302,9 @@ int snd_sof_trace_update_pos(struct snd_sof_dev *sdev,/* an error has occurred within the DSP that prevents further trace */ void snd_sof_trace_notify_for_error (struct snd_sof_dev *sdev) { +if (!sdev->dtrace_is_supported) +return ; +if (sdev->dtrace_is_enabled) {dev_err (sdev->dev,"error: waking up any trace sleepers\n" ); sdev->dtrace_error = true;
@@ -305,7 +317,7 @@ void snd_sof_release_trace(struct snd_sof_dev *sdev) {int ret; -if (!sdev->dtrace_is_enabled) +if (!sdev->dtrace_is_supported || !sdev->dtrace_is_enabled)return ; ret =snd_sof_dma_trace_trigger (sdev,SNDRV_PCM_TRIGGER_STOP );
@@ -326,6 +338,9 @@ EXPORT_SYMBOL(snd_sof_release_trace);void snd_sof_free_trace (struct snd_sof_dev *sdev) { +if (!sdev->dtrace_is_supported) +return ; +snd_sof_release_trace (sdev);snd_dma_free_pages (&sdev->dmatb);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: trace: move to opt-in with Kconfig and module parameter" to the asoc tree
The patch
ASoC: SOF: trace: move to opt-in with Kconfig and module parameter
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 2ab4c50f6955514150f83b47b7aee3ba5fe3ac1d Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 27 Sep 2019 15:05:28 -0500
Subject: [PATCH] ASoC: SOF: trace: move to opt-in with Kconfig and module
parameter
In a number of debug cases, the DMA-based trace can add problems (e.g. with HDaudio channel allocation). It also generates additional traffic on the bus and if the DMA handling is unreliable will prevent audio use-cases from working normally. Using the trace also requires tools to be installed on the target.
The trace can be instead handled as dynamic debug. We can use a Kconfig to force the trace to be enabled in all cases, or use a module parameter to enable it on a need-basis, e.g. by setting "options snd_sof sof_debug=0x1" in a /etc/modprobe.d file.
--- sound/soc/sof/Kconfig | 8 ++++++++ sound/soc/sof/core.c | 25 +++++++++++++++++++------ sound/soc/sof/sof-priv.h | 13 +++++++++---- sound/soc/sof/trace.c | 17 ++++++++++++++++- 4 files changed, 52 insertions(+), 11 deletions(-)
sound/soc/sof/Kconfig +8 -0
@@ -142,6 +142,14 @@ config SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE Say Y if you want to enable caching the memory windows. If unsure, select "N". +config SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE + bool "SOF enable firmware trace" + help + The firmware trace can be enabled either at build-time with + this option, or dynamically by setting flags in the SOF core + module parameter (similar to dynamic debug) + If unsure, select "N". + config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST bool "SOF enable IPC flood test" help
sound/soc/sof/core.c +19 -6
@@ -16,6 +16,11 @@#include "sof-priv.h" #include "ops.h" +/* see SOF_DBG_ flags */ +int sof_core_debug; +module_param_named (sof_debug, sof_core_debug, int,0444 ); +MODULE_PARM_DESC (sof_debug,"SOF core debug options (0x0 all off)" ); +/* SOF defaults if not provided by the platform in ms */ #define TIMEOUT_DEFAULT_IPC_MS 500#define TIMEOUT_DEFAULT_BOOT_MS 2000
@@ -350,12 +355,20 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) goto fw_run_err; } -/* init DMA trace */ - ret =snd_sof_init_trace (sdev); -if (ret <0 ) { -/* non fatal */ -dev_warn (sdev->dev, -"warning: failed to initialize trace %d\n" , ret); +if (IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE ) || + (sof_core_debug &SOF_DBG_ENABLE_TRACE )) { + sdev->dtrace_is_supported = true; + +/* init DMA trace */ + ret =snd_sof_init_trace (sdev); +if (ret <0 ) { +/* non fatal */ +dev_warn (sdev->dev, +"warning: failed to initialize trace %d\n" , + ret); + } + }else { +dev_dbg (sdev->dev,"SOF firmware trace disabled\n" ); }/* hereafter all FW boot flows are for PM reasons */
sound/soc/sof/sof-priv.h +9 -4
@@ -28,10 +28,14 @@#include <uapi/sound/sof/fw.h> /* debug flags */ -#define SOF_DBG_REGS BIT(1) -#define SOF_DBG_MBOX BIT(2) -#define SOF_DBG_TEXT BIT(3) -#define SOF_DBG_PCI BIT(4) +#define SOF_DBG_ENABLE_TRACE BIT(0) +#define SOF_DBG_REGS BIT(1) +#define SOF_DBG_MBOX BIT(2) +#define SOF_DBG_TEXT BIT(3) +#define SOF_DBG_PCI BIT(4) + +/* global debug state set by SOF_DBG_ flags */ +extern int sof_core_debug;/* max BARs mmaped devices can use */ #define SND_SOF_BARS 8
@@ -434,6 +438,7 @@ struct snd_sof_dev {int dma_trace_pages;wait_queue_head_t trace_sleep;u32 host_offset; +u32 dtrace_is_supported;/* set with Kconfig or module parameter */ u32 dtrace_is_enabled;u32 dtrace_error;u32 dtrace_draining;
sound/soc/sof/trace.c +16 -1
@@ -162,6 +162,9 @@ int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev)struct sof_ipc_reply ipc_reply;int ret; +if (!sdev->dtrace_is_supported) +return 0 ; +if (sdev->dtrace_is_enabled || !sdev->dma_trace_pages)return -EINVAL ;
@@ -222,6 +225,9 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev) {int ret; +if (!sdev->dtrace_is_supported) +return 0 ; +/* set false before start initialization */ sdev->dtrace_is_enabled = false;
@@ -277,6 +283,9 @@ EXPORT_SYMBOL(snd_sof_init_trace);int snd_sof_trace_update_pos (struct snd_sof_dev *sdev,struct sof_ipc_dma_trace_posn *posn) { +if (!sdev->dtrace_is_supported) +return 0 ; +if (sdev->dtrace_is_enabled && sdev->host_offset != posn->host_offset) { sdev->host_offset = posn->host_offset;wake_up (&sdev->trace_sleep);
@@ -293,6 +302,9 @@ int snd_sof_trace_update_pos(struct snd_sof_dev *sdev,/* an error has occurred within the DSP that prevents further trace */ void snd_sof_trace_notify_for_error (struct snd_sof_dev *sdev) { +if (!sdev->dtrace_is_supported) +return ; +if (sdev->dtrace_is_enabled) {dev_err (sdev->dev,"error: waking up any trace sleepers\n" ); sdev->dtrace_error = true;
@@ -305,7 +317,7 @@ void snd_sof_release_trace(struct snd_sof_dev *sdev) {int ret; -if (!sdev->dtrace_is_enabled) +if (!sdev->dtrace_is_supported || !sdev->dtrace_is_enabled)return ; ret =snd_sof_dma_trace_trigger (sdev,SNDRV_PCM_TRIGGER_STOP );
@@ -326,6 +338,9 @@ EXPORT_SYMBOL(snd_sof_release_trace);void snd_sof_free_trace (struct snd_sof_dev *sdev) { +if (!sdev->dtrace_is_supported) +return ; +snd_sof_release_trace (sdev);snd_dma_free_pages (&sdev->dmatb);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 4/13 ASoC: SOF: ipc: retain DSP context after FW exception.
In reply to Pierre-Louis BossartFrom: Liam Girdwood <[email protected]>
Add config option to prevent DSP entering D3 after any FW exception. This can then be used to dump FW context for debug.
--- sound/soc/sof/Kconfig | 8 ++++++++ sound/soc/sof/debug.c | 16 ++++++++++++++++ sound/soc/sof/ipc.c | 4 +--- sound/soc/sof/sof-priv.h | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-)
sound/soc/sof/Kconfig +8 -0
@@ -158,6 +158,14 @@ config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST Say Y if you want to enable IPC flood test. If unsure, select "N". +config SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT + bool "SOF retain DSP context on any FW exceptions" + help + This option keeps the DSP in D0 state so that firmware debug + information can be retained and dumped to userspace. + Say Y if you want to retain DSP context for FW exceptions. + If unsure, select "N". + endif ## SND_SOC_SOF_DEBUG endif ## SND_SOC_SOF_OPTIONS
sound/soc/sof/debug.c +16 -0
@@ -461,3 +461,19 @@ void snd_sof_free_debug(struct snd_sof_dev *sdev)debugfs_remove_recursive (sdev->debugfs_root); }EXPORT_SYMBOL_GPL (snd_sof_free_debug); + +void snd_sof_handle_fw_exception (struct snd_sof_dev *sdev) +{ +if (IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT ) || + (sof_core_debug &SOF_DBG_RETAIN_CTX )) { +/* should we prevent DSP entering D3 ? */ +dev_info (sdev->dev,"info: preventing DSP entering D3 state to preserve context\n" ); +pm_runtime_get_noresume (sdev->dev); + } + +/* dump vital information to the logs */ +snd_sof_dsp_dbg_dump (sdev,SOF_DBG_REGS |SOF_DBG_MBOX ); +snd_sof_ipc_dump (sdev); +snd_sof_trace_notify_for_error (sdev); +} +EXPORT_SYMBOL (snd_sof_handle_fw_exception);
sound/soc/sof/ipc.c +1 -3
@@ -210,9 +210,7 @@ static int tx_wait_done(struct snd_sof_ipc *ipc, struct snd_sof_ipc_msg *msg,if (ret ==0 ) {dev_err (sdev->dev,"error: ipc timed out for 0x%x size %d\n" , hdr->cmd, hdr->size); -snd_sof_dsp_dbg_dump (ipc->sdev,SOF_DBG_REGS |SOF_DBG_MBOX ); -snd_sof_ipc_dump (ipc->sdev); -snd_sof_trace_notify_for_error (ipc->sdev); +snd_sof_handle_fw_exception (ipc->sdev); ret = -ETIMEDOUT ; }else {/* copy the data returned from DSP */
sound/soc/sof/sof-priv.h +2 -0
@@ -33,6 +33,7 @@#define SOF_DBG_MBOX BIT(2)#define SOF_DBG_TEXT BIT(3)#define SOF_DBG_PCI BIT(4) +#define SOF_DBG_RETAIN_CTX BIT(5)/* prevent DSP D3 on FW exception */ /* global debug state set by SOF_DBG_ flags */ extern int sof_core_debug;
@@ -580,6 +581,7 @@ void snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code,struct sof_ipc_panic_info *panic_info, void *stack, size_t stack_words);int snd_sof_init_trace_ipc (struct snd_sof_dev *sdev); +void snd_sof_handle_fw_exception (struct snd_sof_dev *sdev);/* * Platform specific ops.
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: ipc: retain DSP context after FW exception." to the asoc tree
The patch
ASoC: SOF: ipc: retain DSP context after FW exception.
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 9a06508bf7824ba34f2e1e9e08df505ac14a44c2 Mon Sep 17 00:00:00 2001
From: Liam Girdwood <[email protected]>
Date: Fri, 27 Sep 2019 15:05:29 -0500
Subject: [PATCH] ASoC: SOF: ipc: retain DSP context after FW exception.
Add config option to prevent DSP entering D3 after any FW exception. This can then be used to dump FW context for debug.
--- sound/soc/sof/Kconfig | 8 ++++++++ sound/soc/sof/debug.c | 16 ++++++++++++++++ sound/soc/sof/ipc.c | 4 +--- sound/soc/sof/sof-priv.h | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-)
sound/soc/sof/Kconfig +8 -0
@@ -158,6 +158,14 @@ config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST Say Y if you want to enable IPC flood test. If unsure, select "N". +config SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT + bool "SOF retain DSP context on any FW exceptions" + help + This option keeps the DSP in D0 state so that firmware debug + information can be retained and dumped to userspace. + Say Y if you want to retain DSP context for FW exceptions. + If unsure, select "N". + endif ## SND_SOC_SOF_DEBUG endif ## SND_SOC_SOF_OPTIONS
sound/soc/sof/debug.c +16 -0
@@ -461,3 +461,19 @@ void snd_sof_free_debug(struct snd_sof_dev *sdev)debugfs_remove_recursive (sdev->debugfs_root); }EXPORT_SYMBOL_GPL (snd_sof_free_debug); + +void snd_sof_handle_fw_exception (struct snd_sof_dev *sdev) +{ +if (IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT ) || + (sof_core_debug &SOF_DBG_RETAIN_CTX )) { +/* should we prevent DSP entering D3 ? */ +dev_info (sdev->dev,"info: preventing DSP entering D3 state to preserve context\n" ); +pm_runtime_get_noresume (sdev->dev); + } + +/* dump vital information to the logs */ +snd_sof_dsp_dbg_dump (sdev,SOF_DBG_REGS |SOF_DBG_MBOX ); +snd_sof_ipc_dump (sdev); +snd_sof_trace_notify_for_error (sdev); +} +EXPORT_SYMBOL (snd_sof_handle_fw_exception);
sound/soc/sof/ipc.c +1 -3
@@ -210,9 +210,7 @@ static int tx_wait_done(struct snd_sof_ipc *ipc, struct snd_sof_ipc_msg *msg,if (ret ==0 ) {dev_err (sdev->dev,"error: ipc timed out for 0x%x size %d\n" , hdr->cmd, hdr->size); -snd_sof_dsp_dbg_dump (ipc->sdev,SOF_DBG_REGS |SOF_DBG_MBOX ); -snd_sof_ipc_dump (ipc->sdev); -snd_sof_trace_notify_for_error (ipc->sdev); +snd_sof_handle_fw_exception (ipc->sdev); ret = -ETIMEDOUT ; }else {/* copy the data returned from DSP */
sound/soc/sof/sof-priv.h +2 -0
@@ -33,6 +33,7 @@#define SOF_DBG_MBOX BIT(2)#define SOF_DBG_TEXT BIT(3)#define SOF_DBG_PCI BIT(4) +#define SOF_DBG_RETAIN_CTX BIT(5)/* prevent DSP D3 on FW exception */ /* global debug state set by SOF_DBG_ flags */ extern int sof_core_debug;
@@ -580,6 +581,7 @@ void snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code,struct sof_ipc_panic_info *panic_info, void *stack, size_t stack_words);int snd_sof_init_trace_ipc (struct snd_sof_dev *sdev); +void snd_sof_handle_fw_exception (struct snd_sof_dev *sdev);/* * Platform specific ops.
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 5/13 ASoC: SOF: pcm: fix resource leak in hw_free
In reply to Pierre-Louis BossartFrom: Kai Vehmanen <[email protected]>
Fix a bug in sof_pcm_hw_free() where some cleanup actions were skipped if STREAM_PCM_FREE IPC was already successfully sent to DSP when the stream was stopped or suspended. This is incorrect as hw_free should clean up also other resources, including pcm lib page allocations, period elapsed work queue and call to platform hw_free.
--- sound/soc/sof/pcm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
sound/soc/sof/pcm.c +10 -10
@@ -244,7 +244,7 @@ static int sof_pcm_hw_free(struct snd_pcm_substream *substream)snd_soc_rtdcom_lookup (rtd,DRV_NAME );struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (component);struct snd_sof_pcm *spcm; -int ret; +int ret, err =0 ;/* nothing to do for BE */ if (rtd->dai_link->no_pcm)
@@ -254,26 +254,26 @@ static int sof_pcm_hw_free(struct snd_pcm_substream *substream)if (!spcm)return -EINVAL ; -if (!spcm->prepared[substream->stream]) -return 0 ; -dev_dbg (sdev->dev,"pcm: free stream %d dir %d\n" , spcm->pcm.pcm_id, substream->stream); - ret =sof_pcm_dsp_pcm_free (substream, sdev, spcm); +if (spcm->prepared[substream->stream]) { + ret =sof_pcm_dsp_pcm_free (substream, sdev, spcm); +if (ret <0 ) + err = ret; + }snd_pcm_lib_free_pages (substream);cancel_work_sync (&spcm->stream[substream->stream].period_elapsed_work); -if (ret <0 ) -return ret; - ret =snd_sof_pcm_platform_hw_free (sdev, substream); -if (ret <0 ) +if (ret <0 ) {dev_err (sdev->dev,"error: platform hw free failed\n" ); + err = ret; + } -return ret; +return err; }static int sof_pcm_prepare (struct snd_pcm_substream *substream)
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: pcm: fix resource leak in hw_free" to the asoc tree
The patch
ASoC: SOF: pcm: fix resource leak in hw_free
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From e66e52c5b7422824cedf0084c0766602dea7e8a7 Mon Sep 17 00:00:00 2001
From: Kai Vehmanen <[email protected]>
Date: Fri, 27 Sep 2019 15:05:30 -0500
Subject: [PATCH] ASoC: SOF: pcm: fix resource leak in hw_free
Fix a bug in sof_pcm_hw_free() where some cleanup actions were skipped if STREAM_PCM_FREE IPC was already successfully sent to DSP when the stream was stopped or suspended. This is incorrect as hw_free should clean up also other resources, including pcm lib page allocations, period elapsed work queue and call to platform hw_free.
--- sound/soc/sof/pcm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
sound/soc/sof/pcm.c +10 -10
@@ -244,7 +244,7 @@ static int sof_pcm_hw_free(struct snd_pcm_substream *substream)snd_soc_rtdcom_lookup (rtd,DRV_NAME );struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (component);struct snd_sof_pcm *spcm; -int ret; +int ret, err =0 ;/* nothing to do for BE */ if (rtd->dai_link->no_pcm)
@@ -254,26 +254,26 @@ static int sof_pcm_hw_free(struct snd_pcm_substream *substream)if (!spcm)return -EINVAL ; -if (!spcm->prepared[substream->stream]) -return 0 ; -dev_dbg (sdev->dev,"pcm: free stream %d dir %d\n" , spcm->pcm.pcm_id, substream->stream); - ret =sof_pcm_dsp_pcm_free (substream, sdev, spcm); +if (spcm->prepared[substream->stream]) { + ret =sof_pcm_dsp_pcm_free (substream, sdev, spcm); +if (ret <0 ) + err = ret; + }snd_pcm_lib_free_pages (substream);cancel_work_sync (&spcm->stream[substream->stream].period_elapsed_work); -if (ret <0 ) -return ret; - ret =snd_sof_pcm_platform_hw_free (sdev, substream); -if (ret <0 ) +if (ret <0 ) {dev_err (sdev->dev,"error: platform hw free failed\n" ); + err = ret; + } -return ret; +return err; }static int sof_pcm_prepare (struct snd_pcm_substream *substream)
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 6/13 ASoC: SOF: pcm: harden PCM STOP sequence
In reply to Pierre-Louis BossartFrom: Pan Xiuli <[email protected]>
The old STOP sequence is: 1. stop DMA 2. send STOP ipc
If delay happen before the steps 1 and 2, the DMA buffer will be empty in short time and cause pipeline xrun then stop the pipeline. Then the step 2 ipc stop will return error as pipeline is already stopped.
Suggested change to avoid the issue is to switch the order of steps 1 and 2 for the stop sequence.
--- sound/soc/sof/pcm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/soc/sof/pcm.c +14 -1
@@ -323,6 +323,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)struct sof_ipc_stream stream;struct sof_ipc_reply reply;bool reset_hw_params = false; +bool ipc_first = false;int ret;/* nothing to do for BE */
@@ -343,6 +344,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)switch (cmd) {case SNDRV_PCM_TRIGGER_PAUSE_PUSH : stream.hdr.cmd |=SOF_IPC_STREAM_TRIG_PAUSE ; + ipc_first = true;break ;case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : stream.hdr.cmd |=SOF_IPC_STREAM_TRIG_RELEASE ;
@@ -363,6 +365,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_STOP : stream.hdr.cmd |=SOF_IPC_STREAM_TRIG_STOP ; + ipc_first = true; reset_hw_params = true;break ;default :
@@ -370,12 +373,22 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)return -EINVAL ; } -snd_sof_pcm_platform_trigger (sdev, substream, cmd); +/* +* DMA and IPC sequence is different for start and stop. Need to send +* STOP IPC before stop DMA +*/ +if (!ipc_first) +snd_sof_pcm_platform_trigger (sdev, substream, cmd);/* send IPC to the DSP */ ret =sof_ipc_tx_message (sdev->ipc, stream.hdr.cmd, &stream,sizeof (stream), &reply,sizeof (reply)); +/* need to STOP DMA even if STOP IPC failed */ +if (ipc_first) +snd_sof_pcm_platform_trigger (sdev, substream, cmd); + +/* free PCM if reset_hw_params is set and the STOP IPC is successful */ if (!ret && reset_hw_params) ret =sof_pcm_dsp_pcm_free (substream, sdev, spcm);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: pcm: harden PCM STOP sequence" to the asoc tree
The patch
ASoC: SOF: pcm: harden PCM STOP sequence
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 0a1b08345bc5d9214dc701f8ec5d67c473fab735 Mon Sep 17 00:00:00 2001
From: Pan Xiuli <[email protected]>
Date: Fri, 27 Sep 2019 15:05:31 -0500
Subject: [PATCH] ASoC: SOF: pcm: harden PCM STOP sequence
The old STOP sequence is: 1. stop DMA 2. send STOP ipc
If delay happen before the steps 1 and 2, the DMA buffer will be empty in short time and cause pipeline xrun then stop the pipeline. Then the step 2 ipc stop will return error as pipeline is already stopped.
Suggested change to avoid the issue is to switch the order of steps 1 and 2 for the stop sequence.
--- sound/soc/sof/pcm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/soc/sof/pcm.c +14 -1
@@ -323,6 +323,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)struct sof_ipc_stream stream;struct sof_ipc_reply reply;bool reset_hw_params = false; +bool ipc_first = false;int ret;/* nothing to do for BE */
@@ -343,6 +344,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)switch (cmd) {case SNDRV_PCM_TRIGGER_PAUSE_PUSH : stream.hdr.cmd |=SOF_IPC_STREAM_TRIG_PAUSE ; + ipc_first = true;break ;case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : stream.hdr.cmd |=SOF_IPC_STREAM_TRIG_RELEASE ;
@@ -363,6 +365,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_STOP : stream.hdr.cmd |=SOF_IPC_STREAM_TRIG_STOP ; + ipc_first = true; reset_hw_params = true;break ;default :
@@ -370,12 +373,22 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd)return -EINVAL ; } -snd_sof_pcm_platform_trigger (sdev, substream, cmd); +/* +* DMA and IPC sequence is different for start and stop. Need to send +* STOP IPC before stop DMA +*/ +if (!ipc_first) +snd_sof_pcm_platform_trigger (sdev, substream, cmd);/* send IPC to the DSP */ ret =sof_ipc_tx_message (sdev->ipc, stream.hdr.cmd, &stream,sizeof (stream), &reply,sizeof (reply)); +/* need to STOP DMA even if STOP IPC failed */ +if (ipc_first) +snd_sof_pcm_platform_trigger (sdev, substream, cmd); + +/* free PCM if reset_hw_params is set and the STOP IPC is successful */ if (!ret && reset_hw_params) ret =sof_pcm_dsp_pcm_free (substream, sdev, spcm);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 7/13 ASoC: SOF: core: check for mandatory fw_ready op during SOF probe
In reply to Pierre-Louis BossartFrom: Ranjani Sridharan <[email protected]>
fw_ready should be a mandatory op. Make sure fw_ready ops is set during probe.
--- sound/soc/sof/core.c | 3 ++- sound/soc/sof/ipc.c | 6 ------ sound/soc/sof/sof-priv.h | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-)
sound/soc/sof/core.c +2 -1
@@ -466,7 +466,8 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)if (!sof_ops (sdev) || !sof_ops (sdev)->probe || !sof_ops (sdev)->run || !sof_ops (sdev)->block_read || !sof_ops (sdev)->block_write || !sof_ops (sdev)->send_msg || !sof_ops (sdev)->load_firmware || - !sof_ops (sdev)->ipc_msg_data || !sof_ops (sdev)->ipc_pcm_params) + !sof_ops (sdev)->ipc_msg_data || !sof_ops (sdev)->ipc_pcm_params || + !sof_ops (sdev)->fw_ready)return -EINVAL ;INIT_LIST_HEAD (&sdev->pcm_list);
sound/soc/sof/ipc.c +0 -6
@@ -792,12 +792,6 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev)struct snd_sof_ipc *ipc;struct snd_sof_ipc_msg *msg; -/* check if mandatory ops required for ipc are defined */ -if (!sof_ops (sdev)->fw_ready) { -dev_err (sdev->dev,"error: ipc mandatory ops not defined\n" ); -return NULL ; - } - ipc =devm_kzalloc (sdev->dev,sizeof (*ipc),GFP_KERNEL );if (!ipc)return NULL ;
sound/soc/sof/sof-priv.h +1 -1
@@ -133,7 +133,7 @@ struct snd_sof_dsp_ops {* FW ready checks for ABI compatibility and creates * memory windows at first boot */ -int (*fw_ready)(struct snd_sof_dev *sdev,u32 msg_id);/* optional */ +int (*fw_ready)(struct snd_sof_dev *sdev,u32 msg_id);/* mandatory */ /* connect pcm substream to a host stream */ int (*pcm_open)(struct snd_sof_dev *sdev,
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: core: check for mandatory fw_ready op during SOF probe" to the asoc tree
The patch
ASoC: SOF: core: check for mandatory fw_ready op during SOF probe
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 8692d498d675e2e1433274c5f03b855824f3f35d Mon Sep 17 00:00:00 2001
From: Ranjani Sridharan <[email protected]>
Date: Fri, 27 Sep 2019 15:05:32 -0500
Subject: [PATCH] ASoC: SOF: core: check for mandatory fw_ready op during SOF
probe
fw_ready should be a mandatory op. Make sure fw_ready ops is set during probe.
--- sound/soc/sof/core.c | 3 ++- sound/soc/sof/ipc.c | 6 ------ sound/soc/sof/sof-priv.h | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-)
sound/soc/sof/core.c +2 -1
@@ -466,7 +466,8 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)if (!sof_ops (sdev) || !sof_ops (sdev)->probe || !sof_ops (sdev)->run || !sof_ops (sdev)->block_read || !sof_ops (sdev)->block_write || !sof_ops (sdev)->send_msg || !sof_ops (sdev)->load_firmware || - !sof_ops (sdev)->ipc_msg_data || !sof_ops (sdev)->ipc_pcm_params) + !sof_ops (sdev)->ipc_msg_data || !sof_ops (sdev)->ipc_pcm_params || + !sof_ops (sdev)->fw_ready)return -EINVAL ;INIT_LIST_HEAD (&sdev->pcm_list);
sound/soc/sof/ipc.c +0 -6
@@ -792,12 +792,6 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev)struct snd_sof_ipc *ipc;struct snd_sof_ipc_msg *msg; -/* check if mandatory ops required for ipc are defined */ -if (!sof_ops (sdev)->fw_ready) { -dev_err (sdev->dev,"error: ipc mandatory ops not defined\n" ); -return NULL ; - } - ipc =devm_kzalloc (sdev->dev,sizeof (*ipc),GFP_KERNEL );if (!ipc)return NULL ;
sound/soc/sof/sof-priv.h +1 -1
@@ -133,7 +133,7 @@ struct snd_sof_dsp_ops {* FW ready checks for ABI compatibility and creates * memory windows at first boot */ -int (*fw_ready)(struct snd_sof_dev *sdev,u32 msg_id);/* optional */ +int (*fw_ready)(struct snd_sof_dev *sdev,u32 msg_id);/* mandatory */ /* connect pcm substream to a host stream */ int (*pcm_open)(struct snd_sof_dev *sdev,
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 8/13 ASoC: SOF: ipc: introduce no_stream_position in sof_ipc_stream_params struct
In reply to Pierre-Louis BossartFrom: Marcin Rajwa <[email protected]>
The host period bytes value needs to be passed to firmware. However current implementation uses this field for different purpose - to indicate whether FW should send stream position to the host. Therefore this patch introduces another field "no_stream_position", a boolean value aimed to store information about position tracking. This way host_period_bytes preserves its original value.
--- include/sound/sof/stream.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/sound/sof/stream.h +2 -2
@@ -83,10 +83,10 @@ struct sof_ipc_stream_params {uint16_t sample_valid_bytes;uint16_t sample_container_bytes; -/* for notifying host period has completed - 0 means no period IRQ */ uint32_t host_period_bytes; +uint16_t no_stream_position;/**< 1 means don't send stream position */ -uint32_t reserved[2 ]; +uint16_t reserved[3 ];uint16_t chmap[SOF_IPC_MAX_CHANNELS ];/**< channel map - SOF_CHMAP_ */ } __packed;
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: ipc: introduce no_stream_position in sof_ipc_stream_params struct" to the asoc tree
The patch
ASoC: SOF: ipc: introduce no_stream_position in sof_ipc_stream_params struct
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From e3ebfd0ab5b4880bfb6a9f32614c2e389cc3da56 Mon Sep 17 00:00:00 2001
From: Marcin Rajwa <[email protected]>
Date: Fri, 27 Sep 2019 15:05:33 -0500
Subject: [PATCH] ASoC: SOF: ipc: introduce no_stream_position in
sof_ipc_stream_params struct
The host period bytes value needs to be passed to firmware. However current implementation uses this field for different purpose - to indicate whether FW should send stream position to the host. Therefore this patch introduces another field "no_stream_position", a boolean value aimed to store information about position tracking. This way host_period_bytes preserves its original value.
--- include/sound/sof/stream.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/sound/sof/stream.h +2 -2
@@ -83,10 +83,10 @@ struct sof_ipc_stream_params {uint16_t sample_valid_bytes;uint16_t sample_container_bytes; -/* for notifying host period has completed - 0 means no period IRQ */ uint32_t host_period_bytes; +uint16_t no_stream_position;/**< 1 means don't send stream position */ -uint32_t reserved[2 ]; +uint16_t reserved[3 ];uint16_t chmap[SOF_IPC_MAX_CHANNELS ];/**< channel map - SOF_CHMAP_ */ } __packed;
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 9/13 ASoC: SOF: Intel: hda: fix reset of host_period_bytes
In reply to Pierre-Louis BossartFrom: Marcin Rajwa <[email protected]>
This patch prevents the reset of host period bytes and uses no_stream_position to record requests for stream position.
--- sound/soc/sof/intel/hda-pcm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
sound/soc/sof/intel/hda-pcm.c +12 -3
@@ -89,6 +89,7 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,struct hdac_ext_stream *stream =stream_to_hdac_ext_stream (hstream);struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;struct snd_dma_buffer *dmab; +struct sof_ipc_fw_version *v = &sdev->fw_ready.version;int ret;u32 size, rate, bits;
@@ -116,9 +117,17 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,/* disable SPIB, to enable buffer wrap for stream */ hda_dsp_stream_spib_config (sdev, stream,HDA_DSP_SPIB_DISABLE ,0 ); -/* set host_period_bytes to 0 if no IPC position */ -if (hda && hda->no_ipc_position) - ipc_params->host_period_bytes =0 ; +/* update no_stream_position flag for ipc params */ +if (hda && hda->no_ipc_position) { +/* For older ABIs set host_period_bytes to zero to inform +* FW we don't want position updates. Newer versions use +* no_stream_position for this purpose. +*/ +if (v->abi_version <SOF_ABI_VER (3 ,10 ,0 )) + ipc_params->host_period_bytes =0 ; +else + ipc_params->no_stream_position =1 ; + } ipc_params->stream_tag = hstream->stream_tag;
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: Intel: hda: fix reset of host_period_bytes" to the asoc tree
The patch
ASoC: SOF: Intel: hda: fix reset of host_period_bytes
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From f567ff6c76f7e9b317248fcab7a0eb3ef432dc9e Mon Sep 17 00:00:00 2001
From: Marcin Rajwa <[email protected]>
Date: Fri, 27 Sep 2019 15:05:34 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda: fix reset of host_period_bytes
This patch prevents the reset of host period bytes and uses no_stream_position to record requests for stream position.
--- sound/soc/sof/intel/hda-pcm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
sound/soc/sof/intel/hda-pcm.c +12 -3
@@ -89,6 +89,7 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,struct hdac_ext_stream *stream =stream_to_hdac_ext_stream (hstream);struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;struct snd_dma_buffer *dmab; +struct sof_ipc_fw_version *v = &sdev->fw_ready.version;int ret;u32 size, rate, bits;
@@ -116,9 +117,17 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,/* disable SPIB, to enable buffer wrap for stream */ hda_dsp_stream_spib_config (sdev, stream,HDA_DSP_SPIB_DISABLE ,0 ); -/* set host_period_bytes to 0 if no IPC position */ -if (hda && hda->no_ipc_position) - ipc_params->host_period_bytes =0 ; +/* update no_stream_position flag for ipc params */ +if (hda && hda->no_ipc_position) { +/* For older ABIs set host_period_bytes to zero to inform +* FW we don't want position updates. Newer versions use +* no_stream_position for this purpose. +*/ +if (v->abi_version <SOF_ABI_VER (3 ,10 ,0 )) + ipc_params->host_period_bytes =0 ; +else + ipc_params->no_stream_position =1 ; + } ipc_params->stream_tag = hstream->stream_tag;
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 10/13 ASoC: SOF: Intel: hda: fix warnings during FW load
In reply to Pierre-Louis BossartFrom: Kai Vehmanen <[email protected]>
The "snd_pcm_substream" handle was not initialized properly in hda-loader.c for firmware load.
When the HDA DMAs were used to load the firmware, the interrupts related to firmware load also triggered calls to snd_sof_pcm_period_elapsed() on a non-existent ALSA PCM stream.
This caused runtime kernel warnings from
pcm_lib.c:snd_pcm_period_elapsed().
--- sound/soc/sof/intel/hda-loader.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/intel/hda-loader.c +1 -0
@@ -44,6 +44,7 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format,return -ENODEV ; } hstream = &dsp_stream->hstream; + hstream->substream =NULL ;/* allocate DMA buffer */ ret =snd_dma_alloc_pages (SNDRV_DMA_TYPE_DEV_SG , &pci->dev, size, dmab);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: Intel: hda: fix warnings during FW load" to the asoc tree
The patch
ASoC: SOF: Intel: hda: fix warnings during FW load
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 4ff5f6439fe69624e8f7d559915e9b54a6477684 Mon Sep 17 00:00:00 2001
From: Kai Vehmanen <[email protected]>
Date: Fri, 27 Sep 2019 15:05:35 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda: fix warnings during FW load
The "snd_pcm_substream" handle was not initialized properly in hda-loader.c for firmware load.
When the HDA DMAs were used to load the firmware, the interrupts related to firmware load also triggered calls to snd_sof_pcm_period_elapsed() on a non-existent ALSA PCM stream.
This caused runtime kernel warnings from
pcm_lib.c:snd_pcm_period_elapsed().
--- sound/soc/sof/intel/hda-loader.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/intel/hda-loader.c +1 -0
@@ -44,6 +44,7 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format,return -ENODEV ; } hstream = &dsp_stream->hstream; + hstream->substream =NULL ;/* allocate DMA buffer */ ret =snd_dma_alloc_pages (SNDRV_DMA_TYPE_DEV_SG , &pci->dev, size, dmab);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 11/13 ASoC: SOF: Intel: initialise and verify FW crash dump data.
In reply to Pierre-Louis BossartFrom: Liam Girdwood <[email protected]>
FW mailbox offset was not set before use and HDR size was not validated. Fix this.
--- sound/soc/sof/intel/bdw.c | 7 +++++++ sound/soc/sof/intel/byt.c | 6 ++++++ sound/soc/sof/intel/hda.c | 7 +++++++ 3 files changed, 20 insertions(+)
sound/soc/sof/intel/bdw.c +7 -0
@@ -37,6 +37,7 @@#define MBOX_SIZE 0x1000#define MBOX_DUMP_SIZE 0x30#define EXCEPT_OFFSET 0x800 +#define EXCEPT_MAX_HDR_SIZE 0x400/* DSP peripherals */ #define DMAC0_OFFSET 0xFE000
@@ -228,6 +229,11 @@ static void bdw_get_registers(struct snd_sof_dev *sdev,/* note: variable AR register array is not read */ /* then get panic info */ +if (xoops->arch_hdr.totalsize >EXCEPT_MAX_HDR_SIZE ) { +dev_err (sdev->dev,"invalid header size 0x%x. FW oops is bogus\n" , + xoops->arch_hdr.totalsize); +return ; + } offset += xoops->arch_hdr.totalsize;sof_mailbox_read (sdev, offset, panic_info,sizeof (*panic_info));
@@ -451,6 +457,7 @@ static int bdw_probe(struct snd_sof_dev *sdev)/* TODO: add offsets */ sdev->mmio_bar =BDW_DSP_BAR ; sdev->mailbox_bar =BDW_DSP_BAR ; + sdev->dsp_oops_offset =MBOX_OFFSET ;/* PCI base */ mmio = platform_get_resource(pdev, IORESOURCE_MEM,
sound/soc/sof/intel/byt.c +6 -0
@@ -28,6 +28,7 @@#define MBOX_OFFSET 0x144000#define MBOX_SIZE 0x1000#define EXCEPT_OFFSET 0x800 +#define EXCEPT_MAX_HDR_SIZE 0x400/* DSP peripherals */ #define DMAC0_OFFSET 0x098000
@@ -126,6 +127,11 @@ static void byt_get_registers(struct snd_sof_dev *sdev,/* note: variable AR register array is not read */ /* then get panic info */ +if (xoops->arch_hdr.totalsize >EXCEPT_MAX_HDR_SIZE ) { +dev_err (sdev->dev,"invalid header size 0x%x. FW oops is bogus\n" , + xoops->arch_hdr.totalsize); +return ; + } offset += xoops->arch_hdr.totalsize;sof_mailbox_read (sdev, offset, panic_info,sizeof (*panic_info));
sound/soc/sof/intel/hda.c +7 -0
@@ -35,6 +35,8 @@#define IS_CFL (pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)#define IS_CNL (pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) +#define EXCEPT_MAX_HDR_SIZE 0x400 +/* * Debug */
@@ -131,6 +133,11 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,/* note: variable AR register array is not read */ /* then get panic info */ +if (xoops->arch_hdr.totalsize >EXCEPT_MAX_HDR_SIZE ) { +dev_err (sdev->dev,"invalid header size 0x%x. FW oops is bogus\n" , + xoops->arch_hdr.totalsize); +return ; + } offset += xoops->arch_hdr.totalsize;sof_block_read (sdev, sdev->mmio_bar, offset, panic_info,sizeof (*panic_info));
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: Intel: initialise and verify FW crash dump data." to the asoc tree
The patch
ASoC: SOF: Intel: initialise and verify FW crash dump data.
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From ff2be865633e6fa523cd2db3b73197d795dec991 Mon Sep 17 00:00:00 2001
From: Liam Girdwood <[email protected]>
Date: Fri, 27 Sep 2019 15:05:36 -0500
Subject: [PATCH] ASoC: SOF: Intel: initialise and verify FW crash dump data.
FW mailbox offset was not set before use and HDR size was not validated. Fix this.
--- sound/soc/sof/intel/bdw.c | 7 +++++++ sound/soc/sof/intel/byt.c | 6 ++++++ sound/soc/sof/intel/hda.c | 7 +++++++ 3 files changed, 20 insertions(+)
sound/soc/sof/intel/bdw.c +7 -0
@@ -37,6 +37,7 @@#define MBOX_SIZE 0x1000#define MBOX_DUMP_SIZE 0x30#define EXCEPT_OFFSET 0x800 +#define EXCEPT_MAX_HDR_SIZE 0x400/* DSP peripherals */ #define DMAC0_OFFSET 0xFE000
@@ -228,6 +229,11 @@ static void bdw_get_registers(struct snd_sof_dev *sdev,/* note: variable AR register array is not read */ /* then get panic info */ +if (xoops->arch_hdr.totalsize >EXCEPT_MAX_HDR_SIZE ) { +dev_err (sdev->dev,"invalid header size 0x%x. FW oops is bogus\n" , + xoops->arch_hdr.totalsize); +return ; + } offset += xoops->arch_hdr.totalsize;sof_mailbox_read (sdev, offset, panic_info,sizeof (*panic_info));
@@ -451,6 +457,7 @@ static int bdw_probe(struct snd_sof_dev *sdev)/* TODO: add offsets */ sdev->mmio_bar =BDW_DSP_BAR ; sdev->mailbox_bar =BDW_DSP_BAR ; + sdev->dsp_oops_offset =MBOX_OFFSET ;/* PCI base */ mmio = platform_get_resource(pdev, IORESOURCE_MEM,
sound/soc/sof/intel/byt.c +6 -0
@@ -28,6 +28,7 @@#define MBOX_OFFSET 0x144000#define MBOX_SIZE 0x1000#define EXCEPT_OFFSET 0x800 +#define EXCEPT_MAX_HDR_SIZE 0x400/* DSP peripherals */ #define DMAC0_OFFSET 0x098000
@@ -126,6 +127,11 @@ static void byt_get_registers(struct snd_sof_dev *sdev,/* note: variable AR register array is not read */ /* then get panic info */ +if (xoops->arch_hdr.totalsize >EXCEPT_MAX_HDR_SIZE ) { +dev_err (sdev->dev,"invalid header size 0x%x. FW oops is bogus\n" , + xoops->arch_hdr.totalsize); +return ; + } offset += xoops->arch_hdr.totalsize;sof_mailbox_read (sdev, offset, panic_info,sizeof (*panic_info));
sound/soc/sof/intel/hda.c +7 -0
@@ -35,6 +35,8 @@#define IS_CFL (pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)#define IS_CNL (pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) +#define EXCEPT_MAX_HDR_SIZE 0x400 +/* * Debug */
@@ -131,6 +133,11 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,/* note: variable AR register array is not read */ /* then get panic info */ +if (xoops->arch_hdr.totalsize >EXCEPT_MAX_HDR_SIZE ) { +dev_err (sdev->dev,"invalid header size 0x%x. FW oops is bogus\n" , + xoops->arch_hdr.totalsize); +return ; + } offset += xoops->arch_hdr.totalsize;sof_block_read (sdev, sdev->mmio_bar, offset, panic_info,sizeof (*panic_info));
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 12/13 ASoC: SOF: Intel: Add context data to any IPC timeout.
In reply to Pierre-Louis BossartFrom: Liam Girdwood <[email protected]>
Helps with FW debug as it provides DSP IPC processing context.
--- sound/soc/sof/intel/bdw.c | 22 +++++++++++++++++++++- sound/soc/sof/intel/byt.c | 23 ++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-)
sound/soc/sof/intel/bdw.c +21 -1
@@ -247,7 +247,7 @@ static void bdw_dump(struct snd_sof_dev *sdev, u32 flags)struct sof_ipc_dsp_oops_xtensa xoops;struct sof_ipc_panic_info panic_info;u32 stack[BDW_STACK_DUMP_SIZE ]; -u32 status, panic; +u32 status, panic, imrx, imrd;/* now try generic SOF status messages */ status =snd_sof_dsp_read (sdev,BDW_DSP_BAR ,SHIM_IPCD );
@@ -256,6 +256,26 @@ static void bdw_dump(struct snd_sof_dev *sdev, u32 flags) BDW_STACK_DUMP_SIZE);snd_sof_get_status (sdev, status, panic, &xoops, &panic_info, stack,BDW_STACK_DUMP_SIZE ); + +/* provide some context for firmware debug */ + imrx =snd_sof_dsp_read (sdev,BDW_DSP_BAR ,SHIM_IMRX ); + imrd =snd_sof_dsp_read (sdev,BDW_DSP_BAR ,SHIM_IMRD ); +dev_err (sdev->dev, +"error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n" , + panic &SHIM_IPCX_BUSY ?"yes" :"no" , + panic &SHIM_IPCX_DONE ?"yes" :"no" , panic); +dev_err (sdev->dev, +"error: mask host: pending %s complete %s raw 0x%8.8x\n" , + imrx &SHIM_IMRX_BUSY ?"yes" :"no" , + imrx &SHIM_IMRX_DONE ?"yes" :"no" , imrx); +dev_err (sdev->dev, +"error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n" , + status &SHIM_IPCD_BUSY ?"yes" :"no" , + status &SHIM_IPCD_DONE ?"yes" :"no" , status); +dev_err (sdev->dev, +"error: mask DSP: pending %s complete %s raw 0x%8.8x\n" , + imrd &SHIM_IMRD_BUSY ?"yes" :"no" , + imrd &SHIM_IMRD_DONE ?"yes" :"no" , imrd); }/*
sound/soc/sof/intel/byt.c +22 -1
@@ -145,7 +145,7 @@ static void byt_dump(struct snd_sof_dev *sdev, u32 flags)struct sof_ipc_dsp_oops_xtensa xoops;struct sof_ipc_panic_info panic_info;u32 stack[BYT_STACK_DUMP_SIZE ]; -u32 status, panic; +u32 status, panic, imrd, imrx;/* now try generic SOF status messages */ status =snd_sof_dsp_read (sdev,BYT_DSP_BAR ,SHIM_IPCD );
@@ -154,6 +154,27 @@ static void byt_dump(struct snd_sof_dev *sdev, u32 flags) BYT_STACK_DUMP_SIZE);snd_sof_get_status (sdev, status, panic, &xoops, &panic_info, stack,BYT_STACK_DUMP_SIZE ); + +/* provide some context for firmware debug */ + imrx =snd_sof_dsp_read (sdev,BYT_DSP_BAR ,SHIM_IMRX ); + imrd =snd_sof_dsp_read (sdev,BYT_DSP_BAR ,SHIM_IMRD ); +dev_err (sdev->dev, +"error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n" , + panic &SHIM_IPCX_BUSY ?"yes" :"no" , + panic &SHIM_IPCX_DONE ?"yes" :"no" , panic); +dev_err (sdev->dev, +"error: mask host: pending %s complete %s raw 0x%8.8x\n" , + imrx &SHIM_IMRX_BUSY ?"yes" :"no" , + imrx &SHIM_IMRX_DONE ?"yes" :"no" , imrx); +dev_err (sdev->dev, +"error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n" , + status &SHIM_IPCD_BUSY ?"yes" :"no" , + status &SHIM_IPCD_DONE ?"yes" :"no" , status); +dev_err (sdev->dev, +"error: mask DSP: pending %s complete %s raw 0x%8.8x\n" , + imrd &SHIM_IMRD_BUSY ?"yes" :"no" , + imrd &SHIM_IMRD_DONE ?"yes" :"no" , imrd); + }/*
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: Intel: Add context data to any IPC timeout." to the asoc tree
The patch
ASoC: SOF: Intel: Add context data to any IPC timeout.
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 3a9e204d4e36904a464a2e53206b053a7ffc7bad Mon Sep 17 00:00:00 2001
From: Liam Girdwood <[email protected]>
Date: Fri, 27 Sep 2019 15:05:37 -0500
Subject: [PATCH] ASoC: SOF: Intel: Add context data to any IPC timeout.
Helps with FW debug as it provides DSP IPC processing context.
--- sound/soc/sof/intel/bdw.c | 22 +++++++++++++++++++++- sound/soc/sof/intel/byt.c | 23 ++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-)
sound/soc/sof/intel/bdw.c +21 -1
@@ -241,7 +241,7 @@ static void bdw_dump(struct snd_sof_dev *sdev, u32 flags)struct sof_ipc_dsp_oops_xtensa xoops;struct sof_ipc_panic_info panic_info;u32 stack[BDW_STACK_DUMP_SIZE ]; -u32 status, panic; +u32 status, panic, imrx, imrd;/* now try generic SOF status messages */ status =snd_sof_dsp_read (sdev,BDW_DSP_BAR ,SHIM_IPCD );
@@ -250,6 +250,26 @@ static void bdw_dump(struct snd_sof_dev *sdev, u32 flags) BDW_STACK_DUMP_SIZE);snd_sof_get_status (sdev, status, panic, &xoops, &panic_info, stack,BDW_STACK_DUMP_SIZE ); + +/* provide some context for firmware debug */ + imrx =snd_sof_dsp_read (sdev,BDW_DSP_BAR ,SHIM_IMRX ); + imrd =snd_sof_dsp_read (sdev,BDW_DSP_BAR ,SHIM_IMRD ); +dev_err (sdev->dev, +"error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n" , + panic &SHIM_IPCX_BUSY ?"yes" :"no" , + panic &SHIM_IPCX_DONE ?"yes" :"no" , panic); +dev_err (sdev->dev, +"error: mask host: pending %s complete %s raw 0x%8.8x\n" , + imrx &SHIM_IMRX_BUSY ?"yes" :"no" , + imrx &SHIM_IMRX_DONE ?"yes" :"no" , imrx); +dev_err (sdev->dev, +"error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n" , + status &SHIM_IPCD_BUSY ?"yes" :"no" , + status &SHIM_IPCD_DONE ?"yes" :"no" , status); +dev_err (sdev->dev, +"error: mask DSP: pending %s complete %s raw 0x%8.8x\n" , + imrd &SHIM_IMRD_BUSY ?"yes" :"no" , + imrd &SHIM_IMRD_DONE ?"yes" :"no" , imrd); }/*
sound/soc/sof/intel/byt.c +22 -1
@@ -139,7 +139,7 @@ static void byt_dump(struct snd_sof_dev *sdev, u32 flags)struct sof_ipc_dsp_oops_xtensa xoops;struct sof_ipc_panic_info panic_info;u32 stack[BYT_STACK_DUMP_SIZE ]; -u32 status, panic; +u32 status, panic, imrd, imrx;/* now try generic SOF status messages */ status =snd_sof_dsp_read (sdev,BYT_DSP_BAR ,SHIM_IPCD );
@@ -148,6 +148,27 @@ static void byt_dump(struct snd_sof_dev *sdev, u32 flags) BYT_STACK_DUMP_SIZE);snd_sof_get_status (sdev, status, panic, &xoops, &panic_info, stack,BYT_STACK_DUMP_SIZE ); + +/* provide some context for firmware debug */ + imrx =snd_sof_dsp_read (sdev,BYT_DSP_BAR ,SHIM_IMRX ); + imrd =snd_sof_dsp_read (sdev,BYT_DSP_BAR ,SHIM_IMRD ); +dev_err (sdev->dev, +"error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n" , + panic &SHIM_IPCX_BUSY ?"yes" :"no" , + panic &SHIM_IPCX_DONE ?"yes" :"no" , panic); +dev_err (sdev->dev, +"error: mask host: pending %s complete %s raw 0x%8.8x\n" , + imrx &SHIM_IMRX_BUSY ?"yes" :"no" , + imrx &SHIM_IMRX_DONE ?"yes" :"no" , imrx); +dev_err (sdev->dev, +"error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n" , + status &SHIM_IPCD_BUSY ?"yes" :"no" , + status &SHIM_IPCD_DONE ?"yes" :"no" , status); +dev_err (sdev->dev, +"error: mask DSP: pending %s complete %s raw 0x%8.8x\n" , + imrd &SHIM_IMRD_BUSY ?"yes" :"no" , + imrd &SHIM_IMRD_DONE ?"yes" :"no" , imrd); + }/*
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 13/13 ASoC: SOF: Intel: hda: Disable DMI L1 entry during capture
In reply to Pierre-Louis BossartFrom: Ranjani Sridharan <[email protected]>
There is a known issue on some Intel platforms which causes pause/release to run into xrun's during capture usecases. The suggested workaround to address the issue is to disable the entry of lower power L1 state in the physical DMI link when there is a capture stream open.
--- sound/soc/sof/intel/Kconfig | 10 +++++++ sound/soc/sof/intel/hda-ctrl.c | 12 +++------ sound/soc/sof/intel/hda-stream.c | 45 +++++++++++++++++++++++++++----- sound/soc/sof/intel/hda.h | 5 +++- 4 files changed, 56 insertions(+), 16 deletions(-)
sound/soc/sof/intel/Kconfig +10 -0
@@ -273,6 +273,16 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC Say Y if you want to enable HDAudio codecs with SOF. If unsure select "N". +config SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 + bool "SOF enable DMI Link L1" + help + This option enables DMI L1 for both playback and capture + and disables known workarounds for specific HDaudio platforms. + Only use to look into power optimizations on platforms not + affected by DMI L1 issues. This option is not recommended. + Say Y if you want to enable DMI Link L1 + If unsure, select "N". + endif ## SND_SOC_SOF_HDA_COMMON config SND_SOC_SOF_HDA_LINK_BASELINE
sound/soc/sof/intel/hda-ctrl.c +4 -8
@@ -139,20 +139,16 @@ void hda_dsp_ctrl_misc_clock_gating(struct snd_sof_dev *sdev, bool enable)*/ int hda_dsp_ctrl_clock_power_gating (struct snd_sof_dev *sdev,bool enable) { -#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA ) -struct hdac_bus *bus =sof_to_bus (sdev); -#endif u32 val;/* enable/disable audio dsp clock gating */ val = enable ?PCI_CGCTL_ADSPDCGE :0 ;snd_sof_pci_update_bits (sdev,PCI_CGCTL ,PCI_CGCTL_ADSPDCGE , val); -#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA ) -/* enable/disable L1 support */ - val = enable ?SOF_HDA_VS_EM2_L1SEN :0 ; -snd_hdac_chip_updatel (bus,VS_EM2 ,SOF_HDA_VS_EM2_L1SEN , val); -#endif +/* enable/disable DMI Link L1 support */ + val = enable ?HDA_VS_INTEL_EM2_L1SEN :0 ; +snd_sof_dsp_update_bits (sdev,HDA_DSP_HDA_BAR ,HDA_VS_INTEL_EM2 , +HDA_VS_INTEL_EM2_L1SEN , val);/* enable/disable audio dsp power gating */ val = enable ?0 :PCI_PGCTL_ADSPPGD ;
sound/soc/sof/intel/hda-stream.c +38 -7
67 lines not on this page · raw message
sound/soc/sof/intel/hda.h +4 -1
@@ -39,7 +39,6 @@#define SOF_HDA_WAKESTS 0x0E#define SOF_HDA_WAKESTS_INT_MASK ((1 << 8) - 1)#define SOF_HDA_RIRBSTS 0x5d -#define SOF_HDA_VS_EM2_L1SEN BIT(13)/* SOF_HDA_GCTL register bist */ #define SOF_HDA_GCTL_RESET BIT(0)
@@ -228,6 +227,10 @@#define HDA_DSP_REG_HIPCIE (HDA_DSP_IPC_BASE + 0x0C)#define HDA_DSP_REG_HIPCCTL (HDA_DSP_IPC_BASE + 0x10) +/* Intel Vendor Specific Registers */ +#define HDA_VS_INTEL_EM2 0x1030 +#define HDA_VS_INTEL_EM2_L1SEN BIT(13) +/* HIPCI */ #define HDA_DSP_REG_HIPCI_BUSY BIT(31)#define HDA_DSP_REG_HIPCI_MSG_MASK 0x7FFFFFFF
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: Intel: hda: Disable DMI L1 entry during capture" to the asoc tree
The patch
ASoC: SOF: Intel: hda: Disable DMI L1 entry during capture
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 43b2ab9009b13bfff47fcc1893de9244b39bdd54 Mon Sep 17 00:00:00 2001
From: Ranjani Sridharan <[email protected]>
Date: Fri, 27 Sep 2019 15:05:38 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda: Disable DMI L1 entry during capture
There is a known issue on some Intel platforms which causes pause/release to run into xrun's during capture usecases. The suggested workaround to address the issue is to disable the entry of lower power L1 state in the physical DMI link when there is a capture stream open.
--- sound/soc/sof/intel/Kconfig | 10 +++++++ sound/soc/sof/intel/hda-ctrl.c | 12 +++------ sound/soc/sof/intel/hda-stream.c | 45 +++++++++++++++++++++++++++----- sound/soc/sof/intel/hda.h | 5 +++- 4 files changed, 56 insertions(+), 16 deletions(-)
sound/soc/sof/intel/Kconfig +10 -0
@@ -273,6 +273,16 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC Say Y if you want to enable HDAudio codecs with SOF. If unsure select "N". +config SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 + bool "SOF enable DMI Link L1" + help + This option enables DMI L1 for both playback and capture + and disables known workarounds for specific HDaudio platforms. + Only use to look into power optimizations on platforms not + affected by DMI L1 issues. This option is not recommended. + Say Y if you want to enable DMI Link L1 + If unsure, select "N". + endif ## SND_SOC_SOF_HDA_COMMON config SND_SOC_SOF_HDA_LINK_BASELINE
sound/soc/sof/intel/hda-ctrl.c +4 -8
@@ -139,20 +139,16 @@ void hda_dsp_ctrl_misc_clock_gating(struct snd_sof_dev *sdev, bool enable)*/ int hda_dsp_ctrl_clock_power_gating (struct snd_sof_dev *sdev,bool enable) { -#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA ) -struct hdac_bus *bus =sof_to_bus (sdev); -#endif u32 val;/* enable/disable audio dsp clock gating */ val = enable ?PCI_CGCTL_ADSPDCGE :0 ;snd_sof_pci_update_bits (sdev,PCI_CGCTL ,PCI_CGCTL_ADSPDCGE , val); -#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA ) -/* enable/disable L1 support */ - val = enable ?SOF_HDA_VS_EM2_L1SEN :0 ; -snd_hdac_chip_updatel (bus,VS_EM2 ,SOF_HDA_VS_EM2_L1SEN , val); -#endif +/* enable/disable DMI Link L1 support */ + val = enable ?HDA_VS_INTEL_EM2_L1SEN :0 ; +snd_sof_dsp_update_bits (sdev,HDA_DSP_HDA_BAR ,HDA_VS_INTEL_EM2 , +HDA_VS_INTEL_EM2_L1SEN , val);/* enable/disable audio dsp power gating */ val = enable ?0 :PCI_PGCTL_ADSPPGD ;
sound/soc/sof/intel/hda-stream.c +38 -7
67 lines not on this page · raw message
sound/soc/sof/intel/hda.h +4 -1
@@ -39,7 +39,6 @@#define SOF_HDA_WAKESTS 0x0E#define SOF_HDA_WAKESTS_INT_MASK ((1 << 8) - 1)#define SOF_HDA_RIRBSTS 0x5d -#define SOF_HDA_VS_EM2_L1SEN BIT(13)/* SOF_HDA_GCTL register bist */ #define SOF_HDA_GCTL_RESET BIT(0)
@@ -228,6 +227,10 @@#define HDA_DSP_REG_HIPCIE (HDA_DSP_IPC_BASE + 0x0C)#define HDA_DSP_REG_HIPCCTL (HDA_DSP_IPC_BASE + 0x10) +/* Intel Vendor Specific Registers */ +#define HDA_VS_INTEL_EM2 0x1030 +#define HDA_VS_INTEL_EM2_L1SEN BIT(13) +/* HIPCI */ #define HDA_DSP_REG_HIPCI_BUSY BIT(31)#define HDA_DSP_REG_HIPCI_MSG_MASK 0x7FFFFFFF
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel