Commit Graph

330 Commits

Author SHA1 Message Date
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
Mahesh Kumar
1258e71941 platform: dce: fix wait race condition
It is possible that we received the ACK from DCE even before we
start waiting. But currently we are clearing the "complete" state
before start waiting, which may result in missed interrupt.

This patch removes the clearing of complete state before wait.
Also Adds few comments for better understanding.

Bug 3941557

Change-Id: I7d2efb1a64eb6f2d4df1876add07a8f019b449f5
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2845498
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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
Mahesh Kumar
387a379024 platform: dce: add wait in ipc registration
If DCE bootstrapping is not complete, client registration may fail or
result in IPC failures.
Wait for bootstrapping to complete before registering any IPC-Client.
Use high priority work queue to schedule bootstrap work.

Bug 3583331
Bug 3826630

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I0facfe225e1550c795c2de7b42916416faa3bcaa
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834857
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824219
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
75bfcf326d platform: dce: Add suspend resume hooks
Add suspend resume hooks function and handling of sc7 events.

Bug 3583331
Bug 3826630

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I920b02ad46a76330febe666fe17e8d328f744b1d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834856
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824218
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>
2023-04-14 19:23:43 +00:00
Santosh Reddy Galma
31b6d913ab platform: dce: add device_link b/w display and dce
- add the device link between display and DCE such that
DCE KMD module will enter suspend after display suspend is
complete and DCE KMD module resumes early before display
resumes as DCE bootstrap has to be complete for display
to proceed with initialization.

Bug 3685062
Bug 3826630

Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2780892
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Change-Id: I4d84d8b5723747d984f0883aba697a5a0a0a21bf
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824217
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>
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Jon Hunter
12a8ee706f platform: dce: Fix build for Linux v6.2
Upstream Linux commit 4c1e0a97351a ("firmware: tegra: bpmp: Use
iosys-map helpers") updated the Tegra IVC driver to use the iosys-map
helpers for Linux v6.2. Update the DCE driver accordingly to work with
the latest Tegra IVC driver.

Bug 3936429

Change-Id: Id04fa3cbc078ed9657ae779b6a1bbd088008175c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2842560
(cherry picked from commit 545f887e90cffff1d79f6a4ff0af87ddfcbeb178)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801234
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
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>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
5d5463b60f platform:dce: notify dce after state ack
The current code doesn't notify DCE IPC after DCE IPC is in ACK state
Current Flow:

         CPU                      DCE
1: tegra_ivc_init               ---------
2: DCE_ADMIN_CMD_IPC_CREATE     tegra_ivc_init
3:     ---------                tegra_ivc_channel_reset
                                    dce:SIVC_STATE_SYNC
                                    cpu:ESTABLISHED
4: tegra_ivc_reset
       dce:SIVC_STATE_SYNC      ---------
       cpu:SYNC
5: Notify()                     tegra_ivc_channel_notified
                                    dce:SIVC_STATE_ACK
                                    cpu:SYNC
6: tegra_ivc_notified           ---------
       dce:SIVC_STATE_ACK
       cpu:ESTABLISHED

After Step 6 DCE state is in ACK state and CPU state is in ESTABLISHED
state. As there is no further cpu->dce notification in RM_NOTIFY
channel, dce state stays in the "ACK" state and any attempt to send msg
on RM_NOTIFY channel from dce->cpu fails.

This patch notifies dce after step-6, So dce channel is also in the
"ESTABLISHED" state.

If steps 3-6 get executed in CPU before Step 5 in DCE gets a chance
to execute (DCE is slow), the CPU IPC state will change to "established".
Now when step 5 will execute in DCE, it'll see the CPU state as
"established" so, It'll make the DCE state also "established".
That's how it's working today.

Bug 3861985

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Ieb13f525d3f81b30aaae848d8d5adb1106856b65
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2840065
Reviewed-by: svcacv <svcacv@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
Adeel Raza
424a1c66f0 platform: tegra: dce: change license to MIT for errors header
When dce-core-interface-errors.h was copied from DCE FW, the header
incorrectly retained its proprietary license. The license has been
changed to MIT.

Bug 3198239
JIRA TDS-6362

Signed-off-by: Adeel Raza <araza@nvidia.com>
Change-Id: I8fb1c525c11207444655af81f5b103f2908b98ef
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834612
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Jon Hunter
9116ef8c3e platform: dce: Add license and copyright to Makefile
Add the GPL v2.0 license and NVIDIA copyright to the DCE Makefile.

Bug 3912236

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I75044962d68a556c8b6b5ae7d09d44f8ff61b515
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2828593
(cherry picked from commit 15f8adb73788f0073f3f6e960fdadb04246c869a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2829455
Reviewed-by: Bibek Basu <bbasu@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
Mahesh Kumar
3c473c60eb platform: dce: set MIT license for dce headers
Change NV license for dce headers to MIT license as those
can be distributed with other linux sources but they are also
used in DCE firmware.

Bug 3871403

Change-Id: I363d252a1155e3e0119d46b35b073bd6ad10fc57
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820110
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
bb8fc06951 platform: dce: fix async msg read prints
While MST is used, We get two async msgs from DCE and schedule 2 worker
threads, But during processing (dce_client_process_event_ipc) of these
messages, We are processing all the pending messages in one go. So,
while the second worker thread is scheduled, there is no new message
to read.

This Patch fixes the loop to try reading only when there is a new msg to
read. Also convert info print to debug, to avoid print noise.

Bug 3801736

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Iddf9ea8f0194539baa8c52616e2f836527400176
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2810440
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: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Jon Hunter
6379e130a8 platform: dce: Fix automatic loading with DT
The Tegra DCE module is not automatically loaded on boot with
device-tree and this is because the MODULE_DEVICE_TABLE is not populated
in the driver. Add the MODULE_DEVICE_TABLE for the DCE driver to fix
automatic loading with device-tree.

Bug 3583600

Change-Id: I487d4de8b8e9e71a7c3ad961845c346e886e632e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2805837
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
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: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
fde8d45bbe platform: DCE: Add OOT support for ipc
Reorg DCE-KMD IPC code to use only upstream IVC APIs
This will simplify integrating the code for OOT.

Bug 3583600
Bug 3713048

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Ia124f7bc77a788b94b0bf60634ed740c77228725
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2790847
Reviewed-by: Arun Swain <arswain@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-04-14 19:23:43 +00:00
Mahesh Kumar
a42af2d0ad platform: dce: Coverity Fix
Fix Coverity issue CID 10138164
Create new macro to avoid non-reachable code.

Bug 3461002

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Ie5ff50678e30ae0ddd712ceda212f4b572ce624e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765168
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>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Adeel Raza
c032aa992e platform: tegra: dce: Add debugfs for external tests
External clients such as MODS require the ability to run tests. Add
support for this feature. Currently only the following 2 external client
tests are supported:
  - MODS ALU test
  - MODS DMA test

Bug 3198239
JIRA TDS-6362

Change-Id: I18c20a9fa5d2606056d65b76fbaae9b0c81746d4
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2606595
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Adeel Raza
d05457f954 platform: tegra: dce: Proper error codes for admin cmds
Currently admin channel commands return error codes which can't be
understood by KMD. Standardize on DCE_ERR_CORE_* errors (defined in
dce-core-interface-errors.h) for admin commands.

Bug 3198239
JIRA TDS-6362

Change-Id: I42a9ae44c0999aa5133c36ba4c6fb4fee2b25767
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2736608
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
8ef1f2db87 platform: dce: FSM incremental fixes
This patch addresses design review comments for FSM
 - Add comment to update design doc on FSM update
 - Create wrapper function to check bootcmd complete status
 - move bootstrapping functions to dce_bootstrap.c file
 - Fix sw resource init/deinit function name

Bug 3583331

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I77f05135f7ec1882922907f8acef50def639d26d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2758902
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
5aa80075ad platform: dce: remove use of of_irq_xxx
of_irq_xxx faimly of functions are not exported by Kernel.
use platform_irq_count and platform_get_irq APIs instead.

This patch also moves dce_platform_data elements to dce_device
struct to keep dce_platform_data constant.

Bug 3581824

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I5ea13ea039ef1464e678f0604a045a6ab67bc16f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2755141
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
df0f2d1a74 platform: dce: add support for multiple HSP
Change-Id: Ia6d3278b89f5ba34bd6bbbd80820279e4e06fc0b
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2727625
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
28a1cfd1c1 platform: dce: reworked dce FSM design
Redesign DCE KMD drive state machine to handle new PM events.

Bug 3583331

Change-Id: I89adcfa2f311a9a1e86b70e14821468203365266
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2673665
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
a6cc70f8d5 platform: dce: remove debugfs on deinit
Current code does not remove debugfs node on deinit.
This patch fixes the same.

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I9ceb78b73d71aca0a2363df0408bf6a85ca91834
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2743215
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: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Wei Ni
4904a11978 platform: dce: change DCE firmware name
Change the DCE firmware name from dce.bin to display-t234-dce.bin

Bug 3593058

Signed-off-by: Wei Ni <wni@nvidia.com>
Change-Id: I0a6e4243a6d3cc45688303ccd6a28a65a6edbb31
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2695059
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
eab8003c4c platform: dce: remove unused rpc_sync macro
DCE_IPC_WAIT_TYPE_SYNC is not used anymore for RPC. This patch get rid
of DCE_IPC_WAIT_TYPE_SYNC define from the code.

Bug 3472984

Change-Id: Iae0237e39f12f6cb170297f95fa6a39bc64e694a
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2699028
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: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
4b609b3dd4 platform: dce: Add support for debug level logs
Add support to print debug level dce logs.
This is to reduce the number of prints spew by dce in kernel logs.

Bug 3472984

Change-Id: Idaf0dbb3511ee92a632bb0be8c445212e228f8d5
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2692698
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: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00