Commit Graph

2898 Commits

Author SHA1 Message Date
Hariharan Sivaraman
385dc63275 nvadsp: Add ADMA page info in hwmbox
For virtualized configurations, add DMA page info
for ADSP to read via HWMBOX. Remaining DMA pages will be
unmapped by ADSP OS

Jira EMA-414
Jira EMA-415

Change-Id: I67b7b2069aca07948e63436367d80a2baeaaf6ae
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master/r/1477304
(cherry picked from commit 93f338df31af5894935754aac23bb003168f9ea0)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1567625
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Dara Ramesh
6b338bab49 adsp: add dma_set_mask parse
Add dma-mask parsing in device tree for adsp
driver to start allocations start from the
specified address and downwards.

This will allows adsp binaries are placed
at top of the IOVA space

Bug 200385990
Bug 200406253

Change-Id: Id37579a78e6d788cfd722505a23e90f249cee5eb
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1755675
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Dara Ramesh
beddbe937e adsp: updated standard include path & clock_t api
cputime64_to_clock_t is deprecated on kernel 4.14
as it is an architecture defined type
so changing cputime64 to nsecs.

Bug 200406253

Change-Id: I16bac09da698ca1b15130be69fb7c58c70d3ce94
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1742429
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Uday Gupta
159d4e9e34 nvadsp: Increase static app queue size
Increase static app init queue size between ADSP
and CCPLEX to handle more APPs.

Bug 2131818

Change-Id: Id8b376f312c3a3f04ec82abe69ec62994fcc0254
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1726937
Tested-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Dipesh Gandhi
ca09364356 nvadsp: clock cleanup for audio devices
Change cleans up ape, apb2ape clocks from nvadsp device.
These clocks will be controlled by parent aconnect bus device
as for any audio use case to work we need these clocks.

PM_RUNTIME on nvadsp will call runtime for aconnect which
will enable these minimal required clocks.

Jira EMA-641

Change-Id: I2f452ed1f28fc2ee79bd0f7eac686aeccd8d9513
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1688359
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
David Gilhooley
d56b0972b0 platform: nvadsp: prevent speculative load related leak
Data can be speculatively loaded from memory and stay in cache even
when bound check fails. This can lead to unintended information
disclosure via side-channel analysis.

To mitigate this problem, use array_index_nospec.

Bug 2060857
CVE-2017-5753

Change-Id: I3b79ab2df0cff5eb7f94f8056cfdfb98ac69037a
Signed-off-by: David Gilhooley <dgilhooley@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1684649
Reviewed-by: Bo Yan <byan@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Dipesh Gandhi
c844c3a973 nvadsp: false trigger for adsp boot
Change add spinlock protection for message enqueue to avoid possible
race condition between enqueue and dequeue of ADSP OS message.

Bug 2031075

Change-Id: Iad243fdf034db89a61e32411a8b03c817c19d81e
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1613124
(cherry picked from commit 3d146a3ba4dbe4c1375d64d425ff0b9be7f7c272)
Reviewed-on: https://git-master.nvidia.com/r/1669402
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
c8f7a26db7 platform: nvadsp: Reduce blocking time of logger
The logger currently blocks in open for finding SOH within the
circular buffer. This blocking is infinite. However, the SOH
is written in buffer for sure when adsp boots.

Hence, added a check to see if in the past if adsp has been
started and then search for SOH else return an error.

Also, the blocking takes place in the read path where the logger
waits in the position where it gets EOT and loops back. This is
not desirable due to recent changes in debugfs and hence now the
read path returns back with an ASCII value of BELL which will not
effect `cat` from writing anything on the console.

Bug 1997011

Change-Id: Ia6e990bcdc1af5c328c24f350af941126beda07a
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1662918
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
168fe1fdab platform: tegra: nvadsp: remove export symbols
Remove export symbols for APIs that are not exposed and not used by
other modules except ADSP driver.

Bug 200381256

Change-Id: Ibe11e5992e5a93b7a5698a6158d9d27e4f55d453
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1652773
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
5c63aad7c2 platform: nvadsp: do not export da to va mappings
nvadsp_da_to_va_mappings API provides the ability to get the virtual
address from the physical address. This API does not need to be exposed
as there are no other modules using it and prevent prevent speculative
load related leak.

Bug 200381256

Change-Id: Ic94497ca40402101e4246b914f00e030551b0c4c
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1652771
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Dipesh Gandhi
e0ecbe2746 platform: nvadsp: print app version info
Print each app's version info string in
the app's sysfs node

Jira EMA-841
Bug 1819427
Bug 200381729

Change-Id: I2cbb7e13a4a351100812dcf63f9f62b8268c874f
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: http://git-master/r/1246459
(cherry picked from commit 1ccaba7f30c1b663fef0082b0686e1a3ba65e484)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1640900
(cherry picked from commit e81e6dd69db817a351f09befd86ac5612eb003f3)
Reviewed-on: https://git-master.nvidia.com/r/1652453
Reviewed-by: svcboomerang <svcboomerang@nvidia.com>
Tested-by: svcboomerang <svcboomerang@nvidia.com>
2023-06-20 15:13:15 +00:00
Ajay Nandakumar M
07d0f698f2 Revert "Revert "platform: nvadsp: Ability to get chip id on ADSP""
This reverts commit 45f17000bcd1a32f4b6d35a11af476c4dc152060 and
restores change https://git-master.nvidia.com/r/1645257.

Bug 200372198

Change-Id: I3798ac0ba7432cc50df18dde65705145f62c0616
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1652521
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Bharat Nihalani
3079cc865b Revert "platform: nvadsp: Ability to get chip id on ADSP"
This reverts commit baa2e9cd86a446e085091494be4247d2a4b64a33
since it causes ADSP tests to fail on T18x and T19x
platforms.

Bug 2057870

Change-Id: Ibfc1ec5dfcd678bf608598edc1f118a452d072e3
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1651935
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
8f2612d56d platform: nvadsp: Ability to get chip id on ADSP
Adding ability for ADSP OS to get chip id. This can be used
to enable/disable features.

Bug 200372198

Change-Id: I9f872065bcffa714bf1e2added7c41c3b228cebc
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1645257
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
David Gilhooley
c79dd8ba50 platform: nvadsp: prevent speculative load related leak
Data can be speculatively loaded from memory and stay in cache even
when bound check fails. This can lead to unintended information
disclosure via side-channel analysis.

To mitigate this problem, insert speculation barrier.

bug 2039126
CVE-2017-5753

Change-Id: I5a745320b64bf6689cf8ac4b713cf1b32f662a23
Signed-off-by: David Gilhooley <dgilhooley@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1640352
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Prateek Patel
562a14e11b platform: tegra: adsp: add dynamic_app_support
adding dynamic_app_support flag for the dynamic apps and
setting it to true if load from "adsp.elf"

bug 1833670

Change-Id: Ic68611e140f6bc0392a4fb153436d196bf0bda1c
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1618738
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Ian Chang
b3ff5cc423 adsp_dfs: define adspfreq_stats_update conditionally
Define function adspfreq_stats_update only if CONFIG_DEBUG_FS is enabled.
Otherwise, this function is unused, which triggers a warning and may
be treated as an error.

Change-Id: Ia0d6d004dc74ce942db7579810297c469d8ff44f
Signed-off-by: Ian Chang <ianc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1610762
(cherry picked from commit ed13d72d6b99b93095600aad0e02aae6eaf44e8c)
Reviewed-on: https://git-master.nvidia.com/r/1626906
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Prateek Patel
9de7361de1 platform: tegra: adsp: share exception data
adding ability for ADSP to share data when an exception occurs
on the ADSP. The data is shared through the shared memory across
the host.

adding shared exception data prints on host side for debugging.

bug 1868578

Change-Id: I6645e8ae6ab73e5c9df8374f583dacbed4615536
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1611260
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2023-06-20 15:13:15 +00:00
Prateek Patel
68dd548b9e platform: tegra: adsp: remove nvadsp_dram.c
removing dummy functionality of DRAM sharing with ADSP,
which are not in use

bug 200326188

Change-Id: I613a65aa39c3bcd548ca001d29e7112798b438d6
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1608868
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Prateek Patel
765e2695dd platform: tegra: adsp: remove arbitrated semaphore
removing ADSP arbitrated semaphores since they are not part of t18x
and not in use in t21x.

bug 200326188

Change-Id: I52ef7e47c98ae0c5b9a95eed4b10161de2aff5dc
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1607937
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Prateek Patel
d25d71e53f platform: tegra: adsp: use bwmgr to set emc freq
Shared clocks on 4.9 have been deprecated.
This has been replaced by tegra bandwidth managers.

bug 200359628

Change-Id: Ib23ad57d36c501c16ade33d27d846f0d24217b34
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1597879
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Hariharan Sivaraman
a82f3515d6 tegra: nvadsp: adsp_lpthread patch cleanup
Patch to cleanup adsp_lpthread code
	- used enumerators instead of macros
	- Added unload of app during lpthread exit
	- Removed sprinkled print statements
	- Added comments for readability

Bug 1727014
Jira EMA-841
Jira EMA-854

Change-Id: Ifb3a1e60760013a52187a7ed54de27d35ff88c33
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1564217
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Hariharan Sivaraman
2e9feef735 nvadsp: os: remove adsp_lpthread kernel print
Removing adsp_lpthread_debugfs_init() success print
since it causes kernel warning test to fail

Bug 1727014

Change-Id: I5297be9ed656b1872c5e3088f5a9e2e4a29d7a8b
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: http://git-master/r/1153287
(cherry picked from commit 8371d226c11ec602c858ff8a50d0d43e51dc0a48)
Reviewed-on: https://git-master.nvidia.com/r/1558947
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Hariharan Sivaraman
d593fa42f0 tegra: nvadsp: disable suspend when adsp usage log
Prevents adsp os from getting suspended when adsp_usage is being logged
Checks whether usage app is running and skips suspend accordingly

Bug 1727014

Change-Id: Iafd800d3d18d6292bee5d3376cec59dbb4557f2e
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: http://git-master/r/1142669
(cherry picked from commit 04660b149f1455f1e5e77f75aeb652a9dceae55f)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1564184
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Hariharan Sivaraman
f9f361c265 tegra: nvadsp: adsp usage app changes
Combining adsp_lpthread_proc.c and adsp_lpthread.c
under one file adsp_lpthread.c

Bug 1727014

Change-Id: I45ab5e5a49fce29f151b81706fee8e9f3baffeef
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: http://git-master/r/1141833
(cherry picked from commit 8e9632c3bba854eb91fe406b1f67a1941da95292)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1564175
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Hariharan Sivaraman
b3a66c2476 tegra: nvadsp: Include adsp usage functionality
Adds functionality to calculate adsp cpu usage
Inits, loads, starts and resume adsp_lpthread app

Bug 1727014

Change-Id: Icaf7a1ba9e91bff19d7fbc894bfdd0f884971d6c
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: http://git-master/r/1134173
(cherry picked from commit 256bd7180cefa523a9e480be315fbf47b9c8de4f)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1564162
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Prateek Patel
12dc199ff3 platform: tegra: adsp: remove emc clocks
With common clock framework, the shared emc clks have been replaced
by a bandwidth manager. Hence, the shared clocks for t210 on 4.9 are
deprecated.

bug 200345548

Change-Id: I09638ffef2635cabefbb560f2d686eb306f4fd78
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1568428
GVS: Gerrit_Virtual_Submit
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Stephen Warren
1138e7fbc7 nvidia: use kernel overlay features
Update all Kconfig files and Makefiles to rely on the kernel overlay
feature. In particular, don't include any Kconfig files or Makefiles
from other overlays. -I directives in CFLAGS are not yet cleaned up.

Bug 1978395

Change-Id: I425d37d55f8ea61fb3a082a1504f994ff30cec03
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1561187
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Sameer Pujar
c6fc11080f nvadsp: fix compilation warning.
This patch fixes following warning,
warning: symbol 'nvadsp_tegra_adma_dump_ch_reg' was not declared

Bug 200299572

Change-Id: I6d4b06b73d7d8928a08c975c305bf76d8ac58568
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1572940
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-06-20 15:13:15 +00:00
Gaurav Tendolkar
02f9bb7fd0 nvadsp: add debugfs file for adsp crash detection
Added file adsp_health on which userspace app
can poll to check for ADSP crash or hang

Change-Id: If2265cf245759809da233ae366a3fbcb7f42d4b6
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1514462
(cherry picked from commit fb8c6a3119a6ceb4dc6a19bd548737d279f7cba6)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1558929
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
3fb218dbaa platform: nvadsp: rename aram manager apis
As aram manager functions are made available through
tegra_nvadsp.h header, rename those to make those specific
to nvadsp.

Bug 200326188

Change-Id: Ib10d78f6f74600bb2771151ca38792f6f81858f1
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1545002
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
12be717e8c platform: nvadsp: Silence debug t21x clock prints
Moving debug clock logs from dev_info to dev_dbg as it
creates a huge number of prints as ADSP is frequently
suspended and resumed.

Change-Id: I923ea079f74f1de659e3c8626d437cb0a22802bb
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master/r/1509154
(cherry picked from commit 3e9b288c245789f0a09cc7d9ba5a0ef2a7d74a4c)
Reviewed-on: https://git-master.nvidia.com/r/1543825
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
3fbe739b6f platform: nvadsp: adsp_cpu_abus to set freq on t21x
Using adsp_cpu_abus which is a virtual clk (ADSP_CPU_ABUS clock) to set
frequency on t21x platform. Earlier the physical ADSP clk was used which
only provides a constant frequency.

Bug 1955157

Change-Id: Ifcf42b50a543a95e934e651e68056cb1c8d6c654
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1520261
(cherry picked from commit c1c8d713cd723b20f890cfbd205e38a90007e847)
Reviewed-on: https://git-master.nvidia.com/r/1542708
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
9b73ee3d3e platform: nvadsp: kconfig: select ARM_GIC_PM dep
Select ARM_GIC_PM by default as K4.9 nvadsp driver needs
GIC PM feature. For K4.4 there is no dependency and no such
config so it will be ignored.

Bug 200325731

Change-Id: I05735a7f5e2ae6f31df6938a45b89dc83150c7ec
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537419
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
303185c87a platform: nvadsp: rename Makefile and Kconfig
Rename Makefile and Kconfig as Makefile.nvidia and Kconfig.nvidia
respectively. This is done to allow use of downstream nvadsp
driver in kernels like K4.4, K4.9, etc.

Bug 200325731

Change-Id: I96269398089700677bdf919519295f80b40e7848
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537418
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Sameer Pujar
a9dd5adae3 drivers: nvadsp: support for adma regdump callback
With adma driver as module, following compilation error is seen
"undefined reference to tegra_adma_dump_ch_reg".

In the current patch, adsp code exports a function to set regdump
function call back. This function is used by adsp audio driver to
set the function pointer to tegra_adma_dump_ch_reg. This is done
in tegra210_adsp_init().

Bug 200289390

Reviewed-on: http://git-master/r/1483001
Change-Id: I1ef259cf3b988a41720fb6706d39d9bd6f86aac3
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
(cherry picked from commit 36ccba1262928a6ce8b0f4fff1d4ad2591c4305d)
Reviewed-on: https://git-master.nvidia.com/r/1528158
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537339
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
a82a2e94de platform: nvadsp: dfs: update freq table
Update adsp cpu frequency table to be specific to
a chip to reflect supported frequencies.

Bug 200295526
Bug 200322504

Change-Id: I538cbe5280212cc6cd54198d2f3d8e4f78664045
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1526341
(cherry picked from commit ae50e01f2e14c9b9280c4d8d9ef712ef6f38add4)
Reviewed-on: https://git-master.nvidia.com/r/1527566
Reviewed-on: https://git-master.nvidia.com/r/1537338
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
0081a6e97c platform: nvadsp: dfs: add os status checks
Add checks for adsp os running state in adsp_override_freq()
and update_freq(). If adsp os is not running state then
communication with ADSP for freq update will not work. This
could result in failure in updating ADSP CPU frequency.

Bug 200295526
Bug 200322504

Change-Id: Iea25f542b080ac22faf562f35e82ceede43bbc83
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1526340
(cherry picked from commit 2aea120c7c1385e14f36e5fa707594e3ab6e2294)
Reviewed-on: https://git-master.nvidia.com/r/1527565
Reviewed-on: https://git-master.nvidia.com/r/1537337
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
William Pierce
5e4dff249f tegra: linsim removal
Removed multiple tegra_platform_is_linsim if statements because of
linsim deprecation.

Bug 1903831

Change-Id: Id8dd87c9d4ab633175ef3f697fec5cf33dfc4077
Signed-off-by: William Pierce <wpierce@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1485008
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537336
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
71b56ecaa2 platform: nvadsp: make WFI wait non-interruptible
Making the "WFI wait" from interruptible to non-interruptible. This is
done because there is a probalbilty between the thread making a call to
nvadsp_os_suspend / nvadsp_os_start getting signaled or having a
pending signal before ADSP enters WFI and the CPU getting the WFI
interrupt.This results in wait_for_completion_interruptible_timeout()
returning -ERESTARTSYS, due to which nvadsp_os_suspend treats it as
failure although ADSP has entered WFI and the WFI interrupt has been
received on the CCPLEX.

Since this is a race it is not seen often.

Also, reducing the timeouts for WFI and logger wait to 800 and
500 ms respectively. The timeouts have been reduced because during
suspend there are only a few register writes and logger has been
reduced from 1 MB to 16 KB.

Bug 200317530
Bug 1893324

Change-Id: I40b3894f284763c0e4cc45647e1adf2cd074d701
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1517838
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537335
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
a3d5511dea platform: nvadsp: use smem for adsp freq update
Instead of using mailbox to communicate change in adsp cpu
freq, update it in adsp os args from ccplex-adsp shared
memory. This adsp freq update is needed by EDF scheduler
for scheduling EDF threads. The EDF scheduler gets
current adsp freq from shared memory instead of
scheduler callback.

However, for APE1 (i.e. chips = T21x), timer prescalar
must still be updated through mailbox each time adsp cpu
freq is changed.

Bug 200322504

Change-Id: I26f14f5c4f5c2369d67dfcd73dc6b9664df2ca26
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master/r/1512069
(cherry picked from commit 76e8a4c19de2fa5f0d91ebefac68aa0b864cb0eb)
Reviewed-on: https://git-master/r/1512864
(cherry picked from commit 3100911879f9ea9930a515f6d55257caefcef869)
Reviewed-on: https://git-master.nvidia.com/r/1517749
Reviewed-on: https://git-master.nvidia.com/r/1537334
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
5711c0800c platform: nvadsp: add dfs comm logs
Add messages for logs added on adsp for dfs mailbox
communication.

Bug 200295526

Change-Id: I19048f755578359a673d164be3d4f5601cb82634
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/1496891
(cherry picked from commit 06fec301a0d744108ac890a87bd187efd956a688)
Reviewed-on: https://git-master/r/1513589
Reviewed-on: https://git-master.nvidia.com/r/1537333
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
da4867a93c drivers: nvadsp: Add msgs for logs from wfi
Add messages for states logged during wfi entry and exit.
This messages would be useful when ADSP fails to receive
wfi interrupts.

Bug 1893324

Change-Id: I3f7ade24b3d0b7bf2e5fe35d1d380ed51de38b70
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: http://git-master/r/1483708
(cherry picked from commit ea6a7d1566e57c23099ed09c06f64967d67d26da)
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master/r/1513588
Reviewed-on: https://git-master.nvidia.com/r/1537332
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
412366151b platform: nvadsp: dump mailbox queue on error
Dump mailbox queue, if it's not empty, when mailbox
is getting closed.

Also, change errornos in mailbox APIs such that those
are unique in that function.

Bug 200295526

Change-Id: I69e83146c049bb51d7cac5e954183c6c7cc97956
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/1496890
(cherry picked from commit dec73d1e0ab5c6ccddf043bd4ae7ce65d1d478e2)
Reviewed-on: https://git-master/r/1513587
Reviewed-on: https://git-master.nvidia.com/r/1537331
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
c196dc0fff drivers: nvadsp: dump msgs for logs from suspend
Add messages for states logged during ADSP suspend and
resume path.

Bug 200295526

Change-Id: I2b039744e6abfd8d30b6b78ec4f9c4acda7a13aa
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/1475428
(cherry picked from commit e5d9528576285ceffd89f7a8c962ad57140cd3c9)
Reviewed-on: http://git-master/r/1478824
(cherry picked from commit 332a011b8a97cc1ce788500b1dcbce6e08a7fe83)
Reviewed-on: https://git-master/r/1513586
Reviewed-on: https://git-master.nvidia.com/r/1537330
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
9df95f35c0 drivers: nvadsp: dump current thread and last irq
Dump name (first 4 chars) of current thread and irq
number of last interrupt handled from hwmbox reg 4 and 7
respectively.

Bug 200295526

Change-Id: I4b53521cbfece2177e3cf6ed80b559b58e1d1c0a
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/1475487
(cherry picked from commit 64a799ae7d8e8f8783212fb4c28209cf760b38a7)
Reviewed-on: http://git-master/r/1478825
(cherry picked from commit cab60f6977fc8070e4206db01e2a2d444860c90c)
Reviewed-on: https://git-master/r/1513585
Reviewed-on: https://git-master.nvidia.com/r/1537329
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
7e75728df7 platform: tegra: nvadsp: add adma reg dump
Add ADMA regs as part of dump_adsp_sys() which is called
on irrecoverable errors on ADSP.

Bug 200295526

Change-Id: Iacb315d6b188d1b98085e59a86c74212246308da
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/1466422
(cherry picked from commit 4df02685ef33a9b3058d63bc1c09ceb4a726aa70)
Reviewed-on: http://git-master/r/1465573
(cherry picked from commit 83fa5779125c024dd0101215c4d37df8e89a9619)
Reviewed-on: https://git-master/r/1513584
Reviewed-on: https://git-master.nvidia.com/r/1537328
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
808af08cb9 nvadsp: dump adsp state from hwmbox reg
The state of ADSP is logged by writing to a mailbox
register. Adding support to kernel driver to dump ADSP
state when crash happens.

Jira EMA-404
Bug 1901511
Bug 1893324
Bug 200239577

Change-Id: Ia2beb84a7d5bc871f7062bd6a661333af0b0e24d
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: http://git-master/r/1229864
(cherry picked from commit 0027e7a51f6134b4a7b332c17f7c7c26ac727ebc)
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537327
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
816abce5a9 platform: nvadsp: move request/free irqs calls
The request irqs are moved just before starting ADSP and freed when
adsp is suspended/stopped.

This is since the new agic driver is based on a device-driver model
and requires all interrupts to be freed before it could suspend.

Bug 200270956

Change-Id: I8ecd05ebe52020f11be79b9a1da37a85fed432ac
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: http://git-master/r/1478838
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537326
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Nitin Kumbhar
2a016f531d drivers: nvadsp: fix sparse warnings
Fix following sparse warnings by including header dev-t21x.h, which
has function declarations, in dev-t21x.c.

dev-t21x.c:284:5: warning: symbol 'nvadsp_pm_t21x_init' was not declared.
Should it be static?
dev-t21x.c:296:5: warning: symbol 'nvadsp_reset_t21x_init' was not declared.
Should it be static?

Bug 200299572

Change-Id: I5f16da0852ab9083fba7395cfbd66ec012014663
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/1474440
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537325
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
2023-06-20 15:13:15 +00:00