mirror of https://gitee.com/openkylin/linux.git
ASoC: SOF: Intel: hda: fix the condition passed to sof_dev_dbg_or_err
The condition boot_iteration == HDA_FW_BOOT_ATTEMPTS to determine the log level for the DSP status dump would only work in the case of DSP init failure after maximum number of attempts to initialize the DSP. If DSP init succeeds in less than HDA_FW_BOOT_ATTEMPTS attempts and FW loading fails, the ROM status dump would end up getting logged as debug instead of an error. So, add a new flag, SOF_DBG_DUMP_LOG_ERROR, to explicitly specify the log level for DSP status dump. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20201211100743.3188821-4-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
fbfa22ec4b
commit
8f7ef6fca0
|
@ -88,6 +88,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag)
|
|||
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
|
||||
const struct sof_intel_dsp_desc *chip = hda->desc;
|
||||
unsigned int status;
|
||||
u32 flags;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
|
@ -175,7 +176,13 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag)
|
|||
__func__);
|
||||
|
||||
err:
|
||||
hda_dsp_dump(sdev, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_MBOX);
|
||||
flags = SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_MBOX;
|
||||
|
||||
/* force error log level after max boot attempts */
|
||||
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
|
||||
flags |= SOF_DBG_DUMP_FORCE_ERR_LEVEL;
|
||||
|
||||
hda_dsp_dump(sdev, flags);
|
||||
hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask);
|
||||
|
||||
return ret;
|
||||
|
@ -411,7 +418,8 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
|
|||
if (!ret) {
|
||||
dev_dbg(sdev->dev, "Firmware download successful, booting...\n");
|
||||
} else {
|
||||
hda_dsp_dump(sdev, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_MBOX);
|
||||
hda_dsp_dump(sdev, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_MBOX |
|
||||
SOF_DBG_DUMP_FORCE_ERR_LEVEL);
|
||||
dev_err(sdev->dev, "error: load fw failed ret: %d\n", ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -416,9 +416,8 @@ void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags)
|
|||
}
|
||||
|
||||
/* dump the first 8 dwords representing the extended ROM status */
|
||||
static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev)
|
||||
static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, u32 flags)
|
||||
{
|
||||
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
|
||||
char msg[128];
|
||||
int len = 0;
|
||||
u32 value;
|
||||
|
@ -429,14 +428,13 @@ static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev)
|
|||
len += snprintf(msg + len, sizeof(msg) - len, " 0x%x", value);
|
||||
}
|
||||
|
||||
sof_dev_dbg_or_err(sdev->dev, hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS,
|
||||
sof_dev_dbg_or_err(sdev->dev, flags & SOF_DBG_DUMP_FORCE_ERR_LEVEL,
|
||||
"extended rom status: %s", msg);
|
||||
|
||||
}
|
||||
|
||||
void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
|
||||
{
|
||||
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
|
||||
struct sof_ipc_dsp_oops_xtensa xoops;
|
||||
struct sof_ipc_panic_info panic_info;
|
||||
u32 stack[HDA_DSP_STACK_DUMP_SIZE];
|
||||
|
@ -456,11 +454,11 @@ void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
|
|||
snd_sof_get_status(sdev, status, panic, &xoops, &panic_info,
|
||||
stack, HDA_DSP_STACK_DUMP_SIZE);
|
||||
} else {
|
||||
sof_dev_dbg_or_err(sdev->dev, hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS,
|
||||
sof_dev_dbg_or_err(sdev->dev, flags & SOF_DBG_DUMP_FORCE_ERR_LEVEL,
|
||||
"status = 0x%8.8x panic = 0x%8.8x\n",
|
||||
status, panic);
|
||||
|
||||
hda_dsp_dump_ext_rom_status(sdev);
|
||||
hda_dsp_dump_ext_rom_status(sdev, flags);
|
||||
hda_dsp_get_status(sdev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -857,7 +857,7 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)
|
|||
if (ret == 0) {
|
||||
dev_err(sdev->dev, "error: firmware boot failure\n");
|
||||
snd_sof_dsp_dbg_dump(sdev, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX |
|
||||
SOF_DBG_DUMP_TEXT | SOF_DBG_DUMP_PCI);
|
||||
SOF_DBG_DUMP_TEXT | SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_FORCE_ERR_LEVEL);
|
||||
sdev->fw_state = SOF_FW_BOOT_FAILED;
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#define SOF_DBG_DUMP_MBOX BIT(1)
|
||||
#define SOF_DBG_DUMP_TEXT BIT(2)
|
||||
#define SOF_DBG_DUMP_PCI BIT(3)
|
||||
#define SOF_DBG_DUMP_FORCE_ERR_LEVEL BIT(4) /* used to dump dsp status with error log level */
|
||||
|
||||
|
||||
/* global debug state set by SOF_DBG_ flags */
|
||||
extern int sof_core_debug;
|
||||
|
|
Loading…
Reference in New Issue