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

drm/i915: lookup for mem_region of a mem_type

Lookup function to retrieve the pointer to a memory region of
a mem_type.

v2:
for_each_memory_region is used.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200104191043.2207314-1-chris@chris-wilson.co.uk

authored by

Ramalingam C and committed by
Chris Wilson
50129bca 06581862

+17
+14
drivers/gpu/drm/i915/intel_memory_region.c
··· 16 16 [INTEL_REGION_STOLEN] = REGION_MAP(INTEL_MEMORY_STOLEN, 0), 17 17 }; 18 18 19 + struct intel_memory_region * 20 + intel_memory_region_by_type(struct drm_i915_private *i915, 21 + enum intel_memory_type mem_type) 22 + { 23 + struct intel_memory_region *mr; 24 + int id; 25 + 26 + for_each_memory_region(mr, i915, id) 27 + if (mr->type == mem_type) 28 + return mr; 29 + 30 + return NULL; 31 + } 32 + 19 33 static u64 20 34 intel_memory_region_free_pages(struct intel_memory_region *mem, 21 35 struct list_head *blocks)
+3
drivers/gpu/drm/i915/intel_memory_region.h
··· 132 132 133 133 int intel_memory_regions_hw_probe(struct drm_i915_private *i915); 134 134 void intel_memory_regions_driver_release(struct drm_i915_private *i915); 135 + struct intel_memory_region * 136 + intel_memory_region_by_type(struct drm_i915_private *i915, 137 + enum intel_memory_type mem_type); 135 138 136 139 __printf(2, 3) void 137 140 intel_memory_region_set_name(struct intel_memory_region *mem,