Re: [CI 3/3] drm/i915/gtt: Free unused lower-level page tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 12, 2016 at 06:47:38PM +0200, Michał Winiarski wrote:
> +static bool gen8_ppgtt_clear_pd(struct i915_address_space *vm,
>  				struct i915_page_directory *pd,
>  				uint64_t start,
>  				uint64_t length)
>  {
> +	struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
>  	struct i915_page_table *pt;
>  	uint64_t pde;
> +	gen8_pde_t *pde_vaddr;
> +	gen8_pde_t scratch_pde = gen8_pde_encode(px_dma(vm->scratch_pt),
> +						 I915_CACHE_LLC);
> +	bool reduce;
>  
>  	gen8_for_each_pde(pt, pd, start, length, pde) {
>  		if (WARN_ON(!pd->page_table[pde]))
>  			break;
>  
> -		gen8_ppgtt_clear_pt(vm, pt, start, length);
> +		reduce = gen8_ppgtt_clear_pt(vm, pt, start, length);
> +
> +		if (reduce) {
> +			__clear_bit(pde, pd->used_pdes);
> +			pde_vaddr = kmap_px(pd);
> +			pde_vaddr[pde] = scratch_pde;
> +			kunmap_px(ppgtt, pde_vaddr);

On !48b (bsw), the pd is only partially set up, it is not backed by a
page, but i915_page_dir_dma_addr() converts the empty bit into the
scratch address instead.
Obnoxiously this requires another if (USES_FULL_48BIT_PPGTT(0)) {}
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux