[Intel-gfx] [RFC 03/28] drm/i915: Move intel_gt initialization to a separate file
Chris Wilson
chris at chris-wilson.co.uk
Thu Jun 13 13:43:36 UTC 2019
Quoting Tvrtko Ursulin (2019-06-13 14:35:14)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> As it will grow in a following patch make a new home for it.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
> drivers/gpu/drm/i915/Makefile | 1 +
> drivers/gpu/drm/i915/gt/intel_gt.c | 19 +++++++++++++++++++
> drivers/gpu/drm/i915/gt/intel_gt.h | 14 ++++++++++++++
> drivers/gpu/drm/i915/i915_gem.c | 9 ++-------
> 4 files changed, 36 insertions(+), 7 deletions(-)
> create mode 100644 drivers/gpu/drm/i915/gt/intel_gt.c
> create mode 100644 drivers/gpu/drm/i915/gt/intel_gt.h
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index c0a7b2994077..8df1bf2855d0 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -73,6 +73,7 @@ gt-y += \
> gt/intel_context.o \
> gt/intel_engine_cs.o \
> gt/intel_engine_pm.o \
> + gt/intel_gt.o \
> gt/intel_gt_pm.o \
> gt/intel_hangcheck.o \
> gt/intel_lrc.o \
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> new file mode 100644
> index 000000000000..e91ffd2dc4fa
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -0,0 +1,19 @@
> +/*
> + * SPDX-License-Identifier: MIT
> + *
> + * Copyright © 2019 Intel Corporation
> + */
> +
> +#include "intel_gt.h"
> +
> +void intel_gt_init(struct intel_gt *gt)
> +{
> + static struct lock_class_key reset_key;
> +
> + INIT_LIST_HEAD(>->active_rings);
> + INIT_LIST_HEAD(>->closed_vma);
> +
> + spin_lock_init(>->closed_lock);
> +
> + lockdep_init_map(>->reset_lockmap, "i915.reset", &reset_key, 0);
> +}
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
> new file mode 100644
> index 000000000000..d0b599dd6d0f
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.h
> @@ -0,0 +1,14 @@
> +/*
> + * SPDX-License-Identifier: MIT
> + *
> + * Copyright © 2019 Intel Corporation
> + */
> +
> +#ifndef __INTEL_GT__
> +#define __INTEL_GT__
> +
> +#include "gt/intel_gt_types.h"
> +
> +void intel_gt_init(struct intel_gt *gt);
> +
> +#endif /* __INTEL_GT_H__ */
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 4bbded4aa936..d5897e13897b 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -44,6 +44,7 @@
> #include "gem/i915_gem_pm.h"
> #include "gem/i915_gemfs.h"
> #include "gt/intel_engine_pm.h"
> +#include "gt/intel_gt.h"
> #include "gt/intel_gt_pm.h"
> #include "gt/intel_mocs.h"
> #include "gt/intel_reset.h"
> @@ -1746,17 +1747,11 @@ static void i915_gem_init__mm(struct drm_i915_private *i915)
>
> int i915_gem_init_early(struct drm_i915_private *dev_priv)
> {
> - static struct lock_class_key reset_key;
> int err;
>
> + intel_gt_init(&dev_priv->gt);
> intel_gt_pm_init(dev_priv);
>
> - INIT_LIST_HEAD(&dev_priv->gt.active_rings);
> - INIT_LIST_HEAD(&dev_priv->gt.closed_vma);
> - spin_lock_init(&dev_priv->gt.closed_lock);
> - lockdep_init_map(&dev_priv->gt.reset_lockmap,
> - "i915.reset", &reset_key, 0);
> -
> i915_gem_init__mm(dev_priv);
> i915_gem_init__pm(dev_priv);
Please also fixup mock_gem_device to use the new function.
-Chris
More information about the Intel-gfx
mailing list