crypto: qat - share adf_enable_pf2vf_comms() from adf_pf2vf_msg.c
authorMarco Chiappero <marco.chiappero@intel.com>
Tue, 28 Sep 2021 11:44:40 +0000 (12:44 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 Oct 2021 12:02:44 +0000 (20:02 +0800)
The PFVF protocol "enable" functions are direction specific but not
device specific. Move the protocol enable function for the PF into the
PF specific protocol file for better file organization and duplicated
code reduction.

NOTE: the patch keeps gen4 disabled as it doesn't have full PFVF
support yet.

Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c
drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c
drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c
drivers/crypto/qat/qat_common/adf_common_drv.h
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c

index 88c0ded411f15792d27a6a858be4452f19f9a819..fa768f10635fdc8f8461ffa800556f38186fbdc0 100644 (file)
@@ -191,7 +191,7 @@ static int adf_init_device(struct adf_accel_dev *accel_dev)
        return ret;
 }
 
-static int adf_enable_pf2vf_comms(struct adf_accel_dev *accel_dev)
+static int pfvf_comms_disabled(struct adf_accel_dev *accel_dev)
 {
        return 0;
 }
@@ -253,7 +253,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data)
        hw_data->uof_get_ae_mask = uof_get_ae_mask;
        hw_data->set_msix_rttable = set_msix_default_rttable;
        hw_data->set_ssm_wdtimer = adf_gen4_set_ssm_wdtimer;
-       hw_data->enable_pfvf_comms = adf_enable_pf2vf_comms;
+       hw_data->enable_pfvf_comms = pfvf_comms_disabled;
        hw_data->disable_iov = adf_disable_sriov;
        hw_data->min_iov_compat_ver = ADF_PFVF_COMPAT_THIS_VERSION;
 
index 6a39d2e7f4c0cba8224b42fd1c20cce73fba1073..1fa690219d9250d13cd58de4def91ff716f4481d 100644 (file)
@@ -91,13 +91,6 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)
                   ADF_C3XXX_SMIA1_MASK);
 }
 
-static int adf_enable_pf2vf_comms(struct adf_accel_dev *accel_dev)
-{
-       spin_lock_init(&accel_dev->pf.vf2pf_ints_lock);
-
-       return 0;
-}
-
 static void configure_iov_threads(struct adf_accel_dev *accel_dev, bool enable)
 {
        adf_gen2_cfg_iov_thds(accel_dev, enable,
index e259ca38a653628ff7e5079bfd091db1556aada4..0613db0776896ab10c4409e33ecad753dfd785ce 100644 (file)
@@ -93,13 +93,6 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)
                   ADF_C62X_SMIA1_MASK);
 }
 
-static int adf_enable_pf2vf_comms(struct adf_accel_dev *accel_dev)
-{
-       spin_lock_init(&accel_dev->pf.vf2pf_ints_lock);
-
-       return 0;
-}
-
 static void configure_iov_threads(struct adf_accel_dev *accel_dev, bool enable)
 {
        adf_gen2_cfg_iov_thds(accel_dev, enable,
index dd82272019ecdcb2072aac87f2cf84037d1fb791..2cc6622833c449471af0e3237a81a364f174efe4 100644 (file)
@@ -196,6 +196,7 @@ void adf_disable_vf2pf_interrupts_irq(struct adf_accel_dev *accel_dev,
                                      u32 vf_mask);
 void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev,
                                 u32 vf_mask);
+int adf_enable_pf2vf_comms(struct adf_accel_dev *accel_dev);
 void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
 void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
 void adf_schedule_vf2pf_handler(struct adf_accel_vf_info *vf_info);
@@ -210,6 +211,11 @@ void adf_flush_vf_wq(struct adf_accel_dev *accel_dev);
 #else
 #define adf_sriov_configure NULL
 
+static inline int adf_enable_pf2vf_comms(struct adf_accel_dev *accel_dev)
+{
+       return 0;
+}
+
 static inline void adf_disable_sriov(struct adf_accel_dev *accel_dev)
 {
 }
index 711f6e3f66735efcaaeab4f507737e27854dd023..59860bdaedb69b42b0434750c66d79ef2b43bcd9 100644 (file)
@@ -396,3 +396,21 @@ int adf_enable_vf2pf_comms(struct adf_accel_dev *accel_dev)
        return adf_vf2pf_request_version(accel_dev);
 }
 EXPORT_SYMBOL_GPL(adf_enable_vf2pf_comms);
+
+/**
+ * adf_enable_pf2vf_comms() - Function enables communication from pf to vf
+ *
+ * @accel_dev: Pointer to acceleration device virtual function.
+ *
+ * This function carries out the necessary steps to setup and start the PFVF
+ * communication channel, if any.
+ *
+ * Return: 0 on success, error code otherwise.
+ */
+int adf_enable_pf2vf_comms(struct adf_accel_dev *accel_dev)
+{
+       spin_lock_init(&accel_dev->pf.vf2pf_ints_lock);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(adf_enable_pf2vf_comms);
index e5e64f880fbfaafed6199a26113f0ae9cf0dc696..8e2e1554dcf6a2ef3014bf1bb366d09e237d5257 100644 (file)
@@ -158,13 +158,6 @@ static void disable_vf2pf_interrupts(void __iomem *pmisc_addr, u32 vf_mask)
        }
 }
 
-static int adf_enable_pf2vf_comms(struct adf_accel_dev *accel_dev)
-{
-       spin_lock_init(&accel_dev->pf.vf2pf_ints_lock);
-
-       return 0;
-}
-
 static void configure_iov_threads(struct adf_accel_dev *accel_dev, bool enable)
 {
        adf_gen2_cfg_iov_thds(accel_dev, enable,