diff options
author | Neela Chithirala <chithiralan@google.com> | 2021-11-19 02:37:22 +0000 |
---|---|---|
committer | Neela Chithirala <chithiralan@google.com> | 2021-11-19 07:37:45 +0000 |
commit | e14069f1739b05c7a7f60ae73c8ce14b91ef12e0 (patch) | |
tree | 49b54f216dc0556c514ce692e13f3bfa53d442dc /gxp-debugfs.c | |
parent | de16475969ca7dfaecf7144ece32b929cf193861 (diff) | |
download | gs201-e14069f1739b05c7a7f60ae73c8ce14b91ef12e0.tar.gz |
Merge branch 'gs201-release' to android13-gs-pixel-5.10
* gs201-release:
gxp: Initial commit for PM interface
gxp: map and unmap TPU mailbox queues buffer
gxp: unittests: add a gxp-debugfs-test.c
gxp: unittests: add a gxp-platform-test.c
gxp: unittests: add a gxp-vd-test.c
gxp: unittests: add a gxp-firmware-test.c
gxp: Update the logging/tracing device/host shared structures.
gxp: Add ability to mmap telemetry buffers
gxp: Move ETM trace_data off the stack
gxp: Add IOCTL for configuring ETM registers
gxp: Update copyright to "Google LLC"
gxp: Remove NEED_SG_DMA_LENGTH from Kconfig
gxp: unittests: fix kunit path in kokoro
gxp: unittests: let LPM be always active
gxp: unittests: add a fake firmware loader
gxp: unittests: support device tree in unit tests
gxp: unittests: use kokoro to execute tests
Signed-off-by: Neela Chithirala <chithiralan@google.com>
Change-Id: I8fa8dfaaa70d2a40503ff3bffe636380b69e443c
Diffstat (limited to 'gxp-debugfs.c')
-rw-r--r-- | gxp-debugfs.c | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/gxp-debugfs.c b/gxp-debugfs.c index e8991ec..88b3190 100644 --- a/gxp-debugfs.c +++ b/gxp-debugfs.c @@ -11,8 +11,9 @@ #include "gxp-firmware.h" #include "gxp-firmware-data.h" #include "gxp-internal.h" -#include "gxp-lpm.h" +#include "gxp-pm.h" #include "gxp-mailbox.h" +#include "gxp-telemetry.h" #include "gxp-vd.h" static int gxp_debugfs_lpm_test(void *data, u64 val) @@ -165,7 +166,7 @@ static int gxp_blk_powerstate_set(void *data, u64 val) int ret = 0; if (val >= AUR_DVFS_MIN_STATE) { - ret = gxp_blk_set_state(gxp, val); + ret = gxp_pm_blk_set_state_acpm(gxp, val); } else { ret = -EINVAL; dev_err(gxp->dev, "Incorrect state %llu\n", val); @@ -177,7 +178,7 @@ static int gxp_blk_powerstate_get(void *data, u64 *val) { struct gxp_dev *gxp = (struct gxp_dev *)data; - *val = gxp_blk_get_state(gxp); + *val = gxp_pm_blk_get_state_acpm(gxp); return 0; } @@ -191,6 +192,66 @@ static int gxp_debugfs_coredump(void *data, u64 val) DEFINE_DEBUGFS_ATTRIBUTE(gxp_coredump_fops, NULL, gxp_debugfs_coredump, "%llu\n"); +static int gxp_log_buff_set(void *data, u64 val) +{ + struct gxp_dev *gxp = (struct gxp_dev *)data; + int i; + u64 **buffers; + u64 *ptr; + + mutex_lock(&gxp->telemetry_mgr->lock); + + if (!gxp->telemetry_mgr->logging_buff_data) { + dev_err(gxp->dev, "%s: Logging buffer has not been created\n", + __func__); + mutex_unlock(&gxp->telemetry_mgr->lock); + return -ENODEV; + } + + buffers = (u64 **)gxp->telemetry_mgr->logging_buff_data->buffers; + for (i = 0; i < GXP_NUM_CORES; i++) { + ptr = buffers[i]; + *ptr = val; + } + dev_dbg(gxp->dev, + "%s: log buff first bytes: [0] = %llu, [1] = %llu, [2] = %llu, [3] = %llu (val=%llu)\n", + __func__, *buffers[0], *buffers[1], *buffers[2], *buffers[3], + val); + + mutex_unlock(&gxp->telemetry_mgr->lock); + + return 0; +} + +static int gxp_log_buff_get(void *data, u64 *val) +{ + struct gxp_dev *gxp = (struct gxp_dev *)data; + u64 **buffers; + + mutex_lock(&gxp->telemetry_mgr->lock); + + if (!gxp->telemetry_mgr->logging_buff_data) { + dev_err(gxp->dev, "%s: Logging buffer has not been created\n", + __func__); + mutex_unlock(&gxp->telemetry_mgr->lock); + return -ENODEV; + } + + buffers = (u64 **)gxp->telemetry_mgr->logging_buff_data->buffers; + dev_dbg(gxp->dev, + "%s: log buff first bytes: [0] = %llu, [1] = %llu, [2] = %llu, [3] = %llu\n", + __func__, *buffers[0], *buffers[1], *buffers[2], *buffers[3]); + + *val = *buffers[0]; + + mutex_unlock(&gxp->telemetry_mgr->lock); + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(gxp_log_buff_fops, gxp_log_buff_get, gxp_log_buff_set, + "%llu\n"); + void gxp_create_debugfs(struct gxp_dev *gxp) { gxp->d_entry = debugfs_create_dir("gxp", NULL); @@ -209,6 +270,7 @@ void gxp_create_debugfs(struct gxp_dev *gxp) &gxp_blk_powerstate_fops); debugfs_create_file("coredump", 0200, gxp->d_entry, gxp, &gxp_coredump_fops); + debugfs_create_file("log", 0600, gxp->d_entry, gxp, &gxp_log_buff_fops); } void gxp_remove_debugfs(struct gxp_dev *gxp) |