[Intel-gfx] [PATCH] drm/i915/dp: make intel_dp_pack_aux() static again

2021-12-29 Thread Jani Nikula
The last user of intel_dp_pack_aux() outside intel_dp_aux.c got removed
in commit ad26451a7902 ("drm/i915/display: Drop PSR support from HSW and
BDW"). Make the function static again.

Rename the pack/unpack functions to follow the usual naming conventions
while at it.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/display/intel_dp_aux.c | 8 
 drivers/gpu/drm/i915/display/intel_dp_aux.h | 4 
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c 
b/drivers/gpu/drm/i915/display/intel_dp_aux.c
index 5fbb767fcd63..2bc119374555 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
@@ -10,7 +10,7 @@
 #include "intel_pps.h"
 #include "intel_tc.h"
 
-u32 intel_dp_pack_aux(const u8 *src, int src_bytes)
+static u32 intel_dp_aux_pack(const u8 *src, int src_bytes)
 {
int i;
u32 v = 0;
@@ -22,7 +22,7 @@ u32 intel_dp_pack_aux(const u8 *src, int src_bytes)
return v;
 }
 
-static void intel_dp_unpack_aux(u32 src, u8 *dst, int dst_bytes)
+static void intel_dp_aux_unpack(u32 src, u8 *dst, int dst_bytes)
 {
int i;
 
@@ -267,7 +267,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
for (i = 0; i < send_bytes; i += 4)
intel_uncore_write(uncore,
   ch_data[i >> 2],
-  intel_dp_pack_aux(send + i,
+  intel_dp_aux_pack(send + i,
 send_bytes 
- i));
 
/* Send the command and wait for it to complete */
@@ -352,7 +352,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
recv_bytes = recv_size;
 
for (i = 0; i < recv_bytes; i += 4)
-   intel_dp_unpack_aux(intel_uncore_read(uncore, ch_data[i >> 2]),
+   intel_dp_aux_unpack(intel_uncore_read(uncore, ch_data[i >> 2]),
recv + i, recv_bytes - i);
 
ret = recv_bytes;
diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.h 
b/drivers/gpu/drm/i915/display/intel_dp_aux.h
index 4afbe76217b9..738577537bc7 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.h
@@ -6,12 +6,8 @@
 #ifndef __INTEL_DP_AUX_H__
 #define __INTEL_DP_AUX_H__
 
-#include 
-
 struct intel_dp;
 
-u32 intel_dp_pack_aux(const u8 *src, int src_bytes);
-
 void intel_dp_aux_fini(struct intel_dp *intel_dp);
 void intel_dp_aux_init(struct intel_dp *intel_dp);
 
-- 
2.30.2



[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/dp: make intel_dp_pack_aux() static again

2021-12-29 Thread Patchwork
== Series Details ==

Series: drm/i915/dp: make intel_dp_pack_aux() static again
URL   : https://patchwork.freedesktop.org/series/98399/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_11039 -> Patchwork_21907


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (42 -> 33)
--

  Missing(9): fi-kbl-soraka bat-dg1-6 fi-bsw-cyan bat-adlp-6 bat-adlp-4 
fi-pnv-d510 bat-rpls-1 bat-jsl-2 fi-bdw-samus 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@amdgpu/amd_basic@cs-gfx:
- fi-hsw-4770:NOTRUN -> [SKIP][1] ([fdo#109271] / [fdo#109315]) +17 
similar issues
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-hsw-4770/igt@amdgpu/amd_ba...@cs-gfx.html

  * igt@core_hotunplug@unbind-rebind:
- fi-tgl-u2:  [PASS][2] -> [INCOMPLETE][3] ([i915#4006])
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-tgl-u2/igt@core_hotunp...@unbind-rebind.html
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-tgl-u2/igt@core_hotunp...@unbind-rebind.html

  * igt@gem_flink_basic@bad-flink:
- fi-skl-6600u:   [PASS][4] -> [INCOMPLETE][5] ([i915#4547])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-skl-6600u/igt@gem_flink_ba...@bad-flink.html
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-skl-6600u/igt@gem_flink_ba...@bad-flink.html

  * igt@i915_selftest@live@hangcheck:
- fi-snb-2600:[PASS][6] -> [INCOMPLETE][7] ([i915#3921])
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-snb-2600/igt@i915_selftest@l...@hangcheck.html
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-snb-2600/igt@i915_selftest@l...@hangcheck.html

  * igt@kms_frontbuffer_tracking@basic:
- fi-cfl-8109u:   [PASS][8] -> [DMESG-FAIL][9] ([i915#295])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-cfl-8109u/igt@kms_frontbuffer_track...@basic.html
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-cfl-8109u/igt@kms_frontbuffer_track...@basic.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
- fi-cfl-8109u:   [PASS][10] -> [DMESG-WARN][11] ([i915#295]) +10 
similar issues
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-cfl-8109u/igt@kms_pipe_crc_ba...@compare-crc-sanitycheck-pipe-b.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-cfl-8109u/igt@kms_pipe_crc_ba...@compare-crc-sanitycheck-pipe-b.html

  * igt@runner@aborted:
- fi-skl-6600u:   NOTRUN -> [FAIL][12] ([i915#2722] / [i915#4312])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-skl-6600u/igt@run...@aborted.html
- fi-tgl-u2:  NOTRUN -> [FAIL][13] ([i915#2722] / [i915#4312])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-tgl-u2/igt@run...@aborted.html

  
 Possible fixes 

  * igt@i915_selftest@live@hangcheck:
- fi-hsw-4770:[INCOMPLETE][14] ([i915#3303]) -> [PASS][15]
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-hsw-4770/igt@i915_selftest@l...@hangcheck.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-hsw-4770/igt@i915_selftest@l...@hangcheck.html

  * igt@kms_frontbuffer_tracking@basic:
- fi-cml-u2:  [DMESG-WARN][16] ([i915#4269]) -> [PASS][17]
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
  [i915#295]: https://gitlab.freedesktop.org/drm/intel/issues/295
  [i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
  [i915#3921]: https://gitlab.freedesktop.org/drm/intel/issues/3921
  [i915#4006]: https://gitlab.freedesktop.org/drm/intel/issues/4006
  [i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547


Build changes
-

  * Linux: CI_DRM_11039 -> Patchwork_21907

  CI-20190529: 20190529
  CI_DRM_11039: c90264924b9988493890773248bde3173a4866b4 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_6321: 85a5938090cd3da34e4fba8f541fbe240210b47d @ 
https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_21907: 7a27f1853f7536cf6a8d61add89588ddbbaef336 @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

7a27f1853f75 dr

Re: [Intel-gfx] [PATCH] drm/i915: Increment composite fence seqno

2021-12-29 Thread Jani Nikula
On Tue, 14 Dec 2021, Matthew Brost  wrote:
> Increment composite fence seqno on each fence creation.

For future reference, this commit message is not enough. Both the
subject line and the commit message just repeat what I can see from the
code, i.e. *what* is being done, but there is not a hint on the *why*
here.

BR,
Jani.

>
> Fixes: 544460c33821 ("drm/i915: Multi-BB execbuf")
> Signed-off-by: Matthew Brost 
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c 
> b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 2213f7b613da..96cf8361b017 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -3113,7 +3113,7 @@ eb_composite_fence_create(struct i915_execbuffer *eb, 
> int out_fence_fd)
>   fence_array = dma_fence_array_create(eb->num_batches,
>fences,
>
> eb->context->parallel.fence_context,
> -  eb->context->parallel.seqno,
> +  eb->context->parallel.seqno++,
>false);
>   if (!fence_array) {
>   kfree(fences);

-- 
Jani Nikula, Intel Open Source Graphics Center


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

2021-12-29 Thread Jani Nikula


Hi Dave & Daniel -

Final i915 fixes for v5.16.

BR,
Jani.

The following changes since commit fc74e0a40e4f9fd0468e34045b0c45bba11dcbb2:

  Linux 5.16-rc7 (2021-12-26 13:17:17 -0800)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-fixes-2021-12-29

for you to fetch changes up to d46f329a3f6048e04736e86cb13c880645048792:

  drm/i915: Increment composite fence seqno (2021-12-27 11:33:40 +0200)


drm/i915 fixes for v5.16:
- Fix possible uninitialized variable
- Fix composite fence seqno icrement on each fence creation


Matthew Brost (2):
  drm/i915: Fix possible uninitialized variable in parallel extension
  drm/i915: Increment composite fence seqno

 drivers/gpu/drm/i915/gem/i915_gem_context.c| 2 +-
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center


[Intel-gfx] [PULL] drm-intel-next-fixes for v5.17-rc1

2021-12-29 Thread Jani Nikula


Hi Dave & Daniel -

A lone FBC fix for drm-next for the merge window.

BR,
Jani.

The following changes since commit 040bf2a9446f6ba267225d34dc4a9b14d11e5092:

  Merge tag 'drm-misc-next-fixes-2021-12-23' of 
git://anongit.freedesktop.org/drm/drm-misc into drm-next (2021-12-24 06:24:06 
+1000)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel 
tags/drm-intel-next-fixes-2021-12-29

for you to fetch changes up to c65fe9cbbfd61dbc12868f9ed4940c80fcb249e8:

  drm/i915/fbc: Remember to update FBC state even when not reallocating CFB 
(2021-12-27 11:46:48 +0200)


drm/i915 fixes for the v5.17-rc1:
- Update FBC state even when not reallocating CFB


Ville Syrjälä (1):
  drm/i915/fbc: Remember to update FBC state even when not reallocating CFB

 drivers/gpu/drm/i915/display/intel_fbc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
Jani Nikula, Intel Open Source Graphics Center


[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/dp: make intel_dp_pack_aux() static again

2021-12-29 Thread Patchwork
== Series Details ==

Series: drm/i915/dp: make intel_dp_pack_aux() static again
URL   : https://patchwork.freedesktop.org/series/98399/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11039_full -> Patchwork_21907_full


Summary
---

  **FAILURE**

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

  

Participating hosts (12 -> 12)
--

  No changes in participating hosts

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-skl:  [PASS][1] -> [INCOMPLETE][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-skl1/igt@kms_pipe_crc_ba...@suspend-read-crc-pipe-a.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-skl8/igt@kms_pipe_crc_ba...@suspend-read-crc-pipe-a.html

  
 Suppressed 

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

  * igt@gem_ctx_shared@q-smoketest-all:
- {shard-rkl}:NOTRUN -> ([INCOMPLETE][3], [PASS][4])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-rkl-5/igt@gem_ctx_sha...@q-smoketest-all.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-rkl-4/igt@gem_ctx_sha...@q-smoketest-all.html

  * igt@gem_exec_schedule@smoketest@vcs0:
- {shard-rkl}:NOTRUN -> [INCOMPLETE][5]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-rkl-5/igt@gem_exec_schedule@smoket...@vcs0.html

  * igt@gem_softpin@allocator-evict@bcs0:
- {shard-rkl}:[PASS][6] -> [INCOMPLETE][7] +2 similar issues
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-rkl-5/igt@gem_softpin@allocator-ev...@bcs0.html
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-rkl-5/igt@gem_softpin@allocator-ev...@bcs0.html

  * igt@gem_tiled_partial_pwrite_pread@reads:
- {shard-dg1}:NOTRUN -> [SKIP][8]
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-dg1-18/igt@gem_tiled_partial_pwrite_pr...@reads.html

  * igt@gem_userptr_blits@probe:
- {shard-dg1}:NOTRUN -> [FAIL][9] +3 similar issues
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-dg1-18/igt@gem_userptr_bl...@probe.html

  * igt@i915_pm_rps@waitboost:
- {shard-dg1}:[PASS][10] -> [FAIL][11]
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-dg1-16/igt@i915_pm_...@waitboost.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21907/shard-dg1-15/igt@i915_pm_...@waitboost.html

  
Known issues


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

### CI changes ###

 Possible fixes 

  * boot:
- shard-apl:  ([PASS][12], [PASS][13], [PASS][14], [PASS][15], 
[PASS][16], [PASS][17], [PASS][18], [PASS][19], [PASS][20], [PASS][21], 
[PASS][22], [PASS][23], [PASS][24], [PASS][25], [PASS][26], [PASS][27], 
[PASS][28], [PASS][29], [PASS][30], [PASS][31], [PASS][32], [PASS][33], 
[PASS][34], [FAIL][35], [PASS][36]) ([i915#4386]) -> ([PASS][37], [PASS][38], 
[PASS][39], [PASS][40], [PASS][41], [PASS][42], [PASS][43], [PASS][44], 
[PASS][45], [PASS][46], [PASS][47], [PASS][48], [PASS][49], [PASS][50], 
[PASS][51], [PASS][52], [PASS][53], [PASS][54], [PASS][55], [PASS][56], 
[PASS][57], [PASS][58], [PASS][59], [PASS][60], [PASS][61])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl7/boot.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl7/boot.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl6/boot.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl6/boot.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl6/boot.html
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl7/boot.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl6/boot.html
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl7/boot.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl4/boot.html
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl4/boot.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl8/boot.html
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-apl8/boot.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/sha

[Intel-gfx] [PATCH v5 0/2] GPD Win Max display fixes

2021-12-29 Thread Anisse Astier
This patch series is for making the GPD Win Max display usable with
Linux.

The GPD Win Max is a small laptop, and its eDP panel does not send an
EDID over DPCD; the EDID is instead available in the intel opregion, in
mailbox #5 [1]

The second patch is just to fix the orientation of the panel.

Changes since v1:
 - rebased on drm-tip
 - squashed patch 1 & 2
 - picked up Reviewed-by from Hans de Goede (thanks for the review)

Changes since v2:
 - rebased on drm-tip
 - updated commit message

When v2 was initially sent [3] Ville Syrjälä suggested that it might be
a good idea to use the ACPI _DDC method instead to get the EDID, to
cover a wider range of hardware. Unfortunately, it doesn't seem
available on GPD Win Max, so I think this work should be done
independently, and this patch series considered separately.

Change since v3:
 - edits following Jani's review:
- The EDID from the opregion is now only used as a fallback: if we
  cannot get any edid from the edp connector, then we attempt to get
  it from the opregion. This works for the GPD Win Max.
- all other remarks should have been taken into account
 - rebased on drm-tip
 - added Co-developed-by
 - reordered signed-off-by and reviewed-by in second patch (thanks
   Maarten!)

Changes since v4:
 - checkpatch.pl fixes
 - rebased on drm-tip
 - Note: patch #1 is incomplete, still missing Jani's signed-off-by


[1]: https://gitlab.freedesktop.org/drm/intel/-/issues/3454
[2]: 
https://patchwork.kernel.org/project/intel-gfx/patch/20200828061941.17051-1-jani.nik...@intel.com/
[3]: 
https://patchwork.kernel.org/project/intel-gfx/patch/20210531204642.4907-2-ani...@astier.eu/


Anisse Astier (2):
  drm/i915/opregion: add support for mailbox #5 EDID
  drm: Add orientation quirk for GPD Win Max

 .../gpu/drm/drm_panel_orientation_quirks.c|  6 ++
 drivers/gpu/drm/i915/display/intel_dp.c   |  7 +++
 drivers/gpu/drm/i915/display/intel_opregion.c | 55 ++-
 drivers/gpu/drm/i915/display/intel_opregion.h | 10 
 4 files changed, 77 insertions(+), 1 deletion(-)

-- 
2.31.1



[Intel-gfx] [PATCH v5 2/2] drm: Add orientation quirk for GPD Win Max

2021-12-29 Thread Anisse Astier
Panel is 800x1280, but mounted on a laptop form factor, sideways.

Signed-off-by: Anisse Astier 
Reviewed-by: Hans de Goede 
---
 drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c 
b/drivers/gpu/drm/drm_panel_orientation_quirks.c
index 042bb80383c9..3dc383b1e2ba 100644
--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
@@ -174,6 +174,12 @@ static const struct dmi_system_id orientation_data[] = {
  DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MicroPC"),
},
.driver_data = (void *)&lcd720x1280_rightside_up,
+   }, {/* GPD Win Max */
+   .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "G1619-01"),
+   },
+   .driver_data = (void *)&lcd800x1280_rightside_up,
}, {/*
 * GPD Pocket, note that the the DMI data is less generic then
 * it seems, devices with a board-vendor of "AMI Corporation"
-- 
2.33.1



[Intel-gfx] [PATCH v5 1/2] drm/i915/opregion: add support for mailbox #5 EDID

2021-12-29 Thread Anisse Astier
The ACPI OpRegion Mailbox #5 ASLE extension may contain an EDID to be
used for the embedded display. Add support for using it via by adding
the EDID to the list of available modes on the connector, and use it for
eDP when available.

If a panel's EDID is broken, there may be an override EDID set in the
ACPI OpRegion mailbox #5. Use it if available.

Fixes the GPD Win Max display.

Based on original patch series by: Jani Nikula 
https://patchwork.kernel.org/project/intel-gfx/patch/20200828061941.17051-1-jani.nik...@intel.com/

Changes:
 - EDID is copied and validated with drm_edid_is_valid
 - EDID is now only used as a fallback.
 - squashed the two patches

Cc: Jani Nikula 
Cc: Uma Shankar 
Cc: Ville Syrjälä 
Co-developed-by: Jani Nikula 
Signed-off-by: Anisse Astier 
---
 drivers/gpu/drm/i915/display/intel_dp.c   |  8 +++
 drivers/gpu/drm/i915/display/intel_opregion.c | 55 ++-
 drivers/gpu/drm/i915/display/intel_opregion.h | 10 
 3 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index b5e2508db1cf..d6d8c9922feb 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4974,6 +4974,14 @@ static bool intel_edp_init_connector(struct intel_dp 
*intel_dp,
 
mutex_lock(&dev->mode_config.mutex);
edid = drm_get_edid(connector, &intel_dp->aux.ddc);
+   if (!edid) {
+   /* Fallback to EDID from ACPI OpRegion, if any */
+   edid = intel_opregion_get_edid(intel_connector);
+   if (edid)
+   drm_dbg_kms(&dev_priv->drm,
+   "[CONNECTOR:%d:%s] Using OpRegion EDID\n",
+   connector->base.id, connector->name);
+   }
if (edid) {
if (drm_add_edid_modes(connector, edid)) {
drm_connector_update_edid_property(connector, edid);
diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c 
b/drivers/gpu/drm/i915/display/intel_opregion.c
index 0065111593a6..985790a66a4d 100644
--- a/drivers/gpu/drm/i915/display/intel_opregion.c
+++ b/drivers/gpu/drm/i915/display/intel_opregion.c
@@ -195,6 +195,8 @@ struct opregion_asle_ext {
 #define ASLE_IUER_WINDOWS_BTN  (1 << 1)
 #define ASLE_IUER_POWER_BTN(1 << 0)
 
+#define ASLE_PHED_EDID_VALID_MASK  0x3
+
 /* Software System Control Interrupt (SWSCI) */
 #define SWSCI_SCIC_INDICATOR   (1 << 0)
 #define SWSCI_SCIC_MAIN_FUNCTION_SHIFT 1
@@ -908,8 +910,10 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
opregion->asle->ardy = ASLE_ARDY_NOT_READY;
}
 
-   if (mboxes & MBOX_ASLE_EXT)
+   if (mboxes & MBOX_ASLE_EXT) {
drm_dbg(&dev_priv->drm, "ASLE extension supported\n");
+   opregion->asle_ext = base + OPREGION_ASLE_EXT_OFFSET;
+   }
 
if (intel_load_vbt_firmware(dev_priv) == 0)
goto out;
@@ -1036,6 +1040,54 @@ intel_opregion_get_panel_type(struct drm_i915_private 
*dev_priv)
return ret - 1;
 }
 
+/**
+ * intel_opregion_get_edid - Fetch EDID from ACPI OpRegion mailbox #5
+ * @intel_connector: eDP connector
+ *
+ * This reads the ACPI Opregion mailbox #5 to extract the EDID that is passed
+ * to it.
+ *
+ * Returns:
+ * The EDID in the OpRegion, or NULL if there is none or it's invalid.
+ *
+ */
+struct edid *intel_opregion_get_edid(struct intel_connector *intel_connector)
+{
+   struct drm_connector *connector = &intel_connector->base;
+   struct drm_i915_private *i915 = to_i915(connector->dev);
+   struct intel_opregion *opregion = &i915->opregion;
+   const void *in_edid;
+   const struct edid *edid;
+   struct edid *new_edid;
+   int len;
+
+   if (!opregion->asle_ext)
+   return NULL;
+
+   in_edid = opregion->asle_ext->bddc;
+
+   /* Validity corresponds to number of 128-byte blocks */
+   len = (opregion->asle_ext->phed & ASLE_PHED_EDID_VALID_MASK) * 128;
+   if (!len || !memchr_inv(in_edid, 0, len))
+   return NULL;
+
+   edid = in_edid;
+
+   if (len < EDID_LENGTH * (1 + edid->extensions)) {
+   drm_dbg_kms(&i915->drm, "Invalid EDID in ACPI OpRegion (Mailbox 
#5): too short\n");
+   return NULL;
+   }
+   new_edid = drm_edid_duplicate(edid);
+   if (!new_edid)
+   return NULL;
+   if (!drm_edid_is_valid(new_edid)) {
+   kfree(new_edid);
+   drm_dbg_kms(&i915->drm, "Invalid EDID in ACPI OpRegion (Mailbox 
#5)\n");
+   return NULL;
+   }
+   return new_edid;
+}
+
 void intel_opregion_register(struct drm_i915_private *i915)
 {
struct intel_opregion *opregion = &i915->opregion;
@@ -1129,6 +1181,7 @@ void intel_opregion_unregister(struct drm_i915_private 
*i915)
opregion->acpi = NULL;
opregion->swsci = NULL;
 

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for GPD Win Max display fixes (rev7)

2021-12-29 Thread Patchwork
== Series Details ==

Series: GPD Win Max display fixes (rev7)
URL   : https://patchwork.freedesktop.org/series/90483/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
ace525da9b7f drm/i915/opregion: add support for mailbox #5 EDID
-:20: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#20: 
https://patchwork.kernel.org/project/intel-gfx/patch/20200828061941.17051-1-jani.nik...@intel.com/

-:30: WARNING:BAD_SIGN_OFF: Co-developed-by and Signed-off-by: name/email do 
not match 
#30: 
Co-developed-by: Jani Nikula 
Signed-off-by: Anisse Astier 
total: 0 errors, 2 warnings, 0 checks, 134 lines checked
8b5753e9c404 drm: Add orientation quirk for GPD Win Max




[Intel-gfx] ✗ Fi.CI.SPARSE: warning for GPD Win Max display fixes (rev7)

2021-12-29 Thread Patchwork
== Series Details ==

Series: GPD Win Max display fixes (rev7)
URL   : https://patchwork.freedesktop.org/series/90483/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.




[Intel-gfx] ✓ Fi.CI.BAT: success for GPD Win Max display fixes (rev7)

2021-12-29 Thread Patchwork
== Series Details ==

Series: GPD Win Max display fixes (rev7)
URL   : https://patchwork.freedesktop.org/series/90483/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_11039 -> Patchwork_21908


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (42 -> 31)
--

  Missing(11): fi-kbl-soraka bat-dg1-6 fi-tgl-u2 fi-tgl-dsi fi-bsw-cyan 
bat-adlp-6 bat-adlp-4 fi-pnv-d510 bat-rpls-1 bat-jsl-2 fi-bdw-samus 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_flink_basic@bad-flink:
- fi-skl-6600u:   [PASS][1] -> [FAIL][2] ([i915#4547])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-skl-6600u/igt@gem_flink_ba...@bad-flink.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/fi-skl-6600u/igt@gem_flink_ba...@bad-flink.html

  * igt@runner@aborted:
- fi-skl-6600u:   NOTRUN -> [FAIL][3] ([i915#4312])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/fi-skl-6600u/igt@run...@aborted.html

  
 Possible fixes 

  * igt@kms_frontbuffer_tracking@basic:
- fi-cml-u2:  [DMESG-WARN][4] ([i915#4269]) -> [PASS][5]
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html

  
 Warnings 

  * igt@i915_selftest@live@hangcheck:
- fi-hsw-4770:[INCOMPLETE][6] ([i915#3303]) -> [INCOMPLETE][7] 
([i915#4785])
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/fi-hsw-4770/igt@i915_selftest@l...@hangcheck.html
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/fi-hsw-4770/igt@i915_selftest@l...@hangcheck.html

  
  [i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
  [i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
  [i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785


Build changes
-

  * Linux: CI_DRM_11039 -> Patchwork_21908

  CI-20190529: 20190529
  CI_DRM_11039: c90264924b9988493890773248bde3173a4866b4 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_6321: 85a5938090cd3da34e4fba8f541fbe240210b47d @ 
https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_21908: 8b5753e9c404ab1da33b5fe59b9daaa2ef0f4734 @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

8b5753e9c404 drm: Add orientation quirk for GPD Win Max
ace525da9b7f drm/i915/opregion: add support for mailbox #5 EDID

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/index.html


Re: [Intel-gfx] [PATCH] x86/quirks: Fix logic to apply quirk once

2021-12-29 Thread Bjorn Helgaas
On Fri, Dec 17, 2021 at 10:13:13PM -0800, Lucas De Marchi wrote:
> When using QFLAG_APPLY_ONCE we make sure the quirk is applied only once.

Maybe "called" only once, since you're about to add a distinction
between "called" and "applied"?

I'm not really sure the concept of QFLAG_APPLY_ONCE, QFLAG_APPLIED,
QFLAG_DONE is general purpose enough to be handled at the level of
check_dev_quirk().

We don't have anything like that for the regular PCI fixups (see
pci_do_fixups()).  If a regular fixup needed something like that, it
would use a static local variable.  Maybe that would be simpler
overall here, too, since the quirk would be *always* called for
matching devices, and the "one-time" logic would be encapsulated in
the quirk itself where it's more obvious?

> This is useful when it's enough one device to trigger a certain
> condition or when the resource in each that applies is global to the
> system rather than local to the device.
> 
> However we call the quirk handler based on vendor, class, and device,
> allowing the specific handler to do additional filtering. In that case
> check_dev_quirk() may incorrectly mark the quirk as applied when it's
> not. This is particularly bad for intel_graphics_quirks() that uses
> PCI_ANY_ID and then compares with a long list of devices. This hasn't
> been problematic so far because those devices are integrated GPUs and
> there can only be one in the system.  However as Intel starts to
> release discrete cards, this condition is no longer true and we fail to
> reserve the stolen memory (for the integrated gpu) depending on the bus
> topology: if the traversal finds the discrete card first, for which
> there is no system stolen memory, we will fail to reserve it for the
> integrated card.

s/integrated gpu/integrated GPU/ (to match previous use)

> This fixes the stolen memory reservation for an Alderlake-P system with
> one additional DG2. In this system we have:

DG2?

>   - 00:01.0 Bridge
> `- 03:00.0 DG2
>   - Alderklake-P's integrated graphics

s/Alderklake-P/Alderlake-P/

Might be nice to include the integrated GPU PCI address to be parallel
with the bridge and DG2.

> Since we do a depth-first traversal, when we call the handler because of
> DG2 we were marking it as already being applied and never reserving the
> stolen memory for Alderlake-P.
> 
> Here we change the quirk fucntions to return bool in case it applied a
> quirk so we only flag it as applied when that really happened. This only
> makes a difference for quirks using QFLAG_APPLY_ONCE, so all the others
> simply returns true in order to avoid unnecessary complication.

s/fucntions/functions/
s/returns true/return true/

I would consider splitting this into two patches:

  1) Change the quirk signature, make them all return "true", and
  update check_dev_quirk().  This would have no functional impact.

  2) Update intel_graphics_quirks() to return "false" when it doesn't
  reserve the stolen memory.

Then the important change will be in a small patch by itself and will
be easier to understand and revert if that should be necessary.

> Signed-off-by: Lucas De Marchi 
> ---
>  arch/x86/kernel/early-quirks.c | 75 ++
>  1 file changed, 49 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
> index 391a4e2b8604..5d235fe2a07a 100644
> --- a/arch/x86/kernel/early-quirks.c
> +++ b/arch/x86/kernel/early-quirks.c
> @@ -28,7 +28,7 @@
>  #include 
>  #include 
>  
> -static void __init fix_hypertransport_config(int num, int slot, int func)
> +static bool __init fix_hypertransport_config(int num, int slot, int func)
>  {
>   u32 htcfg;
>   /*
> @@ -51,10 +51,10 @@ static void __init fix_hypertransport_config(int num, int 
> slot, int func)
>   }
>   }
>  
> -
> + return true;
>  }
>  
> -static void __init via_bugs(int  num, int slot, int func)
> +static bool __init via_bugs(int  num, int slot, int func)
>  {
>  #ifdef CONFIG_GART_IOMMU
>   if ((max_pfn > MAX_DMA32_PFN ||  force_iommu) &&
> @@ -63,8 +63,12 @@ static void __init via_bugs(int  num, int slot, int func)
>  "Looks like a VIA chipset. Disabling IOMMU."
>  " Override with iommu=allowed\n");
>   gart_iommu_aperture_disabled = 1;
> +
> + return true;
>   }
>  #endif
> +
> + return false;
>  }
>  
>  #ifdef CONFIG_ACPI
> @@ -77,7 +81,7 @@ static int __init nvidia_hpet_check(struct 
> acpi_table_header *header)
>  #endif /* CONFIG_X86_IO_APIC */
>  #endif /* CONFIG_ACPI */
>  
> -static void __init nvidia_bugs(int num, int slot, int func)
> +static bool __init nvidia_bugs(int num, int slot, int func)
>  {
>  #ifdef CONFIG_ACPI
>  #ifdef CONFIG_X86_IO_APIC
> @@ -86,7 +90,7 @@ static void __init nvidia_bugs(int num, int slot, int func)
>* Nvidia graphics cards with PCI ports on secondary buses.
>*/
>   if (num)
> - retu

[Intel-gfx] ✗ Fi.CI.IGT: failure for GPD Win Max display fixes (rev7)

2021-12-29 Thread Patchwork
== Series Details ==

Series: GPD Win Max display fixes (rev7)
URL   : https://patchwork.freedesktop.org/series/90483/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11039_full -> Patchwork_21908_full


Summary
---

  **FAILURE**

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

  

Participating hosts (12 -> 19)
--

  Additional (7): shard-tglu-7 shard-tglu-6 shard-tglu-8 shard-tglu-1 
shard-tglu-3 shard-tglu-4 shard-tglu-2 

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@i915_selftest@mock@requests:
- shard-skl:  [PASS][1] -> [INCOMPLETE][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-skl9/igt@i915_selftest@m...@requests.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-skl6/igt@i915_selftest@m...@requests.html

  
 Suppressed 

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

  * igt@api_intel_allocator@fork-simple-stress:
- {shard-rkl}:[PASS][3] -> [INCOMPLETE][4] +1 similar issue
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-rkl-2/igt@api_intel_alloca...@fork-simple-stress.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-rkl-5/igt@api_intel_alloca...@fork-simple-stress.html

  * igt@gem_create@busy-create:
- {shard-tglu-7}: NOTRUN -> [INCOMPLETE][5]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-7/igt@gem_cre...@busy-create.html

  * igt@gem_create@create-massive:
- {shard-tglu-4}: NOTRUN -> [DMESG-WARN][6]
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-4/igt@gem_cre...@create-massive.html

  * igt@gem_exec_fair@basic-none-rrul@rcs0:
- {shard-tglu-8}: NOTRUN -> [FAIL][7] +3 similar issues
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-8/igt@gem_exec_fair@basic-none-r...@rcs0.html

  * igt@gem_exec_fair@basic-none-vip@rcs0:
- {shard-tglu-2}: NOTRUN -> [FAIL][8]
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-2/igt@gem_exec_fair@basic-none-...@rcs0.html

  * igt@gem_exec_fair@basic-pace@vecs0:
- {shard-tglu-6}: NOTRUN -> [FAIL][9] +6 similar issues
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-6/igt@gem_exec_fair@basic-p...@vecs0.html

  * igt@gem_exec_fair@basic-throttle@rcs0:
- {shard-tglu-3}: NOTRUN -> [FAIL][10] +5 similar issues
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-3/igt@gem_exec_fair@basic-throt...@rcs0.html

  * igt@gem_exec_params@no-vebox:
- {shard-tglu-7}: NOTRUN -> [SKIP][11] +80 similar issues
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-7/igt@gem_exec_par...@no-vebox.html

  * igt@gem_exec_suspend@basic-s3-devices@smem:
- {shard-tglu-7}: NOTRUN -> [FAIL][12]
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-7/igt@gem_exec_suspend@basic-s3-devi...@smem.html

  * igt@gem_exec_suspend@basic-s3@smem:
- {shard-tglu-1}: NOTRUN -> [FAIL][13] +1 similar issue
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-1/igt@gem_exec_suspend@basic...@smem.html

  * igt@gem_lmem_swapping@smem-oom@lmem0:
- {shard-dg1}:[PASS][14] -> [DMESG-WARN][15] +1 similar issue
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11039/shard-dg1-15/igt@gem_lmem_swapping@smem-...@lmem0.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-dg1-14/igt@gem_lmem_swapping@smem-...@lmem0.html

  * igt@gem_tiled_partial_pwrite_pread@reads:
- {shard-dg1}:NOTRUN -> [SKIP][16] +1 similar issue
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-dg1-17/igt@gem_tiled_partial_pwrite_pr...@reads.html

  * igt@gem_userptr_blits@input-checking:
- {shard-tglu-7}: NOTRUN -> [DMESG-WARN][17] +1 similar issue
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-tglu-7/igt@gem_userptr_bl...@input-checking.html

  * igt@gem_userptr_blits@probe:
- {shard-dg1}:NOTRUN -> [FAIL][18] +5 similar issues
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21908/shard-dg1-17/igt@gem_userptr_bl...@probe.html

  * igt@i915_pm_rc6_residency@rc6-fence:
- {shard-tglu-2}: NOTRUN -> [WARN][19] +1 similar issue
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwor

Re: [Intel-gfx] [PATCH] x86/quirks: Fix logic to apply quirk once

2021-12-29 Thread Lucas De Marchi

On Wed, Dec 29, 2021 at 05:27:52PM -0600, Bjorn Helgaas wrote:

On Fri, Dec 17, 2021 at 10:13:13PM -0800, Lucas De Marchi wrote:

When using QFLAG_APPLY_ONCE we make sure the quirk is applied only once.


Maybe "called" only once, since you're about to add a distinction
between "called" and "applied"?


ok... yeah, the current issue is that the logic here considers
"called" as "applied", and it's not true since the called function may
do additional checks



I'm not really sure the concept of QFLAG_APPLY_ONCE, QFLAG_APPLIED,
QFLAG_DONE is general purpose enough to be handled at the level of
check_dev_quirk().

We don't have anything like that for the regular PCI fixups (see
pci_do_fixups()).  If a regular fixup needed something like that, it
would use a static local variable.  Maybe that would be simpler
overall here, too, since the quirk would be *always* called for
matching devices, and the "one-time" logic would be encapsulated in
the quirk itself where it's more obvious?


so would that mean an alternative solution, removing all the logic using
flags and just embed it in the few quirks that make use of it?

yeah, I guess that would work too. Not sure what solution is preferred
though.


This is useful when it's enough one device to trigger a certain
condition or when the resource in each that applies is global to the
system rather than local to the device.

However we call the quirk handler based on vendor, class, and device,
allowing the specific handler to do additional filtering. In that case
check_dev_quirk() may incorrectly mark the quirk as applied when it's
not. This is particularly bad for intel_graphics_quirks() that uses
PCI_ANY_ID and then compares with a long list of devices. This hasn't
been problematic so far because those devices are integrated GPUs and
there can only be one in the system.  However as Intel starts to
release discrete cards, this condition is no longer true and we fail to
reserve the stolen memory (for the integrated gpu) depending on the bus
topology: if the traversal finds the discrete card first, for which
there is no system stolen memory, we will fail to reserve it for the
integrated card.


s/integrated gpu/integrated GPU/ (to match previous use)


This fixes the stolen memory reservation for an Alderlake-P system with
one additional DG2. In this system we have:


DG2?


that is its name, not an abbreviation. It's one of Intel's discrete
graphics cards. See for example 9e22cfc5e9b9 ("drm/i915/dg2: add DG2 platform 
info")

maybe reword this as "one additional Intel GPU, DG2"?




- 00:01.0 Bridge
  `- 03:00.0 DG2
- Alderklake-P's integrated graphics


s/Alderklake-P/Alderlake-P/

Might be nice to include the integrated GPU PCI address to be parallel
with the bridge and DG2.


ok




Since we do a depth-first traversal, when we call the handler because of
DG2 we were marking it as already being applied and never reserving the
stolen memory for Alderlake-P.

Here we change the quirk fucntions to return bool in case it applied a
quirk so we only flag it as applied when that really happened. This only
makes a difference for quirks using QFLAG_APPLY_ONCE, so all the others
simply returns true in order to avoid unnecessary complication.


s/fucntions/functions/
s/returns true/return true/

I would consider splitting this into two patches:

 1) Change the quirk signature, make them all return "true", and
 update check_dev_quirk().  This would have no functional impact.

 2) Update intel_graphics_quirks() to return "false" when it doesn't
 reserve the stolen memory.

Then the important change will be in a small patch by itself and will
be easier to understand and revert if that should be necessary.


makes sense. I will take a look on what the other alternative you gave
looks like, too.

thanks for the review

Lucas De Marchi




Signed-off-by: Lucas De Marchi 
---
 arch/x86/kernel/early-quirks.c | 75 ++
 1 file changed, 49 insertions(+), 26 deletions(-)

diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 391a4e2b8604..5d235fe2a07a 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -28,7 +28,7 @@
 #include 
 #include 

-static void __init fix_hypertransport_config(int num, int slot, int func)
+static bool __init fix_hypertransport_config(int num, int slot, int func)
 {
u32 htcfg;
/*
@@ -51,10 +51,10 @@ static void __init fix_hypertransport_config(int num, int 
slot, int func)
}
}

-
+   return true;
 }

-static void __init via_bugs(int  num, int slot, int func)
+static bool __init via_bugs(int  num, int slot, int func)
 {
 #ifdef CONFIG_GART_IOMMU
if ((max_pfn > MAX_DMA32_PFN ||  force_iommu) &&
@@ -63,8 +63,12 @@ static void __init via_bugs(int  num, int slot, int func)
   "Looks like a VIA chipset. Disabling IOMMU."
   " Override with iommu=allowed\n");