[RFC,7/7] iommufd: Skip the CACHE_COHERENCY and iommu group check

Message ID 20230923170540.1447301-8-lulu@redhat.com
State New
Headers
Series vdpa: Add support for iommufd |

Commit Message

Cindy Lu Sept. 23, 2023, 5:05 p.m. UTC
  This is just the work arround for vdpa, I Will
fix these problems in the next version.

Skip these 2 checks:
1.IOMMU_CAP_CACHE_COHERENCY check
2.iommu_group_get check

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 drivers/iommu/iommufd/device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Jason Gunthorpe Sept. 25, 2023, 1:50 p.m. UTC | #1
On Sun, Sep 24, 2023 at 01:05:40AM +0800, Cindy Lu wrote:
> This is just the work arround for vdpa, I Will
> fix these problems in the next version.
> 
> Skip these 2 checks:
> 1.IOMMU_CAP_CACHE_COHERENCY check
> 2.iommu_group_get check

Uuh, something has gone really, really wrong if you need to skip these
checks in the core iommufd code..

Jason
  
Cindy Lu Sept. 26, 2023, 8:02 a.m. UTC | #2
On Mon, Sep 25, 2023 at 9:50 PM Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> On Sun, Sep 24, 2023 at 01:05:40AM +0800, Cindy Lu wrote:
> > This is just the work arround for vdpa, I Will
> > fix these problems in the next version.
> >
> > Skip these 2 checks:
> > 1.IOMMU_CAP_CACHE_COHERENCY check
> > 2.iommu_group_get check
>
> Uuh, something has gone really, really wrong if you need to skip these
> checks in the core iommufd code..
>
there are problems in this code, I will continue working in this.
Thanks
Cindy
> Jason
>
  

Patch

diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index f7cb353fd9c7..0224d751f503 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -71,8 +71,8 @@  struct iommufd_device *iommufd_device_bind(struct iommufd_ctx *ictx,
 	 * to restore cache coherency.
 	 */
 	if (!device_iommu_capable(dev, IOMMU_CAP_CACHE_COHERENCY))
-		return ERR_PTR(-EINVAL);
-
+		//return ERR_PTR(-EINVAL);
+#if 0
 	group = iommu_group_get(dev);
 	if (!group)
 		return ERR_PTR(-ENODEV);
@@ -80,7 +80,7 @@  struct iommufd_device *iommufd_device_bind(struct iommufd_ctx *ictx,
 	rc = iommu_device_claim_dma_owner(dev, ictx);
 	if (rc)
 		goto out_group_put;
-
+#endif
 	idev = iommufd_object_alloc(ictx, idev, IOMMUFD_OBJ_DEVICE);
 	if (IS_ERR(idev)) {
 		rc = PTR_ERR(idev);