Merge tag 'v6.5-rc6' into iommufd for-next
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 15 Aug 2023 13:01:26 +0000 (10:01 -0300)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 15 Aug 2023 13:01:26 +0000 (10:01 -0300)
Required for following patches.

Resolve merge conflict by using the hunk from the for-next branch and
shifting the iommufd_object_deref_user() into iommufd_hw_pagetable_put()

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1  2 
drivers/iommu/iommufd/device.c
drivers/iommu/iommufd/iommufd_private.h
drivers/iommu/iommufd/main.c

Simple merge
@@@ -255,34 -267,11 +266,34 @@@ struct iommufd_hw_pagetable 
  struct iommufd_hw_pagetable *
  iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
                           struct iommufd_device *idev, bool immediate_attach);
 +int iommufd_hw_pagetable_enforce_cc(struct iommufd_hw_pagetable *hwpt);
  int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt,
                                struct iommufd_device *idev);
 -void iommufd_hw_pagetable_detach(struct iommufd_hw_pagetable *hwpt,
 -                               struct iommufd_device *idev);
 +struct iommufd_hw_pagetable *
 +iommufd_hw_pagetable_detach(struct iommufd_device *idev);
  void iommufd_hw_pagetable_destroy(struct iommufd_object *obj);
-               iommufd_object_destroy_user(ictx, &hwpt->obj);
 +void iommufd_hw_pagetable_abort(struct iommufd_object *obj);
 +int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd);
 +
 +static inline void iommufd_hw_pagetable_put(struct iommufd_ctx *ictx,
 +                                          struct iommufd_hw_pagetable *hwpt)
 +{
 +      lockdep_assert_not_held(&hwpt->ioas->mutex);
 +      if (hwpt->auto_domain)
++              iommufd_object_deref_user(ictx, &hwpt->obj);
 +      else
 +              refcount_dec(&hwpt->obj.users);
 +}
 +
 +struct iommufd_group {
 +      struct kref ref;
 +      struct mutex lock;
 +      struct iommufd_ctx *ictx;
 +      struct iommu_group *group;
 +      struct iommufd_hw_pagetable *hwpt;
 +      struct list_head device_list;
 +      phys_addr_t sw_msi_start;
 +};
  
  /*
   * A iommufd_device object represents the binding relationship between a
Simple merge