Commit Graph

9 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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