gpu: nvgpu: Protect sync by an own lock
[linux-3.10.git] / drivers / gpu / nvgpu / gk20a / channel_gk20a.h
index d0e79dc..6021c43 100644 (file)
@@ -72,6 +72,8 @@ struct channel_gk20a_job {
        int num_mapped_buffers;
        struct gk20a_fence *pre_fence;
        struct gk20a_fence *post_fence;
+       struct priv_cmd_entry *wait_cmd;
+       struct priv_cmd_entry *incr_cmd;
        struct list_head list;
 };
 
@@ -81,6 +83,12 @@ struct channel_gk20a_poll_events {
        int num_pending_events;
 };
 
+struct channel_gk20a_clean_up {
+       struct mutex lock;
+       bool scheduled;
+       struct delayed_work wq;
+};
+
 /* this is the priv element of struct nvhost_channel */
 struct channel_gk20a {
        struct gk20a *g; /* set only when channel is active */
@@ -132,6 +140,8 @@ struct channel_gk20a {
        u32 timeout_accumulated_ms;
        u32 timeout_gpfifo_get;
 
+       struct channel_gk20a_clean_up clean_up;
+
        bool cmds_pending;
        struct {
                /* These fences should be accessed with submit_lock held. */
@@ -162,6 +172,7 @@ struct channel_gk20a {
        struct nvgpu_notification *error_notifier;
        void *error_notifier_va;
 
+       struct mutex sync_lock;
        struct gk20a_channel_sync *sync;
 
 #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
@@ -191,10 +202,8 @@ void gk20a_channel_close(struct channel_gk20a *ch);
 
 bool gk20a_channel_update_and_check_timeout(struct channel_gk20a *ch,
                                            u32 timeout_delta_ms);
-void gk20a_disable_channel(struct channel_gk20a *ch,
-                          bool wait_for_finish,
-                          unsigned long finish_timeout);
-void gk20a_channel_abort(struct channel_gk20a *ch);
+void gk20a_disable_channel(struct channel_gk20a *ch);
+void gk20a_channel_abort(struct channel_gk20a *ch, bool channel_preempt);
 int gk20a_channel_finish(struct channel_gk20a *ch, unsigned long timeout);
 void gk20a_set_error_notifier(struct channel_gk20a *ch, __u32 error);
 void gk20a_channel_semaphore_wakeup(struct gk20a *g);
@@ -237,10 +246,12 @@ void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a);
 
 int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
                                struct nvgpu_gpfifo *gpfifo,
+                               struct nvgpu_submit_gpfifo_args *args,
                                u32 num_entries,
                                u32 flags,
                                struct nvgpu_fence *fence,
-                               struct gk20a_fence **fence_out);
+                               struct gk20a_fence **fence_out,
+                               bool force_need_sync_fence);
 
 int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c,
                               struct nvgpu_alloc_gpfifo_args *args);