[PATCH] drm/i915/gvt: Do not use I915_NUM_ENGINES to iterate over the mocs regs array
Michel Thierry
michel.thierry at intel.com
Fri Jan 12 16:48:07 UTC 2018
On 1/8/2018 10:37 AM, Michel Thierry wrote:
> The mocs reg array is defined locally but then we iterate over its
> elements using I915_NUM_ENGINES. There is no 'hard' connection between
> I915_NUM_ENGINES and the regs array and there will be problems if either
> of them increases.
Heads up, there is already a patch floating in intel-gfx that will
increase I915_NUM_ENGINES,
https://lists.freedesktop.org/archives/intel-gfx/2018-January/151967.html
>
> Use the size of the mocs reg array instead to safely iterate over it.
>
> Signed-off-by: Michel Thierry <michel.thierry at intel.com>
> Cc: Weinan Li <weinan.z.li at intel.com>
> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> ---
> drivers/gpu/drm/i915/gvt/mmio_context.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/mmio_context.c b/drivers/gpu/drm/i915/gvt/mmio_context.c
> index 74834395dd89..1e113d5eef06 100644
> --- a/drivers/gpu/drm/i915/gvt/mmio_context.c
> +++ b/drivers/gpu/drm/i915/gvt/mmio_context.c
> @@ -167,7 +167,7 @@ static void load_render_mocs(struct drm_i915_private *dev_priv)
> };
> int ring_id, i;
>
> - for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) {
> + for (ring_id = 0; ring_id < ARRAY_SIZE(regs); ring_id++) {
> offset.reg = regs[ring_id];
> for (i = 0; i < 64; i++) {
> gen9_render_mocs.control_table[ring_id][i] =
> --
> 2.15.1
>
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
>
More information about the intel-gvt-dev
mailing list