@@ -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)
@@ -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");
@@ -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);