From owner-svn-soc-all@freebsd.org Tue Jul 21 13:41:34 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B87419A5168 for ; Tue, 21 Jul 2015 13:41:34 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A920816B7 for ; Tue, 21 Jul 2015 13:41:34 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t6LDfYJY008343 for ; Tue, 21 Jul 2015 13:41:34 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t6LDfXl5008075 for svn-soc-all@FreeBSD.org; Tue, 21 Jul 2015 13:41:33 GMT (envelope-from stefano@FreeBSD.org) Date: Tue, 21 Jul 2015 13:41:33 GMT Message-Id: <201507211341.t6LDfXl5008075@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r288610 - soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2015 13:41:34 -0000 Author: stefano Date: Tue Jul 21 13:41:33 2015 New Revision: 288610 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=288610 Log: vmm_mem: removed unused functions Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.c soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.h Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.c Tue Jul 21 12:53:47 2015 (r288609) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.c Tue Jul 21 13:41:33 2015 (r288610) @@ -55,57 +55,6 @@ return (0); } -static vm_object_t -vmm_mmio_alloc_sg(struct vmspace *vmspace, vm_paddr_t gpa, size_t len, - struct sglist *sg) -{ - int error; - vm_object_t obj; - - obj = vm_pager_allocate(OBJT_SG, sg, len, VM_PROT_RW, 0, NULL); - if (obj != NULL) { - error = vm_map_find(&vmspace->vm_map, obj, 0, &gpa, len, 0, - VMFS_NO_SPACE, VM_PROT_RW, VM_PROT_RW, 0); - if (error != KERN_SUCCESS) { - vm_object_deallocate(obj); - obj = NULL; - } - } - - return (obj); -} - -#define VMM_MEM_USER_NSEGS 100000 /* XXX-stefano: find a correct nsegs */ - -vm_object_t -vmm_mmio_alloc_user(struct vmspace *vmspace, vm_paddr_t gpa, size_t len, - void *buf, struct thread *td) -{ - int error; - vm_object_t obj; - struct sglist *sg; - - sg = sglist_alloc(VMM_MEM_USER_NSEGS, M_WAITOK); - error = sglist_append_user(sg, buf, len, td); - KASSERT(error == 0, ("error %d appending user-space buffer to sglist", error)); - - obj = vmm_mmio_alloc_sg(vmspace, gpa, len, sg); - /* - * Drop the reference on the sglist. - * - * If the scatter/gather object was successfully allocated then it - * has incremented the reference count on the sglist. Dropping the - * initial reference count ensures that the sglist will be freed - * when the object is deallocated. - * - * If the object could not be allocated then we end up freeing the - * sglist. - */ - sglist_free(sg); - - return (obj); -} - vm_object_t vmm_mmio_alloc(struct vmspace *vmspace, vm_paddr_t gpa, size_t len, vm_paddr_t hpa) @@ -118,21 +67,30 @@ error = sglist_append_phys(sg, hpa, len); KASSERT(error == 0, ("error %d appending physaddr to sglist", error)); - obj = vmm_mmio_alloc_sg(vmspace, gpa, len, sg); - /* - * VT-x ignores the MTRR settings when figuring out the - * memory type for translations obtained through EPT. - * - * Therefore we explicitly force the pages provided by - * this object to be mapped as uncacheable. - */ - VM_OBJECT_WLOCK(obj); - error = vm_object_set_memattr(obj, VM_MEMATTR_UNCACHEABLE); - VM_OBJECT_WUNLOCK(obj); - if (error != KERN_SUCCESS) { - panic("vmm_mmio_alloc: vm_object_set_memattr error %d", + obj = vm_pager_allocate(OBJT_SG, sg, len, VM_PROT_RW, 0, NULL); + if (obj != NULL) { + /* + * VT-x ignores the MTRR settings when figuring out the + * memory type for translations obtained through EPT. + * + * Therefore we explicitly force the pages provided by + * this object to be mapped as uncacheable. + */ + VM_OBJECT_WLOCK(obj); + error = vm_object_set_memattr(obj, VM_MEMATTR_UNCACHEABLE); + VM_OBJECT_WUNLOCK(obj); + if (error != KERN_SUCCESS) { + panic("vmm_mmio_alloc: vm_object_set_memattr error %d", error); + } + error = vm_map_find(&vmspace->vm_map, obj, 0, &gpa, len, 0, + VMFS_NO_SPACE, VM_PROT_RW, VM_PROT_RW, 0); + if (error != KERN_SUCCESS) { + vm_object_deallocate(obj); + obj = NULL; + } } + /* * Drop the reference on the sglist. * Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.h Tue Jul 21 12:53:47 2015 (r288609) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_mem.h Tue Jul 21 13:41:33 2015 (r288610) @@ -36,8 +36,6 @@ struct vm_object *vmm_mem_alloc(struct vmspace *, vm_paddr_t gpa, size_t size); struct vm_object *vmm_mmio_alloc(struct vmspace *, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); -struct vm_object *vmm_mmio_alloc_user(struct vmspace *, vm_paddr_t gpa, - size_t len, void *buf, struct thread *td); void vmm_mem_free(struct vmspace *, vm_paddr_t gpa, size_t size); void vmm_mmio_free(struct vmspace *, vm_paddr_t gpa, size_t size); vm_paddr_t vmm_mem_maxaddr(void);