Commit 95b4d40e authored by Marco Chiappero's avatar Marco Chiappero Committed by Herbert Xu
Browse files

crypto: qat - refactor PF top half for PFVF



Move logic associated to handling VF2PF interrupt to its own function.
This will simplify the handling of multiple interrupt sources in the
function adf_msix_isr_ae() in the future.

Signed-off-by: default avatarMarco Chiappero <marco.chiappero@intel.com>
Co-developed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 5002200b
Loading
Loading
Loading
Loading
+44 −40
Original line number Diff line number Diff line
@@ -54,17 +54,14 @@ static irqreturn_t adf_msix_isr_bundle(int irq, void *bank_ptr)
	return IRQ_HANDLED;
}

static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
{
	struct adf_accel_dev *accel_dev = dev_ptr;

#ifdef CONFIG_PCI_IOV
	/* If SR-IOV is enabled (vf_info is non-NULL), check for VF->PF ints */
	if (accel_dev->pf.vf_info) {
static bool adf_handle_vf2pf_int(struct adf_accel_dev *accel_dev)
{
	struct adf_hw_device_data *hw_data = accel_dev->hw_device;
		struct adf_bar *pmisc =
			&GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
	int bar_id = hw_data->get_misc_bar_id(hw_data);
	struct adf_bar *pmisc = &GET_BARS(accel_dev)[bar_id];
	void __iomem *pmisc_addr = pmisc->virt_addr;
	bool irq_handled = false;
	unsigned long vf_mask;

	/* Get the interrupt sources triggered by VFs */
@@ -72,7 +69,6 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)

	if (vf_mask) {
		struct adf_accel_vf_info *vf_info;
			bool irq_handled = false;
		int i;

		/* Disable VF2PF interrupts for VFs with pending ints */
@@ -95,13 +91,21 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
			adf_schedule_vf2pf_handler(vf_info);
			irq_handled = true;
		}

			if (irq_handled)
				return IRQ_HANDLED;
	}
	return irq_handled;
}
#endif /* CONFIG_PCI_IOV */

static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
{
	struct adf_accel_dev *accel_dev = dev_ptr;

#ifdef CONFIG_PCI_IOV
	/* If SR-IOV is enabled (vf_info is non-NULL), check for VF->PF ints */
	if (accel_dev->pf.vf_info && adf_handle_vf2pf_int(accel_dev))
		return IRQ_HANDLED;
#endif /* CONFIG_PCI_IOV */

	dev_dbg(&GET_DEV(accel_dev), "qat_dev%d spurious AE interrupt\n",
		accel_dev->accel_id);