drm/i915: Extend the parser to check register writes against a mask/value pair.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 29 May 2015 13:44:14 +0000 (16:44 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 15 Jun 2015 13:00:43 +0000 (16:00 +0300)
commitc1091b25f547d45ffdcb443a3790aed652fb9b48
tree8dd2998a7bb9a36b9cf90e74abadcc05e4a51197
parent8a389cac1fd7dd6411c7e586ab098938a75870e0
drm/i915: Extend the parser to check register writes against a mask/value pair.

In some cases it might be unnecessary or dangerous to give userspace
the right to write arbitrary values to some register, even though it
might be desirable to give it control of some of its bits.  This patch
extends the register whitelist entries to contain a mask/value pair in
addition to the register offset.  For registers with non-zero mask,
any LRM writes and LRI writes where the bits of the immediate given by
the mask don't match the specified value will be rejected.

This will be used in my next patch to grant userspace partial write
access to some sensitive registers.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/i915_cmd_parser.c
drivers/gpu/drm/i915/intel_ringbuffer.h