| .. | .. |
|---|
| 27 | 27 | **************************************************************************/ |
|---|
| 28 | 28 | |
|---|
| 29 | 29 | #include "vmwgfx_drv.h" |
|---|
| 30 | +#include <linux/highmem.h> |
|---|
| 30 | 31 | |
|---|
| 31 | 32 | /* |
|---|
| 32 | 33 | * Template that implements find_first_diff() for a generic |
|---|
| .. | .. |
|---|
| 374 | 375 | copy_size = min_t(u32, copy_size, PAGE_SIZE - src_page_offset); |
|---|
| 375 | 376 | |
|---|
| 376 | 377 | if (unmap_src) { |
|---|
| 377 | | - ttm_kunmap_atomic_prot(d->src_addr, d->src_prot); |
|---|
| 378 | + kunmap_local(d->src_addr); |
|---|
| 378 | 379 | d->src_addr = NULL; |
|---|
| 379 | 380 | } |
|---|
| 380 | 381 | |
|---|
| 381 | 382 | if (unmap_dst) { |
|---|
| 382 | | - ttm_kunmap_atomic_prot(d->dst_addr, d->dst_prot); |
|---|
| 383 | + kunmap_local(d->dst_addr); |
|---|
| 383 | 384 | d->dst_addr = NULL; |
|---|
| 384 | 385 | } |
|---|
| 385 | 386 | |
|---|
| .. | .. |
|---|
| 387 | 388 | if (WARN_ON_ONCE(dst_page >= d->dst_num_pages)) |
|---|
| 388 | 389 | return -EINVAL; |
|---|
| 389 | 390 | |
|---|
| 390 | | - d->dst_addr = |
|---|
| 391 | | - ttm_kmap_atomic_prot(d->dst_pages[dst_page], |
|---|
| 392 | | - d->dst_prot); |
|---|
| 393 | | - if (!d->dst_addr) |
|---|
| 394 | | - return -ENOMEM; |
|---|
| 395 | | - |
|---|
| 391 | + d->dst_addr = kmap_local_page_prot(d->dst_pages[dst_page], |
|---|
| 392 | + d->dst_prot); |
|---|
| 396 | 393 | d->mapped_dst = dst_page; |
|---|
| 397 | 394 | } |
|---|
| 398 | 395 | |
|---|
| .. | .. |
|---|
| 400 | 397 | if (WARN_ON_ONCE(src_page >= d->src_num_pages)) |
|---|
| 401 | 398 | return -EINVAL; |
|---|
| 402 | 399 | |
|---|
| 403 | | - d->src_addr = |
|---|
| 404 | | - ttm_kmap_atomic_prot(d->src_pages[src_page], |
|---|
| 405 | | - d->src_prot); |
|---|
| 406 | | - if (!d->src_addr) |
|---|
| 407 | | - return -ENOMEM; |
|---|
| 408 | | - |
|---|
| 400 | + d->src_addr = kmap_local_page_prot(d->src_pages[src_page], |
|---|
| 401 | + d->src_prot); |
|---|
| 409 | 402 | d->mapped_src = src_page; |
|---|
| 410 | 403 | } |
|---|
| 411 | 404 | diff->do_cpy(diff, d->dst_addr + dst_page_offset, |
|---|
| .. | .. |
|---|
| 435 | 428 | * |
|---|
| 436 | 429 | * Performs a CPU blit from one buffer object to another avoiding a full |
|---|
| 437 | 430 | * bo vmap which may exhaust- or fragment vmalloc space. |
|---|
| 438 | | - * On supported architectures (x86), we're using kmap_atomic which avoids |
|---|
| 439 | | - * cross-processor TLB- and cache flushes and may, on non-HIGHMEM systems |
|---|
| 431 | + * |
|---|
| 432 | + * On supported architectures (x86), we're using kmap_local_prot() which |
|---|
| 433 | + * avoids cross-processor TLB- and cache flushes. kmap_local_prot() will |
|---|
| 434 | + * either map a highmem page with the proper pgprot on HIGHMEM=y systems or |
|---|
| 440 | 435 | * reference already set-up mappings. |
|---|
| 441 | 436 | * |
|---|
| 442 | 437 | * Neither of the buffer objects may be placed in PCI memory |
|---|
| .. | .. |
|---|
| 459 | 454 | |
|---|
| 460 | 455 | /* Buffer objects need to be either pinned or reserved: */ |
|---|
| 461 | 456 | if (!(dst->mem.placement & TTM_PL_FLAG_NO_EVICT)) |
|---|
| 462 | | - lockdep_assert_held(&dst->resv->lock.base); |
|---|
| 457 | + dma_resv_assert_held(dst->base.resv); |
|---|
| 463 | 458 | if (!(src->mem.placement & TTM_PL_FLAG_NO_EVICT)) |
|---|
| 464 | | - lockdep_assert_held(&src->resv->lock.base); |
|---|
| 459 | + dma_resv_assert_held(src->base.resv); |
|---|
| 465 | 460 | |
|---|
| 466 | | - if (dst->ttm->state == tt_unpopulated) { |
|---|
| 467 | | - ret = dst->ttm->bdev->driver->ttm_tt_populate(dst->ttm, &ctx); |
|---|
| 461 | + if (!ttm_tt_is_populated(dst->ttm)) { |
|---|
| 462 | + ret = dst->bdev->driver->ttm_tt_populate(dst->bdev, dst->ttm, &ctx); |
|---|
| 468 | 463 | if (ret) |
|---|
| 469 | 464 | return ret; |
|---|
| 470 | 465 | } |
|---|
| 471 | 466 | |
|---|
| 472 | | - if (src->ttm->state == tt_unpopulated) { |
|---|
| 473 | | - ret = src->ttm->bdev->driver->ttm_tt_populate(src->ttm, &ctx); |
|---|
| 467 | + if (!ttm_tt_is_populated(src->ttm)) { |
|---|
| 468 | + ret = src->bdev->driver->ttm_tt_populate(src->bdev, src->ttm, &ctx); |
|---|
| 474 | 469 | if (ret) |
|---|
| 475 | 470 | return ret; |
|---|
| 476 | 471 | } |
|---|
| .. | .. |
|---|
| 499 | 494 | } |
|---|
| 500 | 495 | out: |
|---|
| 501 | 496 | if (d.src_addr) |
|---|
| 502 | | - ttm_kunmap_atomic_prot(d.src_addr, d.src_prot); |
|---|
| 497 | + kunmap_local(d.src_addr); |
|---|
| 503 | 498 | if (d.dst_addr) |
|---|
| 504 | | - ttm_kunmap_atomic_prot(d.dst_addr, d.dst_prot); |
|---|
| 499 | + kunmap_local(d.dst_addr); |
|---|
| 505 | 500 | |
|---|
| 506 | 501 | return ret; |
|---|
| 507 | 502 | } |
|---|