Skip to contentSkip to conversation

LMEM basics

PATCH Superseded Matthew Auld 4 participants 50 messages Sep 27, 2019 – Sep 30, 2019

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover LMEM basics

The basic LMEM bits, minus the uAPI, pruning, etc. The goal is to support basic LMEM object creation within the kernel. From there we can start with the dumb buffer support, and then the other display related bits.

We still have a few patches that deal with lack of MAPPABLE_APERTURE support, though we can probably split that into its own series.

Patches 1-2 are just noise.
Patches 3-6 are the basic intel_memory_region bits + basic mock_selftests. Patches 7-11 are the basic LMEM region bits + basic live_selftests. Patches 12-14 try to turn stolen + shmem into intel_region_regions. Patches 15-21 implement the !MAPPABLE_APERTURE bits.

The fake LMEM patch allows us to run the live_selftests with LMEM enabled and !HAS_MAPPABLE_APERTURE in CI.

Abdiel Janulgue (4):
drm/i915: Add memory region information to device_info drm/i915: setup io-mapping for LMEM drm/i915/lmem: support kernel mapping drm/i915: enumerate and init each supported region

CQ Tang (1):
drm/i915: check for missing aperture in GTT pread/pwrite paths

Daniele Ceraolo Spurio (4):
drm/i915: define HAS_MAPPABLE_APERTURE
drm/i915: do not map aperture if it is not available. drm/i915: set num_fence_regs to 0 if there is no aperture drm/i915: error capture with no ggtt slot

Matthew Auld (12):
drm/i915: check for kernel_context
drm/i915: simplify i915_gem_init_early
drm/i915: introduce intel_memory_region drm/i915/region: support continuous allocations drm/i915/region: support volatile objects
drm/i915: support creating LMEM objects drm/i915/selftests: add write-dword test for LMEM drm/i915/selftest: extend coverage to include LMEM huge-pages drm/i915: treat shmem as a region
drm/i915: treat stolen as a region drm/i915/selftests: check for missing aperture
HAX drm/i915: add the fake lmem region

Michal Wajdeczko (1):
drm/i915: Don't try to place HWS in non-existing mappable region

 arch/x86/kernel/early-quirks.c                |  26 +
 drivers/gpu/drm/i915/Makefile                 |   4 +
 drivers/gpu/drm/i915/gem/i915_gem_internal.c  |  21 +-
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c      |  70 +++
 drivers/gpu/drm/i915/gem/i915_gem_lmem.h      |  31 +
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  12 +
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  23 +-
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     |  26 +-
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |   5 +-
 drivers/gpu/drm/i915/gem/i915_gem_region.c    | 166 +++++
 drivers/gpu/drm/i915/gem/i915_gem_region.h    |  29 +
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  71 ++-
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c    |  71 ++-
 drivers/gpu/drm/i915/gem/i915_gem_stolen.h    |   3 +-
 .../drm/i915/gem/selftests/huge_gem_object.c  |   4 +-
 .../gpu/drm/i915/gem/selftests/huge_pages.c   | 212 ++++++-
 .../i915/gem/selftests/i915_gem_coherency.c   |   5 +-
 .../drm/i915/gem/selftests/i915_gem_mman.c    |   6 +
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |   9 +-
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |  14 +-
 drivers/gpu/drm/i915/i915_drv.c               |  13 +-
 drivers/gpu/drm/i915/i915_drv.h               |  17 +-
 drivers/gpu/drm/i915/i915_gem.c               |  19 +-
 drivers/gpu/drm/i915/i915_gem_fence_reg.c     |   6 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c           | 119 +++-
 drivers/gpu/drm/i915/i915_gpu_error.c         |  65 +-
 drivers/gpu/drm/i915/i915_pci.c               |  29 +-
 drivers/gpu/drm/i915/intel_device_info.h      |   2 +
 drivers/gpu/drm/i915/intel_memory_region.c    | 192 ++++++
 drivers/gpu/drm/i915/intel_memory_region.h    | 119 ++++
 drivers/gpu/drm/i915/intel_region_lmem.c      | 157 +++++
 drivers/gpu/drm/i915/intel_region_lmem.h      |  16 +
 drivers/gpu/drm/i915/selftests/i915_gem.c     |   3 +
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |   8 +-
 .../drm/i915/selftests/i915_live_selftests.h  |   1 +
 .../drm/i915/selftests/i915_mock_selftests.h  |   1 +
 .../drm/i915/selftests/intel_memory_region.c  | 587 ++++++++++++++++++
 .../gpu/drm/i915/selftests/mock_gem_device.c  |   9 +-
 drivers/gpu/drm/i915/selftests/mock_region.c  |  59 ++
 drivers/gpu/drm/i915/selftests/mock_region.h  |  16 +
 include/drm/i915_drm.h                        |   3 +
 41 files changed, 2115 insertions(+), 134 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_lmem.c
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_lmem.h
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_region.c
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_region.h
 create mode 100644 drivers/gpu/drm/i915/intel_memory_region.c
 create mode 100644 drivers/gpu/drm/i915/intel_memory_region.h
 create mode 100644 drivers/gpu/drm/i915/intel_region_lmem.c
 create mode 100644 drivers/gpu/drm/i915/intel_region_lmem.h
 create mode 100644 drivers/gpu/drm/i915/selftests/intel_memory_region.c
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_region.c
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_region.h
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/22 drm/i915: check for kernel_context

Explosions during early driver init on the error path. Make sure we fail gracefully.

[ 9547.672258] BUG: kernel NULL pointer dereference, address: 000000000000007c
[ 9547.672288] #PF: supervisor read access in kernel mode
[ 9547.672292] #PF: error_code(0x0000) - not-present page
[ 9547.672296] PGD 8000000846b41067 P4D 8000000846b41067 PUD 797034067 PMD 0
[ 9547.672303] Oops: 0000 [#1] SMP PTI
[ 9547.672307] CPU: 1 PID: 25634 Comm: i915_selftest Tainted: G     U            5.3.0-rc8+ #73
[ 9547.672313] Hardware name:  /NUC6i7KYB, BIOS KYSKLi70.86A.0050.2017.0831.1924 08/31/2017
[ 9547.672395] RIP: 0010:intel_context_unpin+0x9/0x100 [i915]
[ 9547.672400] Code: 6b 60 00 e9 17 ff ff ff bd fc ff ff ff e9 7c ff ff ff 66 66 2e 0f 1f 84 00 00 00 00
 00 0f 1f 40 00 0f 1f 44 00 00 41 54 55 53 <8b> 47 7c 83 f8 01 74 26 8d 48 ff f0 0f b1 4f 7c 48 8d 57 7c
 75 05
[ 9547.672413] RSP: 0018:ffffae8ac24ff878 EFLAGS: 00010246
[ 9547.672417] RAX: ffff944a1b7842d0 RBX: ffff944a1b784000 RCX: ffff944a12dd6fa8
[ 9547.672422] RDX: ffff944a1b7842c0 RSI: ffff944a12dd5328 RDI: 0000000000000000
[ 9547.672428] RBP: 0000000000000000 R08: ffff944a11e5d840 R09: 0000000000000000
[ 9547.672433] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 9547.672438] R13: ffffffffc11aaf00 R14: 00000000ffffffe4 R15: ffff944a0e29bf38
[ 9547.672443] FS:  00007fc259b88ac0(0000) GS:ffff944a1f880000(0000) knlGS:0000000000000000
[ 9547.672449] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9547.672454] CR2: 000000000000007c CR3: 0000000853346003 CR4: 00000000003606e0
[ 9547.672459] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 9547.672464] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 9547.672469] Call Trace:
[ 9547.672518]  intel_engine_cleanup_common+0xe3/0x270 [i915]
[ 9547.672567]  execlists_destroy+0xe/0x30 [i915]
[ 9547.672669]  intel_engines_init+0x94/0xf0 [i915]
[ 9547.672749]  i915_gem_init+0x191/0x950 [i915]
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +5 -2
index f451d5076bde..f97686bdc28b 100644
@@ -820,8 +820,11 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine)
 	if (engine->default_state)
 		i915_gem_object_put(engine->default_state);
 
-	intel_context_unpin(engine->kernel_context);
-	intel_context_put(engine->kernel_context);
+	if (engine->kernel_context) {
+		intel_context_unpin(engine->kernel_context);
+		intel_context_put(engine->kernel_context);
+	}
+
 	GEM_BUG_ON(!llist_empty(&engine->barrier_tasks));
 
 	intel_wa_list_free(&engine->ctx_wa_list);
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/22
#2 lore raw

Re: [PATCH 01/22] drm/i915: check for kernel_context

Quoting Matthew Auld (2019-09-27 18:33:48)

Quoted 2 lines

Explosions during early driver init on the error path. Make sure we fail gracefully.

Joonas would complain about the clearly not onion unwind here, but we have thrown it in as a catch-all cleanup for what is quite a complicated setup.

Quoted 28 lines
[ 9547.672258] BUG: kernel NULL pointer dereference, address: 000000000000007c
[ 9547.672288] #PF: supervisor read access in kernel mode
[ 9547.672292] #PF: error_code(0x0000) - not-present page
[ 9547.672296] PGD 8000000846b41067 P4D 8000000846b41067 PUD 797034067 PMD 0
[ 9547.672303] Oops: 0000 [#1] SMP PTI
[ 9547.672307] CPU: 1 PID: 25634 Comm: i915_selftest Tainted: G     U            5.3.0-rc8+ #73
[ 9547.672313] Hardware name:  /NUC6i7KYB, BIOS KYSKLi70.86A.0050.2017.0831.1924 08/31/2017
[ 9547.672395] RIP: 0010:intel_context_unpin+0x9/0x100 [i915]
[ 9547.672400] Code: 6b 60 00 e9 17 ff ff ff bd fc ff ff ff e9 7c ff ff ff 66 66 2e 0f 1f 84 00 00 00 00
 00 0f 1f 40 00 0f 1f 44 00 00 41 54 55 53 <8b> 47 7c 83 f8 01 74 26 8d 48 ff f0 0f b1 4f 7c 48 8d 57 7c
 75 05
[ 9547.672413] RSP: 0018:ffffae8ac24ff878 EFLAGS: 00010246
[ 9547.672417] RAX: ffff944a1b7842d0 RBX: ffff944a1b784000 RCX: ffff944a12dd6fa8
[ 9547.672422] RDX: ffff944a1b7842c0 RSI: ffff944a12dd5328 RDI: 0000000000000000
[ 9547.672428] RBP: 0000000000000000 R08: ffff944a11e5d840 R09: 0000000000000000
[ 9547.672433] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 9547.672438] R13: ffffffffc11aaf00 R14: 00000000ffffffe4 R15: ffff944a0e29bf38
[ 9547.672443] FS:  00007fc259b88ac0(0000) GS:ffff944a1f880000(0000) knlGS:0000000000000000
[ 9547.672449] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9547.672454] CR2: 000000000000007c CR3: 0000000853346003 CR4: 00000000003606e0
[ 9547.672459] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 9547.672464] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 9547.672469] Call Trace:
[ 9547.672518]  intel_engine_cleanup_common+0xe3/0x270 [i915]
[ 9547.672567]  execlists_destroy+0xe/0x30 [i915]
[ 9547.672669]  intel_engines_init+0x94/0xf0 [i915]
[ 9547.672749]  i915_gem_init+0x191/0x950 [i915]
Quoted 1 line

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH 2/22 drm/i915: simplify i915_gem_init_early

In reply to Matthew Auld

i915_gem_init_early doesn't need to return anything.

---
 drivers/gpu/drm/i915/i915_drv.c | 5 +----
 drivers/gpu/drm/i915/i915_drv.h | 2 +-
 drivers/gpu/drm/i915/i915_gem.c | 4 +---
 3 files changed, 3 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -4
index a9ee73b61f4d..91aae56b4280 100644
@@ -589,9 +589,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
 
 	intel_gt_init_early(&dev_priv->gt, dev_priv);
 
-	ret = i915_gem_init_early(dev_priv);
-	if (ret < 0)
-		goto err_gt;
+	i915_gem_init_early(dev_priv);
 
 	/* This must be called before any calls to HAS_PCH_* */
 	intel_detect_pch(dev_priv);
@@ -613,7 +611,6 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
 
 err_gem:
 	i915_gem_cleanup_early(dev_priv);
-err_gt:
 	intel_gt_driver_late_release(&dev_priv->gt);
 	vlv_free_s0ix_state(dev_priv);
 err_workqueues:
drivers/gpu/drm/i915/i915_drv.h +1 -1
index b3c7dbc1832a..0dc504fc6ffc 100644
@@ -2250,7 +2250,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
 int i915_gem_init_userptr(struct drm_i915_private *dev_priv);
 void i915_gem_cleanup_userptr(struct drm_i915_private *dev_priv);
 void i915_gem_sanitize(struct drm_i915_private *i915);
-int i915_gem_init_early(struct drm_i915_private *dev_priv);
+void i915_gem_init_early(struct drm_i915_private *dev_priv);
 void i915_gem_cleanup_early(struct drm_i915_private *dev_priv);
 int i915_gem_freeze(struct drm_i915_private *dev_priv);
 int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/i915_gem.c +1 -3
index e2897a666225..3d3fda4cae99 100644
@@ -1533,7 +1533,7 @@ static void i915_gem_init__mm(struct drm_i915_private *i915)
 	i915_gem_init__objects(i915);
 }
 
-int i915_gem_init_early(struct drm_i915_private *dev_priv)
+void i915_gem_init_early(struct drm_i915_private *dev_priv)
 {
 	int err;
 
@@ -1545,8 +1545,6 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
 	err = i915_gemfs_init(dev_priv);
 	if (err)
 		DRM_NOTE("Unable to create a private tmpfs mount, hugepage support will be disabled(%d).\n", err);
-
-	return 0;
 }
 
 void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 3/22 drm/i915: introduce intel_memory_region

In reply to Matthew Auld

Support memory regions, as defined by a given (start, end), and allow creating GEM objects which are backed by said region. The immediate goal here is to have something to represent our device memory, but later on we also want to represent every memory domain with a region, so stolen, shmem, and of course device. At some point we are probably going to want use a common struct here, such that we are better aligned with say TTM.

---
 drivers/gpu/drm/i915/Makefile                 |   2 +
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |   9 +
 drivers/gpu/drm/i915/gem/i915_gem_region.c    | 133 ++++++++++++++
 drivers/gpu/drm/i915/gem/i915_gem_region.h    |  28 +++
 .../gpu/drm/i915/gem/selftests/huge_pages.c   |  78 ++++++++
 drivers/gpu/drm/i915/i915_drv.h               |   1 +
 drivers/gpu/drm/i915/intel_memory_region.c    | 173 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_memory_region.h    |  77 ++++++++
 .../drm/i915/selftests/i915_mock_selftests.h  |   1 +
 .../drm/i915/selftests/intel_memory_region.c  | 124 +++++++++++++
 .../gpu/drm/i915/selftests/mock_gem_device.c  |   1 +
 drivers/gpu/drm/i915/selftests/mock_region.c  |  59 ++++++
 drivers/gpu/drm/i915/selftests/mock_region.h  |  16 ++
 13 files changed, 702 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_region.c
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_region.h
 create mode 100644 drivers/gpu/drm/i915/intel_memory_region.c
 create mode 100644 drivers/gpu/drm/i915/intel_memory_region.h
 create mode 100644 drivers/gpu/drm/i915/selftests/intel_memory_region.c
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_region.c
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_region.h
drivers/gpu/drm/i915/Makefile +2 -0
index 6313e7b4bd78..d849dff31f76 100644
@@ -50,6 +50,7 @@ i915-y += i915_drv.o \
 	  i915_utils.o \
 	  intel_csr.o \
 	  intel_device_info.o \
+	  intel_memory_region.o \
 	  intel_pch.o \
 	  intel_pm.o \
 	  intel_runtime_pm.o \
@@ -118,6 +119,7 @@ gem-y += \
 	gem/i915_gem_pages.o \
 	gem/i915_gem_phys.o \
 	gem/i915_gem_pm.o \
+	gem/i915_gem_region.o \
 	gem/i915_gem_shmem.o \
 	gem/i915_gem_shrinker.o \
 	gem/i915_gem_stolen.o \
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +9 -0
index d695f187b790..d36c860c9c6f 100644
@@ -158,6 +158,15 @@ struct drm_i915_gem_object {
 		atomic_t pages_pin_count;
 		atomic_t shrink_pin;
 
+		/**
+		 * Memory region for this object.
+		 */
+		struct intel_memory_region *region;
+		/**
+		 * List of memory region blocks allocated for this object.
+		 */
+		struct list_head blocks;
+
 		struct sg_table *pages;
 		void *mapping;
 
drivers/gpu/drm/i915/gem/i915_gem_region.c new file +133 -0

133 lines not on this page · raw message

drivers/gpu/drm/i915/gem/i915_gem_region.h new file +28 -0
new file mode 100644
index 000000000000..ebddc86d78f7
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#ifndef __I915_GEM_REGION_H__
+#define __I915_GEM_REGION_H__
+
+#include <linux/types.h>
+
+struct intel_memory_region;
+struct drm_i915_gem_object;
+struct sg_table;
+
+int i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj);
+void i915_gem_object_put_pages_buddy(struct drm_i915_gem_object *obj,
+				     struct sg_table *pages);
+
+void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,
+					struct intel_memory_region *mem);
+void i915_gem_object_release_memory_region(struct drm_i915_gem_object *obj);
+
+struct drm_i915_gem_object *
+i915_gem_object_create_region(struct intel_memory_region *mem,
+			      resource_size_t size,
+			      unsigned int flags);
+
+#endif
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +78 -0

102 lines not on this page · raw message

drivers/gpu/drm/i915/i915_drv.h +1 -0
index 0dc504fc6ffc..8ed4b8c2484f 100644
@@ -85,6 +85,7 @@
 #include "intel_device_info.h"
 #include "intel_pch.h"
 #include "intel_runtime_pm.h"
+#include "intel_memory_region.h"
 #include "intel_uncore.h"
 #include "intel_wakeref.h"
 #include "intel_wopcm.h"
drivers/gpu/drm/i915/intel_memory_region.c new file +173 -0

173 lines not on this page · raw message

drivers/gpu/drm/i915/intel_memory_region.h new file +77 -0

77 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/i915_mock_selftests.h +1 -0
index b88084fe3269..aa5a0e7f5d9e 100644
@@ -26,3 +26,4 @@ selftest(gtt, i915_gem_gtt_mock_selftests)
 selftest(hugepages, i915_gem_huge_page_mock_selftests)
 selftest(contexts, i915_gem_context_mock_selftests)
 selftest(buddy, i915_buddy_mock_selftests)
+selftest(memory_region, intel_memory_region_mock_selftests)
drivers/gpu/drm/i915/selftests/intel_memory_region.c new file +124 -0

124 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/mock_gem_device.c +1 -0
index 91f15fa728cd..32e32b1cd566 100644
@@ -32,6 +32,7 @@
 #include "mock_gem_device.h"
 #include "mock_gtt.h"
 #include "mock_uncore.h"
+#include "mock_region.h"
 
 #include "gem/selftests/mock_context.h"
 #include "gem/selftests/mock_gem_object.h"
drivers/gpu/drm/i915/selftests/mock_region.c new file +59 -0

59 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/mock_region.h new file +16 -0
new file mode 100644
index 000000000000..24608089d833
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#ifndef __MOCK_REGION_H
+#define __MOCK_REGION_H
+
+struct intel_memory_region *
+mock_region_create(struct drm_i915_private *i915,
+		   resource_size_t start,
+		   resource_size_t size,
+		   resource_size_t min_page_size,
+		   resource_size_t io_start);
+
+#endif /* !__MOCK_REGION_H */
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 03/22] drm/i915: introduce intel_memory_region

Quoting Matthew Auld (2019-09-27 18:33:50)

Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_region.c new file +7 -0
+struct drm_i915_gem_object *
+i915_gem_object_create_region(struct intel_memory_region *mem,
+                             resource_size_t size,
+                             unsigned int flags)
+{
+       struct drm_i915_gem_object *obj;
+

drivers/gpu/drm/i915/gem/i915_gem_region.c line 127

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_region.c new file +10 -0
+       if (!mem)
+               return ERR_PTR(-ENODEV);
+
+       size = round_up(size, mem->min_page_size);
+
+       GEM_BUG_ON(!size);
+       GEM_BUG_ON(!IS_ALIGNED(size, I915_GTT_MIN_ALIGNMENT));
+
+       if (size >> PAGE_SHIFT > INT_MAX)
+               return ERR_PTR(-E2BIG);

It's probably past time we fixed up the remaining int num_pages.

Hmm, I know gcc has warned for constants > type. Can we get it to warn for unguarded type restrictions, i.e.

	int num_pages = resource_size_t >> PAGE_SIZE;

Or maybe we go on a rampage and just ban obj->base.size and force ourselves to use a wrapper in order to catch any offenders. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [PATCH 03/22] drm/i915: introduce intel_memory_region

In reply to Matthew Auld

Quoting Matthew Auld (2019-09-27 18:33:50)

drivers/gpu/drm/i915/intel_memory_region.c line 166

Quoted 6 lines
drivers/gpu/drm/i915/intel_memory_region.c new file +6 -0
+void
+intel_memory_region_destroy(struct intel_memory_region *mem)
+{
+       if (mem->ops->release)
+               mem->ops->release(mem);
+
	mutex_destroy(&mem->mm_lock);

Review

Quoted 2 lines
(quoted diff) +2 -0
+       kfree(mem);
+}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [PATCH 03/22] drm/i915: introduce intel_memory_region

In reply to Matthew Auld

Quoting Matthew Auld (2019-09-27 18:33:50)

Quoted 6 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c new file +6 -0
+static void close_objects(struct list_head *objects)
+{
+       struct drm_i915_private *i915 = NULL;
+       struct drm_i915_gem_object *obj, *on;
+
+       list_for_each_entry_safe(obj, on, objects, st_link) {

drivers/gpu/drm/i915/selftests/intel_memory_region.c line 32

Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c new file +10 -0
+               i915 = to_i915(obj->base.dev);
+               if (i915_gem_object_has_pinned_pages(obj))
+                       i915_gem_object_unpin_pages(obj);
+               /* No polluting the memory region between tests */
+               __i915_gem_object_put_pages(obj, I915_MM_NORMAL);
+               i915_gem_object_put(obj);
+               list_del(&obj->st_link);
+       }
+
+       if (i915) {

That's on the ugly side. You will have a mem in each subtest, so why not supply it here and use the mem->i915 from that?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH 03/22] drm/i915: introduce intel_memory_region

Quoting Chris Wilson (2019-09-27 19:24:43)

Quoted 12 lines

Quoting Matthew Auld (2019-09-27 18:33:50)

Quoted 11 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c new file +11 -0
+static void close_objects(struct list_head *objects)
+{
+       struct drm_i915_private *i915 = NULL;
+       struct drm_i915_gem_object *obj, *on;
+
+       list_for_each_entry_safe(obj, on, objects, st_link) {
+               i915 = to_i915(obj->base.dev);
+               if (i915_gem_object_has_pinned_pages(obj))
+                       i915_gem_object_unpin_pages(obj);
+               /* No polluting the memory region between tests */
+               __i915_gem_object_put_pages(obj, I915_MM_NORMAL);
Quoted 8 lines

drivers/gpu/drm/i915/selftests/intel_memory_region.c line 32

Quoted 5 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c new file +5 -0
+               i915_gem_object_put(obj);
+               list_del(&obj->st_link);
+       }
+
+       if (i915) {

That's on the ugly side. You will have a mem in each subtest, so why not supply it here and use the mem->i915 from that?

The further thought, was to have an mem test runner that drained the pages between each subtest. That's an area that we need to improve. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

Re: [PATCH 03/22] drm/i915: introduce intel_memory_region

In reply to Matthew Auld

Quoting Matthew Auld (2019-09-27 18:33:50)

drivers/gpu/drm/i915/intel_memory_region.c line 37

Quoted 4 lines
drivers/gpu/drm/i915/intel_memory_region.c new file +4 -0
+void
+__intel_memory_region_put_block_buddy(struct i915_buddy_block *block)
+{
+       struct list_head blocks;

LIST_HEAD(blocks); (and no INIT_LIST_HEAD required)

drivers/gpu/drm/i915/intel_memory_region.c line 42

Quoted 5 lines
drivers/gpu/drm/i915/intel_memory_region.c new file +5 -0
+
+       INIT_LIST_HEAD(&blocks);
+       list_add(&block->link, &blocks);
+       __intel_memory_region_put_pages_buddy(block->private, &blocks);
+}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

Re: [PATCH 03/22] drm/i915: introduce intel_memory_region

In reply to Matthew Auld

Quoting Matthew Auld (2019-09-27 18:33:50)

drivers/gpu/drm/i915/gem/i915_gem_region.c line 119

Quoted 9 lines
drivers/gpu/drm/i915/gem/i915_gem_region.c new file +9 -0
+struct drm_i915_gem_object *
+i915_gem_object_create_region(struct intel_memory_region *mem,
+                             resource_size_t size,
+                             unsigned int flags)
+{
+       struct drm_i915_gem_object *obj;
+
+       if (!mem)
+               return ERR_PTR(-ENODEV);

What scenarios do you have in mind that this is not a programmer bug? -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

PATCH 4/22 drm/i915/region: support continuous allocations

In reply to Matthew Auld

Some kernel internal objects may need to be allocated as a continuous block, also thinking ahead the various kernel io_mapping interfaces seem to expect it, although this is purely a limitation in the kernel API...so perhaps something to be improved.

Cc Joonas Lahtinen <[email protected]>
Cc Abdiel Janulgue <[email protected]>
---
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |   4 +
 drivers/gpu/drm/i915/gem/i915_gem_region.c    |  15 +-
 drivers/gpu/drm/i915/gem/i915_gem_region.h    |   3 +-
 .../gpu/drm/i915/gem/selftests/huge_pages.c   |   3 +-
 drivers/gpu/drm/i915/intel_memory_region.c    |  13 +-
 drivers/gpu/drm/i915/intel_memory_region.h    |   3 +-
 .../drm/i915/selftests/intel_memory_region.c  | 163 ++++++++++++++++++
 drivers/gpu/drm/i915/selftests/mock_region.c  |   2 +-
 8 files changed, 197 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +4 -0
index d36c860c9c6f..7acd383f174f 100644
@@ -117,6 +117,10 @@ struct drm_i915_gem_object {
 
 	I915_SELFTEST_DECLARE(struct list_head st_link);
 
+	unsigned long flags;
+#define I915_BO_ALLOC_CONTIGUOUS BIT(0)
+#define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS)
+
 	/*
 	 * Is the object to be mapped as read-only to the GPU
 	 * Only honoured if hardware has relevant pte bit
drivers/gpu/drm/i915/gem/i915_gem_region.c +12 -3
index 5c3bfc121921..b317a5c84144 100644
@@ -23,10 +23,10 @@ i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj)
 {
 	struct intel_memory_region *mem = obj->mm.region;
 	struct list_head *blocks = &obj->mm.blocks;
-	unsigned int flags = I915_ALLOC_MIN_PAGE_SIZE;
 	resource_size_t size = obj->base.size;
 	resource_size_t prev_end;
 	struct i915_buddy_block *block;
+	unsigned int flags;
 	struct sg_table *st;
 	struct scatterlist *sg;
 	unsigned int sg_page_sizes;
@@ -42,6 +42,10 @@ i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj)
 		return -ENOMEM;
 	}
 
+	flags = I915_ALLOC_MIN_PAGE_SIZE;
+	if (obj->flags & I915_BO_ALLOC_CONTIGUOUS)
+		flags |= I915_ALLOC_CONTIGUOUS;
+
 	ret = __intel_memory_region_get_pages_buddy(mem, size, flags, blocks);
 	if (ret)
 		goto err_free_sg;
@@ -56,7 +60,8 @@ i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj)
 	list_for_each_entry(block, blocks, link) {
 		u64 block_size, offset;
 
-		block_size = i915_buddy_block_size(&mem->mm, block);
+		block_size = min_t(u64, size,
+				   i915_buddy_block_size(&mem->mm, block));
 		offset = i915_buddy_block_offset(block);
 
 		GEM_BUG_ON(overflows_type(block_size, sg->length));
@@ -98,10 +103,12 @@ i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj)
 }
 
 void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,
-					struct intel_memory_region *mem)
+					struct intel_memory_region *mem,
+					unsigned long flags)
 {
 	INIT_LIST_HEAD(&obj->mm.blocks);
 	obj->mm.region = mem;
+	obj->flags = flags;
 }
 
 void i915_gem_object_release_memory_region(struct drm_i915_gem_object *obj)
@@ -115,6 +122,8 @@ i915_gem_object_create_region(struct intel_memory_region *mem,
 {
 	struct drm_i915_gem_object *obj;
 
+	GEM_BUG_ON(flags & ~I915_BO_ALLOC_FLAGS);
+
 	if (!mem)
 		return ERR_PTR(-ENODEV);
 
drivers/gpu/drm/i915/gem/i915_gem_region.h +2 -1
index ebddc86d78f7..f2ff6f8bff74 100644
@@ -17,7 +17,8 @@ void i915_gem_object_put_pages_buddy(struct drm_i915_gem_object *obj,
 				     struct sg_table *pages);
 
 void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,
-					struct intel_memory_region *mem);
+					struct intel_memory_region *mem,
+					unsigned long flags);
 void i915_gem_object_release_memory_region(struct drm_i915_gem_object *obj);
 
 struct drm_i915_gem_object *
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +2 -1
index 4e1805aaeb99..f9fbf2865782 100644
@@ -471,7 +471,8 @@ static int igt_mock_memory_region_huge_pages(void *arg)
 		unsigned int page_size = BIT(bit);
 		resource_size_t phys;
 
-		obj = i915_gem_object_create_region(mem, page_size, 0);
+		obj = i915_gem_object_create_region(mem, page_size,
+						    I915_BO_ALLOC_CONTIGUOUS);
 		if (IS_ERR(obj)) {
 			err = PTR_ERR(obj);
 			goto out_destroy_device;
drivers/gpu/drm/i915/intel_memory_region.c +11 -2
index e48d5c37c4df..7a66872d9eac 100644
@@ -47,8 +47,8 @@ __intel_memory_region_get_pages_buddy(struct intel_memory_region *mem,
 				      unsigned int flags,
 				      struct list_head *blocks)
 {
-	unsigned long n_pages = size >> ilog2(mem->mm.chunk_size);
 	unsigned int min_order = 0;
+	unsigned long n_pages;
 
 	GEM_BUG_ON(!IS_ALIGNED(size, mem->mm.chunk_size));
 	GEM_BUG_ON(!list_empty(blocks));
@@ -58,6 +58,13 @@ __intel_memory_region_get_pages_buddy(struct intel_memory_region *mem,
 			    ilog2(mem->mm.chunk_size);
 	}
 
+	if (flags & I915_ALLOC_CONTIGUOUS) {
+		size = roundup_pow_of_two(size);
+		min_order = ilog2(size) - ilog2(mem->mm.chunk_size);
+	}
+
+	n_pages = size >> ilog2(mem->mm.chunk_size);
+
 	mutex_lock(&mem->mm_lock);
 
 	do {
@@ -104,7 +111,9 @@ __intel_memory_region_get_block_buddy(struct intel_memory_region *mem,
 	int ret;
 
 	INIT_LIST_HEAD(&blocks);
-	ret = __intel_memory_region_get_pages_buddy(mem, size, 0, &blocks);
+	ret = __intel_memory_region_get_pages_buddy(mem, size,
+						    I915_ALLOC_CONTIGUOUS,
+						    &blocks);
 	if (ret)
 		return ERR_PTR(ret);
 
drivers/gpu/drm/i915/intel_memory_region.h +2 -1
index ae1ce298bcd1..1dad51b2fc96 100644
@@ -17,7 +17,8 @@ struct drm_i915_gem_object;
 struct intel_memory_region;
 struct sg_table;
 
-#define I915_ALLOC_MIN_PAGE_SIZE   BIT(0)
+#define I915_ALLOC_MIN_PAGE_SIZE  BIT(0)
+#define I915_ALLOC_CONTIGUOUS     BIT(1)
 
 struct intel_memory_region_ops {
 	unsigned int flags;
drivers/gpu/drm/i915/selftests/intel_memory_region.c +163 -0

179 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/mock_region.c +1 -1
index 0e9a575ede3b..7b0c99ddc2d5 100644
@@ -36,7 +36,7 @@ mock_object_create(struct intel_memory_region *mem,
 
 	i915_gem_object_set_cache_coherency(obj, I915_CACHE_NONE);
 
-	i915_gem_object_init_memory_region(obj, mem);
+	i915_gem_object_init_memory_region(obj, mem, flags);
 
 	return obj;
 }
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

Re: [PATCH 04/22] drm/i915/region: support continuous allocations

Quoting Matthew Auld (2019-09-27 18:33:51)

drivers/gpu/drm/i915/gem/selftests/huge_pages.c static int igt_mock_memory_region_huge_pages(void *arg) · line 475

Quoted 12 lines

struct drm_i915_gem_object *

drivers/gpu/drm/i915/gem/selftests/huge_pages.c +2 -1
index 4e1805aaeb99..f9fbf2865782 100644
@@ -471,7 +471,8 @@ static int igt_mock_memory_region_huge_pages(void *arg)
                unsigned int page_size = BIT(bit);
                resource_size_t phys;
 
-               obj = i915_gem_object_create_region(mem, page_size, 0);
+               obj = i915_gem_object_create_region(mem, page_size,
+                                                   I915_BO_ALLOC_CONTIGUOUS);

Seems a good opportunity to test both?

Quoted 32 lines
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +0 -0
                if (IS_ERR(obj)) {
                        err = PTR_ERR(obj);
                        goto out_destroy_device;
drivers/gpu/drm/i915/intel_memory_region.c +8 -1
index e48d5c37c4df..7a66872d9eac 100644
@@ -47,8 +47,8 @@ __intel_memory_region_get_pages_buddy(struct intel_memory_region *mem,
                                      unsigned int flags,
                                      struct list_head *blocks)
 {
-       unsigned long n_pages = size >> ilog2(mem->mm.chunk_size);
        unsigned int min_order = 0;
+       unsigned long n_pages;
 
        GEM_BUG_ON(!IS_ALIGNED(size, mem->mm.chunk_size));
        GEM_BUG_ON(!list_empty(blocks));
@@ -58,6 +58,13 @@ __intel_memory_region_get_pages_buddy(struct intel_memory_region *mem,
                            ilog2(mem->mm.chunk_size);
        }
 
+       if (flags & I915_ALLOC_CONTIGUOUS) {
+               size = roundup_pow_of_two(size);
+               min_order = ilog2(size) - ilog2(mem->mm.chunk_size);
+       }
+
+       n_pages = size >> ilog2(mem->mm.chunk_size);
+
        mutex_lock(&mem->mm_lock);
 
        do {

drivers/gpu/drm/i915/intel_memory_region.c __intel_memory_region_get_block_buddy(struct intel_memory_region *mem, · line 116

Quoted 7 lines
drivers/gpu/drm/i915/intel_memory_region.c +3 -1
@@ -104,7 +111,9 @@ __intel_memory_region_get_block_buddy(struct intel_memory_region *mem,
        int ret;
 
        INIT_LIST_HEAD(&blocks);
-       ret = __intel_memory_region_get_pages_buddy(mem, size, 0, &blocks);
+       ret = __intel_memory_region_get_pages_buddy(mem, size,
+                                                   I915_ALLOC_CONTIGUOUS,
+                                                   &blocks);

This chunk looks odd. Quick explanation why we don't pass flags here?

drivers/gpu/drm/i915/intel_memory_region.c __intel_memory_region_get_block_buddy(struct intel_memory_region *mem, · line 118

Quoted 2 lines
drivers/gpu/drm/i915/intel_memory_region.c +0 -0
        if (ret)
                return ERR_PTR(ret);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

Re: [PATCH 04/22] drm/i915/region: support continuous allocations

In reply to Matthew Auld
Quoted 10 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Matthew Auld
Sent: Friday, September 27, 2019 1:34 PM
To: [email protected]
Cc: [email protected]
Subject: [Intel-gfx] [PATCH 04/22] drm/i915/region: support continuous allocations

Some kernel internal objects may need to be allocated as a continuous

Nit:

You refer to the "continuous block", but the then you create the "CONTIGUOUS" allocations.

s/continuous/contiguous?

Mike

Quoted 406 lines

block, also thinking ahead the various kernel io_mapping interfaces seem to expect it, although this is purely a limitation in the kernel API...so perhaps something to be improved.

Cc Joonas Lahtinen <[email protected]>
Cc Abdiel Janulgue <[email protected]>

---

.../gpu/drm/i915/gem/i915_gem_object_types.h  |   4 +
drivers/gpu/drm/i915/gem/i915_gem_region.c    |  15 +-
drivers/gpu/drm/i915/gem/i915_gem_region.h    |   3 +-
.../gpu/drm/i915/gem/selftests/huge_pages.c   |   3 +-
drivers/gpu/drm/i915/intel_memory_region.c    |  13 +-
drivers/gpu/drm/i915/intel_memory_region.h    |   3 +-
.../drm/i915/selftests/intel_memory_region.c  | 163 ++++++++++++++++++
drivers/gpu/drm/i915/selftests/mock_region.c  |   2 +-
8 files changed, 197 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +4 -0
index d36c860c9c6f..7acd383f174f 100644
@@ -117,6 +117,10 @@ struct drm_i915_gem_object {
 
 	I915_SELFTEST_DECLARE(struct list_head st_link);
 
+	unsigned long flags;
+#define I915_BO_ALLOC_CONTIGUOUS BIT(0)
+#define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS)
+
 	/*
 	 * Is the object to be mapped as read-only to the GPU
 	 * Only honoured if hardware has relevant pte bit
drivers/gpu/drm/i915/gem/i915_gem_region.c +1 -1
index 5c3bfc121921..b317a5c84144 100644
@@ -23,10 +23,10 @@ i915_gem_object_get_pages_buddy(struct
 drm_i915_gem_object *obj)
 {
 	struct intel_memory_region *mem = obj->mm.region;
 	struct list_head *blocks = &obj->mm.blocks;
-	unsigned int flags = I915_ALLOC_MIN_PAGE_SIZE;
 	resource_size_t size = obj->base.size;
 	resource_size_t prev_end;
 	struct i915_buddy_block *block;
+	unsigned int flags;
 	struct sg_table *st;
 	struct scatterlist *sg;
	unsigned int sg_page_sizes;
drivers/gpu/drm/i915/gem/i915_gem_region.c +4 -0
@@ -42,6 +42,10 @@ i915_gem_object_get_pages_buddy(struct
 drm_i915_gem_object *obj)
 		return -ENOMEM;
 	}
 
+	flags = I915_ALLOC_MIN_PAGE_SIZE;
+	if (obj->flags & I915_BO_ALLOC_CONTIGUOUS)
+		flags |= I915_ALLOC_CONTIGUOUS;
+
 	ret = __intel_memory_region_get_pages_buddy(mem, size, flags,
 blocks);
	if (ret)
		goto err_free_sg;
drivers/gpu/drm/i915/gem/i915_gem_region.c +2 -1
@@ -56,7 +60,8 @@ i915_gem_object_get_pages_buddy(struct
 drm_i915_gem_object *obj)
 	list_for_each_entry(block, blocks, link) {
 		u64 block_size, offset;
 
-		block_size = i915_buddy_block_size(&mem->mm, block);
+		block_size = min_t(u64, size,
+				   i915_buddy_block_size(&mem->mm,
 block));
 		offset = i915_buddy_block_offset(block);
		GEM_BUG_ON(overflows_type(block_size, sg->length));
drivers/gpu/drm/i915/gem/i915_gem_region.c +0 -0
@@ -98,10 +103,12 @@ i915_gem_object_get_pages_buddy(struct
 drm_i915_gem_object *obj)
 }
 

void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,

drivers/gpu/drm/i915/gem/i915_gem_region.c +2 -1
-					struct intel_memory_region *mem)
+					struct intel_memory_region *mem,
+					unsigned long flags)
{
	INIT_LIST_HEAD(&obj->mm.blocks);
	obj->mm.region = mem;
drivers/gpu/drm/i915/gem/i915_gem_region.c +1 -0
+	obj->flags = flags;

}

void i915_gem_object_release_memory_region(struct
drm_i915_gem_object *obj)

drivers/gpu/drm/i915/gem/i915_gem_region.c +2 -0
@@ -115,6 +122,8 @@ i915_gem_object_create_region(struct
 intel_memory_region *mem,
 {
 	struct drm_i915_gem_object *obj;
 
+	GEM_BUG_ON(flags & ~I915_BO_ALLOC_FLAGS);
+
 	if (!mem)
 		return ERR_PTR(-ENODEV);
drivers/gpu/drm/i915/gem/i915_gem_region.h +0 -0
index ebddc86d78f7..f2ff6f8bff74 100644
@@ -17,7 +17,8 @@ void i915_gem_object_put_pages_buddy(struct
 drm_i915_gem_object *obj,
 				     struct sg_table *pages);
 

void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,

drivers/gpu/drm/i915/gem/i915_gem_region.h +2 -1
-					struct intel_memory_region *mem);
+					struct intel_memory_region *mem,
+					unsigned long flags);

void i915_gem_object_release_memory_region(struct
drm_i915_gem_object *obj);

struct drm_i915_gem_object *

drivers/gpu/drm/i915/gem/selftests/huge_pages.c +2 -1
index 4e1805aaeb99..f9fbf2865782 100644
@@ -471,7 +471,8 @@ static int igt_mock_memory_region_huge_pages(void
 *arg)
 		unsigned int page_size = BIT(bit);
 		resource_size_t phys;
 
-		obj = i915_gem_object_create_region(mem, page_size, 0);
+		obj = i915_gem_object_create_region(mem, page_size,
+
 I915_BO_ALLOC_CONTIGUOUS);
 		if (IS_ERR(obj)) {
			err = PTR_ERR(obj);
			goto out_destroy_device;
drivers/gpu/drm/i915/intel_memory_region.c +1 -1
index e48d5c37c4df..7a66872d9eac 100644
@@ -47,8 +47,8 @@ __intel_memory_region_get_pages_buddy(struct
 intel_memory_region *mem,
 				      unsigned int flags,
 				      struct list_head *blocks)
 {
-	unsigned long n_pages = size >> ilog2(mem->mm.chunk_size);
 	unsigned int min_order = 0;
+	unsigned long n_pages;
 
 	GEM_BUG_ON(!IS_ALIGNED(size, mem->mm.chunk_size));
	GEM_BUG_ON(!list_empty(blocks));
drivers/gpu/drm/i915/intel_memory_region.c +7 -0
@@ -58,6 +58,13 @@ __intel_memory_region_get_pages_buddy(struct
 intel_memory_region *mem,
 			    ilog2(mem->mm.chunk_size);
 	}
 
+	if (flags & I915_ALLOC_CONTIGUOUS) {
+		size = roundup_pow_of_two(size);
+		min_order = ilog2(size) - ilog2(mem->mm.chunk_size);
+	}
+
+	n_pages = size >> ilog2(mem->mm.chunk_size);
+
 	mutex_lock(&mem->mm_lock);
 
	do {
drivers/gpu/drm/i915/intel_memory_region.c +3 -1
@@ -104,7 +111,9 @@ __intel_memory_region_get_block_buddy(struct
 intel_memory_region *mem,
 	int ret;
 
 	INIT_LIST_HEAD(&blocks);
-	ret = __intel_memory_region_get_pages_buddy(mem, size, 0,
 &blocks);
+	ret = __intel_memory_region_get_pages_buddy(mem, size,
+						    I915_ALLOC_CONTIGUOUS,
+						    &blocks);
 	if (ret)
		return ERR_PTR(ret);
drivers/gpu/drm/i915/intel_memory_region.h +2 -1
index ae1ce298bcd1..1dad51b2fc96 100644
@@ -17,7 +17,8 @@ struct drm_i915_gem_object;
 struct intel_memory_region;
 struct sg_table;
 
-#define I915_ALLOC_MIN_PAGE_SIZE   BIT(0)
+#define I915_ALLOC_MIN_PAGE_SIZE  BIT(0)
+#define I915_ALLOC_CONTIGUOUS     BIT(1)
 
 struct intel_memory_region_ops {
 	unsigned int flags;
drivers/gpu/drm/i915/selftests/intel_memory_region.c +138 -0
index 54f9a624b4e1..c43d00ec38ea 100644
@@ -13,6 +13,7 @@
 
 #include "gem/i915_gem_region.h"
 #include "gem/selftests/mock_context.h"
+#include "selftests/i915_random.h"
 
 static void close_objects(struct list_head *objects)
 {
@@ -89,10 +90,172 @@ static int igt_mock_fill(void *arg)
 	return err;
 }
 
+static struct drm_i915_gem_object *
+igt_object_create(struct intel_memory_region *mem,
+		  struct list_head *objects,
+		  u64 size,
+		  unsigned int flags)
+{
+	struct drm_i915_gem_object *obj;
+	int err;
+
+	obj = i915_gem_object_create_region(mem, size, flags);
+	if (IS_ERR(obj))
+		return obj;
+
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto put;
+
+	list_add(&obj->st_link, objects);
+	return obj;
+
+put:
+	i915_gem_object_put(obj);
+	return ERR_PTR(err);
+}
+
+void igt_object_release(struct drm_i915_gem_object *obj)
+{
+	i915_gem_object_unpin_pages(obj);
+	__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
+	i915_gem_object_put(obj);
+	list_del(&obj->st_link);
+}
+
+static int igt_mock_continuous(void *arg)
+{
+	struct intel_memory_region *mem = arg;
+	struct drm_i915_gem_object *obj;
+	unsigned long n_objects;
+	LIST_HEAD(objects);
+	LIST_HEAD(holes);
+	I915_RND_STATE(prng);
+	resource_size_t target;
+	resource_size_t total;
+	resource_size_t min;
+	int err = 0;
+
+	total = resource_size(&mem->region);
+
+	/* Min size */
+	obj = igt_object_create(mem, &objects, mem->mm.chunk_size,
+				I915_BO_ALLOC_CONTIGUOUS);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	if (obj->mm.pages->nents != 1) {
+		pr_err("%s min object spans multiple sg entries\n",
 __func__);
+		err = -EINVAL;
+		goto err_close_objects;
+	}
+
+	igt_object_release(obj);
+
+	/* Max size */
+	obj = igt_object_create(mem, &objects, total,
 I915_BO_ALLOC_CONTIGUOUS);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	if (obj->mm.pages->nents != 1) {
+		pr_err("%s max object spans multiple sg entries\n",
 __func__);
+		err = -EINVAL;
+		goto err_close_objects;
+	}
+
+	igt_object_release(obj);
+
+	/* Internal fragmentation should not bleed into the object size */
+	target = round_up(prandom_u32_state(&prng) % total, PAGE_SIZE);
+	target = max_t(u64, PAGE_SIZE, target);
+
+	obj = igt_object_create(mem, &objects, target,
+				I915_BO_ALLOC_CONTIGUOUS);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	if (obj->base.size != target) {
+		pr_err("%s obj->base.size(%llx) != target(%llx)\n", __func__,
+		       (u64)obj->base.size, (u64)target);
+		err = -EINVAL;
+		goto err_close_objects;
+	}
+
+	if (obj->mm.pages->nents != 1) {
+		pr_err("%s object spans multiple sg entries\n", __func__);
+		err = -EINVAL;
+		goto err_close_objects;
+	}
+
+	igt_object_release(obj);
+
+	/*
+	 * Try to fragment the address space, such that half of it is free, but
+	 * the max contiguous block size is SZ_64K.
+	 */
+
+	target = SZ_64K;
+	n_objects = div64_u64(total, target);
+
+	while (n_objects--) {
+		struct list_head *list;
+
+		if (n_objects % 2)
+			list = &holes;
+		else
+			list = &objects;
+
+		obj = igt_object_create(mem, list, target,
+					I915_BO_ALLOC_CONTIGUOUS);
+		if (IS_ERR(obj)) {
+			err = PTR_ERR(obj);
+			goto err_close_objects;
+		}
+	}
+
+	close_objects(&holes);
+
+	min = target;
+	target = total >> 1;
+
+	/* Make sure we can still allocate all the fragmented space */
+	obj = igt_object_create(mem, &objects, target, 0);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	igt_object_release(obj);
+
+	/*
+	 * Even though we have enough free space, we don't have a big

enough

drivers/gpu/drm/i915/selftests/intel_memory_region.c +24 -0
+	 * contiguous block. Make sure that holds true.
+	 */
+
+	do {
+		bool should_fail = target > min;
+
+		obj = igt_object_create(mem, &objects, target,
+					I915_BO_ALLOC_CONTIGUOUS);
+		if (should_fail != IS_ERR(obj)) {
+			pr_err("%s target allocation(%llx) mismatch\n",
+			       __func__, (u64)target);
+			err = -EINVAL;
+			goto err_close_objects;
+		}
+
+		target >>= 1;
+	} while (target >= mem->mm.chunk_size);
+
+err_close_objects:
+	list_splice_tail(&holes, &objects);
+	close_objects(&objects);
+	return err;
+}
+

int intel_memory_region_mock_selftests(void)

{
	static const struct i915_subtest tests[] = {
		SUBTEST(igt_mock_fill),
drivers/gpu/drm/i915/selftests/intel_memory_region.c +1 -0
+		SUBTEST(igt_mock_continuous),
	};
	struct intel_memory_region *mem;
	struct drm_i915_private *i915;
drivers/gpu/drm/i915/selftests/mock_region.c +1 -1
index 0e9a575ede3b..7b0c99ddc2d5 100644
@@ -36,7 +36,7 @@ mock_object_create(struct intel_memory_region
 *mem,
 
 	i915_gem_object_set_cache_coherency(obj, I915_CACHE_NONE);
 
-	i915_gem_object_init_memory_region(obj, mem);
+	i915_gem_object_init_memory_region(obj, mem, flags);
 
 	return obj;

}
--
2.20.1

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

PATCH 5/22 drm/i915/region: support volatile objects

In reply to Matthew Auld

Volatile objects are marked as DONTNEED while pinned, therefore once unpinned the backing store can be discarded. This is limited to kernel internal objects.

Cc Joonas Lahtinen <[email protected]>
Cc Abdiel Janulgue <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_internal.c    | 17 +++++++++--------
 drivers/gpu/drm/i915/gem/i915_gem_object.h      |  6 ++++++
 .../gpu/drm/i915/gem/i915_gem_object_types.h    |  9 ++++++++-
 drivers/gpu/drm/i915/gem/i915_gem_pages.c       |  6 ++++++
 drivers/gpu/drm/i915/gem/i915_gem_region.c      | 12 ++++++++++++
 drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 12 ++++--------
 drivers/gpu/drm/i915/intel_memory_region.c      |  4 ++++
 drivers/gpu/drm/i915/intel_memory_region.h      |  5 +++++
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c   |  5 ++---
 9 files changed, 56 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_internal.c +9 -8
index 0c41e04ab8fa..5e72cb1cc2d3 100644
@@ -117,13 +117,6 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
 		goto err;
 	}
 
-	/* Mark the pages as dontneed whilst they are still pinned. As soon
-	 * as they are unpinned they are allowed to be reaped by the shrinker,
-	 * and the caller is expected to repopulate - the contents of this
-	 * object are only valid whilst active and pinned.
-	 */
-	obj->mm.madv = I915_MADV_DONTNEED;
-
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -143,7 +136,6 @@ static void i915_gem_object_put_pages_internal(struct drm_i915_gem_object *obj,
 	internal_free_pages(pages);
 
 	obj->mm.dirty = false;
-	obj->mm.madv = I915_MADV_WILLNEED;
 }
 
 static const struct drm_i915_gem_object_ops i915_gem_object_internal_ops = {
@@ -188,6 +180,15 @@ i915_gem_object_create_internal(struct drm_i915_private *i915,
 	drm_gem_private_object_init(&i915->drm, &obj->base, size);
 	i915_gem_object_init(obj, &i915_gem_object_internal_ops);
 
+	/*
+	 * Mark the object as volatile, such that the pages are marked as
+	 * dontneed whilst they are still pinned. As soon as they are unpinned
+	 * they are allowed to be reaped by the shrinker, and the caller is
+	 * expected to repopulate - the contents of this object are only valid
+	 * whilst active and pinned.
+	 */
+	obj->flags = I915_BO_ALLOC_VOLATILE;
+
 	obj->read_domains = I915_GEM_DOMAIN_CPU;
 	obj->write_domain = I915_GEM_DOMAIN_CPU;
 
drivers/gpu/drm/i915/gem/i915_gem_object.h +6 -0
index 29b9eddc4c7f..d5839cbd82c0 100644
@@ -122,6 +122,12 @@ i915_gem_object_lock_fence(struct drm_i915_gem_object *obj);
 void i915_gem_object_unlock_fence(struct drm_i915_gem_object *obj,
 				  struct dma_fence *fence);
 
+static inline bool
+i915_gem_object_is_volatile(const struct drm_i915_gem_object *obj)
+{
+	return obj->flags & I915_BO_ALLOC_VOLATILE;
+}
+
 static inline void
 i915_gem_object_set_readonly(struct drm_i915_gem_object *obj)
 {
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +8 -1
index 7acd383f174f..0d934b67e547 100644
@@ -119,7 +119,8 @@ struct drm_i915_gem_object {
 
 	unsigned long flags;
 #define I915_BO_ALLOC_CONTIGUOUS BIT(0)
-#define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS)
+#define I915_BO_ALLOC_VOLATILE   BIT(1)
+#define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS | I915_BO_ALLOC_VOLATILE)
 
 	/*
 	 * Is the object to be mapped as read-only to the GPU
@@ -170,6 +171,12 @@ struct drm_i915_gem_object {
 		 * List of memory region blocks allocated for this object.
 		 */
 		struct list_head blocks;
+		/**
+		 * Element within memory_region->objects or region->purgeable
+		 * if the object is marked as DONTNEED. Access is protected by
+		 * region->obj_lock.
+		 */
+		struct list_head region_link;
 
 		struct sg_table *pages;
 		void *mapping;
drivers/gpu/drm/i915/gem/i915_gem_pages.c +6 -0
index 2e941f093a20..b0ec0959c13f 100644
@@ -18,6 +18,9 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 
 	lockdep_assert_held(&obj->mm.lock);
 
+	if (i915_gem_object_is_volatile(obj))
+		obj->mm.madv = I915_MADV_DONTNEED;
+
 	/* Make the pages coherent with the GPU (flushing any swapin). */
 	if (obj->cache_dirty) {
 		obj->write_domain = 0;
@@ -160,6 +163,9 @@ __i915_gem_object_unset_pages(struct drm_i915_gem_object *obj)
 	if (IS_ERR_OR_NULL(pages))
 		return pages;
 
+	if (i915_gem_object_is_volatile(obj))
+		obj->mm.madv = I915_MADV_WILLNEED;
+
 	i915_gem_object_make_unshrinkable(obj);
 
 	if (obj->mm.mapping) {
drivers/gpu/drm/i915/gem/i915_gem_region.c +12 -0
index b317a5c84144..e9550e0364cc 100644
@@ -109,10 +109,22 @@ void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,
 	INIT_LIST_HEAD(&obj->mm.blocks);
 	obj->mm.region = mem;
 	obj->flags = flags;
+
+	mutex_lock(&mem->obj_lock);
+
+	if (obj->flags & I915_BO_ALLOC_VOLATILE)
+		list_add(&obj->mm.region_link, &mem->purgeable);
+	else
+		list_add(&obj->mm.region_link, &mem->objects);
+
+	mutex_unlock(&mem->obj_lock);
 }
 
 void i915_gem_object_release_memory_region(struct drm_i915_gem_object *obj)
 {
+	mutex_lock(&obj->mm.region->obj_lock);
+	list_del(&obj->mm.region_link);
+	mutex_unlock(&obj->mm.region->obj_lock);
 }
 
 struct drm_i915_gem_object *
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +4 -8
index f9fbf2865782..b6dc90030156 100644
@@ -115,8 +115,6 @@ static int get_huge_pages(struct drm_i915_gem_object *obj)
 	if (i915_gem_gtt_prepare_pages(obj, st))
 		goto err;
 
-	obj->mm.madv = I915_MADV_DONTNEED;
-
 	GEM_BUG_ON(sg_page_sizes != obj->mm.page_mask);
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
@@ -137,7 +135,6 @@ static void put_huge_pages(struct drm_i915_gem_object *obj,
 	huge_pages_free_pages(pages);
 
 	obj->mm.dirty = false;
-	obj->mm.madv = I915_MADV_WILLNEED;
 }
 
 static const struct drm_i915_gem_object_ops huge_page_ops = {
@@ -170,6 +167,8 @@ huge_pages_object(struct drm_i915_private *i915,
 	drm_gem_private_object_init(&i915->drm, &obj->base, size);
 	i915_gem_object_init(obj, &huge_page_ops);
 
+	obj->flags = I915_BO_ALLOC_VOLATILE;
+
 	obj->write_domain = I915_GEM_DOMAIN_CPU;
 	obj->read_domains = I915_GEM_DOMAIN_CPU;
 	obj->cache_level = I915_CACHE_NONE;
@@ -229,8 +228,6 @@ static int fake_get_huge_pages(struct drm_i915_gem_object *obj)
 
 	i915_sg_trim(st);
 
-	obj->mm.madv = I915_MADV_DONTNEED;
-
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -263,8 +260,6 @@ static int fake_get_huge_pages_single(struct drm_i915_gem_object *obj)
 	sg_dma_len(sg) = obj->base.size;
 	sg_dma_address(sg) = page_size;
 
-	obj->mm.madv = I915_MADV_DONTNEED;
-
 	__i915_gem_object_set_pages(obj, st, sg->length);
 
 	return 0;
@@ -283,7 +278,6 @@ static void fake_put_huge_pages(struct drm_i915_gem_object *obj,
 {
 	fake_free_huge_pages(obj, pages);
 	obj->mm.dirty = false;
-	obj->mm.madv = I915_MADV_WILLNEED;
 }
 
 static const struct drm_i915_gem_object_ops fake_ops = {
@@ -323,6 +317,8 @@ fake_huge_pages_object(struct drm_i915_private *i915, u64 size, bool single)
 	else
 		i915_gem_object_init(obj, &fake_ops);
 
+	obj->flags = I915_BO_ALLOC_VOLATILE;
+
 	obj->write_domain = I915_GEM_DOMAIN_CPU;
 	obj->read_domains = I915_GEM_DOMAIN_CPU;
 	obj->cache_level = I915_CACHE_NONE;
drivers/gpu/drm/i915/intel_memory_region.c +4 -0
index 7a66872d9eac..fba07f71d9bd 100644
@@ -154,6 +154,10 @@ intel_memory_region_create(struct drm_i915_private *i915,
 	mem->min_page_size = min_page_size;
 	mem->ops = ops;
 
+	mutex_init(&mem->obj_lock);
+	INIT_LIST_HEAD(&mem->objects);
+	INIT_LIST_HEAD(&mem->purgeable);
+
 	mutex_init(&mem->mm_lock);
 
 	if (ops->init) {
drivers/gpu/drm/i915/intel_memory_region.h +5 -0
index 1dad51b2fc96..095f5a8b77af 100644
@@ -49,6 +49,11 @@ struct intel_memory_region {
 	unsigned int type;
 	unsigned int instance;
 	unsigned int id;
+
+	/* Protects access to objects and purgeable */
+	struct mutex obj_lock;
+	struct list_head objects;
+	struct list_head purgeable;
 };
 
 int intel_memory_region_init_buddy(struct intel_memory_region *mem);
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +2 -3
index 0d40e0b42923..f4d7b254c9a7 100644
@@ -91,8 +91,6 @@ static int fake_get_pages(struct drm_i915_gem_object *obj)
 	}
 	GEM_BUG_ON(rem);
 
-	obj->mm.madv = I915_MADV_DONTNEED;
-
 	__i915_gem_object_set_pages(obj, pages, sg_page_sizes);
 
 	return 0;
@@ -104,7 +102,6 @@ static void fake_put_pages(struct drm_i915_gem_object *obj,
 {
 	fake_free_pages(obj, pages);
 	obj->mm.dirty = false;
-	obj->mm.madv = I915_MADV_WILLNEED;
 }
 
 static const struct drm_i915_gem_object_ops fake_ops = {
@@ -131,6 +128,8 @@ fake_dma_object(struct drm_i915_private *i915, u64 size)
 	drm_gem_private_object_init(&i915->drm, &obj->base, size);
 	i915_gem_object_init(obj, &fake_ops);
 
+	obj->flags = I915_BO_ALLOC_VOLATILE;
+
 	obj->write_domain = I915_GEM_DOMAIN_CPU;
 	obj->read_domains = I915_GEM_DOMAIN_CPU;
 	obj->cache_level = I915_CACHE_NONE;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 6/22 drm/i915: Add memory region information to device_info

In reply to Matthew Auld

From: Abdiel Janulgue <[email protected]>

Exposes available regions for the platform. Shared memory will always be available.

---
 drivers/gpu/drm/i915/i915_drv.h          | 2 ++
 drivers/gpu/drm/i915/intel_device_info.h | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 8ed4b8c2484f..93116cc8b149 100644
@@ -2170,6 +2170,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 
 #define HAS_IPC(dev_priv)		 (INTEL_INFO(dev_priv)->display.has_ipc)
 
+#define HAS_REGION(i915, i) (INTEL_INFO(i915)->memory_regions & (i))
+
 #define HAS_GT_UC(dev_priv)	(INTEL_INFO(dev_priv)->has_gt_uc)
 
 /* Having GuC is not the same as using GuC */
drivers/gpu/drm/i915/intel_device_info.h +2 -0
index 0cdc2465534b..e9940f932d26 100644
@@ -160,6 +160,8 @@ struct intel_device_info {
 
 	unsigned int page_sizes; /* page sizes supported by the HW */
 
+	u32 memory_regions; /* regions supported by the HW */
+
 	u32 display_mmio_offset;
 
 	u8 pipe_mask;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

PATCH 7/22 drm/i915: support creating LMEM objects

In reply to Matthew Auld

We currently define LMEM, or local memory, as just another memory region, like system memory or stolen, which we can expose to userspace and can be mapped to the CPU via some BAR.

Cc Joonas Lahtinen <[email protected]>
Cc Abdiel Janulgue <[email protected]>
---
 drivers/gpu/drm/i915/Makefile                 |  2 +
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c      | 31 +++++++++++++
 drivers/gpu/drm/i915/gem/i915_gem_lmem.h      | 23 ++++++++++
 drivers/gpu/drm/i915/i915_drv.h               |  5 +++
 drivers/gpu/drm/i915/intel_memory_region.c    |  6 +++
 drivers/gpu/drm/i915/intel_memory_region.h    | 30 +++++++++++++
 drivers/gpu/drm/i915/intel_region_lmem.c      | 43 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_region_lmem.h      | 11 +++++
 .../drm/i915/selftests/i915_live_selftests.h  |  1 +
 .../drm/i915/selftests/intel_memory_region.c  | 45 +++++++++++++++++++
 10 files changed, 197 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_lmem.c
 create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_lmem.h
 create mode 100644 drivers/gpu/drm/i915/intel_region_lmem.c
 create mode 100644 drivers/gpu/drm/i915/intel_region_lmem.h
drivers/gpu/drm/i915/Makefile +2 -0
index d849dff31f76..ccf4223ed3f9 100644
@@ -115,6 +115,7 @@ gem-y += \
 	gem/i915_gem_internal.o \
 	gem/i915_gem_object.o \
 	gem/i915_gem_object_blt.o \
+	gem/i915_gem_lmem.o \
 	gem/i915_gem_mman.o \
 	gem/i915_gem_pages.o \
 	gem/i915_gem_phys.o \
@@ -143,6 +144,7 @@ i915-y += \
 	  i915_scheduler.o \
 	  i915_trace_points.o \
 	  i915_vma.o \
+	  intel_region_lmem.o \
 	  intel_wopcm.o
 
 # general-purpose microcontroller (GuC) support
drivers/gpu/drm/i915/gem/i915_gem_lmem.c new file +31 -0
new file mode 100644
index 000000000000..26a23304df32
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#include "intel_memory_region.h"
+#include "gem/i915_gem_region.h"
+#include "gem/i915_gem_lmem.h"
+#include "i915_drv.h"
+
+const struct drm_i915_gem_object_ops i915_gem_lmem_obj_ops = {
+	.get_pages = i915_gem_object_get_pages_buddy,
+	.put_pages = i915_gem_object_put_pages_buddy,
+	.release = i915_gem_object_release_memory_region,
+};
+
+bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
+{
+	struct intel_memory_region *region = obj->mm.region;
+
+	return region && region->type == INTEL_LMEM;
+}
+
+struct drm_i915_gem_object *
+i915_gem_object_create_lmem(struct drm_i915_private *i915,
+			    resource_size_t size,
+			    unsigned int flags)
+{
+	return i915_gem_object_create_region(i915->mm.regions[INTEL_MEMORY_LMEM],
+					     size, flags);
+}
drivers/gpu/drm/i915/gem/i915_gem_lmem.h new file +23 -0
new file mode 100644
index 000000000000..ebc15fe24f58
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#ifndef __I915_GEM_LMEM_H
+#define __I915_GEM_LMEM_H
+
+#include <linux/types.h>
+
+struct drm_i915_private;
+struct drm_i915_gem_object;
+
+extern const struct drm_i915_gem_object_ops i915_gem_lmem_obj_ops;
+
+bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
+
+struct drm_i915_gem_object *
+i915_gem_object_create_lmem(struct drm_i915_private *i915,
+			    resource_size_t size,
+			    unsigned int flags);
+
+#endif /* !__I915_GEM_LMEM_H */
drivers/gpu/drm/i915/i915_drv.h +5 -0
index 93116cc8b149..05a6491690f7 100644
@@ -100,6 +100,8 @@
 #include "i915_vma.h"
 #include "i915_irq.h"
 
+#include "intel_region_lmem.h"
+
 #include "intel_gvt.h"
 
 /* General customization:
@@ -686,6 +688,8 @@ struct i915_gem_mm {
 	 */
 	struct vfsmount *gemfs;
 
+	struct intel_memory_region *regions[INTEL_MEMORY_UKNOWN];
+
 	struct notifier_block oom_notifier;
 	struct notifier_block vmap_notifier;
 	struct shrinker shrinker;
@@ -2171,6 +2175,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define HAS_IPC(dev_priv)		 (INTEL_INFO(dev_priv)->display.has_ipc)
 
 #define HAS_REGION(i915, i) (INTEL_INFO(i915)->memory_regions & (i))
+#define HAS_LMEM(i915) HAS_REGION(i915, REGION_LMEM)
 
 #define HAS_GT_UC(dev_priv)	(INTEL_INFO(dev_priv)->has_gt_uc)
 
drivers/gpu/drm/i915/intel_memory_region.c +6 -0
index fba07f71d9bd..703c615331c0 100644
@@ -6,6 +6,12 @@
 #include "intel_memory_region.h"
 #include "i915_drv.h"
 
+const u32 intel_region_map[] = {
+	[INTEL_MEMORY_SMEM] = BIT(INTEL_SMEM + INTEL_MEMORY_TYPE_SHIFT) | BIT(0),
+	[INTEL_MEMORY_LMEM] = BIT(INTEL_LMEM + INTEL_MEMORY_TYPE_SHIFT) | BIT(0),
+	[INTEL_MEMORY_STOLEN] = BIT(INTEL_STOLEN + INTEL_MEMORY_TYPE_SHIFT) | BIT(0),
+};
+
 static u64
 intel_memory_region_free_pages(struct intel_memory_region *mem,
 			       struct list_head *blocks)
drivers/gpu/drm/i915/intel_memory_region.h +30 -0
index 095f5a8b77af..9ef2ec760a4b 100644
@@ -17,9 +17,39 @@ struct drm_i915_gem_object;
 struct intel_memory_region;
 struct sg_table;
 
+/**
+ *  Base memory type
+ */
+enum intel_memory_type {
+	INTEL_SMEM = 0,
+	INTEL_LMEM,
+	INTEL_STOLEN,
+};
+
+enum intel_region_id {
+	INTEL_MEMORY_SMEM = 0,
+	INTEL_MEMORY_LMEM,
+	INTEL_MEMORY_STOLEN,
+	INTEL_MEMORY_UKNOWN, /* Should be last */
+};
+
+#define REGION_SMEM     BIT(INTEL_MEMORY_SMEM)
+#define REGION_LMEM     BIT(INTEL_MEMORY_LMEM)
+#define REGION_STOLEN   BIT(INTEL_MEMORY_STOLEN)
+
+#define INTEL_MEMORY_TYPE_SHIFT 16
+
+#define MEMORY_TYPE_FROM_REGION(r) (ilog2(r >> INTEL_MEMORY_TYPE_SHIFT))
+#define MEMORY_INSTANCE_FROM_REGION(r) (ilog2(r & 0xffff))
+
 #define I915_ALLOC_MIN_PAGE_SIZE  BIT(0)
 #define I915_ALLOC_CONTIGUOUS     BIT(1)
 
+/**
+ * Memory regions encoded as type | instance
+ */
+extern const u32 intel_region_map[];
+
 struct intel_memory_region_ops {
 	unsigned int flags;
 
drivers/gpu/drm/i915/intel_region_lmem.c new file +43 -0

43 lines not on this page · raw message

drivers/gpu/drm/i915/intel_region_lmem.h new file +11 -0
new file mode 100644
index 000000000000..ed2a3bab6443
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#ifndef __INTEL_REGION_LMEM_H
+#define __INTEL_REGION_LMEM_H
+
+extern const struct intel_memory_region_ops intel_region_lmem_ops;
+
+#endif /* !__INTEL_REGION_LMEM_H */
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
index 66d83c1390c1..b4a507c7ec1d 100644
@@ -31,6 +31,7 @@ selftest(gem_contexts, i915_gem_context_live_selftests)
 selftest(blt, i915_gem_object_blt_live_selftests)
 selftest(client, i915_gem_client_blt_live_selftests)
 selftest(reset, intel_reset_live_selftests)
+selftest(memory_region, intel_memory_region_live_selftests)
 selftest(hangcheck, intel_hangcheck_live_selftests)
 selftest(execlists, intel_execlists_live_selftests)
 selftest(guc, intel_guc_live_selftest)
drivers/gpu/drm/i915/selftests/intel_memory_region.c +45 -0

62 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH 07/22] drm/i915: support creating LMEM objects

Quoting Matthew Auld (2019-09-27 18:33:54)

drivers/gpu/drm/i915/intel_memory_region.c line 13

Quoted 5 lines
drivers/gpu/drm/i915/intel_memory_region.c +5 -0
+const u32 intel_region_map[] = {
+       [INTEL_MEMORY_SMEM] = BIT(INTEL_SMEM + INTEL_MEMORY_TYPE_SHIFT) | BIT(0),
+       [INTEL_MEMORY_LMEM] = BIT(INTEL_LMEM + INTEL_MEMORY_TYPE_SHIFT) | BIT(0),
+       [INTEL_MEMORY_STOLEN] = BIT(INTEL_STOLEN + INTEL_MEMORY_TYPE_SHIFT) | BIT(0),
+};

#define REGION_MAP(type, inst) \
BIT(type + SHIFT) | BIT(inst)

BIT(inst) looks odd.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

PATCH 8/22 drm/i915: setup io-mapping for LMEM

In reply to Matthew Auld

From: Abdiel Janulgue <[email protected]>

---
 drivers/gpu/drm/i915/intel_region_lmem.c | 28 ++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_region_lmem.c +26 -2
index 7a3f96e1f766..051069664074 100644
@@ -36,8 +36,32 @@ lmem_create_object(struct intel_memory_region *mem,
 	return obj;
 }
 
+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 = lmem_create_object,
 };
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

PATCH 9/22 drm/i915/lmem: support kernel mapping

In reply to Matthew Auld

From: Abdiel Janulgue <[email protected]>

We can create LMEM objects, but we also need to support mapping them into kernel space for internal use.

---
 drivers/gpu/drm/i915/gem/i915_gem_internal.c  |  4 +-
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c      | 36 +++++++++
 drivers/gpu/drm/i915/gem/i915_gem_lmem.h      |  8 ++
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  6 ++
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  3 +-
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     | 20 ++++-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  3 +-
 .../drm/i915/gem/selftests/huge_gem_object.c  |  4 +-
 .../drm/i915/selftests/intel_memory_region.c  | 76 +++++++++++++++++++
 9 files changed, 152 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_internal.c +3 -1
index 5e72cb1cc2d3..c2e237702e8c 100644
@@ -140,7 +140,9 @@ static void i915_gem_object_put_pages_internal(struct drm_i915_gem_object *obj,
 
 static const struct drm_i915_gem_object_ops i915_gem_object_internal_ops = {
 	.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
-		 I915_GEM_OBJECT_IS_SHRINKABLE,
+		 I915_GEM_OBJECT_IS_SHRINKABLE |
+		 I915_GEM_OBJECT_IS_MAPPABLE,
+
 	.get_pages = i915_gem_object_get_pages_internal,
 	.put_pages = i915_gem_object_put_pages_internal,
 };
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +36 -0
index 26a23304df32..d7ec74ed5b88 100644
@@ -9,11 +9,47 @@
 #include "i915_drv.h"
 
 const struct drm_i915_gem_object_ops i915_gem_lmem_obj_ops = {
+	.flags = I915_GEM_OBJECT_IS_MAPPABLE,
+
 	.get_pages = i915_gem_object_get_pages_buddy,
 	.put_pages = i915_gem_object_put_pages_buddy,
 	.release = i915_gem_object_release_memory_region,
 };
 
+/* XXX: Time to vfunc your life up? */
+void __iomem *i915_gem_object_lmem_io_map_page(struct drm_i915_gem_object *obj,
+					       unsigned long n)
+{
+	resource_size_t offset;
+
+	offset = i915_gem_object_get_dma_address(obj, n);
+
+	return io_mapping_map_wc(&obj->mm.region->iomap, offset, PAGE_SIZE);
+}
+
+void __iomem *i915_gem_object_lmem_io_map_page_atomic(struct drm_i915_gem_object *obj,
+						      unsigned long n)
+{
+	resource_size_t offset;
+
+	offset = i915_gem_object_get_dma_address(obj, n);
+
+	return io_mapping_map_atomic_wc(&obj->mm.region->iomap, offset);
+}
+
+void __iomem *i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
+					  unsigned long n,
+					  unsigned long size)
+{
+	resource_size_t offset;
+
+	GEM_BUG_ON(!(obj->flags & I915_BO_ALLOC_CONTIGUOUS));
+
+	offset = i915_gem_object_get_dma_address(obj, n);
+
+	return io_mapping_map_wc(&obj->mm.region->iomap, offset, size);
+}
+
 bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
 {
 	struct intel_memory_region *region = obj->mm.region;
drivers/gpu/drm/i915/gem/i915_gem_lmem.h +8 -0
index ebc15fe24f58..31a6462bdbb6 100644
@@ -13,6 +13,14 @@ struct drm_i915_gem_object;
 
 extern const struct drm_i915_gem_object_ops i915_gem_lmem_obj_ops;
 
+void __iomem *i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
+					  unsigned long n, unsigned long size);
+void __iomem *i915_gem_object_lmem_io_map_page(struct drm_i915_gem_object *obj,
+					       unsigned long n);
+void __iomem *
+i915_gem_object_lmem_io_map_page_atomic(struct drm_i915_gem_object *obj,
+					unsigned long n);
+
 bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
 
 struct drm_i915_gem_object *
drivers/gpu/drm/i915/gem/i915_gem_object.h +6 -0
index d5839cbd82c0..e8cc776581d0 100644
@@ -158,6 +158,12 @@ i915_gem_object_is_proxy(const struct drm_i915_gem_object *obj)
 	return obj->ops->flags & I915_GEM_OBJECT_IS_PROXY;
 }
 
+static inline bool
+i915_gem_object_is_mappable(const struct drm_i915_gem_object *obj)
+{
+	return obj->ops->flags & I915_GEM_OBJECT_IS_MAPPABLE;
+}
+
 static inline bool
 i915_gem_object_needs_async_cancel(const struct drm_i915_gem_object *obj)
 {
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +2 -1
index 0d934b67e547..743898944760 100644
@@ -32,7 +32,8 @@ struct drm_i915_gem_object_ops {
 #define I915_GEM_OBJECT_HAS_STRUCT_PAGE	BIT(0)
 #define I915_GEM_OBJECT_IS_SHRINKABLE	BIT(1)
 #define I915_GEM_OBJECT_IS_PROXY	BIT(2)
-#define I915_GEM_OBJECT_ASYNC_CANCEL	BIT(3)
+#define I915_GEM_OBJECT_IS_MAPPABLE	BIT(3)
+#define I915_GEM_OBJECT_ASYNC_CANCEL	BIT(4)
 
 	/* Interface between the GEM object and its backing storage.
 	 * get_pages() is called once prior to the use of the associated set
drivers/gpu/drm/i915/gem/i915_gem_pages.c +16 -4
index b0ec0959c13f..fc4ad29ce881 100644
@@ -7,6 +7,7 @@
 #include "i915_drv.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
+#include "i915_gem_lmem.h"
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 				 struct sg_table *pages,
@@ -172,7 +173,9 @@ __i915_gem_object_unset_pages(struct drm_i915_gem_object *obj)
 		void *ptr;
 
 		ptr = page_mask_bits(obj->mm.mapping);
-		if (is_vmalloc_addr(ptr))
+		if (i915_gem_object_is_lmem(obj))
+			io_mapping_unmap(ptr);
+		else if (is_vmalloc_addr(ptr))
 			vunmap(ptr);
 		else
 			kunmap(kmap_to_page(ptr));
@@ -231,7 +234,7 @@ int __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
 }
 
 /* The 'mapping' part of i915_gem_object_pin_map() below */
-static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,
+static void *i915_gem_object_map(struct drm_i915_gem_object *obj,
 				 enum i915_map_type type)
 {
 	unsigned long n_pages = obj->base.size >> PAGE_SHIFT;
@@ -244,6 +247,13 @@ static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,
 	pgprot_t pgprot;
 	void *addr;
 
+	if (i915_gem_object_is_lmem(obj)) {
+		if (type != I915_MAP_WC)
+			return NULL;
+
+		return i915_gem_object_lmem_io_map(obj, 0, obj->base.size);
+	}
+
 	/* A single page can always be kmapped */
 	if (n_pages == 1 && type == I915_MAP_WB)
 		return kmap(sg_page(sgt->sgl));
@@ -289,7 +299,7 @@ void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
 	void *ptr;
 	int err;
 
-	if (unlikely(!i915_gem_object_has_struct_page(obj)))
+	if (unlikely(!i915_gem_object_is_mappable(obj)))
 		return ERR_PTR(-ENXIO);
 
 	err = mutex_lock_interruptible(&obj->mm.lock);
@@ -321,7 +331,9 @@ void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
 			goto err_unpin;
 		}
 
-		if (is_vmalloc_addr(ptr))
+		if (i915_gem_object_is_lmem(obj))
+			io_mapping_unmap(ptr);
+		else if (is_vmalloc_addr(ptr))
 			vunmap(ptr);
 		else
 			kunmap(kmap_to_page(ptr));
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +2 -1
index 4c4954e8ce0a..9f5d903f7793 100644
@@ -422,7 +422,8 @@ static void shmem_release(struct drm_i915_gem_object *obj)
 
 const struct drm_i915_gem_object_ops i915_gem_shmem_ops = {
 	.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
-		 I915_GEM_OBJECT_IS_SHRINKABLE,
+		 I915_GEM_OBJECT_IS_SHRINKABLE |
+		 I915_GEM_OBJECT_IS_MAPPABLE,
 
 	.get_pages = shmem_get_pages,
 	.put_pages = shmem_put_pages,
drivers/gpu/drm/i915/gem/selftests/huge_gem_object.c +3 -1
index 3c5d17b2b670..686e0e909280 100644
@@ -86,7 +86,9 @@ static void huge_put_pages(struct drm_i915_gem_object *obj,
 
 static const struct drm_i915_gem_object_ops huge_ops = {
 	.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
-		 I915_GEM_OBJECT_IS_SHRINKABLE,
+		 I915_GEM_OBJECT_IS_SHRINKABLE |
+		 I915_GEM_OBJECT_IS_MAPPABLE,
+
 	.get_pages = huge_get_pages,
 	.put_pages = huge_put_pages,
 };
drivers/gpu/drm/i915/selftests/intel_memory_region.c +76 -0

96 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH 09/22] drm/i915/lmem: support kernel mapping

Quoting Matthew Auld (2019-09-27 18:33:56)

Quoted 7 lines
 static const struct drm_i915_gem_object_ops i915_gem_object_internal_ops = {
        .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
(quoted diff) +3 -1
-                I915_GEM_OBJECT_IS_SHRINKABLE,
+                I915_GEM_OBJECT_IS_SHRINKABLE |
+                I915_GEM_OBJECT_IS_MAPPABLE,
+
 const struct drm_i915_gem_object_ops i915_gem_shmem_ops = {

Review

Quoted 10 lines
(quoted diff) +4 -2
        .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
-                I915_GEM_OBJECT_IS_SHRINKABLE,
+                I915_GEM_OBJECT_IS_SHRINKABLE |
+                I915_GEM_OBJECT_IS_MAPPABLE,
 
 static const struct drm_i915_gem_object_ops huge_ops = {
        .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
-                I915_GEM_OBJECT_IS_SHRINKABLE,
+                I915_GEM_OBJECT_IS_SHRINKABLE |
+                I915_GEM_OBJECT_IS_MAPPABLE,

Where's huge_pages and userptr?

In short any that HAS_STRUCT_PAGE is also mappable by your definition (we can use kmap on them). I suggest maybe using HAS_IOMEM and then

	if (!(obj->ops->flags & (HAS_STRUCT_PAGE | HAS_IOMEM))

?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

Re: [PATCH 09/22] drm/i915/lmem: support kernel mapping

In reply to Matthew Auld

Quoting Matthew Auld (2019-09-27 18:33:56)

Quoted 4 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +4 -0
+static int igt_lmem_write_cpu(void *arg)
+{
+       struct drm_i915_private *i915 = arg;
+       struct intel_context *ce = i915->engine[BCS0]->kernel_context;

drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_lmem_create(void *arg) · line 292

Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +10 -0
+       struct drm_i915_gem_object *obj;
+       struct rnd_state prng;
+       u32 *vaddr;
+       u32 dword;
+       u32 val;
+       u32 sz;
+       int err;
+
+       if (!HAS_ENGINE(i915, BCS0))
+               return 0;

Too late. You've already *i915->engine[BCS0]
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw

PATCH 10/22 drm/i915/selftests: add write-dword test for LMEM

In reply to Matthew Auld

Simple test writing to dwords across an object, using various engines in a randomized order, checking that our writes land from the cpu.

---
 .../drm/i915/selftests/intel_memory_region.c  | 179 ++++++++++++++++++
 1 file changed, 179 insertions(+)
drivers/gpu/drm/i915/selftests/intel_memory_region.c +179 -0
index ba98e8254b80..8d7d8b9e00da 100644
@@ -7,13 +7,16 @@
 
 #include "../i915_selftest.h"
 
+
 #include "mock_drm.h"
 #include "mock_gem_device.h"
 #include "mock_region.h"
 
+#include "gem/i915_gem_context.h"
 #include "gem/i915_gem_lmem.h"
 #include "gem/i915_gem_region.h"
 #include "gem/i915_gem_object_blt.h"
+#include "gem/selftests/igt_gem_utils.h"
 #include "gem/selftests/mock_context.h"
 #include "gt/intel_gt.h"
 #include "selftests/igt_flush_test.h"
@@ -255,6 +258,133 @@ static int igt_mock_continuous(void *arg)
 	return err;
 }
 
+static int igt_gpu_write_dw(struct intel_context *ce,
+			    struct i915_vma *vma,
+			    u32 dword,
+			    u32 value)
+{
+	int err;
+
+	i915_gem_object_lock(vma->obj);
+	err = i915_gem_object_set_to_gtt_domain(vma->obj, true);
+	i915_gem_object_unlock(vma->obj);
+	if (err)
+		return err;
+
+	return igt_gpu_fill_dw(ce, vma, dword * sizeof(u32),
+			       vma->size >> PAGE_SHIFT, value);
+}
+
+static int igt_cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
+{
+	unsigned long n;
+	int err;
+
+	i915_gem_object_lock(obj);
+	err = i915_gem_object_set_to_wc_domain(obj, false);
+	i915_gem_object_unlock(obj);
+	if (err)
+		return err;
+
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		return err;
+
+	for (n = 0; n < obj->base.size >> PAGE_SHIFT; ++n) {
+		u32 __iomem *base;
+		u32 read_val;
+
+		base = i915_gem_object_lmem_io_map_page_atomic(obj, n);
+
+		read_val = ioread32(base + dword);
+		io_mapping_unmap_atomic(base);
+		if (read_val != val) {
+			pr_err("n=%lu base[%u]=%u, val=%u\n",
+			       n, dword, read_val, val);
+			err = -EINVAL;
+			break;
+		}
+	}
+
+	i915_gem_object_unpin_pages(obj);
+	return err;
+}
+
+static int igt_gpu_write(struct i915_gem_context *ctx,
+			 struct drm_i915_gem_object *obj)
+{
+	struct drm_i915_private *i915 = ctx->i915;
+	struct i915_address_space *vm = ctx->vm ?: &i915->ggtt.vm;
+	struct i915_gem_engines *engines;
+	struct i915_gem_engines_iter it;
+	struct intel_context *ce;
+	I915_RND_STATE(prng);
+	IGT_TIMEOUT(end_time);
+	unsigned int count;
+	struct i915_vma *vma;
+	int *order;
+	int i, n;
+	int err = 0;
+
+	GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
+
+	n = 0;
+	count = 0;
+	for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it) {
+		count++;
+		if (!intel_engine_can_store_dword(ce->engine))
+			continue;
+
+		n++;
+	}
+	i915_gem_context_unlock_engines(ctx);
+	if (!n)
+		return 0;
+
+	order = i915_random_order(count * count, &prng);
+	if (!order)
+		return -ENOMEM;
+
+	vma = i915_vma_instance(obj, vm, NULL);
+	if (IS_ERR(vma)) {
+		err = PTR_ERR(vma);
+		goto out_free;
+	}
+
+	err = i915_vma_pin(vma, 0, 0, PIN_USER);
+	if (err)
+		goto out_free;
+
+	i = 0;
+	engines = i915_gem_context_lock_engines(ctx);
+	do {
+		u32 rng = prandom_u32_state(&prng);
+		u32 dword = offset_in_page(rng) / 4;
+
+		ce = engines->engines[order[i] % engines->num_engines];
+		i = (i + 1) % (count * count);
+		if (!ce || !intel_engine_can_store_dword(ce->engine))
+			continue;
+
+		err = igt_gpu_write_dw(ce, vma, dword, rng);
+		if (err)
+			break;
+
+		err = igt_cpu_check(obj, dword, rng);
+		if (err)
+			break;
+	} while (!__igt_timeout(end_time, NULL));
+	i915_gem_context_unlock_engines(ctx);
+
+out_free:
+	kfree(order);
+
+	if (err == -ENOMEM)
+		err = 0;
+
+	return err;
+}
+
 static int igt_lmem_create(void *arg)
 {
 	struct drm_i915_private *i915 = arg;
@@ -276,6 +406,54 @@ static int igt_lmem_create(void *arg)
 	return err;
 }
 
+static int igt_lmem_write_gpu(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj;
+	struct i915_gem_context *ctx;
+	struct drm_file *file;
+	I915_RND_STATE(prng);
+	u32 sz;
+	int err;
+
+	mutex_unlock(&i915->drm.struct_mutex);
+	file = mock_file(i915);
+	mutex_lock(&i915->drm.struct_mutex);
+	if (IS_ERR(file))
+		return PTR_ERR(file);
+
+	ctx = live_context(i915, file);
+	if (IS_ERR(ctx)) {
+		err = PTR_ERR(ctx);
+		goto out_file;
+	}
+
+	sz = round_up(prandom_u32_state(&prng) % SZ_32M, PAGE_SIZE);
+
+	obj = i915_gem_object_create_lmem(i915, sz, 0);
+	if (IS_ERR(obj)) {
+		err = PTR_ERR(obj);
+		goto out_file;
+	}
+
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto out_put;
+
+	err = igt_gpu_write(ctx, obj);
+	if (err)
+		pr_err("igt_gpu_write failed(%d)\n", err);
+
+	i915_gem_object_unpin_pages(obj);
+out_put:
+	i915_gem_object_put(obj);
+out_file:
+	mutex_unlock(&i915->drm.struct_mutex);
+	mock_file_free(i915, file);
+	mutex_lock(&i915->drm.struct_mutex);
+	return err;
+}
+
 static int igt_lmem_write_cpu(void *arg)
 {
 	struct drm_i915_private *i915 = arg;
@@ -389,6 +567,7 @@ int intel_memory_region_live_selftests(struct drm_i915_private *i915)
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_lmem_create),
 		SUBTEST(igt_lmem_write_cpu),
+		SUBTEST(igt_lmem_write_gpu),
 	};
 	int err;
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

Re: [PATCH 10/22] drm/i915/selftests: add write-dword test for LMEM

Quoting Matthew Auld (2019-09-27 18:33:57)

drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_mock_continuous(void *arg) · line 272

Quoted 12 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +12 -0
+static int igt_gpu_write_dw(struct intel_context *ce,
+                           struct i915_vma *vma,
+                           u32 dword,
+                           u32 value)
+{
+       int err;
+
+       i915_gem_object_lock(vma->obj);
+       err = i915_gem_object_set_to_gtt_domain(vma->obj, true);
+       i915_gem_object_unlock(vma->obj);
+       if (err)
+               return err;

Your cpu check doesn't leave the caches dirty so this is overkill, and worse may hide a coherency problem?

drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_mock_continuous(void *arg) · line 276

Quoted 3 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +3 -0
+       return igt_gpu_fill_dw(ce, vma, dword * sizeof(u32),
+                              vma->size >> PAGE_SHIFT, value);
+}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#25 lore raw

Re: [PATCH 10/22] drm/i915/selftests: add write-dword test for LMEM

In reply to Matthew Auld

Quoting Matthew Auld (2019-09-27 18:33:57)

Quoted 4 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +4 -0
+       i = 0;
+       engines = i915_gem_context_lock_engines(ctx);
+       do {
+               u32 rng = prandom_u32_state(&prng);

drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_mock_continuous(void *arg) · line 371

Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +10 -0
+               u32 dword = offset_in_page(rng) / 4;
+
+               ce = engines->engines[order[i] % engines->num_engines];
+               i = (i + 1) % (count * count);
+               if (!ce || !intel_engine_can_store_dword(ce->engine))
+                       continue;
+
+               err = igt_gpu_write_dw(ce, vma, dword, rng);
+               if (err)
+                       break;

Do you have a test that does
dword,
64B or cacheline,
page
random width&strides of the above
before doing the read back of a random dword from those?

Think nasty cache artifacts, PCI transfers, and timing. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#26 lore raw

Re: [PATCH 10/22] drm/i915/selftests: add write-dword test for LMEM

Quoted 14 lines · Chris Wilson

Quoting Matthew Auld (2019-09-27 18:33:57)

Quoted 13 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +13 -0
+       i = 0;
+       engines = i915_gem_context_lock_engines(ctx);
+       do {
+               u32 rng = prandom_u32_state(&prng);
+               u32 dword = offset_in_page(rng) / 4;
+
+               ce = engines->engines[order[i] % engines->num_engines];
+               i = (i + 1) % (count * count);
+               if (!ce || !intel_engine_can_store_dword(ce->engine))
+                       continue;
+
+               err = igt_gpu_write_dw(ce, vma, dword, rng);
+               if (err)
Quoted 8 lines
Quoted 1 line

+ break;

Do you have a test that does
dword,
64B or cacheline,
page
random width&strides of the above
before doing the read back of a random dword from those?

Are you thinking write_dw + increment(dword, qword, cl, ..), or actually doing the fill: write_dw, write_qw, write_block?

Or maybe both? I have been playing around with the write_dw + increment for hugepages.c.

Quoted 4 lines

Think nasty cache artifacts, PCI transfers, and timing. -Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

Re: [PATCH 10/22] drm/i915/selftests: add write-dword test for LMEM

Quoting Matthew Auld (2019-09-30 10:58:15)

Quoted 24 lines · Chris Wilson
Quoted 14 lines

Quoting Matthew Auld (2019-09-27 18:33:57)

Quoted 13 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +13 -0
+       i = 0;
+       engines = i915_gem_context_lock_engines(ctx);
+       do {
+               u32 rng = prandom_u32_state(&prng);
+               u32 dword = offset_in_page(rng) / 4;
+
+               ce = engines->engines[order[i] % engines->num_engines];
+               i = (i + 1) % (count * count);
+               if (!ce || !intel_engine_can_store_dword(ce->engine))
+                       continue;
+
+               err = igt_gpu_write_dw(ce, vma, dword, rng);
+               if (err)
Quoted 8 lines
Quoted 1 line

+ break;

Do you have a test that does
dword,
64B or cacheline,
page
random width&strides of the above
before doing the read back of a random dword from those?

Quoted 2 lines

Are you thinking write_dw + increment(dword, qword, cl, ..), or actually doing the fill: write_dw, write_qw, write_block?

Here, I think stride is most interesting to hit various caching/transfer artifacts between the CPU and lmem (and possibly with writes to lmem).

I think write_dw et al better stress the GPU write side and the instruction stream.

Quoted 2 lines

Or maybe both? I have been playing around with the write_dw + increment for hugepages.c.

Maybe both :) Never say no to more patterns! (Just be cautious of time budget and use the cycles wisely to maximise coverage of your mental model of the HW.) Once we get past the obvious coherency glitches in the driver, it gets far more subtle. It's easy enough to filter out the noise but deducing a pattern from gaps in the testing is much harder :) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#28 lore raw

PATCH 11/22 drm/i915/selftest: extend coverage to include LMEM huge-pages

In reply to Matthew Auld
---
 .../gpu/drm/i915/gem/selftests/huge_pages.c   | 121 +++++++++++++++++-
 1 file changed, 120 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +120 -1
index b6dc90030156..434c1fc57adf 100644
@@ -9,6 +9,7 @@
 #include "i915_selftest.h"
 
 #include "gem/i915_gem_region.h"
+#include "gem/i915_gem_lmem.h"
 #include "gem/i915_gem_pm.h"
 
 #include "gt/intel_gt.h"
@@ -970,7 +971,7 @@ static int gpu_write(struct intel_context *ce,
 			       vma->size >> PAGE_SHIFT, val);
 }
 
-static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
+static int __cpu_check_shmem(struct drm_i915_gem_object *obj, u32 dword, u32 val)
 {
 	unsigned int needs_flush;
 	unsigned long n;
@@ -1002,6 +1003,51 @@ static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
 	return err;
 }
 
+static int __cpu_check_lmem(struct drm_i915_gem_object *obj, u32 dword, u32 val)
+{
+	unsigned long n;
+	int err;
+
+	i915_gem_object_lock(obj);
+	err = i915_gem_object_set_to_wc_domain(obj, false);
+	i915_gem_object_unlock(obj);
+	if (err)
+		return err;
+
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		return err;
+
+	for (n = 0; n < obj->base.size >> PAGE_SHIFT; ++n) {
+		u32 __iomem *base;
+		u32 read_val;
+
+		base = i915_gem_object_lmem_io_map_page_atomic(obj, n);
+
+		read_val = ioread32(base + dword);
+		io_mapping_unmap_atomic(base);
+		if (read_val != val) {
+			pr_err("n=%lu base[%u]=%u, val=%u\n",
+			       n, dword, read_val, val);
+			err = -EINVAL;
+			break;
+		}
+	}
+
+	i915_gem_object_unpin_pages(obj);
+	return err;
+}
+
+static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
+{
+	if (i915_gem_object_has_struct_page(obj))
+		return __cpu_check_shmem(obj, dword, val);
+	else if (i915_gem_object_is_lmem(obj))
+		return __cpu_check_lmem(obj, dword, val);
+
+	return -ENODEV;
+}
+
 static int __igt_write_huge(struct intel_context *ce,
 			    struct drm_i915_gem_object *obj,
 			    u64 size, u64 offset,
@@ -1386,6 +1432,78 @@ static int igt_ppgtt_gemfs_huge(void *arg)
 	return err;
 }
 
+static int igt_ppgtt_lmem_huge(void *arg)
+{
+	struct i915_gem_context *ctx = arg;
+	struct drm_i915_private *i915 = ctx->i915;
+	struct drm_i915_gem_object *obj;
+	static const unsigned int sizes[] = {
+		SZ_64K,
+		SZ_512K,
+		SZ_1M,
+		SZ_2M,
+	};
+	int i;
+	int err;
+
+	if (!HAS_LMEM(i915)) {
+		pr_info("device lacks LMEM support, skipping\n");
+		return 0;
+	}
+
+	/*
+	 * Sanity check that the HW uses huge pages correctly through LMEM
+	 * -- ensure that our writes land in the right place.
+	 */
+
+	for (i = 0; i < ARRAY_SIZE(sizes); ++i) {
+		unsigned int size = sizes[i];
+
+		obj = i915_gem_object_create_lmem(i915, size, I915_BO_ALLOC_CONTIGUOUS);
+		if (IS_ERR(obj)) {
+			err = PTR_ERR(obj);
+			if (err == -E2BIG) {
+				pr_info("object too big for region!\n");
+				return 0;
+			}
+
+			return err;
+		}
+
+		err = i915_gem_object_pin_pages(obj);
+		if (err)
+			goto out_put;
+
+		if (obj->mm.page_sizes.phys < I915_GTT_PAGE_SIZE_64K) {
+			pr_info("LMEM unable to allocate huge-page(s) with size=%u\n",
+				size);
+			goto out_unpin;
+		}
+
+		err = igt_write_huge(ctx, obj);
+		if (err) {
+			pr_err("LMEM write-huge failed with size=%u\n", size);
+			goto out_unpin;
+		}
+
+		i915_gem_object_unpin_pages(obj);
+		__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
+		i915_gem_object_put(obj);
+	}
+
+	return 0;
+
+out_unpin:
+	i915_gem_object_unpin_pages(obj);
+out_put:
+	i915_gem_object_put(obj);
+
+	if (err == -ENOMEM)
+		err = 0;
+
+	return err;
+}
+
 static int igt_ppgtt_pin_update(void *arg)
 {
 	struct i915_gem_context *ctx = arg;
@@ -1742,6 +1860,7 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *i915)
 		SUBTEST(igt_ppgtt_exhaust_huge),
 		SUBTEST(igt_ppgtt_gemfs_huge),
 		SUBTEST(igt_ppgtt_internal_huge),
+		SUBTEST(igt_ppgtt_lmem_huge),
 	};
 	struct drm_file *file;
 	struct i915_gem_context *ctx;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#29 lore raw

PATCH 12/22 drm/i915: enumerate and init each supported region

In reply to Matthew Auld

From: Abdiel Janulgue <[email protected]>

Nothing to enumerate yet...

---
 drivers/gpu/drm/i915/i915_drv.h               |  3 +
 drivers/gpu/drm/i915/i915_gem_gtt.c           | 70 +++++++++++++++++--
 .../gpu/drm/i915/selftests/mock_gem_device.c  |  6 ++
 3 files changed, 72 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -0
index 05a6491690f7..cd1414f2bcb5 100644
@@ -2394,6 +2394,9 @@ int __must_check i915_gem_evict_for_node(struct i915_address_space *vm,
 					 unsigned int flags);
 int i915_gem_evict_vm(struct i915_address_space *vm);
 
+void i915_gem_cleanup_memory_regions(struct drm_i915_private *i915);
+int i915_gem_init_memory_regions(struct drm_i915_private *i915);
+
 /* i915_gem_internal.c */
 struct drm_i915_gem_object *
 i915_gem_object_create_internal(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/i915_gem_gtt.c +63 -7

94 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/mock_gem_device.c +6 -0
index 32e32b1cd566..f210b5043112 100644
@@ -82,6 +82,8 @@ static void mock_device_release(struct drm_device *dev)
 
 	i915_gemfs_fini(i915);
 
+	i915_gem_cleanup_memory_regions(i915);
+
 	drm_mode_config_cleanup(&i915->drm);
 
 	drm_dev_fini(&i915->drm);
@@ -219,6 +221,10 @@ struct drm_i915_private *mock_gem_device(void)
 
 	WARN_ON(i915_gemfs_init(i915));
 
+	err = i915_gem_init_memory_regions(i915);
+	if (err)
+		goto err_context;
+
 	return i915;
 
 err_context:
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#30 lore raw

Re: [PATCH 12/22] drm/i915: enumerate and init each supported region

Quoting Matthew Auld (2019-09-27 18:33:59)

drivers/gpu/drm/i915/i915_gem_gtt.c int i915_init_ggtt(struct drm_i915_private *i915) · line 2795

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +3 -0
+               mem->id = intel_region_map[i];
+               mem->type = type;
+               mem->instance = MEMORY_INSTANCE_FROM_REGION(intel_region_map[i]);

So why 3xu32 for a single u32 of information? Either one or two u32 would do, depending on frequency of use.

And why was it BIT(inst)?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#31 lore raw

PATCH 13/22 drm/i915: treat shmem as a region

In reply to Matthew Auld
Cc Joonas Lahtinen <[email protected]>
Cc Abdiel Janulgue <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |  5 +-
 drivers/gpu/drm/i915/gem/i915_gem_region.c    | 14 +++-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     | 68 ++++++++++++++-----
 drivers/gpu/drm/i915/i915_drv.h               |  2 +
 drivers/gpu/drm/i915/i915_gem.c               |  9 ---
 drivers/gpu/drm/i915/i915_gem_gtt.c           |  3 +-
 drivers/gpu/drm/i915/i915_pci.c               | 29 +++++---
 .../gpu/drm/i915/selftests/mock_gem_device.c  |  6 +-
 8 files changed, 95 insertions(+), 41 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_phys.c +4 -1
index 768356908160..8043ff63d73f 100644
@@ -16,6 +16,7 @@
 #include "gt/intel_gt.h"
 #include "i915_drv.h"
 #include "i915_gem_object.h"
+#include "i915_gem_region.h"
 #include "i915_scatterlist.h"
 
 static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
@@ -191,8 +192,10 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align)
 	/* Perma-pin (until release) the physical set of pages */
 	__i915_gem_object_pin_pages(obj);
 
-	if (!IS_ERR_OR_NULL(pages))
+	if (!IS_ERR_OR_NULL(pages)) {
 		i915_gem_shmem_ops.put_pages(obj, pages);
+		i915_gem_object_release_memory_region(obj);
+	}
 	mutex_unlock(&obj->mm.lock);
 	return 0;
 
drivers/gpu/drm/i915/gem/i915_gem_region.c +13 -1
index e9550e0364cc..0aeaebb41050 100644
@@ -6,6 +6,7 @@
 #include "intel_memory_region.h"
 #include "i915_gem_region.h"
 #include "i915_drv.h"
+#include "i915_trace.h"
 
 void
 i915_gem_object_put_pages_buddy(struct drm_i915_gem_object *obj,
@@ -144,11 +145,22 @@ i915_gem_object_create_region(struct intel_memory_region *mem,
 	GEM_BUG_ON(!size);
 	GEM_BUG_ON(!IS_ALIGNED(size, I915_GTT_MIN_ALIGNMENT));
 
+	/*
+	 * There is a prevalence of the assumption that we fit the object's
+	 * page count inside a 32bit _signed_ variable. Let's document this and
+	 * catch if we ever need to fix it. In the meantime, if you do spot
+	 * such a local variable, please consider fixing!
+	 */
+
 	if (size >> PAGE_SHIFT > INT_MAX)
 		return ERR_PTR(-E2BIG);
 
 	if (overflows_type(size, obj->base.size))
 		return ERR_PTR(-E2BIG);
 
-	return mem->ops->create_object(mem, size, flags);
+	obj = mem->ops->create_object(mem, size, flags);
+	if (!IS_ERR(obj))
+		trace_i915_gem_object_create(obj);
+
+	return obj;
 }
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +51 -17

131 lines not on this page · raw message

drivers/gpu/drm/i915/i915_drv.h +2 -0
index cd1414f2bcb5..6cf13e98794a 100644
@@ -2263,6 +2263,8 @@ void i915_gem_cleanup_early(struct drm_i915_private *dev_priv);
 int i915_gem_freeze(struct drm_i915_private *dev_priv);
 int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
 
+struct intel_memory_region *i915_gem_shmem_setup(struct drm_i915_private *i915);
+
 static inline void i915_gem_drain_freed_objects(struct drm_i915_private *i915)
 {
 	/*
drivers/gpu/drm/i915/i915_gem.c +0 -9
index 3d3fda4cae99..fd329b6b475c 100644
@@ -45,7 +45,6 @@
 #include "gem/i915_gem_context.h"
 #include "gem/i915_gem_ioctls.h"
 #include "gem/i915_gem_pm.h"
-#include "gem/i915_gemfs.h"
 #include "gt/intel_engine_user.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
@@ -1535,16 +1534,10 @@ static void i915_gem_init__mm(struct drm_i915_private *i915)
 
 void i915_gem_init_early(struct drm_i915_private *dev_priv)
 {
-	int err;
-
 	i915_gem_init__mm(dev_priv);
 	i915_gem_init__pm(dev_priv);
 
 	spin_lock_init(&dev_priv->fb_tracking.lock);
-
-	err = i915_gemfs_init(dev_priv);
-	if (err)
-		DRM_NOTE("Unable to create a private tmpfs mount, hugepage support will be disabled(%d).\n", err);
 }
 
 void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
@@ -1553,8 +1546,6 @@ void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
 	GEM_BUG_ON(!llist_empty(&dev_priv->mm.free_list));
 	GEM_BUG_ON(atomic_read(&dev_priv->mm.free_count));
 	WARN_ON(dev_priv->mm.shrink_count);
-
-	i915_gemfs_fini(dev_priv);
 }
 
 int i915_gem_freeze(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -1
index a2963677861d..67fa61e8bb18 100644
@@ -2780,7 +2780,8 @@ int i915_gem_init_memory_regions(struct drm_i915_private *i915)
 
 		type = MEMORY_TYPE_FROM_REGION(intel_region_map[i]);
 		switch (type) {
-		default:
+		case INTEL_SMEM:
+			mem = i915_gem_shmem_setup(i915);
 			break;
 		}
 
drivers/gpu/drm/i915/i915_pci.c +21 -8
index ea53dfe2fba0..9101ea1dff96 100644
@@ -152,6 +152,9 @@
 #define GEN_DEFAULT_PAGE_SIZES \
 	.page_sizes = I915_GTT_PAGE_SIZE_4K
 
+#define GEN_DEFAULT_REGIONS \
+	.memory_regions = REGION_SMEM
+
 #define I830_FEATURES \
 	GEN(2), \
 	.is_mobile = 1, \
@@ -169,7 +172,8 @@
 	I9XX_PIPE_OFFSETS, \
 	I9XX_CURSOR_OFFSETS, \
 	I9XX_COLORS, \
-	GEN_DEFAULT_PAGE_SIZES
+	GEN_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 #define I845_FEATURES \
 	GEN(2), \
@@ -186,7 +190,8 @@
 	I845_PIPE_OFFSETS, \
 	I845_CURSOR_OFFSETS, \
 	I9XX_COLORS, \
-	GEN_DEFAULT_PAGE_SIZES
+	GEN_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 static const struct intel_device_info intel_i830_info = {
 	I830_FEATURES,
@@ -220,7 +225,8 @@ static const struct intel_device_info intel_i865g_info = {
 	I9XX_PIPE_OFFSETS, \
 	I9XX_CURSOR_OFFSETS, \
 	I9XX_COLORS, \
-	GEN_DEFAULT_PAGE_SIZES
+	GEN_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 static const struct intel_device_info intel_i915g_info = {
 	GEN3_FEATURES,
@@ -305,7 +311,8 @@ static const struct intel_device_info intel_pineview_m_info = {
 	I9XX_PIPE_OFFSETS, \
 	I9XX_CURSOR_OFFSETS, \
 	I965_COLORS, \
-	GEN_DEFAULT_PAGE_SIZES
+	GEN_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 static const struct intel_device_info intel_i965g_info = {
 	GEN4_FEATURES,
@@ -355,7 +362,8 @@ static const struct intel_device_info intel_gm45_info = {
 	I9XX_PIPE_OFFSETS, \
 	I9XX_CURSOR_OFFSETS, \
 	ILK_COLORS, \
-	GEN_DEFAULT_PAGE_SIZES
+	GEN_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 static const struct intel_device_info intel_ironlake_d_info = {
 	GEN5_FEATURES,
@@ -385,7 +393,8 @@ static const struct intel_device_info intel_ironlake_m_info = {
 	I9XX_PIPE_OFFSETS, \
 	I9XX_CURSOR_OFFSETS, \
 	ILK_COLORS, \
-	GEN_DEFAULT_PAGE_SIZES
+	GEN_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 #define SNB_D_PLATFORM \
 	GEN6_FEATURES, \
@@ -433,7 +442,8 @@ static const struct intel_device_info intel_sandybridge_m_gt2_info = {
 	IVB_PIPE_OFFSETS, \
 	IVB_CURSOR_OFFSETS, \
 	IVB_COLORS, \
-	GEN_DEFAULT_PAGE_SIZES
+	GEN_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 #define IVB_D_PLATFORM \
 	GEN7_FEATURES, \
@@ -494,6 +504,7 @@ static const struct intel_device_info intel_valleyview_info = {
 	I9XX_CURSOR_OFFSETS,
 	I965_COLORS,
 	GEN_DEFAULT_PAGE_SIZES,
+	GEN_DEFAULT_REGIONS,
 };
 
 #define G75_FEATURES  \
@@ -588,6 +599,7 @@ static const struct intel_device_info intel_cherryview_info = {
 	CHV_CURSOR_OFFSETS,
 	CHV_COLORS,
 	GEN_DEFAULT_PAGE_SIZES,
+	GEN_DEFAULT_REGIONS,
 };
 
 #define GEN9_DEFAULT_PAGE_SIZES \
@@ -662,7 +674,8 @@ static const struct intel_device_info intel_skylake_gt4_info = {
 	HSW_PIPE_OFFSETS, \
 	IVB_CURSOR_OFFSETS, \
 	IVB_COLORS, \
-	GEN9_DEFAULT_PAGE_SIZES
+	GEN9_DEFAULT_PAGE_SIZES, \
+	GEN_DEFAULT_REGIONS
 
 static const struct intel_device_info intel_broxton_info = {
 	GEN9_LP_FEATURES,
drivers/gpu/drm/i915/selftests/mock_gem_device.c +2 -4
index f210b5043112..10ed3a503772 100644
@@ -80,8 +80,6 @@ static void mock_device_release(struct drm_device *dev)
 
 	destroy_workqueue(i915->wq);
 
-	i915_gemfs_fini(i915);
-
 	i915_gem_cleanup_memory_regions(i915);
 
 	drm_mode_config_cleanup(&i915->drm);
@@ -181,6 +179,8 @@ struct drm_i915_private *mock_gem_device(void)
 		I915_GTT_PAGE_SIZE_64K |
 		I915_GTT_PAGE_SIZE_2M;
 
+	mkwrite_device_info(i915)->memory_regions = REGION_SMEM;
+
 	mock_uncore_init(&i915->uncore);
 	i915_gem_init__mm(i915);
 	intel_gt_init_early(&i915->gt, i915);
@@ -219,8 +219,6 @@ struct drm_i915_private *mock_gem_device(void)
 	intel_engines_driver_register(i915);
 	mutex_unlock(&i915->drm.struct_mutex);
 
-	WARN_ON(i915_gemfs_init(i915));
-
 	err = i915_gem_init_memory_regions(i915);
 	if (err)
 		goto err_context;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#32 lore raw

PATCH 14/22 drm/i915: treat stolen as a region

In reply to Matthew Auld

Convert stolen memory over to a region object. Still leaves open the question with what to do with pre-allocated objects...

Cc Joonas Lahtinen <[email protected]>
Cc Abdiel Janulgue <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_region.c |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 71 +++++++++++++++++++---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.h |  3 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c        | 14 +----
 drivers/gpu/drm/i915/i915_pci.c            |  2 +-
 5 files changed, 68 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_region.c +1 -1
index 0aeaebb41050..77e89fabbddf 100644
@@ -159,7 +159,7 @@ i915_gem_object_create_region(struct intel_memory_region *mem,
 		return ERR_PTR(-E2BIG);
 
 	obj = mem->ops->create_object(mem, size, flags);
-	if (!IS_ERR(obj))
+	if (!IS_ERR_OR_NULL(obj))
 		trace_i915_gem_object_create(obj);
 
 	return obj;
drivers/gpu/drm/i915/gem/i915_gem_stolen.c +62 -9

132 lines not on this page · raw message

drivers/gpu/drm/i915/gem/i915_gem_stolen.h +1 -2
index 2289644d8604..c1040627fbf3 100644
@@ -21,8 +21,7 @@ int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv,
 					 u64 end);
 void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
 				 struct drm_mm_node *node);
-int i915_gem_init_stolen(struct drm_i915_private *dev_priv);
-void i915_gem_cleanup_stolen(struct drm_i915_private *dev_priv);
+struct intel_memory_region *i915_gem_stolen_setup(struct drm_i915_private *i915);
 struct drm_i915_gem_object *
 i915_gem_object_create_stolen(struct drm_i915_private *dev_priv,
 			      resource_size_t size);
drivers/gpu/drm/i915/i915_gem_gtt.c +3 -11
index 67fa61e8bb18..51b2087b214f 100644
@@ -2748,8 +2748,6 @@ void i915_gem_cleanup_memory_regions(struct drm_i915_private *i915)
 {
 	int i;
 
-	i915_gem_cleanup_stolen(i915);
-
 	for (i = 0; i < ARRAY_SIZE(i915->mm.regions); i++) {
 		struct intel_memory_region *region = i915->mm.regions[i];
 
@@ -2762,15 +2760,6 @@ int i915_gem_init_memory_regions(struct drm_i915_private *i915)
 {
 	int err, i;
 
-	/*
-	 * Initialise stolen early so that we may reserve preallocated
-	 * objects for the BIOS to KMS transition.
-	 */
-	/* XXX: stolen will become a region at some point */
-	err = i915_gem_init_stolen(i915);
-	if (err)
-		return err;
-
 	for (i = 0; i < ARRAY_SIZE(i915->mm.regions); i++) {
 		struct intel_memory_region *mem = NULL;
 		u32 type;
@@ -2783,6 +2772,9 @@ int i915_gem_init_memory_regions(struct drm_i915_private *i915)
 		case INTEL_SMEM:
 			mem = i915_gem_shmem_setup(i915);
 			break;
+		case INTEL_STOLEN:
+			mem = i915_gem_stolen_setup(i915);
+			break;
 		}
 
 		if (IS_ERR(mem)) {
drivers/gpu/drm/i915/i915_pci.c +1 -1
index 9101ea1dff96..daf74c912c65 100644
@@ -153,7 +153,7 @@
 	.page_sizes = I915_GTT_PAGE_SIZE_4K
 
 #define GEN_DEFAULT_REGIONS \
-	.memory_regions = REGION_SMEM
+	.memory_regions = REGION_SMEM | REGION_STOLEN
 
 #define I830_FEATURES \
 	GEN(2), \
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#33 lore raw

Re: [PATCH 14/22] drm/i915: treat stolen as a region

Quoting Matthew Auld (2019-09-27 18:34:01)

drivers/gpu/drm/i915/gem/i915_gem_region.c i915_gem_object_create_region(struct intel_memory_region *mem, · line 162

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_region.c +1 -1
index 0aeaebb41050..77e89fabbddf 100644
@@ -159,7 +159,7 @@ i915_gem_object_create_region(struct intel_memory_region *mem,
                return ERR_PTR(-E2BIG);
 
        obj = mem->ops->create_object(mem, size, flags);
-       if (!IS_ERR(obj))
+       if (!IS_ERR_OR_NULL(obj))

Have a prep patch to bring stolen function signature into line. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#34 lore raw

PATCH 15/22 drm/i915: define HAS_MAPPABLE_APERTURE

In reply to Matthew Auld

From: Daniele Ceraolo Spurio <[email protected]>

The following patches in the series will use it to avoid certain operations when aperture is not available in HW.

---
 drivers/gpu/drm/i915/i915_drv.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 6cf13e98794a..d6303045f546 100644
@@ -2126,6 +2126,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define OVERLAY_NEEDS_PHYSICAL(dev_priv) \
 		(INTEL_INFO(dev_priv)->display.overlay_needs_physical)
 
+#define HAS_MAPPABLE_APERTURE(dev_priv) (dev_priv->ggtt.mappable_end > 0)
+
 /* Early gen2 have a totally busted CS tlb and require pinned batches. */
 #define HAS_BROKEN_CS_TLB(dev_priv)	(IS_I830(dev_priv) || IS_I845G(dev_priv))
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#35 lore raw

PATCH 16/22 drm/i915: do not map aperture if it is not available.

In reply to Matthew Auld

From: Daniele Ceraolo Spurio <[email protected]>

Skip both setup and cleanup of the aperture mapping if the HW doesn't have an aperture bar.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 34 ++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +21 -13
index 51b2087b214f..1be7b236f234 100644
@@ -2827,7 +2827,9 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt)
 	mutex_unlock(&i915->drm.struct_mutex);
 
 	arch_phys_wc_del(ggtt->mtrr);
-	io_mapping_fini(&ggtt->iomap);
+
+	if (ggtt->iomap.size)
+		io_mapping_fini(&ggtt->iomap);
 }
 
 /**
@@ -3038,10 +3040,13 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)
 	int err;
 
 	/* TODO: We're not aware of mappable constraints on gen8 yet */
-	ggtt->gmadr =
-		(struct resource) DEFINE_RES_MEM(pci_resource_start(pdev, 2),
-						 pci_resource_len(pdev, 2));
-	ggtt->mappable_end = resource_size(&ggtt->gmadr);
+	/* FIXME: We probably need to add do device_info or runtime_info */
+	if (!HAS_LMEM(dev_priv)) {
+		ggtt->gmadr =
+			(struct resource) DEFINE_RES_MEM(pci_resource_start(pdev, 2),
+							 pci_resource_len(pdev, 2));
+		ggtt->mappable_end = resource_size(&ggtt->gmadr);
+	}
 
 	err = pci_set_dma_mask(pdev, DMA_BIT_MASK(39));
 	if (!err)
@@ -3267,15 +3272,18 @@ static int ggtt_init_hw(struct i915_ggtt *ggtt)
 	if (!HAS_LLC(i915) && !HAS_PPGTT(i915))
 		ggtt->vm.mm.color_adjust = i915_ggtt_color_adjust;
 
-	if (!io_mapping_init_wc(&ggtt->iomap,
-				ggtt->gmadr.start,
-				ggtt->mappable_end)) {
-		ggtt->vm.cleanup(&ggtt->vm);
-		ret = -EIO;
-		goto out;
-	}
+	if (ggtt->mappable_end) {
+		if (!io_mapping_init_wc(&ggtt->iomap,
+					ggtt->gmadr.start,
+					ggtt->mappable_end)) {
+			ggtt->vm.cleanup(&ggtt->vm);
+			ret = -EIO;
+			goto out;
+		}
 
-	ggtt->mtrr = arch_phys_wc_add(ggtt->gmadr.start, ggtt->mappable_end);
+		ggtt->mtrr = arch_phys_wc_add(ggtt->gmadr.start,
+					      ggtt->mappable_end);
+	}
 
 	i915_ggtt_init_fences(ggtt);
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#36 lore raw

PATCH 17/22 drm/i915: set num_fence_regs to 0 if there is no aperture

In reply to Matthew Auld

From: Daniele Ceraolo Spurio <[email protected]>

We can't fence anything without aperture.

---
 drivers/gpu/drm/i915/i915_gem_fence_reg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_fence_reg.c +4 -2
index 615a9f4ef30c..e15e4e247576 100644
@@ -828,8 +828,10 @@ void i915_ggtt_init_fences(struct i915_ggtt *ggtt)
 
 	detect_bit_6_swizzle(i915);
 
-	if (INTEL_GEN(i915) >= 7 &&
-	    !(IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)))
+	if (!HAS_MAPPABLE_APERTURE(i915))
+		num_fences = 0;
+	else if (INTEL_GEN(i915) >= 7 &&
+		 !(IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)))
 		num_fences = 32;
 	else if (INTEL_GEN(i915) >= 4 ||
 		 IS_I945G(i915) || IS_I945GM(i915) ||
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#37 lore raw

Re: [PATCH 17/22] drm/i915: set num_fence_regs to 0 if there is no aperture

Quoting Matthew Auld (2019-09-27 18:34:04)

Quoted 16 lines

From: Daniele Ceraolo Spurio <[email protected]>

We can't fence anything without aperture.

---
 drivers/gpu/drm/i915/i915_gem_fence_reg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_fence_reg.c +0 -0
index 615a9f4ef30c..e15e4e247576 100644

drivers/gpu/drm/i915/i915_gem_fence_reg.c void i915_ggtt_init_fences(struct i915_ggtt *ggtt) · line 831

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_fence_reg.c +1 -2
@@ -828,8 +828,10 @@ void i915_ggtt_init_fences(struct i915_ggtt *ggtt)
 
        detect_bit_6_swizzle(i915);
 
-       if (INTEL_GEN(i915) >= 7 &&
-           !(IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)))
+       if (!HAS_MAPPABLE_APERTURE(i915))

You have the actual i915_ggtt!
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#38 lore raw

PATCH 18/22 drm/i915/selftests: check for missing aperture

In reply to Matthew Auld

We may be missing support for the mappable aperture on some platforms.

Cc Daniele Ceraolo Spurio <[email protected]>
---
 .../drm/i915/gem/selftests/i915_gem_coherency.c    |  5 ++++-
 drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c |  6 ++++++
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c       | 14 ++++++++++----
 drivers/gpu/drm/i915/selftests/i915_gem.c          |  3 +++
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c      |  3 +++
 5 files changed, 26 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c +4 -1
index 0ff7a89aadca..07faeada86eb 100644
@@ -246,7 +246,10 @@ static bool always_valid(struct drm_i915_private *i915)
 
 static bool needs_fence_registers(struct drm_i915_private *i915)
 {
-	return !intel_gt_is_wedged(&i915->gt);
+	if (intel_gt_is_wedged(&i915->gt))
+		return false;
+
+	return i915->ggtt.num_fences;
 }
 
 static bool needs_mi_store_dword(struct drm_i915_private *i915)
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +6 -0
index aefe557527f8..cb880d73ef73 100644
@@ -301,6 +301,9 @@ static int igt_partial_tiling(void *arg)
 	int tiling;
 	int err;
 
+	if (!HAS_MAPPABLE_APERTURE(i915))
+		return 0;
+
 	/* We want to check the page mapping and fencing of a large object
 	 * mmapped through the GTT. The object we create is larger than can
 	 * possibly be mmaped as a whole, and so we must use partial GGTT vma.
@@ -433,6 +436,9 @@ static int igt_smoke_tiling(void *arg)
 	IGT_TIMEOUT(end);
 	int err;
 
+	if (!HAS_MAPPABLE_APERTURE(i915))
+		return 0;
+
 	/*
 	 * igt_partial_tiling() does an exhastive check of partial tiling
 	 * chunking, but will undoubtably run out of time. Here, we do a
drivers/gpu/drm/i915/gt/selftest_hangcheck.c +10 -4
index a0098fc35921..35cc2c68b32f 100644
@@ -1189,8 +1189,12 @@ static int __igt_reset_evict_vma(struct intel_gt *gt,
 	struct i915_request *rq;
 	struct evict_vma arg;
 	struct hang h;
+	unsigned int pin_flags;
 	int err;
 
+	if (!gt->ggtt->num_fences && flags & EXEC_OBJECT_NEEDS_FENCE)
+		return 0;
+
 	if (!engine || !intel_engine_can_store_dword(engine))
 		return 0;
 
@@ -1227,10 +1231,12 @@ static int __igt_reset_evict_vma(struct intel_gt *gt,
 		goto out_obj;
 	}
 
-	err = i915_vma_pin(arg.vma, 0, 0,
-			   i915_vma_is_ggtt(arg.vma) ?
-			   PIN_GLOBAL | PIN_MAPPABLE :
-			   PIN_USER);
+	pin_flags = i915_vma_is_ggtt(arg.vma) ? PIN_GLOBAL : PIN_USER;
+
+	if (flags & EXEC_OBJECT_NEEDS_FENCE)
+		pin_flags |= PIN_MAPPABLE;
+
+	err = i915_vma_pin(arg.vma, 0, 0, pin_flags);
 	if (err) {
 		i915_request_add(rq);
 		goto out_obj;
drivers/gpu/drm/i915/selftests/i915_gem.c +3 -0
index 37593831b539..4951957a4d8d 100644
@@ -42,6 +42,9 @@ static void trash_stolen(struct drm_i915_private *i915)
 	unsigned long page;
 	u32 prng = 0x12345678;
 
+	if (!HAS_MAPPABLE_APERTURE(i915))
+		return;
+
 	for (page = 0; page < size; page += PAGE_SIZE) {
 		const dma_addr_t dma = i915->dsm.start + page;
 		u32 __iomem *s;
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +3 -0
index f4d7b254c9a7..57dd237cd220 100644
@@ -1152,6 +1152,9 @@ static int igt_ggtt_page(void *arg)
 	unsigned int *order, n;
 	int err;
 
+	if (!HAS_MAPPABLE_APERTURE(i915))
+		return 0;
+
 	mutex_lock(&i915->drm.struct_mutex);
 
 	obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#39 lore raw

Re: [PATCH 18/22] drm/i915/selftests: check for missing aperture

Quoting Matthew Auld (2019-09-27 18:34:05)

drivers/gpu/drm/i915/selftests/i915_gem.c static void trash_stolen(struct drm_i915_private *i915) · line 46

Quoted 10 lines
drivers/gpu/drm/i915/selftests/i915_gem.c +2 -0
index 37593831b539..4951957a4d8d 100644
@@ -42,6 +42,9 @@ static void trash_stolen(struct drm_i915_private *i915)
        unsigned long page;
        u32 prng = 0x12345678;
 
+       if (!HAS_MAPPABLE_APERTURE(i915))
+               return;

That's a bit of a nasty loss in coverage. Note we need to extend this test to trash lmem as well. Ideas? (Possibly using the GPU to trash everything but itself?)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#40 lore raw

PATCH 19/22 drm/i915: error capture with no ggtt slot

In reply to Matthew Auld

From: Daniele Ceraolo Spurio <[email protected]>

If the aperture is not available in HW we can't use a ggtt slot and wc copy, so fall back to regular kmap.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c   | 19 ++++----
 drivers/gpu/drm/i915/i915_gpu_error.c | 65 ++++++++++++++++++++++-----
 2 files changed, 64 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +11 -8
index 1be7b236f234..29f9c43b2c68 100644
@@ -2661,7 +2661,8 @@ static void ggtt_release_guc_top(struct i915_ggtt *ggtt)
 static void cleanup_init_ggtt(struct i915_ggtt *ggtt)
 {
 	ggtt_release_guc_top(ggtt);
-	drm_mm_remove_node(&ggtt->error_capture);
+	if (drm_mm_node_allocated(&ggtt->error_capture))
+		drm_mm_remove_node(&ggtt->error_capture);
 }
 
 static int init_ggtt(struct i915_ggtt *ggtt)
@@ -2692,13 +2693,15 @@ static int init_ggtt(struct i915_ggtt *ggtt)
 	if (ret)
 		return ret;
 
-	/* Reserve a mappable slot for our lockless error capture */
-	ret = drm_mm_insert_node_in_range(&ggtt->vm.mm, &ggtt->error_capture,
-					  PAGE_SIZE, 0, I915_COLOR_UNEVICTABLE,
-					  0, ggtt->mappable_end,
-					  DRM_MM_INSERT_LOW);
-	if (ret)
-		return ret;
+	if (HAS_MAPPABLE_APERTURE(ggtt->vm.i915)) {
+		/* Reserve a mappable slot for our lockless error capture */
+		ret = drm_mm_insert_node_in_range(&ggtt->vm.mm, &ggtt->error_capture,
+						  PAGE_SIZE, 0, I915_COLOR_UNEVICTABLE,
+						  0, ggtt->mappable_end,
+						  DRM_MM_INSERT_LOW);
+		if (ret)
+			return ret;
+	}
 
 	/*
 	 * The upper portion of the GuC address space has a sizeable hole
drivers/gpu/drm/i915/i915_gpu_error.c +53 -12

118 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#41 lore raw

Re: [PATCH 19/22] drm/i915: error capture with no ggtt slot

Quoting Matthew Auld (2019-09-27 18:34:06)

drivers/gpu/drm/i915/i915_gem_gtt.c static int init_ggtt(struct i915_ggtt *ggtt) · line 2696

Quoted 12 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -7
@@ -2692,13 +2693,15 @@ static int init_ggtt(struct i915_ggtt *ggtt)
        if (ret)
                return ret;
 
-       /* Reserve a mappable slot for our lockless error capture */
-       ret = drm_mm_insert_node_in_range(&ggtt->vm.mm, &ggtt->error_capture,
-                                         PAGE_SIZE, 0, I915_COLOR_UNEVICTABLE,
-                                         0, ggtt->mappable_end,
-                                         DRM_MM_INSERT_LOW);
-       if (ret)
-               return ret;
+       if (HAS_MAPPABLE_APERTURE(ggtt->vm.i915)) {

Uh. If only we had the answer to hand...

if (ggtt->mappable_end) {

Or make HAS_MAPPABLE_APERTURE take ggtt. Though I'd vote for less shouting.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#42 lore raw

PATCH 20/22 drm/i915: Don't try to place HWS in non-existing mappable region

In reply to Matthew Auld

From: Michal Wajdeczko <[email protected]>

HWS placement restrictions can't just rely on HAS_LLC flag.

Cc Daniele Ceraolo Spurio <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +1 -1
index f97686bdc28b..2e3f7a7507ae 100644
@@ -513,7 +513,7 @@ static int pin_ggtt_status_page(struct intel_engine_cs *engine,
 	unsigned int flags;
 
 	flags = PIN_GLOBAL;
-	if (!HAS_LLC(engine->i915))
+	if (!HAS_LLC(engine->i915) && HAS_MAPPABLE_APERTURE(engine->i915))
 		/*
 		 * On g33, we cannot place HWS above 256MiB, so
 		 * restrict its pinning to the low mappable arena.
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#43 lore raw

PATCH 21/22 drm/i915: check for missing aperture in GTT pread/pwrite paths

In reply to Matthew Auld

From: CQ Tang <[email protected]>

drm_mm_insert_node_in_range() treats range_start > range_end as a programmer error, such that we explode in insert_mappable_node. For now simply check for missing aperture on such paths.

---
 drivers/gpu/drm/i915/i915_gem.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +6 -0
index fd329b6b475c..82daaab022d8 100644
@@ -337,6 +337,9 @@ i915_gem_gtt_pread(struct drm_i915_gem_object *obj,
 	u64 remain, offset;
 	int ret;
 
+	if (!HAS_MAPPABLE_APERTURE(i915))
+		return -ENOSPC;
+
 	ret = mutex_lock_interruptible(&i915->drm.struct_mutex);
 	if (ret)
 		return ret;
@@ -530,6 +533,9 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj,
 	void __user *user_data;
 	int ret;
 
+	if (!HAS_MAPPABLE_APERTURE(i915))
+		return -ENOSPC;
+
 	ret = mutex_lock_interruptible(&i915->drm.struct_mutex);
 	if (ret)
 		return ret;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#44 lore raw

Re: [PATCH 21/22] drm/i915: check for missing aperture in GTT pread/pwrite paths

Quoting Matthew Auld (2019-09-27 18:34:08)

Quoted 5 lines

From: CQ Tang <[email protected]>

drm_mm_insert_node_in_range() treats range_start > range_end as a programmer error, such that we explode in insert_mappable_node. For now simply check for missing aperture on such paths.

range_start is 0.
range_end is 0.

drm_mm_insert_node_in_range():

	DRM_MM_BUG_ON(range_start > range_end);

	if (size == 0 || range_end - range_start < size)
		return -ENOSPC;

This patch is superfluous.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#45 lore raw

PATCH 22/22 HAX drm/i915: add the fake lmem region

In reply to Matthew Auld

Intended for upstream testing so that we can still exercise the LMEM plumbing and !HAS_MAPPABLE_APERTURE paths. Smoke tested on Skull Canyon device. This works by allocating an intel_memory_region for a reserved portion of system memory, which we treat like LMEM. For the LMEMBAR we steal the aperture and 1:1 it map to the stolen region.

To enable simply set i915_fake_lmem_start= on the kernel cmdline with the start of reserved region(see memmap=). The size of the region we can use is determined by the size of the mappable aperture, so the size of reserved region should be >= mappable_end.

eg. memmap=2G$16G i915_fake_lmem_start=0x400000000

Cc Joonas Lahtinen <[email protected]>
Cc Abdiel Janulgue <[email protected]>
---
 arch/x86/kernel/early-quirks.c             | 26 +++++++
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c   |  3 +
 drivers/gpu/drm/i915/i915_drv.c            |  8 ++
 drivers/gpu/drm/i915/i915_gem_gtt.c        |  3 +
 drivers/gpu/drm/i915/intel_memory_region.h |  6 ++
 drivers/gpu/drm/i915/intel_region_lmem.c   | 90 ++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_region_lmem.h   |  5 ++
 include/drm/i915_drm.h                     |  3 +
 8 files changed, 144 insertions(+)
arch/x86/kernel/early-quirks.c +26 -0
index 6f6b1d04dadf..9b04655e3926 100644
@@ -603,6 +603,32 @@ static void __init intel_graphics_quirks(int num, int slot, int func)
 	}
 }
 
+struct resource intel_graphics_fake_lmem_res __ro_after_init = DEFINE_RES_MEM(0, 0);
+EXPORT_SYMBOL(intel_graphics_fake_lmem_res);
+
+static int __init early_i915_fake_lmem_init(char *s)
+{
+	u64 start;
+	int ret;
+
+	if (*s == '=')
+		s++;
+
+	ret = kstrtoull(s, 16, &start);
+	if (ret)
+		return ret;
+
+	intel_graphics_fake_lmem_res.start = start;
+	intel_graphics_fake_lmem_res.end = SZ_2G; /* Placeholder; depends on aperture size */
+
+	printk(KERN_INFO "Intel graphics fake LMEM starts at %pa\n",
+	       &intel_graphics_fake_lmem_res.start);
+
+	return 0;
+}
+
+early_param("i915_fake_lmem_start", early_i915_fake_lmem_init);
+
 static void __init force_disable_hpet(int num, int slot, int func)
 {
 #ifdef CONFIG_HPET_TIMER
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +3 -0
index d7ec74ed5b88..c5e75c2f2511 100644
@@ -23,6 +23,7 @@ void __iomem *i915_gem_object_lmem_io_map_page(struct drm_i915_gem_object *obj,
 	resource_size_t offset;
 
 	offset = i915_gem_object_get_dma_address(obj, n);
+	offset -= obj->mm.region->region.start;
 
 	return io_mapping_map_wc(&obj->mm.region->iomap, offset, PAGE_SIZE);
 }
@@ -33,6 +34,7 @@ void __iomem *i915_gem_object_lmem_io_map_page_atomic(struct drm_i915_gem_object
 	resource_size_t offset;
 
 	offset = i915_gem_object_get_dma_address(obj, n);
+	offset -= obj->mm.region->region.start;
 
 	return io_mapping_map_atomic_wc(&obj->mm.region->iomap, offset);
 }
@@ -46,6 +48,7 @@ void __iomem *i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
 	GEM_BUG_ON(!(obj->flags & I915_BO_ALLOC_CONTIGUOUS));
 
 	offset = i915_gem_object_get_dma_address(obj, n);
+	offset -= obj->mm.region->region.start;
 
 	return io_mapping_map_wc(&obj->mm.region->iomap, offset, size);
 }
drivers/gpu/drm/i915/i915_drv.c +8 -0
index 91aae56b4280..98fa1932c4aa 100644
@@ -1546,6 +1546,14 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (!i915_modparams.nuclear_pageflip && match_info->gen < 5)
 		dev_priv->drm.driver_features &= ~DRIVER_ATOMIC;
 
+	/* Check if we support fake LMEM -- enable for live selftests */
+	if (INTEL_GEN(dev_priv) >= 9 && i915_selftest.live &&
+	    intel_graphics_fake_lmem_res.start) {
+		mkwrite_device_info(dev_priv)->memory_regions =
+			REGION_SMEM | REGION_LMEM;
+		GEM_BUG_ON(!HAS_LMEM(dev_priv));
+	}
+
 	ret = pci_enable_device(pdev);
 	if (ret)
 		goto out_fini;
drivers/gpu/drm/i915/i915_gem_gtt.c +3 -0
index 29f9c43b2c68..02d2a6266b8c 100644
@@ -2778,6 +2778,9 @@ int i915_gem_init_memory_regions(struct drm_i915_private *i915)
 		case INTEL_STOLEN:
 			mem = i915_gem_stolen_setup(i915);
 			break;
+		case INTEL_LMEM:
+			mem = intel_setup_fake_lmem(i915);
+			break;
 		}
 
 		if (IS_ERR(mem)) {
drivers/gpu/drm/i915/intel_memory_region.h +6 -0
index 9ef2ec760a4b..61f0da075805 100644
@@ -9,6 +9,7 @@
 #include <linux/ioport.h>
 #include <linux/mutex.h>
 #include <linux/io-mapping.h>
+#include <drm/drm_mm.h>
 
 #include "i915_buddy.h"
 
@@ -70,6 +71,9 @@ struct intel_memory_region {
 	struct io_mapping iomap;
 	struct resource region;
 
+	/* For faking for lmem */
+	struct drm_mm_node fake_mappable;
+
 	struct i915_buddy_mm mm;
 	struct mutex mm_lock;
 
@@ -80,6 +84,8 @@ struct intel_memory_region {
 	unsigned int instance;
 	unsigned int id;
 
+	dma_addr_t remap_addr;
+
 	/* Protects access to objects and purgeable */
 	struct mutex obj_lock;
 	struct list_head objects;
drivers/gpu/drm/i915/intel_region_lmem.c +90 -0

108 lines not on this page · raw message

drivers/gpu/drm/i915/intel_region_lmem.h +5 -0
index ed2a3bab6443..213def7c7b8a 100644
@@ -6,6 +6,11 @@
 #ifndef __INTEL_REGION_LMEM_H
 #define __INTEL_REGION_LMEM_H
 
+struct drm_i915_private;
+
 extern const struct intel_memory_region_ops intel_region_lmem_ops;
 
+struct intel_memory_region *
+intel_setup_fake_lmem(struct drm_i915_private *i915);
+
 #endif /* !__INTEL_REGION_LMEM_H */
include/drm/i915_drm.h +3 -0
index 6722005884db..271980225deb 100644
@@ -39,6 +39,9 @@ bool i915_gpu_turbo_disable(void);
 /* Exported from arch/x86/kernel/early-quirks.c */
 extern struct resource intel_graphics_stolen_res;
 
+/* Exported from arch/x86/kernel/early-printk.c */
+extern struct resource intel_graphics_fake_lmem_res;
+
 /*
  * The Bridge device's PCI config space has information about the
  * fb aperture size and the amount of pre-reserved memory.
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#46 lore raw

✗ Fi.CI.CHECKPATCH: warning for LMEM basics

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: LMEM basics
URL : https://patchwork.freedesktop.org/series/67350/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
ccc51e3ac24e drm/i915: check for kernel_context
dbbfe24cafca drm/i915: simplify i915_gem_init_early
f52b9b0685d8 drm/i915: introduce intel_memory_region
-:59: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#59: 
new file mode 100644

-:562: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct intel_memory_region *' should also have an identifier name #562: FILE: drivers/gpu/drm/i915/intel_memory_region.h:25:
+ int (*init)(struct intel_memory_region *);

-:563: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct intel_memory_region *' should also have an identifier name #563: FILE: drivers/gpu/drm/i915/intel_memory_region.h:26:
+ void (*release)(struct intel_memory_region *);

-:565: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct intel_memory_region *' should also have an identifier name #565: FILE: drivers/gpu/drm/i915/intel_memory_region.h:28:
+ struct drm_i915_gem_object *

-:565: WARNING:FUNCTION_ARGUMENTS: function definition argument 'resource_size_t' should also have an identifier name #565: FILE: drivers/gpu/drm/i915/intel_memory_region.h:28:
+ struct drm_i915_gem_object *

-:565: WARNING:FUNCTION_ARGUMENTS: function definition argument 'unsigned int' should also have an identifier name #565: FILE: drivers/gpu/drm/i915/intel_memory_region.h:28:
+ struct drm_i915_gem_object *

-:580: CHECK:UNCOMMENTED_DEFINITION: struct mutex definition without comment #580: FILE: drivers/gpu/drm/i915/intel_memory_region.h:43:
+ struct mutex mm_lock;

-:599: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #599: FILE: drivers/gpu/drm/i915/intel_memory_region.h:62:
+__intel_memory_region_get_block_buddy(struct intel_memory_region *mem,
+ resource_size_t size);

-:601: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #601: FILE: drivers/gpu/drm/i915/intel_memory_region.h:64:
+void __intel_memory_region_put_pages_buddy(struct intel_memory_region *mem,
+ struct list_head *blocks);

-:709: WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'igt_mock_fill', this function's name, in a string #709: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:80:
+ pr_err("igt_mock_fill failed, space still left in region\n");

total: 0 errors, 7 warnings, 3 checks, 759 lines checked 6d8c4bbbc790 drm/i915/region: support continuous allocations -:227: WARNING:LINE_SPACING: Missing a blank line after declarations #227: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:133:
+ LIST_HEAD(holes);
+ I915_RND_STATE(prng);

total: 0 errors, 1 warnings, 0 checks, 307 lines checked
c6f24f30618c drm/i915/region: support volatile objects
b5655dcc6d84 drm/i915: Add memory region information to device_info
a066bf23d40b drm/i915: support creating LMEM objects
-:35: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #35:
new file mode 100644

-:117: WARNING:TYPO_SPELLING: 'UKNOWN' may be misspelled - perhaps 'UNKNOWN'? #117: FILE: drivers/gpu/drm/i915/i915_drv.h:684:
+ struct intel_memory_region *regions[INTEL_MEMORY_UKNOWN];

-:168: WARNING:TYPO_SPELLING: 'UKNOWN' may be misspelled - perhaps 'UNKNOWN'? #168: FILE: drivers/gpu/drm/i915/intel_memory_region.h:33:
+ INTEL_MEMORY_UKNOWN, /* Should be last */

-:177: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'r' may be better as '(r)' to avoid precedence issues #177: FILE: drivers/gpu/drm/i915/intel_memory_region.h:42:
+#define MEMORY_TYPE_FROM_REGION(r) (ilog2(r >> INTEL_MEMORY_TYPE_SHIFT))

-:178: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'r' may be better as '(r)' to avoid precedence issues #178: FILE: drivers/gpu/drm/i915/intel_memory_region.h:43:
+#define MEMORY_INSTANCE_FROM_REGION(r) (ilog2(r & 0xffff))

total: 0 errors, 3 warnings, 2 checks, 265 lines checked 63ad9888746c drm/i915: setup io-mapping for LMEM
-:7: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 34 lines checked 1dd672af1e42 drm/i915/lmem: support kernel mapping
-:289: ERROR:CODE_INDENT: code indent should use tabs where possible #289: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:323:
+^I^I^I val);$

-:289: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #289: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:323:
+ pr_err("vaddr[%u]=%u, val=%u\n", dword, vaddr[dword],
+ val);

-:301: ERROR:CODE_INDENT: code indent should use tabs where possible #301: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:335:
+^I^I^I val ^ 0xdeadbeaf);$

-:301: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #301: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:335:
+ pr_err("vaddr[%u]=%u, val=%u\n", dword, vaddr[dword],
+ val ^ 0xdeadbeaf);

total: 2 errors, 0 warnings, 2 checks, 263 lines checked 76154df5dd82 drm/i915/selftests: add write-dword test for LMEM -:19: CHECK:LINE_SPACING: Please don't use multiple blank lines #19: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:10:

+

-:96: WARNING:LINE_SPACING: Missing a blank line after declarations #96: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:321:
+ struct intel_context *ce;
+ I915_RND_STATE(prng);

-:176: WARNING:LINE_SPACING: Missing a blank line after declarations #176: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:415:
+ struct drm_file *file;
+ I915_RND_STATE(prng);

total: 0 errors, 2 warnings, 1 checks, 210 lines checked 970fd335c3b3 drm/i915/selftest: extend coverage to include LMEM huge-pages -:7: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 151 lines checked 91e43c262159 drm/i915: enumerate and init each supported region 19270051b021 drm/i915: treat shmem as a region
-:7: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:116: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #116: FILE: drivers/gpu/drm/i915/gem/i915_gem_shmem.c:444:
+static int __create_shmem(struct drm_i915_private *i915,
struct drm_gem_object *obj,

-:128: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #128: FILE: drivers/gpu/drm/i915/gem/i915_gem_shmem.c:467:
+ unsigned flags)

-:190: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 17) #190: FILE: drivers/gpu/drm/i915/gem/i915_gem_shmem.c:591:
+ if (err)
+ DRM_NOTE("Unable to create a private tmpfs mount, hugepage support will be disabled(%d).\n", err);

-:191: WARNING:LONG_LINE: line over 100 characters #191: FILE: drivers/gpu/drm/i915/gem/i915_gem_shmem.c:592:
+ DRM_NOTE("Unable to create a private tmpfs mount, hugepage support will be disabled(%d).\n", err);

total: 0 errors, 4 warnings, 1 checks, 346 lines checked
82bde2d03644 drm/i915: treat stolen as a region
8355d01685d9 drm/i915: define HAS_MAPPABLE_APERTURE
-:20: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'dev_priv' may be better as '(dev_priv)' to avoid precedence issues #20: FILE: drivers/gpu/drm/i915/i915_drv.h:2122:
+#define HAS_MAPPABLE_APERTURE(dev_priv) (dev_priv->ggtt.mappable_end > 0)

total: 0 errors, 0 warnings, 1 checks, 8 lines checked 2199f453f083 drm/i915: do not map aperture if it is not available. -:38: CHECK:SPACING: No space is necessary after a cast #38: FILE: drivers/gpu/drm/i915/i915_gem_gtt.c:3046:
+ (struct resource) DEFINE_RES_MEM(pci_resource_start(pdev, 2),

total: 0 errors, 0 warnings, 1 checks, 53 lines checked 4a7487273a64 drm/i915: set num_fence_regs to 0 if there is no aperture 9d82c4a319bc drm/i915/selftests: check for missing aperture f722fde71ba0 drm/i915: error capture with no ggtt slot -:175: WARNING:LINE_SPACING: Missing a blank line after declarations #175: FILE: drivers/gpu/drm/i915/i915_gpu_error.c:1720:
+ const u64 slot = ggtt->error_capture.start;
+ ggtt->vm.clear_range(&ggtt->vm, slot, PAGE_SIZE);

total: 0 errors, 1 warnings, 0 checks, 149 lines checked
097c34ca5081 drm/i915: Don't try to place HWS in non-existing mappable region
2f657bf00d3c drm/i915: check for missing aperture in GTT pread/pwrite paths
e2124597ca45 HAX drm/i915: add the fake lmem region
-:49: WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... #49: FILE: arch/x86/kernel/early-quirks.c:624:
+ printk(KERN_INFO "Intel graphics fake LMEM starts at %pa\n",

total: 0 errors, 1 warnings, 0 checks, 228 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#47 lore raw

✗ Fi.CI.SPARSE: warning for LMEM basics

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: LMEM basics
URL : https://patchwork.freedesktop.org/series/67350/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.6.0
Commit: drm/i915: check for kernel_context
Okay!

Commit: drm/i915: simplify i915_gem_init_early
Okay!

Commit: drm/i915: introduce intel_memory_region
Okay!

Commit: drm/i915/region: support continuous allocations +drivers/gpu/drm/i915/selftests/intel_memory_region.c:118:6: warning: symbol 'igt_object_release' was not declared. Should it be static?

Commit: drm/i915/region: support volatile objects
Okay!

Commit: drm/i915: Add memory region information to device_info Okay!

Commit: drm/i915: support creating LMEM objects
Okay!

Commit: drm/i915: setup io-mapping for LMEM
Okay!

Commit: drm/i915/lmem: support kernel mapping
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:177:42: expected void [noderef] <asn:2> *vaddr
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:177:42: got void *[assigned] ptr
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:177:42: warning: incorrect type in argument 1 (different address spaces)
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:254:51: expected void *
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:254:51: got void [noderef] <asn:2> *
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:254:51: warning: incorrect type in return expression (different address spaces)
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:335:42: expected void [noderef] <asn:2> *vaddr
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:335:42: got void *[assigned] ptr
+drivers/gpu/drm/i915/gem/i915_gem_pages.c:335:42: warning: incorrect type in argument 1 (different address spaces)

Commit: drm/i915/selftests: add write-dword test for LMEM Okay!

Commit: drm/i915/selftest: extend coverage to include LMEM huge-pages Okay!

Commit: drm/i915: enumerate and init each supported region Okay!

Commit: drm/i915: treat shmem as a region
Okay!

Commit: drm/i915: treat stolen as a region
Okay!

Commit: drm/i915: define HAS_MAPPABLE_APERTURE
Okay!

Commit: drm/i915: do not map aperture if it is not available. Okay!

Commit: drm/i915: set num_fence_regs to 0 if there is no aperture Okay!

Commit: drm/i915/selftests: check for missing aperture Okay!

Commit: drm/i915: error capture with no ggtt slot
-
+drivers/gpu/drm/i915/i915_gpu_error.c:1027:55: expected void *src
+drivers/gpu/drm/i915/i915_gpu_error.c:1027:55: got void [noderef] <asn:2> *[assigned] s
+drivers/gpu/drm/i915/i915_gpu_error.c:1027:55: warning: incorrect type in argument 2 (different address spaces)

Commit: drm/i915: Don't try to place HWS in non-existing mappable region Okay!

Commit: drm/i915: check for missing aperture in GTT pread/pwrite paths Okay!

Commit: HAX drm/i915: add the fake lmem region
Okay!

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#48 lore raw

✓ Fi.CI.BAT: success for LMEM basics

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: LMEM basics
URL : https://patchwork.freedesktop.org/series/67350/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6970 -> Patchwork_14569
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/index.html

New tests
---------

New tests have been introduced between CI_DRM_6970 and Patchwork_14569:

### New IGT tests (1) ###

* igt@i915_selftest@live_memory_region:
- Statuses : 46 pass(s)
- Exec time: [0.36, 2.33] s

Known issues
------------

Here are the changes found in Patchwork_14569 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_mmap_gtt@basic-small-bo:
- fi-icl-u3: [PASS][1] -> [DMESG-WARN][2] ([fdo#107724])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/fi-icl-u3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/fi-icl-u3/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u2: [PASS][3] -> [FAIL][4] ([fdo#103167])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/fi-icl-u2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/fi-icl-u2/igt@[email protected]

#### Possible fixes ####

* igt@debugfs_test@read_all_entries:
- {fi-tgl-u2}: [DMESG-WARN][5] ([fdo#111600]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/fi-tgl-u2/igt@debugfs_test@read_all_entries.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/fi-tgl-u2/igt@debugfs_test@read_all_entries.html

* igt@gem_exec_reloc@basic-cpu:
- fi-icl-u3: [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8] +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/fi-icl-u3/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/fi-icl-u3/igt@[email protected]

#### Warnings ####

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][9] ([fdo#111407]) -> [FAIL][10] ([fdo#111045] / [fdo#111096])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/fi-kbl-7500u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/fi-kbl-7500u/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[fdo#111600]: https://bugs.freedesktop.org/show_bug.cgi?id=111600

Participating hosts (53 -> 46)
------------------------------

Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6970 -> Patchwork_14569

CI-20190529: 20190529
CI_DRM_6970: ee94847f064c84de51b33d8d843aa6bde51a8af6 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5206: 5a6c68568def840cd720f18fc66f529a89f84675 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14569: e2124597ca45de1ae9d5166f4df166817780c8fd @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

e2124597ca45 HAX drm/i915: add the fake lmem region
2f657bf00d3c drm/i915: check for missing aperture in GTT pread/pwrite paths 097c34ca5081 drm/i915: Don't try to place HWS in non-existing mappable region f722fde71ba0 drm/i915: error capture with no ggtt slot 9d82c4a319bc drm/i915/selftests: check for missing aperture 4a7487273a64 drm/i915: set num_fence_regs to 0 if there is no aperture 2199f453f083 drm/i915: do not map aperture if it is not available. 8355d01685d9 drm/i915: define HAS_MAPPABLE_APERTURE
82bde2d03644 drm/i915: treat stolen as a region
19270051b021 drm/i915: treat shmem as a region
91e43c262159 drm/i915: enumerate and init each supported region 970fd335c3b3 drm/i915/selftest: extend coverage to include LMEM huge-pages 76154df5dd82 drm/i915/selftests: add write-dword test for LMEM 1dd672af1e42 drm/i915/lmem: support kernel mapping
63ad9888746c drm/i915: setup io-mapping for LMEM
a066bf23d40b drm/i915: support creating LMEM objects
b5655dcc6d84 drm/i915: Add memory region information to device_info c6f24f30618c drm/i915/region: support volatile objects 6d8c4bbbc790 drm/i915/region: support continuous allocations f52b9b0685d8 drm/i915: introduce intel_memory_region
dbbfe24cafca drm/i915: simplify i915_gem_init_early
ccc51e3ac24e drm/i915: check for kernel_context

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#49 lore raw

✗ Fi.CI.IGT: failure for LMEM basics

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: LMEM basics
URL : https://patchwork.freedesktop.org/series/67350/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6970_full -> Patchwork_14569_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_14569_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_14569_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_14569_full:

### IGT changes ###

#### Possible regressions ####

* igt@i915_pm_rpm@system-suspend-execbuf:
- shard-iclb: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb8/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb3/igt@[email protected]

New tests
---------

New tests have been introduced between CI_DRM_6970_full and Patchwork_14569_full:

### New IGT tests (2) ###

* igt@i915_selftest@live_memory_region:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@mock_memory_region:
- Statuses :
- Exec time: [None] s

Known issues
------------

Here are the changes found in Patchwork_14569_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#110841])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb2/igt@[email protected]

* igt@gem_exec_schedule@wide-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325]) +4 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb3/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb2/igt@[email protected]

* igt@gem_exec_suspend@basic-s3:
- shard-skl: [PASS][7] -> [INCOMPLETE][8] ([fdo#104108])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-skl8/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-skl5/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-128x42-random:
- shard-iclb: [PASS][9] -> [INCOMPLETE][10] ([fdo#107713]) +1 similar issue
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb6/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb1/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-suspend:
- shard-skl: [PASS][11] -> [INCOMPLETE][12] ([fdo#110741])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-skl9/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-skl10/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible:
- shard-skl: [PASS][13] -> [FAIL][14] ([fdo#100368])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-skl1/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-skl1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-rgb565-draw-render:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +3 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb6/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb1/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- shard-apl: [PASS][17] -> [DMESG-WARN][18] ([fdo#108566]) +3 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-apl3/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-apl4/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: [PASS][19] -> [FAIL][20] ([fdo#108145] / [fdo#110403])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-skl9/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-skl10/igt@[email protected]

* igt@kms_psr@psr2_sprite_mmap_cpu:
- shard-iclb: [PASS][21] -> [SKIP][22] ([fdo#109441])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_cpu.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb4/igt@kms_psr@psr2_sprite_mmap_cpu.html

* igt@perf@polling:
- shard-skl: [PASS][23] -> [FAIL][24] ([fdo#110728])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-skl10/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-skl9/igt@[email protected]

* igt@prime_busy@hang-bsd2:
- shard-iclb: [PASS][25] -> [SKIP][26] ([fdo#109276]) +13 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb1/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb7/igt@[email protected]

* igt@sw_sync@sync_expired_merge:
- shard-apl: [PASS][27] -> [INCOMPLETE][28] ([fdo#103927])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-apl8/igt@sw_sync@sync_expired_merge.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-apl5/igt@sw_sync@sync_expired_merge.html

#### Possible fixes ####

* igt@gem_exec_schedule@fifo-bsd1:
- shard-iclb: [SKIP][29] ([fdo#109276]) -> [PASS][30] +8 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb5/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@preempt-other-chain-bsd:
- shard-iclb: [SKIP][31] ([fdo#111325]) -> [PASS][32] +4 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb4/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb3/igt@[email protected]

* igt@gem_exec_schedule@wide-vebox:
- shard-apl: [INCOMPLETE][33] ([fdo#103927]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-apl7/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-apl8/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-apl: [DMESG-WARN][35] ([fdo#108566]) -> [PASS][36] +3 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-apl7/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-apl5/igt@[email protected]

* igt@gem_workarounds@suspend-resume-fd:
- shard-skl: [INCOMPLETE][37] ([fdo#104108]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-skl9/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-skl3/igt@[email protected]

* {igt@i915_pm_dc@dc6-dpms}:
- shard-iclb: [FAIL][39] ([fdo#110548]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb3/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt:
- shard-iclb: [FAIL][41] ([fdo#103167]) -> [PASS][42] +2 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb6/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb4/igt@[email protected]

* igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: [FAIL][43] ([fdo#103166]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb8/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb3/igt@[email protected]

* igt@kms_psr@psr2_cursor_mmap_cpu:
- shard-iclb: [SKIP][45] ([fdo#109441]) -> [PASS][46] +1 similar issue
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb4/igt@kms_psr@psr2_cursor_mmap_cpu.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html

* igt@kms_setmode@basic:
- shard-hsw: [FAIL][47] ([fdo#99912]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-hsw1/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-hsw5/igt@[email protected]

#### Warnings ####

* igt@gem_ctx_isolation@vcs1-nonpriv:
- shard-iclb: [SKIP][49] ([fdo#109276]) -> [FAIL][50] ([fdo#111329])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb3/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb1/igt@[email protected]

* igt@gem_mocs_settings@mocs-settings-bsd2:
- shard-iclb: [FAIL][51] ([fdo#111330]) -> [SKIP][52] ([fdo#109276]) +1 similar issue
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-iclb1/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-iclb7/igt@[email protected]

* igt@kms_content_protection@atomic:
- shard-apl: [FAIL][53] ([fdo#110321] / [fdo#110336]) -> [INCOMPLETE][54] ([fdo#103927])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6970/shard-apl3/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/shard-apl1/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#100368]: https://bugs.freedesktop.org/show_bug.cgi?id=100368
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
[fdo#110336]: https://bugs.freedesktop.org/show_bug.cgi?id=110336
[fdo#110403]: https://bugs.freedesktop.org/show_bug.cgi?id=110403
[fdo#110548]: https://bugs.freedesktop.org/show_bug.cgi?id=110548
[fdo#110728]: https://bugs.freedesktop.org/show_bug.cgi?id=110728
[fdo#110741]: https://bugs.freedesktop.org/show_bug.cgi?id=110741
[fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111329]: https://bugs.freedesktop.org/show_bug.cgi?id=111329
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (16 -> 10)
------------------------------

Missing (6): shard-tglb1 shard-tglb2 shard-tglb3 shard-tglb4 shard-tglb5 shard-tglb6

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6970 -> Patchwork_14569

CI-20190529: 20190529
CI_DRM_6970: ee94847f064c84de51b33d8d843aa6bde51a8af6 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5206: 5a6c68568def840cd720f18fc66f529a89f84675 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14569: e2124597ca45de1ae9d5166f4df166817780c8fd @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14569/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx