iommu/tegra-smmu: Fix tlb_mask
Subsystems (3)
PATCH 1/1 iommu/tegra-smmu: Fix tlb_mask
The "num_tlb_lines" might not be a power-of-2 value, being 48 on Tegra210 for example. So the current way of calculating tlb_mask using the num_tlb_lines is not correct: tlb_mask=0x5f in case of num_tlb_lines=48, which will trim a setting of 0x30 (48) to 0x10.
--- drivers/iommu/tegra-smmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/tegra-smmu.c +1 -1
@@ -1120,7 +1120,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,BIT_MASK (mc->soc->num_address_bits -SMMU_PTE_SHIFT ) -1 ;dev_dbg (dev,"address bits: %u, PFN mask: %#lx\n" , mc->soc->num_address_bits, smmu->pfn_mask); - smmu->tlb_mask = (smmu->soc->num_tlb_lines <<1 ) -1 ; + smmu->tlb_mask = (1 <<fls (smmu->soc->num_tlb_lines)) -1 ;dev_dbg (dev,"TLB lines: %u, mask: %#lx\n" , smmu->soc->num_tlb_lines, smmu->tlb_mask);
Signature · 6 lines
2.17.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 9 lines · Nicolin Chen
The "
num_tlb_lines" might not be a power-of-2 value, being 48 on Tegra210 for example. So the current way of calculatingtlb_maskusing thenum_tlb_linesis not correct: tlb_mask=0x5f in case of num_tlb_lines=48, which will trim a setting of0x30(48) to0x10.Signed-off-by Nicolin Chen <[email protected]>--- drivers/iommu/tegra-smmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
This is technically a prerequisite for this patch you sent out earlier:
https://patchwork.ozlabs.org/project/linux-tegra/patch/[email protected]/
You should send both of those out as one series and add maintainers for both subsystems to both patches so that they can work out who will be applying them.
For this pair it's probably best for Joerg to pick up both patches because this primarily concerns the Tegra SMMU, whereas the above patch only provides the per-SoC data update for the SMMU. Obviously if Joerg prefers for Krzysztof to pick up both patches that's fine with me too.
In either case, please send this out as a series so that both Joerg and Krzysztof (Cc'ed for visibility) are aware of both patches. From the Tegra side:
Quoted 16 lines
drivers/iommu/tegra-smmu.c +1
-1@@ -1120,7 +1120,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,BIT_MASK (mc->soc->num_address_bits -SMMU_PTE_SHIFT ) -1 ;dev_dbg (dev,"address bits: %u, PFN mask: %#lx\n" , mc->soc->num_address_bits, smmu->pfn_mask); - smmu->tlb_mask = (smmu->soc->num_tlb_lines <<1 ) -1 ; + smmu->tlb_mask = (1 <<fls (smmu->soc->num_tlb_lines)) -1 ;dev_dbg (dev,"TLB lines: %u, mask: %#lx\n" , smmu->soc->num_tlb_lines, smmu->tlb_mask);Signature · 1 line
2.17.1
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu