Skip to content

Commit 5c6c13c

Browse files
icklerodrigovivi
authored andcommitted
drm/i915: Drop runtime-pm assert from vgpu io accessors
The "mmio" writes into vgpu registers are simple memory traps from the guest into the host. We do not need to assert in the guest that the device is awake for the io as we do not write to the device itself. However, over time we have refactored all the mmio accessors with the result that the vgpu reuses the gen2 accessors and so inherits the assert for runtime-pm of the native device. The assert though has actually been there since commit 3be0bf5 ("drm/i915: Create vGPU specific MMIO operations to reduce traps"). References: 3be0bf5 ("drm/i915: Create vGPU specific MMIO operations to reduce traps") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Yan Zhao <yan.y.zhao@intel.com> Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com> Cc: stable@vger.kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20200811092532.13753-1-chris@chris-wilson.co.uk (cherry picked from commit 0e65ce2) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 8195400 commit 5c6c13c

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

drivers/gpu/drm/i915/intel_uncore.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,18 @@ unclaimed_reg_debug(struct intel_uncore *uncore,
12091209
spin_unlock(&uncore->debug->lock);
12101210
}
12111211

1212+
#define __vgpu_read(x) \
1213+
static u##x \
1214+
vgpu_read##x(struct intel_uncore *uncore, i915_reg_t reg, bool trace) { \
1215+
u##x val = __raw_uncore_read##x(uncore, reg); \
1216+
trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
1217+
return val; \
1218+
}
1219+
__vgpu_read(8)
1220+
__vgpu_read(16)
1221+
__vgpu_read(32)
1222+
__vgpu_read(64)
1223+
12121224
#define GEN2_READ_HEADER(x) \
12131225
u##x val = 0; \
12141226
assert_rpm_wakelock_held(uncore->rpm);
@@ -1414,6 +1426,16 @@ __gen_reg_write_funcs(gen8);
14141426
#undef GEN6_WRITE_FOOTER
14151427
#undef GEN6_WRITE_HEADER
14161428

1429+
#define __vgpu_write(x) \
1430+
static void \
1431+
vgpu_write##x(struct intel_uncore *uncore, i915_reg_t reg, u##x val, bool trace) { \
1432+
trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
1433+
__raw_uncore_write##x(uncore, reg, val); \
1434+
}
1435+
__vgpu_write(8)
1436+
__vgpu_write(16)
1437+
__vgpu_write(32)
1438+
14171439
#define ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, x) \
14181440
do { \
14191441
(uncore)->funcs.mmio_writeb = x##_write8; \
@@ -1735,7 +1757,10 @@ static void uncore_raw_init(struct intel_uncore *uncore)
17351757
{
17361758
GEM_BUG_ON(intel_uncore_has_forcewake(uncore));
17371759

1738-
if (IS_GEN(uncore->i915, 5)) {
1760+
if (intel_vgpu_active(uncore->i915)) {
1761+
ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, vgpu);
1762+
ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, vgpu);
1763+
} else if (IS_GEN(uncore->i915, 5)) {
17391764
ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, gen5);
17401765
ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, gen5);
17411766
} else {

0 commit comments

Comments
 (0)