iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas()
No need to pass the iommufd_ucmd pointer. Link: https://lore.kernel.org/r/20230327093351.44505-2-yi.l.liu@intel.com Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
fe15c26ee2
commit
325de95029
|
@ -71,7 +71,7 @@ int iommufd_ioas_iova_ranges(struct iommufd_ucmd *ucmd)
|
|||
if (cmd->__reserved)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, cmd->ioas_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
|
||||
|
@ -151,7 +151,7 @@ int iommufd_ioas_allow_iovas(struct iommufd_ucmd *ucmd)
|
|||
if (cmd->__reserved)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, cmd->ioas_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
iopt = &ioas->iopt;
|
||||
|
@ -213,7 +213,7 @@ int iommufd_ioas_map(struct iommufd_ucmd *ucmd)
|
|||
if (cmd->iova >= ULONG_MAX || cmd->length >= ULONG_MAX)
|
||||
return -EOVERFLOW;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, cmd->ioas_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
|
||||
|
@ -253,7 +253,7 @@ int iommufd_ioas_copy(struct iommufd_ucmd *ucmd)
|
|||
cmd->dst_iova >= ULONG_MAX)
|
||||
return -EOVERFLOW;
|
||||
|
||||
src_ioas = iommufd_get_ioas(ucmd, cmd->src_ioas_id);
|
||||
src_ioas = iommufd_get_ioas(ucmd->ictx, cmd->src_ioas_id);
|
||||
if (IS_ERR(src_ioas))
|
||||
return PTR_ERR(src_ioas);
|
||||
rc = iopt_get_pages(&src_ioas->iopt, cmd->src_iova, cmd->length,
|
||||
|
@ -262,7 +262,7 @@ int iommufd_ioas_copy(struct iommufd_ucmd *ucmd)
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
dst_ioas = iommufd_get_ioas(ucmd, cmd->dst_ioas_id);
|
||||
dst_ioas = iommufd_get_ioas(ucmd->ictx, cmd->dst_ioas_id);
|
||||
if (IS_ERR(dst_ioas)) {
|
||||
rc = PTR_ERR(dst_ioas);
|
||||
goto out_pages;
|
||||
|
@ -292,7 +292,7 @@ int iommufd_ioas_unmap(struct iommufd_ucmd *ucmd)
|
|||
unsigned long unmapped = 0;
|
||||
int rc;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, cmd->ioas_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
|
||||
|
@ -381,7 +381,7 @@ int iommufd_ioas_option(struct iommufd_ucmd *ucmd)
|
|||
if (cmd->__reserved)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, cmd->object_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, cmd->object_id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
|
||||
|
|
|
@ -211,10 +211,10 @@ struct iommufd_ioas {
|
|||
struct list_head hwpt_list;
|
||||
};
|
||||
|
||||
static inline struct iommufd_ioas *iommufd_get_ioas(struct iommufd_ucmd *ucmd,
|
||||
static inline struct iommufd_ioas *iommufd_get_ioas(struct iommufd_ctx *ictx,
|
||||
u32 id)
|
||||
{
|
||||
return container_of(iommufd_get_object(ucmd->ictx, id,
|
||||
return container_of(iommufd_get_object(ictx, id,
|
||||
IOMMUFD_OBJ_IOAS),
|
||||
struct iommufd_ioas, obj);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ void iommufd_test_syz_conv_iova_id(struct iommufd_ucmd *ucmd,
|
|||
return;
|
||||
*flags &= ~(u32)MOCK_FLAGS_ACCESS_SYZ;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, ioas_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, ioas_id);
|
||||
if (IS_ERR(ioas))
|
||||
return;
|
||||
*iova = iommufd_test_syz_conv_iova(&ioas->iopt, iova);
|
||||
|
@ -279,7 +279,7 @@ static int iommufd_test_mock_domain(struct iommufd_ucmd *ucmd,
|
|||
struct iommufd_ioas *ioas;
|
||||
int rc;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, cmd->id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, cmd->id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
|
||||
|
@ -322,7 +322,7 @@ static int iommufd_test_add_reserved(struct iommufd_ucmd *ucmd,
|
|||
struct iommufd_ioas *ioas;
|
||||
int rc;
|
||||
|
||||
ioas = iommufd_get_ioas(ucmd, mockpt_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, mockpt_id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
down_write(&ioas->iopt.iova_rwsem);
|
||||
|
|
|
@ -137,7 +137,7 @@ int iommufd_vfio_ioas(struct iommufd_ucmd *ucmd)
|
|||
return iommufd_ucmd_respond(ucmd, sizeof(*cmd));
|
||||
|
||||
case IOMMU_VFIO_IOAS_SET:
|
||||
ioas = iommufd_get_ioas(ucmd, cmd->ioas_id);
|
||||
ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id);
|
||||
if (IS_ERR(ioas))
|
||||
return PTR_ERR(ioas);
|
||||
xa_lock(&ucmd->ictx->objects);
|
||||
|
|
Loading…
Reference in New Issue