iommu/arm-smmu-v3: Avoid ILLEGAL setting of STE.S1STALLD and CD.S
authorYisheng Xie <xieyisheng1@huawei.com>
Thu, 21 Sep 2017 12:36:07 +0000 (20:36 +0800)
committerWill Deacon <will.deacon@arm.com>
Fri, 20 Oct 2017 15:55:04 +0000 (16:55 +0100)
commit9cff86fd2b960f9bedc67771c24a73d7dc32048d
tree4e53fee65a0f6215f89f2124d083da0471d0757c
parent74f55d34414c866dbf3a69e28a2f963abe61ca58
iommu/arm-smmu-v3: Avoid ILLEGAL setting of STE.S1STALLD and CD.S

According to Spec, it is ILLEGAL to set STE.S1STALLD if STALL_MODEL
is not 0b00, which means we should not disable stall mode if stall
or terminate mode is not configuable.

Meanwhile, it is also ILLEGAL when STALL_MODEL==0b10 && CD.S==0 which
means if stall mode is force we should always set CD.S.

As Jean-Philippe's suggestion, this patch introduce a feature bit
ARM_SMMU_FEAT_STALL_FORCE, which means smmu only supports stall force.
Therefore, we can avoid the ILLEGAL setting of STE.S1STALLD.by checking
ARM_SMMU_FEAT_STALL_FORCE.

This patch keeps the ARM_SMMU_FEAT_STALLS as the meaning of stall supported
(force or configuable) to easy to expand the future function, i.e. we can
only use ARM_SMMU_FEAT_STALLS to check whether we should register fault
handle or enable master can_stall, etc to supporte platform SVM.

The feature bit, STE.S1STALLD and CD.S setting will be like:

STALL_MODEL  FEATURE                                         S1STALLD CD.S
0b00         ARM_SMMU_FEAT_STALLS                                 0b1 0b0
0b01         !ARM_SMMU_FEAT_STALLS && !ARM_SMMU_FEAT_STALL_FORCE  0b0 0b0
0b10         ARM_SMMU_FEAT_STALLS && ARM_SMMU_FEAT_STALL_FORCE    0b0 0b1

after apply this patch.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/iommu/arm-smmu-v3.c