Lines Matching +full:device +full:- +full:specific
1 // SPDX-License-Identifier: GPL-2.0-or-later
24 * virtcrypto_devmgr_add_dev() - Add vcrypto_dev to the acceleration
26 * @vcrypto_dev: Pointer to virtio crypto device.
28 * Function adds virtio crypto device to the global list.
29 * To be used by virtio crypto device specific drivers.
42 return -EFAULT; in virtcrypto_devmgr_add_dev()
51 return -EEXIST; in virtcrypto_devmgr_add_dev()
54 atomic_set(&vcrypto_dev->ref_count, 0); in virtcrypto_devmgr_add_dev()
55 list_add_tail(&vcrypto_dev->list, &virtio_crypto_table); in virtcrypto_devmgr_add_dev()
56 vcrypto_dev->dev_id = num_devices++; in virtcrypto_devmgr_add_dev()
67 * virtcrypto_devmgr_rm_dev() - Remove vcrypto_dev from the acceleration
69 * @vcrypto_dev: Pointer to virtio crypto device.
71 * Function removes virtio crypto device from the acceleration framework.
72 * To be used by virtio crypto device specific drivers.
79 list_del(&vcrypto_dev->list); in virtcrypto_devmgr_rm_dev()
80 num_devices--; in virtcrypto_devmgr_rm_dev()
87 * Function returns the first virtio crypto device from the acceleration
90 * To be used by virtio crypto device specific drivers.
108 * virtcrypto_dev_in_use() - Check whether vcrypto_dev is currently in use
109 * @vcrypto_dev: Pointer to virtio crypto device.
111 * To be used by virtio crypto device specific drivers.
113 * Return: 1 when device is in use, 0 otherwise.
117 return atomic_read(&vcrypto_dev->ref_count) != 0; in virtcrypto_dev_in_use()
121 * virtcrypto_dev_get() - Increment vcrypto_dev reference count
122 * @vcrypto_dev: Pointer to virtio crypto device.
127 * To be used by virtio crypto device specific drivers.
133 if (atomic_add_return(1, &vcrypto_dev->ref_count) == 1) in virtcrypto_dev_get()
134 if (!try_module_get(vcrypto_dev->owner)) in virtcrypto_dev_get()
135 return -EFAULT; in virtcrypto_dev_get()
140 * virtcrypto_dev_put() - Decrement vcrypto_dev reference count
141 * @vcrypto_dev: Pointer to virtio crypto device.
146 * To be used by virtio crypto device specific drivers.
152 if (atomic_sub_return(1, &vcrypto_dev->ref_count) == 0) in virtcrypto_dev_put()
153 module_put(vcrypto_dev->owner); in virtcrypto_dev_put()
157 * virtcrypto_dev_started() - Check whether device has started
158 * @vcrypto_dev: Pointer to virtio crypto device.
160 * To be used by virtio crypto device specific drivers.
162 * Return: 1 when the device has started, 0 otherwise
166 return (vcrypto_dev->status & VIRTIO_CRYPTO_S_HW_READY); in virtcrypto_dev_started()
170 * virtcrypto_get_dev_node() - Get vcrypto_dev on the node.
177 * Function returns the virtio crypto device used fewest on the node,
180 * To be used by virtio crypto device specific drivers.
194 if ((node == dev_to_node(&tmp_dev->vdev->dev) || in virtcrypto_get_dev_node()
195 dev_to_node(&tmp_dev->vdev->dev) < 0) && in virtcrypto_get_dev_node()
198 ctr = atomic_read(&tmp_dev->ref_count); in virtcrypto_get_dev_node()
207 pr_info("virtio_crypto: Could not find a device on node %d\n", in virtcrypto_get_dev_node()
209 /* Get any started device */ in virtcrypto_get_dev_node()
229 * virtcrypto_dev_start() - Start virtio crypto device
230 * @vcrypto: Pointer to virtio crypto device.
232 * Function notifies all the registered services that the virtio crypto device
234 * To be used by virtio crypto device specific drivers.
242 return -EFAULT; in virtcrypto_dev_start()
248 return -EFAULT; in virtcrypto_dev_start()
255 * virtcrypto_dev_stop() - Stop virtio crypto device
256 * @vcrypto: Pointer to virtio crypto device.
258 * Function notifies all the registered services that the virtio crypto device
260 * To be used by virtio crypto device specific drivers.
272 * @vcrypto: Pointer to virtio crypto device.
278 * Validate if the virtio crypto device supports a service and
281 * Return true if device supports a service and algo.
293 algo -= 32; in virtcrypto_algo_is_supported()
297 if (!(vcrypto->crypto_services & service_mask)) in virtcrypto_algo_is_supported()
303 algo_mask = vcrypto->cipher_algo_l; in virtcrypto_algo_is_supported()
305 algo_mask = vcrypto->cipher_algo_h; in virtcrypto_algo_is_supported()
309 algo_mask = vcrypto->hash_algo; in virtcrypto_algo_is_supported()
314 algo_mask = vcrypto->mac_algo_l; in virtcrypto_algo_is_supported()
316 algo_mask = vcrypto->mac_algo_h; in virtcrypto_algo_is_supported()
320 algo_mask = vcrypto->aead_algo; in virtcrypto_algo_is_supported()
324 algo_mask = vcrypto->akcipher_algo; in virtcrypto_algo_is_supported()