Skip to contentSkip to conversation

Introduce buffer based cmd transport

PATCH Superseded Michal Wajdeczko 3 participants 7 messages May 25, 2017 – May 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover Introduce buffer based cmd transport

Buffer based command transport can replace MMIO based mechanism. It may be used to perform host-2-guc and guc-to-host communication.

v3: using static owner id (Daniele)
v4: but keep channel initialization generic (Daniele)
and introduce owner_sub_id (Daniele)

Michal Wajdeczko (3):
drm/i915/guc: Disable send function on fini drm/i915/guc: Introduce buffer based cmd transport HAX Enable GuC loading & submission

 drivers/gpu/drm/i915/Makefile         |   1 +
 drivers/gpu/drm/i915/i915_drv.h       |   2 +
 drivers/gpu/drm/i915/i915_params.c    |   8 +-
 drivers/gpu/drm/i915/intel_guc_ct.c   | 461 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_guc_ct.h   |  86 +++++++
 drivers/gpu/drm/i915/intel_guc_fwif.h |  43 ++++
 drivers/gpu/drm/i915/intel_uc.c       |  26 +-
 drivers/gpu/drm/i915/intel_uc.h       |   3 +-
 8 files changed, 623 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_guc_ct.c
 create mode 100644 drivers/gpu/drm/i915/intel_guc_ct.h
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 1/3 drm/i915/guc: Disable send function on fini

In earlier patch 789a625 we were enabling send function only after successful init. For completeness, we should make sure that we disable it on fini.

v2: don't group steps by submission flag (Chris)

Cc Joonas Lahtinen <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_uc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uc.c +6 -1
index d27b527..31dc8c3 100644
@@ -410,11 +410,16 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
 	if (!i915.enable_guc_loading)
 		return;
 
-	if (i915.enable_guc_submission) {
+	if (i915.enable_guc_submission)
 		i915_guc_submission_disable(dev_priv);
+
+	guc_disable_communication(&dev_priv->guc);
+
+	if (i915.enable_guc_submission) {
 		gen9_disable_guc_interrupts(dev_priv);
 		i915_guc_submission_fini(dev_priv);
 	}
+
 	i915_ggtt_disable_guc(dev_priv);
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v4 2/3 drm/i915/guc: Introduce buffer based cmd transport

In reply to Michal Wajdeczko

Buffer based command transport can replace MMIO based mechanism. It may be used to perform host-2-guc and guc-to-host communication.

Portions of this patch are based on work by:
Michel Thierry <[email protected]> Robert Beckett <[email protected]> Daniele Ceraolo Spurio <[email protected]>

v2: use gem_object_pin_map (Chris)
don't use DEBUG_RATELIMITED (Chris)
don't track action stats (Chris)
simplify next fence (Chris)
use READ_ONCE (Chris)
move blob allocation to new function (Chris)

v3: use static owner id (Daniele)
v4: but keep channel initialization generic (Daniele)
and introduce owner_sub_id (Daniele)

Cc Daniele Ceraolo Spurio <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/Makefile         |   1 +
 drivers/gpu/drm/i915/i915_drv.h       |   2 +
 drivers/gpu/drm/i915/intel_guc_ct.c   | 461 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_guc_ct.h   |  86 +++++++
 drivers/gpu/drm/i915/intel_guc_fwif.h |  43 ++++
 drivers/gpu/drm/i915/intel_uc.c       |  19 +-
 drivers/gpu/drm/i915/intel_uc.h       |   3 +-
 7 files changed, 613 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_guc_ct.c
 create mode 100644 drivers/gpu/drm/i915/intel_guc_ct.h
drivers/gpu/drm/i915/Makefile +1 -0
index 7b05fb8..16dccf5 100644
@@ -58,6 +58,7 @@ i915-y += i915_cmd_parser.o \
 
 # general-purpose microcontroller (GuC) support
 i915-y += intel_uc.o \
+	  intel_guc_ct.o \
 	  intel_guc_log.o \
 	  intel_guc_loader.o \
 	  intel_huc.o \
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 17883a8..453eea5 100644
@@ -760,6 +760,7 @@ struct intel_csr {
 	func(has_gmbus_irq); \
 	func(has_gmch_display); \
 	func(has_guc); \
+	func(has_guc_ct); \
 	func(has_hotplug); \
 	func(has_l3_dpf); \
 	func(has_llc); \
@@ -2947,6 +2948,7 @@ intel_info(const struct drm_i915_private *dev_priv)
  * properties, so we have separate macros to test them.
  */
 #define HAS_GUC(dev_priv)	((dev_priv)->info.has_guc)
+#define HAS_GUC_CT(dev_priv)	((dev_priv)->info.has_guc_ct)
 #define HAS_GUC_UCODE(dev_priv)	(HAS_GUC(dev_priv))
 #define HAS_GUC_SCHED(dev_priv)	(HAS_GUC(dev_priv))
 #define HAS_HUC_UCODE(dev_priv)	(HAS_GUC(dev_priv))
drivers/gpu/drm/i915/intel_guc_ct.c new file +461 -0

461 lines not on this page · raw message

drivers/gpu/drm/i915/intel_guc_ct.h new file +86 -0

86 lines not on this page · raw message

drivers/gpu/drm/i915/intel_guc_fwif.h +43 -0

55 lines not on this page · raw message

drivers/gpu/drm/i915/intel_uc.c +18 -1
index 31dc8c3..d17029c 100644
@@ -105,6 +105,8 @@ void intel_uc_init_early(struct drm_i915_private *dev_priv)
 {
 	struct intel_guc *guc = &dev_priv->guc;
 
+	intel_guc_ct_init_early(&guc->ct);
+
 	mutex_init(&guc->send_mutex);
 	guc->send = intel_guc_send_nop;
 	guc->notify = guc_write_irq_trigger;
@@ -288,14 +290,24 @@ static void guc_init_send_regs(struct intel_guc *guc)
 
 static int guc_enable_communication(struct intel_guc *guc)
 {
-	/* XXX: placeholder for alternate setup */
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
+
 	guc_init_send_regs(guc);
+
+	if (HAS_GUC_CT(dev_priv))
+		return intel_guc_enable_ct(guc);
+
 	guc->send = intel_guc_send_mmio;
 	return 0;
 }
 
 static void guc_disable_communication(struct intel_guc *guc)
 {
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
+
+	if (HAS_GUC_CT(dev_priv))
+		intel_guc_disable_ct(guc);
+
 	guc->send = intel_guc_send_nop;
 }
 
@@ -442,6 +454,11 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len)
 	GEM_BUG_ON(!len);
 	GEM_BUG_ON(len > guc->send_regs.count);
 
+	/* If CT is available, we expect to use MMIO only during init/fini */
+	GEM_BUG_ON(HAS_GUC_CT(dev_priv) &&
+		*action != INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER &&
+		*action != INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER);
+
 	mutex_lock(&guc->send_mutex);
 	intel_uncore_forcewake_get(dev_priv, guc->send_regs.fw_domains);
 
drivers/gpu/drm/i915/intel_uc.h +2 -1
index 930f2e1..fb1d640 100644
@@ -27,7 +27,7 @@
 #include "intel_guc_fwif.h"
 #include "i915_guc_reg.h"
 #include "intel_ringbuffer.h"
-
+#include "intel_guc_ct.h"
 #include "i915_vma.h"
 
 struct drm_i915_gem_request;
@@ -173,6 +173,7 @@ struct intel_guc_log {
 struct intel_guc {
 	struct intel_uc_fw fw;
 	struct intel_guc_log log;
+	struct intel_guc_ct ct;
 
 	/* intel_guc_recv interrupt related state */
 	bool interrupts_enabled;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v4 2/3
#3 lore raw

Re: [PATCH v4 2/3] drm/i915/guc: Introduce buffer based cmd transport

Quoted 19 lines · Michal Wajdeczko

Buffer based command transport can replace MMIO based mechanism. It may be used to perform host-2-guc and guc-to-host communication.

Portions of this patch are based on work by:
Michel Thierry <[email protected]> Robert Beckett <[email protected]> Daniele Ceraolo Spurio <[email protected]>

v2: use gem_object_pin_map (Chris)
don't use DEBUG_RATELIMITED (Chris)
don't track action stats (Chris)
simplify next fence (Chris)
use READ_ONCE (Chris)
move blob allocation to new function (Chris)

v3: use static owner id (Daniele)
v4: but keep channel initialization generic (Daniele)
and introduce owner_sub_id (Daniele)

Quoted 6 lines
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>

---

minor possible bikeshed below.

drivers/gpu/drm/i915/intel_guc_ct.h line 79

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +10 -0
+
+/** Holds all command transport channels.
+ *
+ * @host_channel: main channel used by the host
+ */
+struct intel_guc_ct {
+	struct intel_guc_ct_channel host_channel;
+	/* other channels are tbd */
+};
+

We could also use an array if we modify the enum:

	enum {
		CTB_OWNER_HOST = 0,
		/* other channels are tbd */
		CTB_MAX_CHANNELS
	};

and use:

	struct intel_guc_ct_channel ct_channels[CTB_MAX_CHANNELS];

we can then address the host specific one with:

	&guc.ct_channels[CTB_OWNER_HOST];

Thanks,
Daniele
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH v4 2/3] drm/i915/guc: Introduce buffer based cmd transport

Quoted 52 lines · Daniele Ceraolo Spurio
Quoted 19 lines · Michal Wajdeczko

Buffer based command transport can replace MMIO based mechanism. It may be used to perform host-2-guc and guc-to-host communication.

Portions of this patch are based on work by:
Michel Thierry <[email protected]> Robert Beckett <[email protected]> Daniele Ceraolo Spurio <[email protected]>

v2: use gem_object_pin_map (Chris)
don't use DEBUG_RATELIMITED (Chris)
don't track action stats (Chris)
simplify next fence (Chris)
use READ_ONCE (Chris)
move blob allocation to new function (Chris)

v3: use static owner id (Daniele)
v4: but keep channel initialization generic (Daniele)
and introduce owner_sub_id (Daniele)

Quoted 6 lines
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>

---

minor possible bikeshed below.

drivers/gpu/drm/i915/intel_guc_ct.h line 79

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +10 -0
+
+/** Holds all command transport channels.
+ *
+ * @host_channel: main channel used by the host
+ */
+struct intel_guc_ct {
+	struct intel_guc_ct_channel host_channel;
+	/* other channels are tbd */
+};
+

We could also use an array if we modify the enum:

	enum {
		CTB_OWNER_HOST = 0,
		/* other channels are tbd */
		CTB_MAX_CHANNELS
	};
Quoted 8 lines

and use:

	struct intel_guc_ct_channel ct_channels[CTB_MAX_CHANNELS];

we can then address the host specific one with:

	&guc.ct_channels[CTB_OWNER_HOST];

I would wait with this approach until we actually introduce other channels and have more than single entry in this array.

Thanks,
Michal
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

PATCH v4 3/3 HAX Enable GuC loading & submission

In reply to Michal Wajdeczko

This is just for CI testing, *** DO NOT MERGE ***

---
 drivers/gpu/drm/i915/i915_params.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_params.c +4 -4
index b6a7e36..abd2894 100644
@@ -56,8 +56,8 @@ struct i915_params i915 __read_mostly = {
 	.verbose_state_checks = 1,
 	.nuclear_pageflip = 0,
 	.edp_vswing = 0,
-	.enable_guc_loading = 0,
-	.enable_guc_submission = 0,
+	.enable_guc_loading = 1,
+	.enable_guc_submission = 1,
 	.guc_log_level = -1,
 	.guc_firmware_path = NULL,
 	.huc_firmware_path = NULL,
@@ -221,12 +221,12 @@ MODULE_PARM_DESC(edp_vswing,
 module_param_named_unsafe(enable_guc_loading, i915.enable_guc_loading, int, 0400);
 MODULE_PARM_DESC(enable_guc_loading,
 		"Enable GuC firmware loading "
-		"(-1=auto, 0=never [default], 1=if available, 2=required)");
+		"(-1=auto, 0=never, 1=if available [default], 2=required)");
 
 module_param_named_unsafe(enable_guc_submission, i915.enable_guc_submission, int, 0400);
 MODULE_PARM_DESC(enable_guc_submission,
 		"Enable GuC submission "
-		"(-1=auto, 0=never [default], 1=if available, 2=required)");
+		"(-1=auto, 0=never, 1=if available [default], 2=required)");
 
 module_param_named(guc_log_level, i915.guc_log_level, int, 0400);
 MODULE_PARM_DESC(guc_log_level,
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

✓ Fi.CI.BAT: success for Introduce buffer based cmd transport (rev2)

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: Introduce buffer based cmd transport (rev2)
URL : https://patchwork.freedesktop.org/series/24786/
State : success

== Summary ==

Series 24786v2 Introduce buffer based cmd transport
https://patchwork.freedesktop.org/api/1.0/series/24786/revisions/2/mbox/

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:439s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:433s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:501s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:482s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:479s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:423s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:411s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:414s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:486s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:466s
fi-kbl-7500u     total:278  pass:255  dwarn:5   dfail:0   fail:0   skip:18  time:448s
fi-kbl-7560u     total:278  pass:263  dwarn:5   dfail:0   fail:0   skip:10  time:554s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:455s
fi-skl-6700hq    total:278  pass:239  dwarn:0   dfail:1   fail:17  skip:21  time:419s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:457s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:481s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:421s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:530s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:398s

fi-bsw-n3050 failed to collect. IGT log at Patchwork_4807/fi-bsw-n3050/igt.log

af161db6dba99f58096174c0456f211aab3976ad drm-tip: 2017y-05m-25d-01h-32m-39s UTC integration manifest a5c35fd HAX Enable GuC loading & submission
4f9e76e drm/i915/guc: Introduce buffer based cmd transport
e047a77 drm/i915/guc: Disable send function on fini

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4807/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx