From: Stephen Rothwell Date: Mon, 31 Jul 2023 03:16:45 +0000 (+1000) Subject: Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6b93248c0b0999928823334d4de144364ff6a169;p=users%2Fwilly%2Fpagecache.git Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git --- 6b93248c0b0999928823334d4de144364ff6a169 diff --cc drivers/iommu/iommufd/iommufd_private.h index 0349d7aea59ad,8ba786bc95ff8..da84aed5ad937 --- a/drivers/iommu/iommufd/iommufd_private.h +++ b/drivers/iommu/iommufd/iommufd_private.h @@@ -267,11 -255,34 +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); + 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_destroy_user(ictx, &hwpt->obj); ++ 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