Merge OCK next branch to TK5 master branch

This commit is contained in:
Jianping Liu 2024-09-18 11:02:58 +08:00
commit 45d1845157
3 changed files with 17 additions and 17 deletions

View File

@ -217,7 +217,7 @@ static long csv_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
if (input.cmd > CSV_MAX)
return -EINVAL;
if (is_vendor_hygon() && mutex_enabled) {
if (mutex_enabled) {
if (psp_mutex_lock_timeout(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex,
PSP_MUTEX_TIMEOUT) != 1)
return -EBUSY;
@ -245,7 +245,7 @@ static long csv_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
* Release the mutex before calling the native ioctl function
* because it will acquires the mutex.
*/
if (is_vendor_hygon() && mutex_enabled)
if (mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);
@ -255,7 +255,7 @@ static long csv_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
if (copy_to_user(argp, &input, sizeof(struct sev_issue_cmd)))
ret = -EFAULT;
if (is_vendor_hygon() && mutex_enabled)
if (mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);
@ -418,7 +418,7 @@ static int csv_do_ringbuf_cmds(int *psp_ret)
if (!hygon_psp_hooks.sev_dev_hooks_installed)
return -ENODEV;
if (is_vendor_hygon() && mutex_enabled) {
if (mutex_enabled) {
if (psp_mutex_lock_timeout(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex,
PSP_MUTEX_TIMEOUT) != 1)
return -EBUSY;
@ -437,7 +437,7 @@ static int csv_do_ringbuf_cmds(int *psp_ret)
csv_comm_mode = CSV_COMM_MAILBOX_ON;
cmd_unlock:
if (is_vendor_hygon() && mutex_enabled)
if (mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);
@ -824,7 +824,7 @@ static int vpsp_psp_mutex_trylock(void)
{
int mutex_enabled = READ_ONCE(hygon_psp_hooks.psp_mutex_enabled);
if (is_vendor_hygon() && mutex_enabled)
if (mutex_enabled)
return psp_mutex_trylock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
return mutex_trylock(hygon_psp_hooks.sev_cmd_mutex);
@ -834,7 +834,7 @@ static int vpsp_psp_mutex_unlock(void)
{
int mutex_enabled = READ_ONCE(hygon_psp_hooks.psp_mutex_enabled);
if (is_vendor_hygon() && mutex_enabled)
if (mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);

View File

@ -597,7 +597,7 @@ int psp_do_cmd(int cmd, void *data, int *psp_ret)
int rc;
int mutex_enabled = READ_ONCE(hygon_psp_hooks.psp_mutex_enabled);
if (is_vendor_hygon() && mutex_enabled) {
if (mutex_enabled) {
if (psp_mutex_lock_timeout(&psp_misc->data_pg_aligned->mb_mutex,
PSP_MUTEX_TIMEOUT) != 1)
return -EBUSY;
@ -605,7 +605,7 @@ int psp_do_cmd(int cmd, void *data, int *psp_ret)
mutex_lock(hygon_psp_hooks.sev_cmd_mutex);
}
rc = __psp_do_cmd_locked(cmd, data, psp_ret);
if (is_vendor_hygon() && mutex_enabled)
if (mutex_enabled)
psp_mutex_unlock(&psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);

View File

@ -415,13 +415,13 @@ static int sev_do_cmd(int cmd, void *data, int *psp_ret)
PSP_MUTEX_TIMEOUT) != 1)
return -EBUSY;
} else {
mutex_lock(hygon_psp_hooks.sev_cmd_mutex);
mutex_lock(&sev_cmd_mutex);
}
rc = __sev_do_cmd_locked(cmd, data, psp_ret);
if (is_vendor_hygon() && mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);
mutex_unlock(&sev_cmd_mutex);
return rc;
}
@ -546,13 +546,13 @@ int sev_platform_init(int *error)
PSP_MUTEX_TIMEOUT) != 1)
return -EBUSY;
} else {
mutex_lock(hygon_psp_hooks.sev_cmd_mutex);
mutex_lock(&sev_cmd_mutex);
}
rc = __sev_platform_init_locked(error);
if (is_vendor_hygon() && mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);
mutex_unlock(&sev_cmd_mutex);
return rc;
}
@ -596,13 +596,13 @@ static int sev_platform_shutdown(int *error)
PSP_MUTEX_TIMEOUT) != 1)
return -EBUSY;
} else {
mutex_lock(hygon_psp_hooks.sev_cmd_mutex);
mutex_lock(&sev_cmd_mutex);
}
rc = __sev_platform_shutdown_locked(NULL);
if (is_vendor_hygon() && mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);
mutex_unlock(&sev_cmd_mutex);
return rc;
}
@ -1168,7 +1168,7 @@ static long sev_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
PSP_MUTEX_TIMEOUT) != 1)
return -EBUSY;
} else {
mutex_lock(hygon_psp_hooks.sev_cmd_mutex);
mutex_lock(&sev_cmd_mutex);
}
switch (input.cmd) {
@ -1212,7 +1212,7 @@ out:
if (is_vendor_hygon() && mutex_enabled)
psp_mutex_unlock(&hygon_psp_hooks.psp_misc->data_pg_aligned->mb_mutex);
else
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex);
mutex_unlock(&sev_cmd_mutex);
return ret;
}