qseecom: change check_blocked flag to an u32 value

Change app entry's check_blocked flag to u32 to indicate the
total number of clients being blocked on this app; then this
app can only be unloaded if this flag is 0.

Change-Id: I0370b25657b6dfdc40a738c784e601907c9b4dd4
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
This commit is contained in:
Zhen Kong 2018-07-30 17:50:10 -07:00 committed by Gerrit - the friendly Code Review server
parent 88532b424b
commit c3d18aedda

View File

@ -208,7 +208,7 @@ struct qseecom_registered_app_list {
char app_name[MAX_APP_NAME_SIZE];
u32 app_arch;
bool app_blocked;
bool check_block;
u32 check_block;
u32 blocked_on_listener_id;
};
@ -2301,7 +2301,7 @@ static void __qseecom_reentrancy_check_if_this_app_blocked(
sigset_t new_sigset, old_sigset;
if (qseecom.qsee_reentrancy_support) {
ptr_app->check_block = true;
ptr_app->check_block++;
while (ptr_app->app_blocked || qseecom.app_block_ref_cnt > 1) {
/* thread sleep until this app unblocked */
sigfillset(&new_sigset);
@ -2316,7 +2316,7 @@ static void __qseecom_reentrancy_check_if_this_app_blocked(
mutex_lock(&app_access_lock);
sigprocmask(SIG_SETMASK, &old_sigset, NULL);
}
ptr_app->check_block = false;
ptr_app->check_block--;
}
}
@ -2586,6 +2586,7 @@ static int qseecom_load_app(struct qseecom_dev_handle *data, void __user *argp)
MAX_APP_NAME_SIZE);
entry->app_blocked = false;
entry->blocked_on_listener_id = 0;
entry->check_block = 0;
spin_lock_irqsave(&qseecom.registered_app_list_lock, flags);
list_add_tail(&entry->list, &qseecom.registered_app_list_head);
@ -4556,6 +4557,7 @@ int qseecom_start_app(struct qseecom_handle **handle,
entry->app_arch = app_arch;
entry->app_blocked = false;
entry->blocked_on_listener_id = 0;
entry->check_block = 0;
spin_lock_irqsave(&qseecom.registered_app_list_lock, flags);
list_add_tail(&entry->list, &qseecom.registered_app_list_head);
spin_unlock_irqrestore(&qseecom.registered_app_list_lock,
@ -5471,6 +5473,7 @@ static int qseecom_query_app_loaded(struct qseecom_dev_handle *data,
MAX_APP_NAME_SIZE);
entry->app_blocked = false;
entry->blocked_on_listener_id = 0;
entry->check_block = 0;
spin_lock_irqsave(&qseecom.registered_app_list_lock,
flags);
list_add_tail(&entry->list,