msm: ADSPRPC: Close SMD channel after RPC session ends

The SMD channel open request needs to be delayed as the
remote processor may not be up early on when the driver
is initialized. The SMD channel is opened when the first
RPC session is opened and closed when the last RPC
session ends.

Change-Id: I0bbff2956c3e367312d4344107340feb29e643ab
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: ADSPRPC: Remove scatterlist validation

The buffers allocated by ION for ADSP/AUDIO heap would be
physically contiguous and no additional checks are required
to validate this.

Change-Id: Ib54aaf6c18448d18d0a22dac0ddab50a0ab4f493
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: ADSPRPC: Add mappings to IOMMU for remote heap

The remote heap buffers need to be mapped and unmapped in
the IOMMU when SMMU is present on the remote processor.

Change-Id: I9d78e1098a4163109dbde4c23681be4cfb8a353a
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: ADSPRPC: Save and restore contexts when interrupted

While a RPC session is in progress, wait could get interrupted
as a result of device entering power collase and the system call
retried once the device leaves power collapse. This requires that
the RPC session context is saved and restored across these
interrupts to avoid duplicate invocations being sent across to
the remote processor.

Change-Id: I71141c13da7be3d33e13305e0744148921123160
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
introduce kref_put_mutex()

equivalent of
	mutex_lock(mutex);
	if (!kref_put(kref, release))
		mutex_unlock(mutex);

Change-Id: I05d61a7380eb29fbf12f634bcff5ac1072e13765
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[mitchelh@codeaurora.org: trivial conflict due to moved code]
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>