diff options
author | alc <alc@FreeBSD.org> | 2009-06-26 04:47:43 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2009-06-26 04:47:43 +0000 |
commit | 91cafd48b17a27bda3cfbc38e8460a14c273ba9a (patch) | |
tree | be473333ccc371c232599396e7b5253cdbad245b | |
parent | 9a472dd5889ffcc7520ed12bf9cbc791eb34eab7 (diff) | |
download | FreeBSD-src-91cafd48b17a27bda3cfbc38e8460a14c273ba9a.zip FreeBSD-src-91cafd48b17a27bda3cfbc38e8460a14c273ba9a.tar.gz |
This change is the next step in implementing the cache control functionality
required by video card drivers. Specifically, this change introduces
vm_cache_mode_t with an appropriate VM_CACHE_DEFAULT definition on all
architectures. In addition, this changes adds a vm_cache_mode_t parameter
to kmem_alloc_contig() and vm_phys_alloc_contig(). These will be the
interfaces for allocating mapped kernel memory and physical memory,
respectively, with non-default cache modes.
In collaboration with: jhb
-rw-r--r-- | sys/amd64/include/vm.h | 45 | ||||
-rw-r--r-- | sys/arm/include/vm.h | 35 | ||||
-rw-r--r-- | sys/i386/include/vm.h | 45 | ||||
-rw-r--r-- | sys/ia64/include/vm.h | 44 | ||||
-rw-r--r-- | sys/kern/kern_mbuf.c | 2 | ||||
-rw-r--r-- | sys/mips/include/vm.h | 40 | ||||
-rw-r--r-- | sys/powerpc/include/vm.h | 40 | ||||
-rw-r--r-- | sys/sparc64/include/vm.h | 35 | ||||
-rw-r--r-- | sys/sun4v/include/vm.h | 35 | ||||
-rw-r--r-- | sys/sun4v/sun4v/pmap.c | 3 | ||||
-rw-r--r-- | sys/vm/vm.h | 8 | ||||
-rw-r--r-- | sys/vm/vm_contig.c | 8 | ||||
-rw-r--r-- | sys/vm/vm_extern.h | 2 | ||||
-rw-r--r-- | sys/vm/vm_phys.c | 2 | ||||
-rw-r--r-- | sys/vm/vm_phys.h | 2 |
15 files changed, 338 insertions, 8 deletions
diff --git a/sys/amd64/include/vm.h b/sys/amd64/include/vm.h new file mode 100644 index 0000000..411e271 --- /dev/null +++ b/sys/amd64/include/vm.h @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin <jhb@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include <machine/specialreg.h> + +/* Cache control options. */ +#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PAT_UNCACHEABLE) +#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PAT_WRITE_COMBINING) +#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PAT_WRITE_THROUGH) +#define VM_CACHE_WRITE_PROTECTED ((vm_cache_mode_t)PAT_WRITE_PROTECTED) +#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PAT_WRITE_BACK) +#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PAT_UNCACHED) + +#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/arm/include/vm.h b/sys/arm/include/vm.h new file mode 100644 index 0000000..ef3ef1a --- /dev/null +++ b/sys/arm/include/vm.h @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +/* Cache control is not (yet) implemented. */ +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/i386/include/vm.h b/sys/i386/include/vm.h new file mode 100644 index 0000000..411e271 --- /dev/null +++ b/sys/i386/include/vm.h @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin <jhb@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include <machine/specialreg.h> + +/* Cache control options. */ +#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PAT_UNCACHEABLE) +#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PAT_WRITE_COMBINING) +#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PAT_WRITE_THROUGH) +#define VM_CACHE_WRITE_PROTECTED ((vm_cache_mode_t)PAT_WRITE_PROTECTED) +#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PAT_WRITE_BACK) +#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PAT_UNCACHED) + +#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/ia64/include/vm.h b/sys/ia64/include/vm.h new file mode 100644 index 0000000..f8e8c73 --- /dev/null +++ b/sys/ia64/include/vm.h @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include <machine/atomic.h> +#include <machine/pte.h> + +/* Cache control options. */ +#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PTE_MA_WB) +#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PTE_MA_UC) +#define VM_CACHE_UNCACHEABLE_EXPORTED ((vm_cache_mode_t)PTE_MA_UCE) +#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PTE_MA_WC) +#define VM_CACHE_NATPAGE ((vm_cache_mode_t)PTE_MA_NATPAGE) + +#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 67c955c..f266fd5 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -356,7 +356,7 @@ mbuf_jumbo_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, - (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0)); + (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_CACHE_DEFAULT)); } /* diff --git a/sys/mips/include/vm.h b/sys/mips/include/vm.h new file mode 100644 index 0000000..5a55d32 --- /dev/null +++ b/sys/mips/include/vm.h @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include <machine/pte.h> + +/* Cache control options. */ +#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PTE_UNCACHED) +#define VM_CACHE_CACHEABLE_NONCOHERENT ((vm_cache_mode_t)PTE_CACHE) + +#define VM_CACHE_DEFAULT VM_CACHE_CACHEABLE_NONCOHERENT + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/powerpc/include/vm.h b/sys/powerpc/include/vm.h new file mode 100644 index 0000000..d706bdc --- /dev/null +++ b/sys/powerpc/include/vm.h @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include <machine/pte.h> + +/* Cache control options. */ +#define VM_CACHE_INHIBIT ((vm_cache_mode_t)PTE_I) +#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PTE_W) + +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/sparc64/include/vm.h b/sys/sparc64/include/vm.h new file mode 100644 index 0000000..ef3ef1a --- /dev/null +++ b/sys/sparc64/include/vm.h @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +/* Cache control is not (yet) implemented. */ +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/sun4v/include/vm.h b/sys/sun4v/include/vm.h new file mode 100644 index 0000000..ef3ef1a --- /dev/null +++ b/sys/sun4v/include/vm.h @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +/* Cache control is not (yet) implemented. */ +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/sun4v/sun4v/pmap.c b/sys/sun4v/sun4v/pmap.c index e5c2382..984c3a0 100644 --- a/sys/sun4v/sun4v/pmap.c +++ b/sys/sun4v/sun4v/pmap.c @@ -1297,7 +1297,8 @@ pmap_alloc_zeroed_contig_pages(int npages, uint64_t alignment) while (m == NULL) { for (i = 0; phys_avail[i + 1] != 0; i += 2) { m = vm_phys_alloc_contig(npages, phys_avail[i], - phys_avail[i + 1], alignment, (1UL<<34)); + phys_avail[i + 1], alignment, (1UL<<34), + VM_CACHE_DEFAULT); if (m) goto found; } diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 57f2163..832c335 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -61,6 +61,14 @@ #ifndef VM_H #define VM_H +#include <machine/vm.h> + +/* + * The exact set of cache control codes is machine dependent. However, every + * machine is required to define VM_CACHE_DEFAULT. + */ +typedef char vm_cache_mode_t; /* cache control codes */ + typedef char vm_inherit_t; /* inheritance codes */ #define VM_INHERIT_SHARE ((vm_inherit_t) 0) diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c index 8dec3b5..d2b6703 100644 --- a/sys/vm/vm_contig.c +++ b/sys/vm/vm_contig.c @@ -236,7 +236,7 @@ contigmalloc( void *ret; ret = (void *)kmem_alloc_contig(kernel_map, size, flags, low, high, - alignment, boundary); + alignment, boundary, VM_CACHE_DEFAULT); if (ret != NULL) malloc_type_allocated(type, round_page(size)); return (ret); @@ -244,7 +244,8 @@ contigmalloc( vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, - vm_paddr_t high, unsigned long alignment, unsigned long boundary) + vm_paddr_t high, unsigned long alignment, unsigned long boundary, + vm_cache_mode_t mode) { vm_offset_t ret; vm_page_t pages; @@ -255,7 +256,8 @@ kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, npgs = size >> PAGE_SHIFT; tries = 0; retry: - pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary); + pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary, + mode); if (pages == NULL) { if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { vm_page_lock_queues(); diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index 69bf64c..7bacde4 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -43,7 +43,7 @@ int kernacc(void *, int, int); vm_offset_t kmem_alloc(vm_map_t, vm_size_t); vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, - unsigned long boundary); + unsigned long boundary, vm_cache_mode_t mode); vm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t); vm_offset_t kmem_alloc_wait(vm_map_t, vm_size_t); void kmem_free(vm_map_t, vm_offset_t, vm_size_t); diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index f64bc9c..58e71d0 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -588,7 +588,7 @@ vm_phys_zero_pages_idle(void) */ vm_page_t vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high, - unsigned long alignment, unsigned long boundary) + unsigned long alignment, unsigned long boundary, vm_cache_mode_t mode) { struct vm_freelist *fl; struct vm_phys_seg *seg; diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h index 0e012c3..483ab91 100644 --- a/sys/vm/vm_phys.h +++ b/sys/vm/vm_phys.h @@ -43,7 +43,7 @@ void vm_phys_add_page(vm_paddr_t pa); vm_page_t vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high, - unsigned long alignment, unsigned long boundary); + unsigned long alignment, unsigned long boundary, vm_cache_mode_t mode); vm_page_t vm_phys_alloc_pages(int pool, int order); vm_paddr_t vm_phys_bootstrap_alloc(vm_size_t size, unsigned long alignment); void vm_phys_free_pages(vm_page_t m, int order); |