Skip to content

Commit 69cf449

Browse files
Sai Praneeth Prakhyajoergroedel
authored andcommitted
iommu: Remove functions that support private domain
After moving iommu_group setup to iommu core code [1][2] and removing private domain support in vt-d [3], there are no users for functions such as iommu_request_dm_for_dev(), iommu_request_dma_domain_for_dev() and request_default_domain_for_dev(). So, remove these functions. [1] commit dce8d69 ("iommu/amd: Convert to probe/release_device() call-backs") [2] commit e5d1841 ("iommu/vt-d: Convert to probe/release_device() call-backs") [3] commit 327d5b2 ("iommu/vt-d: Allow 32bit devices to uses DMA domain") Signed-off-by: Sai Praneeth Prakhya <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 8627892 commit 69cf449

File tree

2 files changed

+0
-77
lines changed

2 files changed

+0
-77
lines changed

drivers/iommu/iommu.c

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2536,71 +2536,6 @@ struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
25362536
}
25372537
EXPORT_SYMBOL_GPL(iommu_alloc_resv_region);
25382538

2539-
static int
2540-
request_default_domain_for_dev(struct device *dev, unsigned long type)
2541-
{
2542-
struct iommu_domain *domain;
2543-
struct iommu_group *group;
2544-
int ret;
2545-
2546-
/* Device must already be in a group before calling this function */
2547-
group = iommu_group_get(dev);
2548-
if (!group)
2549-
return -EINVAL;
2550-
2551-
mutex_lock(&group->mutex);
2552-
2553-
ret = 0;
2554-
if (group->default_domain && group->default_domain->type == type)
2555-
goto out;
2556-
2557-
/* Don't change mappings of existing devices */
2558-
ret = -EBUSY;
2559-
if (iommu_group_device_count(group) != 1)
2560-
goto out;
2561-
2562-
ret = -ENOMEM;
2563-
domain = __iommu_domain_alloc(dev->bus, type);
2564-
if (!domain)
2565-
goto out;
2566-
2567-
/* Attach the device to the domain */
2568-
ret = __iommu_attach_group(domain, group);
2569-
if (ret) {
2570-
iommu_domain_free(domain);
2571-
goto out;
2572-
}
2573-
2574-
/* Make the domain the default for this group */
2575-
if (group->default_domain)
2576-
iommu_domain_free(group->default_domain);
2577-
group->default_domain = domain;
2578-
2579-
iommu_create_device_direct_mappings(group, dev);
2580-
2581-
dev_info(dev, "Using iommu %s mapping\n",
2582-
type == IOMMU_DOMAIN_DMA ? "dma" : "direct");
2583-
2584-
ret = 0;
2585-
out:
2586-
mutex_unlock(&group->mutex);
2587-
iommu_group_put(group);
2588-
2589-
return ret;
2590-
}
2591-
2592-
/* Request that a device is direct mapped by the IOMMU */
2593-
int iommu_request_dm_for_dev(struct device *dev)
2594-
{
2595-
return request_default_domain_for_dev(dev, IOMMU_DOMAIN_IDENTITY);
2596-
}
2597-
2598-
/* Request that a device can't be direct mapped by the IOMMU */
2599-
int iommu_request_dma_domain_for_dev(struct device *dev)
2600-
{
2601-
return request_default_domain_for_dev(dev, IOMMU_DOMAIN_DMA);
2602-
}
2603-
26042539
void iommu_set_default_passthrough(bool cmd_line)
26052540
{
26062541
if (cmd_line)

include/linux/iommu.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,6 @@ extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
482482
extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
483483
extern void generic_iommu_put_resv_regions(struct device *dev,
484484
struct list_head *list);
485-
extern int iommu_request_dm_for_dev(struct device *dev);
486-
extern int iommu_request_dma_domain_for_dev(struct device *dev);
487485
extern void iommu_set_default_passthrough(bool cmd_line);
488486
extern void iommu_set_default_translated(bool cmd_line);
489487
extern bool iommu_default_passthrough(void);
@@ -804,16 +802,6 @@ static inline int iommu_get_group_resv_regions(struct iommu_group *group,
804802
return -ENODEV;
805803
}
806804

807-
static inline int iommu_request_dm_for_dev(struct device *dev)
808-
{
809-
return -ENODEV;
810-
}
811-
812-
static inline int iommu_request_dma_domain_for_dev(struct device *dev)
813-
{
814-
return -ENODEV;
815-
}
816-
817805
static inline void iommu_set_default_passthrough(bool cmd_line)
818806
{
819807
}

0 commit comments

Comments
 (0)