diff options
author | Sourab Gupta <sourabg@nvidia.com> | 2018-04-20 00:55:16 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-05-07 07:42:06 -0400 |
commit | 0ad40e83dbcf0f3f6e936f573c8e7878803ab37f (patch) | |
tree | ca149277fc9287ac49a071b98f72ba9cb65fcc5a /drivers/gpu/nvgpu/common | |
parent | c92afad630f0539dfd2d28369d493715648b4ace (diff) |
gpu: nvgpu: add conversion function for gpu alarm events
In order to enable the movement of clk arbitrator to common
code, we need to remove the NVGPU_GPU_EVENT_* defines (which
are present in uapi) and instead use the common code defines.
Add a conversion function for the same.
With this the uapi header is no longer required to be included
inside clk_arb.c
Jira VQRM-3741
Change-Id: If01614b01733876046f98b97e70285c52bc33e45
Signed-off-by: Sourab Gupta <sourabg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1699241
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
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')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/clk_arb.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c | 39 |
2 files changed, 39 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/clk_arb.c b/drivers/gpu/nvgpu/common/linux/clk_arb.c index 85d9d11c..3ec7fd54 100644 --- a/drivers/gpu/nvgpu/common/linux/clk_arb.c +++ b/drivers/gpu/nvgpu/common/linux/clk_arb.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifdef CONFIG_DEBUG_FS | 24 | #ifdef CONFIG_DEBUG_FS |
25 | #include <linux/debugfs.h> | 25 | #include <linux/debugfs.h> |
26 | #endif | 26 | #endif |
27 | #include <uapi/linux/nvgpu.h> | ||
28 | 27 | ||
29 | #include <nvgpu/bitops.h> | 28 | #include <nvgpu/bitops.h> |
30 | #include <nvgpu/lock.h> | 29 | #include <nvgpu/lock.h> |
@@ -1184,7 +1183,7 @@ mutex_fail: | |||
1184 | void nvgpu_clk_arb_send_thermal_alarm(struct gk20a *g) | 1183 | void nvgpu_clk_arb_send_thermal_alarm(struct gk20a *g) |
1185 | { | 1184 | { |
1186 | nvgpu_clk_arb_schedule_alarm(g, | 1185 | nvgpu_clk_arb_schedule_alarm(g, |
1187 | (0x1UL << NVGPU_GPU_EVENT_ALARM_THERMAL_ABOVE_THRESHOLD)); | 1186 | (0x1UL << NVGPU_EVENT_ALARM_THERMAL_ABOVE_THRESHOLD)); |
1188 | } | 1187 | } |
1189 | 1188 | ||
1190 | void nvgpu_clk_arb_schedule_alarm(struct gk20a *g, u32 alarm) | 1189 | void nvgpu_clk_arb_schedule_alarm(struct gk20a *g, u32 alarm) |
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c b/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c index 62b6ae17..40a5b11c 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c | |||
@@ -97,6 +97,43 @@ static int nvgpu_clk_arb_release_event_dev(struct inode *inode, | |||
97 | return 0; | 97 | return 0; |
98 | } | 98 | } |
99 | 99 | ||
100 | static inline u32 nvgpu_convert_gpu_event(u32 nvgpu_event) | ||
101 | { | ||
102 | u32 nvgpu_gpu_event; | ||
103 | |||
104 | switch (nvgpu_event) { | ||
105 | case NVGPU_EVENT_VF_UPDATE: | ||
106 | nvgpu_gpu_event = NVGPU_GPU_EVENT_VF_UPDATE; | ||
107 | break; | ||
108 | case NVGPU_EVENT_ALARM_TARGET_VF_NOT_POSSIBLE: | ||
109 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_TARGET_VF_NOT_POSSIBLE; | ||
110 | break; | ||
111 | case NVGPU_EVENT_ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE: | ||
112 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE; | ||
113 | break; | ||
114 | case NVGPU_EVENT_ALARM_CLOCK_ARBITER_FAILED: | ||
115 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_CLOCK_ARBITER_FAILED; | ||
116 | break; | ||
117 | case NVGPU_EVENT_ALARM_VF_TABLE_UPDATE_FAILED: | ||
118 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_VF_TABLE_UPDATE_FAILED; | ||
119 | break; | ||
120 | case NVGPU_EVENT_ALARM_THERMAL_ABOVE_THRESHOLD: | ||
121 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_THERMAL_ABOVE_THRESHOLD; | ||
122 | break; | ||
123 | case NVGPU_EVENT_ALARM_POWER_ABOVE_THRESHOLD: | ||
124 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_POWER_ABOVE_THRESHOLD; | ||
125 | break; | ||
126 | case NVGPU_EVENT_ALARM_GPU_LOST: | ||
127 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_GPU_LOST; | ||
128 | break; | ||
129 | default: | ||
130 | /* Control shouldn't come here */ | ||
131 | nvgpu_gpu_event = NVGPU_GPU_EVENT_ALARM_GPU_LOST + 1; | ||
132 | break; | ||
133 | } | ||
134 | return nvgpu_gpu_event; | ||
135 | } | ||
136 | |||
100 | static inline u32 __pending_event(struct nvgpu_clk_dev *dev, | 137 | static inline u32 __pending_event(struct nvgpu_clk_dev *dev, |
101 | struct nvgpu_gpu_event_info *info) { | 138 | struct nvgpu_gpu_event_info *info) { |
102 | 139 | ||
@@ -112,7 +149,7 @@ static inline u32 __pending_event(struct nvgpu_clk_dev *dev, | |||
112 | if (_WRAPGTEQ(tail, head) && info) { | 149 | if (_WRAPGTEQ(tail, head) && info) { |
113 | head++; | 150 | head++; |
114 | p_notif = &dev->queue.notifications[head % dev->queue.size]; | 151 | p_notif = &dev->queue.notifications[head % dev->queue.size]; |
115 | events |= p_notif->notification; | 152 | events |= nvgpu_convert_gpu_event(p_notif->notification); |
116 | info->event_id = ffs(events) - 1; | 153 | info->event_id = ffs(events) - 1; |
117 | info->timestamp = p_notif->timestamp; | 154 | info->timestamp = p_notif->timestamp; |
118 | nvgpu_atomic_set(&dev->queue.head, head); | 155 | nvgpu_atomic_set(&dev->queue.head, head); |