diff mbox series

vfio/pci: Add driver_managed_dma to the new vfio_pci drivers

Message ID 0-v1-f9dfa642fab0+2b3-vfio_managed_dma_jgg@nvidia.com (mailing list archive)
State New, archived
Headers show
Series vfio/pci: Add driver_managed_dma to the new vfio_pci drivers | expand

Commit Message

Jason Gunthorpe May 19, 2022, 11:14 p.m. UTC
When the iommu series adding driver_managed_dma was rebased it missed that
new VFIO drivers were added and did not update them too.

Without this vfio will claim the groups are not viable.

Add driver_managed_dma to mlx5 and hisi.

Fixes: 70693f470848 ("vfio: Set DMA ownership for VFIO devices")
Reported-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 1 +
 drivers/vfio/pci/mlx5/main.c                   | 1 +
 2 files changed, 2 insertions(+)


base-commit: 9cfc47edbcd46edc6fb65ba00e7f12bacb1aab9c

Comments

Tian, Kevin May 20, 2022, 1:34 a.m. UTC | #1
> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Friday, May 20, 2022 7:14 AM
> 
> When the iommu series adding driver_managed_dma was rebased it missed
> that
> new VFIO drivers were added and did not update them too.
> 
> Without this vfio will claim the groups are not viable.
> 
> Add driver_managed_dma to mlx5 and hisi.
> 
> Fixes: 70693f470848 ("vfio: Set DMA ownership for VFIO devices")
> Reported-by: Yishai Hadas <yishaih@nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> ---
>  drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 1 +
>  drivers/vfio/pci/mlx5/main.c                   | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index e92376837b29e6..4def43f5f7b619 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -1323,6 +1323,7 @@ static struct pci_driver hisi_acc_vfio_pci_driver = {
>  	.probe = hisi_acc_vfio_pci_probe,
>  	.remove = hisi_acc_vfio_pci_remove,
>  	.err_handler = &hisi_acc_vf_err_handlers,
> +	.driver_managed_dma = true,
>  };
> 
>  module_pci_driver(hisi_acc_vfio_pci_driver);
> diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c
> index dd1009b5ff9c82..0558d0649ddb8c 100644
> --- a/drivers/vfio/pci/mlx5/main.c
> +++ b/drivers/vfio/pci/mlx5/main.c
> @@ -641,6 +641,7 @@ static struct pci_driver mlx5vf_pci_driver = {
>  	.probe = mlx5vf_pci_probe,
>  	.remove = mlx5vf_pci_remove,
>  	.err_handler = &mlx5vf_err_handlers,
> +	.driver_managed_dma = true,
>  };
> 
>  static void __exit mlx5vf_pci_cleanup(void)
> 
> base-commit: 9cfc47edbcd46edc6fb65ba00e7f12bacb1aab9c
> --
> 2.36.0
Shameerali Kolothum Thodi May 20, 2022, 10:20 a.m. UTC | #2
> -----Original Message-----
> From: Jason Gunthorpe [mailto:jgg@nvidia.com]
> Sent: 20 May 2022 00:14
> To: Cornelia Huck <cohuck@redhat.com>; Kevin Tian <kevin.tian@intel.com>;
> kvm@vger.kernel.org; liulongfang <liulongfang@huawei.com>; Shameerali
> Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>; Lu Baolu
> <baolu.lu@linux.intel.com>; Joerg Roedel <jroedel@suse.de>; Yishai Hadas
> <yishaih@nvidia.com>
> Subject: [PATCH] vfio/pci: Add driver_managed_dma to the new vfio_pci
> drivers
> 
> When the iommu series adding driver_managed_dma was rebased it missed
> that
> new VFIO drivers were added and did not update them too.
> 
> Without this vfio will claim the groups are not viable.
> 
> Add driver_managed_dma to mlx5 and hisi.
> 
> Fixes: 70693f470848 ("vfio: Set DMA ownership for VFIO devices")
> Reported-by: Yishai Hadas <yishaih@nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Thanks for this. Verified on HiSilicon platform.

FWIW:

Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>

Shameer


> ---
>  drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 1 +
>  drivers/vfio/pci/mlx5/main.c                   | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index e92376837b29e6..4def43f5f7b619 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -1323,6 +1323,7 @@ static struct pci_driver hisi_acc_vfio_pci_driver = {
>  	.probe = hisi_acc_vfio_pci_probe,
>  	.remove = hisi_acc_vfio_pci_remove,
>  	.err_handler = &hisi_acc_vf_err_handlers,
> +	.driver_managed_dma = true,
>  };
> 
>  module_pci_driver(hisi_acc_vfio_pci_driver);
> diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c
> index dd1009b5ff9c82..0558d0649ddb8c 100644
> --- a/drivers/vfio/pci/mlx5/main.c
> +++ b/drivers/vfio/pci/mlx5/main.c
> @@ -641,6 +641,7 @@ static struct pci_driver mlx5vf_pci_driver = {
>  	.probe = mlx5vf_pci_probe,
>  	.remove = mlx5vf_pci_remove,
>  	.err_handler = &mlx5vf_err_handlers,
> +	.driver_managed_dma = true,
>  };
> 
>  static void __exit mlx5vf_pci_cleanup(void)
> 
> base-commit: 9cfc47edbcd46edc6fb65ba00e7f12bacb1aab9c
> --
> 2.36.0
Alex Williamson May 24, 2022, 4:07 p.m. UTC | #3
On Thu, 19 May 2022 20:14:01 -0300
Jason Gunthorpe <jgg@nvidia.com> wrote:

> When the iommu series adding driver_managed_dma was rebased it missed that
> new VFIO drivers were added and did not update them too.
> 
> Without this vfio will claim the groups are not viable.
> 
> Add driver_managed_dma to mlx5 and hisi.
> 
> Fixes: 70693f470848 ("vfio: Set DMA ownership for VFIO devices")
> Reported-by: Yishai Hadas <yishaih@nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 1 +
>  drivers/vfio/pci/mlx5/main.c                   | 1 +
>  2 files changed, 2 insertions(+)

Applied to vfio next branch for v5.19.  Thanks,

Alex
diff mbox series

Patch

diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index e92376837b29e6..4def43f5f7b619 100644
--- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
+++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
@@ -1323,6 +1323,7 @@  static struct pci_driver hisi_acc_vfio_pci_driver = {
 	.probe = hisi_acc_vfio_pci_probe,
 	.remove = hisi_acc_vfio_pci_remove,
 	.err_handler = &hisi_acc_vf_err_handlers,
+	.driver_managed_dma = true,
 };
 
 module_pci_driver(hisi_acc_vfio_pci_driver);
diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c
index dd1009b5ff9c82..0558d0649ddb8c 100644
--- a/drivers/vfio/pci/mlx5/main.c
+++ b/drivers/vfio/pci/mlx5/main.c
@@ -641,6 +641,7 @@  static struct pci_driver mlx5vf_pci_driver = {
 	.probe = mlx5vf_pci_probe,
 	.remove = mlx5vf_pci_remove,
 	.err_handler = &mlx5vf_err_handlers,
+	.driver_managed_dma = true,
 };
 
 static void __exit mlx5vf_pci_cleanup(void)