drm/i915: Use two 32bit reads for select 64bit REG_READ ioctls
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 16 Jul 2015 11:37:56 +0000 (12:37 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 21 Jul 2015 09:49:13 +0000 (11:49 +0200)
commit648a9bc5308d952f2c80772301b339f73026f013
tree009210e7ebeb563ada53f3b36bc9b176aa25ce74
parent52721d9d3334c1cb1f76219a161084094ec634dc
drm/i915: Use two 32bit reads for select 64bit REG_READ ioctls

Since the hardware sometimes mysteriously totally flummoxes the 64bit
read of a 64bit register when read using a single instruction, split the
read into two instructions. Since the read here is of automatically
incrementing timestamp counters, we also have to be very careful in
order to make sure that it does not increment between the two
instructions.

However, since userspace tried to workaround this issue and so enshrined
this ABI for a broken hardware read and in the process neglected that
the read only fails in some environments, we have to introduce a new
uABI flag for userspace to request the 2x32 bit accurate read of the
timestamp.

v2: Fix alignment check and include details of the workaround for
userspace.

Reported-by: Karol Herbst <freedesktop@karolherbst.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91317
Testcase: igt/gem_reg_read
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: stable@vger.kernel.org
Tested-by: Michał Winiarski <michal.winiarski@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_uncore.c
include/uapi/drm/i915_drm.h