From: Andrzej Hajda Date: Mon, 14 Nov 2022 10:38:24 +0000 (+0100) Subject: drm/i915: fix TLB invalidation for Gen12 video and compute engines X-Git-Tag: archive/raspbian/6.0.10-2+rpi1^2~13 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=32d40b60a8f3325ecaa18a93c999912c6b9abb33;p=linux.git drm/i915: fix TLB invalidation for Gen12 video and compute engines Origin: https://git.kernel.org/linus/04aa64375f48a5d430b5550d9271f8428883e550 Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2022-4139 In case of Gen12 video and compute engines, TLB_INV registers are masked - to modify one bit, corresponding bit in upper half of the register must be enabled, otherwise nothing happens. CVE: CVE-2022-4139 Suggested-by: Chris Wilson Signed-off-by: Andrzej Hajda Acked-by: Daniel Vetter Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds Gbp-Pq: Topic bugfix/x86 Gbp-Pq: Name drm-i915-fix-TLB-invalidation-for-Gen12-video-and-co.patch --- diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c index f435e06125a..f158f6a08e7 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -961,6 +961,11 @@ static void mmio_invalidate_full(struct intel_gt *gt) if (!i915_mmio_reg_offset(rb.reg)) continue; + if (GRAPHICS_VER(i915) == 12 && (engine->class == VIDEO_DECODE_CLASS || + engine->class == VIDEO_ENHANCEMENT_CLASS || + engine->class == COMPUTE_CLASS)) + rb.bit = _MASKED_BIT_ENABLE(rb.bit); + intel_uncore_write_fw(uncore, rb.reg, rb.bit); awake |= engine->mask; }