From 1480afeb013decec1d5451fd0d3eeaffa8e17bb6 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 3 Nov 2017 05:36:10 -0700 Subject: gpu: nvgpu: define EVENT_IDs in common code All the event ids NVGPU_IOCTL_CHANNEL_EVENT_ID_* are defined in linux specific user header uapi/linux/nvgpu.h and can't be used in common code Hence add new definitions of type NVGPU_EVENT_ID_* for all the events in common code and use them wherever required in common code For future additions to event ids, we need to update both NVGPU_IOCTL_CHANNEL_EVENT_ID_* and NVGPU_EVENT_ID_* fields Also add new API nvgpu_event_id_to_ioctl_channel_event_id() to convert common event_id of the form NVGPU_EVENT_ID_* to Linux specific event_id of the form NVGPU_IOCTL_CHANNEL_EVENT_ID_* Use this API in gk20a_channel/tsg_event_id_post_event() to get correct event_id Jira NVGPU-259 Change-Id: I15a7f41181fdbb8f1876f88bbcd044447d88325f Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1591434 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 4 ++-- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 12 ++++++------ drivers/gpu/nvgpu/gk20a/gr_gk20a.h | 10 ++++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index c938ba6b..805902eb 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -2395,10 +2395,10 @@ void gk20a_channel_semaphore_wakeup(struct gk20a *g, bool post_events) &g->fifo.tsg[c->tsgid]; gk20a_tsg_event_id_post_event(tsg, - NVGPU_IOCTL_CHANNEL_EVENT_ID_BLOCKING_SYNC); + NVGPU_EVENT_ID_BLOCKING_SYNC); } else { gk20a_channel_event_id_post_event(c, - NVGPU_IOCTL_CHANNEL_EVENT_ID_BLOCKING_SYNC); + NVGPU_EVENT_ID_BLOCKING_SYNC); } } /* diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 2a20c2d9..f7db1ffa 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -5275,10 +5275,10 @@ static int gk20a_gr_handle_semaphore_pending(struct gk20a *g, struct tsg_gk20a *tsg = &g->fifo.tsg[ch->tsgid]; gk20a_tsg_event_id_post_event(tsg, - NVGPU_IOCTL_CHANNEL_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN); + NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN); } else { gk20a_channel_event_id_post_event(ch, - NVGPU_IOCTL_CHANNEL_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN); + NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN); } nvgpu_cond_broadcast(&ch->semaphore_wq); @@ -5824,10 +5824,10 @@ static int gk20a_gr_post_bpt_events(struct gk20a *g, struct channel_gk20a *ch, struct tsg_gk20a *tsg = &g->fifo.tsg[ch->tsgid]; gk20a_tsg_event_id_post_event(tsg, - NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_INT); + NVGPU_EVENT_ID_BPT_INT); } else { gk20a_channel_event_id_post_event(ch, - NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_INT); + NVGPU_EVENT_ID_BPT_INT); } } if (global_esr & gr_gpc0_tpc0_sm_hww_global_esr_bpt_pause_pending_f()) { @@ -5835,10 +5835,10 @@ static int gk20a_gr_post_bpt_events(struct gk20a *g, struct channel_gk20a *ch, struct tsg_gk20a *tsg = &g->fifo.tsg[ch->tsgid]; gk20a_tsg_event_id_post_event(tsg, - NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_PAUSE); + NVGPU_EVENT_ID_BPT_PAUSE); } else { gk20a_channel_event_id_post_event(ch, - NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_PAUSE); + NVGPU_EVENT_ID_BPT_PAUSE); } } diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h index 8a044728..d411a2fa 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h @@ -124,6 +124,16 @@ enum { BLCG_AUTO /* clk will run when non-idle, standard blcg mode */ }; +enum { + NVGPU_EVENT_ID_BPT_INT = 0, + NVGPU_EVENT_ID_BPT_PAUSE, + NVGPU_EVENT_ID_BLOCKING_SYNC, + NVGPU_EVENT_ID_CILP_PREEMPTION_STARTED, + NVGPU_EVENT_ID_CILP_PREEMPTION_COMPLETE, + NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN, + NVGPU_EVENT_ID_MAX, +}; + #ifndef GR_GO_IDLE_BUNDLE #define GR_GO_IDLE_BUNDLE 0x0000e100 /* --V-B */ #endif -- cgit v1.2.2