Skip to content

Commit cd65bbb

Browse files
committed
Merge tag 'gvt-fixes-2020-06-17' of https://github.com/intel/gvt-linux into drm-intel-fixes
gvt-fixes-2020-06-17 - Two missed MMIO handler fixes for SKL/CFL (Colin) - Fix mask register bits check (Colin) - Fix one lockdep error for debugfs entry access (Colin) Signed-off-by: Jani Nikula <[email protected]> From: Zhenyu Wang <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 9ebcfad + a291e4f commit cd65bbb

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static inline int mmio_diff_handler(struct intel_gvt *gvt,
6666
vreg = vgpu_vreg(param->vgpu, offset);
6767

6868
if (preg != vreg) {
69-
node = kmalloc(sizeof(*node), GFP_KERNEL);
69+
node = kmalloc(sizeof(*node), GFP_ATOMIC);
7070
if (!node)
7171
return -ENOMEM;
7272

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,13 +1726,13 @@ static int ring_mode_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
17261726
(*(u32 *)p_data) &= ~_MASKED_BIT_ENABLE(2);
17271727
write_vreg(vgpu, offset, p_data, bytes);
17281728

1729-
if (data & _MASKED_BIT_ENABLE(1)) {
1729+
if (IS_MASKED_BITS_ENABLED(data, 1)) {
17301730
enter_failsafe_mode(vgpu, GVT_FAILSAFE_UNSUPPORTED_GUEST);
17311731
return 0;
17321732
}
17331733

17341734
if (IS_COFFEELAKE(vgpu->gvt->gt->i915) &&
1735-
data & _MASKED_BIT_ENABLE(2)) {
1735+
IS_MASKED_BITS_ENABLED(data, 2)) {
17361736
enter_failsafe_mode(vgpu, GVT_FAILSAFE_UNSUPPORTED_GUEST);
17371737
return 0;
17381738
}
@@ -1741,14 +1741,14 @@ static int ring_mode_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
17411741
* pvinfo, if not, we will treat this guest as non-gvtg-aware
17421742
* guest, and stop emulating its cfg space, mmio, gtt, etc.
17431743
*/
1744-
if (((data & _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE)) ||
1745-
(data & _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE)))
1746-
&& !vgpu->pv_notified) {
1744+
if ((IS_MASKED_BITS_ENABLED(data, GFX_PPGTT_ENABLE) ||
1745+
IS_MASKED_BITS_ENABLED(data, GFX_RUN_LIST_ENABLE)) &&
1746+
!vgpu->pv_notified) {
17471747
enter_failsafe_mode(vgpu, GVT_FAILSAFE_UNSUPPORTED_GUEST);
17481748
return 0;
17491749
}
1750-
if ((data & _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE))
1751-
|| (data & _MASKED_BIT_DISABLE(GFX_RUN_LIST_ENABLE))) {
1750+
if (IS_MASKED_BITS_ENABLED(data, GFX_RUN_LIST_ENABLE) ||
1751+
IS_MASKED_BITS_DISABLED(data, GFX_RUN_LIST_ENABLE)) {
17521752
enable_execlist = !!(data & GFX_RUN_LIST_ENABLE);
17531753

17541754
gvt_dbg_core("EXECLIST %s on ring %s\n",
@@ -1809,7 +1809,7 @@ static int ring_reset_ctl_write(struct intel_vgpu *vgpu,
18091809
write_vreg(vgpu, offset, p_data, bytes);
18101810
data = vgpu_vreg(vgpu, offset);
18111811

1812-
if (data & _MASKED_BIT_ENABLE(RESET_CTL_REQUEST_RESET))
1812+
if (IS_MASKED_BITS_ENABLED(data, RESET_CTL_REQUEST_RESET))
18131813
data |= RESET_CTL_READY_TO_RESET;
18141814
else if (data & _MASKED_BIT_DISABLE(RESET_CTL_REQUEST_RESET))
18151815
data &= ~RESET_CTL_READY_TO_RESET;
@@ -1827,7 +1827,8 @@ static int csfe_chicken1_mmio_write(struct intel_vgpu *vgpu,
18271827
(*(u32 *)p_data) &= ~_MASKED_BIT_ENABLE(0x18);
18281828
write_vreg(vgpu, offset, p_data, bytes);
18291829

1830-
if (data & _MASKED_BIT_ENABLE(0x10) || data & _MASKED_BIT_ENABLE(0x8))
1830+
if (IS_MASKED_BITS_ENABLED(data, 0x10) ||
1831+
IS_MASKED_BITS_ENABLED(data, 0x8))
18311832
enter_failsafe_mode(vgpu, GVT_FAILSAFE_UNSUPPORTED_GUEST);
18321833

18331834
return 0;
@@ -3055,6 +3056,7 @@ static int init_skl_mmio_info(struct intel_gvt *gvt)
30553056
MMIO_D(_MMIO(0x72380), D_SKL_PLUS);
30563057
MMIO_D(_MMIO(0x7239c), D_SKL_PLUS);
30573058
MMIO_D(_MMIO(_PLANE_SURF_3_A), D_SKL_PLUS);
3059+
MMIO_D(_MMIO(_PLANE_SURF_3_B), D_SKL_PLUS);
30583060

30593061
MMIO_D(CSR_SSP_BASE, D_SKL_PLUS);
30603062
MMIO_D(CSR_HTP_SKL, D_SKL_PLUS);
@@ -3131,8 +3133,8 @@ static int init_skl_mmio_info(struct intel_gvt *gvt)
31313133
MMIO_DFH(GEN9_WM_CHICKEN3, D_SKL_PLUS, F_MODE_MASK | F_CMD_ACCESS,
31323134
NULL, NULL);
31333135

3134-
MMIO_D(GAMT_CHKN_BIT_REG, D_KBL);
3135-
MMIO_D(GEN9_CTX_PREEMPT_REG, D_KBL | D_SKL);
3136+
MMIO_D(GAMT_CHKN_BIT_REG, D_KBL | D_CFL);
3137+
MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS);
31363138

31373139
return 0;
31383140
}

drivers/gpu/drm/i915/gvt/mmio_context.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ bool is_inhibit_context(struct intel_context *ce);
5454

5555
int intel_vgpu_restore_inhibit_context(struct intel_vgpu *vgpu,
5656
struct i915_request *req);
57-
#define IS_RESTORE_INHIBIT(a) \
58-
(_MASKED_BIT_ENABLE(CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT) == \
59-
((a) & _MASKED_BIT_ENABLE(CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT)))
57+
58+
#define IS_RESTORE_INHIBIT(a) \
59+
IS_MASKED_BITS_ENABLED(a, CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT)
6060

6161
#endif

drivers/gpu/drm/i915/gvt/reg.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@
9494
#define GFX_MODE_BIT_SET_IN_MASK(val, bit) \
9595
((((bit) & 0xffff0000) == 0) && !!((val) & (((bit) << 16))))
9696

97+
#define IS_MASKED_BITS_ENABLED(_val, _b) \
98+
(((_val) & _MASKED_BIT_ENABLE(_b)) == _MASKED_BIT_ENABLE(_b))
99+
#define IS_MASKED_BITS_DISABLED(_val, _b) \
100+
((_val) & _MASKED_BIT_DISABLE(_b))
101+
97102
#define FORCEWAKE_RENDER_GEN9_REG 0xa278
98103
#define FORCEWAKE_ACK_RENDER_GEN9_REG 0x0D84
99104
#define FORCEWAKE_BLITTER_GEN9_REG 0xa188

0 commit comments

Comments
 (0)