Commit Graph

16 Commits

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

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

Bug 4167219

Change-Id: Id9b9047fa0e293f8616e23a5c8b4b1bacf233934
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2927740
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-12 19:00:52 -07:00
Laxman Dewangan
b20c5f57e3 dce: Use SPDX license GPL 2.0-only format
Use SPDX license GPL-V2.0 format and change Nvidia
copyright year to include 2023.

Bug 4078035

Change-Id: Icc0060431eb8d9c470a44f4cee50913cc1d8048a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890656
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-21 11:41:56 -07:00
Mahesh Kumar
1258e71941 platform: dce: fix wait race condition
It is possible that we received the ACK from DCE even before we
start waiting. But currently we are clearing the "complete" state
before start waiting, which may result in missed interrupt.

This patch removes the clearing of complete state before wait.
Also Adds few comments for better understanding.

Bug 3941557

Change-Id: I7d2efb1a64eb6f2d4df1876add07a8f019b449f5
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2845498
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
387a379024 platform: dce: add wait in ipc registration
If DCE bootstrapping is not complete, client registration may fail or
result in IPC failures.
Wait for bootstrapping to complete before registering any IPC-Client.
Use high priority work queue to schedule bootstrap work.

Bug 3583331
Bug 3826630

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I0facfe225e1550c795c2de7b42916416faa3bcaa
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834857
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824219
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
75bfcf326d platform: dce: Add suspend resume hooks
Add suspend resume hooks function and handling of sc7 events.

Bug 3583331
Bug 3826630

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I920b02ad46a76330febe666fe17e8d328f744b1d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834856
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824218
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>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
a42af2d0ad platform: dce: Coverity Fix
Fix Coverity issue CID 10138164
Create new macro to avoid non-reachable code.

Bug 3461002

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Ie5ff50678e30ae0ddd712ceda212f4b572ce624e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765168
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: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
8ef1f2db87 platform: dce: FSM incremental fixes
This patch addresses design review comments for FSM
 - Add comment to update design doc on FSM update
 - Create wrapper function to check bootcmd complete status
 - move bootstrapping functions to dce_bootstrap.c file
 - Fix sw resource init/deinit function name

Bug 3583331

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I77f05135f7ec1882922907f8acef50def639d26d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2758902
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
28a1cfd1c1 platform: dce: reworked dce FSM design
Redesign DCE KMD drive state machine to handle new PM events.

Bug 3583331

Change-Id: I89adcfa2f311a9a1e86b70e14821468203365266
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2673665
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Adeel Raza
048b473d86 platform: tegra: dce: fix worker deadlock
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
2023-04-14 19:23:43 +00:00
Mahesh Kumar
4653b0d74e platform: tegra: dce: Admin rpc post boot support
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>
2023-04-14 19:23:43 +00:00
Manish Bhardwaj
42e6775484 tegra: platform: dce: use mutex_lock API properly
Improper use of mutex_lock API is leading to below crash with
rt kernel, this patch fixes the below crash.

dce: dce_req_boot_irq_sync:70   Waiting on dce fw to boot...
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current)
WARNING: CPU: 0 PID: 126 at /dvs/git/dirty/git-master_modular/out/
aarch64-arm64-tegra_defconfig-rt_patches-debug-extmod_ubuntu18.04_aarch64
-extmod_linux_x86_64/kernel/src-rt/kernel-5.10/kernel/locking/
rtmutex-debug.c:47 debug_rt_mutex_unlock+0x5c/0x68
 Modules linked in:
 CPU: 0 PID: 126 Comm: dce_worker_thre Not tainted 5.10.17-rt32-tegra #2
 Hardware name: t234pre_si (DT)
 pstate: 00800089 (nzcv daIf -PAN +UAO -TCO BTYPE=--)
 pc : debug_rt_mutex_unlock+0x5c/0x68
 lr : debug_rt_mutex_unlock+0x5c/0x68
 sp : ffff8000137fbc90
 x29: ffff8000137fbc90 x28: 0000000000000000
 x27: 0000000000000000 x26: ffff800012241180
 x25: ffff000082b7e090 x24: ffff800010e781d0
 x23: 0000000000000000 x22: ffff8000137fbd18
 x21: ffff8000137fbd08 x20: 0000000000000000
 x19: ffff000082b7e0b8 x18: ffffffffffffffff
 x17: 00000000000000c0 x16: fffffe0001eadf40
 x15: ffff800011e6f988 x14: ffff8000937fb817
 x13: ffff8000137fb825 x12: 2065756c61562020
 x11: 0000000005f5e0ff x10: ffff8000137fb770
 x9 : ffff8000137fbc90 x8 : 4e5241575f534b43
 x7 : 000000000000001f x6 : ffff80001224a65c
 x5 : 00000000ffffe163 x4 : 00000000ffffe163
 x3 : ffff800011f3ba50 x2 : 0000000100000001
 x1 : 0e62cf1b356d1e00 x0 : 0000000000000000
 Call trace:
  debug_rt_mutex_unlock+0x5c/0x68
  rt_mutex_slowunlock+0x38/0x98
  rt_mutex_unlock+0x5c/0x98
  __rt_mutex_unlock+0x20/0x30
  _mutex_unlock+0x20/0x30
  dce_worker_thread_wait+0x88/0x300
  dce_wait_boot_complete+0x74/0x118
  dce_worker+0x24/0x1c8
  dce_thread_proxy+0x20/0x30
  kthread+0x194/0x1a0
  ret_from_fork+0x10/0x18
 ---[ end trace 0000000000000001 ]---

JIRA ESLC-5710

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I0a67b4792515ca8212dc4a3b34ead5bde9f94f49
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2499983
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Arun Swain
ea84c95dbf tegra: platform: dce: Fix race condition on fgpa
Resolve race condition where DCE Firmware could
potentially send an IVC signal before even CPU
driver starts listening for it.

This fix makes sure that the driver need not wait
if it has been signalled already by Firmware.

Jira TDS-6381

Change-Id: I3d6dd1f93ce36f9e44b7157f70c0aad099f2d561
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2394468
Tested-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
ef3f18c398 tegra: dce: suppress unnecessary info logs
This patch removes unnecessary dce_info prints to avoid flooding of uart
logs.

JIRA TDS-5691

Change-Id: I9c9a32815e685504b443f24483502fe019ac0eaf
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2375553
Reviewed-by: Automatic_Commit_Validation_User
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>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
dc3e980731 tegra: dce: Add debugfs node to show boot status
This patch adds a debugfs node to show DCE boot status.

It also adds following dce boot marker in logs
  - DCE_BOOT_DONE
  - DCE_BOOT_FAILED

JIRA TDS-5691

Change-Id: Iada5c1234e5e5f1a5e7afd88dcb94c2da6a3fe1c
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2361287
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
91c35f09be dce: avoid kmsg flooding with info print.
If dce is not initialized dce-driver prints a print every second.
This patch removes the print as we already have debug node
to check the dce-boot status.

Change-Id: I25a8830dce6a61eef122b58fc211b53c2bb04cd4
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2352003
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Arun Swain
606f03fbf2 platform: tegra: dce: add dce kernel driver
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>
2023-04-14 19:23:43 +00:00