diff options
author | 2020-01-22 04:17:50 +0000 | |
---|---|---|
committer | 2020-01-22 04:17:50 +0000 | |
commit | 513b98cb1ce6d30af7211b4c43d313720f347858 (patch) | |
tree | 953dbc6c9e688f78002f264fd5fb24cb863020c7 /sys | |
parent | reword to avoid second person. ok cheloha deraadt (diff) | |
download | wireguard-openbsd-513b98cb1ce6d30af7211b4c43d313720f347858.tar.xz wireguard-openbsd-513b98cb1ce6d30af7211b4c43d313720f347858.zip |
Make ttm_bo_unmap_virtual_locked() actually unmap things. Fixes cursor
issues and suspend/resume on amdgpu(4). Might help radeondrm(4) issues
as well.
tested by mortimer@, abieber@, krw@
ok jsg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c index 229d1a62311..8d45107631b 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo.c +++ b/sys/dev/pci/drm/ttm/ttm_bo.c @@ -1609,7 +1609,34 @@ void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo) { struct ttm_bo_device *bdev = bo->bdev; +#ifdef __linux__ drm_vma_node_unmap(&bo->vma_node, bdev->dev_mapping); +#else + if (drm_vma_node_has_offset(&bo->vma_node) && + bo->mem.bus.io_reserved_vm) { + struct vm_page *pg; + bus_addr_t addr; + paddr_t paddr; + unsigned i; + + if (bo->mem.bus.is_iomem) { + addr = bo->mem.bus.base + bo->mem.bus.offset; + paddr = bus_space_mmap(bdev->memt, addr, 0, 0, 0); + for (i = 0; i < bo->mem.num_pages; i++) { + pg = PHYS_TO_VM_PAGE(paddr); + if (pg) + pmap_page_protect(pg, PROT_NONE); + paddr += PAGE_SIZE; + } + } else if (bo->ttm) { + for (i = 0; i < bo->ttm->num_pages; i++) { + pg = bo->ttm->pages[i]; + if (pg) + pmap_page_protect(pg, PROT_NONE); + } + } + } +#endif ttm_mem_io_free_vm(bo); } |