drm/i915: split out intel_dram.[ch] from i915_drv.c
Subsystems (2)
PATCH 1/3 drm/i915: split out intel_dram.[ch] from i915_drv.c
The DRAM related routines are pretty isolated from the rest of the i915_drv.c, split it out to a separate file. Put the eDRAM stuff in the same bag, and rename the visible functions to have intel_dram_ prefix. Do some benign whitespace fixes and dev_priv -> i915 conversions while at it.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 493 +----------------------------- drivers/gpu/drm/i915/intel_dram.c | 487 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dram.h | 14 + 4 files changed, 505 insertions(+), 490 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_dram.c create mode 100644 drivers/gpu/drm/i915/intel_dram.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -47,6 +47,7 @@ i915-y += i915_drv.o \ i915_sysfs.o \ i915_utils.o \ intel_device_info.o \ + intel_dram.o \ intel_memory_region.o \ intel_pch.o \ intel_pm.o \
drivers/gpu/drm/i915/i915_drv.c +3 -490
517 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dram.c new file +487 -0
487 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dram.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef __INTEL_DRAM_H__ +#define __INTEL_DRAM_H__ + +struct drm_i915_private ; + +void intel_dram_edram_detect (struct drm_i915_private *i915); +void intel_dram_detect (struct drm_i915_private *i915); + +#endif /* __INTEL_DRAM_H__ */
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/i915/dram: use intel_uncore_*() functions for register access
The implicit "dev_priv" local variable use has been a long-standing pain point in the register access macros I915_READ(), I915_WRITE(), POSTING_READ(), I915_READ_FW(), and I915_WRITE_FW().
Replace them with the corresponding uncore register accessors intel_uncore_read(), intel_uncore_write(), intel_uncore_posting_read(), intel_uncore_read_fw(), and intel_uncore_write_fw().
Rename dev_priv to i915 while at it.
No functional changes.
--- drivers/gpu/drm/i915/intel_dram.c | 57 ++++++++++++++++--------------- 1 file changed, 30 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_dram.c +30 -27
@@ -166,25 +166,27 @@ intel_is_dram_symmetric(const struct dram_channel_info *ch0, }static int -skl_dram_get_channels_info (struct drm_i915_private *dev_priv) +skl_dram_get_channels_info (struct drm_i915_private *i915) { -struct dram_info *dram_info = &dev_priv->dram_info; +struct dram_info *dram_info = &i915->dram_info;struct dram_channel_info ch0 = {}, ch1 = {};u32 val;int ret; - val =I915_READ (SKL_MAD_DIMM_CH0_0_0_0_MCHBAR_MCMAIN ); - ret =skl_dram_get_channel_info (dev_priv, &ch0,0 , val); + val =intel_uncore_read (&i915->uncore, +SKL_MAD_DIMM_CH0_0_0_0_MCHBAR_MCMAIN ); + ret =skl_dram_get_channel_info (i915, &ch0,0 , val);if (ret ==0 ) dram_info->num_channels++; - val =I915_READ (SKL_MAD_DIMM_CH1_0_0_0_MCHBAR_MCMAIN ); - ret =skl_dram_get_channel_info (dev_priv, &ch1,1 , val); + val =intel_uncore_read (&i915->uncore, +SKL_MAD_DIMM_CH1_0_0_0_MCHBAR_MCMAIN ); + ret =skl_dram_get_channel_info (i915, &ch1,1 , val);if (ret ==0 ) dram_info->num_channels++;if (dram_info->num_channels ==0 ) { -drm_info (&dev_priv->drm,"Number of memory channels is zero\n" ); +drm_info (&i915->drm,"Number of memory channels is zero\n" );return -EINVAL ; }
@@ -199,8 +201,7 @@ skl_dram_get_channels_info(struct drm_i915_private *dev_priv) dram_info->ranks =max (ch0.ranks, ch1.ranks);if (dram_info->ranks ==0 ) { -drm_info (&dev_priv->drm, -"couldn't get memory rank information\n" ); +drm_info (&i915->drm,"couldn't get memory rank information\n" );return -EINVAL ; }
@@ -208,18 +209,19 @@ skl_dram_get_channels_info(struct drm_i915_private *dev_priv) dram_info->symmetric_memory =intel_is_dram_symmetric (&ch0, &ch1); -drm_dbg_kms (&dev_priv->drm,"Memory configuration is symmetric? %s\n" , +drm_dbg_kms (&i915->drm,"Memory configuration is symmetric? %s\n" ,yesno (dram_info->symmetric_memory));return 0 ; }static enum intel_dram_type -skl_get_dram_type (struct drm_i915_private *dev_priv) +skl_get_dram_type (struct drm_i915_private *i915) {u32 val; - val =I915_READ (SKL_MAD_INTER_CHANNEL_0_0_0_MCHBAR_MCMAIN ); + val =intel_uncore_read (&i915->uncore, +SKL_MAD_INTER_CHANNEL_0_0_0_MCHBAR_MCMAIN );switch (val &SKL_DRAM_DDR_TYPE_MASK ) {case SKL_DRAM_DDR_TYPE_DDR3 :
@@ -237,21 +239,22 @@ skl_get_dram_type(struct drm_i915_private *dev_priv) }static int -skl_get_dram_info (struct drm_i915_private *dev_priv) +skl_get_dram_info (struct drm_i915_private *i915) { -struct dram_info *dram_info = &dev_priv->dram_info; +struct dram_info *dram_info = &i915->dram_info;u32 mem_freq_khz, val;int ret; - dram_info->type =skl_get_dram_type (dev_priv); -drm_dbg_kms (&dev_priv->drm,"DRAM type: %s\n" , + dram_info->type =skl_get_dram_type (i915); +drm_dbg_kms (&i915->drm,"DRAM type: %s\n" ,intel_dram_type_str (dram_info->type)); - ret =skl_dram_get_channels_info (dev_priv); + ret =skl_dram_get_channels_info (i915);if (ret)return ret; - val =I915_READ (SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU ); + val =intel_uncore_read (&i915->uncore, +SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU ); mem_freq_khz =DIV_ROUND_UP ((val &SKL_REQ_DATA_MASK ) *SKL_MEMORY_FREQ_MULTIPLIER_HZ ,1000 );
@@ -259,7 +262,7 @@ skl_get_dram_info(struct drm_i915_private *dev_priv) mem_freq_khz *8 ;if (dram_info->bandwidth_kbps ==0 ) { -drm_info (&dev_priv->drm, +drm_info (&i915->drm,"Couldn't get system memory bandwidth\n" );return -EINVAL ; }
@@ -346,15 +349,15 @@ static void bxt_get_dimm_info(struct dram_dimm_info *dimm, u32 val) dimm->size =bxt_get_dimm_size (val) *intel_dimm_num_devices (dimm) /8 ; } -static int bxt_get_dram_info (struct drm_i915_private *dev_priv) +static int bxt_get_dram_info (struct drm_i915_private *i915) { -struct dram_info *dram_info = &dev_priv->dram_info; +struct dram_info *dram_info = &i915->dram_info;u32 dram_channels;u32 mem_freq_khz, val;u8 num_active_channels;int i; - val =I915_READ (BXT_P_CR_MC_BIOS_REQ_0_0_0 ); + val =intel_uncore_read (&i915->uncore,BXT_P_CR_MC_BIOS_REQ_0_0_0 ); mem_freq_khz =DIV_ROUND_UP ((val &BXT_REQ_DATA_MASK ) *BXT_MEMORY_FREQ_MULTIPLIER_HZ ,1000 );
@@ -365,7 +368,7 @@ static int bxt_get_dram_info(struct drm_i915_private *dev_priv) dram_info->bandwidth_kbps = (mem_freq_khz * num_active_channels *4 );if (dram_info->bandwidth_kbps ==0 ) { -drm_info (&dev_priv->drm, +drm_info (&i915->drm,"Couldn't get system memory bandwidth\n" );return -EINVAL ; }
@@ -377,7 +380,7 @@ static int bxt_get_dram_info(struct drm_i915_private *dev_priv)struct dram_dimm_info dimm;enum intel_dram_type type; - val =I915_READ (BXT_D_CR_DRP0_DUNIT (i)); + val =intel_uncore_read (&i915->uncore,BXT_D_CR_DRP0_DUNIT (i));if (val ==0xFFFFFFFF )continue ;
@@ -386,11 +389,11 @@ static int bxt_get_dram_info(struct drm_i915_private *dev_priv)bxt_get_dimm_info (&dimm, val); type =bxt_get_dimm_type (val); -drm_WARN_ON (&dev_priv->drm, type !=INTEL_DRAM_UNKNOWN && +drm_WARN_ON (&i915->drm, type !=INTEL_DRAM_UNKNOWN && dram_info->type !=INTEL_DRAM_UNKNOWN && dram_info->type != type); - drm_dbg_kms(&dev_priv->drm, + drm_dbg_kms(&i915->drm, "CH%u DIMM size: %u GB, width: X%u, ranks: %u, type: %s\n", i - BXT_D_CR_DRP0_DUNIT_START, dimm.size, dimm.width, dimm.ranks,
@@ -411,7 +414,7 @@ static int bxt_get_dram_info(struct drm_i915_private *dev_priv) }if (dram_info->type ==INTEL_DRAM_UNKNOWN || dram_info->ranks ==0 ) { -drm_info (&dev_priv->drm,"couldn't get memory information\n" ); +drm_info (&i915->drm,"couldn't get memory information\n" );return -EINVAL ; }
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 drm/i915/drv: use intel_uncore_write() for register access
In reply to Jani NikulaThe implicit "dev_priv" local variable use has been a long-standing pain point in the register access macros I915_READ(), I915_WRITE(), POSTING_READ(), I915_READ_FW(), and I915_WRITE_FW().
Replace the sole remaining I915_WRITE() in i915_drv.c with intel_uncore_write(), although it might be better to keep the entire file void of direct register access.
No functional changes.
--- drivers/gpu/drm/i915/i915_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +2 -1
@@ -758,7 +758,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)* when running inside a VM. */ if (intel_vgpu_active (dev_priv)) -I915_WRITE (vgtif_reg (display_ready),VGT_DRV_DISPLAY_READY ); +intel_uncore_write (&dev_priv->uncore,vgtif_reg (display_ready), +VGT_DRV_DISPLAY_READY );/* Reveal our presence to userspace */ if (drm_dev_register (dev,0 ) ==0 ) {
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 3/3] drm/i915/drv: use intel_uncore_write() for register access
Quoting Jani Nikula (2020-02-25 11:15:09)
Quoted 20 lines
The implicit "
dev_priv" local variable use has been a long-standing pain point in the register access macrosI915_READ(),I915_WRITE(),POSTING_READ(),I915_READ_FW(), andI915_WRITE_FW().Replace the sole remaining
I915_WRITE()ini915_drv.cwithintel_uncore_write(), although it might be better to keep the entire file void of direct register access.No functional changes.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.c +0
-0
drivers/gpu/drm/i915/i915_drv.c static void i915_driver_register(struct drm_i915_private *dev_priv) · line 762
Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.c +2
-1@@ -758,7 +758,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)* when running inside a VM. */ if (intel_vgpu_active (dev_priv)) -I915_WRITE (vgtif_reg (display_ready),VGT_DRV_DISPLAY_READY ); +intel_uncore_write (&dev_priv->uncore,vgtif_reg (display_ready), +VGT_DRV_DISPLAY_READY );
Bonus patch for intel_vgpu_register() ?
Series is
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: split out intel_dram.[ch] from i915_drv.c
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: split out intel_dram.[ch] from i915_drv.c
URL : https://patchwork.freedesktop.org/series/73894/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip a633c5989ab0 drm/i915: split out intel_dram.[ch] from i915_drv.c -:552: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #552: new file mode 100644
-:565: ERROR:BRACKET_SPACE: space prohibited before open square bracket '[' #565: FILE: drivers/gpu/drm/i915/intel_dram.c:9:
+#define DRAM_TYPE_STR(type) [INTEL_DRAM_ ## type] = #type
total: 1 errors, 1 warnings, 0 checks, 1025 lines checked 744ac95da66a drm/i915/dram: use intel_uncore_*() functions for register access 9c8d12fe133b drm/i915/drv: use intel_uncore_write() for register access
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: split out intel_dram.[ch] from i915_drv.c
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: split out intel_dram.[ch] from i915_drv.c
URL : https://patchwork.freedesktop.org/series/73894/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_8004 -> Patchwork_16700
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/index.html
Known issues
------------
Here are the changes found in Patchwork_16700 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s4-devices:
- fi-tgl-y: [PASS][1] -> [FAIL][2] ([CI#94])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8004/fi-tgl-y/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/fi-tgl-y/igt@[email protected]
* igt@kms_addfb_basic@addfb25-x-tiled-mismatch:
- fi-tgl-y: [PASS][3] -> [DMESG-WARN][4] ([CI#94] / [i915#402]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8004/fi-tgl-y/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/fi-tgl-y/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live_execlists:
- fi-icl-y: [INCOMPLETE][5] ([i915#140]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8004/fi-icl-y/igt@i915_selftest@live_execlists.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/fi-icl-y/igt@i915_selftest@live_execlists.html
* igt@kms_addfb_basic@addfb25-bad-modifier:
- fi-tgl-y: [DMESG-WARN][7] ([CI#94] / [i915#402]) -> [PASS][8] +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8004/fi-tgl-y/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/fi-tgl-y/igt@[email protected]
* igt@kms_chamelium@dp-edid-read:
- fi-cml-u2: [FAIL][9] ([i915#217] / [i915#976]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8004/fi-cml-u2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/fi-cml-u2/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][11] ([fdo#111096] / [i915#323]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8004/fi-kbl-7500u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/fi-kbl-7500u/igt@[email protected]
#### Warnings ####
* igt@i915_selftest@live_gt_lrc:
- fi-tgl-y: [DMESG-FAIL][13] ([CI#94] / [i915#1233]) -> [INCOMPLETE][14] ([CI#94] / [i915#1233])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8004/fi-tgl-y/igt@i915_selftest@live_gt_lrc.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/fi-tgl-y/igt@i915_selftest@live_gt_lrc.html
[CI#94]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/94
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[i915#1233]: https://gitlab.freedesktop.org/drm/intel/issues/1233
[i915#140]: https://gitlab.freedesktop.org/drm/intel/issues/140
[i915#217]: https://gitlab.freedesktop.org/drm/intel/issues/217
[i915#323]: https://gitlab.freedesktop.org/drm/intel/issues/323
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#976]: https://gitlab.freedesktop.org/drm/intel/issues/976
Participating hosts (43 -> 41)
------------------------------
Additional (5): fi-ehl-1 fi-ilk-650 fi-snb-2520m fi-elk-e7500 fi-blb-e6850
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-byt-squawks fi-byt-clapper fi-bsw-nick fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_8004 -> Patchwork_16700
CI-20190529: 20190529
CI_DRM_8004: 1a2e0cce5af4a9ad9694995610ed64578ccc430f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5464: 8cf2f8684992052ab89de1cf328c418224c0c2a7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16700: 9c8d12fe133b783cc1744a638a8a8af762698080 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
9c8d12fe133b drm/i915/drv: use intel_uncore_write() for register access 744ac95da66a drm/i915/dram: use intel_uncore_*() functions for register access a633c5989ab0 drm/i915: split out intel_dram.[ch] from i915_drv.c
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16700/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 3/3] drm/i915/drv: use intel_uncore_write() for register access
In reply to Chris WilsonQuoted 16 lines · Chris Wilson
Quoting Jani Nikula (2020-02-25 11:15:09)
Quoted 15 lines
The implicit "
dev_priv" local variable use has been a long-standing pain point in the register access macrosI915_READ(),I915_WRITE(),POSTING_READ(),I915_READ_FW(), andI915_WRITE_FW().Replace the sole remaining
I915_WRITE()ini915_drv.cwithintel_uncore_write(), although it might be better to keep the entire file void of direct register access.No functional changes.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.c static void i915_driver_register(struct drm_i915_private *dev_priv) · line 762
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.c +2
-1@@ -758,7 +758,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)* when running inside a VM. */ if (intel_vgpu_active (dev_priv)) -I915_WRITE (vgtif_reg (display_ready),VGT_DRV_DISPLAY_READY ); +intel_uncore_write (&dev_priv->uncore,vgtif_reg (display_ready), +VGT_DRV_DISPLAY_READY );Bonus patch for
intel_vgpu_register()?
Sure!
Quoted 2 lines
Series is
Reviewed-by Chris Wilson <[email protected]>
Thanks, pushed to dinq.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx