crypto: qat - move vf2pf interrupt helpers
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Wed, 17 Nov 2021 14:30:37 +0000 (14:30 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 26 Nov 2021 05:20:45 +0000 (16:20 +1100)
Move vf2pf interrupt enable and disable functions from adf_pf2vf_msg.c
to adf_isr.c
This it to separate the interrupt related code from the PFVF protocol
logic.

With this change, the function adf_disable_vf2pf_interrupts_irq() is
only called from adf_isr.c and it has been marked as static.

Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/adf_common_drv.h
drivers/crypto/qat/qat_common/adf_isr.c
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c

index de94b76..4f9f94d 100644 (file)
@@ -193,8 +193,6 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs);
 void adf_disable_sriov(struct adf_accel_dev *accel_dev);
 void adf_disable_vf2pf_interrupts(struct adf_accel_dev *accel_dev,
                                  u32 vf_mask);
-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);
index 5dfc534..2b4900c 100644 (file)
@@ -55,6 +55,45 @@ static irqreturn_t adf_msix_isr_bundle(int irq, void *bank_ptr)
 }
 
 #ifdef CONFIG_PCI_IOV
+void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, u32 vf_mask)
+{
+       struct adf_hw_device_data *hw_data = accel_dev->hw_device;
+       u32 misc_bar_id = hw_data->get_misc_bar_id(hw_data);
+       struct adf_bar *pmisc = &GET_BARS(accel_dev)[misc_bar_id];
+       void __iomem *pmisc_addr = pmisc->virt_addr;
+       unsigned long flags;
+
+       spin_lock_irqsave(&accel_dev->pf.vf2pf_ints_lock, flags);
+       hw_data->enable_vf2pf_interrupts(pmisc_addr, vf_mask);
+       spin_unlock_irqrestore(&accel_dev->pf.vf2pf_ints_lock, flags);
+}
+
+void adf_disable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, u32 vf_mask)
+{
+       struct adf_hw_device_data *hw_data = accel_dev->hw_device;
+       u32 misc_bar_id = hw_data->get_misc_bar_id(hw_data);
+       struct adf_bar *pmisc = &GET_BARS(accel_dev)[misc_bar_id];
+       void __iomem *pmisc_addr = pmisc->virt_addr;
+       unsigned long flags;
+
+       spin_lock_irqsave(&accel_dev->pf.vf2pf_ints_lock, flags);
+       hw_data->disable_vf2pf_interrupts(pmisc_addr, vf_mask);
+       spin_unlock_irqrestore(&accel_dev->pf.vf2pf_ints_lock, flags);
+}
+
+static void adf_disable_vf2pf_interrupts_irq(struct adf_accel_dev *accel_dev,
+                                            u32 vf_mask)
+{
+       struct adf_hw_device_data *hw_data = accel_dev->hw_device;
+       u32 misc_bar_id = hw_data->get_misc_bar_id(hw_data);
+       struct adf_bar *pmisc = &GET_BARS(accel_dev)[misc_bar_id];
+       void __iomem *pmisc_addr = pmisc->virt_addr;
+
+       spin_lock(&accel_dev->pf.vf2pf_ints_lock);
+       hw_data->disable_vf2pf_interrupts(pmisc_addr, vf_mask);
+       spin_unlock(&accel_dev->pf.vf2pf_ints_lock);
+}
+
 static bool adf_handle_vf2pf_int(struct adf_accel_dev *accel_dev)
 {
        struct adf_hw_device_data *hw_data = accel_dev->hw_device;
index 99ee17c..d049253 100644 (file)
                                         ADF_PFVF_MSG_ACK_MAX_RETRY + \
                                         ADF_PFVF_MSG_COLLISION_DETECT_DELAY)
 
-void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, u32 vf_mask)
-{
-       struct adf_hw_device_data *hw_data = accel_dev->hw_device;
-       u32 misc_bar_id = hw_data->get_misc_bar_id(hw_data);
-       struct adf_bar *pmisc = &GET_BARS(accel_dev)[misc_bar_id];
-       void __iomem *pmisc_addr = pmisc->virt_addr;
-       unsigned long flags;
-
-       spin_lock_irqsave(&accel_dev->pf.vf2pf_ints_lock, flags);
-       hw_data->enable_vf2pf_interrupts(pmisc_addr, vf_mask);
-       spin_unlock_irqrestore(&accel_dev->pf.vf2pf_ints_lock, flags);
-}
-
-void adf_disable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, u32 vf_mask)
-{
-       struct adf_hw_device_data *hw_data = accel_dev->hw_device;
-       u32 misc_bar_id = hw_data->get_misc_bar_id(hw_data);
-       struct adf_bar *pmisc = &GET_BARS(accel_dev)[misc_bar_id];
-       void __iomem *pmisc_addr = pmisc->virt_addr;
-       unsigned long flags;
-
-       spin_lock_irqsave(&accel_dev->pf.vf2pf_ints_lock, flags);
-       hw_data->disable_vf2pf_interrupts(pmisc_addr, vf_mask);
-       spin_unlock_irqrestore(&accel_dev->pf.vf2pf_ints_lock, flags);
-}
-
-void adf_disable_vf2pf_interrupts_irq(struct adf_accel_dev *accel_dev,
-                                     u32 vf_mask)
-{
-       struct adf_hw_device_data *hw_data = accel_dev->hw_device;
-       u32 misc_bar_id = hw_data->get_misc_bar_id(hw_data);
-       struct adf_bar *pmisc = &GET_BARS(accel_dev)[misc_bar_id];
-       void __iomem *pmisc_addr = pmisc->virt_addr;
-
-       spin_lock(&accel_dev->pf.vf2pf_ints_lock);
-       hw_data->disable_vf2pf_interrupts(pmisc_addr, vf_mask);
-       spin_unlock(&accel_dev->pf.vf2pf_ints_lock);
-}
-
 static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)
 {
        struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev;