summaryrefslogtreecommitdiff
path: root/gxp-debugfs.c
diff options
context:
space:
mode:
authorAurora pro automerger <aurora-pro-automerger@google.com>2022-05-14 14:55:22 -0700
committerCopybara-Service <copybara-worker@google.com>2022-05-16 12:19:42 -0700
commit35e3403a4d6660b3db2e434d5fa93e23961222ec (patch)
tree08ae62eb3b9613f11afaf8289651cd04f130c8fa /gxp-debugfs.c
parentfa5cf5721220d5b97544ea56b91bd9f2590debac (diff)
downloadgs201-35e3403a4d6660b3db2e434d5fa93e23961222ec.tar.gz
[Copybara Auto Merge] Merge branch 'gs201-release' into 'android13-gs-pixel-5.10'
gxp: Remove stale TODO comments Bug: 232447048 gxp: heuristically guess the user buffer perm Bug: 232529892 gxp: rearrange logs for BLK/VD suspend/resume Bug: 209083969 gxp: check AUR_OFF while sending power requests Bug: 231694821 gxp: rename NUM_CORES to MAX_NUM_CORES Bug: 229961485 gxp: fix one more typo of "semphore" Bug: 232447048 (repeat) gxp: fix size check for telemetry mmap Bug: 232447048 (repeat) gxp: check VD wakelock for GXP_TRIGGER_DEBUG_DUMP Bug: 231692562 gxp: Handle debug dump cases with invalid segment header Bug: 218344866 gxp: Add header file version into debug dump struct Bug: 202417979 gxp: Fix "semphore" typo Bug: 232447048 (repeat) gxp: Use DMA direction argument to determine read/write buffer map Bug: 201243473 gxp: Update mailbox command codes and remove unused ones Bug: 231328277 gxp: assert client->semaphore held without rw Bug: 231692448 gxp: Add unittests for the TPU related ioctl Bug: 227545695 gxp: refine power state transition interface Bug: 231584263 gxp: Add check that virtual device is not NULL Bug: 231271959 gxp: remove unused block wakelock functions Bug: 232447048 (repeat) gxp: Check memory-per-core arg to GXP_ALLOCATE_VIRTUAL_DEVICE Bug: 231272386 gxp: Log changes to thermal limit on BLK frequency Bug: 177217526 gxp: don't warn if all power votes are revoked Bug: 232447048 (repeat) gxp: Do not request firmware until first open() Bug: 228377252 gxp: Add the ability to re-request firmware images Bug: 228377252 (repeat) gxp: Prepare fw images and buffers on probe Bug: 228377252 (repeat) gxp: Add IOCTL for triggering debug dump Bug: 185262089 gxp: Update coredump debugfs node Bug: 185262089 (repeat) gxp: check valid dma direction Bug: 232447048 (repeat) gxp: fix probe cleanup sequences Bug: 228920163 gxp: Check DMA direction before create mapping Bug: 229578163 gxp: Use kvmalloc to allocate pages for mapping Bug: 230312441 gxp: add uaccess.h header for access_ok Bug: 201243473 (repeat) gxp: Refactor mappings to be owned by VDs Bug: 184572070 Bug: 220225771 Bug: 230291950 gxp: Add access_ok check to buffer map operation Bug: 201243473 (repeat) gxp: Add lock assertion for cmd_queue and resp_queue manipulation Bug: 229919339 gxp: use realtime kthread for response handling Bug: 229687028 gxp: Register IRQ handler after initializing the mailbox Bug: 229912601 gxp: Update comment when scheduling power requests Bug: 232447048 (repeat) gxp: remove config GXP_CLOUDRIPPER Bug: 229696441 gxp: add timeout to response ioctl Bug: 229443637 gxp: fix broken Makefile for out-of-tree build Bug: 232447048 (repeat) gxp: fix GXP_NUM_CORES setting Bug: 232447048 (repeat) gxp: add NOWARN flag when pinning user pages Bug: 229578166 gxp: create amalthea configurations Bug: 227528380 gxp: add Kconfig for future gen Bug: 227528380 (repeat) gxp: check fw_app by IS_ERR_OR_NULL Bug: 229433210 gxp: Add log for out of memory when pinning pages Bug: 232447048 (repeat) gxp: validate virtual core list on buffer map Bug: 229172687 gxp: initialize specs ioctl output buf Bug: 229470814 gxp: Update flow for kernel-initiated debug dumps Bug: 185262089 (repeat) gxp: Always return an error on gxp_vd_allocate failure Bug: 229329108 gxp: refuse vd wakelock acquriing if not allocated Bug: 229249566 gxp: add -Idrivers/gxp/include to ccflags Bug: 205970684 gxp: check null pointer in eventfd unregistration Bug: 229198626 gxp: Add support for dynamic callstack reconstruction in debug dump Bug: 203441187 gxp: Add ability to map/unmap user buffers to kernel space Bug: 203441187 (repeat) gxp: move acpm_dvfs to include/ Bug: 228938583 gxp: not set doorbell mask twice if it's not GEM5 Bug: 232447048 (repeat) gxp: add iommu domain pool Bug: 209083969 (repeat) gxp: Add flush_workqueue when pm destroy Bug: 232447048 (repeat) gxp: add include/ to inclusion path Bug: 205970684 (repeat) GitOrigin-RevId: ef68c0f9b9145e7ffbee141fa192335bf877e82d Change-Id: Ide21a9ab84d480c018ae065868d8ee619df83bf0
Diffstat (limited to 'gxp-debugfs.c')
-rw-r--r--gxp-debugfs.c108
1 files changed, 48 insertions, 60 deletions
diff --git a/gxp-debugfs.c b/gxp-debugfs.c
index 0d9dae6..8853c3b 100644
--- a/gxp-debugfs.c
+++ b/gxp-debugfs.c
@@ -5,23 +5,22 @@
* Copyright (C) 2021 Google LLC
*/
-#ifdef CONFIG_GXP_CLOUDRIPPER
#include <linux/acpm_dvfs.h>
-#endif
-#include "gxp.h"
#include "gxp-client.h"
#include "gxp-debug-dump.h"
#include "gxp-debugfs.h"
-#include "gxp-firmware.h"
#include "gxp-firmware-data.h"
+#include "gxp-firmware.h"
#include "gxp-internal.h"
-#include "gxp-pm.h"
+#include "gxp-notification.h"
+#include "gxp-lpm.h"
#include "gxp-mailbox.h"
+#include "gxp-pm.h"
#include "gxp-telemetry.h"
-#include "gxp-lpm.h"
#include "gxp-vd.h"
#include "gxp-wakelock.h"
+#include "gxp.h"
static int gxp_debugfs_lpm_test(void *data, u64 val)
{
@@ -73,54 +72,18 @@ static int gxp_debugfs_mailbox(void *data, u64 val)
}
DEFINE_DEBUGFS_ATTRIBUTE(gxp_mailbox_fops, NULL, gxp_debugfs_mailbox, "%llu\n");
-static int gxp_debugfs_pingpong(void *data, u64 val)
-{
- int core;
- struct gxp_command cmd;
- struct gxp_response resp;
- struct gxp_dev *gxp = (struct gxp_dev *)data;
-
- core = val / 1000;
- if (core >= GXP_NUM_CORES) {
- dev_notice(gxp->dev,
- "Mailbox for core %d doesn't exist.\n", core);
- return -EINVAL;
- }
-
- if (gxp->mailbox_mgr == NULL ||
- gxp->mailbox_mgr->mailboxes[core] == NULL) {
- dev_notice(
- gxp->dev,
- "Unable to send mailbox pingpong -- mailbox %d not ready\n",
- core);
- return -EINVAL;
- }
-
- cmd.code = GXP_MBOX_CODE_PINGPONG;
- cmd.priority = 0;
- cmd.buffer_descriptor.address = 0;
- cmd.buffer_descriptor.size = 0;
- cmd.buffer_descriptor.flags = (u32) val;
-
- down_read(&gxp->vd_semaphore);
- gxp_mailbox_execute_cmd(gxp->mailbox_mgr->mailboxes[core], &cmd, &resp);
- up_read(&gxp->vd_semaphore);
-
- dev_info(
- gxp->dev,
- "Mailbox Pingpong Sent to core %d: val=%d, resp.status=%d, resp.retval=%d\n",
- core, cmd.buffer_descriptor.flags, resp.status, resp.retval);
- return 0;
-}
-DEFINE_DEBUGFS_ATTRIBUTE(gxp_pingpong_fops, NULL, gxp_debugfs_pingpong,
- "%llu\n");
-
static int gxp_firmware_run_set(void *data, u64 val)
{
struct gxp_dev *gxp = (struct gxp_dev *) data;
struct gxp_client *client;
int ret = 0;
+ ret = gxp_firmware_request_if_needed(gxp);
+ if (ret) {
+ dev_err(gxp->dev, "Unable to request dsp firmware files\n");
+ return ret;
+ }
+
mutex_lock(&gxp->debugfs_client_lock);
if (val) {
@@ -157,8 +120,10 @@ static int gxp_firmware_run_set(void *data, u64 val)
goto err_wakelock;
}
gxp->debugfs_client->has_block_wakelock = true;
- gxp_pm_update_requested_power_state(gxp, AUR_OFF, true, AUR_UUD,
- true);
+ gxp_pm_update_requested_power_states(gxp, AUR_OFF, true,
+ AUR_UUD, true,
+ AUR_MEM_UNDEFINED,
+ AUR_MEM_UNDEFINED);
down_write(&gxp->vd_semaphore);
ret = gxp_vd_start(gxp->debugfs_client->vd);
@@ -181,8 +146,10 @@ static int gxp_firmware_run_set(void *data, u64 val)
*/
gxp_client_destroy(gxp->debugfs_client);
gxp->debugfs_client = NULL;
- gxp_pm_update_requested_power_state(gxp, AUR_UUD, true, AUR_OFF,
- true);
+ gxp_pm_update_requested_power_states(gxp, AUR_UUD, true,
+ AUR_OFF, true,
+ AUR_MEM_UNDEFINED,
+ AUR_MEM_UNDEFINED);
}
out:
@@ -192,7 +159,9 @@ out:
err_start:
gxp_wakelock_release(gxp);
- gxp_pm_update_requested_power_state(gxp, AUR_UUD, true, AUR_OFF, true);
+ gxp_pm_update_requested_power_states(gxp, AUR_UUD, true, AUR_OFF, true,
+ AUR_MEM_UNDEFINED,
+ AUR_MEM_UNDEFINED);
err_wakelock:
/* Destroying a client cleans up any VDss or wakelocks it held. */
gxp_client_destroy(gxp->debugfs_client);
@@ -205,7 +174,10 @@ static int gxp_firmware_run_get(void *data, u64 *val)
{
struct gxp_dev *gxp = (struct gxp_dev *) data;
+ down_read(&gxp->vd_semaphore);
*val = gxp->firmware_running;
+ up_read(&gxp->vd_semaphore);
+
return 0;
}
@@ -236,8 +208,10 @@ static int gxp_wakelock_set(void *data, u64 val)
goto out;
}
gxp->debugfs_wakelock_held = true;
- gxp_pm_update_requested_power_state(gxp, AUR_OFF, true, AUR_UUD,
- true);
+ gxp_pm_update_requested_power_states(gxp, AUR_OFF, true,
+ AUR_UUD, true,
+ AUR_MEM_UNDEFINED,
+ AUR_MEM_UNDEFINED);
} else {
/* Wakelock Release */
if (!gxp->debugfs_wakelock_held) {
@@ -248,8 +222,10 @@ static int gxp_wakelock_set(void *data, u64 val)
gxp_wakelock_release(gxp);
gxp->debugfs_wakelock_held = false;
- gxp_pm_update_requested_power_state(gxp, AUR_UUD, true, AUR_OFF,
- true);
+ gxp_pm_update_requested_power_states(gxp, AUR_UUD, true,
+ AUR_OFF, true,
+ AUR_MEM_UNDEFINED,
+ AUR_MEM_UNDEFINED);
}
out:
@@ -301,8 +277,22 @@ DEFINE_DEBUGFS_ATTRIBUTE(gxp_blk_powerstate_fops, gxp_blk_powerstate_get,
static int gxp_debugfs_coredump(void *data, u64 val)
{
- return gxp_debugfs_mailbox(data, GXP_MBOX_CODE_COREDUMP);
+ struct gxp_dev *gxp = (struct gxp_dev *)data;
+ int core;
+
+ down_read(&gxp->vd_semaphore);
+
+ for (core = 0; core < GXP_NUM_CORES; core++) {
+ if (gxp_is_fw_running(gxp, core))
+ gxp_notification_send(gxp, core,
+ CORE_NOTIF_GENERATE_DEBUG_DUMP);
+ }
+
+ up_read(&gxp->vd_semaphore);
+
+ return 0;
}
+
DEFINE_DEBUGFS_ATTRIBUTE(gxp_coredump_fops, NULL, gxp_debugfs_coredump,
"%llu\n");
@@ -475,8 +465,6 @@ void gxp_create_debugfs(struct gxp_dev *gxp)
&gxp_lpm_test_fops);
debugfs_create_file("mailbox", 0200, gxp->d_entry, gxp,
&gxp_mailbox_fops);
- debugfs_create_file("pingpong", 0200, gxp->d_entry, gxp,
- &gxp_pingpong_fops);
debugfs_create_file("firmware_run", 0600, gxp->d_entry, gxp,
&gxp_firmware_run_fops);
debugfs_create_file("wakelock", 0200, gxp->d_entry, gxp,