From bb1b3218c6e301b422b426a9c646fc9ece6fe0e2 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Tue, 8 Oct 2019 14:03:49 -0700 Subject: nvgpu: vgpu: no debugfs entries that rely on PMU When virtualized, the guest OS has no direct access to PMU functionality so don't create debugfs entries that rely on PMU access Bug 200543218 Change-Id: I12730b600802448a240f3de042760041d3ae7d29 Signed-off-by: Peter Daifuku Reviewed-on: https://git-master.nvidia.com/r/2213650 (cherry picked from commit 053131ef44252748aecaad11ba8dc54f1dc40fce) Reviewed-on: https://git-master.nvidia.com/r/2215162 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Luis Dib Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/debug_pmu.c | 37 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'drivers/gpu/nvgpu/os') diff --git a/drivers/gpu/nvgpu/os/linux/debug_pmu.c b/drivers/gpu/nvgpu/os/linux/debug_pmu.c index f4ed992d..f3e36d0c 100644 --- a/drivers/gpu/nvgpu/os/linux/debug_pmu.c +++ b/drivers/gpu/nvgpu/os/linux/debug_pmu.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 NVIDIA Corporation. All rights reserved. + * Copyright (C) 2017-2019 NVIDIA Corporation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -452,28 +452,31 @@ int gk20a_pmu_debugfs_init(struct gk20a *g) goto err_out; d = debugfs_create_file( - "falc_trace", S_IRUGO, l->debugfs, g, - &falc_trace_fops); + "pmu_security", S_IRUGO, l->debugfs, g, + &security_fops); if (!d) goto err_out; - d = debugfs_create_file( - "perfmon_events_enable", S_IRUGO, l->debugfs, g, + /* No access to PMU if virtual */ + if (!g->is_virtual) { + d = debugfs_create_file( + "falc_trace", S_IRUGO, l->debugfs, g, + &falc_trace_fops); + if (!d) + goto err_out; + + d = debugfs_create_file( + "perfmon_events_enable", S_IRUGO, l->debugfs, g, &perfmon_events_enable_fops); - if (!d) - goto err_out; + if (!d) + goto err_out; - d = debugfs_create_file( - "perfmon_events_count", S_IRUGO, l->debugfs, g, + d = debugfs_create_file( + "perfmon_events_count", S_IRUGO, l->debugfs, g, &perfmon_events_count_fops); - if (!d) - goto err_out; - - d = debugfs_create_file( - "pmu_security", S_IRUGO, l->debugfs, g, - &security_fops); - if (!d) - goto err_out; + if (!d) + goto err_out; + } return 0; err_out: pr_err("%s: Failed to make debugfs node\n", __func__); -- cgit v1.2.2