aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 8fbe77cae810..293e248e1b29 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -976,7 +976,6 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
976 976
977void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) 977void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
978{ 978{
979 unsigned long flags;
980 unsigned int i = 0; 979 unsigned int i = 0;
981 980
982 dev_err(gpu->dev, "recover hung GPU!\n"); 981 dev_err(gpu->dev, "recover hung GPU!\n");
@@ -989,11 +988,11 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
989 etnaviv_hw_reset(gpu); 988 etnaviv_hw_reset(gpu);
990 989
991 /* complete all events, the GPU won't do it after the reset */ 990 /* complete all events, the GPU won't do it after the reset */
992 spin_lock_irqsave(&gpu->event_spinlock, flags); 991 spin_lock(&gpu->event_spinlock);
993 for_each_set_bit_from(i, gpu->event_bitmap, ETNA_NR_EVENTS) 992 for_each_set_bit_from(i, gpu->event_bitmap, ETNA_NR_EVENTS)
994 complete(&gpu->event_free); 993 complete(&gpu->event_free);
995 bitmap_zero(gpu->event_bitmap, ETNA_NR_EVENTS); 994 bitmap_zero(gpu->event_bitmap, ETNA_NR_EVENTS);
996 spin_unlock_irqrestore(&gpu->event_spinlock, flags); 995 spin_unlock(&gpu->event_spinlock);
997 996
998 etnaviv_gpu_hw_init(gpu); 997 etnaviv_gpu_hw_init(gpu);
999 gpu->lastctx = NULL; 998 gpu->lastctx = NULL;
@@ -1083,7 +1082,7 @@ static inline bool fence_after(u32 a, u32 b)
1083static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events, 1082static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,
1084 unsigned int *events) 1083 unsigned int *events)
1085{ 1084{
1086 unsigned long flags, timeout = msecs_to_jiffies(10 * 10000); 1085 unsigned long timeout = msecs_to_jiffies(10 * 10000);
1087 unsigned i, acquired = 0; 1086 unsigned i, acquired = 0;
1088 1087
1089 for (i = 0; i < nr_events; i++) { 1088 for (i = 0; i < nr_events; i++) {
@@ -1100,7 +1099,7 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,
1100 timeout = ret; 1099 timeout = ret;
1101 } 1100 }
1102 1101
1103 spin_lock_irqsave(&gpu->event_spinlock, flags); 1102 spin_lock(&gpu->event_spinlock);
1104 1103
1105 for (i = 0; i < nr_events; i++) { 1104 for (i = 0; i < nr_events; i++) {
1106 int event = find_first_zero_bit(gpu->event_bitmap, ETNA_NR_EVENTS); 1105 int event = find_first_zero_bit(gpu->event_bitmap, ETNA_NR_EVENTS);
@@ -1110,7 +1109,7 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,
1110 set_bit(event, gpu->event_bitmap); 1109 set_bit(event, gpu->event_bitmap);
1111 } 1110 }
1112 1111
1113 spin_unlock_irqrestore(&gpu->event_spinlock, flags); 1112 spin_unlock(&gpu->event_spinlock);
1114 1113
1115 return 0; 1114 return 0;
1116 1115
@@ -1123,18 +1122,11 @@ out:
1123 1122
1124static void event_free(struct etnaviv_gpu *gpu, unsigned int event) 1123static void event_free(struct etnaviv_gpu *gpu, unsigned int event)
1125{ 1124{
1126 unsigned long flags;
1127
1128 spin_lock_irqsave(&gpu->event_spinlock, flags);
1129
1130 if (!test_bit(event, gpu->event_bitmap)) { 1125 if (!test_bit(event, gpu->event_bitmap)) {
1131 dev_warn(gpu->dev, "event %u is already marked as free", 1126 dev_warn(gpu->dev, "event %u is already marked as free",
1132 event); 1127 event);
1133 spin_unlock_irqrestore(&gpu->event_spinlock, flags);
1134 } else { 1128 } else {
1135 clear_bit(event, gpu->event_bitmap); 1129 clear_bit(event, gpu->event_bitmap);
1136 spin_unlock_irqrestore(&gpu->event_spinlock, flags);
1137
1138 complete(&gpu->event_free); 1130 complete(&gpu->event_free);
1139 } 1131 }
1140} 1132}