提交 b8fe0382 编写于 作者: R Russell King 提交者: Thierry Reding

iommu/tegra-smmu: Split smmu_flush_ptc()

smmu_flush_ptc() is used in two modes: one is to flush an individual
entry, the other is to flush all entries.  We know at the call site
which we require.  Split the function into smmu_flush_ptc_all() and
smmu_flush_ptc().
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: NThierry Reding <treding@nvidia.com>
上级 4b3c7d10
...@@ -165,13 +165,17 @@ static void smmu_flush_dcache(struct page *page, unsigned long offset, ...@@ -165,13 +165,17 @@ static void smmu_flush_dcache(struct page *page, unsigned long offset,
#endif #endif
} }
static void smmu_flush_ptc_all(struct tegra_smmu *smmu)
{
smmu_writel(smmu, SMMU_PTC_FLUSH_TYPE_ALL, SMMU_PTC_FLUSH);
}
static inline void smmu_flush_ptc(struct tegra_smmu *smmu, struct page *page, static inline void smmu_flush_ptc(struct tegra_smmu *smmu, struct page *page,
unsigned long offset) unsigned long offset)
{ {
phys_addr_t phys = page ? page_to_phys(page) : 0; phys_addr_t phys = page_to_phys(page);
u32 value; u32 value;
if (page) {
offset &= ~(smmu->mc->soc->atom_size - 1); offset &= ~(smmu->mc->soc->atom_size - 1);
if (smmu->mc->soc->num_address_bits > 32) { if (smmu->mc->soc->num_address_bits > 32) {
...@@ -184,10 +188,6 @@ static inline void smmu_flush_ptc(struct tegra_smmu *smmu, struct page *page, ...@@ -184,10 +188,6 @@ static inline void smmu_flush_ptc(struct tegra_smmu *smmu, struct page *page,
} }
value = (phys + offset) | SMMU_PTC_FLUSH_TYPE_ADR; value = (phys + offset) | SMMU_PTC_FLUSH_TYPE_ADR;
} else {
value = SMMU_PTC_FLUSH_TYPE_ALL;
}
smmu_writel(smmu, value, SMMU_PTC_FLUSH); smmu_writel(smmu, value, SMMU_PTC_FLUSH);
} }
...@@ -894,7 +894,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, ...@@ -894,7 +894,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
smmu_writel(smmu, value, SMMU_TLB_CONFIG); smmu_writel(smmu, value, SMMU_TLB_CONFIG);
smmu_flush_ptc(smmu, NULL, 0); smmu_flush_ptc_all(smmu);
smmu_flush_tlb(smmu); smmu_flush_tlb(smmu);
smmu_writel(smmu, SMMU_CONFIG_ENABLE, SMMU_CONFIG); smmu_writel(smmu, SMMU_CONFIG_ENABLE, SMMU_CONFIG);
smmu_flush(smmu); smmu_flush(smmu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册