summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-11-03 08:36:10 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-06 14:20:01 -0500
commit1480afeb013decec1d5451fd0d3eeaffa8e17bb6 (patch)
tree41325c4bb8b45ae9f98febc85dd6634c5113d5b9 /drivers/gpu/nvgpu/common/linux/ioctl_channel.c
parent69c301a99201d6945fb3bd4df821aedf6d590d46 (diff)
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 <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1591434 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_channel.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 44f662cb..9a867bcb 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -21,6 +21,8 @@
21#include <linux/anon_inodes.h> 21#include <linux/anon_inodes.h>
22#include <linux/dma-buf.h> 22#include <linux/dma-buf.h>
23#include <linux/poll.h> 23#include <linux/poll.h>
24#include <uapi/linux/nvgpu.h>
25#include <uapi/linux/nvgpu-t18x.h>
24 26
25#include <nvgpu/semaphore.h> 27#include <nvgpu/semaphore.h>
26#include <nvgpu/timers.h> 28#include <nvgpu/timers.h>
@@ -689,12 +691,41 @@ static int gk20a_channel_get_event_data_from_id(struct channel_gk20a *ch,
689 } 691 }
690} 692}
691 693
694/*
695 * Convert common event_id of the form NVGPU_EVENT_ID_* to Linux specific
696 * event_id of the form NVGPU_IOCTL_CHANNEL_EVENT_ID_* which is used in IOCTLs
697 */
698u32 nvgpu_event_id_to_ioctl_channel_event_id(u32 event_id)
699{
700 switch (event_id) {
701 case NVGPU_EVENT_ID_BPT_INT:
702 return NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_INT;
703 case NVGPU_EVENT_ID_BPT_PAUSE:
704 return NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_PAUSE;
705 case NVGPU_EVENT_ID_BLOCKING_SYNC:
706 return NVGPU_IOCTL_CHANNEL_EVENT_ID_BLOCKING_SYNC;
707 case NVGPU_EVENT_ID_CILP_PREEMPTION_STARTED:
708 return NVGPU_IOCTL_CHANNEL_EVENT_ID_CILP_PREEMPTION_STARTED;
709 case NVGPU_EVENT_ID_CILP_PREEMPTION_COMPLETE:
710 return NVGPU_IOCTL_CHANNEL_EVENT_ID_CILP_PREEMPTION_COMPLETE;
711 case NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN:
712 return NVGPU_IOCTL_CHANNEL_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN;
713 }
714
715 return NVGPU_IOCTL_CHANNEL_EVENT_ID_MAX;
716}
717
692void gk20a_channel_event_id_post_event(struct channel_gk20a *ch, 718void gk20a_channel_event_id_post_event(struct channel_gk20a *ch,
693 u32 event_id) 719 u32 __event_id)
694{ 720{
695 struct gk20a_event_id_data *event_id_data; 721 struct gk20a_event_id_data *event_id_data;
722 u32 event_id;
696 int err = 0; 723 int err = 0;
697 724
725 event_id = nvgpu_event_id_to_ioctl_channel_event_id(__event_id);
726 if (event_id >= NVGPU_IOCTL_CHANNEL_EVENT_ID_MAX)
727 return;
728
698 err = gk20a_channel_get_event_data_from_id(ch, event_id, 729 err = gk20a_channel_get_event_data_from_id(ch, event_id,
699 &event_id_data); 730 &event_id_data);
700 if (err) 731 if (err)