Message ID | 20190619132459.25351-4-tvrtko.ursulin@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Implicit dev_priv removal and GT compartmentalization | expand |
Quoting Tvrtko Ursulin (2019-06-19 14:24:29) > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > As it will grow in a following patch make a new home for it. > > v2: > * Convert mock_gem_device as well. (Chris) > > v3: > * Rename to intel_gt_init_early and move call site to i915_drv.c. (Chris) > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> # v2 > --- > drivers/gpu/drm/i915/Makefile | 1 + > drivers/gpu/drm/i915/gt/intel_gt.c | 15 +++++++++++++++ > drivers/gpu/drm/i915/gt/intel_gt.h | 14 ++++++++++++++ > drivers/gpu/drm/i915/i915_drv.c | 3 +++ > drivers/gpu/drm/i915/i915_gem.c | 4 ---- > drivers/gpu/drm/i915/selftests/mock_gem_device.c | 6 ++---- > 6 files changed, 35 insertions(+), 8 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 91355c2ea8a5..19f8b6745772 100644 > --- a/drivers/gpu/drm/i915/Makefile > +++ b/drivers/gpu/drm/i915/Makefile > @@ -74,6 +74,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..29a0f0a32549 > --- /dev/null > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c > @@ -0,0 +1,15 @@ > +/* > + * SPDX-License-Identifier: MIT > + * > + * Copyright © 2019 Intel Corporation > + */ > + > +#include "intel_gt.h" > + > +void intel_gt_init_early(struct intel_gt *gt) > +{ > + INIT_LIST_HEAD(>->active_rings); > + INIT_LIST_HEAD(>->closed_vma); > + > + spin_lock_init(>->closed_lock); > +} > 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..d153e7fb4c08 > --- /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" Inside gt/ we don't need to use the gt/ prefix for includes. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> -Chris
On Wed, Jun 19, 2019 at 05:20:38PM +0100, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2019-06-19 14:24:29) > > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > > > As it will grow in a following patch make a new home for it. > > > > v2: > > * Convert mock_gem_device as well. (Chris) > > > > v3: > > * Rename to intel_gt_init_early and move call site to i915_drv.c. (Chris) > > > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> # v2 > > --- > > drivers/gpu/drm/i915/Makefile | 1 + > > drivers/gpu/drm/i915/gt/intel_gt.c | 15 +++++++++++++++ > > drivers/gpu/drm/i915/gt/intel_gt.h | 14 ++++++++++++++ > > drivers/gpu/drm/i915/i915_drv.c | 3 +++ > > drivers/gpu/drm/i915/i915_gem.c | 4 ---- > > drivers/gpu/drm/i915/selftests/mock_gem_device.c | 6 ++---- > > 6 files changed, 35 insertions(+), 8 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 91355c2ea8a5..19f8b6745772 100644 > > --- a/drivers/gpu/drm/i915/Makefile > > +++ b/drivers/gpu/drm/i915/Makefile > > @@ -74,6 +74,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..29a0f0a32549 > > --- /dev/null > > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c > > @@ -0,0 +1,15 @@ > > +/* > > + * SPDX-License-Identifier: MIT > > + * > > + * Copyright © 2019 Intel Corporation > > + */ > > + > > +#include "intel_gt.h" > > + > > +void intel_gt_init_early(struct intel_gt *gt) > > +{ > > + INIT_LIST_HEAD(>->active_rings); > > + INIT_LIST_HEAD(>->closed_vma); > > + > > + spin_lock_init(>->closed_lock); > > +} > > 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..d153e7fb4c08 > > --- /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" > > Inside gt/ we don't need to use the gt/ prefix for includes. with this fixed feel free to upgrade my v2 rev as well Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> > > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> > -Chris > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 91355c2ea8a5..19f8b6745772 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -74,6 +74,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..29a0f0a32549 --- /dev/null +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -0,0 +1,15 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright © 2019 Intel Corporation + */ + +#include "intel_gt.h" + +void intel_gt_init_early(struct intel_gt *gt) +{ + INIT_LIST_HEAD(>->active_rings); + INIT_LIST_HEAD(>->closed_vma); + + spin_lock_init(>->closed_lock); +} 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..d153e7fb4c08 --- /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_early(struct intel_gt *gt); + +#endif /* __INTEL_GT_H__ */ diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index f62e3397d936..bc5a11dfd554 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -61,6 +61,7 @@ #include "gem/i915_gem_context.h" #include "gem/i915_gem_ioctls.h" +#include "gt/intel_gt.h" #include "gt/intel_gt_pm.h" #include "gt/intel_reset.h" #include "gt/intel_workarounds.h" @@ -922,6 +923,8 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv) if (ret < 0) goto err_engines; + intel_gt_init_early(&dev_priv->gt); + ret = i915_gem_init_early(dev_priv); if (ret < 0) goto err_workqueues; diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 190ad54fb072..fc8fd41dd32e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1748,10 +1748,6 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv) 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); - i915_gem_init__mm(dev_priv); i915_gem_init__pm(dev_priv); diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c index 64bc51400ae7..8dc9296892e6 100644 --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c @@ -25,6 +25,7 @@ #include <linux/pm_domain.h> #include <linux/pm_runtime.h> +#include "gt/intel_gt.h" #include "gt/mock_engine.h" #include "mock_request.h" @@ -179,6 +180,7 @@ struct drm_i915_private *mock_gem_device(void) mock_uncore_init(&i915->uncore); i915_gem_init__mm(i915); + intel_gt_init_early(&i915->gt); intel_gt_pm_init(i915); atomic_inc(&i915->gt.wakeref.count); /* disable; no hw support */ @@ -200,10 +202,6 @@ struct drm_i915_private *mock_gem_device(void) i915_timelines_init(i915); - INIT_LIST_HEAD(&i915->gt.active_rings); - INIT_LIST_HEAD(&i915->gt.closed_vma); - spin_lock_init(&i915->gt.closed_lock); - mutex_lock(&i915->drm.struct_mutex); mock_init_ggtt(i915, &i915->ggtt);