iommu: msm: Refactor remote spinlock defconfig
Refactor the remote spinlock defconfig to allow it to be used with
subsystems other than GPU. This will enhance the usability of this
feature and minimize the chance of errors when enabling this feature.
CRs-fixed: 517873
Change-Id: I609cd77ece4e8d2e15e1a24d87a23be05a61b60f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/arch/arm/mach-msm/include/mach/iommu.h b/arch/arm/mach-msm/include/mach/iommu.h
index 7cfbd93..45f3a60 100644
--- a/arch/arm/mach-msm/include/mach/iommu.h
+++ b/arch/arm/mach-msm/include/mach/iommu.h
@@ -277,7 +277,7 @@
}
#endif
-#ifdef CONFIG_MSM_IOMMU_GPU_SYNC
+#ifdef CONFIG_MSM_IOMMU_SYNC
void msm_iommu_remote_p0_spin_lock(void);
void msm_iommu_remote_p0_spin_unlock(void);
@@ -290,19 +290,6 @@
#define msm_iommu_remote_spin_unlock()
#endif
-/* Allows kgsl iommu driver to acquire lock */
-#define msm_iommu_lock() \
- do { \
- msm_iommu_mutex_lock(); \
- msm_iommu_remote_spin_lock(); \
- } while (0)
-
-#define msm_iommu_unlock() \
- do { \
- msm_iommu_remote_spin_unlock(); \
- msm_iommu_mutex_unlock(); \
- } while (0)
-
#ifdef CONFIG_MSM_IOMMU
/*
* Look up an IOMMU context device by its context name. NULL if none found.
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 6324dff..8e70129 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -45,10 +45,22 @@
If unsure, say N here.
+# MSM IOMMU sync lock support
+config MSM_IOMMU_SYNC
+ bool "MSM IOMMU Sync Lock Support"
+ depends on (ARCH_MSM8X60 || ARCH_MSM8960 || ARCH_APQ8064 || ARCH_MSM8930 || ARCH_MSM8610) && MSM_IOMMU_V0
+ help
+ Say Y here if you want the IOMMU to grab a remote spinlock to ensure
+ synchronization between IOMMU accesses by CPU and other exectution
+ environments in the SoC.
+
+ If unsure, say N here.
+
# MSM IOMMU CPU-GPU sync programming support
config MSM_IOMMU_GPU_SYNC
bool "MSM IOMMU CPU-GPU Sync Support"
- depends on (ARCH_MSM8X60 || ARCH_MSM8960 || ARCH_APQ8064 || ARCH_MSM8930) && MSM_IOMMU_V0 && MSM_REMOTE_SPINLOCK_SFPB
+ depends on (ARCH_MSM8X60 || ARCH_MSM8960 || ARCH_APQ8064 || ARCH_MSM8930) && MSM_IOMMU_V0
+ select MSM_IOMMU_SYNC
help
Say Y here if you want to synchronize access to IOMMU configuration
port between CPU and GPU. CPU will grab a remote spinlock before
diff --git a/drivers/iommu/msm_iommu-v0.c b/drivers/iommu/msm_iommu-v0.c
index 49bfdb8..56aa7b2 100644
--- a/drivers/iommu/msm_iommu-v0.c
+++ b/drivers/iommu/msm_iommu-v0.c
@@ -83,7 +83,7 @@
static struct msm_iommu_remote_lock msm_iommu_remote_lock;
-#ifdef CONFIG_MSM_IOMMU_GPU_SYNC
+#ifdef CONFIG_MSM_IOMMU_SYNC
static void _msm_iommu_remote_spin_lock_init(void)
{
msm_iommu_remote_lock.lock = smem_alloc(SMEM_SPINLOCK_ARRAY, 32);
@@ -202,12 +202,14 @@
static void _iommu_lock_acquire(void)
{
- msm_iommu_lock();
+ msm_iommu_mutex_lock();
+ msm_iommu_remote_spin_lock();
}
static void _iommu_lock_release(void)
{
- msm_iommu_unlock();
+ msm_iommu_remote_spin_unlock();
+ msm_iommu_mutex_unlock();
}
struct iommu_access_ops iommu_access_ops_v0 = {