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/common/linux/ioctl_tsg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_tsg.c') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index 2570886d..681a5e66 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c @@ -80,11 +80,16 @@ static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, } void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, - int event_id) + int __event_id) { struct gk20a_event_id_data *event_id_data; + u32 event_id; int err = 0; + event_id = nvgpu_event_id_to_ioctl_channel_event_id(__event_id); + if (event_id >= NVGPU_IOCTL_CHANNEL_EVENT_ID_MAX) + return; + err = gk20a_tsg_get_event_data_from_id(tsg, event_id, &event_id_data); if (err) -- cgit v1.2.2