diff options
Diffstat (limited to 'drivers')
-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 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | 30 |
3 files changed, 68 insertions, 4 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); |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h index a2f8135e..45561e31 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h +++ b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | |||
@@ -57,8 +57,36 @@ struct nvgpu_clk_session; | |||
57 | __fls((a)->pstates & (b)->pstates) :\ | 57 | __fls((a)->pstates & (b)->pstates) :\ |
58 | VF_POINT_INVALID_PSTATE) | 58 | VF_POINT_INVALID_PSTATE) |
59 | 59 | ||
60 | /* | ||
61 | * These events, defined in common code are the counterparts of the uapi | ||
62 | * events. There should be a conversion function to take care to convert | ||
63 | * these to the uapi events. | ||
64 | */ | ||
65 | /* Event associated to a VF update */ | ||
66 | #define NVGPU_EVENT_VF_UPDATE 0 | ||
67 | |||
68 | /* Recoverable alarms (POLLPRI) */ | ||
69 | /* Alarm when target frequency on any session is not possible */ | ||
70 | #define NVGPU_EVENT_ALARM_TARGET_VF_NOT_POSSIBLE 1 | ||
71 | /* Alarm when target frequency on current session is not possible */ | ||
72 | #define NVGPU_EVENT_ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE 2 | ||
73 | /* Alarm when Clock Arbiter failed */ | ||
74 | #define NVGPU_EVENT_ALARM_CLOCK_ARBITER_FAILED 3 | ||
75 | /* Alarm when VF table update failed */ | ||
76 | #define NVGPU_EVENT_ALARM_VF_TABLE_UPDATE_FAILED 4 | ||
77 | /* Alarm on thermal condition */ | ||
78 | #define NVGPU_EVENT_ALARM_THERMAL_ABOVE_THRESHOLD 5 | ||
79 | /* Alarm on power condition */ | ||
80 | #define NVGPU_EVENT_ALARM_POWER_ABOVE_THRESHOLD 6 | ||
81 | |||
82 | /* Non recoverable alarm (POLLHUP) */ | ||
83 | /* Alarm on GPU shutdown/fall from bus */ | ||
84 | #define NVGPU_EVENT_ALARM_GPU_LOST 7 | ||
85 | |||
86 | #define NVGPU_EVENT_LAST NVGPU_EVENT_ALARM_GPU_LOST | ||
87 | |||
60 | /* Local Alarms */ | 88 | /* Local Alarms */ |
61 | #define EVENT(alarm) (0x1UL << NVGPU_GPU_EVENT_##alarm) | 89 | #define EVENT(alarm) (0x1UL << NVGPU_EVENT_##alarm) |
62 | 90 | ||
63 | #define LOCAL_ALARM_MASK (EVENT(ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE) | \ | 91 | #define LOCAL_ALARM_MASK (EVENT(ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE) | \ |
64 | EVENT(VF_UPDATE)) | 92 | EVENT(VF_UPDATE)) |