Unverified Commit ba7ea028 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6149 [sync] PR-6101: vfio/pci: Disable auto-enable of exclusive INTx IRQ

parents ac4e4642 c623ec2a
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -199,8 +199,15 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)

	vdev->ctx[0].trigger = trigger;

	/*
	 * Devices without DisINTx support require an exclusive interrupt,
	 * IRQ masking is performed at the IRQ chip.  The masked status is
	 * protected by vdev->irqlock. Setup the IRQ without auto-enable and
	 * unmask as necessary below under lock.  DisINTx is unmodified by
	 * the IRQ configuration and may therefore use auto-enable.
	 */
	if (!vdev->pci_2_3)
		irqflags = 0;
		irqflags = IRQF_NO_AUTOEN;

	ret = request_irq(pdev->irq, vfio_intx_handler,
			  irqflags, vdev->ctx[0].name, vdev);
@@ -211,13 +218,9 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)
		return ret;
	}

	/*
	 * INTx disable will stick across the new irq setup,
	 * disable_irq won't.
	 */
	spin_lock_irqsave(&vdev->irqlock, flags);
	if (!vdev->pci_2_3 && vdev->ctx[0].masked)
		disable_irq_nosync(pdev->irq);
	if (!vdev->pci_2_3 && !vdev->ctx[0].masked)
		enable_irq(pdev->irq);
	spin_unlock_irqrestore(&vdev->irqlock, flags);

	return 0;