iommu/arm-smmu: Support DOMAIN_ATTR_S1_BYPASS

Certain configurations may require nested translation, but may
want to avoid software performance limitation on map/unmap
operations.

Change-Id: I6653b3b6ceb071283fb5a8e07257c496e99dd1f3
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
This commit is contained in:
Patrick Daly 2016-03-15 18:58:28 -07:00 committed by Jeevan Shriram
parent a1b066a460
commit c1b29ef10e

View file

@ -1453,7 +1453,9 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain,
} }
/* SCTLR */ /* SCTLR */
reg = SCTLR_CFCFG | SCTLR_CFIE | SCTLR_CFRE | SCTLR_M | SCTLR_EAE_SBOP; reg = SCTLR_CFCFG | SCTLR_CFIE | SCTLR_CFRE | SCTLR_EAE_SBOP;
if (!stage1 || !(smmu_domain->attributes & DOMAIN_ATTR_S1_BYPASS))
reg |= SCTLR_M;
if (stage1) if (stage1)
reg |= SCTLR_S1_ASIDPNE; reg |= SCTLR_S1_ASIDPNE;
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
@ -2898,6 +2900,11 @@ static int arm_smmu_domain_get_attr(struct iommu_domain *domain,
& (1 << DOMAIN_ATTR_NON_FATAL_FAULTS)); & (1 << DOMAIN_ATTR_NON_FATAL_FAULTS));
ret = 0; ret = 0;
break; break;
case DOMAIN_ATTR_S1_BYPASS:
*((int *)data) = !!(smmu_domain->attributes
& (1 << DOMAIN_ATTR_S1_BYPASS));
ret = 0;
break;
default: default:
ret = -ENODEV; ret = -ENODEV;
break; break;
@ -3009,6 +3016,18 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
smmu_domain->non_fatal_faults = *((int *)data); smmu_domain->non_fatal_faults = *((int *)data);
ret = 0; ret = 0;
break; break;
case DOMAIN_ATTR_S1_BYPASS: {
int bypass = *((int *)data);
if (bypass)
smmu_domain->attributes |= 1 << DOMAIN_ATTR_S1_BYPASS;
else
smmu_domain->attributes &=
~(1 << DOMAIN_ATTR_S1_BYPASS);
ret = 0;
break;
}
default: default:
ret = -ENODEV; ret = -ENODEV;
break; break;