drm/i915/gt: Split logical ring contexts from execlist submission
PATCH 1/2 drm/i915/gt: Split logical ring contexts from execlist submission
Split the definition, construction and updating of the Logical Ring Context from the execlist submission interface. The LRC is used by the HW, irrespective of our different submission backends.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gt/gen8_engine_cs.c | 2 +- drivers/gpu/drm/i915/gt/intel_context_sseu.c | 3 +- .../drm/i915/gt/intel_execlists_submission.c | 1683 +-------------- .../drm/i915/gt/intel_execlists_submission.h | 17 - drivers/gpu/drm/i915/gt/intel_lrc.c | 1579 ++++++++++++++ drivers/gpu/drm/i915/gt/intel_lrc.h | 85 + drivers/gpu/drm/i915/gt/intel_lrc_reg.h | 2 + drivers/gpu/drm/i915/gt/selftest_execlists.c | 1776 +--------------- drivers/gpu/drm/i915/gt/selftest_lrc.c | 1861 +++++++++++++++++ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 2 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 26 +- drivers/gpu/drm/i915/gvt/scheduler.c | 1 + drivers/gpu/drm/i915/i915_perf.c | 2 +- 14 files changed, 3618 insertions(+), 3422 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_lrc.c create mode 100644 drivers/gpu/drm/i915/gt/intel_lrc.h create mode 100644 drivers/gpu/drm/i915/gt/selftest_lrc.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -104,6 +104,7 @@ gt-y += \ gt/intel_gt_requests.o \ gt/intel_gtt.o \ gt/intel_llc.o \ + gt/intel_lrc.o \ gt/intel_mocs.o \ gt/intel_ppgtt.o \ gt/intel_rc6.o \
drivers/gpu/drm/i915/gt/gen8_engine_cs.c +1 -1
@@ -5,7 +5,7 @@#include "gen8_engine_cs.h" #include "i915_drv.h" -#include "intel_execlists_submission.h" /* XXX */ +#include "intel_lrc.h" #include "intel_gpu_commands.h" #include "intel_ring.h"
drivers/gpu/drm/i915/gt/intel_context_sseu.c +1 -2
@@ -8,8 +8,7 @@#include "intel_context.h" #include "intel_engine_pm.h" #include "intel_gpu_commands.h" -#include "intel_execlists_submission.h" -#include "intel_lrc_reg.h" +#include "intel_lrc.h" #include "intel_ring.h" #include "intel_sseu.h"
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +60 -1623
1,862 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_execlists_submission.h +0 -17
@@ -22,25 +22,8 @@ enum {int intel_execlists_submission_setup (struct intel_engine_cs *engine); -/* Logical Ring Contexts */ -/* At the start of the context image is its per-process HWS page */ -#define LRC_PPHWSP_PN (0) -#define LRC_PPHWSP_SZ (1) -/* After the PPHWSP we have the logical state for the context */ -#define LRC_STATE_PN (LRC_PPHWSP_PN + LRC_PPHWSP_SZ) -#define LRC_STATE_OFFSET (LRC_STATE_PN * PAGE_SIZE) - -/* Space within PPHWSP reserved to be used as scratch */ -#define LRC_PPHWSP_SCRATCH 0x34 -#define LRC_PPHWSP_SCRATCH_ADDR (LRC_PPHWSP_SCRATCH * sizeof(u32)) -void intel_execlists_set_default_submission (struct intel_engine_cs *engine); -void intel_lr_context_reset (struct intel_engine_cs *engine, -struct intel_context *ce, -u32 head, -bool scrub); - void intel_execlists_show_requests(struct intel_engine_cs *engine, struct drm_printer *m, void (*show_request)(struct drm_printer *m,
drivers/gpu/drm/i915/gt/intel_lrc.c new file +1579 -0
1,089 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_lrc.h new file +85 -0
85 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_lrc_reg.h +2 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/i915/gt/selftest_execlists.c +1 -1775
1,776 lines not on this page · raw message
drivers/gpu/drm/i915/gt/selftest_lrc.c new file +1861 -0
1,861 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +24 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Part of the diff is not shown here. View the raw message.
PATCH 2/2 drm/i915/gt: Provide a utility to create a scratch buffer
Primarily used by selftests, but also by runtime debugging of engine w/a, is a routine to create a temporarily bound buffer for readback. Almagamate the duplicated routines into one.
--- drivers/gpu/drm/i915/gt/intel_gtt.c | 29 +++++++++++++++ drivers/gpu/drm/i915/gt/intel_gtt.h | 3 ++ drivers/gpu/drm/i915/gt/intel_workarounds.c | 36 ++----------------- drivers/gpu/drm/i915/gt/selftest_execlists.c | 30 ++-------------- drivers/gpu/drm/i915/gt/selftest_lrc.c | 24 +------------ drivers/gpu/drm/i915/gt/selftest_mocs.c | 29 +-------------- .../gpu/drm/i915/gt/selftest_workarounds.c | 11 +++--- 7 files changed, 45 insertions(+), 117 deletions(-)
drivers/gpu/drm/i915/gt/intel_gtt.c +29 -0
@@ -422,6 +422,35 @@ void setup_private_pat(struct intel_uncore *uncore)bdw_setup_private_ppat (uncore); } +struct i915_vma * +__vm_create_scratch_for_read (struct i915_address_space *vm,unsigned long size) +{ +struct drm_i915_gem_object *obj; +struct i915_vma *vma; +int err; + + obj =i915_gem_object_create_internal (vm->i915,PAGE_ALIGN (size)); +if (IS_ERR (obj)) +return ERR_CAST (obj); + +i915_gem_object_set_cache_coherency (obj,I915_CACHING_CACHED ); + + vma =i915_vma_instance (obj, vm,NULL ); +if (IS_ERR (vma)) { +i915_gem_object_put (obj); +return vma; + } + + err =i915_vma_pin (vma,0 ,0 , +i915_vma_is_ggtt (vma) ?PIN_GLOBAL :PIN_USER ); +if (err) { +i915_vma_put (vma); +return ERR_PTR (err); + } + +return vma; +} +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )#include "selftests/mock_gtt.c" #endif
drivers/gpu/drm/i915/gt/intel_gtt.h +3 -0
@@ -573,6 +573,9 @@ int i915_vm_pin_pt_stash(struct i915_address_space *vm,void i915_vm_free_pt_stash (struct i915_address_space *vm,struct i915_vm_pt_stash *stash); +struct i915_vma * +__vm_create_scratch_for_read (struct i915_address_space *vm,unsigned long size); + static inline struct sgt_dma { struct scatterlist *sg; dma_addr_t dma, max;
drivers/gpu/drm/i915/gt/intel_workarounds.c +2 -34
@@ -2086,39 +2086,6 @@ void intel_engine_apply_workarounds(struct intel_engine_cs *engine)wa_list_apply (engine->uncore, &engine->wa_list); } -static struct i915_vma * -create_scratch (struct i915_address_space *vm,int count) -{ -struct drm_i915_gem_object *obj; -struct i915_vma *vma; -unsigned int size; -int err; - - size =round_up (count *sizeof (u32),PAGE_SIZE ); - obj =i915_gem_object_create_internal (vm->i915, size); -if (IS_ERR (obj)) -return ERR_CAST (obj); - -i915_gem_object_set_cache_coherency (obj,I915_CACHE_LLC ); - - vma =i915_vma_instance (obj, vm,NULL ); -if (IS_ERR (vma)) { - err =PTR_ERR (vma); - goto err_obj; - } - - err =i915_vma_pin (vma,0 ,0 , -i915_vma_is_ggtt (vma) ?PIN_GLOBAL :PIN_USER ); -if (err) - goto err_obj; - -return vma; - -err_obj: -i915_gem_object_put (obj); -return ERR_PTR (err); -} -struct mcr_range {u32 start;u32 end;
@@ -2221,7 +2188,8 @@ static int engine_wa_list_verify(struct intel_context *ce,if (!wal->count)return 0 ; - vma =create_scratch (&ce->engine->gt->ggtt->vm, wal->count); + vma =__vm_create_scratch_for_read (&ce->engine->gt->ggtt->vm, + wal->count *sizeof (u32));if (IS_ERR (vma))return PTR_ERR (vma);
drivers/gpu/drm/i915/gt/selftest_execlists.c +2 -28
@@ -25,33 +25,6 @@#define NUM_GPR 16#define NUM_GPR_DW (NUM_GPR * 2)/* each GPR is 2 dwords */ -static struct i915_vma *create_scratch (struct intel_gt *gt) -{ -struct drm_i915_gem_object *obj; -struct i915_vma *vma; -int err; - - obj =i915_gem_object_create_internal (gt->i915,PAGE_SIZE ); -if (IS_ERR (obj)) -return ERR_CAST (obj); - -i915_gem_object_set_cache_coherency (obj,I915_CACHING_CACHED ); - - vma =i915_vma_instance (obj, >->ggtt->vm,NULL ); -if (IS_ERR (vma)) { -i915_gem_object_put (obj); -return vma; - } - - err =i915_vma_pin (vma,0 ,0 ,PIN_GLOBAL ); -if (err) { -i915_gem_object_put (obj); -return ERR_PTR (err); - } - -return vma; -} -static bool is_active (struct i915_request *rq) {if (i915_request_is_active (rq))
@@ -4167,7 +4140,8 @@ static int preserved_virtual_engine(struct intel_gt *gt,int err =0 ;u32 *cs; - scratch =create_scratch (siblings[0 ]->gt); + scratch =__vm_create_scratch_for_read (&siblings[0 ]->gt->ggtt->vm, +PAGE_SIZE );if (IS_ERR (scratch))return PTR_ERR (scratch);
drivers/gpu/drm/i915/gt/selftest_lrc.c +1 -23
@@ -27,29 +27,7 @@static struct i915_vma *create_scratch (struct intel_gt *gt) { -struct drm_i915_gem_object *obj; -struct i915_vma *vma; -int err; - - obj =i915_gem_object_create_internal (gt->i915,PAGE_SIZE ); -if (IS_ERR (obj)) -return ERR_CAST (obj); - -i915_gem_object_set_cache_coherency (obj,I915_CACHING_CACHED ); - - vma =i915_vma_instance (obj, >->ggtt->vm,NULL ); -if (IS_ERR (vma)) { -i915_gem_object_put (obj); -return vma; - } - - err =i915_vma_pin (vma,0 ,0 ,PIN_GLOBAL ); -if (err) { -i915_gem_object_put (obj); -return ERR_PTR (err); - } - -return vma; +return __vm_create_scratch_for_read (>->ggtt->vm,PAGE_SIZE ); }static bool is_active (struct i915_request *rq)
drivers/gpu/drm/i915/gt/selftest_mocs.c +1 -28
@@ -57,33 +57,6 @@ static int request_add_spin(struct i915_request *rq, struct igt_spinner *spin)return err; } -static struct i915_vma *create_scratch (struct intel_gt *gt) -{ -struct drm_i915_gem_object *obj; -struct i915_vma *vma; -int err; - - obj =i915_gem_object_create_internal (gt->i915,PAGE_SIZE ); -if (IS_ERR (obj)) -return ERR_CAST (obj); - -i915_gem_object_set_cache_coherency (obj,I915_CACHING_CACHED ); - - vma =i915_vma_instance (obj, >->ggtt->vm,NULL ); -if (IS_ERR (vma)) { -i915_gem_object_put (obj); -return vma; - } - - err =i915_vma_pin (vma,0 ,0 ,PIN_GLOBAL ); -if (err) { -i915_gem_object_put (obj); -return ERR_PTR (err); - } - -return vma; -} -static int live_mocs_init (struct live_mocs *arg,struct intel_gt *gt) {struct drm_i915_mocs_table table;
@@ -102,7 +75,7 @@ static int live_mocs_init(struct live_mocs *arg, struct intel_gt *gt)if (flags & (HAS_GLOBAL_MOCS |HAS_ENGINE_MOCS )) arg->mocs = table; - arg->scratch =create_scratch (gt); + arg->scratch =__vm_create_scratch_for_read (>->ggtt->vm,PAGE_SIZE );if (IS_ERR (arg->scratch))return PTR_ERR (arg->scratch);
drivers/gpu/drm/i915/gt/selftest_workarounds.c +7 -4
@@ -486,10 +486,11 @@ static int check_dirty_whitelist(struct intel_context *ce)struct intel_engine_cs *engine = ce->engine;struct i915_vma *scratch;struct i915_vma *batch; -int err =0 , i, v; +int err =0 , i, v, sz;u32 *cs, *results; - scratch =create_scratch (ce->vm,2 *ARRAY_SIZE (values) +1 ); + sz = (2 *ARRAY_SIZE (values) +1 ) *sizeof (u32); + scratch =__vm_create_scratch_for_read (ce->vm, sz);if (IS_ERR (scratch))return PTR_ERR (scratch);
@@ -1028,13 +1029,15 @@ static int live_isolated_whitelist(void *arg)return 0 ;for (i =0 ; i <ARRAY_SIZE (client); i++) { - client[i].scratch[0 ] =create_scratch (gt->vm,1024 ); + client[i].scratch[0 ] = +__vm_create_scratch_for_read (gt->vm,4096 );if (IS_ERR (client[i].scratch[0 ])) { err =PTR_ERR (client[i].scratch[0 ]); goto err; } - client[i].scratch[1 ] =create_scratch (gt->vm,1024 ); + client[i].scratch[1 ] = +__vm_create_scratch_for_read (gt->vm,4096 );if (IS_ERR (client[i].scratch[1 ])) { err =PTR_ERR (client[i].scratch[1 ]);i915_vma_unpin_and_release (&client[i].scratch[0 ],0 );
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission
URL : https://patchwork.freedesktop.org/series/85095/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 0fd013ab16e2 drm/i915/gt: Split logical ring contexts from execlist submission -:1882: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1882: FILE: drivers/gpu/drm/i915/gt/intel_execlists_submission.c:3406: +static int virtual_context_pre_pin(struct intel_context *ce, + struct i915_gem_ww_ctx *ww,
-:1974: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #1974:
new file mode 100644
-:2005: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'count' - possible side-effects? #2005: FILE: drivers/gpu/drm/i915/gt/intel_lrc.c:27:
+#define LRI(count, flags) ((flags) << 6 | (count) | BUILD_BUG_ON_ZERO(count >= BIT(6)))
-:2007: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'x' - possible side-effects? #2007: FILE: drivers/gpu/drm/i915/gt/intel_lrc.c:29:
+#define REG(x) (((x) >> 2) | BUILD_BUG_ON_ZERO(x >= 0x200))
-:2008: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #2008: FILE: drivers/gpu/drm/i915/gt/intel_lrc.c:30:
+#define REG16(x) \
+ (((x) >> 9) | BIT(7) | BUILD_BUG_ON_ZERO(x >= 0x10000)), \
+ (((x) >> 2) & 0x7f)
-:2008: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'x' - possible side-effects? #2008: FILE: drivers/gpu/drm/i915/gt/intel_lrc.c:30:
+#define REG16(x) \
+ (((x) >> 9) | BIT(7) | BUILD_BUG_ON_ZERO(x >= 0x10000)), \
+ (((x) >> 2) & 0x7f)
-:2011: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #2011: FILE: drivers/gpu/drm/i915/gt/intel_lrc.c:33:
+#define END(total_state_size) 0, (total_state_size)
-:6092: WARNING:MEMORY_BARRIER: memory barrier without comment #6092: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:634:
+ wmb();
-:6121: WARNING:MEMORY_BARRIER: memory barrier without comment #6121: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:663:
+ wmb();
-:6253: WARNING:MEMORY_BARRIER: memory barrier without comment #6253: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:795:
+ wmb();
-:6801: WARNING:MEMORY_BARRIER: memory barrier without comment #6801: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:1343:
+ wmb();
-:7215: WARNING:LINE_SPACING: Missing a blank line after declarations #7215: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:1757:
+ struct i915_request *rq;
+ IGT_TIMEOUT(end_time);
total: 2 errors, 6 warnings, 4 checks, 5523 lines checked 1d13fb4c2906 drm/i915/gt: Provide a utility to create a scratch buffer
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission
URL : https://patchwork.freedesktop.org/series/85095/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_9506 -> Patchwork_19182
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/index.html
Known issues
------------
Here are the changes found in Patchwork_19182 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_cs_nop@nop-gfx0:
- fi-apl-guc: NOTRUN -> [SKIP][1] ([fdo#109271]) +17 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-apl-guc/igt@amdgpu/[email protected]
* igt@gem_exec_suspend@basic-s3:
- fi-tgl-u2: [PASS][2] -> [FAIL][3] ([i915#1888])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-u2/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-tgl-u2/igt@[email protected]
* igt@gem_flink_basic@basic:
- fi-tgl-y: [PASS][4] -> [DMESG-WARN][5] ([i915#402]) +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-y/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-tgl-y/igt@[email protected]
* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: [PASS][6] -> [DMESG-FAIL][7] ([i915#2291] / [i915#541])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
#### Possible fixes ####
* igt@i915_selftest@live@gt_timelines:
- fi-apl-guc: [INCOMPLETE][8] ([i915#2750]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-apl-guc/igt@i915_selftest@live@gt_timelines.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-apl-guc/igt@i915_selftest@live@gt_timelines.html
* igt@prime_self_import@basic-with_two_bos:
- fi-tgl-y: [DMESG-WARN][10] ([i915#402]) -> [PASS][11] +1 similar issue
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-y/igt@prime_self_import@basic-with_two_bos.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-tgl-y/igt@prime_self_import@basic-with_two_bos.html
#### Warnings ####
* igt@debugfs_test@read_all_entries:
- fi-tgl-y: [DMESG-WARN][12] ([i915#402]) -> [DMESG-WARN][13] ([i915#1982] / [i915#402])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-y/igt@debugfs_test@read_all_entries.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-tgl-y/igt@debugfs_test@read_all_entries.html
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
[i915#2750]: https://gitlab.freedesktop.org/drm/intel/issues/2750
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#541]: https://gitlab.freedesktop.org/drm/intel/issues/541
Participating hosts (43 -> 39)
------------------------------
Missing (4): fi-ilk-m540 fi-bsw-cyan fi-bdw-samus fi-hsw-4200u
Build changes
-------------
* Linux: CI_DRM_9506 -> Patchwork_19182
CI-20190529: 20190529
CI_DRM_9506: fe289d6c234d4e7ed53d0df1b7c7330f195f3689 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5910: 67b56a31dcb10a2301d818c8641b5f6b53b272e7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19182: 1d13fb4c2906e06036e4813150b5babfaa6b6b6c @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
1d13fb4c2906 drm/i915/gt: Provide a utility to create a scratch buffer 0fd013ab16e2 drm/i915/gt: Split logical ring contexts from execlist submission
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx