mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-13 22:14:20 +08:00
iommu: Remove ops->set_platform_dma_ops()
All drivers are now using IDENTITY or PLATFORM domains for what this did, we can remove it now. It is no longer possible to attach to a NULL domain. Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> Tested-by: Steven Price <steven.price@arm.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/15-v8-81230027b2fa+9d-iommu_all_defdom_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
78fc30b4bb
commit
24b1d47616
@ -2351,21 +2351,8 @@ static int __iommu_group_set_domain_internal(struct iommu_group *group,
|
||||
if (group->domain == new_domain)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* New drivers should support default domains, so set_platform_dma()
|
||||
* op will never be called. Otherwise the NULL domain represents some
|
||||
* platform specific behavior.
|
||||
*/
|
||||
if (!new_domain) {
|
||||
for_each_group_device(group, gdev) {
|
||||
const struct iommu_ops *ops = dev_iommu_ops(gdev->dev);
|
||||
|
||||
if (!WARN_ON(!ops->set_platform_dma_ops))
|
||||
ops->set_platform_dma_ops(gdev->dev);
|
||||
}
|
||||
group->domain = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (WARN_ON(!new_domain))
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Changing the domain is done by calling attach_dev() on the new
|
||||
@ -2401,19 +2388,15 @@ err_revert:
|
||||
*/
|
||||
last_gdev = gdev;
|
||||
for_each_group_device(group, gdev) {
|
||||
const struct iommu_ops *ops = dev_iommu_ops(gdev->dev);
|
||||
|
||||
/*
|
||||
* If set_platform_dma_ops is not present a NULL domain can
|
||||
* happen only for first probe, in which case we leave
|
||||
* group->domain as NULL and let release clean everything up.
|
||||
* A NULL domain can happen only for first probe, in which case
|
||||
* we leave group->domain as NULL and let release clean
|
||||
* everything up.
|
||||
*/
|
||||
if (group->domain)
|
||||
WARN_ON(__iommu_device_set_domain(
|
||||
group, gdev->dev, group->domain,
|
||||
IOMMU_SET_DOMAIN_MUST_SUCCEED));
|
||||
else if (ops->set_platform_dma_ops)
|
||||
ops->set_platform_dma_ops(gdev->dev);
|
||||
if (gdev == last_gdev)
|
||||
break;
|
||||
}
|
||||
@ -3036,9 +3019,6 @@ static int iommu_setup_default_domain(struct iommu_group *group,
|
||||
/*
|
||||
* There are still some drivers which don't support default domains, so
|
||||
* we ignore the failure and leave group->default_domain NULL.
|
||||
*
|
||||
* We assume that the iommu driver starts up the device in
|
||||
* 'set_platform_dma_ops' mode if it does not support default domains.
|
||||
*/
|
||||
dom = iommu_group_alloc_default_domain(group, req_type);
|
||||
if (!dom) {
|
||||
|
@ -243,9 +243,6 @@ struct iommu_iotlb_gather {
|
||||
* @release_device: Remove device from iommu driver handling
|
||||
* @probe_finalize: Do final setup work after the device is added to an IOMMU
|
||||
* group and attached to the groups domain
|
||||
* @set_platform_dma_ops: Returning control back to the platform DMA ops. This op
|
||||
* is to support old IOMMU drivers, new drivers should use
|
||||
* default domains, and the common IOMMU DMA ops.
|
||||
* @device_group: find iommu group for a particular device
|
||||
* @get_resv_regions: Request list of reserved regions for a device
|
||||
* @of_xlate: add OF master IDs to iommu grouping
|
||||
@ -280,7 +277,6 @@ struct iommu_ops {
|
||||
struct iommu_device *(*probe_device)(struct device *dev);
|
||||
void (*release_device)(struct device *dev);
|
||||
void (*probe_finalize)(struct device *dev);
|
||||
void (*set_platform_dma_ops)(struct device *dev);
|
||||
struct iommu_group *(*device_group)(struct device *dev);
|
||||
|
||||
/* Request/Free a list of reserved regions for a device */
|
||||
|
Loading…
Reference in New Issue
Block a user