Commit Graph

2 Commits

  • feat(pool): return a viewed grant's pages once the kernel reports no mapping is left
    A client's view of a pool BO is a physical-range descriptor; a task can
    copy its mapping in the VM, and the copy refers to the device pager's VM
    object, not to the descriptor, so the view's free did not mean the pages
    were unmapped and every viewed grant was retired for good (run68: 77
    grants, 25524 KiB).
    
    Where the kernel has iokit_physical_descriptor_close_notify (XNU patch
    gpupool-device-pager-close), a view registers the grant with it before
    anything can map the view, and its reference to the grant goes only when
    the kernel reports the pager's close: IOKit has released the descriptor
    and the VM has reported the object's last unmap, which it does only once
    no map entry, memory entry or copy object refers to it. The pages then
    return to the pool, marked for the cache pass before their next zero
    fill. A view the kernel cannot track (the symbol is weak; kernels
    without the patch) retires its grant as before, and gpu-pool=2 still
    recycles those too. native_adreno_pool_views counts both kinds, the
    reports and the grants given back.
    
    Not run on hardware.
  • feat(memory): take write-combined system BOs from a pool of DRAM outside the kernel's
    The board registers free DRAM the kernel does not manage with native_adreno_pool_add. A write-combined system BO first asks the pool (NativeAdrenoPool.cpp: a bitmap a range, best single run, else the longest runs first, zero fill through the range's own write-combined kernel mapping before a grant is handed out); whatever the pool does not serve takes the descriptor path unchanged. A pool BO has a grant and no descriptor: its spans are the grant's runs, nothing of it is cleaned, audited or read through the cacheable aperture, its client view maps its physical runs write-combined and holds the grant until IOKit frees the view, and an import of pool pages is refused. Pages a client had a view of are retired unless gpu-pool=2; gpu-pool=0 turns the pool off. Counters: native_adreno_pool_state, native_adreno_pool_fallbacks, native_adreno_pool_zero.
    
    Host tests: test_pool (allocator against a page model) and test_pool_memory (BO paths); the existing 23 pass as before, test_client and test_gmuconfig fail as at the base. Every changed kernel source passes the kernel's compile recipe as a syntax check. Not built into an image and not run on hardware.