From: Abdiel Janulgue Date: Fri, 25 Oct 2019 15:37:23 +0000 (+0100) Subject: drm/i915: setup io-mapping for LMEM X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=cb6d2467ace7fb50203ff3900c31d01c7670ff6f;p=openwrt%2Fstaging%2Fblogic.git drm/i915: setup io-mapping for LMEM Create an io-mapping to describe the CPU aperture for lmem. Signed-off-by: Abdiel Janulgue Cc: Matthew Auld Reviewed-by: Chris Wilson Signed-off-by: Chris Wilson Link: https://patchwork.freedesktop.org/patch/msgid/20191025153728.23689-2-chris@chris-wilson.co.uk --- diff --git a/drivers/gpu/drm/i915/intel_region_lmem.c b/drivers/gpu/drm/i915/intel_region_lmem.c index 199532056e1b..9a351af45ce6 100644 --- a/drivers/gpu/drm/i915/intel_region_lmem.c +++ b/drivers/gpu/drm/i915/intel_region_lmem.c @@ -9,8 +9,32 @@ #include "gem/i915_gem_region.h" #include "intel_region_lmem.h" +static void +region_lmem_release(struct intel_memory_region *mem) +{ + io_mapping_fini(&mem->iomap); + intel_memory_region_release_buddy(mem); +} + +static int +region_lmem_init(struct intel_memory_region *mem) +{ + int ret; + + if (!io_mapping_init_wc(&mem->iomap, + mem->io_start, + resource_size(&mem->region))) + return -EIO; + + ret = intel_memory_region_init_buddy(mem); + if (ret) + io_mapping_fini(&mem->iomap); + + return ret; +} + const struct intel_memory_region_ops intel_region_lmem_ops = { - .init = intel_memory_region_init_buddy, - .release = intel_memory_region_release_buddy, + .init = region_lmem_init, + .release = region_lmem_release, .create_object = __i915_gem_lmem_object_create, };