GuC code reorganization
Subsystems (2)
v3 cover GuC code reorganization
With HuC being imminent we could benefit from some code reorganization. There will be more uC than just GuC so we should name files accordingly.
There is also need to use host2guc_*() family of functions, which are currently limited to submission only.
In effect host2guc and guc2host entities were renamed and moved around.
v2: host2guc and guc2host renaming, init mutex in intel_uc_init()
v3: another round of review, general code scrub and slight renaming
Arkadiusz Hiler (5):
drm/i915: Rename intel_guc.h to intel_uc.h drm/i915/guc: Drop guc2host/host2guc from names drm/i915/guc: Move guc_{send,recv}() to intel_uc.c drm/i915/guc: Init send_mutex in intel_uc_init_early() drm/i915/guc: Remove spurious include
drivers/gpu/drm/i915/Makefile | 3 +-
drivers/gpu/drm/i915/i915_drv.c | 2 +
drivers/gpu/drm/i915/i915_drv.h | 2 +-
drivers/gpu/drm/i915/i915_guc_reg.h | 4 +-
drivers/gpu/drm/i915/i915_guc_submission.c | 170 ++++-------------------
drivers/gpu/drm/i915/i915_irq.c | 4 +-
drivers/gpu/drm/i915/intel_guc_fwif.h | 46 +++---
drivers/gpu/drm/i915/intel_guc_loader.c | 2 +-
drivers/gpu/drm/i915/intel_uc.c | 143 +++++++++++++++++++
drivers/gpu/drm/i915/{intel_guc.h => intel_uc.h} | 20 ++-
10 files changed, 219 insertions(+), 177 deletions(-)
create mode 100644 drivers/gpu/drm/i915/intel_uc.c
rename drivers/gpu/drm/i915/{intel_guc.h => intel_uc.h} (91%)Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/5 drm/i915: Rename intel_guc.h to intel_uc.h
GuC is not the only one micro controller we have.
There are also HuC and DMC.
Making the file more general will help with code organization.
---
drivers/gpu/drm/i915/i915_drv.h | 2 +-
drivers/gpu/drm/i915/i915_guc_submission.c | 2 +-
drivers/gpu/drm/i915/intel_guc_loader.c | 2 +-
drivers/gpu/drm/i915/{intel_guc.h => intel_uc.h} | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
rename drivers/gpu/drm/i915/{intel_guc.h => intel_uc.h} (99%)drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -55,7 +55,7 @@#include "intel_bios.h" #include "intel_dpll_mgr.h" -#include "intel_guc.h" +#include "intel_uc.h" #include "intel_lrc.h" #include "intel_ringbuffer.h"
drivers/gpu/drm/i915/i915_guc_submission.c +1 -1
@@ -26,7 +26,7 @@#include <linux/debugfs.h> #include <linux/relay.h> #include "i915_drv.h" -#include "intel_guc.h" +#include "intel_uc.h" /** * DOC: GuC-based command submission
drivers/gpu/drm/i915/intel_guc_loader.c +1 -1
@@ -28,7 +28,7 @@*/ #include <linux/firmware.h> #include "i915_drv.h" -#include "intel_guc.h" +#include "intel_uc.h" /** * DOC: GuC-specific firmware loader
drivers/gpu/drm/i915/intel_uc.h renamed from drivers/gpu/drm/i915/intel_guc.h +2 -2
@@ -21,8 +21,8 @@* IN THE SOFTWARE. * */ -#ifndef _INTEL_GUC_H_ -#define _INTEL_GUC_H_ +#ifndef _INTEL_UC_H_ +#define _INTEL_UC_H_#include "intel_guc_fwif.h" #include "i915_guc_reg.h"
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 2/5 drm/i915/guc: Drop guc2host/host2guc from names
In reply to Arkadiusz HilerTo facilitate code reorganization we are renaming everything that contains guc2host or host2guc.
host2guc_action() and host2guc_action_response() become guc_send() and guc_recv() respectively.
Other host2guc_*() functions become simply guc_*().
Other entities are renamed basing on context they appear in:
- HOST2GUC_ACTIONS_& become INTEL_GUC_ACTION_*
- HOST2GUC_{INTERRUPT,TRIGGER} become GUC_SEND_{INTERRUPT,TRIGGER}
- GUC2HOST_STATUS_* become INTEL_GUC_STATUS_*
- GUC2HOST_MSG_* become INTEL_GUC_RECV_MSG_*
- action_lock becomes send_mutex
v2: drop unnecessary backslashes and use BIT() instead of '<<'
v3: shortened enum names and INTEL_GUC_STATUS_*
--- drivers/gpu/drm/i915/i915_guc_reg.h | 4 +- drivers/gpu/drm/i915/i915_guc_submission.c | 91 +++++++++++++++--------------- drivers/gpu/drm/i915/i915_irq.c | 4 +- drivers/gpu/drm/i915/intel_guc_fwif.h | 46 +++++++-------- drivers/gpu/drm/i915/intel_uc.h | 6 +- 5 files changed, 75 insertions(+), 76 deletions(-)
drivers/gpu/drm/i915/i915_guc_reg.h +2 -2
@@ -100,8 +100,8 @@ GUC_ENABLE_READ_CACHE_FOR_WOPCM_DATA | \ GUC_ENABLE_MIA_CLOCK_GATING) -#define HOST2GUC_INTERRUPT _MMIO(0xc4c8) -#define HOST2GUC_TRIGGER (1<<0) +#define GUC_SEND_INTERRUPT _MMIO(0xc4c8) +#define GUC_SEND_TRIGGER (1<<0)#define GEN8_DRBREGL (x) _MMIO(0x1000 + (x) * 8)#define GEN8_DRB_VALID (1<<0)
drivers/gpu/drm/i915/i915_guc_submission.c +45 -46
252 lines not on this page · raw message
drivers/gpu/drm/i915/i915_irq.c +2 -2
@@ -1683,8 +1683,8 @@ static void gen9_guc_irq_handler(struct drm_i915_private *dev_priv, u32 gt_iir)u32 msg, flush; msg =I915_READ (SOFT_SCRATCH (15 )); - flush = msg & (GUC2HOST_MSG_CRASH_DUMP_POSTED | -GUC2HOST_MSG_FLUSH_LOG_BUFFER ); + flush = msg & (INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED | +INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER );if (flush) {/* Clear the message bits that are handled */ I915_WRITE (SOFT_SCRATCH (15 ), msg & ~flush);
drivers/gpu/drm/i915/intel_guc_fwif.h +23 -23
63 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.h +3 -3
@@ -142,7 +142,7 @@ struct intel_guc {struct intel_guc_fw guc_fw;struct intel_guc_log log; -/* GuC2Host interrupt related state */ +/* intel_guc_recv interrupt related state */ bool interrupts_enabled;struct i915_vma *ads_vma;
@@ -164,8 +164,8 @@ struct intel_guc {uint64_t submissions[I915_NUM_ENGINES ];uint32_t last_seqno[I915_NUM_ENGINES ]; -/* To serialize the Host2GuC actions */ -struct mutex action_lock; +/* To serialize the intel_guc_send actions */ +struct mutex send_mutex; };/* intel_guc_loader.c */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 3/5 drm/i915/guc: Move guc_{send, recv}() to intel_uc.c
In reply to Arkadiusz Hilerguc_send(), guc_recv() and related functions were introduced in the i915_guc_submission.c and their scope was limited only to that file.
Those are not submission specific though.
This patch moves moves them to intel_uc.c with intel_ prefix added.
v2: rename intel_guc_log_* functions and clean up intel_guc_send usages
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/i915_guc_submission.c | 147 ++++------------------------- drivers/gpu/drm/i915/intel_uc.c | 138 +++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_uc.h | 9 ++ 4 files changed, 167 insertions(+), 130 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_uc.c
drivers/gpu/drm/i915/Makefile +2 -1
@@ -55,7 +55,8 @@ i915-y += i915_cmd_parser.o \ intel_uncore.o # general-purpose microcontroller (GuC) support -i915-y += intel_guc_loader.o \ +i915-y += intel_uc.o \ + intel_guc_loader.o \ i915_guc_submission.o # autogenerated null render state
drivers/gpu/drm/i915/i915_guc_submission.c +18 -129
214 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.c new file +138 -0
138 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.h +9 -0
@@ -168,6 +168,15 @@ struct intel_guc {struct mutex send_mutex; }; +/* intel_uc.c */ +bool intel_guc_recv (struct drm_i915_private *dev_priv,u32 *status); +int intel_guc_send (struct intel_guc *guc,const u32 *action,u32 len); +int intel_guc_sample_forcewake (struct intel_guc *guc, +struct i915_guc_client *client); +int intel_guc_log_flush_complete (struct intel_guc *guc); +int intel_guc_log_flush (struct intel_guc *guc); +int intel_guc_log_control (struct intel_guc *guc,u32 control_val); +/* intel_guc_loader.c */ extern void intel_guc_init (struct drm_device *dev);extern int intel_guc_setup (struct drm_device *dev);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 4/5 drm/i915/guc: Init send_mutex in intel_uc_init_early()
In reply to Arkadiusz Hilersend_mutex is used to serialise communication with GuC via intel_guc_send().
Since functions that utilize it are no longer limited to submission, initialization should be handled as a part of general setup.
v2: move initialization to *_early()
--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/i915_guc_submission.c | 1 - drivers/gpu/drm/i915/intel_uc.c | 5 +++++ drivers/gpu/drm/i915/intel_uc.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -817,6 +817,8 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,mutex_init (&dev_priv->wm.wm_mutex);mutex_init (&dev_priv->pps_mutex); +intel_uc_init_early (dev_priv); +i915_memcpy_init_early (dev_priv); ret =i915_workqueues_init (dev_priv);
drivers/gpu/drm/i915/i915_guc_submission.c +0 -1
@@ -1388,7 +1388,6 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv) guc->ctx_pool_vma = vma;ida_init (&guc->ctx_ids); -mutex_init (&guc->send_mutex);guc_log_create (guc);guc_addon_create (guc);
drivers/gpu/drm/i915/intel_uc.c +5 -0
@@ -26,6 +26,11 @@#include "i915_drv.h" #include "intel_uc.h" +void intel_uc_init_early (struct drm_i915_private *dev_priv) +{ +mutex_init (&dev_priv->guc.send_mutex); +} +/* * Read GuC command/status register (SOFT_SCRATCH_0) * Return true if it contains a response rather than a command
drivers/gpu/drm/i915/intel_uc.h +1 -0
@@ -169,6 +169,7 @@ struct intel_guc { };/* intel_uc.c */ +void intel_uc_init_early (struct drm_i915_private *dev_priv);bool intel_guc_recv (struct drm_i915_private *dev_priv,u32 *status);int intel_guc_send (struct intel_guc *guc,const u32 *action,u32 len); int intel_guc_sample_forcewake(struct intel_guc *guc,
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 5/5 drm/i915/guc: Remove spurious include
In reply to Arkadiusz Hiler--- drivers/gpu/drm/i915/i915_guc_submission.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -1
@@ -21,7 +21,6 @@* IN THE SOFTWARE. * */ -#include <linux/firmware.h> #include <linux/circ_buf.h> #include <linux/debugfs.h> #include <linux/relay.h>
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: success for GuC code reorganization (rev7)
In reply to Arkadiusz Hiler== Series Details ==
== Series Details ==
Series: GuC code reorganization (rev7)
URL : https://patchwork.freedesktop.org/series/15896/
State : success
== Summary ==
Series 15896v7 GuC code reorganization
https://patchwork.freedesktop.org/api/1.0/series/15896/revisions/7/mbox/
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a:
dmesg-warn -> PASS (fi-ilk-650)fi-bdw-5557u total:245 pass:230 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:245 pass:205 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:245 pass:217 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:245 pass:217 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:245 pass:213 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:245 pass:225 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:245 pass:225 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:245 pass:192 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:245 pass:223 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:245 pass:223 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7500u total:245 pass:223 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:245 pass:231 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:245 pass:224 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:245 pass:223 dwarn:1 dfail:0 fail:0 skip:21 fi-skl-6770hq total:245 pass:231 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:245 pass:213 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:245 pass:212 dwarn:0 dfail:0 fail:0 skip:33
4d904cb07bb992d4b5f3c8b8d00ed5297b774c0c drm-tip: 2016y-11m-28d-08h-24m-29s UTC integration manifest 983d62f drm/i915/guc: Remove spurious include
a22e8ac drm/i915/guc: Init send_mutex in intel_uc_init_early()
1ea7b6c drm/i915/guc: Move guc_{send, recv}() to intel_uc.cc7e9cb42 drm/i915/guc: Drop guc2host/host2guc from names
0f702d6 drm/i915: Rename intel_guc.h to intel_uc.h
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3123/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx