Commit Graph

212 Commits

Author SHA1 Message Date
Besar Wicaksono
927a33af1c tegra: hwpm: fix userspace tmake files
Fixing the paths used in the tmake files to build
userspace library and test.

JIRA MSST-830

Change-Id: Ib4469794d66aa20ae343b367acdc4f43b5e3c4ab
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3363640
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
rel-38_eng_2025-12-16 rel-38_eng_2025-12-05 rel-38_eng_2025-11-25 rel-38_eng_2025-11-12 rel-38_eng_2025-10-06 jetson_38.2.2 jetson_38.2.1 jetson_38.2
2025-05-26 12:42:11 -07:00
Besar Wicaksono
efd031dcb0 tegra: hwpm: add user data mode test
Add mode E user data test for these IPS:
- NVTHERM
- IPMU

JIRA MSST-831

Change-Id: Id8911fa9bbed47f1c5d1e82b075e60134e05ad2c
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3361434
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
2025-05-26 12:42:07 -07:00
Besar Wicaksono
dbbd871203 tegra: hwpm: add test for NVTHERM, CSN, IPMU
Add mode B and E test for these IPS:
- NVTHERM
- CSN
- IPMU

JIRA MSST-831

Change-Id: If67ed0ab41f1ee4369311261ce73d5a0643326bb
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3341509
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-04-25 05:31:15 -07:00
Besar Wicaksono
4d309240ac tegra: hwpm: add userspace test for next4
Add unit test for next4.

JIRA MSST-831

Change-Id: If59fbff5f6d9a61fbcda8c0213f236d0acce8062
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3333470
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-04-25 05:31:07 -07:00
Besar Wicaksono
106bc61f86 tegra: hwpm: add cpu_ext_* enums
Add new CPU IP and resource enum in
kernel driver and userspace library.
This is to extend support for chips with
more than 32 CPU instances (up to 128).

JIRA MSST-893

Change-Id: I33142c7fc8f268f8c436cc3b7cd97385da31b558
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3328654
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-04-25 05:31:02 -07:00
Besar Wicaksono
a4b7ab4486 tegra: hwpm: add csn/csnh enum
Add new enums for CSN/CSNH ip and resource to
kernel driver and userspace library.

JIRA MSST-869

Change-Id: I821010dca617596b86b0fec07f499cf1e6e3f258
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3325216
Reviewed-by: Yifei Wan <ywan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-04-25 05:30:57 -07:00
Besar Wicaksono
8b415ed149 tegra: hwpm: add nvtherm enum
Add enum for NVTHERM ip and resource to
kernel driver and userspace library.

JIRA MSST-868

Change-Id: Iacb6e9c9205e4293af04e28f265dd535b6fd1783
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3322825
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-04-25 05:30:52 -07:00
Besar Wicaksono
7f1249c9e9 tegra: hwpm: add initial userspace lib
Initial change for libnvsochwpm userspace library.

Change-Id: I20b11f9d253b65583db97dfebd9ff78b4d33d50c
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3267999
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-04-25 05:30:47 -07:00
Besar Wicaksono
f1de425d35 tegra: hwpm: add membytes high address check
Adding mem bytes high address validation to make sure
it is the same as stream buffer high address.

Change-Id: I189f44037279dc8e9569d1affcee4e19c3194558
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3319873
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
2025-04-25 05:30:42 -07:00
vasukis
a02386ec6e tegra: hwpm: t264: Fix VI and ISP ip details
VI and ISP (Camera modules) have an overlapping MMIO
address regions with both overlapping. Hence, set the
islots_overlimit flag to indicate this in HWPM driver.

Fix minor errors in VI and ISP driver enablement in HWPM
driver.

Bug 5072985

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I37d84c1ae6750202abd8caa9adb38a79f8b75537
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3323540
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2025-03-27 01:53:08 -07:00
Jon Hunter
742e79fa06 tegra: hwpm: Simplify CONFTEST presence check
The variable 'NV_BUILD_SYSTEM_TYPE' is an NVIDIA internal Makefile
variable used for building the Linux kernel. We should avoid using this
in drivers where possible because otherwise it will require external
users to set this.

CONFTEST itself is not internal and is distributed with the NVIDIA OOT
drivers. Rather than using 'NV_BUILD_SYSTEM_TYPE' to see if CONFTEST is
presence, we can simply see if the 'srctree.conftest' variable is set
and avoid using 'NV_BUILD_SYSTEM_TYPE' at all.

Furthermore, given that the variable 'CONFIG_TEGRA_HWPM_CONFTEST' now
defines if CONFTEST is present and this will only be set in the Makefile
if 'CONFIG_TEGRA_HWPM_OOT' is set, then we don't need to check for both
of these variables in the source files to determine if we need to
include 'nvidia/conftest.h'.

Bug 5120925

Change-Id: If9f6cebc7cc38414fce10a445ed090ba345e5002
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3318049
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-03-15 05:59:36 -07:00
vasukis
4fbceccafa tegra: hwpm: t264: Reduce DG map reg timeout
A timeout of 100ms is provided to allow DG Map
register values to propagate to router during
Perfmon enable/disable functionality. This is a lot
as ideally HW takes few us for the propagation. Hence,
reduce the timeout value to 10ms.

Bug 5072985

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Ie67a3325341824a451315d94afff3b5a1c0bb144
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3311261
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
2025-03-13 09:32:05 -07:00
Besar Wicaksono
c39de268c9 tegra: hwpm: os: linux: add explicit CONFTEST flag
CONFTEST is NVIDIA internal and not available when
building HWPM driver locally without NVIDIA build
system. This patch introduces a new explicit config
to enable/disable reference to CONFTEST.

Bug 5120925

Change-Id: I669855f04186041661362cd578514b887128ef44
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3307050
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-03-11 06:53:03 -07:00
Besar Wicaksono
547508653d tegra: hwpm: os: linux: update kernel vers. check
This is needed when building HWPM driver locally without
NVIDIA build system.

- driver.c: use kernel version check to select the correct
  signature of class:devnode
- mem_mgmt_utils.c:
  - use kernel version check to provide correct parameter
    of MODULE_IMPORT_NS macro
  - use kernel version check to select the correct signature
    of get_user_pages function
- mem_mgmt_utils.h: use kernel version check to select
  between iosys-map or dma-buf-map

Bug 5120925

Change-Id: Ib33afc4d99056d5b872f0d4362e0e6c25eb7b64a
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3306471
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-03-11 06:52:59 -07:00
Besar Wicaksono
47aa6ea0b9 tegra: hwpm: disable inst/el dynamic alloc on overlimit
The driver will use brute force approach and iterate over
the static instance/element array when the corresponding
*_overlimit is set to true. However, during initialization
the driver may still allocate a dynamic array for the
instance/element, which will be unused (waisted).

This patch reuse the *overlimit option to also disable
the dynamic allocation. This is also needed to configure
IP that has instances without a regular address stride
pattern, like the routers in different dielets in next4.

JIRA MSST-832

Change-Id: Ia616435c38f27962a1632e3d08eb3e9cfe9f0ba8
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3298868
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-03-11 06:52:51 -07:00
Besar Wicaksono
8d43841584 tegra: hwpm: common: fix IP fs info
Fix the shift value for incorporating element fs
mask to the final IP floorsweeping mask.

The floorsweeping info contains the fs info
of all the elements in the IP. The patch fixes
an issue for IP with more than two instances,
where the element fs info of 3rd instance
onwards are not calculated correctly.

Change-Id: Idfa69171b3630ca62f684f7130400a55d451f2ff
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3307893
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2025-03-11 06:52:47 -07:00
vasukis
98c51d644b tegra: hwpm: t264: Enable VI and ISP compilation
Enable Camera (VI and ISP) IP file compilation
in HWPM driver for AV+L builds only.

Bug 4345706

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: If647e7e25ce7d1a853cc7c298780538e03392ec0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3283197
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
2025-03-09 13:17:18 -07:00
vasukis
d9ed3fd02b tegra: hwpm: t264: Depreciate message to warning
When an IP is not enabled in HWPM Makefile, an error
message is given out. This has a higher log_level
which causes the Kernel Warning test in GVS to fail.
Hence, depreciate the log level to warning as not enabling
an IP for HWPM profiling is not an error per say.

Bug 4345706

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Ib85931c06f42168e86aea5b0b2cb208f93216042
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3284317
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-01-26 07:51:46 -08:00
vasukis
474df3d0b4 tegra: hwpm: t264: Add ISP IP support
ISP is part of Camera IP. Add IP files to enable ISP IP.

Jira THWPM-90
Bug 4345706

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I2458181b89234bcf50a674de7697dc961407922d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3263621
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
2025-01-05 08:44:37 -08:00
vasukis
9785a43b05 tegra: hwpm: t264: Add VI IP support
VI is part of Camera IP. Add IP files to enable VI IP.

Jira THWPM-90
Bug 4345706

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I7122d4b1b9e07181c4df0679c1d3d30bd222990c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3262913
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-01-05 08:44:13 -08:00
Jon Hunter
d61c003cdf tegra: hwpm: Fix build for Linux v6.13
The HWPM driver fails to be with Linux v6.13 because of the following
two issues:

1. In Linux v6.13, commit cdd30ebb1b9f ("module: Convert symbol
   namespace to string literal") updated the MODULE_IMPORT_NS macro to
   take a string literal as an argument in Linux v6.13. Use conftest to
   detect if MODULE_IMPORT_NS takes a string literal as an argument and
   update the HWPM driver accordingly.

2. The following build error is observed:

   In file included from os/linux/clk_rst_utils.c:17:
    include/linux/reset.h:30:49:
    error: implicit declaration of function ‘BIT’
    [-Werror=implicit-function-declaration]
   30 | #define RESET_CONTROL_FLAGS_BIT_ACQUIRED        BIT(2)
      |                                                 ^~~

   Fix the above by including the 'bits.h' header file.

Bug 4991705

Change-Id: I26cba920a0b0af251fd2f623ab9326ecafef5a5f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3261738
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2024-12-12 03:28:48 -08:00
Vedashree Vidwans
c4e5fde336 tegra: hwpm: add ip_config debugfs flags
Change-Id: I4160b776947570df9ec81f4f34bdef6376b44be8
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3245391
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2024-11-28 18:58:39 -08:00
Vedashree Vidwans
2c2a933a9f tegra: hwpm: add debugfs node to skip alist
Currently, HWPM driver checks regops address to validate that the
address belongs to an IP allowlist that is reserved for profiling.
However, it is possible that the allowlist doesn't include all register
offset that are required for profiling. This scenario is often
encountered during early stages of bringup. This patch adds a debugfs
node to make HWPM driver skip allowlist check. This change will allow
users to dynamically skip allowlist check when debugfs is available.

JIRA THWPM-65

Change-Id: Ic85a1c7fac6a95f7cde532f3bdf6040bbcc7f5f3
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3241080
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Vasuki Shankar <vasukis@nvidia.com>
2024-11-28 18:58:30 -08:00
vasukis
cda058bccc tegra: hwpm: next4: Add next4 chip support
Add HWPM driver support for Next4 chip.

Jira MSST-821

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Idc9c99653fa814a24fcab22735ae258f6f1a3f1c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3250030
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2024-11-28 18:56:19 -08:00
Frankie Chang
f4b7bb9ead kleaf: add t264 Makefile to fix build error
Missing Makefile.t264.sources would cause kleaf build error.
Add into 'drivers/tegra/hwpm/BUILD.bazel' to fix this build error.

Bug 4344670

Change-Id: Ib0870116c557a29d4c16e0f10057f26bbf24c79a
Signed-off-by: Frankie Chang <frankiec@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3246772
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-11-22 21:31:22 -08:00
vasukis
cfec15ebca tegra: hwpm: type-cast to prevent QNX build errors
Type cast variable to prevent build error on QNX SDP 7.1.

Bug 4893334

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Ica23d35aad973eb0dd092978e4a276ef765e1b34
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3251800
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2024-11-22 10:36:04 -08:00
vasukis
75a6c76cec tegra: hwpm: type-cast to prevent build errors
Type cast variable to prevent build error on QNX SDP 7.1.

Bug 4893334

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I1158a8a19f582fa08c554a56e4ad63e74ee6d5a1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3249137
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-11-20 22:02:09 -08:00
vasukis
bb4b1def61 tegra: hwpm: t264: Merge t264-hwpm files to hwpm
Merge the T264 private source code to hwpm common code.
This is done after T264 source code can be made public.

Bug 4856428
Bug 4943517

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Ie830c5465f32f49978cb465d68785ab3dbaee984
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3219865
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2024-11-06 01:56:13 -08:00
Vedashree Vidwans
b8a884d226 tegra: hwpm: add cpu ip and resource enums
Add IP and resource enums for CPU IP that support HWPM.

Bug 4730025
Bug 4748888

Change-Id: Ica0d247953500fc6d7eb21144a318f2dbcca2d96
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3198954
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2024-11-02 12:25:06 -07:00
Vedashree Vidwans
1a5bd8d683 tegra: hwpm: add ucf ip and resource enums
UCF component is comprised of many sub-units such as MSW, OSW, SCB, etc.
Add IP and resource enums for UCF sub-units that support HWPM.

Bug 4730025
Bug 4748888

Change-Id: Ib50bf9a32d807d05ed0a7f55a5aa08009227e105
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3187986
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2024-10-16 19:44:39 -07:00
vasukis
b6fa559660 tegra: hwpm: fix credit programming count logic
The num_entries variable indicates the number of credit
programming requests that is sent from user space test app.
Current implementation has been configured to loop through
this in such a way that leads to an additional loop.
This change fixes the issue.

Bug 4571175

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Id9fd4315e5ef470c697bf2815e16b42e746edf45
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3212369
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-19 23:34:13 -07:00
Vedashree Vidwans
29c34c51d1 tegra: hwpm: add mcf ocu ip and resource enums
Add IP and resource enums for MCF OCU that support HWPM.

Bug 4730025
Bug 4748888

Change-Id: Ic0a15f60d8c1cbbb3bb46c79672f6a607087f508
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3211219
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2024-09-19 06:06:34 -07:00
Vedashree Vidwans
a8fc1ef30a tegra: hwpm: follow up svcacv fix
This is a follow up to fix svcacv warning in 3186843 about missing spdx
identifier.

Bug 4707244

Change-Id: If004830eb12e19bbdd8c6ef84818aca36ee5ebd7
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3210319
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-09-12 08:53:11 -07:00
vasukis
425b5f92ae tegra: hwpm: Linux: Setup trigger IOCTL Infra
Add IOCTL infra for Cross trigger programming in HWPM Driver.
Cross Triggering involves the access to secure register, which
cannot be issued by user space application. Hence, implement
cross trigger functionality in HWPM kernel driver.

Bug 4571175

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Ia46227c4678d3ee282ebae8c58e116feaf4e59cb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3147289
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-11 13:51:43 -07:00
vasukis
f672287ded tegra: hwpm: Support for Credit Programming
- Add HWPM Driver support for Credit Programming. Credit
programming can be accomplished by read-write into
secure HWPM registers, which cannot come in as a reg_ops
request from User Space application.

- Implement an empty credit programming handler for T234 and
th500.

- Implement OS agnostic HALs for Credit programming.

Bug 4571175

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I18dcff47dfe461bce3dcb6d78f39ff0156b4b0a5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3127013
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-11 13:51:39 -07:00
vasukis
5d80b2edb5 tegra: hwpm: Linux: IOCTL for Credit Programming
- Add IOCTL infra for Credit programming in Linux based
OSs.

Bug 4571175

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I1a5ff5aefcf8da6ad85507d71c0a9bd3b7f31f6d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3136565
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2024-09-11 13:51:35 -07:00
Vedashree Vidwans
b5f2672134 tegra: hwpm: th500: update ip structure files
Update all IP files to include aperture_index variable in
hwpm_ip_aperture structures. This index will be used to
translate dynamic element index to static index.

Bug 4707244

Change-Id: I9999a7dc26c366381f37aea5f602a662d8707a8b
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3197913
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-06 11:59:01 -07:00
Vedashree Vidwans
eccff56167 tegra: hwpm: t234: update ip structure files
Update all IP files to include aperture_index variable in
hwpm_ip_aperture structures. This index will be used to
translate dynamic element index to static index.

Bug 4707244

Change-Id: Ic4adb1aadffb4e2039ef5b898ce8ed046881ecde
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3197912
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2024-09-06 11:58:58 -07:00
Vedashree Vidwans
48e85a9c07 tegra: hwpm: update logic to use static indexes
HWPM driver uses nested structures and arrays of structures. The IP
structure setup logic allocates pointer arrays based on dynamic list of
IPs and aperture addresses. This dynamic list is required to search
given regops address in less amount of time.
However, there is a chance that the number of pointers computed
dynamically is huge. And huge amount of memory will be required for the
dynamic pointers array, which is impractical.
This, this patch modifies ip structure setup and address to aperture
conversion logic to use static indexes if the pointer array size is
huge.
This patch modifies relevant functions to always use static arrays
to access instance and aperture structures.

If dynamic pointers array is allocated, the patch adds logic to
translate dynamic index to static index using inst_index_mask for
instances and new added aperture_index for element level structures.

Add/update few log message to improve relayed information.

Bug 4707244

Change-Id: Ib4847e6575f82b628a3ce838ad69196a4bc08fed
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3186843
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-06 11:58:53 -07:00
Vishal Aslot
cdbd6e7a24 tegra: hwpm: th500: fixes and reorg of IPs
This patch fixes issues found during testing
and guidance provided by devtools. The following
is changed in this patch:

1. mcf_iobhx and mcf_ocu are merged into a single mcf_soc IP.
2a. c2c is changed from 2 instances to 1.
2b. Remove C2CS0/1 which are the broadcast apertures.
    Also remove the allowlist offset specific to broadcast
    aperture.
3. mss_hub is changed from 1 instance to 8.
4. mss_channel is changed from 1 instance to 32.
5. mc0 perfmux is added to mcf_clink.
6. mcf_core is changed from 1 instance to 8.
7. License headers updated where necessary.
8. c2c allowlist updated to have just the offsets common
   to all links.
9. Added a verbose comment explaining the design of
   th500_hwpm_force_enable_ips()
10. Added back validate_current_config module parameter
    as many systems still don't support fuses.
11. If all F's are read back for a regop in ip_readl(),
    return -ENODEV.

There is a corresponding patch to update the python scripts
that generated many of the C and header files.

Bug 4287384

Change-Id: I8e14b0165dfa1abb9f5e04de577a41f0eb278246
Signed-off-by: Vishal Aslot <vaslot@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3134365
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Eric Lu <ericlu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-02 21:52:45 -07:00
Vishal Aslot
fdbe788448 tegra:hwpm:th500: Force-enablement support for IPs
This patch adds support to selectively force-enable
TH500 IPs using module parameters.

Bug 4287384

Signed-off-by: Vishal Aslot <vaslot@nvidia.com>
Change-Id: I684169ad52da466b51e6b18634a997563390b0a4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3026101
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-02 21:52:41 -07:00
Jon Hunter
11de2bc045 tegra: hwpm: Fix build for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update the Tegra HWPM driver
as necessary to fix this.

Bug 4749580

Change-Id: Ide44224bb3e5d0a000a252b4a8117ca203904a54
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3183043
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
2024-07-31 08:06:12 -07:00
Jian-Min Liu
b8d1724bb0 Kleaf: add hwpm kernel module
1. Add BUILD.bazel file.
2. Add build target of kernel module and required include folder
   srctree.* in Makefile to fix the build issue

Bug 4344670

Change-Id: I22560573aaa38ec5a2b14290a2ba48e1f2e5ab0c
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3066227
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Chun Ng <chunn@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-16 02:06:57 -07:00
Vedashree Vidwans
5705145f59 tegra: hwpm: th500: correct config flag name
Recently, TH500 HWPM config flag was renamed to CONFIG_TEGRA_HWPM_TH500.
Correct the config flag name in init.c and acpi.h files.

Jira THWPM-112

Change-Id: I9fcc40cd2529c0e5e6894bda95f6d8248e8b61cd
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3167472
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
2024-07-13 08:56:49 -07:00
Vedashree Vidwans
095fc3dea0 tegra: hwpm: add clk rate as chip variable
LA clock rate is specific to a chip. Move LA clock rate macro as a chip
specific variable. Set la_clk_rate variable to correct value for T234
and TH500 chips.

Jira THWPM-112

Change-Id: I962cf579aed33d91d0abbfb8a44fc4063dc8444c
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3140419
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-05-22 10:20:24 -07:00
vasukis
ab110e5f27 tegra: hwpm: Add OPT_HWPM_DISABLE mask definition
- Add OPT_HWPM_DISABLE fuse (offset 0xd18) mask for NEXT3
chip.

Jira THWPM-73

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Idc403276886fb2f00b18a69be2c285bc8b3da000
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3139627
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-21 17:15:07 -07:00
Vedashree Vidwans
5f4378574c tegra: hwpm: cleanup build logic in makefile
Currently, conditions to compile HWPM driver based on build config is
not defined well in the Makefiles. Update Makefiles to
- use external chip specific flags to include chip source files
- add copyright information
- revise IP force enablement logic, remove unused MINIMAL_IP_ENABLE flag
- follow a standard way of including source files and config flags.

Jira THWPM-109

Change-Id: I6d32b5b67d34c65b56fb9cb9d6a1c4cca7b11cc6
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3121175
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-05 20:11:48 -07:00
vasukis
1ff862c00a th500: hwpm: Fix EMC Fuse Mask calculation.
A recent change has led to EMC fuse mask calculation regression.
This is being corrected in this patch. The emc_fuse_disable mask
is set in such a way that, each bit corresponds to 4 MSS Channels.
For example, emc_fuse_disable mask=1100, corresponds to MSS_Channel0
to MSS_Channel7 being present, while MSS_Channel8 to MSS_Channel15
are floorswept. However, in HWPM Driver, the logic to represent a
floorswept IP element is indicated by '1'. Correct the logic to
indicate this.

Bug 4490868

Change-Id: Id83d9e1d983c3fbf8f58cef3a1ff45334d7eadd6
Signed-off-by: vasukis <vasukis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3122752
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-05-02 08:45:53 -07:00
vasukis
89426a7e0a tegra: hwpm: Fix EMC Fuse Mask calculation.
A recent change has led to EMC fuse mask calculation regression.
This is being corrected in this patch. The emc_fuse_disable mask is
set in such a way that, each bit corresponds to 4 MSS Channels.
For example, emc_fuse_disable mask=1100, corresponds to MSS_Channel0
to MSS_Channel7 being present, while MSS_Channel8 to MSS_Channel15
are floorswept. However, in HWPM Driver, the logic to represent
a floorswept IP element is indicated by '1'. Correct the logic to
indicate this.

Bug 4490868

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: Ia3825db29715e04aa43822283b160252d00f0a81
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3099298
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-05-02 08:40:39 -07:00
Ahmad Chaudhry
be41a4158c tegra: hwpm: fix acpi compilation error
ACPI configs are not required for aaos as
aaos is booted with dtb and not acpi.
Disabling CONFIG_ACPI results in a build failure as
it's undefined in the #if directive
so adding this check to see whether it is defined
resolves the issue and allows aaos to build
successfully with CONFIG_ACPI disabled

Bug 4559177

Change-Id: I9f068c373d6dc57acb610a107eb8a2e90a0e944b
Signed-off-by: Ahmad Chaudhry <ahmadc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3115456
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
2024-04-18 01:11:13 -07:00