Dereference after null check for pointers cl and handlep. Add a null
check before referencing cl and handlep.
Check return value of request_firmware for error.
Using uninitialized value event when calling dce_worker_thread_wait.
Add EVENT_ID_DCE_INVALID_EVENT and have a check before using the
value event.
CID 10127898
CID 10127999
CID 10127954
CID 10127811
Bug 3461002
Change-Id: If00ece28fd52e495b3a8d3eec7bdb4825d3c7892
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2661588
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: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
There is race condition in driver when in_use variable
is accessed in both interrupt context and process context
to schedule a workitem in workqueue. When it is reproduced,
following error message is printed in kernel log.
dce: dce_client_schedule_event_work:359 Failed to schedule Async event
Queue Full!
- This change make sure to check for in_use variable in
interrupt context before scheduling a workitem in workqueue and also
uses atomic operations for usage of in_use variable.
- This also removes unreachable code in driver.
Bug 3454371
Change-Id: I68ce3cd17769ec837a895a4147ae042e2730ae58
Signed-off-by: David Yu <davyu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2636749
(cherry picked from commit b8935cf34edb52b9803dae3ace767b116b8adbef)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2637714
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
currently dce_client_ipc_wait_rpc function waits with
"wait_event_interruptible". And if process is interrupted, it leads
to RPC failure as "dce_ipc_send_message_sync" will try to read RPC msg
when there is no msg to read yet.
This CL make change to restart/retry wait if condition variable is not
signaled by "dce_client_ipc_wakeup"
Bug 200771402
Change-Id: I8f1c7781bab8b6c20b05251cc2862ad2db22cc1f
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2600849
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
The file dce-debug.c is only used when CONFIG_DEBUG_FS is enabled.
Compilation errors occur when CONFIG_DEBUG_FS is disabled.
Moreover the function "dce_init_debug" is defined in dce-debug.c.
Since compilation of this file only occurs when debugfs is enabled,
the declaration of the function should only be done when debugfs is
enabled.
This patch fixes the compilation errors by compiling the above
mentioned file only when debugfs is enabled. Also the declaration of
"dce_init_debug" is guarded by CONFIG_DEBUG_FS since it is only used
when debugfs is enabled.
Bug 200755555
Change-Id: I0077e0c7a722ed515b0bcdfdd82c94a371f5aae3
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2583640
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
For the BOOT_COMPLETE event the worker thread was immediately returning
in an error case without releasing the worker lock. This causes a
deadlock for the next worker event that has to be processed because the
worker lock can't be acquired. Fix this bug by not returning immediately
in the error case. Instead break out of the switch case block and
release the lock at the end of the function.
JIRA TDS-6380
Change-Id: I468098a37ac8f5f6f7459b84d590b989585075e3
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2552228
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Current code assumes no RPC message on Admin-channel post boot. So
- Admin RPC reply post-boot are not passed to the process issuing the
RPC instead expect dce_worker to handle the reply.
- dce_worker doesn't wait for > 1 RPC reply from DCE-Core post boot.
This patch Adds support to send RPC over Admin channel post boot and
also adds support to wake-up the process issued RPC and waiting for
reply.
JIRA TDS-6381
Change-Id: Ifa85f8686c4aee86eb8efc69f85e552ca6f605c5
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2500788
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
In current code RPC ack events are handled by thread issuing RPC but
Async-IPC events are handled in the bottom-half with interrupt disabled.
This may delay delivery of RPC ack if async-IPC handling is hogging the
CPU. It can also lead to a race condition where the RPC caller takes
the lock, issues a RPC and waits for a reply. And in-between KMD receives
an Async IPC and wants to take the same lock.
As IPC code is running with interrupt disabled, RPC-reply interrupt will
not be notified and will result in a deadlock.
This patch creates a Workqueue to handle Async IPC events.
JIRA TDS-6381
Change-Id: If7d69ef50298ad9364e9e494a32cf483ecfb744e
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2485764
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Re-organize IPC channel reset and mailbox interrupt handling code to
fix race condition where KMD was receiving new msg from DCE while
processing previous msg and clearing mailbox interrupt as part of it.
which was causing wait_for_ipc to get stuck.
JIRA TDS-6381
Change-Id: Ibd6ab1758d9b5b2e3709a03dadbc84f2585653a4
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2460641
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
For T23x, we have a separate R5 based cluster
named as Display Controller Engine(DCE) to run
our Display RM code. This driver will run on CPU
with the following functionality:
Via debugfs for test and bring-up purposes:
1. Reads the DCE firmware image into DRAM.
2. Sets up DCE AST to cover the DCE firmware image.
3. Sets up R5 reset vector to point to DCE firmware
entry point
4. Brings DCE out of reset
5. Dumps various regsiters for debug
In production env:
1. Manages interrupts to CPU from DCE
2. Uses bootstrap command interface to define Admin
IPC
3. Locks down bootstrap command interface
4. Uses Admin IPC to define message IPC
5. Uses Admin IPC to define message IPC payload area
6. Uses Admin IPC to set IPC channels
6. Uses Admin IPC to define crashdump area
(optional)
7. Provides IPC interfaces for any DCE Client running
on CCPLEX including Display RM.
8. Uses Admin IPC to set logging level (optional)
This patch puts a framework in place with the
following features :
1. Firmware Loading
2. AST Configuration
3. DCE Reset with EVP Programming
4. Logging Infra
5. Debugfs Support
6. Interrupt Handling
7. Mailbox Programming
8. IPC Programming
9. DCE Client Interface
10. Ftrace Support for debug purposes
Change-Id: Idd28cd9254706c7313f531fcadaa7024a5b344e7
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2289865
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
local variables size is more then recommended values leading
to compilation warning. So usign this patch we are fixing
below compilation warnigs:-
nvidia-oot/drivers/crypto/tegra-nvvse-cryptodev.c:
In function ‘tnvvse_crypto_dev_ioctl’:
nvidia-oot/drivers/crypto/tegra-nvvse-cryptodev.c:2103:1:
warning: the frame size of 2224 bytes is larger than 2048 bytes
[-Wframe-larger-than=]
Bug 4064812
Change-Id: Ie5f0489c9733451f9a132e146790a18d3dd4d6f9
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2887287
Reviewed-by: Ashutosh Patel <ashutoshp@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
The DLA fuses are not exposed via nvmem for upstream Linux kernels and
so when booting upstream Linux kernels the following warnings are seen
for DLA:
nvdla 158c0000.nvdla1: nvmem_cell_get error -2. Assuming DLA instances
are available
nvdla 15880000.nvdla0: nvmem_cell_get error -2. Assuming DLA instances
are available
Disabling DLA instances for devices that don't support DLA is handled by
the bootloader and so for Linux kernel's greater than v5.10, it is not
necessary for the kernel driver to check this.
Bug 3795915
Change-Id: Icbd5e7c522a66a827fe1ed58ed2271a98497bbcd
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2870158
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@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: Ken Adams <kadams@nvidia.com>
Reviewed-by: Mitch Harwell <mharwell@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
[1] For the OOT, there are no implementations for the prepare_suspend,
suspend, resume and complete_resume from the nvhost.
[2] This commit decouples the DLA dependency on the nvhost for the
suspend and the resume operations.
Bug 3977752
Bug 3978072
Change-Id: Ie8ae9d29873559e1c76331294e4c7dfd0ccf0237
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2857153
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
[1] When the multiple clients try to ping at the same time, the
KMD errors out for all clients except one. This behavior
is expected since there is only one command memory and the
KMD errors out when that memory is busy.
[2] This commit fixes the issue by synchronizing the ping operations
across all the clients by introducing a lock.
[3] Alternatively Increasing MAX_COMMANDS_PER_DEVICE will work but
not optimal since,
- the ping is an INIT mode operation.
- the ping operation is inexpensive => the memory is immediately
available even if locked.
- the overall memory allocation will increase.
Considering the use case is rare, the synchronization of ping across
multiple clients is preferred.
Change-Id: I012efd18554a85bb31b79b98bf83386b37251d32
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2813197
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: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Ken Adams <kadams@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
When nvdla driver is build as OOT module, it is required
to set the following config.
CONFIG_TEGRA_GRHOST_NVDLA := m
CONFIG_TEGRA_HOST1X_NEXT := m
CONFIG_TEGRA_FUSE_UPSTREAM := y
Set these config when CONFIG_TEGRA_OOT_MODULE is set.
Bug 3583604
Change-Id: I309db8493a90572e58dcf9f95d1fc1b9ccc47d18
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2715740
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit
Some 3rd party Linux distributions, set the kernel configuration option
"CONFIG_FRAME_WARN=1024" which will causes the compiler to generate
compilation errors when a functions stack frame size exceeds 1024 bytes.
When compiling the DLA driver on Fedora the compilation fails with the
following errors.
drivers/video/tegra/host/nvdla/nvdla.o] Error 1
drivers/video/tegra/host/nvdla/nvdla_ioctl.c: In function ‘nvdla_emu_task_submit’:
build/drivers/video/tegra/host/nvdla/nvdla_ioctl.c:918:1: error: the frame size of
1456 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
drivers/video/tegra/host/nvdla/nvdla_ioctl.c: In function ‘nvdla_submit’:
drivers/video/tegra/host/nvdla/nvdla_ioctl.c:1118:1: error: the frame size of 1440
bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Fix this by copying the user tasks from userspace one at a time and
allocating the structure nvdla_emu_task dynamically so that is it not
allocated on the stack.
Bug 3524939
Change-Id: If752423a170c46efd9b6cffc458a7c1db1984afe
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2694097
Tested-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
Reviewed-by: Praveen K <kpraveen@nvidia.com>
GVS: Gerrit_Virtual_Submit