Skip to content

Commit 229496a

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/arm-smmu: Drop IOVA cookie management
The core code bakes its own cookies now. Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/7ae3680dad9735cc69c3618866666896bd11e031.1628682048.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent 3f166da commit 229496a

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,12 +1984,6 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type)
19841984
if (!smmu_domain)
19851985
return NULL;
19861986

1987-
if (type == IOMMU_DOMAIN_DMA &&
1988-
iommu_get_dma_cookie(&smmu_domain->domain)) {
1989-
kfree(smmu_domain);
1990-
return NULL;
1991-
}
1992-
19931987
mutex_init(&smmu_domain->init_mutex);
19941988
INIT_LIST_HEAD(&smmu_domain->devices);
19951989
spin_lock_init(&smmu_domain->devices_lock);
@@ -2021,7 +2015,6 @@ static void arm_smmu_domain_free(struct iommu_domain *domain)
20212015
struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
20222016
struct arm_smmu_device *smmu = smmu_domain->smmu;
20232017

2024-
iommu_put_dma_cookie(domain);
20252018
free_io_pgtable_ops(smmu_domain->pgtbl_ops);
20262019

20272020
/* Free the CD and ASID, if we allocated them */

drivers/iommu/arm/arm-smmu/arm-smmu.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -868,10 +868,10 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type)
868868
{
869869
struct arm_smmu_domain *smmu_domain;
870870

871-
if (type != IOMMU_DOMAIN_UNMANAGED &&
872-
type != IOMMU_DOMAIN_DMA &&
873-
type != IOMMU_DOMAIN_IDENTITY)
874-
return NULL;
871+
if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_IDENTITY) {
872+
if (using_legacy_binding || type != IOMMU_DOMAIN_DMA)
873+
return NULL;
874+
}
875875
/*
876876
* Allocate the domain and initialise some of its data structures.
877877
* We can't really do anything meaningful until we've added a
@@ -881,12 +881,6 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type)
881881
if (!smmu_domain)
882882
return NULL;
883883

884-
if (type == IOMMU_DOMAIN_DMA && (using_legacy_binding ||
885-
iommu_get_dma_cookie(&smmu_domain->domain))) {
886-
kfree(smmu_domain);
887-
return NULL;
888-
}
889-
890884
mutex_init(&smmu_domain->init_mutex);
891885
spin_lock_init(&smmu_domain->cb_lock);
892886

@@ -901,7 +895,6 @@ static void arm_smmu_domain_free(struct iommu_domain *domain)
901895
* Free the domain resources. We assume that all devices have
902896
* already been detached.
903897
*/
904-
iommu_put_dma_cookie(domain);
905898
arm_smmu_destroy_domain_context(domain);
906899
kfree(smmu_domain);
907900
}

drivers/iommu/arm/arm-smmu/qcom_iommu.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/bitfield.h>
1111
#include <linux/clk.h>
1212
#include <linux/delay.h>
13-
#include <linux/dma-iommu.h>
1413
#include <linux/dma-mapping.h>
1514
#include <linux/err.h>
1615
#include <linux/interrupt.h>
@@ -335,12 +334,6 @@ static struct iommu_domain *qcom_iommu_domain_alloc(unsigned type)
335334
if (!qcom_domain)
336335
return NULL;
337336

338-
if (type == IOMMU_DOMAIN_DMA &&
339-
iommu_get_dma_cookie(&qcom_domain->domain)) {
340-
kfree(qcom_domain);
341-
return NULL;
342-
}
343-
344337
mutex_init(&qcom_domain->init_mutex);
345338
spin_lock_init(&qcom_domain->pgtbl_lock);
346339

@@ -351,8 +344,6 @@ static void qcom_iommu_domain_free(struct iommu_domain *domain)
351344
{
352345
struct qcom_iommu_domain *qcom_domain = to_qcom_iommu_domain(domain);
353346

354-
iommu_put_dma_cookie(domain);
355-
356347
if (qcom_domain->iommu) {
357348
/*
358349
* NOTE: unmap can be called after client device is powered

0 commit comments

Comments
 (0)