This is for avoiding kernel hang when DCE FW fails to respond.
Failures of IPC call will return -ERESTARTSYS or -ETIMEOUT, which
will be handled by caller functions:
1. tegra_dce_client_ipc_send_recv (EXPORT_SYMBOL)
This is module export symbol and caller have the responsibility
of checking return value.
2. DCE FSM event handler
Error return will change back to previous state.
DCE_IPC_TIMEOUT_MS_MAX is set to 10000[ms]
SHA computation time on SC7 entry request can go up 2sec.
Host tolerance time must be larger than this.
Jira TDS-16567
https://nvbugspro.nvidia.com/bug/5335034
Change-Id: I5d77a9497f14f305d07b98e39a58fbcecafedf92
Signed-off-by: charliej <charliej@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3358620
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
(cherry picked from commit 6c2ab3c78ce7cba0e88455b263d51d1a88c03927)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3402917
Add support to the bootstrap command over the admin channel,
which will be called when a client registers. This command will
perform steps that must be performed only after the client is ready.
TODO: This bootstrap-2 command will be replaced by the existing
bootstrap command which we call during DCE-FW bootstrapping once
we split admin bootstrapping and RM bootstrapping in the DCE-KMD.
Jira TDS-17135
Change-Id: I55330b9ce73e1acf20e2a80d392d7984c91ed65f
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3274949
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
- dce-os-worker.c/.h module exposes functionality which allows
DCE KMD clients to wait/signal events.
- The current abstraction of this module has following drawbacks
which this change attempts to address:
* Name: dce-os-worker is a misnomer
- Rename to dce-wait-cond.c/.h and make it a dce-kmd core file.
- Rename functions accordingly.
* dce-os-worker module initializes data structures from tegra_dce
which makes it ineligible for re-use.
- dce-client-ipc can re-use this module as it uses exact
same functionality.
- But this module is tied with DCE-KMD core such that it has
functions that operate on fixed known inputs.
- dce_os_work_cond_sw_resource_init/deinit()
Inits/Deinits most but not all condition var resources
from tegra_dce. Eg. dce-client-ipc resources
are not initialized.
- Move this function to new core file:dce-waiters.c
- All other functions require msg_id as input and can only
operate on DCE_WAIT* resources making it ineligible
to be used by other clients like dce-client-ipc.
- Refactor these fucntions to operate on
individual wait conditions so that all DCE-KMD
core modules can reuse them.
- Additionally, this change will also remove unused functions
and macros from dce-os-cond.c/.h
- dce-client-ipc will also switch to use dce-wait-cond interface
for client ipc waits.
- Make dce-os-cond.h a common file and move OS specific impl
to dce-os-cond-internal.h
JIRA TDS-16581
Change-Id: Ie8c6ec724e48cde66917fab4aa43e7da464ef8fb
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3258562
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
- This change will remove linux nuances from dce-client-ipc.c
file and make it a core DCE-KMD file agnostic to OS.
- To do that, dce-client-ipc module will repalce linux specific
nuances for work queue related functionality with
dce-os-work module.
- Further to support existing dce_client_ipc asyn callback function
we need to make worker queue more generic by allowing clients
to pass any data of their choice as data param to the
callback function.
- Also take this opportunity to make following functions static:
- dce_resume_work_fn()
- dce_bootstrap_work_fn()
JIRA TDS-16581
Change-Id: I741b8675dd67ef932ee462e16cad016cbe8b7e2c
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3257808
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
- This is pre-req to make dce-client-ipc.c a core file and use
it for HVRTOS as well.
- dce-client-ipc.c uses worker queues today to manage async events.
But instead of using existing dce-os-work abstraction it
directly uses linux structs/calls.
- Current dce-os-work abstraction cannot be used as is for
dce-client-ipc.c as it only allows scheduling work
to system hipri work queue. But dce-client-ipc creates
and schedules work to a new worker queue.
- To allow dce-client-ipc.c use exising dce-os-work abstraction,
we need to make it more generic such that work can be scheduled
either to a new queue or existing system hipri work queue.
- This CL will update worker queue abstraction to make it more generic
and start using it for usecases which use default sys hipri WQ.
- There will be a follow-up CL for dce-client-ipc to start using
this abstraction.
- Further, this change will also make WQ and work structs
opaque and make dce-os-work.h a common header.
JIRA TDS-16126
Change-Id: I4d8a274a277f6dc08dc67847c1e3a3e35fb839b0
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3257738
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
- I2b8a24f9044bc08e10e5ff8cbf0c3f51fa53ff53 change introduced
an issue of concurrent accesses of admin message buffer
by different admin channel clients.
- This change will fix this issue by adding set of buffers per admin
channel client.
- When a admin channel client wants to use a buffer it will
have to request using it's client ID.
Buffer will be granted only if at least one buffer for that client
is not in use.
- Admin channel clients must release the buffer once done with the
usage so that it's available for other accesses by the same client.
- Do we need a mutex to protect this array?
1) There's no issue if different clients are trying to get/put
buffers concurrently since each query will operate on
separate per client array.
2) We've an assumption that none of the clients will be active
during init. This is also documented as part of function
documentation.
3) Will we ever have a usecase where a same client does
get/put concurrently?
4) Is it possible for a client to be active during de-init?
- If answer to 3 or 4 is yes then we still need a mutex to protect
the buffers.
- Currently we've assumed that there woudn't be concurrent
operations during init/deinit and on same client so
we're not introducing any mutex.
JIRA TDS-16126
Change-Id: I2ab640dc7c8ee6dedc9179dbb726368c3cb7d65f
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3249307
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Module covered: dce-workqueue
This is not a functional change. It does the following:
1) Move include/dce-workqueue.h to
os/linux/include/dce-os-work.h
2) s/dce_work/dce_os_work/g
3) s/dce_init_work/dce_os_work_init/g
4) s/dce_schedule_work/dce_os_work_schedule/g
5) Remove intermediate os header os/include/os-dce-workqueue.h
and replace all includes directly with <dce-os-work.h>
JIRA TDS-16126
Change-Id: I4d88cf68a187a061fd0c8c084ea074fb9e74d315
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228552
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Module covered in this CL: dce-cond
This is not a functional CL. It does the following.
1) Move os/include/linux-kmd/os-cond.h to
os/linux/include/dce-os-cond.h
2) s/dce_cond/dce_os_cond/g
3) s/DCE_COND/DCE_OS_COND/g
4) Delete intermediate include os/include/os-cond.h and replace
all includes with <dce-os-cond.h>
JIRA TDS-16126
Change-Id: Ib4f3cbe5402b2abe114be89f36e25a6fe47e8b13
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228543
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Modules covered in this CL: dce-lock
This is not a function CL. It does the following:
1) Move dce-lock.h to os/linux/include/dce-os-lock.h
2) s/dce_mutex/dce_os_mutex/g
3) Remove intermediate includes previously introduced:
a) Delete os/include/os-lock.h
JIRA TDS-16126
Change-Id: I994bcbf75ec87461c0dc2714b300d0ad1e3ee018
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228541
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Modules covered in this CL:
1) dce-os-log
This is not a functional CL. It does the following:
1) Rename dce_<info/err/debug/warn> to
dce_os_<info/err/debug/warn>
2) Rename dce_log_msg() to dce_os_log_msg()
3) Rename DCE_<WARNING/ERROR/INFO/DEBUG> to
DCE_OS_<WARNING/ERROR/INFO/DEBUG>
4) Move dce-log.h to os/linux/include/dce-os-log.h
5) Stop using old abstraction:
a) Replace <os-dce-log.h> includes with <dce-os-log.h>
6) Delete all related old deprecated log files:
a) os/include/linux-kmd/os-dce-log.h
b) os/include/os-dce-log.h
JIRA TDS-16126
Change-Id: I75ebe98a785c298678d80371184efae6e46932ee
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228536
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
- This change will add new DCE OS interface for types.h.
- This DCE OS interface layer will act as entry point to OS layer
from core DCE-KMD code.
- The intended usage is as follows.
- DCE-KMD core will include respective OS header file from
DCE OS interface.
Eg. In dce-fsm.c
#include <dce-os-types.h>
- DCE OS interface will further include OS specific files
Eg. In dce-os-types.h
#include <os-types.h>
- OS specific files will reside in respective OS specific paths.
Eg. for Linux the path will be
kernel/nvidia-oot/../dce/os/include/linux/os-types.h
For HVRTOS the path will be
display/server/os/include/hvrtos/os-types.h
- The OS specific paths will be directly included in respective
OS makefiles during compilation so that we don't need to use
ifdefs within DCE OS interface layer.
- This is first change to follow this convention for types.h.
We will have follow-up CLs to follow this suite for all other
OS dependencies for DCE-KMD.
JIRA TDS-16126
Change-Id: Ied7bee6eac5de9134b973e74020df200707afa10
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3224052
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
- In DCE_KMD, dce_fsm_start() schedules start of state machine
functionality which involves the waiting for DCE-FW boot completion,
IPC admin setup and communication etc.
- HVRTOS restricts certain functionalities like waiting on events,
acquiring locks, etc in initialize phase.
- Also for HVRTOS we are executing worker queue work in same
thread context directly from where it's called from.
- For above reasons, we need to decouple SW resource allocation and
init logic and actual execution start logic which was part of
dce_driver_init() earlier into 2 phases:
- dce_driver_init()
- This will do all resource allocation/init and will be called
during resource initialization phase.
- Module probe for Linux
- Initialize() context for HVRTOS.
- dce_driver_start()
- This will start actual DCE logic execution after all
resources are allocated and initialized and will be executed
separately.
- In Linux, both will be executed from the same probe
while in HVRTOS, the former is in process initialize
stage and dce_driver_start is run in the
Thread initialize stage.
JIRA TDS-16052
Change-Id: I1176d748bc705106bb0c8ca7e647713abf2d4a00
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3192613
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
- DCE-KMD code is only compiled on Linux Kernel today. So it has
some linux specific dependencies.
- We will be compiling the same code for new DispalySerer HVRTOS
process. To support this we will need to abstract out OS
specific dependencies from DCE-KMD.
- Common OS abstraction code will be developed under display/drivers/
server/ repo.
- DCE-KMD will start using that os abtsaction and this is the first
CL towards that effort.
JIRA TDS-16052
Change-Id: I51fba684ac285139225a2999338e73c724d9d499
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3167249
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
of_irq_xxx faimly of functions are not exported by Kernel.
use platform_irq_count and platform_get_irq APIs instead.
This patch also moves dce_platform_data elements to dce_device
struct to keep dce_platform_data constant.
Bug 3581824
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I5ea13ea039ef1464e678f0604a045a6ab67bc16f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2755141
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
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
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
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>