FROMGIT: iommu/arm-smmu: Don't bypass pinned stream mappings

Commit 0e764a0101 ("iommu/arm-smmu: Allow client devices to select
direct mapping") sets the initial domain type to SMMU_DOMAIN_IDENTITY
for devices that select direct mapping. This ends up setting the domain
as ARM_SMMU_DOMAIN_BYPASS which causes the stream ID mappings
for the device to be programmed to S2CR_TYPE_BYPASS.

This causes a problem for stream mappings that are inherited from
the bootloader since rewriting the stream to BYPASS will disrupt the
display controller access to DDR.

This is an extension to ("iommu/arm-smmu: Allow inheriting stream mapping
from bootloader") [1] that identifies streams that are already configured
 and marked them as pinned. This patch extends that to not re-write pinned
stream mappings for ARM_SMMU_DOMAIN_BYPASS domains.

[1] https://lore.kernel.org/r/20191226221709.3844244-4-bjorn.andersson@linaro.org

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
(cherry picked from commit 7ea70cbadd53c199b36f6d2433183dfcb9b1fbdb
 https://github.com/freedreno/kernel-msm.git wip/c630-5.8-rc1)
Change-Id: Iecc6e3d1feedee178e04f7da8f601ee12bd5ae3b
This commit is contained in:
Jordan Crouse 2020-06-09 12:05:16 -06:00 committed by John Stultz
commit 792c2bf3a5

View file

@ -1143,6 +1143,10 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
continue;
/* Don't bypasss pinned streams; leave them as they are */
if (type == S2CR_TYPE_BYPASS && s2cr[idx].pinned)
continue;
s2cr[idx].type = type;
s2cr[idx].privcfg = S2CR_PRIVCFG_DEFAULT;
s2cr[idx].cbndx = cbndx;