Commit Graph

2635 Commits

Author SHA1 Message Date
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
Yi-Wei Wang
5d14eb10df nvpmodel: Remove legacy nvpmodel-emc-cap driver
The driver has been switched to nvpmodel-clk-cap so remove legacy
nvpmodel-emc-cap.

Bug 3997304

Signed-off-by: Yi-Wei Wang <yiweiw@nvidia.com>
Change-Id: Ic11c29b8cb360b8d591ed94db74ba3f12663f068
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921042
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-21 13:25:26 -07:00
Laxman Dewangan
ec337ed89b nvadsp: Merge nvadsp from kernel/nvidia to kernel/nvidia-oot
Merge remote-tracking branch
   'origin/dev/ldewangan/nvadsp-from-nvidia' into
    nvadsp-oot-dev-main

Bug 4164138

Change-Id: Ia4e652c86267667320351db3a0ec787e4e85854b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-06-20 22:34:30 -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
Jon Hunter
e4f4ae06b6 arm64: tegra: Update Jetson overlay for Linux v6.3
Commit 2838cfddbc1c ("arm64: tegra: Bump #address-cells and
#size-cells") updated the address-cells and size-cells for the bus@0
node to be 64-bits. Update the Tegra194 Jetson overlay to work with the
latest upstream device-tree.

Bug 4075345

Change-Id: Iabed119515adade6614ee80f74b42181e3af1729
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2920655
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-20 15:08:22 -07:00
yashi
bf473bccc0 Add the missed code snippet back
There is a code discrepency between bring-up branch
and dev-main branch. A code snippet is missed in the
dev-main branch causing semover test failure.
This patch adds it back

Bug 4156918

Change-Id: I4347176cf3e5ab8214428247620e4cb6fbf4f511
Signed-off-by: Yang Shi <yashi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921008
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Carl Dong <carld@nvidia.com>
Reviewed-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-20 08:37:04 -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
Mohan Kumar
4464d26007 nvadsp: Add Interconnect support for ADSP
Add Interconnect API support for ADSP Memory bandwidth requirement
handling.

From Kernel 4.14 and beyond
- On T23X and newer platforms, the interconnects driver will be initialized
  and calls to BWMGR will be stubbed out.
- On T194 and earlier platforms, BWMGR driver will be initialized and calls
  to interconnect framework will be stubbed out.

Added code check with K5.9 as mc_utils.h header is present from K5.9 build

For Kernel 4.9 and earlier

- T23x will not be supported.
- T194 and earlier platforms will use BWMGR. Interconnect framework is not
  available.

JIRA TAS-1060

Change-Id: Ie0b4040f374a3c6102cb7aff2506d8cf2f0eab69
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2414369
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@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
Sameer Pujar
3b69d4961c nvadsp: Convert to set_sched_fifo*() for v5.9
While enabling 'CONFIG_TEGRA_ADSP_FILEIO' following build error
is seen with v5.9-rc4 build.

 ERROR: modpost: "sched_setscheduler" [drivers/platform/tegra/
   nvadsp/nvadsp.ko] undefined!

This happens because sched_setscheduler() export is removed with
commit 616d91b68cd5 ("sched: Remove sched_setscheduler*() EXPORTs")
in upstream. The reason for removal is below.

Upstream commit 7318d4cc14c8 ("sched: Provide sched_set_fifo()")
provides sched_set_*() functions and suggests to convert existing
sched_setscheduler_*() calls to sched_set_*(). As per this
following updates are made for ADSP driver to work for v5.9.

  - Use sched_set_fifo() whenever a high priority is required.
    (However by default priority is set to MAX_RT/2)
  - Use sched_set_fifo_low() whenever priority needs to be above
    SCHED_NORMAL.

Since it is a recent change in upstream kernel above changes are
not applicable for previous kernels (v4.14 and v4.9). Hence these
can continue to use existing calls. Thus above changes are protected
under kernel version checks.

Bug 200657500

Change-Id: I763fb7d1461e23e1eeb26d7c49a295172450e54d
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2417919
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@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
Sameer Pujar
86b6ccfd04 nvadsp: fix v5.9-rc4 build error
After v5.9-rc4 merge in dev-main-5.9 many build errors are seen with
ADSP config CONFIG_TEGRA_ADSP_LPTHREAD. Some of these build errors
are listed below.

* kernel/nvidia/drivers/platform/tegra/nvadsp/adsp_lpthread.c:15:0:
  kernel-5.9/include/linux/uaccess.h: In function ‘force_uaccess_begin’:
  kernel-5.9/include/linux/uaccess.h:20:2: error: implicit declaration
      of function ‘set_fs’; did you mean ‘get_fs’?
      [-Werror=implicit-function-declaration]
      set_fs(USER_DS);
      ^~~~~~

* kernel-5.9/arch/arm64/include/asm/uaccess.h: In function
      ‘__uaccess_mask_ptr’:
  kernel-5.9/arch/arm64/include/asm/uaccess.h:240:41: error: invalid type
      argument of ‘->’ (have ‘int’) : "r" (ptr), "r"
      (current_thread_info()->addr_limit),
                            ^~

  ...

The errors appear to be related to 'uaccess.h' header and following
inclusion order is causing build failures for some reason. Checked with
other source files with below and same behavior is seen.

  #include <asm/uaccess.h>
  #include <linux/uaccess.h>
  ...

Issue goes away after replacing 'asm/uaccess.h' with 'linux/uaccess.h'.
It should be noted that latter header by default includes the former one.
For consistency this is done for other relevant ADSP files too.

Bug 200657500

Change-Id: I7ce98c46327a825711c4fa9ab791afc65b1cbf1b
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2417265
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Uday Gupta <udayg@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