Unverified Commit 03db12ef authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: SOF: ipc4/Intel: Support for firmware exception

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

When a firmware crashes it creats a panic information into a telemetry
slot.  The panic format is defined by Zephyr, includes stack and
additional information to help to identify the reason for the crash.
Part of the firmware exception handling the firmware also sends an
EXCEPTION_CAUGHT notification.

This series implements the kernel side handling of the exception: print
information into the kernel log export the whole telemetry slot to user
space for tools extract additional information from the panic dump.
parents 16bb2209 c1c48fd6
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -515,6 +515,23 @@ struct sof_ipc4_notify_resource_data {
	uint32_t data[6];
} __packed __aligned(4);

#define SOF_IPC4_DEBUG_DESCRIPTOR_SIZE		12 /* 3 x u32 */

/*
 * The debug memory window is divided into 16 slots, and the
 * first slot is used as a recorder for the other 15 slots.
 */
#define SOF_IPC4_MAX_DEBUG_SLOTS		15
#define SOF_IPC4_DEBUG_SLOT_SIZE		0x1000

/* debug log slot types */
#define SOF_IPC4_DEBUG_SLOT_UNUSED		0x00000000
#define SOF_IPC4_DEBUG_SLOT_CRITICAL_LOG	0x54524300 /* byte 0: core ID */
#define SOF_IPC4_DEBUG_SLOT_DEBUG_LOG		0x474f4c00 /* byte 0: core ID */
#define SOF_IPC4_DEBUG_SLOT_GDB_STUB		0x42444700
#define SOF_IPC4_DEBUG_SLOT_TELEMETRY		0x4c455400
#define SOF_IPC4_DEBUG_SLOT_BROKEN		0x44414544

/** @}*/

#endif
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ snd-sof-objs += ipc3.o ipc3-loader.o ipc3-topology.o ipc3-control.o ipc3-pcm.o\
endif
ifneq ($(CONFIG_SND_SOC_SOF_IPC4),)
snd-sof-objs += ipc4.o ipc4-loader.o ipc4-topology.o ipc4-control.o ipc4-pcm.o\
		ipc4-mtrace.o
		ipc4-mtrace.o ipc4-telemetry.o
endif

# SOF client support
+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \
				 hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \
				 hda-dai.o hda-dai-ops.o hda-bus.o \
				 skl.o hda-loader-skl.o \
				 apl.o cnl.o tgl.o icl.o mtl.o lnl.o hda-common-ops.o
				 apl.o cnl.o tgl.o icl.o mtl.o lnl.o hda-common-ops.o \
				 telemetry.o

snd-sof-intel-hda-mlink-objs := hda-mlink.o

+14 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "../sof-pci-dev.h"
#include "../ops.h"
#include "hda.h"
#include "telemetry.h"

#define CREATE_TRACE_POINTS
#include <trace/events/sof_intel.h>
@@ -731,6 +732,19 @@ void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
	}
}

void hda_ipc4_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
{
	char *level = (flags & SOF_DBG_DUMP_OPTIONAL) ? KERN_DEBUG : KERN_ERR;

	/* print ROM/FW status */
	hda_dsp_get_state(sdev, level);

	if (flags & SOF_DBG_DUMP_REGS)
		sof_ipc4_intel_dump_telemetry_state(sdev, flags);
	else
		hda_dsp_dump_ext_rom_status(sdev, level, flags);
}

static bool hda_check_ipc_irq(struct snd_sof_dev *sdev)
{
	const struct sof_intel_dsp_desc *chip;
+1 −0
Original line number Diff line number Diff line
@@ -603,6 +603,7 @@ int hda_dsp_shutdown_dma_flush(struct snd_sof_dev *sdev);
int hda_dsp_shutdown(struct snd_sof_dev *sdev);
int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev);
void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags);
void hda_ipc4_dsp_dump(struct snd_sof_dev *sdev, u32 flags);
void hda_ipc_dump(struct snd_sof_dev *sdev);
void hda_ipc_irq_dump(struct snd_sof_dev *sdev);
void hda_dsp_d0i3_work(struct work_struct *work);
Loading