Commit Graph

303 Commits

Author SHA1 Message Date
Mahesh Kumar
2ea5632398 platform: dce: reset condition variable after use
Once we complete EVENT_ID_DCE_BOOT_COMPLETE_RECEIVED event handling, it
doesn't reset the complition variable. Which causes
dce_wait_interruptible to exit early without waiting in next cycle.

This patch fixes the same by resetting complition variable after use for
EVENT_ID_DCE_BOOT_COMPLETE_RECEIVED.

Bug 4167219

Change-Id: Id9b9047fa0e293f8616e23a5c8b4b1bacf233934
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2927740
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-12 19:00:52 -07:00
Johnny Liu
2529d12c52 platform: tegra: Fix overflow before widen
To avoid overflow, cast mc_all_actives to type u64.

Bug 3952896

CID 10174209

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ic49e56652e32a042f884a7f02aa4c4a878a592d0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2930556
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-05 14:56:22 -07:00
Vedashree Vidwans
569541dfb9 tegra: mc-hwpm: update remove driver function
Update remove function in mc-hwpm driver to include missing HWPM
unregister call.

Jira THWPM-8

Change-Id: I1698860647214472e75503e0fd77594e105b2913
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2924754
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-30 17:56:13 -07:00
Laxman Dewangan
a8454b9a5f rtcpu: remove unused drivers for clk, drive and reset groups
Remove unused module drivers from build as the drivers
are integrated with client driver as single module.
Drivers which are getting removed are:
         clk-group
         device-group
         reset-group

These drivers was restored due to packaging error in
release branch which is fixed now.

Change-Id: I094e62ae2a83eb7816c98bf113c5a74f2636a41f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929127
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-30 13:05:59 -07:00
Laxman Dewangan
821e738ecc rtcpu: Add drivers for clk, drive and reset groups
Add the following driver back into build to avoid
the packaging error in release branch to avoid
package error:
     clk-group
     device-group
     reset-group

These drivers will be deleted after release branch is updated
with proper packaging.

Change-Id: I128a3fee5d0fb19c78321845b06deb023f233a59
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2926512
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-27 09:28:50 -07:00
Laxman Dewangan
44ece33f27 drivers: Remove Kconfigs
There is no need of the CONFIG_* for oot modules
and hence remove the Kconfig from modules
directory.

Bug 4078035

Change-Id: I78ca8b7f123fb92c410e8443c4056a67dcf280b5
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2923232
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-22 23:39:27 -07:00
Laxman Dewangan
0ea187142e Makefile: Add missing license files
Add lincese and copyright information on Makefile
where it is missing.

Bug 4078035

Change-Id: I4d44143c186a30aabacb706b7db6549131c6e4d6
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2924242
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-22 23:39:23 -07:00
Praveen James
38152fe335 tegra-fsicom: fix deinit notification to fsi driver
fix for sc7 failure with FSI disabled build.
Deinit notification is send if fsi is flashed with
production fw.

Bug 4082254

Change-Id: I195369d040df96727b1d7a626fb9e37453d48bbf
Signed-off-by: Praveen James <pjames@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2906587
Reviewed-by: Rahul Bedarkar <rabedarkar@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-22 00:50:19 -07:00
Gerrit Code Review
8a44e8b8b1 Merge "nvadsp: Merge nvadsp from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-06-21 19:40:20 -07:00
Santosh Reddy Galma
ebbb6ea7a2 platform: tegra: dce: fix coverity defect
- check the handle is valid before retrieving the
client structure for the handle during client unregister.

Bug 3952896

Change-Id: I6f37625e01453055fb4dc256cffb1f85f199aa36
Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2922622
Reviewed-by: Mahesh Kumar <mahkumar@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-06-20 15:09:10 -07:00
Bharat Nihalani
d40e2df1b2 drivers: Use runtime debugfs check
When kernel command line debugfs=off is specified instead of
disabling CONFIG_DEBUG_FS in defconfig to disable Debug-FS,
debugfs functions like debugfs_create_dir will fail.

Use function debugfs_initialized() to check if debugfs
functionality is enabled before calling any debugfs functions.

This allows us to by-pass debugfs initialization if debugfs
is not enabled.

Also, there is no need to protect debugfs related code under
CONFIG_DEBUG_FS, as stub functions for all debugfs APIs are
defined when CONFIG_DEBUG_FS is disabled.

Bug 3752450

Change-Id: I1aa2c46bc822da54fdc87504ac75c91845e02c12
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820666
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: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
83ee116f72 nvadsp: Check ADSP_STATUS before reset in suspend
Check L2_IDLE and L2_CLKSTOPPED in AMISC_ADSP_STATUS_0
before asserting ADSP reset in suspend flow.

Standby mode in ADSP L2CC Power Control register should be enabled
so that L2C clock is stopped after all cores enter WFI.

Bug 3700834

Change-Id: I4b89771968dd8b72dfea9920c9125562f8dfa92d
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2759621
(cherry picked from commit 7b819575670eb1e06e510a840977101cae3367be)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765174
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Tested-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-20 15:13:15 +00:00
Akash Kollipara
358498746a nvadsp: app: Dispatch apps on sec-cores
- Updated nvadsp_run_app to accept core ID for pinning app
- For legacy api, apps are pinned to core 0

Bug 3664974

Signed-off-by: Akash Kollipara <akollipara@nvidia.com>
Change-Id: I8f3bcc6a77bb2f912675cfd5af131cdbd36c417c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2738421
(cherry picked from commit 12bcba564e9a570218eab944d4ee8e64074c6be4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2747911
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Akash Kollipara
3a6d714aa7 nvadsp: Added new commands support to adsp console
- Added suspend, reusme and stop abilities to adsp console

Bug 3596981

Change-Id: I867a85130bb2abf7feb5a3a78ebb2b343272a32a
Signed-off-by: Akash Kollipara <akollipara@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2723711
(cherry picked from commit 046f4f8874a1fc8c7af88c44ad08114e489f3302)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2695477
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Uday Gupta
913a409fe5 nvadsp: Don't use ICC in HV
- tegra_icc node is disabled in HV config
- In HV config do not call icc api to register with BW Manager.

Bug 3602082

Change-Id: Ic6d476e3e605fe6b5addc6439045920a10b34e48
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2737892
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Uday Gupta
b7dc4e8302 nvadsp: Add more error logs and fix crash
- Change adds more error logs in case of APP init failure.
- Also potentially fixes the crash issue

Bug 3374437
Bug 3498407

Change-Id: If6baf6e2e11250815cff4a6b8a2abe553e893e34
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2593021
(cherry picked from commit b051fae2faffafbffed99b94914bbd9bc370240f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2731778
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Swati Sachdeva <ssachdeva@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Niranjan Dighe
4bcb44fbf9 nvadsp: adspff: Handle kthread creation failure
kthread_create call may return ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR)
in case of memory allocation failure or if the newly created thread
receives a fatal signal. Handle the conditions by returning and not
attempting to wake up the thread.

Bug 200688338

Change-Id: Ibde3a847202476f52fca38d145091c540ace19c4
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2633986
(cherry picked from commit 4d382d925befd445cddfc10c556d7c06b980b920)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2729780
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: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Uday Gupta <udayg@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
e6c266d6bf nvadsp: Add support for multiple FW
Support is added for launching multiple FW on ADSP (multiple
AMP, or combination of SMP and AMP). CONFIG_TEGRA_ADSP_MULTIPLE_FW
will need to be enabled.

Shared memory is communicated via the respective AHSP for the core.

For front door boot MB2 would have loaded the FW for all the cores.
Carveout allocation should be set as necessary (4x4 MB = 16 MB).

Backdoor boot via SMMU is also supported. Individual core FW for
AMP cores are loaded first, followed by core-0 FW at the end.

CCPLEX<->ADSP communication is limited to AHSP0, so only core-0
(SMP or AMP) will be accessible for command interface or signalling.

Bug 200745833

Change-Id: Ibfddd463de1ecada6fd47944ca12ef0444cd269f
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2722603
(cherry picked from commit 1e08636df25690017b8d7e1818eda210fef6da8b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2701452
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
9bfe26c72d nvadsp: Add chip ID major rev in T239
Extend chip ID in T239 with major revision so that
the value (=0x239) is distinct from T234.

Bug 200688972
Bug 3660611

Change-Id: If00da32ade7aa88f3dc6ba7f59038e5b4710a677
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2720497
(cherry picked from commit 246f43a203714c97b0df7e22e82d976c126b8267)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2725862
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
3325cdc0cb nvadsp: Disable AMC error WAR for T239
Spurious AMC error when accessing address < 0x1000 is fixed
in T239, hence the WAR is disabled for "nvidia,tegra239-adsp".

Bug 200747371
Bug 3580398

Change-Id: I943f4c4c2fa8250b15e6ee73607bb6ecb9d760a3
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2715544
(cherry picked from commit 095ceb378a0e3aa9e54cc1742c59adf897bc1b14)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2690528
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
dramesh
2b0e81df35 audio: nvadsp: copy shared memory iova address
on Non-Secure FW load, incase FW explicitly defined a shared
memory region then ensure IOVA data populated correctly
into shared_adsp_os_data_iova.

Bug 3592962

Change-Id: I6c40f1c691f37fc14f6752759b97942e28c76f43
Signed-off-by: dramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2700117
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@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
2023-06-20 15:13:15 +00:00
Asha Talambedu
b1977843d8 nvadsp: Remove MBOX2 related logic
Replacing mbox2 usage with the help of existing mbox
used for os related communication with host cpu
so that the mbox2 can be used in 128 bit mbox usage

Bug 3581290

Change-Id: Iba750b6cedcc2e7b0c5ab1548e3614d77aaeb729
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2686392
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Akash Kollipara
11c878a96e audio: tegra: nvadsp: Fixed typecast warnings
- Fixed typecast warning
- Updated datatypes to make it compliant with kernel version > 5.10.0

Bug 3528414

Change-Id: Ief5cac399c35786e3f53dbe3199f70881e730df3
Signed-off-by: Akash Kollipara <akollipara@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2682497
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Niranjan Dighe
3fa96a4417 drivers: platform: nvadsp: Fix sparse issues
Fix multiple instances of the following issues -
- warning: incorrect type in argument 2 (different address spaces)
- warning: symbol 'file_size' was not declared. Should it be static?

Bug 3528414

Change-Id: I2cbda8dbfc98b134f36ec3c291a5147d96c6ff82
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2684747
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Uday Gupta
19cf0a1232 nvadsp: Use HWMBOX5 for ADSP OS decompression
There is a decompress_done flag in the adsp OS firmware
that was earlier used to indicate that decompress is done
at the adsp os cold boot

However this flag cannot be part of firmware
as fw needs to authenticated at the sc7 resume as well and
hence the fw should not have modifications

On fw side, the flag is removed. Instead the same information
is preserved across sc7 cycles via HWMBOX5 and this driver
enables the decompress bit to indicate the same to adsp at
cold start

Bug 3491011

Change-Id: I77d1ff6defdf1228f4cd4278cf5bb667df51fad1
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2660706
Tested-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Sharad Gupta
9b526e03db nvadsp: CERT-C Fixes
Fixed for L1 issues :

Return value check for snprintf
NULL pointer check using IS_ERR_OR_NULL

Bug 3512545

CID 407176
CID 429671
CID 471352

Signed-off-by: Sharad Gupta <sharadg@nvidia.com>
Change-Id: Ib03339db8dc669b6eff448941fac62b2feabf7bc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2679048
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Akash Kollipara <akollipara@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@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
2023-06-20 15:13:15 +00:00
Viswanath L
2204b3fe10 nvadsp: Use array bound in loop
Use array bound in loop rather than depend upon a
NULL element to mark the end.

CID: 490319

Bug 3512545

Change-Id: I65c7eeecd41e8cfa3c35e2bbaa059b272b154d70
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2676345
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: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
5616ba82b1 nvadsp: Fix uninitialized access
Access module name from initialized location.

CID: 490698

Bug 3512545

Change-Id: I8b6ece000342b424a3b0e1b0a29fb423d6801f16
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2676344
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: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
77a7ea2c88 nvadsp: Skip ACAST setting if already set
It may be useful at times to boot ADSP via backdoor, even
while system boots via front door. MB2 sets the ACAST in
front door, so ACAST setting from nvadsp driver is skipped
if that region is already enabled.

Above scheme will work for ADSP backdoor boot via SMMU
mapped memory, but not for physical memory, as the underlying
carveout memory is different between frontdoor and backdoor.

Bug 200745826

Change-Id: I718da97e3f06eb86b3e40efab91275f2d5958dd4
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2675786
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Sharad gupta
3ea7c9344c nvadsp: os: CERT-C Fixes
Uploaded fix to address coverity issues.

1. Fix for string assignment to a char ptr (const)
2. Unsigned int type variable to hold AGIC IRQ number
3. Misc. : added error handling for null pointers

Bug 3512545

CID : 407176, 339372, 426068, 349597, 408235,
468432, 425451, 339564, 340901, 360199, 482718,
338388, 434000, 488442, 355983, 437791, 444590,
409920, 423102, 416511, 426540, 392115, 451458,
355042, 443648, 420343, 423532, 488763, 476874,
404805, 380630, 358854, 485375, 483303, 462651,
371708, 465040, 447093, 406990, 335646, 437343,
467012, 378419, 428324, 354351, 460155, 415702,
376737,  390977, 414736, 411426, 393560, 490887

Change-Id: I5c847fa02438931e95107d06333014fb802c8207
Signed-off-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2672112
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
f90d551e16 drivers: nvadsp: Disable MBX empty intr at config
MBOX empty interrupt line is high by default; configuring AGIC line
in this state is undefined behaviour. Fix this by disabling the
interrupt at source and enabling it only after unmasking in AGIC.

Immediately upon unmasking one empty interrupt will be raised, which
must be ignored.

Bug 3432474

Change-Id: I03a26f061bb28b616626bb07153b0263540d7bd9
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2672095
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: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
7835064bc3 nvadsp: Add err check in ADSP ELF string copy
Error check is added to prevent out-of-bound access
when copying ADSP ELF string from DT.

Fixes Coverity defect CID 10132209.

Bug 3461002
Bug 200746669
Bug 200773359

Change-Id: I56beabcf8d78aed560cde523dee0429acd784dc9
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2664843
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: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
a99d68a86e nvadsp: Add provision to specify ADSP ELF name
Provision is added to specify ADSP ELF name from DT, using prop
'nvidia,adsp_elf'. This will be picked from /lib/firmware/ when
ADSP boots in backdoor mode. Default name remains "adsp.elf", if
the prop is not specified.

Bug 200746669
Bug 200773359

Change-Id: Ie5a4ba60fa2c049b7895967326a325257a65bb82
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2662909
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Prateek Patel
35393d7615 drivers: adsp: fix resource leak
Coverity defect: Variable msg_recv going out of scope leaks the
storage it points to. Fix the defect by freeing msg_recv before
return.

CID 31655

Bug 3461002

Change-Id: I350191943d342d33b1d07155ddcc2d875a78f7af
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653460
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Prateek Patel
5efd53d8fb drivers: adsp: fix check_return Coverity defect
Defect: check_return: Calling of_property_read_u32 without checking
return value. Fix the defect by validating the return value.

CID 10129674

Bug 3461002

Change-Id: Idd236fccabc23b789d57c29c126e09391df022dc
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2650556
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Akash Kollipara
0b2760e995 nvadsp: Handles adspff init failure
- Avoids adspff init in non-secure boot mode
 - Avoids boot failure if adspff.elf is absent
   on secure boot mode

Bug 200773359
Bug 200746669

Change-Id: Ib62ce4ecae3434b7c7fde57e8735620976d2a653
Signed-off-by: Akash Kollipara <akollipara@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2641776
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
f5feadcb43 nvadsp: ACAST settings from DT
ACAST settings are expected to be done by the driver in backdoor
boot. Provision is added to read the ACAST address ranges and
the SMMU stream ID from DT.

ACAST settings are done either for physical memory, or for SMMU
mapped memory, as per the backdoor boot configuration.

Also, call to ACAST init function is moved from runtime resume
to device probe.

Bug 200745795
Bug 200746669
Bug 200773359

Change-Id: Ia53820968ce4d48966c39d72b4c2106be99815fa
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2644989
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
cadec46986 nvadsp: AMC error WAR under chip flag
WAR for spurious AMC error when accessing address < 0x1000
is placed under a flag in chip data.

Bug 200747371
Bug 200773359

Change-Id: I6299fe754efbf2f4d6a99252f71ed3140bade1ba
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2639578
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
ac60258ffd nvadsp: Add provision to configure timeout
Provision is added to specify the OS load timeout
from DT, using property "nvidia,adsp_load_timeout".

Bug 200745795
Bug 200746669

Change-Id: Ie868a1528ad9d39200a0359f6a9d54a2832b0547
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2622380
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
8036a9525f nvadsp: Pass platform info to ADSP
Provision is made to pass the Tegra platform information to ADSP
("nvidia,tegra_platform" DT property, as per enum tegra_platform);
this will be useful to convey whether the platform is CMODEL, in
which case the ADSP may take CMODEL specific paths, like using
HSP shared interrupts.

Upper 16 bits of nvadsp_os_args.chip_id is used to convey the
platform information; this may be improved in future as a
separate structure member.

Bug 200745795
Bug 200746669

Change-Id: Ibd9423eebb06fc4d243c132ab1cb7c6dc558ba5e
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2622156
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
3c9d6d8db1 nvadsp: Add support for APE_TKE reset
Add support for APE_TKE assert/deassert alongside
ADSP assert/deassert. This reset may be specified
in the DT with string "ape_tke".

Bug 200736921
Bug 200773359

Change-Id: I3331ec1572057661ea62dc5269288575a0f0364b
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2627992
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Asha Talambedu
f33770d313 tegra: nvadsp: Timeout added on wait for app start
In cold boot stress test, it is observed that adsp OS
hung intermittently(1/276). Due to which
1) app init of adspff is not able to
complete as it does not receive start ack from adsp
2) wdt handler is triggered as adsp is hung for more
than 10 seconds.

When poweroff is issued in such case,
the alsactl save/restore job which is part of shutdown
sequence is hung as its unable to acquire lock held by
host adsp audio driver fn that initiated nvadsp_os_start.

Therefore, timeout is added while waiting for app init.
If app init fails to happen within timeout duration,
error status is received by nvadsp_os_start
which inturn is received by host side adsp audio driver.
This ensures that lock is released in case of adsff_init
failure in nvadsp_os_start function so that shutdown
can proceed without issue.

Bug 3391964

Change-Id: Ieca54fe9dd21bf9de70d781cfaceb5ffe83809ef
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2626892
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
bb93b07676 nvadsp: Pass shared mem via MBX in backdoor boot
In backdoor boot if shared memory region is not defined in the
ADSP FW then assume it to be placed at the start of OS memory
and communicate the same via MBX. In case MBX is not available
then the boot is aborted.

Bug 200745795
Bug 200746669

Change-Id: I15cd4f3f07dd91c2700479906d19b9219814e2f6
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2613565
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
6360f074cf nvadsp: Add backdoor boot via CO memory
Support is added for backdoor boot via CO memory (i.e. no SMMU). To
use this mode, 'nvidia,adsp_os_secload' property should be removed
and reserved-memory:adspos_carveout node enabled.

ACAST mapping in this mode should span the exact CO reserved region.

Bug 200745795
Bug 200746669

Change-Id: I6bbb84d3278db8f69e60933d63a900c2797fc425
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2613521
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Viswanath L
8bbf49a386 nvadsp: Move struct element for alignment
Simulator platforms do not support unaligned access, so
element adsp_freq_hz in struct nvadsp_os_args is reorganized
to make it aligned.

Bug 200745795
Bug 200746669

Change-Id: I053756a52b8baf3ec04cdbc9eb82878fd6531a62
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2612812
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Sahil Mukund Patki
7aae76754e platform: tegra: nvadsp: Fix debugfs compilation error
Fix compilation errors in nvadsp driver seen when disabling
CONFIG_DEBUG_FS

Bug 200755555

Change-Id: Id749b2af4aeb199a58997ea788273b9af31c1682
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2569775
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Viswanath L
fc0faf10ad nvadsp: Set alignment for shared structs
Shared structures nvadsp_app_shared_msg_pool and
nvadsp_shared_mem are aligned using #pragma pack(8)
in order to match the alignment on ADSP side.

Bug 200729844

Change-Id: I541a8a26894e9c5e78f56fa687ca59b905342f23
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2559105
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Asha Talambedu
8f504dc84e nvadsp: Write chip id to h/w mailbox1
Need to communicate chip id info so that ast settings
can be enabled only for t186/t194 from ADSP. Hence,
HWMBOX1 is used to communicate the same

Bug 200684491

Change-Id: If7ae5f58fc410fd7cbb19c9e0129bead8740e88b
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2529141
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00
Ajay Nandakumar
5190a1db72 nvadsp: change chip_id type in shared struct
The chip_id type in shared struct is u8 where as across the adsp firmwares
the chip_id type is of type uint32_t. This causes shared structure sizes
to be different causing firmwares and causes different address of the shared
struct variables when accessed from the Host and the adsp firmware.

Bug 200692666

Change-Id: I6ad23f021f64458d87596b9d6c47c9df38e3689b
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2524414
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-20 15:13:15 +00:00
Bitan Biswas
56135207fa platform: tegra: nvadsp: fix external build
Fix build errors in external build due to unavailable headers

bug 200705253

Change-Id: Ic4627681a9dee0e47d2da57d4247274b150928f5
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2503918
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Ajay Nandakumar M <anandakumarm@nvidia.com>
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-06-20 15:13:15 +00:00