Files
linux-nv-oot/drivers/platform/tegra/dce/dce-init-deinit.c
Mahesh Kumar 35242999ff platform: tegra: dce: Add WQ to handle async IPC
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
2023-04-14 19:23:43 +00:00

88 lines
1.9 KiB
C

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <dce.h>
#include <dce-util-common.h>
/**
* dce_driver_init - Initializes the various sw components
* and few hw elements dce.
*
* @d : Pointer to tegra_dce struct.
*
* Return : 0 if successful.
*/
int dce_driver_init(struct tegra_dce *d)
{
int ret = 0;
ret = dce_boot_interface_init(d);
if (ret) {
dce_err(d, "dce boot interface init failed");
goto err_boot_interface_init;
}
ret = dce_admin_init(d);
if (ret) {
dce_err(d, "dce admin interface init failed");
goto err_admin_interface_init;
}
ret = dce_client_init(d);
if (ret) {
dce_err(d, "dce client workqueue init failed");
goto err_client_init;
}
ret = dce_worker_thread_init(d);
if (ret) {
dce_err(d, "dce worker thread init failed");
goto err_worker_thread_init;
}
return ret;
err_worker_thread_init:
dce_client_deinit(d);
err_client_init:
dce_admin_deinit(d);
err_admin_interface_init:
dce_boot_interface_deinit(d);
err_boot_interface_init:
d->boot_status |= DCE_STATUS_FAILED;
return ret;
}
/**
* dce_driver_deinit - Release various sw resources
* associated with dce.
*
* @d : Pointer to tegra_dce struct.
*
* Return : Void
*/
void dce_driver_deinit(struct tegra_dce *d)
{
/* TODO : Reset DCE ? */
dce_worker_thread_deinit(d);
dce_client_deinit(d);
dce_admin_deinit(d);
dce_boot_interface_deinit(d);
dce_release_fw(d, d->fw_data);
}