diff options
author | Igor Nabirushkin <inabirushkin@nvidia.com> | 2013-09-07 15:16:57 +0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-26 19:46:22 -0700 |
commit | d9734e285985f8bcaaacf3d6b9b047516a791ac3 (patch) | |
tree | b8772adc8bc9ec8f7704609f98160b74c0ab9a9f /drivers/misc/tegra-profiler | |
parent | 408ef482338cc38d27cbcf111ee191fabc4ff13f (diff) |
misc: tegra-profiler: add /proc entries
Tegra Profiler: show version and capabilities:
/proc/quadd/version
/proc/quadd/capabilities
Bug 1364258
Bug 1312406
Change-Id: I4ba26a0b6e95ecd350add4fac851feb98b0e84de
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/271828
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/misc/tegra-profiler')
-rw-r--r-- | drivers/misc/tegra-profiler/Makefile | 14 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/main.c | 5 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/quadd.h | 1 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/quadd_proc.c | 130 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/quadd_proc.h | 34 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/version.h | 2 |
6 files changed, 184 insertions, 2 deletions
diff --git a/drivers/misc/tegra-profiler/Makefile b/drivers/misc/tegra-profiler/Makefile index 7b3d8088aa2f..b206c8d0e6df 100644 --- a/drivers/misc/tegra-profiler/Makefile +++ b/drivers/misc/tegra-profiler/Makefile @@ -14,5 +14,17 @@ # obj-$(CONFIG_TEGRA_PROFILER) += tegra-profiler.o -tegra-profiler-objs := main.o armv7_pmu.o pl310.o hrt.o comm.o mmap.o backtrace.o debug.o ma.o power_clk.o auth.o +tegra-profiler-objs := \ + main.o \ + armv7_pmu.o \ + pl310.o \ + hrt.o \ + comm.o \ + mmap.o \ + backtrace.o \ + debug.o \ + ma.o \ + power_clk.o \ + auth.o \ + quadd_proc.o diff --git a/drivers/misc/tegra-profiler/main.c b/drivers/misc/tegra-profiler/main.c index 7cc07627fa17..823fa4db82cc 100644 --- a/drivers/misc/tegra-profiler/main.c +++ b/drivers/misc/tegra-profiler/main.c @@ -33,6 +33,7 @@ #include "power_clk.h" #include "auth.h" #include "version.h" +#include "quadd_proc.h" static struct quadd_ctx ctx; @@ -452,6 +453,9 @@ static int __init quadd_module_init(void) return err; } + get_capabilities(&ctx.cap); + quadd_proc_init(&ctx); + return 0; } @@ -464,6 +468,7 @@ static void __exit quadd_module_exit(void) quadd_power_clk_deinit(); quadd_comm_events_exit(); quadd_auth_deinit(); + quadd_proc_deinit(); } module_init(quadd_module_init); diff --git a/drivers/misc/tegra-profiler/quadd.h b/drivers/misc/tegra-profiler/quadd.h index 4bcbb8144702..75b145ff0e32 100644 --- a/drivers/misc/tegra-profiler/quadd.h +++ b/drivers/misc/tegra-profiler/quadd.h @@ -45,6 +45,7 @@ struct source_info { struct quadd_ctx { struct quadd_parameters param; + struct quadd_comm_cap cap; struct quadd_event_source_interface *pmu; struct source_info pmu_info; diff --git a/drivers/misc/tegra-profiler/quadd_proc.c b/drivers/misc/tegra-profiler/quadd_proc.c new file mode 100644 index 000000000000..649c2d7065d5 --- /dev/null +++ b/drivers/misc/tegra-profiler/quadd_proc.c @@ -0,0 +1,130 @@ +/* + * drivers/misc/tegra-profiler/quadd_proc.c + * + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifdef CONFIG_PROC_FS + +#include <linux/module.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> + +#include <linux/tegra_profiler.h> + +#include "quadd.h" +#include "version.h" +#include "quadd_proc.h" + +#define YES_NO(x) ((x) ? "yes" : "no") + +static struct quadd_ctx *ctx; + +static int show_version(struct seq_file *f, void *offset) +{ + seq_printf(f, "version: %s\n", QUADD_MODULE_VERSION); + seq_printf(f, "branch: %s\n", QUADD_MODULE_BRANCH); + seq_printf(f, "samples version: %d\n", QUADD_SAMPLES_VERSION); + seq_printf(f, "io version: %d\n", QUADD_IO_VERSION); + + return 0; +} + +static int show_version_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, show_version, NULL); +} + +static const struct file_operations version_proc_fops = { + .open = show_version_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int show_capabilities(struct seq_file *f, void *offset) +{ + struct quadd_comm_cap *cap = &ctx->cap; + struct quadd_events_cap *event = &cap->events_cap; + + seq_printf(f, "pmu: %s\n", + YES_NO(cap->pmu)); + seq_printf(f, "tegra 3 LP cluster: %s\n", + YES_NO(cap->tegra_lp_cluster)); + seq_printf(f, "power rate samples: %s\n", + YES_NO(cap->power_rate)); + + seq_printf(f, "l2 cache: %s\n", + YES_NO(cap->l2_cache)); + if (cap->l2_cache) { + seq_printf(f, "Multiple l2 events: %s\n", + YES_NO(cap->l2_multiple_events)); + } + + seq_printf(f, "\n"); + seq_printf(f, "Supported events:\n"); + seq_printf(f, "cpu_cycles: %s\n", + YES_NO(event->cpu_cycles)); + seq_printf(f, "instructions: %s\n", + YES_NO(event->instructions)); + seq_printf(f, "branch_instructions: %s\n", + YES_NO(event->branch_instructions)); + seq_printf(f, "branch_misses: %s\n", + YES_NO(event->branch_misses)); + seq_printf(f, "bus_cycles: %s\n", + YES_NO(event->bus_cycles)); + seq_printf(f, "l1_dcache_read_misses: %s\n", + YES_NO(event->l1_dcache_read_misses)); + seq_printf(f, "l1_dcache_write_misses: %s\n", + YES_NO(event->l1_dcache_write_misses)); + seq_printf(f, "l1_icache_misses: %s\n", + YES_NO(event->l1_icache_misses)); + seq_printf(f, "l2_dcache_read_misses: %s\n", + YES_NO(event->l2_dcache_read_misses)); + seq_printf(f, "l2_dcache_write_misses: %s\n", + YES_NO(event->l2_dcache_write_misses)); + seq_printf(f, "l2_icache_misses: %s\n", + YES_NO(event->l2_icache_misses)); + + return 0; +} + +static int show_capabilities_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, show_capabilities, NULL); +} + +static const struct file_operations capabilities_proc_fops = { + .open = show_capabilities_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +void quadd_proc_init(struct quadd_ctx *context) +{ + ctx = context; + + proc_mkdir("quadd", NULL); + proc_create("quadd/version", 0, NULL, &version_proc_fops); + proc_create("quadd/capabilities", 0, NULL, &capabilities_proc_fops); +} + +void quadd_proc_deinit(void) +{ + remove_proc_entry("quadd/version", NULL); + remove_proc_entry("quadd/capabilities", NULL); + remove_proc_entry("quadd", NULL); +} + +#endif /* CONFIG_PROC_FS */ diff --git a/drivers/misc/tegra-profiler/quadd_proc.h b/drivers/misc/tegra-profiler/quadd_proc.h new file mode 100644 index 000000000000..e5647e468729 --- /dev/null +++ b/drivers/misc/tegra-profiler/quadd_proc.h @@ -0,0 +1,34 @@ +/* + * drivers/misc/tegra-profiler/quadd_proc.h + * + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef __QUADD_PROC_H +#define __QUADD_PROC_H + +struct quadd_ctx; + +#ifdef CONFIG_PROC_FS +void quadd_proc_init(struct quadd_ctx *context); +void quadd_proc_deinit(void); +#else +static inline void quadd_proc_init(struct quadd_ctx *context) +{ +} +static inline void quadd_proc_deinit(void) +{ +} +#endif + +#endif /* __QUADD_PROC_H */ diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h index c24895433449..838c1f4d56f4 100644 --- a/drivers/misc/tegra-profiler/version.h +++ b/drivers/misc/tegra-profiler/version.h @@ -18,7 +18,7 @@ #ifndef __QUADD_VERSION_H #define __QUADD_VERSION_H -#define QUADD_MODULE_VERSION "1.28" +#define QUADD_MODULE_VERSION "1.29" #define QUADD_MODULE_BRANCH "Dev" #endif /* __QUADD_VERSION_H */ |