iommu: msm: Add reference counting to IOMMUv1

Add reference counting to IOMMU attach and detach so that clients
can attach to the same context bank which allows for sharing of
context banks among client.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
iommu: msm: Program all M2V tables at once

Currently, M2V tables are programmed per context bank when
attaching. Attaching to a single context bank will take the
SMMU out of pass through mode. This means that when one context
bank is attached, none of the other banks will have M2Vs
programmed until they are attached. This presents a problem if a
single context bank is expected to work in pass through mode.
As a solution, program the M2V table for all context bank when
the first context bank of an IOMMU is attached. Clear out the
M2V tables only when the last context is detached.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Linux 3.4.87

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>