[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/4] drm/i915: Add missing forward declarations/includes to display power headers

2023-06-16 Thread Patchwork
== Series Details ==

Series: series starting with [1/4] drm/i915: Add missing forward 
declarations/includes to display power headers
URL   : https://patchwork.freedesktop.org/series/119480/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13279 -> Patchwork_119480v1


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (42 -> 41)
--

  Missing(1): fi-snb-2520m 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@core_auth@basic-auth:
- bat-adlp-11:NOTRUN -> [ABORT][1] ([i915#4423] / [i915#8011])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-adlp-11/igt@core_a...@basic-auth.html

  * igt@gem_lmem_swapping@parallel-random-engines:
- fi-bsw-nick:NOTRUN -> [SKIP][2] ([fdo#109271]) +19 similar issues
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/fi-bsw-nick/igt@gem_lmem_swapp...@parallel-random-engines.html
- bat-mtlp-8: NOTRUN -> [SKIP][3] ([i915#4613]) +3 similar issues
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-mtlp-8/igt@gem_lmem_swapp...@parallel-random-engines.html

  * igt@i915_pm_rps@basic-api:
- bat-mtlp-8: NOTRUN -> [SKIP][4] ([i915#6621])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-mtlp-8/igt@i915_pm_...@basic-api.html

  * igt@i915_selftest@live@execlists:
- fi-bsw-n3050:   [PASS][5] -> [ABORT][6] ([i915#7911] / [i915#7913])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/fi-bsw-n3050/igt@i915_selftest@l...@execlists.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/fi-bsw-n3050/igt@i915_selftest@l...@execlists.html

  * igt@i915_selftest@live@hangcheck:
- bat-dg2-11: [PASS][7] -> [ABORT][8] ([i915#7913] / [i915#7979])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-dg2-11/igt@i915_selftest@l...@hangcheck.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-dg2-11/igt@i915_selftest@l...@hangcheck.html

  * igt@i915_selftest@live@migrate:
- bat-dg2-11: [PASS][9] -> [DMESG-WARN][10] ([i915#7699])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-dg2-11/igt@i915_selftest@l...@migrate.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-dg2-11/igt@i915_selftest@l...@migrate.html

  * igt@i915_selftest@live@requests:
- bat-mtlp-8: NOTRUN -> [DMESG-FAIL][11] ([i915#8497])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-mtlp-8/igt@i915_selftest@l...@requests.html

  * igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-WARN][12] ([i915#6367])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-rpls-2/igt@i915_selftest@l...@slpc.html

  * igt@i915_suspend@basic-s2idle-without-i915:
- bat-rpls-2: NOTRUN -> [ABORT][13] ([i915#6687] / [i915#8668])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-rpls-2/igt@i915_susp...@basic-s2idle-without-i915.html

  * igt@i915_suspend@basic-s3-without-i915:
- bat-mtlp-8: NOTRUN -> [SKIP][14] ([i915#6645])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-mtlp-8/igt@i915_susp...@basic-s3-without-i915.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-mtlp-8: NOTRUN -> [SKIP][15] ([i915#7828])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-mtlp-8/igt@kms_chamelium_...@common-hpd-after-suspend.html

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-dg2-11: NOTRUN -> [SKIP][16] ([i915#1845] / [i915#5354]) +3 
similar issues
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-dg2-11/igt@kms_pipe_crc_ba...@nonblocking-crc-frame-sequence.html

  * igt@kms_setmode@basic-clone-single-crtc:
- fi-bsw-nick:NOTRUN -> [SKIP][17] ([fdo#109271] / [i915#4579])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/fi-bsw-nick/igt@kms_setm...@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-read:
- bat-mtlp-8: NOTRUN -> [SKIP][18] ([i915#3708]) +2 similar issues
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-mtlp-8/igt@prime_v...@basic-fence-read.html

  * igt@prime_vgem@basic-gtt:
- bat-mtlp-8: NOTRUN -> [SKIP][19] ([i915#3708] / [i915#4077]) +1 
similar issue
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119480v1/bat-mtlp-8/igt@prime_v...@basic-gtt.html

  
 Possible fixes 

  * igt@i915_pm_rpm@basic-rte:
- bat-mtlp-8: [ABORT][20] -> [PASS][21]
   [20]: 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/perf: Consider OA buffer boundary when zeroing out reports (rev2)

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915/perf: Consider OA buffer boundary when zeroing out reports 
(rev2)
URL   : https://patchwork.freedesktop.org/series/119427/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13279 -> Patchwork_119427v2


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (42 -> 41)
--

  Additional (1): fi-kbl-soraka 
  Missing(2): bat-rpls-2 fi-snb-2520m 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@core_auth@basic-auth:
- bat-adlp-11:NOTRUN -> [ABORT][1] ([i915#8011])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-adlp-11/igt@core_a...@basic-auth.html

  * igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka:  NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#2190])
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/fi-kbl-soraka/igt@gem_huc_c...@huc-copy.html

  * igt@gem_lmem_swapping@basic:
- fi-kbl-soraka:  NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#4613]) +3 
similar issues
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/fi-kbl-soraka/igt@gem_lmem_swapp...@basic.html

  * igt@gem_lmem_swapping@parallel-random-engines:
- fi-bsw-nick:NOTRUN -> [SKIP][4] ([fdo#109271]) +19 similar issues
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/fi-bsw-nick/igt@gem_lmem_swapp...@parallel-random-engines.html
- bat-mtlp-8: NOTRUN -> [SKIP][5] ([i915#4613]) +3 similar issues
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-mtlp-8/igt@gem_lmem_swapp...@parallel-random-engines.html

  * igt@i915_pm_rps@basic-api:
- bat-mtlp-8: NOTRUN -> [SKIP][6] ([i915#6621])
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-mtlp-8/igt@i915_pm_...@basic-api.html

  * igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka:  NOTRUN -> [DMESG-FAIL][7] ([i915#5334] / [i915#7872])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@gt_mocs:
- bat-mtlp-8: NOTRUN -> [DMESG-FAIL][8] ([i915#7059])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html

  * igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka:  NOTRUN -> [DMESG-FAIL][9] ([i915#1886] / [i915#7913])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@live@requests:
- bat-mtlp-6: [PASS][10] -> [DMESG-FAIL][11] ([i915#8497])
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-mtlp-6/igt@i915_selftest@l...@requests.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-mtlp-6/igt@i915_selftest@l...@requests.html

  * igt@i915_selftest@live@slpc:
- bat-mtlp-8: NOTRUN -> [DMESG-WARN][12] ([i915#6367])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-mtlp-8/igt@i915_selftest@l...@slpc.html

  * igt@i915_suspend@basic-s3-without-i915:
- bat-mtlp-8: NOTRUN -> [SKIP][13] ([i915#6645])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-mtlp-8/igt@i915_susp...@basic-s3-without-i915.html
- bat-rpls-1: NOTRUN -> [ABORT][14] ([i915#6687] / [i915#7978])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-rpls-1/igt@i915_susp...@basic-s3-without-i915.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-mtlp-8: NOTRUN -> [SKIP][15] ([i915#7828])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-mtlp-8/igt@kms_chamelium_...@common-hpd-after-suspend.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-kbl-soraka:  NOTRUN -> [SKIP][16] ([fdo#109271]) +14 similar issues
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/fi-kbl-soraka/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
- bat-dg2-8:  [PASS][17] -> [FAIL][18] ([i915#7932])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-seque...@pipe-d-dp-1.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-seque...@pipe-d-dp-1.html

  * igt@kms_setmode@basic-clone-single-crtc:
- fi-bsw-nick:NOTRUN -> [SKIP][19] ([fdo#109271] / [i915#4579])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v2/fi-bsw-nick/igt@kms_setm...@basic-clone-single-crtc.html
   

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/perf: Determine context valid in OA reports (rev2)

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915/perf: Determine context valid in OA reports (rev2)
URL   : https://patchwork.freedesktop.org/series/119426/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13279 -> Patchwork_119426v2


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (42 -> 41)
--

  Missing(1): fi-snb-2520m 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_lmem_swapping@parallel-random-engines:
- fi-bsw-nick:NOTRUN -> [SKIP][1] ([fdo#109271]) +19 similar issues
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/fi-bsw-nick/igt@gem_lmem_swapp...@parallel-random-engines.html
- bat-mtlp-8: NOTRUN -> [SKIP][2] ([i915#4613]) +3 similar issues
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@gem_lmem_swapp...@parallel-random-engines.html

  * igt@i915_pm_rps@basic-api:
- bat-mtlp-8: NOTRUN -> [SKIP][3] ([i915#6621])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@i915_pm_...@basic-api.html

  * igt@i915_selftest@live@gt_mocs:
- bat-mtlp-8: NOTRUN -> [DMESG-FAIL][4] ([i915#7059])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html

  * igt@i915_selftest@live@reset:
- bat-rpls-2: NOTRUN -> [ABORT][5] ([i915#4983] / [i915#7461] / 
[i915#7913] / [i915#8347])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-rpls-2/igt@i915_selftest@l...@reset.html

  * igt@i915_selftest@live@slpc:
- bat-rpls-1: NOTRUN -> [DMESG-WARN][6] ([i915#6367])
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-rpls-1/igt@i915_selftest@l...@slpc.html

  * igt@i915_suspend@basic-s3-without-i915:
- bat-mtlp-8: NOTRUN -> [SKIP][7] ([i915#6645])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@i915_susp...@basic-s3-without-i915.html
- bat-rpls-1: NOTRUN -> [ABORT][8] ([i915#6687] / [i915#7978])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-rpls-1/igt@i915_susp...@basic-s3-without-i915.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-mtlp-8: NOTRUN -> [SKIP][9] ([i915#7828])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@kms_chamelium_...@common-hpd-after-suspend.html

  * igt@kms_setmode@basic-clone-single-crtc:
- fi-bsw-nick:NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#4579])
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/fi-bsw-nick/igt@kms_setm...@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-read:
- bat-mtlp-8: NOTRUN -> [SKIP][11] ([i915#3708]) +2 similar issues
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@prime_v...@basic-fence-read.html

  * igt@prime_vgem@basic-gtt:
- bat-mtlp-8: NOTRUN -> [SKIP][12] ([i915#3708] / [i915#4077]) +1 
similar issue
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@prime_v...@basic-gtt.html

  
 Possible fixes 

  * igt@i915_pm_rpm@basic-rte:
- bat-mtlp-8: [ABORT][13] -> [PASS][14]
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-mtlp-8/igt@i915_pm_...@basic-rte.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-8/igt@i915_pm_...@basic-rte.html

  * igt@i915_selftest@live@gt_mocs:
- bat-mtlp-6: [DMESG-FAIL][15] ([i915#7059]) -> [PASS][16]
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html

  * igt@i915_selftest@live@requests:
- bat-rpls-2: [ABORT][17] ([i915#4983] / [i915#7913]) -> [PASS][18]
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-rpls-2/igt@i915_selftest@l...@requests.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-rpls-2/igt@i915_selftest@l...@requests.html

  * igt@i915_selftest@live@reset:
- bat-rpls-1: [ABORT][19] ([i915#7461] / [i915#7981] / [i915#8347] 
/ [i915#8384]) -> [PASS][20]
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13279/bat-rpls-1/igt@i915_selftest@l...@reset.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119426v2/bat-rpls-1/igt@i915_selftest@l...@reset.html

  * igt@i915_selftest@live@slpc:
- bat-mtlp-6: [DMESG-WARN][21] ([i915#6367]) -> [PASS][22]
   [21]: 

Re: [Intel-gfx] [PATCH] drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Randy Dunlap



On 6/16/23 02:31, Arnd Bergmann wrote:
> From: Arnd Bergmann 
> 
> The function is only defined if CONFIG_PROC_FS is enabled:
> 
> ld.lld: error: undefined symbol: i915_drm_client_fdinfo
 referenced by i915_driver.c
   drivers/gpu/drm/i915/i915_driver.o:(i915_drm_driver) in 
 archive vmlinux.a
> 
> Use the PTR_IF() helper to make the reference NULL otherwise.
> 
> Fixes: e894b724c316d ("drm/i915: Use the fdinfo helper")
> Signed-off-by: Arnd Bergmann 

Acked-by: Randy Dunlap 
Tested-by: Randy Dunlap  # build-tested

Thanks.

> ---
>  drivers/gpu/drm/i915/i915_driver.c | 2 +-
>  drivers/gpu/drm/i915/i915_drm_client.h | 2 --
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_driver.c 
> b/drivers/gpu/drm/i915/i915_driver.c
> index 75cbc43b326dd..0ad0c5885ec27 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1816,7 +1816,7 @@ static const struct drm_driver i915_drm_driver = {
>   .open = i915_driver_open,
>   .lastclose = i915_driver_lastclose,
>   .postclose = i915_driver_postclose,
> - .show_fdinfo = i915_drm_client_fdinfo,
> + .show_fdinfo = PTR_IF(IS_ENABLED(CONFIG_PROC_FS), 
> i915_drm_client_fdinfo),
>  
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> diff --git a/drivers/gpu/drm/i915/i915_drm_client.h 
> b/drivers/gpu/drm/i915/i915_drm_client.h
> index 4c18b99e10a4e..67816c912bca1 100644
> --- a/drivers/gpu/drm/i915/i915_drm_client.h
> +++ b/drivers/gpu/drm/i915/i915_drm_client.h
> @@ -47,8 +47,6 @@ static inline void i915_drm_client_put(struct 
> i915_drm_client *client)
>  
>  struct i915_drm_client *i915_drm_client_alloc(void);
>  
> -#ifdef CONFIG_PROC_FS
>  void i915_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
> -#endif
>  
>  #endif /* !__I915_DRM_CLIENT_H__ */

-- 
~Randy


Re: [Intel-gfx] [PATCH 1/4] drm/i915: Add missing forward declarations/includes to display power headers

2023-06-16 Thread Randy Dunlap
Hi--

On 6/16/23 11:51, Imre Deak wrote:
> Add the seq_file struct forward declaration to intel_display_power.h
> fixing the build error below. While at it add the rest of missing
> forward declarations/includes to the display power header files.
> 
> In file included from :
> ./../drivers/gpu/drm/i915/display/intel_display_power.h:255:70: error: 
> 'struct seq_file'
> declared inside parameter list will not be visible outside of this definition 
> or declaration [-Werror]
>   255 | void intel_display_power_debug(struct drm_i915_private *i915, struct 
> seq_file *m);
>   |  
> ^~~~
> 
> Reported-by: Randy Dunlap 
> Closes: 
> https://lore.kernel.org/intel-gfx/89adc1ac-25a0-6eb6-4cc9-ab6cc8d49...@infradead.org/
> Signed-off-by: Imre Deak 

Acked-by: Randy Dunlap 
Tested-by: Randy Dunlap  # build-tested

Thanks.

> ---
>  drivers/gpu/drm/i915/display/intel_display_power.h  | 4 
>  drivers/gpu/drm/i915/display/intel_display_power_well.h | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h 
> b/drivers/gpu/drm/i915/display/intel_display_power.h
> index be1a87bde0c9d..df38632c62371 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.h
> @@ -6,6 +6,9 @@
>  #ifndef __INTEL_DISPLAY_POWER_H__
>  #define __INTEL_DISPLAY_POWER_H__
>  
> +#include 
> +#include 
> +
>  #include "intel_wakeref.h"
>  
>  enum aux_ch;
> @@ -16,6 +19,7 @@ enum port;
>  struct drm_i915_private;
>  struct i915_power_well;
>  struct intel_encoder;
> +struct seq_file;
>  
>  /*
>   * Keep the pipe, transcoder, port (DDI_LANES,DDI_IO,AUX) domain instances
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power_well.h 
> b/drivers/gpu/drm/i915/display/intel_display_power_well.h
> index e494df379e6c2..1015bba4af01e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power_well.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_power_well.h
> @@ -12,6 +12,8 @@
>  
>  struct drm_i915_private;
>  struct i915_power_well;
> +struct i915_power_well_ops;
> +struct intel_encoder;
>  
>  #define for_each_power_well(__dev_priv, __power_well)
> \
>   for ((__power_well) = (__dev_priv)->display.power.domains.power_wells;  
> \

-- 
~Randy


[Intel-gfx] [PATCH v2] drm/i915: Extend Wa_14015795083 platforms

2023-06-16 Thread Matt Roper
This workaround was already implemented for DG2, PVC, and some steppings
of MTL, but the workaround database has now been updated to extend this
workaround to TGL, RKL, DG1, and ADL.

v2:
 - Skip readback verification for these extra gen12lp platforms.  On
   some of the platforms, the firmware locks this register, preventing
   the driver from making any modifications.  We should still try to
   apply the workaround, but if the register is locked and the value
   doesn't stick, that's semi-expected and not something we want to flag
   as a driver error on debug builds.

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/i915/gt/intel_workarounds.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 4d2dece96011..4bb83c435a70 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -1485,6 +1485,18 @@ gen12_gt_workarounds_init(struct intel_gt *gt, struct 
i915_wa_list *wal)
 
/* Wa_14011059788:tgl,rkl,adl-s,dg1,adl-p */
wa_mcr_write_or(wal, GEN10_DFR_RATIO_EN_AND_CHICKEN, DFR_DISABLE);
+
+   /*
+* Wa_14015795083
+*
+* Firmware on some gen12 platforms locks the MISCCPCTL register,
+* preventing i915 from modifying it for this workaround.  Skip the
+* readback verification for this workaround on debug builds; if the
+* workaround doesn't stick due to firmware behavior, it's not an error
+* that we want CI to flag.
+*/
+   wa_add(wal, GEN7_MISCCPCTL, GEN12_DOP_CLOCK_GATE_RENDER_ENABLE,
+  0, 0, false);
 }
 
 static void
-- 
2.40.1



[Intel-gfx] [PATCH] drm/i915/gt: Remove incorrect hard coded cache coherrency setting

2023-06-16 Thread Zhanjun Dong
The previouse i915_gem_object_create_internal already set it with proper
value before function return. This hard coded setting is incorrect for
platforms like MTL, thus need to be removed.

Signed-off-by: Zhanjun Dong 
---
 drivers/gpu/drm/i915/gt/intel_timeline.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c 
b/drivers/gpu/drm/i915/gt/intel_timeline.c
index b9640212d659..693d18e14b00 100644
--- a/drivers/gpu/drm/i915/gt/intel_timeline.c
+++ b/drivers/gpu/drm/i915/gt/intel_timeline.c
@@ -26,8 +26,6 @@ static struct i915_vma *hwsp_alloc(struct intel_gt *gt)
if (IS_ERR(obj))
return ERR_CAST(obj);
 
-   i915_gem_object_set_cache_coherency(obj, I915_CACHE_LLC);
-
vma = i915_vma_instance(obj, >ggtt->vm, NULL);
if (IS_ERR(vma))
i915_gem_object_put(obj);
-- 
2.34.1



[Intel-gfx] [PATCH] drm/i915/mtl: Skip using vbt hdmi_level_shifter selection on MTL

2023-06-16 Thread Radhakrishna Sripada
The hdmi_level_shifter part of General Bytes definition in VBT, which was
used for choosing different levels on earlier platforms is now a hidden
optin and shows the default value of 0. The level shifter is now to be
deduced from hdmi_default_entry in  intel_ddi_buf_trans for each phy.

Skip providing the default hw provided value to force driver to choose hdmi
default entry.

Bspec: 20124
Cc: Khaled Almahallawy 
Cc: Lee Shawn C 
Cc: Clint Taylor 
Signed-off-by: Radhakrishna Sripada 
---
 drivers/gpu/drm/i915/display/intel_bios.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c 
b/drivers/gpu/drm/i915/display/intel_bios.c
index 34a397adbd6b..4b9bf76e137d 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2615,7 +2615,8 @@ intel_bios_encoder_is_lspcon(const struct 
intel_bios_encoder_data *devdata)
 /* This is an index in the HDMI/DVI DDI buffer translation table, or -1 */
 int intel_bios_hdmi_level_shift(const struct intel_bios_encoder_data *devdata)
 {
-   if (!devdata || devdata->i915->display.vbt.version < 158)
+   if (!devdata || devdata->i915->display.vbt.version < 158 ||
+   DISPLAY_VER(devdata->i915) >= 14)
return -1;
 
return devdata->child.hdmi_level_shifter_value;
-- 
2.34.1



[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/4] drm/i915: Add missing forward declarations/includes to display power headers

2023-06-16 Thread Patchwork
== Series Details ==

Series: series starting with [1/4] drm/i915: Add missing forward 
declarations/includes to display power headers
URL   : https://patchwork.freedesktop.org/series/119480/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.




[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915: Add missing forward declarations/includes to display power headers

2023-06-16 Thread Patchwork
== Series Details ==

Series: series starting with [1/4] drm/i915: Add missing forward 
declarations/includes to display power headers
URL   : https://patchwork.freedesktop.org/series/119480/
State : warning

== Summary ==

Error: dim checkpatch failed
0fa1731f78bd drm/i915: Add missing forward declarations/includes to display 
power headers
-:13: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#13: 
declared inside parameter list will not be visible outside of this definition 
or declaration [-Werror]

total: 0 errors, 1 warnings, 0 checks, 24 lines checked
bb70c02d041a drm/i915: Remove redundant forward declarations from display power 
headers
30b20e115fd7 drm/i915: Add way to specify the power-off delay of a display 
power domain
f69fb91dbeb7 drm/i915: Prevent needless toggling of DC states during modesets




[Intel-gfx] [PATCH 4/4] drm/i915: Prevent needless toggling of DC states during modesets

2023-06-16 Thread Imre Deak
DC states are disabled / re-enabled around each modeset, which may lead
to a needless off->on->off toggling of the DC_off power well. This has
some overhead as toggling DC states involves running a DMC firmware
handler and also running a periodic firmware handler while DC states are
enabled. The limit of when DC states have a benefit is at 30 FPS (using
DC3co) and below 30 FPS (using DC5/6), where the firmware can actually
disable clocks / power off power wells. Accordingly delay powering off
the DC_off powerwell (which re-enables DC states) by 17 ms at the end of
a modeset to avoid the above overhead at or above 60 FPS.

Signed-off-by: Imre Deak 
---
 drivers/gpu/drm/i915/display/intel_display.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index dd52c689267f4..de77d130d6f9f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7148,7 +7148,11 @@ static void intel_atomic_commit_tail(struct 
intel_atomic_state *state)
 */
intel_uncore_arm_unclaimed_mmio_detection(_priv->uncore);
}
-   intel_display_power_put(dev_priv, POWER_DOMAIN_DC_OFF, wakeref);
+   /*
+* Delay re-enabling DC states by 17 ms to avoid the off->on->off
+* toggling overhead at and above 60 FPS.
+*/
+   intel_display_power_put_async_delay(dev_priv, POWER_DOMAIN_DC_OFF, 
wakeref, 17);
intel_runtime_pm_put(_priv->runtime_pm, state->wakeref);
 
/*
-- 
2.37.2



[Intel-gfx] [PATCH 2/4] drm/i915: Remove redundant forward declarations from display power headers

2023-06-16 Thread Imre Deak
Remove the forward declarations for enums and structs from display power
header files that aren't used in prototypes.

Signed-off-by: Imre Deak 
---
 drivers/gpu/drm/i915/display/intel_display_power.h  | 3 ---
 drivers/gpu/drm/i915/display/intel_display_power_well.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h 
b/drivers/gpu/drm/i915/display/intel_display_power.h
index df38632c62371..83ceab091468e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.h
+++ b/drivers/gpu/drm/i915/display/intel_display_power.h
@@ -12,9 +12,6 @@
 #include "intel_wakeref.h"
 
 enum aux_ch;
-enum dpio_channel;
-enum dpio_phy;
-enum i915_drm_suspend_mode;
 enum port;
 struct drm_i915_private;
 struct i915_power_well;
diff --git a/drivers/gpu/drm/i915/display/intel_display_power_well.h 
b/drivers/gpu/drm/i915/display/intel_display_power_well.h
index 1015bba4af01e..a8736588314d9 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power_well.h
+++ b/drivers/gpu/drm/i915/display/intel_display_power_well.h
@@ -11,7 +11,6 @@
 #include "intel_dpio_phy.h"
 
 struct drm_i915_private;
-struct i915_power_well;
 struct i915_power_well_ops;
 struct intel_encoder;
 
-- 
2.37.2



[Intel-gfx] [PATCH 3/4] drm/i915: Add way to specify the power-off delay of a display power domain

2023-06-16 Thread Imre Deak
Add support for specifying a delay different than the current 100 ms
default for powering off a display power domain. This is needed by the
next patch which delays re-enabling DC states during modesets to avoid
the off->on->off toggling overhead of the DC_off power well, but does
this using a < 100 ms delay for a better utilization of DC power saving
states.

Signed-off-by: Imre Deak 
---
 .../drm/i915/display/intel_display_power.c| 41 +++
 .../drm/i915/display/intel_display_power.h| 26 ++--
 2 files changed, 55 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
b/drivers/gpu/drm/i915/display/intel_display_power.c
index d3310c7205320..38225e5d311e5 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -458,6 +458,17 @@ async_put_domains_clear_domain(struct i915_power_domains 
*power_domains,
clear_bit(domain, power_domains->async_put_domains[1].bits);
 }
 
+static void
+cancel_async_put_work(struct i915_power_domains *power_domains, bool sync)
+{
+   if (sync)
+   cancel_delayed_work_sync(_domains->async_put_work);
+   else
+   cancel_delayed_work(_domains->async_put_work);
+
+   power_domains->async_put_next_delay = 0;
+}
+
 static bool
 intel_display_power_grab_async_put_ref(struct drm_i915_private *dev_priv,
   enum intel_display_power_domain domain)
@@ -478,7 +489,7 @@ intel_display_power_grab_async_put_ref(struct 
drm_i915_private *dev_priv,
if (!bitmap_empty(async_put_mask.bits, POWER_DOMAIN_NUM))
goto out_verify;
 
-   cancel_delayed_work(_domains->async_put_work);
+   cancel_async_put_work(power_domains, false);
intel_runtime_pm_put_raw(_priv->runtime_pm,
 
fetch_and_zero(_domains->async_put_wakeref));
 out_verify:
@@ -609,7 +620,8 @@ static void __intel_display_power_put(struct 
drm_i915_private *dev_priv,
 
 static void
 queue_async_put_domains_work(struct i915_power_domains *power_domains,
-intel_wakeref_t wakeref)
+intel_wakeref_t wakeref,
+int delay_ms)
 {
struct drm_i915_private *i915 = container_of(power_domains,
 struct drm_i915_private,
@@ -618,7 +630,7 @@ queue_async_put_domains_work(struct i915_power_domains 
*power_domains,
power_domains->async_put_wakeref = wakeref;
drm_WARN_ON(>drm, !queue_delayed_work(system_unbound_wq,

_domains->async_put_work,
-   msecs_to_jiffies(100)));
+   
msecs_to_jiffies(delay_ms)));
 }
 
 static void
@@ -681,13 +693,15 @@ intel_display_power_put_async_work(struct work_struct 
*work)
bitmap_zero(power_domains->async_put_domains[1].bits,
POWER_DOMAIN_NUM);
queue_async_put_domains_work(power_domains,
-fetch_and_zero(_work_wakeref));
+fetch_and_zero(_work_wakeref),
+
power_domains->async_put_next_delay);
+   power_domains->async_put_next_delay = 0;
} else {
/*
 * Cancel the work that got queued after this one got dequeued,
 * since here we released the corresponding async-put reference.
 */
-   cancel_delayed_work(_domains->async_put_work);
+   cancel_async_put_work(power_domains, false);
}
 
 out_verify:
@@ -706,19 +720,25 @@ intel_display_power_put_async_work(struct work_struct 
*work)
  * @i915: i915 device instance
  * @domain: power domain to reference
  * @wakeref: wakeref acquired for the reference that is being released
+ * @delay_ms: delay of powering down the power domain
  *
  * This function drops the power domain reference obtained by
  * intel_display_power_get*() and schedules a work to power down the
  * corresponding hardware block if this is the last reference.
+ * The power down is delayed by @delay_ms if this is >= 0, or by a default
+ * 100 ms otherwise.
  */
 void __intel_display_power_put_async(struct drm_i915_private *i915,
 enum intel_display_power_domain domain,
-intel_wakeref_t wakeref)
+intel_wakeref_t wakeref,
+int delay_ms)
 {
struct i915_power_domains *power_domains = >display.power.domains;
struct intel_runtime_pm *rpm = >runtime_pm;
intel_wakeref_t work_wakeref = intel_runtime_pm_get_raw(rpm);
 
+   delay_ms = delay_ms >= 0 ? delay_ms : 100;
+

[Intel-gfx] [PATCH 1/4] drm/i915: Add missing forward declarations/includes to display power headers

2023-06-16 Thread Imre Deak
Add the seq_file struct forward declaration to intel_display_power.h
fixing the build error below. While at it add the rest of missing
forward declarations/includes to the display power header files.

In file included from :
./../drivers/gpu/drm/i915/display/intel_display_power.h:255:70: error: 'struct 
seq_file'
declared inside parameter list will not be visible outside of this definition 
or declaration [-Werror]
  255 | void intel_display_power_debug(struct drm_i915_private *i915, struct 
seq_file *m);
  |  
^~~~

Reported-by: Randy Dunlap 
Closes: 
https://lore.kernel.org/intel-gfx/89adc1ac-25a0-6eb6-4cc9-ab6cc8d49...@infradead.org/
Signed-off-by: Imre Deak 
---
 drivers/gpu/drm/i915/display/intel_display_power.h  | 4 
 drivers/gpu/drm/i915/display/intel_display_power_well.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h 
b/drivers/gpu/drm/i915/display/intel_display_power.h
index be1a87bde0c9d..df38632c62371 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.h
+++ b/drivers/gpu/drm/i915/display/intel_display_power.h
@@ -6,6 +6,9 @@
 #ifndef __INTEL_DISPLAY_POWER_H__
 #define __INTEL_DISPLAY_POWER_H__
 
+#include 
+#include 
+
 #include "intel_wakeref.h"
 
 enum aux_ch;
@@ -16,6 +19,7 @@ enum port;
 struct drm_i915_private;
 struct i915_power_well;
 struct intel_encoder;
+struct seq_file;
 
 /*
  * Keep the pipe, transcoder, port (DDI_LANES,DDI_IO,AUX) domain instances
diff --git a/drivers/gpu/drm/i915/display/intel_display_power_well.h 
b/drivers/gpu/drm/i915/display/intel_display_power_well.h
index e494df379e6c2..1015bba4af01e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power_well.h
+++ b/drivers/gpu/drm/i915/display/intel_display_power_well.h
@@ -12,6 +12,8 @@
 
 struct drm_i915_private;
 struct i915_power_well;
+struct i915_power_well_ops;
+struct intel_encoder;
 
 #define for_each_power_well(__dev_priv, __power_well)  
\
for ((__power_well) = (__dev_priv)->display.power.domains.power_wells;  
\
-- 
2.37.2



Re: [Intel-gfx] [PATCH] drm/i915/perf: Consider OA buffer boundary when zeroing out reports

2023-06-16 Thread Dixit, Ashutosh
On Fri, 16 Jun 2023 10:34:02 -0700, Umesh Nerlige Ramappa wrote:
>
> For reports that are not powers of 2, reports at the end of the OA
> buffer may get split across the buffer boundary. When zeroing out such
> reports, take the split into consideration.
>
> v2: Use OA_BUFFER_SIZE (Ashutosh)
>
> Fixes: 09a36015d9a0 ("drm/i915/perf: Clear out entire reports after reading 
> if not power of 2 size")
> Signed-off-by: Umesh Nerlige Ramappa 
> ---
>  drivers/gpu/drm/i915/i915_perf.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c 
> b/drivers/gpu/drm/i915/i915_perf.c
> index b5491a382bfd..66ab6e1d5c7b 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -867,8 +867,17 @@ static int gen8_append_oa_reports(struct 
> i915_perf_stream *stream,
>   oa_report_id_clear(stream, report32);
>   oa_timestamp_clear(stream, report32);
>   } else {
> + u8 *oa_buf_end = stream->oa_buffer.vaddr +
> +  OA_BUFFER_SIZE;

Above we already have "u8 *oa_buf_base = stream->oa_buffer.vaddr;" so we
could just use that?

> + u32 part = oa_buf_end - (u8 *)report32;

We also have "u8 *report".

In any case:

Reviewed-by: Ashutosh Dixit 

> +
>   /* Zero out the entire report */
> - memset(report32, 0, report_size);
> + if (report_size <= part) {
> + memset(report32, 0, report_size);
> + } else {
> + memset(report32, 0, part);
> + memset(oa_buf_base, 0, report_size - part);
> + }
>   }
>   }
>
> --
> 2.36.1
>


[Intel-gfx] [linux-next:master] BUILD REGRESSION f7efed9f38f886edb450041b82a6f15d663c98f8

2023-06-16 Thread kernel test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
branch HEAD: f7efed9f38f886edb450041b82a6f15d663c98f8  Add linux-next specific 
files for 20230616

Error/Warning reports:

https://lore.kernel.org/oe-kbuild-all/202306100035.vtusnhm4-...@intel.com
https://lore.kernel.org/oe-kbuild-all/20230613.hher4zoo-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202306141719.mjhclsrc-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202306141934.ukmm9bfx-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202306142017.23vmblmg-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202306151506.goheegod-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202306160203.db48f7wr-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202306160811.nv1bmsk4-...@intel.com

Error/Warning: (recently discovered and may have been fixed)

arch/parisc/kernel/pdt.c:65:6: warning: no previous prototype for 
'arch_report_meminfo' [-Wmissing-prototypes]
drivers/block/pktcdvd.c:1371:13: warning: stack frame size (2496) exceeds limit 
(2048) in 'pkt_handle_packets' [-Wframe-larger-than]
drivers/char/mem.c:164:25: error: implicit declaration of function 
'unxlate_dev_mem_ptr'; did you mean 'xlate_dev_mem_ptr'? 
[-Werror=implicit-function-declaration]
drivers/gpu/drm/i915/display/intel_display_power.h:255:70: error: declaration 
of 'struct seq_file' will not be visible outside of this function 
[-Werror,-Wvisibility]
drivers/leds/leds-cht-wcove.c:144:21: warning: no previous prototype for 
'cht_wc_leds_brightness_get' [-Wmissing-prototypes]
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:1036:1: 
warning: the frame size of 1112 bytes is larger than 1024 bytes 
[-Wframe-larger-than=]
drivers/scsi/FlashPoint.c:1712:12: warning: stack frame size (4208) exceeds 
limit (2048) in 'FlashPoint_HandleInterrupt' [-Wframe-larger-than]
fs/ntfs3/super.c:1094:12: warning: stack frame size (2384) exceeds limit (2048) 
in 'ntfs_fill_super' [-Wframe-larger-than]
lib/kunit/executor_test.c:138:4: warning: cast from 'void (*)(const void *)' to 
'kunit_action_t *' (aka 'void (*)(void *)') converts to incompatible function 
type [-Wcast-function-type-strict]
lib/kunit/test.c:775:38: warning: cast from 'void (*)(const void *)' to 
'kunit_action_t *' (aka 'void (*)(void *)') converts to incompatible function 
type [-Wcast-function-type-strict]
security/apparmor/policy_unpack.c:1173: warning: expecting prototype for 
verify_dfa_accept_xindex(). Prototype was for verify_dfa_accept_index() instead

Unverified Error/Warning (likely false positive, please contact us if 
interested):

drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c:98 
mlx5_devcom_register_device() error: uninitialized symbol 'tmp_dev'.
drivers/opp/core.c:2710 dev_pm_opp_xlate_performance_state() warn: variable 
dereferenced before check 'src_table' (see line 2698)
drivers/usb/cdns3/cdns3-starfive.c:23: warning: expecting prototype for 
cdns3(). Prototype was for USB_STRAP_HOST() instead
fs/btrfs/volumes.c:6404 btrfs_map_block() error: we previously assumed 
'mirror_num_ret' could be null (see line 6242)
fs/smb/client/cifsfs.c:982 cifs_smb3_do_mount() warn: possible memory leak of 
'cifs_sb'
fs/smb/client/cifssmb.c:4089 CIFSFindFirst() warn: missing error code? 'rc'
fs/smb/client/cifssmb.c:4216 CIFSFindNext() warn: missing error code? 'rc'
fs/smb/client/connect.c:2775 cifs_match_super() error: 'tlink' dereferencing 
possible ERR_PTR()
fs/smb/client/connect.c:2974 generic_ip_connect() error: we previously assumed 
'socket' could be null (see line 2962)
lib/kunit/test.c:336 __kunit_abort() warn: ignoring unreachable code.
make[2]: *** No rule to make target 'rustdoc'.
{standard input}: Error: local label `"2" (instance number 9 of a fb label)' is 
not defined
{standard input}:1097: Error: pcrel too far

Error/Warning ids grouped by kconfigs:

gcc_recent_errors
|-- arm-randconfig-r046-20230615
|   `-- 
drivers-media-platform-verisilicon-rockchip_vpu981_hw_av1_dec.c:warning:the-frame-size-of-bytes-is-larger-than-bytes
|-- i386-allyesconfig
|   `-- 
drivers-leds-leds-cht-wcove.c:warning:no-previous-prototype-for-cht_wc_leds_brightness_get
|-- i386-randconfig-m021-20230614
|   |-- 
drivers-opp-core.c-dev_pm_opp_xlate_performance_state()-warn:variable-dereferenced-before-check-src_table-(see-line-)
|   |-- 
fs-smb-client-cifsfs.c-cifs_smb3_do_mount()-warn:possible-memory-leak-of-cifs_sb
|   |-- fs-smb-client-cifssmb.c-CIFSFindFirst()-warn:missing-error-code-rc
|   |-- fs-smb-client-cifssmb.c-CIFSFindNext()-warn:missing-error-code-rc
|   |-- 
fs-smb-client-connect.c-cifs_match_super()-error:tlink-dereferencing-possible-ERR_PTR()
|   `-- 
fs-smb-client-connect.c-generic_ip_connect()-error:we-previously-assumed-socket-could-be-null-(see-line-)
|-- microblaze-randconfig-m031-20230614
|   `-- 
drivers-opp-core.c-dev_pm_opp_xlate_performance_state()-warn:variable-dereferenced-before-check-src_table-(see-line-)
|-- mips-randconfig-m04

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Init DDI ports based on port_mask (rev4)

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: Init DDI ports based on port_mask (rev4)
URL   : https://patchwork.freedesktop.org/series/117641/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13278_full -> Patchwork_117641v4_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Participating hosts (7 -> 7)
--

  No changes in participating hosts

Possible new issues
---

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

### IGT changes ###

 Suppressed 

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

  * igt@kms_flip@flip-vs-panning-vs-hang@a-hdmi-a3:
- {shard-dg1}:NOTRUN -> [INCOMPLETE][1]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-dg1-13/igt@kms_flip@flip-vs-panning-vs-h...@a-hdmi-a3.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_barrier_race@remote-request@rcs0:
- shard-glk:  [PASS][2] -> [ABORT][3] ([i915#7461] / [i915#8211])
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-glk1/igt@gem_barrier_race@remote-requ...@rcs0.html
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-glk7/igt@gem_barrier_race@remote-requ...@rcs0.html

  * igt@gem_ctx_exec@basic-nohangcheck:
- shard-rkl:  [PASS][4] -> [FAIL][5] ([i915#6268])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-rkl-7/igt@gem_ctx_e...@basic-nohangcheck.html
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-rkl-1/igt@gem_ctx_e...@basic-nohangcheck.html

  * igt@gem_eio@hibernate:
- shard-tglu: [PASS][6] -> [ABORT][7] ([i915#7975] / [i915#8213] / 
[i915#8398])
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-tglu-2/igt@gem_...@hibernate.html
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-tglu-10/igt@gem_...@hibernate.html

  * igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk:  [PASS][8] -> [FAIL][9] ([i915#2842])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-glk9/igt@gem_exec_fair@basic-pace-sh...@rcs0.html
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-glk1/igt@gem_exec_fair@basic-pace-sh...@rcs0.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-tglu: [PASS][10] -> [FAIL][11] ([i915#3989] / [i915#454])
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-tglu-9/igt@i915_pm...@dc6-dpms.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-tglu-5/igt@i915_pm...@dc6-dpms.html

  * igt@i915_pm_rpm@modeset-non-lpsp-stress:
- shard-rkl:  [PASS][12] -> [SKIP][13] ([i915#1397]) +1 similar 
issue
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-rkl-2/igt@i915_pm_...@modeset-non-lpsp-stress.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-rkl-7/igt@i915_pm_...@modeset-non-lpsp-stress.html

  * igt@i915_suspend@basic-s3-without-i915:
- shard-rkl:  [PASS][14] -> [FAIL][15] ([fdo#103375]) +3 similar 
issues
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-rkl-1/igt@i915_susp...@basic-s3-without-i915.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-rkl-4/igt@i915_susp...@basic-s3-without-i915.html

  * igt@kms_color@deep-color:
- shard-rkl:  NOTRUN -> [SKIP][16] ([i915#3555] / [i915#4579])
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-rkl-6/igt@kms_co...@deep-color.html

  * igt@kms_dither@fb-8bpc-vs-panel-6bpc@pipe-a-hdmi-a-1:
- shard-rkl:  NOTRUN -> [SKIP][17] ([i915#3804] / [i915#4579])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-rkl-7/igt@kms_dither@fb-8bpc-vs-panel-6...@pipe-a-hdmi-a-1.html

  * igt@kms_fbcon_fbt@fbc-suspend:
- shard-apl:  [PASS][18] -> [FAIL][19] ([i915#4767])
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-apl3/igt@kms_fbcon_...@fbc-suspend.html
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-apl1/igt@kms_fbcon_...@fbc-suspend.html

  * igt@kms_hdr@invalid-hdr:
- shard-rkl:  NOTRUN -> [SKIP][20] ([i915#4579] / [i915#6953] / 
[i915#8228])
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-rkl-7/igt@kms_...@invalid-hdr.html

  * igt@kms_plane_scaling@intel-max-src-size@pipe-a-hdmi-a-2:
- shard-rkl:  NOTRUN -> [FAIL][21] ([i915#8292])
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/shard-rkl-6/igt@kms_plane_scaling@intel-max-src-s...@pipe-a-hdmi-a-2.html

  * 

[Intel-gfx] [PATCH] drm/i915/perf: Consider OA buffer boundary when zeroing out reports

2023-06-16 Thread Umesh Nerlige Ramappa
For reports that are not powers of 2, reports at the end of the OA
buffer may get split across the buffer boundary. When zeroing out such
reports, take the split into consideration.

v2: Use OA_BUFFER_SIZE (Ashutosh)

Fixes: 09a36015d9a0 ("drm/i915/perf: Clear out entire reports after reading if 
not power of 2 size")
Signed-off-by: Umesh Nerlige Ramappa 
---
 drivers/gpu/drm/i915/i915_perf.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index b5491a382bfd..66ab6e1d5c7b 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -867,8 +867,17 @@ static int gen8_append_oa_reports(struct i915_perf_stream 
*stream,
oa_report_id_clear(stream, report32);
oa_timestamp_clear(stream, report32);
} else {
+   u8 *oa_buf_end = stream->oa_buffer.vaddr +
+OA_BUFFER_SIZE;
+   u32 part = oa_buf_end - (u8 *)report32;
+
/* Zero out the entire report */
-   memset(report32, 0, report_size);
+   if (report_size <= part) {
+   memset(report32, 0, report_size);
+   } else {
+   memset(report32, 0, part);
+   memset(oa_buf_base, 0, report_size - part);
+   }
}
}
 
-- 
2.36.1



[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: make i915_drm_client_fdinfo() reference conditional again
URL   : https://patchwork.freedesktop.org/series/119441/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13278_full -> Patchwork_119441v1_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Participating hosts (7 -> 7)
--

  No changes in participating hosts

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@gem_ctx_exec@basic-nohangcheck:
- shard-rkl:  [PASS][1] -> [FAIL][2] ([i915#6268])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-rkl-7/igt@gem_ctx_e...@basic-nohangcheck.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-rkl-1/igt@gem_ctx_e...@basic-nohangcheck.html
- shard-tglu: [PASS][3] -> [FAIL][4] ([i915#6268])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-tglu-7/igt@gem_ctx_e...@basic-nohangcheck.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-tglu-10/igt@gem_ctx_e...@basic-nohangcheck.html

  * igt@gem_exec_endless@dispatch@rcs0:
- shard-tglu: [PASS][5] -> [TIMEOUT][6] ([i915#3778] / [i915#7392] 
/ [i915#7921])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-tglu-5/igt@gem_exec_endless@dispa...@rcs0.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-tglu-9/igt@gem_exec_endless@dispa...@rcs0.html

  * igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk:  [PASS][7] -> [FAIL][8] ([i915#2842])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-glk9/igt@gem_exec_fair@basic-pace-sh...@rcs0.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-glk8/igt@gem_exec_fair@basic-pace-sh...@rcs0.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-tglu: [PASS][9] -> [FAIL][10] ([i915#3989] / [i915#454])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-tglu-9/igt@i915_pm...@dc6-dpms.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-tglu-3/igt@i915_pm...@dc6-dpms.html

  * igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-vga:
- shard-snb:  NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#4579]) +11 
similar issues
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-snb4/igt@i915_pm_lpsp@kms-l...@kms-lpsp-vga.html

  * igt@i915_pm_rpm@modeset-lpsp:
- shard-rkl:  [PASS][12] -> [SKIP][13] ([i915#1397])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-rkl-7/igt@i915_pm_...@modeset-lpsp.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-rkl-6/igt@i915_pm_...@modeset-lpsp.html

  * igt@i915_suspend@basic-s3-without-i915:
- shard-rkl:  [PASS][14] -> [FAIL][15] ([fdo#103375]) +6 similar 
issues
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-rkl-1/igt@i915_susp...@basic-s3-without-i915.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-rkl-6/igt@i915_susp...@basic-s3-without-i915.html

  * 
igt@kms_async_flips@async-flip-with-page-flip-events@pipe-b-hdmi-a-1-y-rc_ccs:
- shard-rkl:  NOTRUN -> [SKIP][16] ([i915#8502]) +3 similar issues
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-rkl-7/igt@kms_async_flips@async-flip-with-page-flip-events@pipe-b-hdmi-a-1-y-rc_ccs.html

  * igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs:
- shard-apl:  NOTRUN -> [SKIP][17] ([fdo#109271] / [i915#3886])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-apl3/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs.html
- shard-glk:  NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#3886])
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-glk7/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-glk:  NOTRUN -> [FAIL][19] ([i915#2346])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-glk7/igt@kms_cursor_leg...@flip-vs-cursor-atomic-transitions.html
- shard-apl:  NOTRUN -> [FAIL][20] ([i915#2346])
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-apl3/igt@kms_cursor_leg...@flip-vs-cursor-atomic-transitions.html

  * igt@kms_flip@flip-vs-suspend@a-dp1:
- shard-apl:  [PASS][21] -> [ABORT][22] ([i915#180])
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/shard-apl2/igt@kms_flip@flip-vs-susp...@a-dp1.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/shard-apl3/igt@kms_flip@flip-vs-susp...@a-dp1.html

  * 

Re: [Intel-gfx] [PATCH v1] drm/i915/gsc: Fix intel_gsc_uc_fw_proxy_init_done with directed wakerefs

2023-06-16 Thread Ceraolo Spurio, Daniele




On 6/15/2023 2:19 PM, Alan Previn wrote:

intel_gsc_uc_fw_proxy_init_done is used by a few code paths
and usages. However, certain paths need a wakeref while others
can't take a wakeref such as from the runtime_pm_resume callstack.

Add a param into this helper to allow callers to direct whether
to take the wakeref or not. This resolves the following bug:

INFO: task sh:2607 blocked for more than 61 seconds.
Not tainted 6.3.0-pxp-gsc-final-jun14+ #297
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:sh  state:D stack:13016 pid:2607  ppid:2602   
flags:0x4000
Call Trace:
   
   __schedule+0x47b/0xe10
   schedule+0x58/0xd0
   rpm_resume+0x1cc/0x800
   ? __pfx_autoremove_wake_function+0x10/0x10
   __pm_runtime_resume+0x42/0x80
   __intel_runtime_pm_get+0x19/0x80 [i915]
   gsc_uc_get_fw_status+0x10/0x50 [i915]
   intel_gsc_uc_fw_init_done+0x9/0x20 [i915]
   intel_gsc_uc_load_start+0x5b/0x130 [i915]
   __uc_resume+0xa5/0x280 [i915]
   intel_runtime_resume+0xd4/0x250 [i915]
   ? __pfx_pci_pm_runtime_resume+0x10/0x10
__rpm_callback+0x3c/0x160

Fixes: 8c33c3755b75 ("drm/i915/gsc: take a wakeref for the proxy-init-completion 
check")
Signed-off-by: Alan Previn 


Reviewed-by: Daniele Ceraolo Spurio 

I'm going to send a trybot of this patch with the FW definition patch, 
just to make sure there aren't any other issues that kick in once the FW 
is defined and the code starts being executed, and merge if the results 
are ok.


Daniele


---
  drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c  | 17 +++--
  drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h  |  2 +-
  drivers/gpu/drm/i915/gt/uc/intel_gsc_uc.c  |  2 +-
  drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.c |  2 +-
  4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c 
b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c
index 856de9af1e3a..ab1a456f833d 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c
@@ -22,27 +22,32 @@ static bool gsc_is_in_reset(struct intel_uncore *uncore)
HECI1_FWSTS1_CURRENT_STATE_RESET;
  }
  
-static u32 gsc_uc_get_fw_status(struct intel_uncore *uncore)

+static u32 gsc_uc_get_fw_status(struct intel_uncore *uncore, bool 
needs_wakeref)
  {
intel_wakeref_t wakeref;
u32 fw_status = 0;
  
-	with_intel_runtime_pm(uncore->rpm, wakeref)

-   fw_status = intel_uncore_read(uncore, 
HECI_FWSTS(MTL_GSC_HECI1_BASE, 1));
+   if (needs_wakeref)
+   wakeref = intel_runtime_pm_get(uncore->rpm);
  
+	fw_status = intel_uncore_read(uncore, HECI_FWSTS(MTL_GSC_HECI1_BASE, 1));

+
+   if (needs_wakeref)
+   intel_runtime_pm_put(uncore->rpm, wakeref);
return fw_status;
  }
  
-bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc)

+bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc, bool 
needs_wakeref)
  {
return REG_FIELD_GET(HECI1_FWSTS1_CURRENT_STATE,
-gsc_uc_get_fw_status(gsc_uc_to_gt(gsc)->uncore)) ==
+gsc_uc_get_fw_status(gsc_uc_to_gt(gsc)->uncore,
+ needs_wakeref)) ==
   HECI1_FWSTS1_PROXY_STATE_NORMAL;
  }
  
  bool intel_gsc_uc_fw_init_done(struct intel_gsc_uc *gsc)

  {
-   return gsc_uc_get_fw_status(gsc_uc_to_gt(gsc)->uncore) &
+   return gsc_uc_get_fw_status(gsc_uc_to_gt(gsc)->uncore, false) &
   HECI1_FWSTS1_INIT_COMPLETE;
  }
  
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h

index 8d7b9e4f1ffc..ad2167ce9137 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h
+++ b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h
@@ -15,6 +15,6 @@ struct intel_uncore;
  int intel_gsc_fw_get_binary_info(struct intel_uc_fw *gsc_fw, const void 
*data, size_t size);
  int intel_gsc_uc_fw_upload(struct intel_gsc_uc *gsc);
  bool intel_gsc_uc_fw_init_done(struct intel_gsc_uc *gsc);
-bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc);
+bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc, bool 
needs_wakeref);
  
  #endif

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_gsc_uc.c 
b/drivers/gpu/drm/i915/gt/uc/intel_gsc_uc.c
index 85d90f0a15e3..75a3a0790ef3 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_gsc_uc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_gsc_uc.c
@@ -72,7 +72,7 @@ static void gsc_work(struct work_struct *work)
 * complete the request handling cleanly, so we need to 
check the
 * status register to check if the proxy init was 
actually successful
 */
-   if (intel_gsc_uc_fw_proxy_init_done(gsc)) {
+   if (intel_gsc_uc_fw_proxy_init_done(gsc, false)) {
drm_dbg(>i915->drm, "GSC Proxy 

[Intel-gfx] [PATCH v3 i-g-t] tests/i915_pm_freq_api: Add a suspend subtest

2023-06-16 Thread Vinay Belgaumkar
Verify that SLPC API works as expected after a suspend. Added
another subtest that does multiple GT resets and checks freq api
works as expected after each one.

We now check requested frequency instead of soft min/max after a
reset or suspend. That ensures the soft limits got applied
correctly at init. Also, disable efficient freq before starting the
test which allows current freq to be consistent with SLPC min freq.

v2: Restore freq in exit handler (Ashutosh)
v3: Free the allocated stash arrays

Signed-off-by: Vinay Belgaumkar 
---
 tests/i915/i915_pm_freq_api.c | 92 +++
 1 file changed, 71 insertions(+), 21 deletions(-)

diff --git a/tests/i915/i915_pm_freq_api.c b/tests/i915/i915_pm_freq_api.c
index 9005cd220..522abee35 100644
--- a/tests/i915/i915_pm_freq_api.c
+++ b/tests/i915/i915_pm_freq_api.c
@@ -18,6 +18,12 @@
  *
  * SUBTEST: freq-reset
  * Description: Test basic freq API works after a reset
+ *
+ * SUBTEST: freq-reset-multiple
+ * Description: Test basic freq API works after multiple resets
+ *
+ * SUBTEST: freq-suspend
+ * Description: Test basic freq API works after a runtime suspend
  */
 
 IGT_TEST_DESCRIPTION("Test SLPC freq API");
@@ -49,7 +55,6 @@ static void test_freq_basic_api(int dirfd, int gt)
rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
rp0 = get_freq(dirfd, RPS_RP0_FREQ_MHZ);
rpe = get_freq(dirfd, RPS_RP1_FREQ_MHZ);
-   igt_info("System min freq: %dMHz; max freq: %dMHz\n", rpn, rp0);
 
/*
 * Negative bound tests
@@ -79,31 +84,66 @@ static void test_freq_basic_api(int dirfd, int gt)
 
 }
 
-static void test_reset(int i915, int dirfd, int gt)
+static void test_reset(int i915, int dirfd, int gt, int count)
 {
uint32_t rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
int fd;
 
+   for (int i = 0; i < count; i++) {
+   igt_assert_f(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0,
+"Failed after %d good cycles\n", i);
+   igt_assert_f(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0,
+"Failed after %d good cycles\n", i);
+   usleep(ACT_FREQ_LATENCY_US);
+   igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
+"Failed after %d good cycles\n", i);
+
+   /* Manually trigger a GT reset */
+   fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY);
+   igt_require(fd >= 0);
+   igt_ignore_warn(write(fd, "1\n", 2));
+
+   igt_assert_f(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn,
+"Failed after %d good cycles\n", i);
+   }
+   close(fd);
+}
+
+static void test_suspend(int i915, int dirfd, int gt)
+{
+   uint32_t rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
+
igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
usleep(ACT_FREQ_LATENCY_US);
-   igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
+   igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
 
-   /* Manually trigger a GT reset */
-   fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY);
-   igt_require(fd >= 0);
-   igt_ignore_warn(write(fd, "1\n", 2));
-   close(fd);
+   /* Manually trigger a suspend */
+   igt_system_suspend_autoresume(SUSPEND_STATE_S3,
+ SUSPEND_TEST_NONE);
 
-   igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
-   igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpn);
+   igt_assert(get_freq(dirfd, RPS_CUR_FREQ_MHZ) == rpn);
 }
 
-igt_main
+int i915 = -1;
+uint32_t *stash_min, *stash_max;
+
+static void restore_sysfs_freq(int sig)
 {
-   int i915 = -1;
-   uint32_t *stash_min, *stash_max;
+   int dirfd, gt;
+   /* Restore frequencies */
+   for_each_sysfs_gt_dirfd(i915, dirfd, gt) {
+   igt_pm_ignore_slpc_efficient_freq(i915, dirfd, false);
+   igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, stash_max[gt]) > 
0);
+   igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, stash_min[gt]) > 
0);
+   }
+   free(stash_min);
+   free(stash_max);
+   close(i915);
+}
 
+igt_main
+{
igt_fixture {
int num_gts, dirfd, gt;
 
@@ -122,7 +162,9 @@ igt_main
for_each_sysfs_gt_dirfd(i915, dirfd, gt) {
stash_min[gt] = get_freq(dirfd, RPS_MIN_FREQ_MHZ);
stash_max[gt] = get_freq(dirfd, RPS_MAX_FREQ_MHZ);
+   igt_pm_ignore_slpc_efficient_freq(i915, dirfd, true);
}
+   igt_install_exit_handler(restore_sysfs_freq);
}
 
igt_describe("Test basic API for controlling min/max GT frequency");
@@ -140,16 +182,24 @@ igt_main
 
for_each_sysfs_gt_dirfd(i915, dirfd, gt)
igt_dynamic_f("gt%u", gt)
-   

Re: [Intel-gfx] [PATCH v7 2/8] PCI/VGA: Deal only with VGA class devices

2023-06-16 Thread Sui Jingfeng

Hi,

On 2023/6/16 22:34, Alex Deucher wrote:

On Fri, Jun 16, 2023 at 10:22 AM Sui Jingfeng  wrote:


On 2023/6/16 21:41, Alex Deucher wrote:

On Fri, Jun 16, 2023 at 3:11 AM Sui Jingfeng  wrote:

Hi,

On 2023/6/16 05:11, Alex Deucher wrote:

On Wed, Jun 14, 2023 at 6:50 AM Sui Jingfeng  wrote:

Hi,

On 2023/6/13 11:01, Sui Jingfeng wrote:

From: Sui Jingfeng 

Deal only with the VGA devcie(pdev->class == 0x0300), so replace the
pci_get_subsys() function with pci_get_class(). Filter the non-PCI display
device(pdev->class != 0x0300) out. There no need to process the non-display
PCI device.

Cc: Bjorn Helgaas 
Signed-off-by: Sui Jingfeng 
---
 drivers/pci/vgaarb.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index c1bc6c983932..22a505e877dc 100644
--- a/drivers/pci/vgaarb.c
+++ b/drivers/pci/vgaarb.c
@@ -754,10 +754,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev 
*pdev)
 struct pci_dev *bridge;
 u16 cmd;

- /* Only deal with VGA class devices */
- if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
- return false;
-

Hi, here is probably a bug fixing.

For an example, nvidia render only GPU typically has 0x0380.

as its PCI class number, but render only GPU should not participate in
the arbitration.

As it shouldn't snoop the legacy fixed VGA address.

It(render only GPU) can not display anything.


But 0x0380 >> 8 = 0x03, the filter  failed.



 /* Allocate structure */
 vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL);
 if (vgadev == NULL) {
@@ -1500,7 +1496,9 @@ static int pci_notify(struct notifier_block *nb, unsigned 
long action,
 struct pci_dev *pdev = to_pci_dev(dev);
 bool notify = false;

- vgaarb_dbg(dev, "%s\n", __func__);
+ /* Only deal with VGA class devices */
+ if (pdev->class != PCI_CLASS_DISPLAY_VGA << 8)
+ return 0;

So here we only care 0x0300, my initial intent is to make an optimization,

nowadays sane display graphic card should all has 0x0300 as its PCI
class number, is this complete right?

```

#define PCI_BASE_CLASS_DISPLAY0x03
#define PCI_CLASS_DISPLAY_VGA0x0300
#define PCI_CLASS_DISPLAY_XGA0x0301
#define PCI_CLASS_DISPLAY_3D0x0302
#define PCI_CLASS_DISPLAY_OTHER0x0380

```

Any ideas ?

I'm not quite sure what you are asking about here.

To be honest, I'm worried about the PCI devices which has a

PCI_CLASS_DISPLAY_XGA as its PCI class number.

As those devices are very uncommon in the real world.


$ find . -name "*.c" -type f | xargs grep "PCI_CLASS_DISPLAY_XGA"


Grep the "PCI_CLASS_DISPLAY_XGA" in the linux kernel tree got ZERO,

there no code reference this macro. So I think it seems safe to ignore
the XGA ?


PCI_CLASS_DISPLAY_3D and PCI_CLASS_DISPLAY_OTHER are used to annotate
the render-only GPU.

And render-only GPU can't decode the fixed VGA address space, it is safe
to ignore them.



For vga_arb, we
only care about VGA class devices since those should be on the only
ones that might have VGA routed to them.
However, as VGA gets deprecated,

We need the vgaarb for a system with multiple video card.

Not only because some Legacy VGA devices implemented

on PCI will typically have the same "hard-decoded" addresses;

But also these video card need to participate in the arbitration,

determine the default boot device.

But couldn't the boot device be determined via what whatever resources
were used by the pre-OS console?

I don't know what you are refer to by saying  pre-OS console, UEFI
SHELL,  UEFI GOP  or something like that.


Right.  Before the OS loads the platform firmware generally sets up
something for display.  That could be GOP or vesa or some other
platform specific protocol.


If you are referring to the framebuffer driver which light up the screen
before the Linux kernel is loaded .


Then, what you have said is true,  the boot device is determined by the
pre-OS console.

But the problem is how does the Linux kernel(vgaarb) could know which
one is the default boot device

on a multiple GPU machine.  Relaying on the firmware fb's address and
size is what the mechanism

we already in using.

Right.  It shouldn't need to depend on vgaarb.




   I feel like that should be separate from vgaarb.

Emm, this really deserved another patch, please ?


   vgaarb should handle PCI VGA routing and some other
mechanism should be used to determine what device provided the pre-OS
console.

If the new mechanism need the firmware changed, then this probably break
the old machine.

Also, this probably will get all arch involved. to get the new mechanism
supported.

The testing pressure and review power needed is quite large.

drm/amdgpu and drm/radeon already being used on X86, ARM64,  Mips and
more arch...

The reviewing process will became quite difficult then.

vgaarb is really what we already in use, and being 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Init DDI ports based on port_mask (rev4)

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: Init DDI ports based on port_mask (rev4)
URL   : https://patchwork.freedesktop.org/series/117641/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13278 -> Patchwork_117641v4


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (42 -> 40)
--

  Missing(2): bat-mtlp-8 fi-snb-2520m 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@i915_selftest@live@workarounds:
- bat-mtlp-6: [PASS][1] -> [DMESG-FAIL][2] ([i915#6763])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-mtlp-6/igt@i915_selftest@l...@workarounds.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-mtlp-6/igt@i915_selftest@l...@workarounds.html

  * igt@i915_suspend@basic-s2idle-without-i915:
- bat-rpls-2: NOTRUN -> [ABORT][3] ([i915#6687] / [i915#8668])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-rpls-2/igt@i915_susp...@basic-s2idle-without-i915.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-dg2-11: NOTRUN -> [SKIP][4] ([i915#7828])
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-dg2-11/igt@kms_chamelium_...@common-hpd-after-suspend.html

  
 Possible fixes 

  * igt@i915_selftest@live@gt_lrc:
- bat-dg2-11: [INCOMPLETE][5] ([i915#7609] / [i915#7913]) -> 
[PASS][6]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html

  * igt@i915_selftest@live@reset:
- bat-rpls-2: [ABORT][7] ([i915#4983] / [i915#7461] / [i915#7913] / 
[i915#8347]) -> [PASS][8]
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-rpls-2/igt@i915_selftest@l...@reset.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-rpls-2/igt@i915_selftest@l...@reset.html

  * igt@i915_selftest@live@slpc:
- bat-rpls-1: [DMESG-WARN][9] ([i915#6367]) -> [PASS][10]
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-rpls-1/igt@i915_selftest@l...@slpc.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-rpls-1/igt@i915_selftest@l...@slpc.html

  * igt@i915_selftest@live@workarounds:
- bat-rpls-2: [DMESG-FAIL][11] ([i915#6763] / [i915#7913]) -> 
[PASS][12]
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-rpls-2/igt@i915_selftest@l...@workarounds.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-rpls-2/igt@i915_selftest@l...@workarounds.html

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
- bat-dg2-8:  [FAIL][13] ([i915#7932]) -> [PASS][14] +1 similar 
issue
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-seque...@pipe-d-dp-1.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-seque...@pipe-d-dp-1.html

  
 Warnings 

  * igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-a-edp-1:
- bat-adlp-6: [ABORT][15] ([i915#7977]) -> [ABORT][16] ([i915#7977] 
/ [i915#8434])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-adlp-6/igt@kms_pipe_crc_basic@read-crc-frame-seque...@pipe-a-edp-1.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_117641v4/bat-adlp-6/igt@kms_pipe_crc_basic@read-crc-frame-seque...@pipe-a-edp-1.html

  
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
  [i915#6763]: https://gitlab.freedesktop.org/drm/intel/issues/6763
  [i915#7461]: https://gitlab.freedesktop.org/drm/intel/issues/7461
  [i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
  [i915#7977]: https://gitlab.freedesktop.org/drm/intel/issues/7977
  [i915#8347]: https://gitlab.freedesktop.org/drm/intel/issues/8347
  [i915#8434]: https://gitlab.freedesktop.org/drm/intel/issues/8434
  [i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668


Build changes
-

  * Linux: CI_DRM_13278 -> Patchwork_117641v4

  CI-20190529: 20190529
  CI_DRM_13278: 3c942541e24c0aaab070d498c57647e7b4e9aa6e @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_7334: 

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Init DDI ports based on port_mask (rev4)

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: Init DDI ports based on port_mask (rev4)
URL   : https://patchwork.freedesktop.org/series/117641/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.




[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Init DDI ports based on port_mask (rev4)

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: Init DDI ports based on port_mask (rev4)
URL   : https://patchwork.freedesktop.org/series/117641/
State : warning

== Summary ==

Error: dim checkpatch failed
7f76f42ce69c drm/i915: Remove bogus DDI-F from hsw/bdw output init
701f1f810f87 drm/i915: Introduce device info port_mask
-:105: WARNING:LONG_LINE_COMMENT: line length of 109 exceeds 100 columns
#105: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:319:
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C) | 
BIT(PORT_D), /* SDVO/HDMI/DP B/C, DP D */

-:112: WARNING:LONG_LINE_COMMENT: line length of 109 exceeds 100 columns
#112: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:326:
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C) | 
BIT(PORT_D), /* SDVO/HDMI/DP B/C, DP D */

-:122: WARNING:LONG_LINE_COMMENT: line length of 133 exceeds 100 columns
#122: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:340:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D) /* DP A, SDVO/HDMI/DP B, HDMI/DP C/D */

-:130: WARNING:LONG_LINE_COMMENT: line length of 134 exceeds 100 columns
#130: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:362:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D), /* DP A, SDVO/HDMI/DP B, HDMI/DP C/D */

-:138: WARNING:LONG_LINE_COMMENT: line length of 134 exceeds 100 columns
#138: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:376:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D), /* DP A, SDVO/HDMI/DP B, HDMI/DP C/D */

-:154: WARNING:LONG_LINE: line length of 108 exceeds 100 columns
#154: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:409:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D) | BIT(PORT_E),

-:162: WARNING:LONG_LINE: line length of 108 exceeds 100 columns
#162: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:427:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D) | BIT(PORT_E),

-:178: WARNING:LONG_LINE: line length of 108 exceeds 100 columns
#178: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:467:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D) | BIT(PORT_E),

-:279: WARNING:LONG_LINE: line length of 108 exceeds 100 columns
#279: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:553:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D) | BIT(PORT_E),

-:299: WARNING:LONG_LINE: line length of 110 exceeds 100 columns
#299: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:613:
+   BIT(PORT_TC1) | BIT(PORT_TC2) | BIT(PORT_TC3) | BIT(PORT_TC4) | 
BIT(PORT_TC5) | BIT(PORT_TC6),

-:341: WARNING:LONG_LINE: line length of 101 exceeds 100 columns
#341: FILE: drivers/gpu/drm/i915/display/intel_display_device.c:708:
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D_XELPD) |

total: 0 errors, 11 warnings, 0 checks, 342 lines checked
8a3e8bd3d9ba drm/i915: Assert that device info bitmasks have enough bits
403ac3a17be2 drm/i915: Assert that the port being initialized is valid
21b5e6d1a27a drm/i915: Beef up SDVO/HDMI port checks
5fe2c6ee6495 drm/i915: Init DDI outputs based on port_mask on skl+
d1c88773301e drm/i915: Convert HSW/BDW to use port_mask for DDI probe




Re: [Intel-gfx] [PATCH v7 2/8] PCI/VGA: Deal only with VGA class devices

2023-06-16 Thread Alex Deucher
On Fri, Jun 16, 2023 at 10:22 AM Sui Jingfeng  wrote:
>
>
> On 2023/6/16 21:41, Alex Deucher wrote:
> > On Fri, Jun 16, 2023 at 3:11 AM Sui Jingfeng  
> > wrote:
> >> Hi,
> >>
> >> On 2023/6/16 05:11, Alex Deucher wrote:
> >>> On Wed, Jun 14, 2023 at 6:50 AM Sui Jingfeng  
> >>> wrote:
>  Hi,
> 
>  On 2023/6/13 11:01, Sui Jingfeng wrote:
> > From: Sui Jingfeng 
> >
> > Deal only with the VGA devcie(pdev->class == 0x0300), so replace the
> > pci_get_subsys() function with pci_get_class(). Filter the non-PCI 
> > display
> > device(pdev->class != 0x0300) out. There no need to process the 
> > non-display
> > PCI device.
> >
> > Cc: Bjorn Helgaas 
> > Signed-off-by: Sui Jingfeng 
> > ---
> > drivers/pci/vgaarb.c | 22 --
> > 1 file changed, 12 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
> > index c1bc6c983932..22a505e877dc 100644
> > --- a/drivers/pci/vgaarb.c
> > +++ b/drivers/pci/vgaarb.c
> > @@ -754,10 +754,6 @@ static bool vga_arbiter_add_pci_device(struct 
> > pci_dev *pdev)
> > struct pci_dev *bridge;
> > u16 cmd;
> >
> > - /* Only deal with VGA class devices */
> > - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
> > - return false;
> > -
>  Hi, here is probably a bug fixing.
> 
>  For an example, nvidia render only GPU typically has 0x0380.
> 
>  as its PCI class number, but render only GPU should not participate in
>  the arbitration.
> 
>  As it shouldn't snoop the legacy fixed VGA address.
> 
>  It(render only GPU) can not display anything.
> 
> 
>  But 0x0380 >> 8 = 0x03, the filter  failed.
> 
> 
> > /* Allocate structure */
> > vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL);
> > if (vgadev == NULL) {
> > @@ -1500,7 +1496,9 @@ static int pci_notify(struct notifier_block *nb, 
> > unsigned long action,
> > struct pci_dev *pdev = to_pci_dev(dev);
> > bool notify = false;
> >
> > - vgaarb_dbg(dev, "%s\n", __func__);
> > + /* Only deal with VGA class devices */
> > + if (pdev->class != PCI_CLASS_DISPLAY_VGA << 8)
> > + return 0;
>  So here we only care 0x0300, my initial intent is to make an 
>  optimization,
> 
>  nowadays sane display graphic card should all has 0x0300 as its PCI
>  class number, is this complete right?
> 
>  ```
> 
>  #define PCI_BASE_CLASS_DISPLAY0x03
>  #define PCI_CLASS_DISPLAY_VGA0x0300
>  #define PCI_CLASS_DISPLAY_XGA0x0301
>  #define PCI_CLASS_DISPLAY_3D0x0302
>  #define PCI_CLASS_DISPLAY_OTHER0x0380
> 
>  ```
> 
>  Any ideas ?
> >>> I'm not quite sure what you are asking about here.
> >> To be honest, I'm worried about the PCI devices which has a
> >>
> >> PCI_CLASS_DISPLAY_XGA as its PCI class number.
> >>
> >> As those devices are very uncommon in the real world.
> >>
> >>
> >> $ find . -name "*.c" -type f | xargs grep "PCI_CLASS_DISPLAY_XGA"
> >>
> >>
> >> Grep the "PCI_CLASS_DISPLAY_XGA" in the linux kernel tree got ZERO,
> >>
> >> there no code reference this macro. So I think it seems safe to ignore
> >> the XGA ?
> >>
> >>
> >> PCI_CLASS_DISPLAY_3D and PCI_CLASS_DISPLAY_OTHER are used to annotate
> >> the render-only GPU.
> >>
> >> And render-only GPU can't decode the fixed VGA address space, it is safe
> >> to ignore them.
> >>
> >>
> >>>For vga_arb, we
> >>> only care about VGA class devices since those should be on the only
> >>> ones that might have VGA routed to them.
> >>>However, as VGA gets deprecated,
> >> We need the vgaarb for a system with multiple video card.
> >>
> >> Not only because some Legacy VGA devices implemented
> >>
> >> on PCI will typically have the same "hard-decoded" addresses;
> >>
> >> But also these video card need to participate in the arbitration,
> >>
> >> determine the default boot device.
> > But couldn't the boot device be determined via what whatever resources
> > were used by the pre-OS console?
>
> I don't know what you are refer to by saying  pre-OS console, UEFI
> SHELL,  UEFI GOP  or something like that.
>

Right.  Before the OS loads the platform firmware generally sets up
something for display.  That could be GOP or vesa or some other
platform specific protocol.

> If you are referring to the framebuffer driver which light up the screen
> before the Linux kernel is loaded .
>
>
> Then, what you have said is true,  the boot device is determined by the
> pre-OS console.
>
> But the problem is how does the Linux kernel(vgaarb) could know which
> one is the default boot device
>
> on a multiple GPU machine.  Relaying on the firmware fb's address and
> size is what the mechanism
>
> we already in 

Re: [Intel-gfx] [PATCH v7 2/8] PCI/VGA: Deal only with VGA class devices

2023-06-16 Thread Sui Jingfeng



On 2023/6/16 21:41, Alex Deucher wrote:

On Fri, Jun 16, 2023 at 3:11 AM Sui Jingfeng  wrote:

Hi,

On 2023/6/16 05:11, Alex Deucher wrote:

On Wed, Jun 14, 2023 at 6:50 AM Sui Jingfeng  wrote:

Hi,

On 2023/6/13 11:01, Sui Jingfeng wrote:

From: Sui Jingfeng 

Deal only with the VGA devcie(pdev->class == 0x0300), so replace the
pci_get_subsys() function with pci_get_class(). Filter the non-PCI display
device(pdev->class != 0x0300) out. There no need to process the non-display
PCI device.

Cc: Bjorn Helgaas 
Signed-off-by: Sui Jingfeng 
---
drivers/pci/vgaarb.c | 22 --
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index c1bc6c983932..22a505e877dc 100644
--- a/drivers/pci/vgaarb.c
+++ b/drivers/pci/vgaarb.c
@@ -754,10 +754,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev 
*pdev)
struct pci_dev *bridge;
u16 cmd;

- /* Only deal with VGA class devices */
- if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
- return false;
-

Hi, here is probably a bug fixing.

For an example, nvidia render only GPU typically has 0x0380.

as its PCI class number, but render only GPU should not participate in
the arbitration.

As it shouldn't snoop the legacy fixed VGA address.

It(render only GPU) can not display anything.


But 0x0380 >> 8 = 0x03, the filter  failed.



/* Allocate structure */
vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL);
if (vgadev == NULL) {
@@ -1500,7 +1496,9 @@ static int pci_notify(struct notifier_block *nb, unsigned 
long action,
struct pci_dev *pdev = to_pci_dev(dev);
bool notify = false;

- vgaarb_dbg(dev, "%s\n", __func__);
+ /* Only deal with VGA class devices */
+ if (pdev->class != PCI_CLASS_DISPLAY_VGA << 8)
+ return 0;

So here we only care 0x0300, my initial intent is to make an optimization,

nowadays sane display graphic card should all has 0x0300 as its PCI
class number, is this complete right?

```

#define PCI_BASE_CLASS_DISPLAY0x03
#define PCI_CLASS_DISPLAY_VGA0x0300
#define PCI_CLASS_DISPLAY_XGA0x0301
#define PCI_CLASS_DISPLAY_3D0x0302
#define PCI_CLASS_DISPLAY_OTHER0x0380

```

Any ideas ?

I'm not quite sure what you are asking about here.

To be honest, I'm worried about the PCI devices which has a

PCI_CLASS_DISPLAY_XGA as its PCI class number.

As those devices are very uncommon in the real world.


$ find . -name "*.c" -type f | xargs grep "PCI_CLASS_DISPLAY_XGA"


Grep the "PCI_CLASS_DISPLAY_XGA" in the linux kernel tree got ZERO,

there no code reference this macro. So I think it seems safe to ignore
the XGA ?


PCI_CLASS_DISPLAY_3D and PCI_CLASS_DISPLAY_OTHER are used to annotate
the render-only GPU.

And render-only GPU can't decode the fixed VGA address space, it is safe
to ignore them.



   For vga_arb, we
only care about VGA class devices since those should be on the only
ones that might have VGA routed to them.
   However, as VGA gets deprecated,

We need the vgaarb for a system with multiple video card.

Not only because some Legacy VGA devices implemented

on PCI will typically have the same "hard-decoded" addresses;

But also these video card need to participate in the arbitration,

determine the default boot device.

But couldn't the boot device be determined via what whatever resources
were used by the pre-OS console?


I don't know what you are refer to by saying  pre-OS console, UEFI 
SHELL,  UEFI GOP  or something like that.


If you are referring to the framebuffer driver which light up the screen 
before the Linux kernel is loaded .



Then, what you have said is true,  the boot device is determined by the 
pre-OS console.


But the problem is how does the Linux kernel(vgaarb) could know which 
one is the default boot device


on a multiple GPU machine.  Relaying on the firmware fb's address and 
size is what the mechanism


we already in using.



  I feel like that should be separate from vgaarb.


Emm, this really deserved another patch, please ?


  vgaarb should handle PCI VGA routing and some other
mechanism should be used to determine what device provided the pre-OS
console.


If the new mechanism need the firmware changed, then this probably break 
the old machine.


Also, this probably will get all arch involved. to get the new mechanism 
supported.


The testing pressure and review power needed is quite large.

drm/amdgpu and drm/radeon already being used on X86, ARM64,  Mips and 
more arch...


The reviewing process will became quite difficult then.

vgaarb is really what we already in use, and being used more than ten 
years ...




Alex





Nowadays, the 'VGA devices' here is stand for the Graphics card

which is capable of display something on the screen.

We still need vgaarb to select the default boot device.



you'll have more non VGA PCI classes for devices which
could be the pre-OS console 

[Intel-gfx] ✗ Fi.CI.IGT: failure for Enhance vfio PCI hot reset for vfio cdev device (rev8)

2023-06-16 Thread Patchwork
== Series Details ==

Series: Enhance vfio PCI hot reset for vfio cdev device (rev8)
URL   : https://patchwork.freedesktop.org/series/116991/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13277_full -> Patchwork_116991v8_full


Summary
---

  **FAILURE**

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

  

Participating hosts (7 -> 7)
--

  No changes in participating hosts

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@kms_vblank@pipe-c-accuracy-idle:
- shard-glk:  [PASS][1] -> [FAIL][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk8/igt@kms_vbl...@pipe-c-accuracy-idle.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-glk6/igt@kms_vbl...@pipe-c-accuracy-idle.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@drm_fdinfo@most-busy-idle-check-all@rcs0:
- shard-rkl:  [PASS][3] -> [FAIL][4] ([i915#7742])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-6/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-rkl-7/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html

  * igt@gem_barrier_race@remote-request@rcs0:
- shard-glk:  [PASS][5] -> [ABORT][6] ([i915#7461] / [i915#8211])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk5/igt@gem_barrier_race@remote-requ...@rcs0.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-glk5/igt@gem_barrier_race@remote-requ...@rcs0.html

  * igt@gem_eio@hibernate:
- shard-tglu: [PASS][7] -> [ABORT][8] ([i915#7975] / [i915#8213] / 
[i915#8398])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-7/igt@gem_...@hibernate.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-tglu-10/igt@gem_...@hibernate.html

  * igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglu: [PASS][9] -> [FAIL][10] ([i915#2842])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-3/igt@gem_exec_fair@basic-f...@rcs0.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-tglu-2/igt@gem_exec_fair@basic-f...@rcs0.html

  * igt@gem_exec_fair@basic-none@vcs0:
- shard-rkl:  [PASS][11] -> [FAIL][12] ([i915#2842])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-1/igt@gem_exec_fair@basic-n...@vcs0.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-rkl-4/igt@gem_exec_fair@basic-n...@vcs0.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-tglu: [PASS][13] -> [FAIL][14] ([i915#3989] / [i915#454])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-4/igt@i915_pm...@dc6-dpms.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-tglu-3/igt@i915_pm...@dc6-dpms.html

  * igt@i915_pm_dc@dc9-dpms:
- shard-tglu: [PASS][15] -> [SKIP][16] ([i915#4281])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-9/igt@i915_pm...@dc9-dpms.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-tglu-6/igt@i915_pm...@dc9-dpms.html

  * igt@i915_pm_rpm@dpms-lpsp:
- shard-rkl:  [PASS][17] -> [SKIP][18] ([i915#1397]) +1 similar 
issue
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-7/igt@i915_pm_...@dpms-lpsp.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-rkl-1/igt@i915_pm_...@dpms-lpsp.html

  * 
igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs:
- shard-rkl:  NOTRUN -> [SKIP][19] ([i915#8502]) +3 similar issues
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-rkl-1/igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs.html

  * igt@kms_ccs@pipe-d-bad-aux-stride-4_tiled_mtl_mc_ccs:
- shard-glk:  NOTRUN -> [SKIP][20] ([fdo#109271]) +27 similar issues
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/shard-glk8/igt@kms_ccs@pipe-d-bad-aux-stride-4_tiled_mtl_mc_ccs.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-glk:  [PASS][21] -> [FAIL][22] ([i915#2346])
   [21]: 

[Intel-gfx] [PATCH v3 7/7] drm/i915: Convert HSW/BDW to use port_mask for DDI probe

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

Make HSW/BDW use port_mask for output probing as well.
To achieve that the strap checks are moved into
intel_ddi_init() itself. Or should we move them to the
runtime port_mask init instead? Maybe not since the hardware
is still there, just not connected to anything.

v2: Account for DDI-E in strap detection
Keep to the old CRT->DDI init order

Reviewed-by: Jani Nikula 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 29 
 drivers/gpu/drm/i915/display/intel_display.c | 23 +++-
 2 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 62bf6cc136ad..61722556bb47 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4653,6 +4653,29 @@ static void 
intel_ddi_tc_encoder_shutdown_complete(struct intel_encoder *encoder
 #define port_tc_name(port) ((port) - PORT_TC1 + '1')
 #define tc_port_name(tc_port) ((tc_port) - TC_PORT_1 + '1')
 
+static bool port_strap_detected(struct drm_i915_private *i915, enum port port)
+{
+   /* straps not used on skl+ */
+   if (DISPLAY_VER(i915) >= 9)
+   return true;
+
+   switch (port) {
+   case PORT_A:
+   return intel_de_read(i915, DDI_BUF_CTL(PORT_A)) & 
DDI_INIT_DISPLAY_DETECTED;
+   case PORT_B:
+   return intel_de_read(i915, SFUSE_STRAP) & 
SFUSE_STRAP_DDIB_DETECTED;
+   case PORT_C:
+   return intel_de_read(i915, SFUSE_STRAP) & 
SFUSE_STRAP_DDIC_DETECTED;
+   case PORT_D:
+   return intel_de_read(i915, SFUSE_STRAP) & 
SFUSE_STRAP_DDID_DETECTED;
+   case PORT_E:
+   return true; /* no strap for DDI-E */
+   default:
+   MISSING_CASE(port);
+   return false;
+   }
+}
+
 void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 {
struct intel_digital_port *dig_port;
@@ -4661,6 +4684,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, 
enum port port)
bool init_hdmi, init_dp;
enum phy phy = intel_port_to_phy(dev_priv, port);
 
+   if (!port_strap_detected(dev_priv, port)) {
+   drm_dbg_kms(_priv->drm,
+   "Port %c strap not detected\n", port_name(port));
+   return;
+   }
+
if (!assert_port_valid(dev_priv, port))
return;
 
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 3273ed4fa834..e87bb4e57b50 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7404,9 +7404,12 @@ void intel_setup_outputs(struct drm_i915_private 
*dev_priv)
if (!HAS_DISPLAY(dev_priv))
return;
 
-   if (DISPLAY_VER(dev_priv) >= 9) {
+   if (HAS_DDI(dev_priv)) {
enum port port;
 
+   if (intel_ddi_crt_present(dev_priv))
+   intel_crt_init(dev_priv);
+
for_each_port_masked(port, 
DISPLAY_RUNTIME_INFO(dev_priv)->port_mask)
intel_ddi_init(dev_priv, port);
 
@@ -7417,24 +7420,6 @@ void intel_setup_outputs(struct drm_i915_private 
*dev_priv)
 
if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
vlv_dsi_init(dev_priv);
-   } else if (HAS_DDI(dev_priv)) {
-   u32 found;
-
-   if (intel_ddi_crt_present(dev_priv))
-   intel_crt_init(dev_priv);
-
-   /* Haswell uses DDI functions to detect digital outputs. */
-   found = intel_de_read(dev_priv, DDI_BUF_CTL(PORT_A)) & 
DDI_INIT_DISPLAY_DETECTED;
-   if (found)
-   intel_ddi_init(dev_priv, PORT_A);
-
-   found = intel_de_read(dev_priv, SFUSE_STRAP);
-   if (found & SFUSE_STRAP_DDIB_DETECTED)
-   intel_ddi_init(dev_priv, PORT_B);
-   if (found & SFUSE_STRAP_DDIC_DETECTED)
-   intel_ddi_init(dev_priv, PORT_C);
-   if (found & SFUSE_STRAP_DDID_DETECTED)
-   intel_ddi_init(dev_priv, PORT_D);
} else if (HAS_PCH_SPLIT(dev_priv)) {
int found;
 
-- 
2.39.3



[Intel-gfx] [PATCH v3 6/7] drm/i915: Init DDI outputs based on port_mask on skl+

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

Instead of listing every platform's possible DDI outputs
in intel_setup_outputs() just loop over the new port_mask
to achieve the same thing.

HSW/BDW were left as is since they still look at the straps
as well.

DSI is still a mess. For now just check for the relevant
platforms explicitly.

Reviewed-by: Jani Nikula 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 80 
 1 file changed, 13 insertions(+), 67 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 669e0cb6e392..3273ed4fa834 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7404,73 +7404,19 @@ void intel_setup_outputs(struct drm_i915_private 
*dev_priv)
if (!HAS_DISPLAY(dev_priv))
return;
 
-   if (IS_METEORLAKE(dev_priv)) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_TC1);
-   intel_ddi_init(dev_priv, PORT_TC2);
-   intel_ddi_init(dev_priv, PORT_TC3);
-   intel_ddi_init(dev_priv, PORT_TC4);
-   } else if (IS_DG2(dev_priv)) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_C);
-   intel_ddi_init(dev_priv, PORT_D_XELPD);
-   intel_ddi_init(dev_priv, PORT_TC1);
-   } else if (IS_ALDERLAKE_P(dev_priv)) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_TC1);
-   intel_ddi_init(dev_priv, PORT_TC2);
-   intel_ddi_init(dev_priv, PORT_TC3);
-   intel_ddi_init(dev_priv, PORT_TC4);
-   icl_dsi_init(dev_priv);
-   } else if (IS_ALDERLAKE_S(dev_priv)) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_TC1);
-   intel_ddi_init(dev_priv, PORT_TC2);
-   intel_ddi_init(dev_priv, PORT_TC3);
-   intel_ddi_init(dev_priv, PORT_TC4);
-   } else if (IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv)) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_TC1);
-   intel_ddi_init(dev_priv, PORT_TC2);
-   } else if (DISPLAY_VER(dev_priv) >= 12) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_TC1);
-   intel_ddi_init(dev_priv, PORT_TC2);
-   intel_ddi_init(dev_priv, PORT_TC3);
-   intel_ddi_init(dev_priv, PORT_TC4);
-   intel_ddi_init(dev_priv, PORT_TC5);
-   intel_ddi_init(dev_priv, PORT_TC6);
-   icl_dsi_init(dev_priv);
-   } else if (IS_JSL_EHL(dev_priv)) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_C);
-   intel_ddi_init(dev_priv, PORT_D);
-   icl_dsi_init(dev_priv);
-   } else if (DISPLAY_VER(dev_priv) == 11) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_C);
-   intel_ddi_init(dev_priv, PORT_D);
-   intel_ddi_init(dev_priv, PORT_E);
-   intel_ddi_init(dev_priv, PORT_F);
-   icl_dsi_init(dev_priv);
-   } else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_C);
-   vlv_dsi_init(dev_priv);
-   } else if (DISPLAY_VER(dev_priv) >= 9) {
-   intel_ddi_init(dev_priv, PORT_A);
-   intel_ddi_init(dev_priv, PORT_B);
-   intel_ddi_init(dev_priv, PORT_C);
-   intel_ddi_init(dev_priv, PORT_D);
-   intel_ddi_init(dev_priv, PORT_E);
+   if (DISPLAY_VER(dev_priv) >= 9) {
+   enum port port;
+
+   for_each_port_masked(port, 
DISPLAY_RUNTIME_INFO(dev_priv)->port_mask)
+   intel_ddi_init(dev_priv, port);
+
+   /* FIXME do something about DSI */
+   if (IS_ALDERLAKE_P(dev_priv) || IS_TIGERLAKE(dev_priv) ||
+   DISPLAY_VER(dev_priv) == 11)
+   icl_dsi_init(dev_priv);
+
+   if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
+   vlv_dsi_init(dev_priv);
} else if (HAS_DDI(dev_priv)) {
u32 found;
 
-- 
2.39.3



[Intel-gfx] [PATCH v3 5/7] drm/i915: Beef up SDVO/HDMI port checks

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

The SDVO code already warns when the port in question doesn't
actually support SDVO. Let's make that also bail the encoder
registration like the generic assert_port_valid() we added.

And add a similar thing for g4x HDMI, mainly because on g4x
itsefl port D only supports DP but not SDVO/HDMI. For the
other platforms the generic port_mask check should actually
be sufficient, but since we're here might as well list the
ports.

Reviewed-by: Jani Nikula 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/g4x_hdmi.c   | 17 +
 drivers/gpu/drm/i915/display/intel_sdvo.c | 17 -
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/g4x_hdmi.c 
b/drivers/gpu/drm/i915/display/g4x_hdmi.c
index 59704939c111..8c71e3ede680 100644
--- a/drivers/gpu/drm/i915/display/g4x_hdmi.c
+++ b/drivers/gpu/drm/i915/display/g4x_hdmi.c
@@ -659,6 +659,20 @@ int g4x_hdmi_connector_atomic_check(struct drm_connector 
*connector,
return ret;
 }
 
+static bool is_hdmi_port_valid(struct drm_i915_private *i915, enum port port)
+{
+   if (IS_G4X(i915) || IS_VALLEYVIEW(i915))
+   return port == PORT_B || port == PORT_C;
+   else
+   return port == PORT_B || port == PORT_C || port == PORT_D;
+}
+
+static bool assert_hdmi_port_valid(struct drm_i915_private *i915, enum port 
port)
+{
+   return !drm_WARN(>drm, !is_hdmi_port_valid(i915, port),
+"Platform does not support HDMI %c\n", 
port_name(port));
+}
+
 void g4x_hdmi_init(struct drm_i915_private *dev_priv,
   i915_reg_t hdmi_reg, enum port port)
 {
@@ -670,6 +684,9 @@ void g4x_hdmi_init(struct drm_i915_private *dev_priv,
if (!assert_port_valid(dev_priv, port))
return;
 
+   if (!assert_hdmi_port_valid(dev_priv, port))
+   return;
+
devdata = intel_bios_encoder_data_lookup(dev_priv, port);
 
/* FIXME bail? */
diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c 
b/drivers/gpu/drm/i915/display/intel_sdvo.c
index d269726a832e..8298a86d1334 100644
--- a/drivers/gpu/drm/i915/display/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
@@ -3313,13 +3313,19 @@ intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo,
return i2c_add_adapter(>ddc) == 0;
 }
 
-static void assert_sdvo_port_valid(const struct drm_i915_private *dev_priv,
-  enum port port)
+static bool is_sdvo_port_valid(struct drm_i915_private *dev_priv, enum port 
port)
 {
if (HAS_PCH_SPLIT(dev_priv))
-   drm_WARN_ON(_priv->drm, port != PORT_B);
+   return port == PORT_B;
else
-   drm_WARN_ON(_priv->drm, port != PORT_B && port != PORT_C);
+   return port == PORT_B || port == PORT_C;
+}
+
+static bool assert_sdvo_port_valid(struct drm_i915_private *dev_priv,
+  enum port port)
+{
+   return !drm_WARN(_priv->drm, !is_sdvo_port_valid(dev_priv, port),
+"Platform does not support SDVO %c\n", 
port_name(port));
 }
 
 bool intel_sdvo_init(struct drm_i915_private *dev_priv,
@@ -3332,7 +3338,8 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,
if (!assert_port_valid(dev_priv, port))
return false;
 
-   assert_sdvo_port_valid(dev_priv, port);
+   if (!assert_sdvo_port_valid(dev_priv, port))
+   return false;
 
intel_sdvo = kzalloc(sizeof(*intel_sdvo), GFP_KERNEL);
if (!intel_sdvo)
-- 
2.39.3



[Intel-gfx] [PATCH v3 4/7] drm/i915: Assert that the port being initialized is valid

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

Sprinkle some asserts to catch any mishaps in the port_mask
vs. output init.

For DDI/DP/HDMI/SDVO I decided that we want to bail out for
an invalid port since those are the encoder types where
we might want consider driving the whole thing from the VBT
child device list, and bogus VBTs could be a real issue
(if for no other reason than the i915.vbt_firmware).

For DVO and HSW/BDW CRT port I just threw the assert in
there for good measure.

Reviewed-by: Jani Nikula 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/g4x_dp.c| 3 +++
 drivers/gpu/drm/i915/display/g4x_hdmi.c  | 3 +++
 drivers/gpu/drm/i915/display/intel_crt.c | 2 ++
 drivers/gpu/drm/i915/display/intel_ddi.c | 3 +++
 drivers/gpu/drm/i915/display/intel_display.c | 6 ++
 drivers/gpu/drm/i915/display/intel_display.h | 2 ++
 drivers/gpu/drm/i915/display/intel_dvo.c | 2 ++
 drivers/gpu/drm/i915/display/intel_sdvo.c| 3 +++
 8 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c 
b/drivers/gpu/drm/i915/display/g4x_dp.c
index 112d91d81fdc..c58a3f249a01 100644
--- a/drivers/gpu/drm/i915/display/g4x_dp.c
+++ b/drivers/gpu/drm/i915/display/g4x_dp.c
@@ -1259,6 +1259,9 @@ bool g4x_dp_init(struct drm_i915_private *dev_priv,
struct drm_encoder *encoder;
struct intel_connector *intel_connector;
 
+   if (!assert_port_valid(dev_priv, port))
+   return false;
+
devdata = intel_bios_encoder_data_lookup(dev_priv, port);
 
/* FIXME bail? */
diff --git a/drivers/gpu/drm/i915/display/g4x_hdmi.c 
b/drivers/gpu/drm/i915/display/g4x_hdmi.c
index 5c187e6e0472..59704939c111 100644
--- a/drivers/gpu/drm/i915/display/g4x_hdmi.c
+++ b/drivers/gpu/drm/i915/display/g4x_hdmi.c
@@ -667,6 +667,9 @@ void g4x_hdmi_init(struct drm_i915_private *dev_priv,
struct intel_encoder *intel_encoder;
struct intel_connector *intel_connector;
 
+   if (!assert_port_valid(dev_priv, port))
+   return;
+
devdata = intel_bios_encoder_data_lookup(dev_priv, port);
 
/* FIXME bail? */
diff --git a/drivers/gpu/drm/i915/display/intel_crt.c 
b/drivers/gpu/drm/i915/display/intel_crt.c
index ab7cd5e60a0a..809074758687 100644
--- a/drivers/gpu/drm/i915/display/intel_crt.c
+++ b/drivers/gpu/drm/i915/display/intel_crt.c
@@ -1064,6 +1064,8 @@ void intel_crt_init(struct drm_i915_private *dev_priv)
}
 
if (HAS_DDI(dev_priv)) {
+   assert_port_valid(dev_priv, PORT_E);
+
crt->base.port = PORT_E;
crt->base.get_config = hsw_crt_get_config;
crt->base.get_hw_state = intel_ddi_get_hw_state;
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 090f242e610c..62bf6cc136ad 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4661,6 +4661,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, 
enum port port)
bool init_hdmi, init_dp;
enum phy phy = intel_port_to_phy(dev_priv, port);
 
+   if (!assert_port_valid(dev_priv, port))
+   return;
+
/*
 * On platforms with HTI (aka HDPORT), if it's enabled at boot it may
 * have taken over some of the PHYs and made them unavailable to the
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 27ace4aa8402..669e0cb6e392 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7388,6 +7388,12 @@ static bool intel_ddi_crt_present(struct 
drm_i915_private *dev_priv)
return true;
 }
 
+bool assert_port_valid(struct drm_i915_private *i915, enum port port)
+{
+   return !drm_WARN(>drm, !(DISPLAY_RUNTIME_INFO(i915)->port_mask & 
BIT(port)),
+"Platform does not support port %c\n", 
port_name(port));
+}
+
 void intel_setup_outputs(struct drm_i915_private *dev_priv)
 {
struct intel_encoder *encoder;
diff --git a/drivers/gpu/drm/i915/display/intel_display.h 
b/drivers/gpu/drm/i915/display/intel_display.h
index c744c021af23..53ca0e4e2357 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -539,6 +539,8 @@ void assert_transcoder(struct drm_i915_private *dev_priv,
 #define assert_transcoder_enabled(d, t) assert_transcoder(d, t, true)
 #define assert_transcoder_disabled(d, t) assert_transcoder(d, t, false)
 
+bool assert_port_valid(struct drm_i915_private *i915, enum port port);
+
 /*
  * Use I915_STATE_WARN(x) (rather than WARN() and WARN_ON()) for hw state 
sanity
  * checks to check for unexpected conditions which may not necessarily be a 
user
diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c 
b/drivers/gpu/drm/i915/display/intel_dvo.c
index 9884678743b6..b386894c3a6d 100644
--- a/drivers/gpu/drm/i915/display/intel_dvo.c
+++ 

[Intel-gfx] [PATCH v3 3/7] drm/i915: Assert that device info bitmasks have enough bits

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

Sprinkle in some BUILD_BUG_ON()s to make sure some of
the bitmasks used in the device info have enough bits.

Do we have a better place for this sort of stuff?

v2: Relocate to the new place

Reviewed-by: Jani Nikula 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display_device.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c 
b/drivers/gpu/drm/i915/display/intel_display_device.c
index f5305447494f..75ebe4c960a6 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -854,6 +854,10 @@ void intel_display_device_info_runtime_init(struct 
drm_i915_private *i915)
struct intel_display_runtime_info *display_runtime = 
DISPLAY_RUNTIME_INFO(i915);
enum pipe pipe;
 
+   BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->pipe_mask) < 
I915_MAX_PIPES);
+   BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->cpu_transcoder_mask) < 
I915_MAX_TRANSCODERS);
+   BUILD_BUG_ON(BITS_PER_TYPE(display_runtime->port_mask) < 
I915_MAX_PORTS);
+
/* Wa_14011765242: adl-s A0,A1 */
if (IS_ADLS_DISPLAY_STEP(i915, STEP_A0, STEP_A2))
for_each_pipe(i915, pipe)
-- 
2.39.3



[Intel-gfx] [PATCH v3 2/7] drm/i915: Introduce device info port_mask

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

Declare the available DVO/SDVO/HDMI/DP/DDI ports in the
device info. The other outputs (LVDS/TV/DSI/VGA) are left
out since for most of them we don't consider them as "ports".

DSI we should probably perhaps include somehow in the device
info. Just not sure how. Or we just introduce a HAS_DSI() and
call it a day?

TODO: figure out what to do about the subplatform stuff. Would
  it be better to declare those directly with a different
  device info or not? Also not sure the icl port-f stuff
  matters even. Bspec claims there are icl SKUs with far
  less ports than that and we don't seem to check for those
  either?

v2: Fix TC5 vs. TC6 mixup on TGL (Jani)
Drop DDI C for now on TGL, and add a FIXME (Jani)

Reviewed-by: Uma Shankar 
Signed-off-by: Ville Syrjälä 
---
 .../drm/i915/display/intel_display_device.c   | 158 --
 .../drm/i915/display/intel_display_device.h   |   1 +
 drivers/gpu/drm/i915/intel_device_info.c  |   4 +
 3 files changed, 113 insertions(+), 50 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c 
b/drivers/gpu/drm/i915/display/intel_display_device.c
index 3fd30e7f0062..f5305447494f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -187,10 +187,6 @@ static const struct intel_display_device_info no_display = 
{};
.__runtime_defaults.cpu_transcoder_mask = \
BIT(TRANSCODER_A) | BIT(TRANSCODER_B)
 
-static const struct intel_display_device_info i830_display = {
-   I830_DISPLAY,
-};
-
 #define I845_DISPLAY \
.has_overlay = 1, \
.overlay_needs_physical = 1, \
@@ -203,19 +199,29 @@ static const struct intel_display_device_info 
i830_display = {
.__runtime_defaults.pipe_mask = BIT(PIPE_A), \
.__runtime_defaults.cpu_transcoder_mask = BIT(TRANSCODER_A)
 
+static const struct intel_display_device_info i830_display = {
+   I830_DISPLAY,
+
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | 
BIT(PORT_C), /* DVO A/B/C */
+};
+
 static const struct intel_display_device_info i845_display = {
I845_DISPLAY,
+
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C), /* DVO B/C */
 };
 
 static const struct intel_display_device_info i85x_display = {
I830_DISPLAY,
 
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C), /* DVO B/C */
.__runtime_defaults.fbc_mask = BIT(INTEL_FBC_A),
 };
 
 static const struct intel_display_device_info i865g_display = {
I845_DISPLAY,
 
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C), /* DVO B/C */
.__runtime_defaults.fbc_mask = BIT(INTEL_FBC_A),
 };
 
@@ -228,7 +234,8 @@ static const struct intel_display_device_info i865g_display 
= {
.__runtime_defaults.ip.ver = 3, \
.__runtime_defaults.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
.__runtime_defaults.cpu_transcoder_mask = \
-   BIT(TRANSCODER_A) | BIT(TRANSCODER_B)
+   BIT(TRANSCODER_A) | BIT(TRANSCODER_B), \
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C) /* SDVO B/C */
 
 static const struct intel_display_device_info i915g_display = {
GEN3_DISPLAY,
@@ -293,6 +300,8 @@ static const struct intel_display_device_info pnv_display = 
{
 static const struct intel_display_device_info i965g_display = {
GEN4_DISPLAY,
.has_overlay = 1,
+
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C), /* SDVO B/C 
*/
 };
 
 static const struct intel_display_device_info i965gm_display = {
@@ -300,17 +309,21 @@ static const struct intel_display_device_info 
i965gm_display = {
.has_overlay = 1,
.supports_tv = 1,
 
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C), /* SDVO B/C 
*/
.__runtime_defaults.fbc_mask = BIT(INTEL_FBC_A),
 };
 
 static const struct intel_display_device_info g45_display = {
GEN4_DISPLAY,
+
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C) | 
BIT(PORT_D), /* SDVO/HDMI/DP B/C, DP D */
 };
 
 static const struct intel_display_device_info gm45_display = {
GEN4_DISPLAY,
.supports_tv = 1,
 
+   .__runtime_defaults.port_mask = BIT(PORT_B) | BIT(PORT_C) | 
BIT(PORT_D), /* SDVO/HDMI/DP B/C, DP D */
.__runtime_defaults.fbc_mask = BIT(INTEL_FBC_A),
 };
 
@@ -323,7 +336,8 @@ static const struct intel_display_device_info gm45_display 
= {
.__runtime_defaults.ip.ver = 5, \
.__runtime_defaults.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
.__runtime_defaults.cpu_transcoder_mask = \
-   BIT(TRANSCODER_A) | BIT(TRANSCODER_B)
+   BIT(TRANSCODER_A) | BIT(TRANSCODER_B), \
+   .__runtime_defaults.port_mask = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) 
| BIT(PORT_D) /* DP A, SDVO/HDMI/DP B, HDMI/DP C/D */
 
 static const struct intel_display_device_info ilk_d_display = {
ILK_DISPLAY,
@@ 

[Intel-gfx] [PATCH v3 1/7] drm/i915: Remove bogus DDI-F from hsw/bdw output init

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

HSW/BDW don't have DDI-F so don't go looking for one.

Seems to have been accidentally left behind when the
skl+ stuff got split out in commit 097d9e902068
("drm/i915/display: remove strap checks from gen 9").

Reviewed-by: Lucas De Marchi 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index d8533603ad05..27ace4aa8402 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7483,8 +7483,6 @@ void intel_setup_outputs(struct drm_i915_private 
*dev_priv)
intel_ddi_init(dev_priv, PORT_C);
if (found & SFUSE_STRAP_DDID_DETECTED)
intel_ddi_init(dev_priv, PORT_D);
-   if (found & SFUSE_STRAP_DDIF_DETECTED)
-   intel_ddi_init(dev_priv, PORT_F);
} else if (HAS_PCH_SPLIT(dev_priv)) {
int found;
 
-- 
2.39.3



[Intel-gfx] [PATCH v3 0/7] drm/i915: Init DDI ports based on port_mask

2023-06-16 Thread Ville Syrjala
From: Ville Syrjälä 

Introduce port_mask into the device info and utilize it
it initalize DDI ports instead of hand rolling each
intel_ddi_init() call per platform+port.

This is an intermediate step towards initializing
DDI/DP/HDMI/DSI ports purely based on VBT information.

v2: rebased due to intel_display_device.c
v3: Drop DDI-C on TGL for now, fix TGL TC5/6 mixup, rebase due to DSI stuff

Ville Syrjälä (7):
  drm/i915: Remove bogus DDI-F from hsw/bdw output init
  drm/i915: Introduce device info port_mask
  drm/i915: Assert that device info bitmasks have enough bits
  drm/i915: Assert that the port being initialized is valid
  drm/i915: Beef up SDVO/HDMI port checks
  drm/i915: Init DDI outputs based on port_mask on skl+
  drm/i915: Convert HSW/BDW to use port_mask for DDI probe

 drivers/gpu/drm/i915/display/g4x_dp.c |   3 +
 drivers/gpu/drm/i915/display/g4x_hdmi.c   |  20 +++
 drivers/gpu/drm/i915/display/intel_crt.c  |   2 +
 drivers/gpu/drm/i915/display/intel_ddi.c  |  32 
 drivers/gpu/drm/i915/display/intel_display.c  |  99 ++-
 drivers/gpu/drm/i915/display/intel_display.h  |   2 +
 .../drm/i915/display/intel_display_device.c   | 162 --
 .../drm/i915/display/intel_display_device.h   |   1 +
 drivers/gpu/drm/i915/display/intel_dvo.c  |   2 +
 drivers/gpu/drm/i915/display/intel_sdvo.c |  20 ++-
 drivers/gpu/drm/i915/intel_device_info.c  |   4 +
 11 files changed, 210 insertions(+), 137 deletions(-)

-- 
2.39.3



[Intel-gfx] ✗ Fi.CI.BUILD: failure for Add vfio_device cdev for iommufd support (rev17)

2023-06-16 Thread Patchwork
== Series Details ==

Series: Add vfio_device cdev for iommufd support (rev17)
URL   : https://patchwork.freedesktop.org/series/113696/
State : failure

== Summary ==

Error: patch 
https://patchwork.freedesktop.org/api/1.0/series/113696/revisions/17/mbox/ not 
applied
Applying: vfio: Allocate per device file structure
Applying: vfio: Refine vfio file kAPIs for KVM
Applying: vfio: Accept vfio device file in the KVM facing kAPI
Applying: kvm/vfio: Prepare for accepting vfio device fd
Applying: kvm/vfio: Accept vfio device file from userspace
Applying: vfio: Pass struct vfio_device_file * to vfio_device_open/close()
Applying: vfio: Block device access via device fd until device is opened
Applying: vfio: Add cdev_device_open_cnt to vfio_group
Applying: vfio: Make vfio_df_open() single open for device cdev path
Applying: vfio-iommufd: Move noiommu compat validation out of 
vfio_iommufd_bind()
Applying: vfio-iommufd: Split bind/attach into two steps
Applying: vfio: Record devid in vfio_device_file
Applying: vfio-iommufd: Add detach_ioas support for physical VFIO devices
Applying: iommufd/device: Add iommufd_access_detach() API
Applying: vfio-iommufd: Add detach_ioas support for emulated VFIO devices
error: sha1 information is lacking or useless (drivers/vfio/iommufd.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0015 vfio-iommufd: Add detach_ioas support for emulated VFIO 
devices
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".
Build failed, no error log produced




Re: [Intel-gfx] [PATCH v7 2/8] PCI/VGA: Deal only with VGA class devices

2023-06-16 Thread Alex Deucher
On Fri, Jun 16, 2023 at 3:11 AM Sui Jingfeng  wrote:
>
> Hi,
>
> On 2023/6/16 05:11, Alex Deucher wrote:
> > On Wed, Jun 14, 2023 at 6:50 AM Sui Jingfeng  
> > wrote:
> >> Hi,
> >>
> >> On 2023/6/13 11:01, Sui Jingfeng wrote:
> >>> From: Sui Jingfeng 
> >>>
> >>> Deal only with the VGA devcie(pdev->class == 0x0300), so replace the
> >>> pci_get_subsys() function with pci_get_class(). Filter the non-PCI display
> >>> device(pdev->class != 0x0300) out. There no need to process the 
> >>> non-display
> >>> PCI device.
> >>>
> >>> Cc: Bjorn Helgaas 
> >>> Signed-off-by: Sui Jingfeng 
> >>> ---
> >>>drivers/pci/vgaarb.c | 22 --
> >>>1 file changed, 12 insertions(+), 10 deletions(-)
> >>>
> >>> diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
> >>> index c1bc6c983932..22a505e877dc 100644
> >>> --- a/drivers/pci/vgaarb.c
> >>> +++ b/drivers/pci/vgaarb.c
> >>> @@ -754,10 +754,6 @@ static bool vga_arbiter_add_pci_device(struct 
> >>> pci_dev *pdev)
> >>>struct pci_dev *bridge;
> >>>u16 cmd;
> >>>
> >>> - /* Only deal with VGA class devices */
> >>> - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
> >>> - return false;
> >>> -
> >> Hi, here is probably a bug fixing.
> >>
> >> For an example, nvidia render only GPU typically has 0x0380.
> >>
> >> as its PCI class number, but render only GPU should not participate in
> >> the arbitration.
> >>
> >> As it shouldn't snoop the legacy fixed VGA address.
> >>
> >> It(render only GPU) can not display anything.
> >>
> >>
> >> But 0x0380 >> 8 = 0x03, the filter  failed.
> >>
> >>
> >>>/* Allocate structure */
> >>>vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL);
> >>>if (vgadev == NULL) {
> >>> @@ -1500,7 +1496,9 @@ static int pci_notify(struct notifier_block *nb, 
> >>> unsigned long action,
> >>>struct pci_dev *pdev = to_pci_dev(dev);
> >>>bool notify = false;
> >>>
> >>> - vgaarb_dbg(dev, "%s\n", __func__);
> >>> + /* Only deal with VGA class devices */
> >>> + if (pdev->class != PCI_CLASS_DISPLAY_VGA << 8)
> >>> + return 0;
> >> So here we only care 0x0300, my initial intent is to make an optimization,
> >>
> >> nowadays sane display graphic card should all has 0x0300 as its PCI
> >> class number, is this complete right?
> >>
> >> ```
> >>
> >> #define PCI_BASE_CLASS_DISPLAY0x03
> >> #define PCI_CLASS_DISPLAY_VGA0x0300
> >> #define PCI_CLASS_DISPLAY_XGA0x0301
> >> #define PCI_CLASS_DISPLAY_3D0x0302
> >> #define PCI_CLASS_DISPLAY_OTHER0x0380
> >>
> >> ```
> >>
> >> Any ideas ?
> > I'm not quite sure what you are asking about here.
>
> To be honest, I'm worried about the PCI devices which has a
>
> PCI_CLASS_DISPLAY_XGA as its PCI class number.
>
> As those devices are very uncommon in the real world.
>
>
> $ find . -name "*.c" -type f | xargs grep "PCI_CLASS_DISPLAY_XGA"
>
>
> Grep the "PCI_CLASS_DISPLAY_XGA" in the linux kernel tree got ZERO,
>
> there no code reference this macro. So I think it seems safe to ignore
> the XGA ?
>
>
> PCI_CLASS_DISPLAY_3D and PCI_CLASS_DISPLAY_OTHER are used to annotate
> the render-only GPU.
>
> And render-only GPU can't decode the fixed VGA address space, it is safe
> to ignore them.
>
>
> >   For vga_arb, we
> > only care about VGA class devices since those should be on the only
> > ones that might have VGA routed to them.
>
> >   However, as VGA gets deprecated,
>
> We need the vgaarb for a system with multiple video card.
>
> Not only because some Legacy VGA devices implemented
>
> on PCI will typically have the same "hard-decoded" addresses;
>
> But also these video card need to participate in the arbitration,
>
> determine the default boot device.

But couldn't the boot device be determined via what whatever resources
were used by the pre-OS console?  I feel like that should be separate
from vgaarb.  vgaarb should handle PCI VGA routing and some other
mechanism should be used to determine what device provided the pre-OS
console.

Alex


>
>
> Nowadays, the 'VGA devices' here is stand for the Graphics card
>
> which is capable of display something on the screen.
>
> We still need vgaarb to select the default boot device.
>
>
> > you'll have more non VGA PCI classes for devices which
> > could be the pre-OS console device.
>
> Ah, we still want  do this(by applying this patch) first,
>
> and then we will have the opportunity to see who will crying if
> something is broken. Will know more then.
>
> But drop this patch or revise it with more consideration is also
> acceptable.
>
>
> I asking about suggestion and/or review.
>
> > Alex
> >
> >>>/* For now we're only intereted in devices added and removed. I 
> >>> didn't
> >>> * test this thing here, so someone needs to double check for the
> >>> @@ -1510,6 +1508,8 @@ static int pci_notify(struct notifier_block *nb, 
> >>> unsigned long action,
> >>>else if (action == 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: make i915_drm_client_fdinfo() reference conditional again
URL   : https://patchwork.freedesktop.org/series/119441/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13278 -> Patchwork_119441v1


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (42 -> 40)
--

  Missing(2): bat-mtlp-8 fi-snb-2520m 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@i915_selftest@live@gt_lrc:
- bat-adlp-9: [PASS][1] -> [INCOMPLETE][2] ([i915#4983] / 
[i915#7913])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-adlp-9/igt@i915_selftest@live@gt_lrc.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-adlp-9/igt@i915_selftest@live@gt_lrc.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-dg2-11: NOTRUN -> [SKIP][3] ([i915#7828])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-dg2-11/igt@kms_chamelium_...@common-hpd-after-suspend.html

  
 Possible fixes 

  * igt@i915_selftest@live@gt_lrc:
- bat-dg2-11: [INCOMPLETE][4] ([i915#7609] / [i915#7913]) -> 
[PASS][5]
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html

  * igt@i915_selftest@live@gt_mocs:
- bat-mtlp-6: [DMESG-FAIL][6] ([i915#7059]) -> [PASS][7]
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html

  * igt@i915_selftest@live@slpc:
- bat-mtlp-6: [DMESG-WARN][8] ([i915#6367]) -> [PASS][9]
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-mtlp-6/igt@i915_selftest@l...@slpc.html
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-mtlp-6/igt@i915_selftest@l...@slpc.html

  * igt@i915_selftest@live@workarounds:
- bat-rpls-2: [DMESG-FAIL][10] ([i915#6763] / [i915#7913]) -> 
[PASS][11]
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-rpls-2/igt@i915_selftest@l...@workarounds.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-rpls-2/igt@i915_selftest@l...@workarounds.html

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
- bat-dg2-8:  [FAIL][12] ([i915#7932]) -> [PASS][13] +1 similar 
issue
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-seque...@pipe-d-dp-1.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-seque...@pipe-d-dp-1.html

  
 Warnings 

  * igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-a-edp-1:
- bat-adlp-6: [ABORT][14] ([i915#7977]) -> [ABORT][15] ([i915#7977] 
/ [i915#8434])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13278/bat-adlp-6/igt@kms_pipe_crc_basic@read-crc-frame-seque...@pipe-a-edp-1.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119441v1/bat-adlp-6/igt@kms_pipe_crc_basic@read-crc-frame-seque...@pipe-a-edp-1.html

  
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6763]: https://gitlab.freedesktop.org/drm/intel/issues/6763
  [i915#7059]: https://gitlab.freedesktop.org/drm/intel/issues/7059
  [i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
  [i915#7977]: https://gitlab.freedesktop.org/drm/intel/issues/7977
  [i915#8434]: https://gitlab.freedesktop.org/drm/intel/issues/8434


Build changes
-

  * Linux: CI_DRM_13278 -> Patchwork_119441v1

  CI-20190529: 20190529
  CI_DRM_13278: 3c942541e24c0aaab070d498c57647e7b4e9aa6e @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_7334: 9dd259184050af3e5217e1a63e6b90b1b946e7c4 @ 
https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_119441v1: 3c942541e24c0aaab070d498c57647e7b4e9aa6e @ 
git://anongit.freedesktop.org/gfx-ci/linux


### Linux commits

7af97a6e3f88 drm/i915: make i915_drm_client_fdinfo() reference conditional again

== Logs ==

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


[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: make i915_drm_client_fdinfo() reference conditional again
URL   : https://patchwork.freedesktop.org/series/119441/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.




[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915: make i915_drm_client_fdinfo() reference conditional again
URL   : https://patchwork.freedesktop.org/series/119441/
State : warning

== Summary ==

Error: dim checkpatch failed
e48e1d622c43 drm/i915: make i915_drm_client_fdinfo() reference conditional again
-:11: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#11: 
>>>   drivers/gpu/drm/i915/i915_driver.o:(i915_drm_driver) in 
>>> archive vmlinux.a

-:15: WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12 chars 
of sha1> ("")' - ie: 'Fixes: e894b724c316 ("drm/i915: Use the 
fdinfo helper")'
#15: 
Fixes: e894b724c316d ("drm/i915: Use the fdinfo helper")

total: 0 errors, 2 warnings, 0 checks, 16 lines checked




[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/mtl: Fix SSC selection for MPLLA

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915/mtl: Fix SSC selection for MPLLA
URL   : https://patchwork.freedesktop.org/series/119428/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13277_full -> Patchwork_119428v1_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Participating hosts (7 -> 8)
--

  Additional (1): shard-rkl0 

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@drm_fdinfo@most-busy-idle-check-all@rcs0:
- shard-rkl:  [PASS][1] -> [FAIL][2] ([i915#7742])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-6/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-rkl-7/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html

  * igt@gem_ctx_exec@basic-nohangcheck:
- shard-tglu: [PASS][3] -> [FAIL][4] ([i915#6268])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-3/igt@gem_ctx_e...@basic-nohangcheck.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-tglu-6/igt@gem_ctx_e...@basic-nohangcheck.html

  * igt@gem_ctx_persistence@smoketest:
- shard-rkl:  [PASS][5] -> [FAIL][6] ([i915#5099])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-4/igt@gem_ctx_persiste...@smoketest.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-rkl-6/igt@gem_ctx_persiste...@smoketest.html

  * igt@gem_exec_fair@basic-none@vcs0:
- shard-rkl:  [PASS][7] -> [FAIL][8] ([i915#2842])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-1/igt@gem_exec_fair@basic-n...@vcs0.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-rkl-2/igt@gem_exec_fair@basic-n...@vcs0.html

  * igt@gem_exec_suspend@basic-s4-devices@smem:
- shard-tglu: [PASS][9] -> [ABORT][10] ([i915#7975] / [i915#8213])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-9/igt@gem_exec_suspend@basic-s4-devi...@smem.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-tglu-10/igt@gem_exec_suspend@basic-s4-devi...@smem.html

  * igt@gem_lmem_swapping@heavy-verify-multi-ccs:
- shard-glk:  NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#4613])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-glk1/igt@gem_lmem_swapp...@heavy-verify-multi-ccs.html

  * igt@gen9_exec_parse@allowed-single:
- shard-apl:  [PASS][12] -> [ABORT][13] ([i915#5566])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-apl2/igt@gen9_exec_pa...@allowed-single.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-apl4/igt@gen9_exec_pa...@allowed-single.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-tglu: [PASS][14] -> [FAIL][15] ([i915#3989] / [i915#454])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-4/igt@i915_pm...@dc6-dpms.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-tglu-7/igt@i915_pm...@dc6-dpms.html

  * igt@i915_pm_rpm@modeset-non-lpsp:
- shard-rkl:  [PASS][16] -> [SKIP][17] ([i915#1397])
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-3/igt@i915_pm_...@modeset-non-lpsp.html
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-rkl-7/igt@i915_pm_...@modeset-non-lpsp.html

  * igt@i915_selftest@live@gt_heartbeat:
- shard-apl:  [PASS][18] -> [DMESG-FAIL][19] ([i915#5334])
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-apl7/igt@i915_selftest@live@gt_heartbeat.html
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-apl7/igt@i915_selftest@live@gt_heartbeat.html

  * igt@kms_async_flips@alternate-sync-async-flip@pipe-a-hdmi-a-2:
- shard-glk:  [PASS][20] -> [FAIL][21] ([i915#2521]) +1 similar 
issue
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk5/igt@kms_async_flips@alternate-sync-async-f...@pipe-a-hdmi-a-2.html
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-glk1/igt@kms_async_flips@alternate-sync-async-f...@pipe-a-hdmi-a-2.html

  * 
igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs:
- shard-rkl:  NOTRUN -> [SKIP][22] ([i915#8502]) +3 similar issues
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119428v1/shard-rkl-2/igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs.html

  * igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_mc_ccs:
- shard-glk:  NOTRUN -> [SKIP][23] ([fdo#109271] / [i915#3886]) +2 
similar issues
   [23]: 

Re: [Intel-gfx] [PATCH 11/11] drm/i915/mtl: s/MTL/METEORLAKE for platform/subplatform defines

2023-06-16 Thread Tvrtko Ursulin



On 16/06/2023 13:05, Tvrtko Ursulin wrote:


On 16/06/2023 12:42, Dnyaneshwar Bhadane wrote:

Follow consistent naming convention. Replace MTL with
METEORLAKE

Signed-off-by: Dnyaneshwar Bhadane 
---
  drivers/gpu/drm/i915/display/intel_fbc.c  |  2 +-
  drivers/gpu/drm/i915/display/intel_pmdemand.c |  2 +-
  drivers/gpu/drm/i915/display/intel_psr.c  | 10 ++---
  .../drm/i915/display/skl_universal_plane.c    |  4 +-
  drivers/gpu/drm/i915/gt/gen8_engine_cs.c  |  8 ++--
  drivers/gpu/drm/i915/gt/intel_engine_cs.c |  2 +-
  .../drm/i915/gt/intel_execlists_submission.c  |  2 +-
  drivers/gpu/drm/i915/gt/intel_gt_mcr.c    |  4 +-
  drivers/gpu/drm/i915/gt/intel_lrc.c   |  4 +-
  drivers/gpu/drm/i915/gt/intel_rc6.c   |  2 +-
  drivers/gpu/drm/i915/gt/intel_workarounds.c   | 44 +--
  drivers/gpu/drm/i915/gt/uc/intel_guc.c    |  4 +-
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c |  4 +-
  drivers/gpu/drm/i915/i915_drv.h   |  6 +--
  drivers/gpu/drm/i915/i915_perf.c  |  4 +-
  15 files changed, 51 insertions(+), 51 deletions(-)

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

index 7f8b2d7713c7..6358a8b26172 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -1093,7 +1093,7 @@ static int intel_fbc_check_plane(struct 
intel_atomic_state *state,

  /* Wa_14016291713 */
  if ((IS_DISPLAY_VER(i915, 12, 13) ||
- IS_MTL_DISPLAY_STEP(i915, STEP_A0, STEP_C0)) &&
+ IS_METEORLAKE_DISPLAY_STEP(i915, STEP_A0, STEP_C0)) &&
  crtc_state->has_psr) {
  plane_state->no_fbc_reason = "PSR1 enabled (Wa_14016291713)";
  return 0;
diff --git a/drivers/gpu/drm/i915/display/intel_pmdemand.c 
b/drivers/gpu/drm/i915/display/intel_pmdemand.c

index f7608d363634..8c3158b188ef 100644
--- a/drivers/gpu/drm/i915/display/intel_pmdemand.c
+++ b/drivers/gpu/drm/i915/display/intel_pmdemand.c
@@ -92,7 +92,7 @@ int intel_pmdemand_init(struct drm_i915_private *i915)
   _state->base,
   _pmdemand_funcs);
-    if (IS_MTL_DISPLAY_STEP(i915, STEP_A0, STEP_C0))
+    if (IS_METEORLAKE_DISPLAY_STEP(i915, STEP_A0, STEP_C0))
  /* Wa_14016740474 */
  intel_de_rmw(i915, XELPD_CHICKEN_DCPR_3, 0, 
DMD_RSP_TIMEOUT_DISABLE);
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c

index cf82cc295319..00c98c2b4324 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1247,7 +1247,7 @@ static void wm_optimization_wa(struct intel_dp 
*intel_dp,

  bool set_wa_bit = false;
  /* Wa_14015648006 */
-    if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
+    if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
  IS_DISPLAY_VER(dev_priv, 11, 13))
  set_wa_bit |= crtc_state->wm_level_disabled;
@@ -1320,7 +1320,7 @@ static void intel_psr_enable_source(struct 
intel_dp *intel_dp,
   * All supported adlp panels have 1-based X granularity, 
this may

   * cause issues if non-supported panels are used.
   */
-    if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+    if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
  intel_de_rmw(dev_priv, 
MTL_CHICKEN_TRANS(cpu_transcoder), 0,

   ADLP_1_BASED_X_GRANULARITY);
  else if (IS_ALDERLAKE_P(dev_priv))
@@ -1328,7 +1328,7 @@ static void intel_psr_enable_source(struct 
intel_dp *intel_dp,

   ADLP_1_BASED_X_GRANULARITY);
  /* Wa_16012604467:adlp,mtl[a0,b0] */
-    if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+    if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
  intel_de_rmw(dev_priv,
   MTL_CLKGATE_DIS_TRANS(cpu_transcoder), 0,
   MTL_CLKGATE_DIS_TRANS_DMASC_GATING_DIS);
@@ -1489,7 +1489,7 @@ static void intel_psr_disable_locked(struct 
intel_dp *intel_dp)

  if (intel_dp->psr.psr2_enabled) {
  /* Wa_16012604467:adlp,mtl[a0,b0] */
-    if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+    if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
  intel_de_rmw(dev_priv,
   MTL_CLKGATE_DIS_TRANS(cpu_transcoder),
   MTL_CLKGATE_DIS_TRANS_DMASC_GATING_DIS, 0);
@@ -1963,7 +1963,7 @@ int intel_psr2_sel_fetch_update(struct 
intel_atomic_state *state,

  goto skip_sel_fetch_set_loop;
  /* Wa_14014971492 */
-    if ((IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
+    if ((IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
   IS_ALDERLAKE_P(dev_priv) || IS_TIGERLAKE(dev_priv)) &&
  crtc_state->splitter.enable)
  pipe_clip.y1 = 0;
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 

Re: [Intel-gfx] [PATCH 11/11] drm/i915/mtl: s/MTL/METEORLAKE for platform/subplatform defines

2023-06-16 Thread Tvrtko Ursulin



On 16/06/2023 12:42, Dnyaneshwar Bhadane wrote:

Follow consistent naming convention. Replace MTL with
METEORLAKE

Signed-off-by: Dnyaneshwar Bhadane 
---
  drivers/gpu/drm/i915/display/intel_fbc.c  |  2 +-
  drivers/gpu/drm/i915/display/intel_pmdemand.c |  2 +-
  drivers/gpu/drm/i915/display/intel_psr.c  | 10 ++---
  .../drm/i915/display/skl_universal_plane.c|  4 +-
  drivers/gpu/drm/i915/gt/gen8_engine_cs.c  |  8 ++--
  drivers/gpu/drm/i915/gt/intel_engine_cs.c |  2 +-
  .../drm/i915/gt/intel_execlists_submission.c  |  2 +-
  drivers/gpu/drm/i915/gt/intel_gt_mcr.c|  4 +-
  drivers/gpu/drm/i915/gt/intel_lrc.c   |  4 +-
  drivers/gpu/drm/i915/gt/intel_rc6.c   |  2 +-
  drivers/gpu/drm/i915/gt/intel_workarounds.c   | 44 +--
  drivers/gpu/drm/i915/gt/uc/intel_guc.c|  4 +-
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c |  4 +-
  drivers/gpu/drm/i915/i915_drv.h   |  6 +--
  drivers/gpu/drm/i915/i915_perf.c  |  4 +-
  15 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c 
b/drivers/gpu/drm/i915/display/intel_fbc.c
index 7f8b2d7713c7..6358a8b26172 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -1093,7 +1093,7 @@ static int intel_fbc_check_plane(struct 
intel_atomic_state *state,
  
  	/* Wa_14016291713 */

if ((IS_DISPLAY_VER(i915, 12, 13) ||
-IS_MTL_DISPLAY_STEP(i915, STEP_A0, STEP_C0)) &&
+IS_METEORLAKE_DISPLAY_STEP(i915, STEP_A0, STEP_C0)) &&
crtc_state->has_psr) {
plane_state->no_fbc_reason = "PSR1 enabled (Wa_14016291713)";
return 0;
diff --git a/drivers/gpu/drm/i915/display/intel_pmdemand.c 
b/drivers/gpu/drm/i915/display/intel_pmdemand.c
index f7608d363634..8c3158b188ef 100644
--- a/drivers/gpu/drm/i915/display/intel_pmdemand.c
+++ b/drivers/gpu/drm/i915/display/intel_pmdemand.c
@@ -92,7 +92,7 @@ int intel_pmdemand_init(struct drm_i915_private *i915)
 _state->base,
 _pmdemand_funcs);
  
-	if (IS_MTL_DISPLAY_STEP(i915, STEP_A0, STEP_C0))

+   if (IS_METEORLAKE_DISPLAY_STEP(i915, STEP_A0, STEP_C0))
/* Wa_14016740474 */
intel_de_rmw(i915, XELPD_CHICKEN_DCPR_3, 0, 
DMD_RSP_TIMEOUT_DISABLE);
  
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c

index cf82cc295319..00c98c2b4324 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1247,7 +1247,7 @@ static void wm_optimization_wa(struct intel_dp *intel_dp,
bool set_wa_bit = false;
  
  	/* Wa_14015648006 */

-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
IS_DISPLAY_VER(dev_priv, 11, 13))
set_wa_bit |= crtc_state->wm_level_disabled;
  
@@ -1320,7 +1320,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,

 * All supported adlp panels have 1-based X granularity, this 
may
 * cause issues if non-supported panels are used.
 */
-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
intel_de_rmw(dev_priv, 
MTL_CHICKEN_TRANS(cpu_transcoder), 0,
 ADLP_1_BASED_X_GRANULARITY);
else if (IS_ALDERLAKE_P(dev_priv))
@@ -1328,7 +1328,7 @@ static void intel_psr_enable_source(struct intel_dp 
*intel_dp,
 ADLP_1_BASED_X_GRANULARITY);
  
  		/* Wa_16012604467:adlp,mtl[a0,b0] */

-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
intel_de_rmw(dev_priv,
 MTL_CLKGATE_DIS_TRANS(cpu_transcoder), 0,
 MTL_CLKGATE_DIS_TRANS_DMASC_GATING_DIS);
@@ -1489,7 +1489,7 @@ static void intel_psr_disable_locked(struct intel_dp 
*intel_dp)
  
  	if (intel_dp->psr.psr2_enabled) {

/* Wa_16012604467:adlp,mtl[a0,b0] */
-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
intel_de_rmw(dev_priv,
 MTL_CLKGATE_DIS_TRANS(cpu_transcoder),
 MTL_CLKGATE_DIS_TRANS_DMASC_GATING_DIS, 0);
@@ -1963,7 +1963,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state 
*state,
goto skip_sel_fetch_set_loop;
  
  	/* Wa_14014971492 */

-   if ((IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
+   if ((IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, 

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/perf: Consider OA buffer boundary when zeroing out reports

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915/perf: Consider OA buffer boundary when zeroing out reports
URL   : https://patchwork.freedesktop.org/series/119427/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13277_full -> Patchwork_119427v1_full


Summary
---

  **FAILURE**

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

  

Participating hosts (7 -> 7)
--

  No changes in participating hosts

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@gem_softpin@noreloc:
- shard-glk:  [PASS][1] -> [INCOMPLETE][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk3/igt@gem_soft...@noreloc.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-glk6/igt@gem_soft...@noreloc.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@drm_fdinfo@most-busy-idle-check-all@rcs0:
- shard-rkl:  [PASS][3] -> [FAIL][4] ([i915#7742])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-6/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-rkl-6/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html

  * igt@gem_lmem_swapping@heavy-verify-multi-ccs:
- shard-glk:  NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-glk5/igt@gem_lmem_swapp...@heavy-verify-multi-ccs.html

  * igt@gem_mmap_gtt@fault-concurrent-y:
- shard-snb:  [PASS][6] -> [ABORT][7] ([i915#5161])
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-snb7/igt@gem_mmap_...@fault-concurrent-y.html
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-snb7/igt@gem_mmap_...@fault-concurrent-y.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-tglu: [PASS][8] -> [FAIL][9] ([i915#3989] / [i915#454])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-4/igt@i915_pm...@dc6-dpms.html
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-tglu-8/igt@i915_pm...@dc6-dpms.html

  * igt@i915_selftest@live@gt_heartbeat:
- shard-apl:  [PASS][10] -> [DMESG-FAIL][11] ([i915#5334])
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-apl7/igt@i915_selftest@live@gt_heartbeat.html
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-apl6/igt@i915_selftest@live@gt_heartbeat.html

  * 
igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs:
- shard-rkl:  NOTRUN -> [SKIP][12] ([i915#8502]) +3 similar issues
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-rkl-3/igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs.html

  * igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_mc_ccs:
- shard-glk:  NOTRUN -> [SKIP][13] ([fdo#109271] / [i915#3886]) +2 
similar issues
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-glk5/igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_mc_ccs.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-glk:  [PASS][14] -> [FAIL][15] ([i915#2346])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk9/igt@kms_cursor_leg...@flip-vs-cursor-atomic-transitions.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-glk7/igt@kms_cursor_leg...@flip-vs-cursor-atomic-transitions.html

  * igt@kms_cursor_legacy@single-move@pipe-b:
- shard-rkl:  [PASS][16] -> [INCOMPLETE][17] ([i915#8011]) +1 
similar issue
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-3/igt@kms_cursor_legacy@single-m...@pipe-b.html
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-rkl-7/igt@kms_cursor_legacy@single-m...@pipe-b.html

  * igt@kms_fbcon_fbt@fbc-suspend:
- shard-glk:  NOTRUN -> [FAIL][18] ([i915#4767])
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119427v1/shard-glk5/igt@kms_fbcon_...@fbc-suspend.html

  * 
igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling@pipe-a-valid-mode:
- shard-glk:  NOTRUN -> [SKIP][19] ([fdo#109271] / [i915#4579])
   [19]: 

[Intel-gfx] [PATCH 10/11] drm/i915/adls: s/ADLS/ALDERLAKE_S in platform and subplatform defines

2023-06-16 Thread Dnyaneshwar Bhadane
From: Anusha Srivatsa 

Driver refers to the platform Alderlake S as ADLS in places
and ALDERLAKE_S in some. Making the consistent change
to avoid confusion of the right naming convention for
the platform.

Signed-off-by: Anusha Srivatsa 
---
 drivers/gpu/drm/i915/display/intel_display_device.c | 2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c   | 2 +-
 drivers/gpu/drm/i915/i915_drv.h | 6 +++---
 drivers/gpu/drm/i915/intel_step.c   | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c 
b/drivers/gpu/drm/i915/display/intel_display_device.c
index 3fd30e7f0062..f3090b8afc60 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -797,7 +797,7 @@ void intel_display_device_info_runtime_init(struct 
drm_i915_private *i915)
enum pipe pipe;
 
/* Wa_14011765242: adl-s A0,A1 */
-   if (IS_ADLS_DISPLAY_STEP(i915, STEP_A0, STEP_A2))
+   if (IS_ALDERLAKE_S_DISPLAY_STEP(i915, STEP_A0, STEP_A2))
for_each_pipe(i915, pipe)
display_runtime->num_scalers[pipe] = 0;
else if (DISPLAY_VER(i915) >= 11) {
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c 
b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
index 18250fb64bd8..eb28705b88bd 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
@@ -43,7 +43,7 @@ static void uc_expand_default_options(struct intel_uc *uc)
}
 
/* Intermediate platforms are HuC authentication only */
-   if (IS_ALDERLAKE_S(i915) && !IS_ADLS_RPLS(i915)) {
+   if (IS_ALDERLAKE_S(i915) && !IS_ALDERLAKE_S_RPLS(i915)) {
i915->params.enable_guc = ENABLE_GUC_LOAD_HUC;
return;
}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6dee940e6913..ef828e7de2ec 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -585,7 +585,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
IS_SUBPLATFORM(i915, INTEL_DG2, INTEL_SUBPLATFORM_G11)
 #define IS_DG2_G12(i915) \
IS_SUBPLATFORM(i915, INTEL_DG2, INTEL_SUBPLATFORM_G12)
-#define IS_ADLS_RPLS(i915) \
+#define IS_ALDERLAKE_S_RPLS(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_S, INTEL_SUBPLATFORM_RPL)
 #define IS_ALDERLAKE_P_N(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_N)
@@ -669,11 +669,11 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define IS_ROCKETLAKE_DISPLAY_STEP(p, since, until) \
(IS_ROCKETLAKE(p) && IS_DISPLAY_STEP(p, since, until))
 
-#define IS_ADLS_DISPLAY_STEP(__i915, since, until) \
+#define IS_ALDERLAKE_S_DISPLAY_STEP(__i915, since, until) \
(IS_ALDERLAKE_S(__i915) && \
 IS_DISPLAY_STEP(__i915, since, until))
 
-#define IS_ADLS_GRAPHICS_STEP(__i915, since, until) \
+#define IS_ALDERLAKE_GRAPHICS_STEP(__i915, since, until) \
(IS_ALDERLAKE_S(__i915) && \
 IS_GRAPHICS_STEP(__i915, since, until))
 
diff --git a/drivers/gpu/drm/i915/intel_step.c 
b/drivers/gpu/drm/i915/intel_step.c
index fe447063a064..f410aa2a8077 100644
--- a/drivers/gpu/drm/i915/intel_step.c
+++ b/drivers/gpu/drm/i915/intel_step.c
@@ -201,7 +201,7 @@ void intel_step_init(struct drm_i915_private *i915)
} else if (IS_ALDERLAKE_P(i915)) {
revids = adlp_revids;
size = ARRAY_SIZE(adlp_revids);
-   } else if (IS_ADLS_RPLS(i915)) {
+   } else if (IS_ALDERLAKE_S_RPLS(i915)) {
revids = adls_rpls_revids;
size = ARRAY_SIZE(adls_rpls_revids);
} else if (IS_ALDERLAKE_S(i915)) {
-- 
2.34.1



[Intel-gfx] [PATCH 11/11] drm/i915/mtl: s/MTL/METEORLAKE for platform/subplatform defines

2023-06-16 Thread Dnyaneshwar Bhadane
Follow consistent naming convention. Replace MTL with
METEORLAKE

Signed-off-by: Dnyaneshwar Bhadane 
---
 drivers/gpu/drm/i915/display/intel_fbc.c  |  2 +-
 drivers/gpu/drm/i915/display/intel_pmdemand.c |  2 +-
 drivers/gpu/drm/i915/display/intel_psr.c  | 10 ++---
 .../drm/i915/display/skl_universal_plane.c|  4 +-
 drivers/gpu/drm/i915/gt/gen8_engine_cs.c  |  8 ++--
 drivers/gpu/drm/i915/gt/intel_engine_cs.c |  2 +-
 .../drm/i915/gt/intel_execlists_submission.c  |  2 +-
 drivers/gpu/drm/i915/gt/intel_gt_mcr.c|  4 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c   |  4 +-
 drivers/gpu/drm/i915/gt/intel_rc6.c   |  2 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c   | 44 +--
 drivers/gpu/drm/i915/gt/uc/intel_guc.c|  4 +-
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c |  4 +-
 drivers/gpu/drm/i915/i915_drv.h   |  6 +--
 drivers/gpu/drm/i915/i915_perf.c  |  4 +-
 15 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c 
b/drivers/gpu/drm/i915/display/intel_fbc.c
index 7f8b2d7713c7..6358a8b26172 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -1093,7 +1093,7 @@ static int intel_fbc_check_plane(struct 
intel_atomic_state *state,
 
/* Wa_14016291713 */
if ((IS_DISPLAY_VER(i915, 12, 13) ||
-IS_MTL_DISPLAY_STEP(i915, STEP_A0, STEP_C0)) &&
+IS_METEORLAKE_DISPLAY_STEP(i915, STEP_A0, STEP_C0)) &&
crtc_state->has_psr) {
plane_state->no_fbc_reason = "PSR1 enabled (Wa_14016291713)";
return 0;
diff --git a/drivers/gpu/drm/i915/display/intel_pmdemand.c 
b/drivers/gpu/drm/i915/display/intel_pmdemand.c
index f7608d363634..8c3158b188ef 100644
--- a/drivers/gpu/drm/i915/display/intel_pmdemand.c
+++ b/drivers/gpu/drm/i915/display/intel_pmdemand.c
@@ -92,7 +92,7 @@ int intel_pmdemand_init(struct drm_i915_private *i915)
 _state->base,
 _pmdemand_funcs);
 
-   if (IS_MTL_DISPLAY_STEP(i915, STEP_A0, STEP_C0))
+   if (IS_METEORLAKE_DISPLAY_STEP(i915, STEP_A0, STEP_C0))
/* Wa_14016740474 */
intel_de_rmw(i915, XELPD_CHICKEN_DCPR_3, 0, 
DMD_RSP_TIMEOUT_DISABLE);
 
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c
index cf82cc295319..00c98c2b4324 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1247,7 +1247,7 @@ static void wm_optimization_wa(struct intel_dp *intel_dp,
bool set_wa_bit = false;
 
/* Wa_14015648006 */
-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
IS_DISPLAY_VER(dev_priv, 11, 13))
set_wa_bit |= crtc_state->wm_level_disabled;
 
@@ -1320,7 +1320,7 @@ static void intel_psr_enable_source(struct intel_dp 
*intel_dp,
 * All supported adlp panels have 1-based X granularity, this 
may
 * cause issues if non-supported panels are used.
 */
-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
intel_de_rmw(dev_priv, 
MTL_CHICKEN_TRANS(cpu_transcoder), 0,
 ADLP_1_BASED_X_GRANULARITY);
else if (IS_ALDERLAKE_P(dev_priv))
@@ -1328,7 +1328,7 @@ static void intel_psr_enable_source(struct intel_dp 
*intel_dp,
 ADLP_1_BASED_X_GRANULARITY);
 
/* Wa_16012604467:adlp,mtl[a0,b0] */
-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
intel_de_rmw(dev_priv,
 MTL_CLKGATE_DIS_TRANS(cpu_transcoder), 0,
 MTL_CLKGATE_DIS_TRANS_DMASC_GATING_DIS);
@@ -1489,7 +1489,7 @@ static void intel_psr_disable_locked(struct intel_dp 
*intel_dp)
 
if (intel_dp->psr.psr2_enabled) {
/* Wa_16012604467:adlp,mtl[a0,b0] */
-   if (IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   if (IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
intel_de_rmw(dev_priv,
 MTL_CLKGATE_DIS_TRANS(cpu_transcoder),
 MTL_CLKGATE_DIS_TRANS_DMASC_GATING_DIS, 0);
@@ -1963,7 +1963,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state 
*state,
goto skip_sel_fetch_set_loop;
 
/* Wa_14014971492 */
-   if ((IS_MTL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
+   if ((IS_METEORLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0) ||
 

[Intel-gfx] [PATCH 09/11] drm/i915/adln: s/ADLP/ALDERLAKE_P in ADLN defines

2023-06-16 Thread Dnyaneshwar Bhadane
From: Anusha Srivatsa 

Follow consistent naming convention. Replace ADLP with
ALDERLAKE_P

Signed-off-by: Anusha Srivatsa 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c | 2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c| 2 +-
 drivers/gpu/drm/i915/i915_drv.h | 2 +-
 drivers/gpu/drm/i915/intel_step.c   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c
index 852bea0208ce..cc9569af7f0c 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c
@@ -94,7 +94,7 @@ static int guc_hwconfig_fill_buffer(struct intel_guc *guc, 
struct intel_hwconfig
 
 static bool has_table(struct drm_i915_private *i915)
 {
-   if (IS_ALDERLAKE_P(i915) && !IS_ADLP_N(i915))
+   if (IS_ALDERLAKE_P(i915) && !IS_ALDERLAKE_P_N(i915))
return true;
if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 55))
return true;
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c 
b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
index d408856ae4c0..dfb2837a3ed4 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
@@ -279,7 +279,7 @@ __uc_fw_auto_select(struct drm_i915_private *i915, struct 
intel_uc_fw *uc_fw)
 * ADL-S, otherwise the GuC might attempt to fetch a config table that
 * does not exist.
 */
-   if (IS_ADLP_N(i915))
+   if (IS_ALDERLAKE_P_N(i915))
p = INTEL_ALDERLAKE_S;
 
GEM_BUG_ON(uc_fw->type >= ARRAY_SIZE(blobs_all));
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index aa9689a1683f..6dee940e6913 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -587,7 +587,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
IS_SUBPLATFORM(i915, INTEL_DG2, INTEL_SUBPLATFORM_G12)
 #define IS_ADLS_RPLS(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_S, INTEL_SUBPLATFORM_RPL)
-#define IS_ADLP_N(i915) \
+#define IS_ALDERLAKE_P_N(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_N)
 #define IS_ALDERLAKE_P_RPLP(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_RPL)
diff --git a/drivers/gpu/drm/i915/intel_step.c 
b/drivers/gpu/drm/i915/intel_step.c
index 9072f4ccd3c1..fe447063a064 100644
--- a/drivers/gpu/drm/i915/intel_step.c
+++ b/drivers/gpu/drm/i915/intel_step.c
@@ -192,7 +192,7 @@ void intel_step_init(struct drm_i915_private *i915)
} else if (IS_XEHPSDV(i915)) {
revids = xehpsdv_revids;
size = ARRAY_SIZE(xehpsdv_revids);
-   } else if (IS_ADLP_N(i915)) {
+   } else if (IS_ALDERLAKE_P_N(i915)) {
revids = adlp_n_revids;
size = ARRAY_SIZE(adlp_n_revids);
} else if (IS_ALDERLAKE_P_RPLP(i915)) {
-- 
2.34.1



[Intel-gfx] [PATCH 08/11] drm/i915/rplu: s/ADLP/ALDERLAKE_P in RPLU defines

2023-06-16 Thread Dnyaneshwar Bhadane
From: Anusha Srivatsa 

Follow consistent naming convention. Replace ADLP with
ALDERLAKE_P

Signed-off-by: Anusha Srivatsa 
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 2 +-
 drivers/gpu/drm/i915/i915_drv.h| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c 
b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 034454233d87..4318785b940f 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -3562,7 +3562,7 @@ void intel_init_cdclk_hooks(struct drm_i915_private 
*dev_priv)
if (IS_ALDERLAKE_P_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) {
dev_priv->display.cdclk.table = adlp_a_step_cdclk_table;
dev_priv->display.funcs.cdclk = _cdclk_funcs;
-   } else if (IS_ADLP_RPLU(dev_priv)) {
+   } else if (IS_ALDERLAKE_RPLU(dev_priv)) {
dev_priv->display.cdclk.table = rplu_cdclk_table;
dev_priv->display.funcs.cdclk = _cdclk_funcs;
} else {
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 819e72a39ba6..aa9689a1683f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -591,7 +591,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_N)
 #define IS_ALDERLAKE_P_RPLP(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_RPL)
-#define IS_ADLP_RPLU(i915) \
+#define IS_ALDERLAKE_RPLU(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_RPLU)
 #define IS_HSW_EARLY_SDV(i915) (IS_HASWELL(i915) && \
(INTEL_DEVID(i915) & 0xFF00) == 0x0C00)
-- 
2.34.1



[Intel-gfx] [PATCH 05/11] drm/i915/tgl: s/TGL/TIGERLAKE for platform/subplatform defines

2023-06-16 Thread Dnyaneshwar Bhadane
Follow consistent naming convention. Replace TGL with
TIGERLAKE.

Signed-off-by: Dnyaneshwar Bhadane 
---
 drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c | 2 +-
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 2 +-
 drivers/gpu/drm/i915/i915_drv.h| 4 ++--
 drivers/gpu/drm/i915/intel_step.c  | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c 
b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
index cd6915e9e138..ab84d003232c 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
@@ -1390,7 +1390,7 @@ tgl_get_combo_buf_trans_dp(struct intel_encoder *encoder,
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 
if (crtc_state->port_clock > 27) {
-   if (IS_TGL_UY(dev_priv)) {
+   if (IS_TIGERLAKE_UY(dev_priv)) {
return 
intel_get_buf_trans(_uy_combo_phy_trans_dp_hbr2,
   n_entries);
} else {
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 
b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 6b01a0b68b97..26def9cb86e4 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -2196,7 +2196,7 @@ static bool gen12_plane_has_mc_ccs(struct 
drm_i915_private *i915,
 
/* Wa_14010477008 */
if (IS_DG1(i915) || IS_ROCKETLAKE(i915) ||
-   IS_TGL_DISPLAY_STEP(i915, STEP_A0, STEP_D0))
+   IS_TIGERLAKE_DISPLAY_STEP(i915, STEP_A0, STEP_D0))
return false;
 
/* Wa_22011186057 */
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b6a720ac48bf..865977d69f7e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -647,7 +647,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define IS_ICL_WITH_PORT_F(i915) \
IS_SUBPLATFORM(i915, INTEL_ICELAKE, INTEL_SUBPLATFORM_PORTF)
 
-#define IS_TGL_UY(i915) \
+#define IS_TIGERLAKE_UY(i915) \
IS_SUBPLATFORM(i915, INTEL_TIGERLAKE, INTEL_SUBPLATFORM_UY)
 
 #define IS_SKYLAKE_GRAPHICS_STEP(p, since, until) (IS_SKYLAKE(p) && 
IS_GRAPHICS_STEP(p, since, until))
@@ -662,7 +662,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define IS_JASPERLAKE_EHL_DISPLAY_STEP(p, since, until) \
(IS_JASPERLAKE_EHL(p) && IS_DISPLAY_STEP(p, since, until))
 
-#define IS_TGL_DISPLAY_STEP(__i915, since, until) \
+#define IS_TIGERLAKE_DISPLAY_STEP(__i915, since, until) \
(IS_TIGERLAKE(__i915) && \
 IS_DISPLAY_STEP(__i915, since, until))
 
diff --git a/drivers/gpu/drm/i915/intel_step.c 
b/drivers/gpu/drm/i915/intel_step.c
index 3469d912e83e..847c7de50e1f 100644
--- a/drivers/gpu/drm/i915/intel_step.c
+++ b/drivers/gpu/drm/i915/intel_step.c
@@ -213,7 +213,7 @@ void intel_step_init(struct drm_i915_private *i915)
} else if (IS_ROCKETLAKE(i915)) {
revids = rkl_revids;
size = ARRAY_SIZE(rkl_revids);
-   } else if (IS_TGL_UY(i915)) {
+   } else if (IS_TIGERLAKE_UY(i915)) {
revids = tgl_uy_revids;
size = ARRAY_SIZE(tgl_uy_revids);
} else if (IS_TIGERLAKE(i915)) {
-- 
2.34.1



[Intel-gfx] [PATCH 07/11] drm/i915/rplp: s/ADLP/ALDERLAKE_P for RPLP defines

2023-06-16 Thread Dnyaneshwar Bhadane
From: Anusha Srivatsa 

Follow consistent naming convention. Replace ADLP with
ALDERLAKE_P.

Signed-off-by: Anusha Srivatsa 
---
 drivers/gpu/drm/i915/i915_drv.h   | 2 +-
 drivers/gpu/drm/i915/intel_step.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 691ed3f0258b..819e72a39ba6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -589,7 +589,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_S, INTEL_SUBPLATFORM_RPL)
 #define IS_ADLP_N(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_N)
-#define IS_ADLP_RPLP(i915) \
+#define IS_ALDERLAKE_P_RPLP(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_RPL)
 #define IS_ADLP_RPLU(i915) \
IS_SUBPLATFORM(i915, INTEL_ALDERLAKE_P, INTEL_SUBPLATFORM_RPLU)
diff --git a/drivers/gpu/drm/i915/intel_step.c 
b/drivers/gpu/drm/i915/intel_step.c
index 847c7de50e1f..9072f4ccd3c1 100644
--- a/drivers/gpu/drm/i915/intel_step.c
+++ b/drivers/gpu/drm/i915/intel_step.c
@@ -195,7 +195,7 @@ void intel_step_init(struct drm_i915_private *i915)
} else if (IS_ADLP_N(i915)) {
revids = adlp_n_revids;
size = ARRAY_SIZE(adlp_n_revids);
-   } else if (IS_ADLP_RPLP(i915)) {
+   } else if (IS_ALDERLAKE_P_RPLP(i915)) {
revids = adlp_rplp_revids;
size = ARRAY_SIZE(adlp_rplp_revids);
} else if (IS_ALDERLAKE_P(i915)) {
-- 
2.34.1



[Intel-gfx] [PATCH 03/11] drm/i915/tgl: s/RKL/ROCKETLAKE for platform/subplatform defines

2023-06-16 Thread Dnyaneshwar Bhadane
Follow consistent naming convention. Replace RKL with
ROCKETLAKE.

Signed-off-by: Dnyaneshwar Bhadane 
---
 drivers/gpu/drm/i915/display/intel_display_power.c | 2 +-
 drivers/gpu/drm/i915/i915_drv.h| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
b/drivers/gpu/drm/i915/display/intel_display_power.c
index db5437043904..c65505b82065 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -1586,7 +1586,7 @@ static void tgl_bw_buddy_init(struct drm_i915_private 
*dev_priv)
return;
 
if (IS_ALDERLAKE_S(dev_priv) ||
-   IS_RKL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   IS_ROCKETLAKE_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
/* Wa_1409767108 */
table = wa_1409767108_buddy_page_masks;
else
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6102b127fe4d..feddd9d32dce 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -666,7 +666,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
(IS_TIGERLAKE(__i915) && \
 IS_DISPLAY_STEP(__i915, since, until))
 
-#define IS_RKL_DISPLAY_STEP(p, since, until) \
+#define IS_ROCKETLAKE_DISPLAY_STEP(p, since, until) \
(IS_ROCKETLAKE(p) && IS_DISPLAY_STEP(p, since, until))
 
 #define IS_ADLS_DISPLAY_STEP(__i915, since, until) \
-- 
2.34.1



[Intel-gfx] [PATCH 06/11] drm/i915/adlp: s/ADLP/ALDERLAKE_P for display and graphics step

2023-06-16 Thread Dnyaneshwar Bhadane
From: Anusha Srivatsa 

Driver refers to the platform Alderlake P as ADLP in places
and ALDERLAKE_P in some. Making the consistent change
to avoid confusion of the right naming convention for
the platform.

Signed-off-by: Anusha Srivatsa 
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 2 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c  | 2 +-
 drivers/gpu/drm/i915/display/intel_psr.c   | 8 
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 4 ++--
 drivers/gpu/drm/i915/i915_drv.h| 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c 
b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 2acfa0435675..034454233d87 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -3559,7 +3559,7 @@ void intel_init_cdclk_hooks(struct drm_i915_private 
*dev_priv)
dev_priv->display.cdclk.table = dg2_cdclk_table;
} else if (IS_ALDERLAKE_P(dev_priv)) {
/* Wa_22011320316:adl-p[a0] */
-   if (IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) {
+   if (IS_ALDERLAKE_P_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) {
dev_priv->display.cdclk.table = adlp_a_step_cdclk_table;
dev_priv->display.funcs.cdclk = _cdclk_funcs;
} else if (IS_ADLP_RPLU(dev_priv)) {
diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c 
b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
index c6d376d414b8..47fe8311067e 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -3781,7 +3781,7 @@ static void adlp_cmtg_clock_gating_wa(struct 
drm_i915_private *i915, struct inte
 {
u32 val;
 
-   if (!IS_ADLP_DISPLAY_STEP(i915, STEP_A0, STEP_B0) ||
+   if (!IS_ALDERLAKE_P_DISPLAY_STEP(i915, STEP_A0, STEP_B0) ||
pll->info->id != DPLL_ID_ICL_DPLL0)
return;
/*
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c
index 46f6469ad4d8..cf82cc295319 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -639,7 +639,7 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
}
 
/* Wa_22012278275:adl-p */
-   if (IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_E0)) {
+   if (IS_ALDERLAKE_P_DISPLAY_STEP(dev_priv, STEP_A0, STEP_E0)) {
static const u8 map[] = {
2, /* 5 lines */
1, /* 6 lines */
@@ -807,7 +807,7 @@ tgl_dc3co_exitline_compute_config(struct intel_dp *intel_dp,
return;
 
/* Wa_16011303918:adl-p */
-   if (IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
+   if (IS_ALDERLAKE_P_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
return;
 
/*
@@ -975,7 +975,7 @@ static bool intel_psr2_config_valid(struct intel_dp 
*intel_dp,
return false;
}
 
-   if (IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) {
+   if (IS_ALDERLAKE_P_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) {
drm_dbg_kms(_priv->drm, "PSR2 not completely functional in 
this stepping\n");
return false;
}
@@ -1033,7 +1033,7 @@ static bool intel_psr2_config_valid(struct intel_dp 
*intel_dp,
 
/* Wa_16011303918:adl-p */
if (crtc_state->vrr.enable &&
-   IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) {
+   IS_ALDERLAKE_P_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) {
drm_dbg_kms(_priv->drm,
"PSR2 not enabled, not compatible with HW stepping 
+ VRR\n");
return false;
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 
b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 26def9cb86e4..636a88827a8f 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -2174,7 +2174,7 @@ static bool skl_plane_has_rc_ccs(struct drm_i915_private 
*i915,
return false;
 
/* Wa_22011186057 */
-   if (IS_ADLP_DISPLAY_STEP(i915, STEP_A0, STEP_B0))
+   if (IS_ALDERLAKE_P_DISPLAY_STEP(i915, STEP_A0, STEP_B0))
return false;
 
if (DISPLAY_VER(i915) >= 11)
@@ -2200,7 +2200,7 @@ static bool gen12_plane_has_mc_ccs(struct 
drm_i915_private *i915,
return false;
 
/* Wa_22011186057 */
-   if (IS_ADLP_DISPLAY_STEP(i915, STEP_A0, STEP_B0))
+   if (IS_ALDERLAKE_P_DISPLAY_STEP(i915, STEP_A0, STEP_B0))
return false;
 
/* Wa_14013215631 */
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 865977d69f7e..691ed3f0258b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -677,11 +677,11 @@ IS_SUBPLATFORM(const 

[Intel-gfx] [PATCH 02/11] drm/i915/kbl: s/KBL/KABYLAKE for platform/subplatform defines

2023-06-16 Thread Dnyaneshwar Bhadane
Follow consistent naming convention. Replace KBL with
KABYLAKE.

Signed-off-by: Dnyaneshwar Bhadane 
---
 drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c |  4 ++--
 drivers/gpu/drm/i915/gt/gen8_engine_cs.c   |  2 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c|  6 +++---
 drivers/gpu/drm/i915/i915_drv.h| 12 ++--
 drivers/gpu/drm/i915/intel_clock_gating.c  |  4 ++--
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c 
b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
index 13a2c364b8eb..cd6915e9e138 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
@@ -1718,9 +1718,9 @@ void intel_ddi_buf_trans_init(struct intel_encoder 
*encoder)
encoder->get_buf_trans = icl_get_mg_buf_trans;
} else if (IS_GEMINILAKE(i915) || IS_BROXTON(i915)) {
encoder->get_buf_trans = bxt_get_buf_trans;
-   } else if (IS_CML_ULX(i915) || IS_CFL_ULX(i915) || IS_KBL_ULX(i915)) {
+   } else if (IS_CML_ULX(i915) || IS_CFL_ULX(i915) || 
IS_KABYLAKE_ULX(i915)) {
encoder->get_buf_trans = kbl_y_get_buf_trans;
-   } else if (IS_CML_ULT(i915) || IS_CFL_ULT(i915) || IS_KBL_ULT(i915)) {
+   } else if (IS_CML_ULT(i915) || IS_CFL_ULT(i915) || 
IS_KABYLAKE_ULT(i915)) {
encoder->get_buf_trans = kbl_u_get_buf_trans;
} else if (IS_COMETLAKE(i915) || IS_COFFEELAKE(i915) || 
IS_KABYLAKE(i915)) {
encoder->get_buf_trans = kbl_get_buf_trans;
diff --git a/drivers/gpu/drm/i915/gt/gen8_engine_cs.c 
b/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
index 23857cc08eca..3173e811463d 100644
--- a/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
@@ -43,7 +43,7 @@ int gen8_emit_flush_rcs(struct i915_request *rq, u32 mode)
vf_flush_wa = true;
 
/* WaForGAMHang:kbl */
-   if (IS_KBL_GRAPHICS_STEP(rq->engine->i915, 0, STEP_C0))
+   if (IS_KABYLAKE_GRAPHICS_STEP(rq->engine->i915, 0, STEP_C0))
dc_flush_wa = true;
}
 
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 38ecbe793ea4..bb948ffc95ca 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -584,7 +584,7 @@ static void kbl_ctx_workarounds_init(struct intel_engine_cs 
*engine,
gen9_ctx_workarounds_init(engine, wal);
 
/* WaToEnableHwFixForPushConstHWBug:kbl */
-   if (IS_KBL_GRAPHICS_STEP(i915, STEP_C0, STEP_FOREVER))
+   if (IS_KABYLAKE_GRAPHICS_STEP(i915, STEP_C0, STEP_FOREVER))
wa_masked_en(wal, COMMON_SLICE_CHICKEN2,
 GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION);
 
@@ -1185,7 +1185,7 @@ kbl_gt_workarounds_init(struct intel_gt *gt, struct 
i915_wa_list *wal)
gen9_gt_workarounds_init(gt, wal);
 
/* WaDisableDynamicCreditSharing:kbl */
-   if (IS_KBL_GRAPHICS_STEP(gt->i915, 0, STEP_C0))
+   if (IS_KABYLAKE_GRAPHICS_STEP(gt->i915, 0, STEP_C0))
wa_write_or(wal,
GAMT_CHKN_BIT_REG,
GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING);
@@ -2933,7 +2933,7 @@ xcs_engine_wa_init(struct intel_engine_cs *engine, struct 
i915_wa_list *wal)
struct drm_i915_private *i915 = engine->i915;
 
/* WaKBLVECSSemaphoreWaitPoll:kbl */
-   if (IS_KBL_GRAPHICS_STEP(i915, STEP_A0, STEP_F0)) {
+   if (IS_KABYLAKE_GRAPHICS_STEP(i915, STEP_A0, STEP_F0)) {
wa_write(wal,
 RING_SEMA_WAIT_POLL(engine->mmio_base),
 1);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 71dd1d80dc97..6102b127fe4d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -614,9 +614,9 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
IS_SUBPLATFORM(i915, INTEL_SKYLAKE, INTEL_SUBPLATFORM_ULT)
 #define IS_SKYLAKE_ULX(i915) \
IS_SUBPLATFORM(i915, INTEL_SKYLAKE, INTEL_SUBPLATFORM_ULX)
-#define IS_KBL_ULT(i915) \
+#define IS_KABYLAKE_ULT(i915) \
IS_SUBPLATFORM(i915, INTEL_KABYLAKE, INTEL_SUBPLATFORM_ULT)
-#define IS_KBL_ULX(i915) \
+#define IS_KABYLAKE_ULX(i915) \
IS_SUBPLATFORM(i915, INTEL_KABYLAKE, INTEL_SUBPLATFORM_ULX)
 #define IS_SKYLAKE_GT2(i915)   (IS_SKYLAKE(i915) && \
 INTEL_INFO(i915)->gt == 2)
@@ -624,9 +624,9 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 INTEL_INFO(i915)->gt == 3)
 #define IS_SKYLAKE_GT4(i915)   (IS_SKYLAKE(i915) && \
 INTEL_INFO(i915)->gt == 4)
-#define IS_KBL_GT2(i915)   (IS_KABYLAKE(i915) && \
+#define IS_KABYLAKE_GT2(i915)  (IS_KABYLAKE(i915) && \
  

[Intel-gfx] [PATCH 04/11] drm/i915/jsl: s/JSL/JASPERLAKE for platform/subplatform defines

2023-06-16 Thread Dnyaneshwar Bhadane
Follow consistent naming convention. Replace JSL with
JASPERLAKE.

Signed-off-by: Dnyaneshwar Bhadane 
---
 drivers/gpu/drm/i915/display/icl_dsi.c |  4 ++--
 drivers/gpu/drm/i915/display/intel_cdclk.c |  4 ++--
 drivers/gpu/drm/i915/display/intel_combo_phy.c |  6 +++---
 drivers/gpu/drm/i915/display/intel_ddi.c   |  6 +++---
 drivers/gpu/drm/i915/display/intel_display.c   |  6 +++---
 drivers/gpu/drm/i915/display/intel_dp.c|  2 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c  | 18 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c  |  2 +-
 drivers/gpu/drm/i915/display/intel_psr.c   |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_object.c |  2 +-
 drivers/gpu/drm/i915/gt/intel_sseu.c   |  2 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c|  2 +-
 drivers/gpu/drm/i915/i915_drv.h| 10 +-
 drivers/gpu/drm/i915/intel_step.c  |  2 +-
 drivers/gpu/drm/i915/soc/intel_pch.c   |  6 +++---
 15 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c 
b/drivers/gpu/drm/i915/display/icl_dsi.c
index 59a2a289d9be..70f045da3bac 100644
--- a/drivers/gpu/drm/i915/display/icl_dsi.c
+++ b/drivers/gpu/drm/i915/display/icl_dsi.c
@@ -444,7 +444,7 @@ static void gen11_dsi_config_phy_lanes_sequence(struct 
intel_encoder *encoder)
intel_de_write(dev_priv, ICL_PORT_TX_DW2_GRP(phy), tmp);
 
/* For EHL, TGL, set latency optimization for PCS_DW1 lanes */
-   if (IS_JSL_EHL(dev_priv) || (DISPLAY_VER(dev_priv) >= 12)) {
+   if (IS_JASPERLAKE_EHL(dev_priv) || (DISPLAY_VER(dev_priv) >= 
12)) {
intel_de_rmw(dev_priv, ICL_PORT_PCS_DW1_AUX(phy),
 LATENCY_OPTIM_MASK, LATENCY_OPTIM_VAL(0));
 
@@ -553,7 +553,7 @@ gen11_dsi_setup_dphy_timings(struct intel_encoder *encoder,
}
}
 
-   if (IS_JSL_EHL(dev_priv)) {
+   if (IS_JASPERLAKE_EHL(dev_priv)) {
for_each_dsi_phy(phy, intel_dsi->phys)
intel_de_rmw(dev_priv, ICL_DPHY_CHKN(phy),
 0, ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP);
diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c 
b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 4207863b7b2a..2acfa0435675 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -3147,7 +3147,7 @@ static int intel_compute_max_dotclk(struct 
drm_i915_private *dev_priv)
  */
 void intel_update_max_cdclk(struct drm_i915_private *dev_priv)
 {
-   if (IS_JSL_EHL(dev_priv)) {
+   if (IS_JASPERLAKE_EHL(dev_priv)) {
if (dev_priv->display.cdclk.hw.ref == 24000)
dev_priv->display.cdclk.max_cdclk_freq = 552000;
else
@@ -3575,7 +3575,7 @@ void intel_init_cdclk_hooks(struct drm_i915_private 
*dev_priv)
} else if (DISPLAY_VER(dev_priv) >= 12) {
dev_priv->display.funcs.cdclk = _cdclk_funcs;
dev_priv->display.cdclk.table = icl_cdclk_table;
-   } else if (IS_JSL_EHL(dev_priv)) {
+   } else if (IS_JASPERLAKE_EHL(dev_priv)) {
dev_priv->display.funcs.cdclk = _cdclk_funcs;
dev_priv->display.cdclk.table = icl_cdclk_table;
} else if (DISPLAY_VER(dev_priv) >= 11) {
diff --git a/drivers/gpu/drm/i915/display/intel_combo_phy.c 
b/drivers/gpu/drm/i915/display/intel_combo_phy.c
index 922a6d87b553..37bd6d31ced1 100644
--- a/drivers/gpu/drm/i915/display/intel_combo_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_combo_phy.c
@@ -141,7 +141,7 @@ static bool has_phy_misc(struct drm_i915_private *i915, 
enum phy phy)
 
if (IS_ALDERLAKE_S(i915))
return phy == PHY_A;
-   else if (IS_JSL_EHL(i915) ||
+   else if (IS_JASPERLAKE_EHL(i915) ||
 IS_ROCKETLAKE(i915) ||
 IS_DG1(i915))
return phy < PHY_C;
@@ -242,7 +242,7 @@ static bool icl_combo_phy_verify_state(struct 
drm_i915_private *dev_priv,
ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),
 IREFGEN, IREFGEN);
 
-   if (IS_JSL_EHL(dev_priv)) {
+   if (IS_JASPERLAKE_EHL(dev_priv)) {
if (ehl_vbt_ddi_d_present(dev_priv))
expected_val = ICL_PHY_MISC_MUX_DDID;
 
@@ -333,7 +333,7 @@ static void icl_combo_phys_init(struct drm_i915_private 
*dev_priv)
 * "internal" child devices.
 */
val = intel_de_read(dev_priv, ICL_PHY_MISC(phy));
-   if (IS_JSL_EHL(dev_priv) && phy == PHY_A) {
+   if (IS_JASPERLAKE_EHL(dev_priv) && phy == PHY_A) {
val &= ~ICL_PHY_MISC_MUX_DDID;
 
if (ehl_vbt_ddi_d_present(dev_priv))
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 

[Intel-gfx] [PATCH 01/11] drm/i915/skl: s/SKL/SKYLAKE for platform/subplatform defines

2023-06-16 Thread Dnyaneshwar Bhadane
Follow consistent naming convention. Replace SKL with
SKYLAKE.

Signed-off-by: Dnyaneshwar Bhadane 
---
 drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c |  4 ++--
 drivers/gpu/drm/i915/gt/intel_workarounds.c|  2 +-
 drivers/gpu/drm/i915/i915_drv.h| 14 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c 
b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
index b7d20485bde5..13a2c364b8eb 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
@@ -1724,9 +1724,9 @@ void intel_ddi_buf_trans_init(struct intel_encoder 
*encoder)
encoder->get_buf_trans = kbl_u_get_buf_trans;
} else if (IS_COMETLAKE(i915) || IS_COFFEELAKE(i915) || 
IS_KABYLAKE(i915)) {
encoder->get_buf_trans = kbl_get_buf_trans;
-   } else if (IS_SKL_ULX(i915)) {
+   } else if (IS_SKYLAKE_ULX(i915)) {
encoder->get_buf_trans = skl_y_get_buf_trans;
-   } else if (IS_SKL_ULT(i915)) {
+   } else if (IS_SKYLAKE_ULT(i915)) {
encoder->get_buf_trans = skl_u_get_buf_trans;
} else if (IS_SKYLAKE(i915)) {
encoder->get_buf_trans = skl_get_buf_trans;
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 4d2dece96011..38ecbe793ea4 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -1173,7 +1173,7 @@ skl_gt_workarounds_init(struct intel_gt *gt, struct 
i915_wa_list *wal)
GEN8_EU_GAUNIT_CLOCK_GATE_DISABLE);
 
/* WaInPlaceDecompressionHang:skl */
-   if (IS_SKL_GRAPHICS_STEP(gt->i915, STEP_A0, STEP_H0))
+   if (IS_SKYLAKE_GRAPHICS_STEP(gt->i915, STEP_A0, STEP_H0))
wa_write_or(wal,
GEN9_GAMT_ECO_REG_RW_IA,
GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b4cf6f0f636d..71dd1d80dc97 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -610,19 +610,19 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 /* ULX machines are also considered ULT. */
 #define IS_HSW_ULX(i915) \
IS_SUBPLATFORM(i915, INTEL_HASWELL, INTEL_SUBPLATFORM_ULX)
-#define IS_SKL_ULT(i915) \
+#define IS_SKYLAKE_ULT(i915) \
IS_SUBPLATFORM(i915, INTEL_SKYLAKE, INTEL_SUBPLATFORM_ULT)
-#define IS_SKL_ULX(i915) \
+#define IS_SKYLAKE_ULX(i915) \
IS_SUBPLATFORM(i915, INTEL_SKYLAKE, INTEL_SUBPLATFORM_ULX)
 #define IS_KBL_ULT(i915) \
IS_SUBPLATFORM(i915, INTEL_KABYLAKE, INTEL_SUBPLATFORM_ULT)
 #define IS_KBL_ULX(i915) \
IS_SUBPLATFORM(i915, INTEL_KABYLAKE, INTEL_SUBPLATFORM_ULX)
-#define IS_SKL_GT2(i915)   (IS_SKYLAKE(i915) && \
+#define IS_SKYLAKE_GT2(i915)   (IS_SKYLAKE(i915) && \
 INTEL_INFO(i915)->gt == 2)
-#define IS_SKL_GT3(i915)   (IS_SKYLAKE(i915) && \
+#define IS_SKYLAKE_GT3(i915)   (IS_SKYLAKE(i915) && \
 INTEL_INFO(i915)->gt == 3)
-#define IS_SKL_GT4(i915)   (IS_SKYLAKE(i915) && \
+#define IS_SKYLAKE_GT4(i915)   (IS_SKYLAKE(i915) && \
 INTEL_INFO(i915)->gt == 4)
 #define IS_KBL_GT2(i915)   (IS_KABYLAKE(i915) && \
 INTEL_INFO(i915)->gt == 2)
@@ -650,7 +650,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define IS_TGL_UY(i915) \
IS_SUBPLATFORM(i915, INTEL_TIGERLAKE, INTEL_SUBPLATFORM_UY)
 
-#define IS_SKL_GRAPHICS_STEP(p, since, until) (IS_SKYLAKE(p) && 
IS_GRAPHICS_STEP(p, since, until))
+#define IS_SKYLAKE_GRAPHICS_STEP(p, since, until) (IS_SKYLAKE(p) && 
IS_GRAPHICS_STEP(p, since, until))
 
 #define IS_KBL_GRAPHICS_STEP(i915, since, until) \
(IS_KABYLAKE(i915) && IS_GRAPHICS_STEP(i915, since, until))
@@ -801,7 +801,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 
 /* WaRsDisableCoarsePowerGating:skl,cnl */
 #define NEEDS_WaRsDisableCoarsePowerGating(i915)   \
-   (IS_SKL_GT3(i915) || IS_SKL_GT4(i915))
+   (IS_SKYLAKE_GT3(i915) || IS_SKYLAKE_GT4(i915))
 
 /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
  * rows, which changed the alignment requirements and fence programming.
-- 
2.34.1



[Intel-gfx] [PATCH 00/11] Replace acronym with full platform name in defines.

2023-06-16 Thread Dnyaneshwar Bhadane
Replace all occurences of MTL with METEORLAKE, ADL with ALDERLAKE, 
TGL with TIGERLAKE, RKL with ROCKETLAKE, JSL with JASPERLAKE, 
KBL with KABYLAKE and SKL with SKYLAKE in platform and subplatform
defines. This way there is a consistent pattern to how platforms 
are referred. While the change is minor and could be combined to 
have lesser patches, splitting to per subpaltform for easier 
cherrypicks, if needed.

v2:
 - Reordered patches by incrementing platform generations.

Anusha Srivatsa (5):
  drm/i915/adlp: s/ADLP/ALDERLAKE_P for display and graphics step
  drm/i915/rplp: s/ADLP/ALDERLAKE_P for RPLP defines
  drm/i915/rplu: s/ADLP/ALDERLAKE_P in RPLU defines
  drm/i915/adln: s/ADLP/ALDERLAKE_P in ADLN defines
  drm/i915/adls: s/ADLS/ALDERLAKE_S in platform and subplatform defines

Dnyaneshwar Bhadane (6):
  drm/i915/skl: s/SKL/SKYLAKE for platform/subplatform defines
  drm/i915/kbl: s/KBL/KABYLAKE for platform/subplatform defines
  drm/i915/tgl: s/RKL/ROCKETLAKE for platform/subplatform defines
  drm/i915/jsl: s/JSL/JASPERLAKE for platform/subplatform defines
  drm/i915/tgl: s/TGL/TIGERLAKE for platform/subplatform defines
  drm/i915/mtl: s/MTL/METEORLAKE for platform/subplatform defines

 drivers/gpu/drm/i915/display/icl_dsi.c|  4 +-
 drivers/gpu/drm/i915/display/intel_cdclk.c|  8 +--
 .../gpu/drm/i915/display/intel_combo_phy.c|  6 +-
 drivers/gpu/drm/i915/display/intel_ddi.c  |  6 +-
 .../drm/i915/display/intel_ddi_buf_trans.c| 10 +--
 drivers/gpu/drm/i915/display/intel_display.c  |  6 +-
 .../drm/i915/display/intel_display_device.c   |  2 +-
 .../drm/i915/display/intel_display_power.c|  2 +-
 drivers/gpu/drm/i915/display/intel_dp.c   |  2 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 20 +++---
 drivers/gpu/drm/i915/display/intel_fbc.c  |  2 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c |  2 +-
 drivers/gpu/drm/i915/display/intel_pmdemand.c |  2 +-
 drivers/gpu/drm/i915/display/intel_psr.c  | 20 +++---
 .../drm/i915/display/skl_universal_plane.c| 10 +--
 drivers/gpu/drm/i915/gem/i915_gem_object.c|  2 +-
 drivers/gpu/drm/i915/gt/gen8_engine_cs.c  | 10 +--
 drivers/gpu/drm/i915/gt/intel_engine_cs.c |  2 +-
 .../drm/i915/gt/intel_execlists_submission.c  |  2 +-
 drivers/gpu/drm/i915/gt/intel_gt_mcr.c|  4 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c   |  4 +-
 drivers/gpu/drm/i915/gt/intel_rc6.c   |  2 +-
 drivers/gpu/drm/i915/gt/intel_sseu.c  |  2 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c   | 54 
 drivers/gpu/drm/i915/gt/uc/intel_guc.c|  4 +-
 .../gpu/drm/i915/gt/uc/intel_guc_hwconfig.c   |  2 +-
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c |  4 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c |  2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c  |  2 +-
 drivers/gpu/drm/i915/i915_drv.h   | 64 +--
 drivers/gpu/drm/i915/i915_perf.c  |  4 +-
 drivers/gpu/drm/i915/intel_clock_gating.c |  4 +-
 drivers/gpu/drm/i915/intel_step.c | 10 +--
 drivers/gpu/drm/i915/soc/intel_pch.c  |  6 +-
 34 files changed, 143 insertions(+), 143 deletions(-)

-- 
2.34.1



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

2023-06-16 Thread Maarten Lankhorst

Hey Dave, Daniel,

Sorry for being late,  life sometimes get in the way. Sometimes even 
literally!


Cheers,
~Maarten

drm-misc-fixes-2023-06-16:
drm-misc-fixes maybe in time for v6.4-rc7:
- qaic leak and null deref fix.
- Fix runtime pm in nouveau.
- Fix array overflow in ti-sn65dsi86 pwm chip handling.
- Assorted null check fixes in nouveau.
The following changes since commit a3efabee5878b8d7b1863debb78cb7129d07a346:

  accel/ivpu: Fix sporadic VPU boot failure (2023-06-08 08:17:27 +0200)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2023-06-16

for you to fetch changes up to 55b94bb8c42464bad3d2217f6874aa1a85664eac:

  drm/nouveau: add nv_encoder pointer check for NULL (2023-06-13 
16:53:00 -0400)



drm-misc-fixes maybe in time for v6.4-rc7:
- qaic leak and null deref fix.
- Fix runtime pm in nouveau.
- Fix array overflow in ti-sn65dsi86 pwm chip handling.
- Assorted null check fixes in nouveau.


Carl Vanderlip (1):
  accel/qaic: Free user handle on interrupted mutex

Jeffrey Hugo (1):
  accel/qaic: Fix NULL pointer deref in qaic_destroy_drm_device()

Natalia Petrova (2):
  drm/nouveau/dp: check for NULL nv_connector->native_mode
  drm/nouveau: add nv_encoder pointer check for NULL

Ratchanan Srirattanamet (1):
  drm/nouveau: don't detect DSM for non-NVIDIA device

Su Hui (1):
  drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow

 drivers/accel/qaic/qaic_drv.c   | 4 
 drivers/gpu/drm/bridge/ti-sn65dsi86.c   | 4 
 drivers/gpu/drm/nouveau/nouveau_acpi.c  | 3 +++
 drivers/gpu/drm/nouveau/nouveau_connector.c | 7 ---
 4 files changed, 15 insertions(+), 3 deletions(-)


Re: [Intel-gfx] [PATCH] drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Tvrtko Ursulin



On 16/06/2023 11:16, Andi Shyti wrote:

Hi Arnd,

On Fri, Jun 16, 2023 at 11:31:47AM +0200, Arnd Bergmann wrote:

From: Arnd Bergmann 

The function is only defined if CONFIG_PROC_FS is enabled:

ld.lld: error: undefined symbol: i915_drm_client_fdinfo

referenced by i915_driver.c
   drivers/gpu/drm/i915/i915_driver.o:(i915_drm_driver) in archive 
vmlinux.a


Use the PTR_IF() helper to make the reference NULL otherwise.

Fixes: e894b724c316d ("drm/i915: Use the fdinfo helper")
Signed-off-by: Arnd Bergmann 
---
  drivers/gpu/drm/i915/i915_driver.c | 2 +-
  drivers/gpu/drm/i915/i915_drm_client.h | 2 --
  2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_driver.c 
b/drivers/gpu/drm/i915/i915_driver.c
index 75cbc43b326dd..0ad0c5885ec27 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1816,7 +1816,7 @@ static const struct drm_driver i915_drm_driver = {
.open = i915_driver_open,
.lastclose = i915_driver_lastclose,
.postclose = i915_driver_postclose,
-   .show_fdinfo = i915_drm_client_fdinfo,
+   .show_fdinfo = PTR_IF(IS_ENABLED(CONFIG_PROC_FS), 
i915_drm_client_fdinfo),
  
  	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,

.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/i915/i915_drm_client.h 
b/drivers/gpu/drm/i915/i915_drm_client.h
index 4c18b99e10a4e..67816c912bca1 100644
--- a/drivers/gpu/drm/i915/i915_drm_client.h
+++ b/drivers/gpu/drm/i915/i915_drm_client.h
@@ -47,8 +47,6 @@ static inline void i915_drm_client_put(struct i915_drm_client 
*client)
  
  struct i915_drm_client *i915_drm_client_alloc(void);
  
-#ifdef CONFIG_PROC_FS

  void i915_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
-#endif


nice! This is becoming the new trend now.

Reviewed-by: Andi Shyti 


Thanks for the fix and review! (And I got to learn about existence of 
PTR_IF too.)


Andi will you merge once green or should I?

Regards,

Tvrtko


[Intel-gfx] ✓ Fi.CI.BAT: success for Enhance vfio PCI hot reset for vfio cdev device (rev8)

2023-06-16 Thread Patchwork
== Series Details ==

Series: Enhance vfio PCI hot reset for vfio cdev device (rev8)
URL   : https://patchwork.freedesktop.org/series/116991/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13277 -> Patchwork_116991v8


Summary
---

  **SUCCESS**

  No regressions found.

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

Participating hosts (41 -> 41)
--

  Additional (2): bat-rpls-2 bat-atsm-1 
  Missing(2): fi-snb-2520m fi-pnv-d510 

Known issues


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

### CI changes ###

 Possible fixes 

  * boot:
- fi-elk-e7500:   [FAIL][1] ([i915#8293]) -> [PASS][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/fi-elk-e7500/boot.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/fi-elk-e7500/boot.html

  

### IGT changes ###

 Issues hit 

  * igt@debugfs_test@basic-hwmon:
- bat-rpls-2: NOTRUN -> [SKIP][3] ([i915#7456])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@debugfs_t...@basic-hwmon.html

  * igt@fbdev@read:
- bat-rpls-2: NOTRUN -> [SKIP][4] ([i915#2582]) +4 similar issues
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@fb...@read.html

  * igt@gem_exec_suspend@basic-s0@smem:
- bat-jsl-1:  [PASS][5] -> [ABORT][6] ([i915#5122])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/bat-jsl-1/igt@gem_exec_suspend@basic...@smem.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-jsl-1/igt@gem_exec_suspend@basic...@smem.html

  * igt@gem_lmem_swapping@verify-random:
- bat-rpls-2: NOTRUN -> [SKIP][7] ([i915#4613]) +3 similar issues
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@gem_lmem_swapp...@verify-random.html

  * igt@gem_mmap@basic:
- bat-atsm-1: NOTRUN -> [SKIP][8] ([i915#4083])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-atsm-1/igt@gem_m...@basic.html

  * igt@gem_render_tiled_blits@basic:
- bat-atsm-1: NOTRUN -> [SKIP][9] ([i915#4079]) +1 similar issue
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-atsm-1/igt@gem_render_tiled_bl...@basic.html

  * igt@gem_tiled_fence_blits@basic:
- bat-atsm-1: NOTRUN -> [SKIP][10] ([i915#4077]) +2 similar issues
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-atsm-1/igt@gem_tiled_fence_bl...@basic.html

  * igt@gem_tiled_pread_basic:
- bat-rpls-2: NOTRUN -> [SKIP][11] ([i915#3282])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@gem_tiled_pread_basic.html

  * igt@i915_pm_backlight@basic-brightness:
- bat-rpls-2: NOTRUN -> [SKIP][12] ([i915#7561])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@i915_pm_backli...@basic-brightness.html

  * igt@i915_pm_rps@basic-api:
- bat-rpls-2: NOTRUN -> [SKIP][13] ([i915#6621])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@i915_pm_...@basic-api.html
- bat-atsm-1: NOTRUN -> [SKIP][14] ([i915#6621])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-atsm-1/igt@i915_pm_...@basic-api.html

  * igt@i915_selftest@live@gt_heartbeat:
- fi-apl-guc: [PASS][15] -> [DMESG-FAIL][16] ([i915#5334])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@gt_mocs:
- bat-mtlp-8: [PASS][17] -> [DMESG-FAIL][18] ([i915#7059])
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html
- bat-mtlp-6: [PASS][19] -> [DMESG-FAIL][20] ([i915#7059])
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html

  * igt@i915_selftest@live@gt_pm:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][21] ([i915#4258] / [i915#7913])
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-WARN][22] ([i915#6367])
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_116991v8/bat-rpls-2/igt@i915_selftest@l...@slpc.html

  * igt@i915_suspend@basic-s2idle-without-i915:
- bat-rpls-2:   

Re: [Intel-gfx] [PATCH] drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Andi Shyti
Hi Arnd,

On Fri, Jun 16, 2023 at 11:31:47AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann 
> 
> The function is only defined if CONFIG_PROC_FS is enabled:
> 
> ld.lld: error: undefined symbol: i915_drm_client_fdinfo
> >>> referenced by i915_driver.c
> >>>   drivers/gpu/drm/i915/i915_driver.o:(i915_drm_driver) in 
> >>> archive vmlinux.a
> 
> Use the PTR_IF() helper to make the reference NULL otherwise.
> 
> Fixes: e894b724c316d ("drm/i915: Use the fdinfo helper")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/gpu/drm/i915/i915_driver.c | 2 +-
>  drivers/gpu/drm/i915/i915_drm_client.h | 2 --
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_driver.c 
> b/drivers/gpu/drm/i915/i915_driver.c
> index 75cbc43b326dd..0ad0c5885ec27 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1816,7 +1816,7 @@ static const struct drm_driver i915_drm_driver = {
>   .open = i915_driver_open,
>   .lastclose = i915_driver_lastclose,
>   .postclose = i915_driver_postclose,
> - .show_fdinfo = i915_drm_client_fdinfo,
> + .show_fdinfo = PTR_IF(IS_ENABLED(CONFIG_PROC_FS), 
> i915_drm_client_fdinfo),
>  
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> diff --git a/drivers/gpu/drm/i915/i915_drm_client.h 
> b/drivers/gpu/drm/i915/i915_drm_client.h
> index 4c18b99e10a4e..67816c912bca1 100644
> --- a/drivers/gpu/drm/i915/i915_drm_client.h
> +++ b/drivers/gpu/drm/i915/i915_drm_client.h
> @@ -47,8 +47,6 @@ static inline void i915_drm_client_put(struct 
> i915_drm_client *client)
>  
>  struct i915_drm_client *i915_drm_client_alloc(void);
>  
> -#ifdef CONFIG_PROC_FS
>  void i915_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
> -#endif

nice! This is becoming the new trend now.

Reviewed-by: Andi Shyti  

Andi


[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Enhance vfio PCI hot reset for vfio cdev device (rev8)

2023-06-16 Thread Patchwork
== Series Details ==

Series: Enhance vfio PCI hot reset for vfio cdev device (rev8)
URL   : https://patchwork.freedesktop.org/series/116991/
State : warning

== Summary ==

Error: dim checkpatch failed
bbf7d5109b70 vfio/pci: Update comment around group_fd get in 
vfio_pci_ioctl_pci_hot_reset()
20a69119fe6e vfio/pci: Move the existing hot reset logic to be a helper
-:6: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#6: 
This prepares to add another method for hot reset. The major hot reset logic

total: 0 errors, 1 warnings, 0 checks, 99 lines checked
5827269728db iommufd: Reserve all negative IDs in the iommufd xarray
7f95aa488081 iommufd: Add iommufd_ctx_has_group()
fe3e3a790452 iommufd: Add helper to retrieve iommufd_ctx and devid
97e3dbafa2d7 vfio: Mark cdev usage in vfio_device
-:8: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description 
(prefer a maximum 75 chars per line)
#8: 
cdev path yet, so the vfio_device_cdev_opened() helper always returns false.

total: 0 errors, 1 warnings, 0 checks, 11 lines checked
046903816932 vfio: Add helper to search vfio_device in a dev_set
8d8bcf84cee9 vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio 
device cdev
5f281038039a vfio/pci: Copy hot-reset device info to userspace in the devices 
loop
f4eff917ccab vfio/pci: Allow passing zero-length fd array in 
VFIO_DEVICE_PCI_HOT_RESET




[Intel-gfx] ✗ Fi.CI.IGT: failure for Remove incorrect hard coded cache coherrency setting

2023-06-16 Thread Patchwork
== Series Details ==

Series: Remove incorrect hard coded cache coherrency setting
URL   : https://patchwork.freedesktop.org/series/119418/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13277_full -> Patchwork_119418v1_full


Summary
---

  **FAILURE**

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

  

Participating hosts (7 -> 8)
--

  Additional (1): shard-rkl0 

Possible new issues
---

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

### IGT changes ###

 Possible regressions 

  * igt@kms_plane_lowres@tiling-y@pipe-a-hdmi-a-1:
- shard-glk:  [PASS][1] -> [INCOMPLETE][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk3/igt@kms_plane_lowres@tilin...@pipe-a-hdmi-a-1.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-glk3/igt@kms_plane_lowres@tilin...@pipe-a-hdmi-a-1.html

  
Known issues


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

### IGT changes ###

 Issues hit 

  * igt@drm_fdinfo@most-busy-idle-check-all@rcs0:
- shard-rkl:  [PASS][3] -> [FAIL][4] ([i915#7742])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-6/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-rkl-4/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html

  * igt@gem_barrier_race@remote-request@rcs0:
- shard-tglu: [PASS][5] -> [ABORT][6] ([i915#8211] / [i915#8234])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-9/igt@gem_barrier_race@remote-requ...@rcs0.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-tglu-8/igt@gem_barrier_race@remote-requ...@rcs0.html

  * igt@gem_eio@suspend:
- shard-snb:  [PASS][7] -> [INCOMPLETE][8] ([i915#7850])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-snb2/igt@gem_...@suspend.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-snb5/igt@gem_...@suspend.html

  * igt@gem_exec_fair@basic-none-solo@rcs0:
- shard-apl:  [PASS][9] -> [FAIL][10] ([i915#2842])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-apl7/igt@gem_exec_fair@basic-none-s...@rcs0.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-apl4/igt@gem_exec_fair@basic-none-s...@rcs0.html

  * igt@gem_exec_fair@basic-none@vcs0:
- shard-rkl:  [PASS][11] -> [FAIL][12] ([i915#2842])
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-1/igt@gem_exec_fair@basic-n...@vcs0.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-rkl-4/igt@gem_exec_fair@basic-n...@vcs0.html

  * igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk:  [PASS][13] -> [FAIL][14] ([i915#2842])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk1/igt@gem_exec_fair@basic-pace-sh...@rcs0.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-glk7/igt@gem_exec_fair@basic-pace-sh...@rcs0.html

  * igt@gem_lmem_swapping@heavy-verify-multi-ccs:
- shard-glk:  NOTRUN -> [SKIP][15] ([fdo#109271] / [i915#4613])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-glk9/igt@gem_lmem_swapp...@heavy-verify-multi-ccs.html

  * igt@gen9_exec_parse@allowed-single:
- shard-apl:  [PASS][16] -> [ABORT][17] ([i915#5566])
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-apl2/igt@gen9_exec_pa...@allowed-single.html
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-apl6/igt@gen9_exec_pa...@allowed-single.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-tglu: [PASS][18] -> [FAIL][19] ([i915#3989] / [i915#454])
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-4/igt@i915_pm...@dc6-dpms.html
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-tglu-6/igt@i915_pm...@dc6-dpms.html

  * igt@i915_pm_dc@dc9-dpms:
- shard-tglu: [PASS][20] -> [SKIP][21] ([i915#4281])
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-9/igt@i915_pm...@dc9-dpms.html
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119418v1/shard-tglu-8/igt@i915_pm...@dc9-dpms.html

  * igt@i915_pm_rpm@modeset-non-lpsp-stress:
- shard-rkl:  [PASS][22] -> [SKIP][23] ([i915#1397]) +1 similar 
issue
   [22]: 

[Intel-gfx] [PATCH v13 22/22] docs: vfio: Add vfio device cdev description

2023-06-16 Thread Yi Liu
This gives notes for userspace applications on device cdev usage.

Reviewed-by: Kevin Tian 
Signed-off-by: Yi Liu 
---
 Documentation/driver-api/vfio.rst | 139 ++
 1 file changed, 139 insertions(+)

diff --git a/Documentation/driver-api/vfio.rst 
b/Documentation/driver-api/vfio.rst
index 363e12c90b87..633d11c7fa71 100644
--- a/Documentation/driver-api/vfio.rst
+++ b/Documentation/driver-api/vfio.rst
@@ -239,6 +239,137 @@ group and can access them as follows::
/* Gratuitous device reset and go... */
ioctl(device, VFIO_DEVICE_RESET);
 
+IOMMUFD and vfio_iommu_type1
+
+
+IOMMUFD is the new user API to manage I/O page tables from userspace.
+It intends to be the portal of delivering advanced userspace DMA
+features (nested translation [5]_, PASID [6]_, etc.) while also providing
+a backwards compatibility interface for existing VFIO_TYPE1v2_IOMMU use
+cases.  Eventually the vfio_iommu_type1 driver, as well as the legacy
+vfio container and group model is intended to be deprecated.
+
+The IOMMUFD backwards compatibility interface can be enabled two ways.
+In the first method, the kernel can be configured with
+CONFIG_IOMMUFD_VFIO_CONTAINER, in which case the IOMMUFD subsystem
+transparently provides the entire infrastructure for the VFIO
+container and IOMMU backend interfaces.  The compatibility mode can
+also be accessed if the VFIO container interface, ie. /dev/vfio/vfio is
+simply symlink'd to /dev/iommu.  Note that at the time of writing, the
+compatibility mode is not entirely feature complete relative to
+VFIO_TYPE1v2_IOMMU (ex. DMA mapping MMIO) and does not attempt to
+provide compatibility to the VFIO_SPAPR_TCE_IOMMU interface.  Therefore
+it is not generally advisable at this time to switch from native VFIO
+implementations to the IOMMUFD compatibility interfaces.
+
+Long term, VFIO users should migrate to device access through the cdev
+interface described below, and native access through the IOMMUFD
+provided interfaces.
+
+VFIO Device cdev
+
+
+Traditionally user acquires a device fd via VFIO_GROUP_GET_DEVICE_FD
+in a VFIO group.
+
+With CONFIG_VFIO_DEVICE_CDEV=y the user can now acquire a device fd
+by directly opening a character device /dev/vfio/devices/vfioX where
+"X" is the number allocated uniquely by VFIO for registered devices.
+cdev interface does not support noiommu devices, so user should use
+the legacy group interface if noiommu is wanted.
+
+The cdev only works with IOMMUFD.  Both VFIO drivers and applications
+must adapt to the new cdev security model which requires using
+VFIO_DEVICE_BIND_IOMMUFD to claim DMA ownership before starting to
+actually use the device.  Once BIND succeeds then a VFIO device can
+be fully accessed by the user.
+
+VFIO device cdev doesn't rely on VFIO group/container/iommu drivers.
+Hence those modules can be fully compiled out in an environment
+where no legacy VFIO application exists.
+
+So far SPAPR does not support IOMMUFD yet.  So it cannot support device
+cdev either.
+
+vfio device cdev access is still bound by IOMMU group semantics, ie. there
+can be only one DMA owner for the group.  Devices belonging to the same
+group can not be bound to multiple iommufd_ctx or shared between native
+kernel and vfio bus driver or other driver supporting the driver_managed_dma
+flag.  A violation of this ownership requirement will fail at the
+VFIO_DEVICE_BIND_IOMMUFD ioctl, which gates full device access.
+
+Device cdev Example
+---
+
+Assume user wants to access PCI device :6a:01.0::
+
+   $ ls /sys/bus/pci/devices/:6a:01.0/vfio-dev/
+   vfio0
+
+This device is therefore represented as vfio0.  The user can verify
+its existence::
+
+   $ ls -l /dev/vfio/devices/vfio0
+   crw--- 1 root root 511, 0 Feb 16 01:22 /dev/vfio/devices/vfio0
+   $ cat /sys/bus/pci/devices/:6a:01.0/vfio-dev/vfio0/dev
+   511:0
+   $ ls -l /dev/char/511\:0
+   lrwxrwxrwx 1 root root 21 Feb 16 01:22 /dev/char/511:0 -> 
../vfio/devices/vfio0
+
+Then provide the user with access to the device if unprivileged
+operation is desired::
+
+   $ chown user:user /dev/vfio/devices/vfio0
+
+Finally the user could get cdev fd by::
+
+   cdev_fd = open("/dev/vfio/devices/vfio0", O_RDWR);
+
+An opened cdev_fd doesn't give the user any permission of accessing
+the device except binding the cdev_fd to an iommufd.  After that point
+then the device is fully accessible including attaching it to an
+IOMMUFD IOAS/HWPT to enable userspace DMA::
+
+   struct vfio_device_bind_iommufd bind = {
+   .argsz = sizeof(bind),
+   .flags = 0,
+   };
+   struct iommu_ioas_alloc alloc_data  = {
+   .size = sizeof(alloc_data),
+   .flags = 0,
+   };
+   struct vfio_device_attach_iommufd_pt attach_data = {
+   .argsz = sizeof(attach_data),
+   .flags = 0,
+   };
+   

[Intel-gfx] [PATCH v13 19/22] vfio: Add VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT

2023-06-16 Thread Yi Liu
This adds ioctl for userspace to attach device cdev fd to and detach
from IOAS/hw_pagetable managed by iommufd.

VFIO_DEVICE_ATTACH_IOMMUFD_PT: attach vfio device to IOAS, hw_pagetable
   managed by iommufd. Attach can be
   undo by VFIO_DEVICE_DETACH_IOMMUFD_PT
   or device fd close.
VFIO_DEVICE_DETACH_IOMMUFD_PT: detach vfio device from the current attached
   IOAS or hw_pagetable managed by iommufd.

Only allowed on cdev fds.  cdev does not support noiommu devices, hence
noiommu devices do not support [AT|DE]TACH.

Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Tested-by: Terrence Xu 
Signed-off-by: Yi Liu 
---
 drivers/vfio/device_cdev.c | 66 ++
 drivers/vfio/vfio.h| 16 +
 drivers/vfio/vfio_main.c   |  8 +
 include/uapi/linux/vfio.h  | 44 +
 4 files changed, 134 insertions(+)

diff --git a/drivers/vfio/device_cdev.c b/drivers/vfio/device_cdev.c
index a4498ddbe774..6e1d499ee160 100644
--- a/drivers/vfio/device_cdev.c
+++ b/drivers/vfio/device_cdev.c
@@ -167,6 +167,72 @@ long vfio_df_ioctl_bind_iommufd(struct vfio_device_file 
*df,
return ret;
 }
 
+int vfio_df_ioctl_attach_pt(struct vfio_device_file *df,
+   struct vfio_device_attach_iommufd_pt __user *arg)
+{
+   struct vfio_device *device = df->device;
+   struct vfio_device_attach_iommufd_pt attach;
+   unsigned long minsz;
+   int ret;
+
+   minsz = offsetofend(struct vfio_device_attach_iommufd_pt, pt_id);
+
+   if (copy_from_user(, arg, minsz))
+   return -EFAULT;
+
+   if (attach.argsz < minsz || attach.flags)
+   return -EINVAL;
+
+   /* ATTACH only allowed for cdev fds */
+   if (df->group)
+   return -EINVAL;
+
+   mutex_lock(>dev_set->lock);
+   ret = device->ops->attach_ioas(device, _id);
+   if (ret)
+   goto out_unlock;
+
+   ret = copy_to_user(>pt_id, _id,
+  sizeof(attach.pt_id)) ? -EFAULT : 0;
+   if (ret)
+   goto out_detach;
+   mutex_unlock(>dev_set->lock);
+
+   return 0;
+
+out_detach:
+   device->ops->detach_ioas(device);
+out_unlock:
+   mutex_unlock(>dev_set->lock);
+   return ret;
+}
+
+int vfio_df_ioctl_detach_pt(struct vfio_device_file *df,
+   struct vfio_device_detach_iommufd_pt __user *arg)
+{
+   struct vfio_device *device = df->device;
+   struct vfio_device_detach_iommufd_pt detach;
+   unsigned long minsz;
+
+   minsz = offsetofend(struct vfio_device_detach_iommufd_pt, flags);
+
+   if (copy_from_user(, arg, minsz))
+   return -EFAULT;
+
+   if (detach.argsz < minsz || detach.flags)
+   return -EINVAL;
+
+   /* DETACH only allowed for cdev fds */
+   if (df->group)
+   return -EINVAL;
+
+   mutex_lock(>dev_set->lock);
+   device->ops->detach_ioas(device);
+   mutex_unlock(>dev_set->lock);
+
+   return 0;
+}
+
 static char *vfio_device_devnode(const struct device *dev, umode_t *mode)
 {
return kasprintf(GFP_KERNEL, "vfio/devices/%s", dev_name(dev));
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index a6e7cf6793fd..e7a3fe093362 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -290,6 +290,10 @@ int vfio_device_fops_cdev_open(struct inode *inode, struct 
file *filep);
 void vfio_df_cdev_close(struct vfio_device_file *df);
 long vfio_df_ioctl_bind_iommufd(struct vfio_device_file *df,
struct vfio_device_bind_iommufd __user *arg);
+int vfio_df_ioctl_attach_pt(struct vfio_device_file *df,
+   struct vfio_device_attach_iommufd_pt __user *arg);
+int vfio_df_ioctl_detach_pt(struct vfio_device_file *df,
+   struct vfio_device_detach_iommufd_pt __user *arg);
 int vfio_cdev_init(struct class *device_class);
 void vfio_cdev_cleanup(void);
 #else
@@ -323,6 +327,18 @@ static inline long vfio_df_ioctl_bind_iommufd(struct 
vfio_device_file *df,
return -EOPNOTSUPP;
 }
 
+static inline int vfio_df_ioctl_attach_pt(struct vfio_device_file *df,
+ struct vfio_device_attach_iommufd_pt 
__user *arg)
+{
+   return -EOPNOTSUPP;
+}
+
+static inline int vfio_df_ioctl_detach_pt(struct vfio_device_file *df,
+ struct vfio_device_detach_iommufd_pt 
__user *arg)
+{
+   return -EOPNOTSUPP;
+}
+
 static inline int vfio_cdev_init(struct class *device_class)
 {
return 0;
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 83ddd9f515ac..51c80eb32af6 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -1163,6 +1163,14 @@ static long 

[Intel-gfx] [PATCH v13 21/22] vfio: Compile vfio_group infrastructure optionally

2023-06-16 Thread Yi Liu
vfio_group is not needed for vfio device cdev, so with vfio device cdev
introduced, the vfio_group infrastructures can be compiled out if only
cdev is needed.

Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Tested-by: Terrence Xu 
Signed-off-by: Yi Liu 
---
 drivers/iommu/iommufd/Kconfig |  4 +-
 drivers/vfio/Kconfig  | 15 ++
 drivers/vfio/Makefile |  2 +-
 drivers/vfio/vfio.h   | 89 ---
 include/linux/vfio.h  | 25 --
 5 files changed, 123 insertions(+), 12 deletions(-)

diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
index ada693ea51a7..99d4b075df49 100644
--- a/drivers/iommu/iommufd/Kconfig
+++ b/drivers/iommu/iommufd/Kconfig
@@ -14,8 +14,8 @@ config IOMMUFD
 if IOMMUFD
 config IOMMUFD_VFIO_CONTAINER
bool "IOMMUFD provides the VFIO container /dev/vfio/vfio"
-   depends on VFIO && !VFIO_CONTAINER
-   default VFIO && !VFIO_CONTAINER
+   depends on VFIO_GROUP && !VFIO_CONTAINER
+   default VFIO_GROUP && !VFIO_CONTAINER
help
  IOMMUFD will provide /dev/vfio/vfio instead of VFIO. This relies on
  IOMMUFD providing compatibility emulation to give the same ioctls.
diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
index 1cab8e4729de..35ab8ab87688 100644
--- a/drivers/vfio/Kconfig
+++ b/drivers/vfio/Kconfig
@@ -4,6 +4,8 @@ menuconfig VFIO
select IOMMU_API
depends on IOMMUFD || !IOMMUFD
select INTERVAL_TREE
+   select VFIO_GROUP if SPAPR_TCE_IOMMU || IOMMUFD=n
+   select VFIO_DEVICE_CDEV if !VFIO_GROUP
select VFIO_CONTAINER if IOMMUFD=n
help
  VFIO provides a framework for secure userspace device drivers.
@@ -15,6 +17,7 @@ if VFIO
 config VFIO_DEVICE_CDEV
bool "Support for the VFIO cdev /dev/vfio/devices/vfioX"
depends on IOMMUFD
+   default !VFIO_GROUP
help
  The VFIO device cdev is another way for userspace to get device
  access. Userspace gets device fd by opening device cdev under
@@ -24,9 +27,20 @@ config VFIO_DEVICE_CDEV
 
  If you don't know what to do here, say N.
 
+config VFIO_GROUP
+   bool "Support for the VFIO group /dev/vfio/$group_id"
+   default y
+   help
+  VFIO group support provides the traditional model for accessing
+  devices through VFIO and is used by the majority of userspace
+  applications and drivers making use of VFIO.
+
+  If you don't know what to do here, say Y.
+
 config VFIO_CONTAINER
bool "Support for the VFIO container /dev/vfio/vfio"
select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
+   depends on VFIO_GROUP
default y
help
  The VFIO container is the classic interface to VFIO for establishing
@@ -48,6 +62,7 @@ endif
 
 config VFIO_NOIOMMU
bool "VFIO No-IOMMU support"
+   depends on VFIO_GROUP
help
  VFIO is built on the ability to isolate devices using the IOMMU.
  Only with an IOMMU can userspace access to DMA capable devices be
diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile
index 245394aeb94b..57c3515af606 100644
--- a/drivers/vfio/Makefile
+++ b/drivers/vfio/Makefile
@@ -2,9 +2,9 @@
 obj-$(CONFIG_VFIO) += vfio.o
 
 vfio-y += vfio_main.o \
- group.o \
  iova_bitmap.o
 vfio-$(CONFIG_VFIO_DEVICE_CDEV) += device_cdev.o
+vfio-$(CONFIG_VFIO_GROUP) += group.o
 vfio-$(CONFIG_IOMMUFD) += iommufd.o
 vfio-$(CONFIG_VFIO_CONTAINER) += container.o
 vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index e7a3fe093362..b27a3915e6c9 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -36,6 +36,12 @@ vfio_allocate_device_file(struct vfio_device *device);
 
 extern const struct file_operations vfio_device_fops;
 
+#ifdef CONFIG_VFIO_NOIOMMU
+extern bool vfio_noiommu __read_mostly;
+#else
+enum { vfio_noiommu = false };
+#endif
+
 enum vfio_group_type {
/*
 * Physical device with IOMMU backing.
@@ -60,6 +66,7 @@ enum vfio_group_type {
VFIO_NO_IOMMU,
 };
 
+#if IS_ENABLED(CONFIG_VFIO_GROUP)
 struct vfio_group {
struct device   dev;
struct cdev cdev;
@@ -111,6 +118,82 @@ static inline bool vfio_device_is_noiommu(struct 
vfio_device *vdev)
return IS_ENABLED(CONFIG_VFIO_NOIOMMU) &&
   vdev->group->type == VFIO_NO_IOMMU;
 }
+#else
+struct vfio_group;
+
+static inline int vfio_device_block_group(struct vfio_device *device)
+{
+   return 0;
+}
+
+static inline void vfio_device_unblock_group(struct vfio_device *device)
+{
+}
+
+static inline int vfio_device_set_group(struct vfio_device *device,
+   enum vfio_group_type type)
+{
+   return 0;
+}
+
+static inline void vfio_device_remove_group(struct vfio_device *device)
+{
+}
+

[Intel-gfx] [PATCH v13 20/22] vfio: Move the IOMMU_CAP_CACHE_COHERENCY check in __vfio_register_dev()

2023-06-16 Thread Yi Liu
The IOMMU_CAP_CACHE_COHERENCY check only applies to the physical devices
that are IOMMU-backed. But it is now in the group code. If want to compile
vfio_group infrastructure out, this check needs to be moved out of the group
code.

Another reason for this change is to fail the device registration for the
physical devices that do not have IOMMU if the group code is not compiled
as the cdev interface does not support such devices.

Suggested-by: Jason Gunthorpe 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c | 10 --
 drivers/vfio/vfio_main.c | 11 +++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 41a09a2df690..c2e0128323a7 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -687,16 +687,6 @@ static struct vfio_group *vfio_group_find_or_alloc(struct 
device *dev)
if (!iommu_group)
return ERR_PTR(-EINVAL);
 
-   /*
-* VFIO always sets IOMMU_CACHE because we offer no way for userspace to
-* restore cache coherency. It has to be checked here because it is only
-* valid for cases where we are using iommu groups.
-*/
-   if (!device_iommu_capable(dev, IOMMU_CAP_CACHE_COHERENCY)) {
-   iommu_group_put(iommu_group);
-   return ERR_PTR(-EINVAL);
-   }
-
mutex_lock(_lock);
group = vfio_group_find_from_iommu(iommu_group);
if (group) {
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 51c80eb32af6..ffb4585b7f0e 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -292,6 +292,17 @@ static int __vfio_register_dev(struct vfio_device *device,
if (ret)
return ret;
 
+   /*
+* VFIO always sets IOMMU_CACHE because we offer no way for userspace to
+* restore cache coherency. It has to be checked here because it is only
+* valid for cases where we are using iommu groups.
+*/
+   if (type == VFIO_IOMMU && !vfio_device_is_noiommu(device) &&
+   !device_iommu_capable(device->dev, IOMMU_CAP_CACHE_COHERENCY)) {
+   ret = -EINVAL;
+   goto err_out;
+   }
+
ret = vfio_device_add(device);
if (ret)
goto err_out;
-- 
2.34.1



[Intel-gfx] [PATCH v13 18/22] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-06-16 Thread Yi Liu
This adds ioctl for userspace to bind device cdev fd to iommufd.

VFIO_DEVICE_BIND_IOMMUFD: bind device to an iommufd, hence gain DMA
  control provided by the iommufd. open_device
  op is called after bind_iommufd op.

Only allowed on cdev fds.  cdev does not support noiommu devices, hence
noiommu devices do not support BIND.

Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Tested-by: Terrence Xu 
Signed-off-by: Yi Liu 
---
 drivers/vfio/device_cdev.c | 123 +
 drivers/vfio/vfio.h|  13 
 drivers/vfio/vfio_main.c   |   5 ++
 include/linux/vfio.h   |   5 +-
 include/uapi/linux/vfio.h  |  27 
 5 files changed, 171 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/device_cdev.c b/drivers/vfio/device_cdev.c
index 1c640016a824..a4498ddbe774 100644
--- a/drivers/vfio/device_cdev.c
+++ b/drivers/vfio/device_cdev.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2023 Intel Corporation.
  */
 #include 
+#include 
 
 #include "vfio.h"
 
@@ -44,6 +45,128 @@ int vfio_device_fops_cdev_open(struct inode *inode, struct 
file *filep)
return ret;
 }
 
+static void vfio_device_get_kvm_safe(struct vfio_device_file *df)
+{
+   spin_lock(>kvm_ref_lock);
+   if (df->kvm)
+   _vfio_device_get_kvm_safe(df->device, df->kvm);
+   spin_unlock(>kvm_ref_lock);
+}
+
+void vfio_df_cdev_close(struct vfio_device_file *df)
+{
+   struct vfio_device *device = df->device;
+
+   /*
+* In the time of close, there is no contention with another one
+* changing this flag.  So read df->access_granted without lock
+* and no smp_load_acquire() is ok.
+*/
+   if (!df->access_granted)
+   return;
+
+   mutex_lock(>dev_set->lock);
+   vfio_df_close(df);
+   vfio_device_put_kvm(device);
+   iommufd_ctx_put(df->iommufd);
+   device->cdev_opened = false;
+   mutex_unlock(>dev_set->lock);
+   vfio_device_unblock_group(device);
+}
+
+static struct iommufd_ctx *vfio_get_iommufd_from_fd(int fd)
+{
+   struct iommufd_ctx *iommufd;
+   struct fd f;
+
+   f = fdget(fd);
+   if (!f.file)
+   return ERR_PTR(-EBADF);
+
+   iommufd = iommufd_ctx_from_file(f.file);
+
+   fdput(f);
+   return iommufd;
+}
+
+long vfio_df_ioctl_bind_iommufd(struct vfio_device_file *df,
+   struct vfio_device_bind_iommufd __user *arg)
+{
+   struct vfio_device *device = df->device;
+   struct vfio_device_bind_iommufd bind;
+   unsigned long minsz;
+   int ret;
+
+   static_assert(__same_type(arg->out_devid, df->devid));
+
+   minsz = offsetofend(struct vfio_device_bind_iommufd, out_devid);
+
+   if (copy_from_user(, arg, minsz))
+   return -EFAULT;
+
+   if (bind.argsz < minsz || bind.flags || bind.iommufd < 0)
+   return -EINVAL;
+
+   /* BIND_IOMMUFD only allowed for cdev fds */
+   if (df->group)
+   return -EINVAL;
+
+   ret = vfio_device_block_group(device);
+   if (ret)
+   return ret;
+
+   mutex_lock(>dev_set->lock);
+   /* one device cannot be bound twice */
+   if (df->access_granted) {
+   ret = -EINVAL;
+   goto out_unlock;
+   }
+
+   df->iommufd = vfio_get_iommufd_from_fd(bind.iommufd);
+   if (IS_ERR(df->iommufd)) {
+   ret = PTR_ERR(df->iommufd);
+   df->iommufd = NULL;
+   goto out_unlock;
+   }
+
+   /*
+* Before the device open, get the KVM pointer currently
+* associated with the device file (if there is) and obtain
+* a reference.  This reference is held until device closed.
+* Save the pointer in the device for use by drivers.
+*/
+   vfio_device_get_kvm_safe(df);
+
+   ret = vfio_df_open(df);
+   if (ret)
+   goto out_put_kvm;
+
+   ret = copy_to_user(>out_devid, >devid,
+  sizeof(df->devid)) ? -EFAULT : 0;
+   if (ret)
+   goto out_close_device;
+
+   /*
+* Paired with smp_load_acquire() in vfio_device_fops::ioctl/
+* read/write/mmap
+*/
+   smp_store_release(>access_granted, true);
+   device->cdev_opened = true;
+   mutex_unlock(>dev_set->lock);
+   return 0;
+
+out_close_device:
+   vfio_df_close(df);
+out_put_kvm:
+   vfio_device_put_kvm(device);
+   iommufd_ctx_put(df->iommufd);
+   df->iommufd = NULL;
+out_unlock:
+   mutex_unlock(>dev_set->lock);
+   vfio_device_unblock_group(device);
+   return ret;
+}
+
 static char *vfio_device_devnode(const struct device *dev, umode_t *mode)
 {
return kasprintf(GFP_KERNEL, "vfio/devices/%s", dev_name(dev));
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index fb8f2fac3d23..a6e7cf6793fd 100644

[Intel-gfx] [PATCH v13 17/22] vfio: Add cdev for vfio_device

2023-06-16 Thread Yi Liu
This allows user to directly open a vfio device w/o using the legacy
container/group interface, as a prerequisite for supporting new iommu
features like nested translation.

The device fd opened in this manner doesn't have the capability to access
the device as the fops open() doesn't open the device until the successful
BIND_IOMMUFD which be added in next patch.

With this patch, devices registered to vfio core have both group and device
interface created.

- group interface : /dev/vfio/$groupID
- device interface: /dev/vfio/devices/vfioX - normal device
("X" is the minor number and is unique across devices)

Given a vfio device the user can identify the matching vfioX by checking
the sysfs path of the device. Take PCI device (:6a:01.0) for example,
/sys/bus/pci/devices/\:6a\:01.0/vfio-dev/vfio0/dev contains the
major:minor of the matching vfioX.

Userspace then opens the /dev/vfio/devices/vfioX and checks with fstat
that the major:minor matches.

The vfio_device cdev logic in this patch:
*) __vfio_register_dev() path ends up doing cdev_device_add() for each
   vfio_device if VFIO_DEVICE_CDEV configured.
*) vfio_unregister_group_dev() path does cdev_device_del();

cdev interface does not support noiommu devices, so VFIO only registers
the group interface for the physcial devices that do not have IOMMU. noiommu
users should use the legacy group interface.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/Kconfig   | 12 
 drivers/vfio/Makefile  |  1 +
 drivers/vfio/device_cdev.c | 62 ++
 drivers/vfio/vfio.h| 54 +
 drivers/vfio/vfio_main.c   | 23 +++---
 include/linux/vfio.h   |  4 +++
 6 files changed, 151 insertions(+), 5 deletions(-)
 create mode 100644 drivers/vfio/device_cdev.c

diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
index 89e06c981e43..1cab8e4729de 100644
--- a/drivers/vfio/Kconfig
+++ b/drivers/vfio/Kconfig
@@ -12,6 +12,18 @@ menuconfig VFIO
  If you don't know what to do here, say N.
 
 if VFIO
+config VFIO_DEVICE_CDEV
+   bool "Support for the VFIO cdev /dev/vfio/devices/vfioX"
+   depends on IOMMUFD
+   help
+ The VFIO device cdev is another way for userspace to get device
+ access. Userspace gets device fd by opening device cdev under
+ /dev/vfio/devices/vfioX, and then bind the device fd with an iommufd
+ to set up secure DMA context for device access.  This interface does
+ not support noiommu.
+
+ If you don't know what to do here, say N.
+
 config VFIO_CONTAINER
bool "Support for the VFIO container /dev/vfio/vfio"
select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile
index 70e7dcb302ef..245394aeb94b 100644
--- a/drivers/vfio/Makefile
+++ b/drivers/vfio/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_VFIO) += vfio.o
 vfio-y += vfio_main.o \
  group.o \
  iova_bitmap.o
+vfio-$(CONFIG_VFIO_DEVICE_CDEV) += device_cdev.o
 vfio-$(CONFIG_IOMMUFD) += iommufd.o
 vfio-$(CONFIG_VFIO_CONTAINER) += container.o
 vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o
diff --git a/drivers/vfio/device_cdev.c b/drivers/vfio/device_cdev.c
new file mode 100644
index ..1c640016a824
--- /dev/null
+++ b/drivers/vfio/device_cdev.c
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2023 Intel Corporation.
+ */
+#include 
+
+#include "vfio.h"
+
+static dev_t device_devt;
+
+void vfio_init_device_cdev(struct vfio_device *device)
+{
+   device->device.devt = MKDEV(MAJOR(device_devt), device->index);
+   cdev_init(>cdev, _device_fops);
+   device->cdev.owner = THIS_MODULE;
+}
+
+/*
+ * device access via the fd opened by this function is blocked until
+ * .open_device() is called successfully during BIND_IOMMUFD.
+ */
+int vfio_device_fops_cdev_open(struct inode *inode, struct file *filep)
+{
+   struct vfio_device *device = container_of(inode->i_cdev,
+ struct vfio_device, cdev);
+   struct vfio_device_file *df;
+   int ret;
+
+   if (!vfio_device_try_get_registration(device))
+   return -ENODEV;
+
+   df = vfio_allocate_device_file(device);
+   if (IS_ERR(df)) {
+   ret = PTR_ERR(df);
+   goto err_put_registration;
+   }
+
+   filep->private_data = df;
+
+   return 0;
+
+err_put_registration:
+   vfio_device_put_registration(device);
+   return ret;
+}
+
+static char *vfio_device_devnode(const struct device *dev, umode_t *mode)
+{
+   return kasprintf(GFP_KERNEL, "vfio/devices/%s", dev_name(dev));
+}
+
+int vfio_cdev_init(struct class *device_class)
+{
+   device_class->devnode = vfio_device_devnode;

[Intel-gfx] [PATCH v13 16/22] vfio: Move vfio_device_group_unregister() to be the first operation in unregister

2023-06-16 Thread Yi Liu
This avoids endless vfio_device refcount increasement by userspace,
which would keep blocking the vfio_unregister_group_dev().

Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Tested-by: Terrence Xu 
Signed-off-by: Yi Liu 
---
 drivers/vfio/vfio_main.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index c71c0d1a079f..6d45caa1f9a0 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -332,6 +332,12 @@ void vfio_unregister_group_dev(struct vfio_device *device)
bool interrupted = false;
long rc;
 
+   /*
+* Prevent new device opened by userspace via the
+* VFIO_GROUP_GET_DEVICE_FD in the group path.
+*/
+   vfio_device_group_unregister(device);
+
vfio_device_put_registration(device);
rc = try_wait_for_completion(>comp);
while (rc <= 0) {
@@ -355,8 +361,6 @@ void vfio_unregister_group_dev(struct vfio_device *device)
}
}
 
-   vfio_device_group_unregister(device);
-
/* Balances device_add in register path */
device_del(>device);
 
-- 
2.34.1



[Intel-gfx] [PATCH v13 15/22] vfio-iommufd: Add detach_ioas support for emulated VFIO devices

2023-06-16 Thread Yi Liu
This prepares for adding DETACH ioctl for emulated VFIO devices.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/gpu/drm/i915/gvt/kvmgt.c  |  1 +
 drivers/s390/cio/vfio_ccw_ops.c   |  1 +
 drivers/s390/crypto/vfio_ap_ops.c |  1 +
 drivers/vfio/iommufd.c| 13 +
 include/linux/vfio.h  |  3 +++
 samples/vfio-mdev/mbochs.c|  1 +
 samples/vfio-mdev/mdpy.c  |  1 +
 samples/vfio-mdev/mtty.c  |  1 +
 8 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index de675d799c7d..9cd9e9da60dd 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1474,6 +1474,7 @@ static const struct vfio_device_ops intel_vgpu_dev_ops = {
.bind_iommufd   = vfio_iommufd_emulated_bind,
.unbind_iommufd = vfio_iommufd_emulated_unbind,
.attach_ioas= vfio_iommufd_emulated_attach_ioas,
+   .detach_ioas= vfio_iommufd_emulated_detach_ioas,
 };
 
 static int intel_vgpu_probe(struct mdev_device *mdev)
diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c
index 5b53b94f13c7..cba4971618ff 100644
--- a/drivers/s390/cio/vfio_ccw_ops.c
+++ b/drivers/s390/cio/vfio_ccw_ops.c
@@ -632,6 +632,7 @@ static const struct vfio_device_ops vfio_ccw_dev_ops = {
.bind_iommufd = vfio_iommufd_emulated_bind,
.unbind_iommufd = vfio_iommufd_emulated_unbind,
.attach_ioas = vfio_iommufd_emulated_attach_ioas,
+   .detach_ioas = vfio_iommufd_emulated_detach_ioas,
 };
 
 struct mdev_driver vfio_ccw_mdev_driver = {
diff --git a/drivers/s390/crypto/vfio_ap_ops.c 
b/drivers/s390/crypto/vfio_ap_ops.c
index cfbcb864ab63..50d0293eeef3 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -1844,6 +1844,7 @@ static const struct vfio_device_ops 
vfio_ap_matrix_dev_ops = {
.bind_iommufd = vfio_iommufd_emulated_bind,
.unbind_iommufd = vfio_iommufd_emulated_unbind,
.attach_ioas = vfio_iommufd_emulated_attach_ioas,
+   .detach_ioas = vfio_iommufd_emulated_detach_ioas,
 };
 
 static struct mdev_driver vfio_ap_matrix_driver = {
diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
index 86df5415759a..4d84904fd927 100644
--- a/drivers/vfio/iommufd.c
+++ b/drivers/vfio/iommufd.c
@@ -231,3 +231,16 @@ int vfio_iommufd_emulated_attach_ioas(struct vfio_device 
*vdev, u32 *pt_id)
return 0;
 }
 EXPORT_SYMBOL_GPL(vfio_iommufd_emulated_attach_ioas);
+
+void vfio_iommufd_emulated_detach_ioas(struct vfio_device *vdev)
+{
+   lockdep_assert_held(>dev_set->lock);
+
+   if (WARN_ON(!vdev->iommufd_access) ||
+   !vdev->iommufd_attached)
+   return;
+
+   iommufd_access_detach(vdev->iommufd_access);
+   vdev->iommufd_attached = false;
+}
+EXPORT_SYMBOL_GPL(vfio_iommufd_emulated_detach_ioas);
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index f2f02273ece1..24091a7c7bdb 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -128,6 +128,7 @@ int vfio_iommufd_emulated_bind(struct vfio_device *vdev,
   struct iommufd_ctx *ictx, u32 *out_device_id);
 void vfio_iommufd_emulated_unbind(struct vfio_device *vdev);
 int vfio_iommufd_emulated_attach_ioas(struct vfio_device *vdev, u32 *pt_id);
+void vfio_iommufd_emulated_detach_ioas(struct vfio_device *vdev);
 #else
 static inline struct iommufd_ctx *
 vfio_iommufd_device_ictx(struct vfio_device *vdev)
@@ -157,6 +158,8 @@ vfio_iommufd_get_dev_id(struct vfio_device *vdev, struct 
iommufd_ctx *ictx)
((void (*)(struct vfio_device *vdev)) NULL)
 #define vfio_iommufd_emulated_attach_ioas \
((int (*)(struct vfio_device *vdev, u32 *pt_id)) NULL)
+#define vfio_iommufd_emulated_detach_ioas \
+   ((void (*)(struct vfio_device *vdev)) NULL)
 #endif
 
 static inline bool vfio_device_cdev_opened(struct vfio_device *device)
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index c6c6b5d26670..3764d1911b51 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -1377,6 +1377,7 @@ static const struct vfio_device_ops mbochs_dev_ops = {
.bind_iommufd   = vfio_iommufd_emulated_bind,
.unbind_iommufd = vfio_iommufd_emulated_unbind,
.attach_ioas= vfio_iommufd_emulated_attach_ioas,
+   .detach_ioas= vfio_iommufd_emulated_detach_ioas,
 };
 
 static struct mdev_driver mbochs_driver = {
diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c
index a62ea11e20ec..064e1c0a7aa8 100644
--- a/samples/vfio-mdev/mdpy.c
+++ b/samples/vfio-mdev/mdpy.c
@@ -666,6 +666,7 @@ static const struct vfio_device_ops mdpy_dev_ops = {
.bind_iommufd   = vfio_iommufd_emulated_bind,
.unbind_iommufd = vfio_iommufd_emulated_unbind,
.attach_ioas= 

[Intel-gfx] [PATCH v13 14/22] iommufd/device: Add iommufd_access_detach() API

2023-06-16 Thread Yi Liu
From: Nicolin Chen 

Previously, the detach routine is only done by the destroy(). And it was
called by vfio_iommufd_emulated_unbind() when the device runs close(), so
all the mappings in iopt were cleaned in that setup, when the call trace
reaches this detach() routine.

Now, there's a need of a detach uAPI, meaning that it does not only need
a new iommufd_access_detach() API, but also requires access->ops->unmap()
call as a cleanup. So add one.

However, leaving that unprotected can introduce some potential of a race
condition during the pin_/unpin_pages() call, where access->ioas->iopt is
getting referenced. So, add an ioas_lock to protect the context of iopt
referencings.

Also, to allow the iommufd_access_unpin_pages() callback to happen via
this unmap() call, add an ioas_unpin pointer, so the unpin routine won't
be affected by the "access->ioas = NULL" trick.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Nicolin Chen 
Signed-off-by: Yi Liu 
---
 drivers/iommu/iommufd/device.c  | 76 +++--
 drivers/iommu/iommufd/iommufd_private.h |  2 +
 include/linux/iommufd.h |  1 +
 3 files changed, 74 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index 96d4281bfa7c..6b4ff635c15e 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -486,6 +486,7 @@ iommufd_access_create(struct iommufd_ctx *ictx,
iommufd_ctx_get(ictx);
iommufd_object_finalize(ictx, >obj);
*id = access->obj.id;
+   mutex_init(>ioas_lock);
return access;
 }
 EXPORT_SYMBOL_NS_GPL(iommufd_access_create, IOMMUFD);
@@ -505,26 +506,66 @@ void iommufd_access_destroy(struct iommufd_access *access)
 }
 EXPORT_SYMBOL_NS_GPL(iommufd_access_destroy, IOMMUFD);
 
+static void __iommufd_access_detach(struct iommufd_access *access)
+{
+   struct iommufd_ioas *cur_ioas = access->ioas;
+
+   lockdep_assert_held(>ioas_lock);
+   /*
+* Set ioas to NULL to block any further iommufd_access_pin_pages().
+* iommufd_access_unpin_pages() can continue using access->ioas_unpin.
+*/
+   access->ioas = NULL;
+
+   if (access->ops->unmap) {
+   mutex_unlock(>ioas_lock);
+   access->ops->unmap(access->data, 0, ULONG_MAX);
+   mutex_lock(>ioas_lock);
+   }
+   iopt_remove_access(_ioas->iopt, access);
+   refcount_dec(_ioas->obj.users);
+}
+
+void iommufd_access_detach(struct iommufd_access *access)
+{
+   mutex_lock(>ioas_lock);
+   if (WARN_ON(!access->ioas))
+   goto out;
+   __iommufd_access_detach(access);
+out:
+   access->ioas_unpin = NULL;
+   mutex_unlock(>ioas_lock);
+}
+EXPORT_SYMBOL_NS_GPL(iommufd_access_detach, IOMMUFD);
+
 int iommufd_access_attach(struct iommufd_access *access, u32 ioas_id)
 {
struct iommufd_ioas *new_ioas;
int rc = 0;
 
-   if (access->ioas)
+   mutex_lock(>ioas_lock);
+   if (access->ioas) {
+   mutex_unlock(>ioas_lock);
return -EINVAL;
+   }
 
new_ioas = iommufd_get_ioas(access->ictx, ioas_id);
-   if (IS_ERR(new_ioas))
+   if (IS_ERR(new_ioas)) {
+   mutex_unlock(>ioas_lock);
return PTR_ERR(new_ioas);
+   }
 
rc = iopt_add_access(_ioas->iopt, access);
if (rc) {
+   mutex_unlock(>ioas_lock);
iommufd_put_object(_ioas->obj);
return rc;
}
iommufd_ref_to_users(_ioas->obj);
 
access->ioas = new_ioas;
+   access->ioas_unpin = new_ioas;
+   mutex_unlock(>ioas_lock);
return 0;
 }
 EXPORT_SYMBOL_NS_GPL(iommufd_access_attach, IOMMUFD);
@@ -579,8 +620,8 @@ void iommufd_access_notify_unmap(struct io_pagetable *iopt, 
unsigned long iova,
 void iommufd_access_unpin_pages(struct iommufd_access *access,
unsigned long iova, unsigned long length)
 {
-   struct io_pagetable *iopt = >ioas->iopt;
struct iopt_area_contig_iter iter;
+   struct io_pagetable *iopt;
unsigned long last_iova;
struct iopt_area *area;
 
@@ -588,6 +629,13 @@ void iommufd_access_unpin_pages(struct iommufd_access 
*access,
WARN_ON(check_add_overflow(iova, length - 1, _iova)))
return;
 
+   mutex_lock(>ioas_lock);
+   if (!access->ioas_unpin) {
+   mutex_unlock(>ioas_lock);
+   return;
+   }
+   iopt = >ioas_unpin->iopt;
+
down_read(>iova_rwsem);
iopt_for_each_contig_area(, area, iopt, iova, last_iova)
iopt_area_remove_access(
@@ -597,6 +645,7 @@ void iommufd_access_unpin_pages(struct iommufd_access 
*access,
min(last_iova, iopt_area_last_iova(area;
up_read(>iova_rwsem);
  

[Intel-gfx] [PATCH v13 13/22] vfio-iommufd: Add detach_ioas support for physical VFIO devices

2023-06-16 Thread Yi Liu
This prepares for adding DETACH ioctl for physical VFIO devices.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 Documentation/driver-api/vfio.rst |  8 +---
 drivers/vfio/fsl-mc/vfio_fsl_mc.c |  1 +
 drivers/vfio/iommufd.c| 20 +++
 .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c|  2 ++
 drivers/vfio/pci/mlx5/main.c  |  1 +
 drivers/vfio/pci/vfio_pci.c   |  1 +
 drivers/vfio/platform/vfio_amba.c |  1 +
 drivers/vfio/platform/vfio_platform.c |  1 +
 drivers/vfio/vfio_main.c  |  3 ++-
 include/linux/vfio.h  |  8 +++-
 10 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/Documentation/driver-api/vfio.rst 
b/Documentation/driver-api/vfio.rst
index 68abc089d6dd..363e12c90b87 100644
--- a/Documentation/driver-api/vfio.rst
+++ b/Documentation/driver-api/vfio.rst
@@ -279,6 +279,7 @@ similar to a file operations structure::
struct iommufd_ctx *ictx, u32 
*out_device_id);
void(*unbind_iommufd)(struct vfio_device *vdev);
int (*attach_ioas)(struct vfio_device *vdev, u32 *pt_id);
+   void(*detach_ioas)(struct vfio_device *vdev);
int (*open_device)(struct vfio_device *vdev);
void(*close_device)(struct vfio_device *vdev);
ssize_t (*read)(struct vfio_device *vdev, char __user *buf,
@@ -315,9 +316,10 @@ container_of().
- The [un]bind_iommufd callbacks are issued when the device is bound to
  and unbound from iommufd.
 
-   - The attach_ioas callback is issued when the device is attached to an
- IOAS managed by the bound iommufd. The attached IOAS is automatically
- detached when the device is unbound from iommufd.
+   - The [de]attach_ioas callback is issued when the device is attached to
+ and detached from an IOAS managed by the bound iommufd. However, the
+ attached IOAS can also be automatically detached when the device is
+ unbound from iommufd.
 
- The read/write/mmap callbacks implement the device region access 
defined
  by the device's own VFIO_DEVICE_GET_REGION_INFO ioctl.
diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c 
b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
index c89a047a4cd8..d540cf683d93 100644
--- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c
+++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
@@ -594,6 +594,7 @@ static const struct vfio_device_ops vfio_fsl_mc_ops = {
.bind_iommufd   = vfio_iommufd_physical_bind,
.unbind_iommufd = vfio_iommufd_physical_unbind,
.attach_ioas= vfio_iommufd_physical_attach_ioas,
+   .detach_ioas= vfio_iommufd_physical_detach_ioas,
 };
 
 static struct fsl_mc_driver vfio_fsl_mc_driver = {
diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
index 4fc674c01a05..86df5415759a 100644
--- a/drivers/vfio/iommufd.c
+++ b/drivers/vfio/iommufd.c
@@ -140,6 +140,14 @@ int vfio_iommufd_physical_attach_ioas(struct vfio_device 
*vdev, u32 *pt_id)
 {
int rc;
 
+   lockdep_assert_held(>dev_set->lock);
+
+   if (WARN_ON(!vdev->iommufd_device))
+   return -EINVAL;
+
+   if (vdev->iommufd_attached)
+   return -EBUSY;
+
rc = iommufd_device_attach(vdev->iommufd_device, pt_id);
if (rc)
return rc;
@@ -148,6 +156,18 @@ int vfio_iommufd_physical_attach_ioas(struct vfio_device 
*vdev, u32 *pt_id)
 }
 EXPORT_SYMBOL_GPL(vfio_iommufd_physical_attach_ioas);
 
+void vfio_iommufd_physical_detach_ioas(struct vfio_device *vdev)
+{
+   lockdep_assert_held(>dev_set->lock);
+
+   if (WARN_ON(!vdev->iommufd_device) || !vdev->iommufd_attached)
+   return;
+
+   iommufd_device_detach(vdev->iommufd_device);
+   vdev->iommufd_attached = false;
+}
+EXPORT_SYMBOL_GPL(vfio_iommufd_physical_detach_ioas);
+
 /*
  * The emulated standard ops mean that vfio_device is going to use the
  * "mdev path" and will call vfio_pin_pages()/vfio_dma_rw(). Drivers using this
diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c 
b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index a117eaf21c14..b2f9778c8366 100644
--- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
+++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
@@ -1373,6 +1373,7 @@ static const struct vfio_device_ops 
hisi_acc_vfio_pci_migrn_ops = {
.bind_iommufd = vfio_iommufd_physical_bind,
.unbind_iommufd = vfio_iommufd_physical_unbind,
.attach_ioas = vfio_iommufd_physical_attach_ioas,
+   .detach_ioas = vfio_iommufd_physical_detach_ioas,
 };
 
 static const struct vfio_device_ops hisi_acc_vfio_pci_ops = {
@@ -1391,6 +1392,7 @@ static const struct vfio_device_ops hisi_acc_vfio_pci_ops 

[Intel-gfx] [PATCH v13 12/22] vfio: Record devid in vfio_device_file

2023-06-16 Thread Yi Liu
.bind_iommufd() will generate an ID to represent this bond, which is
needed by userspace for further usage. Store devid in vfio_device_file
to avoid passing the pointer in multiple places.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/iommufd.c   | 12 +++-
 drivers/vfio/vfio.h  | 10 +-
 drivers/vfio/vfio_main.c |  6 +++---
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
index 91fdae69bb45..4fc674c01a05 100644
--- a/drivers/vfio/iommufd.c
+++ b/drivers/vfio/iommufd.c
@@ -18,14 +18,14 @@ bool vfio_iommufd_device_has_compat_ioas(struct vfio_device 
*vdev,
return !iommufd_vfio_compat_ioas_get_id(ictx, _id);
 }
 
-int vfio_iommufd_bind(struct vfio_device *vdev, struct iommufd_ctx *ictx)
+int vfio_df_iommufd_bind(struct vfio_device_file *df)
 {
-   u32 device_id;
+   struct vfio_device *vdev = df->device;
+   struct iommufd_ctx *ictx = df->iommufd;
 
lockdep_assert_held(>dev_set->lock);
 
-   /* The legacy path has no way to return the device id */
-   return vdev->ops->bind_iommufd(vdev, ictx, _id);
+   return vdev->ops->bind_iommufd(vdev, ictx, >devid);
 }
 
 int vfio_iommufd_compat_attach_ioas(struct vfio_device *vdev,
@@ -48,8 +48,10 @@ int vfio_iommufd_compat_attach_ioas(struct vfio_device *vdev,
return vdev->ops->attach_ioas(vdev, _id);
 }
 
-void vfio_iommufd_unbind(struct vfio_device *vdev)
+void vfio_df_iommufd_unbind(struct vfio_device_file *df)
 {
+   struct vfio_device *vdev = df->device;
+
lockdep_assert_held(>dev_set->lock);
 
if (vfio_device_is_noiommu(vdev))
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 04755379940c..58801adc1a7e 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -21,6 +21,7 @@ struct vfio_device_file {
struct vfio_group *group;
 
u8 access_granted;
+   u32 devid; /* only valid when iommufd is valid */
spinlock_t kvm_ref_lock; /* protect kvm field */
struct kvm *kvm;
struct iommufd_ctx *iommufd; /* protected by struct 
vfio_device_set::lock */
@@ -236,8 +237,8 @@ static inline void vfio_container_cleanup(void)
 #if IS_ENABLED(CONFIG_IOMMUFD)
 bool vfio_iommufd_device_has_compat_ioas(struct vfio_device *vdev,
 struct iommufd_ctx *ictx);
-int vfio_iommufd_bind(struct vfio_device *device, struct iommufd_ctx *ictx);
-void vfio_iommufd_unbind(struct vfio_device *device);
+int vfio_df_iommufd_bind(struct vfio_device_file *df);
+void vfio_df_iommufd_unbind(struct vfio_device_file *df);
 int vfio_iommufd_compat_attach_ioas(struct vfio_device *device,
struct iommufd_ctx *ictx);
 #else
@@ -248,13 +249,12 @@ vfio_iommufd_device_has_compat_ioas(struct vfio_device 
*vdev,
return false;
 }
 
-static inline int vfio_iommufd_bind(struct vfio_device *device,
-   struct iommufd_ctx *ictx)
+static inline int vfio_df_iommufd_bind(struct vfio_device_file *fd)
 {
return -EOPNOTSUPP;
 }
 
-static inline void vfio_iommufd_unbind(struct vfio_device *device)
+static inline void vfio_df_iommufd_unbind(struct vfio_device_file *df)
 {
 }
 
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index be5e4ddd5901..3a4b7eb128df 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -446,7 +446,7 @@ static int vfio_df_device_first_open(struct 
vfio_device_file *df)
return -ENODEV;
 
if (iommufd)
-   ret = vfio_iommufd_bind(device, iommufd);
+   ret = vfio_df_iommufd_bind(df);
else
ret = vfio_device_group_use_iommu(device);
if (ret)
@@ -461,7 +461,7 @@ static int vfio_df_device_first_open(struct 
vfio_device_file *df)
 
 err_unuse_iommu:
if (iommufd)
-   vfio_iommufd_unbind(device);
+   vfio_df_iommufd_unbind(df);
else
vfio_device_group_unuse_iommu(device);
 err_module_put:
@@ -479,7 +479,7 @@ static void vfio_df_device_last_close(struct 
vfio_device_file *df)
if (device->ops->close_device)
device->ops->close_device(device);
if (iommufd)
-   vfio_iommufd_unbind(device);
+   vfio_df_iommufd_unbind(df);
else
vfio_device_group_unuse_iommu(device);
module_put(device->dev->driver->owner);
-- 
2.34.1



[Intel-gfx] [PATCH v13 11/22] vfio-iommufd: Split bind/attach into two steps

2023-06-16 Thread Yi Liu
This aligns the bind/attach logic with the coming vfio device cdev support.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c   | 17 +
 drivers/vfio/iommufd.c | 35 +--
 drivers/vfio/vfio.h|  9 +
 3 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index b8b77daf7aa6..41a09a2df690 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -207,9 +207,13 @@ static int vfio_df_group_open(struct vfio_device_file *df)
}
 
ret = vfio_df_open(df);
-   if (ret) {
-   df->iommufd = NULL;
+   if (ret)
goto out_put_kvm;
+
+   if (df->iommufd && device->open_count == 1) {
+   ret = vfio_iommufd_compat_attach_ioas(device, df->iommufd);
+   if (ret)
+   goto out_close_device;
}
 
/*
@@ -218,12 +222,17 @@ static int vfio_df_group_open(struct vfio_device_file *df)
 */
smp_store_release(>access_granted, true);
 
+   mutex_unlock(>dev_set->lock);
+   mutex_unlock(>group->group_lock);
+   return 0;
+
+out_close_device:
+   vfio_df_close(df);
 out_put_kvm:
+   df->iommufd = NULL;
if (device->open_count == 0)
vfio_device_put_kvm(device);
-
mutex_unlock(>dev_set->lock);
-
 out_unlock:
mutex_unlock(>group->group_lock);
return ret;
diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
index 36f838dad084..91fdae69bb45 100644
--- a/drivers/vfio/iommufd.c
+++ b/drivers/vfio/iommufd.c
@@ -20,33 +20,32 @@ bool vfio_iommufd_device_has_compat_ioas(struct vfio_device 
*vdev,
 
 int vfio_iommufd_bind(struct vfio_device *vdev, struct iommufd_ctx *ictx)
 {
-   u32 ioas_id;
u32 device_id;
+
+   lockdep_assert_held(>dev_set->lock);
+
+   /* The legacy path has no way to return the device id */
+   return vdev->ops->bind_iommufd(vdev, ictx, _id);
+}
+
+int vfio_iommufd_compat_attach_ioas(struct vfio_device *vdev,
+   struct iommufd_ctx *ictx)
+{
+   u32 ioas_id;
int ret;
 
lockdep_assert_held(>dev_set->lock);
 
-   ret = vdev->ops->bind_iommufd(vdev, ictx, _id);
-   if (ret)
-   return ret;
+   /* compat noiommu does not need to do ioas attach */
+   if (vfio_device_is_noiommu(vdev))
+   return 0;
 
ret = iommufd_vfio_compat_ioas_get_id(ictx, _id);
if (ret)
-   goto err_unbind;
-   ret = vdev->ops->attach_ioas(vdev, _id);
-   if (ret)
-   goto err_unbind;
-
-   /*
-* The legacy path has no way to return the device id or the selected
-* pt_id
-*/
-   return 0;
+   return ret;
 
-err_unbind:
-   if (vdev->ops->unbind_iommufd)
-   vdev->ops->unbind_iommufd(vdev);
-   return ret;
+   /* The legacy path has no way to return the selected pt_id */
+   return vdev->ops->attach_ioas(vdev, _id);
 }
 
 void vfio_iommufd_unbind(struct vfio_device *vdev)
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 300cab04f4e1..04755379940c 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -238,6 +238,8 @@ bool vfio_iommufd_device_has_compat_ioas(struct vfio_device 
*vdev,
 struct iommufd_ctx *ictx);
 int vfio_iommufd_bind(struct vfio_device *device, struct iommufd_ctx *ictx);
 void vfio_iommufd_unbind(struct vfio_device *device);
+int vfio_iommufd_compat_attach_ioas(struct vfio_device *device,
+   struct iommufd_ctx *ictx);
 #else
 static inline bool
 vfio_iommufd_device_has_compat_ioas(struct vfio_device *vdev,
@@ -255,6 +257,13 @@ static inline int vfio_iommufd_bind(struct vfio_device 
*device,
 static inline void vfio_iommufd_unbind(struct vfio_device *device)
 {
 }
+
+static inline int
+vfio_iommufd_compat_attach_ioas(struct vfio_device *device,
+   struct iommufd_ctx *ictx)
+{
+   return -EOPNOTSUPP;
+}
 #endif
 
 #if IS_ENABLED(CONFIG_VFIO_VIRQFD)
-- 
2.34.1



[Intel-gfx] [PATCH v13 10/22] vfio-iommufd: Move noiommu compat validation out of vfio_iommufd_bind()

2023-06-16 Thread Yi Liu
This moves the noiommu compat validation logic into vfio_df_group_open().
This is more consistent with what will be done in vfio device cdev path.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c   | 13 +
 drivers/vfio/iommufd.c | 22 --
 drivers/vfio/vfio.h|  9 +
 3 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 4e6277191eb4..b8b77daf7aa6 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -192,6 +192,19 @@ static int vfio_df_group_open(struct vfio_device_file *df)
vfio_device_group_get_kvm_safe(device);
 
df->iommufd = device->group->iommufd;
+   if (df->iommufd && vfio_device_is_noiommu(device) && device->open_count 
== 0) {
+   /*
+* Require no compat ioas to be assigned to proceed.  The basic
+* statement is that the user cannot have done something that
+* implies they expected translation to exist
+*/
+   if (!capable(CAP_SYS_RAWIO) ||
+   vfio_iommufd_device_has_compat_ioas(device, df->iommufd))
+   ret = -EPERM;
+   else
+   ret = 0;
+   goto out_put_kvm;
+   }
 
ret = vfio_df_open(df);
if (ret) {
diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
index afda47ee9663..36f838dad084 100644
--- a/drivers/vfio/iommufd.c
+++ b/drivers/vfio/iommufd.c
@@ -10,6 +10,14 @@
 MODULE_IMPORT_NS(IOMMUFD);
 MODULE_IMPORT_NS(IOMMUFD_VFIO);
 
+bool vfio_iommufd_device_has_compat_ioas(struct vfio_device *vdev,
+struct iommufd_ctx *ictx)
+{
+   u32 ioas_id;
+
+   return !iommufd_vfio_compat_ioas_get_id(ictx, _id);
+}
+
 int vfio_iommufd_bind(struct vfio_device *vdev, struct iommufd_ctx *ictx)
 {
u32 ioas_id;
@@ -18,20 +26,6 @@ int vfio_iommufd_bind(struct vfio_device *vdev, struct 
iommufd_ctx *ictx)
 
lockdep_assert_held(>dev_set->lock);
 
-   if (vfio_device_is_noiommu(vdev)) {
-   if (!capable(CAP_SYS_RAWIO))
-   return -EPERM;
-
-   /*
-* Require no compat ioas to be assigned to proceed. The basic
-* statement is that the user cannot have done something that
-* implies they expected translation to exist
-*/
-   if (!iommufd_vfio_compat_ioas_get_id(ictx, _id))
-   return -EPERM;
-   return 0;
-   }
-
ret = vdev->ops->bind_iommufd(vdev, ictx, _id);
if (ret)
return ret;
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 85484a971a3e..300cab04f4e1 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -234,9 +234,18 @@ static inline void vfio_container_cleanup(void)
 #endif
 
 #if IS_ENABLED(CONFIG_IOMMUFD)
+bool vfio_iommufd_device_has_compat_ioas(struct vfio_device *vdev,
+struct iommufd_ctx *ictx);
 int vfio_iommufd_bind(struct vfio_device *device, struct iommufd_ctx *ictx);
 void vfio_iommufd_unbind(struct vfio_device *device);
 #else
+static inline bool
+vfio_iommufd_device_has_compat_ioas(struct vfio_device *vdev,
+   struct iommufd_ctx *ictx)
+{
+   return false;
+}
+
 static inline int vfio_iommufd_bind(struct vfio_device *device,
struct iommufd_ctx *ictx)
 {
-- 
2.34.1



[Intel-gfx] [PATCH v13 09/22] vfio: Make vfio_df_open() single open for device cdev path

2023-06-16 Thread Yi Liu
VFIO group has historically allowed multi-open of the device FD. This
was made secure because the "open" was executed via an ioctl to the
group FD which is itself only single open.

However, no known use of multiple device FDs today. It is kind of a
strange thing to do because new device FDs can naturally be created
via dup().

When we implement the new device uAPI (only used in cdev path) there is
no natural way to allow the device itself from being multi-opened in a
secure manner. Without the group FD we cannot prove the security context
of the opener.

Thus, when moving to the new uAPI we block the ability of opening
a device multiple times. Given old group path still allows it we store
a vfio_group pointer in struct vfio_device_file to differentiate.

Reviewed-by: Kevin Tian 
Reviewed-by: Jason Gunthorpe 
Reviewed-by: Eric Auger 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c | 2 ++
 drivers/vfio/vfio.h  | 1 +
 drivers/vfio/vfio_main.c | 7 +++
 3 files changed, 10 insertions(+)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 2751d61689c4..4e6277191eb4 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -245,6 +245,8 @@ static struct file *vfio_device_open_file(struct 
vfio_device *device)
goto err_out;
}
 
+   df->group = device->group;
+
ret = vfio_df_group_open(df);
if (ret)
goto err_free;
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index ae7dd2ca14b9..85484a971a3e 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -18,6 +18,7 @@ struct vfio_container;
 
 struct vfio_device_file {
struct vfio_device *device;
+   struct vfio_group *group;
 
u8 access_granted;
spinlock_t kvm_ref_lock; /* protect kvm field */
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index c37fc14599d0..be5e4ddd5901 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -492,6 +492,13 @@ int vfio_df_open(struct vfio_device_file *df)
 
lockdep_assert_held(>dev_set->lock);
 
+   /*
+* Only the group path allows the device to be opened multiple
+* times.  The device cdev path doesn't have a secure way for it.
+*/
+   if (device->open_count != 0 && !df->group)
+   return -EINVAL;
+
device->open_count++;
if (device->open_count == 1) {
ret = vfio_df_device_first_open(df);
-- 
2.34.1



[Intel-gfx] [PATCH v13 08/22] vfio: Add cdev_device_open_cnt to vfio_group

2023-06-16 Thread Yi Liu
This is for counting the devices that are opened via the cdev path. This
count is increased and decreased by the cdev path. The group path checks
it to achieve exclusion with the cdev path. With this, only one path
(group path or cdev path) will claim DMA ownership. This avoids scenarios
in which devices within the same group may be opened via different paths.

Reviewed-by: Kevin Tian 
Reviewed-by: Jason Gunthorpe 
Reviewed-by: Eric Auger 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c | 33 +
 drivers/vfio/vfio.h  |  3 +++
 2 files changed, 36 insertions(+)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 088dd34c8931..2751d61689c4 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -383,6 +383,33 @@ static long vfio_group_fops_unl_ioctl(struct file *filep,
}
 }
 
+int vfio_device_block_group(struct vfio_device *device)
+{
+   struct vfio_group *group = device->group;
+   int ret = 0;
+
+   mutex_lock(>group_lock);
+   if (group->opened_file) {
+   ret = -EBUSY;
+   goto out_unlock;
+   }
+
+   group->cdev_device_open_cnt++;
+
+out_unlock:
+   mutex_unlock(>group_lock);
+   return ret;
+}
+
+void vfio_device_unblock_group(struct vfio_device *device)
+{
+   struct vfio_group *group = device->group;
+
+   mutex_lock(>group_lock);
+   group->cdev_device_open_cnt--;
+   mutex_unlock(>group_lock);
+}
+
 static int vfio_group_fops_open(struct inode *inode, struct file *filep)
 {
struct vfio_group *group =
@@ -405,6 +432,11 @@ static int vfio_group_fops_open(struct inode *inode, 
struct file *filep)
goto out_unlock;
}
 
+   if (group->cdev_device_open_cnt) {
+   ret = -EBUSY;
+   goto out_unlock;
+   }
+
/*
 * Do we need multiple instances of the group open?  Seems not.
 */
@@ -479,6 +511,7 @@ static void vfio_group_release(struct device *dev)
mutex_destroy(>device_lock);
mutex_destroy(>group_lock);
WARN_ON(group->iommu_group);
+   WARN_ON(group->cdev_device_open_cnt);
ida_free(_ida, MINOR(group->dev.devt));
kfree(group);
 }
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 4478a1e77a5e..ae7dd2ca14b9 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -84,8 +84,11 @@ struct vfio_group {
struct blocking_notifier_head   notifier;
struct iommufd_ctx  *iommufd;
spinlock_t  kvm_ref_lock;
+   unsigned intcdev_device_open_cnt;
 };
 
+int vfio_device_block_group(struct vfio_device *device);
+void vfio_device_unblock_group(struct vfio_device *device);
 int vfio_device_set_group(struct vfio_device *device,
  enum vfio_group_type type);
 void vfio_device_remove_group(struct vfio_device *device);
-- 
2.34.1



[Intel-gfx] [PATCH v13 06/22] vfio: Pass struct vfio_device_file * to vfio_device_open/close()

2023-06-16 Thread Yi Liu
This avoids passing too much parameters in multiple functions. Per the
input parameter change, rename the function to be vfio_df_open/close().

Reviewed-by: Kevin Tian 
Reviewed-by: Jason Gunthorpe 
Reviewed-by: Eric Auger 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c | 20 ++--
 drivers/vfio/vfio.h  |  8 
 drivers/vfio/vfio_main.c | 25 +++--
 3 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index b56e19d2a02d..caf53716ddb2 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -169,8 +169,9 @@ static void vfio_device_group_get_kvm_safe(struct 
vfio_device *device)
spin_unlock(>group->kvm_ref_lock);
 }
 
-static int vfio_device_group_open(struct vfio_device *device)
+static int vfio_df_group_open(struct vfio_device_file *df)
 {
+   struct vfio_device *device = df->device;
int ret;
 
mutex_lock(>group->group_lock);
@@ -190,7 +191,11 @@ static int vfio_device_group_open(struct vfio_device 
*device)
if (device->open_count == 0)
vfio_device_group_get_kvm_safe(device);
 
-   ret = vfio_device_open(device, device->group->iommufd);
+   df->iommufd = device->group->iommufd;
+
+   ret = vfio_df_open(df);
+   if (ret)
+   df->iommufd = NULL;
 
if (device->open_count == 0)
vfio_device_put_kvm(device);
@@ -202,12 +207,15 @@ static int vfio_device_group_open(struct vfio_device 
*device)
return ret;
 }
 
-void vfio_device_group_close(struct vfio_device *device)
+void vfio_df_group_close(struct vfio_device_file *df)
 {
+   struct vfio_device *device = df->device;
+
mutex_lock(>group->group_lock);
mutex_lock(>dev_set->lock);
 
-   vfio_device_close(device, device->group->iommufd);
+   vfio_df_close(df);
+   df->iommufd = NULL;
 
if (device->open_count == 0)
vfio_device_put_kvm(device);
@@ -228,7 +236,7 @@ static struct file *vfio_device_open_file(struct 
vfio_device *device)
goto err_out;
}
 
-   ret = vfio_device_group_open(device);
+   ret = vfio_df_group_open(df);
if (ret)
goto err_free;
 
@@ -260,7 +268,7 @@ static struct file *vfio_device_open_file(struct 
vfio_device *device)
return filep;
 
 err_close_device:
-   vfio_device_group_close(device);
+   vfio_df_group_close(df);
 err_free:
kfree(df);
 err_out:
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 332528af0846..2094f5a4ef04 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -21,13 +21,13 @@ struct vfio_device_file {
 
spinlock_t kvm_ref_lock; /* protect kvm field */
struct kvm *kvm;
+   struct iommufd_ctx *iommufd; /* protected by struct 
vfio_device_set::lock */
 };
 
 void vfio_device_put_registration(struct vfio_device *device);
 bool vfio_device_try_get_registration(struct vfio_device *device);
-int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd);
-void vfio_device_close(struct vfio_device *device,
-  struct iommufd_ctx *iommufd);
+int vfio_df_open(struct vfio_device_file *df);
+void vfio_df_close(struct vfio_device_file *df);
 struct vfio_device_file *
 vfio_allocate_device_file(struct vfio_device *device);
 
@@ -92,7 +92,7 @@ void vfio_device_group_register(struct vfio_device *device);
 void vfio_device_group_unregister(struct vfio_device *device);
 int vfio_device_group_use_iommu(struct vfio_device *device);
 void vfio_device_group_unuse_iommu(struct vfio_device *device);
-void vfio_device_group_close(struct vfio_device *device);
+void vfio_df_group_close(struct vfio_device_file *df);
 struct vfio_group *vfio_group_from_file(struct file *file);
 bool vfio_group_enforced_coherent(struct vfio_group *group);
 void vfio_group_set_kvm(struct vfio_group *group, struct kvm *kvm);
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 8ef9210ad2aa..825b1eeaebe2 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -434,9 +434,10 @@ vfio_allocate_device_file(struct vfio_device *device)
return df;
 }
 
-static int vfio_device_first_open(struct vfio_device *device,
- struct iommufd_ctx *iommufd)
+static int vfio_df_device_first_open(struct vfio_device_file *df)
 {
+   struct vfio_device *device = df->device;
+   struct iommufd_ctx *iommufd = df->iommufd;
int ret;
 
lockdep_assert_held(>dev_set->lock);
@@ -468,9 +469,11 @@ static int vfio_device_first_open(struct vfio_device 
*device,
return ret;
 }
 
-static void vfio_device_last_close(struct vfio_device *device,
-  struct iommufd_ctx *iommufd)
+static void vfio_df_device_last_close(struct 

[Intel-gfx] [PATCH v13 07/22] vfio: Block device access via device fd until device is opened

2023-06-16 Thread Yi Liu
Allow the vfio_device file to be in a state where the device FD is
opened but the device cannot be used by userspace (i.e. its .open_device()
hasn't been called). This inbetween state is not used when the device
FD is spawned from the group FD, however when we create the device FD
directly by opening a cdev it will be opened in the blocked state.

The reason for the inbetween state is that userspace only gets a FD but
doesn't gain access permission until binding the FD to an iommufd. So in
the blocked state, only the bind operation is allowed. Completing bind
will allow user to further access the device.

This is implemented by adding a flag in struct vfio_device_file to mark
the blocked state and using a simple smp_load_acquire() to obtain the
flag value and serialize all the device setup with the thread accessing
this device.

Following this lockless scheme, it can safely handle the device FD
unbound->bound but it cannot handle bound->unbound. To allow this we'd
need to add a lock on all the vfio ioctls which seems costly. So once
device FD is bound, it remains bound until the FD is closed.

Suggested-by: Jason Gunthorpe 
Reviewed-by: Kevin Tian 
Reviewed-by: Jason Gunthorpe 
Reviewed-by: Eric Auger 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c | 11 ++-
 drivers/vfio/vfio.h  |  1 +
 drivers/vfio/vfio_main.c | 16 
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index caf53716ddb2..088dd34c8931 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -194,9 +194,18 @@ static int vfio_df_group_open(struct vfio_device_file *df)
df->iommufd = device->group->iommufd;
 
ret = vfio_df_open(df);
-   if (ret)
+   if (ret) {
df->iommufd = NULL;
+   goto out_put_kvm;
+   }
+
+   /*
+* Paired with smp_load_acquire() in vfio_device_fops::ioctl/
+* read/write/mmap and vfio_file_has_device_access()
+*/
+   smp_store_release(>access_granted, true);
 
+out_put_kvm:
if (device->open_count == 0)
vfio_device_put_kvm(device);
 
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 2094f5a4ef04..4478a1e77a5e 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -19,6 +19,7 @@ struct vfio_container;
 struct vfio_device_file {
struct vfio_device *device;
 
+   u8 access_granted;
spinlock_t kvm_ref_lock; /* protect kvm field */
struct kvm *kvm;
struct iommufd_ctx *iommufd; /* protected by struct 
vfio_device_set::lock */
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 825b1eeaebe2..c37fc14599d0 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -1129,6 +1129,10 @@ static long vfio_device_fops_unl_ioctl(struct file 
*filep,
struct vfio_device *device = df->device;
int ret;
 
+   /* Paired with smp_store_release() following vfio_df_open() */
+   if (!smp_load_acquire(>access_granted))
+   return -EINVAL;
+
ret = vfio_device_pm_runtime_get(device);
if (ret)
return ret;
@@ -1156,6 +1160,10 @@ static ssize_t vfio_device_fops_read(struct file *filep, 
char __user *buf,
struct vfio_device_file *df = filep->private_data;
struct vfio_device *device = df->device;
 
+   /* Paired with smp_store_release() following vfio_df_open() */
+   if (!smp_load_acquire(>access_granted))
+   return -EINVAL;
+
if (unlikely(!device->ops->read))
return -EINVAL;
 
@@ -1169,6 +1177,10 @@ static ssize_t vfio_device_fops_write(struct file *filep,
struct vfio_device_file *df = filep->private_data;
struct vfio_device *device = df->device;
 
+   /* Paired with smp_store_release() following vfio_df_open() */
+   if (!smp_load_acquire(>access_granted))
+   return -EINVAL;
+
if (unlikely(!device->ops->write))
return -EINVAL;
 
@@ -1180,6 +1192,10 @@ static int vfio_device_fops_mmap(struct file *filep, 
struct vm_area_struct *vma)
struct vfio_device_file *df = filep->private_data;
struct vfio_device *device = df->device;
 
+   /* Paired with smp_store_release() following vfio_df_open() */
+   if (!smp_load_acquire(>access_granted))
+   return -EINVAL;
+
if (unlikely(!device->ops->mmap))
return -EINVAL;
 
-- 
2.34.1



[Intel-gfx] [PATCH v13 03/22] vfio: Accept vfio device file in the KVM facing kAPI

2023-06-16 Thread Yi Liu
This makes the vfio file kAPIs to accept vfio device files, also a
preparation for vfio device cdev support.

For the kvm set with vfio device file, kvm pointer is stored in struct
vfio_device_file, and use kvm_ref_lock to protect kvm set and kvm
pointer usage within VFIO. This kvm pointer will be set to vfio_device
after device file is bound to iommufd in the cdev path.

Reviewed-by: Kevin Tian 
Reviewed-by: Jason Gunthorpe 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/vfio.h  |  3 +++
 drivers/vfio/vfio_main.c | 36 +++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index b1e327a85a32..332528af0846 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -18,6 +18,9 @@ struct vfio_container;
 
 struct vfio_device_file {
struct vfio_device *device;
+
+   spinlock_t kvm_ref_lock; /* protect kvm field */
+   struct kvm *kvm;
 };
 
 void vfio_device_put_registration(struct vfio_device *device);
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 4665791aa2eb..8ef9210ad2aa 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -429,6 +429,7 @@ vfio_allocate_device_file(struct vfio_device *device)
return ERR_PTR(-ENOMEM);
 
df->device = device;
+   spin_lock_init(>kvm_ref_lock);
 
return df;
 }
@@ -1190,13 +1191,23 @@ const struct file_operations vfio_device_fops = {
.mmap   = vfio_device_fops_mmap,
 };
 
+static struct vfio_device *vfio_device_from_file(struct file *file)
+{
+   struct vfio_device_file *df = file->private_data;
+
+   if (file->f_op != _device_fops)
+   return NULL;
+   return df->device;
+}
+
 /**
  * vfio_file_is_valid - True if the file is valid vfio file
  * @file: VFIO group file or VFIO device file
  */
 bool vfio_file_is_valid(struct file *file)
 {
-   return vfio_group_from_file(file);
+   return vfio_group_from_file(file) ||
+  vfio_device_from_file(file);
 }
 EXPORT_SYMBOL_GPL(vfio_file_is_valid);
 
@@ -1211,16 +1222,36 @@ EXPORT_SYMBOL_GPL(vfio_file_is_valid);
  */
 bool vfio_file_enforced_coherent(struct file *file)
 {
+   struct vfio_device *device;
struct vfio_group *group;
 
group = vfio_group_from_file(file);
if (group)
return vfio_group_enforced_coherent(group);
 
+   device = vfio_device_from_file(file);
+   if (device)
+   return device_iommu_capable(device->dev,
+   IOMMU_CAP_ENFORCE_CACHE_COHERENCY);
+
return true;
 }
 EXPORT_SYMBOL_GPL(vfio_file_enforced_coherent);
 
+static void vfio_device_file_set_kvm(struct file *file, struct kvm *kvm)
+{
+   struct vfio_device_file *df = file->private_data;
+
+   /*
+* The kvm is first recorded in the vfio_device_file, and will
+* be propagated to vfio_device::kvm when the file is bound to
+* iommufd successfully in the vfio device cdev path.
+*/
+   spin_lock(>kvm_ref_lock);
+   df->kvm = kvm;
+   spin_unlock(>kvm_ref_lock);
+}
+
 /**
  * vfio_file_set_kvm - Link a kvm with VFIO drivers
  * @file: VFIO group file or VFIO device file
@@ -1236,6 +1267,9 @@ void vfio_file_set_kvm(struct file *file, struct kvm *kvm)
group = vfio_group_from_file(file);
if (group)
vfio_group_set_kvm(group, kvm);
+
+   if (vfio_device_from_file(file))
+   vfio_device_file_set_kvm(file, kvm);
 }
 EXPORT_SYMBOL_GPL(vfio_file_set_kvm);
 
-- 
2.34.1



[Intel-gfx] [PATCH v13 04/22] kvm/vfio: Prepare for accepting vfio device fd

2023-06-16 Thread Yi Liu
This renames kvm_vfio_group related helpers to prepare for accepting
vfio device fd. No functional change is intended.

Reviewed-by: Kevin Tian 
Reviewed-by: Eric Auger 
Reviewed-by: Jason Gunthorpe 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 virt/kvm/vfio.c | 115 
 1 file changed, 58 insertions(+), 57 deletions(-)

diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index b33c7b8488b3..8f7fa07e8170 100644
--- a/virt/kvm/vfio.c
+++ b/virt/kvm/vfio.c
@@ -21,7 +21,7 @@
 #include 
 #endif
 
-struct kvm_vfio_group {
+struct kvm_vfio_file {
struct list_head node;
struct file *file;
 #ifdef CONFIG_SPAPR_TCE_IOMMU
@@ -30,7 +30,7 @@ struct kvm_vfio_group {
 };
 
 struct kvm_vfio {
-   struct list_head group_list;
+   struct list_head file_list;
struct mutex lock;
bool noncoherent;
 };
@@ -98,34 +98,35 @@ static struct iommu_group *kvm_vfio_file_iommu_group(struct 
file *file)
 }
 
 static void kvm_spapr_tce_release_vfio_group(struct kvm *kvm,
-struct kvm_vfio_group *kvg)
+struct kvm_vfio_file *kvf)
 {
-   if (WARN_ON_ONCE(!kvg->iommu_group))
+   if (WARN_ON_ONCE(!kvf->iommu_group))
return;
 
-   kvm_spapr_tce_release_iommu_group(kvm, kvg->iommu_group);
-   iommu_group_put(kvg->iommu_group);
-   kvg->iommu_group = NULL;
+   kvm_spapr_tce_release_iommu_group(kvm, kvf->iommu_group);
+   iommu_group_put(kvf->iommu_group);
+   kvf->iommu_group = NULL;
 }
 #endif
 
 /*
- * Groups can use the same or different IOMMU domains.  If the same then
- * adding a new group may change the coherency of groups we've previously
- * been told about.  We don't want to care about any of that so we retest
- * each group and bail as soon as we find one that's noncoherent.  This
- * means we only ever [un]register_noncoherent_dma once for the whole device.
+ * Groups/devices can use the same or different IOMMU domains. If the same
+ * then adding a new group/device may change the coherency of groups/devices
+ * we've previously been told about. We don't want to care about any of
+ * that so we retest each group/device and bail as soon as we find one that's
+ * noncoherent.  This means we only ever [un]register_noncoherent_dma once
+ * for the whole device.
  */
 static void kvm_vfio_update_coherency(struct kvm_device *dev)
 {
struct kvm_vfio *kv = dev->private;
bool noncoherent = false;
-   struct kvm_vfio_group *kvg;
+   struct kvm_vfio_file *kvf;
 
mutex_lock(>lock);
 
-   list_for_each_entry(kvg, >group_list, node) {
-   if (!kvm_vfio_file_enforced_coherent(kvg->file)) {
+   list_for_each_entry(kvf, >file_list, node) {
+   if (!kvm_vfio_file_enforced_coherent(kvf->file)) {
noncoherent = true;
break;
}
@@ -143,10 +144,10 @@ static void kvm_vfio_update_coherency(struct kvm_device 
*dev)
mutex_unlock(>lock);
 }
 
-static int kvm_vfio_group_add(struct kvm_device *dev, unsigned int fd)
+static int kvm_vfio_file_add(struct kvm_device *dev, unsigned int fd)
 {
struct kvm_vfio *kv = dev->private;
-   struct kvm_vfio_group *kvg;
+   struct kvm_vfio_file *kvf;
struct file *filp;
int ret;
 
@@ -162,27 +163,27 @@ static int kvm_vfio_group_add(struct kvm_device *dev, 
unsigned int fd)
 
mutex_lock(>lock);
 
-   list_for_each_entry(kvg, >group_list, node) {
-   if (kvg->file == filp) {
+   list_for_each_entry(kvf, >file_list, node) {
+   if (kvf->file == filp) {
ret = -EEXIST;
goto err_unlock;
}
}
 
-   kvg = kzalloc(sizeof(*kvg), GFP_KERNEL_ACCOUNT);
-   if (!kvg) {
+   kvf = kzalloc(sizeof(*kvf), GFP_KERNEL_ACCOUNT);
+   if (!kvf) {
ret = -ENOMEM;
goto err_unlock;
}
 
-   kvg->file = filp;
-   list_add_tail(>node, >group_list);
+   kvf->file = filp;
+   list_add_tail(>node, >file_list);
 
kvm_arch_start_assignment(dev->kvm);
 
mutex_unlock(>lock);
 
-   kvm_vfio_file_set_kvm(kvg->file, dev->kvm);
+   kvm_vfio_file_set_kvm(kvf->file, dev->kvm);
kvm_vfio_update_coherency(dev);
 
return 0;
@@ -193,10 +194,10 @@ static int kvm_vfio_group_add(struct kvm_device *dev, 
unsigned int fd)
return ret;
 }
 
-static int kvm_vfio_group_del(struct kvm_device *dev, unsigned int fd)
+static int kvm_vfio_file_del(struct kvm_device *dev, unsigned int fd)
 {
struct kvm_vfio *kv = dev->private;
-   struct kvm_vfio_group *kvg;
+   struct kvm_vfio_file *kvf;
struct fd f;
int ret;
 
@@ -208,18 +209,18 @@ static int 

[Intel-gfx] [PATCH v13 05/22] kvm/vfio: Accept vfio device file from userspace

2023-06-16 Thread Yi Liu
This defines KVM_DEV_VFIO_FILE* and make alias with KVM_DEV_VFIO_GROUP*.
Old userspace uses KVM_DEV_VFIO_GROUP* works as well.

Reviewed-by: Jason Gunthorpe 
Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 Documentation/virt/kvm/devices/vfio.rst | 47 -
 include/uapi/linux/kvm.h| 13 +--
 virt/kvm/vfio.c | 12 +++
 3 files changed, 47 insertions(+), 25 deletions(-)

diff --git a/Documentation/virt/kvm/devices/vfio.rst 
b/Documentation/virt/kvm/devices/vfio.rst
index 08b544212638..c549143bb891 100644
--- a/Documentation/virt/kvm/devices/vfio.rst
+++ b/Documentation/virt/kvm/devices/vfio.rst
@@ -9,22 +9,34 @@ Device types supported:
   - KVM_DEV_TYPE_VFIO
 
 Only one VFIO instance may be created per VM.  The created device
-tracks VFIO groups in use by the VM and features of those groups
-important to the correctness and acceleration of the VM.  As groups
-are enabled and disabled for use by the VM, KVM should be updated
-about their presence.  When registered with KVM, a reference to the
-VFIO-group is held by KVM.
+tracks VFIO files (group or device) in use by the VM and features
+of those groups/devices important to the correctness and acceleration
+of the VM.  As groups/devices are enabled and disabled for use by the
+VM, KVM should be updated about their presence.  When registered with
+KVM, a reference to the VFIO file is held by KVM.
 
 Groups:
-  KVM_DEV_VFIO_GROUP
-
-KVM_DEV_VFIO_GROUP attributes:
-  KVM_DEV_VFIO_GROUP_ADD: Add a VFIO group to VFIO-KVM device tracking
-   kvm_device_attr.addr points to an int32_t file descriptor
-   for the VFIO group.
-  KVM_DEV_VFIO_GROUP_DEL: Remove a VFIO group from VFIO-KVM device tracking
-   kvm_device_attr.addr points to an int32_t file descriptor
-   for the VFIO group.
+  KVM_DEV_VFIO_FILE
+   alias: KVM_DEV_VFIO_GROUP
+
+KVM_DEV_VFIO_FILE attributes:
+  KVM_DEV_VFIO_FILE_ADD: Add a VFIO file (group/device) to VFIO-KVM device
+   tracking
+
+   kvm_device_attr.addr points to an int32_t file descriptor for the
+   VFIO file.
+
+  KVM_DEV_VFIO_FILE_DEL: Remove a VFIO file (group/device) from VFIO-KVM
+   device tracking
+
+   kvm_device_attr.addr points to an int32_t file descriptor for the
+   VFIO file.
+
+KVM_DEV_VFIO_GROUP (legacy kvm device group restricted to the handling of VFIO 
group fd):
+  KVM_DEV_VFIO_GROUP_ADD: same as KVM_DEV_VFIO_FILE_ADD for group fd only
+
+  KVM_DEV_VFIO_GROUP_DEL: same as KVM_DEV_VFIO_FILE_DEL for group fd only
+
   KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: attaches a guest visible TCE table
allocated by sPAPR KVM.
kvm_device_attr.addr points to a struct::
@@ -40,7 +52,10 @@ KVM_DEV_VFIO_GROUP attributes:
- @tablefd is a file descriptor for a TCE table allocated via
  KVM_CREATE_SPAPR_TCE.
 
-The GROUP_ADD operation above should be invoked prior to accessing the
+The FILE/GROUP_ADD operation above should be invoked prior to accessing the
 device file descriptor via VFIO_GROUP_GET_DEVICE_FD in order to support
 drivers which require a kvm pointer to be set in their .open_device()
-callback.
+callback.  It is the same for device file descriptor via character device
+open which gets device access via VFIO_DEVICE_BIND_IOMMUFD.  For such file
+descriptors, FILE_ADD should be invoked before VFIO_DEVICE_BIND_IOMMUFD
+to support the drivers mentioned in prior sentence as well.
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 737318b1c1d9..0423af6161e1 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -1416,9 +1416,16 @@ struct kvm_device_attr {
__u64   addr;   /* userspace address of attr data */
 };
 
-#define  KVM_DEV_VFIO_GROUP1
-#define   KVM_DEV_VFIO_GROUP_ADD   1
-#define   KVM_DEV_VFIO_GROUP_DEL   2
+#define  KVM_DEV_VFIO_FILE 1
+
+#define   KVM_DEV_VFIO_FILE_ADD1
+#define   KVM_DEV_VFIO_FILE_DEL2
+
+/* KVM_DEV_VFIO_GROUP aliases are for compile time uapi compatibility */
+#define  KVM_DEV_VFIO_GROUPKVM_DEV_VFIO_FILE
+
+#define   KVM_DEV_VFIO_GROUP_ADD   KVM_DEV_VFIO_FILE_ADD
+#define   KVM_DEV_VFIO_GROUP_DEL   KVM_DEV_VFIO_FILE_DEL
 #define   KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3
 
 enum kvm_device_type {
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index 8f7fa07e8170..07cb5f44b2a2 100644
--- a/virt/kvm/vfio.c
+++ b/virt/kvm/vfio.c
@@ -286,12 +286,12 @@ static int kvm_vfio_set_file(struct kvm_device *dev, long 
attr,
int32_t fd;
 
switch (attr) {
-   case KVM_DEV_VFIO_GROUP_ADD:
+   case KVM_DEV_VFIO_FILE_ADD:
if (get_user(fd, argp))
return -EFAULT;
return 

[Intel-gfx] [PATCH v13 02/22] vfio: Refine vfio file kAPIs for KVM

2023-06-16 Thread Yi Liu
This prepares for making the below kAPIs to accept both group file
and device file instead of only vfio group file.

  bool vfio_file_enforced_coherent(struct file *file);
  void vfio_file_set_kvm(struct file *file, struct kvm *kvm);

Reviewed-by: Kevin Tian 
Reviewed-by: Eric Auger 
Reviewed-by: Jason Gunthorpe 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c | 53 +---
 drivers/vfio/vfio.h  |  3 +++
 drivers/vfio/vfio_main.c | 49 +
 include/linux/vfio.h |  1 +
 virt/kvm/vfio.c  | 10 
 5 files changed, 75 insertions(+), 41 deletions(-)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index fbba9fc15e57..b56e19d2a02d 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -754,6 +754,15 @@ bool vfio_device_has_container(struct vfio_device *device)
return device->group->container;
 }
 
+struct vfio_group *vfio_group_from_file(struct file *file)
+{
+   struct vfio_group *group = file->private_data;
+
+   if (file->f_op != _group_fops)
+   return NULL;
+   return group;
+}
+
 /**
  * vfio_file_iommu_group - Return the struct iommu_group for the vfio group 
file
  * @file: VFIO group file
@@ -764,13 +773,13 @@ bool vfio_device_has_container(struct vfio_device *device)
  */
 struct iommu_group *vfio_file_iommu_group(struct file *file)
 {
-   struct vfio_group *group = file->private_data;
+   struct vfio_group *group = vfio_group_from_file(file);
struct iommu_group *iommu_group = NULL;
 
if (!IS_ENABLED(CONFIG_SPAPR_TCE_IOMMU))
return NULL;
 
-   if (!vfio_file_is_group(file))
+   if (!group)
return NULL;
 
mutex_lock(>group_lock);
@@ -784,33 +793,20 @@ struct iommu_group *vfio_file_iommu_group(struct file 
*file)
 EXPORT_SYMBOL_GPL(vfio_file_iommu_group);
 
 /**
- * vfio_file_is_group - True if the file is usable with VFIO aPIS
+ * vfio_file_is_group - True if the file is a vfio group file
  * @file: VFIO group file
  */
 bool vfio_file_is_group(struct file *file)
 {
-   return file->f_op == _group_fops;
+   return vfio_group_from_file(file);
 }
 EXPORT_SYMBOL_GPL(vfio_file_is_group);
 
-/**
- * vfio_file_enforced_coherent - True if the DMA associated with the VFIO file
- *is always CPU cache coherent
- * @file: VFIO group file
- *
- * Enforced coherency means that the IOMMU ignores things like the PCIe 
no-snoop
- * bit in DMA transactions. A return of false indicates that the user has
- * rights to access additional instructions such as wbinvd on x86.
- */
-bool vfio_file_enforced_coherent(struct file *file)
+bool vfio_group_enforced_coherent(struct vfio_group *group)
 {
-   struct vfio_group *group = file->private_data;
struct vfio_device *device;
bool ret = true;
 
-   if (!vfio_file_is_group(file))
-   return true;
-
/*
 * If the device does not have IOMMU_CAP_ENFORCE_CACHE_COHERENCY then
 * any domain later attached to it will also not support it. If the cap
@@ -828,28 +824,13 @@ bool vfio_file_enforced_coherent(struct file *file)
mutex_unlock(>device_lock);
return ret;
 }
-EXPORT_SYMBOL_GPL(vfio_file_enforced_coherent);
 
-/**
- * vfio_file_set_kvm - Link a kvm with VFIO drivers
- * @file: VFIO group file
- * @kvm: KVM to link
- *
- * When a VFIO device is first opened the KVM will be available in
- * device->kvm if one was associated with the group.
- */
-void vfio_file_set_kvm(struct file *file, struct kvm *kvm)
+void vfio_group_set_kvm(struct vfio_group *group, struct kvm *kvm)
 {
-   struct vfio_group *group = file->private_data;
-
-   if (!vfio_file_is_group(file))
-   return;
-
spin_lock(>kvm_ref_lock);
group->kvm = kvm;
spin_unlock(>kvm_ref_lock);
 }
-EXPORT_SYMBOL_GPL(vfio_file_set_kvm);
 
 /**
  * vfio_file_has_dev - True if the VFIO file is a handle for device
@@ -860,9 +841,9 @@ EXPORT_SYMBOL_GPL(vfio_file_set_kvm);
  */
 bool vfio_file_has_dev(struct file *file, struct vfio_device *device)
 {
-   struct vfio_group *group = file->private_data;
+   struct vfio_group *group = vfio_group_from_file(file);
 
-   if (!vfio_file_is_group(file))
+   if (!group)
return false;
 
return group == device->group;
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 87d3dd6b9ef9..b1e327a85a32 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -90,6 +90,9 @@ void vfio_device_group_unregister(struct vfio_device *device);
 int vfio_device_group_use_iommu(struct vfio_device *device);
 void vfio_device_group_unuse_iommu(struct vfio_device *device);
 void vfio_device_group_close(struct vfio_device *device);
+struct vfio_group *vfio_group_from_file(struct file *file);
+bool 

[Intel-gfx] [PATCH v13 01/22] vfio: Allocate per device file structure

2023-06-16 Thread Yi Liu
This is preparation for adding vfio device cdev support. vfio device
cdev requires:
1) A per device file memory to store the kvm pointer set by KVM. It will
   be propagated to vfio_device:kvm after the device cdev file is bound
   to an iommufd.
2) A mechanism to block device access through device cdev fd before it
   is bound to an iommufd.

To address the above requirements, this adds a per device file structure
named vfio_device_file. For now, it's only a wrapper of struct vfio_device
pointer. Other fields will be added to this per file structure in future
commits.

Reviewed-by: Kevin Tian 
Reviewed-by: Eric Auger 
Reviewed-by: Jason Gunthorpe 
Tested-by: Terrence Xu 
Tested-by: Nicolin Chen 
Tested-by: Matthew Rosato 
Tested-by: Yanting Jiang 
Tested-by: Shameer Kolothum 
Signed-off-by: Yi Liu 
---
 drivers/vfio/group.c | 13 +++--
 drivers/vfio/vfio.h  |  6 ++
 drivers/vfio/vfio_main.c | 31 ++-
 3 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index fc75c1000d74..fbba9fc15e57 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -218,19 +218,26 @@ void vfio_device_group_close(struct vfio_device *device)
 
 static struct file *vfio_device_open_file(struct vfio_device *device)
 {
+   struct vfio_device_file *df;
struct file *filep;
int ret;
 
+   df = vfio_allocate_device_file(device);
+   if (IS_ERR(df)) {
+   ret = PTR_ERR(df);
+   goto err_out;
+   }
+
ret = vfio_device_group_open(device);
if (ret)
-   goto err_out;
+   goto err_free;
 
/*
 * We can't use anon_inode_getfd() because we need to modify
 * the f_mode flags directly to allow more than just ioctls
 */
filep = anon_inode_getfile("[vfio-device]", _device_fops,
-  device, O_RDWR);
+  df, O_RDWR);
if (IS_ERR(filep)) {
ret = PTR_ERR(filep);
goto err_close_device;
@@ -254,6 +261,8 @@ static struct file *vfio_device_open_file(struct 
vfio_device *device)
 
 err_close_device:
vfio_device_group_close(device);
+err_free:
+   kfree(df);
 err_out:
return ERR_PTR(ret);
 }
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 7b19c621e0e6..87d3dd6b9ef9 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -16,11 +16,17 @@ struct iommufd_ctx;
 struct iommu_group;
 struct vfio_container;
 
+struct vfio_device_file {
+   struct vfio_device *device;
+};
+
 void vfio_device_put_registration(struct vfio_device *device);
 bool vfio_device_try_get_registration(struct vfio_device *device);
 int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd);
 void vfio_device_close(struct vfio_device *device,
   struct iommufd_ctx *iommufd);
+struct vfio_device_file *
+vfio_allocate_device_file(struct vfio_device *device);
 
 extern const struct file_operations vfio_device_fops;
 
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index ab4f3a794f78..39c1158ffef0 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -419,6 +419,20 @@ static bool vfio_assert_device_open(struct vfio_device 
*device)
return !WARN_ON_ONCE(!READ_ONCE(device->open_count));
 }
 
+struct vfio_device_file *
+vfio_allocate_device_file(struct vfio_device *device)
+{
+   struct vfio_device_file *df;
+
+   df = kzalloc(sizeof(*df), GFP_KERNEL_ACCOUNT);
+   if (!df)
+   return ERR_PTR(-ENOMEM);
+
+   df->device = device;
+
+   return df;
+}
+
 static int vfio_device_first_open(struct vfio_device *device,
  struct iommufd_ctx *iommufd)
 {
@@ -532,12 +546,15 @@ static inline void vfio_device_pm_runtime_put(struct 
vfio_device *device)
  */
 static int vfio_device_fops_release(struct inode *inode, struct file *filep)
 {
-   struct vfio_device *device = filep->private_data;
+   struct vfio_device_file *df = filep->private_data;
+   struct vfio_device *device = df->device;
 
vfio_device_group_close(device);
 
vfio_device_put_registration(device);
 
+   kfree(df);
+
return 0;
 }
 
@@ -1102,7 +1119,8 @@ static int vfio_ioctl_device_feature(struct vfio_device 
*device,
 static long vfio_device_fops_unl_ioctl(struct file *filep,
   unsigned int cmd, unsigned long arg)
 {
-   struct vfio_device *device = filep->private_data;
+   struct vfio_device_file *df = filep->private_data;
+   struct vfio_device *device = df->device;
int ret;
 
ret = vfio_device_pm_runtime_get(device);
@@ -1129,7 +1147,8 @@ static long vfio_device_fops_unl_ioctl(struct file *filep,
 static ssize_t vfio_device_fops_read(struct file *filep, char __user *buf,
 size_t count, 

[Intel-gfx] [PATCH v13 00/22] Add vfio_device cdev for iommufd support

2023-06-16 Thread Yi Liu
Existing VFIO provides group-centric user APIs for userspace. Userspace
opens the /dev/vfio/$group_id first before getting device fd and hence
getting access to device. This is not the desired model for iommufd. Per
the conclusion of community discussion[1], iommufd provides device-centric
kAPIs and requires its consumer (like VFIO) to be device-centric user
APIs. Such user APIs are used to associate device with iommufd and also
the I/O address spaces managed by the iommufd.

This series first introduces a per device file structure to be prepared
for further enhancement and refactors the kvm-vfio code to be prepared
for accepting device file from userspace. After this, adds a mechanism for
blocking device access before iommufd bind. Then refactors the vfio to be
able to handle cdev path (e.g. iommufd binding, no-iommufd, [de]attach ioas).
This refactor includes making the device_open exclusive between the group
and the cdev path, only allow single device open in cdev path; vfio-iommufd
code is also refactored to support cdev. e.g. split the vfio_iommufd_bind()
into two steps. Eventually, adds the cdev support for vfio device and the
new ioctls, then makes group infrastructure optional as it is not needed
when vfio device cdev is compiled.

This series is based on some preparation works done to vfio emulated devices[2]
and vfio pci hot reset enhancements[3].

This series is a prerequisite for iommu nesting for vfio device[4] [5].

The complete code can be found in below branch, simple tests done to the
legacy group path and the cdev path. Draft QEMU branch can be found at[6]
However, the noiommu mode test is only done with some hacks in kernel and
qemu to check if qemu can boot with noiommu devices.

https://github.com/yiliu1765/iommufd/tree/vfio_device_cdev_v13
(config CONFIG_IOMMUFD=y CONFIG_VFIO_DEVICE_CDEV=y)

base-commit: dcc9d48709e6bc6ec3da97626b8768582e138326

[1] 
https://lore.kernel.org/kvm/bn9pr11mb5433b1e4ae5b0480369f97178c...@bn9pr11mb5433.namprd11.prod.outlook.com/
[2] https://lore.kernel.org/kvm/20230327093351.44505-1-yi.l@intel.com/ - 
merged
[3] https://lore.kernel.org/kvm/20230616093042.65094-1-yi.l@intel.com/
[4] 
https://lore.kernel.org/linux-iommu/20230511143844.22693-1-yi.l@intel.com/
[5] 
https://lore.kernel.org/linux-iommu/20230511145110.27707-1-yi.l@intel.com/#t
[6] https://github.com/yiliu1765/qemu/tree/iommufd_rfcv4.mig.reset.v4_var3

Change log:

v13:
 - vfio_device_first_open() and vfio_device_last_close() to be 
vfio_df_device_first_open()
   vfio_df_device_last_close() (Alex)
 - Define struct vfio_device_file::access_granted as u8 and also place the u32 
devid to
   be behind this flag as this structure access is hot, so needs to avoid too 
much hole
   in the structure (Alex)
 - Use u8 instead bool in the struct vfio_device for the flags (Alex)
 - Define BIND, ATTACH, DETACH ioctl behind VFIO_DEVICE_FEATURE whose offset is 
17 (Alex)
 - Drop patch 20, 21, 22 of v12 (Alex)
 - Per the patch drop, still needs to detect the physical devices that do not 
have
   IOMMU in the cdev registration as cdev does not support such devices. Per the
   suggestion from Jason, lift the IOMMU_CAP_CACHE_COHERENCY check to be in 
vfio_main.c
   so that it can fail the registration of such devices if only cdev is 
compiled. (Jason, Alex)
 - Refine the vfio.rst doc, highlight that the cdev device access is stil bound 
with
   iommu group. (Alex)
 - Reaffirm t-b from below folks:
   Nicolin Chen - Test nesting branch which is based on cdev v12, the test is 
done on ARM64 (SMMUv3)
   Matthew Rosato - vfio-pci, vfio-ap, vfio-ccw under container, compat and 
cdev mode, and nesting
test on SMMUv3 and Intel.
   Yanting Jiang - regression tests with NIC passthrough on Intel platform

v12: https://lore.kernel.org/kvm/20230602121653.80017-1-yi.l@intel.com/#r
 - Rename vfio_device_xx() to be vfio_df_xx() if the object is vfio_device_file 
(Alex)
 - Refine patch 10 of v11 (Alex)
 - Add new device ioctls from offset 18 (Alex)
 - Add a patch to check group->type for noiommu test, no need to check
   CONFIG_VFIO_NOIOMMU (Alex)
 - Refine the logic of vfio_device_set_noiommu() per Alex's suggestion. The 
noiommu
   taint is moved to __vfio_register_dev(), also add a check on group type 
before
   calling vfio_device_set_noiommu() as only physical device can be noiommu 
device.
 - Drop noiommu support for cdev, patch 16 of v11 is dropped, the related 
changes
   are in patch 17 - 24 of this series.

v11: https://lore.kernel.org/kvm/20230513132827.39066-1-yi.l@intel.com/
 - Add back the noiommu determination at vfio device registration patch and
   put it prior to compiling vfio_group code optionally as compiling vfio_group
   optionaly is the major reason for it.
 - Fix a typo related to SPAPR (Cédric Le Goater)
 - Add t-b from Shameerali Kolothum Thodi, tested on HiSilicon D06(ARM64) 
platform
   with a NIC pass-through

v10: 

[Intel-gfx] [PATCH] drm/i915: make i915_drm_client_fdinfo() reference conditional again

2023-06-16 Thread Arnd Bergmann
From: Arnd Bergmann 

The function is only defined if CONFIG_PROC_FS is enabled:

ld.lld: error: undefined symbol: i915_drm_client_fdinfo
>>> referenced by i915_driver.c
>>>   drivers/gpu/drm/i915/i915_driver.o:(i915_drm_driver) in 
>>> archive vmlinux.a

Use the PTR_IF() helper to make the reference NULL otherwise.

Fixes: e894b724c316d ("drm/i915: Use the fdinfo helper")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/i915/i915_driver.c | 2 +-
 drivers/gpu/drm/i915/i915_drm_client.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_driver.c 
b/drivers/gpu/drm/i915/i915_driver.c
index 75cbc43b326dd..0ad0c5885ec27 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1816,7 +1816,7 @@ static const struct drm_driver i915_drm_driver = {
.open = i915_driver_open,
.lastclose = i915_driver_lastclose,
.postclose = i915_driver_postclose,
-   .show_fdinfo = i915_drm_client_fdinfo,
+   .show_fdinfo = PTR_IF(IS_ENABLED(CONFIG_PROC_FS), 
i915_drm_client_fdinfo),
 
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/i915/i915_drm_client.h 
b/drivers/gpu/drm/i915/i915_drm_client.h
index 4c18b99e10a4e..67816c912bca1 100644
--- a/drivers/gpu/drm/i915/i915_drm_client.h
+++ b/drivers/gpu/drm/i915/i915_drm_client.h
@@ -47,8 +47,6 @@ static inline void i915_drm_client_put(struct i915_drm_client 
*client)
 
 struct i915_drm_client *i915_drm_client_alloc(void);
 
-#ifdef CONFIG_PROC_FS
 void i915_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
-#endif
 
 #endif /* !__I915_DRM_CLIENT_H__ */
-- 
2.39.2



[Intel-gfx] [PATCH v8 03/10] iommufd: Reserve all negative IDs in the iommufd xarray

2023-06-16 Thread Yi Liu
With this reservation, IOMMUFD users can encode the negative IDs for
specific purposes. e.g. VFIO needs two reserved values to tell userspace
the ID returned is not valid but has other meaning.

Tested-by: Terrence Xu 
Reviewed-by: Jason Gunthorpe 
Signed-off-by: Yi Liu 
---
 drivers/iommu/iommufd/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c
index 3fbe636c3d8a..32ce7befc8dd 100644
--- a/drivers/iommu/iommufd/main.c
+++ b/drivers/iommu/iommufd/main.c
@@ -50,7 +50,7 @@ struct iommufd_object *_iommufd_object_alloc(struct 
iommufd_ctx *ictx,
 * before calling iommufd_object_finalize().
 */
rc = xa_alloc(>objects, >id, XA_ZERO_ENTRY,
- xa_limit_32b, GFP_KERNEL_ACCOUNT);
+ xa_limit_31b, GFP_KERNEL_ACCOUNT);
if (rc)
goto out_free;
return obj;
-- 
2.34.1



[Intel-gfx] [PATCH v8 06/10] vfio: Mark cdev usage in vfio_device

2023-06-16 Thread Yi Liu
This can be used to differentiate whether to report group_id or devid in
the revised VFIO_DEVICE_GET_PCI_HOT_RESET_INFO ioctl. At this moment, no
cdev path yet, so the vfio_device_cdev_opened() helper always returns false.

Reviewed-by: Kevin Tian 
Tested-by: Terrence Xu 
Signed-off-by: Yi Liu 
---
 include/linux/vfio.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 2c137ea94a3e..2a45853773a6 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -139,6 +139,11 @@ int vfio_iommufd_emulated_attach_ioas(struct vfio_device 
*vdev, u32 *pt_id);
((int (*)(struct vfio_device *vdev, u32 *pt_id)) NULL)
 #endif
 
+static inline bool vfio_device_cdev_opened(struct vfio_device *device)
+{
+   return false;
+}
+
 /**
  * struct vfio_migration_ops - VFIO bus device driver migration callbacks
  *
-- 
2.34.1



[Intel-gfx] [PATCH v8 10/10] vfio/pci: Allow passing zero-length fd array in VFIO_DEVICE_PCI_HOT_RESET

2023-06-16 Thread Yi Liu
This is the way user to invoke hot-reset for the devices opened by cdev
interface. User should check the flag VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED
in the output of VFIO_DEVICE_GET_PCI_HOT_RESET_INFO ioctl before doing
hot-reset for cdev devices.

Suggested-by: Jason Gunthorpe 
Signed-off-by: Jason Gunthorpe 
Reviewed-by: Jason Gunthorpe 
Tested-by: Yanting Jiang 
Signed-off-by: Yi Liu 
---
 drivers/vfio/pci/vfio_pci_core.c | 61 ++--
 include/uapi/linux/vfio.h| 21 +++
 2 files changed, 71 insertions(+), 11 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 5998da0f5771..860f8119ec9f 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -181,7 +181,8 @@ static void vfio_pci_probe_mmaps(struct 
vfio_pci_core_device *vdev)
 struct vfio_pci_group_info;
 static void vfio_pci_dev_set_try_reset(struct vfio_device_set *dev_set);
 static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
- struct vfio_pci_group_info *groups);
+ struct vfio_pci_group_info *groups,
+ struct iommufd_ctx *iommufd_ctx);
 
 /*
  * INTx masking requires the ability to disable INTx signaling via PCI_COMMAND
@@ -1291,8 +1292,7 @@ vfio_pci_ioctl_pci_hot_reset_groups(struct 
vfio_pci_core_device *vdev,
if (ret)
return ret;
 
-   /* Somewhere between 1 and count is OK */
-   if (!array_count || array_count > count)
+   if (array_count > count)
return -EINVAL;
 
group_fds = kcalloc(array_count, sizeof(*group_fds), GFP_KERNEL);
@@ -1341,7 +1341,7 @@ vfio_pci_ioctl_pci_hot_reset_groups(struct 
vfio_pci_core_device *vdev,
info.count = array_count;
info.files = files;
 
-   ret = vfio_pci_dev_set_hot_reset(vdev->vdev.dev_set, );
+   ret = vfio_pci_dev_set_hot_reset(vdev->vdev.dev_set, , NULL);
 
 hot_reset_release:
for (file_idx--; file_idx >= 0; file_idx--)
@@ -1364,13 +1364,21 @@ static int vfio_pci_ioctl_pci_hot_reset(struct 
vfio_pci_core_device *vdev,
if (hdr.argsz < minsz || hdr.flags)
return -EINVAL;
 
+   /* zero-length array is only for cdev opened devices */
+   if (!!hdr.count == vfio_device_cdev_opened(>vdev))
+   return -EINVAL;
+
/* Can we do a slot or bus reset or neither? */
if (!pci_probe_reset_slot(vdev->pdev->slot))
slot = true;
else if (pci_probe_reset_bus(vdev->pdev->bus))
return -ENODEV;
 
-   return vfio_pci_ioctl_pci_hot_reset_groups(vdev, hdr.count, slot, arg);
+   if (hdr.count)
+   return vfio_pci_ioctl_pci_hot_reset_groups(vdev, hdr.count, 
slot, arg);
+
+   return vfio_pci_dev_set_hot_reset(vdev->vdev.dev_set, NULL,
+ 
vfio_iommufd_device_ictx(>vdev));
 }
 
 static int vfio_pci_ioctl_ioeventfd(struct vfio_pci_core_device *vdev,
@@ -2338,13 +2346,16 @@ const struct pci_error_handlers 
vfio_pci_core_err_handlers = {
 };
 EXPORT_SYMBOL_GPL(vfio_pci_core_err_handlers);
 
-static bool vfio_dev_in_groups(struct vfio_pci_core_device *vdev,
+static bool vfio_dev_in_groups(struct vfio_device *vdev,
   struct vfio_pci_group_info *groups)
 {
unsigned int i;
 
+   if (!groups)
+   return false;
+
for (i = 0; i < groups->count; i++)
-   if (vfio_file_has_dev(groups->files[i], >vdev))
+   if (vfio_file_has_dev(groups->files[i], vdev))
return true;
return false;
 }
@@ -2420,7 +2431,8 @@ static int vfio_pci_dev_set_pm_runtime_get(struct 
vfio_device_set *dev_set)
  * get each memory_lock.
  */
 static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
- struct vfio_pci_group_info *groups)
+ struct vfio_pci_group_info *groups,
+ struct iommufd_ctx *iommufd_ctx)
 {
struct vfio_pci_core_device *cur_mem;
struct vfio_pci_core_device *cur_vma;
@@ -2450,11 +2462,38 @@ static int vfio_pci_dev_set_hot_reset(struct 
vfio_device_set *dev_set,
goto err_unlock;
 
list_for_each_entry(cur_vma, _set->device_list, vdev.dev_set_list) {
+   bool owned;
+
/*
-* Test whether all the affected devices are contained by the
-* set of groups provided by the user.
+* Test whether all the affected devices can be reset by the
+* user.
+*
+* If called from a group opened device and the user provides
+* a set of groups, all the devices in the dev_set should be
+* contained by the set of groups provided by the user.
+*
+

[Intel-gfx] [PATCH v8 09/10] vfio/pci: Copy hot-reset device info to userspace in the devices loop

2023-06-16 Thread Yi Liu
This copies the vfio_pci_dependent_device to userspace during looping each
affected device for reporting vfio_pci_hot_reset_info. This avoids counting
the affected devices and allocating a potential large buffer to store the
vfio_pci_dependent_device of all the affected devices before copying them
to userspace.

Suggested-by: Jason Gunthorpe 
Signed-off-by: Jason Gunthorpe 
Signed-off-by: Yi Liu 
---
 drivers/vfio/pci/vfio_pci_core.c | 93 
 1 file changed, 33 insertions(+), 60 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 65e3ee5255a6..5998da0f5771 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -777,19 +777,25 @@ static int vfio_pci_count_devs(struct pci_dev *pdev, void 
*data)
 }
 
 struct vfio_pci_fill_info {
-   int max;
-   int cur;
-   struct vfio_pci_dependent_device *devices;
+   struct vfio_pci_dependent_device __user *devices;
+   struct vfio_pci_dependent_device __user *devices_end;
struct vfio_device *vdev;
+   u32 count;
u32 flags;
 };
 
 static int vfio_pci_fill_devs(struct pci_dev *pdev, void *data)
 {
+   struct vfio_pci_dependent_device info = {
+   .segment = pci_domain_nr(pdev->bus),
+   .bus = pdev->bus->number,
+   .devfn = pdev->devfn,
+   };
struct vfio_pci_fill_info *fill = data;
 
-   if (fill->cur == fill->max)
-   return -EAGAIN; /* Something changed, try again */
+   fill->count++;
+   if (fill->devices >= fill->devices_end)
+   return 0;
 
if (fill->flags & VFIO_PCI_HOT_RESET_FLAG_DEV_ID) {
struct iommufd_ctx *iommufd = 
vfio_iommufd_device_ictx(fill->vdev);
@@ -802,19 +808,19 @@ static int vfio_pci_fill_devs(struct pci_dev *pdev, void 
*data)
 */
vdev = vfio_find_device_in_devset(dev_set, >dev);
if (!vdev) {
-   fill->devices[fill->cur].devid = 
VFIO_PCI_DEVID_NOT_OWNED;
+   info.devid = VFIO_PCI_DEVID_NOT_OWNED;
} else {
int id = vfio_iommufd_get_dev_id(vdev, iommufd);
 
if (id > 0)
-   fill->devices[fill->cur].devid = id;
+   info.devid = id;
else if (id == -ENOENT)
-   fill->devices[fill->cur].devid = 
VFIO_PCI_DEVID_OWNED;
+   info.devid = VFIO_PCI_DEVID_OWNED;
else
-   fill->devices[fill->cur].devid = 
VFIO_PCI_DEVID_NOT_OWNED;
+   info.devid = VFIO_PCI_DEVID_NOT_OWNED;
}
/* If devid is VFIO_PCI_DEVID_NOT_OWNED, clear owned flag. */
-   if (fill->devices[fill->cur].devid == VFIO_PCI_DEVID_NOT_OWNED)
+   if (info.devid == VFIO_PCI_DEVID_NOT_OWNED)
fill->flags &= ~VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED;
} else {
struct iommu_group *iommu_group;
@@ -823,13 +829,13 @@ static int vfio_pci_fill_devs(struct pci_dev *pdev, void 
*data)
if (!iommu_group)
return -EPERM; /* Cannot reset non-isolated devices */
 
-   fill->devices[fill->cur].group_id = iommu_group_id(iommu_group);
+   info.group_id = iommu_group_id(iommu_group);
iommu_group_put(iommu_group);
}
-   fill->devices[fill->cur].segment = pci_domain_nr(pdev->bus);
-   fill->devices[fill->cur].bus = pdev->bus->number;
-   fill->devices[fill->cur].devfn = pdev->devfn;
-   fill->cur++;
+
+   if (copy_to_user(fill->devices, , sizeof(info)))
+   return -EFAULT;
+   fill->devices++;
return 0;
 }
 
@@ -1221,8 +1227,7 @@ static int vfio_pci_ioctl_get_pci_hot_reset_info(
unsigned long minsz =
offsetofend(struct vfio_pci_hot_reset_info, count);
struct vfio_pci_hot_reset_info hdr;
-   struct vfio_pci_fill_info fill = { 0 };
-   struct vfio_pci_dependent_device *devices = NULL;
+   struct vfio_pci_fill_info fill = {};
bool slot = false;
int ret = 0;
 
@@ -1240,29 +1245,9 @@ static int vfio_pci_ioctl_get_pci_hot_reset_info(
else if (pci_probe_reset_bus(vdev->pdev->bus))
return -ENODEV;
 
-   /* How many devices are affected? */
-   ret = vfio_pci_for_each_slot_or_bus(vdev->pdev, vfio_pci_count_devs,
-   , slot);
-   if (ret)
-   return ret;
-
-   WARN_ON(!fill.max); /* Should always be at least one */
-
-   /*
-* If there's enough space, fill it now, otherwise return -ENOSPC and
-* the number of devices affected.
-*/
-   if (hdr.argsz < sizeof(hdr) + (fill.max * sizeof(*devices))) {
-

[Intel-gfx] [PATCH v8 07/10] vfio: Add helper to search vfio_device in a dev_set

2023-06-16 Thread Yi Liu
There are drivers that need to search vfio_device within a given dev_set.
e.g. vfio-pci. So add a helper.

vfio_pci_is_device_in_set() now returns -EBUSY in commit a882c16a2b7e
("vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set") where
it was trying to preserve the return of vfio_pci_try_zap_and_vma_lock_cb().
However, it makes more sense to return -ENODEV.

Suggested-by: Alex Williamson 
Tested-by: Terrence Xu 
Reviewed-by: Jason Gunthorpe 
Signed-off-by: Yi Liu 
---
 drivers/vfio/pci/vfio_pci_core.c |  6 +-
 drivers/vfio/vfio_main.c | 15 +++
 include/linux/vfio.h |  3 +++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index cc23c9d65826..6f13161dca6b 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -2339,12 +2339,8 @@ static bool vfio_dev_in_groups(struct 
vfio_pci_core_device *vdev,
 static int vfio_pci_is_device_in_set(struct pci_dev *pdev, void *data)
 {
struct vfio_device_set *dev_set = data;
-   struct vfio_device *cur;
 
-   list_for_each_entry(cur, _set->device_list, dev_set_list)
-   if (cur->dev == >dev)
-   return 0;
-   return -EBUSY;
+   return vfio_find_device_in_devset(dev_set, >dev) ? 0 : -ENODEV;
 }
 
 /*
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index f0ca33b2e1df..ab4f3a794f78 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -141,6 +141,21 @@ unsigned int vfio_device_set_open_count(struct 
vfio_device_set *dev_set)
 }
 EXPORT_SYMBOL_GPL(vfio_device_set_open_count);
 
+struct vfio_device *
+vfio_find_device_in_devset(struct vfio_device_set *dev_set,
+  struct device *dev)
+{
+   struct vfio_device *cur;
+
+   lockdep_assert_held(_set->lock);
+
+   list_for_each_entry(cur, _set->device_list, dev_set_list)
+   if (cur->dev == dev)
+   return cur;
+   return NULL;
+}
+EXPORT_SYMBOL_GPL(vfio_find_device_in_devset);
+
 /*
  * Device objects - create, release, get, put, search
  */
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 2a45853773a6..ee120d2d530b 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -244,6 +244,9 @@ void vfio_unregister_group_dev(struct vfio_device *device);
 
 int vfio_assign_device_set(struct vfio_device *device, void *set_id);
 unsigned int vfio_device_set_open_count(struct vfio_device_set *dev_set);
+struct vfio_device *
+vfio_find_device_in_devset(struct vfio_device_set *dev_set,
+  struct device *dev);
 
 int vfio_mig_get_next_state(struct vfio_device *device,
enum vfio_device_mig_state cur_fsm,
-- 
2.34.1



[Intel-gfx] [PATCH v8 02/10] vfio/pci: Move the existing hot reset logic to be a helper

2023-06-16 Thread Yi Liu
This prepares to add another method for hot reset. The major hot reset logic
are moved to vfio_pci_ioctl_pci_hot_reset_groups().

No functional change is intended.

Suggested-by: Jason Gunthorpe 
Signed-off-by: Jason Gunthorpe 
Reviewed-by: Jason Gunthorpe 
Reviewed-by: Eric Auger 
Reviewed-by: Kevin Tian 
Tested-by: Yanting Jiang 
Tested-by: Terrence Xu 
Signed-off-by: Yi Liu 
---
 drivers/vfio/pci/vfio_pci_core.c | 55 +++-
 1 file changed, 32 insertions(+), 23 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index f4153fd22a87..cc23c9d65826 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -1258,29 +1258,16 @@ static int vfio_pci_ioctl_get_pci_hot_reset_info(
return ret;
 }
 
-static int vfio_pci_ioctl_pci_hot_reset(struct vfio_pci_core_device *vdev,
-   struct vfio_pci_hot_reset __user *arg)
+static int
+vfio_pci_ioctl_pci_hot_reset_groups(struct vfio_pci_core_device *vdev,
+   int array_count, bool slot,
+   struct vfio_pci_hot_reset __user *arg)
 {
-   unsigned long minsz = offsetofend(struct vfio_pci_hot_reset, count);
-   struct vfio_pci_hot_reset hdr;
int32_t *group_fds;
struct file **files;
struct vfio_pci_group_info info;
-   bool slot = false;
int file_idx, count = 0, ret = 0;
 
-   if (copy_from_user(, arg, minsz))
-   return -EFAULT;
-
-   if (hdr.argsz < minsz || hdr.flags)
-   return -EINVAL;
-
-   /* Can we do a slot or bus reset or neither? */
-   if (!pci_probe_reset_slot(vdev->pdev->slot))
-   slot = true;
-   else if (pci_probe_reset_bus(vdev->pdev->bus))
-   return -ENODEV;
-
/*
 * We can't let userspace give us an arbitrarily large buffer to copy,
 * so verify how many we think there could be.  Note groups can have
@@ -1292,11 +1279,11 @@ static int vfio_pci_ioctl_pci_hot_reset(struct 
vfio_pci_core_device *vdev,
return ret;
 
/* Somewhere between 1 and count is OK */
-   if (!hdr.count || hdr.count > count)
+   if (!array_count || array_count > count)
return -EINVAL;
 
-   group_fds = kcalloc(hdr.count, sizeof(*group_fds), GFP_KERNEL);
-   files = kcalloc(hdr.count, sizeof(*files), GFP_KERNEL);
+   group_fds = kcalloc(array_count, sizeof(*group_fds), GFP_KERNEL);
+   files = kcalloc(array_count, sizeof(*files), GFP_KERNEL);
if (!group_fds || !files) {
kfree(group_fds);
kfree(files);
@@ -1304,7 +1291,7 @@ static int vfio_pci_ioctl_pci_hot_reset(struct 
vfio_pci_core_device *vdev,
}
 
if (copy_from_user(group_fds, arg->group_fds,
-  hdr.count * sizeof(*group_fds))) {
+  array_count * sizeof(*group_fds))) {
kfree(group_fds);
kfree(files);
return -EFAULT;
@@ -1314,7 +1301,7 @@ static int vfio_pci_ioctl_pci_hot_reset(struct 
vfio_pci_core_device *vdev,
 * Get the group file for each fd to ensure the group is held across
 * the reset
 */
-   for (file_idx = 0; file_idx < hdr.count; file_idx++) {
+   for (file_idx = 0; file_idx < array_count; file_idx++) {
struct file *file = fget(group_fds[file_idx]);
 
if (!file) {
@@ -1338,7 +1325,7 @@ static int vfio_pci_ioctl_pci_hot_reset(struct 
vfio_pci_core_device *vdev,
if (ret)
goto hot_reset_release;
 
-   info.count = hdr.count;
+   info.count = array_count;
info.files = files;
 
ret = vfio_pci_dev_set_hot_reset(vdev->vdev.dev_set, );
@@ -1351,6 +1338,28 @@ static int vfio_pci_ioctl_pci_hot_reset(struct 
vfio_pci_core_device *vdev,
return ret;
 }
 
+static int vfio_pci_ioctl_pci_hot_reset(struct vfio_pci_core_device *vdev,
+   struct vfio_pci_hot_reset __user *arg)
+{
+   unsigned long minsz = offsetofend(struct vfio_pci_hot_reset, count);
+   struct vfio_pci_hot_reset hdr;
+   bool slot = false;
+
+   if (copy_from_user(, arg, minsz))
+   return -EFAULT;
+
+   if (hdr.argsz < minsz || hdr.flags)
+   return -EINVAL;
+
+   /* Can we do a slot or bus reset or neither? */
+   if (!pci_probe_reset_slot(vdev->pdev->slot))
+   slot = true;
+   else if (pci_probe_reset_bus(vdev->pdev->bus))
+   return -ENODEV;
+
+   return vfio_pci_ioctl_pci_hot_reset_groups(vdev, hdr.count, slot, arg);
+}
+
 static int vfio_pci_ioctl_ioeventfd(struct vfio_pci_core_device *vdev,
struct vfio_device_ioeventfd __user *arg)
 {
-- 
2.34.1



[Intel-gfx] [PATCH v8 05/10] iommufd: Add helper to retrieve iommufd_ctx and devid

2023-06-16 Thread Yi Liu
This is needed by the vfio-pci driver to report affected devices in the
hot-reset for a given device.

Tested-by: Terrence Xu 
Reviewed-by: Jason Gunthorpe 
Signed-off-by: Yi Liu 
---
 drivers/iommu/iommufd/device.c | 12 
 include/linux/iommufd.h|  3 +++
 2 files changed, 15 insertions(+)

diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index 4571344c8508..96d4281bfa7c 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -146,6 +146,18 @@ void iommufd_device_unbind(struct iommufd_device *idev)
 }
 EXPORT_SYMBOL_NS_GPL(iommufd_device_unbind, IOMMUFD);
 
+struct iommufd_ctx *iommufd_device_to_ictx(struct iommufd_device *idev)
+{
+   return idev->ictx;
+}
+EXPORT_SYMBOL_NS_GPL(iommufd_device_to_ictx, IOMMUFD);
+
+u32 iommufd_device_to_id(struct iommufd_device *idev)
+{
+   return idev->obj.id;
+}
+EXPORT_SYMBOL_NS_GPL(iommufd_device_to_id, IOMMUFD);
+
 static int iommufd_device_setup_msi(struct iommufd_device *idev,
struct iommufd_hw_pagetable *hwpt,
phys_addr_t sw_msi_start)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index f241bafa03da..68defed9ea48 100644
--- a/include/linux/iommufd.h
+++ b/include/linux/iommufd.h
@@ -25,6 +25,9 @@ void iommufd_device_unbind(struct iommufd_device *idev);
 int iommufd_device_attach(struct iommufd_device *idev, u32 *pt_id);
 void iommufd_device_detach(struct iommufd_device *idev);
 
+struct iommufd_ctx *iommufd_device_to_ictx(struct iommufd_device *idev);
+u32 iommufd_device_to_id(struct iommufd_device *idev);
+
 struct iommufd_access_ops {
u8 needs_pin_pages : 1;
void (*unmap)(void *data, unsigned long iova, unsigned long length);
-- 
2.34.1



[Intel-gfx] [PATCH v8 08/10] vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device cdev

2023-06-16 Thread Yi Liu
This allows VFIO_DEVICE_GET_PCI_HOT_RESET_INFO ioctl use the iommufd_ctx
of the cdev device to check the ownership of the other affected devices.

When VFIO_DEVICE_GET_PCI_HOT_RESET_INFO is called on an IOMMUFD managed
device, the new flag VFIO_PCI_HOT_RESET_FLAG_DEV_ID is reported to indicate
the values returned are IOMMUFD devids rather than group IDs as used when
accessing vfio devices through the conventional vfio group interface.
Additionally the flag VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED will be reported
in this mode if all of the devices affected by the hot-reset are owned by
either virtue of being directly bound to the same iommufd context as the
calling device, or implicitly owned via a shared IOMMU group.

Suggested-by: Jason Gunthorpe 
Suggested-by: Alex Williamson 
Signed-off-by: Yi Liu 
---
 drivers/vfio/iommufd.c   | 44 ++
 drivers/vfio/pci/vfio_pci_core.c | 54 +++-
 include/linux/vfio.h | 14 +
 include/uapi/linux/vfio.h| 50 -
 4 files changed, 154 insertions(+), 8 deletions(-)

diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
index 88b00c501015..afda47ee9663 100644
--- a/drivers/vfio/iommufd.c
+++ b/drivers/vfio/iommufd.c
@@ -66,6 +66,50 @@ void vfio_iommufd_unbind(struct vfio_device *vdev)
vdev->ops->unbind_iommufd(vdev);
 }
 
+struct iommufd_ctx *vfio_iommufd_device_ictx(struct vfio_device *vdev)
+{
+   if (vdev->iommufd_device)
+   return iommufd_device_to_ictx(vdev->iommufd_device);
+   return NULL;
+}
+EXPORT_SYMBOL_GPL(vfio_iommufd_device_ictx);
+
+static int vfio_iommufd_device_id(struct vfio_device *vdev)
+{
+   if (vdev->iommufd_device)
+   return iommufd_device_to_id(vdev->iommufd_device);
+   return -EINVAL;
+}
+
+/*
+ * Return devid for a device.
+ *  valid ID for the device that is owned by the ictx
+ *  -ENOENT = device is owned but there is no ID
+ *  -ENODEV or other error = device is not owned
+ */
+int vfio_iommufd_get_dev_id(struct vfio_device *vdev, struct iommufd_ctx *ictx)
+{
+   struct iommu_group *group;
+   int devid;
+
+   if (vfio_iommufd_device_ictx(vdev) == ictx)
+   return vfio_iommufd_device_id(vdev);
+
+   group = iommu_group_get(vdev->dev);
+   if (!group)
+   return -ENODEV;
+
+   if (iommufd_ctx_has_group(ictx, group))
+   devid = -ENOENT;
+   else
+   devid = -ENODEV;
+
+   iommu_group_put(group);
+
+   return devid;
+}
+EXPORT_SYMBOL_GPL(vfio_iommufd_get_dev_id);
+
 /*
  * The physical standard ops mean that the iommufd_device is bound to the
  * physical device vdev->dev that was provided to vfio_init_group_dev(). 
Drivers
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 6f13161dca6b..65e3ee5255a6 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #if IS_ENABLED(CONFIG_EEH)
 #include 
 #endif
@@ -779,26 +780,56 @@ struct vfio_pci_fill_info {
int max;
int cur;
struct vfio_pci_dependent_device *devices;
+   struct vfio_device *vdev;
+   u32 flags;
 };
 
 static int vfio_pci_fill_devs(struct pci_dev *pdev, void *data)
 {
struct vfio_pci_fill_info *fill = data;
-   struct iommu_group *iommu_group;
 
if (fill->cur == fill->max)
return -EAGAIN; /* Something changed, try again */
 
-   iommu_group = iommu_group_get(>dev);
-   if (!iommu_group)
-   return -EPERM; /* Cannot reset non-isolated devices */
+   if (fill->flags & VFIO_PCI_HOT_RESET_FLAG_DEV_ID) {
+   struct iommufd_ctx *iommufd = 
vfio_iommufd_device_ictx(fill->vdev);
+   struct vfio_device_set *dev_set = fill->vdev->dev_set;
+   struct vfio_device *vdev;
 
-   fill->devices[fill->cur].group_id = iommu_group_id(iommu_group);
+   /*
+* hot-reset requires all affected devices be represented in
+* the dev_set.
+*/
+   vdev = vfio_find_device_in_devset(dev_set, >dev);
+   if (!vdev) {
+   fill->devices[fill->cur].devid = 
VFIO_PCI_DEVID_NOT_OWNED;
+   } else {
+   int id = vfio_iommufd_get_dev_id(vdev, iommufd);
+
+   if (id > 0)
+   fill->devices[fill->cur].devid = id;
+   else if (id == -ENOENT)
+   fill->devices[fill->cur].devid = 
VFIO_PCI_DEVID_OWNED;
+   else
+   fill->devices[fill->cur].devid = 
VFIO_PCI_DEVID_NOT_OWNED;
+   }
+   /* If devid is VFIO_PCI_DEVID_NOT_OWNED, clear owned flag. */
+   if (fill->devices[fill->cur].devid == VFIO_PCI_DEVID_NOT_OWNED)
+ 

[Intel-gfx] [PATCH v8 04/10] iommufd: Add iommufd_ctx_has_group()

2023-06-16 Thread Yi Liu
This adds the helper to check if any device within the given iommu_group
has been bound with the iommufd_ctx. This is helpful for the checking on
device ownership for the devices which have not been bound but cannot be
bound to any other iommufd_ctx as the iommu_group has been bound.

Tested-by: Terrence Xu 
Reviewed-by: Jason Gunthorpe 
Signed-off-by: Yi Liu 
---
 drivers/iommu/iommufd/device.c | 30 ++
 include/linux/iommufd.h|  2 ++
 2 files changed, 32 insertions(+)

diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index 4f9b2142274c..4571344c8508 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -98,6 +98,36 @@ struct iommufd_device *iommufd_device_bind(struct 
iommufd_ctx *ictx,
 }
 EXPORT_SYMBOL_NS_GPL(iommufd_device_bind, IOMMUFD);
 
+/**
+ * iommufd_ctx_has_group - True if any device within the group is bound
+ * to the ictx
+ * @ictx: iommufd file descriptor
+ * @group: Pointer to a physical iommu_group struct
+ *
+ * True if any device within the group has been bound to this ictx, ex. via
+ * iommufd_device_bind(), therefore implying ictx ownership of the group.
+ */
+bool iommufd_ctx_has_group(struct iommufd_ctx *ictx, struct iommu_group *group)
+{
+   struct iommufd_object *obj;
+   unsigned long index;
+
+   if (!ictx || !group)
+   return false;
+
+   xa_lock(>objects);
+   xa_for_each(>objects, index, obj) {
+   if (obj->type == IOMMUFD_OBJ_DEVICE &&
+   container_of(obj, struct iommufd_device, obj)->group == 
group) {
+   xa_unlock(>objects);
+   return true;
+   }
+   }
+   xa_unlock(>objects);
+   return false;
+}
+EXPORT_SYMBOL_NS_GPL(iommufd_ctx_has_group, IOMMUFD);
+
 /**
  * iommufd_device_unbind - Undo iommufd_device_bind()
  * @idev: Device returned by iommufd_device_bind()
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 1129a36a74c4..f241bafa03da 100644
--- a/include/linux/iommufd.h
+++ b/include/linux/iommufd.h
@@ -16,6 +16,7 @@ struct page;
 struct iommufd_ctx;
 struct iommufd_access;
 struct file;
+struct iommu_group;
 
 struct iommufd_device *iommufd_device_bind(struct iommufd_ctx *ictx,
   struct device *dev, u32 *id);
@@ -50,6 +51,7 @@ void iommufd_ctx_get(struct iommufd_ctx *ictx);
 #if IS_ENABLED(CONFIG_IOMMUFD)
 struct iommufd_ctx *iommufd_ctx_from_file(struct file *file);
 void iommufd_ctx_put(struct iommufd_ctx *ictx);
+bool iommufd_ctx_has_group(struct iommufd_ctx *ictx, struct iommu_group 
*group);
 
 int iommufd_access_pin_pages(struct iommufd_access *access, unsigned long iova,
 unsigned long length, struct page **out_pages,
-- 
2.34.1



[Intel-gfx] [PATCH v8 00/10] Enhance vfio PCI hot reset for vfio cdev device

2023-06-16 Thread Yi Liu
VFIO_DEVICE_PCI_HOT_RESET requires user to pass an array of group fds
to prove that it owns all devices affected by resetting the calling
device. While for cdev devices, user can use an iommufd-based ownership
checking model and invoke VFIO_DEVICE_PCI_HOT_RESET with a zero-length
fd array.

This series extends VFIO_DEVICE_GET_PCI_HOT_RESET_INFO to check ownership
and return the check result and the devid of affected devices to user. In
the end, extends the VFIO_DEVICE_PCI_HOT_RESET to accept zero-length fd
array for hot-reset with cdev devices.

The new hot reset method and updated _INFO ioctl are tested with the
below qemu:

https://github.com/yiliu1765/qemu/tree/iommufd_rfcv4.mig.reset.v4_var3
(requires to test with the cdev kernel)

Change log:

v8:
 - Add r-b from Jason to patch 03, 04, 05, 07, 09 of v7
 - Add a patch to copy the per-device hot-reset structure to user during the
   device loop instead of storing them in a buffer and copy all the contents
   in one copy, this avoids an extra loop to count device and also avoids
   allocating a temporay buffer for it. (Jason)
 - Rename vfio_iommufd_device_hot_reset_devid() to be vfio_iommufd_get_dev_id()
   and refine its return value for the case no valid ID can be returned. Hence
   make it a general helper to get ID for a device. (Alex, Jason)
 - Remove iommufd_ctx_has_group() CONIFG_IOMMUFD disabled stub as this API is
   called in iommufd specific code which is compiled when CONFIG_IOMMU is
   enabled. (Alex)
 - Reaffirming Yanting's t-b (Tested NIC passthrough on Intel platform. mainly
   regression tests)

v7: https://lore.kernel.org/kvm/20230602121515.79374-1-yi.l@intel.com/
 - Drop noiommu support (patch 01 of v6 is dropped)
 - Remove helpers to get devid and ictx for iommufd_access
 - Document the dev_set representative requirement in the
   VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for the cdev opened device (Alex)
 - zero-length fd array approach is only for cdev opened device (Alex)

v6: https://lore.kernel.org/kvm/20230522115751.326947-1-yi.l@intel.com/
 - Remove noiommu_access, reuse iommufd_access instead (Alex)
 - vfio_iommufd_physical_ictx -> vfio_iommufd_device_ictx
 - vfio_iommufd_physical_devid -> vfio_iommufd_device_hot_reset_devid
 - Refine logic in patch 9 and 10 of v5, no uapi change. (Alex)
 - Remove lockdep asset in vfio_pci_is_device_in_set (Cédric)
 - Add t-b from Terrence (Tested GVT-g / GVT-d VFIO legacy mode / compat mode
   / cdev mode, including negative tests. No regression be introduced.)

v5: https://lore.kernel.org/kvm/20230513132136.15021-1-yi.l@intel.com/
 - Drop patch 01 of v4 (Alex)
 - Create noiommu_access for noiommu devices (Jason)
 - Reserve all negative iommufd IDs, hence VFIO can encode negative
   values (Jason)
 - Make vfio_iommufd_physical_devid() return -EINVAL if it's not called
   with a physical device or a noiommu device.
 - Add vfio_find_device_in_devset() in vfio_main.c (Alex)
 - Add iommufd_ctx_has_group() to replace vfio_devset_iommufd_has_group().
   Reason: vfio_devset_iommufd_has_group() only loops the devices within
   the given devset to check the iommufd an iommu_group, but an iommu_group
   can span into multiple devsets. So if failed to find the group in a
   devset doesn't mean the group is not owned by the iommufd. So here either
   needs to search all the devsets or add an iommufd API to check it. It
   appears an iommufd API makes more sense.
 - Adopt suggestions from Alex on patch 08 and 09 of v4, refine the hot-reset
   uapi description and minor tweaks
 - Use bitfields for bool members (Alex)

v4: https://lore.kernel.org/kvm/20230426145419.450922-1-yi.l@intel.com/
 - Rename the patch series subject
 - Patch 01 is moved from the cdev series
 - Patch 02, 06 are new per review comments in v3
 - Patch 03/04/05/07/08/09 are from v3 with updates

v3: https://lore.kernel.org/kvm/20230401144429.88673-1-yi.l@intel.com/
 - Remove the new _INFO ioctl of v2, extend the existing _INFO ioctl to
   report devid (Alex)
 - Add r-b from Jason
 - Add t-b from Terrence Xu and Yanting Jiang (mainly regression test)

v2: https://lore.kernel.org/kvm/20230327093458.44939-1-yi.l@intel.com/
 - Split the patch 03 of v1 to be 03, 04 and 05 of v2 (Jaon)
 - Add r-b from Kevin and Jason
 - Add patch 10 to introduce a new _INFO ioctl for the usage of device
   fd passing usage in cdev path (Jason, Alex)

v1: https://lore.kernel.org/kvm/20230316124156.12064-1-yi.l@intel.com/

Regards,
Yi Liu

Yi Liu (10):
  vfio/pci: Update comment around group_fd get in
vfio_pci_ioctl_pci_hot_reset()
  vfio/pci: Move the existing hot reset logic to be a helper
  iommufd: Reserve all negative IDs in the iommufd xarray
  iommufd: Add iommufd_ctx_has_group()
  iommufd: Add helper to retrieve iommufd_ctx and devid
  vfio: Mark cdev usage in vfio_device
  vfio: Add helper to search vfio_device in a dev_set
  vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device
cdev
  vfio/pci: Copy 

[Intel-gfx] [PATCH v8 01/10] vfio/pci: Update comment around group_fd get in vfio_pci_ioctl_pci_hot_reset()

2023-06-16 Thread Yi Liu
This suits more on what the code does.

Reviewed-by: Kevin Tian 
Reviewed-by: Jason Gunthorpe 
Reviewed-by: Eric Auger 
Signed-off-by: Yi Liu 
---
 drivers/vfio/pci/vfio_pci_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index ec7e662de033..f4153fd22a87 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -1311,9 +1311,8 @@ static int vfio_pci_ioctl_pci_hot_reset(struct 
vfio_pci_core_device *vdev,
}
 
/*
-* For each group_fd, get the group through the vfio external user
-* interface and store the group and iommu ID.  This ensures the group
-* is held across the reset.
+* Get the group file for each fd to ensure the group is held across
+* the reset
 */
for (file_idx = 0; file_idx < hdr.count; file_idx++) {
struct file *file = fget(group_fds[file_idx]);
-- 
2.34.1



Re: [Intel-gfx] [RFC 3/3] drm/i915/display: Add wrapper to Compute SAD

2023-06-16 Thread Borah, Chaitanya Kumar
Hello Kai,

> -Original Message-
> From: Golani, Mitulkumar Ajitkumar
> 
> Sent: Thursday, June 15, 2023 12:37 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Shankar, Uma ; Borah, Chaitanya Kumar
> ; Golani, Mitulkumar Ajitkumar
> ; Nautiyal, Ankit K
> 
> Subject: [RFC 3/3] drm/i915/display: Add wrapper to Compute SAD
> 
> Compute SADs that takes into account the supported rate and channel based
> on the capabilities of the audio source. This wrapper function should
> encapsulate the logic for determining the supported rate and channel and
> should return a set of SADs that are compatible with the source.
> 
> --v1:
> - call intel_audio_compute_eld in this commit as it is defined here
> 
> Signed-off-by: Mitul Golani 
> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 66 ++
> drivers/gpu/drm/i915/display/intel_audio.h |  1 +
> drivers/gpu/drm/i915/display/intel_hdmi.c  |  2 +
>  3 files changed, 69 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c
> b/drivers/gpu/drm/i915/display/intel_audio.c
> index e20ffc8e9654..a6a58b0f0717 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -794,6 +794,72 @@ bool intel_audio_compute_config(struct
> intel_encoder *encoder,
>   return true;
>  }
> 
> +static unsigned int drm_sad_to_channels(const u8 *sad) {
> + return 1 + (sad[0] & 0x7);
> +}
> +
> +static inline u8 *parse_sad(u8 *eld)
> +{
> + unsigned int ver, mnl;
> +
> + ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >>
> DRM_ELD_VER_SHIFT;
> + if (ver != 2 && ver != 31)
> + return NULL;
> +
> + mnl = drm_eld_mnl(eld);
> + if (mnl > 16)
> + return NULL;
> +
> + return eld + DRM_ELD_CEA_SAD(mnl, 0);
> +}
> +
> +static u8 get_supported_freq_mask(struct intel_crtc_state *crtc_state)
> +{
> + int audio_freq_hz[] = {32000, 44100, 48000, 88000, 96000, 176000,
> 192000, 0};
> + u8 mask = 0;
> +
> + for (u8 index = 0; index < ARRAY_SIZE(audio_freq_hz); index++) {
> + mask |= 1 << index;
> + if (crtc_state->audio.max_frequency != audio_freq_hz[index])
> + continue;
> + else
> + break;
> + }
> +
> + return mask;
> +}
> +
> +void intel_audio_compute_eld(struct intel_crtc_state *crtc_state) {
> + struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
> + u8 *eld, *sad, index, mask = 0;
> +
> + eld = crtc_state->eld;
> + if (!eld) {
> + drm_err(>drm, "failed to locate eld\n");
> + return;
> + }
> +
> + sad = (u8 *)parse_sad(eld);
> + if (sad) {
> + mask = get_supported_freq_mask(crtc_state);
> +
> + for (index = 0; index < drm_eld_sad_count(eld); index++, sad +=
> 3) {
> + /*
> +  *  Respect to source restrictions. If source limit is
> greater than sink
> +  *  capabilities then follow to sink's highest supported
> rate.
> +  */
> + if (drm_sad_to_channels(sad) >= crtc_state-
> >audio.max_channel) {
> + sad[0] &= ~0x7;
> + sad[0] |= crtc_state->audio.max_channel - 1;
> + }
> +
> + sad[1] &= mask;

We would like to hear your opinion on this implementation from audio driver 
perspective.

Regards

Chaitanya

> + }
> + }
> +}
> +
>  /**
>   * intel_audio_codec_enable - Enable the audio codec for HD audio
>   * @encoder: encoder on which to enable audio diff --git
> a/drivers/gpu/drm/i915/display/intel_audio.h
> b/drivers/gpu/drm/i915/display/intel_audio.h
> index 07d034a981e9..2ec7fafd9711 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.h
> +++ b/drivers/gpu/drm/i915/display/intel_audio.h
> @@ -14,6 +14,7 @@ struct intel_crtc_state;  struct intel_encoder;
> 
>  void intel_audio_hooks_init(struct drm_i915_private *dev_priv);
> +void intel_audio_compute_eld(struct intel_crtc_state *crtc_state);
>  bool intel_audio_compute_config(struct intel_encoder *encoder,
>   struct intel_crtc_state *crtc_state,
>   struct drm_connector_state *conn_state); diff
> --git a/drivers/gpu/drm/i915/display/intel_hdmi.c
> b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 0188a600f9f5..beafeff494f8 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -2403,6 +2403,8 @@ int intel_hdmi_compute_config(struct
> intel_encoder *encoder,
>   return -EINVAL;
>   }
> 
> + intel_audio_compute_eld(pipe_config);
> +
>   return 0;
>  }
> 
> --
> 2.25.1



[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/gsc: Fix intel_gsc_uc_fw_proxy_init_done with directed wakerefs

2023-06-16 Thread Patchwork
== Series Details ==

Series: drm/i915/gsc: Fix intel_gsc_uc_fw_proxy_init_done with directed wakerefs
URL   : https://patchwork.freedesktop.org/series/119412/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13277_full -> Patchwork_119412v1_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Participating hosts (7 -> 7)
--

  No changes in participating hosts

Known issues


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

### IGT changes ###

 Issues hit 

  * igt@drm_fdinfo@most-busy-idle-check-all@rcs0:
- shard-rkl:  [PASS][1] -> [FAIL][2] ([i915#7742])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-6/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-rkl-1/igt@drm_fdinfo@most-busy-idle-check-...@rcs0.html

  * igt@gem_ctx_exec@basic-nohangcheck:
- shard-tglu: [PASS][3] -> [FAIL][4] ([i915#6268])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-3/igt@gem_ctx_e...@basic-nohangcheck.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-tglu-6/igt@gem_ctx_e...@basic-nohangcheck.html

  * igt@gem_exec_fair@basic-none@vcs0:
- shard-rkl:  [PASS][5] -> [FAIL][6] ([i915#2842])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-1/igt@gem_exec_fair@basic-n...@vcs0.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-rkl-2/igt@gem_exec_fair@basic-n...@vcs0.html

  * igt@i915_pm_dc@dc6-dpms:
- shard-tglu: [PASS][7] -> [FAIL][8] ([i915#3989] / [i915#454])
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-tglu-4/igt@i915_pm...@dc6-dpms.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-tglu-3/igt@i915_pm...@dc6-dpms.html

  * igt@kms_async_flips@alternate-sync-async-flip@pipe-a-hdmi-a-1:
- shard-glk:  [PASS][9] -> [FAIL][10] ([i915#2521])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk5/igt@kms_async_flips@alternate-sync-async-f...@pipe-a-hdmi-a-1.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-glk3/igt@kms_async_flips@alternate-sync-async-f...@pipe-a-hdmi-a-1.html

  * 
igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs:
- shard-rkl:  NOTRUN -> [SKIP][11] ([i915#8502]) +3 similar issues
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-rkl-4/igt@kms_async_flips@async-flip-with-page-flip-events@pipe-a-hdmi-a-2-y-rc_ccs.html

  * igt@kms_big_fb@linear-16bpp-rotate-0:
- shard-snb:  [PASS][12] -> [SKIP][13] ([fdo#109271])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-snb4/igt@kms_big...@linear-16bpp-rotate-0.html
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-snb6/igt@kms_big...@linear-16bpp-rotate-0.html

  * igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip:
- shard-rkl:  [PASS][14] -> [FAIL][15] ([i915#3743])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-7/igt@kms_big...@x-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip.html
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-rkl-7/igt@kms_big...@x-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-glk:  [PASS][16] -> [FAIL][17] ([i915#2346])
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-glk9/igt@kms_cursor_leg...@flip-vs-cursor-atomic-transitions.html
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-glk9/igt@kms_cursor_leg...@flip-vs-cursor-atomic-transitions.html

  * igt@kms_cursor_legacy@single-move@pipe-b:
- shard-rkl:  [PASS][18] -> [INCOMPLETE][19] ([i915#8011])
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13277/shard-rkl-3/igt@kms_cursor_legacy@single-m...@pipe-b.html
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-rkl-7/igt@kms_cursor_legacy@single-m...@pipe-b.html

  * igt@kms_dither@fb-8bpc-vs-panel-6bpc@pipe-a-hdmi-a-1:
- shard-glk:  NOTRUN -> [SKIP][20] ([fdo#109271])
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-glk6/igt@kms_dither@fb-8bpc-vs-panel-6...@pipe-a-hdmi-a-1.html

  * 
igt@kms_plane_scaling@plane-scaler-with-rotation-unity-scaling@pipe-a-hdmi-a-2:
- shard-rkl:  NOTRUN -> [SKIP][21] ([i915#5176])
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_119412v1/shard-rkl-4/igt@kms_plane_scaling@plane-scaler-with-rotation-unity-scal...@pipe-a-hdmi-a-2.html

  * 
igt@kms_plane_scaling@plane-scaler-with-rotation-unity-scaling@pipe-b-hdmi-a-2:
- 

  1   2   >