Lines Matching refs:ppgtt

135 i915_ppgtt_page_alloc(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt,
147 DDI_DMA_DONTWAIT, NULL, &ppgtt->dma_hdl)) {
152 if (ddi_dma_mem_alloc(ppgtt->dma_hdl, ptob(pgcnt), &ppgt_acc_attr,
154 &ppgtt->kaddr, &ppgtt->real_size, &ppgtt->acc_hdl)) {
159 if (ddi_dma_addr_bind_handle(ppgtt->dma_hdl, NULL,
160 ppgtt->kaddr, ppgtt->real_size, DDI_DMA_RDWR,
168 real_pgcnt = btopr(ppgtt->real_size);
170 ppgtt->pt_pages = kmem_zalloc(real_pgcnt * sizeof (pfn_t), KM_NOSLEEP);
171 if (ppgtt->pt_pages == NULL) {
181 ppgtt->pt_pages[n++] = btop(paddr);
187 ddi_dma_nextcookie(ppgtt->dma_hdl, &cookie);
191 (void) ddi_dma_unbind_handle(ppgtt->dma_hdl);
193 ddi_dma_mem_free(&ppgtt->acc_hdl);
195 ddi_dma_free_handle(&ppgtt->dma_hdl);
201 static void gen6_write_pdes(struct i915_hw_ppgtt *ppgtt)
203 struct drm_i915_private *dev_priv = ppgtt->dev->dev_private;
209 WARN_ON(ppgtt->pd_offset & 0x3f);
210 for (i = 0; i < ppgtt->num_pd_entries; i++) {
212 + ppgtt->pd_offset + i * sizeof(gtt_pte_t));
215 pt_addr = ppgtt->pt_pages[i] << PAGE_SHIFT;
224 (gen6_gtt_pte_t *)(uintptr_t)((caddr_t)dev_priv->gtt.virtual_gtt + ppgtt->pd_offset));
232 struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
235 BUG_ON(ppgtt->pd_offset & 0x3f);
237 gen6_write_pdes(ppgtt);
239 pd_offset = ppgtt->pd_offset;
286 static void gen6_ppgtt_clear_range(struct i915_hw_ppgtt *ppgtt,
295 scratch_pte = ppgtt->pte_encode(ppgtt->dev,
296 ppgtt->scratch_page_paddr,
304 pt_vaddr = (uint32_t*)(uintptr_t)(ppgtt->kaddr + act_pt*PAGE_SIZE);
315 static void gen6_ppgtt_insert_entries(struct i915_hw_ppgtt *ppgtt,
324 pt_vaddr = (gen6_gtt_pte_t *)(uintptr_t)(ppgtt->kaddr + act_pt*PAGE_SIZE);
327 pt_vaddr[act_pte] = ppgtt->pte_encode(ppgtt->dev, pages[j] << PAGE_SHIFT,
331 pt_vaddr = (gen6_gtt_pte_t *)(uintptr_t)(ppgtt->kaddr + act_pt*PAGE_SIZE);
338 static void gen6_ppgtt_cleanup(struct i915_hw_ppgtt *ppgtt)
340 kmem_free(ppgtt->pt_pages, btopr(ppgtt->real_size) * sizeof (pfn_t));
342 (void) ddi_dma_unbind_handle(ppgtt->dma_hdl);
343 ddi_dma_mem_free(&ppgtt->acc_hdl);
344 ddi_dma_free_handle(&ppgtt->dma_hdl);
345 kfree(ppgtt, sizeof(*ppgtt));
348 static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
350 struct drm_device *dev = ppgtt->dev;
355 /* ppgtt PDEs reside in the global gtt pagetable, which has 512*1024
356 * entries. For aliasing ppgtt support we just steal them at the end for
361 ppgtt->pte_encode = hsw_pte_encode;
363 ppgtt->pte_encode = byt_pte_encode;
365 ppgtt->pte_encode = gen6_pte_encode;
367 ppgtt->num_pd_entries = I915_PPGTT_PD_ENTRIES;
368 ppgtt->enable = gen6_ppgtt_enable;
369 ppgtt->clear_range = gen6_ppgtt_clear_range;
370 ppgtt->insert_entries = gen6_ppgtt_insert_entries;
371 ppgtt->cleanup = gen6_ppgtt_cleanup;
372 ret = i915_ppgtt_page_alloc(dev, ppgtt, ppgtt->num_pd_entries);
376 ppgtt->clear_range(ppgtt, 0,
377 ppgtt->num_pd_entries*I915_PPGTT_PT_ENTRIES);
379 ppgtt->pd_offset = first_pd_entry_in_global_pt * sizeof(gen6_gtt_pte_t);
388 struct i915_hw_ppgtt *ppgtt;
391 ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
392 if (!ppgtt)
395 ppgtt->dev = dev;
396 ppgtt->scratch_page_paddr = ptob(dev_priv->gtt.scratch_page->pfnarray[0]);
399 ret = gen6_ppgtt_init(ppgtt);
402 DRM_ERROR("ppgtt is not supported");
406 kfree(ppgtt, sizeof(*ppgtt));
408 dev_priv->mm.aliasing_ppgtt = ppgtt;
416 struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
418 if (!ppgtt)
421 ppgtt->cleanup(ppgtt);
425 void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt,
430 ppgtt->insert_entries(ppgtt,
437 void i915_ppgtt_unbind_object(struct i915_hw_ppgtt *ppgtt,
440 ppgtt->clear_range(ppgtt,
675 /* Disable ppgtt on SNB if VT-d is on. */
694 * aperture accordingly when using aliasing ppgtt. */
978 /* ensure that ppgtt is disabled */