12c86e55dSMatthew Auld /* SPDX-License-Identifier: MIT */ 20260c420SBen Widawsky /* 32c86e55dSMatthew Auld * Copyright © 2020 Intel Corporation 40260c420SBen Widawsky */ 50260c420SBen Widawsky 60260c420SBen Widawsky #ifndef __I915_GEM_GTT_H__ 70260c420SBen Widawsky #define __I915_GEM_GTT_H__ 80260c420SBen Widawsky 98ef8561fSChris Wilson #include <linux/io-mapping.h> 102c86e55dSMatthew Auld #include <linux/types.h> 11b32fa811SChris Wilson 12b32fa811SChris Wilson #include <drm/drm_mm.h> 138ef8561fSChris Wilson 142c86e55dSMatthew Auld #include "gt/intel_gtt.h" 1537d63f8fSChris Wilson #include "i915_scatterlist.h" 16b0decaf7SChris Wilson 175e5d2e20SChris Wilson struct drm_i915_gem_object; 182c86e55dSMatthew Auld struct i915_address_space; 197e00897bSMaarten Lankhorst struct i915_gem_ww_ctx; 200260c420SBen Widawsky 21*0cfee2d7SJani Nikula #define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */ 22*0cfee2d7SJani Nikula 2303ac84f1SChris Wilson int __must_check i915_gem_gtt_prepare_pages(struct drm_i915_gem_object *obj, 2403ac84f1SChris Wilson struct sg_table *pages); 2503ac84f1SChris Wilson void i915_gem_gtt_finish_pages(struct drm_i915_gem_object *obj, 2603ac84f1SChris Wilson struct sg_table *pages); 270260c420SBen Widawsky 28625d988aSChris Wilson int i915_gem_gtt_reserve(struct i915_address_space *vm, 297e00897bSMaarten Lankhorst struct i915_gem_ww_ctx *ww, 30625d988aSChris Wilson struct drm_mm_node *node, 31625d988aSChris Wilson u64 size, u64 offset, unsigned long color, 32625d988aSChris Wilson unsigned int flags); 33625d988aSChris Wilson 34e007b19dSChris Wilson int i915_gem_gtt_insert(struct i915_address_space *vm, 357e00897bSMaarten Lankhorst struct i915_gem_ww_ctx *ww, 36e007b19dSChris Wilson struct drm_mm_node *node, 37e007b19dSChris Wilson u64 size, u64 alignment, unsigned long color, 38e007b19dSChris Wilson u64 start, u64 end, unsigned int flags); 39e007b19dSChris Wilson 4059bfa124SChris Wilson /* Flags used by pin/bind&friends. */ 416846895fSChris Wilson #define PIN_NOEVICT BIT_ULL(0) 426846895fSChris Wilson #define PIN_NOSEARCH BIT_ULL(1) 436846895fSChris Wilson #define PIN_NONBLOCK BIT_ULL(2) 44b18fe4beSChris Wilson #define PIN_MAPPABLE BIT_ULL(3) 45b18fe4beSChris Wilson #define PIN_ZONE_4G BIT_ULL(4) 46b18fe4beSChris Wilson #define PIN_HIGH BIT_ULL(5) 47b18fe4beSChris Wilson #define PIN_OFFSET_BIAS BIT_ULL(6) 48b18fe4beSChris Wilson #define PIN_OFFSET_FIXED BIT_ULL(7) 4961102251SChris Wilson #define PIN_OFFSET_GUARD BIT_ULL(8) 5061102251SChris Wilson #define PIN_VALIDATE BIT_ULL(9) /* validate placement only, no need to call unpin() */ 51305bc234SChris Wilson 522850748eSChris Wilson #define PIN_GLOBAL BIT_ULL(10) /* I915_VMA_GLOBAL_BIND */ 532850748eSChris Wilson #define PIN_USER BIT_ULL(11) /* I915_VMA_LOCAL_BIND */ 54305bc234SChris Wilson 552c86e55dSMatthew Auld #define PIN_OFFSET_MASK I915_GTT_PAGE_MASK 5659bfa124SChris Wilson 570260c420SBen Widawsky #endif 58