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; 19*7e00897bSMaarten Lankhorst struct i915_gem_ww_ctx; 200260c420SBen Widawsky 2103ac84f1SChris Wilson int __must_check i915_gem_gtt_prepare_pages(struct drm_i915_gem_object *obj, 2203ac84f1SChris Wilson struct sg_table *pages); 2303ac84f1SChris Wilson void i915_gem_gtt_finish_pages(struct drm_i915_gem_object *obj, 2403ac84f1SChris Wilson struct sg_table *pages); 250260c420SBen Widawsky 26625d988aSChris Wilson int i915_gem_gtt_reserve(struct i915_address_space *vm, 27*7e00897bSMaarten Lankhorst struct i915_gem_ww_ctx *ww, 28625d988aSChris Wilson struct drm_mm_node *node, 29625d988aSChris Wilson u64 size, u64 offset, unsigned long color, 30625d988aSChris Wilson unsigned int flags); 31625d988aSChris Wilson 32e007b19dSChris Wilson int i915_gem_gtt_insert(struct i915_address_space *vm, 33*7e00897bSMaarten Lankhorst struct i915_gem_ww_ctx *ww, 34e007b19dSChris Wilson struct drm_mm_node *node, 35e007b19dSChris Wilson u64 size, u64 alignment, unsigned long color, 36e007b19dSChris Wilson u64 start, u64 end, unsigned int flags); 37e007b19dSChris Wilson 3859bfa124SChris Wilson /* Flags used by pin/bind&friends. */ 396846895fSChris Wilson #define PIN_NOEVICT BIT_ULL(0) 406846895fSChris Wilson #define PIN_NOSEARCH BIT_ULL(1) 416846895fSChris Wilson #define PIN_NONBLOCK BIT_ULL(2) 42b18fe4beSChris Wilson #define PIN_MAPPABLE BIT_ULL(3) 43b18fe4beSChris Wilson #define PIN_ZONE_4G BIT_ULL(4) 44b18fe4beSChris Wilson #define PIN_HIGH BIT_ULL(5) 45b18fe4beSChris Wilson #define PIN_OFFSET_BIAS BIT_ULL(6) 46b18fe4beSChris Wilson #define PIN_OFFSET_FIXED BIT_ULL(7) 47305bc234SChris Wilson 482850748eSChris Wilson #define PIN_GLOBAL BIT_ULL(10) /* I915_VMA_GLOBAL_BIND */ 492850748eSChris Wilson #define PIN_USER BIT_ULL(11) /* I915_VMA_LOCAL_BIND */ 50305bc234SChris Wilson 512c86e55dSMatthew Auld #define PIN_OFFSET_MASK I915_GTT_PAGE_MASK 5259bfa124SChris Wilson 530260c420SBen Widawsky #endif 54