[PATCH] iommu/arm-smmu-v2: Workaround for ThunderX errata#27704

Will Deacon
2016-03-02T13:35:01Z

On Wed, Mar 02, 2016 at 03:23:57AM +0000, Chalamarla, Tirumalesh wrote:
> On 3/1/16, 7:07 PM, "Will Deacon" <will.deacon@arm.com> wrote:
> >On Wed, Feb 24, 2016 at 01:13:53PM -0800, Tirumalesh Chalamarla wrote:
> >> + smmu->cavium_smmu_id = cavium_smmu_count;
> >> + cavium_smmu_count++;
> >> + smmu->cavium_id_base =
> >> + (smmu->cavium_smmu_id * ARM_SMMU_MAX_CBS);
> >
> >Can you not use num_context_banks here, instead of the constant?
> We need total context banks so far, so ARM_SMMU_MAX_CBS is best option.
> For Thunder both are same anyway.

Hmm, so couldn't you instead just update a running total as you go along?
That is, initialise it to zero, then atomic_add_return(num_context_banks)
when you probe?

Will