Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe/stolen: convert compat static inlines to proper functions

Add display/xe_stolen.c as the implementation for the stolen interface
exposed to display. This allows hiding the implementation details that
shouldn't be exposed to display.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/8e807c6aafc6151b18df08dda20053516813e001.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+119 -85
+1
drivers/gpu/drm/xe/Makefile
··· 214 214 display/xe_hdcp_gsc.o \ 215 215 display/xe_panic.o \ 216 216 display/xe_plane_initial.o \ 217 + display/xe_stolen.o \ 217 218 display/xe_tdf.o 218 219 219 220 # SOC code shared with i915
+19 -85
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_stolen.h
··· 6 6 #ifndef _I915_GEM_STOLEN_H_ 7 7 #define _I915_GEM_STOLEN_H_ 8 8 9 - #include "xe_ttm_stolen_mgr.h" 10 - #include "xe_res_cursor.h" 11 - #include "xe_validation.h" 9 + #include <linux/types.h> 12 10 13 11 struct xe_bo; 12 + struct xe_device; 14 13 15 14 struct intel_stolen_node { 16 15 struct xe_bo *bo; 17 16 }; 18 17 19 - static inline int i915_gem_stolen_insert_node_in_range(struct xe_device *xe, 20 - struct intel_stolen_node *node, 21 - u32 size, u32 align, 22 - u32 start, u32 end) 23 - { 24 - struct xe_bo *bo; 25 - int err = 0; 26 - u32 flags = XE_BO_FLAG_PINNED | XE_BO_FLAG_STOLEN; 18 + int i915_gem_stolen_insert_node_in_range(struct xe_device *xe, 19 + struct intel_stolen_node *node, 20 + u32 size, u32 align, 21 + u32 start, u32 end); 27 22 28 - if (start < SZ_4K) 29 - start = SZ_4K; 23 + int i915_gem_stolen_insert_node(struct xe_device *xe, 24 + struct intel_stolen_node *node, 25 + u32 size, u32 align); 30 26 31 - if (align) { 32 - size = ALIGN(size, align); 33 - start = ALIGN(start, align); 34 - } 27 + void i915_gem_stolen_remove_node(struct xe_device *xe, 28 + struct intel_stolen_node *node); 35 29 36 - bo = xe_bo_create_pin_range_novm(xe, xe_device_get_root_tile(xe), 37 - size, start, end, ttm_bo_type_kernel, flags); 38 - if (IS_ERR(bo)) { 39 - err = PTR_ERR(bo); 40 - bo = NULL; 41 - return err; 42 - } 30 + bool i915_gem_stolen_initialized(struct xe_device *xe); 43 31 44 - node->bo = bo; 32 + bool i915_gem_stolen_node_allocated(const struct intel_stolen_node *node); 45 33 46 - return err; 47 - } 34 + u32 i915_gem_stolen_node_offset(struct intel_stolen_node *node); 48 35 49 - static inline int i915_gem_stolen_insert_node(struct xe_device *xe, 50 - struct intel_stolen_node *node, 51 - u32 size, u32 align) 52 - { 53 - /* Not used on xe */ 54 - WARN_ON(1); 36 + u64 i915_gem_stolen_area_address(const struct xe_device *xe); 55 37 56 - return -ENODEV; 57 - } 38 + u64 i915_gem_stolen_area_size(const struct xe_device *xe); 58 39 59 - static inline void i915_gem_stolen_remove_node(struct xe_device *xe, 60 - struct intel_stolen_node *node) 61 - { 62 - xe_bo_unpin_map_no_vm(node->bo); 63 - node->bo = NULL; 64 - } 40 + u64 i915_gem_stolen_node_address(struct xe_device *xe, 41 + struct intel_stolen_node *node); 65 42 66 - static inline bool i915_gem_stolen_initialized(struct xe_device *xe) 67 - { 68 - return ttm_manager_type(&xe->ttm, XE_PL_STOLEN); 69 - } 70 - 71 - static inline bool i915_gem_stolen_node_allocated(const struct intel_stolen_node *node) 72 - { 73 - return node->bo; 74 - } 75 - 76 - static inline u32 i915_gem_stolen_node_offset(struct intel_stolen_node *node) 77 - { 78 - struct xe_res_cursor res; 79 - 80 - xe_res_first(node->bo->ttm.resource, 0, 4096, &res); 81 - return res.start; 82 - } 83 - 84 - /* Used for < gen4. These are not supported by Xe */ 85 - static inline u64 i915_gem_stolen_area_address(const struct xe_device *xe) 86 - { 87 - WARN_ON(1); 88 - 89 - return 0; 90 - } 91 - 92 - /* Used for gen9 specific WA. Gen9 is not supported by Xe */ 93 - static inline u64 i915_gem_stolen_area_size(const struct xe_device *xe) 94 - { 95 - WARN_ON(1); 96 - 97 - return 0; 98 - } 99 - 100 - static inline u64 i915_gem_stolen_node_address(struct xe_device *xe, 101 - struct intel_stolen_node *node) 102 - { 103 - return xe_ttm_stolen_gpu_offset(xe) + i915_gem_stolen_node_offset(node); 104 - } 105 - 106 - static inline u64 i915_gem_stolen_node_size(const struct intel_stolen_node *node) 107 - { 108 - return node->bo->ttm.base.size; 109 - } 43 + u64 i915_gem_stolen_node_size(const struct intel_stolen_node *node); 110 44 111 45 #endif
+99
drivers/gpu/drm/xe/display/xe_stolen.c
··· 1 + // SPDX-License-Identifier: MIT 2 + /* Copyright © 2025 Intel Corporation */ 3 + 4 + #include "gem/i915_gem_stolen.h" 5 + #include "xe_res_cursor.h" 6 + #include "xe_ttm_stolen_mgr.h" 7 + #include "xe_validation.h" 8 + 9 + int i915_gem_stolen_insert_node_in_range(struct xe_device *xe, 10 + struct intel_stolen_node *node, 11 + u32 size, u32 align, 12 + u32 start, u32 end) 13 + { 14 + struct xe_bo *bo; 15 + int err = 0; 16 + u32 flags = XE_BO_FLAG_PINNED | XE_BO_FLAG_STOLEN; 17 + 18 + if (start < SZ_4K) 19 + start = SZ_4K; 20 + 21 + if (align) { 22 + size = ALIGN(size, align); 23 + start = ALIGN(start, align); 24 + } 25 + 26 + bo = xe_bo_create_pin_range_novm(xe, xe_device_get_root_tile(xe), 27 + size, start, end, ttm_bo_type_kernel, flags); 28 + if (IS_ERR(bo)) { 29 + err = PTR_ERR(bo); 30 + bo = NULL; 31 + return err; 32 + } 33 + 34 + node->bo = bo; 35 + 36 + return err; 37 + } 38 + 39 + int i915_gem_stolen_insert_node(struct xe_device *xe, 40 + struct intel_stolen_node *node, 41 + u32 size, u32 align) 42 + { 43 + /* Not used on xe */ 44 + WARN_ON(1); 45 + 46 + return -ENODEV; 47 + } 48 + 49 + void i915_gem_stolen_remove_node(struct xe_device *xe, 50 + struct intel_stolen_node *node) 51 + { 52 + xe_bo_unpin_map_no_vm(node->bo); 53 + node->bo = NULL; 54 + } 55 + 56 + bool i915_gem_stolen_initialized(struct xe_device *xe) 57 + { 58 + return ttm_manager_type(&xe->ttm, XE_PL_STOLEN); 59 + } 60 + 61 + bool i915_gem_stolen_node_allocated(const struct intel_stolen_node *node) 62 + { 63 + return node->bo; 64 + } 65 + 66 + u32 i915_gem_stolen_node_offset(struct intel_stolen_node *node) 67 + { 68 + struct xe_res_cursor res; 69 + 70 + xe_res_first(node->bo->ttm.resource, 0, 4096, &res); 71 + return res.start; 72 + } 73 + 74 + /* Used for < gen4. These are not supported by Xe */ 75 + u64 i915_gem_stolen_area_address(const struct xe_device *xe) 76 + { 77 + WARN_ON(1); 78 + 79 + return 0; 80 + } 81 + 82 + /* Used for gen9 specific WA. Gen9 is not supported by Xe */ 83 + u64 i915_gem_stolen_area_size(const struct xe_device *xe) 84 + { 85 + WARN_ON(1); 86 + 87 + return 0; 88 + } 89 + 90 + u64 i915_gem_stolen_node_address(struct xe_device *xe, 91 + struct intel_stolen_node *node) 92 + { 93 + return xe_ttm_stolen_gpu_offset(xe) + i915_gem_stolen_node_offset(node); 94 + } 95 + 96 + u64 i915_gem_stolen_node_size(const struct intel_stolen_node *node) 97 + { 98 + return node->bo->ttm.base.size; 99 + }