Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43de95ba authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu: Add api to retrieve stream-id for a device" into msm-4.9

parents 16295d9b 1e3c16c6
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1750,3 +1750,23 @@ int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids)
	return 0;
}
EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids);

/*
 * Return the id asoociated with a pci device.
 */
int iommu_fwspec_get_id(struct device *dev, u32 *id)
{
	struct iommu_fwspec *fwspec = dev->iommu_fwspec;

	if (!fwspec)
		return -EINVAL;

	if (!dev_is_pci(dev))
		return -EINVAL;

	if (fwspec->num_ids != 1)
		return -EINVAL;

	*id = fwspec->ids[0];
	return 0;
}
+6 −0
Original line number Diff line number Diff line
@@ -435,6 +435,7 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
		      const struct iommu_ops *ops);
void iommu_fwspec_free(struct device *dev);
int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids);
int iommu_fwspec_get_id(struct device *dev, u32 *id);

#else /* CONFIG_IOMMU_API */

@@ -705,6 +706,11 @@ static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
	return -ENODEV;
}

int iommu_fwspec_get_id(struct device *dev, u32 *id)
{
	return -ENODEV;
}

#endif /* CONFIG_IOMMU_API */

#endif /* __LINUX_IOMMU_H */