Commit 9744a7ab authored by Jason Gunthorpe's avatar Jason Gunthorpe

iommufd: Rename IOMMUFD_OBJ_HW_PAGETABLE to IOMMUFD_OBJ_HWPT_PAGING

To add a new IOMMUFD_OBJ_HWPT_NESTED, rename the HWPT object to confine
it to PAGING hwpts/domains. The following patch will separate the hwpt
structure as well.

Link: https://lore.kernel.org/r/20231026043938.63898-3-yi.l.liu@intel.comSigned-off-by: default avatarNicolin Chen <nicolinc@nvidia.com>
Signed-off-by: default avatarYi Liu <yi.l.liu@intel.com>
Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 54d60681
...@@ -563,7 +563,7 @@ static int iommufd_device_change_pt(struct iommufd_device *idev, u32 *pt_id, ...@@ -563,7 +563,7 @@ static int iommufd_device_change_pt(struct iommufd_device *idev, u32 *pt_id,
return PTR_ERR(pt_obj); return PTR_ERR(pt_obj);
switch (pt_obj->type) { switch (pt_obj->type) {
case IOMMUFD_OBJ_HW_PAGETABLE: { case IOMMUFD_OBJ_HWPT_PAGING: {
struct iommufd_hw_pagetable *hwpt = struct iommufd_hw_pagetable *hwpt =
container_of(pt_obj, struct iommufd_hw_pagetable, obj); container_of(pt_obj, struct iommufd_hw_pagetable, obj);
...@@ -601,8 +601,8 @@ static int iommufd_device_change_pt(struct iommufd_device *idev, u32 *pt_id, ...@@ -601,8 +601,8 @@ static int iommufd_device_change_pt(struct iommufd_device *idev, u32 *pt_id,
/** /**
* iommufd_device_attach - Connect a device to an iommu_domain * iommufd_device_attach - Connect a device to an iommu_domain
* @idev: device to attach * @idev: device to attach
* @pt_id: Input a IOMMUFD_OBJ_IOAS, or IOMMUFD_OBJ_HW_PAGETABLE * @pt_id: Input a IOMMUFD_OBJ_IOAS, or IOMMUFD_OBJ_HWPT_PAGING
* Output the IOMMUFD_OBJ_HW_PAGETABLE ID * Output the IOMMUFD_OBJ_HWPT_PAGING ID
* *
* This connects the device to an iommu_domain, either automatically or manually * This connects the device to an iommu_domain, either automatically or manually
* selected. Once this completes the device could do DMA. * selected. Once this completes the device could do DMA.
...@@ -630,8 +630,8 @@ EXPORT_SYMBOL_NS_GPL(iommufd_device_attach, IOMMUFD); ...@@ -630,8 +630,8 @@ EXPORT_SYMBOL_NS_GPL(iommufd_device_attach, IOMMUFD);
/** /**
* iommufd_device_replace - Change the device's iommu_domain * iommufd_device_replace - Change the device's iommu_domain
* @idev: device to change * @idev: device to change
* @pt_id: Input a IOMMUFD_OBJ_IOAS, or IOMMUFD_OBJ_HW_PAGETABLE * @pt_id: Input a IOMMUFD_OBJ_IOAS, or IOMMUFD_OBJ_HWPT_PAGING
* Output the IOMMUFD_OBJ_HW_PAGETABLE ID * Output the IOMMUFD_OBJ_HWPT_PAGING ID
* *
* This is the same as:: * This is the same as::
* *
......
...@@ -86,7 +86,7 @@ iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas, ...@@ -86,7 +86,7 @@ iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
if (flags && !ops->domain_alloc_user) if (flags && !ops->domain_alloc_user)
return ERR_PTR(-EOPNOTSUPP); return ERR_PTR(-EOPNOTSUPP);
hwpt = iommufd_object_alloc(ictx, hwpt, IOMMUFD_OBJ_HW_PAGETABLE); hwpt = iommufd_object_alloc(ictx, hwpt, IOMMUFD_OBJ_HWPT_PAGING);
if (IS_ERR(hwpt)) if (IS_ERR(hwpt))
return hwpt; return hwpt;
......
...@@ -123,7 +123,7 @@ enum iommufd_object_type { ...@@ -123,7 +123,7 @@ enum iommufd_object_type {
IOMMUFD_OBJ_NONE, IOMMUFD_OBJ_NONE,
IOMMUFD_OBJ_ANY = IOMMUFD_OBJ_NONE, IOMMUFD_OBJ_ANY = IOMMUFD_OBJ_NONE,
IOMMUFD_OBJ_DEVICE, IOMMUFD_OBJ_DEVICE,
IOMMUFD_OBJ_HW_PAGETABLE, IOMMUFD_OBJ_HWPT_PAGING,
IOMMUFD_OBJ_IOAS, IOMMUFD_OBJ_IOAS,
IOMMUFD_OBJ_ACCESS, IOMMUFD_OBJ_ACCESS,
#ifdef CONFIG_IOMMUFD_TEST #ifdef CONFIG_IOMMUFD_TEST
...@@ -256,7 +256,7 @@ static inline struct iommufd_hw_pagetable * ...@@ -256,7 +256,7 @@ static inline struct iommufd_hw_pagetable *
iommufd_get_hwpt(struct iommufd_ucmd *ucmd, u32 id) iommufd_get_hwpt(struct iommufd_ucmd *ucmd, u32 id)
{ {
return container_of(iommufd_get_object(ucmd->ictx, id, return container_of(iommufd_get_object(ucmd->ictx, id,
IOMMUFD_OBJ_HW_PAGETABLE), IOMMUFD_OBJ_HWPT_PAGING),
struct iommufd_hw_pagetable, obj); struct iommufd_hw_pagetable, obj);
} }
int iommufd_hwpt_set_dirty_tracking(struct iommufd_ucmd *ucmd); int iommufd_hwpt_set_dirty_tracking(struct iommufd_ucmd *ucmd);
......
...@@ -488,7 +488,7 @@ static const struct iommufd_object_ops iommufd_object_ops[] = { ...@@ -488,7 +488,7 @@ static const struct iommufd_object_ops iommufd_object_ops[] = {
[IOMMUFD_OBJ_IOAS] = { [IOMMUFD_OBJ_IOAS] = {
.destroy = iommufd_ioas_destroy, .destroy = iommufd_ioas_destroy,
}, },
[IOMMUFD_OBJ_HW_PAGETABLE] = { [IOMMUFD_OBJ_HWPT_PAGING] = {
.destroy = iommufd_hw_pagetable_destroy, .destroy = iommufd_hw_pagetable_destroy,
.abort = iommufd_hw_pagetable_abort, .abort = iommufd_hw_pagetable_abort,
}, },
......
...@@ -437,7 +437,7 @@ get_md_pagetable(struct iommufd_ucmd *ucmd, u32 mockpt_id, ...@@ -437,7 +437,7 @@ get_md_pagetable(struct iommufd_ucmd *ucmd, u32 mockpt_id,
struct iommufd_object *obj; struct iommufd_object *obj;
obj = iommufd_get_object(ucmd->ictx, mockpt_id, obj = iommufd_get_object(ucmd->ictx, mockpt_id,
IOMMUFD_OBJ_HW_PAGETABLE); IOMMUFD_OBJ_HWPT_PAGING);
if (IS_ERR(obj)) if (IS_ERR(obj))
return ERR_CAST(obj); return ERR_CAST(obj);
hwpt = container_of(obj, struct iommufd_hw_pagetable, obj); hwpt = container_of(obj, struct iommufd_hw_pagetable, obj);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment