tegra_bootloader_debug: sysfs to add profile point

This change creates a sysfs entry to add a new profiling
record in bootloader profiler memory.

Bug 3512531

Change-Id: I580efe0872e1801b1d3b61fa7698ed7aed7fa9ec
Signed-off-by: Anvesh Salveru <asalveru@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2691788
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2864627
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Anvesh Salveru
2022-03-31 13:34:00 +00:00
committed by mobile promotions
parent d0ab12f322
commit ddc2be88c6

View File

@@ -226,6 +226,18 @@ size_t tegra_bl_add_profiler_entry(const char *buf, size_t len)
} }
EXPORT_SYMBOL(tegra_bl_add_profiler_entry); EXPORT_SYMBOL(tegra_bl_add_profiler_entry);
static ssize_t add_profiler_record_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
{
if (tegra_bl_add_profiler_entry(buf, len))
pr_err("Error adding profiler entry failed\n");
return len;
}
static struct kobj_attribute add_profiler_record_attribute =
__ATTR_WO(add_profiler_record);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static int dbg_golden_register_show(struct seq_file *s, void *unused) static int dbg_golden_register_show(struct seq_file *s, void *unused)
@@ -397,6 +409,14 @@ static int __init tegra_bootloader_debuginit(void)
goto out_err; goto out_err;
} }
bl_debug_verify_file_entry = sysfs_create_file(boot_profiler_kobj,
&add_profiler_record_attribute.attr);
if (bl_debug_verify_file_entry) {
pr_err("%s: failed to create sysfs file : %d\n",
module_name, bl_debug_verify_file_entry);
goto out_err;
}
if (tegra_bl_prof_start != 0 if (tegra_bl_prof_start != 0
&& !pfn_valid(__phys_to_pfn(tegra_bl_prof_start))) { && !pfn_valid(__phys_to_pfn(tegra_bl_prof_start))) {
ptr_bl_prof_start = ioremap(tegra_bl_prof_start, tegra_bl_prof_size); ptr_bl_prof_start = ioremap(tegra_bl_prof_start, tegra_bl_prof_size);
@@ -441,6 +461,8 @@ out_err:
if (boot_profiler_kobj) { if (boot_profiler_kobj) {
sysfs_remove_file(boot_profiler_kobj, sysfs_remove_file(boot_profiler_kobj,
&profiler_attribute.attr); &profiler_attribute.attr);
sysfs_remove_file(boot_profiler_kobj,
&add_profiler_record_attribute.attr);
kobject_put(boot_profiler_kobj); kobject_put(boot_profiler_kobj);
boot_profiler_kobj = NULL; boot_profiler_kobj = NULL;
} }
@@ -518,6 +540,8 @@ static void __exit tegra_bl_debuginit_module_exit(void)
if (boot_profiler_kobj) { if (boot_profiler_kobj) {
sysfs_remove_file(boot_profiler_kobj, sysfs_remove_file(boot_profiler_kobj,
&profiler_attribute.attr); &profiler_attribute.attr);
sysfs_remove_file(boot_profiler_kobj,
&add_profiler_record_attribute.attr);
kobject_put(boot_profiler_kobj); kobject_put(boot_profiler_kobj);
boot_profiler_kobj = NULL; boot_profiler_kobj = NULL;
} }