MFC r269634:

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
This commit is contained in:
tijl 2014-12-02 14:21:06 +00:00
parent 5bc138563e
commit f3fce3afbd
2 changed files with 10 additions and 4 deletions

View File

@ -1429,8 +1429,10 @@ i915_gem_pager_fault(vm_object_t vm_obj, vm_ooffset_t offset, int prot,
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;

View File

@ -216,8 +216,12 @@ ttm_bo_vm_fault(vm_object_t vm_obj, vm_ooffset_t offset,
}
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;