Re: [PATCH v3 3/5] drm/i915/psr: Calculate IO wake and fast wake lines for DISPLAY_VER < 12

2024-03-05 Thread kernel test robot
Hi Jouni,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip next-20240305]
[cannot apply to drm-intel/for-linux-next-fixes linus/master v6.8-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Jouni-H-gander/drm-i915-display-Make-intel_dp_aux_fw_sync_len-available-for-PSR-code/20240305-200753
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
patch link:
https://lore.kernel.org/r/20240305120458.1275218-4-jouni.hogander%40intel.com
patch subject: [PATCH v3 3/5] drm/i915/psr: Calculate IO wake and fast wake 
lines for DISPLAY_VER < 12
config: s390-allmodconfig 
(https://download.01.org/0day-ci/archive/20240306/202403061144.nxw1e72o-...@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 
325f51237252e6dab8e4e1ea1fa7acbb4faee1cd)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240306/202403061144.nxw1e72o-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202403061144.nxw1e72o-...@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:173:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2188:
   include/linux/vmstat.h:508:43: warning: arithmetic between different 
enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') 
[-Wenum-enum-conversion]
 508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
 |~ ^
 509 |item];
 |
   include/linux/vmstat.h:515:43: warning: arithmetic between different 
enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') 
[-Wenum-enum-conversion]
 515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
 |~ ^
 516 |NR_VM_NUMA_EVENT_ITEMS +
 |~~
   include/linux/vmstat.h:522:36: warning: arithmetic between different 
enumeration types ('enum node_stat_item' and 'enum lru_list') 
[-Wenum-enum-conversion]
 522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
 |   ~~~ ^ ~~~
   include/linux/vmstat.h:527:43: warning: arithmetic between different 
enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') 
[-Wenum-enum-conversion]
 527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
 |~ ^
 528 |NR_VM_NUMA_EVENT_ITEMS +
 |~~
   include/linux/vmstat.h:536:43: warning: arithmetic between different 
enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') 
[-Wenum-enum-conversion]
 536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
 |~ ^
 537 |NR_VM_NUMA_EVENT_ITEMS +
 |~~
   In file included from drivers/gpu/drm/i915/display/intel_psr.c:28:
   In file included from drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:15:
   In file included from 
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h:11:
   In file included from drivers/gpu/drm/xe/xe_bo.h:11:
   In file included from drivers/gpu/drm/xe/xe_bo_types.h:9:
   In file included from include/linux/iosys-map.h:10:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:78:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a 
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
 547 | val = __raw_readb(PCI_IOBASE + addr);
 |   ~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a 
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + 
addr));
 | ~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro 
'__le16_to_cpu'
  37 | #define __le16_to_cpu(x) __swab16((__for

[PATCH v3 3/5] drm/i915/psr: Calculate IO wake and fast wake lines for DISPLAY_VER < 12

2024-03-05 Thread Jouni Högander
Bspec mentions 50 us for IO wake time and 32 us for fast wake time. 32 us
is most probably wrong as it doesn't meet the specification as fast wake
time is calculated in Bspec like this:

10..16 us (precharge) + 8 us (preamble) + 4 us (phy_wake) + 20 us
(tfw_exit_latency)

Instead of using these constants calculate IO wake and fast wake for
DISPLAY_VER < 12 as well.

Signed-off-by: Jouni Högander 
---
 drivers/gpu/drm/i915/display/intel_psr.c | 31 ++--
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c
index 905208e1c771..afcfa541942c 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1150,9 +1150,25 @@ static bool _lnl_compute_alpm_params(struct intel_dp 
*intel_dp,
return true;
 }
 
-static int get_io_buffer_wake_time(void)
+/*
+ * From Bspec:
+ *
+ * For DISPLAY_VER >= 12
+ * 10 us
+ *
+ * For DISPLAY_VER < 12
+ * This is not directly mentioned in Bspec. There are 50 us io wake time and 32
+ * us fast wake time. Clearly preharge pulses are not (improperly) included in
+ * 32 us fast wake time. 50 us - 32 us = 18 us.
+ */
+static int get_io_buffer_wake_time(const struct intel_crtc_state *crtc_state)
 {
-   return 10;
+   struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
+
+   if (DISPLAY_VER(i915) < 12)
+   return 18;
+   else
+   return 10;
 }
 
 static bool _compute_alpm_params(struct intel_dp *intel_dp,
@@ -1162,8 +1178,8 @@ static bool _compute_alpm_params(struct intel_dp 
*intel_dp,
int io_wake_lines, io_wake_time, fast_wake_lines, fast_wake_time;
u8 max_wake_lines;
 
-   if (DISPLAY_VER(i915) >= 12) {
-   int io_buffer_wake_time = get_io_buffer_wake_time();
+   if (DISPLAY_VER(i915) >= 9) {
+   int io_buffer_wake_time = get_io_buffer_wake_time(crtc_state);
int tfw_exit_latency = 20; /* eDP spec */
int phy_wake = 4;  /* eDP spec */
int preamble = 8;  /* eDP spec */
@@ -1173,14 +1189,13 @@ static bool _compute_alpm_params(struct intel_dp 
*intel_dp,
phy_wake + tfw_exit_latency;
fast_wake_time = precharge + preamble + phy_wake +
tfw_exit_latency;
+   }
 
+   if (DISPLAY_VER(i915) >= 12)
/* TODO: Check how we can use ALPM_CTL fast wake extended field 
*/
max_wake_lines = 12;
-   } else {
-   io_wake_time = 50;
-   fast_wake_time = 32;
+   else
max_wake_lines = 8;
-   }
 
io_wake_lines = intel_usecs_to_scanlines(
_state->hw.adjusted_mode, io_wake_time);
-- 
2.34.1