drm/i915: Bypass LMEMBAR/GTTMMADR for MTL stolen memory access
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 2 Feb 2024 22:43:28 +0000 (00:43 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 6 Feb 2024 23:58:54 +0000 (01:58 +0200)
commitc08c364102d07288610734de34111a666e730ae7
tree176a8848e9cd2f401a43bf725ccdc27f1c2e81a7
parent8f7cf0a215b34ef12b4b862f260a592b4ab37a52
drm/i915: Bypass LMEMBAR/GTTMMADR for MTL stolen memory access

On MTL accessing stolen memory via the BARs is somehow borked,
and it can hang the machine. As a workaround let's bypass the
BARs and just go straight to DSMBASE/GSMBASE instead.

Note that on every other platform this itself would hang the
machine, but on MTL the system firmware is expected to relax
the access permission guarding stolen memory to enable this
workaround, and thus direct CPU accesses should be fine.

The raw stolen memory areas won't be passed to VMs so we'll
need to risk using the BAR there for the initial setup. Once
command submission is up we should switch to MI_UPDATE_GTT
which at least shouldn't hang the whole machine.

v2: Don't use direct GSM/DSM access on guests
    Add w/a number
v3: Check register 0x138914 to see if pcode did its job
    Add some debug prints

Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Tested-by: Paz Zcharya <pazz@chromium.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240202224340.30647-5-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/gem/i915_gem_stolen.c
drivers/gpu/drm/i915/gt/intel_ggtt.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/i915_utils.c
drivers/gpu/drm/i915/i915_utils.h