10260c420SBen Widawsky /*
20260c420SBen Widawsky  * Copyright © 2014 Intel Corporation
30260c420SBen Widawsky  *
40260c420SBen Widawsky  * Permission is hereby granted, free of charge, to any person obtaining a
50260c420SBen Widawsky  * copy of this software and associated documentation files (the "Software"),
60260c420SBen Widawsky  * to deal in the Software without restriction, including without limitation
70260c420SBen Widawsky  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
80260c420SBen Widawsky  * and/or sell copies of the Software, and to permit persons to whom the
90260c420SBen Widawsky  * Software is furnished to do so, subject to the following conditions:
100260c420SBen Widawsky  *
110260c420SBen Widawsky  * The above copyright notice and this permission notice (including the next
120260c420SBen Widawsky  * paragraph) shall be included in all copies or substantial portions of the
130260c420SBen Widawsky  * Software.
140260c420SBen Widawsky  *
150260c420SBen Widawsky  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
160260c420SBen Widawsky  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
170260c420SBen Widawsky  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
180260c420SBen Widawsky  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
190260c420SBen Widawsky  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
200260c420SBen Widawsky  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
210260c420SBen Widawsky  * IN THE SOFTWARE.
220260c420SBen Widawsky  *
230260c420SBen Widawsky  * Please try to maintain the following order within this file unless it makes
240260c420SBen Widawsky  * sense to do otherwise. From top to bottom:
250260c420SBen Widawsky  * 1. typedefs
260260c420SBen Widawsky  * 2. #defines, and macros
270260c420SBen Widawsky  * 3. structure definitions
280260c420SBen Widawsky  * 4. function prototypes
290260c420SBen Widawsky  *
300260c420SBen Widawsky  * Within each section, please try to order by generation in ascending order,
310260c420SBen Widawsky  * from top to bottom (ie. gen6 on the top, gen8 on the bottom).
320260c420SBen Widawsky  */
330260c420SBen Widawsky 
340260c420SBen Widawsky #ifndef __I915_GEM_GTT_H__
350260c420SBen Widawsky #define __I915_GEM_GTT_H__
360260c420SBen Widawsky 
374d884705SDaniel Vetter struct drm_i915_file_private;
384d884705SDaniel Vetter 
390260c420SBen Widawsky typedef uint32_t gen6_gtt_pte_t;
400260c420SBen Widawsky typedef uint64_t gen8_gtt_pte_t;
410260c420SBen Widawsky typedef gen8_gtt_pte_t gen8_ppgtt_pde_t;
420260c420SBen Widawsky 
430260c420SBen Widawsky #define gtt_total_entries(gtt) ((gtt).base.total >> PAGE_SHIFT)
440260c420SBen Widawsky 
450260c420SBen Widawsky #define I915_PPGTT_PT_ENTRIES		(PAGE_SIZE / sizeof(gen6_gtt_pte_t))
460260c420SBen Widawsky /* gen6-hsw has bit 11-4 for physical addr bit 39-32 */
470260c420SBen Widawsky #define GEN6_GTT_ADDR_ENCODE(addr)	((addr) | (((addr) >> 28) & 0xff0))
480260c420SBen Widawsky #define GEN6_PTE_ADDR_ENCODE(addr)	GEN6_GTT_ADDR_ENCODE(addr)
490260c420SBen Widawsky #define GEN6_PDE_ADDR_ENCODE(addr)	GEN6_GTT_ADDR_ENCODE(addr)
500260c420SBen Widawsky #define GEN6_PTE_CACHE_LLC		(2 << 1)
510260c420SBen Widawsky #define GEN6_PTE_UNCACHED		(1 << 1)
520260c420SBen Widawsky #define GEN6_PTE_VALID			(1 << 0)
530260c420SBen Widawsky 
540260c420SBen Widawsky #define GEN6_PPGTT_PD_ENTRIES		512
550260c420SBen Widawsky #define GEN6_PD_SIZE			(GEN6_PPGTT_PD_ENTRIES * PAGE_SIZE)
560260c420SBen Widawsky #define GEN6_PD_ALIGN			(PAGE_SIZE * 16)
570260c420SBen Widawsky #define GEN6_PDE_VALID			(1 << 0)
580260c420SBen Widawsky 
590260c420SBen Widawsky #define GEN7_PTE_CACHE_L3_LLC		(3 << 1)
600260c420SBen Widawsky 
610260c420SBen Widawsky #define BYT_PTE_SNOOPED_BY_CPU_CACHES	(1 << 2)
620260c420SBen Widawsky #define BYT_PTE_WRITEABLE		(1 << 1)
630260c420SBen Widawsky 
640260c420SBen Widawsky /* Cacheability Control is a 4-bit value. The low three bits are stored in bits
650260c420SBen Widawsky  * 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
660260c420SBen Widawsky  */
670260c420SBen Widawsky #define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
680260c420SBen Widawsky 					 (((bits) & 0x8) << (11 - 3)))
690260c420SBen Widawsky #define HSW_WB_LLC_AGE3			HSW_CACHEABILITY_CONTROL(0x2)
700260c420SBen Widawsky #define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)
710260c420SBen Widawsky #define HSW_WB_ELLC_LLC_AGE3		HSW_CACHEABILITY_CONTROL(0x8)
720260c420SBen Widawsky #define HSW_WB_ELLC_LLC_AGE0		HSW_CACHEABILITY_CONTROL(0xb)
730260c420SBen Widawsky #define HSW_WT_ELLC_LLC_AGE3		HSW_CACHEABILITY_CONTROL(0x7)
740260c420SBen Widawsky #define HSW_WT_ELLC_LLC_AGE0		HSW_CACHEABILITY_CONTROL(0x6)
750260c420SBen Widawsky #define HSW_PTE_UNCACHED		(0)
760260c420SBen Widawsky #define HSW_GTT_ADDR_ENCODE(addr)	((addr) | (((addr) >> 28) & 0x7f0))
770260c420SBen Widawsky #define HSW_PTE_ADDR_ENCODE(addr)	HSW_GTT_ADDR_ENCODE(addr)
780260c420SBen Widawsky 
790260c420SBen Widawsky /* GEN8 legacy style address is defined as a 3 level page table:
800260c420SBen Widawsky  * 31:30 | 29:21 | 20:12 |  11:0
810260c420SBen Widawsky  * PDPE  |  PDE  |  PTE  | offset
820260c420SBen Widawsky  * The difference as compared to normal x86 3 level page table is the PDPEs are
830260c420SBen Widawsky  * programmed via register.
840260c420SBen Widawsky  */
850260c420SBen Widawsky #define GEN8_PDPE_SHIFT			30
860260c420SBen Widawsky #define GEN8_PDPE_MASK			0x3
870260c420SBen Widawsky #define GEN8_PDE_SHIFT			21
880260c420SBen Widawsky #define GEN8_PDE_MASK			0x1ff
890260c420SBen Widawsky #define GEN8_PTE_SHIFT			12
900260c420SBen Widawsky #define GEN8_PTE_MASK			0x1ff
9176643600SBen Widawsky #define GEN8_LEGACY_PDPES		4
920260c420SBen Widawsky #define GEN8_PTES_PER_PAGE		(PAGE_SIZE / sizeof(gen8_gtt_pte_t))
930260c420SBen Widawsky #define GEN8_PDES_PER_PAGE		(PAGE_SIZE / sizeof(gen8_ppgtt_pde_t))
940260c420SBen Widawsky 
950260c420SBen Widawsky #define PPAT_UNCACHED_INDEX		(_PAGE_PWT | _PAGE_PCD)
960260c420SBen Widawsky #define PPAT_CACHED_PDE_INDEX		0 /* WB LLC */
970260c420SBen Widawsky #define PPAT_CACHED_INDEX		_PAGE_PAT /* WB LLCeLLC */
980260c420SBen Widawsky #define PPAT_DISPLAY_ELLC_INDEX		_PAGE_PCD /* WT eLLC */
990260c420SBen Widawsky 
100ee0ce478SVille Syrjälä #define CHV_PPAT_SNOOP			(1<<6)
1010260c420SBen Widawsky #define GEN8_PPAT_AGE(x)		(x<<4)
1020260c420SBen Widawsky #define GEN8_PPAT_LLCeLLC		(3<<2)
1030260c420SBen Widawsky #define GEN8_PPAT_LLCELLC		(2<<2)
1040260c420SBen Widawsky #define GEN8_PPAT_LLC			(1<<2)
1050260c420SBen Widawsky #define GEN8_PPAT_WB			(3<<0)
1060260c420SBen Widawsky #define GEN8_PPAT_WT			(2<<0)
1070260c420SBen Widawsky #define GEN8_PPAT_WC			(1<<0)
1080260c420SBen Widawsky #define GEN8_PPAT_UC			(0<<0)
1090260c420SBen Widawsky #define GEN8_PPAT_ELLC_OVERRIDE		(0<<2)
1100260c420SBen Widawsky #define GEN8_PPAT(i, x)			((uint64_t) (x) << ((i) * 8))
1110260c420SBen Widawsky 
112fe14d5f4STvrtko Ursulin enum i915_ggtt_view_type {
113fe14d5f4STvrtko Ursulin 	I915_GGTT_VIEW_NORMAL = 0,
114fe14d5f4STvrtko Ursulin };
115fe14d5f4STvrtko Ursulin 
116fe14d5f4STvrtko Ursulin struct i915_ggtt_view {
117fe14d5f4STvrtko Ursulin 	enum i915_ggtt_view_type type;
118fe14d5f4STvrtko Ursulin 
119fe14d5f4STvrtko Ursulin 	struct sg_table *pages;
120fe14d5f4STvrtko Ursulin };
121fe14d5f4STvrtko Ursulin 
122fe14d5f4STvrtko Ursulin extern const struct i915_ggtt_view i915_ggtt_view_normal;
123fe14d5f4STvrtko Ursulin 
1240260c420SBen Widawsky enum i915_cache_level;
125fe14d5f4STvrtko Ursulin 
1260260c420SBen Widawsky /**
1270260c420SBen Widawsky  * A VMA represents a GEM BO that is bound into an address space. Therefore, a
1280260c420SBen Widawsky  * VMA's presence cannot be guaranteed before binding, or after unbinding the
1290260c420SBen Widawsky  * object into/from the address space.
1300260c420SBen Widawsky  *
1310260c420SBen Widawsky  * To make things as simple as possible (ie. no refcounting), a VMA's lifetime
1320260c420SBen Widawsky  * will always be <= an objects lifetime. So object refcounting should cover us.
1330260c420SBen Widawsky  */
1340260c420SBen Widawsky struct i915_vma {
1350260c420SBen Widawsky 	struct drm_mm_node node;
1360260c420SBen Widawsky 	struct drm_i915_gem_object *obj;
1370260c420SBen Widawsky 	struct i915_address_space *vm;
1380260c420SBen Widawsky 
139aff43766STvrtko Ursulin 	/** Flags and address space this VMA is bound to */
140aff43766STvrtko Ursulin #define GLOBAL_BIND	(1<<0)
141aff43766STvrtko Ursulin #define LOCAL_BIND	(1<<1)
142aff43766STvrtko Ursulin #define PTE_READ_ONLY	(1<<2)
143aff43766STvrtko Ursulin 	unsigned int bound : 4;
144aff43766STvrtko Ursulin 
145fe14d5f4STvrtko Ursulin 	/**
146fe14d5f4STvrtko Ursulin 	 * Support different GGTT views into the same object.
147fe14d5f4STvrtko Ursulin 	 * This means there can be multiple VMA mappings per object and per VM.
148fe14d5f4STvrtko Ursulin 	 * i915_ggtt_view_type is used to distinguish between those entries.
149fe14d5f4STvrtko Ursulin 	 * The default one of zero (I915_GGTT_VIEW_NORMAL) is default and also
150fe14d5f4STvrtko Ursulin 	 * assumed in GEM functions which take no ggtt view parameter.
151fe14d5f4STvrtko Ursulin 	 */
152fe14d5f4STvrtko Ursulin 	struct i915_ggtt_view ggtt_view;
153fe14d5f4STvrtko Ursulin 
1540260c420SBen Widawsky 	/** This object's place on the active/inactive lists */
1550260c420SBen Widawsky 	struct list_head mm_list;
1560260c420SBen Widawsky 
1570260c420SBen Widawsky 	struct list_head vma_link; /* Link in the object's VMA list */
1580260c420SBen Widawsky 
1590260c420SBen Widawsky 	/** This vma's place in the batchbuffer or on the eviction list */
1600260c420SBen Widawsky 	struct list_head exec_list;
1610260c420SBen Widawsky 
1620260c420SBen Widawsky 	/**
1630260c420SBen Widawsky 	 * Used for performing relocations during execbuffer insertion.
1640260c420SBen Widawsky 	 */
1650260c420SBen Widawsky 	struct hlist_node exec_node;
1660260c420SBen Widawsky 	unsigned long exec_handle;
1670260c420SBen Widawsky 	struct drm_i915_gem_exec_object2 *exec_entry;
1680260c420SBen Widawsky 
1690260c420SBen Widawsky 	/**
1700260c420SBen Widawsky 	 * How many users have pinned this object in GTT space. The following
1714feb7659SDaniel Vetter 	 * users can each hold at most one reference: pwrite/pread, execbuffer
1724feb7659SDaniel Vetter 	 * (objects are not allowed multiple times for the same batchbuffer),
1734feb7659SDaniel Vetter 	 * and the framebuffer code. When switching/pageflipping, the
1744feb7659SDaniel Vetter 	 * framebuffer code has at most two buffers pinned per crtc.
1750260c420SBen Widawsky 	 *
1760260c420SBen Widawsky 	 * In the worst case this is 1 + 1 + 1 + 2*2 = 7. That would fit into 3
1770260c420SBen Widawsky 	 * bits with absolutely no headroom. So use 4 bits. */
1780260c420SBen Widawsky 	unsigned int pin_count:4;
1790260c420SBen Widawsky #define DRM_I915_GEM_OBJECT_MAX_PIN_COUNT 0xf
1800260c420SBen Widawsky 
1810260c420SBen Widawsky 	/** Unmap an object from an address space. This usually consists of
1820260c420SBen Widawsky 	 * setting the valid PTE entries to a reserved scratch page. */
1830260c420SBen Widawsky 	void (*unbind_vma)(struct i915_vma *vma);
1840260c420SBen Widawsky 	/* Map an object into an address space with the given cache flags. */
1850260c420SBen Widawsky 	void (*bind_vma)(struct i915_vma *vma,
1860260c420SBen Widawsky 			 enum i915_cache_level cache_level,
1870260c420SBen Widawsky 			 u32 flags);
1880260c420SBen Widawsky };
1890260c420SBen Widawsky 
190d7b3de91SBen Widawsky struct i915_page_table_entry {
191d7b3de91SBen Widawsky 	struct page *page;
1927324cc04SBen Widawsky 	dma_addr_t daddr;
193d7b3de91SBen Widawsky };
194d7b3de91SBen Widawsky 
195d7b3de91SBen Widawsky struct i915_page_directory_entry {
196d7b3de91SBen Widawsky 	struct page *page; /* NULL for GEN6-GEN7 */
1977324cc04SBen Widawsky 	union {
1987324cc04SBen Widawsky 		uint32_t pd_offset;
1997324cc04SBen Widawsky 		dma_addr_t daddr;
2007324cc04SBen Widawsky 	};
2017324cc04SBen Widawsky 
20206fda602SBen Widawsky 	struct i915_page_table_entry *page_table[GEN6_PPGTT_PD_ENTRIES]; /* PDEs */
203d7b3de91SBen Widawsky };
204d7b3de91SBen Widawsky 
205d7b3de91SBen Widawsky struct i915_page_directory_pointer_entry {
206d7b3de91SBen Widawsky 	/* struct page *page; */
20706fda602SBen Widawsky 	struct i915_page_directory_entry *page_directory[GEN8_LEGACY_PDPES];
208d7b3de91SBen Widawsky };
209d7b3de91SBen Widawsky 
2100260c420SBen Widawsky struct i915_address_space {
2110260c420SBen Widawsky 	struct drm_mm mm;
2120260c420SBen Widawsky 	struct drm_device *dev;
2130260c420SBen Widawsky 	struct list_head global_link;
2140260c420SBen Widawsky 	unsigned long start;		/* Start offset always 0 for dri2 */
2150260c420SBen Widawsky 	size_t total;		/* size addr space maps (ex. 2GB for ggtt) */
2160260c420SBen Widawsky 
2170260c420SBen Widawsky 	struct {
2180260c420SBen Widawsky 		dma_addr_t addr;
2190260c420SBen Widawsky 		struct page *page;
2200260c420SBen Widawsky 	} scratch;
2210260c420SBen Widawsky 
2220260c420SBen Widawsky 	/**
2230260c420SBen Widawsky 	 * List of objects currently involved in rendering.
2240260c420SBen Widawsky 	 *
2250260c420SBen Widawsky 	 * Includes buffers having the contents of their GPU caches
22697b2a6a1SJohn Harrison 	 * flushed, not necessarily primitives. last_read_req
2270260c420SBen Widawsky 	 * represents when the rendering involved will be completed.
2280260c420SBen Widawsky 	 *
2290260c420SBen Widawsky 	 * A reference is held on the buffer while on this list.
2300260c420SBen Widawsky 	 */
2310260c420SBen Widawsky 	struct list_head active_list;
2320260c420SBen Widawsky 
2330260c420SBen Widawsky 	/**
2340260c420SBen Widawsky 	 * LRU list of objects which are not in the ringbuffer and
2350260c420SBen Widawsky 	 * are ready to unbind, but are still in the GTT.
2360260c420SBen Widawsky 	 *
23797b2a6a1SJohn Harrison 	 * last_read_req is NULL while an object is in this list.
2380260c420SBen Widawsky 	 *
2390260c420SBen Widawsky 	 * A reference is not held on the buffer while on this list,
2400260c420SBen Widawsky 	 * as merely being GTT-bound shouldn't prevent its being
2410260c420SBen Widawsky 	 * freed, and we'll pull it off the list in the free path.
2420260c420SBen Widawsky 	 */
2430260c420SBen Widawsky 	struct list_head inactive_list;
2440260c420SBen Widawsky 
2450260c420SBen Widawsky 	/* FIXME: Need a more generic return type */
2460260c420SBen Widawsky 	gen6_gtt_pte_t (*pte_encode)(dma_addr_t addr,
2470260c420SBen Widawsky 				     enum i915_cache_level level,
24824f3a8cfSAkash Goel 				     bool valid, u32 flags); /* Create a valid PTE */
2490260c420SBen Widawsky 	void (*clear_range)(struct i915_address_space *vm,
2500260c420SBen Widawsky 			    uint64_t start,
2510260c420SBen Widawsky 			    uint64_t length,
2520260c420SBen Widawsky 			    bool use_scratch);
2530260c420SBen Widawsky 	void (*insert_entries)(struct i915_address_space *vm,
2540260c420SBen Widawsky 			       struct sg_table *st,
2550260c420SBen Widawsky 			       uint64_t start,
25624f3a8cfSAkash Goel 			       enum i915_cache_level cache_level, u32 flags);
2570260c420SBen Widawsky 	void (*cleanup)(struct i915_address_space *vm);
2580260c420SBen Widawsky };
2590260c420SBen Widawsky 
2600260c420SBen Widawsky /* The Graphics Translation Table is the way in which GEN hardware translates a
2610260c420SBen Widawsky  * Graphics Virtual Address into a Physical Address. In addition to the normal
2620260c420SBen Widawsky  * collateral associated with any va->pa translations GEN hardware also has a
2630260c420SBen Widawsky  * portion of the GTT which can be mapped by the CPU and remain both coherent
2640260c420SBen Widawsky  * and correct (in cases like swizzling). That region is referred to as GMADR in
2650260c420SBen Widawsky  * the spec.
2660260c420SBen Widawsky  */
2670260c420SBen Widawsky struct i915_gtt {
2680260c420SBen Widawsky 	struct i915_address_space base;
2690260c420SBen Widawsky 	size_t stolen_size;		/* Total size of stolen memory */
2700260c420SBen Widawsky 
2710260c420SBen Widawsky 	unsigned long mappable_end;	/* End offset that we can CPU map */
2720260c420SBen Widawsky 	struct io_mapping *mappable;	/* Mapping to our CPU mappable region */
2730260c420SBen Widawsky 	phys_addr_t mappable_base;	/* PA of our GMADR */
2740260c420SBen Widawsky 
2750260c420SBen Widawsky 	/** "Graphics Stolen Memory" holds the global PTEs */
2760260c420SBen Widawsky 	void __iomem *gsm;
2770260c420SBen Widawsky 
2780260c420SBen Widawsky 	bool do_idle_maps;
2790260c420SBen Widawsky 
2800260c420SBen Widawsky 	int mtrr;
2810260c420SBen Widawsky 
2820260c420SBen Widawsky 	/* global gtt ops */
2830260c420SBen Widawsky 	int (*gtt_probe)(struct drm_device *dev, size_t *gtt_total,
2840260c420SBen Widawsky 			  size_t *stolen, phys_addr_t *mappable_base,
2850260c420SBen Widawsky 			  unsigned long *mappable_end);
2860260c420SBen Widawsky };
2870260c420SBen Widawsky 
2880260c420SBen Widawsky struct i915_hw_ppgtt {
2890260c420SBen Widawsky 	struct i915_address_space base;
2900260c420SBen Widawsky 	struct kref ref;
2910260c420SBen Widawsky 	struct drm_mm_node node;
2920260c420SBen Widawsky 	unsigned num_pd_entries;
2930260c420SBen Widawsky 	unsigned num_pd_pages; /* gen8+ */
2940260c420SBen Widawsky 	union {
295d7b3de91SBen Widawsky 		struct i915_page_directory_pointer_entry pdp;
296d7b3de91SBen Widawsky 		struct i915_page_directory_entry pd;
297d7b3de91SBen Widawsky 	};
2980260c420SBen Widawsky 
2994d884705SDaniel Vetter 	struct drm_i915_file_private *file_priv;
3000260c420SBen Widawsky 
3010260c420SBen Widawsky 	int (*enable)(struct i915_hw_ppgtt *ppgtt);
3020260c420SBen Widawsky 	int (*switch_mm)(struct i915_hw_ppgtt *ppgtt,
3036689c167SMcAulay, Alistair 			 struct intel_engine_cs *ring);
3040260c420SBen Widawsky 	void (*debug_dump)(struct i915_hw_ppgtt *ppgtt, struct seq_file *m);
3050260c420SBen Widawsky };
3060260c420SBen Widawsky 
3070260c420SBen Widawsky int i915_gem_gtt_init(struct drm_device *dev);
3080260c420SBen Widawsky void i915_gem_init_global_gtt(struct drm_device *dev);
30990d0a0e8SDaniel Vetter void i915_global_gtt_cleanup(struct drm_device *dev);
3100260c420SBen Widawsky 
311ee960be7SDaniel Vetter 
312ee960be7SDaniel Vetter int i915_ppgtt_init(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt);
31382460d97SDaniel Vetter int i915_ppgtt_init_hw(struct drm_device *dev);
314ee960be7SDaniel Vetter void i915_ppgtt_release(struct kref *kref);
3154d884705SDaniel Vetter struct i915_hw_ppgtt *i915_ppgtt_create(struct drm_device *dev,
3164d884705SDaniel Vetter 					struct drm_i915_file_private *fpriv);
317ee960be7SDaniel Vetter static inline void i915_ppgtt_get(struct i915_hw_ppgtt *ppgtt)
318ee960be7SDaniel Vetter {
319ee960be7SDaniel Vetter 	if (ppgtt)
320ee960be7SDaniel Vetter 		kref_get(&ppgtt->ref);
321ee960be7SDaniel Vetter }
322ee960be7SDaniel Vetter static inline void i915_ppgtt_put(struct i915_hw_ppgtt *ppgtt)
323ee960be7SDaniel Vetter {
324ee960be7SDaniel Vetter 	if (ppgtt)
325ee960be7SDaniel Vetter 		kref_put(&ppgtt->ref, i915_ppgtt_release);
326ee960be7SDaniel Vetter }
3270260c420SBen Widawsky 
3280260c420SBen Widawsky void i915_check_and_clear_faults(struct drm_device *dev);
3290260c420SBen Widawsky void i915_gem_suspend_gtt_mappings(struct drm_device *dev);
3300260c420SBen Widawsky void i915_gem_restore_gtt_mappings(struct drm_device *dev);
3310260c420SBen Widawsky 
3320260c420SBen Widawsky int __must_check i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj);
3330260c420SBen Widawsky void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj);
3340260c420SBen Widawsky 
3350260c420SBen Widawsky #endif
336