drm/i915/guc: Disable send function on fini
Subsystems (2)
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)
--- drivers/gpu/drm/i915/intel_uc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uc.c +6 -1
@@ -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
PATCH v2 2/3 drm/i915/guc: 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.
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)
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 2 + drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/intel_guc_ct.c | 468 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_guc_ct.h | 97 +++++++ drivers/gpu/drm/i915/intel_guc_fwif.h | 44 ++++ drivers/gpu/drm/i915/intel_uc.c | 25 +- drivers/gpu/drm/i915/intel_uc.h | 4 +- 8 files changed, 641 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
@@ -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.c +2 -0
@@ -869,6 +869,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,i915_workqueues_cleanup (dev_priv); err_engines:i915_engines_cleanup (dev_priv); +intel_uc_cleanup (dev_priv);return ret; }
@@ -883,6 +884,7 @@ static void i915_driver_cleanup_early(struct drm_i915_private *dev_priv)intel_irq_fini (dev_priv);i915_workqueues_cleanup (dev_priv);i915_engines_cleanup (dev_priv); +intel_uc_cleanup (dev_priv); }static int i915_mmio_setup (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -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 +468 -0
468 lines not on this page · raw message
drivers/gpu/drm/i915/intel_guc_ct.h new file +97 -0
97 lines not on this page · raw message
drivers/gpu/drm/i915/intel_guc_fwif.h +44 -0
56 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.c +24 -1
@@ -108,6 +108,14 @@ void intel_uc_init_early(struct drm_i915_private *dev_priv)mutex_init (&guc->send_mutex); guc->send = intel_guc_send_nop; guc->notify = guc_write_irq_trigger; +intel_guc_ct_init_early (&guc->ct); +} + +void intel_uc_cleanup (struct drm_i915_private *dev_priv) +{ +struct intel_guc *guc = &dev_priv->guc; + +intel_guc_ct_cleanup (&guc->ct); } static void fetch_uc_fw(struct drm_i915_private *dev_priv,
@@ -288,14 +296,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 +460,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 +3 -1
@@ -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;
@@ -214,6 +215,7 @@ struct intel_huc {/* intel_uc.c */ void intel_uc_sanitize_options (struct drm_i915_private *dev_priv);void intel_uc_init_early (struct drm_i915_private *dev_priv); +void intel_uc_cleanup (struct drm_i915_private *dev_priv);void intel_uc_init_fw (struct drm_i915_private *dev_priv);void intel_uc_fini_fw (struct drm_i915_private *dev_priv);int intel_uc_init_hw (struct drm_i915_private *dev_priv);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/3 HAX Enable GuC loading & submission
In reply to Michal WajdeczkoThis 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
@@ -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
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [v2,1/3] drm/i915/guc: Disable send function on fini
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: series starting with [v2,1/3] drm/i915/guc: Disable send function on fini
URL : https://patchwork.freedesktop.org/series/24715/
State : failure
== Summary ==
Series 24715v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/24715/revisions/1/mbox/
Test gem_close_race:
Subgroup basic-threads:
pass -> INCOMPLETE (fi-skl-6700k)
Test gem_ctx_create:
Subgroup basic-files:
pass -> INCOMPLETE (fi-skl-6260u)
pass -> INCOMPLETE (fi-skl-6770hq)
pass -> INCOMPLETE (fi-kbl-7500u)
Test gem_ctx_switch:
Subgroup basic-default:
pass -> INCOMPLETE (fi-skl-6700hq)
pass -> INCOMPLETE (fi-skl-gvtdvm)
pass -> INCOMPLETE (fi-bxt-j4205)
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
fail -> PASS (fi-snb-2600) fdo#100007fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:440s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:434s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:593s fi-bxt-j4205 total:21 pass:20 dwarn:0 dfail:0 fail:0 skip:0 fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:492s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:487s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:413s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:408s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:415s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:505s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:460s fi-kbl-7500u total:17 pass:16 dwarn:0 dfail:0 fail:0 skip:0 fi-skl-6260u total:17 pass:16 dwarn:0 dfail:0 fail:0 skip:0 fi-skl-6700hq total:21 pass:20 dwarn:0 dfail:0 fail:0 skip:0 fi-skl-6700k total:12 pass:11 dwarn:0 dfail:0 fail:0 skip:0 fi-skl-6770hq total:17 pass:16 dwarn:0 dfail:0 fail:0 skip:0 fi-skl-gvtdvm total:21 pass:20 dwarn:0 dfail:0 fail:0 skip:0 fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:539s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:403s
d6a919d390561ba24c01e3f4119426503c2670ce drm-tip: 2017y-05m-19d-14h-47m-13s UTC integration manifest bcfb6fa HAX Enable GuC loading & submission
00e06b5 drm/i915/guc: Introduce buffer based cmd transport
c00a148 drm/i915/guc: Disable send function on fini
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4757/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 2/3 drm/i915/guc: Introduce buffer based cmd transport
In reply to Michal WajdeczkoBuffer 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)
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/intel_guc_ct.c | 455 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_guc_ct.h | 80 ++++++ drivers/gpu/drm/i915/intel_guc_fwif.h | 42 ++++ drivers/gpu/drm/i915/intel_uc.c | 17 +- drivers/gpu/drm/i915/intel_uc.h | 3 +- 7 files changed, 598 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
@@ -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
@@ -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 +455 -0
455 lines not on this page · raw message
drivers/gpu/drm/i915/intel_guc_ct.h new file +80 -0
80 lines not on this page · raw message
drivers/gpu/drm/i915/intel_guc_fwif.h +42 -0
54 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.c +16 -1
@@ -288,14 +288,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 +452,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
@@ -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
Re: [PATCH v3 2/3] drm/i915/guc: Introduce buffer based cmd transport
<snip>
Quoted 47 lines
drivers/gpu/drm/i915/intel_guc_ct.c new file +47
-0+ +static int ctch_init (struct intel_guc *guc, +struct intel_guc_ct_channel *ctch) +{ +struct i915_vma *vma; +void *blob; +int err; +int i; + +GEM_BUG_ON (ctch->vma); + +/* We allocate 1 page to hold both descriptors and both buffers. +* ___________..................... +* |desc (SEND)| : +* |___________| PAGE/4 +* :___________....................: +* |desc (RECV)| : +* |___________| PAGE/4 +* :_______________________________: +* |cmds (SEND) | +* | PAGE/4 +* |_______________________________| +* |cmds (RECV) | +* | PAGE/4 +* |_______________________________| +* +* Each message can use a maximum of 32 dwords and we don't expect to +* have more than 1 in flight at any time, so we have enough space. +* Some logic further ahead will rely on the fact that there is only 1 +* page and that it is always mapped, so if the size is changed the +* other code will need updating as well. +*/ + +/* allocate vma */ + vma =intel_guc_allocate_vma (guc,PAGE_SIZE ); +if (IS_ERR (vma)) { + err =PTR_ERR (vma); + goto err_out; + } + ctch->vma = vma; + +/* map first page */ + blob =i915_gem_object_pin_map (vma->obj,I915_MAP_WB ); +if (IS_ERR (blob)) { + err =PTR_ERR (blob); + goto err_vma; + }
drivers/gpu/drm/i915/intel_guc_ct.c line 163
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_ct.c new file +10
-0+DRM_DEBUG_DRIVER ("CT: vma base=%#x\n" ,guc_ggtt_offset (ctch->vma)); + +/* store pointers to desc and cmds */ +for (i =0 ; i <ARRAY_SIZE (ctch->ctbs); i++) { +GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); + ctch->ctbs[i].desc = blob +PAGE_SIZE /4 * i; + ctch->ctbs[i].cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + } + + ctch->owner =CTB_OWNER_HOST ;
mmmh, this function gets a generic struct intel_guc_ct_channel as input but here it assumes that it is the host one. If we want it to be generic then we need to pass the owner from outside, otherwise if we assume that this is the host channel then we can just do:
ctch = &guc->ct.channel;
without passing it as a parameter. My preference goes to option 1.
<snip>
Quoted 70 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +64
-0@@ -0,0 +1,80 @@ +/* +* Copyright © 2016-2017 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#ifndef _INTEL_GUC_CT_H_ +#define _INTEL_GUC_CT_H_ + +struct intel_guc ; +struct i915_vma ; + +#include "intel_guc_fwif.h" + +/** +* DOC: Command Transport (CT). +* +* Buffer based command transport is a replacement for MMIO based mechanism. +* It can be used to perform both host-2-guc and guc-to-host communication. +*/ + +/** Represents single command transport buffer. +* +* A single command transport buffer consists of two parts, the header +* record (command transport buffer descriptor) and the actual buffer which +* holds the commands. +* +* @desc: pointer to the buffer descriptor +* @cmds: pointer to the commands buffer +*/ +struct intel_guc_ct_buffer { +struct guc_ct_buffer_desc *desc; +u32 *cmds; +}; + +/** Represents pair of command transport buffers. +* +* Buffers go in pairs to allow bi-directional communication. +* To simplify the code we place both of them in the same vma. +* Buffers from the same pair must share unique owner id. +* +* @vma: pointer to the vma with pair of CT buffers +* @ctbs: buffers for sending(0) and receiving(1) commands +* @owner: unique identifier +* @next_fence: fence to be used with next send command +*/ +struct intel_guc_ct_channel {
drivers/gpu/drm/i915/intel_guc_ct.h line 74
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +10
-0+struct i915_vma *vma; +struct intel_guc_ct_buffer ctbs[2 ]; +u32 owner; +u32 next_fence; +}; + +/* */ +struct intel_guc_ct { +struct intel_guc_ct_channel channel; +};
Do we still need this structure now that there is no ida? Can't we just use intel_guc_ct_channel directly?
Quoted 18 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +6
-0+ +/* XXX: move to intel_uc.h ? don't fit there either */ +int intel_guc_enable_ct (struct intel_guc *guc); +void intel_guc_disable_ct (struct intel_guc *guc); + +#endif /* _INTEL_GUC_CT_H_ */ drivers/gpu/drm/i915/intel_guc_fwif.h +4
-0@@ -331,6 +331,46 @@ struct guc_stage_desc {u64 desc_private; } __packed; +/* +* Describes single command transport buffer. +* Used by both guc-master and clients. +*/
drivers/gpu/drm/i915/intel_guc_fwif.h struct guc_stage_desc { · line 347
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_fwif.h +10
-0+struct guc_ct_buffer_desc { +u32 addr;/* gfx address */ +u64 host_private;/* owner private data */ +u32 size;/* size in bytes */ +u32 head;/* offset updated by GuC*/ +u32 tail;/* offset updated by owner */ +u32 is_in_error;/* error indicator */ +u32 fence;/* fence updated by GuC */ +u32 status;/* status updated by GuC */ +u32 owner;/* id assigned by owner */
maybe something like
/* id of the channel owner */
might be clearer as the owner does not decide its id, it can only decide the sub_ids
drivers/gpu/drm/i915/intel_guc_fwif.h struct guc_stage_desc { · line 348
Quoted 1 line
drivers/gpu/drm/i915/intel_guc_fwif.h +1
-0+u32 reserved[6 ];
I know from our IM conversation that you prefer to not define the subtracking_id field because we do not use it. However, until now we're always kept our definitions in sync with the GuC FW so I'd prefer to do the same here. We can use a comment to make the field use clear even if we don't use it at the moment.
Thanks,
Daniele
Quoted 94 lines
drivers/gpu/drm/i915/intel_guc_fwif.h +27
-0+} __packed; + +/* Type of command transport buffer */ +#define INTEL_GUC_CT_BUFFER_TYPE_SEND 0x0u +#define INTEL_GUC_CT_BUFFER_TYPE_RECV 0x1u + +/* +* Definition of the command transport message header (DW0) +* +* bit[4..0] message len (in dwords) +* bit[7..5] reserved +* bit[8] write fence to desc +* bit[9] write status to H2G buff +* bit[10] send status (via G2H) +* bit[15..11] reserved +* bit[31..16] action code +*/ +#define GUC_CT_MSG_LEN_SHIFT 0 +#define GUC_CT_MSG_LEN_MASK 0x1F +#define GUC_CT_MSG_WRITE_FENCE_TO_DESC (1 << 8) +#define GUC_CT_MSG_WRITE_STATUS_TO_BUFF (1 << 9) +#define GUC_CT_MSG_SEND_STATUS (1 << 10) +#define GUC_CT_MSG_ACTION_SHIFT 16 +#define GUC_CT_MSG_ACTION_MASK 0xFFFF +#define GUC_FORCEWAKE_RENDER (1 << 0)#define GUC_FORCEWAKE_MEDIA (1 << 1)@@ -515,6 +555,8 @@ enum intel_guc_action {INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 ,INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 , +INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER =0x4505 , +INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER =0x4506 ,INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING =0x0E000 , INTEL_GUC_ACTION_LIMIT };drivers/gpu/drm/i915/intel_uc.c +16
-1@@ -288,14 +288,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 +452,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 +1
-1@@ -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 ;
drivers/gpu/drm/i915/intel_uc.h struct intel_guc_log { · line 179
Quoted 7 lines
drivers/gpu/drm/i915/intel_uc.h +1
-0@@ -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;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 2/3] drm/i915/guc: Introduce buffer based cmd transport
Quoted 65 lines · Daniele Ceraolo Spurio
<snip>
Quoted 47 lines
drivers/gpu/drm/i915/intel_guc_ct.c new file +47
-0+ +static int ctch_init (struct intel_guc *guc, +struct intel_guc_ct_channel *ctch) +{ +struct i915_vma *vma; +void *blob; +int err; +int i; + +GEM_BUG_ON (ctch->vma); + +/* We allocate 1 page to hold both descriptors and both buffers. +* ___________..................... +* |desc (SEND)| : +* |___________| PAGE/4 +* :___________....................: +* |desc (RECV)| : +* |___________| PAGE/4 +* :_______________________________: +* |cmds (SEND) | +* | PAGE/4 +* |_______________________________| +* |cmds (RECV) | +* | PAGE/4 +* |_______________________________| +* +* Each message can use a maximum of 32 dwords and we don't expect to +* have more than 1 in flight at any time, so we have enough space. +* Some logic further ahead will rely on the fact that there is only 1 +* page and that it is always mapped, so if the size is changed the +* other code will need updating as well. +*/ + +/* allocate vma */ + vma =intel_guc_allocate_vma (guc,PAGE_SIZE ); +if (IS_ERR (vma)) { + err =PTR_ERR (vma); + goto err_out; + } + ctch->vma = vma; + +/* map first page */ + blob =i915_gem_object_pin_map (vma->obj,I915_MAP_WB ); +if (IS_ERR (blob)) { + err =PTR_ERR (blob); + goto err_vma; + }drivers/gpu/drm/i915/intel_guc_ct.c line 163
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_ct.c new file +10
-0+DRM_DEBUG_DRIVER ("CT: vma base=%#x\n" ,guc_ggtt_offset (ctch->vma)); + +/* store pointers to desc and cmds */ +for (i =0 ; i <ARRAY_SIZE (ctch->ctbs); i++) { +GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); + ctch->ctbs[i].desc = blob +PAGE_SIZE /4 * i; + ctch->ctbs[i].cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + } + + ctch->owner =CTB_OWNER_HOST ;mmmh, this function gets a generic struct
intel_guc_ct_channelas input but here it assumes that it is the host one. If we want it to be generic then we need to pass the owner from outside, otherwise if we assume that this is the host channel then we can just do:
Quoted 4 lines
ctch = &guc->ct.channel;without passing it as a parameter. My preference goes to option 1.
Yeah, this was just too easy shortcut. Now as we agree that owners ID are static, I've moved this initialization to the reincarnated guc_ct_init_early(), where we'll be able to pre-assign owners to all future channels.
Quoted 78 lines
<snip>
Quoted 75 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +69
-0@@ -0,0 +1,80 @@ +/* +* Copyright © 2016-2017 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#ifndef _INTEL_GUC_CT_H_ +#define _INTEL_GUC_CT_H_ + +struct intel_guc ; +struct i915_vma ; + +#include "intel_guc_fwif.h" + +/** +* DOC: Command Transport (CT). +* +* Buffer based command transport is a replacement for MMIO based mechanism. +* It can be used to perform both host-2-guc and guc-to-host communication. +*/ + +/** Represents single command transport buffer. +* +* A single command transport buffer consists of two parts, the header +* record (command transport buffer descriptor) and the actual buffer which +* holds the commands. +* +* @desc: pointer to the buffer descriptor +* @cmds: pointer to the commands buffer +*/ +struct intel_guc_ct_buffer { +struct guc_ct_buffer_desc *desc; +u32 *cmds; +}; + +/** Represents pair of command transport buffers. +* +* Buffers go in pairs to allow bi-directional communication. +* To simplify the code we place both of them in the same vma. +* Buffers from the same pair must share unique owner id. +* +* @vma: pointer to the vma with pair of CT buffers +* @ctbs: buffers for sending(0) and receiving(1) commands +* @owner: unique identifier +* @next_fence: fence to be used with next send command +*/ +struct intel_guc_ct_channel { +struct i915_vma *vma; +struct intel_guc_ct_buffer ctbs[2 ]; +u32 owner; +u32 next_fence; +};
Quoted 8 lines
drivers/gpu/drm/i915/intel_guc_ct.h line 74
Quoted 5 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +5
-0+ +/* */ +struct intel_guc_ct { +struct intel_guc_ct_channel channel; +};Do we still need this structure now that there is no ida? Can't we just use
intel_guc_ct_channeldirectly?
Single ct_channel is our (low level) representation of the single CT channel. As we expect more possible channels, we must be prepared where we locate them. This higher level guc_ct struct will be a perfect place.
Quoted 37 lines
Quoted 19 lines
drivers/gpu/drm/i915/intel_guc_ct.h new file +6
-0+ +/* XXX: move to intel_uc.h ? don't fit there either */ +int intel_guc_enable_ct (struct intel_guc *guc); +void intel_guc_disable_ct (struct intel_guc *guc); + +#endif /* _INTEL_GUC_CT_H_ */ drivers/gpu/drm/i915/intel_guc_fwif.h +4
-0@@ -331,6 +331,46 @@ struct guc_stage_desc {u64 desc_private; } __packed; +/* +* Describes single command transport buffer. +* Used by both guc-master and clients. +*/ drivers/gpu/drm/i915/intel_guc_fwif.h struct guc_stage_desc { · line 347
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_fwif.h +10
-0+struct guc_ct_buffer_desc { +u32 addr;/* gfx address */ +u64 host_private;/* owner private data */ +u32 size;/* size in bytes */ +u32 head;/* offset updated by GuC*/ +u32 tail;/* offset updated by owner */ +u32 is_in_error;/* error indicator */ +u32 fence;/* fence updated by GuC */ +u32 status;/* status updated by GuC */ +u32 owner;/* id assigned by owner */ maybe something like
/* id of the channel owner */might be clearer as the owner does not decide its id, it can only decide the
sub_ids
Quoted 7 lines
drivers/gpu/drm/i915/intel_guc_fwif.h struct guc_stage_desc { · line 348
Quoted 1 line
drivers/gpu/drm/i915/intel_guc_fwif.h +1
-0+u32 reserved[6 ];I know from our IM conversation that you prefer to not define the
subtracking_idfield because we do not use it. However, until now we're always kept our definitions in sync with the GuC FW so I'd prefer to do the same here. We can use a comment to make the field use clear even if we don't use it at the moment.
Ok, I'll add this field.
Thanks,
Michal
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx