summaryrefslogtreecommitdiff
path: root/gxp-mapping.c
diff options
context:
space:
mode:
authorAurora pro automerger <aurora-pro-automerger@google.com>2023-02-17 09:18:51 +0000
committerCopybara-Service <copybara-worker@google.com>2023-03-09 19:56:47 -0800
commit0ffef44f5b07977a5608985c66e7eeaadc29b426 (patch)
treeb3f76ed4a1152e0d83c4ee3ad43e6a8e448e1f0f /gxp-mapping.c
parentb76197f77494d3879a181690558349a4aedb66c6 (diff)
downloadgs201-0ffef44f5b07977a5608985c66e7eeaadc29b426.tar.gz
gxp: [Copybara Auto Merge] Merge branch 'gs201-u' into 'android13-gs-pixel-5.10-udc'android-u-beta-2_r0.4android-u-beta-2_r0.3android-u-beta-2_r0.2
gcip: fixup: Use devm_* for gcip-pm Bug: 265870718 gcip: Use devm_* for gcip-pm Bug: 265870718 (repeat) gcip: Remove the start log of async power down Bug: 265870718 (repeat) gcip: Add firmware dynamic tracing support Bug: 262916889 gcip: Add PM support Bug: 265870718 (repeat) GCIP_MAIN_REV_ID: c359c8b4c8e11ff2655dbfd8457605b760db383c gxp: remove redundant domain_attach from vd resume Bug: 269587251 gxp: bump version 1.10 Bug: 269587251 (repeat) gxp: move domain detach to block_unready Bug: 269587251 (repeat) gxp: add mcu_crashed flag to gxp_virtual_device Bug: 269587251 (repeat) gxp: use MCU PSM to handle MCU fw crash Bug: 264621513 gxp: add IDs to VD suspend/resume log gxp: skip suspend/resume in full MCU mode Bug: 269717931 gxp: load core FW only once per image Bug: 267713927 gxp: Adopt GCIP PM Bug: 265870718 (repeat) gxp: Log the clients with a wakelock in gxp_platform_suspend Bug: 265870718 (repeat) gxp: Remove suspended from gxp_wakelock_manager Bug: 265870718 (repeat) gxp: support loading DSP core FW in raw binary format Bug: 259215977 gxp: introduce gxp_vd_invalidate_with_client_id Bug: 263994153 gxp: introduce gxp_vd_generate_debug_dump Bug: 263994153 (repeat) gxp: move vd_invalid_eventfd from client to vd Bug: 263994153 (repeat) gxp: gxp_vd_block_unready needs vd_semaphore write lock Bug: 263994153 (repeat) gxp: bump to version 1.9 Bug: 245751727 Bug: 268449263 gxp: unittest: add a unittest for gxp_mapping_iova_log Bug: 245751727 (repeat) gxp: Add a module flag to enable IOVA-space logging Bug: 245751727 (repeat) gxp: introduce debug_dump_lock per vd Bug: 234172464 gxp: gxp_vd_{run,stop} holds vd_sema for writing Bug: 234172464 (repeat) gxp: pass vd to the static functions of debug dump Bug: 234172464 (repeat) gcip: Add a comment about suspend/resume in gcip-pm Bug: 265870718 (repeat) gcip: Add firmware dynamic tracing header Bug: 262916889 (repeat) gcip: Add PM header Bug: 265870718 (repeat) GCIP_HEADERS_REV_ID: 21105099cc4be7a0fec32f06f34cce5026015601 GitOrigin-RevId: 775c7ff3381a68301beb1d3b790d0954e211244c Change-Id: I9637cc7a2ef6bc3b8b184035834ac1ab13ebafb4
Diffstat (limited to 'gxp-mapping.c')
-rw-r--r--gxp-mapping.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gxp-mapping.c b/gxp-mapping.c
index 0188fad..398ff05 100644
--- a/gxp-mapping.c
+++ b/gxp-mapping.c
@@ -6,16 +6,51 @@
*/
#include <linux/dma-mapping.h>
+#include <linux/ktime.h>
#include <linux/mm.h>
#include <linux/mmap_lock.h>
+#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include "gxp-client.h"
#include "gxp-debug-dump.h"
#include "gxp-dma.h"
#include "gxp-internal.h"
#include "gxp-mapping.h"
+#if IS_ENABLED(CONFIG_GXP_TEST)
+/* expose this variable to have unit tests set it dynamically */
+bool gxp_log_iova;
+#else
+static bool gxp_log_iova;
+#endif
+
+module_param_named(log_iova, gxp_log_iova, bool, 0660);
+
+void gxp_mapping_iova_log(struct gxp_client *client, struct gxp_mapping *map,
+ u8 mask)
+{
+ static bool is_first_log = true;
+ struct device *dev = client->gxp->dev;
+ const char *op = mask & GXP_IOVA_LOG_MAP ? "MAP" : "UNMAP";
+ const char *buf_type = mask & GXP_IOVA_LOG_DMABUF ? "DMABUF" : "BUFFER";
+
+ if (likely(!gxp_log_iova))
+ return;
+
+ if (is_first_log) {
+ dev_info(
+ dev,
+ "iova_log_start: operation, buf_type, tgid, pid, host_address, device_address, size");
+ is_first_log = false;
+ }
+
+ dev_info(dev, "iova_log: %s, %s, %d, %d, %#llx, %#llx, %zu", op,
+ buf_type, client->pid, client->tgid, map->host_address,
+ map->device_address, map->size);
+}
+
/* Destructor for a mapping created with `gxp_mapping_create()` */
static void destroy_mapping(struct gxp_mapping *mapping)
{