Re: [PATCH v3 06/11] vfio/pci: Use never-managed version of pci_intx()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[cc->to: Alex W]

On Mon, Dec 09, 2024 at 02:06:28PM +0100, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
> 
> vfio enables its PCI-Device with pci_enable_device(). Thus, it
> needs the never-managed version.
> 
> Replace pci_intx() with pci_intx_unmanaged().
> 
> Signed-off-by: Philipp Stanner <pstanner@xxxxxxxxxx>

Not applied yet, pending ack from Alex.

> ---
>  drivers/vfio/pci/vfio_pci_core.c  |  2 +-
>  drivers/vfio/pci/vfio_pci_intrs.c | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
> index 1ab58da9f38a..90240c8d51aa 100644
> --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -498,7 +498,7 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev)
>  		if (vfio_pci_nointx(pdev)) {
>  			pci_info(pdev, "Masking broken INTx support\n");
>  			vdev->nointx = true;
> -			pci_intx(pdev, 0);
> +			pci_intx_unmanaged(pdev, 0);
>  		} else
>  			vdev->pci_2_3 = pci_intx_mask_supported(pdev);
>  	}
> diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
> index 8382c5834335..40abb0b937a2 100644
> --- a/drivers/vfio/pci/vfio_pci_intrs.c
> +++ b/drivers/vfio/pci/vfio_pci_intrs.c
> @@ -118,7 +118,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
>  	 */
>  	if (unlikely(!is_intx(vdev))) {
>  		if (vdev->pci_2_3)
> -			pci_intx(pdev, 0);
> +			pci_intx_unmanaged(pdev, 0);
>  		goto out_unlock;
>  	}
>  
> @@ -132,7 +132,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
>  		 * mask, not just when something is pending.
>  		 */
>  		if (vdev->pci_2_3)
> -			pci_intx(pdev, 0);
> +			pci_intx_unmanaged(pdev, 0);
>  		else
>  			disable_irq_nosync(pdev->irq);
>  
> @@ -178,7 +178,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *data)
>  	 */
>  	if (unlikely(!is_intx(vdev))) {
>  		if (vdev->pci_2_3)
> -			pci_intx(pdev, 1);
> +			pci_intx_unmanaged(pdev, 1);
>  		goto out_unlock;
>  	}
>  
> @@ -296,7 +296,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,
>  	 */
>  	ctx->masked = vdev->virq_disabled;
>  	if (vdev->pci_2_3) {
> -		pci_intx(pdev, !ctx->masked);
> +		pci_intx_unmanaged(pdev, !ctx->masked);
>  		irqflags = IRQF_SHARED;
>  	} else {
>  		irqflags = ctx->masked ? IRQF_NO_AUTOEN : 0;
> @@ -569,7 +569,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix)
>  	 * via their shutdown paths.  Restore for NoINTx devices.
>  	 */
>  	if (vdev->nointx)
> -		pci_intx(pdev, 0);
> +		pci_intx_unmanaged(pdev, 0);
>  
>  	vdev->irq_type = VFIO_PCI_NUM_IRQS;
>  }
> -- 
> 2.47.1
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux