Skip to content

Commit df198b3

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/arm-smmu: Report IOMMU_CAP_CACHE_COHERENCY better
Assuming that any SMMU can enforce coherency for any device is clearly nonsense. Although technically even a single SMMU instance can be wired up to only be capable of emitting coherent traffic for some of the devices it translates, it's a fairly realistic approximation that if the SMMU's pagetable walker is wired up to a coherent interconnect then all its translation units probably are too, and conversely that lack of coherent table walks implies a non-coherent system in general. Either way it's still less inaccurate than what we've been claiming so far. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/106c9741415f0b6358c72d53ae9c78c553a2b45c.1660574547.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 359ad15 commit df198b3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1994,9 +1994,12 @@ static const struct iommu_flush_ops arm_smmu_flush_ops = {
19941994
/* IOMMU API */
19951995
static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap)
19961996
{
1997+
struct arm_smmu_master *master = dev_iommu_priv_get(dev);
1998+
19971999
switch (cap) {
19982000
case IOMMU_CAP_CACHE_COHERENCY:
1999-
return true;
2001+
/* Assume that a coherent TCU implies coherent TBUs */
2002+
return master->smmu->features & ARM_SMMU_FEAT_COHERENCY;
20002003
case IOMMU_CAP_NOEXEC:
20012004
return true;
20022005
default:

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,13 +1332,12 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
13321332

13331333
static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap)
13341334
{
1335+
struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev);
1336+
13351337
switch (cap) {
13361338
case IOMMU_CAP_CACHE_COHERENCY:
1337-
/*
1338-
* Return true here as the SMMU can always send out coherent
1339-
* requests.
1340-
*/
1341-
return true;
1339+
/* Assume that a coherent TCU implies coherent TBUs */
1340+
return cfg->smmu->features & ARM_SMMU_FEAT_COHERENT_WALK;
13421341
case IOMMU_CAP_NOEXEC:
13431342
return true;
13441343
default:

0 commit comments

Comments
 (0)