Skip to content

Commit 8fe1056

Browse files
coxuintelzhenyw
authored andcommitted
drm/i915/gvt: Set SNOOP for PAT3 on BXT/APL to workaround GPU BB hang
If guest fills non-priv bb on ApolloLake/Broxton as Mesa i965 does in: 717e7539124d (i965: Use a WC map and memcpy for the batch instead of pw-) Due to the missing flush of bb filled by VM vCPU, host GPU hangs on executing these MI_BATCH_BUFFER. Temporarily workaround this by setting SNOOP bit for PAT3 used by PPGTT PML4 PTE: PAT(0) PCD(1) PWT(1). The performance is still expected to be low, will need further improvement. Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Colin Xu <colin.xu@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20201012045231.226748-1-colin.xu@intel.com
1 parent 97f9ca3 commit 8fe1056

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,34 @@ static int edp_psr_imr_iir_write(struct intel_vgpu *vgpu,
16511651
return 0;
16521652
}
16531653

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+
16541682
static int guc_status_read(struct intel_vgpu *vgpu,
16551683
unsigned int offset, void *p_data,
16561684
unsigned int bytes)
@@ -2812,7 +2840,7 @@ static int init_bdw_mmio_info(struct intel_gvt *gvt)
28122840

28132841
MMIO_DH(GEN6_PCODE_MAILBOX, D_BDW_PLUS, NULL, mailbox_write);
28142842

2815-
MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS);
2843+
MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS & ~D_BXT);
28162844
MMIO_D(GEN8_PRIVATE_PAT_HI, D_BDW_PLUS);
28172845

28182846
MMIO_D(GAMTARBMODE, D_BDW_PLUS);
@@ -3316,6 +3344,8 @@ static int init_bxt_mmio_info(struct intel_gvt *gvt)
33163344

33173345
MMIO_DFH(GEN9_CTX_PREEMPT_REG, D_BXT, F_CMD_ACCESS, NULL, NULL);
33183346

3347+
MMIO_DH(GEN8_PRIVATE_PAT_LO, D_BXT, NULL, bxt_ppat_low_write);
3348+
33193349
return 0;
33203350
}
33213351

0 commit comments

Comments
 (0)