[Intel-gfx] [RFC 60/60] drm/i915/lmem: allocate HWSP in lmem
Matthew Auld
matthew.auld at intel.com
Fri Jul 10 11:57:57 UTC 2020
From: Michel Thierry <michel.thierry at intel.com>
Signed-off-by: Michel Thierry <michel.thierry at intel.com>
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Cc: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
---
drivers/gpu/drm/i915/gem/i915_gem_pages.c | 14 ++++++++++++--
drivers/gpu/drm/i915/gt/intel_engine_cs.c | 10 +++++++++-
drivers/gpu/drm/i915/gt/intel_timeline.c | 8 +++++++-
3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index 7050519c87a4..bac33310594c 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -251,8 +251,18 @@ static void *i915_gem_object_map(struct drm_i915_gem_object *obj,
struct vm_struct *area;
pgprot_t pgprot;
- if (!i915_gem_object_has_struct_page(obj) && type != I915_MAP_WC)
- return NULL;
+ /*
+ * XXX: we need to check all the places that try to kmap LMEM,
+ * and ensure that they only do so with WC(if we are certain
+ * that such an object should reside there). After that we can
+ * then re-add the following:
+ *
+ * if (!i915_gem_object_has_struct_page(obj) && type != I915_MAP_WC)
+ * return NULL;
+ */
+
+ if (!i915_gem_object_has_struct_page(obj) && type != I915_MAP_WC)
+ type = I915_MAP_WC;
/* A single page can always be kmapped */
if (n_pte == 1 && type == I915_MAP_WB)
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 1df94e82550f..1eb74571d142 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -25,6 +25,7 @@
#include <drm/drm_print.h>
#include "gem/i915_gem_context.h"
+#include "gem/i915_gem_lmem.h"
#include "i915_drv.h"
@@ -651,7 +652,14 @@ static int init_status_page(struct intel_engine_cs *engine)
* in GFP_DMA32 for i965, and no earlier physical address users had
* access to more than 4G.
*/
- obj = i915_gem_object_create_internal(engine->i915, PAGE_SIZE);
+ if (HAS_LMEM(engine->i915)) {
+ obj = i915_gem_object_create_lmem(engine->i915,
+ PAGE_SIZE,
+ I915_BO_ALLOC_CONTIGUOUS |
+ I915_BO_ALLOC_VOLATILE);
+ } else {
+ obj = i915_gem_object_create_internal(engine->i915, PAGE_SIZE);
+ }
if (IS_ERR(obj)) {
drm_err(&engine->i915->drm,
"Failed to allocate status page\n");
diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c b/drivers/gpu/drm/i915/gt/intel_timeline.c
index 4546284fede1..45e96ecba86a 100644
--- a/drivers/gpu/drm/i915/gt/intel_timeline.c
+++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
@@ -6,6 +6,7 @@
#include "i915_drv.h"
+#include "gem/i915_gem_lmem.h"
#include "i915_active.h"
#include "i915_syncmap.h"
#include "intel_gt.h"
@@ -32,7 +33,12 @@ static struct i915_vma *__hwsp_alloc(struct intel_gt *gt)
struct drm_i915_gem_object *obj;
struct i915_vma *vma;
- obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
+ if (HAS_LMEM(i915))
+ obj = i915_gem_object_create_lmem(i915, PAGE_SIZE,
+ I915_BO_ALLOC_CONTIGUOUS |
+ I915_BO_ALLOC_VOLATILE);
+ else
+ obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
if (IS_ERR(obj))
return ERR_CAST(obj);
--
2.26.2
More information about the Intel-gfx
mailing list