1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>gen8_ppgtt_alloc_page_directories</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux GPU Driver Developer's Guide"><link rel="up" href="ch04s03.html#id-1.4.3.5.6" title="Global GTT views"><link rel="prev" href="API-gen8-ppgtt-alloc-pagetabs.html" title="gen8_ppgtt_alloc_pagetabs"><link rel="next" href="API-gen8-ppgtt-alloc-page-dirpointers.html" title="gen8_ppgtt_alloc_page_dirpointers"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">gen8_ppgtt_alloc_page_directories</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-gen8-ppgtt-alloc-pagetabs.html">Prev</a> </td><th width="60%" align="center">Global GTT views</th><td width="20%" align="right"> <a accesskey="n" href="API-gen8-ppgtt-alloc-page-dirpointers.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-gen8-ppgtt-alloc-page-directories"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gen8_ppgtt_alloc_page_directories — 2 Allocate page directories for VA range. 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">gen8_ppgtt_alloc_page_directories </b>(</code></td><td>struct i915_address_space * <var class="pdparam">vm</var>, </td></tr><tr><td> </td><td>struct i915_page_directory_pointer * <var class="pdparam">pdp</var>, </td></tr><tr><td> </td><td>uint64_t <var class="pdparam">start</var>, </td></tr><tr><td> </td><td>uint64_t <var class="pdparam">length</var>, </td></tr><tr><td> </td><td>unsigned long * <var class="pdparam">new_pds</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.4.3.5.6.21.5"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>vm</code></em></span></dt><dd><p> 4 Master vm structure. 5 </p></dd><dt><span class="term"><em class="parameter"><code>pdp</code></em></span></dt><dd><p> 6 Page directory pointer for this address range. 7 </p></dd><dt><span class="term"><em class="parameter"><code>start</code></em></span></dt><dd><p> 8 Starting virtual address to begin allocations. 9 </p></dd><dt><span class="term"><em class="parameter"><code>length</code></em></span></dt><dd><p> 10 Size of the allocations. 11 </p></dd><dt><span class="term"><em class="parameter"><code>new_pds</code></em></span></dt><dd><p> 12 Bitmap set by function with new allocations. Likely used by the 13 caller to free on error. 14 </p></dd></dl></div></div><div class="refsect1"><a name="id-1.4.3.5.6.21.6"></a><h2>Description</h2><p> 15 Allocate the required number of page directories starting at the pde index of 16 <em class="parameter"><code>start</code></em>, and ending at the pde index <em class="parameter"><code>start</code></em> + <em class="parameter"><code>length</code></em>. This function will skip 17 over already allocated page directories within the range, and only allocate 18 new ones, setting the appropriate pointer within the pdp as well as the 19 correct position in the bitmap <em class="parameter"><code>new_pds</code></em>. 20 </p><p> 21 22 The function will only allocate the pages within the range for a give page 23 directory pointer. In other words, if <em class="parameter"><code>start</code></em> + <em class="parameter"><code>length</code></em> straddles a virtually 24 addressed PDP boundary (512GB for 4k pages), there will be more allocations 25 required by the caller, This is not currently possible, and the BUG in the 26 code will prevent it. 27</p></div><div class="refsect1"><a name="id-1.4.3.5.6.21.7"></a><h2>Return</h2><p> 28 0 if success; negative error code otherwise. 29</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-gen8-ppgtt-alloc-pagetabs.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04s03.html#id-1.4.3.5.6">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-gen8-ppgtt-alloc-page-dirpointers.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">gen8_ppgtt_alloc_pagetabs</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">gen8_ppgtt_alloc_page_dirpointers</span></td></tr></table></div></body></html> 30