Commit Graph

303 Commits

Author SHA1 Message Date
Mahesh Kumar
0721b513a2 platform: dce: coverity fixes
Comparing an array to null is not useful:
events->events[i].name == NULL, since the test will
always evaluate as true.

Bug 3952896

Change-Id: I322b768beb5dce9159892d26b6ca1813e141d2da
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921050
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-14 22:58:13 -07:00
Mahesh Kumar
bb386083e8 platform: dce: decrease verbosity of debug print
Decrease verbosity of debug print during IPC signal.

Bug 3921505
Bug 4080364

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I6fa2b6472e75d0f890d105109f30c6291bb0fe7a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2919258
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-14 22:55:23 -07:00
Ankita Garg
489ff29305 Camera: Disable rtcpu modules in android
Disable camera rtcpu modules to avoid build error when using clang
to build Android Common Kernel (ACK). Camera is also not currently
being used in Android

Bug 3974840

Change-Id: I5c8815003e651c983a940cb82e43776e85ee06d8
Signed-off-by: Ankita Garg <ankitag@nvidia.com>
(cherry picked from commit c150ae607e1388119d86579b30246d0c95aa2772)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910051
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jian-Min Liu <jianminl@nvidia.com>
2023-06-13 00:19:47 -07:00
praagarwal
45903d628b tegra_bootloader_debug: change bl_bcp_ptr variable
change bl_bcp_ptr variable name to a relevent name, boot_cfg_dataptr,
for tegra_bl_bcp_arg as mentioned in a previous file
tegra_bootloader_debug_init.c for 5.15

Bug 3896536

Change-Id: I039ca2b0578d476908c1b6ee8327971dac82038b
Signed-off-by: praagarwal <praagarwal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2916405
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-07 22:23:30 -07:00
praagarwal
a88e0ab87c tegra_bootloader_debug: Add functions to read from cmd line
Add functions to tegra_bootloader_debug to read addresses
from kernel command line for 5.15.

Bug 3896536

Change-Id: Ie0f75bab54b9455ce465740a2ab06a54046657fd
Signed-off-by: praagarwal <praagarwal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2908980
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-06 01:51:05 -07:00
Ketan Patil
a56b9fc61c mc-utils: Update driver so as to support multiple SOCs
Current mc-utils driver is specific to T234 without any support for
extending it to future SOCs. Add such support so that it can be easily
extended for future chips.
- Create a struct of function pointers of all present operations
- Set these function pointers as per SOCs

Bug 4090660

Change-Id: I93e9da987bce1e563eb03aeeb0ac8bcb9da48023
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2911894
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-02 11:03:17 -07:00
Johnny Liu
1285186621 platform: tegra: Add mc_all central actmon driver
Actmon DFS for EMC has been moved to BPMP side. This driver simply reads
the exponential moving average counter register of the MC_ALL client and
export the value in the sysfs node to let tegrastats read the
utilization value of the EMC.

Bug 4041434

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I2b7e6592094d27c47f738fc26ee9091ea209f630
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2912315
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-31 11:33:11 -07:00
Jon Hunter
19de9797ba platform: tegra: rtcpu: Consolidate Makefiles
Consolidate the RTCPU drivers under a single sub-directory so that a
single Makefile is used to build all these drivers. This also simplifies
the paths for finding the necessary header files.

Bug 4078936

Change-Id: I88e45a2954f759ee0bc8a359bfdf3ef09a55617a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897318
(cherry picked from commit 320cf14261d1cf8bcf76cbb030186e7391ca8670)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2898616
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-31 11:29:05 -07:00
Jon Hunter
05bfbdef14 platform: tegra: rtcpu: Rename debug driver
The name of rtcpu's debug kernel module, debug.ko, is not very
descriptive and for users it is unclear what subsystem this 'debug'
kernel module is used by. So rename this to 'rtcpu-debug.ko' so that it
is clear this belongs to the camera subsystem.

Bug 4078936

Change-Id: I77da43fb0d54d1ea058f4c3d6c313f49a85b7cfa
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890897
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Tested-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-24 02:47:39 -07:00
Jon Hunter
9a3174280f platform: tegra: Remove CVNAS driver
The CVNAS driver is not needed for Tegra234 and future devices. Remove
the CVNAS driver and support for CVNAS from DLA, NVMAP and PVA dirvers.

Bug 4037930

Change-Id: I5d1ae3c195485cb094f9b9b480f91d81fd04687c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2903848
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-23 20:56:08 -07:00
Laxman Dewangan
a4136b7e63 platform: tegra: Remove firmware class and inventory drivers
Remove firmware class and firmware inventory modules drivers
as these are not used anymore.

Bug 4090910

Change-Id: Ibef41b6ba026a6d6f24ec79b4b7aaa47bc62632a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2905556
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-20 07:29:16 -07:00
Jon Hunter
e975e7bba9 platform: tegra: rtcpu: Don't register firmware
The Tegra firmware-class driver is being deprecated to reduce the number
of out-of-tree modules that are required. The firmware is registered
with this driver for informational purposes. The firmware version is
already printed on boot and so remove the call to register the firmware.

Bug 4090910

Change-Id: I69045a641f6daf21f15f71ae2ea70def2c74b28e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897319
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2898617
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>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-18 23:38:38 -07:00
Laxman Dewangan
e8240d6a9c platform: tegra: aon: Don't register firmware
The Tegra firmware-class driver is being deprecated to reduce the number
of out-of-tree modules that are required. The firmware is registered
with this driver for informational purposes. The firmware version is
already printed on boot and so remove the call to register the firmware.

Bug 4090910

Change-Id: Ifeafd7c65f1d02da9e1839746b5f91be07aa4578
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2905820
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: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Akhilesh Khumbum <akhumbum@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-18 23:38:19 -07:00
Laxman Dewangan
49244862b1 cvnas: Make module compilation as default
Make cvnas always as module and remove the condition
for built-in compilation.

Also remove the non-required includes.

Bug 4038415

Change-Id: Ib3715e4b94c310a460b943bcd11ad70b8e84cf08
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2904301
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-16 06:33:17 -07:00
Laxman Dewangan
6476bb40a4 cvnas: Drop license paragraphs
The cvnas files are having the SPDX license forma. Hence,
it is not required to have the license paragraphs.

Remove the non-required license paragraphs details.

Bug 4038415

Change-Id: I8f6212255cb9ce2cff3af5492599cf4f3946f04d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2904300
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-16 06:33:13 -07:00
Gerrit Code Review
5f8a0b1583 Merge "cvnas: Integrate drivers from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-05-16 06:33:08 -07:00
Deepak Nibade
cec42e4059 tegra_bootloader_debug: fix crash in absence of bootloader parameters
In absence of bl_debug_data parameter passed from Bootloader, value of
tegra_bl_debug_data_start will be 0.

This triggers a kernel panic on systems where parameter is not specified
and the module is loaded.

Fix this by first checking tegra_bl_debug_data_start and
tegra_bl_debug_data_size before accessing them.

Also add a check upfront to check if mandatory bootloader parameter
tegra_bl_prof_start is passed or not. If this parameter is not passed,
bail out the driver initialization.

Bug 3996651

Change-Id: Ibb78d6cefdae1f79ecb09836b833899deacb03ce
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2900710
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-16 06:28:12 -07:00
Mahesh Kumar
d4185fbe2e platform: dce: add delay between ipc_notify admin-seq
Add a few microseconds delay between sending ipc-notify calls for IPC
channel reset. IPC notify ACKs are asynchronous and sending notify when
the previous ACK was still in progress will cause spurious interrupt/ACK
signal and printout FSP state warnings.

Bug 4069133

Change-Id: I20dff299149a66629dc23ab2a7cb7765eac1b4dc
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2900570
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: Vinod Atyam <vatyam@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Vinod Atyam <vatyam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2902404
2023-05-15 01:18:59 -07:00
Ketan Patil
300ceb3ea2 tegra: cvnas: Fix type casting issue
CERT-C is reporting following issue:
- Casting cvsram_slice_data[1] from unsigned int to int without checking
its value may result in lost or misinterpreted data.
Fix this by changing the data type of slice_size.

CID 490074
Bug 3745813

Change-Id: Ic52fd016798310b69da69247a6eb2d7a626a4146
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2828530
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:13:34 +00:00
Sagar Gulab Patil
59f352a819 tegra: cvnas: Fix Cert-C error handling bug
In function nvcvnas_power_off casting nvcvsram_readl from unsigned int
to int without checking its value may result in lost or misinterpreted
data. Fix this by changing data type of val to u32.

CID 427418
Bug 3512545

Change-Id: I8be65b1ca73270a4a0d76380207078da745c7057
Signed-off-by: Sagar Gulab Patil <sagargulabp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2747340
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:13:26 +00:00
Sagar Gulab Patil
659ad2b6ee tegra: cvnas: Fix Cert-C error handling bug
In function nvcvnas_probe casting cvsram_slice_data[0] from unsigned
int to int without checking its value may result in lost or
misinterpreted data. Fix this by changing data type of variable.

ID 490074
Bug 3512545

Change-Id: Ia9f141f14a540f9c2c436bf605d4aec8f3489fb5
Signed-off-by: Sagar Gulab Patil <sagargulabp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2738506
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:13:11 +00:00
Laxman Dewangan
cb92d33b4e cvnas: Set config variable when build as OOT module
When cvnas driver is build as OOT module, it is required
to set the following config.
	CONFIG_TEGRA_FUSE_UPSTREAM
	CONFIG_TEGRA_CVNAS

Set these config when CONFIG_TEGRA_OOT_MODULE is set.

Bug 3583599

Change-Id: I8deffa609cfc7abf6c9efd69405295077649c8b1
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2715735
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2023-05-15 06:13:03 +00:00
Ketan Patil
242600283f video: tegra: nvmap: Do not export cvnas_dev
By exporting cvnas_dev all the internal data of the driver is getting
exposed to any driver that uses it. This could allow drivers to corrupt
this driver data. Hence do not export cvnas_dev, use helper functions to
get it's required member elements from nvmap.

Bug 200722684
Bug 3528414

Change-Id: I17f6fa1e98c777a7ec9118dbc6f0c6359e949f22
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2704698
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:12:41 +00:00
Ketan Patil
3a87281353 video: tegra: nvmap: Remove dependency of cvnas
Handle dependencies between nvmap and cvnas driver:
- nvmap_register_cvsram_carveout function is called by cvnas driver
(builtin driver for 5.10) and it's definition is present in nvmap driver
(builtin driver for 5.10, but we are trying to make LKM). This is
resulting into build issues while making nvmap as LKM for 5.10
- One option to resolve this is by making cvnas driver as LKM for 5.10
But nvhost, nvdla, cbb are not LKM for 5.10 and are calling functions
defined in cvnas driver e.g. nvcvnas_get_cvsram_base, hence we can't
make cvnas as LKM for 5.10
- Second option is to get rid of the call nvmap_register_cvsram_carveout
from cvnas driver. This approach is implemented in this patch.
- Export cvnas_dev from cvnas driver, do not call the above function
from cvnas driver. During nvmap probe, nvmap itself would call the above
function, as cvnas_dev is exported , it's being used in nvmap driver to
get base, size etc. information, which is needed as argument to above
function, which will register the cvnas carveout in case of 5.10

Bug 200722684

Change-Id: I32e5694386de4a7fef65c3f67ffb9b5066f62ab3
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2678685
2023-05-15 06:12:33 +00:00
Rajkumar Kasirajan
584a58b4b1 tegra: cvnas: set capped clock rate to max
The CVNAS clock does not support dynamic frequency scaling and
it is always expected to run at max rate. When its frequency is
capped at runtime via clock_cap sysfs node, forcefully change
current rate to capped max rate.

Bug 3510538

Change-Id: I133865dbd8cfe58182dca3e6b2b969b99df393b0
Signed-off-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2665653
2023-05-15 06:12:20 +00:00
Jon Hunter
c920508259 platform: tegra: cvnas: Fix function declarations
Sparse generates the following warnings for the CVNAS driver ...

 drivers/platform/tegra/cvnas/cvnas.c:126:5: warning: symbol
 	'nvcvnas_busy' was not declared. Should it be static?
 drivers/platform/tegra/cvnas/cvnas.c:138:5: warning: symbol
 	'nvcvnas_idle' was not declared. Should it be static?
 drivers/platform/tegra/cvnas/cvnas.c:444:13: warning: symbol
 	'nvcvnas_get_cvsram_base' was not declared. Should it be static?
 drivers/platform/tegra/cvnas/cvnas.c:456:8: warning: symbol
 	'nvcvnas_get_cvsram_size' was not declared. Should it be static?
 drivers/platform/tegra/cvnas/cvnas.c:468:5: warning: symbol
 	'is_nvcvnas_probed' was not declared. Should it be static?
 drivers/platform/tegra/cvnas/cvnas.c:476:5: warning: symbol
 	'is_nvcvnas_clk_enabled' was not declared. Should it be static?
 drivers/platform/tegra/cvnas/cvnas.c:779:5: warning: symbol
 	'nvcvnas_busy_no_rpm' was not declared. Should it be static?
 drivers/platform/tegra/cvnas/cvnas.c:793:5: warning: symbol
 	'nvcvnas_idle_no_rpm' was not declared. Should it be static?

There are a few problems here which are:
1. The CVNAS driver does not include the 'cvnas.h' header file and so
   some of the declarations are not found.
2. Some of the CVNAS functions are not declared in the 'cvnas.h' header
   file and need to be added.
3. The Tegra19x CBB driver is a user of these CVNAS functions, but
   instead of including the 'cvnas.h' file it defines prototypes for
   these functions. This is not necessary and so we can remove these
   prototypes and simply include the 'cvnas.h' header file.
4. The function definition nvcvnas_idle_no_rpm() in the CVNAS driver is
   incorrect and this function should not have any arguments passed to
   it and currently does not match the prototype.

Bug 3528414

Change-Id: I7945f8c66ceb5ca5b158b7ed1b81a50f19c52bb7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2670149
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:12:09 +00:00
Jon Hunter
2f44df7fa3 platform: tegra: cvnas: Simplify DT support
The compatible string for CVNAS devices has been updated from
"nvidia,tegra-cvnas" to "nvidia,tegra194-cvnas" to conform with the
upstream policy of stating the actual device it is supported on. The
'nvidia,tegra-cvnas-hv' has been left as-is because this is a special
case for virtualisation.

The CVNAS driver is only support for Tegra194 devices and so it is not
necessary to check the actual device variant, just the device SKU.
Finally, instead of populating platform data in the device-tree table
we can simply use the compatible string itself to detect if the device
support virtualisation.

Bug 3459526

Change-Id: I9755e8277892445b3e6772b8fa0b1960a34d90f4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2657909
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:11:54 +00:00
Jon Hunter
344d952e46 platform: tegra: cvnas: Add support for upstream Linux kernels
When building the CVNAS driver as an external module against upstream
Linux kernels, there are some downstream fuse APIs that are not found.
To fix building CVNAS for upstream kernels ...

1. Use the device-tree machine compatibility string instead of the
   downstream fuse function tegra_get_chip_id().
2. For the functions tegra_platform_is_silicon() and
   tegra_platform_is_sim() add implementations in a fuse-helper.h
   that always assume that platform is silicon and not a simulator.
   Note this assumption is only applied to upstream kernels and
   downstream kernel still use the downstream implementation. Long
   term we need to revisit this.
3. Copy the downstream implementation for function tegra_get_sku_id()
   to the fuse-helper.h so that this is available for upstream kernels.

The functions implemented in fuse-helper.h are only used if the compiler
flag CONFIG_TEGRA_FUSE_UPSTREAM is defined.

Bug 3459526

Change-Id: I5bbd08ac2560c236f932606ce5ad0e73dc71205a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2650491
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:11:40 +00:00
Jon Hunter
526fd969f6 platform: tegra: cvnas: Prepare for building as a module
Prepare for building the CVNAS driver as a module by adding the
necessary Kconfig option. In order to build the driver as an
external module, move the source into its own sub-directory and
add it own Makefile so that it can be built independently of other
drivers.

Bug 3459526

Change-Id: I87ce24852c561144313849774d5031821b6c3a47
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2650490
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-05-15 06:11:26 +00:00
Laxman Dewangan
f03685b25b cvnas: Remove dummy Makefile for cvnas build
Remove dummy makefile for cvnas driver integration
from the kernel/nvidia.

Bug 4083867

Change-Id: I6ebd811b6efafd5d731fae9105d40bfd479a4c29
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-05-15 06:11:05 +00:00
Laxman Dewangan
8733469474 hwpm: Remove of hwpm build along with nvidia-oot
HWPM driver is moved to new location and it is
build independently. nvidia-oot modules uses the
independently build hwpm module.

Remove the build of the hwpm module as part of nvidia-oot
module build.

Bug 4088571

Change-Id: I088e1f6c489c9cd6772a4724b52db6f56564395d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894662
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-28 02:20:37 -07:00
Laxman Dewangan
062b669392 uncore-pmu: Get rid of explicit header inclusion
Move the header "dmce_perfmon.h" to uncore_pmu
driver folder to avoid include of header path
explicitly. This header is only used by the uncore_pmu
driver.

Bug 4087103

Change-Id: I23e3c166861d851f81a7f41e5493cef58aa79531
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894622
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Eric Funsten <efunsten@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 02:20:18 -07:00
Laxman Dewangan
e8583efabf psc: Get rid of explicit header inclusion
The required headers for psc driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: Ia77098f143648020b4c81a4556f7bdfbec03ed36
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894620
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Liang Cheng (SW) <licheng@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 02:20:13 -07:00
Laxman Dewangan
7ecfc08dcc mc-utils: Get rid of explicit header inclusion
The required headers for mc-utils driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: Ib9b621f222aadd45ca1be62578e6208b116b4ae2
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894619
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 02:20:09 -07:00
Laxman Dewangan
b3b257596f platform: Get rid of explicit header inclusion
The required headers for platform/tegra driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: Ie91211c4c899d1ddb3684fa30753ae733625b0d4
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894617
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Akhilesh Khumbum <akhumbum@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 02:20:03 -07:00
Laxman Dewangan
d2b61aaee0 rtcpu: Get rid of explicit header inclusion
The required headers for rtcpu driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: I9f0e9ea7b951be95bddbbb310c9cbf15cd972775
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894621
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Pekka Pessi <ppessi@nvidia.com>
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:15:10 -07:00
Laxman Dewangan
ee73b0ff55 dce: Get rid of explicit header inclusion
The required headers for dce driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: Ied598dc7bf1c49fe42869a254b26aa1e2989e73b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894618
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 02:55:45 -07:00
Ishan Shah
17c13e0ec0 mce: tegra23x-mce: Fix coverity oob-read
CID: 10166532: Out-of-bounds read.
CID: 10166559: Out-of-bounds read.
CID: 10166565: Out-of-bounds read.
CID: 10166594: Out-of-bounds read.
CID: 10166597: Out-of-bounds read.

Fixed by adding checks to prevent get_ari_address_index() function
used in all 5 defects from overflowing.

Bug 3952896

Change-Id: Id67b57c621fd03d3727aea94c794251c8d0f0736
Signed-off-by: Ishan Shah <ishah@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2869316
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-24 23:36:17 -07:00
Laxman Dewangan
40e4e98fbe mc-utils: Use SPDX license GPL 2.0 format
Use SPDX license GPL-V2.0 format and change Nvidia
copyright year to include 2023.

Bug 4078035

Change-Id: Ia37ad697df18900322ff46c2190081ebd61c81f0
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2891214
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-22 04:22:50 -07:00
Laxman Dewangan
b20c5f57e3 dce: Use SPDX license GPL 2.0-only format
Use SPDX license GPL-V2.0 format and change Nvidia
copyright year to include 2023.

Bug 4078035

Change-Id: Icc0060431eb8d9c470a44f4cee50913cc1d8048a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890656
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-21 11:41:56 -07:00
Jon Hunter
c6f9d73c58 platform: tegra: nvpps: Move ptp-notifier source
Move the ptp-notifier.c source file under the 'nvpps' driver directory
because this is built into the NVPPS driver.

Bug 3918941

Change-Id: I4055422dac4f744f9978196ffcc54c20c666e95c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2851187
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-21 11:29:43 -07:00
Jon Hunter
876a3cd09d platform: tegra: mce: Combine drivers
The Tegra MCE driver is currently built as two kernel modules which are
tegra-mce.ko and tegra23x-mce.ko. The tegra-mce.ko module simply exports
functions that other drivers can use and the tegra23x-mce.ko modules is
dependent upon this. Instead of building these as two separate kernel
modules we should build as one. Even in the future, if support for other
SoCs is added we can still have a single driver that supports all SoCs.

Rename the file tegra-mce.c to mce.c and update the Makefile so that the
single kernel module produced is called tegra-mce.ko.

Bug 4078818

Change-Id: I5cd7d09f9defb77de4109a89adf1c1384f6b076c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890818
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-21 11:29:39 -07:00
Laxman Dewangan
3d92077e30 psc: Remove unnecessarily CONFIG
psc driver is build as module only so remove
the intermediate config CONFIG_TEGRA_PSC.

Bug 4074863

Change-Id: Idf40dcd1402f910bfe01756fb83607d17250f11e
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890120
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Liang Cheng (SW) <licheng@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-19 10:58:24 -07:00
Laxman Dewangan
a9e9f0cde1 dce: Get rid of CONFIG_TEGRA_DCE
The config variable CONFIG_TEGRA_DCE is set as m
inside the Makefile for OOT build. As the dce driver
inside nvidia-oot only build as module and there is
no Kconfig, remove this config variable.

Bug 4074863

Change-Id: I16436e97db583f2a8184dfffc3e18ebfddb62967
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2889992
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-19 10:58:10 -07:00
Gerrit Code Review
97b5db3f9b Merge "dce-kmd: Merge the dce-kmd driver from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-04-14 20:02:22 -07:00
JC Kuo
d7d941e745 drivers: tegra: Add Tegra USS io-proxy driver
This commit adds the Tegra USS io-proxy driver which allows userspace
to control clock and GPIO signals to the Ultrasonic sensor subsystem
found on Tegra platform.

Bug 3360749

Change-Id: I0b765e8b9e14b7de87f0f9205237d4dbfdd9f8f5
Signed-off-by: JC Kuo <jckuo@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2886017
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 15:46:35 -07:00
Mahesh Kumar
873e421d95 platform: dce: Add Debugfs support for Perf
Add debugfs nodes
 - start/stop perf stats.
 - read perf stat stats
 - set the format type as csv or xml

Add debugfs to capture perf events
 - Can enable specific perf events
through debugfs node.

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I0a7833d7a8f04296ba3806f4f2a218175080d2e2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765513
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Tested-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:36:09 +00:00
Vince Hsu
b25786578c platform: dce: fix compilation error with GCC 11
GCC 11 reports the array-bounds issue when passing an 32-bit variable
to find_first_bit but referencing it as 64-bit.

drivers/platform/tegra/dce/dce-debug.c: In function ‘dbg_dce_boot_status_fops_read’:
./include/linux/find.h:119:37: error: array subscript ‘long unsigned int[0]’ is partly outside array bounds of ‘hsp_sema_t[1]’ {aka ‘unsigned int[1]’} [-Werror=array-bounds]
  119 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
      |                                     ^~~~~
drivers/platform/tegra/dce/dce-debug.c:493:20: note: while referencing ‘ss’
  493 |         hsp_sema_t ss = dce_ss_get_state(d, DCE_BOOT_SEMA);
      |                    ^~
...
from drivers/platform/tegra/dce/dce-debug.c:15:
./include/linux/find.h:119:37: error: array subscript ‘long unsigned int[0]’ is partly outside array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Werror=array-bounds]
  119 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
      |                                     ^~~~~
drivers/platform/tegra/dce/dce-debug.c:492:13: note: while referencing ‘boot_status’
  492 |         u32 boot_status = d->boot_status;
      |             ^~~~~~~~~~~
cc1: all warnings being treated as errors

Fix it by passing a 64-bit variable to find_first_bit directly.

Bug 200730650

Change-Id: Ibfb68a2ee175aeb60eb9248496c220b35ff98906
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2856358
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
vinodg
47b8841a62 platform: dce: Fix typecast issue
Sparse shows error for using __iomem pointer for
void pointer as incorrect type in assignment.

No need to use __iomem pointer, as this address
is never meant for device memory.

Changed iosys_map_set_vaddr_iomem to
iosys_map_set_vaddr call.

Bug 3646321

Change-Id: I3ebe3db14a7953ab42cd1392b54c74e86dc1243d
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2846522
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
vinodg
658865f51a platform: dce: fix missing static declarations
Fix sparse errors for static declaration.

Update functions and variables defined and used
in the same source files with static declaration.

Bug 3646321

Change-Id: I378b0f514aedf265420c2eb454691e85c378cd95
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2846452
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@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: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00