Module Name: src Committed By: martin Date: Sat Feb 3 11:15:12 UTC 2024
Modified Files: src/sys/external/bsd/drm2/dist/drm/i915/gem [netbsd-10]: i915_gem_mman.c i915_gem_pages.c i915_gem_phys.c i915_gem_region.c i915_gem_stolen.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #559): sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c: revision 1.6 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c: revision 1.7 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.c: revision 1.7 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c: revision 1.9 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.22 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c: revision 1.5 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c: revision 1.6 i915_gem_region: Reduce diff from upstream a little. No functional change intended. Prompted by upcoming nearby changes related to PR kern/57833. i915_gem: Avoid walking off end of sg_pgs. sg_npgs currently fails to match obj->base.size/PAGE_SIZE only due to bugs in the construction of sg_pgs in various i915 gem object types, which we should also fix, but let's avoid compounding it here. Related to PR kern/57833. i915_gem: Assert page array size. Let's detect the bug of sg_npgs failing to match obj->base.size/PAGE_SIZE earlier. Related to PR kern/57833. i915_gem_phys: Fill sg_pgs. This is needed by i915 gem fault, which maps user virtual addresses to those pages, and by i915 gem object destruction, which does pmap_page_protect on the pages to remove any of those user virtual mappings. This needs pmap_kenter_pa rather than pmap_enter(pmap_kernel(), ...) in order to preserve the _kernel's_ mapping of the pages after pmap_page_protect. But bus_dmamem_map currently uses pmap_enter(pmap_kernel(), ...) instead which creates a mapping that is removed by pmap_page_protect. So we use a variant of bus_dmamem_map that uses pmap_kenter_pa instead. Perhaps bus_dmamem_map should do this itself, but this change is less risky to pull up than a change to bus_dmamem_map itself. PR kern/57833: kernel panic on xorg exit i915_gem_region: Fill sg_pgs, with size/PAGE_SIZE entries. Use sg_alloc_table_from_bus_dmamem to do this. i915_gem_mman.c vm_fault_cpu and i915_gem_object_release_mmap_offset both rely on sg_pgs to be a page array, so using something else like size >> ilog2(mem->mm.chunk_size) entries doesn't work. And they rely on the sg_pgs entries to be initialized, which we weren't doing before, and which sg_alloc_table_from_bus_dmamem does for us. Related to PR kern/57833. i915_gem_stolen: Fix memory leak. Found while trying to address the PR 57833 class of problems. i915_gem_stolen: Fill sg_pgs, with size/PAGE_SIZE entries. Use sg_alloc_table_from_bus_dmamem to do this. i915_gem_mman.c vm_fault_cpu and i915_gem_object_release_mmap_offset both rely on sg_pgs to be a page array, so providing a table with only one entry doesn't work (except by accident, if the object is page-sized anyway). And they rely on the sg_pgs entries to be initialized, which we weren't doing before, and which sg_alloc_table_from_bus_dmamem does for us. Related to PR kern/57833. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.21.4.1 \ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c cvs rdiff -u -r1.6 -r1.6.4.1 \ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.c cvs rdiff -u -r1.8 -r1.8.4.1 \ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c cvs rdiff -u -r1.4 -r1.4.4.1 \ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c cvs rdiff -u -r1.5 -r1.5.4.1 \ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.