Skip to contentSkip to conversation

drm/i915: Fix DPLL warning when starting guest VM

PATCH In review Zhao, Xinda 4 participants 7 messages Oct 30, 2017 – Oct 31, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Fix DPLL warning when starting guest VM

The warning is occurred in guest VM when trying to get clock in encoder initialization.

intel_modeset_init()
->intel_modeset_setup_hw_state()

    ->intel_ddi_get_config()
      ->intel_ddi_clock_get()
        ->skl_ddi_clock_get()
          ->intel_get_shared_dpll_id()
            ->WARN_ON(pll < dev_priv->shared_dplls||
                pll > &dev_priv->shared_dplls[dev_priv->num_shared_dpll])

In encoder initialization, shared DPLL is used for calculating clock for DDI ports, but it is not set when crtc is not active.
In some cases, encoder is enabled while crtc is disabled, during encoder initialization, the warning occurred.

---
 drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +10 -0
index 28c25cb..ef35c12 100644
@@ -1489,6 +1489,16 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
+
+	/*
+	 * For DDI ports we always use a shared PLL.
+	 * But the shared PLL will not be set when crtc is not active.
+	 */
+	if (crtc->active == false) {
+		DRM_DEBUG_KMS("Trying to get clock, but pipe is not active.\n");
+		return;
+	}
 
 	if (INTEL_GEN(dev_priv) <= 8)
 		hsw_ddi_clock_get(encoder, pipe_config);
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: failure for drm/i915: Fix DPLL warning when starting guest VM

== Series Details ==

== Series Details ==

Series: drm/i915: Fix DPLL warning when starting guest VM
URL : https://patchwork.freedesktop.org/series/32820/
State : failure

== Summary ==

Series 32820v1 drm/i915: Fix DPLL warning when starting guest VM
https://patchwork.freedesktop.org/api/1.0/series/32820/revisions/1/mbox/

Test drv_module_reload:

        Subgroup basic-no-display:
                pass       -> DMESG-WARN (fi-bdw-5557u)
        Subgroup basic-reload-inject:
                pass       -> INCOMPLETE (fi-bdw-5557u)
fi-bdw-5557u     total:288  pass:266  dwarn:1   dfail:0   fail:0   skip:20 
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:450s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:375s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:526s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:265s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:500s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:492s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:494s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:472s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:599s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:421s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:250s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:575s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:484s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:425s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:426s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:422s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:454s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:492s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:576s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:476s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:582s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:541s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:450s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:590s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:644s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:513s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:495s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:453s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:558s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:418s

d0582552491e17f5e386747f82147c1f2d9158c9 drm-tip: 2017y-10m-27d-19h-16m-21s UTC integration manifest 2d90167d9c06 drm/i915: Fix DPLL warning when starting guest VM

== Logs ==

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

#2 lore raw
In reply to Zhao, Xinda
Quoted 27 lines · Xinda

The warning is occurred in guest VM when trying to get clock in encoder initialization.

intel_modeset_init()
->intel_modeset_setup_hw_state()

    ->intel_ddi_get_config()
      ->intel_ddi_clock_get()
        ->skl_ddi_clock_get()
          ->intel_get_shared_dpll_id()
            ->WARN_ON(pll < dev_priv->shared_dplls||
                pll > &dev_priv->shared_dplls[dev_priv->num_shared_dpll])

In encoder initialization, shared DPLL is used for calculating clock for DDI ports, but it is not set when crtc is not active.
In some cases, encoder is enabled while crtc is disabled, during encoder initialization, the warning occurred.

---
 drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 28c25cb..ef35c12 100644

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_clock_get(struct intel_encoder *encoder, · line 1498

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
@@ -1489,6 +1489,16 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
+
+	/*
+	 * For DDI ports we always use a shared PLL.
+	 * But the shared PLL will not be set when crtc is not active.
+	 */
+	if (crtc->active == false) {

Seem to me that the correct fix would be to do the DPLL readout regardless of the state of the pipe.

Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
+		DRM_DEBUG_KMS("Trying to get clock, but pipe is not active.\n");
+		return;
+	}
 
 	if (INTEL_GEN(dev_priv) <= 8)
 		hsw_ddi_clock_get(encoder, pipe_config);
Signature · 6 lines
2.7.4

_______________________________________________
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
#3 lore raw
Quoted 3 lines · Ville Syrjälä
Quoted 2 lines · Xinda

The warning is occurred in guest VM when trying to get clock in encoder initialization.

What does guest VM mean here? gvt? If so, why do you claim to have an enabled port without an enabled pipe?

Quoted 56 lines
Quoted 25 lines

intel_modeset_init()
->intel_modeset_setup_hw_state()

    ->intel_ddi_get_config()
      ->intel_ddi_clock_get()
        ->skl_ddi_clock_get()
          ->intel_get_shared_dpll_id()
            ->WARN_ON(pll < dev_priv->shared_dplls||
                pll > &dev_priv->shared_dplls[dev_priv->num_shared_dpll])

In encoder initialization, shared DPLL is used for calculating clock for DDI ports, but it is not set when crtc is not active.
In some cases, encoder is enabled while crtc is disabled, during encoder initialization, the warning occurred.

---
 drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 28c25cb..ef35c12 100644

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_clock_get(struct intel_encoder *encoder, · line 1498

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
@@ -1489,6 +1489,16 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
+
+	/*
+	 * For DDI ports we always use a shared PLL.
+	 * But the shared PLL will not be set when crtc is not active.
+	 */
+	if (crtc->active == false) {

Seem to me that the correct fix would be to do the DPLL readout regardless of the state of the pipe.

Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
+		DRM_DEBUG_KMS("Trying to get clock, but pipe is not active.\n");
+		return;
+	}
 
 	if (INTEL_GEN(dev_priv) <= 8)
 		hsw_ddi_clock_get(encoder, pipe_config);
Signature · 6 lines
2.7.4

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

Hi:

Thanks for your quickly response.
I have updated the comments in the following text

Thanks!

Best Wishes!
Xinda

Quoted 9 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Monday, October 30, 2017 11:14 PM
To: Zhao, Xinda <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Fix DPLL warning when starting guest VM

Quoted 7 lines
Quoted 3 lines · Ville Syrjälä
Quoted 2 lines · Xinda

The warning is occurred in guest VM when trying to get clock in encoder initialization.

What does guest VM mean here? gvt? If so, why do you claim to have an enabled port without an enabled pipe?

[xinda]
Yes, gvt-g.

We emulate a DP device on port B that is fixed to pipe A for each guest VM by setting following register, it is mandatory. TRANS_DDI_FUNC_CTL(TRANSCODER_A)) |= (PORT_B << TRANS_DDI_PORT_SHIFT);

We don't emulate the status of pipe, whether it is enabled or not, it depends on the i915 setting in guest VM, it is optional. The PIPECONF register will be trapped, but the behavior will not be emulated.

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

intel_modeset_init()
->intel_modeset_setup_hw_state()

    ->intel_ddi_get_config()
      ->intel_ddi_clock_get()
        ->skl_ddi_clock_get()
          ->intel_get_shared_dpll_id()
            ->WARN_ON(pll < dev_priv->shared_dplls||
                pll >

&dev_priv->shared_dplls[dev_priv->num_shared_dpll])

In encoder initialization, shared DPLL is used for calculating clock for DDI ports, but it is not set when crtc is not active. In some cases, encoder is enabled while crtc is disabled, during encoder initialization, the warning occurred.

---
 drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
Quoted 19 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_clock_get(struct intel_encoder

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 28c25cb..ef35c12 100644
@@ -1489,6 +1489,16 @@ void intel_ddi_clock_get(struct intel_encoder

*encoder,

Quoted 12 lines

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_clock_get(struct intel_encoder *encoder, · line 1498

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
 			 struct intel_crtc_state *pipe_config)  {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
+
+	/*
+	 * For DDI ports we always use a shared PLL.
+	 * But the shared PLL will not be set when crtc is not active.
+	 */
+	if (crtc->active == false) {

Seem to me that the correct fix would be to do the DPLL readout regardless of the state of the pipe.

[xinda]
As many components in "struct intel_crtc_state pipe_config" are not reading out when crtc is inactive, like pixel_multiplier, fdi_lanes, fdi_m_n...., should they all be read out?

I think the better choice is to add a judgement when the components are used, like my solution.

Quoted 20 lines
Quoted 2 lines

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_clock_get(struct intel_encoder · line 1498

Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+		DRM_DEBUG_KMS("Trying to get clock, but pipe is not

active.\n");

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -1
+		return;
+	}
 
 	if (INTEL_GEN(dev_priv) <= 8)
 		hsw_ddi_clock_get(encoder, pipe_config);
--

2.7.4

Quoted 8 lines
Quoted 4 lines

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

--
Ville Syrjälä
Intel OTC

Quoted 3 lines

--
Ville Syrjälä
Intel OTC

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

#5 lore raw
Quoted 9 lines · Xinda
Quoted 8 lines · Ville Syrjälä
Quoted 3 lines · Xinda
Quoted 2 lines

The warning is occurred in guest VM when trying to get clock in encoder initialization.

What does guest VM mean here? gvt? If so, why do you claim to have an enabled port without an enabled pipe?

Quoted 9 lines

[xinda]
Yes, gvt-g.

We emulate a DP device on port B that is fixed to pipe A for each guest VM by setting following register, it is mandatory. TRANS_DDI_FUNC_CTL(TRANSCODER_A)) |= (PORT_B << TRANS_DDI_PORT_SHIFT);

We don't emulate the status of pipe, whether it is enabled or not, it depends on the i915 setting in guest VM, it is optional. The PIPECONF register will be trapped, but the behavior will not be emulated.

Looks that's wrong behavior which means full virtualized display brokenness that still depends on some real hw status?

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

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

#6 lore raw
Quoted 29 lines

-----Original Message-----
From: Zhenyu Wang [mailto:[email protected]]
Sent: Tuesday, October 31, 2017 2:52 PM
To: Zhao, Xinda <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Fix DPLL warning when starting guest VM

Quoted 6 lines · Xinda
Quoted 6 lines · Ville Syrjälä
Quoted 3 lines · Xinda
Quoted 2 lines

The warning is occurred in guest VM when trying to get clock in encoder initialization.

Quoted 7 lines
Quoted 2 lines

What does guest VM mean here? gvt? If so, why do you claim to have an enabled port without an enabled pipe?

[xinda]
Yes, gvt-g.

We emulate a DP device on port B that is fixed to pipe A for each guest VM

by setting following register, it is mandatory.

Quoted 1 line

TRANS_DDI_FUNC_CTL(TRANSCODER_A)) |= (PORT_B <<

TRANS_DDI_PORT_SHIFT);

Quoted 1 line
Quoted 8 lines
Quoted 1 line

We don't emulate the status of pipe, whether it is enabled or not, it

depends on the i915 setting in guest VM, it is optional.

Quoted 1 line

The PIPECONF register will be trapped, but the behavior will not be

emulated.

Quoted 1 line

Looks that's wrong behavior which means full virtualized display brokenness that still depends on some real hw status?

[xinda]
Yes, consider the situation that PIPE A may be disabled in real hw, PIPE A should also be emulated in gvt, I will cook a new patch for this.

Quoted 4 lines

--
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

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