<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 16, 2016 at 4:33 PM Clint Taylor <<a href="mailto:clinton.a.taylor@intel.com">clinton.a.taylor@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/16/2016 12:27 AM, Daniel Vetter wrote:<br>
> On Tue, Mar 15, 2016 at 02:34:05PM -0700, <a href="mailto:clinton.a.taylor@intel.com" target="_blank">clinton.a.taylor@intel.com</a> wrote:<br>
>> From: Clint Taylor <<a href="mailto:clinton.a.taylor@intel.com" target="_blank">clinton.a.taylor@intel.com</a>><br>
>><br>
>> WARNING: Using ChromeOS with an eDP panel and a 4K@60 DP monitor connected<br>
>> to DDI1 the system will hard hang during a cold boot. Occurs when DDI1<br>
>> is enabled when the cdclk is less then required. DP connected to DDI2<br>
>> and HPD on either port works correctly.<br>
><br>
> So this patch hard-hangs machines?<br>
<br>
The hard-hang only occurs in developer mode ChromeOS with Coreboot (FSP<br>
version < 1.9) using DP on DDI1 using a USB-C->DP converter.<br>
<br>
We have not been able to reproduce this issue since updating to FSP 1.9<br>
and was never able to replicate the issue with UEFI and SKL RVP. The<br>
warning was added to the commit message during development to make<br>
everyone aware of the issue.<br></blockquote><div><br></div><div>What does this developer mode has special/different?</div><div>What are the risks of getting this in other platform out there non chrome?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
><br>
>><br>
>> Set cdclk based on the max required pixel clock based on VCO<br>
>> selected. Track boot vco instead of boot cdclk.<br>
>><br>
>> The vco is now tracked at the atomic level and all CRTCs updated if<br>
>> the required vco is changed. Not tested with eDP v1.4 panels that<br>
>> require 8640 vco due to availability.<br>
>><br>
>> V1: initial version<br>
>> V2: add vco tracking in intel_dp_compute_config(), rename<br>
>> skl_boot_cdclk.<br>
>> V3: rebase, V2 feedback not possible as encoders are not aware of<br>
>> atomic.<br>
>> V4: track target vco is atomic state. modeset all CRTCs if vco changes<br>
>> V5: rename atomic variable, cleaner if/else logic, use existing vco if<br>
>> encoder does not return a new vco value. <a href="http://check_patch.pl" rel="noreferrer" target="_blank">check_patch.pl</a> cleanup<br>
>> V6: simplify logic in intel_modeset_checks.<br>
>> V7: reorder an IF for readability and whitespace fix.<br>
>> V8: use dev_cdclk for tracking new cdclk during atomic<br>
>> V9: correctly handle vco 8640 when crtcs==0<br>
>> V10: Clean up if else in crtcs==0<br>
>> V11: Rebase for new intel_dpll_mgr.c<br>
>><br>
>> Reviewed-by: Ville Syrjälä <<a href="mailto:ville.syrjala@linux.intel.com" target="_blank">ville.syrjala@linux.intel.com</a>><br>
><br>
> Is the r-b from Ville really for v11?<br>
<br>
r-b is from patch V9 and only his V8 comment change and a rebase has<br>
occured since. I will submit a V12 with the warning and r-b removed if<br>
necessary.<br></blockquote><div><br></div><div>Ville?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> -Daniel<br>
><br>
>> Signed-off-by: Clint Taylor <<a href="mailto:clinton.a.taylor@intel.com" target="_blank">clinton.a.taylor@intel.com</a>><br>
>> ---<br>
>> drivers/gpu/drm/i915/i915_drv.h | 2 +-<br>
>> drivers/gpu/drm/i915/intel_display.c | 111 ++++++++++++++++++++++++++++-----<br>
>> drivers/gpu/drm/i915/intel_dpll_mgr.c | 9 +--<br>
>> drivers/gpu/drm/i915/intel_drv.h | 5 ++<br>
>> 4 files changed, 106 insertions(+), 21 deletions(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h<br>
>> index 80b14f1..bf87e62 100644<br>
>> --- a/drivers/gpu/drm/i915/i915_drv.h<br>
>> +++ b/drivers/gpu/drm/i915/i915_drv.h<br>
>> @@ -1759,7 +1759,7 @@ struct drm_i915_private {<br>
>> int num_fence_regs; /* 8 on pre-965, 16 otherwise */<br>
>><br>
>> unsigned int fsb_freq, mem_freq, is_ddr3;<br>
>> - unsigned int skl_boot_cdclk;<br>
>> + unsigned int skl_vco_freq;<br>
>> unsigned int cdclk_freq, max_cdclk_freq, atomic_cdclk_freq;<br>
>> unsigned int max_dotclk_freq;<br>
>> unsigned int rawclk_freq;<br>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c<br>
>> index ce55f0b..fc5268c 100644<br>
>> --- a/drivers/gpu/drm/i915/intel_display.c<br>
>> +++ b/drivers/gpu/drm/i915/intel_display.c<br>
>> @@ -5584,7 +5584,7 @@ static unsigned int skl_cdclk_decimal(unsigned int freq)<br>
>> return (freq - 1000) / 500;<br>
>> }<br>
>><br>
>> -static unsigned int skl_cdclk_get_vco(unsigned int freq)<br>
>> +unsigned int skl_cdclk_get_vco(unsigned int freq)<br>
>> {<br>
>> unsigned int i;<br>
>><br>
>> @@ -5742,17 +5742,21 @@ void skl_uninit_cdclk(struct drm_i915_private *dev_priv)<br>
>><br>
>> void skl_init_cdclk(struct drm_i915_private *dev_priv)<br>
>> {<br>
>> - unsigned int required_vco;<br>
>> + unsigned int cdclk;<br>
>><br>
>> /* DPLL0 not enabled (happens on early BIOS versions) */<br>
>> if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE)) {<br>
>> /* enable DPLL0 */<br>
>> - required_vco = skl_cdclk_get_vco(dev_priv->skl_boot_cdclk);<br>
>> - skl_dpll0_enable(dev_priv, required_vco);<br>
>> + if (dev_priv->skl_vco_freq != 8640)<br>
>> + dev_priv->skl_vco_freq = 8100;<br>
>> + skl_dpll0_enable(dev_priv, dev_priv->skl_vco_freq);<br>
>> + cdclk = ((dev_priv->skl_vco_freq == 8100) ? 337500 : 308570);<br>
>> + } else {<br>
>> + cdclk = dev_priv->cdclk_freq;<br>
>> }<br>
>><br>
>> - /* set CDCLK to the frequency the BIOS chose */<br>
>> - skl_set_cdclk(dev_priv, dev_priv->skl_boot_cdclk);<br>
>> + /* set CDCLK to the lowest frequency, Modeset follows */<br>
>> + skl_set_cdclk(dev_priv, cdclk);<br>
>><br>
>> /* enable DBUF power */<br>
>> I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) | DBUF_POWER_REQUEST);<br>
>> @@ -5768,7 +5772,7 @@ int skl_sanitize_cdclk(struct drm_i915_private *dev_priv)<br>
>> {<br>
>> uint32_t lcpll1 = I915_READ(LCPLL1_CTL);<br>
>> uint32_t cdctl = I915_READ(CDCLK_CTL);<br>
>> - int freq = dev_priv->skl_boot_cdclk;<br>
>> + int freq = dev_priv->cdclk_freq;<br>
>><br>
>> /*<br>
>> * check if the pre-os intialized the display<br>
>> @@ -5792,11 +5796,7 @@ int skl_sanitize_cdclk(struct drm_i915_private *dev_priv)<br>
>> /* All well; nothing to sanitize */<br>
>> return false;<br>
>> sanitize:<br>
>> - /*<br>
>> - * As of now initialize with max cdclk till<br>
>> - * we get dynamic cdclk support<br>
>> - * */<br>
>> - dev_priv->skl_boot_cdclk = dev_priv->max_cdclk_freq;<br>
>> +<br>
>> skl_init_cdclk(dev_priv);<br>
>><br>
>> /* we did have to sanitize */<br>
>> @@ -9753,6 +9753,73 @@ static void broadwell_modeset_commit_cdclk(struct drm_atomic_state *old_state)<br>
>> broadwell_set_cdclk(dev, req_cdclk);<br>
>> }<br>
>><br>
>> +static int skl_modeset_calc_cdclk(struct drm_atomic_state *state)<br>
>> +{<br>
>> + struct intel_atomic_state *intel_state = to_intel_atomic_state(state);<br>
>> + struct drm_i915_private *dev_priv = to_i915(state->dev);<br>
>> + const int max_pixclk = ilk_max_pixel_rate(state);<br>
>> + int cdclk;<br>
>> +<br>
>> + /*<br>
>> + * FIXME should also account for plane ratio<br>
>> + * once 64bpp pixel formats are supported.<br>
>> + */<br>
>> +<br>
>> + if (intel_state->cdclk_pll_vco == 8640) {<br>
>> + /* vco 8640 */<br>
>> + if (max_pixclk > 540000)<br>
>> + cdclk = 617140;<br>
>> + else if (max_pixclk > 432000)<br>
>> + cdclk = 540000;<br>
>> + else if (max_pixclk > 308570)<br>
>> + cdclk = 432000;<br>
>> + else<br>
>> + cdclk = 308570;<br>
>> + } else {<br>
>> + /* VCO 8100 */<br>
>> + if (max_pixclk > 540000)<br>
>> + cdclk = 675000;<br>
>> + else if (max_pixclk > 450000)<br>
>> + cdclk = 540000;<br>
>> + else if (max_pixclk > 337500)<br>
>> + cdclk = 450000;<br>
>> + else<br>
>> + cdclk = 337500;<br>
>> + }<br>
>> +<br>
>> + /*<br>
>> + * FIXME move the cdclk caclulation to<br>
>> + * compute_config() so we can fail gracegully.<br>
>> + */<br>
>> + if (cdclk > dev_priv->max_cdclk_freq) {<br>
>> + DRM_ERROR("requested cdclk (%d kHz) exceeds max (%d kHz)\n",<br>
>> + cdclk, dev_priv->max_cdclk_freq);<br>
>> + cdclk = dev_priv->max_cdclk_freq;<br>
>> + }<br>
>> +<br>
>> + intel_state->cdclk = intel_state->dev_cdclk = cdclk;<br>
>> + if (!intel_state->active_crtcs)<br>
>> + intel_state->dev_cdclk = ((intel_state->cdclk_pll_vco == 8640) ?<br>
>> + 308570 : 337500);<br>
>> +<br>
>> +<br>
>> + return 0;<br>
>> +}<br>
>> +<br>
>> +static void skl_modeset_commit_cdclk(struct drm_atomic_state *old_state)<br>
>> +{<br>
>> + struct drm_device *dev = old_state->dev;<br>
>> + struct drm_i915_private *dev_priv = dev->dev_private;<br>
>> + unsigned int req_cdclk = to_intel_atomic_state(old_state)->dev_cdclk;<br>
>> +<br>
>> + /*<br>
>> + * FIXME disable/enable PLL should wrap set_cdclk()<br>
>> + */<br>
>> + skl_set_cdclk(dev_priv, req_cdclk);<br>
>> +<br>
>> + dev_priv->skl_vco_freq = to_intel_atomic_state(old_state)->cdclk_pll_vco;<br>
>> +}<br>
>> +<br>
>> static int haswell_crtc_compute_clock(struct intel_crtc *crtc,<br>
>> struct intel_crtc_state *crtc_state)<br>
>> {<br>
>> @@ -13214,9 +13281,15 @@ static int intel_modeset_checks(struct drm_atomic_state *state)<br>
>> * adjusted_mode bits in the crtc directly.<br>
>> */<br>
>> if (dev_priv->display.modeset_calc_cdclk) {<br>
>> + if (!intel_state->cdclk_pll_vco)<br>
>> + intel_state->cdclk_pll_vco = dev_priv->skl_vco_freq;<br>
>> +<br>
>> ret = dev_priv->display.modeset_calc_cdclk(state);<br>
>> + if (ret < 0)<br>
>> + return ret;<br>
>><br>
>> - if (!ret && intel_state->dev_cdclk != dev_priv->cdclk_freq)<br>
>> + if (intel_state->dev_cdclk != dev_priv->cdclk_freq ||<br>
>> + intel_state->cdclk_pll_vco != dev_priv->skl_vco_freq)<br>
>> ret = intel_modeset_all_pipes(state);<br>
>><br>
>> if (ret < 0)<br>
>> @@ -13588,7 +13661,8 @@ static int intel_atomic_commit(struct drm_device *dev,<br>
>> drm_atomic_helper_update_legacy_modeset_state(state->dev, state);<br>
>><br>
>> if (dev_priv->display.modeset_commit_cdclk &&<br>
>> - intel_state->dev_cdclk != dev_priv->cdclk_freq)<br>
>> + (intel_state->dev_cdclk != dev_priv->cdclk_freq ||<br>
>> + intel_state->cdclk_pll_vco != dev_priv->skl_vco_freq))<br>
>> dev_priv->display.modeset_commit_cdclk(state);<br>
>> }<br>
>><br>
>> @@ -14964,8 +15038,12 @@ static void intel_init_display(struct drm_device *dev)<br>
>> broxton_modeset_commit_cdclk;<br>
>> dev_priv->display.modeset_calc_cdclk =<br>
>> broxton_modeset_calc_cdclk;<br>
>> + } else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {<br>
>> + dev_priv->display.modeset_commit_cdclk =<br>
>> + skl_modeset_commit_cdclk;<br>
>> + dev_priv->display.modeset_calc_cdclk =<br>
>> + skl_modeset_calc_cdclk;<br>
>> }<br>
>> -<br>
>> switch (INTEL_INFO(dev)->gen) {<br>
>> case 2:<br>
>> dev_priv->display.queue_flip = intel_gen2_queue_flip;<br>
>> @@ -15672,7 +15750,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)<br>
>> if (crtc_state->base.active) {<br>
>> dev_priv->active_crtcs |= 1 << crtc->pipe;<br>
>><br>
>> - if (IS_BROADWELL(dev_priv)) {<br>
>> + if (IS_BROADWELL(dev_priv) || IS_SKYLAKE(dev_priv) ||<br>
>> + IS_KABYLAKE(dev_priv)) {<br>
>> pixclk = ilk_pipe_pixel_rate(crtc_state);<br>
>><br>
>> /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */<br>
>> diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c<br>
>> index 4b636c4..a5642b1 100644<br>
>> --- a/drivers/gpu/drm/i915/intel_dpll_mgr.c<br>
>> +++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c<br>
>> @@ -1183,6 +1183,7 @@ skl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,<br>
>> struct intel_shared_dpll *pll;<br>
>> uint32_t ctrl1, cfgcr1, cfgcr2;<br>
>> int clock = crtc_state->port_clock;<br>
>> + uint32_t vco = 8100;<br>
>><br>
>> /*<br>
>> * See comment in intel_dpll_hw_state to understand why we always use 0<br>
>> @@ -1225,17 +1226,17 @@ skl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,<br>
>> case 162000:<br>
>> ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1620, 0);<br>
>> break;<br>
>> - /* TBD: For DP link rates 2.16 GHz and 4.32 GHz, VCO is 8640 which<br>
>> - results in CDCLK change. Need to handle the change of CDCLK by<br>
>> - disabling pipes and re-enabling them */<br>
>> case 108000:<br>
>> ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1080, 0);<br>
>> + vco = 8640;<br>
>> break;<br>
>> case 216000:<br>
>> ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_2160, 0);<br>
>> + vco = 8640;<br>
>> break;<br>
>> }<br>
>><br>
>> + to_intel_atomic_state(crtc_state->base.state)->cdclk_pll_vco = vco;<br>
>> cfgcr1 = cfgcr2 = 0;<br>
>> } else {<br>
>> return NULL;<br>
>> @@ -1628,7 +1629,7 @@ static void intel_ddi_pll_init(struct drm_device *dev)<br>
>> int cdclk_freq;<br>
>><br>
>> cdclk_freq = dev_priv->display.get_display_clock_speed(dev);<br>
>> - dev_priv->skl_boot_cdclk = cdclk_freq;<br>
>> + dev_priv->skl_vco_freq = skl_cdclk_get_vco(cdclk_freq);<br>
>> if (skl_sanitize_cdclk(dev_priv))<br>
>> DRM_DEBUG_KMS("Sanitized cdclk programmed by pre-os\n");<br>
>> if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))<br>
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h<br>
>> index 02b3d22..b23b129 100644<br>
>> --- a/drivers/gpu/drm/i915/intel_drv.h<br>
>> +++ b/drivers/gpu/drm/i915/intel_drv.h<br>
>> @@ -301,6 +301,10 @@ struct intel_atomic_state {<br>
>> * don't bother calculating intermediate watermarks.<br>
>> */<br>
>> bool skip_intermediate_wm;<br>
>> +<br>
>> + /* SKL/KBL Only */<br>
>> + unsigned int cdclk_pll_vco;<br>
>> +<br>
>> };<br>
>><br>
>> struct intel_plane_state {<br>
>> @@ -1239,6 +1243,7 @@ void bxt_disable_dc9(struct drm_i915_private *dev_priv);<br>
>> void skl_init_cdclk(struct drm_i915_private *dev_priv);<br>
>> int skl_sanitize_cdclk(struct drm_i915_private *dev_priv);<br>
>> void skl_uninit_cdclk(struct drm_i915_private *dev_priv);<br>
>> +unsigned int skl_cdclk_get_vco(unsigned int freq);<br>
>> void skl_enable_dc6(struct drm_i915_private *dev_priv);<br>
>> void skl_disable_dc6(struct drm_i915_private *dev_priv);<br>
>> void intel_dp_get_m_n(struct intel_crtc *crtc,<br>
>> --<br>
>> 1.7.9.5<br>
>><br>
>> _______________________________________________<br>
>> Intel-gfx mailing list<br>
>> <a href="mailto:Intel-gfx@lists.freedesktop.org" target="_blank">Intel-gfx@lists.freedesktop.org</a><br>
>> <a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
><br>
<br>
_______________________________________________<br>
Intel-gfx mailing list<br>
<a href="mailto:Intel-gfx@lists.freedesktop.org" target="_blank">Intel-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
</blockquote></div></div>