Skip to content

Commit 0dccdba

Browse files
committed
Merge tag 'gvt-fixes-2020-10-30' of https://github.com/intel/gvt-linux into drm-intel-fixes
gvt-fixes-2020-10-30 - Fix HWSP reset handling during vGPU suspend/resume (Colin) - Apply flush workaround on APL now for possible guest hang (Colin) - Fix vGPU context pin/unpin also for host suspend regression with vGPU created (Colin) - more BXT/APL mmio cmd access fixes (Colin) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> From: Zhenyu Wang <zhenyuw@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201030052117.GC27141@zhen-hp.sh.intel.com
2 parents 3cea11c + 92010a9 commit 0dccdba

2 files changed

Lines changed: 52 additions & 10 deletions

File tree

drivers/gpu/drm/i915/gvt/handlers.c

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,8 @@ static int hws_pga_write(struct intel_vgpu *vgpu, unsigned int offset,
14891489
const struct intel_engine_cs *engine =
14901490
intel_gvt_render_mmio_to_engine(vgpu->gvt, offset);
14911491

1492-
if (!intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) {
1492+
if (value != 0 &&
1493+
!intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) {
14931494
gvt_vgpu_err("write invalid HWSP address, reg:0x%x, value:0x%x\n",
14941495
offset, value);
14951496
return -EINVAL;
@@ -1650,6 +1651,34 @@ static int edp_psr_imr_iir_write(struct intel_vgpu *vgpu,
16501651
return 0;
16511652
}
16521653

1654+
/**
1655+
* FixMe:
1656+
* If guest fills non-priv batch buffer on ApolloLake/Broxton as Mesa i965 did:
1657+
* 717e7539124d (i965: Use a WC map and memcpy for the batch instead of pwrite.)
1658+
* Due to the missing flush of bb filled by VM vCPU, host GPU hangs on executing
1659+
* these MI_BATCH_BUFFER.
1660+
* Temporarily workaround this by setting SNOOP bit for PAT3 used by PPGTT
1661+
* PML4 PTE: PAT(0) PCD(1) PWT(1).
1662+
* The performance is still expected to be low, will need further improvement.
1663+
*/
1664+
static int bxt_ppat_low_write(struct intel_vgpu *vgpu, unsigned int offset,
1665+
void *p_data, unsigned int bytes)
1666+
{
1667+
u64 pat =
1668+
GEN8_PPAT(0, CHV_PPAT_SNOOP) |
1669+
GEN8_PPAT(1, 0) |
1670+
GEN8_PPAT(2, 0) |
1671+
GEN8_PPAT(3, CHV_PPAT_SNOOP) |
1672+
GEN8_PPAT(4, CHV_PPAT_SNOOP) |
1673+
GEN8_PPAT(5, CHV_PPAT_SNOOP) |
1674+
GEN8_PPAT(6, CHV_PPAT_SNOOP) |
1675+
GEN8_PPAT(7, CHV_PPAT_SNOOP);
1676+
1677+
vgpu_vreg(vgpu, offset) = lower_32_bits(pat);
1678+
1679+
return 0;
1680+
}
1681+
16531682
static int guc_status_read(struct intel_vgpu *vgpu,
16541683
unsigned int offset, void *p_data,
16551684
unsigned int bytes)
@@ -2812,7 +2841,7 @@ static int init_bdw_mmio_info(struct intel_gvt *gvt)
28122841

28132842
MMIO_DH(GEN6_PCODE_MAILBOX, D_BDW_PLUS, NULL, mailbox_write);
28142843

2815-
MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS);
2844+
MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS & ~D_BXT);
28162845
MMIO_D(GEN8_PRIVATE_PAT_HI, D_BDW_PLUS);
28172846

28182847
MMIO_D(GAMTARBMODE, D_BDW_PLUS);
@@ -3139,7 +3168,7 @@ static int init_skl_mmio_info(struct intel_gvt *gvt)
31393168
NULL, NULL);
31403169

31413170
MMIO_DFH(GAMT_CHKN_BIT_REG, D_KBL | D_CFL, F_CMD_ACCESS, NULL, NULL);
3142-
MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS);
3171+
MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS & ~D_BXT);
31433172

31443173
return 0;
31453174
}
@@ -3313,9 +3342,21 @@ static int init_bxt_mmio_info(struct intel_gvt *gvt)
33133342
MMIO_D(GEN8_PUSHBUS_SHIFT, D_BXT);
33143343
MMIO_D(GEN6_GFXPAUSE, D_BXT);
33153344
MMIO_DFH(GEN8_L3SQCREG1, D_BXT, F_CMD_ACCESS, NULL, NULL);
3345+
MMIO_DFH(GEN8_L3CNTLREG, D_BXT, F_CMD_ACCESS, NULL, NULL);
3346+
MMIO_DFH(_MMIO(0x20D8), D_BXT, F_CMD_ACCESS, NULL, NULL);
3347+
MMIO_F(GEN8_RING_CS_GPR(RENDER_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3348+
0, 0, D_BXT, NULL, NULL);
3349+
MMIO_F(GEN8_RING_CS_GPR(GEN6_BSD_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3350+
0, 0, D_BXT, NULL, NULL);
3351+
MMIO_F(GEN8_RING_CS_GPR(BLT_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3352+
0, 0, D_BXT, NULL, NULL);
3353+
MMIO_F(GEN8_RING_CS_GPR(VEBOX_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3354+
0, 0, D_BXT, NULL, NULL);
33163355

33173356
MMIO_DFH(GEN9_CTX_PREEMPT_REG, D_BXT, F_CMD_ACCESS, NULL, NULL);
33183357

3358+
MMIO_DH(GEN8_PRIVATE_PAT_LO, D_BXT, NULL, bxt_ppat_low_write);
3359+
33193360
return 0;
33203361
}
33213362

drivers/gpu/drm/i915/gvt/scheduler.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu)
12771277

12781278
i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(s->shadow[0]->vm));
12791279
for_each_engine(engine, vgpu->gvt->gt, id)
1280-
intel_context_unpin(s->shadow[id]);
1280+
intel_context_put(s->shadow[id]);
12811281

12821282
kmem_cache_destroy(s->workloads);
12831283
}
@@ -1369,11 +1369,6 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu)
13691369
ce->ring = __intel_context_ring_size(ring_size);
13701370
}
13711371

1372-
ret = intel_context_pin(ce);
1373-
intel_context_put(ce);
1374-
if (ret)
1375-
goto out_shadow_ctx;
1376-
13771372
s->shadow[i] = ce;
13781373
}
13791374

@@ -1405,7 +1400,6 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu)
14051400
if (IS_ERR(s->shadow[i]))
14061401
break;
14071402

1408-
intel_context_unpin(s->shadow[i]);
14091403
intel_context_put(s->shadow[i]);
14101404
}
14111405
i915_vm_put(&ppgtt->vm);
@@ -1479,6 +1473,7 @@ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload)
14791473
{
14801474
struct intel_vgpu_submission *s = &workload->vgpu->submission;
14811475

1476+
intel_context_unpin(s->shadow[workload->engine->id]);
14821477
release_shadow_batch_buffer(workload);
14831478
release_shadow_wa_ctx(&workload->wa_ctx);
14841479

@@ -1724,6 +1719,12 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu,
17241719
return ERR_PTR(ret);
17251720
}
17261721

1722+
ret = intel_context_pin(s->shadow[engine->id]);
1723+
if (ret) {
1724+
intel_vgpu_destroy_workload(workload);
1725+
return ERR_PTR(ret);
1726+
}
1727+
17271728
return workload;
17281729
}
17291730

0 commit comments

Comments
 (0)