drm/i915: check memory is mappable in read_from_page
authorMatthew Auld <matthew.auld@intel.com>
Tue, 4 Oct 2022 13:19:16 +0000 (14:19 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Wed, 5 Oct 2022 08:02:45 +0000 (09:02 +0100)
commit7024f80efcce8122fe8db3e0b4c096eb199333eb
treebc74529d5585a65bd504df77d82fcb8a783031a2
parente3afc690188be8e4385d13d1b0e7f0ba01caea40
drm/i915: check memory is mappable in read_from_page

On small-bar systems we could be given something non-mappable here,
which leads to nasty oops. Make this nicer by checking if the resource
is mappable or not, and return an error otherwise.

v2: drop GEM_BUG_ON(flags & I915_BO_ALLOC_GPU_ONLY)

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Jianshui Yu <jianshui.yu@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221004131916.233474-5-matthew.auld@intel.com
drivers/gpu/drm/i915/gem/i915_gem_object.c