Skip to content

Commit 776100a

Browse files
plbossartbroonie
authored andcommitted
ASoC: SOF: Intel: hda: reduce verbosity of boot error logs
Previous commits reduced the verbosity of errors during boot iterations, but there are still a couple remaining which generate false positives. Errors should only be logged when after last attempt to download firmware failed. Duplicating logs and assigning them different levels based on the iteration number isn't really elegant, use macro as suggested by Guennadi. Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200917105633.2579047-9-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0e4ea87 commit 776100a

4 files changed

Lines changed: 28 additions & 10 deletions

File tree

‎sound/soc/sof/intel/hda-loader.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsig
8282
* status on core 1, so power up core 1 also momentarily, keep it in
8383
* reset/stall and then turn it off
8484
*/
85-
static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, int iteration)
85+
static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag)
8686
{
8787
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
8888
const struct sof_intel_dsp_desc *chip = hda->desc;
@@ -93,7 +93,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, int iteration)
9393
/* step 1: power up corex */
9494
ret = hda_dsp_core_power_up(sdev, chip->host_managed_cores_mask);
9595
if (ret < 0) {
96-
if (iteration == HDA_FW_BOOT_ATTEMPTS)
96+
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
9797
dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n");
9898
goto err;
9999
}
@@ -116,7 +116,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, int iteration)
116116
/* step 3: unset core 0 reset state & unstall/run core 0 */
117117
ret = hda_dsp_core_run(sdev, BIT(0));
118118
if (ret < 0) {
119-
if (iteration == HDA_FW_BOOT_ATTEMPTS)
119+
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
120120
dev_err(sdev->dev,
121121
"error: dsp core start failed %d\n", ret);
122122
ret = -EIO;
@@ -132,7 +132,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, int iteration)
132132
HDA_DSP_INIT_TIMEOUT_US);
133133

134134
if (ret < 0) {
135-
if (iteration == HDA_FW_BOOT_ATTEMPTS)
135+
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
136136
dev_err(sdev->dev,
137137
"error: %s: timeout for HIPCIE done\n",
138138
__func__);
@@ -148,7 +148,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, int iteration)
148148
/* step 5: power down corex */
149149
ret = hda_dsp_core_power_down(sdev, chip->host_managed_cores_mask & ~(BIT(0)));
150150
if (ret < 0) {
151-
if (iteration == HDA_FW_BOOT_ATTEMPTS)
151+
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
152152
dev_err(sdev->dev,
153153
"error: dsp core x power down failed\n");
154154
goto err;
@@ -168,7 +168,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, int iteration)
168168
if (!ret)
169169
return 0;
170170

171-
if (iteration == HDA_FW_BOOT_ATTEMPTS)
171+
if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
172172
dev_err(sdev->dev,
173173
"error: %s: timeout HDA_DSP_SRAM_REG_ROM_STATUS read\n",
174174
__func__);
@@ -328,6 +328,7 @@ int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev)
328328

329329
int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
330330
{
331+
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
331332
struct snd_sof_pdata *plat_data = sdev->pdata;
332333
const struct sof_dev_desc *desc = plat_data->desc;
333334
const struct sof_intel_dsp_desc *chip_info;
@@ -364,7 +365,8 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
364365
dev_dbg(sdev->dev,
365366
"Attempting iteration %d of Core En/ROM load...\n", i);
366367

367-
ret = cl_dsp_init(sdev, stream->hstream.stream_tag, i + 1);
368+
hda->boot_iteration = i + 1;
369+
ret = cl_dsp_init(sdev, stream->hstream.stream_tag);
368370

369371
/* don't retry anymore if successful */
370372
if (!ret)

‎sound/soc/sof/intel/hda.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags)
418418
/* dump the first 8 dwords representing the extended ROM status */
419419
static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev)
420420
{
421+
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
421422
char msg[128];
422423
int len = 0;
423424
u32 value;
@@ -428,11 +429,14 @@ static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev)
428429
len += snprintf(msg + len, sizeof(msg) - len, " 0x%x", value);
429430
}
430431

431-
dev_err(sdev->dev, "error: extended rom status:%s", msg);
432+
sof_dev_dbg_or_err(sdev->dev, hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS,
433+
"extended rom status: %s", msg);
434+
432435
}
433436

434437
void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
435438
{
439+
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
436440
struct sof_ipc_dsp_oops_xtensa xoops;
437441
struct sof_ipc_panic_info panic_info;
438442
u32 stack[HDA_DSP_STACK_DUMP_SIZE];
@@ -452,8 +456,10 @@ void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
452456
snd_sof_get_status(sdev, status, panic, &xoops, &panic_info,
453457
stack, HDA_DSP_STACK_DUMP_SIZE);
454458
} else {
455-
dev_err(sdev->dev, "error: status = 0x%8.8x panic = 0x%8.8x\n",
456-
status, panic);
459+
sof_dev_dbg_or_err(sdev->dev, hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS,
460+
"status = 0x%8.8x panic = 0x%8.8x\n",
461+
status, panic);
462+
457463
hda_dsp_dump_ext_rom_status(sdev);
458464
hda_dsp_get_status(sdev);
459465
}

‎sound/soc/sof/intel/hda.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
#define BXT_D0I3_DELAY 5000
275275

276276
#define FW_CL_STREAM_NUMBER 0x1
277+
#define HDA_FW_BOOT_ATTEMPTS 3
277278

278279
/* ADSPCS - Audio DSP Control & Status */
279280

@@ -416,6 +417,7 @@ enum sof_hda_D0_substate {
416417

417418
/* represents DSP HDA controller frontend - i.e. host facing control */
418419
struct sof_intel_hda_dev {
420+
int boot_iteration;
419421

420422
struct hda_bus hbus;
421423

‎sound/soc/sof/sof-priv.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,4 +578,12 @@ int intel_pcm_close(struct snd_sof_dev *sdev,
578578

579579
int sof_machine_check(struct snd_sof_dev *sdev);
580580

581+
#define sof_dev_dbg_or_err(dev, is_err, fmt, ...) \
582+
do { \
583+
if (is_err) \
584+
dev_err(dev, "error: " fmt, __VA_ARGS__); \
585+
else \
586+
dev_dbg(dev, fmt, __VA_ARGS__); \
587+
} while (0)
588+
581589
#endif

0 commit comments

Comments
 (0)