[Intel-gfx] [PATCH 02/13] drm/i915: Implement command buffer parsing logic

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 29 23:28:36 CET 2014


On Wed, Jan 29, 2014 at 01:55:03PM -0800, bradley.d.volkin at intel.com wrote:
> +/*
> + * Returns a pointer to a descriptor for the command specified by cmd_header.
> + *
> + * The caller must supply space for a default descriptor via the default_desc
> + * parameter. If no descriptor for the specified command exists in the ring's
> + * command parser tables, this function fills in default_desc based on the
> + * ring's default length encoding and returns default_desc.
> + */
> +static const struct drm_i915_cmd_descriptor*
> +find_cmd(struct intel_ring_buffer *ring,
> +	 u32 cmd_header,
> +	 struct drm_i915_cmd_descriptor *default_desc)
> +{
> +	u32 mask;
> +	int i;
> +
> +	for (i = 0; i < ring->cmd_table_count; i++) {
> +		const struct drm_i915_cmd_descriptor *desc;
> +
> +		desc = find_cmd_in_table(&ring->cmd_tables[i], cmd_header);
> +		if (desc)
> +			return desc;
> +	}
> +
> +	mask = ring->get_cmd_length_mask(cmd_header);
> +	if (!mask)
> +		return NULL;
> +
> +	BUG_ON(!default_desc);
> +	default_desc->flags = CMD_DESC_SKIP;
> +	default_desc->length.mask = mask;

If we turn off all hw validation (through use of the secure bit) should
we not default to a whitelist of commands? Otherwise it just seems to be
a case of running a fuzzer until we kill the machine.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list