mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
misc: mods: update from Perforce
Change-Id: I65dc43cae65946cce09fdd060627a5817127cfcf Signed-off-by: Chris Dragan <kdragan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2895269 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
85c4d41d99
commit
5dcd80a533
@@ -1554,6 +1554,7 @@ static int resume_fb(struct mods_client *client)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static atomic_t console_is_locked;
|
static atomic_t console_is_locked;
|
||||||
|
static atomic_t console_suspend_client_id;
|
||||||
|
|
||||||
static int esc_mods_lock_console(struct mods_client *client)
|
static int esc_mods_lock_console(struct mods_client *client)
|
||||||
{
|
{
|
||||||
@@ -1582,10 +1583,22 @@ static int esc_mods_unlock_console(struct mods_client *client)
|
|||||||
static int esc_mods_suspend_console(struct mods_client *client)
|
static int esc_mods_suspend_console(struct mods_client *client)
|
||||||
{
|
{
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
|
int other_id;
|
||||||
|
|
||||||
LOG_ENT();
|
LOG_ENT();
|
||||||
|
|
||||||
|
other_id = atomic_cmpxchg(&console_suspend_client_id, 0, client->client_id);
|
||||||
|
if (other_id) {
|
||||||
|
if (other_id == client->client_id)
|
||||||
|
cl_error("console already suspended by this client\n");
|
||||||
|
else
|
||||||
|
cl_error("console already suspended by client %u\n", other_id);
|
||||||
|
LOG_EXT();
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (atomic_cmpxchg(&console_is_locked, 0, 1)) {
|
if (atomic_cmpxchg(&console_is_locked, 0, 1)) {
|
||||||
|
atomic_set(&console_suspend_client_id, 0);
|
||||||
cl_error("cannot suspend console, console is locked\n");
|
cl_error("cannot suspend console, console is locked\n");
|
||||||
LOG_EXT();
|
LOG_EXT();
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -1607,8 +1620,10 @@ static int esc_mods_suspend_console(struct mods_client *client)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (err)
|
if (err) {
|
||||||
|
atomic_set(&console_suspend_client_id, 0);
|
||||||
cl_warn("no methods to suspend console available\n");
|
cl_warn("no methods to suspend console available\n");
|
||||||
|
}
|
||||||
|
|
||||||
atomic_set(&console_is_locked, 0);
|
atomic_set(&console_is_locked, 0);
|
||||||
|
|
||||||
@@ -1619,24 +1634,48 @@ static int esc_mods_suspend_console(struct mods_client *client)
|
|||||||
|
|
||||||
static int esc_mods_resume_console(struct mods_client *client)
|
static int esc_mods_resume_console(struct mods_client *client)
|
||||||
{
|
{
|
||||||
|
if (atomic_read(&console_suspend_client_id) != client->client_id) {
|
||||||
|
cl_error("console was not suspended by this client\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
return mods_resume_console(client);
|
return mods_resume_console(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mods_resume_console(struct mods_client *client)
|
static int mods_resume_console(struct mods_client *client)
|
||||||
{
|
{
|
||||||
int err = -EINVAL;
|
bool need_lock = true;
|
||||||
|
int err = -EINVAL;
|
||||||
|
|
||||||
LOG_ENT();
|
LOG_ENT();
|
||||||
|
|
||||||
if (atomic_cmpxchg(&client->console_is_locked, 1, 0)) {
|
if (atomic_cmpxchg(&client->console_is_locked, 1, 0)) {
|
||||||
cl_warn("console was not properly unlocked\n");
|
cl_warn("console was not properly unlocked\n");
|
||||||
console_unlock();
|
console_unlock();
|
||||||
} else if (atomic_cmpxchg(&console_is_locked, 0, 1)) {
|
need_lock = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we got here on close(), check if this client suspended the console. */
|
||||||
|
if (atomic_read(&console_suspend_client_id) != client->client_id) {
|
||||||
|
if (!need_lock)
|
||||||
|
atomic_set(&console_is_locked, 0);
|
||||||
|
LOG_EXT();
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (need_lock && atomic_cmpxchg(&console_is_locked, 0, 1)) {
|
||||||
cl_error("cannot resume console, console is locked\n");
|
cl_error("cannot resume console, console is locked\n");
|
||||||
LOG_EXT();
|
LOG_EXT();
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Another thread resumed the console before we took the lock */
|
||||||
|
if (atomic_read(&console_suspend_client_id) != client->client_id) {
|
||||||
|
atomic_set(&console_is_locked, 0);
|
||||||
|
LOG_EXT();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
err = resume_fb(client);
|
err = resume_fb(client);
|
||||||
|
|
||||||
#if defined(MODS_HAS_CONSOLE_BINDING)
|
#if defined(MODS_HAS_CONSOLE_BINDING)
|
||||||
@@ -1653,6 +1692,7 @@ static int mods_resume_console(struct mods_client *client)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
atomic_set(&console_is_locked, 0);
|
atomic_set(&console_is_locked, 0);
|
||||||
|
atomic_set(&console_suspend_client_id, 0);
|
||||||
|
|
||||||
LOG_EXT();
|
LOG_EXT();
|
||||||
|
|
||||||
@@ -2542,7 +2582,6 @@ static long mods_krnl_ioctl(struct file *fp,
|
|||||||
esc_mods_bpmp_init_pcie_ep_pll,
|
esc_mods_bpmp_init_pcie_ep_pll,
|
||||||
MODS_INIT_PCIE_EP_PLL);
|
MODS_INIT_PCIE_EP_PLL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MODS_ESC_DMA_ALLOC_COHERENT:
|
case MODS_ESC_DMA_ALLOC_COHERENT:
|
||||||
MODS_IOCTL(MODS_ESC_DMA_ALLOC_COHERENT,
|
MODS_IOCTL(MODS_ESC_DMA_ALLOC_COHERENT,
|
||||||
esc_mods_dma_alloc_coherent,
|
esc_mods_dma_alloc_coherent,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
/* Driver version */
|
/* Driver version */
|
||||||
#define MODS_DRIVER_VERSION_MAJOR 4
|
#define MODS_DRIVER_VERSION_MAJOR 4
|
||||||
#define MODS_DRIVER_VERSION_MINOR 16
|
#define MODS_DRIVER_VERSION_MINOR 17
|
||||||
#define MODS_DRIVER_VERSION ((MODS_DRIVER_VERSION_MAJOR << 8) | \
|
#define MODS_DRIVER_VERSION ((MODS_DRIVER_VERSION_MAJOR << 8) | \
|
||||||
((MODS_DRIVER_VERSION_MINOR / 10) << 4) | \
|
((MODS_DRIVER_VERSION_MINOR / 10) << 4) | \
|
||||||
(MODS_DRIVER_VERSION_MINOR % 10))
|
(MODS_DRIVER_VERSION_MINOR % 10))
|
||||||
|
|||||||
Reference in New Issue
Block a user