Skip to contentSkip to conversation

drm/i915: Use wait_for_register in lpt_reset_fdi_mphy()

PATCH Superseded Michal Wajdeczko 3 participants 3 messages Apr 10, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Use wait_for_register in lpt_reset_fdi_mphy()

There is no need to use macros as we can use generic function. And we can save ~2000 bytes in driver footprint.

Cc Paulo Zanoni <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -5
index b6b40cd..63f9dae4 100644
@@ -7697,22 +7697,30 @@ static void ironlake_init_pch_refclk(struct drm_i915_private *dev_priv)
 
 static void lpt_reset_fdi_mphy(struct drm_i915_private *dev_priv)
 {
+	int ret;
 	uint32_t tmp;
 
 	tmp = I915_READ(SOUTH_CHICKEN2);
 	tmp |= FDI_MPHY_IOSFSB_RESET_CTL;
 	I915_WRITE(SOUTH_CHICKEN2, tmp);
 
-	if (wait_for_us(I915_READ(SOUTH_CHICKEN2) &
-			FDI_MPHY_IOSFSB_RESET_STATUS, 100))
+	ret = __intel_wait_for_register_fw(dev_priv,
+					   SOUTH_CHICKEN2,
+					   FDI_MPHY_IOSFSB_RESET_STATUS,
+					   FDI_MPHY_IOSFSB_RESET_STATUS,
+					   100, 0, &tmp);
+	if (ret)
 		DRM_ERROR("FDI mPHY reset assert timeout\n");
 
-	tmp = I915_READ(SOUTH_CHICKEN2);
 	tmp &= ~FDI_MPHY_IOSFSB_RESET_CTL;
 	I915_WRITE(SOUTH_CHICKEN2, tmp);
 
-	if (wait_for_us((I915_READ(SOUTH_CHICKEN2) &
-			 FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100))
+	ret = __intel_wait_for_register_fw(dev_priv,
+					   SOUTH_CHICKEN2,
+					   FDI_MPHY_IOSFSB_RESET_STATUS,
+					   0,
+					   100, 0, &tmp);
+	if (ret)
 		DRM_ERROR("FDI mPHY reset de-assert timeout\n");
 }
 
Signature · 6 lines
2.7.4

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

✓ Fi.CI.BAT: success for drm/i915: Use wait_for_register in lpt_reset_fdi_mphy()

== Series Details ==

== Series Details ==

Series: drm/i915: Use wait_for_register in lpt_reset_fdi_mphy()
URL : https://patchwork.freedesktop.org/series/22758/
State : success

== Summary ==

Series 22758v1 drm/i915: Use wait_for_register in lpt_reset_fdi_mphy()
https://patchwork.freedesktop.org/api/1.0/series/22758/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                pass       -> FAIL       (fi-snb-2600) fdo#100007

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

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:427s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:428s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:567s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:514s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time:544s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:492s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:483s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:407s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:408s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:425s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:489s
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:450s
fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:568s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:460s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time:567s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:461s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:487s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:433s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:533s
fi-snb-2600      total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  time:402s

d86f5fa557fdf089bdb5b51f625a7f5967f11015 drm-tip: 2017y-04m-10d-06h-38m-49s UTC integration manifest bb5c4e4 drm/i915: Use wait_for_register in lpt_reset_fdi_mphy()

== Logs ==

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

#2 lore raw
In reply to Michal Wajdeczko
Quoted 24 lines · Michal Wajdeczko

There is no need to use macros as we can use generic function. And we can save ~2000 bytes in driver footprint.

Cc Paulo Zanoni <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -0
index b6b40cd..63f9dae4 100644
@@ -7697,22 +7697,30 @@ static void ironlake_init_pch_refclk(struct drm_i915_private *dev_priv)
 
 static void lpt_reset_fdi_mphy(struct drm_i915_private *dev_priv)
 {
+	int ret;
 	uint32_t tmp;
 
 	tmp = I915_READ(SOUTH_CHICKEN2);
 	tmp |= FDI_MPHY_IOSFSB_RESET_CTL;
 	I915_WRITE(SOUTH_CHICKEN2, tmp);

drivers/gpu/drm/i915/intel_display.c static void ironlake_init_pch_refclk(struct drm_i915_private *dev_priv) · line 7713

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +6 -2
 
-	if (wait_for_us(I915_READ(SOUTH_CHICKEN2) &
-			FDI_MPHY_IOSFSB_RESET_STATUS, 100))
+	ret = __intel_wait_for_register_fw(dev_priv,
+					   SOUTH_CHICKEN2,
+					   FDI_MPHY_IOSFSB_RESET_STATUS,
+					   FDI_MPHY_IOSFSB_RESET_STATUS,
+					   100, 0, &tmp);
+	if (ret)
 		DRM_ERROR("FDI mPHY reset assert timeout\n");

If we aren't using ret, and if the function remains neatly aligned I would have just done

	if ( __intel_wait_for_register_fw(dev_priv, ...))

DRM_ERROR("FDI mPHY reset assert timeout\n");

I would also let it have a 10ms max timeout - there's no downside. We didn't before because of the expense of the wait_for() loops, and this must be a waitable context.

Hmm. We do want __inte_wait_for_register_fw:

	might_sleep_if(fast_timeout_us > 10 || slow_timeout_ms);

-Chris

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