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.j...@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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to