Commit Graph

493 Commits

Author SHA1 Message Date
Pritesh Raithatha
7399ae2100 platform: tegra: allow mc-utils load for non-tegra devices
Nvgpu driver has dependency on mc-utils driver so
allow the driver to get loaded for non-tegra devices.
Also update functions to fail for non-tegra devices
in case called by mistake.

Bug 5066721

Change-Id: I410c10d0155ac85001eb12b2f4bce694affb5186
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3295359
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
2025-07-24 10:19:15 +00:00
saranyad
d0e719df4a DCE_KMD: Fix TOP 25 CWE Rule
- This patch fixes the following violations

  OVERRUN - 1 (24138320)
  - Added checks to validate boundries

  Rule: OVERRUN
  Rule Description: Out-of-bounds access to a buffer

JIRA TDS-15862

Change-Id: I4df6c7124da19143eb0d9b8027df28fccdff0b75
Signed-off-by: saranyad <saranyad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3305934
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
Mahesh Kumar
fb5f279667 platform:dce: Add a delay between ivc reset
Add a few microseconds delay between IVC channel reset retries.
This prevents kernel logs from flooding if dce bootstrapping takes
some time for any reason.

Based on logs below, DCE is taking around 10-30 microsecond for channel reset.
So, Keeping the delay of 10-20 microseconds.

20:26:46.637409: dce: dce_mailbox_set_full_interrupt:157  Intr bit set multiple times for MB : [0x5]
20:26:46.637421: message repeated 15 times: [ dce: dce_mailbox_set_full_interrupt:157  Intr bit set multiple times for MB : [0x5]]
---
20:26:46.637429: dce: dce_mailbox_set_full_interrupt:157  Intr bit set multiple times for MB : [0x1]
20:26:46.637458: message repeated 12 times: [ dce: dce_mailbox_set_full_interrupt:157  Intr bit set multiple times for MB : [0x1]]
----
20:26:46.637461: dce: dce_mailbox_set_full_interrupt:157  Intr bit set multiple times for MB : [0x2]
20:26:46.637471: message repeated 15 times: [ dce: dce_mailbox_set_full_interrupt:157  Intr bit set multiple times for MB : [0x2]]

Jira TDS-6381

Change-Id: I0f8d3c55058019df5a52edd232eae93b3bf84276
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3304216
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
saranyad
bb80a707cd KMD: Fix Misra-C:2012 Rule
- This patch fixes the following violations

  OVERRUN - 2 (CIDs 22827501, 22827481)
  - Added checks to validate boundries

  Rule: OVERRUN
  Rule Description: Out-of-bounds access to a buffer

JIRA TDS-15862

Change-Id: I94b19dc491583a63ec242c59cc288c5e32134cc0
Signed-off-by: saranyad <saranyad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3299743
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Adithya Sanjeev Byalpi <abyalpi@nvidia.com>
Reviewed-by: Ishwarya Balaji Gururajan <igururajan@nvidia.com>
2025-07-24 10:19:15 +00:00
Yuyuan Chen
3b31f76f27 kernel: nvidia-oot: Fix Static issues S2/5
Jira CAMERASW-31832

Change-Id: I4060480865bf3895fae22127bb3e0c915af8af9f
Signed-off-by: Yuyuan Chen <yuyuanc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297678
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Tested-by: Patrick Young <payoung@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ryan Li <ryanli@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
2025-07-24 10:19:15 +00:00
Bob Zhang
9297cd7cfd kernel: nvidia-oot: Fix Linux KMD coverity defects
Fix INT32-C and INT08-C coverity defects for tegra-rtcpu-trace.c.

JIRA CAMERASW-31291

Change-Id: I2b80963663df440a38e39bdc3b15d240270f99a5
Signed-off-by: Bob Zhang <bozhang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297723
Reviewed-by: Xiaoming Xiang <xxiang@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
anupamg
2f69bee627 DCE-KMD: Update shared files licenses
- Updates licenses for DCE-KMD files that are shared with HVRTOS.
    - Update from GPL-2.0 to MIT as we use these files in both
      open source and closed source context.

JIRA TDS-16741

Change-Id: Icf7aeb737f2f3b294bb9ff9c36d5ed7220c13dea
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3293404
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
2025-07-24 10:19:14 +00:00
Bob Zhang
d1c50209ba kernel: nvidia-oot: Fix Linux KMD coverity defects
Fix INT30-C and INT08-C coverity defects for
tegra-rtcpu-trace.c.

Fix MISSING_LOCK coverity defects for cdi_mgr.c.

Fix NULL_RETURNS coverity defects for cam_fsync.c.

JIRA CAMERASW-30844

Change-Id: If000ed4459479ba0bc9f06477b25efa65e896fc7
Signed-off-by: Bob Zhang <bozhang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3283172
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: Patrick Young <payoung@nvidia.com>
Reviewed-by: Xiaoming Xiang <xxiang@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
2025-07-24 10:19:14 +00:00
mhulagabal
580ec7794c dce: Update copyright in the errors header file
- Added MIT and GPL licensing details

- Bug 5065840

- JIRA TDS-15862

Change-Id: I438ea8c9d52c3cfaae76fe616e09bb18692c3bd4
Signed-off-by: mhulagabal <mhulagabal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3288450
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bernd Weber <bweber@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
2025-07-24 10:19:14 +00:00
yongtaos
2b06fe0a29 kernel: nvidia-oot: Fix Top-25 coverity defects
Fix INT08-C, INT30-C and STR07-C coverity defects for rtcpu-debug.c.

Jira CAMERASW-30854

Change-Id: I0b516587b72bf631974f5f6ee99a55821744bf85
Signed-off-by: yongtaos <yongtaos@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3278378
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Zhiyuan Wang <zhiwang@nvidia.com>
2025-07-24 10:19:13 +00:00
anupamg
6c7b0070f8 DCE-KMD: Refactor dce client ipc registration.
- dce-client-ipc.c is a common file used by HVRTOS as well to
  register as a DCE client.

- We need to refactor existing register function due to certain
  HVRTOS restrictions at init time.
    1) Register function will be called at init time from HVRTOS.
    2) HVRTOS doesn't allow any mutex acquire calls or wait calls
       during INIT phase.

JIRA TDS-16581

Change-Id: I1b3a9587c1e237c2cca8214a3acce9ff34d98cc0
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3280251
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
2025-07-24 10:19:13 +00:00
kevixie
5ce08ee3ce nvidia-oot: cameraSW: add data validation to dt reads
+ Add the following data validation checks based on
  gaps identified when inspecting code for
  SHR-9320:
  + FSYNC: Add check to ensure existence of generators
    property before parse
  + FSYNC: Add check to ensure generators in default
    group adhere to LCM rule
  + CDI: Add check to ensure reg_len / dat_len do
    not exceed 2 bytes
  + CDI: Ensure err is set before jumping to err_probe
  + CDI: Jump to err_probe if IOExpander i2c-bus read
    fails
  + CDI-TCA: Return error if reg_len or dat_len
    out of expected range
  + FuSaCap: Ensure isp/vi-max-channels validated
  + VI: Add check for vi-mapping index found (this was
    already caught in existing code, but error message
    was non-specific)
  + camera_common: Add check for err that was set but
    never read
  + RTCPU: Add debug prints for properties not found

Jira CAMERASW-30537
Change-Id: I9953029f594c0153d6c335913944fb8906adedd9
Signed-off-by: kevixie <kevixie@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3280557
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:13 +00:00
anupamg
2bed40f6fe DCE-KMD: Refactor dce-os-worker.c/.h
- 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>
2025-07-24 10:19:13 +00:00
anupamg
3e2343fa57 DCE_KMD: dce-client-ipc.c: Separate out exports
- dce-client-ipc.c has linux specific export symbols that
  are required to be exported to linux kernel module client.

- We'll be using dce-client-ipc.c as a core DCE-KMD file and
  also be compiling it for HVRTOS.

- This change will add DCE_EXPORT_SYMBOL() as wrapper
  to EXPORT_SYMBOL. This will be OS agnostic macro.
    - For HVRTOS it will be empty.

JIRA TDS-16126

Change-Id: I45fbf3b8b61321c64f88a0c64a07dbe4935296b7
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3258496
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
2025-07-24 10:19:13 +00:00
anupamg
d0bafbec62 DCE-KMD: dce-ipc.c: Remove simple wrappers
- This is a follow-up CL to address a comment in
  I55594d8e34c3b572129119d1f7240cde76cf37bd

- This change will remove below simple static wrappers
  from dce-ipc.c and directly call the corresponding OS functions.
    - _dce_ipc_get_next_write_buff()
    - _dce_ipc_get_next_read_buff()

JIRA TDS-16126

Change-Id: Ie8c08ace75f3c6e14e803c6aeccdf43a0c27f3fa
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3257965
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
2025-07-24 10:19:13 +00:00
anupamg
0137495706 DCE-KMD: Make dce-client-ipc.c core file
- 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>
2025-07-24 10:19:13 +00:00
anupamg
801a2e1d07 DCE-KMD: Update DCE OS Worker Queue abstraction
- 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>
2025-07-24 10:19:13 +00:00
Eric Funsten
84bb75c788 drivers: uncore_pmu: add event type check
Need to check if the event type matches the pmu type and return
ENOENT if there is a mismatch.

Bug 5035098

Change-Id: I3d1341efd1ad59dec011527a730d702ed6dfea4a
Signed-off-by: Eric Funsten <efunsten@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3279805
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:13 +00:00
Evgeny Kornev
c4d1462fd6 tracing: Fix ftrace for ISP trace events
Fix ISP trace events due to 64 bit TS cahnges

Jira CAMERASW-30345

Change-Id: I33aa9325603ec939979e11964224bf3f113a0adb
Signed-off-by: Evgeny Kornev <ekornev@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3266979
Reviewed-by: Jukka Kaartinen <jkaartinen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
283315b000 DCE-KMD: Rename dce-os-device.h
- Rename dce-os-device to dce-linux-device

- dce-os-device.h header is specific to OS and is only intended
  to be internally used within OS. Similarly all it's exposed
  functions are OS specific only.

- Therefore instead of having a common name for all OSs for this
  header file, make this header internal by including linux
  name to it's naming convention.

- Similary rename dce_os_device struct to dce_linux_device and
  also rename corresponding functions from this header.

JIRA TDS-16126

Change-Id: I74e2deb17f49065d242bd80d50c5a849b3dfa3a1
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3256403
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
71f130a999 DCE-KMD: Address admin buffer sync access issue
- 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>
2025-07-24 10:19:12 +00:00
anupamg
0becc78306 DCE-KMD: Add helper macro to check non NULL
- This is a follow-up CL to address a comment in
  I885348a09eaac6e4362c89b59880fbd32d77d3b5

- This change will add a  helper macro, DCE_WARN_ON_NOT_NULL(x),
  to print a warning message if the input param is not NULL.
    - Added to dce.h

JIRA TDS-16126

Change-Id: I9b2c4ea89fa1682d18c20f68b14ab7696917f261
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3251828
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
46895eb9cd DCE-KMD: Make certain util functions static
- This is a follow-up CL to address comment from
  I42bfe95aa81823dc077ae0964eb6288a1f25fc17

- Certain utils functions are used in single files so make
  them static and move to files in which they are used.

- Rename these from dce_os*() to dce_().

- Delete dce_get_fw_phy_addr() as it's unused.

JIRA TDS-16126

Change-Id: I6049ae1d381ac9c18acbcd3b2584d4d8ab3f2dc0
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3248435
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
7813dddaff DCE-KMD: FSM: Rename init/deinit functions
- This is a follow-up CL to address comments for
  I19e10bb890a4ab6d011df4380ab3a6d5fe92c696

- Rename init/deinit functions to indicate that they are not
  thread safe.

- Also add this note to function documentations.

JIRA TDS-16126

Change-Id: Ic9d1e19a28ef940cb7fbcdc9c923fb61446e0463
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3248426
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
48cb79c312 DCE-KMD: Rename dce-worker.c/.h
- dce-worker.c has os specific implementations.

- Therefore rename it to dce-os-worker.c/.h.

- Also rename functions accordingly.

JIRA TDS-16126

Change-Id: I8e1301659c65cca7c3735f4af1f1a7039409cbbe
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233180
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
7970c223dc DCE-KMD: OS abstraction renaming
- Rename following functions from dce-os-utils.c from
  dce_*() to dce_os_*()
    dce_get_phys_stream_id
    dce_get_dce_stream_id
    dce_get_fw_vm_index
    dce_get_fw_carveout_id
    dce_is_physical_id_valid
    dce_get_fw_dce_addr
    dce_get_fw_phy_addr
    dce_get_fw_name
    dce_thread*
    dce_ipc_init_region_info
    dce_ipc_de_init_region_info

- Move include/dce-thread.h to
  os/linux/include/dce-os-thread.h

JIRA TDS-16126

Change-Id: I42bfe95aa81823dc077ae0964eb6288a1f25fc17
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233170
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
cd31698771 DCE-KMD: dce-ipc.c: Abstract out iosys
- Abstract out iosys_* dependencies for writing/reading to/from
  message header and memcpy to os specific implementation.
    - Add new dce-os-ipc.c

- Cannot add these functions to existing 'dce-os-ivc.h' as
  static inline functions because these functions access
  dce_ipc_channel defined in dce_ipc.h.
    - Cannot include dce_ipc.h to this file as it creates
      a circular dependency.

- Also fix exsisting issue of not defining 'tegra_dce' inside
  dce-ipc.h
    - This is exposed now because we're including dce-ipc.h to
      dce-os-ipc.c which doesn't include any prior headers which
      define tegra_dce.
    - Fix by doing forward define to avoid circular dependency
      with dce.h

- Additionally fix below iosys issues:
1) Change Iabebef33719c38a8aa4db8573a0dd7dd7e5f83f6 introduced
   an issue because NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP demands
   different prototypes for below functions:
     - dce_os_ivc_get_next_write_frame()
     - dce_os_ivc_get_next_read_frame()

2) Now since dce_ipc_is_data_available() uses
   dce_os_ivc_get_next_read_frame(), it needs to define
   frame with iosys_map for IOSYS Linux 6.2 usecase. So need
   to creata a OS abstraction for this too.

JIRA TDS-16126

Change-Id: I55594d8e34c3b572129119d1f7240cde76cf37bd
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233117
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
7b46601f2e DCE-KMD: Update DCE OS abstraction - Part 7
Module covered: dce-trace

This is not a functional change. It does the following:
1) Add new os/linux/include/dce-os-trace.h to abstract
   trace event functionality. Define static inline
   wrappers dce_os_trace_*() to corresponding existing
   trace_*() functions.

2) Remove intermediate os header os/include/os-dce-events.h
   and replace all includes directly with <dce-os-trace.h>`

JIRA TDS-16126

Change-Id: I800be4a2b9b51214af4c2531e34dbdd41caccaea
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3229379
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
c0e60a639a DCE-KMD: Update DCE OS abstraction - Part 6
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>
2025-07-24 10:19:12 +00:00
anupamg
9f31ca7c42 DCE-KMD: Update DCE OS abstraction - Part 5
Modules covered in this CL: dce-os-ivc

This is not a functional CL. It does the following:
1) Move os/include/linux-kmd/os-ivc.h to
   os/linux/include/dce-os-ivc.h

2) s/os_ivc/dce_os_ivc/g

3) Delete old intermediate header os/include/os-ivc.h and include
   <dce-os-ivc.h> directly.

JIRA TDS-16126

Change-Id: Ib6264a39910dbb4a107fd2261005c5e593b4b9b7
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228545
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
562347a94e DCE-KMD: Update DCE OS abstraction - Part 4
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>
2025-07-24 10:19:12 +00:00
anupamg
ff65048da5 DCE-KMD: Update DCE OS abstraction - Part 3
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>
2025-07-24 10:19:12 +00:00
anupamg
ea36afee6c DCE-KMD: Update OS abstraction - Part 2
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>
2025-07-24 10:19:12 +00:00
anupamg
2f1230b256 DCE-KMD: Update DCE OS abstraction - Part 1
- We will keep single abstraction layer for linux.
    - File: dce-os-*
    - Fn: dce_os_*()

Modules covered in this CL:
1) dce-os-types
2) dce-os-atomic
3) dce-os-utils
4) dce-os-device
    - This is renamed to dce-linux-device in
      I74e2deb17f49065d242bd80d50c5a849b3dfa3a1

JIRA TDS-16126

Change-Id: I2d5eb45da4f245c1491645b27e2be9141bc038df
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228474
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
7726f604ca DCE-KMD: Revert "DCE-KMD: Add define for USE(x)"
- Revert commit to add USE() define as we've removed all
  usages by adding meningful checks instead.

This reverts commit 4c584ae1dbfd0516178a3fa9227ec6ded40363c8.

JIRA TDS-16126

Change-Id: Ic22ca046a036e8c9883d2857a8de325ee1874980
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3232193
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
302458450a DCE-KMD: pm.c: Remove USE() usage
- We're using USE() to forcefully use a parameter to avoid
  compilation errors in HVRTOS.

- Add a validity check instead to such parameters. This will
  resolve unused varaiable errors as well as add meaningful
  checks, instead of forcefully using params.

JIRA TDS-16126

Change-Id: I4bad1b8fff8ebabc9eb3bd6edfe7cf1f1549e7ef
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3225292
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
90a02e9ca3 DCE-KMD: fsm.c: Remove USE() usage
- We're using USE() to forcefully use a parameter to avoid
  compilation errors in HVRTOS.

- Add a validity check instead to such parameters. This will
  resolve unused varaiable errors as well as add meaningful
  checks, instead of forcefully using params.

JIRA TDS-16126

Change-Id: I672dc9bf6ebcf31ae76ff4ed17bc3c246838c124
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3225283
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
b5e4092538 DCE-KMD: bootstrap.c: Remove USE() usage
- We're using USE() to forcefully use a parameter to avoid
  compilation errors in HVRTOS.

- Add a validity check instead to such parameters. This will
  resolve unused varaiable errors as well as add meaningful
  checks, instead of forcefully using params.

JIRA TDS-16126

Change-Id: I885348a09eaac6e4362c89b59880fbd32d77d3b5
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3225254
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
7f0ed24743 DCE-KMD: Add check for params arg in dce_admin...
- Add check for params arg in dce_admin_handle_ipc_received_event().

- dce_admin_handle_ipc_received_event() is a one of the FSM event
  functions which shares common FSM event function prototype:
    int (*fsm_event_handle)(struct tegra_dce *d, void *params);

- But dce_admin_handle_ipc_received_event() implementation doesn't
  need 'params' argument and therefore callers are expected to
  pass NULL.

- This change will add a check inside this function to check
  if the params are NULL and print a warning message otherwise.

JIRA TDS-16126

Change-Id: I70b73d195d866b7b6bb43b5430dccfb0bc3cb486
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3225248
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
f03b71480a DCE-KMD: Add new DCE OS interface: types.h
- 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>
2025-07-24 10:19:12 +00:00
anupamg
d9528502bc DCE-KMD: Remove dce.h include from dce-pm.h
- Remove dce.h include from dce-pm.h to resolve circular
  dependency betweeen dce.h and dce-pm.h

- This is an existing circular dependency but has floated
  up now due to some re-org in DCE-KMD code.

JIRA TDS-16052

Change-Id: I046743cf70f344d87500e7f9d595f8cfe2379446
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3192713
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
644c60d35c DCE-KMD: Refactor dce_work_cond_sw_resource_init()
- Move resource init specific to PM and bootstrap modules
  to respective PM and bootstrap init functions.

- Motivation here is 2 fold:
    1) To keep common code common across OSs.
    2) Move resource init to respective sub-modules.
        - We will have separate PM module for HVRTOS.
        - We will have separate dce-worker module for HVRTOS.

JIRA TDS-16052

Change-Id: I40f6943eb4173a0da7201dc58afb19aee2a0d04e
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3190873
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
06db88ae67 DCE-KMD: dce-worker.h - Remove dce-thread.h ref
- Remove un-neessary/un-used dce-thread.h inlcude from
  dce-worker.h.

JIRA TDS-16052

Change-Id: I13a465a63226db7a3d378ed5945264a84cf3381b
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3189332
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
484423c54b DCE-KMD: Use os abstraction for events.
- Start using os abstraction for dce-events.

JIRA TDS-16052

Change-Id: I538d6c6748bf09135e7c3bffc607dc9b8571c0ab
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3188480
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
57991f0020 DCE-KMD: Use os abstraction for IVC comm
- Use OS abstraction for IVC commmunication calls.

- Also remove un-necessary mutex lock/unlock calls during init
  as they are not supported on HVRTOS.
    - Accordingly rename
        dce_ipc_channel_init() -> dce_ipc_channel_init_unlocked()
        dce_ipc_channel_deinit() -> dce_ipc_channel_deinit_unlocked()

JIRA TDS-16052

Change-Id: Ia7b062486f0920672c62fb5753ad3d73488f9bde
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3180404
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
1b6b1c620b DCE-KMD: Move IPC region alloc/free calls to OS
- Move IPC region alloc/free calls to OS layer because
  they mean different for different OSs.

- For Linux it will allocate/dma map memory for IVC comm.

- For HVRTOS it will simply fetch pre-allocated memory details
  since the memory allocation is only allowed in hypervisor module.

- Accordingly, rename the API dce_ipc_allocate_region() ->
  dce_ipc_init_region_info(). Similarly for free as well.

JIRA TDS-16052

Change-Id: I201cb5b1bc7384a9b0ccdbf5bc72bbd78d6b1506
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3180405
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
f5d25922eb DCE-KMD: admin: Allocate msg buffer at init time
- Reserve message buffer for DCE admin channel at init time
  since dynamic memory allocations are restricted on HVRTOS.
    - Free this during channel deinit.

- Use this reserved message buffer at all other callsites.

JIRA TDS-16052

Change-Id: I2b8a24f9044bc08e10e5ff8cbf0c3f51fa53ff53
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3180403
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
84e1c1d01f DCE-KMD: Decouple resources init and start logic
- 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>
2025-07-24 10:19:12 +00:00
anupamg
e9fdb45f72 DCE-KMD: FSM: Don't acquire locks during init/de..
Dont't acquire locks during init/deinit.

- FSM init/deinit is expected to be called during init/deinit phase
  when everything else and FSM itself is inactive.

- FSM mutex is just initialized/deinit in the same functions where
  we're trying to acquire lock/release.
    - While it is techically ok in general but not requried.
    - Also HVRTOS restriction prevents to acquire mutexes in
      initialization phase.
        - Deinit can be called in Initization context to deinit
          if init fails.

JIRA TDS-16052

Change-Id: I19e10bb890a4ab6d011df4380ab3a6d5fe92c696
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3178697
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
2025-07-24 10:19:12 +00:00
anupamg
4a304392dd DCE-KMD: Fix un-used params errors
- Force use unused parameters in commmon DCE-KMD
  codebase to fix unused parameters errors on HVRTOS.

JIRA TDS-16052

Change-Id: Id58c87d27a248d7ad3d6ee58f51dd869e6623c32
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3173706
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>
2025-07-24 10:19:12 +00:00