Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/yamt-km]: src/sys/arch/xen/xen convert to the new API.
details: https://anonhg.NetBSD.org/src/rev/e2e0864ceea2
branches: yamt-km
changeset: 573383:e2e0864ceea2
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Mar 19 12:21:12 2005 +0000
description:
convert to the new API.
diffstat:
sys/arch/xen/xen/xbdback.c | 11 +++++++----
sys/arch/xen/xen/xennetback.c | 41 +++++++++++++++++++++++++++--------------
2 files changed, 34 insertions(+), 18 deletions(-)
diffs (127 lines):
diff -r e3c9e4120eb9 -r e2e0864ceea2 sys/arch/xen/xen/xbdback.c
--- a/sys/arch/xen/xen/xbdback.c Sat Mar 19 10:45:52 2005 +0000
+++ b/sys/arch/xen/xen/xbdback.c Sat Mar 19 12:21:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xbdback.c,v 1.4.4.2 2005/03/19 08:33:26 yamt Exp $ */
+/* $NetBSD: xbdback.c,v 1.4.4.3 2005/03/19 12:21:12 yamt Exp $ */
/*
* Copyright (c) 2005 Manuel Bouyer.
@@ -241,7 +241,8 @@
req->status = BLKIF_BE_STATUS_INTERFACE_CONNECTED;
goto end;
}
- ring_addr = uvm_km_alloc(kernel_map, PAGE_SIZE);
+ ring_addr = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
+ UVM_KMF_VAONLY);
if (ring_addr == 0) {
req->status = BLKIF_BE_STATUS_OUT_OF_MEMORY;
goto end;
@@ -251,7 +252,8 @@
error = pmap_remap_pages(pmap_kernel(), ring_addr,
xbdi->ma_ring, 1, PMAP_WIRED | PMAP_CANFAIL, req->domid);
if (error) {
- uvm_km_free(kernel_map, ring_addr, PAGE_SIZE);
+ uvm_km_free(kernel_map, ring_addr, PAGE_SIZE,
+ UVM_KMF_VAONLY);
if (error == ENOMEM)
req->status = BLKIF_BE_STATUS_OUT_OF_MEMORY;
else if (error == EFAULT)
@@ -287,7 +289,8 @@
unbind_evtchn_to_irq(xbdi->evtchn);
ring_addr = (vaddr_t)xbdi->blk_ring;
pmap_remove(pmap_kernel(), ring_addr, ring_addr + PAGE_SIZE);
- uvm_km_free(kernel_map, ring_addr, PAGE_SIZE);
+ uvm_km_free(kernel_map, ring_addr, PAGE_SIZE,
+ UVM_KMF_VAONLY);
req->status = BLKIF_BE_STATUS_OKAY;
break;
}
diff -r e3c9e4120eb9 -r e2e0864ceea2 sys/arch/xen/xen/xennetback.c
--- a/sys/arch/xen/xen/xennetback.c Sat Mar 19 10:45:52 2005 +0000
+++ b/sys/arch/xen/xen/xennetback.c Sat Mar 19 12:21:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xennetback.c,v 1.4.4.2 2005/03/19 08:33:26 yamt Exp $ */
+/* $NetBSD: xennetback.c,v 1.4.4.3 2005/03/19 12:21:12 yamt Exp $ */
/*
* Copyright (c) 2005 Manuel Bouyer.
@@ -147,8 +147,8 @@
XENPRINTF(("xennetback_init\n"));
- xmit_pages_vaddr_base = uvm_km_valloc(kernel_map,
- NB_XMIT_PAGES_BATCH * PAGE_SIZE);
+ xmit_pages_vaddr_base = uvm_km_alloc(kernel_map,
+ NB_XMIT_PAGES_BATCH * PAGE_SIZE, 0, UVM_KMF_VAONLY);
xmit_pages_vaddr_base = xmit_pages_vaddr_base >> PAGE_SHIFT;
xmit_pages_alloc = -1;
if (xmit_pages_vaddr_base == 0)
@@ -298,18 +298,21 @@
req->status = NETIF_BE_STATUS_INTERFACE_CONNECTED;
goto end;
}
- ring_rxaddr = uvm_km_alloc(kernel_map, PAGE_SIZE);
+ ring_rxaddr = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
+ UVM_KMF_VAONLY);
if (ring_rxaddr == 0) {
printf("%s: can't alloc ring VM\n",
xneti->xni_if.if_xname);
req->status = NETIF_BE_STATUS_OUT_OF_MEMORY;
goto end;
}
- ring_txaddr = uvm_km_alloc(kernel_map, PAGE_SIZE);
+ ring_txaddr = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
+ UVM_KMF_VAONLY);
if (ring_txaddr == 0) {
printf("%s: can't alloc ring VM\n",
xneti->xni_if.if_xname);
- uvm_km_free(kernel_map, ring_rxaddr, PAGE_SIZE);
+ uvm_km_free(kernel_map, ring_rxaddr, PAGE_SIZE,
+ UVM_KMF_VAONLY);
req->status = NETIF_BE_STATUS_OUT_OF_MEMORY;
goto end;
}
@@ -318,13 +321,21 @@
error = pmap_remap_pages(pmap_kernel(), ring_rxaddr,
xneti->xni_ma_rxring, 1, PMAP_WIRED | PMAP_CANFAIL,
req->domid);
- if (error == 0)
- error = pmap_remap_pages(pmap_kernel(), ring_txaddr,
- xneti->xni_ma_txring, 1, PMAP_WIRED | PMAP_CANFAIL,
- req->domid);
+ if (error) {
+ goto fail_1;
+ }
+ error = pmap_remap_pages(pmap_kernel(), ring_txaddr,
+ xneti->xni_ma_txring, 1, PMAP_WIRED | PMAP_CANFAIL,
+ req->domid);
if (error) {
- uvm_km_free(kernel_map, ring_rxaddr, PAGE_SIZE);
- uvm_km_free(kernel_map, ring_txaddr, PAGE_SIZE);
+ pmap_remove(kernel_map, ring_rxaddr,
+ ring_rxaddr + PAGE_SIZE);
+ pmap_update();
+fail_1:
+ uvm_km_free(kernel_map, ring_rxaddr, PAGE_SIZE,
+ UVM_KMF_VAONLY);
+ uvm_km_free(kernel_map, ring_txaddr, PAGE_SIZE,
+ UVM_KMF_VAONLY);
printf("%s: can't remap ring: error %d\n",
xneti->xni_if.if_xname, error);
if (error == ENOMEM)
@@ -371,10 +382,12 @@
unbind_evtchn_to_irq(xneti->xni_evtchn);
ring_addr = (vaddr_t)xneti->xni_rxring;
pmap_remove(pmap_kernel(), ring_addr, ring_addr + PAGE_SIZE);
- uvm_km_free(kernel_map, ring_addr, PAGE_SIZE);
+ uvm_km_free(kernel_map, ring_addr, PAGE_SIZE,
+ UVM_KMF_VAONLY);
ring_addr = (vaddr_t)xneti->xni_txring;
pmap_remove(pmap_kernel(), ring_addr, ring_addr + PAGE_SIZE);
- uvm_km_free(kernel_map, ring_addr, PAGE_SIZE);
+ uvm_km_free(kernel_map, ring_addr, PAGE_SIZE,
+ UVM_KMF_VAONLY);
req->status = NETIF_BE_STATUS_OKAY;
break;
Home |
Main Index |
Thread Index |
Old Index