~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/sof/intel/telemetry.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
  2 //
  3 // This file is provided under a dual BSD/GPLv2 license.  When using or
  4 // redistributing this file, you may do so under either license.
  5 //
  6 // Copyright(c) 2023 Intel Corporation
  7 
  8 /* telemetry data queried from debug window */
  9 
 10 #include <sound/sof/ipc4/header.h>
 11 #include <sound/sof/xtensa.h>
 12 #include "../ipc4-priv.h"
 13 #include "../sof-priv.h"
 14 #include "hda.h"
 15 #include "telemetry.h"
 16 
 17 void sof_ipc4_intel_dump_telemetry_state(struct snd_sof_dev *sdev, u32 flags)
 18 {
 19         static const char invalid_slot_msg[] = "Core dump is not available due to";
 20         struct sof_ipc4_telemetry_slot_data *telemetry_data;
 21         struct sof_ipc_dsp_oops_xtensa *xoops;
 22         struct xtensa_arch_block *block;
 23         u32 slot_offset;
 24         char *level;
 25 
 26         level = (flags & SOF_DBG_DUMP_OPTIONAL) ? KERN_DEBUG : KERN_ERR;
 27 
 28         slot_offset = sof_ipc4_find_debug_slot_offset_by_type(sdev, SOF_IPC4_DEBUG_SLOT_TELEMETRY);
 29         if (!slot_offset)
 30                 return;
 31 
 32         telemetry_data = kmalloc(sizeof(*telemetry_data), GFP_KERNEL);
 33         if (!telemetry_data)
 34                 return;
 35         sof_mailbox_read(sdev, slot_offset, telemetry_data, sizeof(*telemetry_data));
 36         if (telemetry_data->separator != XTENSA_CORE_DUMP_SEPARATOR) {
 37                 dev_err(sdev->dev, "%s invalid separator %#x\n", invalid_slot_msg,
 38                         telemetry_data->separator);
 39                 goto free_telemetry_data;
 40         }
 41 
 42         block = kmalloc(sizeof(*block), GFP_KERNEL);
 43         if (!block)
 44                 goto free_telemetry_data;
 45 
 46         sof_mailbox_read(sdev, slot_offset + sizeof(*telemetry_data), block, sizeof(*block));
 47         if (block->soc != XTENSA_SOC_INTEL_ADSP) {
 48                 dev_err(sdev->dev, "%s invalid SOC %d\n", invalid_slot_msg, block->soc);
 49                 goto free_block;
 50         }
 51 
 52         if (telemetry_data->hdr.id[0] != COREDUMP_HDR_ID0 ||
 53             telemetry_data->hdr.id[1] != COREDUMP_HDR_ID1 ||
 54             telemetry_data->arch_hdr.id != COREDUMP_ARCH_HDR_ID) {
 55                 dev_err(sdev->dev, "%s invalid coredump header %c%c, arch hdr %c\n",
 56                         invalid_slot_msg, telemetry_data->hdr.id[0],
 57                         telemetry_data->hdr.id[1],
 58                         telemetry_data->arch_hdr.id);
 59                 goto free_block;
 60         }
 61 
 62         switch (block->toolchain) {
 63         case XTENSA_TOOL_CHAIN_ZEPHYR:
 64                 dev_printk(level, sdev->dev, "FW is built with Zephyr toolchain\n");
 65                 break;
 66         case XTENSA_TOOL_CHAIN_XCC:
 67                 dev_printk(level, sdev->dev, "FW is built with XCC toolchain\n");
 68                 break;
 69         default:
 70                 dev_printk(level, sdev->dev, "Unknown toolchain is used\n");
 71                 break;
 72         }
 73 
 74         xoops = kzalloc(struct_size(xoops, ar, XTENSA_CORE_AR_REGS_COUNT), GFP_KERNEL);
 75         if (!xoops)
 76                 goto free_block;
 77 
 78         xoops->exccause = block->exccause;
 79         xoops->excvaddr = block->excvaddr;
 80         xoops->epc1 = block->pc;
 81         xoops->ps = block->ps;
 82         xoops->sar = block->sar;
 83 
 84         xoops->plat_hdr.numaregs = XTENSA_CORE_AR_REGS_COUNT;
 85         memcpy((void *)xoops->ar, block->ar, XTENSA_CORE_AR_REGS_COUNT * sizeof(u32));
 86 
 87         sof_oops(sdev, level, xoops);
 88         sof_stack(sdev, level, xoops, NULL, 0);
 89 
 90         kfree(xoops);
 91 free_block:
 92         kfree(block);
 93 free_telemetry_data:
 94         kfree(telemetry_data);
 95 }
 96 EXPORT_SYMBOL_NS(sof_ipc4_intel_dump_telemetry_state, SND_SOC_SOF_INTEL_HDA_COMMON);
 97 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php