Skip to content

Commit d62c43a

Browse files
ArvindYadavAMDChristianKoenigAMD
authored andcommitted
dma-buf: Enable signaling on fence for selftests
Here's enabling software signaling on fence for selftest. Signed-off-by: Arvind Yadav <Arvind.Yadav@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220914164321.2156-4-Arvind.Yadav@amd.com Signed-off-by: Christian König <christian.koenig@amd.com>
1 parent c85d00d commit d62c43a

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

drivers/dma-buf/st-dma-fence-chain.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ static int sanitycheck(void *arg)
8787
if (!chain)
8888
err = -ENOMEM;
8989

90+
dma_fence_enable_sw_signaling(chain);
91+
9092
dma_fence_signal(f);
9193
dma_fence_put(f);
9294

@@ -143,6 +145,8 @@ static int fence_chains_init(struct fence_chains *fc, unsigned int count,
143145
}
144146

145147
fc->tail = fc->chains[i];
148+
149+
dma_fence_enable_sw_signaling(fc->chains[i]);
146150
}
147151

148152
fc->chain_length = i;

drivers/dma-buf/st-dma-fence-unwrap.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ static int sanitycheck(void *arg)
102102
if (!f)
103103
return -ENOMEM;
104104

105+
dma_fence_enable_sw_signaling(f);
106+
105107
array = mock_array(1, f);
106108
if (!array)
107109
return -ENOMEM;
@@ -124,12 +126,16 @@ static int unwrap_array(void *arg)
124126
if (!f1)
125127
return -ENOMEM;
126128

129+
dma_fence_enable_sw_signaling(f1);
130+
127131
f2 = mock_fence();
128132
if (!f2) {
129133
dma_fence_put(f1);
130134
return -ENOMEM;
131135
}
132136

137+
dma_fence_enable_sw_signaling(f2);
138+
133139
array = mock_array(2, f1, f2);
134140
if (!array)
135141
return -ENOMEM;
@@ -164,12 +170,16 @@ static int unwrap_chain(void *arg)
164170
if (!f1)
165171
return -ENOMEM;
166172

173+
dma_fence_enable_sw_signaling(f1);
174+
167175
f2 = mock_fence();
168176
if (!f2) {
169177
dma_fence_put(f1);
170178
return -ENOMEM;
171179
}
172180

181+
dma_fence_enable_sw_signaling(f2);
182+
173183
chain = mock_chain(f1, f2);
174184
if (!chain)
175185
return -ENOMEM;
@@ -204,12 +214,16 @@ static int unwrap_chain_array(void *arg)
204214
if (!f1)
205215
return -ENOMEM;
206216

217+
dma_fence_enable_sw_signaling(f1);
218+
207219
f2 = mock_fence();
208220
if (!f2) {
209221
dma_fence_put(f1);
210222
return -ENOMEM;
211223
}
212224

225+
dma_fence_enable_sw_signaling(f2);
226+
213227
array = mock_array(2, f1, f2);
214228
if (!array)
215229
return -ENOMEM;
@@ -248,12 +262,16 @@ static int unwrap_merge(void *arg)
248262
if (!f1)
249263
return -ENOMEM;
250264

265+
dma_fence_enable_sw_signaling(f1);
266+
251267
f2 = mock_fence();
252268
if (!f2) {
253269
err = -ENOMEM;
254270
goto error_put_f1;
255271
}
256272

273+
dma_fence_enable_sw_signaling(f2);
274+
257275
f3 = dma_fence_unwrap_merge(f1, f2);
258276
if (!f3) {
259277
err = -ENOMEM;
@@ -296,10 +314,14 @@ static int unwrap_merge_complex(void *arg)
296314
if (!f1)
297315
return -ENOMEM;
298316

317+
dma_fence_enable_sw_signaling(f1);
318+
299319
f2 = mock_fence();
300320
if (!f2)
301321
goto error_put_f1;
302322

323+
dma_fence_enable_sw_signaling(f2);
324+
303325
f3 = dma_fence_unwrap_merge(f1, f2);
304326
if (!f3)
305327
goto error_put_f2;

drivers/dma-buf/st-dma-fence.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ static int sanitycheck(void *arg)
102102
if (!f)
103103
return -ENOMEM;
104104

105+
dma_fence_enable_sw_signaling(f);
106+
105107
dma_fence_signal(f);
106108
dma_fence_put(f);
107109

@@ -117,6 +119,8 @@ static int test_signaling(void *arg)
117119
if (!f)
118120
return -ENOMEM;
119121

122+
dma_fence_enable_sw_signaling(f);
123+
120124
if (dma_fence_is_signaled(f)) {
121125
pr_err("Fence unexpectedly signaled on creation\n");
122126
goto err_free;
@@ -190,6 +194,8 @@ static int test_late_add_callback(void *arg)
190194
if (!f)
191195
return -ENOMEM;
192196

197+
dma_fence_enable_sw_signaling(f);
198+
193199
dma_fence_signal(f);
194200

195201
if (!dma_fence_add_callback(f, &cb.cb, simple_callback)) {
@@ -282,6 +288,8 @@ static int test_status(void *arg)
282288
if (!f)
283289
return -ENOMEM;
284290

291+
dma_fence_enable_sw_signaling(f);
292+
285293
if (dma_fence_get_status(f)) {
286294
pr_err("Fence unexpectedly has signaled status on creation\n");
287295
goto err_free;
@@ -308,6 +316,8 @@ static int test_error(void *arg)
308316
if (!f)
309317
return -ENOMEM;
310318

319+
dma_fence_enable_sw_signaling(f);
320+
311321
dma_fence_set_error(f, -EIO);
312322

313323
if (dma_fence_get_status(f)) {
@@ -337,6 +347,8 @@ static int test_wait(void *arg)
337347
if (!f)
338348
return -ENOMEM;
339349

350+
dma_fence_enable_sw_signaling(f);
351+
340352
if (dma_fence_wait_timeout(f, false, 0) != -ETIME) {
341353
pr_err("Wait reported complete before being signaled\n");
342354
goto err_free;
@@ -379,6 +391,8 @@ static int test_wait_timeout(void *arg)
379391
if (!wt.f)
380392
return -ENOMEM;
381393

394+
dma_fence_enable_sw_signaling(wt.f);
395+
382396
if (dma_fence_wait_timeout(wt.f, false, 1) != -ETIME) {
383397
pr_err("Wait reported complete before being signaled\n");
384398
goto err_free;
@@ -458,6 +472,8 @@ static int thread_signal_callback(void *arg)
458472
break;
459473
}
460474

475+
dma_fence_enable_sw_signaling(f1);
476+
461477
rcu_assign_pointer(t->fences[t->id], f1);
462478
smp_wmb();
463479

drivers/dma-buf/st-dma-resv.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ static int sanitycheck(void *arg)
4545
if (!f)
4646
return -ENOMEM;
4747

48+
dma_fence_enable_sw_signaling(f);
49+
4850
dma_fence_signal(f);
4951
dma_fence_put(f);
5052

@@ -69,6 +71,8 @@ static int test_signaling(void *arg)
6971
if (!f)
7072
return -ENOMEM;
7173

74+
dma_fence_enable_sw_signaling(f);
75+
7276
dma_resv_init(&resv);
7377
r = dma_resv_lock(&resv, NULL);
7478
if (r) {
@@ -114,6 +118,8 @@ static int test_for_each(void *arg)
114118
if (!f)
115119
return -ENOMEM;
116120

121+
dma_fence_enable_sw_signaling(f);
122+
117123
dma_resv_init(&resv);
118124
r = dma_resv_lock(&resv, NULL);
119125
if (r) {
@@ -173,6 +179,8 @@ static int test_for_each_unlocked(void *arg)
173179
if (!f)
174180
return -ENOMEM;
175181

182+
dma_fence_enable_sw_signaling(f);
183+
176184
dma_resv_init(&resv);
177185
r = dma_resv_lock(&resv, NULL);
178186
if (r) {
@@ -244,6 +252,8 @@ static int test_get_fences(void *arg)
244252
if (!f)
245253
return -ENOMEM;
246254

255+
dma_fence_enable_sw_signaling(f);
256+
247257
dma_resv_init(&resv);
248258
r = dma_resv_lock(&resv, NULL);
249259
if (r) {

0 commit comments

Comments
 (0)