Skip to content

Commit

Permalink
drm/i915/guc: Introduce guc_is_ready
Browse files Browse the repository at this point in the history
We already have guc_is_running function, but it only reflects
firmware status, while to fully use GuC we need to know if we've
already established communication with it.

v2: also s/intel_guc_is_running/intel_guc_is_fw_running (Chris)

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131153706.109528-1-michal.wajdeczko@intel.com
  • Loading branch information
Michal Wajdeczko authored and Chris Wilson committed Jan 31, 2020
1 parent b0e02a7 commit e85de17
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
7 changes: 6 additions & 1 deletion drivers/gpu/drm/i915/gt/uc/intel_guc.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,16 @@ static inline bool intel_guc_is_enabled(struct intel_guc *guc)
return intel_uc_fw_is_enabled(&guc->fw);
}

static inline bool intel_guc_is_running(struct intel_guc *guc)
static inline bool intel_guc_is_fw_running(struct intel_guc *guc)
{
return intel_uc_fw_is_running(&guc->fw);
}

static inline bool intel_guc_is_ready(struct intel_guc *guc)
{
return intel_guc_is_fw_running(guc) && intel_guc_ct_enabled(&guc->ct);
}

static inline int intel_guc_sanitize(struct intel_guc *guc)
{
intel_uc_fw_sanitize(&guc->fw);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void intel_guc_ct_disable(struct intel_guc_ct *ct)

ct->enabled = false;

if (intel_guc_is_running(guc)) {
if (intel_guc_is_fw_running(guc)) {
ct_deregister_buffer(ct, INTEL_GUC_CT_BUFFER_TYPE_SEND);
ct_deregister_buffer(ct, INTEL_GUC_CT_BUFFER_TYPE_RECV);
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/i915/gt/uc/intel_uc.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ static void __uc_fini_hw(struct intel_uc *uc)
{
struct intel_guc *guc = &uc->guc;

if (!intel_guc_is_running(guc))
if (!intel_guc_is_fw_running(guc))
return;

if (intel_uc_supports_guc_submission(uc))
Expand All @@ -527,7 +527,7 @@ void intel_uc_reset_prepare(struct intel_uc *uc)
{
struct intel_guc *guc = &uc->guc;

if (!intel_guc_is_running(guc))
if (!intel_guc_is_ready(guc))
return;

guc_disable_communication(guc);
Expand All @@ -539,7 +539,7 @@ void intel_uc_runtime_suspend(struct intel_uc *uc)
struct intel_guc *guc = &uc->guc;
int err;

if (!intel_guc_is_running(guc))
if (!intel_guc_is_ready(guc))
return;

err = intel_guc_suspend(guc);
Expand All @@ -554,7 +554,7 @@ void intel_uc_suspend(struct intel_uc *uc)
struct intel_guc *guc = &uc->guc;
intel_wakeref_t wakeref;

if (!intel_guc_is_running(guc))
if (!intel_guc_is_ready(guc))
return;

with_intel_runtime_pm(uc_to_gt(uc)->uncore->rpm, wakeref)
Expand All @@ -566,7 +566,7 @@ static int __uc_resume(struct intel_uc *uc, bool enable_communication)
struct intel_guc *guc = &uc->guc;
int err;

if (!intel_guc_is_running(guc))
if (!intel_guc_is_fw_running(guc))
return 0;

/* Make sure we enable communication if and only if it's disabled */
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ static int i915_guc_log_relay_open(struct inode *inode, struct file *file)
struct intel_guc *guc = &i915->gt.uc.guc;
struct intel_guc_log *log = &guc->log;

if (!intel_guc_is_running(guc))
if (!intel_guc_is_ready(guc))
return -ENODEV;

file->private_data = log;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@ i915_coherent_map_type(struct drm_i915_private *i915)
static inline bool intel_guc_submission_is_enabled(struct intel_guc *guc)
{
return intel_guc_is_submission_supported(guc) &&
intel_guc_is_running(guc);
intel_guc_is_ready(guc);
}

#endif

0 comments on commit e85de17

Please sign in to comment.