forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 140
Add fw panic support for IPC4 #4369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ujfalusi
merged 9 commits into
thesofproject:topic/sof-dev
from
RanderWang:ipc4-fw-panic
Sep 7, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
79230db
ASoC: SOF: Xtensa: dump ar registers to restore call stack
RanderWang d6032ca
ASoC: SOF: ipc4-mtrace: move debug slot related definitions to header.h
RanderWang 1460f65
ASoC: SOF: ipc4: add a helper function to search debug slot
RanderWang b5858ce
ASoC: SOF: ipc4: add definition of telemetry slot for exception handling
RanderWang 222c269
ASoC: SOF: ipc4: add exception node in sof debugfs directory
RanderWang 1d3fe49
ASoC: SOF: Intel: add telemetry retrieval support on Intel platforms
RanderWang 069b44e
ASoC: SOF: Intel: mtl: dump dsp stack
RanderWang fdf6ab3
ASoC: SOF: Intel: hda: add ipc4 FW panic support on CAVS 2.5+ platforms
RanderWang f804a68
ASoC: SOF: ipc4: handle EXCEPTION_CAUGHT notification from firmware
RanderWang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) | ||
| // | ||
| // This file is provided under a dual BSD/GPLv2 license. When using or | ||
| // redistributing this file, you may do so under either license. | ||
| // | ||
| // Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
|
|
||
| /* telemetry data queried from debug window */ | ||
|
|
||
| #include <sound/sof/ipc4/header.h> | ||
| #include <sound/sof/xtensa.h> | ||
| #include "../ipc4-priv.h" | ||
| #include "../sof-priv.h" | ||
| #include "hda.h" | ||
| #include "telemetry.h" | ||
|
|
||
| void sof_ipc4_intel_dump_telemetry_state(struct snd_sof_dev *sdev, u32 flags) | ||
| { | ||
| static const char invalid_slot_msg[] = "Core dump is not available due to"; | ||
RanderWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| struct sof_ipc4_telemetry_slot_data *telemetry_data; | ||
| struct sof_ipc_dsp_oops_xtensa *xoops; | ||
| struct xtensa_arch_block *block; | ||
| u32 slot_offset; | ||
RanderWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| char *level; | ||
|
|
||
| level = (flags & SOF_DBG_DUMP_OPTIONAL) ? KERN_DEBUG : KERN_ERR; | ||
|
|
||
| slot_offset = sof_ipc4_find_debug_slot_offset_by_type(sdev, SOF_IPC4_DEBUG_SLOT_TELEMETRY); | ||
| if (!slot_offset) | ||
| return; | ||
|
|
||
| telemetry_data = kmalloc(sizeof(*telemetry_data), GFP_KERNEL); | ||
| if (!telemetry_data) | ||
| return; | ||
| sof_mailbox_read(sdev, slot_offset, telemetry_data, sizeof(*telemetry_data)); | ||
RanderWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (telemetry_data->separator != XTENSA_CORE_DUMP_SEPARATOR) { | ||
| dev_err(sdev->dev, "%s invalid separator %#x\n", invalid_slot_msg, | ||
| telemetry_data->separator); | ||
| goto free_telemetry_data; | ||
| } | ||
RanderWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| block = kmalloc(sizeof(*block), GFP_KERNEL); | ||
| if (!block) | ||
| goto free_telemetry_data; | ||
|
|
||
| sof_mailbox_read(sdev, slot_offset + sizeof(*telemetry_data), block, sizeof(*block)); | ||
| if (block->soc != XTENSA_SOC_INTEL_ADSP) { | ||
RanderWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| dev_err(sdev->dev, "%s invalid SOC %d\n", invalid_slot_msg, block->soc); | ||
| goto free_block; | ||
| } | ||
|
|
||
| if (telemetry_data->hdr.id[0] != COREDUMP_HDR_ID0 || | ||
| telemetry_data->hdr.id[1] != COREDUMP_HDR_ID1 || | ||
| telemetry_data->arch_hdr.id != COREDUMP_ARCH_HDR_ID) { | ||
| dev_err(sdev->dev, "%s invalid coredump header %c%c, arch hdr %c\n", | ||
| invalid_slot_msg, telemetry_data->hdr.id[0], | ||
| telemetry_data->hdr.id[1], | ||
| telemetry_data->arch_hdr.id); | ||
| goto free_block; | ||
| } | ||
RanderWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| switch (block->toolchain) { | ||
| case XTENSA_TOOL_CHAIN_ZEPHYR: | ||
| dev_printk(level, sdev->dev, "FW is built with Zephyr toolchain\n"); | ||
| break; | ||
| case XTENSA_TOOL_CHAIN_XCC: | ||
| dev_printk(level, sdev->dev, "FW is built with XCC toolchain\n"); | ||
| break; | ||
| default: | ||
plbossart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| dev_printk(level, sdev->dev, "Unknown toolchain is used\n"); | ||
| break; | ||
| } | ||
|
|
||
| xoops = kzalloc(struct_size(xoops, ar, XTENSA_CORE_AR_REGS_COUNT), GFP_KERNEL); | ||
| if (!xoops) | ||
| goto free_block; | ||
|
|
||
| xoops->exccause = block->exccause; | ||
| xoops->excvaddr = block->excvaddr; | ||
| xoops->epc1 = block->pc; | ||
| xoops->ps = block->ps; | ||
| xoops->sar = block->sar; | ||
|
|
||
| xoops->plat_hdr.numaregs = XTENSA_CORE_AR_REGS_COUNT; | ||
| memcpy((void *)xoops->ar, block->ar, XTENSA_CORE_AR_REGS_COUNT * sizeof(u32)); | ||
|
|
||
| sof_oops(sdev, level, xoops); | ||
| sof_stack(sdev, level, xoops, NULL, 0); | ||
|
|
||
| kfree(xoops); | ||
RanderWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| free_block: | ||
| kfree(block); | ||
| free_telemetry_data: | ||
| kfree(telemetry_data); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ | ||
| /* | ||
| * This file is provided under a dual BSD/GPLv2 license. When using or | ||
| * redistributing this file, you may do so under either license. | ||
| * | ||
| * Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
| * | ||
| * telemetry data in debug windows | ||
| */ | ||
|
|
||
| #ifndef _SOF_INTEL_TELEMETRY_H | ||
| #define _SOF_INTEL_TELEMETRY_H | ||
|
|
||
| #include "../ipc4-telemetry.h" | ||
|
|
||
| struct xtensa_arch_block { | ||
kv2019i marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| u8 soc; /* should be equal to XTENSA_SOC_INTEL_ADSP */ | ||
| u16 version; | ||
| u8 toolchain; /* ZEPHYR or XCC */ | ||
|
|
||
| u32 pc; | ||
| u32 exccause; | ||
| u32 excvaddr; | ||
| u32 sar; | ||
| u32 ps; | ||
| u32 scompare1; | ||
| u32 ar[XTENSA_CORE_AR_REGS_COUNT]; | ||
| u32 lbeg; | ||
kv2019i marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| u32 lend; | ||
| u32 lcount; | ||
| } __packed; | ||
plbossart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| void sof_ipc4_intel_dump_telemetry_state(struct snd_sof_dev *sdev, u32 flags); | ||
|
|
||
| #endif /* _SOF_INTEL_TELEMETRY_H */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.