CHROMIUM: drm/exynos: remove KDS sync

We haven't been using it for a while since it was replaced with implicit
fence based sync and we will never use it again.

BUG=598126
TEST=build and install kernel 3.8, run webgl aquarium

Change-Id: Id627b3b6ae8f2718911da091bb08034dccbdef48
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/384633
Reviewed-by: Haixia Shi <hshi@chromium.org>
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 8d0b5b4..a48cc22 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -71,7 +71,7 @@
 
 config DRM_DMA_SYNC
 	bool "DRM DMA Sync"
-	depends on DRM && !DMA_SHARED_BUFFER_USES_KDS
+	depends on DRM
 	help
 	  Choose this option if you want to use fences and reservations for
 	  synchronization of shared dma-buf access between different drivers.
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index c689fc6..a6048c5 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -1,6 +1,6 @@
 config DRM_EXYNOS
 	tristate "DRM Support for Samsung SoC EXYNOS Series"
-	depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) && (DMA_SHARED_BUFFER_USES_KDS || DRM_DMA_SYNC)
+	depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) && DRM_DMA_SYNC
 	select DRM_KMS_HELPER
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index d0bc6ea..47eeb45 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -17,9 +17,6 @@
 
 #include <drm/exynos_drm.h>
 
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-#include <linux/kds.h>
-#endif
 #ifdef CONFIG_DRM_DMA_SYNC
 #include <drm/drm_sync_helper.h>
 #endif
@@ -272,13 +269,9 @@
 	DRM_DEBUG_DRIVER("\n");
 
 	mutex_lock(&dev->struct_mutex);
-	/* release kds resource sets for outstanding GEM object acquires */
+	/* release implicit fences for outstanding GEM object acquires */
 	list_for_each_entry_safe(cur, d,
 			&file_private->gem_cpu_acquire_list, list) {
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-		BUG_ON(cur->exynos_gem_obj->resource_set == NULL);
-		kds_resource_set_release(&cur->exynos_gem_obj->resource_set);
-#endif
 #ifdef CONFIG_DRM_DMA_SYNC
 		BUG_ON(!cur->exynos_gem_obj->acquire_fence);
 		drm_fence_signal_and_put(&cur->exynos_gem_obj->acquire_fence);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index e415bfa..1a54cfc1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -19,9 +19,6 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-#include <linux/kds.h>
-#endif
 #ifdef CONFIG_DRM_DMA_SYNC
 #include "drm_sync_helper.h"
 #endif
@@ -95,10 +92,6 @@
 	struct drm_framebuffer *fb;
 	struct drm_framebuffer *pending_fb;
 	struct drm_pending_vblank_event *pending_event;
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-	struct kds_resource_set *kds;
-	struct kds_callback kds_cb;
-#endif
 #ifdef CONFIG_DRM_DMA_SYNC
 	unsigned fence_context;
 	atomic_t fence_seqno;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 898af62..9734348 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -15,9 +15,6 @@
 #include <linux/dma-buf.h>
 #include <linux/reservation.h>
 #include <linux/completion.h>
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-#include <linux/kds.h>
-#endif
 #include <drm/drm_sync_helper.h>
 #include <linux/shmem_fs.h>
 #include <drm/exynos_drm.h>
@@ -173,12 +170,6 @@
 
 	DRM_DEBUG_KMS("handle count = %d\n", atomic_read(&obj->handle_count));
 
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-	if (exynos_gem_obj->resource_set != NULL) {
-		/* kds_resource_set_release NULLs the pointer */
-		kds_resource_set_release(&exynos_gem_obj->resource_set);
-	}
-#endif
 #ifdef CONFIG_DRM_DMA_SYNC
 	drm_fence_signal_and_put(&exynos_gem_obj->acquire_fence);
 #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h
index 0e20fcf..ea9c2c5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h
@@ -59,8 +59,6 @@
  *	continuous memory region allocated by user request
  *	or at framebuffer creation.
  * @vma: a pointer to vm_area.
- * @resource_set: the KDS resource set held by the currently outstanding CPU
- *	acquire (if any).
  * @flags: indicate memory type to allocated buffer and cache attribute.
  *
  * P.S. this object would be transfered to user as kms_bo.handle so
@@ -70,9 +68,6 @@
 	struct drm_gem_object		base;
 	struct exynos_drm_gem_buf	*buffer;
 	struct vm_area_struct		*vma;
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-	struct kds_resource_set         *resource_set;
-#endif
 #ifdef CONFIG_DRM_DMA_SYNC
 	struct fence			*acquire_fence;
 	atomic_t			acquire_shared_count;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 02575df4..2ea49175 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -12,16 +12,13 @@
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
 
-#if defined(CONFIG_DMA_SHARED_BUFFER_USES_KDS) || defined(CONFIG_DRM_DMA_SYNC)
+#if defined(CONFIG_DRM_DMA_SYNC)
 #include <linux/dma-buf.h>
 #endif
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-#include <linux/kds.h>
-#endif
 
 #include <drm/exynos_drm.h>
 #include "exynos_drm_drv.h"
-#if defined(CONFIG_DMA_SHARED_BUFFER_USES_KDS) || defined(CONFIG_DRM_DMA_SYNC)
+#if defined(CONFIG_DRM_DMA_SYNC)
 #include "exynos_drm_fb.h"
 #include "exynos_drm_gem.h"
 #endif
@@ -150,15 +147,6 @@
 
 	old_fb = exynos_plane->fb;
 
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-	if (exynos_plane->kds) {
-		kds_resource_set_release(&exynos_plane->kds);
-		exynos_plane->kds = NULL;
-	}
-
-	if (exynos_plane->kds_cb.user_cb)
-		kds_callback_term(&exynos_plane->kds_cb);
-#endif
 #ifdef CONFIG_DRM_DMA_SYNC
 	if (update_fb || exynos_plane->pending_fence) {
 		drm_fence_signal_and_put(&exynos_plane->fence);
@@ -349,17 +337,13 @@
 		uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h)
 {
 	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-#if defined(CONFIG_DMA_SHARED_BUFFER_USES_KDS) || defined(CONFIG_DRM_DMA_SYNC)
+#if defined(CONFIG_DRM_DMA_SYNC)
 	int ret;
 	struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
 	struct exynos_drm_gem_obj *exynos_gem_obj;
 	struct dma_buf *buf;
 	struct sync_callback_cookie *cookie;
 #endif
-#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
-	struct kds_resource *res_list;
-	unsigned long shared = 0UL;
-#endif
 
 	/* Copy the plane parameters so we can restore it later */
 	exynos_plane->crtc_x = crtc_x;
@@ -386,46 +370,7 @@
 
 	cookie->fb = fb;
 
-#if defined(CONFIG_DMA_SHARED_BUFFER_USES_KDS)
-	BUG_ON(exynos_plane->kds);
-
-	exynos_gem_obj = exynos_drm_fb_obj(exynos_fb, 0);
-	if (!exynos_gem_obj->base.dma_buf) {
-		exynos_plane_helper_commit_cb(cookie, NULL);
-		return 0;
-	}
-
-	ret = kds_callback_init(&exynos_plane->kds_cb, 1,
-			exynos_plane_helper_commit_cb);
-	if (ret) {
-		DRM_ERROR("Failed to initialize kds callback ret=%d\n", ret);
-		goto err;
-	}
-
-	buf = exynos_gem_obj->base.dma_buf;
-	res_list = get_dma_buf_kds_resource(buf);
-
-	exynos_drm_fb_attach_dma_buf(exynos_fb, buf);
-
-	/* Waiting for the KDS resource*/
-	trace_exynos_page_flip_state(exynos_drm_pipe_from_crtc(crtc),
-			DRM_BASE_ID(fb), "wait_kds");
-
-	ret = kds_async_waitall(&exynos_plane->kds, &exynos_plane->kds_cb,
-			cookie, NULL, 1, &shared, &res_list);
-	if (ret) {
-		DRM_ERROR("Failed kds waitall ret=%d\n", ret);
-		goto err;
-	}
-
-	return 0;
-
-err:
-	drm_framebuffer_unreference(fb);
-	kfree(cookie);
-
-	return ret;
-#elif defined(CONFIG_DRM_DMA_SYNC)
+#if defined(CONFIG_DRM_DMA_SYNC)
 	BUG_ON(exynos_plane->pending_fence);
 
 	exynos_gem_obj = exynos_drm_fb_obj(exynos_fb, 0);