Lines Matching refs:mem
36 static int __iopagetest(struct intel_memory_region *mem, in __iopagetest() argument
51 dev_err(mem->i915->drm.dev, in __iopagetest()
53 &mem->region, &mem->io_start, &offset, caller, in __iopagetest()
61 static int iopagetest(struct intel_memory_region *mem, in iopagetest() argument
70 va = ioremap_wc(mem->io_start + offset, PAGE_SIZE); in iopagetest()
72 dev_err(mem->i915->drm.dev, in iopagetest()
74 &mem->io_start, &offset, caller); in iopagetest()
79 err = __iopagetest(mem, va, PAGE_SIZE, val[i], offset, caller); in iopagetest()
83 err = __iopagetest(mem, va, PAGE_SIZE, ~val[i], offset, caller); in iopagetest()
98 static int iomemtest(struct intel_memory_region *mem, in iomemtest() argument
105 if (mem->io_size < PAGE_SIZE) in iomemtest()
108 last = mem->io_size - PAGE_SIZE; in iomemtest()
123 err = iopagetest(mem, page, caller); in iomemtest()
128 err = iopagetest(mem, 0, caller); in iomemtest()
132 err = iopagetest(mem, last, caller); in iomemtest()
136 err = iopagetest(mem, random_page(last), caller); in iomemtest()
182 int intel_memory_region_reserve(struct intel_memory_region *mem, in intel_memory_region_reserve() argument
186 struct ttm_resource_manager *man = mem->region_private; in intel_memory_region_reserve()
188 GEM_BUG_ON(mem->is_range_manager); in intel_memory_region_reserve()
204 static int intel_memory_region_memtest(struct intel_memory_region *mem, in intel_memory_region_memtest() argument
207 struct drm_i915_private *i915 = mem->i915; in intel_memory_region_memtest()
210 if (!mem->io_start) in intel_memory_region_memtest()
214 err = iomemtest(mem, i915->params.memtest, caller); in intel_memory_region_memtest()
230 struct intel_memory_region *mem; in intel_memory_region_create() local
233 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in intel_memory_region_create()
234 if (!mem) in intel_memory_region_create()
237 mem->i915 = i915; in intel_memory_region_create()
238 mem->region = (struct resource)DEFINE_RES_MEM(start, size); in intel_memory_region_create()
239 mem->io_start = io_start; in intel_memory_region_create()
240 mem->io_size = io_size; in intel_memory_region_create()
241 mem->min_page_size = min_page_size; in intel_memory_region_create()
242 mem->ops = ops; in intel_memory_region_create()
243 mem->total = size; in intel_memory_region_create()
244 mem->type = type; in intel_memory_region_create()
245 mem->instance = instance; in intel_memory_region_create()
247 mutex_init(&mem->objects.lock); in intel_memory_region_create()
248 INIT_LIST_HEAD(&mem->objects.list); in intel_memory_region_create()
251 err = ops->init(mem); in intel_memory_region_create()
256 err = intel_memory_region_memtest(mem, (void *)_RET_IP_); in intel_memory_region_create()
260 return mem; in intel_memory_region_create()
263 if (mem->ops->release) in intel_memory_region_create()
264 mem->ops->release(mem); in intel_memory_region_create()
266 kfree(mem); in intel_memory_region_create()
270 void intel_memory_region_set_name(struct intel_memory_region *mem, in intel_memory_region_set_name() argument
276 vsnprintf(mem->name, sizeof(mem->name), fmt, ap); in intel_memory_region_set_name()
294 void intel_memory_region_destroy(struct intel_memory_region *mem) in intel_memory_region_destroy() argument
298 if (mem->ops->release) in intel_memory_region_destroy()
299 ret = mem->ops->release(mem); in intel_memory_region_destroy()
301 GEM_WARN_ON(!list_empty_careful(&mem->objects.list)); in intel_memory_region_destroy()
302 mutex_destroy(&mem->objects.lock); in intel_memory_region_destroy()
304 kfree(mem); in intel_memory_region_destroy()
314 struct intel_memory_region *mem = ERR_PTR(-ENODEV); in intel_memory_regions_hw_probe() local
325 mem = i915_gem_ttm_system_setup(i915, type, in intel_memory_regions_hw_probe()
328 mem = i915_gem_shmem_setup(i915, type, in intel_memory_regions_hw_probe()
332 mem = i915_gem_stolen_lmem_setup(i915, type, instance); in intel_memory_regions_hw_probe()
333 if (!IS_ERR(mem)) in intel_memory_regions_hw_probe()
334 i915->mm.stolen_region = mem; in intel_memory_regions_hw_probe()
337 mem = i915_gem_stolen_smem_setup(i915, type, instance); in intel_memory_regions_hw_probe()
338 if (!IS_ERR(mem)) in intel_memory_regions_hw_probe()
339 i915->mm.stolen_region = mem; in intel_memory_regions_hw_probe()
345 if (IS_ERR(mem)) { in intel_memory_regions_hw_probe()
346 err = PTR_ERR(mem); in intel_memory_regions_hw_probe()
353 mem->id = i; in intel_memory_regions_hw_probe()
354 i915->mm.regions[i] = mem; in intel_memory_regions_hw_probe()