summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2022-02-07 13:16:43 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2022-02-07 13:16:43 +0000
commit2af6b395cc31b2fbf75d19b3b2fb8d5f045df2c6 (patch)
treebcaa68942762141d130863166bcebedd6e6df620 /sys/dev/pci
parent380452a9640a9a65c0c685a95f8f8b93d46e5ca7 (diff)
Convert KVA allocation to km_alloc(9).
ok jsg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/drm_linux.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index 004a7bde2ea..fe7ca71a8a3 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.89 2022/01/21 23:49:36 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.90 2022/02/07 13:16:42 kettenis Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -564,6 +564,11 @@ __pagevec_release(struct pagevec *pvec)
pagevec_reinit(pvec);
}
+static struct kmem_va_mode kv_physwait = {
+ .kv_map = &phys_map,
+ .kv_wait = 1,
+};
+
void *
kmap(struct vm_page *pg)
{
@@ -572,7 +577,7 @@ kmap(struct vm_page *pg)
#if defined (__HAVE_PMAP_DIRECT)
va = pmap_map_direct(pg);
#else
- va = uvm_km_valloc_wait(phys_map, PAGE_SIZE);
+ va = (vaddr_t)km_alloc(PAGE_SIZE, &kv_physwait, &kp_none, &kd_waitok);
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg), PROT_READ | PROT_WRITE);
pmap_update(pmap_kernel());
#endif
@@ -589,7 +594,7 @@ kunmap_va(void *addr)
#else
pmap_kremove(va, PAGE_SIZE);
pmap_update(pmap_kernel());
- uvm_km_free_wakeup(phys_map, va, PAGE_SIZE);
+ km_free((void *)va, PAGE_SIZE, &kv_physwait, &kp_none);
#endif
}
@@ -624,7 +629,8 @@ vmap(struct vm_page **pages, unsigned int npages, unsigned long flags,
paddr_t pa;
int i;
- va = uvm_km_valloc(kernel_map, PAGE_SIZE * npages);
+ va = (vaddr_t)km_alloc(PAGE_SIZE * npages, &kv_any, &kp_none,
+ &kd_nowait);
if (va == 0)
return NULL;
for (i = 0; i < npages; i++) {
@@ -645,7 +651,7 @@ vunmap(void *addr, size_t size)
pmap_remove(pmap_kernel(), va, va + size);
pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, va, size);
+ km_free((void *)va, size, &kv_any, &kp_none);
}
bool