[PATCH 4/7] drm/i915: add iomapping for stolen smem

Robert Beckett bob.beckett at collabora.com
Tue Apr 5 19:33:42 UTC 2022


Signed-off-by: Robert Beckett <bob.beckett at collabora.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
index 7706e46d1f46..adcc521b2810 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -549,11 +549,25 @@ i915_gem_object_create_stolen(struct drm_i915_private *i915,
 
 static int init_stolen_smem(struct intel_memory_region *mem)
 {
+	int err;
+
+	if (!io_mapping_init_wc(&mem->iomap,
+				mem->region.start,
+				resource_size(&mem->region)))
+		return -EIO;
 	/*
 	 * Initialise stolen early so that we may reserve preallocated
 	 * objects for the BIOS to KMS transition.
 	 */
-	return i915_gem_init_stolen(mem);
+	err = i915_gem_init_stolen(mem);
+	if (err)
+		goto err_fini;
+
+	return 0;
+
+err_fini:
+	io_mapping_fini(&mem->iomap);
+	return err;
 }
 
 static const struct intel_memory_region_ops i915_region_stolen_smem_ops = {
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list