From: Brad Volkin <bradley.d.volkin@xxxxxxxxx> Certain commands are always disallowed from userspace. This adds the ability for the command parser to detect such commands and reject batch buffers containing them. OTC-Tracker: AXIA-4631 Change-Id: I000b0df4d441ec80b607a50d35e83418cdfd38b3 Signed-off-by: Brad Volkin <bradley.d.volkin@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_cmd_parser.c | 6 ++++++ drivers/gpu/drm/i915/i915_drv.h | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index b01628e..c64f640 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c @@ -368,6 +368,12 @@ int i915_parse_cmds(struct intel_ring_buffer *ring, break; } + if (desc->flags & CMD_DESC_REJECT) { + DRM_DEBUG_DRIVER("CMD: Rejected command: 0x%08X\n", *cmd); + ret = -EINVAL; + break; + } + cmd += length; } diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 81ef047..6ace856 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1743,10 +1743,12 @@ struct drm_i915_cmd_descriptor { * CMD_DESC_SKIP: The command is allowed but does not follow the * standard length encoding for the opcode range in * which it falls + * CMD_DESC_REJECT: The command is never allowed */ u32 flags; -#define CMD_DESC_FIXED (1<<0) -#define CMD_DESC_SKIP (1<<1) +#define CMD_DESC_FIXED (1<<0) +#define CMD_DESC_SKIP (1<<1) +#define CMD_DESC_REJECT (1<<2) /** * The command's unique identification bits and the bitmask to get them. -- 1.8.4.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx