@@ -110,7 +110,7 @@ struct ffa_drv_info {
110
110
struct work_struct sched_recv_irq_work ;
111
111
struct xarray partition_info ;
112
112
DECLARE_HASHTABLE (notifier_hash , ilog2 (FFA_MAX_NOTIFICATIONS ));
113
- struct mutex notify_lock ; /* lock to protect notifier hashtable */
113
+ rwlock_t notify_lock ; /* lock to protect notifier hashtable */
114
114
};
115
115
116
116
static struct ffa_drv_info * drv_info ;
@@ -1182,18 +1182,18 @@ static int ffa_notify_relinquish(struct ffa_device *dev, int notify_id)
1182
1182
if (notify_id >= FFA_MAX_NOTIFICATIONS )
1183
1183
return - EINVAL ;
1184
1184
1185
- mutex_lock (& drv_info -> notify_lock );
1185
+ write_lock (& drv_info -> notify_lock );
1186
1186
1187
1187
rc = update_notifier_cb (notify_id , type , NULL );
1188
1188
if (rc ) {
1189
1189
pr_err ("Could not unregister notification callback\n" );
1190
- mutex_unlock (& drv_info -> notify_lock );
1190
+ write_unlock (& drv_info -> notify_lock );
1191
1191
return rc ;
1192
1192
}
1193
1193
1194
1194
rc = ffa_notification_unbind (dev -> vm_id , BIT (notify_id ));
1195
1195
1196
- mutex_unlock (& drv_info -> notify_lock );
1196
+ write_unlock (& drv_info -> notify_lock );
1197
1197
1198
1198
return rc ;
1199
1199
}
@@ -1220,7 +1220,7 @@ static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu,
1220
1220
cb_info -> cb_data = cb_data ;
1221
1221
cb_info -> cb = cb ;
1222
1222
1223
- mutex_lock (& drv_info -> notify_lock );
1223
+ write_lock (& drv_info -> notify_lock );
1224
1224
1225
1225
if (is_per_vcpu )
1226
1226
flags = PER_VCPU_NOTIFICATION_FLAG ;
@@ -1237,7 +1237,7 @@ static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu,
1237
1237
}
1238
1238
1239
1239
out_unlock_free :
1240
- mutex_unlock (& drv_info -> notify_lock );
1240
+ write_unlock (& drv_info -> notify_lock );
1241
1241
if (rc )
1242
1242
kfree (cb_info );
1243
1243
@@ -1269,9 +1269,9 @@ static void handle_notif_callbacks(u64 bitmap, enum notify_type type)
1269
1269
if (!(bitmap & 1 ))
1270
1270
continue ;
1271
1271
1272
- mutex_lock (& drv_info -> notify_lock );
1272
+ read_lock (& drv_info -> notify_lock );
1273
1273
cb_info = notifier_hash_node_get (notify_id , type );
1274
- mutex_unlock (& drv_info -> notify_lock );
1274
+ read_unlock (& drv_info -> notify_lock );
1275
1275
1276
1276
if (cb_info && cb_info -> cb )
1277
1277
cb_info -> cb (notify_id , cb_info -> cb_data );
@@ -1721,7 +1721,7 @@ static void ffa_notifications_setup(void)
1721
1721
goto cleanup ;
1722
1722
1723
1723
hash_init (drv_info -> notifier_hash );
1724
- mutex_init (& drv_info -> notify_lock );
1724
+ rwlock_init (& drv_info -> notify_lock );
1725
1725
1726
1726
drv_info -> notif_enabled = true;
1727
1727
return ;
0 commit comments