Commit Graph

321 Commits

Author SHA1 Message Date
Viswanath L
ffdc1ff5c6 nvadsp: Use platform_get_irq to get IRQ num
Use platform_get_irq() instead of platform_get_resource()
to read IRQ num from DT, as platform_get_resource() is not
recommended to read IRQ early in the boot.

Bug 4164138
Bug 3682950

Change-Id: I117e608e6ae798aa2932a3a41f7942a741d3ff9c
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983098
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:18 -07:00
Viswanath L
21a60d1ca1 nvadsp: Load apps only if msgq is initialized
Load static apps only if shared memory is provisioned
and ADSP firmware has initialized message queue.

Bug 4164138
Bug 3682950

Change-Id: I86a9292d8d5f2949595c9a701f0565a9644f3d9a
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2930212
(cherry picked from commit 396b05637869ab2f49e8f3b3358fb9298ba96ae5)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971982
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:13 -07:00
Viswanath L
6815f07e8f nvadsp: Restrict ICC API to T23x
Restrict call to icc_get API to T23x family of chips.

Bug 4164138
Bug 3682950

Change-Id: Ie4140b38661dcfd050305c7cdbbbc8c14031bbe7
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2930170
(cherry picked from commit 92e6565e02b32159469ff7562f75fd36c28f7f9d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971981
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:07 -07:00
Viswanath L
e2b06959b7 nvadsp: Generic changes for chip extensions
Below changes are made to support future
extensibility for new chips:

 - Chip data field 'adsp_prid' is added to specify DSP ID
 - Chip data field 'adsp_elf' is added to specify ELF file name
 - DT property "nvidia,cluster_mem" is added to specify cluster
    internal memories; ELF segments will be loaded into these
    using intermediate shadow buffers so that unaligned access
    is avoided
 - "nvidia,adsp_mem" entries are made optional (0x0 in the size
    field will indicate bypass)
 - Chip extension functions 'set_boot_vec' and 'set_boot_freqs'
    are added to support chip specific settings

Bug 4164138
Bug 3682950

Change-Id: I538ae0df57fa199a6eef75441167a9a5ba6924e8
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2894321
(cherry picked from commit fa7fc9d08af5fab9d0b2c5eb1b9b9a78446ade0e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971980
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:02 -07:00
Viswanath L
d5138e1c58 nvadsp: Fix build issues and enable
Fix build issues for nvadsp in OOT kernel and enable the build.

 - Below files copied from kernel/nvidia/include/linux/
    - tegra_nvadsp.h (72af3e78a6aff0fa250e9fd36b8414264d0e4c9a)
    - tegra-firmwares.h (700223e52f49f300664dd91335fa11111af733aa)
    - tegra-hsp.h (988be8f05033e1d728e046e918b506d829106082)
 - Below file copied from kernel/nvidia/include/uapi/misc/
    - adsp_console_ioctl.h (72af3e78a6aff0fa250e9fd36b8414264d0e4c9a)
 - Functions that needs additional AGIC APIs not supported in upstream
    are pushed under macro CONFIG_AGIC_EXT_APIS
 - T210 chip_data and references removed

Bug 4164138
Bug 3682950

Change-Id: I5dfb570e578ca3631896de7350cea66698612568
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971924
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:09:57 -07:00
Viswanath L
119c4f87e2 nvadsp: Update license and remove kernel ver check
- Update license of all files in nvadsp that will be used
 - Remove kernel version checks in the code

Bug 4164138
Bug 3682950

Change-Id: Ie1f9ba95c1d46c3dd9bc5614e502b1b444484df6
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2980528
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:09:52 -07:00
Jon Hunter
cdc64f43fa drivers: Drop version check for DMA BUF namespace
The MODULE_IMPORT_NS macro adds a namespace tag to the module
information. The DMA_BUF namespace is required for Linux v5.16+ kernels
for drivers that use DMA BUF, there is no reason not to populate this
for earlier kernels. Furthermore, some 3rd party kernels prior to v5.16
may require this too and so drop the version check around the DMA BUF
namespace.

Bug 4119327

Change-Id: If8a5e90340f7a0582247cb91611d275ec1f4990e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2979260
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-13 22:21:25 -07:00
Shardar Mohammed
4be2dd36bb nvidia-oot: remove module * from class_create()
Remove the module pointer from the class_create() based
on following change in core kernel

======
driver core: class: remove module * from class_create()

The module pointer in class_create() never actually did anything, and it
shouldn't have been requred to be set as a parameter even if it did
something.  So just remove it and fix up all callers of the function in
the kernel tree at the same time.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
=====

Bug 4276500

Change-Id: Ifa0a92a282151ce12dc4a48f4f4b5b9499d3fbd8
Signed-off-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2976600
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-08 18:09:50 -07:00
Mahesh Kumar
4ded4286d6 platform: dce: prevent dce driver unloading
DCE-KMD driver does not support reloading of the driver today.
Support will be added in the future.

As a WAR this patch prevents unloading of the driver.

Bug 4239420

Change-Id: I29f60fbaaf99f5f4e22f75b6674bd1a543b83c1a
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2968906
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Vinod Atyam <vatyam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Vinod Atyam <vatyam@nvidia.com>
2023-09-06 17:05:13 -07:00
vinodg
d49cb5b97d drivers: dce: Increase the HSP max count
Increase the hsp index max count to 3

Jira TDS-13541

Change-Id: Ic74eae415a14f5ccb34fc079062e00bc83a3e03a
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2948232
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-31 05:34:45 -07:00
pshaw
01ecacf7b4 fsicom: add fsicom multi core support
- smmu and hsp support added for fsicom multi core
  feature in fsicom kernel driver
- probe, suspend and resume will be called for smmu_inst
  0 only as it will have single dev node for comm.
- mailbox 2,5 and 1,4 is used for TX and RX comm. respectively
  with FSI

Jira SS-5744

Change-Id: I859d5945853195ba76996a8c36ca19efd9c4409f
Signed-off-by: pshaw <pshaw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2952268
Reviewed-by: Praveen James <pjames@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-27 21:50:21 -07:00
Jian-Min Liu
6f90c6d858 Fix unused function errors for ack user build
In Android's user-build, debugfs is not configured. This has led to
multiple warning errors related to Debugfs usage in the nvidia-oot
build. Add CONFIG_DEBUG_FS conditional compilation around the
functions that use it.

drivers/scsi/ufs/ufs-tegra-common.c:39:13: error: unused function
'ufs_tegra_init_debugfs' [-Werror,-Wunused-function]
static void ufs_tegra_init_debugfs(struct ufs_hba *hba)
            ^
 1 error generated.

drivers/platform/tegra/aon/tegra-aon-debug.c:732:13:
error: unused function 'tegra_aondbg_recv_msg'
[-Werror,-Wunused-function]
static void tegra_aondbg_recv_msg(struct mbox_client *cl, void *rx_msg)
            ^

drivers/platform/tegra/aon/tegra-aon-debug.c:749:12:
error: unused function 'aon_dbg_init' [-Werror,-Wunused-function]
static int aon_dbg_init(struct tegra_aondbg *aon)
           ^
 2 errors generated.

Bug 4230728

Change-Id: I4210c3574b4d76205fdca45990e9ccc02c18620a
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2964635
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-08-23 11:19:18 -07:00
Ashish Mhetre
4a11641e79 platform: tegra: Fix MC-HWPM driver
Simplify the MC-HWPM driver and fix the hang seen during probe of it.
These changes are made to scale the driver for future SOCs as well.
The hang is seen because MC registers are accessed in function
get_platform_dram_num_channels() before the MC aperture is io-mapped.

Bug 4235766

Change-Id: I3c8f9229898ac459c616aca0ef400a8b4c16e66a
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2963195
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-20 17:44:08 -07:00
Jian-Min Liu
7bcd11a009 Avoid function re-definition when FS_DEBUG is not set
add FS_DEBUG to the implementation function to avoid re-definition
build error caused by FS_DEBUG is not set with ack user build.

Bug 4230728

Change-Id: I0c1d4357ec86f030b386f65cd32bed87b2382557
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2952839
Reviewed-by: Kevin Kuo (SW-GPU) <kevkuo@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-17 20:19:17 -07:00
Aniket Bahadarpurkar
3b116f7c1a tegra: rtcpu: use separate thread for reading ivc
Using global work queue and its associated worker
pool to read IVC messages from RTCPU may lead to
capture timeouts if the worker thread is not able
to get cpu due to other higher priority threads in
the system. Hence use a separate RT thread to read
IVC.

Notes for nvidia-oot: 

Use low fifo priority for worker threads to avoid
pre-empting the interrupt thread serving the HSP
driver.

Bug 200643334
Bug 3293029
Bug 3291799
Bug 4084364

Old-Change-Id: I5a3e749ec46fac1c7a2de74968169443f5cab939
Signed-off-by: Aniket Bahadarpurkar <aniketb@nvidia.com>
Signed-off-by: Pekka Pessi <ppessi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2689827
(cherry picked from commit 18d670accc7960b0afbc7b58b339a323e424e010)
Change-Id: I48e22606e53d934d3788d524fd1f496d0f92a04a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2939796
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Viktor Horsmanheimo <viktorh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Kalle Jokiniemi <kjokiniemi@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
Tested-by: Viktor Horsmanheimo <viktorh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-25 15:26:25 -07:00
Jon Hunter
926a606226 platform: tegra: rtcpu: Fix frame-size warning
Building the Tegra RTCPU driver generates the following warning ...

 drivers/platform/tegra/rtcpu/tegra-rtcpu-trace.c:
  In function ‘rtcpu_trace_exceptions’:
 drivers/platform/tegra/rtcpu/tegra-rtcpu-trace.c:331:1:
  error: the frame size of 1424 bytes is larger than 1024 bytes
  [-Werror=frame-larger-than=]
  331 | }
      | ^

Allow the frame size to be 2048 bytes to resolve the warning while a
proper fix is implemented.

Bug 4190165

Change-Id: Id684711f036fce759d7a328ad7d63f754a9b46e0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938377
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-19 08:47:13 -07:00
Jon Hunter
b970ad45ec platform: tegra: dce: Remove unneeded warning flags
The Tegra DCE driver compiles fine without the GCC flags to disable
specific warnings and so remove these to catch any new warnings that get
introduced that might be missed with these flags in place.

Bug 4190165

Change-Id: I4f2d445588baecec89ca9ba979e5d8febe39cf3c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938374
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-19 08:46:58 -07:00
Jon Hunter
69b4420809 platform: tegra: Remove actmon driver for Tegra194
The tegra-cactmon driver is only used for Tegra194 and given that the
out-of-tree drivers are only supported for Tegra234 and newer devices we
can remove this driver.

Bug 4174107

Change-Id: I152e8119b5c179f2d75771c1af2eb5d5f865ccbc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2927995
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-14 20:19:11 -07:00
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