diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-03 08:45:15 -0400 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2016-10-10 09:06:41 -0400 |
commit | ca5732c53bf66ad755284786897e0dd10330de87 (patch) | |
tree | 8dde1aa9606b05edb7df1bbebffb8bf508629bd0 | |
parent | f856f847b22c52be82f712ea6ada946c6db884d7 (diff) |
drm/i915: Unalias obj->phys_handle and obj->userptr
We use obj->phys_handle to choose the pread/pwrite path, but as
obj->phys_handle is a union with obj->userptr, we then mistakenly use
the phys_handle path for userptr objects within pread/pwrite.
Testcase: igt/gem_userptr_blits/forbidden-operations
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97519
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161003124516.12388-2-chris@chris-wilson.co.uk
(cherry picked from commit 5f12b80a0b42da253691ca03828033014bb786eb)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 8e1ba3bcfbee..8b9ee4e390c0 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -2276,21 +2276,19 @@ struct drm_i915_gem_object { | |||
2276 | /** Record of address bit 17 of each page at last unbind. */ | 2276 | /** Record of address bit 17 of each page at last unbind. */ |
2277 | unsigned long *bit_17; | 2277 | unsigned long *bit_17; |
2278 | 2278 | ||
2279 | union { | 2279 | struct i915_gem_userptr { |
2280 | /** for phy allocated objects */ | 2280 | uintptr_t ptr; |
2281 | struct drm_dma_handle *phys_handle; | 2281 | unsigned read_only :1; |
2282 | 2282 | unsigned workers :4; | |
2283 | struct i915_gem_userptr { | ||
2284 | uintptr_t ptr; | ||
2285 | unsigned read_only :1; | ||
2286 | unsigned workers :4; | ||
2287 | #define I915_GEM_USERPTR_MAX_WORKERS 15 | 2283 | #define I915_GEM_USERPTR_MAX_WORKERS 15 |
2288 | 2284 | ||
2289 | struct i915_mm_struct *mm; | 2285 | struct i915_mm_struct *mm; |
2290 | struct i915_mmu_object *mmu_object; | 2286 | struct i915_mmu_object *mmu_object; |
2291 | struct work_struct *work; | 2287 | struct work_struct *work; |
2292 | } userptr; | 2288 | } userptr; |
2293 | }; | 2289 | |
2290 | /** for phys allocated objects */ | ||
2291 | struct drm_dma_handle *phys_handle; | ||
2294 | }; | 2292 | }; |
2295 | 2293 | ||
2296 | static inline struct drm_i915_gem_object * | 2294 | static inline struct drm_i915_gem_object * |