Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Aug 2014 17:46:00 +0000 (UTC)
From:      Roger Pau Monné <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r269634 - in head/sys/dev/drm2: i915 ttm
Message-ID:  <53e269d8.5f11.5b973b7c@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: royger
Date: Wed Aug  6 17:45:59 2014
New Revision: 269634
URL: http://svnweb.freebsd.org/changeset/base/269634

Log:
  drm: fix usage of vm_phys_fictitious_to_vm_page
  
  vm_phys_fictitious_to_vm_page should not be called directly, even when
  operating on a range that has been registered using
  vm_phys_fictitious_reg_range. PHYS_TO_VM_PAGE should be used instead
  because on arches that use VM_PHYSSEG_DENSE the page might come
  directly from vm_page_array.
  
  Reported by: nwhitehorn
  Tested by: nwhitehorn, David Mackay <davidm.jx8p@gmail.com>
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/dev/drm2/i915/i915_gem.c
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/i915/i915_gem.c
==============================================================================
--- head/sys/dev/drm2/i915/i915_gem.c	Wed Aug  6 17:40:11 2014	(r269633)
+++ head/sys/dev/drm2/i915/i915_gem.c	Wed Aug  6 17:45:59 2014	(r269634)
@@ -1428,8 +1428,10 @@ retry:
 
 	obj->fault_mappable = true;
 	VM_OBJECT_WLOCK(vm_obj);
-	m = vm_phys_fictitious_to_vm_page(dev->agp->base + obj->gtt_offset +
-	    offset);
+	m = PHYS_TO_VM_PAGE(dev->agp->base + obj->gtt_offset + offset);
+	KASSERT((m->flags & PG_FICTITIOUS) != 0,
+	    ("physical address %#jx not fictitious",
+	    (uintmax_t)(dev->agp->base + obj->gtt_offset + offset)));
 	if (m == NULL) {
 		VM_OBJECT_WUNLOCK(vm_obj);
 		cause = 60;

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c	Wed Aug  6 17:40:11 2014	(r269633)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c	Wed Aug  6 17:45:59 2014	(r269634)
@@ -216,8 +216,12 @@ reserve:
 	}
 
 	if (bo->mem.bus.is_iomem) {
-		m = vm_phys_fictitious_to_vm_page(bo->mem.bus.base +
-		    bo->mem.bus.offset + offset);
+		m = PHYS_TO_VM_PAGE(bo->mem.bus.base + bo->mem.bus.offset +
+		    offset);
+		KASSERT((m->flags & PG_FICTITIOUS) != 0,
+		    ("physical address %#jx not fictitious",
+		    (uintmax_t)(bo->mem.bus.base + bo->mem.bus.offset
+		    + offset)));
 		pmap_page_set_memattr(m, ttm_io_prot(bo->mem.placement));
 	} else {
 		ttm = bo->ttm;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e269d8.5f11.5b973b7c>