Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 2015 13:41:33 GMT
From:      stefano@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r288610 - soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm
Message-ID:  <201507211341.t6LDfXl5008075@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507211341.t6LDfXl5008075>