Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / crypto / qat / qat_common / adf_vf2pf_msg.c
blob2c98fb63f7b7218bac08bc56658f7bb18bb08240
1 // SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
2 /* Copyright(c) 2015 - 2020 Intel Corporation */
3 #include "adf_accel_devices.h"
4 #include "adf_common_drv.h"
5 #include "adf_pf2vf_msg.h"
7 /**
8 * adf_vf2pf_init() - send init msg to PF
9 * @accel_dev: Pointer to acceleration VF device.
11 * Function sends an init messge from the VF to a PF
13 * Return: 0 on success, error code otherwise.
15 int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
17 u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
18 (ADF_VF2PF_MSGTYPE_INIT << ADF_VF2PF_MSGTYPE_SHIFT));
20 if (adf_iov_putmsg(accel_dev, msg, 0)) {
21 dev_err(&GET_DEV(accel_dev),
22 "Failed to send Init event to PF\n");
23 return -EFAULT;
25 set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
26 return 0;
28 EXPORT_SYMBOL_GPL(adf_vf2pf_init);
30 /**
31 * adf_vf2pf_shutdown() - send shutdown msg to PF
32 * @accel_dev: Pointer to acceleration VF device.
34 * Function sends a shutdown messge from the VF to a PF
36 * Return: void
38 void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
40 u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
41 (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT));
43 if (test_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status))
44 if (adf_iov_putmsg(accel_dev, msg, 0))
45 dev_err(&GET_DEV(accel_dev),
46 "Failed to send Shutdown event to PF\n");
48 EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown);