Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'gvt-fixes-2020-05-12' of https://github.com/intel/gvt-linux into drm-intel-fixes

gvt-fixes-2020-05-12

- Correct transcoder and DPLL initial clock to fix recent guest
display probe failure. (Colin)
- Fix kernel oops on older guest using aliasing ppgtt. (Zhenyu)

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
From: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200512024803.GQ18545@zhen-hp.sh.intel.com

+49 -6
+44 -5
drivers/gpu/drm/i915/gvt/display.c
··· 208 208 SKL_FUSE_PG_DIST_STATUS(SKL_PG0) | 209 209 SKL_FUSE_PG_DIST_STATUS(SKL_PG1) | 210 210 SKL_FUSE_PG_DIST_STATUS(SKL_PG2); 211 - vgpu_vreg_t(vgpu, LCPLL1_CTL) |= 212 - LCPLL_PLL_ENABLE | 213 - LCPLL_PLL_LOCK; 214 - vgpu_vreg_t(vgpu, LCPLL2_CTL) |= LCPLL_PLL_ENABLE; 215 - 211 + /* 212 + * Only 1 PIPE enabled in current vGPU display and PIPE_A is 213 + * tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A, 214 + * TRANSCODER_A can be enabled. PORT_x depends on the input of 215 + * setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x 216 + * so we fixed to DPLL0 here. 217 + * Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode 218 + */ 219 + vgpu_vreg_t(vgpu, DPLL_CTRL1) = 220 + DPLL_CTRL1_OVERRIDE(DPLL_ID_SKL_DPLL0); 221 + vgpu_vreg_t(vgpu, DPLL_CTRL1) |= 222 + DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1620, DPLL_ID_SKL_DPLL0); 223 + vgpu_vreg_t(vgpu, LCPLL1_CTL) = 224 + LCPLL_PLL_ENABLE | LCPLL_PLL_LOCK; 225 + vgpu_vreg_t(vgpu, DPLL_STATUS) = DPLL_LOCK(DPLL_ID_SKL_DPLL0); 226 + /* 227 + * Golden M/N are calculated based on: 228 + * 24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID), 229 + * DP link clk 1620 MHz and non-constant_n. 230 + * TODO: calculate DP link symbol clk and stream clk m/n. 231 + */ 232 + vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) = 63 << TU_SIZE_SHIFT; 233 + vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) |= 0x5b425e; 234 + vgpu_vreg_t(vgpu, PIPE_DATA_N1(TRANSCODER_A)) = 0x800000; 235 + vgpu_vreg_t(vgpu, PIPE_LINK_M1(TRANSCODER_A)) = 0x3cd6e; 236 + vgpu_vreg_t(vgpu, PIPE_LINK_N1(TRANSCODER_A)) = 0x80000; 216 237 } 217 238 218 239 if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B)) { 240 + vgpu_vreg_t(vgpu, DPLL_CTRL2) &= 241 + ~DPLL_CTRL2_DDI_CLK_OFF(PORT_B); 242 + vgpu_vreg_t(vgpu, DPLL_CTRL2) |= 243 + DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_B); 244 + vgpu_vreg_t(vgpu, DPLL_CTRL2) |= 245 + DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_B); 219 246 vgpu_vreg_t(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIB_DETECTED; 220 247 vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= 221 248 ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK | ··· 263 236 } 264 237 265 238 if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C)) { 239 + vgpu_vreg_t(vgpu, DPLL_CTRL2) &= 240 + ~DPLL_CTRL2_DDI_CLK_OFF(PORT_C); 241 + vgpu_vreg_t(vgpu, DPLL_CTRL2) |= 242 + DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_C); 243 + vgpu_vreg_t(vgpu, DPLL_CTRL2) |= 244 + DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_C); 266 245 vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTC_HOTPLUG_CPT; 267 246 vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= 268 247 ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK | ··· 289 256 } 290 257 291 258 if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D)) { 259 + vgpu_vreg_t(vgpu, DPLL_CTRL2) &= 260 + ~DPLL_CTRL2_DDI_CLK_OFF(PORT_D); 261 + vgpu_vreg_t(vgpu, DPLL_CTRL2) |= 262 + DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_D); 263 + vgpu_vreg_t(vgpu, DPLL_CTRL2) |= 264 + DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_D); 292 265 vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTD_HOTPLUG_CPT; 293 266 vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= 294 267 ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
+5 -1
drivers/gpu/drm/i915/gvt/scheduler.c
··· 379 379 for (i = 0; i < GVT_RING_CTX_NR_PDPS; i++) { 380 380 struct i915_page_directory * const pd = 381 381 i915_pd_entry(ppgtt->pd, i); 382 - 382 + /* skip now as current i915 ppgtt alloc won't allocate 383 + top level pdp for non 4-level table, won't impact 384 + shadow ppgtt. */ 385 + if (!pd) 386 + break; 383 387 px_dma(pd) = mm->ppgtt_mm.shadow_pdps[i]; 384 388 } 385 389 }