- 
                Notifications
    You must be signed in to change notification settings 
- Fork 136
Telemetry2 debugfs #4956
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
Telemetry2 debugfs #4956
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -536,6 +536,7 @@ struct sof_ipc4_notify_resource_data { | |
| #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_TELEMETRY2 0x4c455500 | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. commit message: a 'second telemetry slot'? so we can have two slots for telemetry used concurrently? if not, how do we know which one is valid? That's not a good start for a review in general. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd assume this would require some discussion. The old telemetry slot is not very extendable so something new is needed to pass more debugging information to SOF side. | ||
| #define SOF_IPC4_DEBUG_SLOT_BROKEN 0x44414544 | ||
|  | ||
| /** | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -11,7 +11,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-telemetry.o | ||
| ipc4-mtrace.o ipc4-telemetry.o ipc4-telemetry2.o | ||
|          | ||
| endif | ||
|  | ||
| # SOF client support | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| // SPDX-License-Identifier: GPL-2.0-only | ||
| // | ||
| // Copyright(c) 2024 Intel Corporation. | ||
|  | ||
| #include <linux/debugfs.h> | ||
| #include <linux/io.h> | ||
| #include <linux/pm_runtime.h> | ||
| #include <sound/sof/debug.h> | ||
| #include <sound/sof/ipc4/header.h> | ||
| #include "sof-priv.h" | ||
| #include "ops.h" | ||
| #include "ipc4-telemetry2.h" | ||
| #include "ipc4-priv.h" | ||
|          | ||
|  | ||
| static ssize_t sof_telemetry2_entry_read(struct file *file, char __user *buffer, | ||
| size_t count, loff_t *ppos) | ||
| { | ||
| struct snd_sof_dfsentry *dfse = file->private_data; | ||
| struct snd_sof_dev *sdev = dfse->sdev; | ||
| u32 type = SOF_IPC4_DEBUG_SLOT_TELEMETRY2; | ||
| loff_t pos = *ppos; | ||
| size_t size_ret; | ||
| u32 offset; | ||
| u8 *buf; | ||
|  | ||
| if (pos < 0) | ||
| return -EINVAL; | ||
| if (pos >= SOF_IPC4_DEBUG_SLOT_SIZE || !count) | ||
| return 0; | ||
| if (count > SOF_IPC4_DEBUG_SLOT_SIZE - pos) | ||
| count = SOF_IPC4_DEBUG_SLOT_SIZE - pos; | ||
|  | ||
| offset = sof_ipc4_find_debug_slot_offset_by_type(sdev, type); | ||
| if (!offset) | ||
| return -EFAULT; | ||
|          | ||
|  | ||
| buf = kzalloc(SOF_IPC4_DEBUG_SLOT_SIZE, GFP_KERNEL); | ||
| if (!buf) | ||
| return -ENOMEM; | ||
|  | ||
| sof_mailbox_read(sdev, offset, buf, SOF_IPC4_DEBUG_SLOT_SIZE); | ||
| size_ret = copy_to_user(buffer, buf + pos, count); | ||
| if (size_ret) { | ||
| kfree(buf); | ||
| return -EFAULT; | ||
| } | ||
|  | ||
| *ppos = pos + count; | ||
| kfree(buf); | ||
|  | ||
| return count; | ||
| } | ||
|  | ||
| static const struct file_operations sof_telemetry2_fops = { | ||
| .open = simple_open, | ||
| .read = sof_telemetry2_entry_read, | ||
| .llseek = default_llseek, | ||
| }; | ||
|  | ||
| void sof_ipc4_create_telemetry2_debugfs_node(struct snd_sof_dev *sdev) | ||
| { | ||
| struct snd_sof_dfsentry *dfse; | ||
|  | ||
| dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); | ||
| if (!dfse) | ||
| return; | ||
|  | ||
| dfse->type = SOF_DFSENTRY_TYPE_IOMEM; | ||
| dfse->size = SOF_IPC4_DEBUG_SLOT_SIZE; | ||
| dfse->access_type = SOF_DEBUGFS_ACCESS_ALWAYS; | ||
| dfse->sdev = sdev; | ||
|  | ||
| list_add(&dfse->list, &sdev->dfsentry_list); | ||
|  | ||
| debugfs_create_file("telemetry2", 0444, sdev->debugfs_root, dfse, &sof_telemetry2_fops); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| /* | ||
| * Copyright(c) 2024 Intel Corporation. | ||
| */ | ||
|  | ||
| #ifndef __SOUND_SOC_SOF_IPC4_TELEMETRY2_H | ||
| #define __SOUND_SOC_SOF_IPC4_TELEMETRY2_H | ||
|  | ||
| void sof_ipc4_create_telemetry2_debugfs_node(struct snd_sof_dev *sdev); | ||
|  | ||
| #endif | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsarha can you please elaborate a bit on what telemetry2 is, the need for it and how it is different from the existing telemetry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It tries to be what Liam has described here:
thesofproject/sof#5521 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but no one can figure this out. You have to add a simple enough abstract so that the PR is self-contained and self-explanatory.