Skip to contentSkip to conversation

drm/i915: Make MMIO_PORT flexible.

PATCH In review Rodrigo Vivi 5 participants 9 messages Jun 8, 2017 – Jun 15, 2017

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/1 drm/i915: Make MMIO_PORT flexible.

In the past the magic reg_a + (reg_b - reg_a) * port was enough because every new register that was appearing on new platforms was respecting the same gap.

However on more recent platforms we start seeing many registers that doesn't respect the gap. So picking from a list of registers seems to be the more general approach that covers all cases.

So let's make MMIO_PORT use _PICK directly so we don't need to create MMIO_PORT3 MMIO_PORT5 MMIO_PORT6 or whatever number of different ports with different registers that doesn't respect the gap.

---
 drivers/gpu/drm/i915/i915_reg.h | 57 +++++++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +46 -11
index b6d69e2..9a57a17 100644
@@ -57,9 +57,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
-#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
+#define _MMIO_PORT(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
@@ -1576,7 +1575,8 @@ enum skl_disp_power_wells {
 #define   BXT_PHY_LANE_POWERDOWN_ACK	(1 << 9)
 #define   BXT_PHY_LANE_ENABLED		(1 << 8)
 #define BXT_PHY_CTL(port)		_MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
-							 _BXT_PHY_CTL_DDI_B)
+							 _BXT_PHY_CTL_DDI_B, \
+							 _BXT_PHY_CTL_DDI_C)
 
 #define _PHY_CTL_FAMILY_EDP		0x64C80
 #define _PHY_CTL_FAMILY_DDI		0x64C90
@@ -1595,7 +1595,9 @@ enum skl_disp_power_wells {
 #define   PORT_PLL_REF_SEL		(1 << 27)
 #define   PORT_PLL_POWER_ENABLE		(1 << 26)
 #define   PORT_PLL_POWER_STATE		(1 << 25)
-#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
+#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, \
+							 _PORT_PLL_B, \
+							 _PORT_PLL_C)
 
 #define _PORT_PLL_EBB_0_A		0x162034
 #define _PORT_PLL_EBB_0_B		0x6C034
@@ -2453,7 +2455,7 @@ enum skl_disp_power_wells {
 #define _VLV_AUD_PORT_EN_B_DBG		(VLV_DISPLAY_BASE + 0x62F20)
 #define _VLV_AUD_PORT_EN_C_DBG		(VLV_DISPLAY_BASE + 0x62F30)
 #define _VLV_AUD_PORT_EN_D_DBG		(VLV_DISPLAY_BASE + 0x62F34)
-#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT3((port) - PORT_B,	   \
+#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT((port) - PORT_B,	    \
 						    _VLV_AUD_PORT_EN_B_DBG, \
 						    _VLV_AUD_PORT_EN_C_DBG, \
 						    _VLV_AUD_PORT_EN_D_DBG)
@@ -4821,7 +4823,10 @@ enum {
 #define _DPD_AUX_CH_DATA4	(dev_priv->info.display_mmio_offset + 0x64320)
 #define _DPD_AUX_CH_DATA5	(dev_priv->info.display_mmio_offset + 0x64324)
 
-#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
+#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, \
+						 _DPB_AUX_CH_CTL, \
+						 _DPC_AUX_CH_CTL, \
+						 _DPD_AUX_CH_CTL)
 #define DP_AUX_CH_DATA(port, i)	_MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
 
 #define   DP_AUX_CH_CTL_SEND_BUSY	    (1 << 31)
@@ -7214,7 +7219,9 @@ enum {
 #define _PCH_DPD_AUX_CH_DATA4	0xe4320
 #define _PCH_DPD_AUX_CH_DATA5	0xe4324
 
-#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
+#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, \
+						   _PCH_DPB_AUX_CH_CTL, \
+						   _PCH_DPC_AUX_CH_CTL)
 #define PCH_DP_AUX_CH_DATA(port, i)	_MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
 
 /* CPT */
@@ -7844,7 +7851,14 @@ enum {
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A			0x64040
 #define _DP_TP_CTL_B			0x64140
-#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
+#define _DP_TP_CTL_C			0x64240
+#define _DP_TP_CTL_D			0x64340
+#define _DP_TP_CTL_E			0x64440
+#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, \
+					 _DP_TP_CTL_B, \
+					 _DP_TP_CTL_C, \
+					 _DP_TP_CTL_D, \
+					 _DP_TP_CTL_E)
 #define  DP_TP_CTL_ENABLE			(1<<31)
 #define  DP_TP_CTL_MODE_SST			(0<<27)
 #define  DP_TP_CTL_MODE_MST			(1<<27)
@@ -7862,7 +7876,14 @@ enum {
 /* DisplayPort Transport Status */
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
-#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define _DP_TP_STATUS_C			0x64244
+#define _DP_TP_STATUS_D			0x64344
+#define _DP_TP_STATUS_E			0x64444
+#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, \
+					    _DP_TP_STATUS_B, \
+					    _DP_TP_STATUS_C, \
+					    _DP_TP_STATUS_D, \
+					    _DP_TP_STATUS_E)
 #define  DP_TP_STATUS_IDLE_DONE			(1<<25)
 #define  DP_TP_STATUS_ACT_SENT			(1<<24)
 #define  DP_TP_STATUS_MODE_STATUS_MST		(1<<23)
@@ -7874,7 +7895,14 @@ enum {
 /* DDI Buffer Control */
 #define _DDI_BUF_CTL_A				0x64000
 #define _DDI_BUF_CTL_B				0x64100
-#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
+#define _DDI_BUF_CTL_C				0x64200
+#define _DDI_BUF_CTL_D				0x64300
+#define _DDI_BUF_CTL_E				0x64400
+#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, \
+					   _DDI_BUF_CTL_B, \
+					   _DDI_BUF_CTL_C, \
+					   _DDI_BUF_CTL_D, \
+					   _DDI_BUF_CTL_E)
 #define  DDI_BUF_CTL_ENABLE			(1<<31)
 #define  DDI_BUF_TRANS_SELECT(n)	((n) << 24)
 #define  DDI_BUF_EMP_MASK			(0xf<<24)
@@ -7973,7 +8001,14 @@ enum {
 /* Port clock selection */
 #define _PORT_CLK_SEL_A			0x46100
 #define _PORT_CLK_SEL_B			0x46104
-#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
+#define _PORT_CLK_SEL_C			0x46108
+#define _PORT_CLK_SEL_D			0x4610C
+#define _PORT_CLK_SEL_E			0x46110
+#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, \
+				            _PORT_CLK_SEL_B, \
+				            _PORT_CLK_SEL_C, \
+				            _PORT_CLK_SEL_D, \
+					    _PORT_CLK_SEL_E)
 #define  PORT_CLK_SEL_LCPLL_2700	(0<<29)
 #define  PORT_CLK_SEL_LCPLL_1350	(1<<29)
 #define  PORT_CLK_SEL_LCPLL_810		(2<<29)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Make MMIO_PORT flexible.

== Series Details ==

== Series Details ==

Series: drm/i915: Make MMIO_PORT flexible.
URL : https://patchwork.freedesktop.org/series/25491/
State : failure

== Summary ==

Series 25491v1 drm/i915: Make MMIO_PORT flexible.
https://patchwork.freedesktop.org/api/1.0/series/25491/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-r) fdo#100125
Test kms_busy:
        Subgroup basic-flip-default-b:
                pass       -> DMESG-WARN (fi-skl-6700hq) fdo#101144 +2
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-skl-6700hq) fdo#101154 +7
Test drv_module_reload:
        Subgroup basic-reload-final:
                pass       -> INCOMPLETE (fi-snb-2600)

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fdo#101154 https://bugs.freedesktop.org/show_bug.cgi?id=101154

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:445s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:435s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:581s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:510s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:486s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:482s
fi-glk-2a        total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:591s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:432s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:415s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:420s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:504s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:471s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:470s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time:570s
fi-kbl-r         total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time:577s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:458s
fi-skl-6700hq    total:278  pass:229  dwarn:1   dfail:0   fail:26  skip:22  time:401s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:466s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:498s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:437s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:539s
fi-snb-2600      total:277  pass:248  dwarn:0   dfail:0   fail:0   skip:28 

76bd436e051e370698f466af7573d2f146bf559e drm-tip: 2017y-06m-08d-16h-56m-04s UTC integration manifest 3247cc5 drm/i915: Make MMIO_PORT flexible.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4914/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.BAT: success for drm/i915: Make MMIO_PORT flexible.

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: drm/i915: Make MMIO_PORT flexible.
URL : https://patchwork.freedesktop.org/series/25491/
State : success

== Summary ==

Series 25491v1 drm/i915: Make MMIO_PORT flexible.
https://patchwork.freedesktop.org/api/1.0/series/25491/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-kbl-7560u) fdo#100125

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:448s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:432s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:579s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:513s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:480s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:485s
fi-glk-2a        total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:589s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:434s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:410s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:418s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:483s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:470s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:472s
fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:564s
fi-kbl-r         total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time:577s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:465s
fi-skl-6700hq    total:278  pass:228  dwarn:1   dfail:0   fail:27  skip:22  time:399s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:472s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:474s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:435s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:536s

918e5432772d75f4a190be27305d28eeb1ce748e drm-tip: 2017y-06m-11d-11h-12m-29s UTC integration manifest b7dad2f drm/i915: Make MMIO_PORT flexible.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4932/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Rodrigo Vivi
Quoted 6 lines · Rodrigo Vivi

In the past the magic reg_a + (reg_b - reg_a) * port was enough because every new register that was appearing on new platforms was respecting the same gap.

However on more recent platforms we start seeing many registers that doesn't respect the gap.

Do you have a list of such registers?

Quoted 5 lines

So picking from
a list of registers seems to be the more general approach that covers all cases.

So let's make MMIO_PORT use _PICK directly so we don't

How much is this going to blow up the code size?

Quoted 47 lines

need to create MMIO_PORT3 MMIO_PORT5 MMIO_PORT6 or whatever number of different ports with different registers that doesn't respect the gap.

---
 drivers/gpu/drm/i915/i915_reg.h | 57 +++++++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -4
index b6d69e2..9a57a17 100644
@@ -57,9 +57,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
-#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
+#define _MMIO_PORT(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
@@ -1576,7 +1575,8 @@ enum skl_disp_power_wells {
 #define   BXT_PHY_LANE_POWERDOWN_ACK	(1 << 9)
 #define   BXT_PHY_LANE_ENABLED		(1 << 8)
 #define BXT_PHY_CTL(port)		_MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
-							 _BXT_PHY_CTL_DDI_B)
+							 _BXT_PHY_CTL_DDI_B, \
+							 _BXT_PHY_CTL_DDI_C)
 
 #define _PHY_CTL_FAMILY_EDP		0x64C80
 #define _PHY_CTL_FAMILY_DDI		0x64C90
@@ -1595,7 +1595,9 @@ enum skl_disp_power_wells {
 #define   PORT_PLL_REF_SEL		(1 << 27)
 #define   PORT_PLL_POWER_ENABLE		(1 << 26)
 #define   PORT_PLL_POWER_STATE		(1 << 25)
-#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
+#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, \
+							 _PORT_PLL_B, \
+							 _PORT_PLL_C)
 
 #define _PORT_PLL_EBB_0_A		0x162034
 #define _PORT_PLL_EBB_0_B		0x6C034

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 2461

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -2453,7 +2455,7 @@ enum skl_disp_power_wells {
 #define _VLV_AUD_PORT_EN_B_DBG		(VLV_DISPLAY_BASE + 0x62F20)
 #define _VLV_AUD_PORT_EN_C_DBG		(VLV_DISPLAY_BASE + 0x62F30)
 #define _VLV_AUD_PORT_EN_D_DBG		(VLV_DISPLAY_BASE + 0x62F34)
-#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT3((port) - PORT_B,	   \
+#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT((port) - PORT_B,	    \
 						    _VLV_AUD_PORT_EN_B_DBG, \
 						    _VLV_AUD_PORT_EN_C_DBG, \
 						    _VLV_AUD_PORT_EN_D_DBG)

There's really no need to change all the platforms. So would probably be better to limit the PICK to where we actually need it.

Quoted 13 lines
drivers/gpu/drm/i915/i915_reg.h +4 -1
@@ -4821,7 +4823,10 @@ enum {
 #define _DPD_AUX_CH_DATA4	(dev_priv->info.display_mmio_offset + 0x64320)
 #define _DPD_AUX_CH_DATA5	(dev_priv->info.display_mmio_offset + 0x64324)
 
-#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
+#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, \
+						 _DPB_AUX_CH_CTL, \
+						 _DPC_AUX_CH_CTL, \
+						 _DPD_AUX_CH_CTL)
 #define DP_AUX_CH_DATA(port, i)	_MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
 
 #define   DP_AUX_CH_CTL_SEND_BUSY	    (1 << 31)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7225

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +3 -1
@@ -7214,7 +7219,9 @@ enum {
 #define _PCH_DPD_AUX_CH_DATA4	0xe4320
 #define _PCH_DPD_AUX_CH_DATA5	0xe4324
 
-#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
+#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, \
+						   _PCH_DPB_AUX_CH_CTL, \
+						   _PCH_DPC_AUX_CH_CTL)
 #define PCH_DP_AUX_CH_DATA(port, i)	_MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */

You changed CTL but didn't change DATA. Why?

Also note that port D is missing from CTL now!

Quoted 70 lines
drivers/gpu/drm/i915/i915_reg.h +32 -4
 /* CPT */
@@ -7844,7 +7851,14 @@ enum {
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A			0x64040
 #define _DP_TP_CTL_B			0x64140
-#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
+#define _DP_TP_CTL_C			0x64240
+#define _DP_TP_CTL_D			0x64340
+#define _DP_TP_CTL_E			0x64440
+#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, \
+					 _DP_TP_CTL_B, \
+					 _DP_TP_CTL_C, \
+					 _DP_TP_CTL_D, \
+					 _DP_TP_CTL_E)
 #define  DP_TP_CTL_ENABLE			(1<<31)
 #define  DP_TP_CTL_MODE_SST			(0<<27)
 #define  DP_TP_CTL_MODE_MST			(1<<27)
@@ -7862,7 +7876,14 @@ enum {
 /* DisplayPort Transport Status */
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
-#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define _DP_TP_STATUS_C			0x64244
+#define _DP_TP_STATUS_D			0x64344
+#define _DP_TP_STATUS_E			0x64444
+#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, \
+					    _DP_TP_STATUS_B, \
+					    _DP_TP_STATUS_C, \
+					    _DP_TP_STATUS_D, \
+					    _DP_TP_STATUS_E)
 #define  DP_TP_STATUS_IDLE_DONE			(1<<25)
 #define  DP_TP_STATUS_ACT_SENT			(1<<24)
 #define  DP_TP_STATUS_MODE_STATUS_MST		(1<<23)
@@ -7874,7 +7895,14 @@ enum {
 /* DDI Buffer Control */
 #define _DDI_BUF_CTL_A				0x64000
 #define _DDI_BUF_CTL_B				0x64100
-#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
+#define _DDI_BUF_CTL_C				0x64200
+#define _DDI_BUF_CTL_D				0x64300
+#define _DDI_BUF_CTL_E				0x64400
+#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, \
+					   _DDI_BUF_CTL_B, \
+					   _DDI_BUF_CTL_C, \
+					   _DDI_BUF_CTL_D, \
+					   _DDI_BUF_CTL_E)
 #define  DDI_BUF_CTL_ENABLE			(1<<31)
 #define  DDI_BUF_TRANS_SELECT(n)	((n) << 24)
 #define  DDI_BUF_EMP_MASK			(0xf<<24)
@@ -7973,7 +8001,14 @@ enum {
 /* Port clock selection */
 #define _PORT_CLK_SEL_A			0x46100
 #define _PORT_CLK_SEL_B			0x46104
-#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
+#define _PORT_CLK_SEL_C			0x46108
+#define _PORT_CLK_SEL_D			0x4610C
+#define _PORT_CLK_SEL_E			0x46110
+#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, \
+				            _PORT_CLK_SEL_B, \
+				            _PORT_CLK_SEL_C, \
+				            _PORT_CLK_SEL_D, \
+					    _PORT_CLK_SEL_E)
 #define  PORT_CLK_SEL_LCPLL_2700	(0<<29)
 #define  PORT_CLK_SEL_LCPLL_1350	(1<<29)
 #define  PORT_CLK_SEL_LCPLL_810		(2<<29)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#4 lore raw
Quoted 11 lines · Ville Syrjälä
Quoted 6 lines · Rodrigo Vivi

In the past the magic reg_a + (reg_b - reg_a) * port was enough because every new register that was appearing on new platforms was respecting the same gap.

However on more recent platforms we start seeing many registers that doesn't respect the gap.

Do you have a list of such registers?

I don't have a list, but I remember seeing a lot on BXT and many of CNL ones specially for the PORT F ones.

Quoted 8 lines
Quoted 6 lines

So picking from
a list of registers seems to be the more general approach that covers all cases.

So let's make MMIO_PORT use _PICK directly so we don't

How much is this going to blow up the code size?

well, the initial idea I believe it was to reduce avoiding few new macros, but during the implementation I saw that we had to actually list more registers and indeed this end up increasing the size.

Quoted 45 lines
Quoted 45 lines

need to create MMIO_PORT3 MMIO_PORT5 MMIO_PORT6 or whatever number of different ports with different registers that doesn't respect the gap.

---
 drivers/gpu/drm/i915/i915_reg.h | 57 +++++++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -4
index b6d69e2..9a57a17 100644
@@ -57,9 +57,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
-#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
+#define _MMIO_PORT(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
@@ -1576,7 +1575,8 @@ enum skl_disp_power_wells {
 #define   BXT_PHY_LANE_POWERDOWN_ACK	(1 << 9)
 #define   BXT_PHY_LANE_ENABLED		(1 << 8)
 #define BXT_PHY_CTL(port)		_MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
-							 _BXT_PHY_CTL_DDI_B)
+							 _BXT_PHY_CTL_DDI_B, \
+							 _BXT_PHY_CTL_DDI_C)
 
 #define _PHY_CTL_FAMILY_EDP		0x64C80
 #define _PHY_CTL_FAMILY_DDI		0x64C90
@@ -1595,7 +1595,9 @@ enum skl_disp_power_wells {
 #define   PORT_PLL_REF_SEL		(1 << 27)
 #define   PORT_PLL_POWER_ENABLE		(1 << 26)
 #define   PORT_PLL_POWER_STATE		(1 << 25)
-#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
+#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, \
+							 _PORT_PLL_B, \
+							 _PORT_PLL_C)
 
Quoted 14 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 2461

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
 #define _PORT_PLL_EBB_0_A		0x162034
 #define _PORT_PLL_EBB_0_B		0x6C034
@@ -2453,7 +2455,7 @@ enum skl_disp_power_wells {
 #define _VLV_AUD_PORT_EN_B_DBG		(VLV_DISPLAY_BASE + 0x62F20)
 #define _VLV_AUD_PORT_EN_C_DBG		(VLV_DISPLAY_BASE + 0x62F30)
 #define _VLV_AUD_PORT_EN_D_DBG		(VLV_DISPLAY_BASE + 0x62F34)
-#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT3((port) - PORT_B,	   \
+#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT((port) - PORT_B,	    \
 						    _VLV_AUD_PORT_EN_B_DBG, \
 						    _VLV_AUD_PORT_EN_C_DBG, \
 						    _VLV_AUD_PORT_EN_D_DBG)

There's really no need to change all the platforms. So would probably be better to limit the PICK to where we actually need it.

Ok, so, what about leave MMIO_PORT as is and create a MMIO_PICK for the registers we need list? So we avoid creating one MMIO_PORT* for every different number of ports.

Quoted 89 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h +4 -1
@@ -4821,7 +4823,10 @@ enum {
 #define _DPD_AUX_CH_DATA4	(dev_priv->info.display_mmio_offset + 0x64320)
 #define _DPD_AUX_CH_DATA5	(dev_priv->info.display_mmio_offset + 0x64324)
 
-#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
+#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, \
+						 _DPB_AUX_CH_CTL, \
+						 _DPC_AUX_CH_CTL, \
+						 _DPD_AUX_CH_CTL)
 #define DP_AUX_CH_DATA(port, i)	_MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
 
 #define   DP_AUX_CH_CTL_SEND_BUSY	    (1 << 31)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7225

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +3 -1
@@ -7214,7 +7219,9 @@ enum {
 #define _PCH_DPD_AUX_CH_DATA4	0xe4320
 #define _PCH_DPD_AUX_CH_DATA5	0xe4324
 
-#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
+#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, \
+						   _PCH_DPB_AUX_CH_CTL, \
+						   _PCH_DPC_AUX_CH_CTL)
 #define PCH_DP_AUX_CH_DATA(port, i)	_MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */

You changed CTL but didn't change DATA. Why?

Also note that port D is missing from CTL now!

Quoted 62 lines
drivers/gpu/drm/i915/i915_reg.h +31 -4
 /* CPT */
@@ -7844,7 +7851,14 @@ enum {
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A			0x64040
 #define _DP_TP_CTL_B			0x64140
-#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
+#define _DP_TP_CTL_C			0x64240
+#define _DP_TP_CTL_D			0x64340
+#define _DP_TP_CTL_E			0x64440
+#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, \
+					 _DP_TP_CTL_B, \
+					 _DP_TP_CTL_C, \
+					 _DP_TP_CTL_D, \
+					 _DP_TP_CTL_E)
 #define  DP_TP_CTL_ENABLE			(1<<31)
 #define  DP_TP_CTL_MODE_SST			(0<<27)
 #define  DP_TP_CTL_MODE_MST			(1<<27)
@@ -7862,7 +7876,14 @@ enum {
 /* DisplayPort Transport Status */
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
-#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define _DP_TP_STATUS_C			0x64244
+#define _DP_TP_STATUS_D			0x64344
+#define _DP_TP_STATUS_E			0x64444
+#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, \
+					    _DP_TP_STATUS_B, \
+					    _DP_TP_STATUS_C, \
+					    _DP_TP_STATUS_D, \
+					    _DP_TP_STATUS_E)
 #define  DP_TP_STATUS_IDLE_DONE			(1<<25)
 #define  DP_TP_STATUS_ACT_SENT			(1<<24)
 #define  DP_TP_STATUS_MODE_STATUS_MST		(1<<23)
@@ -7874,7 +7895,14 @@ enum {
 /* DDI Buffer Control */
 #define _DDI_BUF_CTL_A				0x64000
 #define _DDI_BUF_CTL_B				0x64100
-#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
+#define _DDI_BUF_CTL_C				0x64200
+#define _DDI_BUF_CTL_D				0x64300
+#define _DDI_BUF_CTL_E				0x64400
+#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, \
+					   _DDI_BUF_CTL_B, \
+					   _DDI_BUF_CTL_C, \
+					   _DDI_BUF_CTL_D, \
+					   _DDI_BUF_CTL_E)
 #define  DDI_BUF_CTL_ENABLE			(1<<31)
 #define  DDI_BUF_TRANS_SELECT(n)	((n) << 24)
 #define  DDI_BUF_EMP_MASK			(0xf<<24)
@@ -7973,7 +8001,14 @@ enum {
 /* Port clock selection */
 #define _PORT_CLK_SEL_A			0x46100
 #define _PORT_CLK_SEL_B			0x46104
-#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
+#define _PORT_CLK_SEL_C			0x46108
+#define _PORT_CLK_SEL_D			0x4610C
+#define _PORT_CLK_SEL_E			0x46110
+#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, \
+				            _PORT_CLK_SEL_B, \
+				            _PORT_CLK_SEL_C, \
+				            _PORT_CLK_SEL_D, \
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
+					    _PORT_CLK_SEL_E)
 #define  PORT_CLK_SEL_LCPLL_2700	(0<<29)
 #define  PORT_CLK_SEL_LCPLL_1350	(1<<29)
 #define  PORT_CLK_SEL_LCPLL_810		(2<<29)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 11 lines · Rodrigo
Quoted 10 lines · Ville Syrjälä
Quoted 6 lines · Rodrigo Vivi

In the past the magic reg_a + (reg_b - reg_a) * port was enough because every new register that was appearing on new platforms was respecting the same gap.

However on more recent platforms we start seeing many registers that doesn't respect the gap.

Quoted 4 lines
Quoted 1 line

Do you have a list of such registers?

I don't have a list, but I remember seeing a lot on BXT and many of CNL ones specially for the PORT F ones.

I had a quick look and couldn't find any.

Quoted 177 lines
Quoted 9 lines
Quoted 7 lines

So picking from
a list of registers seems to be the more general approach that covers all cases.

So let's make MMIO_PORT use _PICK directly so we don't

How much is this going to blow up the code size?

well, the initial idea I believe it was to reduce avoiding few new macros, but during the implementation I saw that we had to actually list more registers and indeed this end up increasing the size.

Quoted 45 lines
Quoted 45 lines

need to create MMIO_PORT3 MMIO_PORT5 MMIO_PORT6 or whatever number of different ports with different registers that doesn't respect the gap.

---
 drivers/gpu/drm/i915/i915_reg.h | 57 +++++++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -4
index b6d69e2..9a57a17 100644
@@ -57,9 +57,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
-#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
+#define _MMIO_PORT(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
@@ -1576,7 +1575,8 @@ enum skl_disp_power_wells {
 #define   BXT_PHY_LANE_POWERDOWN_ACK	(1 << 9)
 #define   BXT_PHY_LANE_ENABLED		(1 << 8)
 #define BXT_PHY_CTL(port)		_MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
-							 _BXT_PHY_CTL_DDI_B)
+							 _BXT_PHY_CTL_DDI_B, \
+							 _BXT_PHY_CTL_DDI_C)
 
 #define _PHY_CTL_FAMILY_EDP		0x64C80
 #define _PHY_CTL_FAMILY_DDI		0x64C90
@@ -1595,7 +1595,9 @@ enum skl_disp_power_wells {
 #define   PORT_PLL_REF_SEL		(1 << 27)
 #define   PORT_PLL_POWER_ENABLE		(1 << 26)
 #define   PORT_PLL_POWER_STATE		(1 << 25)
-#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
+#define BXT_PORT_PLL_ENABLE(port)	_MMIO_PORT(port, _PORT_PLL_A, \
+							 _PORT_PLL_B, \
+							 _PORT_PLL_C)
 
Quoted 14 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 2461

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
 #define _PORT_PLL_EBB_0_A		0x162034
 #define _PORT_PLL_EBB_0_B		0x6C034
@@ -2453,7 +2455,7 @@ enum skl_disp_power_wells {
 #define _VLV_AUD_PORT_EN_B_DBG		(VLV_DISPLAY_BASE + 0x62F20)
 #define _VLV_AUD_PORT_EN_C_DBG		(VLV_DISPLAY_BASE + 0x62F30)
 #define _VLV_AUD_PORT_EN_D_DBG		(VLV_DISPLAY_BASE + 0x62F34)
-#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT3((port) - PORT_B,	   \
+#define VLV_AUD_PORT_EN_DBG(port)	_MMIO_PORT((port) - PORT_B,	    \
 						    _VLV_AUD_PORT_EN_B_DBG, \
 						    _VLV_AUD_PORT_EN_C_DBG, \
 						    _VLV_AUD_PORT_EN_D_DBG)

There's really no need to change all the platforms. So would probably be better to limit the PICK to where we actually need it.

Ok, so, what about leave MMIO_PORT as is and create a MMIO_PICK for the registers we need list? So we avoid creating one MMIO_PORT* for every different number of ports.

Quoted 98 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h +4 -1
@@ -4821,7 +4823,10 @@ enum {
 #define _DPD_AUX_CH_DATA4	(dev_priv->info.display_mmio_offset + 0x64320)
 #define _DPD_AUX_CH_DATA5	(dev_priv->info.display_mmio_offset + 0x64324)
 
-#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
+#define DP_AUX_CH_CTL(port)	_MMIO_PORT(port, _DPA_AUX_CH_CTL, \
+						 _DPB_AUX_CH_CTL, \
+						 _DPC_AUX_CH_CTL, \
+						 _DPD_AUX_CH_CTL)
 #define DP_AUX_CH_DATA(port, i)	_MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
 
 #define   DP_AUX_CH_CTL_SEND_BUSY	    (1 << 31)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7225

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +3 -1
@@ -7214,7 +7219,9 @@ enum {
 #define _PCH_DPD_AUX_CH_DATA4	0xe4320
 #define _PCH_DPD_AUX_CH_DATA5	0xe4324
 
-#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
+#define PCH_DP_AUX_CH_CTL(port)		_MMIO_PORT((port) - PORT_B, \
+						   _PCH_DPB_AUX_CH_CTL, \
+						   _PCH_DPC_AUX_CH_CTL)
 #define PCH_DP_AUX_CH_DATA(port, i)	_MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */

You changed CTL but didn't change DATA. Why?

Also note that port D is missing from CTL now!

Quoted 70 lines
drivers/gpu/drm/i915/i915_reg.h +32 -4
 /* CPT */
@@ -7844,7 +7851,14 @@ enum {
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A			0x64040
 #define _DP_TP_CTL_B			0x64140
-#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
+#define _DP_TP_CTL_C			0x64240
+#define _DP_TP_CTL_D			0x64340
+#define _DP_TP_CTL_E			0x64440
+#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, \
+					 _DP_TP_CTL_B, \
+					 _DP_TP_CTL_C, \
+					 _DP_TP_CTL_D, \
+					 _DP_TP_CTL_E)
 #define  DP_TP_CTL_ENABLE			(1<<31)
 #define  DP_TP_CTL_MODE_SST			(0<<27)
 #define  DP_TP_CTL_MODE_MST			(1<<27)
@@ -7862,7 +7876,14 @@ enum {
 /* DisplayPort Transport Status */
 #define _DP_TP_STATUS_A			0x64044
 #define _DP_TP_STATUS_B			0x64144
-#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define _DP_TP_STATUS_C			0x64244
+#define _DP_TP_STATUS_D			0x64344
+#define _DP_TP_STATUS_E			0x64444
+#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, \
+					    _DP_TP_STATUS_B, \
+					    _DP_TP_STATUS_C, \
+					    _DP_TP_STATUS_D, \
+					    _DP_TP_STATUS_E)
 #define  DP_TP_STATUS_IDLE_DONE			(1<<25)
 #define  DP_TP_STATUS_ACT_SENT			(1<<24)
 #define  DP_TP_STATUS_MODE_STATUS_MST		(1<<23)
@@ -7874,7 +7895,14 @@ enum {
 /* DDI Buffer Control */
 #define _DDI_BUF_CTL_A				0x64000
 #define _DDI_BUF_CTL_B				0x64100
-#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
+#define _DDI_BUF_CTL_C				0x64200
+#define _DDI_BUF_CTL_D				0x64300
+#define _DDI_BUF_CTL_E				0x64400
+#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, \
+					   _DDI_BUF_CTL_B, \
+					   _DDI_BUF_CTL_C, \
+					   _DDI_BUF_CTL_D, \
+					   _DDI_BUF_CTL_E)
 #define  DDI_BUF_CTL_ENABLE			(1<<31)
 #define  DDI_BUF_TRANS_SELECT(n)	((n) << 24)
 #define  DDI_BUF_EMP_MASK			(0xf<<24)
@@ -7973,7 +8001,14 @@ enum {
 /* Port clock selection */
 #define _PORT_CLK_SEL_A			0x46100
 #define _PORT_CLK_SEL_B			0x46104
-#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
+#define _PORT_CLK_SEL_C			0x46108
+#define _PORT_CLK_SEL_D			0x4610C
+#define _PORT_CLK_SEL_E			0x46110
+#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, \
+				            _PORT_CLK_SEL_B, \
+				            _PORT_CLK_SEL_C, \
+				            _PORT_CLK_SEL_D, \
+					    _PORT_CLK_SEL_E)
 #define  PORT_CLK_SEL_LCPLL_2700	(0<<29)
 #define  PORT_CLK_SEL_LCPLL_1350	(1<<29)
 #define  PORT_CLK_SEL_LCPLL_810		(2<<29)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 12 lines · Ville Syrjälä
Quoted 11 lines · Rodrigo
Quoted 10 lines · Ville Syrjälä
Quoted 6 lines · Rodrigo Vivi

In the past the magic reg_a + (reg_b - reg_a) * port was enough because every new register that was appearing on new platforms was respecting the same gap.

However on more recent platforms we start seeing many registers that doesn't respect the gap.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do you have a list of such registers?

I don't have a list, but I remember seeing a lot on BXT and many of CNL ones specially for the PORT F ones.

I had a quick look and couldn't find any.

oh, the BXT ones are using BXT_PHY_BASE...

but for the existent ones is the one that uses MMIO_PORT3:
_VLV_AUD_PORT_EN_B_DBG

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x62F34-0x62F30

4

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x62F30-0x62F20

16

and users of MMIO_PORT6 that I just merged on dinq:

CNL_PORT_PCS_DW1_LN0:

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162804-0x162E04

-1536

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162E04-0x162C04

512

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162C04-0x162604

1536

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162604-0x162404

512

Quoted 186 lines
Quoted 75 lines
Quoted 10 lines
Quoted 8 lines

So picking from
a list of registers seems to be the more general approach that covers all cases.

So let's make MMIO_PORT use _PICK directly so we don't

How much is this going to blow up the code size?

well, the initial idea I believe it was to reduce avoiding few new macros, but during the implementation I saw that we had to actually list more registers and indeed this end up increasing the size.

Quoted 45 lines
Quoted 45 lines

need to create MMIO_PORT3 MMIO_PORT5 MMIO_PORT6 or whatever number of different ports with different registers that doesn't respect the gap.

---
 drivers/gpu/drm/i915/i915_reg.h | 57 +++++++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -4
index b6d69e2..9a57a17 100644
@@ -57,9 +57,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
-#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
+#define _MMIO_PORT(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
@@ -1576,7 +1575,8 @@ enum skl_disp_power_wells {
 #define   BXT_PHY_LANE_POWERDOWN_ACK     (1 << 9)
 #define   BXT_PHY_LANE_ENABLED           (1 << 8)
 #define BXT_PHY_CTL(port)                _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
-                                                  _BXT_PHY_CTL_DDI_B)
+                                                  _BXT_PHY_CTL_DDI_B, \
+                                                  _BXT_PHY_CTL_DDI_C)
 
 #define _PHY_CTL_FAMILY_EDP              0x64C80
 #define _PHY_CTL_FAMILY_DDI              0x64C90
@@ -1595,7 +1595,9 @@ enum skl_disp_power_wells {
 #define   PORT_PLL_REF_SEL               (1 << 27)
 #define   PORT_PLL_POWER_ENABLE          (1 << 26)
 #define   PORT_PLL_POWER_STATE           (1 << 25)
-#define BXT_PORT_PLL_ENABLE(port)        _MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
+#define BXT_PORT_PLL_ENABLE(port)        _MMIO_PORT(port, _PORT_PLL_A, \
+                                                  _PORT_PLL_B, \
+                                                  _PORT_PLL_C)
 
Quoted 14 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 2461

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
 #define _PORT_PLL_EBB_0_A                0x162034
 #define _PORT_PLL_EBB_0_B                0x6C034
@@ -2453,7 +2455,7 @@ enum skl_disp_power_wells {
 #define _VLV_AUD_PORT_EN_B_DBG           (VLV_DISPLAY_BASE + 0x62F20)
 #define _VLV_AUD_PORT_EN_C_DBG           (VLV_DISPLAY_BASE + 0x62F30)
 #define _VLV_AUD_PORT_EN_D_DBG           (VLV_DISPLAY_BASE + 0x62F34)
-#define VLV_AUD_PORT_EN_DBG(port)        _MMIO_PORT3((port) - PORT_B,       \
+#define VLV_AUD_PORT_EN_DBG(port)        _MMIO_PORT((port) - PORT_B,         \
                                              _VLV_AUD_PORT_EN_B_DBG, \
                                              _VLV_AUD_PORT_EN_C_DBG, \
                                              _VLV_AUD_PORT_EN_D_DBG)

There's really no need to change all the platforms. So would probably be better to limit the PICK to where we actually need it.

Quoted 103 lines

Ok, so, what about leave MMIO_PORT as is and create a MMIO_PICK for the registers we need list? So we avoid creating one MMIO_PORT* for every different number of ports.

Quoted 98 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h +4 -1
@@ -4821,7 +4823,10 @@ enum {
 #define _DPD_AUX_CH_DATA4        (dev_priv->info.display_mmio_offset + 0x64320)
 #define _DPD_AUX_CH_DATA5        (dev_priv->info.display_mmio_offset + 0x64324)
 
-#define DP_AUX_CH_CTL(port)      _MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
+#define DP_AUX_CH_CTL(port)      _MMIO_PORT(port, _DPA_AUX_CH_CTL, \
+                                          _DPB_AUX_CH_CTL, \
+                                          _DPC_AUX_CH_CTL, \
+                                          _DPD_AUX_CH_CTL)
 #define DP_AUX_CH_DATA(port, i)  _MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
 
 #define   DP_AUX_CH_CTL_SEND_BUSY            (1 << 31)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7225

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +3 -1
@@ -7214,7 +7219,9 @@ enum {
 #define _PCH_DPD_AUX_CH_DATA4    0xe4320
 #define _PCH_DPD_AUX_CH_DATA5    0xe4324
 
-#define PCH_DP_AUX_CH_CTL(port)          _MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
+#define PCH_DP_AUX_CH_CTL(port)          _MMIO_PORT((port) - PORT_B, \
+                                            _PCH_DPB_AUX_CH_CTL, \
+                                            _PCH_DPC_AUX_CH_CTL)
 #define PCH_DP_AUX_CH_DATA(port, i)      _MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */

You changed CTL but didn't change DATA. Why?

Also note that port D is missing from CTL now!

Quoted 70 lines
drivers/gpu/drm/i915/i915_reg.h +32 -4
 /* CPT */
@@ -7844,7 +7851,14 @@ enum {
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A                     0x64040
 #define _DP_TP_CTL_B                     0x64140
-#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
+#define _DP_TP_CTL_C                     0x64240
+#define _DP_TP_CTL_D                     0x64340
+#define _DP_TP_CTL_E                     0x64440
+#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, \
+                                  _DP_TP_CTL_B, \
+                                  _DP_TP_CTL_C, \
+                                  _DP_TP_CTL_D, \
+                                  _DP_TP_CTL_E)
 #define  DP_TP_CTL_ENABLE                        (1<<31)
 #define  DP_TP_CTL_MODE_SST                      (0<<27)
 #define  DP_TP_CTL_MODE_MST                      (1<<27)
@@ -7862,7 +7876,14 @@ enum {
 /* DisplayPort Transport Status */
 #define _DP_TP_STATUS_A                  0x64044
 #define _DP_TP_STATUS_B                  0x64144
-#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define _DP_TP_STATUS_C                  0x64244
+#define _DP_TP_STATUS_D                  0x64344
+#define _DP_TP_STATUS_E                  0x64444
+#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, \
+                                     _DP_TP_STATUS_B, \
+                                     _DP_TP_STATUS_C, \
+                                     _DP_TP_STATUS_D, \
+                                     _DP_TP_STATUS_E)
 #define  DP_TP_STATUS_IDLE_DONE                  (1<<25)
 #define  DP_TP_STATUS_ACT_SENT                   (1<<24)
 #define  DP_TP_STATUS_MODE_STATUS_MST            (1<<23)
@@ -7874,7 +7895,14 @@ enum {
 /* DDI Buffer Control */
 #define _DDI_BUF_CTL_A                           0x64000
 #define _DDI_BUF_CTL_B                           0x64100
-#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
+#define _DDI_BUF_CTL_C                           0x64200
+#define _DDI_BUF_CTL_D                           0x64300
+#define _DDI_BUF_CTL_E                           0x64400
+#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, \
+                                    _DDI_BUF_CTL_B, \
+                                    _DDI_BUF_CTL_C, \
+                                    _DDI_BUF_CTL_D, \
+                                    _DDI_BUF_CTL_E)
 #define  DDI_BUF_CTL_ENABLE                      (1<<31)
 #define  DDI_BUF_TRANS_SELECT(n) ((n) << 24)
 #define  DDI_BUF_EMP_MASK                        (0xf<<24)
@@ -7973,7 +8001,14 @@ enum {
 /* Port clock selection */
 #define _PORT_CLK_SEL_A                  0x46100
 #define _PORT_CLK_SEL_B                  0x46104
-#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
+#define _PORT_CLK_SEL_C                  0x46108
+#define _PORT_CLK_SEL_D                  0x4610C
+#define _PORT_CLK_SEL_E                  0x46110
+#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, \
+                                     _PORT_CLK_SEL_B, \
+                                     _PORT_CLK_SEL_C, \
+                                     _PORT_CLK_SEL_D, \
+                                     _PORT_CLK_SEL_E)
 #define  PORT_CLK_SEL_LCPLL_2700 (0<<29)
 #define  PORT_CLK_SEL_LCPLL_1350 (1<<29)
 #define  PORT_CLK_SEL_LCPLL_810          (2<<29)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 33 lines · Rodrigo Vivi
Quoted 12 lines · Ville Syrjälä
Quoted 11 lines · Rodrigo
Quoted 10 lines · Ville Syrjälä
Quoted 6 lines · Rodrigo Vivi

In the past the magic reg_a + (reg_b - reg_a) * port was enough because every new register that was appearing on new platforms was respecting the same gap.

However on more recent platforms we start seeing many registers that doesn't respect the gap.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do you have a list of such registers?

I don't have a list, but I remember seeing a lot on BXT and many of CNL ones specially for the PORT F ones.

I had a quick look and couldn't find any.

oh, the BXT ones are using BXT_PHY_BASE...

but for the existent ones is the one that uses MMIO_PORT3:
_VLV_AUD_PORT_EN_B_DBG

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x62F34-0x62F30

4

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x62F30-0x62F20

16

and users of MMIO_PORT6 that I just merged on dinq:

CNL_PORT_PCS_DW1_LN0:

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162804-0x162E04

-1536

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162E04-0x162C04

512

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162C04-0x162604

1536

Quoted 1 line
Quoted 1 line
Quoted 1 line

0x162604-0x162404

512

If there's lot of these and they get used a lot then I think the best option might be to add some kind of phy_port_offsets[] type of thing. Although it seems we'd need separate offsets for the group vs. individual lane access.

But for just a few registers that are not used that much and are purely CNL specific, then I guess just using _PICK for them might be OK.

Quoted 193 lines
Quoted 187 lines
Quoted 76 lines
Quoted 11 lines
Quoted 9 lines

So picking from
a list of registers seems to be the more general approach that covers all cases.

So let's make MMIO_PORT use _PICK directly so we don't

How much is this going to blow up the code size?

well, the initial idea I believe it was to reduce avoiding few new macros, but during the implementation I saw that we had to actually list more registers and indeed this end up increasing the size.

Quoted 45 lines
Quoted 45 lines

need to create MMIO_PORT3 MMIO_PORT5 MMIO_PORT6 or whatever number of different ports with different registers that doesn't respect the gap.

---
 drivers/gpu/drm/i915/i915_reg.h | 57 +++++++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -4
index b6d69e2..9a57a17 100644
@@ -57,9 +57,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
 #define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
-#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
+#define _MMIO_PORT(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
 #define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
-#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
 #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
 #define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
 
@@ -1576,7 +1575,8 @@ enum skl_disp_power_wells {
 #define   BXT_PHY_LANE_POWERDOWN_ACK     (1 << 9)
 #define   BXT_PHY_LANE_ENABLED           (1 << 8)
 #define BXT_PHY_CTL(port)                _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \
-                                                  _BXT_PHY_CTL_DDI_B)
+                                                  _BXT_PHY_CTL_DDI_B, \
+                                                  _BXT_PHY_CTL_DDI_C)
 
 #define _PHY_CTL_FAMILY_EDP              0x64C80
 #define _PHY_CTL_FAMILY_DDI              0x64C90
@@ -1595,7 +1595,9 @@ enum skl_disp_power_wells {
 #define   PORT_PLL_REF_SEL               (1 << 27)
 #define   PORT_PLL_POWER_ENABLE          (1 << 26)
 #define   PORT_PLL_POWER_STATE           (1 << 25)
-#define BXT_PORT_PLL_ENABLE(port)        _MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
+#define BXT_PORT_PLL_ENABLE(port)        _MMIO_PORT(port, _PORT_PLL_A, \
+                                                  _PORT_PLL_B, \
+                                                  _PORT_PLL_C)
 
Quoted 14 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 2461

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
 #define _PORT_PLL_EBB_0_A                0x162034
 #define _PORT_PLL_EBB_0_B                0x6C034
@@ -2453,7 +2455,7 @@ enum skl_disp_power_wells {
 #define _VLV_AUD_PORT_EN_B_DBG           (VLV_DISPLAY_BASE + 0x62F20)
 #define _VLV_AUD_PORT_EN_C_DBG           (VLV_DISPLAY_BASE + 0x62F30)
 #define _VLV_AUD_PORT_EN_D_DBG           (VLV_DISPLAY_BASE + 0x62F34)
-#define VLV_AUD_PORT_EN_DBG(port)        _MMIO_PORT3((port) - PORT_B,       \
+#define VLV_AUD_PORT_EN_DBG(port)        _MMIO_PORT((port) - PORT_B,         \
                                              _VLV_AUD_PORT_EN_B_DBG, \
                                              _VLV_AUD_PORT_EN_C_DBG, \
                                              _VLV_AUD_PORT_EN_D_DBG)

There's really no need to change all the platforms. So would probably be better to limit the PICK to where we actually need it.

Quoted 103 lines

Ok, so, what about leave MMIO_PORT as is and create a MMIO_PICK for the registers we need list? So we avoid creating one MMIO_PORT* for every different number of ports.

Quoted 98 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h +4 -1
@@ -4821,7 +4823,10 @@ enum {
 #define _DPD_AUX_CH_DATA4        (dev_priv->info.display_mmio_offset + 0x64320)
 #define _DPD_AUX_CH_DATA5        (dev_priv->info.display_mmio_offset + 0x64324)
 
-#define DP_AUX_CH_CTL(port)      _MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
+#define DP_AUX_CH_CTL(port)      _MMIO_PORT(port, _DPA_AUX_CH_CTL, \
+                                          _DPB_AUX_CH_CTL, \
+                                          _DPC_AUX_CH_CTL, \
+                                          _DPD_AUX_CH_CTL)
 #define DP_AUX_CH_DATA(port, i)  _MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
 
 #define   DP_AUX_CH_CTL_SEND_BUSY            (1 << 31)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7225

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +3 -1
@@ -7214,7 +7219,9 @@ enum {
 #define _PCH_DPD_AUX_CH_DATA4    0xe4320
 #define _PCH_DPD_AUX_CH_DATA5    0xe4324
 
-#define PCH_DP_AUX_CH_CTL(port)          _MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
+#define PCH_DP_AUX_CH_CTL(port)          _MMIO_PORT((port) - PORT_B, \
+                                            _PCH_DPB_AUX_CH_CTL, \
+                                            _PCH_DPC_AUX_CH_CTL)
 #define PCH_DP_AUX_CH_DATA(port, i)      _MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */

You changed CTL but didn't change DATA. Why?

Also note that port D is missing from CTL now!

Quoted 70 lines
drivers/gpu/drm/i915/i915_reg.h +32 -4
 /* CPT */
@@ -7844,7 +7851,14 @@ enum {
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A                     0x64040
 #define _DP_TP_CTL_B                     0x64140
-#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
+#define _DP_TP_CTL_C                     0x64240
+#define _DP_TP_CTL_D                     0x64340
+#define _DP_TP_CTL_E                     0x64440
+#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, \
+                                  _DP_TP_CTL_B, \
+                                  _DP_TP_CTL_C, \
+                                  _DP_TP_CTL_D, \
+                                  _DP_TP_CTL_E)
 #define  DP_TP_CTL_ENABLE                        (1<<31)
 #define  DP_TP_CTL_MODE_SST                      (0<<27)
 #define  DP_TP_CTL_MODE_MST                      (1<<27)
@@ -7862,7 +7876,14 @@ enum {
 /* DisplayPort Transport Status */
 #define _DP_TP_STATUS_A                  0x64044
 #define _DP_TP_STATUS_B                  0x64144
-#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
+#define _DP_TP_STATUS_C                  0x64244
+#define _DP_TP_STATUS_D                  0x64344
+#define _DP_TP_STATUS_E                  0x64444
+#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, \
+                                     _DP_TP_STATUS_B, \
+                                     _DP_TP_STATUS_C, \
+                                     _DP_TP_STATUS_D, \
+                                     _DP_TP_STATUS_E)
 #define  DP_TP_STATUS_IDLE_DONE                  (1<<25)
 #define  DP_TP_STATUS_ACT_SENT                   (1<<24)
 #define  DP_TP_STATUS_MODE_STATUS_MST            (1<<23)
@@ -7874,7 +7895,14 @@ enum {
 /* DDI Buffer Control */
 #define _DDI_BUF_CTL_A                           0x64000
 #define _DDI_BUF_CTL_B                           0x64100
-#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
+#define _DDI_BUF_CTL_C                           0x64200
+#define _DDI_BUF_CTL_D                           0x64300
+#define _DDI_BUF_CTL_E                           0x64400
+#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, \
+                                    _DDI_BUF_CTL_B, \
+                                    _DDI_BUF_CTL_C, \
+                                    _DDI_BUF_CTL_D, \
+                                    _DDI_BUF_CTL_E)
 #define  DDI_BUF_CTL_ENABLE                      (1<<31)
 #define  DDI_BUF_TRANS_SELECT(n) ((n) << 24)
 #define  DDI_BUF_EMP_MASK                        (0xf<<24)
@@ -7973,7 +8001,14 @@ enum {
 /* Port clock selection */
 #define _PORT_CLK_SEL_A                  0x46100
 #define _PORT_CLK_SEL_B                  0x46104
-#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
+#define _PORT_CLK_SEL_C                  0x46108
+#define _PORT_CLK_SEL_D                  0x4610C
+#define _PORT_CLK_SEL_E                  0x46110
+#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, \
+                                     _PORT_CLK_SEL_B, \
+                                     _PORT_CLK_SEL_C, \
+                                     _PORT_CLK_SEL_D, \
+                                     _PORT_CLK_SEL_E)
 #define  PORT_CLK_SEL_LCPLL_2700 (0<<29)
 #define  PORT_CLK_SEL_LCPLL_1350 (1<<29)
 #define  PORT_CLK_SEL_LCPLL_810          (2<<29)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 4 lines · Ville Syrjälä

If there's lot of these and they get used a lot then I think the best option might be to add some kind of phy_port_offsets[] type of thing. Although it seems we'd need separate offsets for the group vs. individual lane access.

We have that for pipe_offsets, trans_offsets, palette_offsets, and cursor_offsets in struct intel_device_info. That's fine for some things, a bit awkward for some others. It's a bit heavy when there are just few registers following some scheme.

Quoted 3 lines

But for just a few registers that are not used that much and are purely CNL specific, then I guess just using _PICK for them might be OK.

Yes, we definitely want to avoid _PICK when ((a) + (port)*((b)-(a))) or similar will do.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx