Commit Graph

6 Commits

Author SHA1 Message Date
Manish Bhardwaj
f9d82f5bb7 nvidia: destroy device on probe failure
Using this patch we are destroying the device if
clock API gets failed and handling the failure
case gracefully otherwise we are are going to get
below warning if the probe gets deferred.

[    9.383997] sysfs: cannot create duplicate
               filename '/devices/virtual/tegra-soc-hwpm'
[    9.384000] CPU: 1 PID: 92 Comm: kworker/1:1
               Tainted: G  W  5.10.104-rt63-tegra #8
[    9.384002] Hardware name: p3710-0010 (DT)
[    9.384004] Workqueue: events deferred_probe_work_func
[    9.384010] Call trace:
[    9.384011]  dump_backtrace+0x0/0x1d0
[    9.384016]  show_stack+0x30/0x50
[    9.384019]  dump_stack+0xd8/0x140
[    9.384022]  sysfs_warn_dup+0x6c/0x90
[    9.384026]  sysfs_create_dir_ns+0xf0/0x110
[    9.384028]  kobject_add_internal+0x94/0x2a0
[    9.384032]  kobject_add+0x90/0x110
[    9.384033]  get_device_parent.isra.0+0x184/0x1b0
[    9.384036]  device_add+0xcc/0x760
[    9.384039]  device_create_groups_vargs+0xec/0x110
[    9.384041]  device_create+0x94/0xd0
[    9.384043]  tegra_hwpm_probe+0x114/0x4c0
[    9.384048]  platform_drv_probe+0x5c/0xd0
[    9.384050]  really_probe+0xf8/0x3e0
[    9.384051]  driver_probe_device+0x60/0xd0
[    9.384053]  __device_attach_driver+0x8c/0xf0
[    9.384054]  bus_for_each_drv+0x8c/0x100
[    9.384057]  __device_attach+0x100/0x160
[    9.384058]  device_initial_probe+0x28/0x40
[    9.384060]  bus_probe_device+0xac/0xd0
[    9.384061]  deferred_probe_work_func+0x90/0xd0
[    9.384062]  process_one_work+0x1c4/0x4f0
[    9.384064]  worker_thread+0x200/0x430
[    9.384065]  kthread+0x180/0x1c0
[    9.384068]  ret_from_fork+0x10/0x24
[    9.384070] kobject_add_internal failed for tegra-soc-hwpm
               with -EEXIST, don't try to register things with
               the same name in the same directory.
[    9.384073] tegra-soc-hwpm: tegra_hwpm_probe: 127: ERROR:
               Failed to create device
[    9.384080] tegra-soc-hwpm: tegra_hwpm_probe: 208: ERROR:
               Probe failed!

JIRA ESLC-6775

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: Ide0d16f420a1c52eadf1b6166859c02906c2ac2f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2737713
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-07-05 05:40:06 -07:00
Vedashree Vidwans
1563712b77 tegra: hwpm: add multiple chip config
- Add support for HWPM on next chip. Update tegra_hwpm_init_chip_info to
include next chip init.
- Rename CONFIG_SOC_HWPM_IP_* flags defined in Makefile to use chip name

Jira THWPM-41

Change-Id: I6b1556eb8775fa795699241d5efb2d3370f93531
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
(cherry picked from commit 17bb2b25bcd147a15862b62f47d29d89fa5162df)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2671797
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-17 07:13:24 -07:00
Vedashree Vidwans
5c8a07022f tegra: hwpm: add dt property, update devnode perm
HWPM is a profiling device. Device node property support-soc-tools
indicates if soc profiling tools should be enabled or disabled.
Add logic to HWPM probe to read device node and probe HWPM device only
if support-soc-tools property is present.

Implement devnode API to disclose device node permissions for HWPM.
Set HWPM device node permissions to allow access for root and group.

Bug 3435136
Bug 3583956

Change-Id: I988de3b21cd00ef9402ca03408d2b0141e7155d8
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2717982
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-03 20:10:38 -07:00
Vedashree Vidwans
ea5e4e406b tegra: hwpm: add HALs to support multiple chip
Add below HALs to make code chip agnostic. This will allow us to use
t234 specific HALs for next chips.
- get_pma_int_idx: get PMA's internal index corresponding to active chip
- get_rtr_int_idx: get RTR's internal index corresponding to active chip
- get_ip_max_idx: get MAX IP index corresponding to active chip

Move chip agnostic code to common files.

Jira THWPM-41

Change-Id: I5518469b1473fe7f66b6517cee729cf46520bbac
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2675515
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-04-20 13:26:32 -07:00
Vedashree Vidwans
9adf6a080d tegra: hwpm: use consistent function names
- Update common function names to tegra_hwpm_* instead of
tegra_soc_hwpm_*.
- Update header guards to follow similar naming guidelines.

Jira THWPM-41

Change-Id: If5ca4f136f5cb6659a99bae42030817142bd242c
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2675469
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-03-15 17:32:54 -07:00
Vedashree Vidwans
92be6f7a00 tegra: hwpm: restructure HWPM driver
- Update HWPM driver to add HAL layer. This will allow support for multiple chips.
- Add below data structure hierarchy for HWPM driver
HWPM driver structure -> chip info struct -> ip info array -> perfmux/perfmon info array
NOTE: To make commit message more legible, using "aperture" instead of "perfmux and/or perfmon"
- Chip info structure contains
  - Array of IP info
  - HAL function pointers
- IP info structure contains IP specific info
  - Number of instances
  - Number of apertures per instance
  - Aperture ranges, strides, static info array
  - Aperture dynamic arrays
- Aperture info structure contains
  - Hw index
  - Physical address info
  - MMIO address info
- Add separate IP info files
- Create separate files that include logic for allowlist, memory buffer, resources, ip, regops to make functions more legible.
- Move probe, ioctl and io functions to os/linux path.
- Add fn, info, register and verbose debug log levels to controls debug messages
  - add debugfs node to update dbg_mask
- Correct MGBE perfmux base address

Jira THWPM-41

Change-Id: I8ffdaa657789e2a187cbb98502d0359bb57f9c54
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2651377
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-02-09 09:46:25 -08:00