[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission

2020-12-18 Thread Patchwork
== 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/85105/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9506 -> Patchwork_19184


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_19184 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_19184, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-apl-guc: [PASS][1] -> [DMESG-WARN][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-apl-guc/igt@kms_pipe_crc_ba...@suspend-read-crc-pipe-a.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19184/fi-apl-guc/igt@kms_pipe_crc_ba...@suspend-read-crc-pipe-a.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@runner@aborted:
- fi-apl-guc: NOTRUN -> [FAIL][3] ([fdo#109271] / [i915#1814] / 
[i915#2426])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19184/fi-apl-guc/igt@run...@aborted.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
  [i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426


Participating hosts (43 -> 37)
--

  Missing(6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-bsw-kefka fi-tgl-y 
fi-bdw-samus 


Build changes
-

  * Linux: CI_DRM_9506 -> Patchwork_19184

  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_19184: b9d0ad833b5c6f4e9631d2bc8b752dada65a821a @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

b9d0ad833b5c drm/i915/gt: Provide a utility to create a scratch buffer
5dd14c1bb771 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_19184/index.html
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission

2020-12-18 Thread Patchwork
== 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/85105/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
5dd14c1bb771 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 >= 0x1)), \
+   (((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 >= 0x1)), \
+   (((x) >> 2) & 0x7f)

-:6071: WARNING:MEMORY_BARRIER: memory barrier without comment
#6071: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:634:
+   wmb();

-:6100: WARNING:MEMORY_BARRIER: memory barrier without comment
#6100: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:663:
+   wmb();

-:6232: WARNING:MEMORY_BARRIER: memory barrier without comment
#6232: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:795:
+   wmb();

-:6780: WARNING:MEMORY_BARRIER: memory barrier without comment
#6780: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:1343:
+   wmb();

-:7194: WARNING:LINE_SPACING: Missing a blank line after declarations
#7194: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:1757:
+   struct i915_request *rq;
+   IGT_TIMEOUT(end_time);

total: 1 errors, 6 warnings, 4 checks, 5502 lines checked
b9d0ad833b5c drm/i915/gt: Provide a utility to create a scratch buffer


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [CI 2/2] drm/i915/gt: Provide a utility to create a scratch buffer

2020-12-18 Thread Chris Wilson
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.

Suggested-by: Daniele Ceraolo Spurio 
Signed-off-by: Chris Wilson 
Reviewed-by: Daniele Ceraolo Spurio 
---
 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(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.c 
b/drivers/gpu/drm/i915/gt/intel_gtt.c
index 7bfe9072be9a..04aa6601e984 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.c
@@ -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
diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h 
b/drivers/gpu/drm/i915/gt/intel_gtt.h
index 8a33940a71f3..29c10fde8ce3 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -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;
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 38868c5c038e..42d320e68b60 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -2086,39 +2086,6 @@ void intel_engine_apply_workarounds(struct 
intel_engine_cs *engine)
wa_list_apply(engine->uncore, >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(>engine->gt->ggtt->vm, wal->count);
+   vma = __vm_create_scratch_for_read(>engine->gt->ggtt->vm,
+  wal->count * sizeof(u32));
if (IS_ERR(vma))
return PTR_ERR(vma);
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_execlists.c 
b/drivers/gpu/drm/i915/gt/selftest_execlists.c
index 34c2bb8313eb..7f2a6421f220 100644
--- a/drivers/gpu/drm/i915/gt/selftest_execlists.c
+++ b/drivers/gpu/drm/i915/gt/selftest_execlists.c
@@ -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);
-
-   

[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission

2020-12-18 Thread Patchwork
== 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/85096/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9506 -> Patchwork_19183


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_19183 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_19183, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@i915_selftest@live@gem_contexts:
- fi-bdw-5557u:   [PASS][1] -> [INCOMPLETE][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-bdw-5557u/igt@i915_selftest@live@gem_contexts.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-bdw-5557u/igt@i915_selftest@live@gem_contexts.html

  * igt@i915_selftest@live@gt_lrc:
- fi-cml-u2:  [PASS][3] -> [DMESG-WARN][4]
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-cml-u2/igt@i915_selftest@live@gt_lrc.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-cml-u2/igt@i915_selftest@live@gt_lrc.html
- fi-bsw-n3050:   [PASS][5] -> [INCOMPLETE][6]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html
- fi-cfl-guc: [PASS][7] -> [INCOMPLETE][8]
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-cfl-guc/igt@i915_selftest@live@gt_lrc.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-cfl-guc/igt@i915_selftest@live@gt_lrc.html
- fi-kbl-soraka:  [PASS][9] -> [INCOMPLETE][10]
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-soraka/igt@i915_selftest@live@gt_lrc.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-kbl-soraka/igt@i915_selftest@live@gt_lrc.html
- fi-bsw-kefka:   [PASS][11] -> [INCOMPLETE][12]
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-bsw-kefka/igt@i915_selftest@live@gt_lrc.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-bsw-kefka/igt@i915_selftest@live@gt_lrc.html
- fi-cml-s:   [PASS][13] -> [INCOMPLETE][14]
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-cml-s/igt@i915_selftest@live@gt_lrc.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-cml-s/igt@i915_selftest@live@gt_lrc.html
- fi-kbl-x1275:   [PASS][15] -> [DMESG-WARN][16]
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-x1275/igt@i915_selftest@live@gt_lrc.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-kbl-x1275/igt@i915_selftest@live@gt_lrc.html
- fi-glk-dsi: [PASS][17] -> [INCOMPLETE][18]
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-glk-dsi/igt@i915_selftest@live@gt_lrc.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-glk-dsi/igt@i915_selftest@live@gt_lrc.html
- fi-kbl-r:   [PASS][19] -> [INCOMPLETE][20]
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-r/igt@i915_selftest@live@gt_lrc.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-kbl-r/igt@i915_selftest@live@gt_lrc.html
- fi-kbl-guc: [PASS][21] -> [DMESG-WARN][22] +1 similar issue
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-guc/igt@i915_selftest@live@gt_lrc.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-kbl-guc/igt@i915_selftest@live@gt_lrc.html
- fi-icl-y:   [PASS][23] -> [INCOMPLETE][24]
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-icl-y/igt@i915_selftest@live@gt_lrc.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-icl-y/igt@i915_selftest@live@gt_lrc.html
- fi-kbl-7500u:   [PASS][25] -> [INCOMPLETE][26]
   [25]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-7500u/igt@i915_selftest@live@gt_lrc.html
   [26]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-kbl-7500u/igt@i915_selftest@live@gt_lrc.html
- fi-bsw-nick:[PASS][27] -> [DMESG-WARN][28]
   [27]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-bsw-nick/igt@i915_selftest@live@gt_lrc.html
   [28]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19183/fi-bsw-nick/igt@i915_selftest@live@gt_lrc.html
- fi-cfl-8109u:   [PASS][29] -> 

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission

2020-12-18 Thread Patchwork
== 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/85096/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
15e1c6d96de6 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 >= 0x1)), \
+   (((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 >= 0x1)), \
+   (((x) >> 2) & 0x7f)

-:6071: WARNING:MEMORY_BARRIER: memory barrier without comment
#6071: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:634:
+   wmb();

-:6100: WARNING:MEMORY_BARRIER: memory barrier without comment
#6100: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:663:
+   wmb();

-:6232: WARNING:MEMORY_BARRIER: memory barrier without comment
#6232: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:795:
+   wmb();

-:6780: WARNING:MEMORY_BARRIER: memory barrier without comment
#6780: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:1343:
+   wmb();

-:7194: WARNING:LINE_SPACING: Missing a blank line after declarations
#7194: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:1757:
+   struct i915_request *rq;
+   IGT_TIMEOUT(end_time);

total: 1 errors, 6 warnings, 4 checks, 5502 lines checked
0c40aa440b7b drm/i915/gt: Provide a utility to create a scratch buffer


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission

2020-12-18 Thread Patchwork
== 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/amd_cs_...@nop-gfx0.html

  * 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@gem_exec_susp...@basic-s3.html
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-tgl-u2/igt@gem_exec_susp...@basic-s3.html

  * 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@gem_flink_ba...@basic.html
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19182/fi-tgl-y/igt@gem_flink_ba...@basic.html

  * 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [CI,1/2] drm/i915/gt: Split logical ring contexts from execlist submission

2020-12-18 Thread Patchwork
== 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 >= 0x1)), \
+   (((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 >= 0x1)), \
+   (((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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v9,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format

2020-12-18 Thread Patchwork
== Series Details ==

Series: series starting with [v9,1/5] drm: Add function to convert rect in 
16.16 fixed format to regular format
URL   : https://patchwork.freedesktop.org/series/85092/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9506 -> Patchwork_19181


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_19181 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_19181, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-tgl-y:   [PASS][1] -> [FAIL][2] +3 similar issues
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-y/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/fi-tgl-y/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html

  * igt@kms_cursor_legacy@basic-flip-before-cursor-legacy:
- fi-tgl-u2:  [PASS][3] -> [FAIL][4] +3 similar issues
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-u2/igt@kms_cursor_leg...@basic-flip-before-cursor-legacy.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/fi-tgl-u2/igt@kms_cursor_leg...@basic-flip-before-cursor-legacy.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@amdgpu/amd_cs_nop@nop-gfx0:
- fi-apl-guc: NOTRUN -> [SKIP][5] ([fdo#109271]) +17 similar issues
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/fi-apl-guc/igt@amdgpu/amd_cs_...@nop-gfx0.html

  * igt@gem_flink_basic@double-flink:
- fi-tgl-y:   [PASS][6] -> [DMESG-WARN][7] ([i915#402]) +2 similar 
issues
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-y/igt@gem_flink_ba...@double-flink.html
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/fi-tgl-y/igt@gem_flink_ba...@double-flink.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-tgl-u2:  [PASS][8] -> [DMESG-WARN][9] ([i915#402])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-u2/igt@kms_pipe_crc_ba...@suspend-read-crc-pipe-a.html
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/fi-tgl-u2/igt@kms_pipe_crc_ba...@suspend-read-crc-pipe-a.html

  
 Possible fixes 

  * igt@debugfs_test@read_all_entries:
- fi-tgl-y:   [DMESG-WARN][10] ([i915#402]) -> [PASS][11] +2 
similar issues
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-tgl-y/igt@debugfs_test@read_all_entries.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/fi-tgl-y/igt@debugfs_test@read_all_entries.html

  * igt@i915_selftest@live@gt_timelines:
- fi-apl-guc: [INCOMPLETE][12] ([i915#2750]) -> [PASS][13]
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-apl-guc/igt@i915_selftest@live@gt_timelines.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/fi-apl-guc/igt@i915_selftest@live@gt_timelines.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#2750]: https://gitlab.freedesktop.org/drm/intel/issues/2750
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402


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_19181

  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_19181: f2e2c14d1cbc725cb3af49363a8303e86305dd4a @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

f2e2c14d1cbc HAX/DO_NOT_MERGE_IT: drm/i915/display: Enable PSR2 selective fetch 
for testing
a476ea73ddef drm/i915/display/psr: Program plane's calculated offset to plane 
SF register
e1037ef26961 drm/i915/display: Split and export main surface calculation from 
skl_check_main_surface()
6e7dbde66422 drm/i915/display/psr: Use plane damage clips to calculate damaged 
area
9f59d653af13 drm: Add function to convert rect in 16.16 fixed format to regular 
format

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19181/index.html
___
Intel-gfx mailing 

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v9,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format

2020-12-18 Thread Patchwork
== Series Details ==

Series: series starting with [v9,1/5] drm: Add function to convert rect in 
16.16 fixed format to regular format
URL   : https://patchwork.freedesktop.org/series/85092/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: 

[Intel-gfx] ✗ Fi.CI.BAT: failure for Introduce Intel PXP component - Mesa single session (rev13)

2020-12-18 Thread Patchwork
== Series Details ==

Series: Introduce Intel PXP component - Mesa single session (rev13)
URL   : https://patchwork.freedesktop.org/series/84620/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9506 -> Patchwork_19180


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_19180 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_19180, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@core_hotunplug@unbind-rebind:
- fi-skl-6700k2:  [PASS][1] -> [DMESG-WARN][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-skl-6700k2/igt@core_hotunp...@unbind-rebind.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-skl-6700k2/igt@core_hotunp...@unbind-rebind.html
- fi-elk-e7500:   [PASS][3] -> [DMESG-WARN][4]
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-elk-e7500/igt@core_hotunp...@unbind-rebind.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-elk-e7500/igt@core_hotunp...@unbind-rebind.html
- fi-ivb-3770:[PASS][5] -> [DMESG-WARN][6]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-ivb-3770/igt@core_hotunp...@unbind-rebind.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-ivb-3770/igt@core_hotunp...@unbind-rebind.html
- fi-ilk-650: [PASS][7] -> [DMESG-WARN][8]
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-ilk-650/igt@core_hotunp...@unbind-rebind.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-ilk-650/igt@core_hotunp...@unbind-rebind.html
- fi-bsw-n3050:   [PASS][9] -> [DMESG-WARN][10]
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-bsw-n3050/igt@core_hotunp...@unbind-rebind.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-bsw-n3050/igt@core_hotunp...@unbind-rebind.html
- fi-cfl-guc: [PASS][11] -> [DMESG-WARN][12]
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-cfl-guc/igt@core_hotunp...@unbind-rebind.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-cfl-guc/igt@core_hotunp...@unbind-rebind.html
- fi-skl-6600u:   [PASS][13] -> [DMESG-WARN][14]
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-skl-6600u/igt@core_hotunp...@unbind-rebind.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-skl-6600u/igt@core_hotunp...@unbind-rebind.html
- fi-pnv-d510:[PASS][15] -> [DMESG-WARN][16]
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-pnv-d510/igt@core_hotunp...@unbind-rebind.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-pnv-d510/igt@core_hotunp...@unbind-rebind.html
- fi-cml-s:   [PASS][17] -> [DMESG-WARN][18]
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-cml-s/igt@core_hotunp...@unbind-rebind.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-cml-s/igt@core_hotunp...@unbind-rebind.html
- fi-kbl-soraka:  [PASS][19] -> [DMESG-WARN][20]
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-soraka/igt@core_hotunp...@unbind-rebind.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-kbl-soraka/igt@core_hotunp...@unbind-rebind.html
- fi-bxt-dsi: [PASS][21] -> [DMESG-WARN][22]
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-bxt-dsi/igt@core_hotunp...@unbind-rebind.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-bxt-dsi/igt@core_hotunp...@unbind-rebind.html
- fi-snb-2520m:   [PASS][23] -> [DMESG-WARN][24]
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-snb-2520m/igt@core_hotunp...@unbind-rebind.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-snb-2520m/igt@core_hotunp...@unbind-rebind.html
- fi-kbl-r:   [PASS][25] -> [DMESG-WARN][26]
   [25]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-kbl-r/igt@core_hotunp...@unbind-rebind.html
   [26]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-kbl-r/igt@core_hotunp...@unbind-rebind.html
- fi-cfl-8700k:   [PASS][27] -> [DMESG-WARN][28]
   [27]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9506/fi-cfl-8700k/igt@core_hotunp...@unbind-rebind.html
   [28]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19180/fi-cfl-8700k/igt@core_hotunp...@unbind-rebind.html
- fi-byt-j1900:   [PASS][29] -> 

[Intel-gfx] [CI 2/2] drm/i915/gt: Provide a utility to create a scratch buffer

2020-12-18 Thread Chris Wilson
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.

Suggested-by: Daniele Ceraolo Spurio 
Signed-off-by: Chris Wilson 
Reviewed-by: Daniele Ceraolo Spurio 
---
 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(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.c 
b/drivers/gpu/drm/i915/gt/intel_gtt.c
index 7bfe9072be9a..04aa6601e984 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.c
@@ -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
diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h 
b/drivers/gpu/drm/i915/gt/intel_gtt.h
index 8a33940a71f3..29c10fde8ce3 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -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;
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 38868c5c038e..42d320e68b60 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -2086,39 +2086,6 @@ void intel_engine_apply_workarounds(struct 
intel_engine_cs *engine)
wa_list_apply(engine->uncore, >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(>engine->gt->ggtt->vm, wal->count);
+   vma = __vm_create_scratch_for_read(>engine->gt->ggtt->vm,
+  wal->count * sizeof(u32));
if (IS_ERR(vma))
return PTR_ERR(vma);
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_execlists.c 
b/drivers/gpu/drm/i915/gt/selftest_execlists.c
index 34c2bb8313eb..7f2a6421f220 100644
--- a/drivers/gpu/drm/i915/gt/selftest_execlists.c
+++ b/drivers/gpu/drm/i915/gt/selftest_execlists.c
@@ -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);
-
-   

[Intel-gfx] [CI 2/2] drm/i915/gt: Provide a utility to create a scratch buffer

2020-12-18 Thread Chris Wilson
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.

Suggested-by: Daniele Ceraolo Spurio 
Signed-off-by: Chris Wilson 
Reviewed-by: Daniele Ceraolo Spurio 
---
 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(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.c 
b/drivers/gpu/drm/i915/gt/intel_gtt.c
index 7bfe9072be9a..04aa6601e984 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.c
@@ -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
diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h 
b/drivers/gpu/drm/i915/gt/intel_gtt.h
index 8a33940a71f3..29c10fde8ce3 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -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;
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 38868c5c038e..42d320e68b60 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -2086,39 +2086,6 @@ void intel_engine_apply_workarounds(struct 
intel_engine_cs *engine)
wa_list_apply(engine->uncore, >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(>engine->gt->ggtt->vm, wal->count);
+   vma = __vm_create_scratch_for_read(>engine->gt->ggtt->vm,
+  wal->count * sizeof(u32));
if (IS_ERR(vma))
return PTR_ERR(vma);
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_execlists.c 
b/drivers/gpu/drm/i915/gt/selftest_execlists.c
index 34c2bb8313eb..7f2a6421f220 100644
--- a/drivers/gpu/drm/i915/gt/selftest_execlists.c
+++ b/drivers/gpu/drm/i915/gt/selftest_execlists.c
@@ -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);
-
-   

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Introduce Intel PXP component - Mesa single session (rev13)

2020-12-18 Thread Patchwork
== Series Details ==

Series: Introduce Intel PXP component - Mesa single session (rev13)
URL   : https://patchwork.freedesktop.org/series/84620/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
+drivers/gpu/drm/i915/pxp/intel_pxp_arb.c:68:5: warning: symbol 
'intel_pxp_arb_reserve_session' was not declared. Should it be static?


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Introduce Intel PXP component - Mesa single session (rev13)

2020-12-18 Thread Patchwork
== Series Details ==

Series: Introduce Intel PXP component - Mesa single session (rev13)
URL   : https://patchwork.freedesktop.org/series/84620/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
24242191f906 drm/i915/pxp: Introduce Intel PXP component
-:118: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#118: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 188 lines checked
b44bfcf946c2 drm/i915/pxp: set KCR reg init during the boot time
6d35a31a3ddf drm/i915/pxp: Implement funcs to create the TEE channel
-:8: WARNING:TYPO_SPELLING: 'defualt' may be misspelled - perhaps 'default'?
#8: 
(defualt) session.

-:83: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#83: 
new file mode 100644

total: 0 errors, 2 warnings, 0 checks, 247 lines checked
84d6354a8d45 drm/i915/pxp: Create the arbitrary session after boot
-:68: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#68: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 299 lines checked
c1c70bd76f1a drm/i915/pxp: Func to send hardware session termination
-:53: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#53: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 222 lines checked
2fdfbcaf09ad drm/i915/pxp: Enable PXP irq worker and callback stub
-:51: WARNING:LONG_LINE_COMMENT: line length of 113 exceeds 100 columns
#51: FILE: drivers/gpu/drm/i915/i915_reg.h:7970:
+#define GEN11_CRYPTO_INTR_MASK _MMIO(0x1900f0) /* crypto mask is in 
bit31-16 (Engine1 Interrupt Mask) */

total: 0 errors, 1 warnings, 0 checks, 230 lines checked
9fd582c50f53 drm/i915/pxp: Destroy arb session upon teardown
d052c32eca47 drm/i915/pxp: Enable PXP power management
-:78: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#78: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 148 lines checked
f1d2d57e3405 drm/i915/pxp: Expose session state for display protection flip
e2b0fe9fd9c4 mei: pxp: export pavp client to me client bus
-:32: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does 
MAINTAINERS need updating?
#32: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 277 lines checked
9bd00aa714e0 drm/i915/uapi: introduce drm_i915_gem_create_ext
-:12: ERROR:BAD_SIGN_OFF: Unrecognized email address: 'Joonas Lahtinen 
joonas.lahti...@linux.intel.com'
#12: 
Cc: Joonas Lahtinen joonas.lahti...@linux.intel.com

-:13: ERROR:BAD_SIGN_OFF: Unrecognized email address: 'Matthew Auld 
matthew.a...@intel.com'
#13: 
Cc: Matthew Auld matthew.a...@intel.com

-:46: ERROR:CODE_INDENT: code indent should use tabs where possible
#46: FILE: drivers/gpu/drm/i915/i915_gem.c:265:
+struct drm_i915_private *i915;$

-:46: WARNING:LEADING_SPACE: please, no spaces at the start of a line
#46: FILE: drivers/gpu/drm/i915/i915_gem.c:265:
+struct drm_i915_private *i915;$

-:50: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#50: FILE: drivers/gpu/drm/i915/i915_gem.c:269:
+static int __create_setparam(struct drm_i915_gem_object_param *args,
+   struct create_ext 
*ext_data)

-:95: CHECK:LINE_SPACING: Please don't use multiple blank lines
#95: FILE: drivers/gpu/drm/i915/i915_gem.c:317:
+
+

-:107: WARNING:LONG_LINE: line length of 120 exceeds 100 columns
#107: FILE: include/uapi/drm/i915_drm.h:395:
+#define DRM_IOCTL_I915_GEM_CREATE_EXT   DRM_IOWR(DRM_COMMAND_BASE + 
DRM_I915_GEM_CREATE, struct drm_i915_gem_create_ext)

-:155: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV)
#155: FILE: include/uapi/drm/i915_drm.h:1736:
+#define I915_OBJECT_PARAM  (1ull<<32)
 ^

total: 3 errors, 2 warnings, 3 checks, 136 lines checked
d7e50ab23f0b drm/i915/pxp: User interface for Protected buffer
889eb67c0ecf drm/i915/pxp: Add plane decryption support


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/dg1: Fix power gate sequence.

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915/dg1: Fix power gate sequence.
URL   : https://patchwork.freedesktop.org/series/85082/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9503_full -> Patchwork_19179_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_ctx_persistence@legacy-engines-cleanup:
- shard-hsw:  NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#1099])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-hsw4/igt@gem_ctx_persiste...@legacy-engines-cleanup.html

  * igt@gem_exec_reloc@basic-wide-active@vcs1:
- shard-iclb: NOTRUN -> [FAIL][2] ([i915#2389]) +1 similar issue
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-iclb2/igt@gem_exec_reloc@basic-wide-act...@vcs1.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-skl:  NOTRUN -> [FAIL][3] ([i915#454]) +1 similar issue
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl8/igt@i915_pm...@dc6-dpms.html

  * igt@kms_big_fb@yf-tiled-8bpp-rotate-270:
- shard-glk:  NOTRUN -> [SKIP][4] ([fdo#109271]) +17 similar issues
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-glk1/igt@kms_big...@yf-tiled-8bpp-rotate-270.html

  * igt@kms_chamelium@hdmi-edid-change-during-suspend:
- shard-apl:  NOTRUN -> [SKIP][5] ([fdo#109271] / [fdo#111827]) +3 
similar issues
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-apl1/igt@kms_chamel...@hdmi-edid-change-during-suspend.html

  * igt@kms_chamelium@hdmi-hpd-for-each-pipe:
- shard-hsw:  NOTRUN -> [SKIP][6] ([fdo#109271] / [fdo#111827]) +2 
similar issues
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-hsw4/igt@kms_chamel...@hdmi-hpd-for-each-pipe.html

  * igt@kms_chamelium@hdmi-mode-timings:
- shard-glk:  NOTRUN -> [SKIP][7] ([fdo#109271] / [fdo#111827]) +3 
similar issues
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-glk1/igt@kms_chamel...@hdmi-mode-timings.html

  * igt@kms_color_chamelium@pipe-c-gamma:
- shard-skl:  NOTRUN -> [SKIP][8] ([fdo#109271] / [fdo#111827]) +4 
similar issues
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl8/igt@kms_color_chamel...@pipe-c-gamma.html

  * igt@kms_cursor_crc@pipe-a-cursor-suspend:
- shard-skl:  [PASS][9] -> [INCOMPLETE][10] ([i915#2295] / 
[i915#300])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl1/igt@kms_cursor_...@pipe-a-cursor-suspend.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl5/igt@kms_cursor_...@pipe-a-cursor-suspend.html

  * igt@kms_cursor_crc@pipe-b-cursor-256x256-sliding:
- shard-skl:  [PASS][11] -> [FAIL][12] ([i915#54])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl9/igt@kms_cursor_...@pipe-b-cursor-256x256-sliding.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl8/igt@kms_cursor_...@pipe-b-cursor-256x256-sliding.html

  * igt@kms_cursor_legacy@pipe-d-torture-bo:
- shard-apl:  NOTRUN -> [SKIP][13] ([fdo#109271] / [i915#533])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-apl1/igt@kms_cursor_leg...@pipe-d-torture-bo.html

  * igt@kms_flip@2x-flip-vs-panning-vs-hang:
- shard-skl:  NOTRUN -> [SKIP][14] ([fdo#109271]) +34 similar issues
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl8/igt@kms_f...@2x-flip-vs-panning-vs-hang.html

  * igt@kms_flip@flip-vs-expired-vblank-interruptible@a-edp1:
- shard-skl:  [PASS][15] -> [FAIL][16] ([i915#79]) +1 similar issue
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl1/igt@kms_flip@flip-vs-expired-vblank-interrupti...@a-edp1.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl5/igt@kms_flip@flip-vs-expired-vblank-interrupti...@a-edp1.html

  * igt@kms_flip@flip-vs-suspend-interruptible@b-edp1:
- shard-skl:  [PASS][17] -> [INCOMPLETE][18] ([i915#198])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl3/igt@kms_flip@flip-vs-suspend-interrupti...@b-edp1.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl9/igt@kms_flip@flip-vs-suspend-interrupti...@b-edp1.html

  * igt@kms_flip@plain-flip-fb-recreate@b-edp1:
- shard-skl:  [PASS][19] -> [FAIL][20] ([i915#2122])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl2/igt@kms_flip@plain-flip-fb-recre...@b-edp1.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/shard-skl1/igt@kms_flip@plain-flip-fb-recre...@b-edp1.html

  * 

Re: [Intel-gfx] [PATCH] drm/i915/dg1: Fix power gate sequence.

2020-12-18 Thread Chris Wilson
Quoting Rodrigo Vivi (2020-12-18 15:24:12)
> sub-pipe PG is not present on DG1. Setting these bits can disable
> other power gates and cause GPU hangs on video playbacks.

Hmm, all I see is "not valid for pre-gen12".

> Fixes: 85a12d7eb8fe ("drm/i915/tgl: Fix Media power gate sequence.")
> Cc: Dale B Stimson 
> Cc: Chris Wilson 
> Signed-off-by: Rodrigo Vivi 
Acked-by: Chris Wilson 
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v9 5/5] HAX/DO_NOT_MERGE_IT: drm/i915/display: Enable PSR2 selective fetch for testing

2020-12-18 Thread José Roberto de Souza
Enabling it to check if it causes regressions in CI but the feature is
still not ready to be enabled by default.

Signed-off-by: José Roberto de Souza 
---
 drivers/gpu/drm/i915/i915_params.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_params.h 
b/drivers/gpu/drm/i915/i915_params.h
index 330c03e2b4f7..b8b19270c339 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -54,7 +54,7 @@ struct drm_printer;
param(int, enable_fbc, -1, 0600) \
param(int, enable_psr, -1, 0600) \
param(bool, psr_safest_params, false, 0600) \
-   param(bool, enable_psr2_sel_fetch, false, 0600) \
+   param(bool, enable_psr2_sel_fetch, true, 0600) \
param(int, disable_power_well, -1, 0400) \
param(int, enable_ips, 1, 0600) \
param(int, invert_brightness, 0, 0600) \
-- 
2.29.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v9 4/5] drm/i915/display/psr: Program plane's calculated offset to plane SF register

2020-12-18 Thread José Roberto de Souza
It programs Plane's calculated x, y, offset to Plane SF register.
It does the calculation of x and y offsets using
skl_calc_main_surface_offset().

v3: Update commit message

Cc: Gwan-gyeong Mun 
Cc: Ville Syrjälä 
Signed-off-by: José Roberto de Souza 
Reviewed-by: Gwan-gyeong Mun 
Tested-by: Gwan-gyeong Mun 
---
 drivers/gpu/drm/i915/display/intel_psr.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c
index f5b9519b3756..c24ae69426cf 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1186,7 +1186,8 @@ void intel_psr2_program_plane_sel_fetch(struct 
intel_plane *plane,
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
enum pipe pipe = plane->pipe;
const struct drm_rect *clip;
-   u32 val;
+   u32 val, offset;
+   int ret, x, y;
 
if (!crtc_state->enable_psr2_sel_fetch)
return;
@@ -1203,9 +1204,14 @@ void intel_psr2_program_plane_sel_fetch(struct 
intel_plane *plane,
val |= plane_state->uapi.dst.x1;
intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_POS(pipe, plane->id), val);
 
-   /* TODO: consider tiling and auxiliary surfaces */
-   val = (clip->y1 + plane_state->color_plane[color_plane].y) << 16;
-   val |= plane_state->color_plane[color_plane].x;
+   /* TODO: consider auxiliary surfaces */
+   x = plane_state->uapi.src.x1 >> 16;
+   y = (plane_state->uapi.src.y1 >> 16) + clip->y1;
+   ret = skl_calc_main_surface_offset(plane_state, , , );
+   if (ret)
+   drm_warn_once(_priv->drm, "skl_calc_main_surface_offset() 
returned %i\n",
+ ret);
+   val = y << 16 | x;
intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_OFFSET(pipe, plane->id),
  val);
 
-- 
2.29.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v9 3/5] drm/i915/display: Split and export main surface calculation from skl_check_main_surface()

2020-12-18 Thread José Roberto de Souza
The calculation the offsets of the main surface will be needed by PSR2
selective fetch code so here splitting and exporting it.
No functional changes were done here.

v3: Rebased

Cc: Gwan-gyeong Mun 
Cc: Ville Syrjälä 
Signed-off-by: José Roberto de Souza 
Reviewed-by: Gwan-gyeong Mun 
Tested-by: Gwan-gyeong Mun 
---
 drivers/gpu/drm/i915/display/intel_display.c | 78 
 drivers/gpu/drm/i915/display/intel_display.h |  2 +
 2 files changed, 51 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 78452de5e12f..add74ff7eb9b 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -3821,33 +3821,19 @@ static int intel_plane_max_height(struct intel_plane 
*plane,
return INT_MAX;
 }
 
-static int skl_check_main_surface(struct intel_plane_state *plane_state)
+int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
+int *x, int *y, u32 *offset)
 {
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb;
-   unsigned int rotation = plane_state->hw.rotation;
-   int x = plane_state->uapi.src.x1 >> 16;
-   int y = plane_state->uapi.src.y1 >> 16;
-   int w = drm_rect_width(_state->uapi.src) >> 16;
-   int h = drm_rect_height(_state->uapi.src) >> 16;
-   int min_width = intel_plane_min_width(plane, fb, 0, rotation);
-   int max_width = intel_plane_max_width(plane, fb, 0, rotation);
-   int max_height = intel_plane_max_height(plane, fb, 0, rotation);
-   int aux_plane = intel_main_to_aux_plane(fb, 0);
-   u32 aux_offset = plane_state->color_plane[aux_plane].offset;
-   u32 alignment, offset;
+   const int aux_plane = intel_main_to_aux_plane(fb, 0);
+   const u32 aux_offset = plane_state->color_plane[aux_plane].offset;
+   const u32 alignment = intel_surf_alignment(fb, 0);
+   const int w = drm_rect_width(_state->uapi.src) >> 16;
 
-   if (w > max_width || w < min_width || h > max_height) {
-   drm_dbg_kms(_priv->drm,
-   "requested Y/RGB source size %dx%d outside limits 
(min: %dx1 max: %dx%d)\n",
-   w, h, min_width, max_width, max_height);
-   return -EINVAL;
-   }
-
-   intel_add_fb_offsets(, , plane_state, 0);
-   offset = intel_plane_compute_aligned_offset(, , plane_state, 0);
-   alignment = intel_surf_alignment(fb, 0);
+   intel_add_fb_offsets(x, y, plane_state, 0);
+   *offset = intel_plane_compute_aligned_offset(x, y, plane_state, 0);
if (drm_WARN_ON(_priv->drm, alignment && !is_power_of_2(alignment)))
return -EINVAL;
 
@@ -3856,9 +3842,10 @@ static int skl_check_main_surface(struct 
intel_plane_state *plane_state)
 * main surface offset, and it must be non-negative. Make
 * sure that is what we will get.
 */
-   if (aux_plane && offset > aux_offset)
-   offset = intel_plane_adjust_aligned_offset(, , plane_state, 
0,
-  offset, aux_offset & 
~(alignment - 1));
+   if (aux_plane && *offset > aux_offset)
+   *offset = intel_plane_adjust_aligned_offset(x, y, plane_state, 
0,
+   *offset,
+   aux_offset & 
~(alignment - 1));
 
/*
 * When using an X-tiled surface, the plane blows up
@@ -3869,18 +3856,51 @@ static int skl_check_main_surface(struct 
intel_plane_state *plane_state)
if (fb->modifier == I915_FORMAT_MOD_X_TILED) {
int cpp = fb->format->cpp[0];
 
-   while ((x + w) * cpp > plane_state->color_plane[0].stride) {
-   if (offset == 0) {
+   while ((*x + w) * cpp > plane_state->color_plane[0].stride) {
+   if (*offset == 0) {
drm_dbg_kms(_priv->drm,
"Unable to find suitable display 
surface offset due to X-tiling\n");
return -EINVAL;
}
 
-   offset = intel_plane_adjust_aligned_offset(, , 
plane_state, 0,
-  offset, 
offset - alignment);
+   *offset = intel_plane_adjust_aligned_offset(x, y, 
plane_state, 0,
+   *offset,
+   *offset - 
alignment);
}
}
 
+   return 0;
+}
+
+static int skl_check_main_surface(struct intel_plane_state *plane_state)

[Intel-gfx] [PATCH v9 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

2020-12-18 Thread José Roberto de Souza
Now using plane damage clips property to calcualte the damaged area.
Selective fetch only supports one region to be fetched so software
needs to calculate a bounding box around all damage clips.

Now that we are not complete fetching each plane, there is another
loop needed as all the plane areas that intersect with the pipe
damaged area needs to be fetched from memory so the complete blending
of all planes can happen.

v2:
- do not shifting new_plane_state->uapi.dst only src is in 16.16 format

v4:
- setting plane selective fetch area using the whole pipe damage area
- mark the whole plane area damaged if plane visibility or alpha
changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but are
invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or it
moved to calculate damaged area
- remove from damaged area the portion not in src clip

v7:
- intersec every damage clip with src to minimize damaged area

v8:
- adjust pipe_damaged area to 4 lines grouping
- adjust calculation now that is understood that uapi.src is the
framebuffer coordinates that plane will start to fetch from

v9:
- Only add plane dst or src to damaged_area if visible
- Early skip plane damage calculation if it was not visible in old and
new state

Cc: Ville Syrjälä 
Cc: Gwan-gyeong Mun 
Signed-off-by: José Roberto de Souza 
---
 drivers/gpu/drm/i915/display/intel_psr.c | 113 ---
 1 file changed, 99 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c
index d9a395c486d3..f5b9519b3756 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1242,9 +1242,11 @@ static void psr2_man_trk_ctl_calc(struct 
intel_crtc_state *crtc_state,
if (clip->y1 == -1)
goto exit;
 
+   drm_WARN_ON(crtc_state->uapi.crtc->dev, clip->y1 % 4 || clip->y2 % 4);
+
val |= PSR2_MAN_TRK_CTL_SF_PARTIAL_FRAME_UPDATE;
val |= PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(clip->y1 / 4 + 1);
-   val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(DIV_ROUND_UP(clip->y2, 4) + 
1);
+   val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(clip->y2 / 4 + 1);
 exit:
crtc_state->psr2_man_track_ctl = val;
 }
@@ -1269,8 +1271,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state 
*state,
struct intel_crtc *crtc)
 {
struct intel_crtc_state *crtc_state = 
intel_atomic_get_new_crtc_state(state, crtc);
+   struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX, .y2 = 
-1 };
struct intel_plane_state *new_plane_state, *old_plane_state;
-   struct drm_rect pipe_clip = { .y1 = -1 };
struct intel_plane *plane;
bool full_update = false;
int i, ret;
@@ -1282,13 +1284,25 @@ int intel_psr2_sel_fetch_update(struct 
intel_atomic_state *state,
if (ret)
return ret;
 
+   /*
+* Calculate minimal selective fetch area of each plane and calculate
+* the pipe damaged area.
+* In the next loop the plane selective fetch area will actually be set
+* using whole pipe damaged area.
+*/
for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
 new_plane_state, i) {
-   struct drm_rect *sel_fetch_area, temp;
+   struct drm_rect src, damaged_area = { .y1 = -1 };
+   struct drm_mode_rect *damaged_clips;
+   u32 num_clips, j;
 
if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc)
continue;
 
+   if (!new_plane_state->uapi.visible &&
+   !old_plane_state->uapi.visible)
+   continue;
+
/*
 * TODO: Not clear how to handle planes with negative position,
 * also planes are not updated if they have a negative X
@@ -1300,23 +1314,94 @@ int intel_psr2_sel_fetch_update(struct 
intel_atomic_state *state,
break;
}
 
-   if (!new_plane_state->uapi.visible)
-   continue;
+   num_clips = 
drm_plane_get_damage_clips_count(_plane_state->uapi);
 
/*
-* For now doing a selective fetch in the whole plane area,
-* optimizations will come in the future.
+* If visibility or plane moved, mark the whole plane area as
+* damaged as it needs to be complete redraw in the new and old
+* position.
 */
-   sel_fetch_area = _plane_state->psr2_sel_fetch_area;
-   sel_fetch_area->y1 = new_plane_state->uapi.src.y1 >> 16;
-   sel_fetch_area->y2 = new_plane_state->uapi.src.y2 >> 16;
+   if 

[Intel-gfx] [PATCH v9 1/5] drm: Add function to convert rect in 16.16 fixed format to regular format

2020-12-18 Thread José Roberto de Souza
Much more clear to read one function call than four lines doing this
conversion.

v7:
- function renamed
- calculating width and height before truncate
- inlined

Cc: Ville Syrjälä 
Cc: dri-de...@lists.freedesktop.org
Cc: Gwan-gyeong Mun 
Signed-off-by: José Roberto de Souza 
---
 include/drm/drm_rect.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index e7f4d24cdd00..7eb84af4a818 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -206,6 +206,19 @@ static inline bool drm_rect_equals(const struct drm_rect 
*r1,
r1->y1 == r2->y1 && r1->y2 == r2->y2;
 }
 
+/**
+ * drm_rect_fp_to_int - Convert a rect in 16.16 fixed point form to int form.
+ * @destination: rect to be stored the converted value
+ * @source: rect in 16.16 fixed point form
+ */
+static inline void drm_rect_fp_to_int(struct drm_rect *destination,
+ const struct drm_rect *source)
+{
+   drm_rect_init(destination, source->x1 >> 16, source->y1 >> 16,
+ drm_rect_width(source) >> 16,
+ drm_rect_height(source) >> 16);
+}
+
 bool drm_rect_intersect(struct drm_rect *r, const struct drm_rect *clip);
 bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
  const struct drm_rect *clip);
-- 
2.29.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC-v13 03/13] drm/i915/pxp: Implement funcs to create the TEE channel

2020-12-18 Thread Huang, Sean Z
Implement the funcs to create the TEE channel, so kernel can
send the TEE commands directly to TEE for creating the arbitrary
(defualt) session.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/Makefile|   3 +-
 drivers/gpu/drm/i915/i915_drv.c  |   1 +
 drivers/gpu/drm/i915/i915_drv.h  |   6 ++
 drivers/gpu/drm/i915/pxp/intel_pxp.c |   5 +
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 132 +++
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.h |  14 +++
 include/drm/i915_component.h |   1 +
 include/drm/i915_pxp_tee_interface.h |  45 
 8 files changed, 206 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_tee.h
 create mode 100644 include/drm/i915_pxp_tee_interface.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 53be29dbc07d..57447887d352 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -258,7 +258,8 @@ i915-y += i915_perf.o
 # Protected execution platform (PXP) support
 i915-$(CONFIG_DRM_I915_PXP) += \
pxp/intel_pxp.o \
-   pxp/intel_pxp_context.o
+   pxp/intel_pxp_context.o \
+   pxp/intel_pxp_tee.o
 
 # Post-mortem debug and GPU hang state capture
 i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 5708e11d917b..9299a456adb0 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -322,6 +322,7 @@ static int i915_driver_early_probe(struct drm_i915_private 
*dev_priv)
mutex_init(_priv->wm.wm_mutex);
mutex_init(_priv->pps_mutex);
mutex_init(_priv->hdcp_comp_mutex);
+   mutex_init(_priv->pxp_tee_comp_mutex);
 
i915_memcpy_init_early(dev_priv);
intel_runtime_pm_init_early(_priv->runtime_pm);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c2d0156e8a5d..aaf452115c2f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1212,6 +1212,12 @@ struct drm_i915_private {
/* Mutex to protect the above hdcp component related values. */
struct mutex hdcp_comp_mutex;
 
+   struct i915_pxp_comp_master *pxp_tee_master;
+   bool pxp_tee_comp_added;
+
+   /* Mutex to protect the above pxp_tee component related values. */
+   struct mutex pxp_tee_comp_mutex;
+
I915_SELFTEST_DECLARE(struct i915_selftest_stash selftest;)
 
/*
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index cf22006222ce..5a3461272fe9 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -5,6 +5,7 @@
 #include "i915_drv.h"
 #include "intel_pxp.h"
 #include "intel_pxp_context.h"
+#include "intel_pxp_tee.h"
 
 /* KCR register definitions */
 #define KCR_INIT_MMIO(0x320f0)
@@ -23,10 +24,14 @@ void intel_pxp_init(struct intel_pxp *pxp)
 
intel_uncore_write(gt->uncore, KCR_INIT, 
KCR_INIT_ALLOW_DISPLAY_ME_WRITES);
 
+   intel_pxp_tee_component_init(pxp);
+
drm_info(>i915->drm, "Protected Xe Path (PXP) protected content 
support initialized\n");
 }
 
 void intel_pxp_fini(struct intel_pxp *pxp)
 {
+   intel_pxp_tee_component_fini(pxp);
+
intel_pxp_ctx_fini(>ctx);
 }
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
new file mode 100644
index ..ca6b61099aee
--- /dev/null
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
@@ -0,0 +1,132 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#include 
+#include "drm/i915_pxp_tee_interface.h"
+#include "drm/i915_component.h"
+#include  "i915_drv.h"
+#include "intel_pxp.h"
+#include "intel_pxp_context.h"
+#include "intel_pxp_tee.h"
+
+static int intel_pxp_tee_io_message(struct intel_pxp *pxp,
+   void *msg_in, u32 msg_in_size,
+   void *msg_out, u32 *msg_out_size_ptr,
+   u32 msg_out_buf_size)
+{
+   int ret;
+   struct intel_gt *gt = container_of(pxp, typeof(*gt), pxp);
+   struct drm_i915_private *i915 = gt->i915;
+   struct i915_pxp_comp_master *pxp_tee_master = i915->pxp_tee_master;
+
+   if (!pxp_tee_master || !msg_in || !msg_out || !msg_out_size_ptr)
+   return -EINVAL;
+
+   lockdep_assert_held(>pxp_tee_comp_mutex);
+
+   if (drm_debug_enabled(DRM_UT_DRIVER))
+   print_hex_dump(KERN_DEBUG, "TEE input message binaries:",
+  DUMP_PREFIX_OFFSET, 4, 4, msg_in, msg_in_size, 
true);
+
+   ret = pxp_tee_master->ops->send(pxp_tee_master->tee_dev, msg_in, 
msg_in_size);
+   if (ret) {
+   drm_err(>drm, "Failed to send TEE message\n");
+   return -EFAULT;
+   }
+
+  

[Intel-gfx] [RFC-v13 10/13] mei: pxp: export pavp client to me client bus

2020-12-18 Thread Huang, Sean Z
From: Vitaly Lubart 

Export PAVP client to work with i915_cp driver,
for binding it uses kernel component framework.

Signed-off-by: Vitaly Lubart 
Signed-off-by: Tomas Winkler 
---
 drivers/misc/mei/Kconfig   |   2 +
 drivers/misc/mei/Makefile  |   1 +
 drivers/misc/mei/pxp/Kconfig   |  13 ++
 drivers/misc/mei/pxp/Makefile  |   7 +
 drivers/misc/mei/pxp/mei_pxp.c | 230 +
 drivers/misc/mei/pxp/mei_pxp.h |  18 +++
 6 files changed, 271 insertions(+)
 create mode 100644 drivers/misc/mei/pxp/Kconfig
 create mode 100644 drivers/misc/mei/pxp/Makefile
 create mode 100644 drivers/misc/mei/pxp/mei_pxp.c
 create mode 100644 drivers/misc/mei/pxp/mei_pxp.h

diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig
index f5fd5b786607..0e0bcd0da852 100644
--- a/drivers/misc/mei/Kconfig
+++ b/drivers/misc/mei/Kconfig
@@ -47,3 +47,5 @@ config INTEL_MEI_TXE
  Intel Bay Trail
 
 source "drivers/misc/mei/hdcp/Kconfig"
+source "drivers/misc/mei/pxp/Kconfig"
+
diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile
index f1c76f7ee804..d8e5165917f2 100644
--- a/drivers/misc/mei/Makefile
+++ b/drivers/misc/mei/Makefile
@@ -26,3 +26,4 @@ mei-$(CONFIG_EVENT_TRACING) += mei-trace.o
 CFLAGS_mei-trace.o = -I$(src)
 
 obj-$(CONFIG_INTEL_MEI_HDCP) += hdcp/
+obj-$(CONFIG_INTEL_MEI_PXP) += pxp/
diff --git a/drivers/misc/mei/pxp/Kconfig b/drivers/misc/mei/pxp/Kconfig
new file mode 100644
index ..4029b96afc04
--- /dev/null
+++ b/drivers/misc/mei/pxp/Kconfig
@@ -0,0 +1,13 @@
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+#
+config INTEL_MEI_PXP
+   tristate "Intel PXP services of ME Interface"
+   select INTEL_MEI_ME
+   depends on DRM_I915
+   help
+ MEI Support for PXP Services on Intel platforms.
+
+ Enables the ME FW services required for PXP support through
+ I915 display driver of Intel.
diff --git a/drivers/misc/mei/pxp/Makefile b/drivers/misc/mei/pxp/Makefile
new file mode 100644
index ..0329950d5794
--- /dev/null
+++ b/drivers/misc/mei/pxp/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+#
+# Makefile - PXP client driver for Intel MEI Bus Driver.
+
+obj-$(CONFIG_INTEL_MEI_PXP) += mei_pxp.o
diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c
new file mode 100644
index ..5bd61fe445e3
--- /dev/null
+++ b/drivers/misc/mei/pxp/mei_pxp.c
@@ -0,0 +1,230 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright © 2020 Intel Corporation
+ */
+
+/**
+ * DOC: MEI_PXP Client Driver
+ *
+ * The mei_pxp driver acts as a translation layer between PXP
+ * protocol  implementer (I915) and ME FW by translating PXP
+ * negotiation messages to ME FW command payloads and vice versa.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mei_pxp.h"
+
+/**
+ * mei_pxp_send_message() - Sends a PXP message to ME FW.
+ * @dev: device corresponding to the mei_cl_device
+ * @message: a message buffer to send
+ * @size: size of the message
+ * Return: 0 on Success, <0 on Failure
+ */
+static int
+mei_pxp_send_message(struct device *dev, const void *message, size_t size)
+{
+   struct mei_cl_device *cldev;
+   ssize_t byte;
+
+   if (!dev || !message)
+   return -EINVAL;
+
+   cldev = to_mei_cl_device(dev);
+
+   /* temporary drop const qualifier till the API is fixed */
+   byte = mei_cldev_send(cldev, (u8 *)message, size);
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   return 0;
+}
+
+/**
+ * mei_pxp_receive_message() - Receives a PXP message from ME FW.
+ * @dev: device corresponding to the mei_cl_device
+ * @buffer: a message buffer to contain the received message
+ * @size: size of the buffer
+ * Return: bytes sent on Success, <0 on Failure
+ */
+static int
+mei_pxp_receive_message(struct device *dev, void *buffer, size_t size)
+{
+   struct mei_cl_device *cldev;
+   ssize_t byte;
+
+   if (!dev || !buffer)
+   return -EINVAL;
+
+   cldev = to_mei_cl_device(dev);
+
+   byte = mei_cldev_recv(cldev, buffer, size);
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   return byte;
+}
+
+static const struct i915_pxp_component_ops mei_pxp_ops = {
+   .owner = THIS_MODULE,
+   .send = mei_pxp_send_message,
+   .receive = mei_pxp_receive_message,
+};
+
+static int mei_component_master_bind(struct device *dev)
+{
+   struct mei_cl_device *cldev = to_mei_cl_device(dev);
+   struct i915_pxp_comp_master *comp_master = mei_cldev_get_drvdata(cldev);
+   int ret;
+
+   dev_dbg(dev, "%s\n", __func__);
+   comp_master->ops = _pxp_ops;
+   

[Intel-gfx] [RFC-v13 09/13] drm/i915/pxp: Expose session state for display protection flip

2020-12-18 Thread Huang, Sean Z
Implement the intel_pxp_gem_object_status() to allow i915 display
querying the current PXP session state. In the design, display
should not perform protection flip on the protected buffers if
there is no PXP session alive.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/pxp/intel_pxp.c | 9 +
 drivers/gpu/drm/i915/pxp/intel_pxp.h | 8 
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index e67b1f302b78..0bca99523089 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -153,3 +153,12 @@ void intel_pxp_irq_handler(struct intel_pxp *pxp, u16 iir)
pxp->current_events |= events;
schedule_work(>irq_work);
 }
+
+bool intel_pxp_gem_object_status(struct drm_i915_private *i915)
+{
+   if (i915->gt.pxp.ctx.inited &&
+   i915->gt.pxp.ctx.flag_display_hm_surface_keys)
+   return true;
+   else
+   return false;
+}
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.h 
b/drivers/gpu/drm/i915/pxp/intel_pxp.h
index cdaa6ce6fdca..976baf9b08e3 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.h
@@ -29,6 +29,8 @@ enum pxp_protection_modes {
PROTECTION_MODE_ALL
 };
 
+struct drm_i915_private;
+
 #ifdef CONFIG_DRM_I915_PXP
 void intel_pxp_irq_handler(struct intel_pxp *pxp, u16 iir);
 int i915_pxp_teardown_required_callback(struct intel_pxp *pxp);
@@ -36,6 +38,7 @@ int i915_pxp_global_terminate_complete_callback(struct 
intel_pxp *pxp);
 
 void intel_pxp_init(struct intel_pxp *pxp);
 void intel_pxp_fini(struct intel_pxp *pxp);
+bool intel_pxp_gem_object_status(struct drm_i915_private *i915);
 #else
 static inline void intel_pxp_irq_handler(struct intel_pxp *pxp, u16 iir)
 {
@@ -58,6 +61,11 @@ static inline void intel_pxp_init(struct intel_pxp *pxp)
 static inline void intel_pxp_fini(struct intel_pxp *pxp)
 {
 }
+
+static inline bool intel_pxp_gem_object_status(struct drm_i915_private *i915)
+{
+   return false;
+}
 #endif
 
 #endif /* __INTEL_PXP_H__ */
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC-v13 05/13] drm/i915/pxp: Func to send hardware session termination

2020-12-18 Thread Huang, Sean Z
Implement the functions to allow PXP to send a GPU command, in
order to terminate the hardware session, so hardware can recycle
this session slot for the next usage.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/Makefile  |   1 +
 drivers/gpu/drm/i915/pxp/intel_pxp.c   |  13 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c   | 158 +
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h   |  18 +++
 drivers/gpu/drm/i915/pxp/intel_pxp_types.h |   4 +
 5 files changed, 194 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 2c84f75b41da..abe52189986a 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -259,6 +259,7 @@ i915-y += i915_perf.o
 i915-$(CONFIG_DRM_I915_PXP) += \
pxp/intel_pxp.o \
pxp/intel_pxp_arb.o \
+   pxp/intel_pxp_cmd.o \
pxp/intel_pxp_context.o \
pxp/intel_pxp_tee.o
 
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index 2203464c76bc..cc8afca955f9 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -17,10 +17,23 @@
 void intel_pxp_init(struct intel_pxp *pxp)
 {
struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
+   int i;
 
if (INTEL_GEN(gt->i915) < 12)
return;
 
+   /* Find the first VCS engine present */
+   for (i = 0; i < I915_MAX_VCS; i++) {
+   if (HAS_ENGINE(gt, _VCS(i))) {
+   pxp->vcs_engine = gt->engine[_VCS(i)];
+   break;
+   }
+   }
+   if (!pxp->vcs_engine) {
+   drm_err(>i915->drm, "Could not find a VCS engine\n");
+   return;
+   }
+
intel_pxp_ctx_init(>ctx);
 
intel_uncore_write(gt->uncore, KCR_INIT, 
KCR_INIT_ALLOW_DISPLAY_ME_WRITES);
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c
new file mode 100644
index ..d9298cf5e1a7
--- /dev/null
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright(c) 2020, Intel Corporation. All rights reserved.
+ */
+
+#include "intel_pxp_cmd.h"
+#include "i915_drv.h"
+#include "gt/intel_context.h"
+#include "gt/intel_engine_pm.h"
+
+struct i915_vma *intel_pxp_cmd_get_batch(struct intel_pxp *pxp,
+struct intel_context *ce,
+struct intel_gt_buffer_pool_node *pool,
+u32 *cmd_buf, int cmd_size_in_dw)
+{
+   struct i915_vma *batch = ERR_PTR(-EINVAL);
+   struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
+   u32 *cmd;
+
+   if (!ce || !ce->engine || !cmd_buf)
+   return ERR_PTR(-EINVAL);
+
+   if (cmd_size_in_dw * 4 > PAGE_SIZE) {
+   drm_err(>i915->drm, "Failed to %s, invalid 
cmd_size_id_dw=[%d]\n",
+   __func__, cmd_size_in_dw);
+   return ERR_PTR(-EINVAL);
+   }
+
+   cmd = i915_gem_object_pin_map(pool->obj, I915_MAP_FORCE_WC);
+   if (IS_ERR(cmd)) {
+   drm_err(>i915->drm, "Failed to 
i915_gem_object_pin_map()\n");
+   return ERR_PTR(-EINVAL);
+   }
+
+   memcpy(cmd, cmd_buf, cmd_size_in_dw * 4);
+
+   if (drm_debug_enabled(DRM_UT_DRIVER)) {
+   print_hex_dump(KERN_DEBUG, "cmd binaries:",
+  DUMP_PREFIX_OFFSET, 4, 4, cmd, cmd_size_in_dw * 
4, true);
+   }
+
+   i915_gem_object_unpin_map(pool->obj);
+
+   batch = i915_vma_instance(pool->obj, ce->vm, NULL);
+   if (IS_ERR(batch)) {
+   drm_err(>i915->drm, "Failed to i915_vma_instance()\n");
+   return batch;
+   }
+
+   return batch;
+}
+
+int intel_pxp_cmd_submit(struct intel_pxp *pxp, u32 *cmd, int cmd_size_in_dw)
+{
+   int err = -EINVAL;
+   struct i915_vma *batch;
+   struct i915_request *rq;
+   struct intel_context *ce = NULL;
+   bool is_engine_pm_get = false;
+   bool is_batch_vma_pin = false;
+   bool is_skip_req_on_err = false;
+   bool is_engine_get_pool = false;
+   struct intel_gt_buffer_pool_node *pool = NULL;
+   struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
+
+   ce = pxp->vcs_engine->kernel_context;
+   if (!ce) {
+   drm_err(>i915->drm, "VCS engine does not have context\n");
+   err = -EINVAL;
+   goto end;
+   }
+
+   if (!cmd || (cmd_size_in_dw * 4) > PAGE_SIZE) {
+   drm_err(>i915->drm, "Failed to %s bad params\n", __func__);
+   return -EINVAL;
+   }
+
+   intel_engine_pm_get(ce->engine);
+   is_engine_pm_get = true;
+
+   pool = intel_gt_get_buffer_pool(gt, 

[Intel-gfx] [RFC-v13 12/13] drm/i915/pxp: User interface for Protected buffer

2020-12-18 Thread Huang, Sean Z
From: Bommu Krishnaiah 

This api allow user mode to create Protected buffer and context creation.

Signed-off-by: Bommu Krishnaiah 
Cc: Telukuntla Sreedhar 
Cc: Kondapally Kalyan 
Cc: Gupta Anshuman 
Cc: Huang Sean Z 
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c   | 15 ++--
 drivers/gpu/drm/i915/gem/i915_gem_context.h   | 10 
 .../gpu/drm/i915/gem/i915_gem_context_types.h |  2 +-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  5 
 drivers/gpu/drm/i915/i915_gem.c   | 23 +++
 include/uapi/drm/i915_drm.h   | 19 +++
 6 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index c7363036765a..12847edec751 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -2019,12 +2019,23 @@ static int ctx_setparam(struct drm_i915_file_private 
*fpriv,
case I915_CONTEXT_PARAM_RECOVERABLE:
if (args->size)
ret = -EINVAL;
-   else if (args->value)
-   i915_gem_context_set_recoverable(ctx);
+   else if (args->value) {
+   if (!i915_gem_context_is_protected(ctx))
+   i915_gem_context_set_recoverable(ctx);
+   else
+   ret = -EPERM;
+   }
else
i915_gem_context_clear_recoverable(ctx);
break;
 
+   case I915_CONTEXT_PARAM_PROTECTED_CONTENT:
+   if (args->size)
+   ret = -EINVAL;
+   else if (args->value)
+   i915_gem_context_set_protected(ctx);
+   break;
+
case I915_CONTEXT_PARAM_PRIORITY:
ret = set_priority(ctx, args);
break;
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.h 
b/drivers/gpu/drm/i915/gem/i915_gem_context.h
index b5c908f3f4f2..f991e882bbe0 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.h
@@ -70,6 +70,16 @@ static inline void i915_gem_context_set_recoverable(struct 
i915_gem_context *ctx
set_bit(UCONTEXT_RECOVERABLE, >user_flags);
 }
 
+static inline void i915_gem_context_set_protected(struct i915_gem_context *ctx)
+{
+   set_bit(UCONTEXT_PROTECTED, >user_flags);
+}
+
+static inline bool i915_gem_context_is_protected(struct i915_gem_context *ctx)
+{
+   return test_bit(UCONTEXT_PROTECTED, >user_flags);
+}
+
 static inline void i915_gem_context_clear_recoverable(struct i915_gem_context 
*ctx)
 {
clear_bit(UCONTEXT_RECOVERABLE, >user_flags);
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h 
b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
index 1449f54924e0..0917c9431c65 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
@@ -134,7 +134,7 @@ struct i915_gem_context {
 #define UCONTEXT_BANNABLE  2
 #define UCONTEXT_RECOVERABLE   3
 #define UCONTEXT_PERSISTENCE   4
-
+#define UCONTEXT_PROTECTED 5
/**
 * @flags: small set of booleans
 */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h 
b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
index e2d9b7e1e152..90ac955463f4 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
@@ -161,6 +161,11 @@ struct drm_i915_gem_object {
} mmo;
 
I915_SELFTEST_DECLARE(struct list_head st_link);
+   /**
+* @user_flags: small set of booleans set by the user
+*/
+   unsigned long user_flags;
+#define I915_BO_PROTECTED BIT(0)
 
unsigned long flags;
 #define I915_BO_ALLOC_CONTIGUOUS BIT(0)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index c53b13c02e59..611a0b5ab51f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -184,7 +184,8 @@ static int
 i915_gem_create(struct drm_file *file,
struct intel_memory_region *mr,
u64 *size_p,
-   u32 *handle_p)
+   u32 *handle_p,
+   u64 user_flags)
 {
struct drm_i915_gem_object *obj;
u32 handle;
@@ -204,6 +205,8 @@ i915_gem_create(struct drm_file *file,
if (IS_ERR(obj))
return PTR_ERR(obj);
 
+   obj->user_flags = user_flags;
+
ret = drm_gem_handle_create(file, >base, );
/* drop reference from allocate - handle holds it now */
i915_gem_object_put(obj);
@@ -258,11 +261,12 @@ i915_gem_dumb_create(struct drm_file *file,
return i915_gem_create(file,
   intel_memory_region_by_type(to_i915(dev),
   

[Intel-gfx] [RFC-v13 00/13] Introduce Intel PXP component - Mesa single session

2020-12-18 Thread Huang, Sean Z


PXP (Protected Xe Path) is an i915 component, available on
GEN12+ that helps to establish the hardware protected session
and manage the status of the alive software session, as well
as its life cycle.

This patch series is to allow the kernel space to create and
manage a single hardware session (a.k.a. default session or
arbitrary session). So user can allocate the protected buffer,
which is encrypted with the leverage of the arbitrary hardware
session.

v2:
- modification based on code review feedbacks received
- passing pxp instead of i915 as function argument
- remove dead code only for multi-session
- move the pxp init call from i915_drv.c to intel_gt.c
- remove the tautology naming

v3:
- rebase to latest drm-tip

v4:
- Append the split non-mesa patch sereis (commit #14 - #21) into
  this patch series

v5:
- include "intel_pxp.h" in intel_pxp_sm.h at commit #14 to fix
  the build problem.

v6:
- Fix the null pointer arb_session access bug in intel_pxp_arb.c in
  "04 [RFC-v5] drm/i915/pxp: Create the arbitrary session after
  boot"

v7:
- Use list_for_each_entry_safe instead of list_for_each_entry

v8:
- Add MEI vtag support for PXP multi-session usage

v9:
- Fix error handling bug in commit #5 "Func to send hardware session
  termination". In intel_pxp_cmd.c, we should properly assign
  "err = PTR_ERR(x)" if hitting the error case "IS_ERR(x)", this is
  the only change in v9.

v10
- Remove the multi session commits #14-#21, for now we would like to
  keep the multi session patches as downstream.
- Adopt the code review suggestion from Wilson in commit #1

v11
- In commit #05 "drm/i915/pxp: Func to send hardware session
  termination", we should not assume VCS0 is always on.
  Instead we use available VCS#, could be VCS0, VCS2, etc.

v12
- Add "#include  in #1 intel_pxp_types.h

v13
- Add "#include  in #1 intel_pxp_types.h (#v12 didn't
  actually update the _types.h file...)



Anshuman Gupta (1):
  drm/i915/pxp: Add plane decryption support

Bommu Krishnaiah (2):
  drm/i915/uapi: introduce drm_i915_gem_create_ext
  drm/i915/pxp: User interface for Protected buffer

Huang, Sean Z (9):
  drm/i915/pxp: Introduce Intel PXP component
  drm/i915/pxp: set KCR reg init during the boot time
  drm/i915/pxp: Implement funcs to create the TEE channel
  drm/i915/pxp: Create the arbitrary session after boot
  drm/i915/pxp: Func to send hardware session termination
  drm/i915/pxp: Enable PXP irq worker and callback stub
  drm/i915/pxp: Destroy arb session upon teardown
  drm/i915/pxp: Enable PXP power management
  drm/i915/pxp: Expose session state for display protection flip

Vitaly Lubart (1):
  mei: pxp: export pavp client to me client bus

 drivers/gpu/drm/i915/Kconfig  |  22 ++
 drivers/gpu/drm/i915/Makefile |   9 +
 drivers/gpu/drm/i915/display/intel_sprite.c   |  21 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |  15 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.h   |  10 +
 .../gpu/drm/i915/gem/i915_gem_context_types.h |   2 +-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |   5 +
 drivers/gpu/drm/i915/gt/intel_gt.c|   4 +
 drivers/gpu/drm/i915/gt/intel_gt_irq.c|   4 +
 drivers/gpu/drm/i915/gt/intel_gt_pm.c |   4 +
 drivers/gpu/drm/i915/gt/intel_gt_types.h  |   3 +
 drivers/gpu/drm/i915/i915_drv.c   |   7 +-
 drivers/gpu/drm/i915/i915_drv.h   |   6 +
 drivers/gpu/drm/i915/i915_gem.c   |  63 +++-
 drivers/gpu/drm/i915/i915_reg.h   |   4 +-
 drivers/gpu/drm/i915/pxp/intel_pxp.c  | 164 +++
 drivers/gpu/drm/i915/pxp/intel_pxp.h  |  71 +
 drivers/gpu/drm/i915/pxp/intel_pxp_arb.c  | 209 +
 drivers/gpu/drm/i915/pxp/intel_pxp_arb.h  |  16 +
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c  | 278 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h  |  20 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_context.c  |  28 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_context.h  |  15 +
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c   |  65 
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.h   |  31 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c  | 170 +++
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.h  |  20 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_types.h|  60 
 drivers/misc/mei/Kconfig  |   2 +
 drivers/misc/mei/Makefile |   1 +
 drivers/misc/mei/pxp/Kconfig  |  13 +
 drivers/misc/mei/pxp/Makefile |   7 +
 drivers/misc/mei/pxp/mei_pxp.c| 230 +++
 drivers/misc/mei/pxp/mei_pxp.h|  18 ++
 include/drm/i915_component.h  |   1 +
 include/drm/i915_pxp_tee_interface.h  |  45 +++
 include/uapi/drm/i915_drm.h   |  66 +
 37 files changed, 1697 insertions(+), 12 deletions(-)
 create mode 100644 

[Intel-gfx] [RFC-v13 07/13] drm/i915/pxp: Destroy arb session upon teardown

2020-12-18 Thread Huang, Sean Z
Teardown is triggered when the display topology changes and no
long meets the secure playback requirement, and hardware trashes
all the encryption keys for display. So as a result, PXP should
handle such case and terminate the type0 sessions, which including
arb session

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/pxp/intel_pxp.c |   3 +
 drivers/gpu/drm/i915/pxp/intel_pxp_arb.c |  76 +
 drivers/gpu/drm/i915/pxp/intel_pxp_arb.h |   1 +
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 130 ++-
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h |  12 ++-
 5 files changed, 212 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index f342ccafa86e..e67b1f302b78 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -28,6 +28,9 @@ static int intel_pxp_teardown_required_callback(struct 
intel_pxp *pxp)
mutex_lock(>ctx.mutex);
 
pxp->ctx.global_state_attacked = true;
+   pxp->ctx.flag_display_hm_surface_keys = false;
+
+   ret = intel_pxp_arb_terminate_session(pxp);
 
mutex_unlock(>ctx.mutex);
 
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_arb.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_arb.c
index d3da72969349..54a5d7c26e4b 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_arb.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_arb.c
@@ -10,6 +10,7 @@
 #include "intel_pxp_arb.h"
 #include "intel_pxp.h"
 #include "intel_pxp_tee.h"
+#include "intel_pxp_cmd.h"
 
 #define GEN12_KCR_SIP _MMIO(0x32260) /* KCR type0 session in play 0-31 */
 
@@ -131,3 +132,78 @@ int intel_pxp_arb_create_session(struct intel_pxp *pxp)
 end:
return ret;
 }
+
+static int intel_pxp_arb_session_with_global_termination(struct intel_pxp *pxp)
+{
+   u32 *cmd = NULL;
+   u32 *cmd_ptr = NULL;
+   int cmd_size_in_dw = 0;
+   int ret;
+   struct intel_gt *gt = container_of(pxp, typeof(*gt), pxp);
+
+   /* Calculate how many bytes need to be alloc */
+   cmd_size_in_dw += intel_pxp_cmd_add_prolog(pxp, NULL, ARB_SESSION_TYPE, 
ARB_SESSION_INDEX);
+   cmd_size_in_dw += intel_pxp_cmd_add_inline_termination(NULL);
+   cmd_size_in_dw += intel_pxp_cmd_add_epilog(NULL);
+
+   cmd = kzalloc(cmd_size_in_dw * 4, GFP_KERNEL);
+   if (!cmd)
+   return -ENOMEM;
+
+   /* Program the command */
+   cmd_ptr = cmd;
+   cmd_ptr += intel_pxp_cmd_add_prolog(pxp, cmd_ptr, ARB_SESSION_TYPE, 
ARB_SESSION_INDEX);
+   cmd_ptr += intel_pxp_cmd_add_inline_termination(cmd_ptr);
+   cmd_ptr += intel_pxp_cmd_add_epilog(cmd_ptr);
+
+   if (cmd_size_in_dw != (cmd_ptr - cmd)) {
+   ret = -EINVAL;
+   drm_err(>i915->drm, "Failed to %s\n", __func__);
+   goto end;
+   }
+
+   if (drm_debug_enabled(DRM_UT_DRIVER)) {
+   print_hex_dump(KERN_DEBUG, "global termination cmd binaries:",
+  DUMP_PREFIX_OFFSET, 4, 4, cmd, cmd_size_in_dw * 
4, true);
+   }
+
+   ret = intel_pxp_cmd_submit(pxp, cmd, cmd_size_in_dw);
+   if (ret) {
+   drm_err(>i915->drm, "Failed to intel_pxp_cmd_submit()\n");
+   goto end;
+   }
+
+end:
+   kfree(cmd);
+   return ret;
+}
+
+/**
+ * intel_pxp_arb_terminate_session - Terminate the arb hw session and its 
entries.
+ * @pxp: pointer to pxp struct.
+ *
+ * This function is NOT intended to be called from the ioctl, and need to be 
protected by
+ * ctx.mutex to ensure no SIP change during the call.
+ *
+ * Return: status. 0 means terminate is successful.
+ */
+int intel_pxp_arb_terminate_session(struct intel_pxp *pxp)
+{
+   int ret;
+   struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
+   struct pxp_protected_session *arb = >ctx.arb_session;
+
+   lockdep_assert_held(>ctx.mutex);
+
+   /* terminate the hw sessions */
+   ret = intel_pxp_arb_session_with_global_termination(pxp);
+   if (ret) {
+   drm_err(>i915->drm, "Failed to 
intel_pxp_arb_session_with_global_termination\n");
+   return ret;
+   }
+
+   arb->is_in_play = false;
+
+   return ret;
+}
+
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_arb.h 
b/drivers/gpu/drm/i915/pxp/intel_pxp_arb.h
index 1eb8db6deb0e..c1ed4ab176aa 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_arb.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_arb.h
@@ -11,5 +11,6 @@
 struct intel_pxp;
 
 int intel_pxp_arb_create_session(struct intel_pxp *pxp);
+int intel_pxp_arb_terminate_session(struct intel_pxp *pxp);
 
 #endif /* __INTEL_PXP_ARB_H__ */
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c
index d9298cf5e1a7..ae338ab2e629 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c
@@ -5,13 +5,33 @@
 
 #include "intel_pxp_cmd.h"
 #include "i915_drv.h"
+#include "gt/intel_gpu_commands.h"
 

[Intel-gfx] [RFC-v13 13/13] drm/i915/pxp: Add plane decryption support

2020-12-18 Thread Huang, Sean Z
From: Anshuman Gupta 

Add support to enable/disable PLANE_SURF Decryption Request bit.
It requires only to enable plane decryption support when following
condition met.
1. PAVP session is enabled.
2. Buffer object is protected.

v2:
- Rebased to libva_cp-drm-tip_tgl_cp tree.
- Used gen fb obj user_flags instead gem_object_metadata. [Krishna]

Cc: Bommu Krishnaiah 
Cc: Huang, Sean Z 
Signed-off-by: Anshuman Gupta 
---
 drivers/gpu/drm/i915/display/intel_sprite.c | 21 ++---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c 
b/drivers/gpu/drm/i915/display/intel_sprite.c
index b7e208816074..273bdc031e8d 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -39,6 +39,8 @@
 #include 
 #include 
 
+#include "pxp/intel_pxp.h"
+
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include "i915_vgpu.h"
@@ -767,6 +769,11 @@ icl_program_input_csc(struct intel_plane *plane,
  PLANE_INPUT_CSC_POSTOFF(pipe, plane_id, 2), 0x0);
 }
 
+static bool intel_fb_obj_protected(const struct drm_i915_gem_object *obj)
+{
+   return obj->user_flags & I915_BO_PROTECTED ? true : false;
+}
+
 static void
 skl_plane_async_flip(struct intel_plane *plane,
 const struct intel_crtc_state *crtc_state,
@@ -803,6 +810,7 @@ skl_program_plane(struct intel_plane *plane,
u32 surf_addr = plane_state->color_plane[color_plane].offset;
u32 stride = skl_plane_stride(plane_state, color_plane);
const struct drm_framebuffer *fb = plane_state->hw.fb;
+   const struct drm_i915_gem_object *obj = intel_fb_obj(fb);
int aux_plane = intel_main_to_aux_plane(fb, color_plane);
int crtc_x = plane_state->uapi.dst.x1;
int crtc_y = plane_state->uapi.dst.y1;
@@ -813,7 +821,7 @@ skl_program_plane(struct intel_plane *plane,
u8 alpha = plane_state->hw.alpha >> 8;
u32 plane_color_ctl = 0, aux_dist = 0;
unsigned long irqflags;
-   u32 keymsk, keymax;
+   u32 keymsk, keymax, plane_surf;
u32 plane_ctl = plane_state->ctl;
 
plane_ctl |= skl_plane_ctl_crtc(crtc_state);
@@ -889,8 +897,15 @@ skl_program_plane(struct intel_plane *plane,
 * the control register just before the surface register.
 */
intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), plane_ctl);
-   intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id),
- intel_plane_ggtt_offset(plane_state) + surf_addr);
+   plane_surf = intel_plane_ggtt_offset(plane_state) + surf_addr;
+
+   if (intel_pxp_gem_object_status(dev_priv) &&
+   intel_fb_obj_protected(obj))
+   plane_surf |= PLANE_SURF_DECRYPTION_ENABLED;
+   else
+   plane_surf &= ~PLANE_SURF_DECRYPTION_ENABLED;
+
+   intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id), plane_surf);
 
if (plane_state->scaler_id >= 0)
skl_program_scaler(plane, crtc_state, plane_state);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 1e8dfe435ca8..0ea7e2a402ae 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7209,6 +7209,7 @@ enum {
 #define _PLANE_SURF_3(pipe)_PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B)
 #define PLANE_SURF(pipe, plane)\
_MMIO_PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe))
+#define   PLANE_SURF_DECRYPTION_ENABLEDREG_BIT(2)
 
 #define _PLANE_OFFSET_1_B  0x711a4
 #define _PLANE_OFFSET_2_B  0x712a4
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC-v13 11/13] drm/i915/uapi: introduce drm_i915_gem_create_ext

2020-12-18 Thread Huang, Sean Z
From: Bommu Krishnaiah 

Same old gem_create but with now with extensions support. This is needed
to support various upcoming usecases. For now we use the extensions
mechanism to support PAVP.

Signed-off-by: Bommu Krishnaiah 
Signed-off-by: Matthew Auld 
Cc: Joonas Lahtinen joonas.lahti...@linux.intel.com
Cc: Matthew Auld matthew.a...@intel.com
Cc: Telukuntla Sreedhar 
---
 drivers/gpu/drm/i915/i915_drv.c |  2 +-
 drivers/gpu/drm/i915/i915_gem.c | 42 -
 include/uapi/drm/i915_drm.h | 47 +
 3 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index af06c85e6ba7..3dbda949bf71 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1733,7 +1733,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {
DRM_IOCTL_DEF_DRV(I915_GEM_THROTTLE, i915_gem_throttle_ioctl, 
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(I915_GEM_ENTERVT, drm_noop, 
DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
DRM_IOCTL_DEF_DRV(I915_GEM_LEAVEVT, drm_noop, 
DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-   DRM_IOCTL_DEF_DRV(I915_GEM_CREATE, i915_gem_create_ioctl, 
DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF_DRV(I915_GEM_CREATE_EXT, i915_gem_create_ioctl, 
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(I915_GEM_PREAD, i915_gem_pread_ioctl, 
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(I915_GEM_PWRITE, i915_gem_pwrite_ioctl, 
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(I915_GEM_MMAP, i915_gem_mmap_ioctl, DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 17a4636ee542..c53b13c02e59 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -53,6 +53,7 @@
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include "i915_vgpu.h"
+#include "i915_user_extensions.h"
 
 #include "intel_pm.h"
 
@@ -260,6 +261,35 @@ i915_gem_dumb_create(struct drm_file *file,
   >size, >handle);
 }
 
+struct create_ext {
+struct drm_i915_private *i915;
+};
+
+static int __create_setparam(struct drm_i915_gem_object_param *args,
+   struct create_ext 
*ext_data)
+{
+   if (!(args->param & I915_OBJECT_PARAM)) {
+   DRM_DEBUG("Missing I915_OBJECT_PARAM namespace\n");
+   return -EINVAL;
+   }
+
+   return -EINVAL;
+}
+
+static int create_setparam(struct i915_user_extension __user *base, void *data)
+{
+   struct drm_i915_gem_create_ext_setparam ext;
+
+   if (copy_from_user(, base, sizeof(ext)))
+   return -EFAULT;
+
+   return __create_setparam(, data);
+}
+
+static const i915_user_extension_fn create_extensions[] = {
+   [I915_GEM_CREATE_EXT_SETPARAM] = create_setparam,
+};
+
 /**
  * Creates a new mm object and returns a handle to it.
  * @dev: drm device pointer
@@ -271,10 +301,20 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
  struct drm_file *file)
 {
struct drm_i915_private *i915 = to_i915(dev);
-   struct drm_i915_gem_create *args = data;
+   struct create_ext ext_data = { .i915 = i915 };
+   struct drm_i915_gem_create_ext *args = data;
+   int ret;
 
i915_gem_flush_free_objects(i915);
 
+   ret = i915_user_extensions(u64_to_user_ptr(args->extensions),
+  create_extensions,
+  ARRAY_SIZE(create_extensions),
+  _data);
+   if (ret)
+   return ret;
+
+
return i915_gem_create(file,
   intel_memory_region_by_type(i915,
   INTEL_MEMORY_SYSTEM),
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 6edcb2b6c708..e918ccc81c74 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -391,6 +391,7 @@ typedef struct _drm_i915_sarea {
 #define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + 
DRM_I915_GEM_ENTERVT)
 #define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + 
DRM_I915_GEM_LEAVEVT)
 #define DRM_IOCTL_I915_GEM_CREATE  DRM_IOWR(DRM_COMMAND_BASE + 
DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
+#define DRM_IOCTL_I915_GEM_CREATE_EXT   DRM_IOWR(DRM_COMMAND_BASE + 
DRM_I915_GEM_CREATE, struct drm_i915_gem_create_ext)
 #define DRM_IOCTL_I915_GEM_PREAD   DRM_IOW (DRM_COMMAND_BASE + 
DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
 #define DRM_IOCTL_I915_GEM_PWRITE  DRM_IOW (DRM_COMMAND_BASE + 
DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
 #define DRM_IOCTL_I915_GEM_MMAPDRM_IOWR(DRM_COMMAND_BASE + 
DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
@@ -728,6 +729,27 @@ struct drm_i915_gem_create {
__u32 pad;
 };
 
+struct drm_i915_gem_create_ext {
+   /**
+* Requested size for the object.
+*
+

[Intel-gfx] [RFC-v13 01/13] drm/i915/pxp: Introduce Intel PXP component

2020-12-18 Thread Huang, Sean Z
PXP (Protected Xe Path) is an i915 componment, available on GEN12+,
that helps to establish the hardware protected session and manage
the status of the alive software session, as well as its life cycle.

This patch series is to allow the kernel space to create and
manage a single hardware session (a.k.a default session or
arbitrary session). So Mesa can allocate the protected buffer,
which is encrypted with the leverage of the arbitrary hardware
session.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/Kconfig | 22 +
 drivers/gpu/drm/i915/Makefile|  5 
 drivers/gpu/drm/i915/gt/intel_gt.c   |  4 
 drivers/gpu/drm/i915/gt/intel_gt_types.h |  3 +++
 drivers/gpu/drm/i915/pxp/intel_pxp.c | 24 +++
 drivers/gpu/drm/i915/pxp/intel_pxp.h | 25 
 drivers/gpu/drm/i915/pxp/intel_pxp_context.c | 25 
 drivers/gpu/drm/i915/pxp/intel_pxp_context.h | 15 
 drivers/gpu/drm/i915/pxp/intel_pxp_types.h   | 23 ++
 9 files changed, 146 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.c
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.h
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.c
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.h
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_types.h

diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 1e1cb245fca7..594775c11e19 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -130,6 +130,28 @@ config DRM_I915_GVT_KVMGT
  Choose this option if you want to enable KVMGT support for
  Intel GVT-g.
 
+config DRM_I915_PXP
+   bool "Enable Intel PXP support for Intel Gen12+ platform"
+   depends on DRM_I915
+   select INTEL_MEI
+   select INTEL_MEI_ME
+   select INTEL_MEI_TXE
+   select INTEL_MEI_PXP
+   default y
+   help
+ This option selects INTEL_MEI_ME if it isn't already selected to
+ enabled full PXP Services on Intel platforms.
+
+ PXP (Protected Xe Path) is an i915 componment, available on GEN12+,
+ that helps to establish the hardware protected session and manage
+ the status of the alive software session, as well as its life cycle.
+
+ This patch series is to allow the kernel space to create and
+ manage a single hardware session (a.k.a default session or
+ arbitrary session). So Mesa can allocate the protected buffer,
+ which is encrypted with the leverage of the arbitrary hardware
+ session.
+
 menu "drm/i915 Debugging"
 depends on DRM_I915
 depends on EXPERT
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index f9ef5199b124..53be29dbc07d 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -255,6 +255,11 @@ i915-y += \
 
 i915-y += i915_perf.o
 
+# Protected execution platform (PXP) support
+i915-$(CONFIG_DRM_I915_PXP) += \
+   pxp/intel_pxp.o \
+   pxp/intel_pxp_context.o
+
 # Post-mortem debug and GPU hang state capture
 i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o
 i915-$(CONFIG_DRM_I915_SELFTEST) += \
diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
b/drivers/gpu/drm/i915/gt/intel_gt.c
index 44f1d51e5ae5..d2448be36ded 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -18,6 +18,7 @@
 #include "intel_uncore.h"
 #include "intel_pm.h"
 #include "shmem_utils.h"
+#include "pxp/intel_pxp.h"
 
 void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
 {
@@ -584,6 +585,8 @@ int intel_gt_init(struct intel_gt *gt)
if (err)
goto err_gt;
 
+   intel_pxp_init(>pxp);
+
goto out_fw;
 err_gt:
__intel_gt_disable(gt);
@@ -638,6 +641,7 @@ void intel_gt_driver_release(struct intel_gt *gt)
if (vm) /* FIXME being called twice on error paths :( */
i915_vm_put(vm);
 
+   intel_pxp_fini(>pxp);
intel_gt_pm_fini(gt);
intel_gt_fini_scratch(gt);
intel_gt_fini_buffer_pool(gt);
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h 
b/drivers/gpu/drm/i915/gt/intel_gt_types.h
index 6d39a4a11bf3..caa3e1403945 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
@@ -23,6 +23,7 @@
 #include "intel_rc6_types.h"
 #include "intel_rps_types.h"
 #include "intel_wakeref.h"
+#include "pxp/intel_pxp_types.h"
 
 struct drm_i915_private;
 struct i915_ggtt;
@@ -120,6 +121,8 @@ struct intel_gt {
/* Slice/subslice/EU info */
struct sseu_dev_info sseu;
} info;
+
+   struct intel_pxp pxp;
 };
 
 enum intel_gt_scratch_field {
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
new file mode 100644
index ..1e757efb7f5f
--- /dev/null
+++ 

[Intel-gfx] [RFC-v13 08/13] drm/i915/pxp: Enable PXP power management

2020-12-18 Thread Huang, Sean Z
During the power event S3+ sleep/resume, hardware will lose all the
encryption keys for every hardware session, even though the
software session state was marked as alive after resume. So to
handle such case, PXP should terminate all the hardware sessions
and cleanup all the software states after the power cycle.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/Makefile  |  1 +
 drivers/gpu/drm/i915/gt/intel_gt_pm.c  |  4 ++
 drivers/gpu/drm/i915/i915_drv.c|  4 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c| 65 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.h| 31 +++
 drivers/gpu/drm/i915/pxp/intel_pxp_types.h |  1 +
 6 files changed, 106 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_pm.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index abe52189986a..d419dfa4923d 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -261,6 +261,7 @@ i915-$(CONFIG_DRM_I915_PXP) += \
pxp/intel_pxp_arb.o \
pxp/intel_pxp_cmd.o \
pxp/intel_pxp_context.o \
+   pxp/intel_pxp_pm.o \
pxp/intel_pxp_tee.o
 
 # Post-mortem debug and GPU hang state capture
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c 
b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index 274aa0dd7050..09a64d0feafe 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -20,6 +20,7 @@
 #include "intel_rc6.h"
 #include "intel_rps.h"
 #include "intel_wakeref.h"
+#include "pxp/intel_pxp_pm.h"
 
 static void user_forcewake(struct intel_gt *gt, bool suspend)
 {
@@ -241,6 +242,8 @@ int intel_gt_resume(struct intel_gt *gt)
 
intel_uc_resume(>uc);
 
+   intel_pxp_pm_resume(>pxp);
+
user_forcewake(gt, false);
 
 out_fw:
@@ -275,6 +278,7 @@ void intel_gt_suspend_prepare(struct intel_gt *gt)
user_forcewake(gt, true);
wait_for_suspend(gt);
 
+   intel_pxp_pm_prepare_suspend(>pxp);
intel_uc_suspend(>uc);
 }
 
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9299a456adb0..af06c85e6ba7 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -68,6 +68,8 @@
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_rc6.h"
 
+#include "pxp/intel_pxp_pm.h"
+
 #include "i915_debugfs.h"
 #include "i915_drv.h"
 #include "i915_ioc32.h"
@@ -1344,6 +1346,8 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
intel_power_domains_resume(dev_priv);
 
+   intel_pxp_pm_resume_early(_priv->gt.pxp);
+
enable_rpm_wakeref_asserts(_priv->runtime_pm);
 
return ret;
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
new file mode 100644
index ..ebe89262485c
--- /dev/null
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright(c) 2020 Intel Corporation.
+ */
+
+#include "intel_pxp_context.h"
+#include "intel_pxp_arb.h"
+#include "intel_pxp_pm.h"
+
+void intel_pxp_pm_prepare_suspend(struct intel_pxp *pxp)
+{
+   if (!pxp->ctx.inited)
+   return;
+
+   mutex_lock(>ctx.mutex);
+
+   /* Disable PXP-IOCTLs */
+   pxp->ctx.global_state_in_suspend = true;
+
+   mutex_unlock(>ctx.mutex);
+}
+
+void intel_pxp_pm_resume_early(struct intel_pxp *pxp)
+{
+   if (!pxp->ctx.inited)
+   return;
+
+   mutex_lock(>ctx.mutex);
+
+   if (pxp->ctx.global_state_in_suspend) {
+   /* reset the attacked flag even there was a pending */
+   pxp->ctx.global_state_attacked = false;
+
+   pxp->ctx.flag_display_hm_surface_keys = false;
+   }
+
+   mutex_unlock(>ctx.mutex);
+}
+
+int intel_pxp_pm_resume(struct intel_pxp *pxp)
+{
+   int ret = 0;
+   struct intel_gt *gt = container_of(pxp, typeof(*gt), pxp);
+
+   if (!pxp->ctx.inited)
+   return 0;
+
+   mutex_lock(>ctx.mutex);
+
+   /* Re-enable PXP-IOCTLs */
+   if (pxp->ctx.global_state_in_suspend) {
+   ret = intel_pxp_arb_terminate_session(pxp);
+   if (ret) {
+   drm_err(>i915->drm, "Failed to terminate the arb 
session\n");
+   goto end;
+   }
+
+   pxp->ctx.global_state_in_suspend = false;
+   }
+
+end:
+   mutex_unlock(>ctx.mutex);
+
+   return ret;
+}
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h 
b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
new file mode 100644
index ..135bfb59aaf7
--- /dev/null
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright(c) 2020, Intel Corporation. All rights reserved.
+ */
+
+#ifndef __INTEL_PXP_PM_H__
+#define __INTEL_PXP_PM_H__
+
+#include "i915_drv.h"
+
+#ifdef CONFIG_DRM_I915_PXP
+void 

[Intel-gfx] [RFC-v13 06/13] drm/i915/pxp: Enable PXP irq worker and callback stub

2020-12-18 Thread Huang, Sean Z
Create the irq worker that serves as callback handler, those
callback stubs should be called while the hardware key teardown
occurs.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/gt/intel_gt_irq.c   |   4 +
 drivers/gpu/drm/i915/i915_reg.h  |   3 +-
 drivers/gpu/drm/i915/pxp/intel_pxp.c | 101 +++
 drivers/gpu/drm/i915/pxp/intel_pxp.h |  24 -
 drivers/gpu/drm/i915/pxp/intel_pxp_context.c |   3 +
 drivers/gpu/drm/i915/pxp/intel_pxp_context.h |   1 -
 drivers/gpu/drm/i915/pxp/intel_pxp_types.h   |   6 ++
 7 files changed, 139 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_irq.c 
b/drivers/gpu/drm/i915/gt/intel_gt_irq.c
index 9830342aa6f4..b92072554ab3 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_irq.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_irq.c
@@ -14,6 +14,7 @@
 #include "intel_lrc_reg.h"
 #include "intel_uncore.h"
 #include "intel_rps.h"
+#include "pxp/intel_pxp.h"
 
 static void guc_irq_handler(struct intel_guc *guc, u16 iir)
 {
@@ -107,6 +108,9 @@ gen11_other_irq_handler(struct intel_gt *gt, const u8 
instance,
if (instance == OTHER_GTPM_INSTANCE)
return gen11_rps_irq_handler(>rps, iir);
 
+   if (instance == OTHER_KCR_INSTANCE)
+   return intel_pxp_irq_handler(>pxp, iir);
+
WARN_ONCE(1, "unhandled other interrupt instance=0x%x, iir=0x%x\n",
  instance, iir);
 }
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 0023c023f472..1e8dfe435ca8 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7944,6 +7944,7 @@ enum {
 /* irq instances for OTHER_CLASS */
 #define OTHER_GUC_INSTANCE 0
 #define OTHER_GTPM_INSTANCE1
+#define OTHER_KCR_INSTANCE 4
 
 #define GEN11_INTR_IDENTITY_REG(x) _MMIO(0x190060 + ((x) * 4))
 
@@ -7966,7 +7967,7 @@ enum {
 #define GEN11_VECS0_VECS1_INTR_MASK_MMIO(0x1900d0)
 #define GEN11_GUC_SG_INTR_MASK _MMIO(0x1900e8)
 #define GEN11_GPM_WGBOXPERF_INTR_MASK  _MMIO(0x1900ec)
-#define GEN11_CRYPTO_RSVD_INTR_MASK_MMIO(0x1900f0)
+#define GEN11_CRYPTO_INTR_MASK _MMIO(0x1900f0) /* crypto mask is in 
bit31-16 (Engine1 Interrupt Mask) */
 #define GEN11_GUNIT_CSME_INTR_MASK _MMIO(0x1900f4)
 
 #define   ENGINE1_MASK REG_GENMASK(31, 16)
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index cc8afca955f9..f342ccafa86e 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -14,6 +14,70 @@
 /* Setting KCR Init bit is required after system boot */
 #define KCR_INIT_ALLOW_DISPLAY_ME_WRITES (BIT(14) | (BIT(14) << 
KCR_INIT_MASK_SHIFT))
 
+static void intel_pxp_write_irq_mask_reg(struct intel_gt *gt, u32 mask)
+{
+   lockdep_assert_held(>irq_lock);
+
+   intel_uncore_write(gt->uncore, GEN11_CRYPTO_INTR_MASK, mask << 16);
+}
+
+static int intel_pxp_teardown_required_callback(struct intel_pxp *pxp)
+{
+   int ret;
+
+   mutex_lock(>ctx.mutex);
+
+   pxp->ctx.global_state_attacked = true;
+
+   mutex_unlock(>ctx.mutex);
+
+   return ret;
+}
+
+static int intel_pxp_global_terminate_complete_callback(struct intel_pxp *pxp)
+{
+   int ret = 0;
+   struct intel_gt *gt = container_of(pxp, typeof(*gt), pxp);
+
+   mutex_lock(>ctx.mutex);
+
+   if (pxp->ctx.global_state_attacked) {
+   pxp->ctx.global_state_attacked = false;
+
+   /* Re-create the arb session after teardown handle complete */
+   ret = intel_pxp_arb_create_session(pxp);
+   if (ret) {
+   drm_err(>i915->drm, "Failed to create arb 
session\n");
+   goto end;
+   }
+   }
+end:
+   mutex_unlock(>ctx.mutex);
+   return ret;
+}
+
+static void intel_pxp_irq_work(struct work_struct *work)
+{
+   struct intel_pxp *pxp = container_of(work, typeof(*pxp), irq_work);
+   struct intel_gt *gt = container_of(pxp, typeof(*gt), pxp);
+   u32 events = 0;
+
+   spin_lock_irq(>irq_lock);
+   events = fetch_and_zero(>current_events);
+   spin_unlock_irq(>irq_lock);
+
+   if (events & PXP_IRQ_VECTOR_DISPLAY_PXP_STATE_TERMINATED ||
+   events & PXP_IRQ_VECTOR_DISPLAY_APP_TERM_PER_FW_REQ)
+   intel_pxp_teardown_required_callback(pxp);
+
+   if (events & PXP_IRQ_VECTOR_PXP_DISP_STATE_RESET_COMPLETE)
+   intel_pxp_global_terminate_complete_callback(pxp);
+
+   spin_lock_irq(>irq_lock);
+   intel_pxp_write_irq_mask_reg(gt, 0);
+   spin_unlock_irq(>irq_lock);
+}
+
 void intel_pxp_init(struct intel_pxp *pxp)
 {
struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
@@ -40,6 +104,12 @@ void intel_pxp_init(struct intel_pxp *pxp)
 
intel_pxp_tee_component_init(pxp);
 
+   INIT_WORK(>irq_work, intel_pxp_irq_work);
+
+   pxp->handled_irr = 

[Intel-gfx] [RFC-v13 02/13] drm/i915/pxp: set KCR reg init during the boot time

2020-12-18 Thread Huang, Sean Z
Set the KCR init during the boot time, which is
required by hardware, to allow us doing further
protection operation such as sending commands to
GPU or TEE.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/pxp/intel_pxp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index 1e757efb7f5f..cf22006222ce 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -6,6 +6,12 @@
 #include "intel_pxp.h"
 #include "intel_pxp_context.h"
 
+/* KCR register definitions */
+#define KCR_INIT_MMIO(0x320f0)
+#define KCR_INIT_MASK_SHIFT (16)
+/* Setting KCR Init bit is required after system boot */
+#define KCR_INIT_ALLOW_DISPLAY_ME_WRITES (BIT(14) | (BIT(14) << 
KCR_INIT_MASK_SHIFT))
+
 void intel_pxp_init(struct intel_pxp *pxp)
 {
struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
@@ -15,6 +21,8 @@ void intel_pxp_init(struct intel_pxp *pxp)
 
intel_pxp_ctx_init(>ctx);
 
+   intel_uncore_write(gt->uncore, KCR_INIT, 
KCR_INIT_ALLOW_DISPLAY_ME_WRITES);
+
drm_info(>i915->drm, "Protected Xe Path (PXP) protected content 
support initialized\n");
 }
 
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC-v13 04/13] drm/i915/pxp: Create the arbitrary session after boot

2020-12-18 Thread Huang, Sean Z
Create the arbitrary session, with the fixed session id 0xf, after
system boot, for the case that application allocates the protected
buffer without establishing any protection session. Because the
hardware requires at least one alive session for protected buffer
creation.  This arbitrary session needs to be re-created after
teardown or power event because hardware encryption key won't be
valid after such cases.

Signed-off-by: Huang, Sean Z 
---
 drivers/gpu/drm/i915/Makefile|   1 +
 drivers/gpu/drm/i915/pxp/intel_pxp.c |   1 +
 drivers/gpu/drm/i915/pxp/intel_pxp.h |  16 +++
 drivers/gpu/drm/i915/pxp/intel_pxp_arb.c | 133 +++
 drivers/gpu/drm/i915/pxp/intel_pxp_arb.h |  15 +++
 drivers/gpu/drm/i915/pxp/intel_pxp_context.h |   1 +
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c |  38 ++
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.h |   6 +
 drivers/gpu/drm/i915/pxp/intel_pxp_types.h   |  26 
 9 files changed, 237 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_arb.c
 create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_arb.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 57447887d352..2c84f75b41da 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -258,6 +258,7 @@ i915-y += i915_perf.o
 # Protected execution platform (PXP) support
 i915-$(CONFIG_DRM_I915_PXP) += \
pxp/intel_pxp.o \
+   pxp/intel_pxp_arb.o \
pxp/intel_pxp_context.o \
pxp/intel_pxp_tee.o
 
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index 5a3461272fe9..2203464c76bc 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -6,6 +6,7 @@
 #include "intel_pxp.h"
 #include "intel_pxp_context.h"
 #include "intel_pxp_tee.h"
+#include "intel_pxp_arb.h"
 
 /* KCR register definitions */
 #define KCR_INIT_MMIO(0x320f0)
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.h 
b/drivers/gpu/drm/i915/pxp/intel_pxp.h
index f47bc6bea34f..8fc91e900b16 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.h
@@ -8,6 +8,22 @@
 
 #include "intel_pxp_types.h"
 
+enum pxp_session_types {
+   SESSION_TYPE_TYPE0 = 0,
+   SESSION_TYPE_TYPE1 = 1,
+
+   SESSION_TYPE_MAX
+};
+
+enum pxp_protection_modes {
+   PROTECTION_MODE_NONE = 0,
+   PROTECTION_MODE_LM   = 2,
+   PROTECTION_MODE_HM   = 3,
+   PROTECTION_MODE_SM   = 6,
+
+   PROTECTION_MODE_ALL
+};
+
 #ifdef CONFIG_DRM_I915_PXP
 void intel_pxp_init(struct intel_pxp *pxp);
 void intel_pxp_fini(struct intel_pxp *pxp);
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_arb.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_arb.c
new file mode 100644
index ..d3da72969349
--- /dev/null
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_arb.c
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright(c) 2020, Intel Corporation. All rights reserved.
+ */
+
+#include "gt/intel_context.h"
+#include "gt/intel_engine_pm.h"
+
+#include "intel_pxp_types.h"
+#include "intel_pxp_arb.h"
+#include "intel_pxp.h"
+#include "intel_pxp_tee.h"
+
+#define GEN12_KCR_SIP _MMIO(0x32260) /* KCR type0 session in play 0-31 */
+
+/* Arbitrary session */
+#define ARB_SESSION_INDEX 0xf
+#define ARB_SESSION_TYPE SESSION_TYPE_TYPE0
+#define ARB_PROTECTION_MODE PROTECTION_MODE_HM
+
+static bool is_hw_arb_session_in_play(struct intel_pxp *pxp)
+{
+   u32 regval_sip = 0;
+   intel_wakeref_t wakeref;
+   struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
+
+   with_intel_runtime_pm(>i915->runtime_pm, wakeref) {
+   regval_sip = intel_uncore_read(gt->uncore, GEN12_KCR_SIP);
+   }
+
+   return regval_sip & BIT(ARB_SESSION_INDEX);
+}
+
+/* wait hw session_in_play reg to match the current sw state */
+static int wait_arb_hw_sw_state(struct intel_pxp *pxp)
+{
+   const int max_retry = 10;
+   const int ms_delay = 10;
+   int retry = 0;
+   int ret;
+   struct pxp_protected_session *arb = >ctx.arb_session;
+
+   ret = -EINVAL;
+   for (retry = 0; retry < max_retry; retry++) {
+   if (is_hw_arb_session_in_play(pxp) ==
+   arb->is_in_play) {
+   ret = 0;
+   break;
+   }
+
+   msleep(ms_delay);
+   }
+
+   return ret;
+}
+
+static void arb_session_entry_init(struct intel_pxp *pxp)
+{
+   struct pxp_protected_session *arb = >ctx.arb_session;
+
+   arb->type = ARB_SESSION_TYPE;
+   arb->protection_mode = ARB_PROTECTION_MODE;
+   arb->index = ARB_SESSION_INDEX;
+   arb->is_in_play = false;
+}
+
+int intel_pxp_arb_reserve_session(struct intel_pxp *pxp)
+{
+   int ret;
+
+   lockdep_assert_held(>ctx.mutex);
+
+   arb_session_entry_init(pxp);
+   ret = wait_arb_hw_sw_state(pxp);
+
+   return ret;
+}
+
+/**
+ * 

Re: [Intel-gfx] linux-next: Tree for Dec 18 (drm/i915/display/intel_panel)

2020-12-18 Thread Randy Dunlap
On 12/17/20 9:33 PM, Stephen Rothwell wrote:
> Hi all,
> 
> News: there will be no linux-next releases between Dec 24 and Jan
> 3 inclusive.
> 
> Please do not add any v5.12 destined code to your linux-next included
> branches until after v5.11-rc1 has been released.
> 
> Changes since 20201217:
> 

on i386:

ld: drivers/gpu/drm/i915/display/intel_panel.o: in function 
`intel_backlight_device_register':
intel_panel.c:(.text+0x2f4f): undefined reference to `backlight_device_register'
ld: drivers/gpu/drm/i915/display/intel_panel.o: in function 
`intel_backlight_device_unregister':
intel_panel.c:(.text+0x2fc8): undefined reference to 
`backlight_device_unregister'


CONFIG_BACKLIGHT_CLASS_DEVICE=m
CONFIG_DRM_I915=y


Full randconfig file is attached.


-- 
~Randy
Reported-by: Randy Dunlap 


config-r6825.xz
Description: application/xz
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v7 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

2020-12-18 Thread Souza, Jose
On Fri, 2020-12-18 at 08:52 -0800, José Roberto de Souza wrote:
> On Fri, 2020-12-18 at 16:31 +, Mun, Gwan-gyeong wrote:
> > On Thu, 2020-12-17 at 13:13 -0800, José Roberto de Souza wrote:
> > > Now using plane damage clips property to calcualte the damaged area.
> > > Selective fetch only supports one region to be fetched so software
> > > needs to calculate a bounding box around all damage clips.
> > > 
> > > Now that we are not complete fetching each plane, there is another
> > > loop needed as all the plane areas that intersect with the pipe
> > > damaged area needs to be fetched from memory so the complete blending
> > > of all planes can happen.
> > > 
> > > v2:
> > > - do not shifthing new_plane_state->uapi.dst only src is in 16.16 
> > Hi,
> > typo here, shifthing -> shifting
> > > format
> > > 
> > > v4:
> > > - setting plane selective fetch area using the whole pipe damage area
> > > - mark the whole plane area damaged if plane visibility or alpha
> > > changed
> > > 
> > > v5:
> > > - taking in consideration src.y1 in the damage coordinates
> > > - adding to the pipe damaged area planes that were visible but are
> > > invisible in the new state
> > > 
> > > v6:
> > > - consider old state plane coordinates when visibility changes or it
> > > moved to calculate damaged area
> > > - remove from damaged area the portion not in src clip
> > > 
> > > v7:
> > > - intersec every damage clip with src to minimize damaged area
> > > 
> > > v8:
> > > - adjust pipe_damaged area to 4 lines grouping
> > > - adjust calculation now that is understood that uapi.src is the
> > > framebuffer coordinates that plane will start to fetch from
> > > 
> > > Cc: Ville Syrjälä 
> > > Cc: Gwan-gyeong Mun 
> > > Signed-off-by: José Roberto de Souza 
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_psr.c | 105 -
> > > --
> > >  1 file changed, 91 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> > > b/drivers/gpu/drm/i915/display/intel_psr.c
> > > index d9a395c486d3..29cae2802089 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_psr.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> > > @@ -1242,9 +1242,11 @@ static void psr2_man_trk_ctl_calc(struct
> > > intel_crtc_state *crtc_state,
> > >   if (clip->y1 == -1)
> > >   goto exit;
> > >  
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > + drm_WARN_ON(crtc_state->uapi.crtc->dev, clip->y1 % 4 || clip-
> > > > y2 % 4);
> > why do you check this line?
> 
> To make sure that clip->y1 and y2 can divide by 4, otherwise PSR2_MAN_TRK_CTL 
> will be programmed with truncated values.
> 
> > > +
> > >   val |= PSR2_MAN_TRK_CTL_SF_PARTIAL_FRAME_UPDATE;
> > >   val |= PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(clip->y1 / 4 + 1);
> > > - val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(DIV_ROUND_UP(clip-
> > > > y2, 4) + 1);
> > > + val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(clip->y2 / 4 + 1);
> > PSR2_MAN_TRK_CTL's the programming note of bspec describes as,
> > 
> > The frame is divided into blocks of four scan lines each. The blocks
> > are addressed starting from 1 for the first block of the frame and
> > ending with ROUNDUP[(TRANS_VTOTAL Vertical Active + 1) / 4]for the last
> > block of the frame.
> > Software must provide the starting and ending block address of the
> > selective update region.
> > The SU Region Start Address is programmed to the first block of the
> > selective update region.
> > The SU Region End Address is programmed to the final block of the
> > selective update region + 1.
> > There can be only one selective update region in a frame.
> > To disable selective update, set the selective update region to the
> > full frame by programming SU Region Start Address to the startof the
> > frame and SU Region End Address to the end of the frame.
> > 
> > if the why not you did not set like this?
> >  val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(clip->y2 / 4 + 2); 
> 
> Imagine that clip->y2 = 800.
> 
> 800 / 4 + = 202
> Now if you convert it back to pixel:
> 
> # it starts on 1
> 202 - 1 = 201
> 201 * 4 = 804
> 
> The roundup in the description above is because of cases like clip->y2 = 799, 
> in this case the "+2" would work but it will not for numbers that divide
> by 4.
> 
> > 
> > >  exit:
> > >   crtc_state->psr2_man_track_ctl = val;
> > >  }
> > > @@ -1269,8 +1271,8 @@ int intel_psr2_sel_fetch_update(struct
> > > intel_atomic_state *state,
> > >   struct intel_crtc *crtc)
> > >  {
> > >   struct intel_crtc_state *crtc_state =
> > > intel_atomic_get_new_crtc_state(state, crtc);
> > > + struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX,
> > why don't you use crtc_state->uapi.adjusted_mode.crtc_hdisplay for
> > setting x2?
> 
> Because it do not matters if it is equals to uapi.adjusted_mode.crtc_hdisplay 
> or larger, we will not use X values to program registers, using the line
> above would only add one more line of code.
> 
> > > .y2 = -1 };

Re: [Intel-gfx] [PATCH v7 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

2020-12-18 Thread Souza, Jose
On Fri, 2020-12-18 at 16:31 +, Mun, Gwan-gyeong wrote:
> On Thu, 2020-12-17 at 13:13 -0800, José Roberto de Souza wrote:
> > Now using plane damage clips property to calcualte the damaged area.
> > Selective fetch only supports one region to be fetched so software
> > needs to calculate a bounding box around all damage clips.
> > 
> > Now that we are not complete fetching each plane, there is another
> > loop needed as all the plane areas that intersect with the pipe
> > damaged area needs to be fetched from memory so the complete blending
> > of all planes can happen.
> > 
> > v2:
> > - do not shifthing new_plane_state->uapi.dst only src is in 16.16 
> Hi,
> typo here, shifthing -> shifting
> > format
> > 
> > v4:
> > - setting plane selective fetch area using the whole pipe damage area
> > - mark the whole plane area damaged if plane visibility or alpha
> > changed
> > 
> > v5:
> > - taking in consideration src.y1 in the damage coordinates
> > - adding to the pipe damaged area planes that were visible but are
> > invisible in the new state
> > 
> > v6:
> > - consider old state plane coordinates when visibility changes or it
> > moved to calculate damaged area
> > - remove from damaged area the portion not in src clip
> > 
> > v7:
> > - intersec every damage clip with src to minimize damaged area
> > 
> > v8:
> > - adjust pipe_damaged area to 4 lines grouping
> > - adjust calculation now that is understood that uapi.src is the
> > framebuffer coordinates that plane will start to fetch from
> > 
> > Cc: Ville Syrjälä 
> > Cc: Gwan-gyeong Mun 
> > Signed-off-by: José Roberto de Souza 
> > ---
> >  drivers/gpu/drm/i915/display/intel_psr.c | 105 -
> > --
> >  1 file changed, 91 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> > b/drivers/gpu/drm/i915/display/intel_psr.c
> > index d9a395c486d3..29cae2802089 100644
> > --- a/drivers/gpu/drm/i915/display/intel_psr.c
> > +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> > @@ -1242,9 +1242,11 @@ static void psr2_man_trk_ctl_calc(struct
> > intel_crtc_state *crtc_state,
> >     if (clip->y1 == -1)
> >     goto exit;
> >  
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > +   drm_WARN_ON(crtc_state->uapi.crtc->dev, clip->y1 % 4 || clip-
> > > y2 % 4);
> why do you check this line?

To make sure that clip->y1 and y2 can divide by 4, otherwise PSR2_MAN_TRK_CTL 
will be programmed with truncated values.

> > +
> >     val |= PSR2_MAN_TRK_CTL_SF_PARTIAL_FRAME_UPDATE;
> >     val |= PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(clip->y1 / 4 + 1);
> > -   val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(DIV_ROUND_UP(clip-
> > > y2, 4) + 1);
> > +   val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(clip->y2 / 4 + 1);
> PSR2_MAN_TRK_CTL's the programming note of bspec describes as,
> 
> The frame is divided into blocks of four scan lines each. The blocks
> are addressed starting from 1 for the first block of the frame and
> ending with ROUNDUP[(TRANS_VTOTAL Vertical Active + 1) / 4]for the last
> block of the frame.
> Software must provide the starting and ending block address of the
> selective update region.
> The SU Region Start Address is programmed to the first block of the
> selective update region.
> The SU Region End Address is programmed to the final block of the
> selective update region + 1.
> There can be only one selective update region in a frame.
> To disable selective update, set the selective update region to the
> full frame by programming SU Region Start Address to the startof the
> frame and SU Region End Address to the end of the frame.
> 
> if the why not you did not set like this?
>  val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(clip->y2 / 4 + 2); 

Imagine that clip->y2 = 800.

800 / 4 + = 202
Now if you convert it back to pixel:

# it starts on 1
202 - 1 = 201
201 * 4 = 804

The roundup in the description above is because of cases like clip->y2 = 799, 
in this case the "+2" would work but it will not for numbers that divide
by 4.

> 
> >  exit:
> >     crtc_state->psr2_man_track_ctl = val;
> >  }
> > @@ -1269,8 +1271,8 @@ int intel_psr2_sel_fetch_update(struct
> > intel_atomic_state *state,
> >     struct intel_crtc *crtc)
> >  {
> >     struct intel_crtc_state *crtc_state =
> > intel_atomic_get_new_crtc_state(state, crtc);
> > +   struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX,
> why don't you use crtc_state->uapi.adjusted_mode.crtc_hdisplay for
> setting x2?

Because it do not matters if it is equals to uapi.adjusted_mode.crtc_hdisplay 
or larger, we will not use X values to program registers, using the line
above would only add one more line of code.

> > .y2 = -1 };
> >     struct intel_plane_state *new_plane_state, *old_plane_state;
> > -   struct drm_rect pipe_clip = { .y1 = -1 };
> >     struct intel_plane *plane;
> >     bool full_update = false;
> >     int i, ret;
> > @@ -1282,9 +1284,17 @@ int intel_psr2_sel_fetch_update(struct
> > intel_atomic_state 

Re: [Intel-gfx] [PATCH v2] drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Tvrtko Ursulin



On 18/12/2020 16:07, Chris Wilson wrote:

Quoting Tvrtko Ursulin (2020-12-18 15:52:05)


On 18/12/2020 12:24, Chris Wilson wrote:

Since we allow removing the timeline map at runtime, there is a risk
that rq->hwsp points into a stale page. To control that risk, we hold
the RCU read lock while reading *rq->hwsp, but we missed a couple of
important barriers. First, the unpinning / removal of the timeline map
must be after all RCU readers into that map are complete, i.e. after an
rcu barrier (in this case courtesy of call_rcu()). Secondly, we must
make sure that the rq->hwsp we are about to dereference under the RCU
lock is valid. In this case, we make the rq->hwsp pointer safe during
i915_request_retire() and so we know that rq->hwsp may become invalid
only after the request has been signaled. Therefore is the request is
not yet signaled when we acquire rq->hwsp under the RCU, we know that
rq->hwsp will remain valid for the duration of the RCU read lock.

This is a very small window that may lead to either considering the
request not completed (causing a delay until the request is checked
again, any wait for the request is not affected) or dereferencing an
invalid pointer.

Fixes: 3adac4689f58 ("drm/i915: Introduce concept of per-timeline (context) 
HWSP")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc:  # v5.1+
---
   drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 11 ++
   drivers/gpu/drm/i915/gt/intel_timeline.c| 10 +++---
   drivers/gpu/drm/i915/i915_request.h | 37 ++---
   3 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 
b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
index 3c62fd6daa76..f96cd7d9b419 100644
--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
@@ -134,11 +134,6 @@ static bool remove_signaling_context(struct 
intel_breadcrumbs *b,
   return true;
   }
   
-static inline bool __request_completed(const struct i915_request *rq)

-{
- return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
-}
-
   __maybe_unused static bool
   check_signal_order(struct intel_context *ce, struct i915_request *rq)
   {
@@ -245,7 +240,7 @@ static void signal_irq_work(struct irq_work *work)
   list_for_each_entry_rcu(rq, >signals, signal_link) {
   bool release;
   
- if (!__request_completed(rq))

+ if (!__i915_request_is_complete(rq))
   break;
   
   if (!test_and_clear_bit(I915_FENCE_FLAG_SIGNAL,

@@ -380,7 +375,7 @@ static void insert_breadcrumb(struct i915_request *rq)
* straight onto a signaled list, and queue the irq worker for
* its signal completion.
*/
- if (__request_completed(rq)) {
+ if (__i915_request_is_complete(rq)) {
   irq_signal_request(rq, b);
   return;
   }
@@ -468,7 +463,7 @@ void i915_request_cancel_breadcrumb(struct i915_request *rq)
   if (release)
   intel_context_put(ce);
   
- if (__request_completed(rq))

+ if (__i915_request_is_complete(rq))
   irq_signal_request(rq, b);
   
   i915_request_put(rq);

diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c 
b/drivers/gpu/drm/i915/gt/intel_timeline.c
index 512afacd2bdc..a005d0165bf4 100644
--- a/drivers/gpu/drm/i915/gt/intel_timeline.c
+++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
@@ -126,6 +126,10 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
   struct intel_timeline_cacheline *cl =
   container_of(rcu, typeof(*cl), rcu);
   
+ /* Must wait until after all *rq->hwsp are complete before removing */

+ i915_gem_object_unpin_map(cl->hwsp->vma->obj);
+ __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, CACHELINE_BITS));
+
   i915_active_fini(>active);
   kfree(cl);
   }
@@ -133,11 +137,6 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
   static void __idle_cacheline_free(struct intel_timeline_cacheline *cl)
   {
   GEM_BUG_ON(!i915_active_is_idle(>active));
-
- i915_gem_object_unpin_map(cl->hwsp->vma->obj);
- i915_vma_put(cl->hwsp->vma);
- __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, CACHELINE_BITS));
-
   call_rcu(>rcu, __rcu_cacheline_free);
   }
   
@@ -179,7 +178,6 @@ cacheline_alloc(struct intel_timeline_hwsp *hwsp, unsigned int cacheline)

   return ERR_CAST(vaddr);
   }
   
- i915_vma_get(hwsp->vma);

   cl->hwsp = hwsp;
   cl->vaddr = page_pack_bits(vaddr, cacheline);
   
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h

index 92e4320c50c4..7c4453e60323 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -440,7 +440,7 @@ static inline u32 hwsp_seqno(const struct i915_request *rq)
   
   static inline bool __i915_request_has_started(const struct i915_request *rq)

  

Re: [Intel-gfx] [PATCH v7 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

2020-12-18 Thread Mun, Gwan-gyeong
On Thu, 2020-12-17 at 13:13 -0800, José Roberto de Souza wrote:
> Now using plane damage clips property to calcualte the damaged area.
> Selective fetch only supports one region to be fetched so software
> needs to calculate a bounding box around all damage clips.
> 
> Now that we are not complete fetching each plane, there is another
> loop needed as all the plane areas that intersect with the pipe
> damaged area needs to be fetched from memory so the complete blending
> of all planes can happen.
> 
> v2:
> - do not shifthing new_plane_state->uapi.dst only src is in 16.16 
Hi,
typo here, shifthing -> shifting
> format
> 
> v4:
> - setting plane selective fetch area using the whole pipe damage area
> - mark the whole plane area damaged if plane visibility or alpha
> changed
> 
> v5:
> - taking in consideration src.y1 in the damage coordinates
> - adding to the pipe damaged area planes that were visible but are
> invisible in the new state
> 
> v6:
> - consider old state plane coordinates when visibility changes or it
> moved to calculate damaged area
> - remove from damaged area the portion not in src clip
> 
> v7:
> - intersec every damage clip with src to minimize damaged area
> 
> v8:
> - adjust pipe_damaged area to 4 lines grouping
> - adjust calculation now that is understood that uapi.src is the
> framebuffer coordinates that plane will start to fetch from
> 
> Cc: Ville Syrjälä 
> Cc: Gwan-gyeong Mun 
> Signed-off-by: José Roberto de Souza 
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 105 -
> --
>  1 file changed, 91 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index d9a395c486d3..29cae2802089 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1242,9 +1242,11 @@ static void psr2_man_trk_ctl_calc(struct
> intel_crtc_state *crtc_state,
>   if (clip->y1 == -1)
>   goto exit;
>  
> + drm_WARN_ON(crtc_state->uapi.crtc->dev, clip->y1 % 4 || clip-
> >y2 % 4);
why do you check this line?
> +
>   val |= PSR2_MAN_TRK_CTL_SF_PARTIAL_FRAME_UPDATE;
>   val |= PSR2_MAN_TRK_CTL_SU_REGION_START_ADDR(clip->y1 / 4 + 1);
> - val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(DIV_ROUND_UP(clip-
> >y2, 4) + 1);
> + val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(clip->y2 / 4 + 1);
PSR2_MAN_TRK_CTL's the programming note of bspec describes as,

The frame is divided into blocks of four scan lines each. The blocks
are addressed starting from 1 for the first block of the frame and
ending with ROUNDUP[(TRANS_VTOTAL Vertical Active + 1) / 4]for the last
block of the frame.
Software must provide the starting and ending block address of the
selective update region.
The SU Region Start Address is programmed to the first block of the
selective update region.
The SU Region End Address is programmed to the final block of the
selective update region + 1.
There can be only one selective update region in a frame.
To disable selective update, set the selective update region to the
full frame by programming SU Region Start Address to the startof the
frame and SU Region End Address to the end of the frame.

if the why not you did not set like this?
 val |= PSR2_MAN_TRK_CTL_SU_REGION_END_ADDR(clip->y2 / 4 + 2); 

>  exit:
>   crtc_state->psr2_man_track_ctl = val;
>  }
> @@ -1269,8 +1271,8 @@ int intel_psr2_sel_fetch_update(struct
> intel_atomic_state *state,
>   struct intel_crtc *crtc)
>  {
>   struct intel_crtc_state *crtc_state =
> intel_atomic_get_new_crtc_state(state, crtc);
> + struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX,
why don't you use crtc_state->uapi.adjusted_mode.crtc_hdisplay for
setting x2?
> .y2 = -1 };
>   struct intel_plane_state *new_plane_state, *old_plane_state;
> - struct drm_rect pipe_clip = { .y1 = -1 };
>   struct intel_plane *plane;
>   bool full_update = false;
>   int i, ret;
> @@ -1282,9 +1284,17 @@ int intel_psr2_sel_fetch_update(struct
> intel_atomic_state *state,
>   if (ret)
>   return ret;
>  
> + /*
> +  * Calculate minimal selective fetch area of each plane and
> calculate
> +  * the pipe damaged area.
> +  * In the next loop the plane selective fetch area will
> actually be set
> +  * using whole pipe damaged area.
> +  */
>   for_each_oldnew_intel_plane_in_state(state, plane,
> old_plane_state,
>new_plane_state, i) {
> - struct drm_rect *sel_fetch_area, temp;
> + struct drm_rect src, damaged_area = { .y1 = -1 };
> + struct drm_mode_rect *damaged_clips;
> + u32 num_clips, j;
>  
>   if (new_plane_state->uapi.crtc != crtc_state-
> >uapi.crtc)
>   continue;
> @@ -1300,23 +1310,90 @@ int intel_psr2_sel_fetch_update(struct
> intel_atomic_state *state,
> 

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Check for rq->hwsp validity after acquiring RCU lock (rev2)

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Check for rq->hwsp validity after acquiring RCU lock (rev2)
URL   : https://patchwork.freedesktop.org/series/85071/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9503_full -> Patchwork_19178_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Possible new issues
---

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

### IGT changes ###

 Suppressed 

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@gem_vm_create@destroy-race}:
- shard-tglb: [PASS][1] -> [INCOMPLETE][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-tglb1/igt@gem_vm_cre...@destroy-race.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-tglb1/igt@gem_vm_cre...@destroy-race.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_ctx_persistence@legacy-engines-cleanup:
- shard-hsw:  NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#1099])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-hsw5/igt@gem_ctx_persiste...@legacy-engines-cleanup.html

  * igt@gem_exec_reloc@basic-wide-active@vcs1:
- shard-iclb: NOTRUN -> [FAIL][4] ([i915#2389])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-iclb4/igt@gem_exec_reloc@basic-wide-act...@vcs1.html

  * igt@gem_userptr_blits@huge-split:
- shard-skl:  [PASS][5] -> [INCOMPLETE][6] ([i915#2502])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl3/igt@gem_userptr_bl...@huge-split.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-skl10/igt@gem_userptr_bl...@huge-split.html

  * igt@gem_workarounds@suspend-resume:
- shard-skl:  [PASS][7] -> [INCOMPLETE][8] ([i915#198]) +1 similar 
issue
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl8/igt@gem_workarou...@suspend-resume.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-skl2/igt@gem_workarou...@suspend-resume.html

  * igt@gem_workarounds@suspend-resume-fd:
- shard-skl:  [PASS][9] -> [INCOMPLETE][10] ([i915#198] / 
[i915#2405])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl2/igt@gem_workarou...@suspend-resume-fd.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-skl5/igt@gem_workarou...@suspend-resume-fd.html

  * igt@gen9_exec_parse@allowed-all:
- shard-glk:  [PASS][11] -> [DMESG-WARN][12] ([i915#1436] / 
[i915#716])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-glk9/igt@gen9_exec_pa...@allowed-all.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-glk3/igt@gen9_exec_pa...@allowed-all.html

  * igt@i915_pm_rc6_residency@rc6-fence:
- shard-hsw:  [PASS][13] -> [WARN][14] ([i915#1519])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-hsw4/igt@i915_pm_rc6_reside...@rc6-fence.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-hsw6/igt@i915_pm_rc6_reside...@rc6-fence.html

  * igt@kms_big_fb@yf-tiled-8bpp-rotate-270:
- shard-glk:  NOTRUN -> [SKIP][15] ([fdo#109271]) +17 similar issues
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-glk6/igt@kms_big...@yf-tiled-8bpp-rotate-270.html

  * igt@kms_chamelium@hdmi-edid-change-during-suspend:
- shard-apl:  NOTRUN -> [SKIP][16] ([fdo#109271] / [fdo#111827]) +3 
similar issues
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-apl2/igt@kms_chamel...@hdmi-edid-change-during-suspend.html

  * igt@kms_chamelium@hdmi-hpd-for-each-pipe:
- shard-hsw:  NOTRUN -> [SKIP][17] ([fdo#109271] / [fdo#111827]) +2 
similar issues
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-hsw5/igt@kms_chamel...@hdmi-hpd-for-each-pipe.html

  * igt@kms_chamelium@hdmi-mode-timings:
- shard-glk:  NOTRUN -> [SKIP][18] ([fdo#109271] / [fdo#111827]) +3 
similar issues
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-glk6/igt@kms_chamel...@hdmi-mode-timings.html

  * igt@kms_color@pipe-b-ctm-0-25:
- shard-skl:  [PASS][19] -> [DMESG-WARN][20] ([i915#1982])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl9/igt@kms_co...@pipe-b-ctm-0-25.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/shard-skl9/igt@kms_co...@pipe-b-ctm-0-25.html

  * igt@kms_cursor_crc@pipe-c-cursor-128x42-sliding:
- shard-skl:  [PASS][21] -> [FAIL][22] ([i915#54])
   [21]: 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/dg1: Fix power gate sequence.

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915/dg1: Fix power gate sequence.
URL   : https://patchwork.freedesktop.org/series/85082/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9503 -> Patchwork_19179


Summary
---

  **SUCCESS**

  No regressions found.

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

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_mmap_gtt@basic:
- fi-tgl-y:   [PASS][1] -> [DMESG-WARN][2] ([i915#402]) +1 similar 
issue
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-tgl-y/igt@gem_mmap_...@basic.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/fi-tgl-y/igt@gem_mmap_...@basic.html

  * igt@i915_selftest@live@execlists:
- fi-cml-s:   [PASS][3] -> [INCOMPLETE][4] ([i915#1037])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-cml-s/igt@i915_selftest@l...@execlists.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/fi-cml-s/igt@i915_selftest@l...@execlists.html

  
 Possible fixes 

  * igt@i915_selftest@live@active:
- fi-kbl-r:   [DMESG-FAIL][5] ([i915#2291] / [i915#666]) -> 
[PASS][6]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-kbl-r/igt@i915_selftest@l...@active.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/fi-kbl-r/igt@i915_selftest@l...@active.html

  * igt@prime_self_import@basic-with_one_bo_two_files:
- fi-tgl-y:   [DMESG-WARN][7] ([i915#402]) -> [PASS][8] +1 similar 
issue
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html

  
  [i915#1037]: https://gitlab.freedesktop.org/drm/intel/issues/1037
  [i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
  [i915#666]: https://gitlab.freedesktop.org/drm/intel/issues/666


Participating hosts (42 -> 39)
--

  Missing(3): fi-ilk-m540 fi-bdw-samus fi-hsw-4200u 


Build changes
-

  * Linux: CI_DRM_9503 -> Patchwork_19179

  CI-20190529: 20190529
  CI_DRM_9503: 82c5c0ad8d578504865837b2135b60dd2d0054a1 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5909: 3d6caf71a3e988cd125eb9efdd0a7cdcd0451673 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_19179: 0e2aab5815f42c76c4fd17dad95885cea4c7d10e @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

0e2aab5815f4 drm/i915/dg1: Fix power gate sequence.

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19179/index.html
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 1/2] drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping

2020-12-18 Thread Jani Nikula
On Fri, 18 Dec 2020, Lucas De Marchi  wrote:
> On Fri, Dec 18, 2020 at 01:13:49PM +0200, Jani Nikula wrote:
>>On Fri, 18 Dec 2020, Jani Nikula  wrote:
>>> On Thu, 17 Dec 2020, Lucas De Marchi  wrote:
 Both patches applied. Thanks!

 Jani, maybe now you can rebase your patch to get rid of the extern ?
>>>
>>> Yes, thanks for the irq so I can stop polling. ;)
>>
>>Huh, why were these applied to drm-intel-gt-next? It's much more about
>>driver core code than gt.
>
> sigh... by mistake. At the time as was mainly thinking about the WAs
> that are affected by these and thought it would belong to gt.
>
> what now? Do we apply in to drm-intel-next as well or wait for a backmerge?

Maybe I'll do the refactoring in gt-next as well. Or wait for the
backmerge. *shrug*

Don't worry about it.

BR,
Jani.


>
> sorry,
>
> Lucas De Marchi
>
>>
>>BR,
>>Jani.
>>
>>
>>>
>>> BR,
>>> Jani.
>>>
>>>


 Lucas De Marchi

 On Wed, Dec 02, 2020 at 11:23:58PM -0800, Aditya Swarup wrote:
>Fix TGL REVID macros to fetch correct display/gt stepping based
>on SOC rev id from INTEL_REVID() macro. Previously, we were just
>returning the first element of the revid array instead of using
>the correct index based on SOC rev id.
>
>Fixes: ("drm/i915/tgl: Fix stepping WA matching")
>Cc: José Roberto de Souza 
>Cc: Matt Roper 
>Cc: Lucas De Marchi 
>Cc: Jani Nikula 
>Cc: Ville Syrjälä 
>Signed-off-by: Aditya Swarup 
>Reviewed-by: Lucas De Marchi 
>---
> drivers/gpu/drm/i915/i915_drv.h | 12 ++--
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/i915_drv.h 
>b/drivers/gpu/drm/i915/i915_drv.h
>index fc1090c6889c..2e2149c9a2f4 100644
>--- a/drivers/gpu/drm/i915/i915_drv.h
>+++ b/drivers/gpu/drm/i915/i915_drv.h
>@@ -1580,9 +1580,9 @@ static inline const struct i915_rev_steppings *
> tgl_revids_get(struct drm_i915_private *dev_priv)
> {
>   if (IS_TGL_U(dev_priv) || IS_TGL_Y(dev_priv))
>-  return tgl_uy_revids;
>+  return _uy_revids[INTEL_REVID(dev_priv)];
>   else
>-  return tgl_revids;
>+  return _revids[INTEL_REVID(dev_priv)];
> }
>
> #define IS_TGL_DISP_REVID(p, since, until) \
>@@ -1592,14 +1592,14 @@ tgl_revids_get(struct drm_i915_private *dev_priv)
>
> #define IS_TGL_UY_GT_REVID(p, since, until) \
>   ((IS_TGL_U(p) || IS_TGL_Y(p)) && \
>-   tgl_uy_revids->gt_stepping >= (since) && \
>-   tgl_uy_revids->gt_stepping <= (until))
>+   tgl_uy_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
>+   tgl_uy_revids[INTEL_REVID(p)].gt_stepping <= (until))
>
> #define IS_TGL_GT_REVID(p, since, until) \
>   (IS_TIGERLAKE(p) && \
>!(IS_TGL_U(p) || IS_TGL_Y(p)) && \
>-   tgl_revids->gt_stepping >= (since) && \
>-   tgl_revids->gt_stepping <= (until))
>+   tgl_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
>+   tgl_revids[INTEL_REVID(p)].gt_stepping <= (until))
>
> #define RKL_REVID_A0  0x0
> #define RKL_REVID_B0  0x1
>--
>2.27.0
>
>___
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>>
>>-- 
>>Jani Nikula, Intel Open Source Graphics Center

-- 
Jani Nikula, Intel Open Source Graphics Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2] drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Chris Wilson
Quoting Tvrtko Ursulin (2020-12-18 15:52:05)
> 
> On 18/12/2020 12:24, Chris Wilson wrote:
> > Since we allow removing the timeline map at runtime, there is a risk
> > that rq->hwsp points into a stale page. To control that risk, we hold
> > the RCU read lock while reading *rq->hwsp, but we missed a couple of
> > important barriers. First, the unpinning / removal of the timeline map
> > must be after all RCU readers into that map are complete, i.e. after an
> > rcu barrier (in this case courtesy of call_rcu()). Secondly, we must
> > make sure that the rq->hwsp we are about to dereference under the RCU
> > lock is valid. In this case, we make the rq->hwsp pointer safe during
> > i915_request_retire() and so we know that rq->hwsp may become invalid
> > only after the request has been signaled. Therefore is the request is
> > not yet signaled when we acquire rq->hwsp under the RCU, we know that
> > rq->hwsp will remain valid for the duration of the RCU read lock.
> > 
> > This is a very small window that may lead to either considering the
> > request not completed (causing a delay until the request is checked
> > again, any wait for the request is not affected) or dereferencing an
> > invalid pointer.
> > 
> > Fixes: 3adac4689f58 ("drm/i915: Introduce concept of per-timeline (context) 
> > HWSP")
> > Signed-off-by: Chris Wilson 
> > Cc: Tvrtko Ursulin 
> > Cc:  # v5.1+
> > ---
> >   drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 11 ++
> >   drivers/gpu/drm/i915/gt/intel_timeline.c| 10 +++---
> >   drivers/gpu/drm/i915/i915_request.h | 37 ++---
> >   3 files changed, 39 insertions(+), 19 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 
> > b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> > index 3c62fd6daa76..f96cd7d9b419 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> > @@ -134,11 +134,6 @@ static bool remove_signaling_context(struct 
> > intel_breadcrumbs *b,
> >   return true;
> >   }
> >   
> > -static inline bool __request_completed(const struct i915_request *rq)
> > -{
> > - return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
> > -}
> > -
> >   __maybe_unused static bool
> >   check_signal_order(struct intel_context *ce, struct i915_request *rq)
> >   {
> > @@ -245,7 +240,7 @@ static void signal_irq_work(struct irq_work *work)
> >   list_for_each_entry_rcu(rq, >signals, signal_link) {
> >   bool release;
> >   
> > - if (!__request_completed(rq))
> > + if (!__i915_request_is_complete(rq))
> >   break;
> >   
> >   if (!test_and_clear_bit(I915_FENCE_FLAG_SIGNAL,
> > @@ -380,7 +375,7 @@ static void insert_breadcrumb(struct i915_request *rq)
> >* straight onto a signaled list, and queue the irq worker for
> >* its signal completion.
> >*/
> > - if (__request_completed(rq)) {
> > + if (__i915_request_is_complete(rq)) {
> >   irq_signal_request(rq, b);
> >   return;
> >   }
> > @@ -468,7 +463,7 @@ void i915_request_cancel_breadcrumb(struct i915_request 
> > *rq)
> >   if (release)
> >   intel_context_put(ce);
> >   
> > - if (__request_completed(rq))
> > + if (__i915_request_is_complete(rq))
> >   irq_signal_request(rq, b);
> >   
> >   i915_request_put(rq);
> > diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c 
> > b/drivers/gpu/drm/i915/gt/intel_timeline.c
> > index 512afacd2bdc..a005d0165bf4 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_timeline.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
> > @@ -126,6 +126,10 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
> >   struct intel_timeline_cacheline *cl =
> >   container_of(rcu, typeof(*cl), rcu);
> >   
> > + /* Must wait until after all *rq->hwsp are complete before removing */
> > + i915_gem_object_unpin_map(cl->hwsp->vma->obj);
> > + __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, 
> > CACHELINE_BITS));
> > +
> >   i915_active_fini(>active);
> >   kfree(cl);
> >   }
> > @@ -133,11 +137,6 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
> >   static void __idle_cacheline_free(struct intel_timeline_cacheline *cl)
> >   {
> >   GEM_BUG_ON(!i915_active_is_idle(>active));
> > -
> > - i915_gem_object_unpin_map(cl->hwsp->vma->obj);
> > - i915_vma_put(cl->hwsp->vma);
> > - __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, 
> > CACHELINE_BITS));
> > -
> >   call_rcu(>rcu, __rcu_cacheline_free);
> >   }
> >   
> > @@ -179,7 +178,6 @@ cacheline_alloc(struct intel_timeline_hwsp *hwsp, 
> > unsigned int cacheline)
> >   return ERR_CAST(vaddr);
> >   }
> >   
> > - i915_vma_get(hwsp->vma);
> >   cl->hwsp = hwsp;
> >   cl->vaddr = page_pack_bits(vaddr, cacheline);
> >   
> > diff --git 

Re: [Intel-gfx] [PATCH v2] drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Tvrtko Ursulin



On 18/12/2020 12:24, Chris Wilson wrote:

Since we allow removing the timeline map at runtime, there is a risk
that rq->hwsp points into a stale page. To control that risk, we hold
the RCU read lock while reading *rq->hwsp, but we missed a couple of
important barriers. First, the unpinning / removal of the timeline map
must be after all RCU readers into that map are complete, i.e. after an
rcu barrier (in this case courtesy of call_rcu()). Secondly, we must
make sure that the rq->hwsp we are about to dereference under the RCU
lock is valid. In this case, we make the rq->hwsp pointer safe during
i915_request_retire() and so we know that rq->hwsp may become invalid
only after the request has been signaled. Therefore is the request is
not yet signaled when we acquire rq->hwsp under the RCU, we know that
rq->hwsp will remain valid for the duration of the RCU read lock.

This is a very small window that may lead to either considering the
request not completed (causing a delay until the request is checked
again, any wait for the request is not affected) or dereferencing an
invalid pointer.

Fixes: 3adac4689f58 ("drm/i915: Introduce concept of per-timeline (context) 
HWSP")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc:  # v5.1+
---
  drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 11 ++
  drivers/gpu/drm/i915/gt/intel_timeline.c| 10 +++---
  drivers/gpu/drm/i915/i915_request.h | 37 ++---
  3 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 
b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
index 3c62fd6daa76..f96cd7d9b419 100644
--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
@@ -134,11 +134,6 @@ static bool remove_signaling_context(struct 
intel_breadcrumbs *b,
return true;
  }
  
-static inline bool __request_completed(const struct i915_request *rq)

-{
-   return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
-}
-
  __maybe_unused static bool
  check_signal_order(struct intel_context *ce, struct i915_request *rq)
  {
@@ -245,7 +240,7 @@ static void signal_irq_work(struct irq_work *work)
list_for_each_entry_rcu(rq, >signals, signal_link) {
bool release;
  
-			if (!__request_completed(rq))

+   if (!__i915_request_is_complete(rq))
break;
  
  			if (!test_and_clear_bit(I915_FENCE_FLAG_SIGNAL,

@@ -380,7 +375,7 @@ static void insert_breadcrumb(struct i915_request *rq)
 * straight onto a signaled list, and queue the irq worker for
 * its signal completion.
 */
-   if (__request_completed(rq)) {
+   if (__i915_request_is_complete(rq)) {
irq_signal_request(rq, b);
return;
}
@@ -468,7 +463,7 @@ void i915_request_cancel_breadcrumb(struct i915_request *rq)
if (release)
intel_context_put(ce);
  
-	if (__request_completed(rq))

+   if (__i915_request_is_complete(rq))
irq_signal_request(rq, b);
  
  	i915_request_put(rq);

diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c 
b/drivers/gpu/drm/i915/gt/intel_timeline.c
index 512afacd2bdc..a005d0165bf4 100644
--- a/drivers/gpu/drm/i915/gt/intel_timeline.c
+++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
@@ -126,6 +126,10 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
struct intel_timeline_cacheline *cl =
container_of(rcu, typeof(*cl), rcu);
  
+	/* Must wait until after all *rq->hwsp are complete before removing */

+   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
+   __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, CACHELINE_BITS));
+
i915_active_fini(>active);
kfree(cl);
  }
@@ -133,11 +137,6 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
  static void __idle_cacheline_free(struct intel_timeline_cacheline *cl)
  {
GEM_BUG_ON(!i915_active_is_idle(>active));
-
-   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
-   i915_vma_put(cl->hwsp->vma);
-   __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, CACHELINE_BITS));
-
call_rcu(>rcu, __rcu_cacheline_free);
  }
  
@@ -179,7 +178,6 @@ cacheline_alloc(struct intel_timeline_hwsp *hwsp, unsigned int cacheline)

return ERR_CAST(vaddr);
}
  
-	i915_vma_get(hwsp->vma);

cl->hwsp = hwsp;
cl->vaddr = page_pack_bits(vaddr, cacheline);
  
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h

index 92e4320c50c4..7c4453e60323 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -440,7 +440,7 @@ static inline u32 hwsp_seqno(const struct i915_request *rq)
  
  static inline bool __i915_request_has_started(const struct i915_request *rq)

  {
-   return i915_seqno_passed(hwsp_seqno(rq), rq->fence.seqno - 1);
+   return 

Re: [Intel-gfx] [PULL] drm-intel-next-fixes

2020-12-18 Thread Daniel Vetter
On Fri, Dec 18, 2020 at 05:04:09PM +0200, Jani Nikula wrote:
> 
> Hi Dave & Daniel -
> 
> drm-intel-next-fixes-2020-12-18:
> drm/i915 fixes for the merge window

Pulled, thanks a lot.
-Daniel

> 
> 
> BR,
> Jani.
> 
> The following changes since commit efd3043790c6e92f0bbe1fe385db9b544131c59c:
> 
>   Merge tag 'amd-drm-fixes-5.11-2020-12-16' of 
> git://people.freedesktop.org/~agd5f/linux into drm-next (2020-12-16 23:25:51 
> +0100)
> 
> are available in the Git repository at:
> 
>   git://anongit.freedesktop.org/drm/drm-intel 
> tags/drm-intel-next-fixes-2020-12-18
> 
> for you to fetch changes up to 046f70d31ddb2069941aec54966fec5b7fbc7b7b:
> 
>   drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping 
> (2020-12-18 12:30:10 +0200)
> 
> 
> drm/i915 fixes for the merge window
> 
> 
> Aditya Swarup (1):
>   drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping
> 
> Chris Wilson (2):
>   Revert "drm/i915: re-order if/else ladder for hpd_irq_setup"
>   drm/i915: Fix mismatch between misplaced vma check and vma insert
> 
> Lionel Landwerlin (1):
>   drm/i915/perf: also include Gen11 in OATAILPTR workaround
> 
>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |  2 +-
>  drivers/gpu/drm/i915/i915_drv.h| 12 ++--
>  drivers/gpu/drm/i915/i915_irq.c| 27 
> ++
>  drivers/gpu/drm/i915/i915_perf.c   |  2 +-
>  4 files changed, 23 insertions(+), 20 deletions(-)
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.IGT: success for Add support for DP-HDMI2.1 PCON (rev9)

2020-12-18 Thread Patchwork
== Series Details ==

Series: Add support for DP-HDMI2.1 PCON (rev9)
URL   : https://patchwork.freedesktop.org/series/82098/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9503_full -> Patchwork_19177_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_ctx_persistence@legacy-engines-cleanup:
- shard-hsw:  NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#1099])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-hsw8/igt@gem_ctx_persiste...@legacy-engines-cleanup.html

  * igt@gem_exec_reloc@basic-many-active@vcs1:
- shard-iclb: NOTRUN -> [FAIL][2] ([i915#2389])
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-iclb2/igt@gem_exec_reloc@basic-many-act...@vcs1.html

  * igt@gem_huc_copy@huc-copy:
- shard-tglb: [PASS][3] -> [SKIP][4] ([i915#2190])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-tglb1/igt@gem_huc_c...@huc-copy.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-tglb6/igt@gem_huc_c...@huc-copy.html

  * igt@gen9_exec_parse@allowed-all:
- shard-skl:  [PASS][5] -> [DMESG-WARN][6] ([i915#1436] / 
[i915#716])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl3/igt@gen9_exec_pa...@allowed-all.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-skl4/igt@gen9_exec_pa...@allowed-all.html
- shard-glk:  [PASS][7] -> [DMESG-WARN][8] ([i915#1436] / 
[i915#716])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-glk9/igt@gen9_exec_pa...@allowed-all.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-glk6/igt@gen9_exec_pa...@allowed-all.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-skl:  NOTRUN -> [FAIL][9] ([i915#454]) +1 similar issue
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-skl10/igt@i915_pm...@dc6-dpms.html

  * igt@i915_pm_rpm@system-suspend-execbuf:
- shard-skl:  [PASS][10] -> [INCOMPLETE][11] ([i915#151])
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl2/igt@i915_pm_...@system-suspend-execbuf.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-skl4/igt@i915_pm_...@system-suspend-execbuf.html

  * igt@kms_async_flips@test-time-stamp:
- shard-tglb: [PASS][12] -> [FAIL][13] ([i915#2574])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-tglb5/igt@kms_async_fl...@test-time-stamp.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-tglb7/igt@kms_async_fl...@test-time-stamp.html

  * igt@kms_chamelium@hdmi-edid-change-during-suspend:
- shard-apl:  NOTRUN -> [SKIP][14] ([fdo#109271] / [fdo#111827]) +3 
similar issues
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-apl2/igt@kms_chamel...@hdmi-edid-change-during-suspend.html

  * igt@kms_chamelium@hdmi-hpd-for-each-pipe:
- shard-hsw:  NOTRUN -> [SKIP][15] ([fdo#109271] / [fdo#111827]) +2 
similar issues
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-hsw8/igt@kms_chamel...@hdmi-hpd-for-each-pipe.html

  * igt@kms_color_chamelium@pipe-c-gamma:
- shard-skl:  NOTRUN -> [SKIP][16] ([fdo#109271] / [fdo#111827]) +4 
similar issues
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-skl10/igt@kms_color_chamel...@pipe-c-gamma.html

  * igt@kms_cursor_crc@pipe-b-cursor-256x256-sliding:
- shard-skl:  [PASS][17] -> [FAIL][18] ([i915#54])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-skl9/igt@kms_cursor_...@pipe-b-cursor-256x256-sliding.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-skl8/igt@kms_cursor_...@pipe-b-cursor-256x256-sliding.html

  * igt@kms_cursor_crc@pipe-b-cursor-64x21-random:
- shard-apl:  [PASS][19] -> [FAIL][20] ([i915#54])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-apl6/igt@kms_cursor_...@pipe-b-cursor-64x21-random.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-apl1/igt@kms_cursor_...@pipe-b-cursor-64x21-random.html

  * igt@kms_cursor_crc@pipe-c-cursor-64x21-random:
- shard-skl:  NOTRUN -> [FAIL][21] ([i915#54])
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/shard-skl8/igt@kms_cursor_...@pipe-c-cursor-64x21-random.html

  * igt@kms_cursor_edge_walk@pipe-a-128x128-right-edge:
- shard-glk:  [PASS][22] -> [DMESG-FAIL][23] ([i915#118] / 
[i915#70] / [i915#95])
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/shard-glk1/igt@kms_cursor_edge_w...@pipe-a-128x128-right-edge.html
   [23]: 

[Intel-gfx] [PATCH] drm/i915/dg1: Fix power gate sequence.

2020-12-18 Thread Rodrigo Vivi
sub-pipe PG is not present on DG1. Setting these bits can disable
other power gates and cause GPU hangs on video playbacks.

Fixes: 85a12d7eb8fe ("drm/i915/tgl: Fix Media power gate sequence.")
Cc: Dale B Stimson 
Cc: Chris Wilson 
Signed-off-by: Rodrigo Vivi 
---
 drivers/gpu/drm/i915/gt/intel_rc6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_rc6.c 
b/drivers/gpu/drm/i915/gt/intel_rc6.c
index d7b8e4457fc2..79f63cdd8bfb 100644
--- a/drivers/gpu/drm/i915/gt/intel_rc6.c
+++ b/drivers/gpu/drm/i915/gt/intel_rc6.c
@@ -110,7 +110,7 @@ static void gen11_rc6_enable(struct intel_rc6 *rc6)
GEN9_MEDIA_PG_ENABLE |
GEN11_MEDIA_SAMPLER_PG_ENABLE;
 
-   if (INTEL_GEN(gt->i915) >= 12) {
+   if (INTEL_GEN(gt->i915) >= 12 && !IS_DG1(gt->i915)) {
for (i = 0; i < I915_MAX_VCS; i++)
if (HAS_ENGINE(gt, _VCS(i)))
pg_enable |= (VDN_HCP_POWERGATE_ENABLE(i) |
-- 
2.29.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 09/13] drm/i915: migrate hsw fdi code to new file.

2020-12-18 Thread Ville Syrjälä
On Fri, Dec 18, 2020 at 04:04:16PM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> Daniel asked for this, but it's a bit messy and I'm not sure
> how best to clean it up yet.
> 
> Signed-off-by: Dave Airlie 
> [Jani: also moved fdi buf trans to intel_fdi.c.]
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/display/intel_crt.c |   1 +
>  drivers/gpu/drm/i915/display/intel_ddi.c | 197 +--
>  drivers/gpu/drm/i915/display/intel_ddi.h |  14 +-
>  drivers/gpu/drm/i915/display/intel_fdi.c | 174 
>  drivers/gpu/drm/i915/display/intel_fdi.h |   7 +
>  5 files changed, 202 insertions(+), 191 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crt.c 
> b/drivers/gpu/drm/i915/display/intel_crt.c
> index 4934edd51cb0..077ebc7e6396 100644
> --- a/drivers/gpu/drm/i915/display/intel_crt.c
> +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> @@ -38,6 +38,7 @@
>  #include "intel_crt.h"
>  #include "intel_ddi.h"
>  #include "intel_display_types.h"
> +#include "intel_fdi.h"
>  #include "intel_fifo_underrun.h"
>  #include "intel_gmbus.h"
>  #include "intel_hotplug.h"
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 6863236df1d0..deabb1ad6045 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -35,10 +35,11 @@
>  #include "intel_ddi.h"
>  #include "intel_display_types.h"
>  #include "intel_dp.h"
> -#include "intel_dp_mst.h"
>  #include "intel_dp_link_training.h"
> +#include "intel_dp_mst.h"
>  #include "intel_dpio_phy.h"
>  #include "intel_dsi.h"
> +#include "intel_fdi.h"
>  #include "intel_fifo_underrun.h"
>  #include "intel_gmbus.h"
>  #include "intel_hdcp.h"
> @@ -51,12 +52,6 @@
>  #include "intel_tc.h"
>  #include "intel_vdsc.h"
>  
> -struct ddi_buf_trans {
> - u32 trans1; /* balance leg enable, de-emph level */
> - u32 trans2; /* vref sel, vswing */
> - u8 i_boost; /* SKL: I_boost; valid: 0x0, 0x1, 0x3, 0x7 */
> -};
> -
>  static const u8 index_to_dp_signal_levels[] = {
>   [0] = DP_TRAIN_VOLTAGE_SWING_LEVEL_0 | DP_TRAIN_PRE_EMPH_LEVEL_0,
>   [1] = DP_TRAIN_VOLTAGE_SWING_LEVEL_0 | DP_TRAIN_PRE_EMPH_LEVEL_1,
> @@ -86,18 +81,6 @@ static const struct ddi_buf_trans 
> hsw_ddi_translations_dp[] = {
>   { 0x80D75FFF, 0x000B, 0x0 },
>  };
>  
> -static const struct ddi_buf_trans hsw_ddi_translations_fdi[] = {
> - { 0x00FF, 0x0007000E, 0x0 },
> - { 0x00D75FFF, 0x000F000A, 0x0 },
> - { 0x00C30FFF, 0x00060006, 0x0 },
> - { 0x00AAAFFF, 0x001E, 0x0 },
> - { 0x00FF, 0x000F000A, 0x0 },
> - { 0x00D75FFF, 0x00160004, 0x0 },
> - { 0x00C30FFF, 0x001E, 0x0 },
> - { 0x00FF, 0x00060006, 0x0 },
> - { 0x00D75FFF, 0x001E, 0x0 },
> -};

Still wouldn't move these buf trans tables. Makes it harder to review
all of them in one go if they're spread around all over the place.
As mentioned before I'd suggest adding intel_ddi_buf_trans.c to house
all of these tables.

The rest of the patch lgtm.

> -
>  static const struct ddi_buf_trans hsw_ddi_translations_hdmi[] = {
>   /* Idx  NT mV d T mV d  db  */
>   { 0x00FF, 0x0006000E, 0x0 },/* 0:   400 400 0   */
> @@ -138,18 +121,6 @@ static const struct ddi_buf_trans 
> bdw_ddi_translations_dp[] = {
>   { 0x80D75FFF, 0x001B0002, 0x0 },
>  };
>  
> -static const struct ddi_buf_trans bdw_ddi_translations_fdi[] = {
> - { 0x00FF, 0x0001000E, 0x0 },
> - { 0x00D75FFF, 0x0004000A, 0x0 },
> - { 0x00C30FFF, 0x00070006, 0x0 },
> - { 0x00AAAFFF, 0x000C, 0x0 },
> - { 0x00FF, 0x0004000A, 0x0 },
> - { 0x00D75FFF, 0x00090004, 0x0 },
> - { 0x00C30FFF, 0x000C, 0x0 },
> - { 0x00FF, 0x00070006, 0x0 },
> - { 0x00D75FFF, 0x000C, 0x0 },
> -};
> -
>  static const struct ddi_buf_trans bdw_ddi_translations_hdmi[] = {
>   /* Idx  NT mV d T mV df db  */
>   { 0x00FF, 0x0007000E, 0x0 },/* 0:   400 400 0   */
> @@ -929,22 +900,6 @@ intel_ddi_get_buf_trans_edp(struct intel_encoder 
> *encoder, int *n_entries)
>   return NULL;
>  }
>  
> -static const struct ddi_buf_trans *
> -intel_ddi_get_buf_trans_fdi(struct drm_i915_private *dev_priv,
> - int *n_entries)
> -{
> - if (IS_BROADWELL(dev_priv)) {
> - *n_entries = ARRAY_SIZE(bdw_ddi_translations_fdi);
> - return bdw_ddi_translations_fdi;
> - } else if (IS_HASWELL(dev_priv)) {
> - *n_entries = ARRAY_SIZE(hsw_ddi_translations_fdi);
> - return hsw_ddi_translations_fdi;
> - }
> -
> - *n_entries = 0;
> - return NULL;
> -}
> -
>  static const struct ddi_buf_trans *
>  intel_ddi_get_buf_trans_hdmi(struct intel_encoder *encoder,
>int *n_entries)
> @@ -1398,8 +1353,8 @@ static int intel_ddi_hdmi_level(struct 

Re: [Intel-gfx] [PATCH 10/13] drm/i915: migrate skl planes code new file (v2)

2020-12-18 Thread Ville Syrjälä
On Fri, Dec 18, 2020 at 04:04:17PM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> Rework the plane init calls to do the gen test one level higher.
> 
> Rework some of the plane helpers so they can live in new file,
> there is still some scope to clean up the plane/fb interactions
> later.
> 
> v2: drop atomic code back, rename file to Ville suggestions,
> add header file.
> 
> Signed-off-by: Dave Airlie 
> [Jani: fixed up sparse warnings.]
> Signed-off-by: Jani Nikula 
> Reported-by: kernel test robot 
> Reported-by: Dan Carpenter 
> ---
>  drivers/gpu/drm/i915/Makefile |3 +-
>  drivers/gpu/drm/i915/display/i9xx_plane.c |4 -
>  drivers/gpu/drm/i915/display/icl_dsi.c|1 +
>  drivers/gpu/drm/i915/display/intel_crtc.c |   13 +-
>  drivers/gpu/drm/i915/display/intel_ddi.c  |1 +
>  drivers/gpu/drm/i915/display/intel_display.c  | 1401 +
>  drivers/gpu/drm/i915/display/intel_display.h  |   29 +-
>  .../drm/i915/display/intel_display_types.h|   21 +
>  drivers/gpu/drm/i915/display/intel_dp_mst.c   |1 +
>  drivers/gpu/drm/i915/display/intel_sprite.c   | 1395 -
>  drivers/gpu/drm/i915/display/intel_sprite.h   |3 -
>  .../drm/i915/display/skl_universal_plane.c| 2790 +
>  .../drm/i915/display/skl_universal_plane.h|   37 +
>  drivers/gpu/drm/i915/display/vlv_dsi.c|1 +
>  drivers/gpu/drm/i915/intel_pm.c   |1 +
>  15 files changed, 2893 insertions(+), 2808 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/display/skl_universal_plane.c
>  create mode 100644 drivers/gpu/drm/i915/display/skl_universal_plane.h
> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index e1a24239e25e..a055860daddb 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -219,7 +219,8 @@ i915-y += \
>   display/intel_sprite.o \
>   display/intel_tc.o \
>   display/intel_vga.o \
> - display/i9xx_plane.o
> + display/i9xx_plane.o \
> + display/skl_universal_plane.o
>  i915-$(CONFIG_ACPI) += \
>   display/intel_acpi.o \
>   display/intel_opregion.o
> diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c 
> b/drivers/gpu/drm/i915/display/i9xx_plane.c
> index b78985c855a5..6c568079f492 100644
> --- a/drivers/gpu/drm/i915/display/i9xx_plane.c
> +++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
> @@ -578,10 +578,6 @@ intel_primary_plane_create(struct drm_i915_private 
> *dev_priv, enum pipe pipe)
>   int num_formats;
>   int ret, zpos;
>  
> - if (INTEL_GEN(dev_priv) >= 9)
> - return skl_universal_plane_create(dev_priv, pipe,
> -   PLANE_PRIMARY);
> -
>   plane = intel_plane_alloc();
>   if (IS_ERR(plane))
>   return plane;
> diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c 
> b/drivers/gpu/drm/i915/display/icl_dsi.c
> index 9d245a689323..9eeec6fadec7 100644
> --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> @@ -35,6 +35,7 @@
>  #include "intel_dsi.h"
>  #include "intel_panel.h"
>  #include "intel_vdsc.h"
> +#include "skl_universal_plane.h"
>  
>  static int header_credits_available(struct drm_i915_private *dev_priv,
>   enum transcoder dsi_trans)
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c 
> b/drivers/gpu/drm/i915/display/intel_crtc.c
> index ad63df163850..d89cf6f2d97d 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -20,6 +20,7 @@
>  #include "intel_pipe_crc.h"
>  #include "intel_sprite.h"
>  #include "i9xx_plane.h"
> +#include "skl_universal_plane.h"
>  
>  static void assert_vblank_disabled(struct drm_crtc *crtc)
>  {
> @@ -244,7 +245,11 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, 
> enum pipe pipe)
>   crtc->pipe = pipe;
>   crtc->num_scalers = RUNTIME_INFO(dev_priv)->num_scalers[pipe];
>  
> - primary = intel_primary_plane_create(dev_priv, pipe);
> + if (INTEL_GEN(dev_priv) >= 9)
> + primary = skl_universal_plane_create(dev_priv, pipe,
> +  PLANE_PRIMARY);
> + else
> + primary = intel_primary_plane_create(dev_priv, pipe);

Ah, this got inlined here. Seems ok. But I'd probably follow
up with s/intel/i9xx/ renamed for the pre-skl function.

>   if (IS_ERR(primary)) {
>   ret = PTR_ERR(primary);
>   goto fail;
> @@ -254,7 +259,11 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, 
> enum pipe pipe)
>   for_each_sprite(dev_priv, pipe, sprite) {
>   struct intel_plane *plane;
>  
> - plane = intel_sprite_plane_create(dev_priv, pipe, sprite);
> + if (INTEL_GEN(dev_priv) >= 9)
> + plane = skl_universal_plane_create(dev_priv, pipe,
> +   

[Intel-gfx] [PULL] drm-intel-next-fixes

2020-12-18 Thread Jani Nikula


Hi Dave & Daniel -

drm-intel-next-fixes-2020-12-18:
drm/i915 fixes for the merge window


BR,
Jani.

The following changes since commit efd3043790c6e92f0bbe1fe385db9b544131c59c:

  Merge tag 'amd-drm-fixes-5.11-2020-12-16' of 
git://people.freedesktop.org/~agd5f/linux into drm-next (2020-12-16 23:25:51 
+0100)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel 
tags/drm-intel-next-fixes-2020-12-18

for you to fetch changes up to 046f70d31ddb2069941aec54966fec5b7fbc7b7b:

  drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping (2020-12-18 
12:30:10 +0200)


drm/i915 fixes for the merge window


Aditya Swarup (1):
  drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping

Chris Wilson (2):
  Revert "drm/i915: re-order if/else ladder for hpd_irq_setup"
  drm/i915: Fix mismatch between misplaced vma check and vma insert

Lionel Landwerlin (1):
  drm/i915/perf: also include Gen11 in OATAILPTR workaround

 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |  2 +-
 drivers/gpu/drm/i915/i915_drv.h| 12 ++--
 drivers/gpu/drm/i915/i915_irq.c| 27 ++
 drivers/gpu/drm/i915/i915_perf.c   |  2 +-
 4 files changed, 23 insertions(+), 20 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 08/13] drm/i915: split fdi code out from intel_display.c

2020-12-18 Thread Ville Syrjälä
On Fri, Dec 18, 2020 at 04:04:15PM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This just refactors out the fdi code to a separate file.
> 
> Signed-off-by: Dave Airlie 
> [Jani: cleaned up intel_fdi.h a bit.]
> Signed-off-by: Jani Nikula 

Reviewed-by: Ville Syrjälä 

-- 
Ville Syrjälä
Intel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 06/13] drm/i915: refactor some crtc code out of intel display. (v2)

2020-12-18 Thread Ville Syrjälä
On Fri, Dec 18, 2020 at 04:04:13PM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> There may be more crtc code that can be pulled out, but this
> is a good start.
> 
> v2: move plane before this.
> 
> Signed-off-by: Dave Airlie 
> [Jani: cleaned up intel_crtc.h a bit.]
> Signed-off-by: Jani Nikula 

lgtm
Reviewed-by: Ville Syrjälä 

-- 
Ville Syrjälä
Intel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 05/13] drm/i915: refactor i915 plane code into separate file.

2020-12-18 Thread Ville Syrjälä
On Fri, Dec 18, 2020 at 04:04:12PM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> Ville suggested this as a good idea, let's move this before moving
> the crtc code.
> 
> Signed-off-by: Dave Airlie 
> ---
>  drivers/gpu/drm/i915/Makefile|   3 +-
>  drivers/gpu/drm/i915/display/i9xx_plane.c| 704 +++
>  drivers/gpu/drm/i915/display/i9xx_plane.h|  21 +
>  drivers/gpu/drm/i915/display/intel_display.c | 689 +-
>  drivers/gpu/drm/i915/display/intel_display.h |   4 -
>  drivers/gpu/drm/i915/display/intel_sprite.c  |   1 +
>  6 files changed, 729 insertions(+), 693 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/display/i9xx_plane.c
>  create mode 100644 drivers/gpu/drm/i915/display/i9xx_plane.h

> +struct intel_plane *
> +intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
> +{
> + struct intel_plane *plane;
> + const struct drm_plane_funcs *plane_funcs;
> + unsigned int supported_rotations;
> + const u32 *formats;
> + int num_formats;
> + int ret, zpos;
> +
> + if (INTEL_GEN(dev_priv) >= 9)
> + return skl_universal_plane_create(dev_priv, pipe,
> +   PLANE_PRIMARY);
> +

A further followup idea:

intel_primary_plane_create()
{
if (gen>=9)
skl_universal_plane_create();
else
i9xx_primary_plane_create();
}

so we don't have this silly rountrip through i9xx_plane.c for
skl+.

Another thing we probably want is to move all the pre-skl sprite
plane code into this file as well since quite a bit of the code/etc.
can actually be shared between the primary and sprite planes.

Anyways, this seems like a good way to start so
Reviewed-by: Ville Syrjälä 

-- 
Ville Syrjälä
Intel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t] lib: Support writing arbitrary data from the start of a busy spinner

2020-12-18 Thread Chris Wilson
Allow the caller to specify a dword, or an arbitrary payload, to be
written by the busy spinner, just prior to starting its infinite loop.
This is similar to the dependency method, that makes a target busy
without writing anything.

Signed-off-by: Chris Wilson 
---
 lib/igt_dummyload.c | 71 +++--
 lib/igt_dummyload.h | 12 +++
 tests/i915/gem_spin_batch.c | 46 
 3 files changed, 127 insertions(+), 2 deletions(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 28fcbf81f..d5a68a46c 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -63,7 +63,7 @@
 #define MI_ARB_CHK (0x5 << 23)
 
 static const int BATCH_SIZE = 4096;
-static const int LOOP_START_OFFSET = 64;
+static const int LOOP_START_OFFSET = 256;
 
 static IGT_LIST_HEAD(spin_list);
 static pthread_mutex_t list_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -132,6 +132,11 @@ emit_recursive_batch(igt_spin_t *spin,
!gem_class_can_store_dword(fd, engine->class))
continue;
 
+   if (opts->flags & (IGT_SPIN_STORE_DWORD |
+  IGT_SPIN_STORE_DATA) &&
+   !gem_class_can_store_dword(fd, engine->class))
+   continue;
+
flags[nengine++] = engine->flags;
}
} else {
@@ -160,6 +165,8 @@ emit_recursive_batch(igt_spin_t *spin,
 
if (opts->dependency) {
igt_assert(!(opts->flags & IGT_SPIN_POLL_RUN));
+   igt_assert(!(opts->flags & (IGT_SPIN_STORE_DWORD |
+   IGT_SPIN_STORE_DATA)));
 
obj[SCRATCH].handle = opts->dependency;
obj[SCRATCH].offset = addr;
@@ -178,6 +185,9 @@ emit_recursive_batch(igt_spin_t *spin,
 
execbuf->buffer_count++;
} else if (opts->flags & IGT_SPIN_POLL_RUN) {
+   igt_assert(!(opts->flags & (IGT_SPIN_STORE_DWORD |
+   IGT_SPIN_STORE_DATA)));
+
r = [obj[BATCH].relocation_count++];
 
igt_assert(!opts->dependency);
@@ -230,6 +240,63 @@ emit_recursive_batch(igt_spin_t *spin,
 
*cs++ = 1;
 
+   execbuf->buffer_count++;
+   } else if (opts->flags & (IGT_SPIN_STORE_DWORD | IGT_SPIN_STORE_DATA)) {
+   int len, cmd;
+
+   igt_assert(opts->store_handle);
+   igt_assert((opts->store_offset & 3) == 0);
+   if (opts->flags & IGT_SPIN_STORE_DATA) {
+   igt_assert(!(opts->flags & IGT_SPIN_STORE_DWORD));
+   igt_assert(opts->store_length < LOOP_START_OFFSET - 16);
+   igt_assert(opts->store_data);
+   len = opts->store_length;
+   } else {
+   len = sizeof(uint32_t);
+   }
+
+   addr += 4096; /* guard page */
+   obj[SCRATCH].offset = addr;
+   obj[SCRATCH].handle = opts->store_handle;
+   obj[SCRATCH].flags = EXEC_OBJECT_WRITE;
+
+   r = [obj[BATCH].relocation_count++];
+   r->read_domains = I915_GEM_DOMAIN_RENDER;
+   r->write_domain = I915_GEM_DOMAIN_RENDER;
+
+   if (gen == 4 || gen == 5) {
+   execbuf->flags |= I915_EXEC_SECURE;
+   igt_require(__igt_device_set_master(fd) == 0);
+   }
+
+   r->presumed_offset = obj[SCRATCH].offset;
+   r->target_handle = obj[SCRATCH].handle;
+   r->offset = sizeof(uint32_t) * 1;
+   r->delta = opts->store_offset;
+
+   cmd = len / sizeof(uint32_t) + 1;
+   if (gen >= 4)
+   cmd++;
+   *cs++ = 0x20 << 23 | (gen < 6 ? 1 << 22 : 0) | cmd;
+
+   if (gen >= 8) {
+   *cs++ = r->presumed_offset + r->delta;
+   *cs++ = 0;
+   } else if (gen >= 4) {
+   *cs++ = 0;
+   *cs++ = r->presumed_offset + r->delta;
+   r->offset += sizeof(uint32_t);
+   } else {
+   *cs++ = r->presumed_offset + r->delta;
+   }
+
+   if (opts->flags & IGT_SPIN_STORE_DWORD) {
+   *cs++ = opts->store_dw;
+   } else {
+   memcpy(cs, opts->store_data, len);
+   cs += len / sizeof(*cs);
+   }
+
execbuf->buffer_count++;
}
 
@@ -258,7 +325,7 @@ emit_recursive_batch(igt_spin_t *spin,
 * trouble. See https://bugs.freedesktop.org/show_bug.cgi?id=102262
 */
if (!(opts->flags & IGT_SPIN_FAST))
-   cs += 960;
+   cs = spin->batch + 1000;
 
/*
 * When using a cmdparser, 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Check for rq->hwsp validity after acquiring RCU lock (rev2)

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Check for rq->hwsp validity after acquiring RCU lock (rev2)
URL   : https://patchwork.freedesktop.org/series/85071/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9503 -> Patchwork_19178


Summary
---

  **SUCCESS**

  No regressions found.

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

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@debugfs_test@read_all_entries:
- fi-tgl-y:   [PASS][1] -> [DMESG-WARN][2] ([i915#402]) +2 similar 
issues
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-tgl-y/igt@debugfs_test@read_all_entries.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/fi-tgl-y/igt@debugfs_test@read_all_entries.html

  * igt@kms_chamelium@dp-crc-fast:
- fi-cml-u2:  [PASS][3] -> [FAIL][4] ([i915#1161] / [i915#262])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-cml-u2/igt@kms_chamel...@dp-crc-fast.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/fi-cml-u2/igt@kms_chamel...@dp-crc-fast.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
- fi-cfl-8109u:   [PASS][5] -> [DMESG-WARN][6] ([i915#165]) +15 similar 
issues
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-cfl-8109u/igt@kms_pipe_crc_ba...@compare-crc-sanitycheck-pipe-b.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/fi-cfl-8109u/igt@kms_pipe_crc_ba...@compare-crc-sanitycheck-pipe-b.html

  
 Possible fixes 

  * igt@i915_selftest@live@active:
- fi-kbl-r:   [DMESG-FAIL][7] ([i915#2291] / [i915#666]) -> 
[PASS][8]
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-kbl-r/igt@i915_selftest@l...@active.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/fi-kbl-r/igt@i915_selftest@l...@active.html

  * igt@prime_self_import@basic-with_one_bo_two_files:
- fi-tgl-y:   [DMESG-WARN][9] ([i915#402]) -> [PASS][10] +1 similar 
issue
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html

  
  [i915#1161]: https://gitlab.freedesktop.org/drm/intel/issues/1161
  [i915#165]: https://gitlab.freedesktop.org/drm/intel/issues/165
  [i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
  [i915#262]: https://gitlab.freedesktop.org/drm/intel/issues/262
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
  [i915#666]: https://gitlab.freedesktop.org/drm/intel/issues/666


Participating hosts (42 -> 39)
--

  Missing(3): fi-ilk-m540 fi-bdw-samus fi-hsw-4200u 


Build changes
-

  * Linux: CI_DRM_9503 -> Patchwork_19178

  CI-20190529: 20190529
  CI_DRM_9503: 82c5c0ad8d578504865837b2135b60dd2d0054a1 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5909: 3d6caf71a3e988cd125eb9efdd0a7cdcd0451673 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_19178: a93ba5a18bf8acda650027601343a1bdc52b84ec @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

a93ba5a18bf8 drm/i915: Check for rq->hwsp validity after acquiring RCU lock

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19178/index.html
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Check for rq->hwsp validity after acquiring RCU lock (rev2)

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Check for rq->hwsp validity after acquiring RCU lock (rev2)
URL   : https://patchwork.freedesktop.org/series/85071/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
a93ba5a18bf8 drm/i915: Check for rq->hwsp validity after acquiring RCU lock
-:28: WARNING:BAD_SIGN_OFF: email address ' # v5.1+' 
might be better as 'sta...@vger.kernel.org# v5.1+'
#28: 
Cc:  # v5.1+

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


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.BAT: success for Add support for DP-HDMI2.1 PCON (rev9)

2020-12-18 Thread Patchwork
== Series Details ==

Series: Add support for DP-HDMI2.1 PCON (rev9)
URL   : https://patchwork.freedesktop.org/series/82098/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9503 -> Patchwork_19177


Summary
---

  **SUCCESS**

  No regressions found.

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

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@prime_vgem@basic-read:
- fi-tgl-y:   [PASS][1] -> [DMESG-WARN][2] ([i915#402]) +2 similar 
issues
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-tgl-y/igt@prime_v...@basic-read.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/fi-tgl-y/igt@prime_v...@basic-read.html

  
 Possible fixes 

  * igt@i915_selftest@live@active:
- fi-kbl-r:   [DMESG-FAIL][3] ([i915#2291] / [i915#666]) -> 
[PASS][4]
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-kbl-r/igt@i915_selftest@l...@active.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/fi-kbl-r/igt@i915_selftest@l...@active.html

  * igt@prime_self_import@basic-with_one_bo_two_files:
- fi-tgl-y:   [DMESG-WARN][5] ([i915#402]) -> [PASS][6] +1 similar 
issue
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html

  
  [i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
  [i915#666]: https://gitlab.freedesktop.org/drm/intel/issues/666


Participating hosts (42 -> 39)
--

  Missing(3): fi-ilk-m540 fi-bdw-samus fi-hsw-4200u 


Build changes
-

  * Linux: CI_DRM_9503 -> Patchwork_19177

  CI-20190529: 20190529
  CI_DRM_9503: 82c5c0ad8d578504865837b2135b60dd2d0054a1 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5909: 3d6caf71a3e988cd125eb9efdd0a7cdcd0451673 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_19177: d739034947bb5b262c819a0e4a0a1c01beef9e01 @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

d739034947bb drm/i915/display: Let PCON convert from RGB to YCbCr if it can
34ee9dfdadfd drm/i915/display: Configure PCON for DSC1.1 to DSC1.2 encoding
35f69a655bad drm/i915: Add helper functions for calculating DSC parameters for 
HDMI2.1
ca5d8df43ceb drm/i915: Read DSC capabilities of the HDMI2.1 PCON encoder
126578f6fe39 drm/i915: Add support for enabling link status and recovery
3793f5252161 drm/i915: Check for FRL training before DP Link training
0f68d7283295 drm/i915: Add support for starting FRL training for HDMI2.1 via 
PCON
29e16a799211 drm/i915: Capture max frl rate for PCON in dfp cap structure
d1464a87a5a8 drm/dp_helper: Add helpers to configure PCONs RGB-YCbCr Conversion
2f4d3c12ee27 drm/dp_helper: Add support for Configuring DSC for HDMI2.1 Pcon
c68914ce7b67 drm/dp_helper: Add support for link failure detection
5120b1727391 drm/dp_helper: Add Helpers for FRL Link Training support for 
DP-HDMI2.1 PCON
89853c019e04 drm/edid: Parse DSC1.2 cap fields from HFVSDB block
13ffe829d77e drm/edid: Parse MAX_FRL field from HFVSDB block
26eb0c2f2ee1 drm/edid: Add additional HFVSDB fields for HDMI2.1

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19177/index.html
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Add support for DP-HDMI2.1 PCON (rev9)

2020-12-18 Thread Patchwork
== Series Details ==

Series: Add support for DP-HDMI2.1 PCON (rev9)
URL   : https://patchwork.freedesktop.org/series/82098/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static 
assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Add support for DP-HDMI2.1 PCON (rev9)

2020-12-18 Thread Patchwork
== Series Details ==

Series: Add support for DP-HDMI2.1 PCON (rev9)
URL   : https://patchwork.freedesktop.org/series/82098/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
26eb0c2f2ee1 drm/edid: Add additional HFVSDB fields for HDMI2.1
-:61: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email name mismatch: 
'From: Swati Sharma ' != 'Signed-off-by: Sharma, 
Swati2 '

total: 0 errors, 1 warnings, 0 checks, 36 lines checked
13ffe829d77e drm/edid: Parse MAX_FRL field from HFVSDB block
-:73: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#73: FILE: drivers/gpu/drm/drm_edid.c:4948:
+   drm_get_max_frl_rate(max_frl_rate, >max_lanes,
+   >max_frl_rate_per_lane);

-:95: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email name mismatch: 
'From: Swati Sharma ' != 'Signed-off-by: Sharma, 
Swati2 '

total: 0 errors, 1 warnings, 1 checks, 68 lines checked
89853c019e04 drm/edid: Parse DSC1.2 cap fields from HFVSDB block
-:51: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#51: FILE: drivers/gpu/drm/drm_edid.c:4969:
+   drm_get_max_frl_rate(dsc_max_frl_rate, 
_dsc->max_lanes,
+   _dsc->max_frl_rate_per_lane);

-:52: WARNING:LONG_LINE: line length of 101 exceeds 100 columns
#52: FILE: drivers/gpu/drm/drm_edid.c:4970:
+   hdmi_dsc->total_chunk_kbytes = hf_vsdb[13] & 
DRM_EDID_DSC_TOTAL_CHUNK_KBYTES;

total: 0 errors, 1 warnings, 1 checks, 125 lines checked
5120b1727391 drm/dp_helper: Add Helpers for FRL Link Training support for 
DP-HDMI2.1 PCON
c68914ce7b67 drm/dp_helper: Add support for link failure detection
-:112: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#112: FILE: include/drm/drm_dp_helper.h:2055:
+void drm_dp_pcon_hdmi_frl_link_error_count(struct drm_dp_aux *aux,
+ struct drm_connector *connector);

total: 0 errors, 0 warnings, 1 checks, 76 lines checked
2f4d3c12ee27 drm/dp_helper: Add support for Configuring DSC for HDMI2.1 Pcon
-:15: WARNING:TYPO_SPELLING: 'Convertor' may be misspelled - perhaps 
'Converter'?
#15: 
v3: Only setting the DSC bits for the Protocol Convertor control

-:165: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a 
separate line
#165: FILE: drivers/gpu/drm/drm_dp_helper.c:3037:
+ * */

-:185: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a 
separate line
#185: FILE: drivers/gpu/drm/drm_dp_helper.c:3057:
+ * */

-:210: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a 
separate line
#210: FILE: drivers/gpu/drm/drm_dp_helper.c:3082:
+ * */

total: 0 errors, 4 warnings, 0 checks, 343 lines checked
d1464a87a5a8 drm/dp_helper: Add helpers to configure PCONs RGB-YCbCr Conversion
-:18: WARNING:TYPO_SPELLING: 'accomodate' may be misspelled - perhaps 
'accommodate'?
#18: 
-Modified the color-conversion cap helper function, to accomodate

total: 0 errors, 1 warnings, 0 checks, 106 lines checked
29e16a799211 drm/i915: Capture max frl rate for PCON in dfp cap structure
-:13: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#13: 
-tweaked the comparison of target bw and pcon frl bw to avoid roundup errors.

total: 0 errors, 1 warnings, 0 checks, 60 lines checked
0f68d7283295 drm/i915: Add support for starting FRL training for HDMI2.1 via 
PCON
-:86: CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
#86: FILE: drivers/gpu/drm/i915/display/intel_dp.c:4005:
+{
+

-:147: WARNING:LONG_LINE: line length of 101 exceeds 100 columns
#147: FILE: drivers/gpu/drm/i915/display/intel_dp.c:4066:
+   wait_for(is_active = drm_dp_pcon_is_frl_ready(_dp->aux) == true, 
TIMEOUT_FRL_READY_MS);

-:166: WARNING:LONG_LINE: line length of 112 exceeds 100 columns
#166: FILE: drivers/gpu/drm/i915/display/intel_dp.c:4085:
+   wait_for(is_active = drm_dp_pcon_hdmi_link_active(_dp->aux) == 
true, TIMEOUT_HDMI_LINK_ACTIVE_MS);

-:172: WARNING:LONG_LINE: line length of 101 exceeds 100 columns
#172: FILE: drivers/gpu/drm/i915/display/intel_dp.c:4091:
+   if (DP_PCON_HDMI_MODE_FRL != drm_dp_pcon_hdmi_link_mode(_dp->aux, 
_trained_mask)) {

-:172: WARNING:CONSTANT_COMPARISON: Comparisons should place the constant on 
the right side of the test
#172: FILE: drivers/gpu/drm/i915/display/intel_dp.c:4091:
+   if (DP_PCON_HDMI_MODE_FRL != drm_dp_pcon_hdmi_link_mode(_dp->aux, 
_trained_mask)) {

-:176: WARNING:LONG_LINE: line length of 109 exceeds 100 columns
#176: FILE: drivers/gpu/drm/i915/display/intel_dp.c:4095:
+   drm_dbg(>drm, "MAX_FRL_MASK = %u, FRL_TRAINED_MASK = %u\n", 
max_frl_bw_mask, frl_trained_mask);

total: 0 errors, 5 warnings, 1 checks, 194 lines checked
3793f5252161 drm/i915: Check for FRL training before DP Link training
126578f6fe39 drm/i915: Add support for enabling link status and recovery
-:54: WARNING:LONG_LINE: line length 

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Check for rq->hwsp validity after acquiring RCU lock
URL   : https://patchwork.freedesktop.org/series/85071/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9503 -> Patchwork_19175


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_19175 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_19175, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@i915_selftest@live@gt_timelines:
- fi-ivb-3770:[PASS][1] -> [INCOMPLETE][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-ivb-3770/igt@i915_selftest@live@gt_timelines.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-ivb-3770/igt@i915_selftest@live@gt_timelines.html
- fi-snb-2520m:   [PASS][3] -> [INCOMPLETE][4]
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-snb-2520m/igt@i915_selftest@live@gt_timelines.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-snb-2520m/igt@i915_selftest@live@gt_timelines.html
- fi-byt-j1900:   [PASS][5] -> [INCOMPLETE][6]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-byt-j1900/igt@i915_selftest@live@gt_timelines.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-byt-j1900/igt@i915_selftest@live@gt_timelines.html
- fi-hsw-4770:[PASS][7] -> [INCOMPLETE][8]
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-hsw-4770/igt@i915_selftest@live@gt_timelines.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-hsw-4770/igt@i915_selftest@live@gt_timelines.html
- fi-bwr-2160:[PASS][9] -> [INCOMPLETE][10]
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-bwr-2160/igt@i915_selftest@live@gt_timelines.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-bwr-2160/igt@i915_selftest@live@gt_timelines.html
- fi-snb-2600:[PASS][11] -> [INCOMPLETE][12]
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-snb-2600/igt@i915_selftest@live@gt_timelines.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-snb-2600/igt@i915_selftest@live@gt_timelines.html
- fi-ilk-650: [PASS][13] -> [INCOMPLETE][14]
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-ilk-650/igt@i915_selftest@live@gt_timelines.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-ilk-650/igt@i915_selftest@live@gt_timelines.html
- fi-elk-e7500:   [PASS][15] -> [INCOMPLETE][16]
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-elk-e7500/igt@i915_selftest@live@gt_timelines.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-elk-e7500/igt@i915_selftest@live@gt_timelines.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@i915_selftest@live@gt_timelines:
- fi-pnv-d510:[PASS][17] -> [INCOMPLETE][18] ([i915#299])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-pnv-d510/igt@i915_selftest@live@gt_timelines.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-pnv-d510/igt@i915_selftest@live@gt_timelines.html
- fi-gdg-551: [PASS][19] -> [INCOMPLETE][20] ([i915#172])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9503/fi-gdg-551/igt@i915_selftest@live@gt_timelines.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19175/fi-gdg-551/igt@i915_selftest@live@gt_timelines.html

  
  [i915#172]: https://gitlab.freedesktop.org/drm/intel/issues/172
  [i915#299]: https://gitlab.freedesktop.org/drm/intel/issues/299


Participating hosts (42 -> 11)
--

  ERROR: It appears as if the changes made in Patchwork_19175 prevented too 
many machines from booting.

  Missing(31): fi-kbl-soraka fi-bdw-gvtdvm fi-icl-u2 fi-apl-guc fi-icl-y 
fi-skl-6600u fi-cml-u2 fi-bxt-dsi fi-bdw-5557u fi-cml-s fi-bsw-n3050 fi-tgl-u2 
fi-glk-dsi fi-kbl-7500u fi-tgl-y fi-bsw-nick fi-skl-6700k2 fi-kbl-r fi-ilk-m540 
fi-ehl-1 fi-tgl-dsi fi-skl-guc fi-cfl-8700k fi-hsw-4200u fi-cfl-guc fi-kbl-guc 
fi-kbl-x1275 fi-cfl-8109u fi-kbl-8809g fi-bsw-kefka fi-bdw-samus 


Build changes
-

  * Linux: CI_DRM_9503 -> Patchwork_19175

  CI-20190529: 20190529
  CI_DRM_9503: 82c5c0ad8d578504865837b2135b60dd2d0054a1 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5909: 

[Intel-gfx] ✗ Fi.CI.BUILD: failure for Infoframe changes for DP-HDMI2.1 PCON

2020-12-18 Thread Patchwork
== Series Details ==

Series: Infoframe changes for DP-HDMI2.1 PCON
URL   : https://patchwork.freedesktop.org/series/85073/
State : failure

== Summary ==

Applying: drm/i915: Export intel_hdmi_compute_avi_infoframe()
Using index info to reconstruct a base tree...
M   drivers/gpu/drm/i915/display/intel_hdmi.c
M   drivers/gpu/drm/i915/display/intel_hdmi.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/display/intel_hdmi.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_hdmi.h
Auto-merging drivers/gpu/drm/i915/display/intel_hdmi.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/i915: Export intel_hdmi_compute_avi_infoframe()
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 1/2] drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping

2020-12-18 Thread Lucas De Marchi

On Fri, Dec 18, 2020 at 01:13:49PM +0200, Jani Nikula wrote:

On Fri, 18 Dec 2020, Jani Nikula  wrote:

On Thu, 17 Dec 2020, Lucas De Marchi  wrote:

Both patches applied. Thanks!

Jani, maybe now you can rebase your patch to get rid of the extern ?


Yes, thanks for the irq so I can stop polling. ;)


Huh, why were these applied to drm-intel-gt-next? It's much more about
driver core code than gt.


sigh... by mistake. At the time as was mainly thinking about the WAs
that are affected by these and thought it would belong to gt.

what now? Do we apply in to drm-intel-next as well or wait for a backmerge?

sorry,

Lucas De Marchi



BR,
Jani.




BR,
Jani.





Lucas De Marchi

On Wed, Dec 02, 2020 at 11:23:58PM -0800, Aditya Swarup wrote:

Fix TGL REVID macros to fetch correct display/gt stepping based
on SOC rev id from INTEL_REVID() macro. Previously, we were just
returning the first element of the revid array instead of using
the correct index based on SOC rev id.

Fixes: ("drm/i915/tgl: Fix stepping WA matching")
Cc: José Roberto de Souza 
Cc: Matt Roper 
Cc: Lucas De Marchi 
Cc: Jani Nikula 
Cc: Ville Syrjälä 
Signed-off-by: Aditya Swarup 
Reviewed-by: Lucas De Marchi 
---
drivers/gpu/drm/i915/i915_drv.h | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index fc1090c6889c..2e2149c9a2f4 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1580,9 +1580,9 @@ static inline const struct i915_rev_steppings *
tgl_revids_get(struct drm_i915_private *dev_priv)
{
if (IS_TGL_U(dev_priv) || IS_TGL_Y(dev_priv))
-   return tgl_uy_revids;
+   return _uy_revids[INTEL_REVID(dev_priv)];
else
-   return tgl_revids;
+   return _revids[INTEL_REVID(dev_priv)];
}

#define IS_TGL_DISP_REVID(p, since, until) \
@@ -1592,14 +1592,14 @@ tgl_revids_get(struct drm_i915_private *dev_priv)

#define IS_TGL_UY_GT_REVID(p, since, until) \
((IS_TGL_U(p) || IS_TGL_Y(p)) && \
-tgl_uy_revids->gt_stepping >= (since) && \
-tgl_uy_revids->gt_stepping <= (until))
+tgl_uy_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
+tgl_uy_revids[INTEL_REVID(p)].gt_stepping <= (until))

#define IS_TGL_GT_REVID(p, since, until) \
(IS_TIGERLAKE(p) && \
 !(IS_TGL_U(p) || IS_TGL_Y(p)) && \
-tgl_revids->gt_stepping >= (since) && \
-tgl_revids->gt_stepping <= (until))
+tgl_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
+tgl_revids[INTEL_REVID(p)].gt_stepping <= (until))

#define RKL_REVID_A00x0
#define RKL_REVID_B00x1
--
2.27.0

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


--
Jani Nikula, Intel Open Source Graphics Center

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Check for rq->hwsp validity after acquiring RCU lock
URL   : https://patchwork.freedesktop.org/series/85071/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
eda31dae2517 drm/i915: Check for rq->hwsp validity after acquiring RCU lock
-:28: WARNING:BAD_SIGN_OFF: email address ' # v5.1+' 
might be better as 'sta...@vger.kernel.org# v5.1+'
#28: 
Cc:  # v5.1+

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


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2] drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Chris Wilson
Since we allow removing the timeline map at runtime, there is a risk
that rq->hwsp points into a stale page. To control that risk, we hold
the RCU read lock while reading *rq->hwsp, but we missed a couple of
important barriers. First, the unpinning / removal of the timeline map
must be after all RCU readers into that map are complete, i.e. after an
rcu barrier (in this case courtesy of call_rcu()). Secondly, we must
make sure that the rq->hwsp we are about to dereference under the RCU
lock is valid. In this case, we make the rq->hwsp pointer safe during
i915_request_retire() and so we know that rq->hwsp may become invalid
only after the request has been signaled. Therefore is the request is
not yet signaled when we acquire rq->hwsp under the RCU, we know that
rq->hwsp will remain valid for the duration of the RCU read lock.

This is a very small window that may lead to either considering the
request not completed (causing a delay until the request is checked
again, any wait for the request is not affected) or dereferencing an
invalid pointer.

Fixes: 3adac4689f58 ("drm/i915: Introduce concept of per-timeline (context) 
HWSP")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc:  # v5.1+
---
 drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 11 ++
 drivers/gpu/drm/i915/gt/intel_timeline.c| 10 +++---
 drivers/gpu/drm/i915/i915_request.h | 37 ++---
 3 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 
b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
index 3c62fd6daa76..f96cd7d9b419 100644
--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
@@ -134,11 +134,6 @@ static bool remove_signaling_context(struct 
intel_breadcrumbs *b,
return true;
 }
 
-static inline bool __request_completed(const struct i915_request *rq)
-{
-   return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
-}
-
 __maybe_unused static bool
 check_signal_order(struct intel_context *ce, struct i915_request *rq)
 {
@@ -245,7 +240,7 @@ static void signal_irq_work(struct irq_work *work)
list_for_each_entry_rcu(rq, >signals, signal_link) {
bool release;
 
-   if (!__request_completed(rq))
+   if (!__i915_request_is_complete(rq))
break;
 
if (!test_and_clear_bit(I915_FENCE_FLAG_SIGNAL,
@@ -380,7 +375,7 @@ static void insert_breadcrumb(struct i915_request *rq)
 * straight onto a signaled list, and queue the irq worker for
 * its signal completion.
 */
-   if (__request_completed(rq)) {
+   if (__i915_request_is_complete(rq)) {
irq_signal_request(rq, b);
return;
}
@@ -468,7 +463,7 @@ void i915_request_cancel_breadcrumb(struct i915_request *rq)
if (release)
intel_context_put(ce);
 
-   if (__request_completed(rq))
+   if (__i915_request_is_complete(rq))
irq_signal_request(rq, b);
 
i915_request_put(rq);
diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c 
b/drivers/gpu/drm/i915/gt/intel_timeline.c
index 512afacd2bdc..a005d0165bf4 100644
--- a/drivers/gpu/drm/i915/gt/intel_timeline.c
+++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
@@ -126,6 +126,10 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
struct intel_timeline_cacheline *cl =
container_of(rcu, typeof(*cl), rcu);
 
+   /* Must wait until after all *rq->hwsp are complete before removing */
+   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
+   __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, CACHELINE_BITS));
+
i915_active_fini(>active);
kfree(cl);
 }
@@ -133,11 +137,6 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
 static void __idle_cacheline_free(struct intel_timeline_cacheline *cl)
 {
GEM_BUG_ON(!i915_active_is_idle(>active));
-
-   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
-   i915_vma_put(cl->hwsp->vma);
-   __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, CACHELINE_BITS));
-
call_rcu(>rcu, __rcu_cacheline_free);
 }
 
@@ -179,7 +178,6 @@ cacheline_alloc(struct intel_timeline_hwsp *hwsp, unsigned 
int cacheline)
return ERR_CAST(vaddr);
}
 
-   i915_vma_get(hwsp->vma);
cl->hwsp = hwsp;
cl->vaddr = page_pack_bits(vaddr, cacheline);
 
diff --git a/drivers/gpu/drm/i915/i915_request.h 
b/drivers/gpu/drm/i915/i915_request.h
index 92e4320c50c4..7c4453e60323 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -440,7 +440,7 @@ static inline u32 hwsp_seqno(const struct i915_request *rq)
 
 static inline bool __i915_request_has_started(const struct i915_request *rq)
 {
-   return i915_seqno_passed(hwsp_seqno(rq), rq->fence.seqno - 1);
+   return i915_seqno_passed(__hwsp_seqno(rq), 

Re: [Intel-gfx] [PATCH] drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Chris Wilson
Quoting Chris Wilson (2020-12-18 09:19:44)
> Since we allow removing the timeline map at runtime, there is a risk
> that rq->hwsp points into a stale page. To control that risk, we hold
> the RCU read lock while reading *rq->hwsp, but we missed a couple of
> important barriers. First, the unpinning / removal of the timeline map
> must be after all RCU readers into that map are complete, i.e. after an
> rcu barrier (in this case courtesy of call_rcu()). Secondly, we must
> make sure that the rq->hwsp we are about to dereference under the RCU
> lock is valid. In this case, we make the rq->hwsp pointer safe during
> i915_request_retire() and so we know that rq->hwsp may become invalid
> only after the request has been signaled. Therefore is the request is
> not yet signaled when we acquire rq->hwsp under the RCU, we know that
> rq->hwsp will remain valid for the duration of the RCU read lock.
> 
> This is a very small window that may lead to either considering the
> request not completed (causing a delay until the request is checked
> again, any wait for the request is not affected) or dereferencing an
> invalid pointer.
> 
> Fixes: 3adac4689f58 ("drm/i915: Introduce concept of per-timeline (context) 
> HWSP")
> Signed-off-by: Chris Wilson 
> Cc: Tvrtko Ursulin 
> Cc:  # v5.1+
> ---
>  drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 11 ++
>  drivers/gpu/drm/i915/gt/intel_timeline.c|  6 ++--
>  drivers/gpu/drm/i915/i915_request.h | 37 ++---
>  3 files changed, 39 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 
> b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> index 3c62fd6daa76..f96cd7d9b419 100644
> --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> @@ -134,11 +134,6 @@ static bool remove_signaling_context(struct 
> intel_breadcrumbs *b,
> return true;
>  }
>  
> -static inline bool __request_completed(const struct i915_request *rq)
> -{
> -   return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
> -}
> -
>  __maybe_unused static bool
>  check_signal_order(struct intel_context *ce, struct i915_request *rq)
>  {
> @@ -245,7 +240,7 @@ static void signal_irq_work(struct irq_work *work)
> list_for_each_entry_rcu(rq, >signals, signal_link) {
> bool release;
>  
> -   if (!__request_completed(rq))
> +   if (!__i915_request_is_complete(rq))
> break;
>  
> if (!test_and_clear_bit(I915_FENCE_FLAG_SIGNAL,
> @@ -380,7 +375,7 @@ static void insert_breadcrumb(struct i915_request *rq)
>  * straight onto a signaled list, and queue the irq worker for
>  * its signal completion.
>  */
> -   if (__request_completed(rq)) {
> +   if (__i915_request_is_complete(rq)) {
> irq_signal_request(rq, b);
> return;
> }
> @@ -468,7 +463,7 @@ void i915_request_cancel_breadcrumb(struct i915_request 
> *rq)
> if (release)
> intel_context_put(ce);
>  
> -   if (__request_completed(rq))
> +   if (__i915_request_is_complete(rq))
> irq_signal_request(rq, b);
>  
> i915_request_put(rq);
> diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c 
> b/drivers/gpu/drm/i915/gt/intel_timeline.c
> index 512afacd2bdc..a0ce2fb8737a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_timeline.c
> +++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
> @@ -126,6 +126,10 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
> struct intel_timeline_cacheline *cl =
> container_of(rcu, typeof(*cl), rcu);
>  
> +   /* Must wait until after all *rq->hwsp are complete before removing */
> +   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
> +   i915_vma_put(cl->hwsp->vma);
> +
> i915_active_fini(>active);
> kfree(cl);
>  }
> @@ -134,8 +138,6 @@ static void __idle_cacheline_free(struct 
> intel_timeline_cacheline *cl)
>  {
> GEM_BUG_ON(!i915_active_is_idle(>active));
>  
> -   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
> -   i915_vma_put(cl->hwsp->vma);
> __idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, 
> CACHELINE_BITS));

I was thinking this was just marking it as being available, but no it
really does free.
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Try to guess PCH type even without ISA bridge (rev2)

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Try to guess PCH type even without ISA bridge (rev2)
URL   : https://patchwork.freedesktop.org/series/84886/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9502_full -> Patchwork_19174_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_exec_create@madvise:
- shard-glk:  [PASS][1] -> [DMESG-WARN][2] ([i915#118] / [i915#95])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-glk5/igt@gem_exec_cre...@madvise.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-glk7/igt@gem_exec_cre...@madvise.html

  * igt@gem_exec_reloc@basic-wide-active@vcs1:
- shard-iclb: NOTRUN -> [FAIL][3] ([i915#2389])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-iclb2/igt@gem_exec_reloc@basic-wide-act...@vcs1.html

  * igt@gem_pwrite@basic-exhaustion:
- shard-kbl:  NOTRUN -> [WARN][4] ([i915#2658])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-kbl2/igt@gem_pwr...@basic-exhaustion.html

  * igt@gen9_exec_parse@allowed-single:
- shard-skl:  [PASS][5] -> [DMESG-WARN][6] ([i915#1436] / 
[i915#716])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-skl4/igt@gen9_exec_pa...@allowed-single.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-skl1/igt@gen9_exec_pa...@allowed-single.html

  * igt@i915_pm_rc6_residency@rc6-fence:
- shard-hsw:  [PASS][7] -> [WARN][8] ([i915#1519])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-hsw8/igt@i915_pm_rc6_reside...@rc6-fence.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-hsw4/igt@i915_pm_rc6_reside...@rc6-fence.html

  * igt@i915_suspend@debugfs-reader:
- shard-iclb: [PASS][9] -> [INCOMPLETE][10] ([i915#1185])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-iclb1/igt@i915_susp...@debugfs-reader.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-iclb3/igt@i915_susp...@debugfs-reader.html

  * igt@i915_suspend@sysfs-reader:
- shard-skl:  [PASS][11] -> [INCOMPLETE][12] ([i915#198]) +1 
similar issue
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-skl7/igt@i915_susp...@sysfs-reader.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-skl10/igt@i915_susp...@sysfs-reader.html

  * igt@kms_color_chamelium@pipe-b-ctm-0-75:
- shard-skl:  NOTRUN -> [SKIP][13] ([fdo#109271] / [fdo#111827])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-skl9/igt@kms_color_chamel...@pipe-b-ctm-0-75.html

  * igt@kms_color_chamelium@pipe-b-ctm-limited-range:
- shard-kbl:  NOTRUN -> [SKIP][14] ([fdo#109271] / [fdo#111827]) +2 
similar issues
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-kbl2/igt@kms_color_chamel...@pipe-b-ctm-limited-range.html

  * igt@kms_color_chamelium@pipe-d-ctm-negative:
- shard-hsw:  NOTRUN -> [SKIP][15] ([fdo#109271] / [fdo#111827])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-hsw2/igt@kms_color_chamel...@pipe-d-ctm-negative.html

  * igt@kms_cursor_crc@pipe-a-cursor-128x42-random:
- shard-skl:  [PASS][16] -> [FAIL][17] ([i915#54]) +2 similar issues
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-skl10/igt@kms_cursor_...@pipe-a-cursor-128x42-random.html
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-skl3/igt@kms_cursor_...@pipe-a-cursor-128x42-random.html

  * igt@kms_flip@flip-vs-expired-vblank-interruptible@a-edp1:
- shard-tglb: [PASS][18] -> [FAIL][19] ([i915#2598])
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-tglb6/igt@kms_flip@flip-vs-expired-vblank-interrupti...@a-edp1.html
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-tglb8/igt@kms_flip@flip-vs-expired-vblank-interrupti...@a-edp1.html

  * igt@kms_flip@flip-vs-expired-vblank-interruptible@c-hdmi-a1:
- shard-glk:  [PASS][20] -> [FAIL][21] ([i915#79])
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-glk4/igt@kms_flip@flip-vs-expired-vblank-interrupti...@c-hdmi-a1.html
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/shard-glk8/igt@kms_flip@flip-vs-expired-vblank-interrupti...@c-hdmi-a1.html

  * igt@kms_flip@flip-vs-expired-vblank@a-edp1:
- shard-skl:  [PASS][22] -> [FAIL][23] ([i915#79]) +1 similar issue
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/shard-skl9/igt@kms_flip@flip-vs-expired-vbl...@a-edp1.html
   [23]: 

Re: [Intel-gfx] [PATCH v2 1/2] drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping

2020-12-18 Thread Jani Nikula
On Fri, 18 Dec 2020, Jani Nikula  wrote:
> On Thu, 17 Dec 2020, Lucas De Marchi  wrote:
>> Both patches applied. Thanks!
>>
>> Jani, maybe now you can rebase your patch to get rid of the extern ?
>
> Yes, thanks for the irq so I can stop polling. ;)

Huh, why were these applied to drm-intel-gt-next? It's much more about
driver core code than gt.

BR,
Jani.


>
> BR,
> Jani.
>
>
>>
>>
>> Lucas De Marchi
>>
>> On Wed, Dec 02, 2020 at 11:23:58PM -0800, Aditya Swarup wrote:
>>>Fix TGL REVID macros to fetch correct display/gt stepping based
>>>on SOC rev id from INTEL_REVID() macro. Previously, we were just
>>>returning the first element of the revid array instead of using
>>>the correct index based on SOC rev id.
>>>
>>>Fixes: ("drm/i915/tgl: Fix stepping WA matching")
>>>Cc: José Roberto de Souza 
>>>Cc: Matt Roper 
>>>Cc: Lucas De Marchi 
>>>Cc: Jani Nikula 
>>>Cc: Ville Syrjälä 
>>>Signed-off-by: Aditya Swarup 
>>>Reviewed-by: Lucas De Marchi 
>>>---
>>> drivers/gpu/drm/i915/i915_drv.h | 12 ++--
>>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>>
>>>diff --git a/drivers/gpu/drm/i915/i915_drv.h 
>>>b/drivers/gpu/drm/i915/i915_drv.h
>>>index fc1090c6889c..2e2149c9a2f4 100644
>>>--- a/drivers/gpu/drm/i915/i915_drv.h
>>>+++ b/drivers/gpu/drm/i915/i915_drv.h
>>>@@ -1580,9 +1580,9 @@ static inline const struct i915_rev_steppings *
>>> tgl_revids_get(struct drm_i915_private *dev_priv)
>>> {
>>> if (IS_TGL_U(dev_priv) || IS_TGL_Y(dev_priv))
>>>-return tgl_uy_revids;
>>>+return _uy_revids[INTEL_REVID(dev_priv)];
>>> else
>>>-return tgl_revids;
>>>+return _revids[INTEL_REVID(dev_priv)];
>>> }
>>>
>>> #define IS_TGL_DISP_REVID(p, since, until) \
>>>@@ -1592,14 +1592,14 @@ tgl_revids_get(struct drm_i915_private *dev_priv)
>>>
>>> #define IS_TGL_UY_GT_REVID(p, since, until) \
>>> ((IS_TGL_U(p) || IS_TGL_Y(p)) && \
>>>- tgl_uy_revids->gt_stepping >= (since) && \
>>>- tgl_uy_revids->gt_stepping <= (until))
>>>+ tgl_uy_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
>>>+ tgl_uy_revids[INTEL_REVID(p)].gt_stepping <= (until))
>>>
>>> #define IS_TGL_GT_REVID(p, since, until) \
>>> (IS_TIGERLAKE(p) && \
>>>  !(IS_TGL_U(p) || IS_TGL_Y(p)) && \
>>>- tgl_revids->gt_stepping >= (since) && \
>>>- tgl_revids->gt_stepping <= (until))
>>>+ tgl_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
>>>+ tgl_revids[INTEL_REVID(p)].gt_stepping <= (until))
>>>
>>> #define RKL_REVID_A00x0
>>> #define RKL_REVID_B00x1
>>>-- 
>>>2.27.0
>>>
>>>___
>>>Intel-gfx mailing list
>>>Intel-gfx@lists.freedesktop.org
>>>https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Graphics Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v7 15/15] drm/i915/display: Let PCON convert from RGB to YCbCr if it can

2020-12-18 Thread Shankar, Uma



> -Original Message-
> From: Nautiyal, Ankit K 
> Sent: Friday, December 18, 2020 4:07 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org; Shankar, Uma ;
> airl...@linux.ie; jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com;
> Kulkarni, Vandita ; Sharma, Swati2
> 
> Subject: [PATCH v7 15/15] drm/i915/display: Let PCON convert from RGB to
> YCbCr if it can
> 
> If PCON has capability to convert RGB->YCbCr colorspace and also to 444->420
> downsampling then for any YUV420 only mode, we can let the PCON do all the
> conversion. If the PCON supports
> RGB->YCbCr conversion for all BT2020, BT709, BT601, choose
> the one that is selected by userspace via connector colorspace property,
> otherwise default to BT601.
> 
> v2: As suggested by Uma Shankar, considered case for colorspace
> BT709 and BT2020, and default to BT601. Also appended dir 'display' in commit
> message.
> 
> v3: Fixed typo in condition for printing one of the error msg.
> 
> v4: As suggested by Uma Shankar:
> -Fixed bug in determining the colorspace for RGB->YCbCr conversion.
> -Fixed minor formatting issues
> Also updated the commit message as per latest changes.

Changes look good, please work on color fixup as a separate series.
Reviewed-by: Uma Shankar 

> Signed-off-by: Ankit Nautiyal 
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c  |  3 +-
>  .../drm/i915/display/intel_display_types.h|  1 +
>  drivers/gpu/drm/i915/display/intel_dp.c   | 72 +++
>  drivers/gpu/drm/i915/display/intel_dp.h   |  3 +-
>  4 files changed, 65 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index fbc07a93504b..17eaa56c5a99 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3644,6 +3644,7 @@ static void tgl_ddi_pre_enable_dp(struct
> intel_atomic_state *state,
>   if (!is_mst)
>   intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
> 
> + intel_dp_configure_protocol_converter(intel_dp, crtc_state);
>   intel_dp_sink_set_decompression_state(intel_dp, crtc_state, true);
>   /*
>* DDI FEC: "anticipates enabling FEC encoding sets the FEC_READY bit
> @@ -3731,7 +3732,7 @@ static void hsw_ddi_pre_enable_dp(struct
> intel_atomic_state *state,
>   intel_ddi_init_dp_buf_reg(encoder, crtc_state);
>   if (!is_mst)
>   intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
> - intel_dp_configure_protocol_converter(intel_dp);
> + intel_dp_configure_protocol_converter(intel_dp, crtc_state);
>   intel_dp_sink_set_decompression_state(intel_dp, crtc_state,
> true);
>   intel_dp_sink_set_fec_ready(intel_dp, crtc_state); diff --git
> a/drivers/gpu/drm/i915/display/intel_display_types.h
> b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 4c01c7c23dfd..2009ae9e9678 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1460,6 +1460,7 @@ struct intel_dp {
>   int pcon_max_frl_bw;
>   u8 max_bpc;
>   bool ycbcr_444_to_420;
> + bool rgb_to_ycbcr;
>   } dfp;
> 
>   /* Display stream compression testing */ diff --git
> a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index fdc028b7db07..d7e01482c808 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -651,6 +651,10 @@ intel_dp_output_format(struct drm_connector
> *connector,
>   !drm_mode_is_420_only(info, mode))
>   return INTEL_OUTPUT_FORMAT_RGB;
> 
> + if (intel_dp->dfp.rgb_to_ycbcr &&
> + intel_dp->dfp.ycbcr_444_to_420)
> + return INTEL_OUTPUT_FORMAT_RGB;
> +
>   if (intel_dp->dfp.ycbcr_444_to_420)
>   return INTEL_OUTPUT_FORMAT_YCBCR444;
>   else
> @@ -4319,7 +4323,8 @@ static void intel_dp_enable_port(struct intel_dp
> *intel_dp,
>   intel_de_posting_read(dev_priv, intel_dp->output_reg);  }
> 
> -void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp)
> +void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp,
> +const struct intel_crtc_state 
> *crtc_state)
>  {
>   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>   u8 tmp;
> @@ -4348,12 +4353,42 @@ void intel_dp_configure_protocol_converter(struct
> intel_dp *intel_dp)
>   enableddisabled(intel_dp->dfp.ycbcr_444_to_420));
> 
>   tmp = 0;
> + if (intel_dp->dfp.rgb_to_ycbcr) {
> + bool bt2020, bt709;
> 
> - if (drm_dp_dpcd_writeb(_dp->aux,
> -DP_PROTOCOL_CONVERTER_CONTROL_2, tmp) <= 0)
> + /*
> +  * FIXME: Currently if userspace selects BT2020 or BT709, but
> PCON supports 

Re: [Intel-gfx] [PATCH v7 11/15] drm/i915: Add support for enabling link status and recovery

2020-12-18 Thread Shankar, Uma


> -Original Message-
> From: Nautiyal, Ankit K 
> Sent: Friday, December 18, 2020 4:07 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org; Shankar, Uma ;
> airl...@linux.ie; jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com;
> Kulkarni, Vandita ; Sharma, Swati2
> 
> Subject: [PATCH v7 11/15] drm/i915: Add support for enabling link status and
> recovery
> 
> From: Swati Sharma 
> 
> In this patch enables support for detecting link failures between PCON and 
> HDMI
> sink in i915 driver. HDMI link loss indication to upstream DP source is 
> indicated
> via IRQ_HPD. This is followed by reading of HDMI link configuration status
> (HDMI_TX_LINK_ACTIVE_STATUS).
> If the PCON → HDMI 2.1 link status is off; reinitiate frl link training to 
> recover.
> Also, report HDMI FRL link error count range for each individual FRL active 
> lane is
> indicated by DOWNSTREAM_HDMI_ERROR_STATUS_LN registers.
> 
> v2: Checked for dpcd read and write failures and added debug message.
> (Uma Shankar)
> 
> v3: Rearranged code to re-start FRL link training or fall back to TMDS mode.
> 
> v4: Resused function to check frl which inturn restarts FRL and fallback to 
> TMDS
> mode.
> 
> Signed-off-by: Swati Sharma 
> Signed-off-by: Ankit Nautiyal 
> Reviewed-by: Uma Shankar  (v2)

Change looks fine, you can keep RB.

> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 53 +++--
>  1 file changed, 50 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index 1e0ff39bb927..66f35e7c9903 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6013,6 +6013,28 @@ intel_dp_check_mst_status(struct intel_dp *intel_dp)
>   return link_ok;
>  }
> 
> +static void
> +intel_dp_handle_hdmi_link_status_change(struct intel_dp *intel_dp) {
> + bool is_active;
> + u8 buf = 0;
> +
> + is_active = drm_dp_pcon_hdmi_link_active(_dp->aux);
> + if (intel_dp->frl.is_trained && !is_active) {
> + if (drm_dp_dpcd_readb(_dp->aux,
> DP_PCON_HDMI_LINK_CONFIG_1, ) < 0)
> + return;
> +
> + buf &=  ~DP_PCON_ENABLE_HDMI_LINK;
> + if (drm_dp_dpcd_writeb(_dp->aux,
> DP_PCON_HDMI_LINK_CONFIG_1, buf) < 0)
> + return;
> +
> + drm_dp_pcon_hdmi_frl_link_error_count(_dp->aux,
> +_dp->attached_connector->base);
> +
> + /* Restart FRL training or fall back to TMDS mode */
> + intel_dp_check_frl_training(intel_dp);
> + }
> +}
> +
>  static bool
>  intel_dp_needs_link_retrain(struct intel_dp *intel_dp)  { @@ -6378,7 +6400,7
> @@ intel_dp_hotplug(struct intel_encoder *encoder,
>   return state;
>  }
> 
> -static void intel_dp_check_service_irq(struct intel_dp *intel_dp)
> +static void intel_dp_check_device_service_irq(struct intel_dp
> +*intel_dp)
>  {
>   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>   u8 val;
> @@ -6402,6 +6424,30 @@ static void intel_dp_check_service_irq(struct intel_dp
> *intel_dp)
>   drm_dbg_kms(>drm, "Sink specific irq unhandled\n");  }
> 
> +static void intel_dp_check_link_service_irq(struct intel_dp *intel_dp)
> +{
> + struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> + u8 val;
> +
> + if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
> + return;
> +
> + if (drm_dp_dpcd_readb(_dp->aux,
> +   DP_LINK_SERVICE_IRQ_VECTOR_ESI0, ) != 1 ||
> !val) {
> + drm_dbg_kms(>drm, "Error in reading link service irq
> vector\n");
> + return;
> + }
> +
> + if (drm_dp_dpcd_writeb(_dp->aux,
> +DP_LINK_SERVICE_IRQ_VECTOR_ESI0, val) != 1) {
> + drm_dbg_kms(>drm, "Error in writing link service irq
> vector\n");
> + return;
> + }
> +
> + if (val & HDMI_LINK_STATUS_CHANGED)
> + intel_dp_handle_hdmi_link_status_change(intel_dp);
> +}
> +
>  /*
>   * According to DP spec
>   * 5.1.2:
> @@ -6441,7 +6487,8 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
>   return false;
>   }
> 
> - intel_dp_check_service_irq(intel_dp);
> + intel_dp_check_device_service_irq(intel_dp);
> + intel_dp_check_link_service_irq(intel_dp);
> 
>   /* Handle CEC interrupts, if any */
>   drm_dp_cec_irq(_dp->aux);
> @@ -6871,7 +6918,7 @@ intel_dp_detect(struct drm_connector *connector,
>   to_intel_connector(connector)->detect_edid)
>   status = connector_status_connected;
> 
> - intel_dp_check_service_irq(intel_dp);
> + intel_dp_check_device_service_irq(intel_dp);
> 
>  out:
>   if (status != connector_status_connected && !intel_dp->is_mst)
> --
> 2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v7 04/15] drm/dp_helper: Add Helpers for FRL Link Training support for DP-HDMI2.1 PCON

2020-12-18 Thread Shankar, Uma



> -Original Message-
> From: Nautiyal, Ankit K 
> Sent: Friday, December 18, 2020 4:07 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org; Shankar, Uma ;
> airl...@linux.ie; jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com;
> Kulkarni, Vandita ; Sharma, Swati2
> 
> Subject: [PATCH v7 04/15] drm/dp_helper: Add Helpers for FRL Link Training
> support for DP-HDMI2.1 PCON
> 
> This patch adds support for configuring a PCON device, connected as a DP
> branched device to enable FRL Link training with a HDMI2.1 + sink.
> 
> v2: Fixed typos and addressed other review comments from Uma Shankar.
> -changed the commit message for better clarity (Uma Shankar) -removed
> unnecessary argument supplied to a drm helper function.
> -fixed return value for max frl read from pcon.
> 
> v3: Removed DPCD 0x3035 for MAX Sink FRL b/w as per new version of spec.
> 
> Signed-off-by: Ankit Nautiyal 
> Reviewed-by: Uma Shankar  (v2)

Changes look good, you can keep the RB.

>  drivers/gpu/drm/drm_dp_helper.c | 263 
>  include/drm/drm_dp_helper.h |  70 +
>  2 files changed, 333 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c
> b/drivers/gpu/drm/drm_dp_helper.c index 5bd0934004e3..f501e3890921 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -2596,3 +2596,266 @@ void drm_dp_vsc_sdp_log(const char *level, struct
> device *dev,  #undef DP_SDP_LOG  }  EXPORT_SYMBOL(drm_dp_vsc_sdp_log);
> +
> +/**
> + * drm_dp_get_pcon_max_frl_bw() - maximum frl supported by PCON
> + * @dpcd: DisplayPort configuration data
> + * @port_cap: port capabilities
> + *
> + * Returns maximum frl bandwidth supported by PCON in GBPS,
> + * returns 0 if not supported.
> + */
> +int drm_dp_get_pcon_max_frl_bw(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
> +const u8 port_cap[4])
> +{
> + int bw;
> + u8 buf;
> +
> + buf = port_cap[2];
> + bw = buf & DP_PCON_MAX_FRL_BW;
> +
> + switch (bw) {
> + case DP_PCON_MAX_9GBPS:
> + return 9;
> + case DP_PCON_MAX_18GBPS:
> + return 18;
> + case DP_PCON_MAX_24GBPS:
> + return 24;
> + case DP_PCON_MAX_32GBPS:
> + return 32;
> + case DP_PCON_MAX_40GBPS:
> + return 40;
> + case DP_PCON_MAX_48GBPS:
> + return 48;
> + case DP_PCON_MAX_0GBPS:
> + default:
> + return 0;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_dp_get_pcon_max_frl_bw);
> +
> +/**
> + * drm_dp_pcon_frl_prepare() - Prepare PCON for FRL.
> + * @aux: DisplayPort AUX channel
> + *
> + * Returns 0 if success, else returns negative error code.
> + */
> +int drm_dp_pcon_frl_prepare(struct drm_dp_aux *aux, bool
> +enable_frl_ready_hpd) {
> + int ret;
> + u8 buf = DP_PCON_ENABLE_SOURCE_CTL_MODE |
> +  DP_PCON_ENABLE_LINK_FRL_MODE;
> +
> + if (enable_frl_ready_hpd)
> + buf |= DP_PCON_ENABLE_HPD_READY;
> +
> + ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(drm_dp_pcon_frl_prepare);
> +
> +/**
> + * drm_dp_pcon_is_frl_ready() - Is PCON ready for FRL
> + * @aux: DisplayPort AUX channel
> + *
> + * Returns true if success, else returns false.
> + */
> +bool drm_dp_pcon_is_frl_ready(struct drm_dp_aux *aux) {
> + int ret;
> + u8 buf;
> +
> + ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_TX_LINK_STATUS, );
> + if (ret < 0)
> + return false;
> +
> + if (buf & DP_PCON_FRL_READY)
> + return true;
> +
> + return false;
> +}
> +EXPORT_SYMBOL(drm_dp_pcon_is_frl_ready);
> +
> +/**
> + * drm_dp_pcon_frl_configure_1() - Set HDMI LINK Configuration-Step1
> + * @aux: DisplayPort AUX channel
> + * @max_frl_gbps: maximum frl bw to be configured between PCON and HDMI
> +sink
> + * @concurrent_mode: true if concurrent mode or operation is required,
> + * false otherwise.
> + *
> + * Returns 0 if success, else returns negative error code.
> + */
> +
> +int drm_dp_pcon_frl_configure_1(struct drm_dp_aux *aux, int max_frl_gbps,
> + bool concurrent_mode)
> +{
> + int ret;
> + u8 buf;
> +
> + ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_LINK_CONFIG_1, );
> + if (ret < 0)
> + return ret;
> +
> + if (concurrent_mode)
> + buf |= DP_PCON_ENABLE_CONCURRENT_LINK;
> + else
> + buf &= ~DP_PCON_ENABLE_CONCURRENT_LINK;
> +
> + switch (max_frl_gbps) {
> + case 9:
> + buf |=  DP_PCON_ENABLE_MAX_BW_9GBPS;
> + break;
> + case 18:
> + buf |=  DP_PCON_ENABLE_MAX_BW_18GBPS;
> + break;
> + case 24:
> + buf |=  DP_PCON_ENABLE_MAX_BW_24GBPS;
> + break;
> + case 32:
> + buf |=  DP_PCON_ENABLE_MAX_BW_32GBPS;
> + break;
> + case 40:
> + buf |=  

[Intel-gfx] [PATCH v7 15/15] drm/i915/display: Let PCON convert from RGB to YCbCr if it can

2020-12-18 Thread Ankit Nautiyal
If PCON has capability to convert RGB->YCbCr colorspace and also
to 444->420 downsampling then for any YUV420 only mode, we can
let the PCON do all the conversion. If the PCON supports
RGB->YCbCr conversion for all BT2020, BT709, BT601, choose
the one that is selected by userspace via connector colorspace
property, otherwise default to BT601.

v2: As suggested by Uma Shankar, considered case for colorspace
BT709 and BT2020, and default to BT601. Also appended dir
'display' in commit message.

v3: Fixed typo in condition for printing one of the error msg.

v4: As suggested by Uma Shankar:
-Fixed bug in determining the colorspace for RGB->YCbCr conversion.
-Fixed minor formatting issues
Also updated the commit message as per latest changes.

Signed-off-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_ddi.c  |  3 +-
 .../drm/i915/display/intel_display_types.h|  1 +
 drivers/gpu/drm/i915/display/intel_dp.c   | 72 +++
 drivers/gpu/drm/i915/display/intel_dp.h   |  3 +-
 4 files changed, 65 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index fbc07a93504b..17eaa56c5a99 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3644,6 +3644,7 @@ static void tgl_ddi_pre_enable_dp(struct 
intel_atomic_state *state,
if (!is_mst)
intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
 
+   intel_dp_configure_protocol_converter(intel_dp, crtc_state);
intel_dp_sink_set_decompression_state(intel_dp, crtc_state, true);
/*
 * DDI FEC: "anticipates enabling FEC encoding sets the FEC_READY bit
@@ -3731,7 +3732,7 @@ static void hsw_ddi_pre_enable_dp(struct 
intel_atomic_state *state,
intel_ddi_init_dp_buf_reg(encoder, crtc_state);
if (!is_mst)
intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
-   intel_dp_configure_protocol_converter(intel_dp);
+   intel_dp_configure_protocol_converter(intel_dp, crtc_state);
intel_dp_sink_set_decompression_state(intel_dp, crtc_state,
  true);
intel_dp_sink_set_fec_ready(intel_dp, crtc_state);
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index 4c01c7c23dfd..2009ae9e9678 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1460,6 +1460,7 @@ struct intel_dp {
int pcon_max_frl_bw;
u8 max_bpc;
bool ycbcr_444_to_420;
+   bool rgb_to_ycbcr;
} dfp;
 
/* Display stream compression testing */
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index fdc028b7db07..d7e01482c808 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -651,6 +651,10 @@ intel_dp_output_format(struct drm_connector *connector,
!drm_mode_is_420_only(info, mode))
return INTEL_OUTPUT_FORMAT_RGB;
 
+   if (intel_dp->dfp.rgb_to_ycbcr &&
+   intel_dp->dfp.ycbcr_444_to_420)
+   return INTEL_OUTPUT_FORMAT_RGB;
+
if (intel_dp->dfp.ycbcr_444_to_420)
return INTEL_OUTPUT_FORMAT_YCBCR444;
else
@@ -4319,7 +4323,8 @@ static void intel_dp_enable_port(struct intel_dp 
*intel_dp,
intel_de_posting_read(dev_priv, intel_dp->output_reg);
 }
 
-void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp)
+void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp,
+  const struct intel_crtc_state 
*crtc_state)
 {
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
u8 tmp;
@@ -4348,12 +4353,42 @@ void intel_dp_configure_protocol_converter(struct 
intel_dp *intel_dp)
enableddisabled(intel_dp->dfp.ycbcr_444_to_420));
 
tmp = 0;
+   if (intel_dp->dfp.rgb_to_ycbcr) {
+   bool bt2020, bt709;
 
-   if (drm_dp_dpcd_writeb(_dp->aux,
-  DP_PROTOCOL_CONVERTER_CONTROL_2, tmp) <= 0)
+   /*
+* FIXME: Currently if userspace selects BT2020 or BT709, but 
PCON supports only
+* RGB->YCbCr for BT601 colorspace, we go ahead with BT601, as 
default.
+*
+*/
+   tmp = DP_CONVERSION_BT601_RGB_YCBCR_ENABLE;
+
+   bt2020 = 
drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
+  
intel_dp->downstream_ports,
+  
DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
+   bt709 = 
drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
+  

[Intel-gfx] [PATCH v7 13/15] drm/i915: Add helper functions for calculating DSC parameters for HDMI2.1

2020-12-18 Thread Ankit Nautiyal
The DP-HDMI2.1 PCON spec provides way for a source to set PPS
parameters: slice height, slice width and bits_per_pixel, based on
the HDMI2.1 sink capabilities. The DSC encoder of the PCON will
respect these parameters, while preparing the 128 byte PPS.

This patch adds helper functions to calculate these PPS paremeters as
per the HDMI2.1 specification.

v2: Addressed review comments given by Uma Shankar:
-added documentation for functions
-fixed typos and errors

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/i915/display/intel_hdmi.c | 233 ++
 drivers/gpu/drm/i915/display/intel_hdmi.h |   7 +
 2 files changed, 240 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c 
b/drivers/gpu/drm/i915/display/intel_hdmi.c
index e10fdb369daa..41eb1c175a0e 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -3428,3 +3428,236 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv,
dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
intel_hdmi_init_connector(dig_port, intel_connector);
 }
+
+/*
+ * intel_hdmi_dsc_get_slice_height - get the dsc slice_height
+ * @vactive: Vactive of a display mode
+ *
+ * @return: appropriate dsc slice height for a given mode.
+ */
+int intel_hdmi_dsc_get_slice_height(int vactive)
+{
+   int slice_height;
+
+   /*
+* Slice Height determination : HDMI2.1 Section 7.7.5.2
+* Select smallest slice height >=96, that results in a valid PPS and
+* requires minimum padding lines required for final slice.
+*
+* Assumption : Vactive is even.
+*/
+   for (slice_height = 96; slice_height <= vactive; slice_height += 2)
+   if (vactive % slice_height == 0)
+   return slice_height;
+
+   return 0;
+}
+
+/*
+ * intel_hdmi_dsc_get_num_slices - get no. of dsc slices based on dsc encoder
+ * and dsc decoder capabilites
+ *
+ * @crtc_state: intel crtc_state
+ * @src_max_slices: maximum slices supported by the DSC encoder
+ * @src_max_slice_width: maximum slice width supported by DSC encoder
+ * @hdmi_max_slices: maximum slices supported by sink DSC decoder
+ * @hdmi_throughput: maximum clock per slice (MHz) supported by HDMI sink
+ *
+ * @return: num of dsc slices that can be supported by the dsc encoder
+ * and decoder.
+ */
+int
+intel_hdmi_dsc_get_num_slices(const struct intel_crtc_state *crtc_state,
+ int src_max_slices, int src_max_slice_width,
+ int hdmi_max_slices, int hdmi_throughput)
+{
+/* Pixel rates in KPixels/sec */
+#define HDMI_DSC_PEAK_PIXEL_RATE   272
+/*
+ * Rates at which the source and sink are required to process pixels in each
+ * slice, can be two levels: either atleast 34KHz or atleast 4KHz.
+ */
+#define HDMI_DSC_MAX_ENC_THROUGHPUT_0  34
+#define HDMI_DSC_MAX_ENC_THROUGHPUT_1  40
+
+/* Spec limits the slice width to 2720 pixels */
+#define MAX_HDMI_SLICE_WIDTH   2720
+   int kslice_adjust;
+   int adjusted_clk_khz;
+   int min_slices;
+   int target_slices;
+   int max_throughput; /* max clock freq. in khz per slice */
+   int max_slice_width;
+   int slice_width;
+   int pixel_clock = crtc_state->hw.adjusted_mode.crtc_clock;
+
+   if (!hdmi_throughput)
+   return 0;
+
+   /*
+* Slice Width determination : HDMI2.1 Section 7.7.5.1
+* kslice_adjust factor for 4:2:0, and 4:2:2 formats is 0.5, where as
+* for 4:4:4 is 1.0. Multiplying these factors by 10 and later
+* dividing adjusted clock value by 10.
+*/
+   if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444 ||
+   crtc_state->output_format == INTEL_OUTPUT_FORMAT_RGB)
+   kslice_adjust = 10;
+   else
+   kslice_adjust = 5;
+
+   /*
+* As per spec, the rate at which the source and the sink process
+* the pixels per slice are at two levels: atleast 340Mhz or 400Mhz.
+* This depends upon the pixel clock rate and output formats
+* (kslice adjust).
+* If pixel clock * kslice adjust >= 2720MHz slices can be processed
+* at max 340MHz, otherwise they can be processed at max 400MHz.
+*/
+
+   adjusted_clk_khz = DIV_ROUND_UP(kslice_adjust * pixel_clock, 10);
+
+   if (adjusted_clk_khz <= HDMI_DSC_PEAK_PIXEL_RATE)
+   max_throughput = HDMI_DSC_MAX_ENC_THROUGHPUT_0;
+   else
+   max_throughput = HDMI_DSC_MAX_ENC_THROUGHPUT_1;
+
+   /*
+* Taking into account the sink's capability for maximum
+* clock per slice (in MHz) as read from HF-VSDB.
+*/
+   max_throughput = min(max_throughput, hdmi_throughput * 1000);
+
+   min_slices = DIV_ROUND_UP(adjusted_clk_khz, max_throughput);
+   max_slice_width = 

[Intel-gfx] [PATCH v7 14/15] drm/i915/display: Configure PCON for DSC1.1 to DSC1.2 encoding

2020-12-18 Thread Ankit Nautiyal
When a source supporting DSC1.1 is connected to DSC1.2 HDMI2.1 sink
via DP HDMI2.1 PCON, the PCON can be configured to decode the
DSC1.1 compressed stream and encode to DSC1.2. It then sends the
DSC1.2 compressed stream to the HDMI2.1 sink.

This patch configures the PCON for DSC1.1 to DSC1.2 encoding, based
on the PCON's DSC encoder capablities and HDMI2.1 sink's DSC decoder
capabilities.

v2: Addressed review comments from Uma Shankar:
-fixed the error in packing pps parameter values
-added check for pcon in the pcon related function
-appended display in commit message

v3: Only consider non-zero DSC FRL b/w for determining max FRL b/w
supported by sink.

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/i915/display/intel_ddi.c |   1 +
 drivers/gpu/drm/i915/display/intel_dp.c  | 118 ++-
 drivers/gpu/drm/i915/display/intel_dp.h  |   2 +
 3 files changed, 119 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 974cf42351bc..fbc07a93504b 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3653,6 +3653,7 @@ static void tgl_ddi_pre_enable_dp(struct 
intel_atomic_state *state,
intel_dp_sink_set_fec_ready(intel_dp, crtc_state);
 
intel_dp_check_frl_training(intel_dp);
+   intel_dp_pcon_dsc_configure(intel_dp, crtc_state);
 
/*
 * 7.i Follow DisplayPort specification training sequence (see notes for
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 7e2c334b3a17..fdc028b7db07 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4043,9 +4043,22 @@ static int intel_dp_hdmi_sink_max_frl(struct intel_dp 
*intel_dp)
 {
struct intel_connector *intel_connector = intel_dp->attached_connector;
struct drm_connector *connector = _connector->base;
+   int max_frl_rate;
+   int max_lanes, rate_per_lane;
+   int max_dsc_lanes, dsc_rate_per_lane;
 
-   return (connector->display_info.hdmi.max_frl_rate_per_lane *
-   connector->display_info.hdmi.max_lanes);
+   max_lanes = connector->display_info.hdmi.max_lanes;
+   rate_per_lane = connector->display_info.hdmi.max_frl_rate_per_lane;
+   max_frl_rate = max_lanes * rate_per_lane;
+
+   if (connector->display_info.hdmi.dsc_cap.v_1p2) {
+   max_dsc_lanes = connector->display_info.hdmi.dsc_cap.max_lanes;
+   dsc_rate_per_lane = 
connector->display_info.hdmi.dsc_cap.max_frl_rate_per_lane;
+   if (max_dsc_lanes && dsc_rate_per_lane)
+   max_frl_rate = min(max_frl_rate, max_dsc_lanes * 
dsc_rate_per_lane);
+   }
+
+   return max_frl_rate;
 }
 
 static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp)
@@ -4152,6 +4165,105 @@ void intel_dp_check_frl_training(struct intel_dp 
*intel_dp)
}
 }
 
+static int
+intel_dp_pcon_dsc_enc_slice_height(const struct intel_crtc_state *crtc_state)
+{
+
+   int vactive = crtc_state->hw.adjusted_mode.vdisplay;
+
+   return intel_hdmi_dsc_get_slice_height(vactive);
+}
+
+static int
+intel_dp_pcon_dsc_enc_slices(struct intel_dp *intel_dp,
+const struct intel_crtc_state *crtc_state)
+{
+   struct intel_connector *intel_connector = intel_dp->attached_connector;
+   struct drm_connector *connector = _connector->base;
+   int hdmi_throughput = 
connector->display_info.hdmi.dsc_cap.clk_per_slice;
+   int hdmi_max_slices = connector->display_info.hdmi.dsc_cap.max_slices;
+   int pcon_max_slices = 
drm_dp_pcon_dsc_max_slices(intel_dp->pcon_dsc_dpcd);
+   int pcon_max_slice_width = 
drm_dp_pcon_dsc_max_slice_width(intel_dp->pcon_dsc_dpcd);
+
+
+   return intel_hdmi_dsc_get_num_slices(crtc_state, pcon_max_slices,
+pcon_max_slice_width,
+hdmi_max_slices, hdmi_throughput);
+}
+
+static int
+intel_dp_pcon_dsc_enc_bpp(struct intel_dp *intel_dp,
+ const struct intel_crtc_state *crtc_state,
+ int num_slices, int slice_width)
+{
+   struct intel_connector *intel_connector = intel_dp->attached_connector;
+   struct drm_connector *connector = _connector->base;
+   int output_format = crtc_state->output_format;
+   bool hdmi_all_bpp = connector->display_info.hdmi.dsc_cap.all_bpp;
+   int pcon_fractional_bpp = 
drm_dp_pcon_dsc_bpp_incr(intel_dp->pcon_dsc_dpcd);
+   int hdmi_max_chunk_bytes =
+   connector->display_info.hdmi.dsc_cap.total_chunk_kbytes * 1024;
+
+   return intel_hdmi_dsc_get_bpp(pcon_fractional_bpp, slice_width,
+ num_slices, output_format, hdmi_all_bpp,
+ hdmi_max_chunk_bytes);
+}
+
+void

[Intel-gfx] [PATCH v7 12/15] drm/i915: Read DSC capabilities of the HDMI2.1 PCON encoder

2020-12-18 Thread Ankit Nautiyal
This patch adds support to read and store the DSC capabilities of the
HDMI2.1 PCon encoder. It also adds a new field to store these caps,
The caps are read during dfp update and can later be used to get the
PPS parameters for PCON-HDMI2.1 sink pair. Which inturn will be used
to take a call to override the existing PPS-metadata, by either
writing the entire new PPS metadata, or by writing only the
PPS override parameters.

v2: Restructured the code to read all capability DPCDs at once and store
in an array in intel_dp structure.

v3: rebase

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 .../drm/i915/display/intel_display_types.h|  1 +
 drivers/gpu/drm/i915/display/intel_dp.c   | 20 +++
 2 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index daecff9783ea..4c01c7c23dfd 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1362,6 +1362,7 @@ struct intel_dp {
u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE];
u8 lttpr_phy_caps[DP_MAX_LTTPR_COUNT][DP_LTTPR_PHY_CAP_SIZE];
u8 fec_capable;
+   u8 pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE];
/* source rates */
int num_source_rates;
const int *source_rates;
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 66f35e7c9903..7e2c334b3a17 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -3988,6 +3988,24 @@ cpt_set_link_train(struct intel_dp *intel_dp,
intel_de_posting_read(dev_priv, intel_dp->output_reg);
 }
 
+static void intel_dp_get_pcon_dsc_cap(struct intel_dp *intel_dp)
+{
+   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+
+   /* Clear the cached register set to avoid using stale values */
+
+   memset(intel_dp->pcon_dsc_dpcd, 0, sizeof(intel_dp->pcon_dsc_dpcd));
+
+   if (drm_dp_dpcd_read(_dp->aux, DP_PCON_DSC_ENCODER,
+intel_dp->pcon_dsc_dpcd,
+sizeof(intel_dp->pcon_dsc_dpcd)) < 0)
+   drm_err(>drm, "Failed to read DPCD register 0x%x\n",
+   DP_PCON_DSC_ENCODER);
+
+   drm_dbg_kms(>drm, "PCON ENCODER DSC DPCD: %*ph\n",
+  (int)sizeof(intel_dp->pcon_dsc_dpcd), 
intel_dp->pcon_dsc_dpcd);
+}
+
 static int intel_dp_pcon_get_frl_mask(u8 frl_bw_mask)
 {
int bw_gbps[] = {9, 18, 24, 32, 40, 48};
@@ -6720,6 +6738,8 @@ intel_dp_update_dfp(struct intel_dp *intel_dp,
intel_dp->dfp.min_tmds_clock,
intel_dp->dfp.max_tmds_clock,
intel_dp->dfp.pcon_max_frl_bw);
+
+   intel_dp_get_pcon_dsc_cap(intel_dp);
 }
 
 static void
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7 11/15] drm/i915: Add support for enabling link status and recovery

2020-12-18 Thread Ankit Nautiyal
From: Swati Sharma 

In this patch enables support for detecting link failures between
PCON and HDMI sink in i915 driver. HDMI link loss indication to
upstream DP source is indicated via IRQ_HPD. This is followed by
reading of HDMI link configuration status (HDMI_TX_LINK_ACTIVE_STATUS).
If the PCON → HDMI 2.1 link status is off; reinitiate frl link
training to recover. Also, report HDMI FRL link error count range for
each individual FRL active lane is indicated by
DOWNSTREAM_HDMI_ERROR_STATUS_LN registers.

v2: Checked for dpcd read and write failures and added debug message.
(Uma Shankar)

v3: Rearranged code to re-start FRL link training or fall back to
TMDS mode.

v4: Resused function to check frl which inturn restarts FRL and
fallback to TMDS mode.

Signed-off-by: Swati Sharma 
Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar  (v2)
---
 drivers/gpu/drm/i915/display/intel_dp.c | 53 +++--
 1 file changed, 50 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 1e0ff39bb927..66f35e7c9903 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -6013,6 +6013,28 @@ intel_dp_check_mst_status(struct intel_dp *intel_dp)
return link_ok;
 }
 
+static void
+intel_dp_handle_hdmi_link_status_change(struct intel_dp *intel_dp)
+{
+   bool is_active;
+   u8 buf = 0;
+
+   is_active = drm_dp_pcon_hdmi_link_active(_dp->aux);
+   if (intel_dp->frl.is_trained && !is_active) {
+   if (drm_dp_dpcd_readb(_dp->aux, 
DP_PCON_HDMI_LINK_CONFIG_1, ) < 0)
+   return;
+
+   buf &=  ~DP_PCON_ENABLE_HDMI_LINK;
+   if (drm_dp_dpcd_writeb(_dp->aux, 
DP_PCON_HDMI_LINK_CONFIG_1, buf) < 0)
+   return;
+
+   drm_dp_pcon_hdmi_frl_link_error_count(_dp->aux, 
_dp->attached_connector->base);
+
+   /* Restart FRL training or fall back to TMDS mode */
+   intel_dp_check_frl_training(intel_dp);
+   }
+}
+
 static bool
 intel_dp_needs_link_retrain(struct intel_dp *intel_dp)
 {
@@ -6378,7 +6400,7 @@ intel_dp_hotplug(struct intel_encoder *encoder,
return state;
 }
 
-static void intel_dp_check_service_irq(struct intel_dp *intel_dp)
+static void intel_dp_check_device_service_irq(struct intel_dp *intel_dp)
 {
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
u8 val;
@@ -6402,6 +6424,30 @@ static void intel_dp_check_service_irq(struct intel_dp 
*intel_dp)
drm_dbg_kms(>drm, "Sink specific irq unhandled\n");
 }
 
+static void intel_dp_check_link_service_irq(struct intel_dp *intel_dp)
+{
+   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+   u8 val;
+
+   if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
+   return;
+
+   if (drm_dp_dpcd_readb(_dp->aux,
+ DP_LINK_SERVICE_IRQ_VECTOR_ESI0, ) != 1 || 
!val) {
+   drm_dbg_kms(>drm, "Error in reading link service irq 
vector\n");
+   return;
+   }
+
+   if (drm_dp_dpcd_writeb(_dp->aux,
+  DP_LINK_SERVICE_IRQ_VECTOR_ESI0, val) != 1) {
+   drm_dbg_kms(>drm, "Error in writing link service irq 
vector\n");
+   return;
+   }
+
+   if (val & HDMI_LINK_STATUS_CHANGED)
+   intel_dp_handle_hdmi_link_status_change(intel_dp);
+}
+
 /*
  * According to DP spec
  * 5.1.2:
@@ -6441,7 +6487,8 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
return false;
}
 
-   intel_dp_check_service_irq(intel_dp);
+   intel_dp_check_device_service_irq(intel_dp);
+   intel_dp_check_link_service_irq(intel_dp);
 
/* Handle CEC interrupts, if any */
drm_dp_cec_irq(_dp->aux);
@@ -6871,7 +6918,7 @@ intel_dp_detect(struct drm_connector *connector,
to_intel_connector(connector)->detect_edid)
status = connector_status_connected;
 
-   intel_dp_check_service_irq(intel_dp);
+   intel_dp_check_device_service_irq(intel_dp);
 
 out:
if (status != connector_status_connected && !intel_dp->is_mst)
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7 10/15] drm/i915: Check for FRL training before DP Link training

2020-12-18 Thread Ankit Nautiyal
This patch calls functions to check FRL training requirements
for an HDMI2.1 sink, when connected through PCON.
The call is made before the DP link training. In case FRL is not
required or failure during FRL training, the TMDS mode is selected
for the pcon.

v2: moved check_frl_training() just after FEC READY, before
starting DP link training.

v3: rebase

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 2 ++
 drivers/gpu/drm/i915/display/intel_dp.c  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 6863236df1d0..974cf42351bc 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3652,6 +3652,8 @@ static void tgl_ddi_pre_enable_dp(struct 
intel_atomic_state *state,
 */
intel_dp_sink_set_fec_ready(intel_dp, crtc_state);
 
+   intel_dp_check_frl_training(intel_dp);
+
/*
 * 7.i Follow DisplayPort specification training sequence (see notes for
 * failure handling)
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 43027a6d5e5e..1e0ff39bb927 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4264,6 +4264,7 @@ static void intel_enable_dp(struct intel_atomic_state 
*state,
 
intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
intel_dp_configure_protocol_converter(intel_dp);
+   intel_dp_check_frl_training(intel_dp);
intel_dp_start_link_train(intel_dp, pipe_config);
intel_dp_stop_link_train(intel_dp, pipe_config);
 
@@ -6185,6 +6186,7 @@ int intel_dp_retrain_link(struct intel_encoder *encoder,
!intel_dp_mst_is_master_trans(crtc_state))
continue;
 
+   intel_dp_check_frl_training(intel_dp);
intel_dp_start_link_train(intel_dp, crtc_state);
intel_dp_stop_link_train(intel_dp, crtc_state);
break;
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7 09/15] drm/i915: Add support for starting FRL training for HDMI2.1 via PCON

2020-12-18 Thread Ankit Nautiyal
This patch adds functions to start FRL training for an HDMI2.1 sink,
connected via a PCON as a DP branch device.
This patch also adds a new structure for storing frl training related
data, when FRL training is completed.

v2: As suggested by Uma Shankar:
-renamed couple of variables for better clarity
-tweaked the macros used for correct semantics for true/false
-fixed other styling issues.

v3: Completed the TODO for condition for going to FRL mode.
Modified the condition to determine the required FRL b/w
based only on the Pcon and Sink's max FRL values.
Moved the frl structure initialization to intel_dp_init_connector().

v4: Fixed typo in initialization of frl structure.

v5: Always use FRL if its possible, instead of enabling only for
higher modes as done in v3.

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar  (v2)
---
 .../drm/i915/display/intel_display_types.h|   7 +
 drivers/gpu/drm/i915/display/intel_dp.c   | 151 ++
 drivers/gpu/drm/i915/display/intel_dp.h   |   2 +
 3 files changed, 160 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index c88d2b918d9f..daecff9783ea 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1339,6 +1339,11 @@ struct intel_dp_compliance {
u8 test_lane_count;
 };
 
+struct intel_dp_pcon_frl {
+   bool is_trained;
+   int trained_rate_gbps;
+};
+
 struct intel_dp {
i915_reg_t output_reg;
u32 DP;
@@ -1461,6 +1466,8 @@ struct intel_dp {
 
bool hobl_failed;
bool hobl_active;
+
+   struct intel_dp_pcon_frl frl;
 };
 
 enum lspcon_vendor {
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 0596d6c24e73..43027a6d5e5e 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -3891,6 +3891,8 @@ static void intel_disable_dp(struct intel_atomic_state 
*state,
intel_edp_backlight_off(old_conn_state);
intel_dp_set_power(intel_dp, DP_SET_POWER_D3);
intel_edp_panel_off(intel_dp);
+   intel_dp->frl.is_trained = false;
+   intel_dp->frl.trained_rate_gbps = 0;
 }
 
 static void g4x_disable_dp(struct intel_atomic_state *state,
@@ -3986,6 +3988,152 @@ cpt_set_link_train(struct intel_dp *intel_dp,
intel_de_posting_read(dev_priv, intel_dp->output_reg);
 }
 
+static int intel_dp_pcon_get_frl_mask(u8 frl_bw_mask)
+{
+   int bw_gbps[] = {9, 18, 24, 32, 40, 48};
+   int i;
+
+   for (i = ARRAY_SIZE(bw_gbps) - 1; i >= 0; i--) {
+   if (frl_bw_mask & (1 << i))
+   return bw_gbps[i];
+   }
+   return 0;
+}
+
+static int intel_dp_pcon_set_frl_mask(int max_frl)
+{
+
+   switch (max_frl) {
+   case 48:
+   return DP_PCON_FRL_BW_MASK_48GBPS;
+   case 40:
+   return DP_PCON_FRL_BW_MASK_40GBPS;
+   case 32:
+   return DP_PCON_FRL_BW_MASK_32GBPS;
+   case 24:
+   return DP_PCON_FRL_BW_MASK_24GBPS;
+   case 18:
+   return DP_PCON_FRL_BW_MASK_18GBPS;
+   case 9:
+   return DP_PCON_FRL_BW_MASK_9GBPS;
+   }
+
+   return 0;
+}
+
+static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp)
+{
+   struct intel_connector *intel_connector = intel_dp->attached_connector;
+   struct drm_connector *connector = _connector->base;
+
+   return (connector->display_info.hdmi.max_frl_rate_per_lane *
+   connector->display_info.hdmi.max_lanes);
+}
+
+static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp)
+{
+#define PCON_EXTENDED_TRAIN_MODE (1 > 0)
+#define PCON_CONCURRENT_MODE (1 > 0)
+#define PCON_SEQUENTIAL_MODE !PCON_CONCURRENT_MODE
+#define PCON_NORMAL_TRAIN_MODE !PCON_EXTENDED_TRAIN_MODE
+#define TIMEOUT_FRL_READY_MS 500
+#define TIMEOUT_HDMI_LINK_ACTIVE_MS 1000
+
+   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+   int max_frl_bw, max_pcon_frl_bw, max_edid_frl_bw, ret;
+   u8 max_frl_bw_mask = 0, frl_trained_mask;
+   bool is_active;
+
+   ret = drm_dp_pcon_reset_frl_config(_dp->aux);
+   if (ret < 0)
+   return ret;
+
+   max_pcon_frl_bw = intel_dp->dfp.pcon_max_frl_bw;
+   drm_dbg(>drm, "PCON max rate = %d Gbps\n", max_pcon_frl_bw);
+
+   max_edid_frl_bw = intel_dp_hdmi_sink_max_frl(intel_dp);
+   drm_dbg(>drm, "Sink max rate from EDID = %d Gbps\n", 
max_edid_frl_bw);
+
+   max_frl_bw = min(max_edid_frl_bw, max_pcon_frl_bw);
+
+   if (max_frl_bw <= 0)
+   return -EINVAL;
+
+   ret = drm_dp_pcon_frl_prepare(_dp->aux, false);
+   if (ret < 0)
+   return ret;
+   /* Wait for PCON to be FRL Ready */
+   wait_for(is_active = drm_dp_pcon_is_frl_ready(_dp->aux) == true, 
TIMEOUT_FRL_READY_MS);
+
+   if (!is_active)
+   return 

[Intel-gfx] [PATCH v7 07/15] drm/dp_helper: Add helpers to configure PCONs RGB-YCbCr Conversion

2020-12-18 Thread Ankit Nautiyal
DP Specification for DP2.0 to HDMI2.1 Pcon specifies support for conversion
of colorspace from RGB to YCbCr.
https://groups.vesa.org/wg/DP/document/previewpdf/15651

This patch adds the relavant registers and helper functions to
get the capability and set the color conversion bits for rgb->ycbcr
conversion through PCON.

v2: As suggested in review comments:
-Fixed bug in the check condition in a drm_helper as reported by
 Dan Carpenter and Kernel test robot. (Dan Carepenter)
-Modified the color-conversion cap helper function, to accomodate
 BT709 and BT2020 colorspace. (Uma Shankar)
-Added spec details for the new cap for color conversion. (Uma Shankar)

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/drm_dp_helper.c | 61 +
 include/drm/drm_dp_helper.h | 19 +-
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 689fd0d5f6c5..9abd65c694ab 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -949,6 +949,38 @@ bool drm_dp_downstream_444_to_420_conversion(const u8 
dpcd[DP_RECEIVER_CAP_SIZE]
 }
 EXPORT_SYMBOL(drm_dp_downstream_444_to_420_conversion);
 
+/**
+ * drm_dp_downstream_rgb_to_ycbcr_conversion() - determine downstream facing 
port
+ *   RGB->YCbCr conversion 
capability
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: downstream facing port capabilities
+ * @colorspc: Colorspace for which conversion cap is sought
+ *
+ * Returns: whether the downstream facing port can convert RGB->YCbCr for a 
given
+ * colorspace.
+ */
+bool drm_dp_downstream_rgb_to_ycbcr_conversion(const u8 
dpcd[DP_RECEIVER_CAP_SIZE],
+  const u8 port_cap[4],
+  u8 color_spc)
+{
+   if (!drm_dp_is_branch(dpcd))
+   return false;
+
+   if (dpcd[DP_DPCD_REV] < 0x13)
+   return false;
+
+   switch (port_cap[0] & DP_DS_PORT_TYPE_MASK) {
+   case DP_DS_PORT_TYPE_HDMI:
+   if ((dpcd[DP_DOWNSTREAMPORT_PRESENT] & 
DP_DETAILED_CAP_INFO_AVAILABLE) == 0)
+   return false;
+
+   return port_cap[3] & color_spc;
+   default:
+   return false;
+   }
+}
+EXPORT_SYMBOL(drm_dp_downstream_rgb_to_ycbcr_conversion);
+
 /**
  * drm_dp_downstream_mode() - return a mode for downstream facing port
  * @dev: DRM device
@@ -3101,3 +3133,32 @@ int drm_dp_pcon_pps_override_param(struct drm_dp_aux 
*aux, u8 pps_param[6])
return 0;
 }
 EXPORT_SYMBOL(drm_dp_pcon_pps_override_param);
+
+/*
+ * drm_dp_pcon_convert_rgb_to_ycbcr() - Configure the PCon to convert RGB to 
Ycbcr
+ * @aux: displayPort AUX channel
+ * @color_spc: Color-space/s for which conversion is to be enabled, 0 for 
disable.
+ *
+ * Returns 0 on success, else returns negative error code.
+ */
+int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc)
+{
+   int ret;
+   u8 buf;
+
+   ret = drm_dp_dpcd_readb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, );
+   if (ret < 0)
+   return ret;
+
+   if (color_spc & DP_CONVERSION_RGB_YCBCR_MASK)
+   buf |= (color_spc & DP_CONVERSION_RGB_YCBCR_MASK);
+   else
+   buf &= ~DP_CONVERSION_RGB_YCBCR_MASK;
+
+   ret = drm_dp_dpcd_writeb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, buf);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_pcon_convert_rgb_to_ycbcr);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index baad87fe6b0a..e096ee98842b 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -432,6 +432,17 @@ struct drm_device;
 # define DP_DS_HDMI_YCBCR444_TO_422_CONV(1 << 3)
 # define DP_DS_HDMI_YCBCR444_TO_420_CONV(1 << 4)
 
+/*
+ * VESA DP-to-HDMI PCON Specification adds caps for colorspace
+ * conversion in DFP cap DPCD 83h. Sec6.1 Table-3.
+ * Based on the available support the source can enable
+ * color conversion by writing into PROTOCOL_COVERTER_CONTROL_2
+ * DPCD 3052h.
+ */
+# define DP_DS_HDMI_BT601_RGB_YCBCR_CONV(1 << 5)
+# define DP_DS_HDMI_BT709_RGB_YCBCR_CONV(1 << 6)
+# define DP_DS_HDMI_BT2020_RGB_YCBCR_CONV   (1 << 7)
+
 #define DP_MAX_DOWNSTREAM_PORTS0x10
 
 /* DP Forward error Correction Registers */
@@ -1207,7 +1218,10 @@ struct drm_device;
 # define DP_PCON_ENC_PPS_OVERRIDE_DISABLED  0
 # define DP_PCON_ENC_PPS_OVERRIDE_EN_PARAMS 1
 # define DP_PCON_ENC_PPS_OVERRIDE_EN_BUFFER 2
-
+# define DP_CONVERSION_RGB_YCBCR_MASK (7 << 4)
+# define DP_CONVERSION_BT601_RGB_YCBCR_ENABLE  (1 << 4)
+# define DP_CONVERSION_BT709_RGB_YCBCR_ENABLE  (1 << 5)
+# define DP_CONVERSION_BT2020_RGB_YCBCR_ENABLE (1 << 6)
 
 /* PCON Downstream HDMI ERROR Status per Lane */
 #define DP_PCON_HDMI_ERROR_STATUS_LN0  

[Intel-gfx] [PATCH v7 08/15] drm/i915: Capture max frl rate for PCON in dfp cap structure

2020-12-18 Thread Ankit Nautiyal
HDMI2.1 PCON advertises Max FRL bandwidth supported by the PCON.

This patch captures this in dfp cap structure in intel_dp and uses
this to prune connector modes that cannot be supported by the PCON
and FRL bandwidth.

v2: Addressed review comments from Uma Shankar:
-tweaked the comparison of target bw and pcon frl bw to avoid roundup errors.
-minor modification of field names and comments.

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 .../drm/i915/display/intel_display_types.h|  1 +
 drivers/gpu/drm/i915/display/intel_dp.c   | 30 +--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index 5bc5bfbc4551..c88d2b918d9f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1451,6 +1451,7 @@ struct intel_dp {
struct {
int min_tmds_clock, max_tmds_clock;
int max_dotclock;
+   int pcon_max_frl_bw;
u8 max_bpc;
bool ycbcr_444_to_420;
} dfp;
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index b2bc0c8c39c7..0596d6c24e73 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -716,6 +716,25 @@ intel_dp_mode_valid_downstream(struct intel_connector 
*connector,
const struct drm_display_info *info = >base.display_info;
int tmds_clock;
 
+   /* If PCON supports FRL MODE, check FRL bandwidth constraints */
+   if (intel_dp->dfp.pcon_max_frl_bw) {
+   int target_bw;
+   int max_frl_bw;
+   int bpp = intel_dp_mode_min_output_bpp(>base, mode);
+
+   target_bw = bpp * target_clock;
+
+   max_frl_bw = intel_dp->dfp.pcon_max_frl_bw;
+
+   /* converting bw from Gbps to Kbps*/
+   max_frl_bw = max_frl_bw * 100;
+
+   if (target_bw > max_frl_bw)
+   return MODE_CLOCK_HIGH;
+
+   return MODE_OK;
+   }
+
if (intel_dp->dfp.max_dotclock &&
target_clock > intel_dp->dfp.max_dotclock)
return MODE_CLOCK_HIGH;
@@ -6492,13 +6511,18 @@ intel_dp_update_dfp(struct intel_dp *intel_dp,
 intel_dp->downstream_ports,
 edid);
 
+   intel_dp->dfp.pcon_max_frl_bw =
+   drm_dp_get_pcon_max_frl_bw(intel_dp->dpcd,
+  intel_dp->downstream_ports);
+
drm_dbg_kms(>drm,
-   "[CONNECTOR:%d:%s] DFP max bpc %d, max dotclock %d, TMDS 
clock %d-%d\n",
+   "[CONNECTOR:%d:%s] DFP max bpc %d, max dotclock %d, TMDS 
clock %d-%d, PCON Max FRL BW %dGbps\n",
connector->base.base.id, connector->base.name,
intel_dp->dfp.max_bpc,
intel_dp->dfp.max_dotclock,
intel_dp->dfp.min_tmds_clock,
-   intel_dp->dfp.max_tmds_clock);
+   intel_dp->dfp.max_tmds_clock,
+   intel_dp->dfp.pcon_max_frl_bw);
 }
 
 static void
@@ -6590,6 +6614,8 @@ intel_dp_unset_edid(struct intel_dp *intel_dp)
intel_dp->dfp.min_tmds_clock = 0;
intel_dp->dfp.max_tmds_clock = 0;
 
+   intel_dp->dfp.pcon_max_frl_bw = 0;
+
intel_dp->dfp.ycbcr_444_to_420 = false;
connector->base.ycbcr_420_allowed = false;
 }
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7 06/15] drm/dp_helper: Add support for Configuring DSC for HDMI2.1 Pcon

2020-12-18 Thread Ankit Nautiyal
This patch adds registers for getting DSC encoder capability for
a HDMI2.1 PCon. It also addes helper functions to configure
DSC between the PCON and HDMI2.1 sink.

v2: Corrected offset for DSC encoder bpc and minor changes.
Also added helper functions for getting pcon dsc encoder capabilities
as suggested by Uma Shankar.

v3: Only setting the DSC bits for the Protocol Convertor control
registers, avoiding overwritining color conversion bits.

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar  (v2)
---
 drivers/gpu/drm/drm_dp_helper.c | 203 
 include/drm/drm_dp_helper.h | 114 ++
 2 files changed, 317 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index a1d518b3a173..689fd0d5f6c5 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -2898,3 +2898,206 @@ void drm_dp_pcon_hdmi_frl_link_error_count(struct 
drm_dp_aux *aux,
}
 }
 EXPORT_SYMBOL(drm_dp_pcon_hdmi_frl_link_error_count);
+
+/*
+ * drm_dp_pcon_enc_is_dsc_1_2 - Does PCON Encoder supports DSC 1.2
+ * @pcon_dsc_dpcd: DSC capabilities of the PCON DSC Encoder
+ *
+ * Returns true is PCON encoder is DSC 1.2 else returns false.
+ */
+bool drm_dp_pcon_enc_is_dsc_1_2(const u8 
pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE])
+{
+   u8 buf;
+   u8 major_v, minor_v;
+
+   buf = pcon_dsc_dpcd[DP_PCON_DSC_VERSION - DP_PCON_DSC_ENCODER];
+   major_v = (buf & DP_PCON_DSC_MAJOR_MASK) >> DP_PCON_DSC_MAJOR_SHIFT;
+   minor_v = (buf & DP_PCON_DSC_MINOR_MASK) >> DP_PCON_DSC_MINOR_SHIFT;
+
+   if (major_v == 1 && minor_v == 2)
+   return true;
+
+   return false;
+}
+EXPORT_SYMBOL(drm_dp_pcon_enc_is_dsc_1_2);
+
+/*
+ * drm_dp_pcon_dsc_max_slices - Get max slices supported by PCON DSC Encoder
+ * @pcon_dsc_dpcd: DSC capabilities of the PCON DSC Encoder
+ *
+ * Returns maximum no. of slices supported by the PCON DSC Encoder.
+ */
+int drm_dp_pcon_dsc_max_slices(const u8 
pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE])
+{
+   u8 slice_cap1, slice_cap2;
+
+   slice_cap1 = pcon_dsc_dpcd[DP_PCON_DSC_SLICE_CAP_1 - 
DP_PCON_DSC_ENCODER];
+   slice_cap2 = pcon_dsc_dpcd[DP_PCON_DSC_SLICE_CAP_2 - 
DP_PCON_DSC_ENCODER];
+
+   if (slice_cap2 & DP_PCON_DSC_24_PER_DSC_ENC)
+   return 24;
+   if (slice_cap2 & DP_PCON_DSC_20_PER_DSC_ENC)
+   return 20;
+   if (slice_cap2 & DP_PCON_DSC_16_PER_DSC_ENC)
+   return 16;
+   if (slice_cap1 & DP_PCON_DSC_12_PER_DSC_ENC)
+   return 12;
+   if (slice_cap1 & DP_PCON_DSC_10_PER_DSC_ENC)
+   return 10;
+   if (slice_cap1 & DP_PCON_DSC_8_PER_DSC_ENC)
+   return 8;
+   if (slice_cap1 & DP_PCON_DSC_6_PER_DSC_ENC)
+   return 6;
+   if (slice_cap1 & DP_PCON_DSC_4_PER_DSC_ENC)
+   return 4;
+   if (slice_cap1 & DP_PCON_DSC_2_PER_DSC_ENC)
+   return 2;
+   if (slice_cap1 & DP_PCON_DSC_1_PER_DSC_ENC)
+   return 1;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_pcon_dsc_max_slices);
+
+/*
+ * drm_dp_pcon_dsc_max_slice_width() - Get max slice width for Pcon DSC encoder
+ * @pcon_dsc_dpcd: DSC capabilities of the PCON DSC Encoder
+ *
+ * Returns maximum width of the slices in pixel width i.e. no. of pixels x 320.
+ */
+int drm_dp_pcon_dsc_max_slice_width(const u8 
pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE])
+{
+   u8 buf;
+
+   buf = pcon_dsc_dpcd[DP_PCON_DSC_MAX_SLICE_WIDTH - DP_PCON_DSC_ENCODER];
+
+   return buf * DP_DSC_SLICE_WIDTH_MULTIPLIER;
+}
+EXPORT_SYMBOL(drm_dp_pcon_dsc_max_slice_width);
+
+/*
+ * drm_dp_pcon_dsc_bpp_incr() - Get bits per pixel increment for PCON DSC 
encoder
+ * @pcon_dsc_dpcd: DSC capabilities of the PCON DSC Encoder
+ *
+ * Returns the bpp precision supported by the PCON encoder.
+ */
+int drm_dp_pcon_dsc_bpp_incr(const u8 
pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE])
+{
+   u8 buf;
+
+   buf = pcon_dsc_dpcd[DP_PCON_DSC_BPP_INCR - DP_PCON_DSC_ENCODER];
+
+   switch (buf & DP_PCON_DSC_BPP_INCR_MASK) {
+   case DP_PCON_DSC_ONE_16TH_BPP:
+   return 16;
+   case DP_PCON_DSC_ONE_8TH_BPP:
+   return 8;
+   case DP_PCON_DSC_ONE_4TH_BPP:
+   return 4;
+   case DP_PCON_DSC_ONE_HALF_BPP:
+   return 2;
+   case DP_PCON_DSC_ONE_BPP:
+   return 1;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_pcon_dsc_bpp_incr);
+
+static
+int drm_dp_pcon_configure_dsc_enc(struct drm_dp_aux *aux, u8 pps_buf_config)
+{
+   u8 buf;
+   int ret;
+
+   ret = drm_dp_dpcd_readb(aux, DP_PROTOCOL_CONVERTER_CONTROL_2, );
+   if (ret < 0)
+   return ret;
+
+   buf |= DP_PCON_ENABLE_DSC_ENCODER;
+
+   if (pps_buf_config <= DP_PCON_ENC_PPS_OVERRIDE_EN_BUFFER) {
+   buf &= ~DP_PCON_ENCODER_PPS_OVERRIDE_MASK;
+   buf |= pps_buf_config << 2;
+   }
+
+   

[Intel-gfx] [PATCH v7 05/15] drm/dp_helper: Add support for link failure detection

2020-12-18 Thread Ankit Nautiyal
From: Swati Sharma 

There are specific DPCDs defined for detecting link failures between
the PCON and HDMI sink and check the link status. In case of link
failure, PCON will communicate the same using an IRQ_HPD to source.
HDMI sink would have indicated the same to PCON using SCDC interrupt
mechanism. While source can always read final HDMI sink's status using
I2C over AUX, it is easier and faster to read the PCONs already read
HDMI sink status registers.

This patch adds the DPCDs required for link failure detection and
provide a helper function for printing error count/lane which might
help in debugging the link failure issues.

v2: Addressed comments from Uma Shankar:
-rephrased the commit message, as per the code.
-fixed styling issues
-added documentation for the helper function.

Signed-off-by: Swati Sharma 
Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/drm_dp_helper.c | 39 +
 include/drm/drm_dp_helper.h | 17 ++
 2 files changed, 56 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index f501e3890921..a1d518b3a173 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -2859,3 +2859,42 @@ int drm_dp_pcon_hdmi_link_mode(struct drm_dp_aux *aux, 
u8 *frl_trained_mask)
return mode;
 }
 EXPORT_SYMBOL(drm_dp_pcon_hdmi_link_mode);
+
+/**
+ * drm_dp_pcon_hdmi_frl_link_error_count() - print the error count per lane
+ * during link failure between PCON and HDMI sink
+ * @aux: DisplayPort AUX channel
+ * @connector: DRM connector
+ * code.
+ **/
+
+void drm_dp_pcon_hdmi_frl_link_error_count(struct drm_dp_aux *aux,
+  struct drm_connector *connector)
+{
+   u8 buf, error_count;
+   int i, num_error;
+   struct drm_hdmi_info *hdmi = >display_info.hdmi;
+
+   for (i = 0; i < hdmi->max_lanes; i++) {
+   if (drm_dp_dpcd_readb(aux, DP_PCON_HDMI_ERROR_STATUS_LN0 + i, 
) < 0)
+   return;
+
+   error_count = buf & DP_PCON_HDMI_ERROR_COUNT_MASK;
+   switch (error_count) {
+   case DP_PCON_HDMI_ERROR_COUNT_HUNDRED_PLUS:
+   num_error = 100;
+   break;
+   case DP_PCON_HDMI_ERROR_COUNT_TEN_PLUS:
+   num_error = 10;
+   break;
+   case DP_PCON_HDMI_ERROR_COUNT_THREE_PLUS:
+   num_error = 3;
+   break;
+   default:
+   num_error = 0;
+   }
+
+   DRM_ERROR("More than %d errors since the last read for lane 
%d", num_error, i);
+   }
+}
+EXPORT_SYMBOL(drm_dp_pcon_hdmi_frl_link_error_count);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index c66f570eadc2..871e8c051642 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -946,6 +946,11 @@ struct drm_device;
 # define DP_CEC_IRQ  (1 << 2)
 
 #define DP_LINK_SERVICE_IRQ_VECTOR_ESI0 0x2005   /* 1.2 */
+# define RX_CAP_CHANGED  (1 << 0)
+# define LINK_STATUS_CHANGED (1 << 1)
+# define STREAM_STATUS_CHANGED   (1 << 2)
+# define HDMI_LINK_STATUS_CHANGED(1 << 3)
+# define CONNECTED_OFF_ENTRY_REQUESTED   (1 << 4)
 
 #define DP_PSR_ERROR_STATUS 0x2006  /* XXX 1.2? */
 # define DP_PSR_LINK_CRC_ERROR  (1 << 0)
@@ -1120,6 +1125,16 @@ struct drm_device;
 #define DP_PROTOCOL_CONVERTER_CONTROL_20x3052 /* DP 1.3 */
 # define DP_CONVERSION_TO_YCBCR422_ENABLE  (1 << 0) /* DP 1.3 */
 
+/* PCON Downstream HDMI ERROR Status per Lane */
+#define DP_PCON_HDMI_ERROR_STATUS_LN0  0x3037
+#define DP_PCON_HDMI_ERROR_STATUS_LN1  0x3038
+#define DP_PCON_HDMI_ERROR_STATUS_LN2  0x3039
+#define DP_PCON_HDMI_ERROR_STATUS_LN3  0x303A
+# define DP_PCON_HDMI_ERROR_COUNT_MASK (0x7 << 0)
+# define DP_PCON_HDMI_ERROR_COUNT_THREE_PLUS   (1 << 0)
+# define DP_PCON_HDMI_ERROR_COUNT_TEN_PLUS (1 << 1)
+# define DP_PCON_HDMI_ERROR_COUNT_HUNDRED_PLUS (1 << 2)
+
 /* HDCP 1.3 and HDCP 2.2 */
 #define DP_AUX_HDCP_BKSV   0x68000
 #define DP_AUX_HDCP_RI_PRIME   0x68005
@@ -2036,5 +2051,7 @@ int drm_dp_pcon_frl_enable(struct drm_dp_aux *aux);
 
 bool drm_dp_pcon_hdmi_link_active(struct drm_dp_aux *aux);
 int drm_dp_pcon_hdmi_link_mode(struct drm_dp_aux *aux, u8 *frl_trained_mask);
+void drm_dp_pcon_hdmi_frl_link_error_count(struct drm_dp_aux *aux,
+ struct drm_connector *connector);
 
 #endif /* _DRM_DP_HELPER_H_ */
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7 04/15] drm/dp_helper: Add Helpers for FRL Link Training support for DP-HDMI2.1 PCON

2020-12-18 Thread Ankit Nautiyal
This patch adds support for configuring a PCON device,
connected as a DP branched device to enable FRL Link training
with a HDMI2.1 + sink.

v2: Fixed typos and addressed other review comments from Uma Shankar.
-changed the commit message for better clarity (Uma Shankar)
-removed unnecessary argument supplied to a drm helper function.
-fixed return value for max frl read from pcon.

v3: Removed DPCD 0x3035 for MAX Sink FRL b/w as per new version of spec.

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar  (v2)
---
 drivers/gpu/drm/drm_dp_helper.c | 263 
 include/drm/drm_dp_helper.h |  70 +
 2 files changed, 333 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 5bd0934004e3..f501e3890921 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -2596,3 +2596,266 @@ void drm_dp_vsc_sdp_log(const char *level, struct 
device *dev,
 #undef DP_SDP_LOG
 }
 EXPORT_SYMBOL(drm_dp_vsc_sdp_log);
+
+/**
+ * drm_dp_get_pcon_max_frl_bw() - maximum frl supported by PCON
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns maximum frl bandwidth supported by PCON in GBPS,
+ * returns 0 if not supported.
+ */
+int drm_dp_get_pcon_max_frl_bw(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+  const u8 port_cap[4])
+{
+   int bw;
+   u8 buf;
+
+   buf = port_cap[2];
+   bw = buf & DP_PCON_MAX_FRL_BW;
+
+   switch (bw) {
+   case DP_PCON_MAX_9GBPS:
+   return 9;
+   case DP_PCON_MAX_18GBPS:
+   return 18;
+   case DP_PCON_MAX_24GBPS:
+   return 24;
+   case DP_PCON_MAX_32GBPS:
+   return 32;
+   case DP_PCON_MAX_40GBPS:
+   return 40;
+   case DP_PCON_MAX_48GBPS:
+   return 48;
+   case DP_PCON_MAX_0GBPS:
+   default:
+   return 0;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_get_pcon_max_frl_bw);
+
+/**
+ * drm_dp_pcon_frl_prepare() - Prepare PCON for FRL.
+ * @aux: DisplayPort AUX channel
+ *
+ * Returns 0 if success, else returns negative error code.
+ */
+int drm_dp_pcon_frl_prepare(struct drm_dp_aux *aux, bool enable_frl_ready_hpd)
+{
+   int ret;
+   u8 buf = DP_PCON_ENABLE_SOURCE_CTL_MODE |
+DP_PCON_ENABLE_LINK_FRL_MODE;
+
+   if (enable_frl_ready_hpd)
+   buf |= DP_PCON_ENABLE_HPD_READY;
+
+   ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf);
+
+   return ret;
+}
+EXPORT_SYMBOL(drm_dp_pcon_frl_prepare);
+
+/**
+ * drm_dp_pcon_is_frl_ready() - Is PCON ready for FRL
+ * @aux: DisplayPort AUX channel
+ *
+ * Returns true if success, else returns false.
+ */
+bool drm_dp_pcon_is_frl_ready(struct drm_dp_aux *aux)
+{
+   int ret;
+   u8 buf;
+
+   ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_TX_LINK_STATUS, );
+   if (ret < 0)
+   return false;
+
+   if (buf & DP_PCON_FRL_READY)
+   return true;
+
+   return false;
+}
+EXPORT_SYMBOL(drm_dp_pcon_is_frl_ready);
+
+/**
+ * drm_dp_pcon_frl_configure_1() - Set HDMI LINK Configuration-Step1
+ * @aux: DisplayPort AUX channel
+ * @max_frl_gbps: maximum frl bw to be configured between PCON and HDMI sink
+ * @concurrent_mode: true if concurrent mode or operation is required,
+ * false otherwise.
+ *
+ * Returns 0 if success, else returns negative error code.
+ */
+
+int drm_dp_pcon_frl_configure_1(struct drm_dp_aux *aux, int max_frl_gbps,
+   bool concurrent_mode)
+{
+   int ret;
+   u8 buf;
+
+   ret = drm_dp_dpcd_readb(aux, DP_PCON_HDMI_LINK_CONFIG_1, );
+   if (ret < 0)
+   return ret;
+
+   if (concurrent_mode)
+   buf |= DP_PCON_ENABLE_CONCURRENT_LINK;
+   else
+   buf &= ~DP_PCON_ENABLE_CONCURRENT_LINK;
+
+   switch (max_frl_gbps) {
+   case 9:
+   buf |=  DP_PCON_ENABLE_MAX_BW_9GBPS;
+   break;
+   case 18:
+   buf |=  DP_PCON_ENABLE_MAX_BW_18GBPS;
+   break;
+   case 24:
+   buf |=  DP_PCON_ENABLE_MAX_BW_24GBPS;
+   break;
+   case 32:
+   buf |=  DP_PCON_ENABLE_MAX_BW_32GBPS;
+   break;
+   case 40:
+   buf |=  DP_PCON_ENABLE_MAX_BW_40GBPS;
+   break;
+   case 48:
+   buf |=  DP_PCON_ENABLE_MAX_BW_48GBPS;
+   break;
+   case 0:
+   buf |=  DP_PCON_ENABLE_MAX_BW_0GBPS;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_1, buf);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_pcon_frl_configure_1);
+
+/**
+ * drm_dp_pcon_frl_configure_2() - Set HDMI Link configuration Step-2
+ * @aux: DisplayPort AUX channel
+ * @max_frl_mask : Max FRL BW to 

[Intel-gfx] [PATCH v7 03/15] drm/edid: Parse DSC1.2 cap fields from HFVSDB block

2020-12-18 Thread Ankit Nautiyal
This patch parses HFVSDB fields for DSC1.2 capabilities of an
HDMI2.1 sink. These fields are required by a source to understand the
DSC capability of the sink, to set appropriate PPS parameters,
before transmitting compressed data stream.

v2: Addressed following issues as suggested by Uma Shankar:
-Added a new struct for hdmi dsc cap
-Fixed bugs in macros usage.

Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/drm_edid.c  | 59 +
 include/drm/drm_connector.h | 43 +++
 2 files changed, 102 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index e657c321d9e4..ca368df2e5ac 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4941,11 +4941,70 @@ static void drm_parse_hdmi_forum_vsdb(struct 
drm_connector *connector,
 
if (hf_vsdb[7]) {
u8 max_frl_rate;
+   u8 dsc_max_frl_rate;
+   u8 dsc_max_slices;
+   struct drm_hdmi_dsc_cap *hdmi_dsc = >dsc_cap;
 
DRM_DEBUG_KMS("hdmi_21 sink detected. parsing edid\n");
max_frl_rate = (hf_vsdb[7] & DRM_EDID_MAX_FRL_RATE_MASK) >> 4;
drm_get_max_frl_rate(max_frl_rate, >max_lanes,
>max_frl_rate_per_lane);
+   hdmi_dsc->v_1p2 = hf_vsdb[11] & DRM_EDID_DSC_1P2;
+
+   if (hdmi_dsc->v_1p2) {
+   hdmi_dsc->native_420 = hf_vsdb[11] & 
DRM_EDID_DSC_NATIVE_420;
+   hdmi_dsc->all_bpp = hf_vsdb[11] & DRM_EDID_DSC_ALL_BPP;
+
+   if (hf_vsdb[11] & DRM_EDID_DSC_16BPC)
+   hdmi_dsc->bpc_supported = 16;
+   else if (hf_vsdb[11] & DRM_EDID_DSC_12BPC)
+   hdmi_dsc->bpc_supported = 12;
+   else if (hf_vsdb[11] & DRM_EDID_DSC_10BPC)
+   hdmi_dsc->bpc_supported = 10;
+   else
+   hdmi_dsc->bpc_supported = 0;
+
+   dsc_max_frl_rate = (hf_vsdb[12] & 
DRM_EDID_DSC_MAX_FRL_RATE_MASK) >> 4;
+   drm_get_max_frl_rate(dsc_max_frl_rate, 
_dsc->max_lanes,
+   _dsc->max_frl_rate_per_lane);
+   hdmi_dsc->total_chunk_kbytes = hf_vsdb[13] & 
DRM_EDID_DSC_TOTAL_CHUNK_KBYTES;
+
+   dsc_max_slices = hf_vsdb[12] & DRM_EDID_DSC_MAX_SLICES;
+   switch (dsc_max_slices) {
+   case 1:
+   hdmi_dsc->max_slices = 1;
+   hdmi_dsc->clk_per_slice = 340;
+   break;
+   case 2:
+   hdmi_dsc->max_slices = 2;
+   hdmi_dsc->clk_per_slice = 340;
+   break;
+   case 3:
+   hdmi_dsc->max_slices = 4;
+   hdmi_dsc->clk_per_slice = 340;
+   break;
+   case 4:
+   hdmi_dsc->max_slices = 8;
+   hdmi_dsc->clk_per_slice = 340;
+   break;
+   case 5:
+   hdmi_dsc->max_slices = 8;
+   hdmi_dsc->clk_per_slice = 400;
+   break;
+   case 6:
+   hdmi_dsc->max_slices = 12;
+   hdmi_dsc->clk_per_slice = 400;
+   break;
+   case 7:
+   hdmi_dsc->max_slices = 16;
+   hdmi_dsc->clk_per_slice = 400;
+   break;
+   case 0:
+   default:
+   hdmi_dsc->max_slices = 0;
+   hdmi_dsc->clk_per_slice = 0;
+   }
+   }
}
 
drm_parse_ycbcr420_deep_color_info(connector, hf_vsdb);
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 1a3b4776b458..1922b278ffad 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -175,6 +175,46 @@ struct drm_scdc {
struct drm_scrambling scrambling;
 };
 
+/**
+ * struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink
+ *
+ * Describes the DSC support provided by HDMI 2.1 sink.
+ * The information is fetched fom additional HFVSDB blocks defined
+ * for HDMI 2.1.
+ */
+struct drm_hdmi_dsc_cap {
+   /** @v_1p2: flag for dsc1.2 version support by sink */
+   bool v_1p2;
+
+   /** @native_420: Does sink support DSC with 4:2:0 compression */
+   bool native_420;
+
+   /**
+* @all_bpp: Does sink support all bpp with 4:4:4: or 4:2:2
+  

[Intel-gfx] [PATCH v7 02/15] drm/edid: Parse MAX_FRL field from HFVSDB block

2020-12-18 Thread Ankit Nautiyal
From: Swati Sharma 

This patch parses MAX_FRL field to get the MAX rate in Gbps that
the HDMI 2.1 panel can support in FRL mode. Source need this
field to determine the optimal rate between the source and sink
during FRL training.

v2: Fixed minor bugs, and removed extra wrapper function (Uma Shankar)

Signed-off-by: Sharma, Swati2 
Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/drm_edid.c  | 44 +
 include/drm/drm_connector.h |  6 +
 2 files changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 74f5a3197214..e657c321d9e4 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4851,6 +4851,41 @@ static void drm_parse_vcdb(struct drm_connector 
*connector, const u8 *db)
info->rgb_quant_range_selectable = true;
 }
 
+static
+void drm_get_max_frl_rate(int max_frl_rate, u8 *max_lanes, u8 
*max_rate_per_lane)
+{
+   switch (max_frl_rate) {
+   case 1:
+   *max_lanes = 3;
+   *max_rate_per_lane = 3;
+   break;
+   case 2:
+   *max_lanes = 3;
+   *max_rate_per_lane = 6;
+   break;
+   case 3:
+   *max_lanes = 4;
+   *max_rate_per_lane = 6;
+   break;
+   case 4:
+   *max_lanes = 4;
+   *max_rate_per_lane = 8;
+   break;
+   case 5:
+   *max_lanes = 4;
+   *max_rate_per_lane = 10;
+   break;
+   case 6:
+   *max_lanes = 4;
+   *max_rate_per_lane = 12;
+   break;
+   case 0:
+   default:
+   *max_lanes = 0;
+   *max_rate_per_lane = 0;
+   }
+}
+
 static void drm_parse_ycbcr420_deep_color_info(struct drm_connector *connector,
   const u8 *db)
 {
@@ -4904,6 +4939,15 @@ static void drm_parse_hdmi_forum_vsdb(struct 
drm_connector *connector,
}
}
 
+   if (hf_vsdb[7]) {
+   u8 max_frl_rate;
+
+   DRM_DEBUG_KMS("hdmi_21 sink detected. parsing edid\n");
+   max_frl_rate = (hf_vsdb[7] & DRM_EDID_MAX_FRL_RATE_MASK) >> 4;
+   drm_get_max_frl_rate(max_frl_rate, >max_lanes,
+   >max_frl_rate_per_lane);
+   }
+
drm_parse_ycbcr420_deep_color_info(connector, hf_vsdb);
 }
 
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index fcdc58d8b88b..1a3b4776b458 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -207,6 +207,12 @@ struct drm_hdmi_info {
 
/** @y420_dc_modes: bitmap of deep color support index */
u8 y420_dc_modes;
+
+   /** @max_frl_rate_per_lane: support fixed rate link */
+   u8 max_frl_rate_per_lane;
+
+   /** @max_lanes: supported by sink */
+   u8 max_lanes;
 };
 
 /**
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7 01/15] drm/edid: Add additional HFVSDB fields for HDMI2.1

2020-12-18 Thread Ankit Nautiyal
From: Swati Sharma 

The HDMI2.1 extends HFVSDB (HDMI Forum Vendor Specific
Data block) to have fields related to newly defined methods of FRL
(Fixed Rate Link) levels, number of lanes supported, DSC Color bit
depth, VRR min/max, FVA (Fast Vactive), ALLM etc.

This patch adds the new HFVSDB fields that are required for
HDMI2.1.

v2: Minor fixes + consistent naming for DPCD register masks
(Uma Shankar)

Signed-off-by: Sharma, Swati2 
Signed-off-by: Ankit Nautiyal 
Reviewed-by: Uma Shankar 
---
 include/drm/drm_edid.h | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index e97daf6ffbb1..a158f585f658 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -229,6 +229,36 @@ struct detailed_timing {
DRM_EDID_YCBCR420_DC_36 | \
DRM_EDID_YCBCR420_DC_30)
 
+/* HDMI 2.1 additional fields */
+#define DRM_EDID_MAX_FRL_RATE_MASK 0xf0
+#define DRM_EDID_FAPA_START_LOCATION   (1 << 0)
+#define DRM_EDID_ALLM  (1 << 1)
+#define DRM_EDID_FVA   (1 << 2)
+
+/* Deep Color specific */
+#define DRM_EDID_DC_30BIT_420  (1 << 0)
+#define DRM_EDID_DC_36BIT_420  (1 << 1)
+#define DRM_EDID_DC_48BIT_420  (1 << 2)
+
+/* VRR specific */
+#define DRM_EDID_CNMVRR(1 << 3)
+#define DRM_EDID_CINEMA_VRR(1 << 4)
+#define DRM_EDID_MDELTA(1 << 5)
+#define DRM_EDID_VRR_MAX_UPPER_MASK0xc0
+#define DRM_EDID_VRR_MAX_LOWER_MASK0xff
+#define DRM_EDID_VRR_MIN_MASK  0x3f
+
+/* DSC specific */
+#define DRM_EDID_DSC_10BPC (1 << 0)
+#define DRM_EDID_DSC_12BPC (1 << 1)
+#define DRM_EDID_DSC_16BPC (1 << 2)
+#define DRM_EDID_DSC_ALL_BPP   (1 << 3)
+#define DRM_EDID_DSC_NATIVE_420(1 << 6)
+#define DRM_EDID_DSC_1P2   (1 << 7)
+#define DRM_EDID_DSC_MAX_FRL_RATE_MASK 0xf0
+#define DRM_EDID_DSC_MAX_SLICES0xf
+#define DRM_EDID_DSC_TOTAL_CHUNK_KBYTES0x3f
+
 /* ELD Header Block */
 #define DRM_ELD_HEADER_BLOCK_SIZE  4
 
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7 00/15] Add support for DP-HDMI2.1 PCON

2020-12-18 Thread Ankit Nautiyal
This patch series attempts to add support for a DP-HDMI2.1 Protocol
Convertor. The VESA spec for the HDMI2.1 PCON are proposed in Errata
E5 to DisplayPort_v2.0:
https://vesa.org/join-vesamemberships/member-downloads/?action=stamp=42299
The details are mentioned in:
VESA DP-to-HDMI PCON Specification Standalone Document
https://groups.vesa.org/wg/DP/document/15651

This series starts with adding support for FRL (Fixed Rate Link)
Training between the PCON and HDMI2.1 sink.
As per HDMI2.1 specification, a new data-channel or lane is added in
FRL mode, by repurposing the TMDS clock Channel. Through FRL, higher
bit-rate can be supported, ie. up to 12 Gbps/lane (48 Gbps over 4
lanes).

With these patches, the HDMI2.1 PCON can be configured to achieve FRL
training based on the maximum FRL rate supported by the panel, source
and the PCON.
The approach is to add the support for FRL training between PCON and
HDMI2.1 sink and gradually add other blocks for supporting higher
resolutions and other HDMI2.1 features, that can be supported by pcon
for the sources that do not natively support HDMI2.1.

This is done before the DP Link training between the source and PCON
is started. In case of FRL training is not achieved, the PCON will
work in the regular TMDS mode, without HDMI2.1 feature support.
Any interruption in FRL training between the PCON and HDMI2.1 sink is
notified through IRQ_HPD. On receiving the IRQ_HPD the concerned DPCD
registers are read and FRL training is re-attempted.

Currently, we have tested the FRL training and are able to enable 4K
display with TGL Platform + Realtek PCON RTD2173 with HDMI2.1 supporting
panel.

v2: Addressed review comments and re-organized patches as suggested in
comments on RFC patches.

v3: Addressed review comments on previous version.

v4: Added support for RGB->YCBCR conversion through PCON

v5: Addressed review comments on previous version.

v6: Fix typo in one of the patch.

v7: Rebased on latest drm-tip and addressed the review comments.

Ankit Nautiyal (11):
  drm/edid: Parse DSC1.2 cap fields from HFVSDB block
  drm/dp_helper: Add Helpers for FRL Link Training support for
DP-HDMI2.1 PCON
  drm/dp_helper: Add support for Configuring DSC for HDMI2.1 Pcon
  drm/dp_helper: Add helpers to configure PCONs RGB-YCbCr Conversion
  drm/i915: Capture max frl rate for PCON in dfp cap structure
  drm/i915: Add support for starting FRL training for HDMI2.1 via PCON
  drm/i915: Check for FRL training before DP Link training
  drm/i915: Read DSC capabilities of the HDMI2.1 PCON encoder
  drm/i915: Add helper functions for calculating DSC parameters for
HDMI2.1
  drm/i915/display: Configure PCON for DSC1.1 to DSC1.2 encoding
  drm/i915/display: Let PCON convert from RGB to YCbCr if it can

Swati Sharma (4):
  drm/edid: Add additional HFVSDB fields for HDMI2.1
  drm/edid: Parse MAX_FRL field from HFVSDB block
  drm/dp_helper: Add support for link failure detection
  drm/i915: Add support for enabling link status and recovery

 drivers/gpu/drm/drm_dp_helper.c   | 566 ++
 drivers/gpu/drm/drm_edid.c| 103 
 drivers/gpu/drm/i915/display/intel_ddi.c  |   6 +-
 .../drm/i915/display/intel_display_types.h|  10 +
 drivers/gpu/drm/i915/display/intel_dp.c   | 442 +-
 drivers/gpu/drm/i915/display/intel_dp.h   |   7 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c | 233 +++
 drivers/gpu/drm/i915/display/intel_hdmi.h |   7 +
 include/drm/drm_connector.h   |  49 ++
 include/drm/drm_dp_helper.h   | 218 +++
 include/drm/drm_edid.h|  30 +
 11 files changed, 1652 insertions(+), 19 deletions(-)

-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC][PATCH 3/3] drm/i915: Implement readout for AVI infoframe SDP

2020-12-18 Thread Swati Sharma
In this patch readout for AVI infoframes enclosed in GMP
DIP is implemented.

Signed-off-by: Swati Sharma 
Signed-off-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp.c | 74 -
 1 file changed, 72 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index d96e69dd2197..4821c96991f2 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -5738,6 +5738,44 @@ intel_dp_hdr_metadata_infoframe_sdp_unpack(struct 
hdmi_drm_infoframe *drm_infofr
return ret;
 }
 
+static int
+intel_dp_avi_infoframe_sdp_unpack(union hdmi_infoframe *frame,
+ const void *buffer, size_t size)
+{
+   int ret;
+
+   const struct dp_sdp *sdp = buffer;
+
+   if (size < sizeof(struct dp_sdp))
+   return -EINVAL;
+
+   if (sdp->sdp_header.HB0 != 0)
+   return -EINVAL;
+
+   if (sdp->sdp_header.HB1 != HDMI_INFOFRAME_TYPE_AVI)
+   return -EINVAL;
+
+   if (sdp->sdp_header.HB2 != 0x1D)
+   return -EINVAL;
+
+   if ((sdp->sdp_header.HB3 & 0x3) != 0)
+   return -EINVAL;
+
+   if (((sdp->sdp_header.HB3 >> 2) & 0x3f) != 0x13)
+   return -EINVAL;
+
+   if (sdp->db[0] != 2)
+   return -EINVAL;
+
+   if (sdp->db[1] != HDMI_AVI_INFOFRAME_SIZE)
+   return -EINVAL;
+
+   ret = hdmi_infoframe_unpack(frame, >db[2],
+   HDMI_DRM_INFOFRAME_SIZE);
+
+   return ret;
+}
+
 static void intel_read_dp_vsc_sdp(struct intel_encoder *encoder,
  struct intel_crtc_state *crtc_state,
  struct drm_dp_vsc_sdp *vsc)
@@ -5790,10 +5828,37 @@ static void 
intel_read_dp_hdr_metadata_infoframe_sdp(struct intel_encoder *encod
"Failed to unpack DP HDR Metadata Infoframe SDP\n");
 }
 
+static void intel_read_dp_avi_infoframe_sdp(struct intel_encoder *encoder,
+   struct intel_crtc_state *crtc_state,
+   union hdmi_infoframe *frame)
+{
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+   unsigned int type = HDMI_PACKET_TYPE_GAMUT_METADATA;
+   struct dp_sdp sdp = {};
+   int ret;
+
+   if ((crtc_state->infoframes.enable &
+   intel_hdmi_infoframe_enable(type)) == 0)
+   return;
+
+   dig_port->read_infoframe(encoder, crtc_state, type, ,
+sizeof(sdp));
+
+   ret = intel_dp_avi_infoframe_sdp_unpack(frame, ,
+   sizeof(sdp));
+
+   if (ret)
+   drm_dbg_kms(_priv->drm,
+   "Failed to unpack DP AVI Infoframe SDP\n");
+}
+
 void intel_read_dp_sdp(struct intel_encoder *encoder,
   struct intel_crtc_state *crtc_state,
   unsigned int type)
 {
+   struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
if (encoder->type != INTEL_OUTPUT_DDI)
return;
 
@@ -5803,8 +5868,13 @@ void intel_read_dp_sdp(struct intel_encoder *encoder,
  _state->infoframes.vsc);
break;
case HDMI_PACKET_TYPE_GAMUT_METADATA:
-   intel_read_dp_hdr_metadata_infoframe_sdp(encoder, crtc_state,
-
_state->infoframes.drm.drm);
+   if (intel_dp_is_hdmi_2_1_sink(intel_dp)) {
+   intel_read_dp_avi_infoframe_sdp(encoder, crtc_state,
+   
_state->infoframes.avi);
+   } else {
+   intel_read_dp_hdr_metadata_infoframe_sdp(encoder, 
crtc_state,
+
_state->infoframes.drm.drm);
+   }
break;
default:
MISSING_CASE(type);
-- 
2.25.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC][PATCH 2/3] drm/i915: Sending AVI infoframe through GMP DIP

2020-12-18 Thread Swati Sharma
DP does not support sending AVI info frame to panel. So we need to
send AVI info frame to HDMI through some other DIP.

When DP-to-HDMI protocol converter is present GMP DIP will be used
to send AVI infoframe instead of static HDR infoframes.

While VESA spec indicates support within PCON to built AVI IF, it
gives better control with source sending the infoframe by itself as
per HDMI/CTA spec. Minimum of version 3 need to be used for VIC >= 128
(i.e. for 8k mode as an example).

Signed-off-by: Swati Sharma 
Signed-off-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp.c | 135 ++--
 1 file changed, 100 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index a776e7f809b4..d96e69dd2197 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2779,6 +2779,22 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct 
intel_dp *intel_dp,
intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA);
 }
 
+static void
+intel_dp_compute_avi_infoframe_sdp(struct intel_encoder *encoder,
+  struct intel_crtc_state *crtc_state,
+  struct drm_connector_state *conn_state)
+{
+   struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+
+   if (!intel_hdmi_compute_avi_infoframe(encoder, crtc_state, conn_state)) 
{
+   drm_dbg_kms(_priv->drm, "bad AVI infoframe\n");
+   return;
+   }
+
+   crtc_state->infoframes.enable |=
+   intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA);
+}
+
 static void
 intel_dp_drrs_compute_config(struct intel_dp *intel_dp,
 struct intel_crtc_state *pipe_config,
@@ -2807,6 +2823,38 @@ intel_dp_drrs_compute_config(struct intel_dp *intel_dp,
   constant_n, pipe_config->fec_enable);
 }
 
+static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp)
+{
+   struct intel_connector *intel_connector = intel_dp->attached_connector;
+   struct drm_connector *connector = _connector->base;
+   int max_frl_rate;
+   int max_lanes, rate_per_lane;
+   int max_dsc_lanes, dsc_rate_per_lane;
+
+   max_lanes = connector->display_info.hdmi.max_lanes;
+   rate_per_lane = connector->display_info.hdmi.max_frl_rate_per_lane;
+   max_frl_rate = max_lanes * rate_per_lane;
+
+   if (connector->display_info.hdmi.dsc_cap.v_1p2) {
+   max_dsc_lanes = connector->display_info.hdmi.dsc_cap.max_lanes;
+   dsc_rate_per_lane = 
connector->display_info.hdmi.dsc_cap.max_frl_rate_per_lane;
+   if (max_dsc_lanes && dsc_rate_per_lane)
+   max_frl_rate = min(max_frl_rate, max_dsc_lanes * 
dsc_rate_per_lane);
+   }
+
+   return max_frl_rate;
+}
+
+static bool intel_dp_is_hdmi_2_1_sink(struct intel_dp *intel_dp)
+{
+   if (drm_dp_is_branch(intel_dp->dpcd) &&
+   intel_dp->has_hdmi_sink &&
+   intel_dp_hdmi_sink_max_frl(intel_dp) > 0)
+   return true;
+
+   return false;
+}
+
 int
 intel_dp_compute_config(struct intel_encoder *encoder,
struct intel_crtc_state *pipe_config,
@@ -2894,7 +2942,13 @@ intel_dp_compute_config(struct intel_encoder *encoder,
intel_dp_drrs_compute_config(intel_dp, pipe_config, output_bpp,
 constant_n);
intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state);
-   intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp, pipe_config, 
conn_state);
+
+   if (intel_dp_is_hdmi_2_1_sink(intel_dp)) {
+   pipe_config->has_infoframe = true;
+   intel_dp_compute_avi_infoframe_sdp(encoder, pipe_config, 
conn_state);
+   } else {
+   intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp, 
pipe_config, conn_state);
+   }
 
return 0;
 }
@@ -4043,28 +4097,6 @@ static int intel_dp_pcon_set_frl_mask(int max_frl)
return 0;
 }
 
-static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp)
-{
-   struct intel_connector *intel_connector = intel_dp->attached_connector;
-   struct drm_connector *connector = _connector->base;
-   int max_frl_rate;
-   int max_lanes, rate_per_lane;
-   int max_dsc_lanes, dsc_rate_per_lane;
-
-   max_lanes = connector->display_info.hdmi.max_lanes;
-   rate_per_lane = connector->display_info.hdmi.max_frl_rate_per_lane;
-   max_frl_rate = max_lanes * rate_per_lane;
-
-   if (connector->display_info.hdmi.dsc_cap.v_1p2) {
-   max_dsc_lanes = connector->display_info.hdmi.dsc_cap.max_lanes;
-   dsc_rate_per_lane = 
connector->display_info.hdmi.dsc_cap.max_frl_rate_per_lane;
-   if (max_dsc_lanes && dsc_rate_per_lane)
-   max_frl_rate = min(max_frl_rate, max_dsc_lanes * 
dsc_rate_per_lane);

[Intel-gfx] [RFC][PATCH 1/3] drm/i915: Export intel_hdmi_compute_avi_infoframe()

2020-12-18 Thread Swati Sharma
Instead of re-writing the avi_infoframe_compute func in intel_dp;
exporting hdmi_compute_avi_infoframe func so that it can be called
directly while encapsulating AVI infoframes in GMP dip.

This is required when HDMI 2.1 PCON (dp to hdmi) is used and we need
to send AVI infoframes to PCON in source control mode.

Signed-off-by: Swati Sharma 
Signed-off-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_hdmi.c | 8 
 drivers/gpu/drm/i915/display/intel_hdmi.h | 3 +++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c 
b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 41eb1c175a0e..537739f9f984 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -716,10 +716,9 @@ void intel_read_infoframe(struct intel_encoder *encoder,
frame->any.type, type);
 }
 
-static bool
-intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder,
-struct intel_crtc_state *crtc_state,
-struct drm_connector_state *conn_state)
+bool intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder,
+ struct intel_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
 {
struct hdmi_avi_infoframe *frame = _state->infoframes.avi.avi;
const struct drm_display_mode *adjusted_mode =
@@ -772,6 +771,7 @@ intel_hdmi_compute_avi_infoframe(struct intel_encoder 
*encoder,
 
return true;
 }
+EXPORT_SYMBOL(intel_hdmi_compute_avi_infoframe);
 
 static bool
 intel_hdmi_compute_spd_infoframe(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.h 
b/drivers/gpu/drm/i915/display/intel_hdmi.h
index fa1a9b030850..b8e6630d01e3 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.h
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.h
@@ -57,5 +57,8 @@ int intel_hdmi_dsc_get_num_slices(const struct 
intel_crtc_state *crtc_state,
  int src_max_slices, int src_max_slice_width,
  int hdmi_max_slices, int hdmi_throughput);
 int intel_hdmi_dsc_get_slice_height(int vactive);
+bool intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder,
+  struct intel_crtc_state *crtc_state,
+  struct drm_connector_state *conn_state);
 
 #endif /* __INTEL_HDMI_H__ */
-- 
2.25.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC][PATCH 0/3] Infoframe changes for DP-HDMI2.1 PCON

2020-12-18 Thread Swati Sharma
These patches should be applied on top of series
https://patchwork.freedesktop.org/series/82098/
(Add support for DP-HDMI2.1 PCON)

This is good to have feature, even if we don't send any AVI info frame,
PCON is able to create and send it based on DP VSC packets. However,
it gives better control with source sending the infoframe by itself.

TODO:
Need to fix:
[8.906566] i915 :00:02.0: [drm] *ERROR* [CRTC:98:pipe A] mismatch in 
has_infoframe (expected yes, found no)
[8.916828] i915 :00:02.0: [drm] *ERROR* [CRTC:98:pipe A] mismatch in 
infoframes.enable (expected 0x000a, found 0x0002)

Swati Sharma (3):
  drm/i915: Export intel_hdmi_compute_avi_infoframe()
  drm/i915: Sending AVI infoframe through GMP DIP
  drm/i915: Implement readout for AVI infoframe SDP

 drivers/gpu/drm/i915/display/intel_dp.c   | 209 ++
 drivers/gpu/drm/i915/display/intel_hdmi.c |   8 +-
 drivers/gpu/drm/i915/display/intel_hdmi.h |   3 +
 3 files changed, 179 insertions(+), 41 deletions(-)

-- 
2.25.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Try to guess PCH type even without ISA bridge (rev2)

2020-12-18 Thread Patchwork
== Series Details ==

Series: drm/i915: Try to guess PCH type even without ISA bridge (rev2)
URL   : https://patchwork.freedesktop.org/series/84886/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9502 -> Patchwork_19174


Summary
---

  **SUCCESS**

  No regressions found.

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

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@amdgpu/amd_prime@amd-to-i915:
- fi-kbl-soraka:  NOTRUN -> [SKIP][1] ([fdo#109271])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/fi-kbl-soraka/igt@amdgpu/amd_pr...@amd-to-i915.html

  * igt@gem_flink_basic@double-flink:
- fi-tgl-y:   [PASS][2] -> [DMESG-WARN][3] ([i915#402]) +1 similar 
issue
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/fi-tgl-y/igt@gem_flink_ba...@double-flink.html
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/fi-tgl-y/igt@gem_flink_ba...@double-flink.html

  * igt@runner@aborted:
- fi-apl-guc: NOTRUN -> [FAIL][4] ([i915#2426] / [i915#2722])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/fi-apl-guc/igt@run...@aborted.html

  
 Possible fixes 

  * igt@prime_self_import@basic-with_one_bo_two_files:
- fi-tgl-y:   [DMESG-WARN][5] ([i915#402]) -> [PASS][6] +1 similar 
issue
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9502/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
  [i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402


Participating hosts (43 -> 39)
--

  Missing(4): fi-ilk-m540 fi-bsw-cyan fi-bdw-samus fi-hsw-4200u 


Build changes
-

  * Linux: CI_DRM_9502 -> Patchwork_19174

  CI-20190529: 20190529
  CI_DRM_9502: 062fb02ead4596719cd755fc28bcb44858a3d80b @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5908: b8b1391f7bfff83397ddc47c0083c2c7ed06be37 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_19174: 6f36913c8145e56c0e5a230a8fc2b0acc2be98fb @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

6f36913c8145 drm/i915: Try to guess PCH type even without ISA bridge

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19174/index.html
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] i915/perf: Move gen specific OA formats to single array

2020-12-18 Thread Lionel Landwerlin

On 18/12/2020 04:08, Umesh Nerlige Ramappa wrote:

On Wed, Dec 16, 2020 at 10:30:24AM +0200, Lionel Landwerlin wrote:

On 15/12/2020 23:49, Umesh Nerlige Ramappa wrote:

Variations in OA formats in the different gens has led to creation of
several sparse arrays to store the formats.

Move oa formats into a single array and add the supported range of
platforms for the oa formats.

Signed-off-by: Umesh Nerlige Ramappa 
---
 drivers/gpu/drm/i915/i915_perf.c   | 56 --
 drivers/gpu/drm/i915/i915_perf_types.h |  3 ++
 2 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c 
b/drivers/gpu/drm/i915/i915_perf.c

index f553caf4b06d..afa92cf075c4 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -298,28 +298,27 @@ static u32 i915_oa_max_sample_rate = 10;
 /* XXX: beware if future OA HW adds new report formats that the 
current
  * code assumes all reports have a power-of-two size and ~(size - 
1) can

- * be used as a mask to align the OA tail pointer.
+ * be used as a mask to align the OA tail pointer. Note that the 
platforms

+ * in this array specify a range (inclusive of start and end).
  */
-static const struct i915_oa_format 
hsw_oa_formats[I915_OA_FORMAT_MAX] = {

-    [I915_OA_FORMAT_A13]    = { 0, 64 },
-    [I915_OA_FORMAT_A29]    = { 1, 128 },
-    [I915_OA_FORMAT_A13_B8_C8]  = { 2, 128 },
-    /* A29_B8_C8 Disallowed as 192 bytes doesn't factor into buffer 
size */

-    [I915_OA_FORMAT_B4_C8]    = { 4, 64 },
-    [I915_OA_FORMAT_A45_B8_C8]  = { 5, 256 },
-    [I915_OA_FORMAT_B4_C8_A16]  = { 6, 128 },
-    [I915_OA_FORMAT_C4_B8]    = { 7, 64 },
-};
-
-static const struct i915_oa_format 
gen8_plus_oa_formats[I915_OA_FORMAT_MAX] = {

-    [I915_OA_FORMAT_A12]    = { 0, 64 },
-    [I915_OA_FORMAT_A12_B8_C8]    = { 2, 128 },
-    [I915_OA_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256 },
-    [I915_OA_FORMAT_C4_B8]    = { 7, 64 },
-};
-
-static const struct i915_oa_format 
gen12_oa_formats[I915_OA_FORMAT_MAX] = {

-    [I915_OA_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256 },
+static const struct i915_oa_format oa_formats[I915_OA_FORMAT_MAX] = {
+    /* haswell */
+    [I915_OA_FORMAT_A13]    = { 0, 64, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_A29]    = { 1, 128, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_A13_B8_C8]  = { 2, 128, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_B4_C8]  = { 4, 64, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_A45_B8_C8]  = { 5, 256, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_B4_C8_A16]  = { 6, 128, 
INTEL_IVYBRIDGE, INTEL_HASWELL },

+
+    /* haswell+ upto but not including tigerlake */
+    [I915_OA_FORMAT_C4_B8]  = { 7, 64, 
INTEL_IVYBRIDGE, INTEL_TIGERLAKE - 1 },

I don't think we support IVB,.


So the above formats are only HASWELL then?



Correct





+
+    /* gen8+ upto but not including tigerlake */
+    [I915_OA_FORMAT_A12]    = { 0, 64, 
INTEL_BROADWELL, INTEL_TIGERLAKE - 1 },
+    [I915_OA_FORMAT_A12_B8_C8]  = { 2, 128, 
INTEL_BROADWELL, INTEL_TIGERLAKE - 1 },

+
+    /* gen8+ */
+    [I915_OA_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256, 
INTEL_BROADWELL, INTEL_MAX_PLATFORMS - 1 },

 };



You also need to change i915_oa_stream_init() to use the global 
array. Looks like it will access a NULL pointer atm.




yikes, will do.



Ah... See my comment below.







 #define SAMPLE_OA_REPORT (1<<0)
@@ -3575,6 +3574,7 @@ static int read_properties_unlocked(struct 
i915_perf *perf,

 for (i = 0; i < n_props; i++) {
 u64 oa_period, oa_freq_hz;
 u64 id, value;
+    enum intel_platform p = INTEL_INFO(perf->i915)->platform;
 ret = get_user(id, uprop);
 if (ret)
@@ -3611,8 +3611,9 @@ static int read_properties_unlocked(struct 
i915_perf *perf,

   value);
 return -EINVAL;
 }
-    if (!perf->oa_formats[value].size) {
-    DRM_DEBUG("Unsupported OA report format %llu\n",
+    if (p < perf->oa_formats[value].start ||
+    p > perf->oa_formats[value].end) {
+    DRM_DEBUG("OA report format not supported %llu\n",
   value);
 return -EINVAL;
 }
@@ -4270,6 +4271,7 @@ void i915_perf_init(struct drm_i915_private 
*i915)

 /* XXX const struct i915_perf_ops! */
+    perf->oa_formats = oa_formats;
 if (IS_HASWELL(i915)) {
 perf->ops.is_valid_b_counter_reg = 
gen7_is_valid_b_counter_addr;

 perf->ops.is_valid_mux_reg = hsw_is_valid_mux_addr;
@@ -4280,8 +4282,6 @@ void i915_perf_init(struct drm_i915_private 
*i915)

 perf->ops.oa_disable = gen7_oa_disable;
 perf->ops.read = gen7_oa_read;
 perf->ops.oa_hw_tail_read = gen7_oa_hw_tail_read;
-
- 

Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] lib/igt_perf: Request CLOCK_MONOTONIC when opening events

2020-12-18 Thread Chris Wilson
Quoting Tvrtko Ursulin (2020-12-18 08:49:39)
> From: Tvrtko Ursulin 
> 
> Ask for CLOCK_MONOTONIC which is more stable than the default perf clock.
> 
> (Ability to select a clock has been available since kernel version 4.1.)
> 
> The change should not have any significant impact on the IGT as whole
> apart from maybe improving the occasional jitter in tests/tools which use
> nanosleep(2) and use time slept together with perf reported time delta
> either in direct or indirect calculations.
> 
> Signed-off-by: Tvrtko Ursulin 
> ---
>  lib/igt_perf.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_perf.c b/lib/igt_perf.c
> index 418c1c18891c..b743859f5d29 100644
> --- a/lib/igt_perf.c
> +++ b/lib/igt_perf.c
> @@ -1,12 +1,13 @@
> -#include 
> +#include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  
>  #include "igt_perf.h"
>  
> @@ -111,6 +112,8 @@ _perf_open(uint64_t type, uint64_t config, int group, 
> uint64_t format)
>  
> attr.read_format = format;
> attr.config = config;
> +   attr.use_clockid = 1;
> +   attr.clockid = CLOCK_MONOTONIC;

Ok, pretty much all are cumulative samples with ktime_get(), and not raw
HW clocks that would prefer MONO_RAW.
Reviewed-by: Chris Wilson 
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: Check for rq->hwsp validity after acquiring RCU lock

2020-12-18 Thread Chris Wilson
Since we allow removing the timeline map at runtime, there is a risk
that rq->hwsp points into a stale page. To control that risk, we hold
the RCU read lock while reading *rq->hwsp, but we missed a couple of
important barriers. First, the unpinning / removal of the timeline map
must be after all RCU readers into that map are complete, i.e. after an
rcu barrier (in this case courtesy of call_rcu()). Secondly, we must
make sure that the rq->hwsp we are about to dereference under the RCU
lock is valid. In this case, we make the rq->hwsp pointer safe during
i915_request_retire() and so we know that rq->hwsp may become invalid
only after the request has been signaled. Therefore is the request is
not yet signaled when we acquire rq->hwsp under the RCU, we know that
rq->hwsp will remain valid for the duration of the RCU read lock.

This is a very small window that may lead to either considering the
request not completed (causing a delay until the request is checked
again, any wait for the request is not affected) or dereferencing an
invalid pointer.

Fixes: 3adac4689f58 ("drm/i915: Introduce concept of per-timeline (context) 
HWSP")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc:  # v5.1+
---
 drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 11 ++
 drivers/gpu/drm/i915/gt/intel_timeline.c|  6 ++--
 drivers/gpu/drm/i915/i915_request.h | 37 ++---
 3 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c 
b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
index 3c62fd6daa76..f96cd7d9b419 100644
--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
@@ -134,11 +134,6 @@ static bool remove_signaling_context(struct 
intel_breadcrumbs *b,
return true;
 }
 
-static inline bool __request_completed(const struct i915_request *rq)
-{
-   return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
-}
-
 __maybe_unused static bool
 check_signal_order(struct intel_context *ce, struct i915_request *rq)
 {
@@ -245,7 +240,7 @@ static void signal_irq_work(struct irq_work *work)
list_for_each_entry_rcu(rq, >signals, signal_link) {
bool release;
 
-   if (!__request_completed(rq))
+   if (!__i915_request_is_complete(rq))
break;
 
if (!test_and_clear_bit(I915_FENCE_FLAG_SIGNAL,
@@ -380,7 +375,7 @@ static void insert_breadcrumb(struct i915_request *rq)
 * straight onto a signaled list, and queue the irq worker for
 * its signal completion.
 */
-   if (__request_completed(rq)) {
+   if (__i915_request_is_complete(rq)) {
irq_signal_request(rq, b);
return;
}
@@ -468,7 +463,7 @@ void i915_request_cancel_breadcrumb(struct i915_request *rq)
if (release)
intel_context_put(ce);
 
-   if (__request_completed(rq))
+   if (__i915_request_is_complete(rq))
irq_signal_request(rq, b);
 
i915_request_put(rq);
diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c 
b/drivers/gpu/drm/i915/gt/intel_timeline.c
index 512afacd2bdc..a0ce2fb8737a 100644
--- a/drivers/gpu/drm/i915/gt/intel_timeline.c
+++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
@@ -126,6 +126,10 @@ static void __rcu_cacheline_free(struct rcu_head *rcu)
struct intel_timeline_cacheline *cl =
container_of(rcu, typeof(*cl), rcu);
 
+   /* Must wait until after all *rq->hwsp are complete before removing */
+   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
+   i915_vma_put(cl->hwsp->vma);
+
i915_active_fini(>active);
kfree(cl);
 }
@@ -134,8 +138,6 @@ static void __idle_cacheline_free(struct 
intel_timeline_cacheline *cl)
 {
GEM_BUG_ON(!i915_active_is_idle(>active));
 
-   i915_gem_object_unpin_map(cl->hwsp->vma->obj);
-   i915_vma_put(cl->hwsp->vma);
__idle_hwsp_free(cl->hwsp, ptr_unmask_bits(cl->vaddr, CACHELINE_BITS));
 
call_rcu(>rcu, __rcu_cacheline_free);
diff --git a/drivers/gpu/drm/i915/i915_request.h 
b/drivers/gpu/drm/i915/i915_request.h
index 92e4320c50c4..7c4453e60323 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -440,7 +440,7 @@ static inline u32 hwsp_seqno(const struct i915_request *rq)
 
 static inline bool __i915_request_has_started(const struct i915_request *rq)
 {
-   return i915_seqno_passed(hwsp_seqno(rq), rq->fence.seqno - 1);
+   return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno - 1);
 }
 
 /**
@@ -471,11 +471,19 @@ static inline bool __i915_request_has_started(const 
struct i915_request *rq)
  */
 static inline bool i915_request_started(const struct i915_request *rq)
 {
+   bool result;
+
if (i915_request_signaled(rq))
return true;
 
-   /* Remember: started but may have since been preempted! */
-  

Re: [Intel-gfx] [PATCH 1/2] i915/perf: Move gen specific OA formats to single array

2020-12-18 Thread Tvrtko Ursulin


On 18/12/2020 02:32, Umesh Nerlige Ramappa wrote:

On Wed, Dec 16, 2020 at 09:25:35AM +, Tvrtko Ursulin wrote:


On 15/12/2020 21:49, Umesh Nerlige Ramappa wrote:

Variations in OA formats in the different gens has led to creation of
several sparse arrays to store the formats.

Move oa formats into a single array and add the supported range of
platforms for the oa formats.

Signed-off-by: Umesh Nerlige Ramappa 
---
 drivers/gpu/drm/i915/i915_perf.c   | 56 --
 drivers/gpu/drm/i915/i915_perf_types.h |  3 ++
 2 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c 
b/drivers/gpu/drm/i915/i915_perf.c

index f553caf4b06d..afa92cf075c4 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -298,28 +298,27 @@ static u32 i915_oa_max_sample_rate = 10;
 /* XXX: beware if future OA HW adds new report formats that the current
  * code assumes all reports have a power-of-two size and ~(size - 1) 
can

- * be used as a mask to align the OA tail pointer.
+ * be used as a mask to align the OA tail pointer. Note that the 
platforms

+ * in this array specify a range (inclusive of start and end).
  */
-static const struct i915_oa_format 
hsw_oa_formats[I915_OA_FORMAT_MAX] = {

-    [I915_OA_FORMAT_A13]    = { 0, 64 },
-    [I915_OA_FORMAT_A29]    = { 1, 128 },
-    [I915_OA_FORMAT_A13_B8_C8]  = { 2, 128 },
-    /* A29_B8_C8 Disallowed as 192 bytes doesn't factor into buffer 
size */

-    [I915_OA_FORMAT_B4_C8]    = { 4, 64 },
-    [I915_OA_FORMAT_A45_B8_C8]  = { 5, 256 },
-    [I915_OA_FORMAT_B4_C8_A16]  = { 6, 128 },
-    [I915_OA_FORMAT_C4_B8]    = { 7, 64 },
-};
-
-static const struct i915_oa_format 
gen8_plus_oa_formats[I915_OA_FORMAT_MAX] = {

-    [I915_OA_FORMAT_A12]    = { 0, 64 },
-    [I915_OA_FORMAT_A12_B8_C8]    = { 2, 128 },
-    [I915_OA_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256 },
-    [I915_OA_FORMAT_C4_B8]    = { 7, 64 },
-};
-
-static const struct i915_oa_format 
gen12_oa_formats[I915_OA_FORMAT_MAX] = {

-    [I915_OA_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256 },
+static const struct i915_oa_format oa_formats[I915_OA_FORMAT_MAX] = {
+    /* haswell */
+    [I915_OA_FORMAT_A13]    = { 0, 64, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_A29]    = { 1, 128, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_A13_B8_C8]  = { 2, 128, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_B4_C8]  = { 4, 64, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_A45_B8_C8]  = { 5, 256, 
INTEL_IVYBRIDGE, INTEL_HASWELL },
+    [I915_OA_FORMAT_B4_C8_A16]  = { 6, 128, 
INTEL_IVYBRIDGE, INTEL_HASWELL },

+
+    /* haswell+ upto but not including tigerlake */
+    [I915_OA_FORMAT_C4_B8]  = { 7, 64, 
INTEL_IVYBRIDGE, INTEL_TIGERLAKE - 1 },

+
+    /* gen8+ upto but not including tigerlake */
+    [I915_OA_FORMAT_A12]    = { 0, 64, 
INTEL_BROADWELL, INTEL_TIGERLAKE - 1 },
+    [I915_OA_FORMAT_A12_B8_C8]  = { 2, 128, 
INTEL_BROADWELL, INTEL_TIGERLAKE - 1 },

+
+    /* gen8+ */
+    [I915_OA_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256, 
INTEL_BROADWELL, INTEL_MAX_PLATFORMS - 1 },

 };
 #define SAMPLE_OA_REPORT  (1<<0)
@@ -3575,6 +3574,7 @@ static int read_properties_unlocked(struct 
i915_perf *perf,

 for (i = 0; i < n_props; i++) {
 u64 oa_period, oa_freq_hz;
 u64 id, value;
+    enum intel_platform p = INTEL_INFO(perf->i915)->platform;
 ret = get_user(id, uprop);
 if (ret)
@@ -3611,8 +3611,9 @@ static int read_properties_unlocked(struct 
i915_perf *perf,

   value);
 return -EINVAL;
 }
-    if (!perf->oa_formats[value].size) {
-    DRM_DEBUG("Unsupported OA report format %llu\n",
+    if (p < perf->oa_formats[value].start ||
+    p > perf->oa_formats[value].end) {
+    DRM_DEBUG("OA report format not supported %llu\n",
   value);
 return -EINVAL;
 }
@@ -4270,6 +4271,7 @@ void i915_perf_init(struct drm_i915_private *i915)
 /* XXX const struct i915_perf_ops! */
+    perf->oa_formats = oa_formats;
 if (IS_HASWELL(i915)) {
 perf->ops.is_valid_b_counter_reg = 
gen7_is_valid_b_counter_addr;

 perf->ops.is_valid_mux_reg = hsw_is_valid_mux_addr;
@@ -4280,8 +4282,6 @@ void i915_perf_init(struct drm_i915_private *i915)
 perf->ops.oa_disable = gen7_oa_disable;
 perf->ops.read = gen7_oa_read;
 perf->ops.oa_hw_tail_read = gen7_oa_hw_tail_read;
-
-    perf->oa_formats = hsw_oa_formats;
 } else if (HAS_LOGICAL_RING_CONTEXTS(i915)) {
 /* Note: that although we could theoretically also support the
  * legacy ringbuffer mode on BDW (and earlier iterations of
@@ -4292,8 +4292,6 @@ void 

[Intel-gfx] [PATCH v2] drm/i915: Try to guess PCH type even without ISA bridge

2020-12-18 Thread Xiong Zhang
From: Zhenyu Wang 

Some vmm like hyperv and crosvm don't supply any ISA bridge to their guest,
when igd passthrough is equipped on these vmm, guest i915 display may
couldn't work as guest i915 detects PCH_NONE pch type.

When i915 runs as guest, this patch guess pch type through gpu type even
without ISA bridge.

v2: Fix CI warning

Signed-off-by: Zhenyu Wang 
---
 drivers/gpu/drm/i915/i915_drv.h  |  7 +-
 drivers/gpu/drm/i915/intel_pch.c | 38 ++--
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 5a7df5621aa3..df0b8f9268b2 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1758,6 +1758,11 @@ tgl_revids_get(struct drm_i915_private *dev_priv)
 #define INTEL_DISPLAY_ENABLED(dev_priv) \
(drm_WARN_ON(&(dev_priv)->drm, !HAS_DISPLAY(dev_priv)), 
!(dev_priv)->params.disable_display)
 
+static inline bool run_as_guest(void)
+{
+   return !hypervisor_is_type(X86_HYPER_NATIVE);
+}
+
 static inline bool intel_vtd_active(void)
 {
 #ifdef CONFIG_INTEL_IOMMU
@@ -1766,7 +1771,7 @@ static inline bool intel_vtd_active(void)
 #endif
 
/* Running as a guest, we assume the host is enforcing VT'd */
-   return !hypervisor_is_type(X86_HYPER_NATIVE);
+   return run_as_guest();
 }
 
 static inline bool intel_scanout_needs_vtd_wa(struct drm_i915_private 
*dev_priv)
diff --git a/drivers/gpu/drm/i915/intel_pch.c b/drivers/gpu/drm/i915/intel_pch.c
index f31c0dabd0cc..a73c60bf349e 100644
--- a/drivers/gpu/drm/i915/intel_pch.c
+++ b/drivers/gpu/drm/i915/intel_pch.c
@@ -184,6 +184,23 @@ intel_virt_detect_pch(const struct drm_i915_private 
*dev_priv)
return id;
 }
 
+static void intel_detect_pch_virt(struct drm_i915_private *dev_priv)
+{
+   unsigned short id;
+   enum intel_pch pch_type;
+
+   id = intel_virt_detect_pch(dev_priv);
+   pch_type = intel_pch_type(dev_priv, id);
+
+   /* Sanity check virtual PCH id */
+   if (drm_WARN_ON(_priv->drm,
+   id && pch_type == PCH_NONE))
+   id = 0;
+
+   dev_priv->pch_type = pch_type;
+   dev_priv->pch_id = id;
+}
+
 void intel_detect_pch(struct drm_i915_private *dev_priv)
 {
struct pci_dev *pch = NULL;
@@ -221,16 +238,7 @@ void intel_detect_pch(struct drm_i915_private *dev_priv)
break;
} else if (intel_is_virt_pch(id, pch->subsystem_vendor,
 pch->subsystem_device)) {
-   id = intel_virt_detect_pch(dev_priv);
-   pch_type = intel_pch_type(dev_priv, id);
-
-   /* Sanity check virtual PCH id */
-   if (drm_WARN_ON(_priv->drm,
-   id && pch_type == PCH_NONE))
-   id = 0;
-
-   dev_priv->pch_type = pch_type;
-   dev_priv->pch_id = id;
+   intel_detect_pch_virt(dev_priv);
break;
}
}
@@ -246,8 +254,14 @@ void intel_detect_pch(struct drm_i915_private *dev_priv)
dev_priv->pch_id = 0;
}
 
-   if (!pch)
-   drm_dbg_kms(_priv->drm, "No PCH found.\n");
+   if (!pch) {
+   if (run_as_guest()) {
+   drm_dbg_kms(_priv->drm, "No PCH found in vm, try 
guess..\n");
+   intel_detect_pch_virt(dev_priv);
+   } else {
+   drm_dbg_kms(_priv->drm, "No PCH found.\n");
+   }
+   }
 
pci_dev_put(pch);
 }
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t] lib/igt_perf: Request CLOCK_MONOTONIC when opening events

2020-12-18 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Ask for CLOCK_MONOTONIC which is more stable than the default perf clock.

(Ability to select a clock has been available since kernel version 4.1.)

The change should not have any significant impact on the IGT as whole
apart from maybe improving the occasional jitter in tests/tools which use
nanosleep(2) and use time slept together with perf reported time delta
either in direct or indirect calculations.

Signed-off-by: Tvrtko Ursulin 
---
 lib/igt_perf.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/igt_perf.c b/lib/igt_perf.c
index 418c1c18891c..b743859f5d29 100644
--- a/lib/igt_perf.c
+++ b/lib/igt_perf.c
@@ -1,12 +1,13 @@
-#include 
+#include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "igt_perf.h"
 
@@ -111,6 +112,8 @@ _perf_open(uint64_t type, uint64_t config, int group, 
uint64_t format)
 
attr.read_format = format;
attr.config = config;
+   attr.use_clockid = 1;
+   attr.clockid = CLOCK_MONOTONIC;
 
do {
ret = perf_event_open(, -1, cpu++, group, 0);
-- 
2.25.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 1/2] drm/i915/tgl: Fix REVID macros for TGL to fetch correct stepping

2020-12-18 Thread Jani Nikula
On Thu, 17 Dec 2020, Lucas De Marchi  wrote:
> Both patches applied. Thanks!
>
> Jani, maybe now you can rebase your patch to get rid of the extern ?

Yes, thanks for the irq so I can stop polling. ;)

BR,
Jani.


>
>
> Lucas De Marchi
>
> On Wed, Dec 02, 2020 at 11:23:58PM -0800, Aditya Swarup wrote:
>>Fix TGL REVID macros to fetch correct display/gt stepping based
>>on SOC rev id from INTEL_REVID() macro. Previously, we were just
>>returning the first element of the revid array instead of using
>>the correct index based on SOC rev id.
>>
>>Fixes: ("drm/i915/tgl: Fix stepping WA matching")
>>Cc: José Roberto de Souza 
>>Cc: Matt Roper 
>>Cc: Lucas De Marchi 
>>Cc: Jani Nikula 
>>Cc: Ville Syrjälä 
>>Signed-off-by: Aditya Swarup 
>>Reviewed-by: Lucas De Marchi 
>>---
>> drivers/gpu/drm/i915/i915_drv.h | 12 ++--
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>>diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>>index fc1090c6889c..2e2149c9a2f4 100644
>>--- a/drivers/gpu/drm/i915/i915_drv.h
>>+++ b/drivers/gpu/drm/i915/i915_drv.h
>>@@ -1580,9 +1580,9 @@ static inline const struct i915_rev_steppings *
>> tgl_revids_get(struct drm_i915_private *dev_priv)
>> {
>>  if (IS_TGL_U(dev_priv) || IS_TGL_Y(dev_priv))
>>- return tgl_uy_revids;
>>+ return _uy_revids[INTEL_REVID(dev_priv)];
>>  else
>>- return tgl_revids;
>>+ return _revids[INTEL_REVID(dev_priv)];
>> }
>>
>> #define IS_TGL_DISP_REVID(p, since, until) \
>>@@ -1592,14 +1592,14 @@ tgl_revids_get(struct drm_i915_private *dev_priv)
>>
>> #define IS_TGL_UY_GT_REVID(p, since, until) \
>>  ((IS_TGL_U(p) || IS_TGL_Y(p)) && \
>>-  tgl_uy_revids->gt_stepping >= (since) && \
>>-  tgl_uy_revids->gt_stepping <= (until))
>>+  tgl_uy_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
>>+  tgl_uy_revids[INTEL_REVID(p)].gt_stepping <= (until))
>>
>> #define IS_TGL_GT_REVID(p, since, until) \
>>  (IS_TIGERLAKE(p) && \
>>   !(IS_TGL_U(p) || IS_TGL_Y(p)) && \
>>-  tgl_revids->gt_stepping >= (since) && \
>>-  tgl_revids->gt_stepping <= (until))
>>+  tgl_revids[INTEL_REVID(p)].gt_stepping >= (since) && \
>>+  tgl_revids[INTEL_REVID(p)].gt_stepping <= (until))
>>
>> #define RKL_REVID_A0 0x0
>> #define RKL_REVID_B0 0x1
>>-- 
>>2.27.0
>>
>>___
>>Intel-gfx mailing list
>>Intel-gfx@lists.freedesktop.org
>>https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Graphics Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx