diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/file.c | 98 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sputrace.c | 8 |
2 files changed, 54 insertions, 52 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index c81341ff75b5..f74259979cb6 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -238,11 +238,13 @@ spufs_mem_write(struct file *file, const char __user *buffer, | |||
238 | return size; | 238 | return size; |
239 | } | 239 | } |
240 | 240 | ||
241 | static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma, | 241 | static int |
242 | unsigned long address) | 242 | spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
243 | { | 243 | { |
244 | struct spu_context *ctx = vma->vm_file->private_data; | 244 | struct spu_context *ctx = vma->vm_file->private_data; |
245 | unsigned long pfn, offset, addr0 = address; | 245 | unsigned long address = (unsigned long)vmf->virtual_address; |
246 | unsigned long pfn, offset; | ||
247 | |||
246 | #ifdef CONFIG_SPU_FS_64K_LS | 248 | #ifdef CONFIG_SPU_FS_64K_LS |
247 | struct spu_state *csa = &ctx->csa; | 249 | struct spu_state *csa = &ctx->csa; |
248 | int psize; | 250 | int psize; |
@@ -260,15 +262,15 @@ static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma, | |||
260 | } | 262 | } |
261 | #endif /* CONFIG_SPU_FS_64K_LS */ | 263 | #endif /* CONFIG_SPU_FS_64K_LS */ |
262 | 264 | ||
263 | offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); | 265 | offset = vmf->pgoff << PAGE_SHIFT; |
264 | if (offset >= LS_SIZE) | 266 | if (offset >= LS_SIZE) |
265 | return NOPFN_SIGBUS; | 267 | return VM_FAULT_SIGBUS; |
266 | 268 | ||
267 | pr_debug("spufs_mem_mmap_nopfn address=0x%lx -> 0x%lx, offset=0x%lx\n", | 269 | pr_debug("spufs_mem_mmap_fault address=0x%lx, offset=0x%lx\n", |
268 | addr0, address, offset); | 270 | address, offset); |
269 | 271 | ||
270 | if (spu_acquire(ctx)) | 272 | if (spu_acquire(ctx)) |
271 | return NOPFN_REFAULT; | 273 | return VM_FAULT_NOPAGE; |
272 | 274 | ||
273 | if (ctx->state == SPU_STATE_SAVED) { | 275 | if (ctx->state == SPU_STATE_SAVED) { |
274 | vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) | 276 | vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) |
@@ -283,12 +285,12 @@ static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma, | |||
283 | 285 | ||
284 | spu_release(ctx); | 286 | spu_release(ctx); |
285 | 287 | ||
286 | return NOPFN_REFAULT; | 288 | return VM_FAULT_NOPAGE; |
287 | } | 289 | } |
288 | 290 | ||
289 | 291 | ||
290 | static struct vm_operations_struct spufs_mem_mmap_vmops = { | 292 | static struct vm_operations_struct spufs_mem_mmap_vmops = { |
291 | .nopfn = spufs_mem_mmap_nopfn, | 293 | .fault = spufs_mem_mmap_fault, |
292 | }; | 294 | }; |
293 | 295 | ||
294 | static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma) | 296 | static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma) |
@@ -351,20 +353,19 @@ static const struct file_operations spufs_mem_fops = { | |||
351 | #endif | 353 | #endif |
352 | }; | 354 | }; |
353 | 355 | ||
354 | static unsigned long spufs_ps_nopfn(struct vm_area_struct *vma, | 356 | static int spufs_ps_fault(struct vm_area_struct *vma, |
355 | unsigned long address, | 357 | struct vm_fault *vmf, |
356 | unsigned long ps_offs, | 358 | unsigned long ps_offs, |
357 | unsigned long ps_size) | 359 | unsigned long ps_size) |
358 | { | 360 | { |
359 | struct spu_context *ctx = vma->vm_file->private_data; | 361 | struct spu_context *ctx = vma->vm_file->private_data; |
360 | unsigned long area, offset = address - vma->vm_start; | 362 | unsigned long area, offset = vmf->pgoff << PAGE_SHIFT; |
361 | int ret = 0; | 363 | int ret = 0; |
362 | 364 | ||
363 | spu_context_nospu_trace(spufs_ps_nopfn__enter, ctx); | 365 | spu_context_nospu_trace(spufs_ps_fault__enter, ctx); |
364 | 366 | ||
365 | offset += vma->vm_pgoff << PAGE_SHIFT; | ||
366 | if (offset >= ps_size) | 367 | if (offset >= ps_size) |
367 | return NOPFN_SIGBUS; | 368 | return VM_FAULT_SIGBUS; |
368 | 369 | ||
369 | /* | 370 | /* |
370 | * Because we release the mmap_sem, the context may be destroyed while | 371 | * Because we release the mmap_sem, the context may be destroyed while |
@@ -378,7 +379,7 @@ static unsigned long spufs_ps_nopfn(struct vm_area_struct *vma, | |||
378 | * pages to hand out to the user, but we don't want to wait | 379 | * pages to hand out to the user, but we don't want to wait |
379 | * with the mmap_sem held. | 380 | * with the mmap_sem held. |
380 | * It is possible to drop the mmap_sem here, but then we need | 381 | * It is possible to drop the mmap_sem here, but then we need |
381 | * to return NOPFN_REFAULT because the mappings may have | 382 | * to return VM_FAULT_NOPAGE because the mappings may have |
382 | * hanged. | 383 | * hanged. |
383 | */ | 384 | */ |
384 | if (spu_acquire(ctx)) | 385 | if (spu_acquire(ctx)) |
@@ -386,14 +387,15 @@ static unsigned long spufs_ps_nopfn(struct vm_area_struct *vma, | |||
386 | 387 | ||
387 | if (ctx->state == SPU_STATE_SAVED) { | 388 | if (ctx->state == SPU_STATE_SAVED) { |
388 | up_read(¤t->mm->mmap_sem); | 389 | up_read(¤t->mm->mmap_sem); |
389 | spu_context_nospu_trace(spufs_ps_nopfn__sleep, ctx); | 390 | spu_context_nospu_trace(spufs_ps_fault__sleep, ctx); |
390 | ret = spufs_wait(ctx->run_wq, ctx->state == SPU_STATE_RUNNABLE); | 391 | ret = spufs_wait(ctx->run_wq, ctx->state == SPU_STATE_RUNNABLE); |
391 | spu_context_trace(spufs_ps_nopfn__wake, ctx, ctx->spu); | 392 | spu_context_trace(spufs_ps_fault__wake, ctx, ctx->spu); |
392 | down_read(¤t->mm->mmap_sem); | 393 | down_read(¤t->mm->mmap_sem); |
393 | } else { | 394 | } else { |
394 | area = ctx->spu->problem_phys + ps_offs; | 395 | area = ctx->spu->problem_phys + ps_offs; |
395 | vm_insert_pfn(vma, address, (area + offset) >> PAGE_SHIFT); | 396 | vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, |
396 | spu_context_trace(spufs_ps_nopfn__insert, ctx, ctx->spu); | 397 | (area + offset) >> PAGE_SHIFT); |
398 | spu_context_trace(spufs_ps_fault__insert, ctx, ctx->spu); | ||
397 | } | 399 | } |
398 | 400 | ||
399 | if (!ret) | 401 | if (!ret) |
@@ -401,18 +403,18 @@ static unsigned long spufs_ps_nopfn(struct vm_area_struct *vma, | |||
401 | 403 | ||
402 | refault: | 404 | refault: |
403 | put_spu_context(ctx); | 405 | put_spu_context(ctx); |
404 | return NOPFN_REFAULT; | 406 | return VM_FAULT_NOPAGE; |
405 | } | 407 | } |
406 | 408 | ||
407 | #if SPUFS_MMAP_4K | 409 | #if SPUFS_MMAP_4K |
408 | static unsigned long spufs_cntl_mmap_nopfn(struct vm_area_struct *vma, | 410 | static int spufs_cntl_mmap_fault(struct vm_area_struct *vma, |
409 | unsigned long address) | 411 | struct vm_fault *vmf) |
410 | { | 412 | { |
411 | return spufs_ps_nopfn(vma, address, 0x4000, 0x1000); | 413 | return spufs_ps_fault(vma, vmf, 0x4000, 0x1000); |
412 | } | 414 | } |
413 | 415 | ||
414 | static struct vm_operations_struct spufs_cntl_mmap_vmops = { | 416 | static struct vm_operations_struct spufs_cntl_mmap_vmops = { |
415 | .nopfn = spufs_cntl_mmap_nopfn, | 417 | .fault = spufs_cntl_mmap_fault, |
416 | }; | 418 | }; |
417 | 419 | ||
418 | /* | 420 | /* |
@@ -1097,23 +1099,23 @@ static ssize_t spufs_signal1_write(struct file *file, const char __user *buf, | |||
1097 | return 4; | 1099 | return 4; |
1098 | } | 1100 | } |
1099 | 1101 | ||
1100 | static unsigned long spufs_signal1_mmap_nopfn(struct vm_area_struct *vma, | 1102 | static int |
1101 | unsigned long address) | 1103 | spufs_signal1_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1102 | { | 1104 | { |
1103 | #if PAGE_SIZE == 0x1000 | 1105 | #if PAGE_SIZE == 0x1000 |
1104 | return spufs_ps_nopfn(vma, address, 0x14000, 0x1000); | 1106 | return spufs_ps_fault(vma, vmf, 0x14000, 0x1000); |
1105 | #elif PAGE_SIZE == 0x10000 | 1107 | #elif PAGE_SIZE == 0x10000 |
1106 | /* For 64k pages, both signal1 and signal2 can be used to mmap the whole | 1108 | /* For 64k pages, both signal1 and signal2 can be used to mmap the whole |
1107 | * signal 1 and 2 area | 1109 | * signal 1 and 2 area |
1108 | */ | 1110 | */ |
1109 | return spufs_ps_nopfn(vma, address, 0x10000, 0x10000); | 1111 | return spufs_ps_fault(vma, vmf, 0x10000, 0x10000); |
1110 | #else | 1112 | #else |
1111 | #error unsupported page size | 1113 | #error unsupported page size |
1112 | #endif | 1114 | #endif |
1113 | } | 1115 | } |
1114 | 1116 | ||
1115 | static struct vm_operations_struct spufs_signal1_mmap_vmops = { | 1117 | static struct vm_operations_struct spufs_signal1_mmap_vmops = { |
1116 | .nopfn = spufs_signal1_mmap_nopfn, | 1118 | .fault = spufs_signal1_mmap_fault, |
1117 | }; | 1119 | }; |
1118 | 1120 | ||
1119 | static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma) | 1121 | static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma) |
@@ -1234,23 +1236,23 @@ static ssize_t spufs_signal2_write(struct file *file, const char __user *buf, | |||
1234 | } | 1236 | } |
1235 | 1237 | ||
1236 | #if SPUFS_MMAP_4K | 1238 | #if SPUFS_MMAP_4K |
1237 | static unsigned long spufs_signal2_mmap_nopfn(struct vm_area_struct *vma, | 1239 | static int |
1238 | unsigned long address) | 1240 | spufs_signal2_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1239 | { | 1241 | { |
1240 | #if PAGE_SIZE == 0x1000 | 1242 | #if PAGE_SIZE == 0x1000 |
1241 | return spufs_ps_nopfn(vma, address, 0x1c000, 0x1000); | 1243 | return spufs_ps_fault(vma, vmf, 0x1c000, 0x1000); |
1242 | #elif PAGE_SIZE == 0x10000 | 1244 | #elif PAGE_SIZE == 0x10000 |
1243 | /* For 64k pages, both signal1 and signal2 can be used to mmap the whole | 1245 | /* For 64k pages, both signal1 and signal2 can be used to mmap the whole |
1244 | * signal 1 and 2 area | 1246 | * signal 1 and 2 area |
1245 | */ | 1247 | */ |
1246 | return spufs_ps_nopfn(vma, address, 0x10000, 0x10000); | 1248 | return spufs_ps_fault(vma, vmf, 0x10000, 0x10000); |
1247 | #else | 1249 | #else |
1248 | #error unsupported page size | 1250 | #error unsupported page size |
1249 | #endif | 1251 | #endif |
1250 | } | 1252 | } |
1251 | 1253 | ||
1252 | static struct vm_operations_struct spufs_signal2_mmap_vmops = { | 1254 | static struct vm_operations_struct spufs_signal2_mmap_vmops = { |
1253 | .nopfn = spufs_signal2_mmap_nopfn, | 1255 | .fault = spufs_signal2_mmap_fault, |
1254 | }; | 1256 | }; |
1255 | 1257 | ||
1256 | static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma) | 1258 | static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma) |
@@ -1362,14 +1364,14 @@ DEFINE_SPUFS_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get, | |||
1362 | spufs_signal2_type_set, "%llu\n", SPU_ATTR_ACQUIRE); | 1364 | spufs_signal2_type_set, "%llu\n", SPU_ATTR_ACQUIRE); |
1363 | 1365 | ||
1364 | #if SPUFS_MMAP_4K | 1366 | #if SPUFS_MMAP_4K |
1365 | static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma, | 1367 | static int |
1366 | unsigned long address) | 1368 | spufs_mss_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1367 | { | 1369 | { |
1368 | return spufs_ps_nopfn(vma, address, 0x0000, 0x1000); | 1370 | return spufs_ps_fault(vma, vmf, 0x0000, 0x1000); |
1369 | } | 1371 | } |
1370 | 1372 | ||
1371 | static struct vm_operations_struct spufs_mss_mmap_vmops = { | 1373 | static struct vm_operations_struct spufs_mss_mmap_vmops = { |
1372 | .nopfn = spufs_mss_mmap_nopfn, | 1374 | .fault = spufs_mss_mmap_fault, |
1373 | }; | 1375 | }; |
1374 | 1376 | ||
1375 | /* | 1377 | /* |
@@ -1424,14 +1426,14 @@ static const struct file_operations spufs_mss_fops = { | |||
1424 | .mmap = spufs_mss_mmap, | 1426 | .mmap = spufs_mss_mmap, |
1425 | }; | 1427 | }; |
1426 | 1428 | ||
1427 | static unsigned long spufs_psmap_mmap_nopfn(struct vm_area_struct *vma, | 1429 | static int |
1428 | unsigned long address) | 1430 | spufs_psmap_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1429 | { | 1431 | { |
1430 | return spufs_ps_nopfn(vma, address, 0x0000, 0x20000); | 1432 | return spufs_ps_fault(vma, vmf, 0x0000, 0x20000); |
1431 | } | 1433 | } |
1432 | 1434 | ||
1433 | static struct vm_operations_struct spufs_psmap_mmap_vmops = { | 1435 | static struct vm_operations_struct spufs_psmap_mmap_vmops = { |
1434 | .nopfn = spufs_psmap_mmap_nopfn, | 1436 | .fault = spufs_psmap_mmap_fault, |
1435 | }; | 1437 | }; |
1436 | 1438 | ||
1437 | /* | 1439 | /* |
@@ -1484,14 +1486,14 @@ static const struct file_operations spufs_psmap_fops = { | |||
1484 | 1486 | ||
1485 | 1487 | ||
1486 | #if SPUFS_MMAP_4K | 1488 | #if SPUFS_MMAP_4K |
1487 | static unsigned long spufs_mfc_mmap_nopfn(struct vm_area_struct *vma, | 1489 | static int |
1488 | unsigned long address) | 1490 | spufs_mfc_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1489 | { | 1491 | { |
1490 | return spufs_ps_nopfn(vma, address, 0x3000, 0x1000); | 1492 | return spufs_ps_fault(vma, vmf, 0x3000, 0x1000); |
1491 | } | 1493 | } |
1492 | 1494 | ||
1493 | static struct vm_operations_struct spufs_mfc_mmap_vmops = { | 1495 | static struct vm_operations_struct spufs_mfc_mmap_vmops = { |
1494 | .nopfn = spufs_mfc_mmap_nopfn, | 1496 | .fault = spufs_mfc_mmap_fault, |
1495 | }; | 1497 | }; |
1496 | 1498 | ||
1497 | /* | 1499 | /* |
diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c index 53202422ba72..8c0e95766a62 100644 --- a/arch/powerpc/platforms/cell/spufs/sputrace.c +++ b/arch/powerpc/platforms/cell/spufs/sputrace.c | |||
@@ -182,10 +182,10 @@ struct spu_probe spu_probes[] = { | |||
182 | { "spu_yield__enter", "ctx %p", spu_context_nospu_event }, | 182 | { "spu_yield__enter", "ctx %p", spu_context_nospu_event }, |
183 | { "spu_deactivate__enter", "ctx %p", spu_context_nospu_event }, | 183 | { "spu_deactivate__enter", "ctx %p", spu_context_nospu_event }, |
184 | { "__spu_deactivate__unload", "ctx %p spu %p", spu_context_event }, | 184 | { "__spu_deactivate__unload", "ctx %p spu %p", spu_context_event }, |
185 | { "spufs_ps_nopfn__enter", "ctx %p", spu_context_nospu_event }, | 185 | { "spufs_ps_fault__enter", "ctx %p", spu_context_nospu_event }, |
186 | { "spufs_ps_nopfn__sleep", "ctx %p", spu_context_nospu_event }, | 186 | { "spufs_ps_fault__sleep", "ctx %p", spu_context_nospu_event }, |
187 | { "spufs_ps_nopfn__wake", "ctx %p spu %p", spu_context_event }, | 187 | { "spufs_ps_fault__wake", "ctx %p spu %p", spu_context_event }, |
188 | { "spufs_ps_nopfn__insert", "ctx %p spu %p", spu_context_event }, | 188 | { "spufs_ps_fault__insert", "ctx %p spu %p", spu_context_event }, |
189 | { "spu_acquire_saved__enter", "ctx %p", spu_context_nospu_event }, | 189 | { "spu_acquire_saved__enter", "ctx %p", spu_context_nospu_event }, |
190 | { "destroy_spu_context__enter", "ctx %p", spu_context_nospu_event }, | 190 | { "destroy_spu_context__enter", "ctx %p", spu_context_nospu_event }, |
191 | { "spufs_stop_callback__enter", "ctx %p spu %p", spu_context_event }, | 191 | { "spufs_stop_callback__enter", "ctx %p spu %p", spu_context_event }, |